dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #09093
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2330: upgrade dataelement group editor/remove un-used function in common.js
------------------------------------------------------------
revno: 2330
committer: Tri <Tri@Tri-Laptop>
branch nick: dhis2
timestamp: Fri 2010-12-10 14:45:59 +0700
message:
upgrade dataelement group editor/remove un-used function in common.js
removed:
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/dataElementGroupEditorView1.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/dataElementGroupEditorView2.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElementGroupEditorView1.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElementGroupEditorView2.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/responseDataElementGroupSuccess.vm
added:
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/dataElementGroupEditorView.vm
modified:
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.ajax.js
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js
dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/dataElementGroup.js
dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/excelitems.js
dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/listDataElementGroup.vm
dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/report/dataelementExpressionBuilderForm.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroup/AddDataElementGroupAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroup/RemoveDataElementGroupAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroup/UpdateDataElementGroupAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/org/hisp/dhis/dd/i18n_module.properties
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/struts.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/indicatorExpressionBuilderForm.vm
dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/expressionBuilderForm.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-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.ajax.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.ajax.js 2010-09-08 10:40:26 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.ajax.js 2010-12-10 07:45:59 +0000
@@ -18,8 +18,10 @@
var operandsByDataElementGroup = new Array();
- this.loadDataElementGroups = function( target )
+ this.loadDataElementGroups = function( jQuerySelectionString )
{
+ var target = jQuery( jQuerySelectionString );
+
target.children().remove();
if( dataElementsGroups.length == 0 )
@@ -40,13 +42,15 @@
}
}
- this.loadAllDataElements = function( target )
+ this.loadAllDataElements = function( jQuerySelectionString )
{
- this.loadDataElementsByGroup( ALL_KEY, target);
+ this.loadDataElementsByGroup( ALL_KEY, jQuerySelectionString);
}
- this.loadDataElementsByGroup = function( id,target )
+ this.loadDataElementsByGroup = function( id, jQuerySelectionString )
{
+ var target = jQuery( jQuerySelectionString );
+
target.children().remove();
var des = dataElementGroupList[id];
@@ -72,8 +76,10 @@
}
- this.loadIndicatorGroups = function( target )
+ this.loadIndicatorGroups = function( jQuerySelectionString )
{
+ var target = jQuery( jQuerySelectionString );
+
target.children().remove();
if( indicatorGroups.length == 0 )
@@ -94,13 +100,15 @@
}
}
- this.loadAllIndicators = function( target )
- {
- this.loadIndicatorsByGroup( ALL_KEY, target);
+ this.loadAllIndicators = function( jQuerySelectionString )
+ {
+ this.loadIndicatorsByGroup( ALL_KEY, jQuerySelectionString );
}
- this.loadIndicatorsByGroup = function( id,target )
+ this.loadIndicatorsByGroup = function( id, jQuerySelectionString )
{
+ var target = jQuery( jQuerySelectionString );
+
target.children().remove();
var ins = indicatorGroupList[id];
@@ -125,8 +133,10 @@
}
}
- this.loadCategoryOptionComboByDE = function( id, target )
+ this.loadCategoryOptionComboByDE = function( id, jQuerySelectionString )
{
+ var target = jQuery( jQuerySelectionString );
+
target.children().remove();
var options = categoryOptionComboList[id];
@@ -152,8 +162,9 @@
}
- this.loadOperands = function (target, params )
+ this.loadOperands = function ( jQuerySelectionString, params )
{
+ var target = jQuery( jQuerySelectionString );
target.children().remove();
jQuery.getJSON('../dhis-web-commons-ajax-json/getOperands.action'
@@ -168,7 +179,7 @@
}
-var DataDictionary = new DataDictionary();
+var dataDictionary = new DataDictionary();
function DataElementGroup( id_, name_ )
{
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js 2010-12-06 22:38:32 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js 2010-12-10 07:45:59 +0000
@@ -683,6 +683,7 @@
for ( var i = 0; i < list.options.length; i++ )
{
+ list.options[i].selected = "selected";
params += paramName + "=" + list.options[i].value + "&";
}
@@ -1196,84 +1197,6 @@
hideById( id );
unLockScreen();
}
-
-/**
-* load All Data Element Groups into select combo box
-* @param selectorJQueryString is String fo jQuery selector, this string is anything but it must valid with jQuery format. This component will contain list of result*
-*/
-
-function loadDataElementGroups( selectorJQueryString )
-{
- DataDictionary.loadDataElementGroups( jQuery( selectorJQueryString ) );
-}
-
-/**
-* load data elements by data element group
-* @param selectorJQueryString is String fo jQuery selector, this string is anything but it must valid with jQuery format. This component will contain list of result*
-* @param id is data element group id
-*/
-function loadDataElementsByGroup( id, selectorJQueryString )
-{
- DataDictionary.loadDataElementsByGroup( id, jQuery( selectorJQueryString ) );
-}
-
-/**
-* load All Data Elements into select combo box
-* @param selectorJQueryString is String fo jQuery selector, this string is anything but it must valid with jQuery format. This component will contain list of result*
-*/
-function loadAllDataElements( selectorJQueryString )
-{
- DataDictionary.loadAllDataElements( jQuery( selectorJQueryString ) );
-}
-
-/**
-* load Category Option Combo of data element
-* @param selectorJQueryString is String fo jQuery selector, this string is anything but it must valid with jQuery format. This component will contain list of result*
-* @param id is data element id
-*/
-function loadCategoryOptionComboByDE( id, selectorJQueryString)
-{
- DataDictionary.loadCategoryOptionComboByDE( id, jQuery( selectorJQueryString ) );
-}
-
-/**
-* load all indicator groups into select combo box
-* @param selectorJQueryString is String fo jQuery selector, this string is anything but it must valid with jQuery format. This component will contain list of result*
-*/
-function loadIndicatorGroups( selectorJQueryString )
-{
- DataDictionary.loadIndicatorGroups( jQuery( selectorJQueryString ) );
-}
-
-/**
-* load indicators by group
-* @param selectorJQueryString is String fo jQuery selector, this string is anything but it must valid with jQuery format. This component will contain list of result*
-* @param id is indicator group id
-*/
-function loadIndicatorsByGroup( id, selectorJQueryString )
-{
- DataDictionary.loadIndicatorsByGroup( id, jQuery( selectorJQueryString ));
-}
-
-/**
-* load all indicator into select combo box
-* @param selectorJQueryString is String fo jQuery selector, this string is anything but it must valid with jQuery format. This component will contain list of result*
-*/
-function loadAllIndicators( selectorJQueryString )
-{
- DataDictionary.loadAllIndicators( jQuery( selectorJQueryString ) );
-}
-
-/**
-* load Operands
-* @param selectorJQueryString is String fo jQuery selector, this string is anything but it must valid with jQuery format. This component will contain list of result*
-* @param params is array of paramater {id : dataElementGroupId, aggregationOperator: sum or average} : this param is optional
-*/
-function loadOperands( selectorJQueryString, params )
-{
- DataDictionary.loadOperands( jQuery( selectorJQueryString ), params);
-}
-
/**
* Removes the opacity div from the document.
function deleteDivEffect()
=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/dataElementGroup.js'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/dataElementGroup.js 2010-12-03 05:41:34 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/dataElementGroup.js 2010-12-10 07:45:59 +0000
@@ -16,9 +16,9 @@
function openAddDataElementGroupOrder()
{
- loadDataElementGroups( "#availableDataElementGroups" );
+ dataDictionary.loadDataElementGroups( "#availableDataElementGroups" );
- loadDataElementsByGroup( "" , "#availableDataElements" );
+ dataDictionary.loadDataElementsByGroup( "" , "#availableDataElements" );
jQuery("#dataElementGroups").dialog("open");
@@ -77,9 +77,9 @@
listDataElement.append('<option value="' + id + '">' + name + '</option>');
}
- loadDataElementGroups( "#availableDataElementGroups" );
+ dataDictionary.loadDataElementGroups( "#availableDataElementGroups" );
- loadDataElementsByGroup( "" , "#availableDataElements" );
+ dataDictionary.loadDataElementsByGroup( "" , "#availableDataElements" );
jQuery("#dataElementGroups").dialog("open");
=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/excelitems.js'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/excelitems.js 2010-09-06 09:12:16 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/excelitems.js 2010-12-10 07:45:59 +0000
@@ -21,8 +21,8 @@
function openExpressionBuild() {
byId("formula").value = byId("expression").value;
- loadDataElementGroups( "#divExpression select[id=dataElementGroup]" );
- loadAllDataElements( "#divExpression select[id=availableDataElements]" );
+ dataDictionary.loadDataElementGroups( "#divExpression select[id=dataElementGroup]" );
+ dataDictionary.loadAllDataElements( "#divExpression select[id=availableDataElements]" );
$( "#availableDataElements" ).change(getOptionCombos);
showPopupWindowById( 'divExpression', 600, 300 );
@@ -30,7 +30,7 @@
// Get option combos for selected dataelement
function getOptionCombos() {
- loadCategoryOptionComboByDE( byId("availableDataElements").value, "#divExpression select[id=optionCombos]" );
+ dataDictionary.loadCategoryOptionComboByDE( byId("availableDataElements").value, "#divExpression select[id=optionCombos]" );
}
// Insert operand into the Formular textbox
@@ -62,8 +62,8 @@
// Open Expression Form
function caExpressionBuilderForm()
{
- loadDataElementGroups( "#divCategory select[id=dataElementGroup]" );
- loadAllDataElements( "#divCategory select[id=availableDataElements]" );
+ dataDictionary.loadDataElementGroups( "#divCategory select[id=dataElementGroup]" );
+ dataDictionary.loadAllDataElements( "#divCategory select[id=availableDataElements]" );
setFieldValue( 'divCategory textarea[id=formula]', getFieldValue('expression') );
showPopupWindowById( 'divCategory', 600, 320 );
@@ -87,7 +87,7 @@
// Get option combos for selected dataelement
function getOptionCombos(id, target) {
- loadCategoryOptionComboByDE( id, target);
+ dataDictionary.loadCategoryOptionComboByDE( id, target);
}
// -----------------------------------------------------------------------
@@ -96,7 +96,7 @@
function getDataElements( id, target )
{
- loadDataElementsByGroup( id, target );
+ dataDictionary.loadDataElementsByGroup( id, target );
}
// -----------------------------------------------------------------------
=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/listDataElementGroup.vm'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/listDataElementGroup.vm 2010-12-03 05:41:34 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/listDataElementGroup.vm 2010-12-10 07:45:59 +0000
@@ -58,7 +58,7 @@
<table width="100%">
<tr>
<td colspan="4">
- <select id="availableDataElementGroups" onchange="loadDataElementsByGroup( this.value , '#availableDataElements' )" style="width:300px"></select>
+ <select id="availableDataElementGroups" onchange="dataDictionary.loadDataElementsByGroup( this.value , '#availableDataElements' )" style="width:300px"></select>
</td>
</tr>
<tr>
=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/report/dataelementExpressionBuilderForm.vm'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/report/dataelementExpressionBuilderForm.vm 2010-10-07 07:10:30 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/report/dataelementExpressionBuilderForm.vm 2010-12-10 07:45:59 +0000
@@ -73,7 +73,7 @@
#if($reportExcel.isCategory())
getDataElementCategoryOptionCombos();
#else
- loadDataElementGroups("#dataelement select[id=groupSelect]") ;
+ dataDictionary.loadDataElementGroups("#dataelement select[id=groupSelect]") ;
#end
setFieldValue( 'dataelement textarea[id=formula]', getFieldValue('expression') );
@@ -87,15 +87,15 @@
function getDataElements( id, target )
{
#if($reportExcel.isCategory())
- loadDataElementsByGroup( id, target);
+ dataDictionary.loadDataElementsByGroup( id, target);
#else
- loadOperands( target, {id:id} );
+ dataDictionary.loadOperands( target, {id:id} );
#end
}
function getOptionCombos( id, targetId )
{
- loadCategoryOptionComboByDE( id, targetId );
+ dataDictionary.loadCategoryOptionComboByDE( id, targetId );
}
function getDataElementCategoryOptionCombos()
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroup/AddDataElementGroupAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroup/AddDataElementGroupAction.java 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroup/AddDataElementGroupAction.java 2010-12-10 07:45:59 +0000
@@ -27,7 +27,6 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
@@ -67,9 +66,9 @@
this.name = name;
}
- private Collection<String> groupMembers;
+ private Set<Integer> groupMembers = new HashSet<Integer>();
- public void setGroupMembers( Collection<String> groupMembers )
+ public void setGroupMembers( Set<Integer> groupMembers )
{
this.groupMembers = groupMembers;
}
@@ -93,13 +92,13 @@
{
dataElementGroup = new DataElementGroup( name );
- if ( groupMembers != null )
+ if ( !groupMembers.isEmpty() )
{
Set<DataElement> members = new HashSet<DataElement>( groupMembers.size() );
- for ( String id : groupMembers )
+ for ( Integer id : groupMembers )
{
- members.add( dataElementService.getDataElement( Integer.parseInt( id ) ) );
+ members.add( dataElementService.getDataElement( id ) );
}
dataElementGroup.setMembers( members );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroup/RemoveDataElementGroupAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroup/RemoveDataElementGroupAction.java 2010-09-25 21:09:08 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroup/RemoveDataElementGroupAction.java 2010-12-10 07:45:59 +0000
@@ -104,6 +104,8 @@
return ERROR;
}
}
+
+ message = i18n.getString( "item_deleted_successfully" );
return SUCCESS;
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroup/UpdateDataElementGroupAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroup/UpdateDataElementGroupAction.java 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroup/UpdateDataElementGroupAction.java 2010-12-10 07:45:59 +0000
@@ -74,12 +74,12 @@
this.name = name;
}
- private Collection<String> groupMembers;
+ private Set<Integer> groupMembers = new HashSet<Integer>();
- public void setGroupMembers( Collection<String> groupMembers )
+ public void setGroupMembers( Set<Integer> groupMembers )
{
this.groupMembers = groupMembers;
- }
+ }
// -------------------------------------------------------------------------
// Output
@@ -105,17 +105,17 @@
dataElementGroup.setName( name );
}
- if ( groupMembers != null && groupMembers.size() > 0 )
+ if ( !groupMembers.isEmpty() )
{
Set<DataElement> members = new HashSet<DataElement>();
- for ( String id : groupMembers )
+ for ( Integer id : groupMembers )
{
- members.add( dataElementService.getDataElement( Integer.parseInt( id ) ) );
+ members.add( dataElementService.getDataElement( id ) );
}
-
+
dataElementGroup.setMembers( members );
- }
+ }
dataElementService.updateDataElementGroup( dataElementGroup );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/org/hisp/dhis/dd/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/org/hisp/dhis/dd/i18n_module.properties 2010-12-09 06:15:40 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/org/hisp/dhis/dd/i18n_module.properties 2010-12-10 07:45:59 +0000
@@ -347,4 +347,6 @@
number_value_type = Number type
int = Integer
positiveNumber = Positive Number
-negativeNumber = Negative Number
\ No newline at end of file
+negativeNumber = Negative Number
+view_1 = View 1
+view_2 = View 2
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/struts.xml 2010-12-03 12:31:32 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/struts.xml 2010-12-10 07:45:59 +0000
@@ -102,67 +102,43 @@
<param name="onExceptionReturn">plainTextError</param>
</action>
- <!-- DataElementGroup Editor -->
-
+ <!-- DataElementGroup Editor -->
+
<action name="dataElementGroupEditor"
- class="org.hisp.dhis.dd.action.SwitchGroupEditorViewAction">
- <result name="view1" type="chain">dataElementGroupEditorView1
- </result>
- <result name="view2" type="chain">dataElementGroupEditorView2
- </result>
- </action>
-
- <action name="dataElementGroupEditorView1"
- class="org.hisp.dhis.dd.action.dataelement.GetDataElementListAction">
- <result name="success" type="velocity">/main.vm</result>
- <param name="page">/dhis-web-maintenance-datadictionary/dataElementGroupEditorView1.vm</param>
- <param name="menu">/dhis-web-maintenance-datadictionary/menu.vm</param>
- <param name="javascripts">javascript/dataElementGroupEditorView1.js</param>
- </action>
-
- <action name="dataElementGroupEditorView2"
- class="org.hisp.dhis.dd.action.dataelement.GetDataElementListAction">
- <result name="success" type="velocity">/main.vm</result>
- <param name="page">/dhis-web-maintenance-datadictionary/dataElementGroupEditorView2.vm</param>
- <param name="menu">/dhis-web-maintenance-datadictionary/menu.vm</param>
- <param name="javascripts">javascript/dataElementGroupEditorView2.js</param>
- </action>
+ class="org.hisp.dhis.commons.action.GetDataElementsAction">
+ <result name="success" type="chain">dataElementGroupEditorChain1</result>
+ </action>
+
+ <action name="dataElementGroupEditorChain1"
+ class="org.hisp.dhis.commons.action.GetDataElementGroupsAction">
+ <result name="success" type="chain">dataElementGroupEditorChain2</result>
+ </action>
+
+ <action name="dataElementGroupEditorChain2"
+ class="org.hisp.dhis.dd.action.NoAction">
+ <result name="success" type="velocity">/main.vm</result>
+ <param name="page">/dhis-web-maintenance-datadictionary/dataElementGroupEditorView.vm</param>
+ <param name="menu">/dhis-web-maintenance-datadictionary/menu.vm</param>
+ </action>
<action name="getAssignedDataElementGroups"
class="org.hisp.dhis.dd.action.dataelementgroup.GetAssignedGroupsByDataElementAction">
- <result name="success" type="velocity-xml">
- /dhis-web-maintenance-datadictionary/responseDataElementGroups.vm
- </result>
+ <result name="success" type="velocity-json">/dhis-web-commons/ajax/jsonDataElementGroups.vm</result>
</action>
<action name="asignGroupsForDataElement"
class="org.hisp.dhis.dd.action.dataelementgroup.AssignGroupsForDataElementAction">
- <result name="success" type="velocity-xml">
- /dhis-web-maintenance-datadictionary/responseSuccess.vm
- </result>
- </action>
-
- <action name="getDataElementGroupEditor"
- class="org.hisp.dhis.dd.action.dataelementgroup.GetDataElementGroupAction">
- <result name="success" type="velocity-xml">
- /dhis-web-maintenance-datadictionary/responseDataElementGroupSuccess.vm
- </result>
- </action>
+ <result name="success" type="velocity-json">/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
+ </action>
<action name="addDataElementGroupEditor"
class="org.hisp.dhis.dd.action.dataelementgroup.AddDataElementGroupAction">
- <result name="success" type="velocity-xml">
- /dhis-web-maintenance-datadictionary/responseAddDataElementGroupSuccess.vm
- </result>
- <param name="requiredAuthorities">F_DATAELEMENTGROUP_ADD</param>
+ <result name="success" type="velocity-json">/dhis-web-commons/ajax/jsonDataElementGroup.vm</result>
</action>
<action name="renameDataElementGroupEditor"
class="org.hisp.dhis.dd.action.dataelementgroup.UpdateDataElementGroupAction">
- <result name="success" type="velocity-xml">
- /dhis-web-maintenance-datadictionary/responseAddDataElementGroupSuccess.vm
- </result>
- <param name="requiredAuthorities">F_DATAELEMENTGROUP_UPDATE</param>
+ <result name="success" type="velocity-json">/dhis-web-commons/ajax/jsonDataElementGroup.vm</result>
</action>
<action name="deleteDataElemenGroupEditor"
@@ -171,15 +147,12 @@
/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
<result name="error" type="velocity-json">
/dhis-web-commons/ajax/jsonResponseError.vm</result>
- <param name="onExceptionReturn">plainTextError</param>
- <param name="requiredAuthorities">F_DATAELEMENTGROUP_DELETE</param>
+ <param name="onExceptionReturn">plainTextError</param>
</action>
<action name="updateDataElementGroupEditor"
class="org.hisp.dhis.dd.action.dataelementgroup.UpdateDataElementGroupAction">
- <result name="success" type="velocity-xml">
- /dhis-web-maintenance-datadictionary/responseSuccess.vm</result>
- <param name="requiredAuthorities">F_DATAELEMENTGROUP_UPDATE</param>
+ <result name="success" type="velocity-json">/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
</action>
<!-- DataElementGroup -->
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/dataElementGroupEditorView.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/dataElementGroupEditorView.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/dataElementGroupEditorView.vm 2010-12-10 07:45:59 +0000
@@ -0,0 +1,465 @@
+<h3>
+ $i18n.getString( "data_element_group_management" ) #openHelp( "dataElementGroupEditor" )
+</h3>
+<script>
+ jQuery(function(){
+ jQuery("#tabs").tabs();
+ });
+</script>
+
+<div id="tabs" style="position:absolute">
+ <ul>
+ <li><a href="#view_1">$i18n.getString( "view_1" )</a></li>
+ <li><a href="#view_2">$i18n.getString( "view_2" )</a></li>
+ </ul>
+ <div id="view_1">
+ <table >
+ <tr>
+ <th>$i18n.getString( "data_element_group" )</th>
+ <th></th>
+ <td rowspan="2"></td>
+ <th>$i18n.getString( "available_dataelements" )</th>
+
+ </tr>
+
+ <tr>
+ <td><input id="dataElementGroupsFilter" type="text" style="width:300px;" onkeyup="filterList(this.value, 'dataElementGroups');"/></td>
+ <td><input id="selecteDataElementsFilter" type="text" style="width:300px;" onkeyup="filterList(this.value, 'selectedDataElements');"/></td>
+ <td><input id="availableDataElementsFilter" type="text" style="width:300px;" onkeyup="loadAvailableDataElements()"/></td>
+ </tr>
+
+ <tr>
+ <td>
+ <select class="select" id="dataElementGroups" size="30" onchange="getDataElementsByGroup()"/>
+ </td>
+ <td>
+ <select class="select" id="selectedDataElements" multiple="multiple" size="30" ondblclick="moveSelectedById(this.id, 'availableDataElements');" />
+ </td>
+
+ <td>
+ <input type="button" value="<" onclick="moveSelectedById('availableDataElements', 'selectedDataElements');" style="width:42px"/><br/><br/>
+ <input type="button" value=">" onclick="moveSelectedById('selectedDataElements', 'availableDataElements');" style="width:42px"/>
+ </td>
+ <td>
+ <select class="select" id="availableDataElements" multiple="multiple" size="30" ondblclick="moveSelectedById(this.id, 'selectedDataElements');"/>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <a href="javascript:sortList( 'dataElementGroups', 'ASC' );"><img align="absmiddle" src="../images/sort_ascending.png" style="border:#666666 thin solid;cursor:pointer;width:20px;"/></a>
+ <a href="javascript:sortList( 'dataElementGroups', 'DES' );"><img align="absmiddle" src="../images/sort_descending.png" style="border:#666666 thin solid;cursor:pointer;width:20px;"/></a>
+ <input type="button" value="$i18n.getString( 'new' )" onclick="showAddGroup()" style="width:70px"/>
+ <input type="button" value="$i18n.getString( 'rename' )" onclick="showUpdateGroup()" style="width:70px"/>
+ <input type="button" value="$i18n.getString( 'delete' )" onclick="deleteDataElemenGroup()" style="width:70px"/>
+ </td>
+ <td>
+ <a href="javascript:sortList( 'selectedDataElements', 'ASC' );"><img align="absmiddle" src="../images/sort_ascending.png" style="border:#666666 thin solid;cursor:pointer;width:20px;"/></a>
+ <a href="javascript:sortList( 'selectedDataElements', 'DES' );"><img align="absmiddle" src="../images/sort_descending.png" style="border:#666666 thin solid;cursor:pointer;width:20px;"/></a>
+ <input type="button" value="$i18n.getString( 'update_dataelement_group_members' )" onclick="updateGroupMembers()"/>
+ </td>
+ <td></td>
+ <td>
+ <a href="javascript:sortList( 'availableDataElements', 'ASC' );"><img align="absmiddle" src="../images/sort_ascending.png" style="border:#666666 thin solid;cursor:pointer;width:20px;"/></a>
+ <a href="javascript:sortList( 'availableDataElements', 'DES' );"><img align="absmiddle" src="../images/sort_descending.png" style="border:#666666 thin solid;cursor:pointer;width:20px;"/></a>
+ </td>
+
+
+ </tr>
+ </table>
+ </div>
+ <div id="view_2">
+ <table>
+ <tr>
+ <th>$i18n.getString( "available_dataelements" )</th>
+ <th></th>
+ <td rowspan="2"></td>
+ <th>$i18n.getString( "available_groups" )</th>
+ </tr>
+
+ <tr>
+ <td><input id="availableDataElementsFilter" type="text" style="width:300px;" onkeyup="filterList(this.value, 'availableDataElements');"/></td>
+ <td><input id="assignedGroupsFilter" type="text" style="width:300px;" onkeyup="filterList(this.value, 'assignedGroups');"/></td>
+ <td><input id="availableGroupsFilter" type="text" style="width:300px;" onkeyup="filterList(this.value, 'availableGroups');"/></td>
+ </tr>
+
+ <tr>
+ <td>
+ <select class="select" id="availableDataElements2" size="30" onclick="getAssignedDataElementGroups()"/>
+ </td>
+ <td>
+ <select class="select" id="assignedGroups" multiple="multiple" size="30" ondblclick="moveSelectedById(this.id, 'availableGroups');"/>
+ </td>
+ <td>
+ <input type="button" value="<" onclick="moveSelectedById('availableGroups', 'assignedGroups');" style="width:42px"/><br/><br/>
+ <input type="button" value=">" onclick="moveSelectedById('assignedGroups', 'availableGroups');" style="width:42px"/>
+ </td>
+ <td>
+ <select name="select" size="30" multiple="multiple" class="select" id="availableGroups" ondblclick="moveSelectedById(this.id, 'assignedGroups');"/>
+ </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>
+ <input type="button" value="$i18n.getString( 'assign_groups_for_dataelement' )" onclick="assignGroupsForDataElement()"/>
+ </td>
+ <td></td>
+ <td>
+ <input type="button" value="$i18n.getString( 'new' )" onclick="showAddGroupView2()" style="width:70px"/>
+ <input type="button" value="$i18n.getString( 'rename' )" onclick="showUpdateGroupView2()" style="width:70px"/>
+ <input type="button" value="$i18n.getString( 'delete' )" onclick="deleteDataElemenGroupView2()" style="width:70px"/>
+ </td>
+ </tr>
+ </table>
+ </div>
+</div>
+
+<div id="addDataElementGroupForm">
+ <label>$i18n.getString( "name" )</label>
+ <input type="text" id="name" name="name" style="width:20em" class="{validate:{required:true}}"/>
+</div>
+
+<style>
+#addDataElementGroupForm{
+ width:300px;
+}
+#addDataElementGroupForm div{
+ float:left;
+}
+.select{
+ min-width:300px;
+}
+</style>
+
+
+
+<script type="text/javascript">
+ var i18n_select_dataelement_group = '$encoder.jsEscape( $i18n.getString( "select_dataelement_group" ) , "'")';
+ var i18n_confirm_delete = '$encoder.jsEscape( $i18n.getString( "confirm_delete_data_element_group" ) , "'")';
+ var i18n_member_of = '$encoder.jsEscape( $i18n.getString( "member_of" ) , "'")';
+ var i18n_update_success = '$encoder.jsEscape( $i18n.getString( "update_success" ) , "'")';
+
+ var dataElementGroups = new Array();
+ #foreach( $dataElementGroup in $dataElementGroups )
+ dataElementGroups['$dataElementGroup.id'] = '$encoder.jsEscape( $dataElementGroup.name, "'" )';
+ #end
+
+ var availableDataElements = new Array();
+ #foreach( $dataElement in $dataElements )
+ availableDataElements['$dataElement.id'] = '$encoder.jsEscape( $dataElement.name, "'" )';
+ #end
+ var selectedDataElements = new Array();
+
+
+ jQuery(function(){
+ loadAvailableGroups();
+ getDataElementsByGroup();
+ loadAvailableDataElements();
+ getAssignedDataElementGroups();
+
+ jQuery( "#addDataElementGroupForm" ).dialog({autoOpen:false, modal:true});
+ });
+
+ function loadAvailableDataElements()
+ {
+ var filter_1 = jQuery( '#view_1 #availableDataElementsFilter' ).val();
+ var filter_2 = jQuery( '#view_2 #availableDataElementsFilter' ).val();
+ var list_1 = jQuery( "#view_1 #availableDataElements" );
+ var list_2 = jQuery( "#view_2 #availableDataElements2" );
+ list_1.empty();
+ list_2.empty();
+
+ for( var id in availableDataElements)
+ {
+ var text = availableDataElements[id];
+ if( text.toLowerCase().indexOf( filter_1.toLowerCase() ) != -1)
+ {
+ list_1.append('<option value="' + id + '">' + text + '</option>' );
+ list_2.append('<option value="' + id + '">' + text + '</option>' );
+ }
+ }
+
+ list_1.find(":first").attr("selected", "selected");
+ list_2.find(":first").attr("selected", "selected");
+
+ }
+
+ function loadAvailableGroups()
+ {
+ var filter_1 = jQuery( '#view_1 #dataElementGroupsFilter' ).val();
+ var filter_2 = jQuery( '#view_2 #dataElementGroupsFilter' ).val();
+ var list_1 = jQuery( "#view_1 #dataElementGroups" );
+ var list_2 = jQuery( "#view_2 #availableGroups" );
+ list_1.empty();
+ list_2.empty();
+ for( var id in dataElementGroups)
+ {
+ var text = dataElementGroups[id];
+ if( text.toLowerCase().indexOf( filter_1.toLowerCase() ) != -1)
+ {
+ list_1.append('<option value="' + id + '">' + text + '</option>' );
+ list_2.append('<option value="' + id + '">' + text + '</option>' );
+ }
+ }
+ list_1.find(":first").attr("selected", "selected");
+ list_2.find(":first").attr("selected", "selected");
+ }
+
+ function getDataElementsByGroup()
+ {
+
+ loadAvailableDataElements();
+
+ var filter_1 = jQuery( '#view_1 #selecteDataElementsFilter' ).val();
+ var list_1 = jQuery( "#view_1 #selectedDataElements" );
+ list_1.empty();
+
+ jQuery.postJSON( "../dhis-web-commons-ajax-json/getDataElements.action", {
+ id: jQuery( '#view_1 #dataElementGroups' ).val()
+ }, function( json ){
+ jQuery.each( json.dataElements, function(i, item){
+ var text = item.name;
+ if( text.toLowerCase().indexOf( filter_1.toLowerCase() ) != -1)
+ {
+ list_1.append('<option value="' + item.id + '">' + text + '</option>' );
+ }
+ jQuery( "#view_1 #availableDataElements" ).children().each( function(k, it){
+ if( item.id == it.value )
+ {
+ jQuery(it).remove();
+ }
+ });
+ });
+ });
+ }
+
+ function showAddGroup()
+ {
+
+ jQuery( '#addDataElementGroupForm' ).dialog('option', 'title', '$encoder.jsEscape( $i18n.getString( "new" ) , "'")');
+ jQuery( '#addDataElementGroupForm' ).dialog('option', 'buttons', [{
+ text: '$encoder.jsEscape( $i18n.getString( "save" ) , "'")',
+ click: function(){
+ jQuery.postJSON( "validateDataElementGroup.action", {
+ name: function(){ return jQuery( '#addDataElementGroupForm #name' ).val(); }
+ }, function( json ){
+ if( json.response == 'success' ){
+ jQuery.postJSON( "addDataElementGroupEditor.action", {
+ name: function(){ return jQuery( '#addDataElementGroupForm #name' ).val(); }
+ }, function( json ){
+ dataElementGroups[json.dataElementGroup.id] = json.dataElementGroup.name;
+ loadAvailableGroups();
+ loadAvailableDataElements();
+ jQuery( "#view_1 #selectedDataElements" ).empty();
+ jQuery( '#addDataElementGroupForm' ).dialog('close');
+ } );
+ }else{
+ markInvalid( "addDataElementGroupForm #name", json.message );
+ }
+ });
+ }
+ }]);
+ jQuery( '#addDataElementGroupForm' ).dialog('open');
+
+ }
+
+ function showAddGroupView2()
+ {
+
+ jQuery( '#addDataElementGroupForm' ).dialog('option', 'title', '$encoder.jsEscape( $i18n.getString( "new" ) , "'")');
+ jQuery( '#addDataElementGroupForm' ).dialog('option', 'buttons', [{
+ text: '$encoder.jsEscape( $i18n.getString( "save" ) , "'")',
+ click: function(){
+ jQuery.postJSON( "validateDataElementGroup.action", {
+ name: function(){ return jQuery( '#addDataElementGroupForm #name' ).val(); }
+ }, function( json ){
+ if( json.response == 'success' ){
+ jQuery.postJSON( "addDataElementGroupEditor.action", {
+ name: function(){ return jQuery( '#addDataElementGroupForm #name' ).val(); }
+ }, function( json ){
+ dataElementGroups[json.dataElementGroup.id] = json.dataElementGroup.name;
+ loadAvailableGroups();
+ jQuery( '#addDataElementGroupForm' ).dialog('close');
+ } );
+ }else{
+ markInvalid( "addDataElementGroupForm #name", json.message );
+ }
+ });
+ }
+ }]);
+ jQuery( '#addDataElementGroupForm' ).dialog('open');
+
+ }
+
+ function showUpdateGroup()
+ {
+ var id = jQuery( "#view_1 #dataElementGroups" ).val();
+ var text = jQuery( "#view_1 #dataElementGroups option[value=" + id + "]" ).text();
+ jQuery( '#addDataElementGroupForm #name' ).val( text );
+
+ jQuery( '#addDataElementGroupForm' ).dialog('option', 'buttons', [{
+ text: '$encoder.jsEscape( $i18n.getString( "save" ) , "'")',
+ click: function(){
+
+ jQuery.postJSON( "validateDataElementGroup.action", {
+ id: id,
+ name: function(){ return jQuery( '#addDataElementGroupForm #name' ).val(); }
+ }, function( json ){
+ if( json.response == 'success' ){
+ jQuery.postJSON( "renameDataElementGroupEditor.action", {
+ name: function(){ return jQuery( '#addDataElementGroupForm #name' ).val(); },
+ id: id
+ }, function( json ){
+ dataElementGroups[json.dataElementGroup.id] = json.dataElementGroup.name;
+ loadAvailableGroups();
+ jQuery( '#addDataElementGroupForm' ).dialog('close');
+ showSuccessMessage( i18n_update_success );
+ } );
+ }else{
+ markInvalid( "addDataElementGroupForm #name", json.message );
+ }
+ });
+ }
+ }]);
+
+ jQuery( '#addDataElementGroupForm' ).dialog('option', 'title', '$encoder.jsEscape( $i18n.getString( "rename" ) , "'")');
+ jQuery( '#addDataElementGroupForm' ).dialog('open');
+
+ }
+
+ function showUpdateGroup2()
+ {
+ var id = jQuery( "#view_2 #availableGroups" ).val();
+ var text = jQuery( "#view_2 #availableGroups option[value=" + id + "]" ).text();
+ jQuery( '#addDataElementGroupForm #name' ).val( text );
+
+ jQuery( '#addDataElementGroupForm' ).dialog('option', 'buttons', [{
+ text: '$encoder.jsEscape( $i18n.getString( "save" ) , "'")',
+ click: function(){
+
+ jQuery.postJSON( "validateDataElementGroup.action", {
+ id: id,
+ name: function(){ return jQuery( '#addDataElementGroupForm #name' ).val(); }
+ }, function( json ){
+ if( json.response == 'success' ){
+ jQuery.postJSON( "renameDataElementGroupEditor.action", {
+ name: function(){ return jQuery( '#addDataElementGroupForm #name' ).val(); },
+ id: id
+ }, function( json ){
+ dataElementGroups[json.dataElementGroup.id] = json.dataElementGroup.name;
+ loadAvailableGroups();
+ jQuery( '#addDataElementGroupForm' ).dialog('close');
+ showSuccessMessage( i18n_update_success );
+ } );
+ }else{
+ markInvalid( "addDataElementGroupForm #name", json.message );
+ }
+ });
+ }
+ }]);
+
+ jQuery( '#addDataElementGroupForm' ).dialog('option', 'title', '$encoder.jsEscape( $i18n.getString( "rename" ) , "'")');
+ jQuery( '#addDataElementGroupForm' ).dialog('open');
+
+ }
+
+ function deleteDataElemenGroup()
+ {
+ if ( window.confirm( i18n_confirm_delete + '\n\n' + name ) )
+ {
+ var id = jQuery( "#view_1 #dataElementGroups" ).val();
+
+ jQuery.postJSON( "deleteDataElemenGroupEditor.action",{
+ id: id
+ }, function( json ){
+ if( json.response == 'success'){
+ dataElementGroups.splice(id, 1);
+ loadAvailableGroups();
+ showSuccessMessage( json.message );
+ }else{
+ showErrorMessage( json.message );
+ }
+ });
+ }
+ }
+
+ function deleteDataElemenGroupView2()
+ {
+ if ( window.confirm( i18n_confirm_delete + '\n\n' + name ) )
+ {
+ var id = jQuery( "#view_2 #availableGroups" ).val()[0];
+
+ jQuery.postJSON( "deleteDataElemenGroupEditor.action",{
+ id: id
+ }, function( json ){
+ if( json.response == 'success'){
+ dataElementGroups.splice(id, 1);
+ loadAvailableGroups();
+ showSuccessMessage( json.message );
+ }else{
+ showErrorMessage( json.message );
+ }
+ });
+ }
+ }
+
+ function updateGroupMembers()
+ {
+ var id = jQuery( "#view_1 #dataElementGroups" ).val();
+
+ jQuery.getJSON( "updateDataElementGroupEditor.action?id=" + id + "&" + toQueryString( '#view_1 #selectedDataElements', 'groupMembers' ),
+ function( json ){
+ showSuccessMessage( i18n_update_success );
+ });
+ }
+
+ function toQueryString( jQueryString, paramName )
+ {
+ var p = "";
+ jQuery( jQueryString ).children().each(function(i, item ){
+ item.selected = "selected";
+ p += paramName + "=" + item.value + "&";
+ });
+ return p;
+ }
+
+ // View 2
+
+ function getAssignedDataElementGroups()
+ {
+ loadAvailableGroups();
+
+ var id = jQuery( "#view_2 #availableDataElements2" ).val();
+ var list_2 = jQuery( "#view_2 #assignedGroups" );
+ list_2.empty();
+
+ jQuery.postJSON( "getAssignedDataElementGroups.action", {
+ dataElementId: id
+ }, function( json ){
+ jQuery.each(json.dataElementGroups, function(i, item ){
+ list_2.append('<option value="' + item.id + '">' + item.name + '</option>' );
+
+ jQuery( "#view_2 #availableGroups" ).children().each( function(k, it){
+ if( item.id == it.value )
+ {
+ jQuery(it).remove();
+ }
+ });
+
+ });
+
+ });
+ }
+
+ function assignGroupsForDataElement()
+ {
+ var dataElementId = jQuery("#view_2 #availableDataElements2").val();
+
+ jQuery.getJSON( "asignGroupsForDataElement.action?dataElementId=" + dataElementId + "&" + toQueryString( '#view_2 #assignedGroups', 'dataElementGroups' ),
+ function( json ){
+ showSuccessMessage( i18n_update_success );
+ });
+
+ }
+
+
+</script>
\ No newline at end of file
=== removed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/dataElementGroupEditorView1.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/dataElementGroupEditorView1.vm 2010-09-29 06:22:23 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/dataElementGroupEditorView1.vm 1970-01-01 00:00:00 +0000
@@ -1,124 +0,0 @@
-<style type="text/css">
-
-.select
-{
- border:#666666 thin solid;
- width:300px;
- size:30;
-}
-
-#tooltip {
- color:#000; font-size:11px; line-height:1.2;
- background-color:#FFFFCC; border:1px solid #667295;
- width:210px; padding:4px;
- z-index: 100000;
- display: none;
- position:absolute;
-}
-
-</style>
-
-<h3>
- $i18n.getString( "data_element_group_management" ) #openHelp( "dataElementGroupEditor" )
-</h3>
-
-<table >
- <tr>
- <th>$i18n.getString( "data_element_group" )</th>
- <th><span id="groupNameView" style="display:block;"></span></th>
- <td rowspan="2" style="text-align:center"><a href="dataElementGroupEditor.action?view=$view" title="$i18n.getString( 'switch_view' )"><img src="../images/arrow_double_clockwise_y.png" title="$i18n.getString( 'switch_view' )"/></a></td>
- <th>$i18n.getString( "available_dataelements" )</th>
-
- </tr>
-
- <tr>
- <td><input id="dataElementGroupsFilter" type="text" style="width:300px;" onkeyup="filterList(this.value, 'dataElementGroups');"/></td>
- <td><input id="selecteDataElementsFilter" type="text" style="width:300px;" onkeyup="filterList(this.value, 'selectedDataElements');"/></td>
- <td><input id="availableDataElementsFilter" type="text" style="width:300px;" onkeyup="filterList(this.value, 'availableDataElements');"/></td>
- </tr>
-
- <tr>
- <td>
- <select class="select" id="dataElementGroups" size="30" onchange="getDataElementGroup( this );" onMouseOut="javascript: hideToolTip();">
- </select>
- </td>
- <td>
- <select class="select" id="selectedDataElements" multiple="multiple" size="30" ondblclick="moveSelectedById(this.id, 'availableDataElements');" onMouseOut="javascript: hideToolTip();">
- </select>
- </td>
-
- <td>
- <input type="button" value="<" onclick="moveSelectedById('availableDataElements', 'selectedDataElements');" style="width:42px"/><br/><br/>
- <input type="button" value=">" onclick="moveSelectedById('selectedDataElements', 'availableDataElements');" style="width:42px"/>
- </td>
- <td>
- <select class="select" id="availableDataElements" multiple="multiple" size="30" ondblclick="moveSelectedById(this.id, 'selectedDataElements');" disabled="true" onMouseOut="javascript: hideToolTip();">
- </select>
- </td>
- </tr>
- <tr>
- <td>
- <a href="javascript:sortList( 'dataElementGroups', 'ASC' );"><img align="absmiddle" src="../images/sort_ascending.png" style="border:#666666 thin solid;cursor:pointer;width:20px;"/></a>
- <a href="javascript:sortList( 'dataElementGroups', 'DES' );"><img align="absmiddle" src="../images/sort_descending.png" style="border:#666666 thin solid;cursor:pointer;width:20px;"/></a>
- <input type="button" value="$i18n.getString( 'new' )" onclick="javascript:showAddDataElementGroupForm()" style="width:70px"/>
- <input type="button" value="$i18n.getString( 'rename' )" onclick="javascript:showRenameDataElementGroupForm()" style="width:70px"/>
- <input type="button" value="$i18n.getString( 'delete' )" onclick="javascript:deleteDataElementGroup()" style="width:70px"/>
- </td>
- <td>
- <a href="javascript:sortList( 'selectedDataElements', 'ASC' );"><img align="absmiddle" src="../images/sort_ascending.png" style="border:#666666 thin solid;cursor:pointer;width:20px;"/></a>
- <a href="javascript:sortList( 'selectedDataElements', 'DES' );"><img align="absmiddle" src="../images/sort_descending.png" style="border:#666666 thin solid;cursor:pointer;width:20px;"/></a>
- <input type="button" value="$i18n.getString( 'update_dataelement_group_members' )" onclick="javascript:updateDataElementGroupMembers()"/>
- </td>
- <td></td>
- <td>
- <a href="javascript:sortList( 'availableDataElements', 'ASC' );"><img align="absmiddle" src="../images/sort_ascending.png" style="border:#666666 thin solid;cursor:pointer;width:20px;"/></a>
- <a href="javascript:sortList( 'availableDataElements', 'DES' );"><img align="absmiddle" src="../images/sort_descending.png" style="border:#666666 thin solid;cursor:pointer;width:20px;"/></a>
- </td>
-
-
- </tr>
-</table>
-
-<div id="addDataElementGroupForm" style="position:fixed;background-color:#FFFFFF;border:thin #000000 solid;height:70px;width:450px;display:none;z-index:10000000000;">
-
-<table width="100%" height="100%" border="0" cellpadding="2" cellspacing="2">
-
- <tr align="center">
- <td>$i18n.getString( "name" )</td>
- <td><input type="text" id="groupName" style="width:20em"/></td>
- <td><input id="addRenameGroupButton" type="submit" value="$i18n.getString( 'ok' )"/>
- <input type="button" onclick="hideById( 'addDataElementGroupForm' );unLockScreen();" value="$i18n.getString( 'cancel' )"/></td>
- </tr>
-
-</table>
-
-</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/close.png" alt="$i18n.getString( 'hide_warning' )"/></a>
- </div>
- <p><span id="warningField"></span></p>
-</div>
-
-<div id="tooltip"></div>
-
-<script type="text/javascript">
- var i18n_select_dataelement_group = '$encoder.jsEscape( $i18n.getString( "select_dataelement_group" ) , "'")';
- var i18n_confirm_delete = '$encoder.jsEscape( $i18n.getString( "confirm_delete_data_element_group" ) , "'")';
- var i18n_member_of = '$encoder.jsEscape( $i18n.getString( "member_of" ) , "'")';
- var i18n_update_success = '$encoder.jsEscape( $i18n.getString( "update_success" ) , "'")';
-
- var dataElementGroups = new Object();
- #foreach( $dataElementGroup in $dataElementGroups )
- dataElementGroups['$dataElementGroup.id'] = '$encoder.jsEscape( $dataElementGroup.name, "'" )';
- #end
-
- var availableDataElements = new Object();
- #foreach( $dataElement in $dataElements )
- availableDataElements['$dataElement.id'] = '$encoder.jsEscape( $dataElement.name, "'" )';
- #end
- var selectedDataElements = new Object();
-
- initAllList();
-</script>
\ No newline at end of file
=== removed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/dataElementGroupEditorView2.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/dataElementGroupEditorView2.vm 2010-09-29 06:22:23 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/dataElementGroupEditorView2.vm 1970-01-01 00:00:00 +0000
@@ -1,116 +0,0 @@
-<style type="text/css">
-
-.select
-{
- border:#666666 thin solid;
- width:300px;
- size:30;
-}
-
-#tooltip {
- color:#000; font-size:11px; line-height:1.2;
- background-color:#FFFFCC; border:1px solid #667295;
- width:210px; padding:4px;
- z-index: 100000;
- display: none;
- position:absolute;
-}
-
-</style>
-
-<h3>
- $i18n.getString( "data_element_group_management" ) #openHelp( "dataElementGroupEditor" )
-</h3>
-
-<span id='message' style="position:fixed;top:80px;right:5px;" onclick="hideById('message');"></span>
-
-<table>
- <tr>
- <th>$i18n.getString( "available_dataelements" )</th>
- <th><span id="groupNameView" style="display:block;"></span></th>
- <td rowspan="2" style="text-align:center"><a href="dataElementGroupEditor.action" title="$i18n.getString( 'switch_view' )"><img src="../images/arrow_double_clockwise_y.png" title="$i18n.getString( 'switch_view' )"/></a></td>
- <th>$i18n.getString( "available_groups" )</th>
- </tr>
-
- <tr>
- <td><input id="availableDataElementsFilter" type="text" style="width:300px;" onkeyup="filterList(this.value, 'availableDataElements');"/></td>
- <td><input id="assignedGroupsFilter" type="text" style="width:300px;" onkeyup="filterList(this.value, 'assignedGroups');"/></td>
- <td><input id="availableGroupsFilter" type="text" style="width:300px;" onkeyup="filterList(this.value, 'availableGroups');"/></td>
- </tr>
-
- <tr>
- <td>
- <select class="select" id="availableDataElements" size="30" onMouseOut="javascript: hideToolTip();" onclick="getAssignedDataElementGroups(this.value)">
- </select>
- </td>
- <td>
- <select class="select" id="assignedGroups" multiple="multiple" size="30" ondblclick="moveSelectedById(this.id, 'availableGroups');" onMouseOut="javascript: hideToolTip();">
- </select>
- </td>
- <td>
- <input type="button" value="<" onclick="moveSelectedById('availableGroups', 'assignedGroups');" style="width:42px"/><br/><br/>
- <input type="button" value=">" onclick="moveSelectedById('assignedGroups', 'availableGroups');" style="width:42px"/>
- </td>
- <td>
- <select name="select" size="30" multiple="multiple" class="select" id="availableGroups" ondblclick="moveSelectedById(this.id, 'assignedGroups');" onmouseout="javascript: hideToolTip();">
- </select>
-</td>
- </tr>
- <tr>
- <td></td>
- <td>
- <input type="button" value="$i18n.getString( 'assign_groups_for_dataelement' )" onclick="javascript:assignGroupsForDataElement()"/>
- </td>
- <td></td>
- <td>
- <input type="button" value="$i18n.getString( 'new' )" onclick="javascript:showAddDataElementGroupForm()" style="width:70px"/>
- <input type="button" value="$i18n.getString( 'rename' )" onclick="javascript:showRenameDataElementGroupForm()" style="width:70px"/>
- <input type="button" value="$i18n.getString( 'delete' )" onclick="javascript:deleteDataElementGroup()" style="width:70px"/>
- </td>
- </tr>
-</table>
-
-<div id="addDataElementGroupForm" style="position:fixed;background-color:#FFFFFF;border:thin #000000 solid;height:70px;width:450px;display:none;z-index:10000000000;">
-
-<table width="100%" height="100%" border="0" cellpadding="2" cellspacing="2">
-
- <tr align="center">
- <td>$i18n.getString( "name" )</td>
- <td><input type="text" id="groupName" style="width:20em"/></td>
- <td><input id="addRenameGroupButton" type="submit" value="$i18n.getString( 'ok' )">
- <input type="button" onclick="hideById( 'addDataElementGroupForm' );unLockScreen();" value="$i18n.getString( 'cancel' )"/></td>
- </tr>
-
-</table>
-
-</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/close.png" alt="$i18n.getString( 'hide_warning' )"/></a>
- </div>
- <p><span id="warningField"></span></p>
-</div>
-
-<div id="tooltip"></div>
-
-<script type="text/javascript">
- var i18n_select_dataelement_group = '$encoder.jsEscape( $i18n.getString( "select_dataelement_group" ) , "'")';
- var i18n_confirm_delete = '$encoder.jsEscape( $i18n.getString( "confirm_delete_data_element_group" ) , "'")';
- var i18n_member_of = '$encoder.jsEscape( $i18n.getString( "member_of" ) , "'")';
- var i18n_update_success = '$encoder.jsEscape( $i18n.getString( "update_success" ) , "'")';
- var i18n_select_dataelement = '$encoder.jsEscape( $i18n.getString( "select_dataelement" ) , "'")';
-
- var availableGroups = new Object();
- #foreach( $availableGroup in $dataElementGroups )
- availableGroups['$availableGroup.id'] = '$encoder.jsEscape( $availableGroup.name, "'" )';
- #end
-
- var availableDataElements = new Object();
- #foreach( $dataElement in $dataElements )
- availableDataElements['$dataElement.id'] = '$encoder.jsEscape( $dataElement.name, "'" )';
- #end
- var assignedGroups = new Object();
-
- initAllList();
-</script>
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/indicatorExpressionBuilderForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/indicatorExpressionBuilderForm.vm 2010-12-07 17:02:27 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/indicatorExpressionBuilderForm.vm 2010-12-10 07:45:59 +0000
@@ -92,7 +92,7 @@
{
numerator = true;
- loadDataElementGroups( "#indicator-expression-container select[id=dataElementGroupId]" );
+ dataDictionary.loadDataElementGroups( "#indicator-expression-container select[id=dataElementGroupId]" );
validator.resetForm();
@@ -113,7 +113,7 @@
{
numerator = false;
- loadDataElementGroups( "#indicator-expression-container select[id=dataElementGroupId]" );
+ dataDictionary.loadDataElementGroups( "#indicator-expression-container select[id=dataElementGroupId]" );
validator.resetForm();
@@ -135,10 +135,10 @@
{
var aggregationOperator = getRadioValue( 'aggregationOperator' );
- var id = getFieldValue( "indicator-expression-container select[id=dataElementGroupId]");
-
- loadOperands( "#indicator-expression-container select[id=dataElementId]", {"id": id, "aggregationOperator": aggregationOperator, "includeTotals":true} );
-
+ var id = getFieldValue( "indicator-expression-container select[id=dataElementGroupId]");
+
+ dataDictionary.loadOperands( "#indicator-expression-container select[id=dataElementId]", {id: id, aggregationOperator: aggregationOperator} );
+
checkAggregationOperator();
}
=== removed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElementGroupEditorView1.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElementGroupEditorView1.js 2010-10-01 18:28:58 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElementGroupEditorView1.js 1970-01-01 00:00:00 +0000
@@ -1,314 +0,0 @@
-function showToolTip( e, value){
-
- var tooltipDiv = byId('tooltip');
- tooltipDiv.style.display = 'block';
-
- var posx = 0;
- var posy = 0;
-
- if (!e) var e = window.event;
- if (e.pageX || e.pageY)
- {
- posx = e.pageX;
- posy = e.pageY;
- }
- else if (e.clientX || e.clientY)
- {
- posx = e.clientX;
- posy = e.clientY;
- }
-
- tooltipDiv.style.left= posx + 8 + 'px';
- tooltipDiv.style.top = posy + 8 + 'px';
- tooltipDiv.innerHTML = " " + value;
-}
-
-function hideToolTip(){
- byId('tooltip').style.display = 'none';
-}
-
-function addOptionToListWithToolTip( list, optionValue, optionText )
-{
- var option = document.createElement( "option" );
- option.value = optionValue;
- option.text = optionText;
- option.onmousemove = function(e) {
- showToolTip(e, optionText);
- }
- list.add( option, null );
-}
-
-function refreshListById( listId )
-{
- var list = byId( listId );
- list.options.length = 0;
-
- if ( listId == 'dataElementGroups' )
- {
- for (var id in dataElementGroups)
- {
- addOptionToListWithToolTip( list, id, dataElementGroups[id] );
- }
- }
- else if ( listId == 'availableDataElements' )
- {
- for (var id in availableDataElements)
- {
- addOptionToListWithToolTip( list, id, availableDataElements[id] );
- }
- }
-}
-
-function initAllList()
-{
- refreshListById( 'dataElementGroups' );
- refreshListById( 'availableDataElements' );
- disable( 'availableDataElements' );
-}
-
-// -------------------------------------------------------------------------
-
-function getDataElementGroup( dataElementGroupList )
-{
- selectedDataElements = new Object();
- var id = dataElementGroupList.options[ dataElementGroupList.selectedIndex ].value;
- var request = new Request();
- request.setResponseTypeXML( 'xmlObject' );
- request.setCallbackSuccess( getDataElementGroupCompleted );
- request.send( 'getDataElementGroupEditor.action?id=' + id );
-}
-
-function getDataElementGroupCompleted( xmlObject )
-{
- selectedDataElements = new Object();
- var name = getElementValue( xmlObject, 'name' );
- var dataElementList = xmlObject.getElementsByTagName('dataElement');
- var selectedList = byId( 'selectedDataElements' );
- selectedList.length = 0;
-
- for ( var i = 0; i < dataElementList.length; i++ )
- {
- dataElement = dataElementList.item(i);
- var id = dataElement.getAttribute('id');
- var value = dataElement.firstChild.nodeValue;
- addOptionToListWithToolTip( selectedList, id, value );
- selectedDataElements[id] = value;
- }
-
- refreshListById( 'availableDataElements' );
- visableAvailableDataElements();
- enable('availableDataElements');
- setInnerHTML('groupNameView', name);
-}
-
-function visableAvailableDataElements()
-{
- var selectedList = byId( 'selectedDataElements' );
- var availableList = byId( 'availableDataElements' );
- var selectedOptions = selectedList.options;
- var availableOptions = availableList.options;
-
- for(var i=0;i<availableOptions.length;i++){
- availableList.options[i].style.display='block';
- for(var j=0;j<selectedOptions.length;j++){
- if(availableOptions[i].value==selectedOptions[j].value){
- availableList.options[i].style.display='none';
- }
- }
- }
-}
-
-// -------------------------------------------------------------------------
-
-function updateDataElementGroupMembers()
-{
- var dataElementGroupsSelect = byId( 'dataElementGroups' );
- var id = dataElementGroupsSelect.options[ dataElementGroupsSelect.selectedIndex ].value;
- var request = new Request();
- var requestString = 'updateDataElementGroupEditor.action';
- var params = "id=" + id;
- var selectedDataElementMembers = byId( 'selectedDataElements' );
-
- for ( var i = 0; i < selectedDataElementMembers.options.length; ++i)
- {
- params += '&groupMembers=' + selectedDataElementMembers.options[i].value;
- }
- request.sendAsPost( params );
- request.setResponseTypeXML( 'xmlObject' );
- request.setCallbackSuccess( updateDataElementGroupMembersReceived );
- request.send( requestString );
-}
-
-function updateDataElementGroupMembersReceived( xmlObject )
-{
- var dataElementGroupsSelect = byId( 'dataElementGroups' );
- setHeaderDelayMessage( i18n_update_success + " : " + dataElementGroupsSelect.options[ dataElementGroupsSelect.selectedIndex ].text );
-}
-
-function deleteDataElementGroup()
-{
- var dataElementGroupsSelect = byId( 'dataElementGroups' );
-
- try
- {
- var id = dataElementGroupsSelect.options[ dataElementGroupsSelect.selectedIndex ].value;
- var name = dataElementGroupsSelect.options[ dataElementGroupsSelect.selectedIndex ].text;
-
- if ( window.confirm( i18n_confirm_delete + '\n\n' + name ) )
- {
- $.getJSON
- (
- 'deleteDataElemenGroupEditor.action',
- {
- "id": id
- },
- function( json )
- {
- if ( json.response == "success" )
- {
- var dataElementGroupsSelect = byId( 'dataElementGroups' );
- dataElementGroupsSelect.remove( dataElementGroupsSelect.selectedIndex );
- byId( 'groupNameView' ).innerHTML = "";
- selectedDataElements = new Object();
- }
- else if ( json.response == "error" )
- {
- setFieldValue( 'warningArea', json.message );
-
- showWarning();
- }
- }
- );
- }
- }
- catch(e)
- {
- setHeaderDelayMessage( i18n_select_dataelement_group );
- }
-}
-
-function showRenameDataElementGroupForm()
-{
- var dataElementGroupsSelect = byId( 'dataElementGroups' );
-
- try
- {
- var name = dataElementGroupsSelect.options[ dataElementGroupsSelect.selectedIndex ].text;
- byId( 'addRenameGroupButton' ).onclick=validateRenameDataElementGroup;
- showPopupWindowById( 'addDataElementGroupForm', 450, 70 );
- byId( 'groupName' ).value = name;
- }
- catch(e)
- {
- setHeaderDelayMessage(i18n_select_dataelement_group);
- }
-}
-
-function validateRenameDataElementGroup()
-{
- var dataElementGroupsSelect = byId( 'dataElementGroups' );
- var id = dataElementGroupsSelect.options[ dataElementGroupsSelect.selectedIndex ].value;
- var name = byId( 'groupName' ).value;
- var request = new Request();
-
- $.postJSON(
- "validateDataElementGroup.action",
- { "id": id, "name": name },
- function( json )
- {
- if ( json.response == "success" )
- {
- renameDataElementGroup();
- }
- else
- {
- alert(json.message);
- }
- }
- );
-}
-
-function renameDataElementGroup()
-{
- var dataElementGroupsSelect = byId( 'dataElementGroups' );
- var id = dataElementGroupsSelect.options[ dataElementGroupsSelect.selectedIndex ].value;
- var name = byId( 'groupName' ).value;
- var request = new Request();
-
- request.setResponseTypeXML( 'xmlObject' );
- request.setCallbackSuccess( renameDataElementGroupReceived );
- request.sendAsPost('id=' + id + '&name=' + name);
- request.send( 'renameDataElementGroupEditor.action' );
-
-}
-
-function renameDataElementGroupReceived( xmlObject )
-{
- var id = getElementValue( xmlObject, 'id' );
- var name = getElementValue( xmlObject, 'name' );
- var list = byId( 'dataElementGroups' );
- var option = list.options[ list.selectedIndex ];
- option.text = name;
- option.onmousemove = function(e) {
- showToolTip(e, name);
- }
- dataElementGroups[id] = name;
- $( '#groupNameView' ).html( name );
- hideById( 'addDataElementGroupForm' );
- unLockScreen();
-}
-
-function showAddDataElementGroupForm()
-{
- byId( 'groupName' ).value='';
- byId( 'addRenameGroupButton' ).onclick=validateAddDataElementGroup;
- showPopupWindowById( 'addDataElementGroupForm', 450, 70 );
-}
-
-function validateAddDataElementGroup()
-{
- $.postJSON(
- "validateDataElementGroup.action",
- {
- "name": getFieldValue( 'groupName' )
- },
- function( json )
- {
- if ( json.response == "success" )
- {
- createNewGroup();
- }
- else
- {
- alert(json.message);
- }
- }
- );
-}
-
-function createNewGroup()
-{
- var name = byId( 'groupName' ).value;
- var request = new Request();
- request.setResponseTypeXML( 'xmlObject' );
- request.setCallbackSuccess( createNewGroupReceived );
- request.sendAsPost('name=' + name);
- request.send( 'addDataElementGroupEditor.action' );
-}
-
-function createNewGroupReceived( xmlObject )
-{
- var id = getElementValue( xmlObject, 'id' );
- var name = getElementValue( xmlObject, 'name' );
- var list = byId( 'dataElementGroups' );
- var option = new Option( name, id );
- option.selected = true;
- option.onmousemove = function(e){
- showToolTip( e, name);
- }
- list.add(option , null);
- dataElementGroups[id] = name;
- $( '#groupNameView' ).html( name );
- hideById( 'addDataElementGroupForm' );
- unLockScreen();
-}
\ No newline at end of file
=== removed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElementGroupEditorView2.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElementGroupEditorView2.js 2010-10-01 18:28:58 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElementGroupEditorView2.js 1970-01-01 00:00:00 +0000
@@ -1,325 +0,0 @@
-function showToolTip( e, value){
-
- var tooltipDiv = byId('tooltip');
- tooltipDiv.style.display = 'block';
-
- var posx = 0;
- var posy = 0;
-
- if (!e) var e = window.event;
- if (e.pageX || e.pageY)
- {
- posx = e.pageX;
- posy = e.pageY;
- }
- else if (e.clientX || e.clientY)
- {
- posx = e.clientX;
- posy = e.clientY;
- }
-
- tooltipDiv.style.left= posx + 8 + 'px';
- tooltipDiv.style.top = posy + 8 + 'px';
- tooltipDiv.innerHTML = " " + value;
-}
-
-function hideToolTip(){
- byId('tooltip').style.display = 'none';
-}
-
-function addOptionToListWithToolTip( list, optionValue, optionText )
-{
- var option = document.createElement( "option" );
- option.value = optionValue;
- option.text = optionText;
- option.onmousemove = function(e) {
- showToolTip(e, optionText);
- }
- list.add( option, null );
-}
-
-function refreshListById( listId )
-{
- var list = byId( listId );
- list.options.length = 0;
-
- if ( listId == 'availableGroups' )
- {
- for (var id in availableGroups)
- {
- addOptionToListWithToolTip( list, id, availableGroups[id] );
- }
- }
- else if ( listId == 'availableDataElements' )
- {
- for (var id in availableDataElements)
- {
- addOptionToListWithToolTip( list, id, availableDataElements[id] );
- }
- }
-}
-
-function initAllList()
-{
- refreshListById( 'availableGroups' );
- refreshListById( 'availableDataElements' );
-}
-
-/*==============================================================================
- * Get DataElement Groups contain dataelement
- *==============================================================================*/
-
-function getAssignedDataElementGroups( id )
-{
- var request = new Request();
- request.setResponseTypeXML( 'xmlObject' );
- request.setCallbackSuccess( getAssignedGroupsCompleted );
- request.send( 'getAssignedDataElementGroups.action?dataElementId=' + id );
-}
-
-function getAssignedGroupsCompleted( xmlObject )
-{
- assignedGroups = new Object();
- var availableList = byId("availableDataElements");
- var name = availableList.options[ availableList.selectedIndex ].text;
- var dataElementGroups = xmlObject.getElementsByTagName( 'dataElementGroup' );
- var list = byId('assignedGroups');
- list.options.length = 0;
-
- for( var i=0;i<dataElementGroups.length;i++)
- {
- var id = getElementValue( dataElementGroups.item(i), 'id' );
- var value = getElementValue( dataElementGroups.item(i), 'name' );
- addOptionToListWithToolTip( list, id, value );
- assignedGroups[id] = value;
- }
-
- refreshListById( 'availableGroups' );
- visableAvailableDataElements();
- enable('availableGroups');
- setInnerHTML('groupNameView', name);
-}
-
-function visableAvailableDataElements()
-{
- var selectedList = byId( 'assignedGroups' );
- var availableList = byId( 'availableGroups' );
- var selectedOptions = selectedList.options;
- var availableOptions = availableList.options;
-
- for(var i=0;i<availableOptions.length;i++){
- availableList.options[i].style.display='block';
- for(var j=0;j<selectedOptions.length;j++){
- if(availableOptions[i].value==selectedOptions[j].value){
- availableList.options[i].style.display='none';
- }
- }
- }
-}
-
-/*==============================================================================
- * New DataElement Group
- *==============================================================================*/
-
-function deleteDataElementGroup()
-{
- var dataElementGroupsSelect = byId( 'availableGroups' );
-
- try
- {
- var id = dataElementGroupsSelect.options[ dataElementGroupsSelect.selectedIndex ].value;
- var name = dataElementGroupsSelect.options[ dataElementGroupsSelect.selectedIndex ].text;
-
- if ( window.confirm( i18n_confirm_delete + '\n\n' + name ) )
- {
- $.getJSON
- (
- 'deleteDataElemenGroupEditor.action',
- {
- "id": id
- },
- function( json )
- {
- if ( json.response == "success" )
- {
- var dataElementGroupsSelect = byId( 'availableGroups' );
- dataElementGroupsSelect.remove( dataElementGroupsSelect.selectedIndex );
- }
- else if ( json.response == "error" )
- {
- setFieldValue( 'warningArea', json.message );
-
- showWarning();
- }
- }
- );
- }
- }
- catch(e)
- {
- setHeaderDelayMessage( i18n_select_dataelement_group );
- }
-}
-
-function showRenameDataElementGroupForm()
-{
- var dataElementGroupsSelect = byId( 'availableGroups' );
-
- try
- {
- var name = dataElementGroupsSelect.options[ dataElementGroupsSelect.selectedIndex ].text;
- byId( 'addRenameGroupButton' ).onclick=validateRenameDataElementGroup;
- showPopupWindowById( 'addDataElementGroupForm', 450, 70 );
- byId( 'groupName' ).value = name;
- }
- catch(e)
- {
- setHeaderDelayMessage(i18n_select_dataelement_group);
- }
-}
-
-function validateRenameDataElementGroup()
-{
- var dataElementGroupsSelect = byId( 'availableGroups' );
- var id = dataElementGroupsSelect.options[ dataElementGroupsSelect.selectedIndex ].value;
- var name = byId( 'groupName' ).value;
- var request = new Request();
-
- $.postJSON(
- "validateDataElementGroup.action",
- { "id": id, "name": name },
- function( json )
- {
- if ( json.response == "success" )
- {
- renameDataElementGroup();
- }
- else
- {
- alert(json.message);
- }
- }
- );
-}
-
-function renameDataElementGroup()
-{
- var dataElementGroupsSelect = byId( 'availableGroups' );
- var id = dataElementGroupsSelect.options[ dataElementGroupsSelect.selectedIndex ].value;
- var name = byId( 'groupName' ).value;
- var request = new Request();
-
- request.setResponseTypeXML( 'xmlObject' );
- request.setCallbackSuccess( renameDataElementGroupReceived );
- request.sendAsPost('id=' + id + '&name=' + name);
- request.send( 'renameDataElementGroupEditor.action' );
-
-}
-
-function renameDataElementGroupReceived( xmlObject )
-{
- var id = getElementValue( xmlObject, 'id' );
- var name = getElementValue( xmlObject, 'name' );
- var list = byId( 'availableGroups' );
- var option = list.options[ list.selectedIndex ];
- option.text = name;
- option.onmousemove = function(e) {
- showToolTip(e, name);
- }
- availableGroups[id] = name;
- $( '#groupNameView' ).html( name );
- hideById( 'addDataElementGroupForm' );
- unLockScreen();
-}
-
-function showAddDataElementGroupForm()
-{
- byId( 'groupName' ).value='';
- byId( 'addRenameGroupButton' ).onclick=validateAddDataElementGroup;
- showPopupWindowById( 'addDataElementGroupForm', 450, 70 );
-}
-
-function validateAddDataElementGroup()
-{
- $.postJSON(
- "validateDataElementGroup.action",
- {
- "name": getFieldValue( 'groupName' )
- },
- function( json )
- {
- if ( json.response == "success" )
- {
- createNewGroup();
- }
- else
- {
- alert(json.message);
- }
- }
- );
-}
-
-function createNewGroup()
-{
- var name = byId( 'groupName' ).value;
- var request = new Request();
- request.setResponseTypeXML( 'xmlObject' );
- request.setCallbackSuccess( createNewGroupReceived );
- request.sendAsPost( 'name=' + name);
- request.send( 'addDataElementGroupEditor.action' );
-}
-
-function createNewGroupReceived( xmlObject )
-{
- var id = getElementValue( xmlObject, 'id' );
- var name = getElementValue( xmlObject, 'name' );
- var list = byId( 'availableGroups' );
- var option = new Option( name, id );
- option.selected = true;
- option.onmousemove = function(e){
- showToolTip( e, name);
- }
- list.add( option, null );
- availableGroups[id] = name;
- $( '#groupNameView' ).html( name );
- hideById( 'addDataElementGroupForm' );
- unLockScreen();
-}
-
-/*==============================================================================
- * New Assign DataElement Groups for dataelement
- *==============================================================================*/
-
-function assignGroupsForDataElement()
-{
- var dataElementId = byId( 'availableDataElements' ).value;
-
- if( dataElementId=="" )
- {
- setHeaderDelayMessage( i18n_select_dataelement );
- return;
- }
-
- var request = new Request();
-
- var requestString = 'asignGroupsForDataElement.action';
-
- var params = "dataElementId=" + dataElementId;
-
- var selectedGroups = byId( 'assignedGroups' );
-
- for ( var i = 0; i < selectedGroups.options.length; ++i)
- {
- params += '&dataElementGroups=' + selectedGroups.options[i].value;
- }
- request.sendAsPost( params );
- request.setResponseTypeXML( 'message' );
- request.setCallbackSuccess( assignGroupsForDataElementReceived );
- request.send( requestString );
-}
-
-function assignGroupsForDataElementReceived( message )
-{
- setHeaderDelayMessage( i18n_update_success );
-}
\ No newline at end of file
=== removed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/responseDataElementGroupSuccess.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/responseDataElementGroupSuccess.vm 2010-03-23 17:23:47 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/responseDataElementGroupSuccess.vm 1970-01-01 00:00:00 +0000
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<dataElementGroup>
- <name>$encoder.xmlEncode( $dataElementGroup.name )</name>
- #foreach( $member in $!dataElementGroup.members )
- <dataElement id="$member.id">$encoder.xmlEncode( $member.name )</dataElement>
- #end
-</dataElementGroup>
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/expressionBuilderForm.vm'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/expressionBuilderForm.vm 2010-12-03 05:41:34 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/expressionBuilderForm.vm 2010-12-10 07:45:59 +0000
@@ -68,7 +68,7 @@
function loadDataElements( dataSetId )
{
var dataElements = jQuery("#dataElementId");
- loadOperands( dataElements, {dataSetId: dataSetId});
+ dataDictionary.loadOperands( dataElements, {dataSetId: dataSetId});
}
function loadDataSets()