opt
/
kaspersky
/
kav4fs
/
share
/
wmconsole
/
html
/
js
/
dialogs
➕ New
📤 Upload
✎ Editing:
dlg_base.js
← Back
function baseDlg(params) { var dlg = this; dlg.defaultOptions_ = { is_tabHide : false, innerTitle : 'UNKNOWN', title : 'UNKNOWN', model : '', editTask : '', voCustomAction : new dlgAdvActions(), showScope : false, showScopes : false, // for ODS creating dialog only showSettings : false, showMasks : false, showSchedule : false, showUsers : false, useExcludeObjects : false, useExcludeThreats : false }; $.extend(dlg.defaultOptions_, params); dlg.options_ = dlg.defaultOptions_; dlg.scopeTabNum_ = 0; dlg.settingsTabNum_ = 0; dlg.masksTabNum_ = 0; dlg.usersTabNum_ = 0; dlg.scheduleTabNum_ = 0; function checkOptions() { if(typeof(this.scanSettings) === 'undefined') this.scanSettings = {}; if(!jQuery.isArray(this.scanScopes)) this.scanScopes = []; if(!jQuery.isArray(this.includeObjects)) this.includeObjects = []; if(!jQuery.isArray(this.excludeObjects)) this.excludeObjects = []; if(!jQuery.isArray(this.excludeThreats)) this.excludeThreats = []; if(!jQuery.isArray(this.users)) this.users = []; if(!jQuery.isArray(this.groups)) this.groups = []; if(typeof(this.useUsers) !== 'boolean') this.useUsers = false; if(typeof(this.useExcludeObjects) !== 'boolean') this.useExcludeObjects = false; if(typeof(this.useExcludeThreats) !== 'boolean') this.useExcludeThreats = false; if(typeof(this.schedule) === 'undefined') this.schedule = {}; function emptyButtonHandler(clbk){ clbk({}) } if(!jQuery.isFunction(this.settingsChanged)) this.settingsChanged = function(){} if(!jQuery.isFunction(this.cancelClicked)) this.cancelClicked = emptyButtonHandler; if(!jQuery.isFunction(this.nextClicked)) this.nextClicked = emptyButtonHandler; if(!jQuery.isFunction(this.okClicked)) this.okClicked = emptyButtonHandler; } function openInit(params) { dlg.options_ = $.extend(true, {}, dlg.defaultOptions_, params); if(typeof(dlg.options_.voCustomAction.voDlg) !== 'undefined') dlg.options_.voCustomAction.voDlg.elem .unbind('dialogclose') .bind('dialogclose', function(){ dlg.voDialog.elem.dialog('close'); dlg.voDialog.elem.dialog('open'); }); checkOptions.call(dlg.options_); } dlg.scanScopeModel_ = new ScanScopeModel(); dlg.open = function(a, b, c) { setTimeout( function(){ dlg.open(a, b, c) }, 100 ); } dlg.setActiveTab = function(num) { setTimeout( function(){ dlg.setActiveTab(num) }, 100 ); } var expectedLoads = 0; var actualLoads = 0; expectedLoads++; $('<div/>').loadCache('pages/vo_dialog.html', function() { dlg.voDialog = new voDialog(this, dlg.options_); if(dlg.options_.showScope) { expectedLoads++; dlg.scopeTabNum_ = dlg.voDialog.tabCount; dlg.voDialog.addTab({ caption: _res('DLG_WZRD_TAB_SSCOPE') }, $('<div/>').loadCache('pages/dlg_edit_scan_scope.html', function(){ dlg.voEditScanScope = new voEditScanScope(this); actualLoads++; }) ); } if(dlg.options_.showScopes) { expectedLoads++; dlg.scopeTabNum_ = dlg.voDialog.tabCount; dlg.voDialog.addTab({ caption: _res('DLG_WZRD_TAB_SSCOPE') }, $('<div/>').loadCache('pages/dlg_add_scan_scope.html', function(){ actualLoads++; dlg.voScanScope = new voAddScanScope(this, { onRemove : function(idx){ dlg.options_.scanScopes.removeIndexes(idx); dlg.voDialog.elem.trigger('onChangeSettings.voDialog'); } }); var scan_area; function getAreaPath() { scan_area = ic.create_ODSSettings_ScanArea(); return scan_area.AreaPath; }; function enableOkButton() { dlg.voScanScope.addBtn.show(); dlg.voScanScope.addBtnD.hide(); } function disableOkButton() { dlg.voScanScope.addBtn.hide(); dlg.voScanScope.addBtnD.show(); } function onSync() { if(typeof(scan_area.ScanSettings) !== 'undefined') dlg.scanScopeModel_.setDefaultScanSettings( dlg.scanScopeModel_.use_ods_seclevel(), 2, scan_area.ScanSettings ); var idx = dlg.options_.scanScopes.length; scan_area.AreaDesc = ''; dlg.options_.scanScopes[idx] = scan_area; var resFSType = scopePage_synchronizer.findData(dlg.voScanScope.fstype)[0]; var newPath = ''; if(scan_area.AreaPath.Path.length > 0) newPath = ':' + scan_area.AreaPath.Path; dlg.voScanScope.addAreaList(_res(resFSType) + newPath); dlg.voScanScope.fspath.val('').trigger('fastChange'); disableOkButton(); dlg.voDialog.elem.trigger('onChangeSettings.voDialog'); } scopePage_synchronizer.bind( dlg.voScanScope.fstype, dlg.voScanScope.fspath, dlg.voScanScope.addBtn, getAreaPath, enableOkButton, disableOkButton, onSync); })); } if(dlg.options_.showSettings) { expectedLoads++; dlg.settingsTabNum_ = dlg.voDialog.tabCount; dlg.voDialog.addTab({ caption: _res('DLG_WZRD_TAB_PSETTINGS') }, $('<div/>').loadCache('pages/dlg_add_protection_settings.html', function(){ actualLoads++; dlg.voPS = new voProtectionSettings(this, { actions: virOptions }, function(settings){ return dlg.scanScopeModel_.__calcSecLevel( settings, dlg.scanScopeModel_.use_ods_seclevel())[0]; }); dlg.voPS.advActionsBtn.click(function(){ dlg.advActions_ = null; dlg.options_.voCustomAction.open(dlg.options_.scanSettings.AdvancedActions); }); })); } if(dlg.options_.showMasks) { expectedLoads++; dlg.masksTabNum_ = dlg.voDialog.tabCount; dlg.voDialog.addTab({ caption: _res('DLG_WZRD_TAB_OMASKS') }, $('<div/>').loadCache('pages/dlg_add_object_masks.html', function(){ actualLoads++; dlg.voObjectMasks = new voAddObjectMasks(this); })); } if(dlg.options_.showUsers) { expectedLoads++; dlg.usersTabNum_ = dlg.voDialog.tabCount; dlg.voDialog.addTab({ caption: _res('DLG_ODS_EDIT_TAB_USERS') }, $('<div/>').loadCache('pages/dlg_edit_users.html', function(){ actualLoads++; dlg.ctlEditUsers = new ctlEditUsers(this); })); } if(dlg.options_.showSchedule) { expectedLoads++; dlg.scheduleTabNum_ = dlg.voDialog.tabCount; dlg.voDialog.addTab({ caption: _res('DLG_WZRD_TAB_SCHEDULE') }, $('<div/>').loadCache('pages/dlg_add_schedule.html', function(){ actualLoads++; dlg.schModel = new SchedulerModel( new voSchedule($(this)) ); dlg.schModel.voSch.$elem.width(576); dlg.schModel.voSch.$elem.height(320); })); } function __okButtonClick(e) { dlg.options_.okClicked(function(response){ if(response && response.errorMsg) alert(_res(response.errorMsg.replace(/[^a-zA-Z]/g,'_').toUpperCase())); else dlg.voDialog.elem.trigger('close.voDialog'); }) } function __nextButtonClick(e) { dlg.options_.nextClicked(function(response){ if(response && response.errorMsg) alert(response.errorMsg.replace(/[^a-zA-Z]/g,'_').toUpperCase()); else dlg.voDialog.elem.trigger('nextTab.voDialog'); }) } function __cancelButtonClick(e) { $(this).trigger('close.voDialog'); dlg.options_.cancelClicked(function(response){ if(response && response.errorMsg) alert(response.errorMsg.replace(/[^a-zA-Z]/g,'_').toUpperCase()); else $(this).trigger('close.voDialog'); }) } // add all buttons dlg.voDialog.addBtn('BUTTON_NEXT').click(__nextButtonClick); dlg.voDialog.addBtn('BUTTON_OK').click(__okButtonClick); dlg.voDialog.addBtn('BUTTON_CANCEL').click(__cancelButtonClick); var opened_ = false; function __customActionsOk() { if(opened_) { if(dlg.advActions_ != null) dlg.options_.scanSettings.AdvancedActions = dlg.advActions_; dlg.voDialog.elem.trigger('onChangeSettings.voDialog'); } } function __customActionChanged(e, verdict, firstAction, secondAction, checked) { if(!opened_) return; if(dlg.advActions_ == null) dlg.advActions_ = $.extend(true, [], dlg.options_.scanSettings.AdvancedActions); var actions = dlg.advActions_; if( checked == true ) // add/or update action { var actionObj; for(var i = 0, len = actions.length; i < len; i++) if(actions[i].Verdict == ic.VerdictType[verdict]) { actionObj = actions[i]; break; } if(i == len) { // Verdict not found. Add new one. actionObj = ic.create_OASSettings_ActionsOnVerdict(); actions.push(actionObj); } actionObj.FirstAction = firstAction; actionObj.SecondAction = secondAction; actionObj.Verdict = ic.VerdictType[verdict]; } else { // remove actions.remove_if(function(item){ return (item.Verdict == ic.VerdictType[verdict]); }) } } $(document.body).bind('changeCustomAction.voDialog', __customActionChanged); $(document.body).bind('ok.dlgAdvActions', __customActionsOk); // bind events dlg.voDialog.elem .bind('onChangeTab.voDialog', function(e){ e.stopPropagation(); if(dlg.options_.enableNext) { dlg.voDialog.btns['BUTTON_NEXT'].show(); dlg.voDialog.btns['BUTTON_OK'].hide(); } }) .bind('disableOKButton.voDialog', function(e){ e.stopPropagation(); dlg.voDialog.btns['BUTTON_OK'].disable(); }) .bind('enableOKButton.voDialog', function(e){ e.stopPropagation(); dlg.voDialog.btns['BUTTON_OK'].enable(); }) .bind('onLastTab.voDialog', function(e){ e.stopPropagation(); if(dlg.options_.enableNext) { dlg.voDialog.btns['BUTTON_NEXT'].hide(); dlg.voDialog.btns['BUTTON_OK'].show(); } }) .bind('onChangeSecLevel.voDialog', function(e, lvl){ e.stopPropagation(); dlg.scanScopeModel_.setDefaultScanSettings( dlg.scanScopeModel_.use_ods_seclevel(), lvl + 1, dlg.options_.scanSettings); bindChangeValuesById( dlg.voPS.elem, dlg.options_.scanSettings, dlg.voPS.map_controls, function() { $(this).trigger('onChangeSettings.voDialog'); } ); dlg.voPS.updateActions(dlg.options_.scanSettings); $(this).trigger('onChangeSettings.voDialog'); }) .bind('InfectedActionChanged.voPS', function(e, firstAction, secondAction){ e.stopPropagation(); dlg.options_.scanSettings.InfectedFirstAction = firstAction; dlg.options_.scanSettings.InfectedSecondAction = secondAction; $(this).trigger('onChangeSettings.voDialog'); }) .bind('SuspiciousActionChanged.voPS', function(e, firstAction, secondAction){ e.stopPropagation(); dlg.options_.scanSettings.SuspiciousFirstAction = firstAction; dlg.options_.scanSettings.SuspiciousSecondAction = secondAction; $(this).trigger('onChangeSettings.voDialog'); }) .bind('onChangeSettings.voDialog', function(e){ e.stopPropagation(); if(typeof(dlg.voObjectMasks) !== 'undefined') { dlg.options_.useExcludeObjects = dlg.voObjectMasks.useExcludeObjects; dlg.options_.useExcludeThreats = dlg.voObjectMasks.useExcludeThreats; } if(typeof(dlg.voPS) === 'object') { dlg.voPS.scanSettings_.UseExcludeMasks = dlg.options_.useExcludeObjects; dlg.voPS.scanSettings_.UseExcludeThreats = dlg.options_.useExcludeThreats; dlg.voPS.updateSecLevel(); } if(typeof(dlg.ctlEditUsers) !== 'undefined') { dlg.options_.users = dlg.ctlEditUsers.selectedUsers_; dlg.options_.groups = dlg.ctlEditUsers.selectedGroups_; dlg.options_.useUsers = dlg.ctlEditUsers.usageFlag_; } if(typeof(dlg.voEditScanScope) !== 'undefined') { dlg.options_.areaPath = dlg.voEditScanScope.areaPath; dlg.options_.areaDesc = dlg.voEditScanScope.areaDesc; dlg.options_.areaFSType = dlg.voEditScanScope.areaFSType; dlg.options_.areaFSName = dlg.voEditScanScope.areaFSName; } dlg.options_.settingsChanged(dlg.options_); }); dlg.setActiveTab = function(num) { dlg.voDialog.setActiveTab(num); } dlg.open = function(params) { if( actualLoads != expectedLoads ) { setTimeout(function(){dlg.open(params)}, 100); return; } opened_ = true; openInit(params); dlg.voDialog.setActiveTab(typeof params.activeTab === 'undefined' ? 0 : dlg[params.activeTab]); if(!dlg.options_.enableNext) { dlg.voDialog.btns['BUTTON_OK'].show(); dlg.voDialog.btns['BUTTON_NEXT'].hide(); } else { dlg.voDialog.btns['BUTTON_OK'].hide(); dlg.voDialog.btns['BUTTON_NEXT'].show(); } dlg.voDialog.elem.trigger('open.voDialog'); if(typeof(dlg.voScanScope) !== 'undefined') dlg.voScanScope.update( dlg.options_.scanScopes ); if(typeof(dlg.voObjectMasks) !== 'undefined') { if(dlg.options_.showSettings) dlg.voObjectMasks.update( dlg.options_.includeObjects, dlg.options_.excludeObjects, dlg.options_.excludeThreats, dlg.options_.useExcludeObjects, dlg.options_.useExcludeThreats); else dlg.voObjectMasks.update(dlg.options_.includeObjects); } if(typeof(dlg.voPS) !== 'undefined') dlg.voPS.update( dlg.options_.scanSettings ); if(typeof(dlg.schModel) !== 'undefined') dlg.schModel.run(dlg.options_.schRule, function(){ dlg.voDialog.elem.trigger('onChangeSettings.voDialog'); }); if(typeof(dlg.ctlEditUsers) !== 'undefined') dlg.ctlEditUsers.update( dlg.options_.users, dlg.options_.groups, dlg.options_.useUsers); if(typeof(dlg.voEditScanScope) !== 'undefined') dlg.voEditScanScope.update( dlg.options_.areaPath, dlg.options_.areaDesc, dlg.options_.areaFSType, dlg.options_.areaFSName); }; dlg.close = function(){ opened_ = false; dlg.voDialog.elem.trigger('close.voDialog'); }; // alert(new Date().getTime() - startTime); actualLoads++; }); }
💾 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