dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #37558
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 19185: support sharing for constants
------------------------------------------------------------
revno: 19185
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2015-05-26 11:17:38 +0700
message:
support sharing for constants
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/descriptors/ConstantSchemaDescriptor.java
dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/constant/hibernate/Constant.hbm.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/constant.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-api/src/main/java/org/hisp/dhis/schema/descriptors/ConstantSchemaDescriptor.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/descriptors/ConstantSchemaDescriptor.java 2015-04-29 07:11:23 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/descriptors/ConstantSchemaDescriptor.java 2015-05-26 04:17:38 +0000
@@ -53,6 +53,7 @@
{
Schema schema = new Schema( Constant.class, SINGULAR, PLURAL );
schema.setRelativeApiEndpoint( API_ENDPOINT );
+ schema.setShareable( true );
schema.setOrder( 1030 );
schema.getAuthorities().add( new Authority( AuthorityType.CREATE, Lists.newArrayList( "F_CONSTANT_ADD" ) ) );
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/constant/hibernate/Constant.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/constant/hibernate/Constant.hbm.xml 2015-05-21 13:11:27 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/constant/hibernate/Constant.hbm.xml 2015-05-26 04:17:38 +0000
@@ -20,8 +20,19 @@
<property name="shortName" column="shortname" unique="true" length="50" />
<property name="description" type="text" />
-
+
<property name="value" not-null="true" />
+ <!-- Access properties -->
+ <many-to-one name="user" class="org.hisp.dhis.user.User" column="userid" foreign-key="fk_constant_userid" />
+
+ <property name="publicAccess" length="8" />
+
+ <set name="userGroupAccesses" table="constantusergroupaccesses">
+ <cache usage="read-write" />
+ <key column="constantid" />
+ <many-to-many class="org.hisp.dhis.user.UserGroupAccess" column="usergroupaccessid" unique="true" />
+ </set>
+
</class>
</hibernate-mapping>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/constant.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/constant.vm 2015-05-21 13:11:27 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/constant.vm 2015-05-26 04:17:38 +0000
@@ -1,12 +1,15 @@
+
+#sharingDialog()
+
<script type="text/javascript">
- jQuery(document).ready(function() {
- tableSorter( 'listTable' );
+ jQuery( document ).ready( function() {
+ tableSorter( 'listTable' );
- dhis2.contextmenu.makeContextMenu({
+ dhis2.contextmenu.makeContextMenu( {
menuId: 'contextMenu',
menuItemActiveClass: 'contextMenuItemActive'
- });
- });
+ } );
+ } );
var i18n_confirm_delete = '$encoder.jsEscape( $i18n.getString( "confirm_delete_constant" ) , "'")';
</script>
@@ -15,61 +18,62 @@
<div id="contextMenu" class="contextMenu">
<ul id="contextMenuItems" class="contextMenuItems">
- <li><a data-target-fn="showUpdateConstantForm"><i class="fa fa-edit"></i> $i18n.getString( "edit" )</a></li>
- <li><a data-target-fn="removeConstant"><i class="fa fa-trash-o"></i> $i18n.getString( "remove" )</a></li>
+ <li data-enabled="canManage"><a data-target-fn="showSharingDialogWithContext"><i class="fa fa-share"></i> $i18n.getString( "sharing_settings" )</a></li>
+ <li data-enabled="canUpdate"><a data-target-fn="showUpdateConstantForm"><i class="fa fa-edit"></i> $i18n.getString( "edit" )</a></li>
+ <li data-enabled="canDelete"><a data-target-fn="removeConstant"><i class="fa fa-trash-o"></i> $i18n.getString( "remove" )</a></li>
<li><a data-target-fn="showConstantDetails"><i class="fa fa-info-circle"></i> $i18n.getString( "show_details" )</a></li>
</ul>
</div>
<table class="mainPageTable">
- <tr>
- <td style="vertical-align:top">
- <table width="100%">
- <tr>
- <td>#filterDiv( "constant" )</td>
- <td colspan="4" style="text-align:right"><input type="button" value="$i18n.getString( 'add_new' )" onclick="window.location.href='showAddConstantForm.action'" style="width:80px"/></td>
- </tr>
- </table>
- <table class="listTable" id="listTable">
- <col/>
+ <tr>
+ <td style="vertical-align:top">
+ <table width="100%">
+ <tr>
+ <td>#filterDiv( "constant" )</td>
+ <td colspan="4" style="text-align:right"><input type="button" value="$i18n.getString( 'add_new' )" onclick="window.location.href='showAddConstantForm.action'" style="width:80px"/></td>
+ </tr>
+ </table>
+ <table class="listTable" id="listTable">
+ <col/>
<thead>
- <tr>
- <th>$i18n.getString( "name" )</th>
- </tr>
- </thead>
- <tbody id="list">
- #foreach( $constant in $constants )
- <tr id="tr${constant.id}">
- <td data-id="$!constant.id" data-uid="$!constant.uid" data-type="Constant" data-name="$encoder.htmlEncode( $!constant.displayName )">
- $encoder.htmlEncode( $!constant.displayName )
- </td>
- </tr>
- #end
- </tbody>
- </table>
- <p></p>
- #parse( "/dhis-web-commons/paging/paging.vm" )
- </td>
-
- <td id="detailsData">
-
- <div id="detailsArea">
- <div id="hideDetailsArea">
- <a href="javascript:hideDetails()" title="$i18n.getString( 'hide_details' )"><img src="../images/hide.png" alt="$i18n.getString( 'hide_details' )"/></a>
- </div>
- <p><label>$i18n.getString( "name" ):</label><br/><span id="nameField"></span></p>
- <p><label>$i18n.getString( "short_name" ):</label><br/><span id="shortNameField"></span></p>
- <p><label>$i18n.getString( "code" ):</label><br/><span id="codeField"></span></p>
- <p><label>$i18n.getString( "value" ):</label><br/><span id="valueField"></span></p>
- <p><label>$i18n.getString( "id" ):</label><br/><span id="idField"></span></p>
- </div>
-
- <div id="warningArea">
- <div id="hideDetailsArea">
- <a href="javascript:hideWarning()" title="$i18n.getString( 'hide_warning' )"><img src="../images/hide.png" alt="$i18n.getString( 'hide_warning' )"/></a>
- </div>
- <p><span id="warningField"></span></p>
- </div>
- </td>
- </tr>
+ <tr>
+ <th>$i18n.getString( "name" )</th>
+ </tr>
+ </thead>
+ <tbody id="list">
+ #foreach( $constant in $constants )
+ <tr id="tr${constant.id}" data-id="$!constant.id" data-uid="$!constant.uid" data-type="Constant" data-name="$encoder.htmlEncode( $!constant.displayName )"
+ data-can-manage="$security.canManage( $constant )"
+ data-can-update="$security.canUpdate( $constant )"
+ data-can-delete="$security.canDelete( $constant )">
+ <td>$encoder.htmlEncode( $!constant.displayName )</td>
+ </tr>
+ #end
+ </tbody>
+ </table>
+ <p></p>
+ #parse( "/dhis-web-commons/paging/paging.vm" )
+ </td>
+
+ <td id="detailsData">
+ <div id="detailsArea">
+ <div id="hideDetailsArea">
+ <a href="javascript:hideDetails()" title="$i18n.getString( 'hide_details' )"><img src="../images/hide.png" alt="$i18n.getString( 'hide_details' )"/></a>
+ </div>
+ <p><label>$i18n.getString( "name" ):</label><br/><span id="nameField"></span></p>
+ <p><label>$i18n.getString( "short_name" ):</label><br/><span id="shortNameField"></span></p>
+ <p><label>$i18n.getString( "code" ):</label><br/><span id="codeField"></span></p>
+ <p><label>$i18n.getString( "value" ):</label><br/><span id="valueField"></span></p>
+ <p><label>$i18n.getString( "id" ):</label><br/><span id="idField"></span></p>
+ </div>
+
+ <div id="warningArea">
+ <div id="hideDetailsArea">
+ <a href="javascript:hideWarning()" title="$i18n.getString( 'hide_warning' )"><img src="../images/hide.png" alt="$i18n.getString( 'hide_warning' )"/></a>
+ </div>
+ <p><span id="warningField"></span></p>
+ </div>
+ </td>
+ </tr>
</table>