Changes between Version 1 and Version 2 of TechnicalDocumentation

Feb 7, 2011, 5:24:52 PM (11 years ago)



  • TechnicalDocumentation

    v1 v2  
    1 =Technical Documentation=
     1= Technical Documentation =
    3 ==Javascript Classes==
     3== Javascript Classes ==
    44The DbNP Project contains several Javascript classes which can dynamically add functionality to the pages which are developed. All of these classes rely on the jQuery library so make sure jQuery is available before using any of these classes. Note that I am using the Grails notation of including Javascript as the whole project is built in [ Grails]. Note that I tend to use ([ yui compressed]) minified Javascript and css for the production version of the application using an if statement.
    6 ===Ontology Chooser===
     6=== Ontology Chooser ===
    77The Ontology Chooser integrates with the [ NCBO Ontologies] and build upon the jQuery-ui autocomplete functionality.
    9 ====Code====
     9==== Code ====
    1010Source can be found here:
    1111[ ontology-chooser.js]
    1212[ ontology-chooser.min.js]
    14 ====Usage====
     14==== Usage ====
    1515First require the Ontology Chooser Javascript code in your project (note the minified Javascript):
    1616 <g:if env="production">
    4040 </script>
    42 ====After initialization====
     42==== After initialization ====
    4343After initializing the ontology fields and selecting one of the provided suggestions in the ontology autocomplete list, three hidden fields will be automatically inserted (if they do not yet exist) into the DOM. Or (if they ''do'' exist) their values will be changed accordingly:
    4444 <input type="hidden" name="fieldName-concept_id" value="..."/>
    5050Upon selecting one of the provided suggestions these hidden fields will be filled
    52 ====CSS====
     52==== CSS ====
    5353The following style sheet elements are used by the ontology chooser. This CSS is already included in the default application wide stylesheet. However, if one would like to implement this somewhere else, this CSS can be used to tweak the look and feel:
    5454 .ui-autocomplete .ui-menu-item {
    6464 }
    66 ====Example====
     66==== Example ====
    6767A screenshot of what the above example looks like:<br />
    6868[[Image:dbnp-ontology-all.png]]<br />
    7373 <input type="hidden" name="myOntology-full_id" value="" />
    75 ====Advanced Example====
     75==== Advanced Example ====
    7676For more advanced behavior, the Ontology Chooser can be instantiated to automatically show and hide a DOM element. This functionality is useful for showing a submit button when there are search results and the user has actually selected one of the results, or hide the submit button when there are no results. You can use this by instantiating the Ontology Chooser like this:
    7777 $(function() {
    8989 &lt;/div&gt;
    91 ===Select Add More===
     91=== Select Add More ===
    9292Select Add More is a Javascript class which is able to dynamically insert an entry to a select element which -upon selecting- causes a jQuery-ui dialog window to open. The look & feel and behaviour can be defined according to your needs.
    94 ====Code====
     94==== Code ====
    9595Source can be found here:
    9696[ SelectAddMore.js]
    9797[ SelectAddMore.min.js]
    99 ====Usage====
     99==== Usage ====
    100100First require the Javascript code in your project (note the minified Javascript):
    101101 <g:if env="production">
    127127This code will insert an option with 'add / modify..' as a label, and when selecting it a jQuery dialog will be opened with url '/gscf/templateEditor' and passing '?entity=...' as get variable (as defined by the ''vars'' argument). Whenever the dialog is closed, the ''onClose'' function is executed.
    129 ====GSCF Grails example====
     129==== GSCF Grails example ====
    130130Instead of writing the select element yourself, within the GSCF template you could also write the following code which automatically renders a select element with ''rel='template'''. Note that this results in a (Blowfish) encrypted entity for security sake:
    131131 <wizard:templateElement name="template" description="Template" entity="${dbnp.studycapturing.Study}" addDummy="true">
    133133 </wizard:templateElement>
    135 ====CSS====
     135==== CSS ====
    136136The actual style which is used by the Javascript class is user definable. In the example above the class is instantiated with the ''modify'' class. Below is the css for this example:
    145145 }
    147 ====Example====
     147==== Example  ====
    148148A screenshot of what the above example looks like:<br />
    154 ===Table Editor===
     154=== Table Editor ===
    155155The table editor provides multi-edit functionality to ''tables''. These tables are defined as a set of HTML elements which -in the user interface- show a table. This can be the table element, but could as well be a set of div elements.
    157 ====Code====
     157==== Code ====
    158158Source can be found here:
    159159[ table-editor.js]
    160160[ table-editor.min.js]
    162 ====Usage====
     162==== Usage ====
    163163First require the Javascript code in your project (note the minified Javascript):
    164164 <g:if env="production">
    191191''Note that this should be done after the DOM is ready (see the ontology chooser how to do that).''
    193 ====Example====
     193==== Example ====
    194194A screenshot of what it would look like:<br />
    195195[[Image:TableEditor.png]]<br />