← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18991: Fixed bug in Add/Update program rule forms.

 

------------------------------------------------------------
revno: 18991
committer: Tran Chau<tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2015-04-23 18:59:05 +0700
message:
  Fixed bug in Add/Update program rule forms.
modified:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/resources/struts.xml
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addProgramRule.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/programRule.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateProgramRule.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/struts.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/resources/struts.xml	2015-04-11 13:18:25 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/resources/struts.xml	2015-04-23 11:59:05 +0000
@@ -1290,6 +1290,7 @@
       <result name="success" type="velocity">/main.vm</result>
       <param name="page">/dhis-web-maintenance-program/addProgramRule.vm</param>
       <param name="javascripts">javascript/programRule.js</param>
+      <param name="stylesheets">style/basic.css</param>
       <param name="requiredAuthorities">F_PROGRAM_RULE_ADD</param>
     </action> 
     
@@ -1297,6 +1298,7 @@
       <result name="success" type="velocity">/main.vm</result>
       <param name="page">/dhis-web-maintenance-program/updateProgramRule.vm</param>
       <param name="javascripts">javascript/programRule.js</param>
+      <param name="stylesheets">style/basic.css</param>
       <param name="requiredAuthorities">F_PROGRAM_RULE_UPDATE</param>
     </action>
     

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addProgramRule.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addProgramRule.vm	2015-04-11 14:34:49 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addProgramRule.vm	2015-04-23 11:59:05 +0000
@@ -25,10 +25,7 @@
 	});
 	
 	var i18n_add_source_field = '$encoder.jsEscape( $i18n.getString( "add_source_field" ) , "'" )';
-	var i18n_display_text = '$encoder.jsEscape( $i18n.getString( "display_text" ) , "'" )';
-	var i18n_shows_a_key_data_box = '$encoder.jsEscape( $i18n.getString( "shows_a_key_data_box" ) , "'" )';
 	var i18n_hide_field = '$encoder.jsEscape( $i18n.getString( "hide_field" ) , "'" )';
-	var i18n_assign_variable = '$encoder.jsEscape( $i18n.getString( "assign_variable" ) , "'" )';
 	var i18n_show_warning = '$encoder.jsEscape( $i18n.getString( "show_warning" ) , "'" )';
 	var i18n_show_error = '$encoder.jsEscape( $i18n.getString( "show_error" ) , "'" )';
 	var i18n_this_field_is_required = '$encoder.jsEscape( $i18n.getString( "this_field_is_required" ) , "'")';
@@ -73,37 +70,54 @@
 		</tr>
 		<tr>
 			<td colspan='2'>
-				<fieldset style="height:100%;">
-					<div style="height:80px;border:1px solid black; overflow: auto;">
-						<table id='sourceFieldList' style="height:80px;width:100%" >
-							<col width="50%" />
-							<col width="50%" />
-							#set($idx = 0 )
-							#foreach($ruleVariable in $ruleVariables)
-								#set( $json_Data='{"name":"' + $ruleVariable.name + '"'
-									+ ',"sourceType":"' + $ruleVariable.sourceType + '"'
-									+ ',"dataElement":{ "id":"' + $ruleVariable.dataElement.id + '"}'
-									+ ',"program":{"id":"' + $ruleVariable.program.id + '"}'
-									+ ',"programStage":{"id":"' + "$!ruleVariable.programStage.id" + '"}}' )
-								#set($clazz = "listAlternateRow")
-								#if( $idx % 2 == 0 )
-									#set($clazz = "listRow")
-								#end		
-								#set($idx = $idx + 1 )
-								<tr class="$clazz" jsonData='$json_Data' id="$ruleVariable.uid">
-									<td>$encoder.htmlEncode($ruleVariable.dataElement.displayName)</td>
-									<td><input type='button' deId='$ruleVariable.dataElement.uid' realValue='$ruleVariable.name' value='$$ruleVariable.name' style='width:150px;' onclick='insertVariable(this)'/></td>
-								</tr>
-							#end
-						</table>
-					</div><br>
-					<input type="button" id="addMoreVariableBtn" value="+ $i18n.getString('add_source_field')" onclick="javascript:addSourceFieldForm();"/>
-				</fieldset>
+				
+				<div style="height:150px; border:1px solid black; overflow-y: auto;">
+					<table id='sourceFieldList' style="height:100px;width:100%" >
+						<col width="50%" />
+						<col width="50%" />
+						#set($idx = 0 )
+						#foreach($ruleVariable in $ruleVariables)
+							#set( $json_Data='{"name":"' + $ruleVariable.name + '"'
+								+ ',"sourceType":"' + $ruleVariable.sourceType + '"'
+								+ ',"dataElement":{ "id":"' + $ruleVariable.dataElement.id + '"}'
+								+ ',"program":{"id":"' + $ruleVariable.program.id + '"}'
+								+ ',"programStage":{"id":"' + "$!ruleVariable.programStage.id" + '"}}' )
+							#set($clazz = "listAlternateRow")
+							#if( $idx % 2 == 0 )
+								#set($clazz = "listRow")
+							#end		
+							#set($idx = $idx + 1 )
+							<tr class="$clazz" jsonData='$json_Data' id="$ruleVariable.uid">
+								<td>$!encoder.htmlEncode($ruleVariable.dataElement.displayName)</td>
+								<td><input type='button' deId='$ruleVariable.dataElement.uid' realValue='$ruleVariable.name' value='#{$ruleVariable.name}' style='width:150px;' onclick='insertVariable(this)'/></td>
+							</tr>
+						#end
+					</table>
+				</div>
+				<br>
+				<input type="button" id="addMoreVariableBtn" value="+ $i18n.getString('add_source_field')" onclick="javascript:addSourceFieldForm();"/>
 			</td>			
 			<td colspan='2'>
-				<fieldset>
-					<textarea size="10" id='condition' name='condition' style="width:98%;border:none"></textarea>
+				<fieldset style="width:80%;">
+					<textarea size="10" id='condition' name='condition' style="width:405px;border:none;height:150px;"></textarea>
 				</fieldset>
+				<br>								
+				<input type='button' class="small-button" onclick='insertOperator( "+" );' value="+" />
+				<input type='button' class="small-button" onclick='insertOperator( "-" );' value="-" />
+				<input type='button' class="small-button" onclick='insertOperator( "*" );' value="*" />
+				<input type='button' class="small-button" onclick='insertOperator( "/" );' value="/" />
+				<input type='button' class="small-button" onclick='insertOperator( "%" );' value="%" />
+				&nbsp;&nbsp;&nbsp;						
+				<input type='button' class="small-button" onclick='insertOperator( ">" );' value=">" />
+				<input type='button' class="small-button" onclick='insertOperator( ">=" );' value=">=" />
+				<input type='button' class="small-button" onclick='insertOperator( "<" );' value="<" />
+				<input type='button' class="small-button" onclick='insertOperator( "<=" );' value="<=" />
+				<input type='button' class="small-button" onclick='insertOperator( "==" );' value="==" />
+				<input type='button' class="small-button" onclick='insertOperator( "!=" );' value="!=" />
+				&nbsp;&nbsp;&nbsp;
+				<input type='button' class="small-button" onclick='insertOperator( "!" );' value="!" />
+				<input type='button' class="small-button" onclick='insertOperator( "&&" );' value="&&" />
+				<input type='button' class="small-button" onclick='insertOperator( "||" );' value="||" />
 			</td>
 		</tr>
 		

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/programRule.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/programRule.js	2015-04-11 13:18:25 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/programRule.js	2015-04-23 11:59:05 +0000
@@ -188,7 +188,7 @@
 
 function addVariableButton( name, deId )
 {
-	return "<input type='button' deId='" + deId + "' realValue='" + name + "' value='$" + name + "' style='width:150px;' onclick='insertVariable(this)'/>";
+	return "<input type='button' deId='" + deId + "' realValue='" + name + "' value='#{" + name + "}' style='width:150px;' onclick='insertVariable(this)'/>";
 }
 
 function insertVariable(_this)
@@ -328,7 +328,6 @@
 	
 }
 
-/* 
 
 $( document ).ajaxStop(function() {
 	if( status == 1 )
@@ -337,7 +336,7 @@
 		window.location.href='programRule.action?id=' + getFieldValue('programLocalId');
 	}
 }); 
-*/
+
 
 // --
 // Add new - Program Rule
@@ -385,10 +384,7 @@
 	}
 	var row = "<tr " + clazz + ">"
 			+ "<td><select class='actionList' style='width:100%'>"
-			+ "	<option value='DISPLAYTEXT'>" + i18n_display_text + "</option>"
-			+ "	<option value='DISPLAYKEYVALUEPAIR'>" + i18n_shows_a_key_data_box + "</option>"
 			+ "	<option value='HIDEFIELD'>" + i18n_hide_field + "</option>"
-			+ "	<option value='ASSIGNVARIABLE'>" + i18n_assign_variable + "</option>"
 			+ "	<option value='SHOWWARNING'>" + i18n_show_warning + "</option>"
 			+ "	<option value='SHOWERROR'>" + i18n_show_error + "</option>"
 			+ "</select>"

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateProgramRule.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateProgramRule.vm	2015-04-11 14:34:49 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateProgramRule.vm	2015-04-23 11:59:05 +0000
@@ -25,10 +25,7 @@
 	});
 	
 	var i18n_add_source_field = '$encoder.jsEscape( $i18n.getString( "add_source_field" ) , "'" )';
-	var i18n_display_text = '$encoder.jsEscape( $i18n.getString( "display_text" ) , "'" )';
-	var i18n_shows_a_key_data_box = '$encoder.jsEscape( $i18n.getString( "shows_a_key_data_box" ) , "'" )';
 	var i18n_hide_field = '$encoder.jsEscape( $i18n.getString( "hide_field" ) , "'" )';
-	var i18n_assign_variable = '$encoder.jsEscape( $i18n.getString( "assign_variable" ) , "'" )';
 	var i18n_show_warning = '$encoder.jsEscape( $i18n.getString( "show_warning" ) , "'" )';
 	var i18n_show_error = '$encoder.jsEscape( $i18n.getString( "show_error" ) , "'" )';
 	var i18n_this_field_is_required = '$encoder.jsEscape( $i18n.getString( "this_field_is_required" ) , "'")';
@@ -75,7 +72,7 @@
 		<tr>
 			<td colspan='2'>
 				<fieldset style="height:100%;">
-					<div style="height:80px;border:1px solid black; overflow: auto;">
+					<div style="height:80px;border:1px solid black; overflow-y: auto;">
 						<table id='sourceFieldList' style="height:80px;width:100%" >
 							<col width="50%" />
 							<col width="50%" />
@@ -92,8 +89,8 @@
 								#end		
 								#set($idx = $idx + 1 )
 								<tr class="$clazz" jsonData='$json_Data' id="$ruleVariable.uid">
-									<td>$encoder.htmlEncode($ruleVariable.dataElement.displayName)</td>
-									<td><input type='button' deId='$ruleVariable.dataElement.uid' realValue='$ruleVariable.name' value='$$ruleVariable.name' style='width:150px;' onclick='insertVariable(this)'/></td>
+									<td>$!encoder.htmlEncode($ruleVariable.dataElement.displayName)</td>
+									<td><input type='button' deId='$ruleVariable.dataElement.uid' realValue='$ruleVariable.name' value='#{$ruleVariable.name}' style='width:150px;' onclick='insertVariable(this)'/></td>
 								</tr>
 							#end
 						</table>
@@ -134,10 +131,7 @@
 							<tr $clazz id="$action.uid">								
 								<td>
 									<select class='actionList' style='width:100%'>
-										<option value='DISPLAYTEXT' #if($action.programRuleActionType=='DISPLAYTEXT') selected #end>$i18n.getString("display_text")</option>
-										<option value='DISPLAYKEYVALUEPAIR' #if($action.programRuleActionType=='DISPLAYKEYVALUEPAIR') selected #end>$i18n.getString("shows_a_key_data_box")</option>
 										<option value='HIDEFIELD' #if($action.programRuleActionType=='HIDEFIELD') selected #end>$i18n.getString("hide_field")</option>
-										<option value='ASSIGNVARIABLE' #if($action.programRuleActionType=='ASSIGNVARIABLE') selected #end>$i18n.getString("assign_variable")</option>
 										<option value='SHOWWARNING' #if($action.programRuleActionType=='SHOWWARNING') selected #end>$i18n.getString("show_warning")</option>
 										<option value='SHOWERROR' #if($action.programRuleActionType=='SHOWERROR') selected #end>$i18n.getString("show_error")</option>
 									</select>