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:
@@ -482,6 +482,8 @@ function saveLog($sSource, $sType, $sDescription)
|
||||
|
||||
G::verifyPath(PATH_DATA . 'log' . PATH_SEP, true);
|
||||
|
||||
//setExecutionMessage( PATH_DATA."log".PATH_SEP);
|
||||
|
||||
if ($sType == 'action') {
|
||||
$oFile = @fopen(PATH_DATA . 'log' . PATH_SEP . 'cron.log', 'a+');
|
||||
} else {
|
||||
|
||||
@@ -346,6 +346,8 @@ class CaseScheduler extends BaseCaseScheduler {
|
||||
case '4' :
|
||||
$aRow ['SCH_STATE'] = 'PROCESSED';
|
||||
break;
|
||||
case '5' :
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
@@ -505,7 +507,7 @@ class CaseScheduler extends BaseCaseScheduler {
|
||||
$newCaseLog->saveLogParameters ( $paramsLog );
|
||||
$newCaseLog->save ();
|
||||
|
||||
if ($sOption != '4') {
|
||||
if ($sOption != '4' && $sOption != '5') {
|
||||
$nSchLastRunTime = $sActualTime;
|
||||
|
||||
$dEstimatedDate = $this->updateNextRun ( $sOption, $sValue, $sActualTime, $sDaysPerformTask, $sWeeks, $sStartDay, $sMonths );
|
||||
@@ -521,12 +523,14 @@ class CaseScheduler extends BaseCaseScheduler {
|
||||
|
||||
$nSchTimeNextRun = $dEstimatedDate;
|
||||
$this->updateDate ( $sSchedulerUid, $nSchTimeNextRun, $nSchLastRunTime );
|
||||
} else {
|
||||
} elseif($sOption != '5'){
|
||||
$Fields = $this->Load ( $sSchedulerUid );
|
||||
$Fields ['SCH_LAST_STATE'] = $aRow ['SCH_STATE'];
|
||||
$Fields ['SCH_LAST_RUN_TIME'] = $Fields ['SCH_TIME_NEXT_RUN'];
|
||||
$Fields ['SCH_STATE'] = 'PROCESSED';
|
||||
$this->Update ( $Fields );
|
||||
} else {
|
||||
|
||||
}
|
||||
} else if ($sActualDataHour == $dActualSysHour && $sActualDataMinutes <= $dActualSysMinutes) {
|
||||
|
||||
@@ -629,7 +633,7 @@ class CaseScheduler extends BaseCaseScheduler {
|
||||
$newCaseLog->saveLogParameters ( $paramsLog );
|
||||
$newCaseLog->save ();
|
||||
|
||||
if ($sOption != '4') {
|
||||
if ($sOption != '4' && $sOption != '5') {
|
||||
$nSchLastRunTime = $sActualTime;
|
||||
|
||||
$dEstimatedDate = $this->updateNextRun ( $sOption, $sValue, $sActualTime, $sDaysPerformTask, $sWeeks, $sStartDay, $sMonths );
|
||||
@@ -646,12 +650,24 @@ class CaseScheduler extends BaseCaseScheduler {
|
||||
$nSchTimeNextRun = $dEstimatedDate;
|
||||
|
||||
$this->updateDate ( $sSchedulerUid, $nSchTimeNextRun, $nSchLastRunTime );
|
||||
} else {
|
||||
} elseif ($sOption != '5'){
|
||||
$Fields = $this->Load ( $sSchedulerUid );
|
||||
$Fields ['SCH_LAST_STATE'] = $aRow ['SCH_STATE'];
|
||||
$Fields ['SCH_LAST_RUN_TIME'] = $Fields ['SCH_TIME_NEXT_RUN'];
|
||||
$Fields ['SCH_STATE'] = 'PROCESSED';
|
||||
$this->Update ( $Fields );
|
||||
} else {
|
||||
$nSchLastRunTime = $sActualTime;
|
||||
$Fields = $this->Load ( $sSchedulerUid );
|
||||
$Fields ['SCH_LAST_RUN_TIME'] = $Fields ['SCH_TIME_NEXT_RUN'];
|
||||
|
||||
$nSchTimeNextRun = strtotime($Fields ['SCH_TIME_NEXT_RUN']);
|
||||
$nextRun = $Fields ['SCH_REPEAT_EVERY']*60*60;
|
||||
$nSchTimeNextRun += $nextRun;
|
||||
$nSchTimeNextRun = date("Y-m-d H:i", $nSchTimeNextRun );
|
||||
|
||||
|
||||
$this->updateDate ( $sSchedulerUid, $nSchTimeNextRun, $nSchLastRunTime );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -63,6 +63,8 @@ try {
|
||||
$sOption = $_POST['form']['SCH_OPTION'];
|
||||
$aData['SCH_OPTION'] = $sOption;
|
||||
|
||||
|
||||
|
||||
if ($_POST['form']['SCH_START_DATE']!=''){
|
||||
$sDateTmp = $_POST['form']['SCH_START_DATE'];
|
||||
} else {
|
||||
@@ -161,7 +163,8 @@ try {
|
||||
|
||||
|
||||
}
|
||||
if(($sOption!='1') && ($sOption!='4')) {
|
||||
echo "<br>sOption: ".$sOption;
|
||||
if(($sOption!='1') && ($sOption!='4') && ($sOption!='5') ) {
|
||||
if ($sStartDay==''){
|
||||
$sStartDay = date('Y-m-d');
|
||||
}
|
||||
@@ -190,8 +193,17 @@ try {
|
||||
$aData['SCH_END_DATE'] = $aData['SCH_START_TIME'];
|
||||
}
|
||||
$aData['SCH_TIME_NEXT_RUN'] = $aData['SCH_START_TIME'];
|
||||
if ($sOption == 5) {
|
||||
$aData['SCH_START_TIME'] = time();
|
||||
$aData['SCH_START_DATE'] = $aData['SCH_START_TIME'];
|
||||
$nextRun = $_POST['form']['SCH_REPEAT_EVERY']*60*60;
|
||||
$aData['SCH_REPEAT_EVERY'] = $_POST['form']['SCH_REPEAT_EVERY'];
|
||||
$date = $aData['SCH_START_TIME'];
|
||||
$date += $nextRun;
|
||||
$date = date("Y-m-d H:i", $date );
|
||||
$aData['SCH_TIME_NEXT_RUN'] = $date;
|
||||
}
|
||||
}
|
||||
|
||||
if(trim($_POST['form']['SCH_END_DATE'])!=''){
|
||||
$aData['SCH_END_DATE'] = $_POST['form']['SCH_END_DATE'];
|
||||
}
|
||||
|
||||
@@ -46,7 +46,6 @@ try {
|
||||
if (empty($_POST)) {
|
||||
die('The information sended is empty!');
|
||||
}
|
||||
|
||||
$aData['SCH_UID'] = $_POST['form']['SCH_UID'];
|
||||
$aData['SCH_NAME'] = $_POST['form']['SCH_NAME'];
|
||||
$aData['PRO_UID'] = $_POST['form']['PRO_UID'];
|
||||
@@ -162,7 +161,7 @@ try {
|
||||
$aData['SCH_END_DATE'] = $_POST['form']['SCH_END_DATE'];
|
||||
}
|
||||
// if the start date has changed then recalculate the next run time
|
||||
if ($_POST['form']['SCH_START_DATE']==$_POST['form']['PREV_SCH_START_DATE']){
|
||||
if ($_POST['form']['SCH_START_DATE']==$_POST['form']['PREV_SCH_START_DATE']) {
|
||||
$recalculateDate = false;
|
||||
} else {
|
||||
$recalculateDate = true;
|
||||
@@ -177,7 +176,7 @@ try {
|
||||
// var_dump($recalculateTime);
|
||||
// die();
|
||||
$nActualTime = $_POST['form']['SCH_START_TIME'];
|
||||
if(($sOption!='1') && ($sOption!='4')) {
|
||||
if(($sOption!='1') && ($sOption!='4') && ($sOption!='5')) {
|
||||
if ($sStartDay==''){
|
||||
$sStartDay = date('Y-m-d');
|
||||
}
|
||||
@@ -230,6 +229,18 @@ try {
|
||||
// var_dump($recalculateTime);
|
||||
// var_dump($aData['SCH_TIME_NEXT_RUN']);
|
||||
// die;
|
||||
if ($sOption=='5') {
|
||||
$date = $oCaseScheduler->getSchLastRunTime();
|
||||
if ($date == null) {
|
||||
$date = $oCaseScheduler->getSchStartTime();
|
||||
}
|
||||
$date = strtotime($date);
|
||||
$nextRun = $_POST['form']['SCH_REPEAT_EVERY']*60*60;
|
||||
$aData['SCH_REPEAT_EVERY'] = $_POST['form']['SCH_REPEAT_EVERY'];
|
||||
$date += $nextRun;
|
||||
$date = date("Y-m-d H:i", $date );
|
||||
$aData['SCH_TIME_NEXT_RUN'] = $date;
|
||||
}
|
||||
}
|
||||
|
||||
if(!empty($_POST['form']['SCH_REPEAT_TASK_CHK'])){
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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');
|
||||
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;
|
||||
|
||||
@@ -85,10 +85,27 @@
|
||||
</td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<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>
|
||||
|
||||
@@ -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,7 +392,10 @@ 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
|
||||
@@ -384,11 +403,24 @@ function showSelection(opt) {
|
||||
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,6 +656,7 @@ 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 (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;
|
||||
@@ -614,6 +665,12 @@ endDate = new Date(endDate[0],endDate[1],endDate[2]);
|
||||
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
|
||||
case '1':
|
||||
@@ -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'));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user