dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #21053
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9866: Add category option user interface (DONE).
------------------------------------------------------------
revno: 9866
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2013-02-22 22:07:05 +0700
message:
Add category option user interface (DONE).
added:
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/categoryOption.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/addDataElementCategoryOptionForm.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/categoryOption.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/updateDataElementCategoryOptionForm.vm
modified:
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/index.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/menu.vm
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/index.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/index.vm 2012-03-04 13:26:24 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/index.vm 2013-02-22 15:07:05 +0000
@@ -12,6 +12,7 @@
#introListImgItem( "dataElementGroup.action" "data_element_group" "dataelement" )
#introListImgItem( "dataElementGroupEditor.action" "data_element_group_editor" "dataelement" )
#introListImgItem( "dataElementGroupSet.action" "data_element_group_set" "dataelement" )
+ #introListImgItem( "categoryOption.action" "data_element_category_option" "dataelement" )
#introListImgItem( "category.action" "data_element_category" "dataelement" )
#introListImgItem( "categoryCombo.action" "data_element_category_combo" "dataelement" )
#introListImgItem( "concept.action" "concept" "dataelement" )
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/categoryOption.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/categoryOption.js 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/categoryOption.js 2013-02-22 15:07:05 +0000
@@ -0,0 +1,58 @@
+
+function addCategoryOption()
+{
+ var value = $( '#categoryOptionName' ).val();
+
+ if ( value.length == 0 )
+ {
+ markInvalid( 'categoryOptionName', i18n_specify_category_option_name );
+ }
+ else if ( listContainsById( 'categoryOptionNames', value ) )
+ {
+ markInvalid( 'categoryOptionName', i18n_category_option_name_already_exists );
+ }
+ else
+ {
+ jQuery.postJSON( 'validateDataElementCategoryOption.action', { name:value }, function( json )
+ {
+ if ( json.response == 'success' )
+ {
+ addOptionById( 'categoryOptionNames', value, value );
+ setFieldValue( 'categoryOptionName', '' );
+ }
+ else
+ {
+ markInvalid( 'categoryOptionName', i18n_category_option_name_already_exists );
+ }
+ } );
+ }
+}
+
+function getSelectedCategoryOption()
+{
+ var name = $( '#categoryOptions :selected' ).text();
+ $( '#categoryOptionName' ).val( name );
+}
+
+function updateCategoryOptionName()
+{
+ var id = $( '#categoryOptions :selected' ).val();
+ var name = $( '#categoryOptionName' ).val();
+
+ var url = 'updateDataElementCategoryOption.action?id=' + id + '&name=' + name;
+
+ $.postUTF8( url, {}, function()
+ {
+ $( '#categoryOptions :selected' ).text( name );
+ } );
+}
+
+function saveCategoryOption( id, name )
+{
+ var url = 'addDataElementCategoryOption.action';
+
+ $.postJSON( url, { categoryId:id, name:name }, function( json )
+ {
+ addOptionById( 'categoryOptions', json.dataElementCategoryOption.id, name );
+ } );
+}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/menu.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/menu.vm 2011-03-18 14:14:32 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/menu.vm 2013-02-22 15:07:05 +0000
@@ -5,6 +5,7 @@
<li><a href="dataElementGroup.action">$i18n.getString( "data_element_group" ) </a></li>
<li><a href="dataElementGroupEditor.action">$i18n.getString( "data_element_group_editor" ) </a></li>
<li><a href="dataElementGroupSet.action">$i18n.getString( "data_element_group_set" ) </a></li>
+ <li><a href="categoryOption.action">$i18n.getString( "data_element_category_option" ) </a></li>
<li><a href="category.action">$i18n.getString( "data_element_category" ) </a></li>
<li><a href="categoryCombo.action">$i18n.getString( "data_element_category_combo" ) </a></li>
<li><a href="concept.action">$i18n.getString( "concept" ) </a></li>
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/addDataElementCategoryOptionForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/addDataElementCategoryOptionForm.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/addDataElementCategoryOptionForm.vm 2013-02-22 15:07:05 +0000
@@ -0,0 +1,50 @@
+<script type="text/javascript">
+ jQuery(document).ready( function() {
+ validation( 'addDataElementCategoryOptionForm', function(form){
+ form.submit();
+ });
+
+ checkValueIsExist( "name", "validateDataElementCategoryOption.action");
+ });
+
+ var i18n_specify_category_option_name = '$encoder.jsEscape( $i18n.getString( "specify_category_option_name" ) , "'")';
+ var i18n_category_option_name_already_exists = '$encoder.jsEscape( $i18n.getString( "category_option_name_already_exists" ) , "'")';
+ var i18n_must_include_category_option = '$encoder.jsEscape( $i18n.getString( "must_include_category_option" ) , "'")';
+</script>
+
+<h3>$i18n.getString( "create_new_data_element_category_option" )</h3>
+
+<form id="addDataElementCategoryOptionForm" name="addDataElementCategoryOptionForm" action="addDataElementCategoryOption.action" method="post">
+ <table>
+ <tr>
+ <th colspan="4">$i18n.getString( "details" )</th>
+ </tr>
+ <tr>
+ <td><label>$i18n.getString( "name" ) <em title="$i18n.getString( "required" )" class="required">*</em></label></td>
+ <td colspan="3"><input type="text" id="name" name="name" style="width:25em" class="{validate:{required:true,rangelength:[2,150]}}"/></td>
+ </tr>
+ <tr>
+ <td><label>$i18n.getString( "code" )</td>
+ <td colspan="3"><input type="text" id="code" name="code" style="width:25em"/></td>
+ </tr>
+ <tr>
+ <td><label>$i18n.getString( "concept_name" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
+ <td colspan="3">
+ <div style="inline">
+ <select id="conceptId" name="conceptId" style="width:305px" >
+ #foreach( $concept in $concepts )
+ <option value="$concept.id">$concept.name</option>
+ #end
+ </select>
+ </div>
+ </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td colspan="3">
+ <input type="submit" value="$i18n.getString( 'add' )" style="width:100px">
+ <input type="button" onclick="window.location.href='categoryOption.action'" value="$i18n.getString( 'cancel' )" style="width:100px"/></p>
+ </td>
+ </tr>
+ </table>
+</form>
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/categoryOption.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/categoryOption.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/categoryOption.vm 2013-02-22 15:07:05 +0000
@@ -0,0 +1,87 @@
+<script type="text/javascript">
+ jQuery(document).ready(function(){
+ tableSorter( 'categoryList' );
+ });
+
+ function showDataElementCategoryOptionDetails( categoryOptionId )
+ {
+ jQuery.post( 'getDataElementCategoryOption.action', { id: categoryOptionId } ,
+ function ( json ) {
+
+ setInnerHTML( 'nameField', json.dataElementCategoryOption.name );
+ setInnerHTML( 'codeField', json.dataElementCategoryOption.code );
+ setInnerHTML( 'conceptField', json.dataElementCategoryOption.concept );
+
+ showDetails();
+ });
+ }
+
+ function removeDataElementCategoryOption( categoryOptionId, categoryName )
+ {
+ removeItem( categoryOptionId, categoryName, i18n_confirm_delete, 'removeDataElementCategoryOption.action' );
+ }
+
+ var i18n_confirm_delete = '$encoder.jsEscape( $i18n.getString( "confirm_delete_data_element_category_option" ) , "'" )';
+</script>
+
+<h3>$i18n.getString( "data_element_category_option_management" ) #openHelp( "dataElementCategoryOption" )</h3>
+
+<table class="mainPageTable">
+ <tr>
+ <td style="vertical-align:top">
+ <table width="100%">
+ <tr>
+ <td>#filterDiv( "categoryOption" )</td>
+ <td colspan="3" style="text-align:right"><input type="button" value="$i18n.getString( 'add_new' )" onclick="window.location.href='showAddDataElementCategoryOptionForm.action'"/></td>
+ </tr>
+ </table>
+ <table class="listTable" id="categoryList">
+ <col/>
+ <col width="120px"/>
+ <thead>
+ <tr>
+ <th>$i18n.getString( "name" )</th>
+ <th class="{sorter: false}">$i18n.getString( "operations" )</th>
+ </tr>
+ </thead>
+ <tbody id="list">
+ #foreach( $dataElementCategoryOption in $dataElementCategoryOptions )
+ #if( $dataElementCategoryOption.id != $defaultCategory.id )
+ <tr id="tr${dataElementCategoryOption.id}">
+ <td onclick="showDataElementCategoryOptionDetails( $dataElementCategoryOption.id )">$encoder.htmlEncode( $dataElementCategoryOption.displayName )</td>
+ <td style="text-align:right">
+ <a href="showUpdateDataElementCategoryOptionForm.action?id=$dataElementCategoryOption.id" title="$i18n.getString( 'edit' )"><img src="../images/edit.png" alt="$i18n.getString( 'edit' )"/></a>
+ <a href="javascript:translate( 'DataElementCategoryOption', '$dataElementCategoryOption.id' )" title="$i18n.getString( 'translation_translate' )"><img src="../images/i18n.png" alt="$i18n.getString( 'translation_translate' )"/></a>
+ <a href="javascript:removeDataElementCategoryOption( '$dataElementCategoryOption.id', '$encoder.jsEncode( $dataElementCategoryOption.name )' )" title="$i18n.getString( 'remove' )"><img src="../images/delete.png" alt="$i18n.getString( 'remove' )"/></a>
+ <a href="javascript:showDataElementCategoryOptionDetails( $dataElementCategoryOption.id )" title="$i18n.getString( 'show_details' )"><img src="../images/information.png" alt="$i18n.getString( 'show_details' )"/></a>
+ </td>
+ </tr>
+ #end
+ #end
+ </tbody>
+
+ </table>
+ <p></p>
+ #parse( "/dhis-web-commons/paging/paging.vm" )
+ </td>
+ <td style="width:20em; padding-left:2em; vertical-align:top">
+
+ <div id="detailsArea" style="display:none">
+ <div style="float:right">
+ <a href="javascript:hideDetails()" title="$i18n.getString( 'hide_details' )"><img src="../images/hide.png" alt="$i18n.getString( 'hide_details' )"/></a>
+ </div>
+ <p><label>$i18n.getString( "name" ):</label><br/><span id="nameField"></span></p>
+ <p><label>$i18n.getString( "code" ):</label><br/><span id="codeField"></span></p>
+ <p><label>$i18n.getString( "concept" ):</label><br/><span id="conceptField"></span></p>
+ </div>
+
+ <div id="warningArea" style="position:fixed;right:10px;top:200px;display:none">
+ <div style="float:right">
+ <a href="javascript:hideWarning()" title="$i18n.getString( 'hide_warning' )"><img src="../images/hide.png" alt="$i18n.getString( 'hide_warning' )"/></a>
+ </div>
+ <p><span id="warningField"></span></p>
+ </div>
+
+ </td>
+ </tr>
+</table>
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/updateDataElementCategoryOptionForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/updateDataElementCategoryOptionForm.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/updateDataElementCategoryOptionForm.vm 2013-02-22 15:07:05 +0000
@@ -0,0 +1,58 @@
+<script type="text/javascript">
+ jQuery(document).ready( function() {
+ validation2( 'editDataElementCategoryOptionForm', function( form ){ form.submit()}, {
+ 'beforeValidateHandler': function() { listValidator( 'memberValidator', 'categoryOptions' ); },
+ 'rules': getValidationRules("dateElementCategoryOption")
+ });
+
+ checkValueIsExist( "name", "validateDataElementCategoryOption.action", {id: $dataElementCategoryOption.id});
+ });
+
+ var i18n_confirm_delete = '$encoder.jsEscape( $i18n.getString( "confirm_delete_data_element_category_option" ) , "'")';
+ var i18n_specify_category_option_name = '$encoder.jsEscape( $i18n.getString( "specify_category_option_name" ) , "'")';
+ var i18n_category_option_name_already_exists = '$encoder.jsEscape( $i18n.getString( "category_option_name_already_exists" ) , "'")';
+ var i18n_option_rename_successfully = '$encoder.jsEscape( $i18n.getString( "option_rename_successfully" ) , "'")';
+</script>
+
+<h3>$i18n.getString( "edit_data_element_category_option" )</h3>
+
+<form id="editDataElementCategoryOptionForm" name="editDataElementCategoryOptionForm" action="updateDataElementCategoryOption.action" method="post">
+
+ <input type="hidden" id="id" name="id" value="$dataElementCategoryOption.id"/>
+
+ <table>
+ <tr>
+ <th colspan="4">$i18n.getString( "details" )</th>
+ </tr>
+ <tr>
+ <td><label>$i18n.getString( "name" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
+ <td><input type="text" id="name" name="name" value="$!encoder.htmlEncode( $dataElementCategoryOption.name )" style="width:25em" class="{validate:{required:true,rangelength:[2,150]}}"/></td>
+ <td></td>
+ </tr>
+ <tr>
+ <td><label>$i18n.getString( "code" )</label></td>
+ <td colspan="3"><input type="text" id="code" name="code" style="width:25em" value="$!encoder.htmlEncode( $dataElementCategoryOption.code )" /></td>
+ </tr>
+ <tr>
+ <td><label>$i18n.getString( "concept_name" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
+ <td>
+ <div style="inline">
+ #set ( $conceptId = $!dataElementCategoryOption.concept.id )
+ <select id="conceptId" name="conceptId" style="width:305px" >
+ #foreach( $concept in $concepts )
+ <option value="$concept.id" #if ( $concept.id == $conceptId ) selected #end>$concept.name</option>
+ #end
+ </select>
+ </div>
+ </td>
+ <td></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td colspan="3">
+ <input type="submit" value="$i18n.getString( 'save' )" style="width:100px"/>
+ <input type="button" onclick="window.location.href='categoryOption.action'" value="$i18n.getString( 'cancel' )" style="width:100px"/></p>
+ </td>
+ </tr>
+ </table>
+</form>