dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #15988
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5929: dataset locking exception ui changes, can now select multiple ous.. (not finished)
------------------------------------------------------------
revno: 5929
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2012-02-13 11:51:23 +0700
message:
dataset locking exception ui changes, can now select multiple ous.. (not finished)
removed:
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lockexception/UpdateLockExceptionAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/updateLockExceptionForm.vm
modified:
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/oust/oust.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lockexception/GetDataSetsAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/struts.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/addLockExceptionForm.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/lockException.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/lockException.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/oust/oust.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/oust/oust.js 2012-02-08 12:04:46 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/oust/oust.js 2012-02-13 04:51:23 +0000
@@ -92,19 +92,19 @@
{
return;
}
-
+
selectedOrganisationUnit = new Array();
-
+
var unitIds = new Array();
for ( i in json.selectedUnits )
{
unitIds[i] = json.selectedUnits[i].id;
- selectedOrganisationUnit.push( unitIds[i] );
+ selectedOrganisationUnit.push( unitIds[i] );
}
+ jQuery("body").trigger("oust.selected", selectedOrganisationUnit);
listenerFunction( unitIds );
- jQuery("body").trigger("oust.selected", unitIds);
}
function getTagId( unitId )
@@ -224,6 +224,8 @@
}
clearLoadingMessage( treeTag );
+
+ jQuery("body").trigger( "oust.selected", selectedOrganisationUnit );
}
function createChildren( parentTag, parentElement )
@@ -270,7 +272,7 @@
{
linkTag.className = 'selected';
selectedOrganisationUnit.push( childId );
-
+
if ( typeof ( window.addSelectedOrganisationUnit__ ) == 'function' )
{
addSelectedOrganisationUnit__( childId );// This code is bad and must be removed
@@ -343,7 +345,7 @@
imgTag.alt = '';
return imgTag;
}
-
+
function getToggleImage()
{
var imgTag = document.createElement( 'img' );
@@ -351,13 +353,13 @@
imgTag.height = '9';
return imgTag;
}
-
+
function setLoadingMessage( treeTag )
{
treeTag.style.backgroundImage = 'url(../images/ajax-loader-circle.gif)';
treeTag.style.backgroundRepeat = 'no-repeat';
}
-
+
function clearLoadingMessage( treeTag )
{
treeTag.style.backgroundImage = 'none';
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lockexception/GetDataSetsAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lockexception/GetDataSetsAction.java 2012-02-08 13:38:13 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lockexception/GetDataSetsAction.java 2012-02-13 04:51:23 +0000
@@ -35,7 +35,9 @@
import org.hisp.dhis.user.UserCredentials;
import java.util.ArrayList;
+import java.util.HashSet;
import java.util.List;
+import java.util.Set;
/**
* @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
@@ -65,9 +67,9 @@
// Input & Output
// -------------------------------------------------------------------------
- private int id;
+ private String id;
- public void setId( int id )
+ public void setId( String id )
{
this.id = id;
}
@@ -91,20 +93,29 @@
return SUCCESS;
}
- private List<DataSet> getDataSetsForCurrentUser( int id )
+ private List<DataSet> getDataSetsForCurrentUser( String ids )
{
- OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( id );
+ // start out with a Set, so that we don't get duplicates
+ Set<DataSet> dataSets = new HashSet<DataSet>();
- if ( organisationUnit == null )
+ if ( ids.length() == 0 )
{
return new ArrayList<DataSet>();
}
- List<DataSet> dataSets = new ArrayList<DataSet>();
-
- if ( organisationUnit.getDataSets() != null )
+ for ( String id : ids.split( "," ) )
{
- dataSets.addAll( organisationUnit.getDataSets() );
+ OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( Integer.parseInt( id ) );
+
+ if ( organisationUnit == null )
+ {
+ continue;
+ }
+
+ if ( organisationUnit.getDataSets() != null )
+ {
+ dataSets.addAll( organisationUnit.getDataSets() );
+ }
}
UserCredentials userCredentials = currentUserService.getCurrentUser().getUserCredentials();
@@ -114,6 +125,6 @@
dataSets.retainAll( userCredentials.getAllDataSets() );
}
- return dataSets;
+ return new ArrayList<DataSet>( dataSets );
}
}
=== removed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lockexception/UpdateLockExceptionAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lockexception/UpdateLockExceptionAction.java 2012-02-08 12:04:46 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lockexception/UpdateLockExceptionAction.java 1970-01-01 00:00:00 +0000
@@ -1,127 +0,0 @@
-package org.hisp.dhis.dataadmin.action.lockexception;
-
-/*
- * Copyright (c) 2004-2012, 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 com.opensymphony.xwork2.Action;
-import org.hisp.dhis.dataset.DataSet;
-import org.hisp.dhis.dataset.DataSetService;
-import org.hisp.dhis.dataset.LockException;
-import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.organisationunit.OrganisationUnitService;
-import org.hisp.dhis.period.Period;
-import org.hisp.dhis.period.PeriodService;
-
-/**
- * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
- */
-public class UpdateLockExceptionAction
- implements Action
-{
- // -------------------------------------------------------------------------
- // Dependencies
- // -------------------------------------------------------------------------
-
- private DataSetService dataSetService;
-
- public void setDataSetService( DataSetService dataSetService )
- {
- this.dataSetService = dataSetService;
- }
-
- private OrganisationUnitService organisationUnitService;
-
- public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
- {
- this.organisationUnitService = organisationUnitService;
- }
-
- private PeriodService periodService;
-
- public void setPeriodService( PeriodService periodService )
- {
- this.periodService = periodService;
- }
-
- // -------------------------------------------------------------------------
- // Input & Output
- // -------------------------------------------------------------------------
-
- private int lockExceptionId;
-
- public void setLockExceptionId( int lockExceptionId )
- {
- this.lockExceptionId = lockExceptionId;
- }
-
- private int organisationUnitId;
-
- public void setOrganisationUnitId( int organisationUnitId )
- {
- this.organisationUnitId = organisationUnitId;
- }
-
- private int dataSetId;
-
- public void setDataSetId( int dataSetId )
- {
- this.dataSetId = dataSetId;
- }
-
- private String periodId;
-
- public void setPeriodId( String periodId )
- {
- this.periodId = periodId;
- }
-
- // -------------------------------------------------------------------------
- // Action Implementation
- // -------------------------------------------------------------------------
-
- @Override
- public String execute() throws Exception
- {
- LockException lockException = dataSetService.getLockException( lockExceptionId );
- OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( organisationUnitId );
- DataSet dataSet = dataSetService.getDataSet( dataSetId );
- Period period = periodService.getPeriodByExternalId( periodId );
-
- if ( lockException == null || organisationUnit == null || dataSet == null || period == null )
- {
- return ERROR;
- }
-
- lockException.setOrganisationUnit( organisationUnit );
- lockException.setDataSet( dataSet );
- lockException.setPeriod( period );
-
- dataSetService.updateLockException( lockException );
-
- return SUCCESS;
- }
-}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/META-INF/dhis/beans.xml 2012-02-08 13:38:13 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/META-INF/dhis/beans.xml 2012-02-13 04:51:23 +0000
@@ -314,13 +314,6 @@
<property name="dataSetService" ref="org.hisp.dhis.dataset.DataSetService" />
</bean>
- <bean id="org.hisp.dhis.dataadmin.action.lockexception.UpdateLockExceptionAction" class="org.hisp.dhis.dataadmin.action.lockexception.UpdateLockExceptionAction"
- scope="prototype">
- <property name="dataSetService" ref="org.hisp.dhis.dataset.DataSetService" />
- <property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
- <property name="periodService" ref="org.hisp.dhis.period.PeriodService" />
- </bean>
-
<bean id="org.hisp.dhis.dataadmin.action.lockexception.GetDataSetsAction" class="org.hisp.dhis.dataadmin.action.lockexception.GetDataSetsAction"
scope="prototype">
<property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/struts.xml 2012-02-08 13:38:13 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/struts.xml 2012-02-13 04:51:23 +0000
@@ -493,26 +493,12 @@
<param name="requiredAuthorities">F_DATASET_ADD</param>
</action>
- <action name="showUpdateLockExceptionForm" class="org.hisp.dhis.dataadmin.action.lockexception.GetLockExceptionFormAction">
- <result name="success" type="velocity">/main.vm</result>
- <param name="menu">/dhis-web-maintenance-dataadmin/menu.vm</param>
- <param name="page">/dhis-web-maintenance-dataadmin/updateLockExceptionForm.vm</param>
- <param name="stylesheets">../dhis-web-commons/paging/paging.css</param>
- <param name="requiredAuthorities">F_DATASET_UPDATE</param>
- </action>
-
<action name="addLockException" class="org.hisp.dhis.dataadmin.action.lockexception.AddLockExceptionAction">
<result name="success" type="redirect">lockException.action</result>
<result name="error" type="redirect">index.action</result>
<param name="requiredAuthorities">F_DATASET_ADD</param>
</action>
- <action name="updateLockException" class="org.hisp.dhis.dataadmin.action.lockexception.UpdateLockExceptionAction">
- <result name="success" type="redirect">lockException.action</result>
- <result name="error" type="redirect">index.action</result>
- <param name="requiredAuthorities">F_DATASET_UPDATE</param>
- </action>
-
<action name="removeLockException" class="org.hisp.dhis.dataadmin.action.lockexception.RemoveLockExceptionAction">
<result name="success" type="velocity-json">/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
<result name="error" type="velocity-json">/dhis-web-commons/ajax/jsonResponseError.vm</result>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/addLockExceptionForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/addLockExceptionForm.vm 2012-02-08 13:38:13 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/addLockExceptionForm.vm 2012-02-13 04:51:23 +0000
@@ -10,7 +10,7 @@
<col/>
<tr>
- <td>#organisationUnitSelectionTree( true, false, true )</td>
+ <td>#organisationUnitSelectionTree( true, true, true )</td>
</tr>
<tr>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/lockException.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/lockException.js 2012-02-08 13:38:13 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/lockException.js 2012-02-13 04:51:23 +0000
@@ -4,10 +4,14 @@
jQuery("#periods").bind("change", periodChanged);
});
-function ouChanged( e, ou ) {
- jQuery("#organisationUnitId").val(ou);
-
- jQuery.getJSON('getDataSets.action?id=' + ou, function ( data ) {
+function ouChanged( e ) {
+ // arguments is only "array-like", so it doesnt have splice
+ var args = Array.prototype.slice.call(arguments);
+ var selectedOus = args.splice(1, args.length);
+
+ jQuery("#organisationUnitId").val(selectedOus.join(','));
+
+ jQuery.getJSON('getDataSets.action?id=' + selectedOus.join(','), function ( data ) {
jQuery("#dataSets").children().remove();
if ( data.dataSets.length == 0 ) {
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/lockException.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/lockException.vm 2012-02-08 12:04:46 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/lockException.vm 2012-02-13 04:51:23 +0000
@@ -50,7 +50,6 @@
<tr id="tr${lockException.id}">
<td onclick="javascript:showLockExceptionDetails( $lockException.id )">$encoder.htmlEncode( $lockException.name )</td>
<td style="text-align:right">
- <a href="showUpdateLockExceptionForm.action?id=$lockException.id" title="$i18n.getString( 'edit' )"><img src="../images/edit.png" alt="$i18n.getString( 'edit' )"/></a>
<a href="javascript:removeLockException( $lockException.id, '$encoder.jsEncode( $lockException.name )' )" title="$i18n.getString( 'remove' )"><img src="../images/delete.png" alt="$i18n.getString( 'remove' )"/></a>
<a href="javascript:showLockExceptionDetails( $lockException.id )" title="$i18n.getString( 'show_details' )"><img src="../images/information.png" alt="$i18n.getString( 'show_details' )"/></a>
</td>
@@ -68,7 +67,7 @@
<a href="javascript:hideDetails()" title="$i18n.getString( 'hide_details' )"><img src="../images/close.png" alt="$i18n.getString( 'hide_details' )"/></a>
</div>
<p><label>$i18n.getString( "organisation_unit" ):</label><br/><span id="organisationUnitField"></span></p>
- <p><label>$i18n.getString( "data_set" ):</label><br/><span id="dataSetField"></span></p>
+ <p><label>$i18n.getString( "dataset" ):</label><br/><span id="dataSetField"></span></p>
<p><label>$i18n.getString( "period" ):</label><br/><span id="periodField"></span></p>
</div>
=== removed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/updateLockExceptionForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/updateLockExceptionForm.vm 2012-02-08 13:38:13 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/updateLockExceptionForm.vm 1970-01-01 00:00:00 +0000
@@ -1,54 +0,0 @@
-<script type="text/javascript" src="javascript/lockException.js"></script>
-
-<h3>$i18n.getString( "edit_lock_exception" )</h3>
-
-<form id="updateLockExceptionForm" action="updateLockException.action" method="post" >
-<input type="hidden" id="lockExceptionId" name="lockExceptionId" value="$lockException.id"/>
-<input type="hidden" id="organisationUnitId" name="organisationUnitId" value="$lockException.organisationUnit.id"/>
-
-<table>
- <col style="width: 100px"/>
- <col/>
-
- <tr>
- <td>#organisationUnitSelectionTree( false, false, true )</td>
- </tr>
-
- <tr>
- <td>
- <select id="dataSets" name="dataSetId" style="width: 100%;">
- #foreach( $dataSet in $dataSets )
- #if( $dataSet.id == $lockException.dataSet.id )
- <option selected="selected" value="$dataSet.id">$encoder.htmlEncode( $!dataSet.name )</option>
- #else
- <option value="$dataSet.id">$encoder.htmlEncode( $!dataSet.name )</option>
- #end
- #end)
- </select>
- </td>
- </tr>
-
- <tr>
- <td>
- <select id="periods" name="periodId" style="width: 100%;">
- #foreach( $period in $periods )
- #if( $period.externalId == $lockException.period.externalId )
- <option selected="selected" value="$period.externalId">$encoder.htmlEncode( $!period.name )</option>
- #else
- <option value="$period.externalId">$encoder.htmlEncode( $!period.name )</option>
- #end
- #end)
- </select>
- </td>
- </tr>
-
- <tr>
- <td colspan="2">
- <br/>
- <input type="submit" value="$i18n.getString( 'save' )" style="width:10em"/>
- <input type="button" value="$i18n.getString( 'cancel' )" onclick="window.location.href='lockException.action'" style="width:10em"/>
- </td>
- </tr>
-</table>
-
-</form>