dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #00916
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 276: Resolved assign-orgunit-to-user-by-group
------------------------------------------------------------
revno: 276
committer: Lars Helge Oeverland larshelge@xxxxxxxxx
branch nick: trunk
timestamp: Tue 2009-05-05 17:24:25 +0200
message:
Resolved assign-orgunit-to-user-by-group
modified:
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/xwork.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/GetUserAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/SetupTreeAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/org/hisp/dhis/user/i18n_module.properties
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/xwork.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/addUserForm.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/javascript/user.js
dhis-2/pom.xml
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/xwork.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/xwork.xml 2009-05-03 23:04:13 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/xwork.xml 2009-05-05 15:24:25 +0000
@@ -4,7 +4,6 @@
<include file="dhis-web-commons.xml"/>
<package name="dhis-web-maintenance-dataset" extends="dhis-web-commons" namespace="/dhis-web-maintenance-dataset">
-
<!-- Custom Value -->
@@ -81,12 +80,12 @@
<result name="success" type="redirect">section.action</result>
</action>
- <action name="removeSection" class="org.hisp.dhis.dataset.action.section.RemoveSectionAction">
+ <action name="removeSection" class="org.hisp.dhis.dataset.action.section.RemoveSectionAction">
<result name="success" type="chain">
<param name="actionName">section</param>
</result>
</action>
-
+
<!-- Get details -->
<action name="getDataSet"
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/GetUserAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/GetUserAction.java 2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/GetUserAction.java 2009-05-05 15:24:25 +0000
@@ -29,7 +29,12 @@
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
+import org.hisp.dhis.organisationunit.OrganisationUnitGroupService;
+import org.hisp.dhis.organisationunit.comparator.OrganisationUnitGroupNameComparator;
import org.hisp.dhis.user.UserAuthorityGroup;
import org.hisp.dhis.user.UserCredentials;
import org.hisp.dhis.user.UserStore;
@@ -54,6 +59,13 @@
this.userStore = userStore;
}
+ private OrganisationUnitGroupService organisationUnitGroupService;
+
+ public void setOrganisationUnitGroupService( OrganisationUnitGroupService organisationUnitGroupService )
+ {
+ this.organisationUnitGroupService = organisationUnitGroupService;
+ }
+
// -------------------------------------------------------------------------
// Input/output
// -------------------------------------------------------------------------
@@ -79,6 +91,13 @@
return userAuthorityGroups;
}
+ private List<OrganisationUnitGroup> organisationUnitGroups;
+
+ public List<OrganisationUnitGroup> getOrganisationUnitGroups()
+ {
+ return organisationUnitGroups;
+ }
+
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
@@ -91,6 +110,10 @@
userAuthorityGroups = new ArrayList<UserAuthorityGroup>( userStore.getAllUserAuthorityGroups() );
userAuthorityGroups.removeAll( userCredentials.getUserAuthorityGroups() );
+
+ organisationUnitGroups = new ArrayList<OrganisationUnitGroup>( organisationUnitGroupService.getAllOrganisationUnitGroups() );
+
+ Collections.sort( organisationUnitGroups, new OrganisationUnitGroupNameComparator() );
return SUCCESS;
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/SetupTreeAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/SetupTreeAction.java 2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/SetupTreeAction.java 2009-05-05 15:24:25 +0000
@@ -27,9 +27,15 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import java.util.ArrayList;
import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
+import org.hisp.dhis.organisationunit.OrganisationUnitGroupService;
+import org.hisp.dhis.organisationunit.comparator.OrganisationUnitGroupNameComparator;
import org.hisp.dhis.oust.manager.SelectionTreeManager;
import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
import org.hisp.dhis.user.CurrentUserService;
@@ -77,6 +83,13 @@
{
this.userStore = userStore;
}
+
+ private OrganisationUnitGroupService organisationUnitGroupService;
+
+ public void setOrganisationUnitGroupService( OrganisationUnitGroupService organisationUnitGroupService )
+ {
+ this.organisationUnitGroupService = organisationUnitGroupService;
+ }
// -------------------------------------------------------------------------
// Input
@@ -89,6 +102,10 @@
this.id = id;
}
+ // -------------------------------------------------------------------------
+ // Output
+ // -------------------------------------------------------------------------
+
private Collection<UserAuthorityGroup> userAuthorityGroups;
public Collection<UserAuthorityGroup> getUserAuthorityGroups()
@@ -100,6 +117,13 @@
{
this.userAuthorityGroups = userAuthorityGroups;
}
+
+ private List<OrganisationUnitGroup> organisationUnitGroups;
+
+ public List<OrganisationUnitGroup> getOrganisationUnitGroups()
+ {
+ return organisationUnitGroups;
+ }
// -------------------------------------------------------------------------
// Action implementation
@@ -139,6 +163,10 @@
userAuthorityGroups = userStore.getAllUserAuthorityGroups();
+ organisationUnitGroups = new ArrayList<OrganisationUnitGroup>( organisationUnitGroupService.getAllOrganisationUnitGroups() );
+
+ Collections.sort( organisationUnitGroups, new OrganisationUnitGroupNameComparator() );
+
return SUCCESS;
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/META-INF/dhis/beans.xml 2009-03-08 05:33:34 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/META-INF/dhis/beans.xml 2009-05-05 15:24:25 +0000
@@ -118,6 +118,31 @@
<property name="userStore">
<ref bean="org.hisp.dhis.user.UserStore"/>
</property>
+ <property name="organisationUnitGroupService">
+ <ref bean="org.hisp.dhis.organisationunit.OrganisationUnitGroupService"/>
+ </property>
+ </bean>
+
+ <bean id="org.hisp.dhis.user.action.SelectOrganisationUnitGroupMembersAction"
+ class="org.hisp.dhis.user.action.SelectOrganisationUnitGroupMembersAction"
+ scope="prototype">
+ <property name="organisationUnitGroupService">
+ <ref bean="org.hisp.dhis.organisationunit.OrganisationUnitGroupService"/>
+ </property>
+ <property name="selectionTreeManager">
+ <ref bean="org.hisp.dhis.oust.manager.SelectionTreeManager"/>
+ </property>
+ </bean>
+
+ <bean id="org.hisp.dhis.user.action.RemoveOrganisationUnitGroupMembersAction"
+ class="org.hisp.dhis.user.action.RemoveOrganisationUnitGroupMembersAction"
+ scope="prototype">
+ <property name="organisationUnitGroupService">
+ <ref bean="org.hisp.dhis.organisationunit.OrganisationUnitGroupService"/>
+ </property>
+ <property name="selectionTreeManager">
+ <ref bean="org.hisp.dhis.oust.manager.SelectionTreeManager"/>
+ </property>
</bean>
<!-- Role -->
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/org/hisp/dhis/user/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/org/hisp/dhis/user/i18n_module.properties 2009-03-24 14:27:01 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/org/hisp/dhis/user/i18n_module.properties 2009-05-05 15:24:25 +0000
@@ -159,4 +159,7 @@
filter_by_user_name = Filter by username
filter_by_role_name = Filter by rolename
phone_number = Phone number
-email_is_not_valid = E-mail is not valid
\ No newline at end of file
+email_is_not_valid = E-mail is not valid
+select_all_in_group = Select all in group
+remove_all_in_group = Remove all in group
+organisation_units = Organisation units
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/xwork.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/xwork.xml 2009-03-07 13:10:38 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/xwork.xml 2009-05-05 15:24:25 +0000
@@ -93,6 +93,16 @@
<param name="onExceptionReturn">plainTextError</param>
</action>
+ <action name="selectOrganisationUnitGroupMembers" class="org.hisp.dhis.user.action.SelectOrganisationUnitGroupMembersAction">
+ <result name="success" type="velocity-xml">/dhis-web-maintenance-user/responseSuccess.vm</result>
+ <param name="onExceptionReturn">plainTextError</param>
+ </action>
+
+ <action name="removeOrganisationUnitGroupMembers" class="org.hisp.dhis.user.action.RemoveOrganisationUnitGroupMembersAction">
+ <result name="success" type="velocity-xml">/dhis-web-maintenance-user/responseSuccess.vm</result>
+ <param name="onExceptionReturn">plainTextError</param>
+ </action>
+
<!-- Role -->
<action name="allRole" class="org.hisp.dhis.user.action.GetRoleListAction">
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/addUserForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/addUserForm.vm 2009-03-24 14:27:01 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/addUserForm.vm 2009-05-05 15:24:25 +0000
@@ -54,9 +54,9 @@
</tr>
<tr>
<td></td>
- <th>$i18n.getString( "available" )</th>
+ <th>$i18n.getString( "available_roles" )</th>
<td></td>
- <th>$i18n.getString( "selected" )</th>
+ <th>$i18n.getString( "selected_roles" )</th>
</tr>
<tr>
<td><label>$i18n.getString( "roles" )</label></td>
@@ -77,6 +77,22 @@
</td>
</tr>
<tr>
+ <td></td>
+ <th colspan="3">$i18n.getString( "organisation_units" )</th>
+ </tr>
+ <tr>
+ <td></td>
+ <td colspan="3">
+ <input type="button" value="$i18n.getString( "select_all_in_group" )" onclick="selectAllInGroup()" style="width:120px">
+ <select id="organisationUnitGroup" style="width:320px">
+ #foreach ( $group in $organisationUnitGroups )
+ <option value="$group.id">$encoder.htmlEncode( $group.name )</option>
+ #end
+ </select>
+ <input type="button" value="$i18n.getString( "remove_all_in_group" )" onclick="removeAllInGroup()" style="width:120px">
+ </td>
+ </tr>
+ <tr>
<td><label for="selectionTree">$i18n.getString( "organisation_unit" )</label></td>
<td colspan="3">
<div id="selectionTree" style="width:47em;height:300px;overflow:auto;border:1px solid #cccccc"></div>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/javascript/user.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/javascript/user.js 2009-03-24 14:45:47 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/javascript/user.js 2009-05-05 15:24:25 +0000
@@ -27,6 +27,33 @@
}
// -----------------------------------------------------------------------------
+// Add / remove organisation units
+// -----------------------------------------------------------------------------
+
+function selectAllInGroup()
+{
+ var id = getListValue( "organisationUnitGroup" );
+
+ var request = new Request();
+ request.setCallbackSuccess( groupReceived );
+ request.send( 'selectOrganisationUnitGroupMembers.action?organisationUnitGroupId=' + id );
+}
+
+function removeAllInGroup()
+{
+ var id = getListValue( "organisationUnitGroup" );
+
+ var request = new Request();
+ request.setCallbackSuccess( groupReceived );
+ request.send( 'removeOrganisationUnitGroupMembers.action?organisationUnitGroupId=' + id );
+}
+
+function groupReceived()
+{
+ selectionTree.buildSelectionTree();
+}
+
+// -----------------------------------------------------------------------------
// Remove user
// -----------------------------------------------------------------------------
=== modified file 'dhis-2/pom.xml'
--- dhis-2/pom.xml 2009-05-05 13:31:22 +0000
+++ dhis-2/pom.xml 2009-05-05 15:24:25 +0000
@@ -22,7 +22,6 @@
<module>dhis-services</module>
<module>dhis-support</module>
<module>dhis-useradminandsecurity</module>
- <module>dhis-web</module>
</modules>
<!--
<repositories>
--
Trunk
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.