← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5735: (patient) Add the number of days for each date-field rule.

 

------------------------------------------------------------
revno: 5735
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2012-01-15 21:53:46 +0700
message:
  (patient) Add the number of days for each date-field rule.
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramValidation.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramValidationService.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/ValidateProgramInstanceAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/dateProgramValidationForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/programValidation.js


--
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/program/ProgramValidation.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramValidation.java	2012-01-13 04:29:08 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramValidation.java	2012-01-15 14:53:46 +0000
@@ -48,24 +48,24 @@
     public static String OBJECT_PROGRAM_STAGE_DATAELEMENT = "DE";
     
 
-    public int BEFORE_CURRENT_DATE = 1;
-
-    public int BEFORE_OR_EQUALS_TO_CURRENT_DATE = 2;
-
-    public int AFTER_CURRENT_DATE = 3;
-
-    public int AFTER_OR_EQUALS_TO_CURRENT_DATE = 4;
-    
-
-    public int BEFORE_DUE_DATE = -1;
-
-    public int BEFORE_OR_EQUALS_TO_DUE_DATE = -2;
-
-    public int AFTER_DUE_DATE = -3;
-
-    public int AFTER_OR_EQUALS_TO_DUE_DATE = -4;
-    
-    public int BEFORE_DUE_DATE_PULS_MAX_DAYS_OF_DATA_ENTRY = -5;
+    public static final int BEFORE_CURRENT_DATE = 1;
+
+    public static final int BEFORE_OR_EQUALS_TO_CURRENT_DATE = 2;
+
+    public static final int AFTER_CURRENT_DATE = 3;
+
+    public static final int AFTER_OR_EQUALS_TO_CURRENT_DATE = 4;
+    
+
+    public static final int BEFORE_DUE_DATE = -1;
+
+    public static final int BEFORE_OR_EQUALS_TO_DUE_DATE = -2;
+
+    public static final int AFTER_DUE_DATE = -3;
+
+    public static final int AFTER_OR_EQUALS_TO_DUE_DATE = -4;
+    
+    public static final int BEFORE_DUE_DATE_PLUS_OR_MINUS_MAX_DAYS = -5;
 
     // -------------------------------------------------------------------------
     // Fields

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramValidationService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramValidationService.java	2012-01-13 04:29:08 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramValidationService.java	2012-01-15 14:53:46 +0000
@@ -30,6 +30,15 @@
 import static org.hisp.dhis.program.ProgramValidation.OBJECT_PROGRAM_STAGE_DATAELEMENT;
 import static org.hisp.dhis.program.ProgramValidation.SEPARATOR_ID;
 import static org.hisp.dhis.program.ProgramValidation.SEPARATOR_OBJECT;
+import static org.hisp.dhis.program.ProgramValidation.BEFORE_CURRENT_DATE;
+import static org.hisp.dhis.program.ProgramValidation.BEFORE_OR_EQUALS_TO_CURRENT_DATE;
+import static org.hisp.dhis.program.ProgramValidation.AFTER_CURRENT_DATE;
+import static org.hisp.dhis.program.ProgramValidation.AFTER_OR_EQUALS_TO_CURRENT_DATE;
+import static org.hisp.dhis.program.ProgramValidation.BEFORE_DUE_DATE;
+import static org.hisp.dhis.program.ProgramValidation.BEFORE_OR_EQUALS_TO_DUE_DATE;
+import static org.hisp.dhis.program.ProgramValidation.AFTER_DUE_DATE;
+import static org.hisp.dhis.program.ProgramValidation.AFTER_OR_EQUALS_TO_DUE_DATE;
+import static org.hisp.dhis.program.ProgramValidation.BEFORE_DUE_DATE_PLUS_OR_MINUS_MAX_DAYS;
 
 import java.util.Collection;
 import java.util.Date;
@@ -242,40 +251,51 @@
                 return true;
             }
 
-            int rightSide = Integer.parseInt( programValidation.getRightSide() );
+            String rightSide = programValidation.getRightSide();
             Date dueDate = dataValue.getProgramStageInstance().getDueDate();
             Date currentDate = dataValue.getTimestamp();
             Date value = format.parseDate( dataValue.getValue() );
 
-            switch ( rightSide )
-            {
-            case 1:
-                return value.before( currentDate );
-            case 2:
-                return (value.before( currentDate ) || value.equals( currentDate ));
-            case 3:
-                return value.after( currentDate );
-            case 4:
-                return (value.after( currentDate ) || value.equals( currentDate ));
-            case -1:
-                return value.before( dueDate );
-            case -2:
-                return (value.before( dueDate ) || value.equals( dueDate ));
-            case -3:
-                return value.after( dueDate );
-            case -4:
-                return (value.after( dueDate ) || value.equals( dueDate ));
-            case -5:
-                Integer maxDaysInProgram = programStageInstance.getProgramStage().getProgram().getMaxDaysAllowedInputData();
-                long maxDays = dueDate.getTime() / 86400000 + maxDaysInProgram ;
-                long minDays = dueDate.getTime() / 86400000 - maxDaysInProgram ;
+            int index = rightSide.indexOf( 'D' );
+            if ( index < 0 )
+            {
+                int rightValidation = Integer.parseInt( rightSide );
+
+                switch ( rightValidation )
+                {
+                case BEFORE_CURRENT_DATE:
+                    return value.before( currentDate );
+                case BEFORE_OR_EQUALS_TO_CURRENT_DATE:
+                    return (value.before( currentDate ) || value.equals( currentDate ));
+                case AFTER_CURRENT_DATE:
+                    return value.after( currentDate );
+                case AFTER_OR_EQUALS_TO_CURRENT_DATE:
+                    return (value.after( currentDate ) || value.equals( currentDate ));
+                case BEFORE_DUE_DATE:
+                    return value.before( dueDate );
+                case BEFORE_OR_EQUALS_TO_DUE_DATE:
+                    return (value.before( dueDate ) || value.equals( dueDate ));
+                case AFTER_DUE_DATE:
+                    return value.after( dueDate );
+                case AFTER_OR_EQUALS_TO_DUE_DATE:
+                    return (value.after( dueDate ) || value.equals( dueDate ));
+                default:
+                    return true;
+                }
+            }
+            
+            int rightValidation = Integer.parseInt( rightSide.substring( 0, index ) );
+
+            int daysValue = Integer.parseInt( rightSide.substring( index + 1, rightSide.length() ) );
+
+            if ( rightValidation == BEFORE_DUE_DATE_PLUS_OR_MINUS_MAX_DAYS )
+            {
+                long maxDays = dueDate.getTime() / 86400000 + daysValue;
+                long minDays = dueDate.getTime() / 86400000 - daysValue;
                 long valueDays = value.getTime() / 86400000;
-                return ( valueDays <= maxDays && valueDays >= minDays );
-            default:
-                return true;
+                return (valueDays <= maxDays && valueDays >= minDays);
             }
         }
-
         return true;
     }
 

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/ValidateProgramInstanceAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/ValidateProgramInstanceAction.java	2012-01-13 04:29:08 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/ValidateProgramInstanceAction.java	2012-01-15 14:53:46 +0000
@@ -27,6 +27,16 @@
 
 package org.hisp.dhis.caseentry.action.caseentry;
 
+import static org.hisp.dhis.program.ProgramValidation.AFTER_OR_EQUALS_TO_CURRENT_DATE;
+import static org.hisp.dhis.program.ProgramValidation.BEFORE_DUE_DATE_PLUS_OR_MINUS_MAX_DAYS;
+import static org.hisp.dhis.program.ProgramValidation.BEFORE_OR_EQUALS_TO_CURRENT_DATE;
+import static org.hisp.dhis.program.ProgramValidation.BEFORE_CURRENT_DATE;
+import static org.hisp.dhis.program.ProgramValidation.AFTER_CURRENT_DATE;
+import static org.hisp.dhis.program.ProgramValidation.BEFORE_DUE_DATE;
+import static org.hisp.dhis.program.ProgramValidation.BEFORE_OR_EQUALS_TO_DUE_DATE;
+import static org.hisp.dhis.program.ProgramValidation.AFTER_DUE_DATE;
+import static org.hisp.dhis.program.ProgramValidation.AFTER_OR_EQUALS_TO_DUE_DATE;
+
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
@@ -258,7 +268,7 @@
                 }
             }
         }
-        
+
         if ( !programValidations.isEmpty() )
         {
             leftsideFormulaMap = new HashMap<Integer, String>( programValidations.size() );
@@ -271,42 +281,61 @@
 
                 if ( validation.getDateType() )
                 {
-                    int rightSide = Integer.parseInt( validation.getRightSide() );
-
-                    switch ( rightSide )
-                    {
-                    case 1:
-                        rightsideFormulaMap.put( validation.getId(), i18n.getString( "before_current_date" ) );
-                        break;
-                    case 2:
-                        rightsideFormulaMap.put( validation.getId(), i18n
-                            .getString( "before_or_equals_to_current_date" ) );
-                        break;
-                    case 3:
-                        rightsideFormulaMap.put( validation.getId(), i18n.getString( "after_current_date" ) );
-                        break;
-                    case 4:
-                        rightsideFormulaMap
-                            .put( validation.getId(), i18n.getString( "after_or_equals_to_current_date" ) );
-                        break;
-                    case -1:
-                        rightsideFormulaMap.put( validation.getId(), i18n.getString( "before_due_date" ) );
-                        break;
-                    case -2:
-                        rightsideFormulaMap.put( validation.getId(), i18n.getString( "before_or_equals_to_due_date" ) );
-                        break;
-                    case -3:
-                        rightsideFormulaMap.put( validation.getId(), i18n.getString( "after_due_date" ) );
-                        break;
-                    case -4:
-                        rightsideFormulaMap.put( validation.getId(), i18n.getString( "after_or_equals_to_due_date" ) );
-                        break;
-                    case -5:
-                        rightsideFormulaMap.put( validation.getId(), i18n.getString( "due_date_with_max_number_of_days_of_data_entry" ) );
-                        break;
-                    default:
-                        rightsideFormulaMap.put( validation.getId(), "" );
-                        break;
+                    String rightSide = validation.getRightSide();
+                    int index = rightSide.indexOf( 'D' );
+                    if ( index < 0 )
+                    {
+                        int rightValidation = Integer.parseInt( rightSide );
+
+                        switch ( rightValidation )
+                        {
+                        case BEFORE_CURRENT_DATE:
+                            rightsideFormulaMap.put( validation.getId(), i18n.getString( "before_current_date" ) );
+                            break;
+                        case BEFORE_OR_EQUALS_TO_CURRENT_DATE:
+                            rightsideFormulaMap.put( validation.getId(), i18n
+                                .getString( "before_or_equals_to_current_date" ) );
+                            break;
+                        case AFTER_CURRENT_DATE:
+                            rightsideFormulaMap.put( validation.getId(), i18n.getString( "after_current_date" ) );
+                            break;
+                        case AFTER_OR_EQUALS_TO_CURRENT_DATE:
+                            rightsideFormulaMap.put( validation.getId(), i18n
+                                .getString( "after_or_equals_to_current_date" ) );
+                            break;
+                        case BEFORE_DUE_DATE:
+                            rightsideFormulaMap.put( validation.getId(), i18n.getString( "before_due_date" ) );
+                            break;
+                        case BEFORE_OR_EQUALS_TO_DUE_DATE:
+                            rightsideFormulaMap.put( validation.getId(), i18n
+                                .getString( "before_or_equals_to_due_date" ) );
+                            break;
+                        case AFTER_DUE_DATE:
+                            rightsideFormulaMap.put( validation.getId(), i18n.getString( "after_due_date" ) );
+                            break;
+                        case AFTER_OR_EQUALS_TO_DUE_DATE:
+                            rightsideFormulaMap
+                                .put( validation.getId(), i18n.getString( "after_or_equals_to_due_date" ) );
+                            break;
+                        default:
+                            rightsideFormulaMap.put( validation.getId(), "" );
+                            break;
+
+                        }
+                    }
+                    else
+                    {
+
+                        int rightValidation = Integer.parseInt( rightSide.substring( 0, index ) );
+
+                        int daysValue = Integer.parseInt( rightSide.substring( index + 1, rightSide.length() ) );
+
+                        if ( rightValidation == BEFORE_DUE_DATE_PLUS_OR_MINUS_MAX_DAYS )
+                        {
+                            rightsideFormulaMap.put( validation.getId(), i18n
+                                .getString( "in_range_due_date_plus_or_minus" )
+                                + " " + daysValue + i18n.getString( "days" ) );
+                        }
                     }
                 }
                 else if ( validation.getRightSide().equals( "1==1" ) )

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties	2012-01-15 02:14:29 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties	2012-01-15 14:53:46 +0000
@@ -267,10 +267,6 @@
 to=To
 ga_orgunit=OrganisationUnit
 ga_facilityby=OrganisationUnit By
-date_is_greater_then_or_equals_due_date=Date inputed >= Due date
-date_is_less_then_or_equals_plus_no_max_days=Date inputed <= ( Due Date + Number of max days allowed to input data )
-min_days=Min days
-max_days=Max days
 value_must_number=Value must be an number
 value_must_positive_integer=Value must be an positive integer
 value_must_negative_integer=Value must be an negative integer
@@ -466,5 +462,5 @@
 after_or_equals_to_due_date = After or equals to due date
 leftSide = Left Side
 rightSide = Right Side
-due_date_with_max_number_of_days_of_data_entry = Due date +/- Max number of days of data entry
+in_range_due_date_plus_or_minus = In range Due date +/-
 single_event_report = Single Event Report
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties	2012-01-15 02:14:29 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties	2012-01-15 14:53:46 +0000
@@ -276,7 +276,7 @@
 design_data_entry_form=Design data entry form
 no_of_char=Number of characters
 letter=Letter
-no_max_days_allowed_input_data=Maximum number of days allowed to input data
+no_max_days_allowed_input_data=Date range for activities
 program_attribute=Program Attribute
 program_attribute_management=Program attribute management
 create_new_program_attribute=Create new program attribute
@@ -397,7 +397,7 @@
 before_or_equals_to_due_date = Before or equals to due date
 after_due_date = After due date
 after_or_equals_to_due_date = After or equals to due date
-due_date_with_max_number_of_days_of_data_entry = Due date +/- Max number of days of data entry
+in_range_due_date = In range Due date
 data_element = Data element
 condition = Condition
 no_date_data_element_in_selected_program_stage = No data elements with date-type in the selected program stage

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/dateProgramValidationForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/dateProgramValidationForm.vm	2012-01-13 05:22:06 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/dateProgramValidationForm.vm	2012-01-15 14:53:46 +0000
@@ -2,7 +2,7 @@
 #if( $dataElementList.size() > 0 )
 	<col width="30"/>
     <col width="400"/>
-    <col/>
+    <col width="280"/>
 	
 	<tr>
 		<th>$i18n.getString('#')</th>
@@ -20,18 +20,28 @@
 			<td>$index</td>
 			<td>$dataElement.name</td>
 			<td> 
-				<select id="$dataElement.id" validationid="$!validationMap.get($dataElement.id).id" onchange="addDateValidation('$id','$dataElement.id' ,'$dataElement.name' )" >
-					<option value='' selected>[$i18n.getString('please_select')] </option>
-					<option value='1' #if( $!validationMap.get($dataElement.id).rightSide=='1' ) selected #end >$i18n.getString('before_current_date') </option>
-					<option value='3' #if( $!validationMap.get($dataElement.id).rightSide=='3' ) selected #end >$i18n.getString('after_current_date') </option>
-					<option value='2' #if( $!validationMap.get($dataElement.id).rightSide=='2' ) selected #end >$i18n.getString('before_or_equals_to_current_date') </option>
-					<option value='4' #if( $!validationMap.get($dataElement.id).rightSide=='4' ) selected #end >$i18n.getString('after_or_equals_to_current_date') </option>
-					<option value='-1' #if( $!validationMap.get($dataElement.id).rightSide=='-1' ) selected #end >$i18n.getString('before_due_date') </option>
-					<option value='-3' #if( $!validationMap.get($dataElement.id).rightSide=='-3' ) selected #end >$i18n.getString('after_due_date') </option>
-					<option value='-2' #if( $!validationMap.get($dataElement.id).rightSide=='-2' ) selected #end >$i18n.getString('before_or_equals_to_due_date') </option>
-					<option value='-4' #if( $!validationMap.get($dataElement.id).rightSide=='-4' ) selected #end >$i18n.getString('after_or_equals_to_due_date') </option>
-					<option value='-5' #if( $!validationMap.get($dataElement.id).rightSide=='-5' ) selected #end >$i18n.getString('due_date_with_max_number_of_days_of_data_entry') </option>
+				<select id="$dataElement.id" validationid="$!validationMap.get($dataElement.id).id" onchange="dateValidation('$id','$dataElement.id' ,'$dataElement.name' )" >
+					<option value=''>[$i18n.getString('please_select')] </option>
+					<option value='1'>$i18n.getString('before_current_date') </option>
+					<option value='3'>$i18n.getString('after_current_date') </option>
+					<option value='2'>$i18n.getString('before_or_equals_to_current_date') </option>
+					<option value='4'>$i18n.getString('after_or_equals_to_current_date') </option>
+					<option value='-1'>$i18n.getString('before_due_date') </option>
+					<option value='-3'>$i18n.getString('after_due_date') </option>
+					<option value='-2'>$i18n.getString('before_or_equals_to_due_date') </option>
+					<option value='-4'>$i18n.getString('after_or_equals_to_due_date') </option>
+					<option value='-5'>$i18n.getString('in_range_due_date')</option>
 				</select>
+				<span id="div$dataElement.id" style='display:none;'>
+					+/- <input type='text' id="days$dataElement.id" style="width:50px;" onchange="saveDateValidation('$id','$dataElement.id' ,'$dataElement.name' )">
+				<span>
+				
+				<script>
+					var dataElementId = '$dataElement.id';
+					var rightSide = '$!validationMap.get($dataElement.id).rightSide';
+					parseRightSide( dataElementId, rightSide );
+				</script>
+				
 			</td>
 		</tr>
 		#set ( $mark = !$mark)

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/programValidation.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/programValidation.js	2012-01-13 02:14:28 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/programValidation.js	2012-01-15 14:53:46 +0000
@@ -1,5 +1,6 @@
 
 var COLOR_GREEN = '#b9ffb9';
+var COLOR_WHITE = '#ffffff'
 
 jQuery(document).ready(	function(){
 	validation( 'programValidationForm', function( form ){			
@@ -185,12 +186,36 @@
 		});
 }
 
-function addDateValidation( id, fieldId, dataElementName )
-{
-	var expression = $("#" + fieldId + ' option:selected').val();
-	var validationid = $("#" + fieldId ).attr('validationid');
-	
-	if( validationid == '')
+function dateValidation( id, fieldId, dataElementName ) 
+{
+	var expression = $("#" + fieldId + ' option:selected').val();
+	var validationid = $("#" + fieldId ).attr('validationid');
+	
+	if( expression != -5)
+	{
+		hideById( 'div' + fieldId );
+		setFieldValue('days' + fieldId, '' );
+		saveDateValidation( id, fieldId, dataElementName );
+	}
+	else
+	{
+		byId( fieldId ).style.backgroundColor = COLOR_WHITE;
+		byId( 'days' + fieldId ).style.backgroundColor = COLOR_WHITE;
+		showById( 'div' + fieldId );
+	}
+	
+} 
+
+function saveDateValidation( id, fieldId, dataElementName )
+{
+	var expression = $("#" + fieldId + ' option:selected').val();
+	if( expression == -5 )
+	{
+		expression += "D" + getFieldValue( 'days' + fieldId );
+	}
+	var validationid = $("#" + fieldId ).attr('validationid');
+	
+	if( validationid == '' )
 	{
 		var description =  $('#programStage option:selected').text() + ' - ' + dataElementName;
 		jQuery.post( "addDateProgramValidation.action", {
@@ -202,6 +227,7 @@
 		}, function( json )
 		{
 			byId( fieldId ).style.backgroundColor = COLOR_GREEN;
+			byId( 'days' + fieldId ).style.backgroundColor = COLOR_GREEN;
 			$("#" + fieldId ).attr('validationid', json.message );
 		});
 	}
@@ -215,6 +241,7 @@
 			}, function( json )
 			{
 				byId( fieldId ).style.backgroundColor = COLOR_GREEN;
+				byId( 'days' + fieldId ).style.backgroundColor = COLOR_GREEN;
 				$("#" + fieldId ).attr('validationid', '' );
 			});
 		}
@@ -230,7 +257,25 @@
 			}, function( json )
 			{
 				byId( fieldId ).style.backgroundColor = COLOR_GREEN;
+				byId( 'days' + fieldId ).style.backgroundColor = COLOR_GREEN;
 			});
 		}
 	}
 }
+
+function parseRightSide( dataElementId, rightSide )
+{
+	var index = rightSide.indexOf('D');
+	if( index < 0 )
+	{
+		$('#' + dataElementId ).val( rightSide );
+	}
+	else
+	{
+		var selectorValue = rightSide.substr( 0,index );
+		var daysValue = rightSide.substr( index + 1,rightSide.length);
+		$('#' + dataElementId).val(selectorValue);
+		$('#days' + dataElementId ).val(daysValue);
+		showById('div' + dataElementId );
+	}
+}