dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #19706
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8709: mobile: only show recipients that are not already added in search + other minor fixes.
------------------------------------------------------------
revno: 8709
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2012-10-25 15:41:53 +0200
message:
mobile: only show recipients that are not already added in search + other minor fixes.
modified:
dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/base.vm
dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/index.vm
dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/new-message.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-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/base.vm'
--- dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/base.vm 2012-10-23 17:12:46 +0000
+++ dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/base.vm 2012-10-25 13:41:53 +0000
@@ -1,6 +1,6 @@
<!DOCTYPE html>
<html manifest="app-cache">
-<!-- <html> -->
+<!-- <html> -->
<head>
<title>DHIS2</title>
@@ -10,6 +10,8 @@
<link rel="stylesheet" href="$baseUrl/../dhis-web-mobile-resources/css/jquery.mobile.min.css?v=1.2.0" />
<script src="$baseUrl/../dhis-web-commons/javascripts/jQuery/jquery.min.js?v=1.7.1"></script>
+ <script src="$baseUrl/../dhis-web-commons/javascripts/dhis2/dhis2.util.js"></script>
+ <script src="$baseUrl/../dhis-web-commons/javascripts/dhis2/dhis2.array.js"></script>
<script src="$baseUrl/../dhis-web-mobile-resources/js/underscore.min.js?v=1.3.3"></script>
<script src="$baseUrl/../dhis-web-mobile-resources/js/jquery.mobile.min.js?v=1.2.0"></script>
<script src="$baseUrl/../dhis-web-mobile-resources/js/dhis2.storage.js"></script>
=== modified file 'dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/index.vm'
--- dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/index.vm 2012-10-24 14:44:08 +0000
+++ dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/index.vm 2012-10-25 13:41:53 +0000
@@ -106,12 +106,12 @@
<h3></h3>
<% if( dvsSize == 0 ) { %>
- <p>No data is stored locally.</p>
+ <p>No data is stored.</p>
<% } else { %>
<% if( dvsSize == 1 ) { %>
- <p>You have <strong><%= dvsSize %></strong> form stored locally</p>
+ <p>You have <strong><%= dvsSize %></strong> form stored.</p>
<% } else { %>
- <p>You have <strong><%= dvsSize %></strong> forms stored locally</p>
+ <p>You have <strong><%= dvsSize %></strong> forms stored.</p>
<% } %>
<% } %>
=== modified file 'dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/new-message.vm'
--- dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/new-message.vm 2012-10-21 15:12:36 +0000
+++ dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/new-message.vm 2012-10-25 13:41:53 +0000
@@ -118,29 +118,67 @@
'filter' : search
}
}).success(function ( data ) {
- if( data.organisationUnits && data.organisationUnits.length > 0)
+ var organisationUnits = data.organisationUnits;
+ var users = data.users;
+ var userGroups = data.userGroups;
+
+ // filter away already selected recipients
+ _( selected ).each(function( val, key ) {
+ if( key.indexOf( 'ou:') != -1 )
+ {
+ var id = key.substring(3);
+
+ _( organisationUnits ).each(function(n, idx) {
+ if( n.id == id ) {
+ dhis2.array.remove( organisationUnits, idx, idx );
+ }
+ });
+ }
+ else if( key.indexOf( 'u:') != -1 )
+ {
+ var id = key.substring(2);
+
+ _( users ).each(function(n, idx) {
+ if( n.id == id ) {
+ dhis2.array.remove( users, idx, idx );
+ }
+ });
+ }
+ else if( key.indexOf( 'ug:') != -1 )
+ {
+ var id = key.substring(3);
+
+ _( userGroups ).each(function(n, idx) {
+ if( n.id == id ) {
+ dhis2.array.remove( userGroups, idx, idx );
+ }
+ });
+ }
+ });
+
+ if( organisationUnits && organisationUnits.length > 0)
{
$('#selection-list').append('<li id="organisation-unit-list" data-role="list-divider">Organisation Units</li>')
- _(data.organisationUnits).each(function(organisationUnit) {
+ _(organisationUnits).each(function(organisationUnit) {
$('#selection-list').append('<li onclick="addRecipient(this);" data-prefix="ou" data-icon="plus" data-id="' + organisationUnit.id + '"><a href="#">' + organisationUnit.name + '</a></li>');
});
}
- if( data.users && data.users.length > 0 )
+ if( users && users.length > 0 )
{
$('#selection-list').append('<li id="user-list" data-role="list-divider">Users</li>')
- _(data.users).each(function(user) {
+ _(users).each(function(user) {
$('#selection-list').append('<li onclick="addRecipient(this);" data-prefix="u" data-icon="plus" data-id="' + user.id + '"><a href="#">' + user.name + '</a></li>');
});
}
- if( data.userGroups && data.userGroups.length > 0 )
+ if( userGroups && userGroups.length > 0 )
{
$('#selection-list').append('<li id="user-group-list" data-role="list-divider">Users Groups</li>')
- _(data.userGroups).each(function(userGroup) {
+ _(userGroups).each(function(userGroup) {
$('#selection-list').append('<li onclick="addRecipient(this);" data-prefix="ug" data-icon="plus" data-id="' + userGroup.id + '"><a href="#">' + userGroup.name + '</a></li>');
});
}