dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #21026
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9850: Add sharing function for program.
------------------------------------------------------------
revno: 9850
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2013-02-20 15:38:11 +0700
message:
Add sharing function for program.
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/SharingUtils.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramService.java
dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java
dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramService.java
dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/Program.hbm.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/addProgramForm.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/updateProgramForm.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programList.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programStage.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/common/SharingUtils.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/SharingUtils.java 2013-01-30 04:56:16 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/SharingUtils.java 2013-02-20 08:38:11 +0000
@@ -36,6 +36,7 @@
import org.hisp.dhis.indicator.Indicator;
import org.hisp.dhis.indicator.IndicatorGroup;
import org.hisp.dhis.indicator.IndicatorGroupSet;
+import org.hisp.dhis.program.Program;
import org.hisp.dhis.report.Report;
import org.hisp.dhis.reporttable.ReportTable;
import org.hisp.dhis.user.User;
@@ -109,6 +110,10 @@
SUPPORTED_TYPES.put( "userGroup", UserGroup.class );
PUBLIC_AUTHORITIES.put( UserGroup.class, "F_USERGROUP_PUBLIC_ADD" );
PRIVATE_AUTHORITIES.put( UserGroup.class, "F_USERGROUP_PRIVATE_ADD" );
+
+ SUPPORTED_TYPES.put( "program", Program.class );
+ PUBLIC_AUTHORITIES.put( Program.class, "F_PROGRAM_PUBLIC_ADD" );
+ PRIVATE_AUTHORITIES.put( Program.class, "F_PROGRAM_PRIVATE_ADD" );
}
public static boolean isSupported( String type )
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramService.java 2013-02-19 06:54:22 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramService.java 2013-02-20 08:38:11 +0000
@@ -61,11 +61,7 @@
Collection<Program> getPrograms( int type );
Collection<Program> getPrograms( int type, OrganisationUnit orgunit );
-
-// Collection<Program> getPrograms( boolean singleEvent );
-//
-// Collection<Program> getPrograms( boolean singleEvent, boolean anonymous );
-//
-// Collection<Program> getPrograms( boolean singleEvent, boolean anonymous, OrganisationUnit orgunit );
+
+ Program getProgram( String uid );
}
=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java 2013-02-07 13:44:38 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java 2013-02-20 08:38:11 +0000
@@ -164,6 +164,8 @@
executeSql( "ALTER TABLE programvalidation RENAME description TO name" );
executeSql( "UPDATE program SET blockEntryForm=false WHERE blockEntryForm is null" );
+ executeSql( "ALTER TABLE dataset DROP CONSTRAINT program_name_key" );
+ executeSql( "UPDATE userroleauthorities SET authority='F_PROGRAM_PUBLIC_ADD' WHERE authority='F_PROGRAM_ADD'" );
updateUid();
}
=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramService.java 2013-02-19 06:54:22 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramService.java 2013-02-20 08:38:11 +0000
@@ -143,4 +143,8 @@
return i18n( i18nService, programStore.getByCurrentUser() );
}
+ public Program getProgram( String uid )
+ {
+ return i18n( i18nService, programStore.getByUid( uid ) );
+ }
}
=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/Program.hbm.xml'
--- dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/Program.hbm.xml 2013-02-19 06:54:22 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/Program.hbm.xml 2013-02-20 08:38:11 +0000
@@ -13,7 +13,7 @@
</id>
&identifiableProperties;
- <property name="name" column="name" not-null="true" unique="true" length="230" />
+ <property name="name" column="name" not-null="true" length="230" />
<property name="description" type="text" />
@@ -72,5 +72,17 @@
column="userroleid" foreign-key="fk_program_userroles"/>
</set>
+ <!-- Access properties -->
+
+ <many-to-one name="user" class="org.hisp.dhis.user.User" column="userid" foreign-key="fk_program_userid" />
+
+ <property name="publicAccess" length="8" />
+
+ <set name="userGroupAccesses" table="programusergroupaccesses">
+ <cache usage="read-write" />
+ <key column="programid" />
+ <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-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/addProgramForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/addProgramForm.js 2012-10-03 04:54:22 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/addProgramForm.js 2013-02-20 08:38:11 +0000
@@ -23,5 +23,5 @@
});
- checkValueIsExist( "name", "validateProgram.action");
+ //checkValueIsExist( "name", "validateProgram.action");
});
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/updateProgramForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/updateProgramForm.js 2013-01-28 09:09:20 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/updateProgramForm.js 2013-02-20 08:38:11 +0000
@@ -21,6 +21,6 @@
}
});
- checkValueIsExist( "name", "validateProgram.action", {id:getFieldValue('id')});
+ //checkValueIsExist( "name", "validateProgram.action", {id:getFieldValue('id')});
programOnChange();
});
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programList.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programList.vm 2013-02-19 08:22:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programList.vm 2013-02-20 08:38:11 +0000
@@ -1,3 +1,5 @@
+#sharingDialog()
+
<h3>$i18n.getString( "program_management" ) #openHelp( "program" )</h3>
<table class="mainPageTable">
@@ -9,7 +11,7 @@
<table class="listTable" id="listTable">
<col>
- <col width="230">
+ <col width="270">
<thead>
<tr>
<th>$i18n.getString( "name" )</th>
@@ -23,13 +25,42 @@
<td onclick="showProgramDetails( $program.id )">$encoder.htmlEncode( $program.displayName )</td>
<td style="text-align:center">
+ #if( $security.canUpdate( $program ) )
<a href="defineProgramAssociationsForm.action?id=$program.id" title="$i18n.getString( 'assign_program_to_orgunits' )"><img src="../images/assign.png" alt="$i18n.getString( 'assign_program_to_orgunits' )"></a>
- <a href="showProgramUserroleForm.action?id=$program.id" title="$i18n.getString( 'assign_program_to_userroles' )"><img src="images/userrole.png" alt="$i18n.getString( 'assign_program_to_userroles' )"></a>
+ #else
+ <img src="../images/assign-denied.png">
+ #end
+
+ #if ( $security.canManage( $program ) )
+ <a href="javascript:showSharingDialog('program', '$program.uid');"><img src="../images/relationship.png" alt="$i18n.getString( 'sharing_settings' )"></a>
+ #else
+ <img src="../images/relationship-denied.png">
+ #end
+
+ #if( $security.canUpdate( $program ) )
+ <a href="showProgramUserroleForm.action?id=$program.id" title="$i18n.getString( 'assign_program_to_userroles' )"><img src="images/userrole.png" alt="$i18n.getString( 'assign_program_to_userroles' )"></a>
+ #else
+ <img src="images/userrole-defined.png">
+ #end
+
+ #if( $security.canUpdate( $program ) )
<a href="programValidation.action?programId=$program.id" title="$i18n.getString( 'program_validation_rule_management' )"><img src="../images/assign_b.png" alt="$i18n.getString( 'program_validation_rule_management' )"></a>
<a href="showUpdateProgramForm.action?id=$program.id" title="$i18n.getString( 'edit' )"><img src="../images/edit.png" alt="$i18n.getString( 'edit' )"></a>
<a href="javascript:translate( 'Program', '$program.id' )" title="$i18n.getString( 'translation_translate' )"><img src="../images/i18n.png" alt="$i18n.getString( 'translation_translate' )"/></a>
<a href="programStage.action?id=$program.id" title="$i18n.getString( 'view_program_stages' )"><img src="../images/add_section.png" alt="$i18n.getString( 'view_stage_management' )"></a>
+ #else
+ <img src="../images/assign_b-denied.png">
+ <img src="../images/edit-denied.png">
+ <img src="../images/i18n-denied.png">
+ <img src="images/programstage-denied.png">
+ #end
+
+ #if( $security.canDelete( $program ) )
<a href="javascript:removeProgram( '$program.id', '$encoder.jsEncode( $program.displayName )' )" title="$i18n.getString( "remove" )"><img src="../images/delete.png" alt="$i18n.getString( 'remove' )"></a>
+ #else
+ <img src="../images/delete-denied.png">
+ #end
+
<a href="javascript:showProgramDetails( $program.id )" title="$i18n.getString( 'show_details' )"><img src="../images/information.png" alt="$i18n.getString( 'show_details' )"></a>
</td>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programStage.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programStage.vm 2013-02-19 08:33:46 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programStage.vm 2013-02-20 08:38:11 +0000
@@ -13,66 +13,14 @@
#end
<input type="button" value="$i18n.getString( 'back' )" onclick="window.location.href='program.action'" style="width:150px">
</td>
- </tr>
- <tr>
- <td style="vertical-align:top" colspan=2>
- <table class="listTable" id="listTable">
- <col>
- <col>
- <col width="160">
- <thead>
- <tr>
- <th>$i18n.getString( "name" )</th>
- <th>$i18n.getString( "description" )</th>
- <th>$i18n.getString( "operations" )</th>
- </tr>
- </thead>
-
- <tbody id="list">
- #set( $mark = false )
- #foreach( $association in $associations )
- <tr id="tr${association.id}" #alternate( $mark )>
- <td onclick="showProgramStageDetails( $association.id )">$encoder.htmlEncode( $association.displayName )</td>
- <td onclick="showProgramStageDetails( $association.id )">$encoder.htmlEncode( $association.description )</td>
-
- <td style="text-align:center"#alternate( $mark )>
- <a href="showUpdateProgramStageForm.action?id=$association.id" title="$i18n.getString( "edit" )"><img src="../images/edit.png" alt="$i18n.getString( 'edit' )"></a>
- <a href="javascript:translate( 'ProgramStage', '$association.id' )" title="$i18n.getString( 'translation_translate' )"><img src="../images/i18n.png" alt="$i18n.getString( 'translation_translate' )"/></a>
- #if( $program.type=='1' )
- <a href="javascript:removeItem( '$association.id', '$encoder.jsEncode( $association.name )', i18n_confirm_delete , 'removeProgramStage.action' )" title="$i18n.getString( 'remove' )"><img src="../images/delete.png" alt="$i18n.getString( 'remove' )"></a>
- #end
- <a href="javascript:showProgramStageDetails( $association.id )" title="$i18n.getString( "show_details" )"><img src="../images/information.png" alt="$i18n.getString( 'show_details' )"></a>
- <a href="programStageSectionList.action?id=$association.id" title="$i18n.getString( 'section_management' )"><img src="images/sections.png" alt="$i18n.getString( 'section_management' )"></a>
- <a href="viewDataEntryForm.action?programStageId=$association.id" title="$i18n.getString( "design_data_entry_form" )"><img src="../images/edit_layout.png" alt="$i18n.getString( 'design_data_entry_form' )"></a>
- </td>
- </tr>
- #set( $mark = !$mark )
- #end
- </tbody>
- </table>
- </td>
-
- <td style="width:20em; padding-left:2em; vertical-align:top">
- <div id="detailsArea" style="display:none">
- <div style="float:right">
- <a href="javascript:hideDetails()" title="$i18n.getString( 'hide_details' )"><img src="../images/hide.png" alt="$i18n.getString( 'hide_details' )"></a>
- </div>
- <p><label class="bold">$i18n.getString( "name" ):</label><br><span id="nameField"></span></p>
- <p><label class="bold">$i18n.getString( "description" ):</label><br><span id="descriptionField"></span></p>
- <p><label class="bold">$i18n.getString( "scheduled_days_from_start" ):</label><br><span id="scheduledDaysFromStartField"></span></p>
- <p><label class="bold">$i18n.getString( "auto_generate_event" ):</label><br><span id="autoGenerateEventField"></span></p>
- <p><label class="bold">$i18n.getString( "irregular" ):</label><br><span id="irregularField"></span></p>
- <p><label class="bold">$i18n.getString( "display_generate_event_box_after_completed" ):</label><br><span id="displayGenerateEventBoxField"></span></p>
- <p><label class="bold">$i18n.getString( "standard_interval_days" ):</label><br><span id="standardIntervalField"></span></p>
- <p><label class="bold">$i18n.getString( "complete_allowed_only_if_validation_passes" ):</label><br><span id="validCompleteOnlyField"></span></p>
- <p><label class="bold">$i18n.getString( "report_date_description" ):</label><br><span id="reportDateDescriptionField"></span></p>
- <p><label class="bold">$i18n.getString( "no_of_dataelements" ):</label><br><span id="dataElementCountField"></span></p>
- <p><span id="templateMessageField"></span></p>
- </div>
- </td>
+ <td style="width:264px"></td>
</tr>
</table>
+<div id='programStageListDiv'>
+ #parse( "/dhis-web-maintenance-patient/programStageList.vm" )
+</div>
+
<script type="text/javascript">
var i18n_please_select_program = '$encoder.jsEscape( $i18n.getString( "please_select_program" ) , "'" )';
var i18n_confirm_delete = '$encoder.jsEscape( $i18n.getString( "confirm_delete_prorgam_stage" ) , "'" )';