BUG 8038 Case Scheduler add a way to schedule tasks more often than... SOLVED

- According to the specifications.
- Was added the option "Every" that run the task each X hours.
This commit is contained in:
Marco Antonio Nina
2012-08-16 17:55:46 -04:00
parent cb5178e5a0
commit 66a3f4a446
8 changed files with 262 additions and 52 deletions

View File

@@ -96,8 +96,30 @@
</td>
</tr>
<tr>
<td class="FormLabel" width="{$form_labelWidth}"><font color="red">* </font> {$SCH_START_TIME} </td>
<td class="FormFieldContent">{$form.SCH_START_TIME}</td>
<td class="FormSubTitle" colspan="2" id="form[SELECT_EVERY]" align="">
<span>{$form.SELECT_EVERY}</span>
</td>
</tr>
<tr>
<tr>
<td colspan="2" align="center">
<table id="startTime" border="0" style="width: 100%">
<tr>
<td class="FormLabel" width="{$form_labelWidth}"><font color="red">* </font> {$SCH_START_TIME}</td>
<td class="FormFieldContent">{$form.SCH_START_TIME} format 24 hrs. (HH:MM) </td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2" align="center">
<table id="everyTime" border="0" style="width: 100%">
<tr>
<td class="FormLabel" width="{$form_labelWidth}"><font color="red">* </font> {$SCH_REPEAT_EVERY}</td>
<td class="FormFieldContent">{$form.SCH_REPEAT_EVERY} hour(s). </td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="FormSubTitle" colspan="2" id="form[SELECT_DATE]" align="">
@@ -197,11 +219,11 @@
<td style="display:none;">{$form.SCH_REPEAT_TASK_CHK}</td>
</tr>
<tr>
<td style="display:none;" class="FormLabel" width="{$form_labelWidth}">{$SCH_REPEAT_EVERY}</td>
<!--<td style="display:none;" class="FormLabel" width="{$form_labelWidth}">{$SCH_REPEAT_EVERY}</td>-->
<td style="display:none;" class="FormFieldContent">
<table style="width: 100%" style="display:none;">
<tr>
<td style="width: 30%"> {$form.SCH_REPEAT_EVERY} </td>
<!--<td style="width: 30%"> {$form.SCH_REPEAT_EVERY} </td>-->
<td > {$form.SCH_REPEAT_EVERY_OPT} {$SCH_REPEAT_EVERY_OPT} </td>
</tr>
</table>

View File

@@ -210,8 +210,14 @@ WHERE A.PRO_UID='@#PRO_UID' AND A.TAS_START = 'TRUE' ]]>
<SCH_REPEAT_TASK_CHK type="checkbox" value="On" falsevalue="Off" defaultvalue="Off" labelonright="1" enablehtml="1">
<en>Repeat Task</en>
</SCH_REPEAT_TASK_CHK>
<SCH_REPEAT_EVERY type="text" maxlength="4" validate="Int" required="0" readonly="0" size="4" mode="edit">
<en>Every</en>
<!--<SCH_REPEAT_EVERY type="text" maxlength="4" validate="Int" required="0" readonly="0" size="4" mode="edit">-->
<!--<en>Every</en>-->
<!--</SCH_REPEAT_EVERY>-->
<SELECT_EVERY type="subtitle" enablehtml="1">
<en>Record the time.</en>
</SELECT_EVERY>
<SCH_REPEAT_EVERY type="text" maxlength="5" validate="Real" mask="##.##" required="0" readonly="0" size="5" mode="edit" comma_separator =".">
<en>Execute every</en>
</SCH_REPEAT_EVERY>
<SCH_ADVANCED type="hidden" >
@@ -273,6 +279,8 @@ switch (getField('SCH_OPTION').value){
break;
case '4':
getField('SCH_OPTION_VIEW').value = 'One Time Only';
case '5':
getField('SCH_OPTION_VIEW').value = 'Every';
break;
}
@@ -289,7 +297,7 @@ function hideProperties(){
document.getElementById('form[PERFORM_TASK]').style.display='none';
document.getElementById('form[SELECT_TIME_DAY]').style.display='none';
document.getElementById('form[SELECT_PLUGIN]').style.display='none';
document.getElementById('form[SELECT_PLUGIN]').style.display='none';
document.getElementById('form[SELECT_EVERY]').style.display='none';
// end of enabling
}
@@ -301,7 +309,7 @@ function showProperties(){
document.getElementById('form[EDIT_USER]').style.display='';
document.getElementById('form[PERFORM_TASK]').style.display='';
document.getElementById('form[SELECT_TIME_DAY]').style.display='';
document.getElementById('form[SELECT_EVERY]').style.display='';
}
@@ -327,7 +335,7 @@ if (getField('SCH_REPEAT_EVERY').value!=''){
function disableAdvanced(){
//disable(getField('SCH_END_DATE'));
disable(getField('SCH_REPEAT_EVERY'));
<!--disable(getField('SCH_REPEAT_EVERY'));-->
disable(getField('SCH_REPEAT_EVERY_OPT'));
// disable(getField('SCH_REPEAT_UNTIL'));
// disable(getField('SCH_REPEAT_STOP_IF_RUNNING'));
@@ -347,7 +355,11 @@ function hideAll() {
contractSubtitle('SELECT_1');
contractSubtitle('SELECT_2');
contractSubtitle('SELECT_3');
contractSubtitle('SELECT_EVERY');
//contractSubtitle('ADVANCED_4');
document.getElementById('startTime').style.display='none';
document.getElementById('everyTime').style.display='none';
}
function showPluginSelection(opt,pro_uid) {
@@ -408,7 +420,11 @@ function showSelection(opt) {
expandSubtitle('SELECT_1');
contractSubtitle('SELECT_2');
contractSubtitle('SELECT_3');
document.getElementById('form[SELECT_EVERY]').style.display='none';
document.getElementById('endDateTable').style.display='';
document.getElementById('startTime').style.display='';
document.getElementById('everyTime').style.display='none';
// SCH_START_DATE
break;
case '2' : contractSubtitle('SELECT_DATE');
@@ -416,13 +432,16 @@ function showSelection(opt) {
expandSubtitle('SELECT_2');
contractSubtitle('SELECT_3');
hideRow('SCH_EVERY_DAYS');
document.getElementById('form[SELECT_EVERY]').style.display='none';
document.getElementById('endDateTable').style.display='';
document.getElementById('startTime').style.display='';
document.getElementById('everyTime').style.display='none';
break;
case '3' : contractSubtitle('SELECT_DATE');
contractSubtitle('SELECT_1');
contractSubtitle('SELECT_2');
expandSubtitle('SELECT_3');
document.getElementById('endDateTable').style.display='';
if (getField('SCH_START_DAY][1').checked){
getField('SCH_START_DAY_OPT_1').disabled=false;
getField('SCH_START_DAY_OPT_1').style.display="";
@@ -438,12 +457,32 @@ function showSelection(opt) {
getField('SCH_START_DAY_OPT_2_DAYS_WEEK').disabled=false;
getField('SCH_START_DAY_OPT_2_DAYS_WEEK').style.display="";
}
document.getElementById('form[SELECT_EVERY]').style.display='none';
document.getElementById('endDateTable').style.display='';
document.getElementById('startTime').style.display='';
document.getElementById('everyTime').style.display='none';
break;
case '4' : expandSubtitle('SELECT_DATE');
case '4' : expandSubtitle('SELECT_DATE');
contractSubtitle('SELECT_1');
contractSubtitle('SELECT_2');
contractSubtitle('SELECT_3');
document.getElementById('form[SELECT_EVERY]').style.display='none';
document.getElementById('endDateTable').style.display='';
document.getElementById('startTime').style.display='';
document.getElementById('everyTime').style.display='none';
break;
case '5' : expandSubtitle('SELECT_EVERY');
contractSubtitle('SELECT_1');
contractSubtitle('SELECT_2');
contractSubtitle('SELECT_3');
enable(getField('SCH_REPEAT_EVERY'));
document.getElementById('form[SELECT_TIME_DAY]').style.display='none';
document.getElementById('endDateTable').style.display='none';
document.getElementById('startTime').style.display='none';
document.getElementById('everyTime').style.display='';
break;
}
@@ -531,8 +570,8 @@ leimnud.event.add(getField('SCH_REPEAT_TASK_CHK'), 'click', function() {
// enable(getField('SCH_REPEAT_UNTIL'));
// enable(getField('SCH_REPEAT_STOP_IF_RUNNING'));
} else {
disable(getField('SCH_REPEAT_EVERY'));
disable(getField('SCH_REPEAT_EVERY_OPT'));
<!--disable(getField('SCH_REPEAT_EVERY'));-->
<!--disable(getField('SCH_REPEAT_EVERY_OPT'));-->
// disable(getField('SCH_REPEAT_UNTIL'));
// disable(getField('SCH_REPEAT_STOP_IF_RUNNING'));
}
@@ -561,6 +600,24 @@ leimnud.event.add(getField('SCH_START_TIME'), 'change', function() {
}
});
leimnud.event.add(getField('SCH_REPEAT_EVERY'), 'change', function() {
hours = getField('SCH_REPEAT_EVERY').value;
answer = hours;
var parties = answer.split('.');
if(parties[0]>23){
msgBox(G_STRINGS.ID_SCHEDULER_CANT_PUT_TIME, 'alert');
getField('SCH_REPEAT_EVERY').value='';
getField('UPDATE').focus();
}
if(parties[1]>99){
msgBox('The minutes can not be greater than 99', 'alert');
getField('SCH_REPEAT_EVERY').value='';
getField('UPDATE').focus();
}
});
leimnud.event.add(getField('SCH_REPEAT_UNTIL'), 'change', function() {
@@ -741,6 +798,12 @@ endDate = new Date(endDate[0],endDate[1],endDate[2]);
msgBox('The time format is invalid','alert');
return false;
}
if (document.getElementById('form[SCH_OPTION]').value == 5) {
if (document.getElementById('form[SCH_REPEAT_EVERY]').value==''){
requiredFields = requiredFields + 'Every,';
validFields = false;
}
}
switch(document.getElementById('form[SCH_OPTION]').value){
// daily
case '1':
@@ -818,6 +881,10 @@ endDate = new Date(endDate[0],endDate[1],endDate[2]);
validFields = true;
break;
//run once
case '5':
validFields = true;
break;
default:
validFields = false;
break;

View File

@@ -86,9 +86,26 @@
<td>&nbsp;</td>
</tr>
<tr>
<td class="FormLabel" width="{$form_labelWidth}"><font color="red">* </font> {$SCH_START_TIME}</td>
<td class="FormFieldContent">{$form.SCH_START_TIME} format 24 hrs. (HH:MM) </td>
<td colspan="2" align="center">
<table id="startTime" border="0">
<tr>
<td class="FormLabel" width="{$form_labelWidth}"><font color="red">* </font> {$SCH_START_TIME}</td>
<td class="FormFieldContent">{$form.SCH_START_TIME} format 24 hrs. (HH:MM) </td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2" align="center">
<table id="everyTime" border="0" style="width: 100%">
<tr>
<td class="FormLabel" width="{$form_labelWidth}"><font color="red">* </font> {$SCH_REPEAT_EVERY}</td>
<td class="FormFieldContent">{$form.SCH_REPEAT_EVERY} Hour(s). </td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="FormSubTitle" colspan="2" id="form[SELECT_DATE]" align="">
<span>{$form.SELECT_DATE}</span>
@@ -190,11 +207,11 @@
<td style="display:none;" >{$form.SCH_REPEAT_TASK_CHK}</td>
</tr>
<tr>
<td style="display:none;" class="FormLabel" width="{$form_labelWidth}">{$SCH_REPEAT_EVERY}</td>
<!--<td style="display:none;" class="FormLabel" width="{$form_labelWidth}">{$SCH_REPEAT_EVERY}</td>-->
<td style="display:none;" class="FormFieldContent">
<table style="width: 100%; display:none;">
<tr>
<td style="width: 30%"> {$form.SCH_REPEAT_EVERY} </td>
<!--<td style="width: 30%"> {$form.SCH_REPEAT_EVERY} </td>-->
<td > {$form.SCH_REPEAT_EVERY_OPT} {$SCH_REPEAT_EVERY_OPT} </td>
</tr>
</table>

View File

@@ -56,6 +56,7 @@
<option name="2">Weekly</option>
<option name="3">Monthly</option>
<option name="4">One time only</option>
<option name="5">Every</option>
</en>
</SCH_OPTION>
@@ -63,7 +64,7 @@
<en>Select the date and time for case(s) to be initiated.</en>
</SELECT_TIME_DAY>
<SCH_START_TIME type="text" maxlength="5" validate="Any" mask="##:##" required="1" readonly="0" size="5" mode="edit" strto="" dependentfields="" defaultvalue="" hint="" formula="" function="" sqlconnection="" savelabel="0">
<SCH_START_TIME type="text" maxlength="5" validate="Any" mask="##:##" required="0" readonly="0" size="5" mode="edit" strto="" dependentfields="" defaultvalue="" hint="" formula="" function="" sqlconnection="" savelabel="0">
<en>Execution time</en>
</SCH_START_TIME>
@@ -103,6 +104,7 @@
<SCH_EVERY_DAYS type="text" maxlength="2" defaultValue="1" validate="Int" required="0" readonly="0" size="2" mode="edit">
<en>Every</en>
</SCH_EVERY_DAYS>
<SCH_WEEK_DAYS type="checkgroup" required="0" mode="edit" options="Array" COLS="2" defaultvalue="" hint="" sqlconnection="" readonly="0" savelabel="0">
<en>Select the day(s) of the week below
<option name="1">Monday</option>
@@ -198,9 +200,16 @@
<SCH_REPEAT_TASK_CHK type="checkbox" value="On" falsevalue="Off" defaultvalue="Off" labelonright="1" enablehtml="1">
<en>Repeat Task</en>
</SCH_REPEAT_TASK_CHK>
<SCH_REPEAT_EVERY type="text" maxlength="4" validate="Int" required="0" readonly="0" size="4" mode="edit">
<en>Every</en>
<!--<SCH_REPEAT_EVERY type="text" maxlength="4" validate="Int" required="0" readonly="0" size="4" mode="edit">-->
<!--<en>Every</en>-->
<!--</SCH_REPEAT_EVERY>-->
<SCH_REPEAT_EVERY type="text" maxlength="5" validate="Real" mask="##.##" required="0" readonly="0" size="5" mode="edit">
<en>Execute every</en>
</SCH_REPEAT_EVERY>
<!--<SCH_REPEAT_EVERY type="text" maxlength="5" validate="Any" mask="##:##" required="0" readonly="0" size="5" mode="edit" strto="" dependentfields="" defaultvalue_sel="empty" hint="" formula="" function="" sqlconnection="" savelabel="0">-->
<!--<en>Every</en>-->
<!--</SCH_REPEAT_EVERY>-->
<!--SCH_START_TIME-->
<SCH_ADVANCED type="hidden" >
<en></en>
@@ -286,7 +295,8 @@ contractSubtitle('SELECT_PLUGIN');
document.getElementById('form[SELECT_1]').style.display='none';
document.getElementById('form[SELECT_2]').style.display='none';
document.getElementById('form[SELECT_3]').style.display='none';
document.getElementById('startTime').style.display='none';
document.getElementById('everyTime').style.display='none';
}
@@ -352,7 +362,10 @@ function showSelection(opt) {
contractSubtitle('SELECT_3');
//document.getElementById('form[ADVANCED_4]').style.display='';
//expandSubtitle('ADVANCED_4');
document.getElementById('endDateTable').style.display='';
document.getElementById('startTime').style.display='';
document.getElementById('everyTime').style.display='none';
break;
case '2' : // Weekly
contractSubtitle('SELECT_DATE');
@@ -361,8 +374,11 @@ function showSelection(opt) {
contractSubtitle('SELECT_3');
//document.getElementById('form[ADVANCED_4]').style.display='';
hideRow('SCH_EVERY_DAYS');
document.getElementById('endDateTable').style.display='';
//expandSubtitle('ADVANCED_4');
document.getElementById('endDateTable').style.display='';
document.getElementById('startTime').style.display='';
document.getElementById('everyTime').style.display='none';
break;
case '3' : // Monthly
contractSubtitle('SELECT_DATE');
@@ -376,20 +392,36 @@ function showSelection(opt) {
getField('SCH_START_DAY_OPT_2_WEEKS').style.display="none";
getField('SCH_START_DAY_OPT_2_DAYS_WEEK').disabled=true;
getField('SCH_START_DAY_OPT_2_DAYS_WEEK').style.display="none";
document.getElementById('endDateTable').style.display='';
document.getElementById('startTime').style.display='';
document.getElementById('everyTime').style.display='none';
//expandSubtitle('ADVANCED_4');
break;
case '4' : // One time only
case '4' : // One time only
expandSubtitle('SELECT_DATE');
contractSubtitle('SELECT_1');
contractSubtitle('SELECT_2');
contractSubtitle('SELECT_3');
document.getElementById('endDateTable').style.display='none';
document.getElementById('startTime').style.display='';
document.getElementById('everyTime').style.display='none';
//document.getElementById('form[ADVANCED_4]').style.display='';
//expandSubtitle('ADVANCED_4');
break;
}
case '5' : // Every
contractSubtitle('SELECT_DATE');
contractSubtitle('SELECT_1');
contractSubtitle('SELECT_2');
contractSubtitle('SELECT_3');
document.getElementById('endDateTable').style.display='none';
document.getElementById('startTime').style.display='none';
document.getElementById('everyTime').style.display='';
break;
}
}
@@ -497,6 +529,24 @@ leimnud.event.add(getField('SCH_START_TIME'), 'change', function() {
}
});
leimnud.event.add(getField('SCH_REPEAT_EVERY'), 'change', function() {
hours = getField('SCH_REPEAT_EVERY').value;
answer = hours;
var parties = answer.split('.');
if(parties[0]>23){
msgBox(G_STRINGS.ID_SCHEDULER_CANT_PUT_TIME, 'alert');
getField('SCH_REPEAT_EVERY').value='';
getField('SAVE').focus();
}
if(parties[1]>99){
msgBox('The minutes can not be greater than 99', 'alert');
getField('SCH_REPEAT_EVERY').value='';
getField('SAVE').focus();
}
});
/*
leimnud.event.add(getField('SCH_OPTION][1'), 'change', function() {
@@ -606,13 +656,20 @@ endDate = new Date(endDate[0],endDate[1],endDate[2]);
// for time format hh:mm
var regExpString = "([0-1]\\d|2[0-3]):([0-5]\\d)";
var timeRegexp = new RegExp(regExpString);
if (!timeRegexp.test(document.getElementById('form[SCH_START_TIME]').value)){
msgBox('The time format is invalid','alert');
return false;
}
if (document.getElementById('form[SCH_START_TIME]').value==''){
requiredFields = requiredFields + 'Execution Time,';
validFields = false;
if (document.getElementById('form[SCH_OPTION]').value != 5) {
if (!timeRegexp.test(document.getElementById('form[SCH_START_TIME]').value)){
msgBox('The time format is invalid','alert');
return false;
}
if (document.getElementById('form[SCH_START_TIME]').value==''){
requiredFields = requiredFields + 'Execution Time,';
validFields = false;
}
} else {
if (document.getElementById('form[SCH_REPEAT_EVERY]').value==''){
requiredFields = requiredFields + 'Every,';
validFields = false;
}
}
switch(document.getElementById('form[SCH_OPTION]').value){
// daily
@@ -689,6 +746,12 @@ endDate = new Date(endDate[0],endDate[1],endDate[2]);
validFields = true;
break;
//run every
case '5':
validFields = true;
break;
default:
validFields = false;
@@ -745,8 +808,8 @@ leimnud.event.add(getField('SCH_REPEAT_TASK_CHK'), 'click', function() {
// enable(getField('SCH_REPEAT_UNTIL'));
// enable(getField('SCH_REPEAT_STOP_IF_RUNNING'));
} else {
disable(getField('SCH_REPEAT_EVERY'));
disable(getField('SCH_REPEAT_EVERY_OPT'));
<!--disable(getField('SCH_REPEAT_EVERY'));-->
<!--disable(getField('SCH_REPEAT_EVERY_OPT'));-->
// disable(getField('SCH_REPEAT_UNTIL'));
// disable(getField('SCH_REPEAT_STOP_IF_RUNNING'));
}