← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15509: Add a link to show/hide advanced options into Add/Update program form.

 

------------------------------------------------------------
revno: 15509
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2014-06-02 12:53:15 +0800
message:
  Add a link to show/hide advanced options into Add/Update program form.
modified:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/resources/org/hisp/dhis/trackedentity/i18n_module.properties
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addProgramForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/program.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateProgramForm.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-maintenance/dhis-web-maintenance-program/src/main/resources/org/hisp/dhis/trackedentity/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/resources/org/hisp/dhis/trackedentity/i18n_module.properties	2014-06-02 02:07:05 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/resources/org/hisp/dhis/trackedentity/i18n_module.properties	2014-06-02 04:53:15 +0000
@@ -494,5 +494,5 @@
 orgunit = Organisation unit
 program_within_orgunit = Program within organisation unit
 auto_save_registration_forms = Auto save registration form 
-show_advanced_options = Show advanced options
+show_hide_advanced_options = Show advanced options
 hide_advanced_options = Hide advanced options
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addProgramForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addProgramForm.vm	2014-06-02 02:07:05 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addProgramForm.vm	2014-06-02 04:53:15 +0000
@@ -45,12 +45,8 @@
 		
 	});
 	
-	checkValueIsExist( "name", "validateProgram.action" );	
-	jQuery('[name=nonAnonymous]').hide();
-	jQuery('[name=advanced]').hide();
+	checkValueIsExist( "name", "validateProgram.action" );
 });
-		var i18n_hide_advanced_options = '$encoder.jsEscape( $i18n.getString( "hide_advanced_options" ) , "'") ';
-
 </script>
 
 <h3>$i18n.getString( "create_new_program" ) #openHelp( "program_information" )</h3>
@@ -88,8 +84,7 @@
 			</td>
 			<td></td>
 		</tr>
-
-		<tr name='nonAnonymous'>
+		<tr name='nonAnonymous' class='multiEvents'>
 			<td><label for="trackedEntityId">$i18n.getString( "tracked_entity" ) <em title="$i18n.getString( "required" )" class="required">*</em></label></td>
 			<td>
 				<select id='trackedEntityId' name='trackedEntityId' style="width: 335px;" class="{validate:{required:true}}">
@@ -222,7 +217,7 @@
 
 <br />
 
-<table name='nonAnonymous'>
+<table name='nonAnonymous' class='multiEvents'>
 	<colgroup>
         <col style="width:400px;"/>
 		<col/>
@@ -278,9 +273,10 @@
 		</td>  
 	</tr>
 </table>
-
-<p><a href='advancedOptionToggle()' id='advancedOptionsLink'>$i18n.getString('show_advanced_options')<a></p>
-
+	
+<p><a href='javascript:showAdvancedOptions()' id='showAdvancedOptionLink'>$i18n.getString('show_advanced_options') <img src='../images/asc.gif'><a></p>
+<p><a href='javascript:hideAdvancedOptions()' id='hideAdvancedOptionLink' style="display:none;">$i18n.getString('hide_advanced_options') <img src='../images/desc.gif'><a></p>
+		
 <table>
 	<tr>
 		<td colspan='3'>
@@ -292,5 +288,5 @@
 </form>
 
 <script>
-	var i18n_hide_advanced_options = '$encoder.jsEscape( $i18n.getString( "hide_advanced_options" ) , "'") ';
+	hideAdvancedOptions();
 </script>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/program.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/program.js	2014-03-31 07:46:14 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/program.js	2014-06-02 04:53:15 +0000
@@ -108,7 +108,8 @@
 
 function programOnChange() {
   var type = getFieldValue('type');
-
+  var isShowAdvancedOptions = jQuery('#showAdvancedOptionLink').is(':hidden');
+  
   // anonymous
   if( type == "3" ) {
     disable('onlyEnrollOnce');
@@ -153,6 +154,13 @@
       disable("dateOfIncidentDescription");
     }
   }
+  
+  if( isShowAdvancedOptions ){
+	showAdvancedOptions();
+  }
+  else{
+	hideAdvancedOptions();
+  }
 }
 
 // -----------------------------------------------------------------------------
@@ -276,3 +284,32 @@
     }
   }
 }
+
+function showAdvancedOptions()
+{
+	jQuery('[name=advanced]').show();
+	if( getFieldValue('type')!=3){
+		jQuery('[name=nonAnonymous]').show();
+		jQuery('.multiEvents').show();
+	}
+	else{
+		jQuery('.multiEvents').hide();
+	}
+	hideById('showAdvancedOptionLink');
+	showById('hideAdvancedOptionLink');
+}
+
+function hideAdvancedOptions()
+{
+	jQuery('[name=advanced]').hide();
+	if( getFieldValue('type')!=3){
+		jQuery('[name=nonAnonymous]').hide();
+		jQuery('.multiEvents').show();
+	}
+	else{
+		jQuery('.multiEvents').hide();
+	}
+	
+	hideById('hideAdvancedOptionLink');
+	showById('showAdvancedOptionLink');
+}

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateProgramForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateProgramForm.vm	2014-06-02 02:07:05 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateProgramForm.vm	2014-06-02 04:53:15 +0000
@@ -41,7 +41,7 @@
 			}
 			
 		});
-	checkValueIsExist( "name", "validateProgram.action",{id:getFieldValue('id')} );
+	checkValueIsExist( "name", "validateProgram.action",{id:getFieldValue('id')} );	
 });
 
 </script>
@@ -82,18 +82,7 @@
 			<td></td>
 		</tr>
 		
-		<tr>
-			<td><label for="dataEntryMethod">$i18n.getString( "data_entry_method_for_option_sets" ) </label></td>
-			<td>
-                <select id='dataEntryMethod' name='dataEntryMethod' style="width: 335px;">
-					<option value='false' #if( $program.dataEntryMethod=='false' ) selected #end>$i18n.getString('drop_down_lists')</option>
-					<option value='true' #if( $program.dataEntryMethod=='true' ) selected #end>$i18n.getString('radio_buttons')</option>
-				</select>
-			</td>
-			<td></td>
-		</tr>
-		
-		<tr name='nonAnonymous'>
+		<tr name='nonAnonymous' class='multiEvents'>
 			<td><label for="trackedEntityId">$i18n.getString( "tracked_entity" ) <em title="$i18n.getString( "required" )" class="required">*</em></label></td>
 			<td>
 				<select id='trackedEntityId' name='trackedEntityId' style="width: 335px;" class="{validate:{required:true}}">
@@ -112,6 +101,17 @@
 			<td></td>
 		</tr>
 		
+		<tr name='advanced'>
+			<td><label for="dataEntryMethod">$i18n.getString( "data_entry_method_for_option_sets" ) </label></td>
+			<td>
+                <select id='dataEntryMethod' name='dataEntryMethod' style="width: 335px;">
+					<option value='false' #if( $program.dataEntryMethod=='false' ) selected #end>$i18n.getString('drop_down_lists')</option>
+					<option value='true' #if( $program.dataEntryMethod=='true' ) selected #end>$i18n.getString('radio_buttons')</option>
+				</select>
+			</td>
+			<td></td>
+		</tr>
+		
 		<tr name='nonAnonymous'>
 			<th colspan="2">$i18n.getString( "enrollment_details" )</th>
 		</tr>
@@ -228,7 +228,7 @@
 
   <br />
 
-	<table name='nonAnonymous'>
+	<table name='nonAnonymous' class='multiEvents'>
 		<colgroup>
 			<col style="width:400px;"/>
 			<col/>
@@ -295,7 +295,10 @@
 	  </tr>
     </tbody>
   </table>  
-  	
+ 
+	<p><a href='javascript:showAdvancedOptions()' id='showAdvancedOptionLink'>$i18n.getString('show_advanced_options') <img src='../images/asc.gif'><a></p>
+	<p><a href='javascript:hideAdvancedOptions()' id='hideAdvancedOptionLink' style="display:none;">$i18n.getString('hide_advanced_options') <img src='../images/desc.gif'><a></p>
+	
   <table>
 	 <tr>
       	<td colspan='3'>