opt
/
kaspersky
/
kav4fs
/
share
/
wmconsole
/
html
/
js
/
awt
/
sch
➕ New
📤 Upload
✎ Editing:
scheduler_model.js
← Back
function voSchedule($elem){ var voSch = this; voSch.$elem = $elem; voSch.isSet = false; voSch.params = { onDate : function(){}, onTime : function(){}, onType : function(){}, onRandomInterval : function(){}, onRunMissedStartRules : function(){}, onTimePeriod : function(){}, onExecuteTimeLimit : function(){}, onDayOfWeek : function(){}, onDayOfMonth : function(){}, onChange : function(){} }; voSch.ruleTypeControl = {}; voSch.ruleTypeControl[ ic.TaskClass.OAS ] = $elem.find('.schRuleType #rtp'); voSch.ruleTypeControl[ ic.TaskClass.ODS ] = voSch.ruleTypeControl[ ic.TaskClass.QS ] = $elem.find('.schRuleType #ods'); voSch.ruleTypeControl[ ic.TaskClass.Update ] = $elem.find('.schRuleType #update'); voSch.currentTaskClass = ic.TaskClass.ODS; voSch.$elem.find('.schTableArea .schDate').datepick({'onSelect': function(timeStrLocal,obj){ if(!voSch.isSet) { voSch.params.onDate(obj.currentYear, obj.currentMonth, obj.currentDay); voSch.params.onChange(); } }}); voSch.$elem.find('.schTableArea .schTime').timeEntry({'showSeconds':true}).change(function(){ if(!voSch.isSet) { var obj = $(this).timeEntry('getTime'); voSch.params.onTime(obj.getHours(), obj.getMinutes(), obj.getSeconds()); voSch.params.onChange(); } }); voSch.$elem.find('.schTableArea .schOpt_3 .schDayOfMonth').each(function(){ misc_setupSizeCorrector($(this), { min : 1, max : 31 }); }); voSch.$elem.find('.schTableArea .schOpt_4 .schTimePeriod').each(function(){ misc_setupSizeCorrector($(this), { min : 1, max : 999 }); }); voSch.$elem.find('.schTableArea .schOpt_5 .schTimePeriod').each(function(){ misc_setupSizeCorrector($(this), { min : 1, max : 999 }); }); voSch.$elem.find('.schTableArea .schOpt_6 .schTimePeriod').each(function(){ misc_setupSizeCorrector($(this), { min : 1, max : 365 }); }); voSch.$elem.find('.schTableArea .schTimePeriod').change(function(){ if(!voSch.isSet) { voSch.params.onTimePeriod(this.value); voSch.params.onChange(); } }); voSch.$elem.find('.schTableArea .schDayOfMonth').change(function(){ if(!voSch.isSet) { voSch.params.onDayOfMonth(this.value); voSch.params.onChange(); } }); voSch.$elem.find('.schTableArea .schDayOfWeek').change(function(){ if(!voSch.isSet) { voSch.params.onDayOfWeek(this.value); voSch.params.onChange(); } }); voSch.$elem.find('.schOpt. .schMinute').each(function(){ misc_setupSizeCorrector($(this), { min : 1, max : 999 }); }); voSch.$elem.find('.schRuleType select').bind('change', function(){ voSch.$elem.find('.schTableArea .schAllType').hide(); voSch.$elem.find('.schTableArea .schOpt_'+this.value).show(); voSch.$elem.find('.schOpt input').attr('disabled',1).filter().val(1); if(voSch.currentTaskClass != ic.TaskClass.OAS) voSch.$elem.find('.schOpt input.schOpt_'+this.value).removeAttr('disabled'); if(!voSch.isSet) { voSch.params.onType(this.value); voSch.params.onChange(); } }); voSch.$elem.find('.schOpt .ExecuteTimeLimitEnable').change(function(){ if(!!$(this).attr('checked')) voSch.$elem.find('.schOpt .ExecuteTimeLimit').val(1).removeAttr('disabled').change(); else { voSch.$elem.find('.schOpt .ExecuteTimeLimit').val(0).attr('disabled',1); if(!voSch.isSet) { voSch.params.onExecuteTimeLimit(0); voSch.params.onChange(); } } }); voSch.$elem.find('.schOpt .ExecuteTimeLimit').change(function(){ if(!voSch.isSet) { voSch.params.onExecuteTimeLimit(this.value); voSch.params.onChange(); } }); voSch.$elem.find('.schOpt .RandomIntervalEnable').change(function(){ if(!!$(this).attr('checked')) voSch.$elem.find('.schOpt .RandomInterval').val(1).removeAttr('disabled').change(); else { voSch.$elem.find('.schOpt .RandomInterval').val(0).attr('disabled',1); if(!voSch.isSet) { voSch.params.onRandomInterval(0); voSch.params.onChange(); } } }); voSch.$elem.find('.schOpt .RandomInterval').change(function(){ if(!voSch.isSet) { voSch.params.onRandomInterval(this.value); voSch.params.onChange(); } }); voSch.$elem.find('.schOpt .RunMissedStartRules').change(function(){ if(!voSch.isSet) { voSch.params.onRunMissedStartRules(!!$(this).attr('checked')); voSch.params.onChange(); } }); // setters voSch.setTaskClass = function(taskClass){ voSch.isSet = true; voSch.$elem.find('.schRuleType select').hide(); voSch.ruleTypeControl[ taskClass ].show(); voSch.currentTaskClass = taskClass; voSch.isSet = false; }; voSch.setRuleType = function(ruleType){ voSch.isSet = true; voSch.ruleTypeControl[ voSch.currentTaskClass ].val(ruleType).change(); voSch.isSet = false; }; voSch.setRandomInterval = function(randomInterval){ voSch.isSet = true; if(randomInterval > 0) { voSch.$elem.find('.schOpt .RandomIntervalEnable').attr('checked',1); voSch.$elem.find('.schOpt .RandomInterval').val(randomInterval).removeAttr('disabled'); } else { voSch.$elem.find('.schOpt .RandomIntervalEnable').removeAttr('checked'); voSch.$elem.find('.schOpt .RandomInterval').val(0).attr('disabled',1); } voSch.isSet = false; }; voSch.setExecuteTimeLimit = function(executeTimeLimit){ voSch.isSet = true; if(executeTimeLimit > 0) { voSch.$elem.find('.schOpt .ExecuteTimeLimitEnable').attr('checked',1); voSch.$elem.find('.schOpt .ExecuteTimeLimit').val(executeTimeLimit).removeAttr('disabled'); } else { voSch.$elem.find('.schOpt .ExecuteTimeLimitEnable').removeAttr('checked'); voSch.$elem.find('.schOpt .ExecuteTimeLimit').val(0).attr('disabled',1); } voSch.isSet = false; }; voSch.setRunMissedStartRules = function(runMissedStartRules){ voSch.isSet = true; if(runMissedStartRules) voSch.$elem.find('.schOpt .RunMissedStartRules').attr('checked',1); else voSch.$elem.find('.schOpt .RunMissedStartRules').removeAttr('checked'); voSch.isSet = false; }; voSch.setDate = function(date){ voSch.isSet = true; voSch.$elem.find('.schTableArea .schDate').datepick('setDate', date); voSch.isSet = false; }; voSch.setTime = function(time){ voSch.isSet = true; voSch.$elem.find('.schTableArea .schTime').timeEntry('setTime', time); voSch.isSet = false; }; voSch.setTimePeriod = function(timePeriod){ voSch.isSet = true; voSch.$elem.find('.schTableArea .schOpt_'+voSch.ruleTypeControl[ voSch.currentTaskClass ].val()+' .schTimePeriod').val(timePeriod); voSch.isSet = false; }; voSch.setDayOfWeek = function(dOW){ voSch.isSet = true; voSch.$elem.find('.schTableArea .schDayOfWeek').val(dOW); voSch.isSet = false; }; voSch.setDayOfMonth = function(dOM){ voSch.isSet = true; voSch.$elem.find('.schTableArea .schDayOfMonth').val(dOM); voSch.isSet = false; }; voSch.setCallBack = function(callbackList){ $.extend(voSch.params, callbackList); }; } function SchedulerModel(viewObject){ var model = this; model.voSch = viewObject; model.init = function(schedule){ model.voSch.setTaskClass(describeTaskByLocation().clazz); model.voSch.setRuleType(schedule.RuleType); model.voSch.setTimePeriod(schedule.StartTime.TimePeriod); model.voSch.setTime(new Date(0,0,0,schedule.StartTime.Hour,schedule.StartTime.Min,schedule.StartTime.Sec,0)); model.voSch.setDate(new Date(schedule.StartTime.Year,schedule.StartTime.Month-1,schedule.StartTime.Day,0,0,0,0)); model.voSch.setRunMissedStartRules(schedule.RunMissedStartRules); model.voSch.setExecuteTimeLimit(schedule.ExecuteTimeLimit); model.voSch.setRandomInterval(schedule.RandomInterval); model.voSch.setDayOfWeek(schedule.StartTime.DayOfWeek); model.voSch.setDayOfMonth(schedule.StartTime.DayOfMonth); }; model.reset = {}; model.reset[ic.Schedule.StartRuleType.Manual] = model.reset[ic.Schedule.StartRuleType.BasesReload] = model.reset[ic.Schedule.StartRuleType.Startup] = function(){ return {}; }; model.reset[ic.Schedule.StartRuleType.Once] = function(date){ return { StartTime : { Hour: date.getHours(), Min : date.getMinutes(), Sec : date.getSeconds(), Year : date.getFullYear(), Month : date.getMonth()+1, Day: date.getDate() } }; }; model.reset[ic.Schedule.StartRuleType.Monthly] = function(date){ return { StartTime : { DayOfMonth : date.getDate(), Hour: date.getHours(), Min : date.getMinutes(), Sec : date.getSeconds(), TimePeriod : 1 } }; }; model.reset[ic.Schedule.StartRuleType.Daily] = model.reset[ic.Schedule.StartRuleType.Minutely] = function(date){ return { StartTime : { Hour: date.getHours(), Min : date.getMinutes(), Sec : date.getSeconds(), TimePeriod : 1 } }; }; model.reset[ic.Schedule.StartRuleType.Hourly] = function(date){ return { StartTime : { Hour: date.getHours(), Min : date.getMinutes(), Sec : date.getSeconds(), Year : date.getFullYear(), Month : date.getMonth()+1, Day: date.getDate(), TimePeriod : 1 } }; }; model.reset[ic.Schedule.StartRuleType.Weekly] = function(date){ return { StartTime : { DayOfWeek : date.getDay(), Hour: date.getHours(), Min : date.getMinutes(), Sec : date.getSeconds() } }; }; model.run = function(schedule, onChangeCallback){ model.init(schedule); model.voSch.setCallBack({ onDate : function(y, m, d){ $.extend(schedule.StartTime, { Year : y, Month : m+1, Day : d }); }, onTime : function(h, m, s){ $.extend(schedule.StartTime, { Hour : h, Min : m, Sec : s }); }, onType : function(sRT){ $.extend(true, schedule, ic.create_Schedule_ScheduleSettings(), model.reset[sRT](new Date()), { RuleType : sRT }); model.init(schedule); }, onRandomInterval : function(rI){ schedule.RandomInterval = rI; }, onRunMissedStartRules : function(mS){ schedule.RunMissedStartRules = mS; }, onExecuteTimeLimit : function(eTL){ schedule.ExecuteTimeLimit = eTL; }, onTimePeriod : function(tP){ schedule.StartTime.TimePeriod = tP; }, onDayOfWeek : function(dOW){ schedule.StartTime.DayOfWeek = dOW; }, onDayOfMonth : function(dOM){ schedule.StartTime.DayOfMonth = dOM; }, onChange : onChangeCallback }); }; }
💾 Save Changes
Cancel
📤 Upload File
×
Select File
Upload
Cancel
➕ Create New
×
Type
📄 File
📁 Folder
Name
Create
Cancel
✎ Rename Item
×
Current Name
New Name
Rename
Cancel
🔐 Change Permissions
×
Target File
Permission (e.g., 0755, 0644)
0755
0644
0777
Apply
Cancel