=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/util/commons.js' --- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/util/commons.js 2010-02-03 11:08:38 +0000 +++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/util/commons.js 2010-02-03 16:07:25 +0000 @@ -593,3 +593,34 @@ $( "div#loaderDiv" ).hide(); $( "div#contentDiv" ).show(); } + +/** + * Deletes and removes an item from a table. The table row to be removed must have + * an identifier on the form "tr[itemId]". + * + * @param itemId the item identifier. + * @param itemName the item name. + * @param message the confirmation message. + * @param action the server action url for deleting the item. + */ +function removeItem( itemId, itemName, message, action ) +{ + var result = window.confirm( i18n_confirm_delete + "\n\n" + itemName ); + + if ( result ) + { + $.ajax({ + "url": action, + "data": { "id": itemId }, + "success": function() + { + $( "tr#tr" + itemId ).remove(); + + $( "table.listTable tbody tr" ).removeClass( "listRow listAlternateRow" ); + $( "table.listTable tbody tr:odd" ).addClass( "listAlternateRow" ); + $( "table.listTable tbody tr:even" ).addClass( "listRow" ); + + } + }); + } +} === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/dataElementGroup.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/dataElementGroup.vm 2010-02-03 14:17:49 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/dataElementGroup.vm 2010-02-03 16:07:25 +0000 @@ -20,20 +20,14 @@ $i18n.getString( "operations" ) - #set( $mark = false ) #foreach( $dataElementGroup in $dataElementGroups ) - - $encoder.htmlEncode( $dataElementGroup.name ) - $i18n.getString( - $i18n.getString( - $i18n.getString( - $i18n.getString( + + $encoder.htmlEncode( $dataElementGroup.name ) + $i18n.getString( + $i18n.getString( + $i18n.getString( + $i18n.getString( - #if( $mark ) - #set( $mark = false ) - #else - #set( $mark = true ) - #end #end === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElementGroup.js' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElementGroup.js 2010-01-22 03:15:07 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElementGroup.js 2010-02-03 16:07:25 +0000 @@ -22,14 +22,19 @@ // Remove data element group // ----------------------------------------------------------------------------- +/** + * DOM modifications at page load. + */ +$( document ).ready( function(){ + +$( "table.listTable tbody tr:odd" ).addClass( "listAlternateRow" ); +$( "table.listTable tbody tr:even" ).addClass( "listRow" ); + +}); + function removeDataElementGroup( dataElementGroupId, dataElementGroupName ) { - var result = window.confirm( i18n_confirm_delete + '\n\n' + dataElementGroupName ); - - if ( result ) - { - window.location.href = 'removeDataElementGroup.action?id=' + dataElementGroupId; - } + removeItem( dataElementGroupId, dataElementGroupName, i18n_confirm_delete, "removeDataElementGroup.action" ); } // -----------------------------------------------------------------------------