← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 11664: Merge from branch lp:~dhis2-devs-core/dhis2/psidataelementtooltip by James Chang. Adds option for...

 

Merge authors:
  James Chang (jamesbchang)
------------------------------------------------------------
revno: 11664 [merge]
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2013-08-14 13:04:31 +0200
message:
  Merge from branch lp:~dhis2-devs-core/dhis2/psidataelementtooltip by James Chang. Adds option for tooltip/decoration on data elements in the form of link to data element URL and display of description in section/default forms.
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSet.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataset/hibernate/DataSet.hbm.xml
  dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/batchhandler/DataSetBatchHandler.java
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/cacheManifest.vm
  dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/LoadFormAction.java
  dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/sectionForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/AddDataSetAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/UpdateDataSetAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/org/hisp/dhis/dataset/i18n_module.properties
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/addDataSet.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/editDataSet.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/dataelement/DataElement.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java	2013-05-25 06:19:23 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java	2013-08-14 11:04:31 +0000
@@ -450,6 +450,16 @@
 
         return expiryDays == Integer.MAX_VALUE ? NO_EXPIRY : expiryDays;
     }
+    
+    public boolean hasDescription()
+    {
+        return description != null && !description.trim().isEmpty();
+    }
+    
+    public boolean hasUrl()
+    {
+        return url != null && !url.trim().isEmpty();
+    }
 
     // -------------------------------------------------------------------------
     // Getters and setters

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSet.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSet.java	2013-07-08 09:42:17 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSet.java	2013-08-14 11:04:31 +0000
@@ -187,6 +187,11 @@
      */
     private boolean skipOffline;
 
+   /**
+     * Property indicating whether it should enable data elements decoration in forms.
+     */
+    private boolean dataElementDecoration;
+
     /**
      * Render default and section forms with tabs instead of multiple sections in one page
      */
@@ -712,6 +717,19 @@
         this.renderHorizontally = renderHorizontally;
     }
 
+    @JsonProperty
+    @JsonView( { DetailedView.class, ExportView.class } )
+    @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
+    public boolean isDataElementDecoration()
+    {
+        return dataElementDecoration;
+    }
+
+    public void setDataElementDecoration( boolean dataElementDecoration )
+    {
+        this.dataElementDecoration = dataElementDecoration;
+    }    
+	
     @Override
     public void mergeWith( IdentifiableObject other )
     {
@@ -735,6 +753,8 @@
             renderAsTabs = dataSet.isRenderAsTabs();
             renderHorizontally = dataSet.isRenderHorizontally();
 
+            dataElementDecoration = dataSet.isDataElementDecoration();
+ 
             removeAllDataElements();
 
             for ( DataElement dataElement : dataSet.getDataElements() )

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java	2013-08-05 08:23:16 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java	2013-08-13 16:43:37 +0000
@@ -620,6 +620,8 @@
         executeSql( "ALTER TABLE dataelement ALTER COLUMN domaintype SET NOT NULL" );
         executeSql( "update dataelementcategory set datadimension = false where datadimension is null" );
         
+		executeSql( "UPDATE dataset SET dataelementdecoration=false WHERE dataelementdecoration is null" );
+
         executeSql( "alter table validationrulegroup rename column validationgroupid to validationrulegroupid" );
         executeSql( "alter table sqlview rename column viewid to sqlviewid" );
 

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataset/hibernate/DataSet.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataset/hibernate/DataSet.hbm.xml	2013-07-08 09:42:17 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataset/hibernate/DataSet.hbm.xml	2013-08-13 16:43:37 +0000
@@ -90,6 +90,8 @@
 
     <property name="skipOffline" />
 
+    <property name="dataElementDecoration" />
+    
     <property name="renderAsTabs" />
 
     <property name="renderHorizontally" />

=== modified file 'dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/batchhandler/DataSetBatchHandler.java'
--- dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/batchhandler/DataSetBatchHandler.java	2013-07-08 10:12:23 +0000
+++ dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/batchhandler/DataSetBatchHandler.java	2013-08-14 11:04:31 +0000
@@ -105,6 +105,7 @@
         statementBuilder.setColumn( "fieldcombinationrequired" );
         statementBuilder.setColumn( "validcompleteonly" );
         statementBuilder.setColumn( "skipoffline" );
+        statementBuilder.setColumn( "dataelementdecoration" );
         statementBuilder.setColumn( "renderastabs" );
         statementBuilder.setColumn( "renderhorizontally" );
     }
@@ -126,6 +127,7 @@
         statementBuilder.setValue( dataSet.isFieldCombinationRequired() );
         statementBuilder.setValue( dataSet.isValidCompleteOnly() );
         statementBuilder.setValue( dataSet.isSkipOffline() );
+        statementBuilder.setValue( dataSet.isDataElementDecoration() );
         statementBuilder.setValue( dataSet.isRenderAsTabs() );
         statementBuilder.setValue( dataSet.isRenderHorizontally() );
     }

=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/cacheManifest.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/cacheManifest.vm	2013-08-12 22:04:17 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/cacheManifest.vm	2013-08-14 11:04:31 +0000
@@ -1,5 +1,5 @@
 CACHE MANIFEST
-# 2.13-SNAPSHOT V4
+# 2.13-SNAPSHOT V5
 NETWORK:
 *
 CACHE:

=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/LoadFormAction.java'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/LoadFormAction.java	2013-07-08 04:59:58 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/LoadFormAction.java	2013-08-12 09:20:12 +0000
@@ -233,6 +233,7 @@
     public String execute()
         throws Exception
     {
+                
         dataSet = dataSetService.getDataSet( dataSetId, true, false, false, true );
 
         List<DataElement> dataElements = new ArrayList<DataElement>( dataElementService.getDataElements( dataSet, null,
@@ -378,7 +379,7 @@
         {
             getOtherDataEntryForm( dataElements, dataSet );
         }
-
+        
         return displayMode;
     }
 

=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/sectionForm.vm'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/sectionForm.vm	2013-08-12 17:52:33 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/sectionForm.vm	2013-08-14 11:04:31 +0000
@@ -1,6 +1,7 @@
 
 #set( $tabIndex = 1 )
 #set( $hasAccess = $auth.hasAccess( "dhis-web-dataentry", "saveValue" ) )
+#set( $decoration = $dataSet.dataElementDecoration )
 
 #if( $dataSet.renderAsTabs )
     <div id="tabs">
@@ -78,7 +79,10 @@
     #end
     #set( $count = $count + 1 )
     <tr>
-    <td id="${dataElement.uid}-cell" #if( $mark == 1 )class="alt"#else class="reg"#end><span id="${dataElement.uid}-dataelement">${encoder.htmlEncode( $dataElement.getFormNameFallback() )}</span></td>
+    <td id="${dataElement.uid}-cell" #if( $mark == 1 )class="alt"#else class="reg"#end>
+    <span id="${dataElement.uid}-dataelement" #if( $decoration && $dataElement.hasDescription() ) title="$!{dataElement.description}"#end >
+    #if( $decoration && $!dataElement.hasUrl() )<a href="${dataElement.url}" target="_blank">#end${encoder.htmlEncode( $dataElement.getFormNameFallback() )}#if( $decoration && $dataElement.hasUrl() )</a>#end
+    </span></td>    
     #foreach( $optionCombo in $optionCombos )
     #set( $dataEntryId = "${dataElement.uid}-${optionCombo.uid}-val" )
     #set( $commentId = "${dataElement.uid}-${optionCombo.uid}-comment" )

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/AddDataSetAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/AddDataSetAction.java	2013-07-08 09:42:17 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/AddDataSetAction.java	2013-08-13 16:43:37 +0000
@@ -184,6 +184,13 @@
         this.skipOffline = skipOffline;
     }
 
+    private boolean dataElementDecoration;
+
+    public void setDataElementDecoration( boolean dataElementDecoration )
+    {
+        this.dataElementDecoration = dataElementDecoration;
+    }
+
     private boolean renderAsTabs;
 
     public void setRenderAsTabs( boolean renderAsTabs )
@@ -256,6 +263,7 @@
         dataSet.setValidCompleteOnly( validCompleteOnly );
         dataSet.setNotifyCompletingUser( notifyCompletingUser );
         dataSet.setSkipOffline( skipOffline );
+        dataSet.setDataElementDecoration( dataElementDecoration );		
         dataSet.setRenderAsTabs( renderAsTabs );
         dataSet.setRenderHorizontally( renderHorizontally );
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/UpdateDataSetAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/UpdateDataSetAction.java	2013-07-08 09:42:17 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/UpdateDataSetAction.java	2013-08-13 16:43:37 +0000
@@ -202,6 +202,13 @@
         this.skipOffline = skipOffline;
     }
 
+    private boolean dataElementDecoration;
+
+    public void setDataElementDecoration( boolean dataElementDecoration )
+    {
+        this.dataElementDecoration = dataElementDecoration;
+    }
+
     private boolean renderAsTabs;
 
     public void setRenderAsTabs( boolean renderAsTabs )
@@ -284,6 +291,7 @@
         dataSet.setValidCompleteOnly( validCompleteOnly );
         dataSet.setNotifyCompletingUser( notifyCompletingUser );
         dataSet.setSkipOffline( skipOffline );
+        dataSet.setDataElementDecoration( dataElementDecoration );		
         dataSet.setRenderAsTabs( renderAsTabs );
         dataSet.setRenderHorizontally( renderHorizontally );
         dataSet.setNotificationRecipients( userGroupService.getUserGroup( notificationRecipients ) );

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/org/hisp/dhis/dataset/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/org/hisp/dhis/dataset/i18n_module.properties	2013-07-20 12:35:56 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/org/hisp/dhis/dataset/i18n_module.properties	2013-08-14 11:04:31 +0000
@@ -107,4 +107,5 @@
 auto_save_data_entry_forms=Auto-save data entry forms
 notify_completing_user=Send notification to completing user
 insert_images=Insert images
-pdf_data_entry_form=Get PDF for Data Entry
\ No newline at end of file
+dataelementdecoration=Data element decoration
+pdf_data_entry_form=Get PDF for Data Entry

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/addDataSet.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/addDataSet.vm	2013-07-19 08:23:53 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/addDataSet.vm	2013-08-13 16:43:37 +0000
@@ -164,6 +164,15 @@
         </td>
       </tr>
       <tr>
+        <td><label>$i18n.getString( "dataelementdecoration" )</label></td>
+        <td>
+          <select id="dataElementDecoration" name="dataElementDecoration">
+            <option value="false">$i18n.getString( "no" )</option>
+            <option value="true">$i18n.getString( "yes" )</option>
+          </select>
+        </td>
+      </tr>      
+      <tr>
         <td><label>$i18n.getString( "render_as_tabs" )</label></td>
         <td>
           <select id="renderAsTabs" name="renderAsTabs">

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/editDataSet.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/editDataSet.vm	2013-07-19 08:23:53 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/editDataSet.vm	2013-08-13 18:04:12 +0000
@@ -164,6 +164,15 @@
         </td>
       </tr>
       <tr>
+        <td><label for="dataElementDecoration">$i18n.getString( "dataelementdecoration" )</label></td>
+        <td>
+          <select id="dataElementDecoration" name="dataElementDecoration">
+            <option value="false">$i18n.getString( "no" )</option>
+            <option value="true"#if( $dataSet.dataElementDecoration == true ) selected="selected"#end>$i18n.getString( "yes" )</option>
+          </select>
+        </td>
+      </tr>      
+      <tr>
         <td><label for="renderAsTabs">$i18n.getString( "render_as_tabs" )</label></td>
         <td>
           <select id="renderAsTabs" name="renderAsTabs">