dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #04581
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1534: Assign Multidataset to Orgunit - Just got GUI - Working ...
------------------------------------------------------------
revno: 1534
committer: hieu <hieu.hispvietnam@xxxxxxxxx>
branch nick: trunk
timestamp: Wed 2010-03-03 11:33:39 +0700
message:
Assign Multidataset to Orgunit - Just got GUI - Working ...
added:
dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/filemanager/action/RenameExcelTemplateAction.java
dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/filemanager/action/UpdateReportExcelByTemplateAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/assign/
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/assign/multidataset/
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/assign/multidataset/ShowAssignMultiDataSetForOrgunitAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/showAssignMultiDataSetForm.vm
modified:
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/struts.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/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.
=== added file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/filemanager/action/RenameExcelTemplateAction.java'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/filemanager/action/RenameExcelTemplateAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/filemanager/action/RenameExcelTemplateAction.java 2010-03-03 04:33:39 +0000
@@ -0,0 +1,122 @@
+package org.hisp.dhis.reportexcel.filemanager.action;
+
+/*
+ * Copyright (c) 2004-2007, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+import java.io.File;
+
+import org.hisp.dhis.options.SystemSettingManager;
+import org.hisp.dhis.reportexcel.action.ActionSupport;
+import org.hisp.dhis.reportexcel.state.SelectionManager;
+import org.hisp.dhis.reportexcel.utils.FileUtils;
+
+/**
+ * @author Dang Duy Hieu
+ * @version $Id
+ * @since 2010-02-05
+ */
+public class RenameExcelTemplateAction
+ extends ActionSupport
+{
+ // -------------------------------------------
+ // Dependency
+ // -------------------------------------------
+
+ private SystemSettingManager systemSettingManager;
+
+ public void setSystemSettingManager( SystemSettingManager systemSettingManager )
+ {
+ this.systemSettingManager = systemSettingManager;
+ }
+
+ private SelectionManager selectionManager;
+
+ public void setSelectionManager( SelectionManager selectionManager )
+ {
+ this.selectionManager = selectionManager;
+ }
+
+ // -------------------------------------------
+ // Getter && Setter
+ // -------------------------------------------
+ private String newFileName;
+
+ public void setNewFileName( String newFileName )
+ {
+ this.newFileName = newFileName;
+ }
+
+ private String curFileName;
+
+ public void setCurFileName( String curFileName )
+ {
+ this.curFileName = curFileName;
+ }
+
+ private String renamingMode;
+
+ public void setRenamingMode( String renamingMode )
+ {
+ this.renamingMode = renamingMode;
+ }
+
+ // -------------------------------------------
+ // Action implementation
+ // -------------------------------------------
+
+ @Override
+ public String execute()
+ throws Exception
+ {
+ message = "";
+
+ String templateDirectory = (String) systemSettingManager
+ .getSystemSetting( SystemSettingManager.KEY_REPORT_TEMPLATE_DIRECTORY );
+
+ File curFile = new File( templateDirectory + File.separator + curFileName );
+ File newFile = new File( templateDirectory + File.separator + newFileName );
+
+ selectionManager.setRenameFilePath( curFile.getAbsolutePath() );
+
+ if ( FileUtils.rename( curFile, newFile ) )
+ {
+ message = "rename_successful";
+ }
+ else
+ {
+ message = "rename_failed";
+ return ERROR;
+ }
+
+ if ( renamingMode.equals( "RNUS" ) )
+ {
+ return NONE;
+ }
+
+ return SUCCESS;
+ }
+
+}
=== added file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/filemanager/action/UpdateReportExcelByTemplateAction.java'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/filemanager/action/UpdateReportExcelByTemplateAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/filemanager/action/UpdateReportExcelByTemplateAction.java 2010-03-03 04:33:39 +0000
@@ -0,0 +1,92 @@
+package org.hisp.dhis.reportexcel.filemanager.action;
+
+/*
+ * Copyright (c) 2004-2007, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+import org.hisp.dhis.reportexcel.ReportExcelService;
+import org.hisp.dhis.reportexcel.action.ActionSupport;
+
+/**
+ * @author Dang Duy Hieu
+ * @version $Id
+ * @since 2010-02-24
+ */
+public class UpdateReportExcelByTemplateAction
+ extends ActionSupport
+{
+ // -------------------------------------------
+ // Dependency
+ // -------------------------------------------
+
+ private ReportExcelService reportService;
+
+ public void setReportService( ReportExcelService reportService )
+ {
+ this.reportService = reportService;
+ }
+
+ // -------------------------------------------
+ // Getter && Setter
+ // -------------------------------------------
+
+ private String curTemplateName;
+
+ public void setCurTemplateName( String curTemplateName )
+ {
+ this.curTemplateName = curTemplateName;
+ }
+
+ private String newTemplateName;
+
+ public void setNewTemplateName( String newTemplateName )
+ {
+ this.newTemplateName = newTemplateName;
+ }
+
+ // -------------------------------------------
+ // Action implementation
+ // -------------------------------------------
+
+ @Override
+ public String execute()
+ throws Exception
+ {
+ message = "";
+
+ if ( newTemplateName.isEmpty() )
+ {
+ message = "verify_filename";
+ return ERROR;
+ }
+
+ reportService.updateReportExcelSystemByTemplate( curTemplateName, newTemplateName );
+
+ message = "update_successful";
+
+ return SUCCESS;
+ }
+
+}
=== added directory 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/assign'
=== added directory 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/assign/multidataset'
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/assign/multidataset/ShowAssignMultiDataSetForOrgunitAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/assign/multidataset/ShowAssignMultiDataSetForOrgunitAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/assign/multidataset/ShowAssignMultiDataSetForOrgunitAction.java 2010-03-03 04:33:39 +0000
@@ -0,0 +1,155 @@
+package org.hisp.dhis.dataset.action.assign.multidataset;
+
+/*
+ * Copyright (c) 2004-2007, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+import org.hisp.dhis.dataset.DataSet;
+import org.hisp.dhis.dataset.DataSetService;
+import org.hisp.dhis.options.displayproperty.DisplayPropertyHandler;
+import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
+import org.hisp.dhis.organisationunit.OrganisationUnitGroupService;
+import org.hisp.dhis.organisationunit.OrganisationUnitLevel;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
+import org.hisp.dhis.organisationunit.comparator.OrganisationUnitGroupNameComparator;
+
+import com.opensymphony.xwork2.ActionSupport;
+
+/**
+ * @author Dang Duy Hieu
+ * @version $Id$
+ */
+public class ShowAssignMultiDataSetForOrgunitAction
+ extends ActionSupport
+{
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ // -------------------------------------------------------------------------
+ // Dependency
+ // -------------------------------------------------------------------------
+
+ private DataSetService dataSetService;
+
+ public void setDataSetService( DataSetService dataSetService )
+ {
+ this.dataSetService = dataSetService;
+ }
+
+ private Comparator<DataSet> dataSetComparator;
+
+ public void setDataSetComparator( Comparator<DataSet> dataSetComparator )
+ {
+ this.dataSetComparator = dataSetComparator;
+ }
+
+ private DisplayPropertyHandler displayPropertyHandler;
+
+ public void setDisplayPropertyHandler( DisplayPropertyHandler displayPropertyHandler )
+ {
+ this.displayPropertyHandler = displayPropertyHandler;
+ }
+
+ private OrganisationUnitService organisationUnitService;
+
+ public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
+ {
+ this.organisationUnitService = organisationUnitService;
+ }
+
+ private OrganisationUnitGroupService organisationUnitGroupService;
+
+ public void setOrganisationUnitGroupService( OrganisationUnitGroupService organisationUnitGroupService )
+ {
+ this.organisationUnitGroupService = organisationUnitGroupService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input & Output
+ // -------------------------------------------------------------------------
+
+ private List<DataSet> availableDataSets;
+
+ private List<OrganisationUnitLevel> levels;
+
+ private List<OrganisationUnitGroup> groups;
+
+ // -------------------------------------------------------------------------
+ // Getter & Setter
+ // -------------------------------------------------------------------------
+
+ public List<DataSet> getAvailableDataSets()
+ {
+ return availableDataSets;
+ }
+
+ public List<OrganisationUnitLevel> getLevels()
+ {
+ return levels;
+ }
+
+ public List<OrganisationUnitGroup> getGroups()
+ {
+ return groups;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action Implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ {
+
+ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ // Get list of datasets
+ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ availableDataSets = new ArrayList<DataSet>( dataSetService.getAllDataSets() );
+
+ Collections.sort( availableDataSets, dataSetComparator );
+
+ displayPropertyHandler.handle( availableDataSets );
+
+ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ // Setup the association tree
+ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ levels = new ArrayList<OrganisationUnitLevel>( organisationUnitService.getOrganisationUnitLevels() );
+
+ groups = new ArrayList<OrganisationUnitGroup>( organisationUnitGroupService.getAllOrganisationUnitGroups() );
+
+ Collections.sort(groups, new OrganisationUnitGroupNameComparator() );
+
+ return SUCCESS;
+ }
+}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/META-INF/dhis/beans.xml 2010-02-22 09:19:15 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/META-INF/dhis/beans.xml 2010-03-03 04:33:39 +0000
@@ -391,4 +391,19 @@
</property>
</bean>
+ <bean id="org.hisp.dhis.dataset.action.assign.multidataset.ShowAssignMultiDataSetForOrgunitAction"
+ class="org.hisp.dhis.dataset.action.assign.multidataset.ShowAssignMultiDataSetForOrgunitAction"
+ scope="prototype">
+ <property name="dataSetService">
+ <ref bean="org.hisp.dhis.dataset.DataSetService"/>
+ </property>
+ <property name="organisationUnitService">
+ <ref bean="org.hisp.dhis.organisationunit.OrganisationUnitService"/>
+ </property>
+ <property name="organisationUnitGroupService">
+ <ref bean="org.hisp.dhis.organisationunit.OrganisationUnitGroupService"/>
+ </property>
+ </bean>
+
+
</beans>
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/struts.xml 2010-02-10 18:04:44 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/struts.xml 2010-03-03 04:33:39 +0000
@@ -317,5 +317,13 @@
<result name="success" type="redirect">dataSet.action</result>
</action>
+ <action name="showAssignMultiDataSetForOrgunitForm"
+ class="org.hisp.dhis.dataset.action.assign.multidataset.ShowAssignMultiDataSetForOrgunitAction">
+ <result name="success" type="velocity">/main.vm</result>
+ <param name="page">/dhis-web-maintenance-dataset/showAssignMultiDataSetForm.vm</param>
+ <param name="menu">/dhis-web-maintenance-dataset/menu.vm</param>
+ <param name="javascripts">javascript/dataSet.js</param>
+ </action>
+
</package>
</struts>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/menu.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/menu.vm 2009-11-03 09:05:08 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/menu.vm 2010-03-03 04:33:39 +0000
@@ -3,4 +3,6 @@
<ul>
<li><a href="dataSet.action">$i18n.getString( "dataset" ) </a></li>
<li><a href="section.action">$i18n.getString( "dataset_section" ) </a></li>
+ <li><a href="showAssignMultiDataSetForOrgunitForm.action">$i18n.getString( "assign_multidataset" ) </a></li>
+
</ul>
\ No newline at end of file
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/showAssignMultiDataSetForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/showAssignMultiDataSetForm.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/showAssignMultiDataSetForm.vm 2010-03-03 04:33:39 +0000
@@ -0,0 +1,160 @@
+<h3>$i18n.getString( "assign_multidataset" )</h3>
+
+<form id="assignMultiDataSetForm" action="saveAssignMultiDataSetForOrgunit.action" method="post" >
+
+<table>
+ <tr>
+ <th>$i18n.getString( "available_datasets" )</th><td></td><th>$i18n.getString( "selected_datasets" )</th>
+ </tr>
+ <tr>
+ <td><input type="text" id="availableDataSetsFilter" onkeyup="filterAvailableDataSets()" style="width:25em"></td>
+ <td style="text-align:center">< $i18n.getString( "filters" ) ></td>
+ <td><input type="text" id="selectedDataSetsFilter" onkeyup="filterSelectedDataSets()" style="width:25em"></td>
+ </tr>
+ <tr>
+ <td>
+ <select id="availableDataSets" size="2" multiple="multiple" style="min-width:25em; height:25em" ondblclick="addSelectedDataSets()">
+ #foreach($dataSet in $availableDataSets)
+ <option value='$dataSet' >$encoder.htmlEncode( $dataSet.name )</option>
+ #end
+ </select>
+ </td>
+
+ <td style="text-align:center">
+ <input type="button" value=">" title="$i18n.getString('move_selected')" onclick="addSelectedDataSets()"><br>
+ <input type="button" value="<" title="$i18n.getString('remove_selected')" onclick="removeSelectedDataSets()">
+ </td>
+
+ <td>
+ <select id="selectedDataSets" name="selectedDataSets" size="2" multiple="multiple" style="min-width:25em; height:25em" ondblclick="removeSelectedDataSets()" />
+ </td>
+ </tr>
+</table>
+
+<div><br/></div>
+
+ <table id="selectionTable">
+ <tr>
+ <td>
+ <input type="button" value="$i18n.getString( "select_all_at_level" )" onclick="selectAllAtLevel()" style="width:12em">
+ <select id="levelList" name="levelList" style="width:12em">
+ #foreach( $lev in $levels )
+ <option value="$lev.level" #if ( $level == $lev.level )selected="selected"#end>$encoder.htmlEncode( $lev.name )</option>
+ #end
+ </select>
+ <input type="button" value="$i18n.getString( "unselect_all_at_level" )" onclick="unselectAllAtLevel()" style="width:12em">
+ <input type="button" value="$i18n.getString( "unselect_all" )" onclick="unselectAll()" style="width:12em">
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <input type="button" value="$i18n.getString( "select_all_in_group" )" onclick="selectGroup()" style="width:12em">
+ <select id="groupList" name="groupList" style="width:12em">
+ #foreach ( $group in $groups )
+ <option value="$group.id" #if ( $organisationUnitGroupId == $group.id )selected="selected"#end>$encoder.htmlEncode( $group.name )</option>
+ #end
+ </select>
+ <input type="button" value="$i18n.getString( "unselect_all_in_group" )" onclick="unselectGroup()" style="width:12em">
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div id="selectionTree" style="width:50em;height:30em;overflow:auto;border:1px solid #cccccc"></div>
+
+ <script type="text/javascript">
+
+ var i18n_loading = '$encoder.jsEncode( $i18n.getString( "loading" ) )';
+
+ selectionTreeSelection.setMultipleSelectionAllowed( true );
+ selectionTreeSelection.setOnSelectFunction( treeClicked );
+ selectionTreeSelection.setListenerFunction( selectCompleted );
+ selectionTree.buildSelectionTree();
+
+ var numberOfSelects = 0;
+
+ function selectAllAtLevel()
+ {
+ var request = new Request();
+ request.setCallbackSuccess( selectReceived );
+ request.send( 'selectLevel.action?level=' + getListValue( 'levelList' ) );
+ }
+
+ function unselectAllAtLevel()
+ {
+ var request = new Request();
+ request.setCallbackSuccess( selectReceived );
+ request.send( 'unselectLevel.action?level=' + getListValue( 'levelList' ) );
+ }
+
+ function selectGroup()
+ {
+ var request = new Request();
+ request.setCallbackSuccess( selectReceived );
+ request.send( 'selectOrganisationUnitGroup.action?organisationUnitGroupId=' + getListValue( 'groupList' ) );
+ }
+
+ function unselectGroup()
+ {
+ var request = new Request();
+ request.setCallbackSuccess( selectReceived );
+ request.send( 'unselectOrganisationUnitGroup.action?organisationUnitGroupId=' + getListValue( 'groupList' ) );
+ }
+
+ function unselectAll()
+ {
+ var request = new Request();
+ request.setCallbackSuccess( selectReceived );
+ request.send( 'unselectAll.action' );
+ }
+
+ function selectReceived()
+ {
+ selectionTree.buildSelectionTree();
+ }
+
+ function treeClicked()
+ {
+ numberOfSelects++;
+
+ setMessage( i18n_loading );
+
+ document.getElementById( "submitButton" ).disabled = true;
+ }
+
+ function selectCompleted( selectedUnits )
+ {
+ numberOfSelects--;
+
+ if ( numberOfSelects <= 0 )
+ {
+ hideMessage();
+
+ document.getElementById( "submitButton" ).disabled = false;
+ }
+ }
+
+ </script>
+ </td>
+ </tr>
+</table>
+<p>
+ <input type="submit" id="submitButton" value="$i18n.getString( "save" )" style="width:10em"><input type="button"
+ onclick="window.location.href='dataSet.action'" value="$i18n.getString( "cancel" )" style="width:10em">
+</p>
+
+</form>
+
+<span id="message"></span>
+
+<script type="text/javascript">
+
+ var selectedDataSets = new Object();
+
+ var availableDataSets = new Object();
+#foreach( $dataSet in $availableDataSets )
+ availableDataSets['$dataSet.id'] = '$encoder.jsEscape( $dataSet.name, "'" )';
+#end
+
+ initLists();
+
+</script>