← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16964: Sharing dialog, display user created by

 

------------------------------------------------------------
revno: 16964
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2014-10-06 15:02:52 +0200
message:
  Sharing dialog, display user created by
modified:
  dhis-2/dhis-services/dhis-service-core/src/main/resources/i18n_global.properties
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/SharingController.java
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.sharing.js
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/macros.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-services/dhis-service-core/src/main/resources/i18n_global.properties'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/i18n_global.properties	2014-09-12 15:30:51 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/i18n_global.properties	2014-10-06 13:02:52 +0000
@@ -730,6 +730,7 @@
 search_for_user_groups=Search for user groups
 object_will_created_public=This object will be created with public edit and view rights
 object_will_created_private=This object will be private to yourself
+created_by=Created by
 
 #-- Countries / flags ---------------------------------------------------------#
 

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/SharingController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/SharingController.java	2014-05-22 12:40:24 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/SharingController.java	2014-10-06 13:02:52 +0000
@@ -83,7 +83,7 @@
     @Autowired
     private AclService aclService;
 
-    @RequestMapping( value = "", produces = { "application/json", "text/*" } )
+    @RequestMapping( method = RequestMethod.GET, produces = { "application/json" } )
     public void getSharing( @RequestParam String type, @RequestParam String id, HttpServletResponse response ) throws IOException
     {
         if ( !aclService.isShareable( type ) )
@@ -154,7 +154,7 @@
         JacksonUtils.toJson( response.getOutputStream(), sharing );
     }
 
-    @RequestMapping( value = "", method = { RequestMethod.POST, RequestMethod.PUT }, consumes = "application/json" )
+    @RequestMapping( method = { RequestMethod.POST, RequestMethod.PUT }, consumes = "application/json" )
     public void setSharing( @RequestParam String type, @RequestParam String id, HttpServletResponse response, HttpServletRequest request ) throws IOException
     {
         Class<? extends IdentifiableObject> sharingClass = aclService.classForType( type );
@@ -251,7 +251,7 @@
         ContextUtils.okResponse( response, "Access control set" );
     }
 
-    @RequestMapping( value = "/search", produces = { "application/json", "text/*" } )
+    @RequestMapping( value = "/search", method = RequestMethod.GET, produces = { "application/json" } )
     public void searchUserGroups( @RequestParam String key, HttpServletResponse response ) throws IOException
     {
         SharingUserGroups sharingUserGroups = new SharingUserGroups();

=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.sharing.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.sharing.js	2014-05-26 21:36:48 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.sharing.js	2014-10-06 13:02:52 +0000
@@ -140,6 +140,15 @@
   return v;
 }
 
+function setCreatedBy( user ) {
+	if ( user && user.name ) {
+		$('#sharingUser').text(user.name);
+	}
+	else {
+		$('#sharingUser').text("[None]");
+	}
+}
+
 function showSharingDialogWithContext( context ) {
   // context always give type which starts with UpperCase
   var type = context.type.charAt(0).toLowerCase() + context.type.slice(1);
@@ -148,6 +157,7 @@
 
 function showSharingDialog( type, uid ) {
   loadSharingSettings(type, uid).done(function( data ) {
+	setCreatedBy(data.object.user);
     setPublicAccess(data.object.publicAccess);
     setExternalAccess(data.object.externalAccess);
     setUserGroupAccesses(data.object.userGroupAccesses);
@@ -170,7 +180,7 @@
       modal: true,
       resizable: false,
       width: 485,
-      height: 480,
+      height: 500,
       buttons: {
         'Cancel': function() {
           $(this).dialog('close');

=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/macros.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/macros.vm	2014-09-24 11:57:54 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/macros.vm	2014-10-06 13:02:52 +0000
@@ -333,10 +333,9 @@
             <tr>
                 <td colspan="2" style="height: 40px"><span class="settingHeader" id="sharingName"></span></td>
             </tr>
-
             <tr>
                 <td><input style="width: 100%;" id="sharingFindUserGroup" placeholder="$i18n.getString( 'search_for_user_groups' )"/></td>
-                <td style="width: 24px;"><button id="addUserGroupAccess" disabled="disabled" style="width: 24px; text-align: center;">+</button></td>
+                <td style="width: 24px;"><button id="addUserGroupAccess" disabled="disabled" style="width:24px; margin-left:2px; text-align:center;">+</button></td>
             </tr>
         </tbody>
     </table>
@@ -344,7 +343,10 @@
     <table id="sharingAccessTable" style="width: 100%; margin-top: 6px;">
         <tbody>
         <tr>
-            <td style="width: 300px; padding-top: 5px; padding-bottom: 5px;">$i18n.getString( "external_access" )</td>
+        	<td colspan="2" style="padding: 5px 0"><span class="tipText">$i18n.getString( "created_by" ): </span><span class="tipText" id="sharingUser"></span></td>
+        </tr>
+        <tr>
+        	<td style="width: 300px; padding: 5px 0;">$i18n.getString( "external_access" )</td>
             <td style="text-align: right;">
                 <input id="sharingExternalAccess" type="checkbox" value="true" />
             </td>