opt
/
kaspersky
/
kav4fs
/
share
/
wmconsole
/
html
/
js
➕ New
📤 Upload
✎ Editing:
scan_scope_model.js
← Back
function ScanScopeModel() { var model = this; var mb = 1024*1024; var base_scan_settings_ods=[ // value array - [value, is_set, is_check] // field_name , Min_value_array , Req_value_array , Max_value_array ['UseAdvancedActions' , [true, true , true ] , [true, true , true ] , [true, true , true ]], // NOTE: Since 13.07.09 security level doesn't depend on UseExclude* flags // ['UseExcludeThreats' , [false, true , true ] , [false, true , true ] , [false, true , true ]], // ['UseExcludeMasks' , [false, true , true ] , [false, true , true ] , [false, true , true ]], ['ScanPacked' , [true , true , true ] , [true , true , true ] , [true , true , true ]], ['ScanSfxArchived' , [true , true , true ] , [true , true , true ] , [true , true , true ]], ['ScanArchived' , [true , true , true ] , [true , true , true ] , [true , true , true ]], ['ScanMailBases' , [false, true , true ] , [false, true , true ] , [true , true , true ]], ['ScanPlainMail' , [false, true , true ] , [false, true , true ] , [true , true , true ]], ['UseTimeLimit' , [true , true , true ] , [false, true , true ] , [false, true , true ]], ['TimeLimit' , [60 , true , true ] , [0 , false, false] , [0 , false, false]], ['UseSizeLimit' , [true , true , true ] , [false, true , true ] , [false, true , true ]], ['SizeLimit' , [8*mb , true , true ] , [0 , false, false] , [0 , false, false]], ['InfectedFirstAction' , [ic.OAS.Action.Cure , true , true ], [ic.OAS.Action.Recommended, true , true ], [ic.OAS.Action.Cure , true , true ]], ['InfectedSecondAction' , [ic.OAS.Action.Remove, true , true ], [ic.OAS.Action.Skip, true , true], [ic.OAS.Action.Remove, true , true ]], ['SuspiciousFirstAction', [ic.OAS.Action.Quarantine , true , true ], [ic.OAS.Action.Recommended, true , true ], [ic.OAS.Action.Quarantine , true , true ]], ['SuspiciousSecondAction', [ic.OAS.Action.Skip , true , true ], [ic.OAS.Action.Skip, true , true ], [ic.OAS.Action.Skip , true , true ]], ['AdvancedActions' , [[{FirstAction:5, SecondAction:5, Verdict:1, __VersionInfo:"1 0"}], true, true], [[{FirstAction:5, SecondAction:5, Verdict:1, __VersionInfo:"1 0"}], true, true], [[{FirstAction:5, SecondAction:5, Verdict:1, __VersionInfo:"1 0"}], true, true]], ['UseAnalyzer' , [true, true, true], [true, true, true], [true, true, true]], ['HeuristicLevel' , [ic.HeuristicLevel.Recommended, true, true], [ic.HeuristicLevel.Recommended, true, true], [ic.HeuristicLevel.Recommended, true, true]] ]; var base_scan_settings_oas=[ // value array - [value, is_set, is_check] // field_name , Min_value_array , Req_value_array , Max_value_array ['UseAdvancedActions' , [true, true , true ] , [true, true , true ] , [true, true , true ]], // ['UseExcludeThreats' , [false, true , true ] , [false, true , true ] , [false, true , true ]], // ['UseExcludeMasks' , [false, true , true ] , [false, true , true ] , [false, true , true ]], ['ScanPacked' , [true , true , true ] , [true , true , true ] , [true , true , true ]], ['ScanSfxArchived' , [false, true , true ] , [false, true , true ] , [true , true , true ]], ['ScanArchived' , [false, true , true ] , [false, true , true ] , [false, true , true ]], ['ScanMailBases' , [false, true , true ] , [false, true , true ] , [false, true , true ]], ['ScanPlainMail' , [false, true , true ] , [false, true , true ] , [false, true , true ]], ['UseTimeLimit' , [true , true , true ] , [true , true , true ] , [true , true , true ]], ['TimeLimit' , [60 , true , true ] , [60 , true , true ] , [60 , true , true ]], ['UseSizeLimit' , [true , true , true ] , [false, true , true ] , [false, true , true ]], ['SizeLimit' , [8*mb , true , true ] , [0 , false, false] , [0 , false, false]], ['InfectedFirstAction' , [ic.OAS.Action.Cure , true , true ], [ic.OAS.Action.Recommended, true , true ], [ic.OAS.Action.Cure , true , true ]], ['InfectedSecondAction' , [ic.OAS.Action.Remove, true , true ], [ic.OAS.Action.Skip, true , true], [ic.OAS.Action.Remove, true , true ]], ['SuspiciousFirstAction', [ic.OAS.Action.Quarantine , true , true ], [ic.OAS.Action.Recommended, true , true ], [ic.OAS.Action.Quarantine , true , true ]], ['SuspiciousSecondAction', [ic.OAS.Action.Skip , true , true ], [ic.OAS.Action.Skip, true , true ], [ic.OAS.Action.Skip , true , true ]], ['AdvancedActions' , [[{FirstAction:5, SecondAction:5, Verdict:1, __VersionInfo:"1 0"}], true, true], [[{FirstAction:5, SecondAction:5, Verdict:1, __VersionInfo:"1 0"}], true, true], [[{FirstAction:5, SecondAction:5, Verdict:1, __VersionInfo:"1 0"}], true, true]], ['UseAnalyzer' , [true, true, true], [true, true, true], [true, true, true]], ['HeuristicLevel' , [ic.HeuristicLevel.Recommended, true, true], [ic.HeuristicLevel.Recommended, true, true], [ic.HeuristicLevel.Recommended, true, true]] ]; this.bindDomElement = 'nonexistent'; this.scopes = 'undefined'; this.enableScanSettings = false; this.lastComboIndex = null; //needed to hide last combo this.lastEditRow = null; this.use_ods_seclevel = function() { return (describeTaskByLocation().clazz == ic.TaskClass.ODS); } this.setDefaultScanSettings = function(use_ods_defaults, subset, area) { var default_settings = use_ods_defaults ? base_scan_settings_ods : base_scan_settings_oas; $(default_settings).each(function(){ if(this[subset][1]) if(typeof(this[subset][0]) === 'object') area[this[0]] = $.extend(true, ( $.isArray(this[subset][0]) ? [] : {} ), this[subset][0]) else area[this[0]] = this[subset][0]; }); } // change selector of 'security level' to link with calculated level function lastComboHide(){} // FIXME: commented out 6.03. Seems like rudiment // { // if(model.lastComboIndex == null) // return; // // var secLevel = model.calcSecLevel(model.scopes[model.lastComboIndex])[1]; // var lastComboIndex = model.lastComboIndex; // var link0 = model.createLink( // function(){showEditCell(lastComboIndex,0)}, // 'showEditCell_0' // ); // $('tr#area'+model.lastComboIndex+' td#scanSettingsColumn a') // .attr('href',link0) // .find('#dataField') // .html(secLevel); // // model.lastComboIndex = null; function lastEditRowStylesReset() { if(model.lastEditRow == null) return; var $area = $('#area' + model.lastEditRow); setupLinks(model.lastEditRow, $area.find('#td_pathContent a'), $area.find('#scanSettingsColumn a'), $area.find('#scanObjectsColumn a'), $area.find('#usersGroupsColumn a')); $area .find('#scanSettingsColumn,#scanObjectsColumn,#usersGroupsColumn') .removeClass('td_box_active td_box') .addClass('td_box') .find('a').removeClass('active'); model.lastEditRow = null; } this.getScanAreaPath = function(area_path){ var res = []; scopePage_synchronizer.findDataByObject(area_path, function(i, data, fstype){ if( fstype != ic.FSType.Local ) res.push(_res(data[0])); if( area_path.Path.length > 0) res.push(area_path.Path); }) return res.join(':'); } function writeObjectsUsersGroupsLink( $link, contentObject ) { if($link.length == 0) return; var content_ = misc_preparetoView(contentObject.content); $link.attr('title', content_); if(contentObject.isall) $link.find('#dataField').html(content_); else misc_writeLongName($link, $link.find('#dataField'), content_, niceShorting); } this.allMasksObject_ = { content : _res('TASK_TAB_ALL_OBJECTS'), isall : true }; this.masksToString = function(scan_area) { if(scan_area.AreaMask.length == 0) return this.allMasksObject_; var re = /^\s*\*\s*$/; for(var i = 0; i < scan_area.AreaMask.length; i++) if(re.test(scan_area.AreaMask[i])) return this.allMasksObject_; return{ content : scan_area.AreaMask.join(', '), isall : false }; } this.allUsersObject_ = { content : _res('TASK_TAB_ALL_USERS'), isall : true }; this.usersToString = function(scan_area) { if((scan_area.AccessUser.UserGroup.length == 0) && (scan_area.AccessUser.UserName.length == 0)) return this.allUsersObject_; var res = scan_area.AccessUser.UserName.join(','); for(var i = 0; i < scan_area.AccessUser.UserGroup.length; i++) res += ',*:' + scan_area.AccessUser.UserGroup[i]; if(res.charAt(0) == ',') res = res.substr(1); return{ content : res, isall : false }; }; this.getPathCellContent = function(ind) { var $result = $('<A id="pathLink" href="' + taskScanScopeBaseHref() + '">' + misc_preparetoView( model.getScanAreaPath( model.scopes[ind].AreaPath)) + '</A><br />' + '<span style="color:gray; font-size:8pt">' + misc_preparetoView( model.scopes[ind].AreaDesc.replace(/(\S{30})/g, "$1 ")) + '</span>'); return $result; } function calcCellWidth() { if (model.enableUsers && model.enableScanSettings) return '160'; else if (model.enableUsers || model.enableScanSettings) return '240'; else return '480'; } this.editAreaPath = function(ind) { // reset SecurityLevel,ScanObjects,Users lastEditRowStylesReset(); lastComboHide(); $('#tableArea table>tbody>tr[id^=area]>td[id^=editrow]').each(function(){ $(this).replaceWith( $(this).find('#scanSettingsColumn,#scanObjectsColumn,#usersGroupsColumn') ); }); // reset ScanArea $('#tableArea table>tbody>tr[id^=area]>td:nth-child(2) #rtp_edit_area_cancel') .trigger('collapseDialog') var td = $('#tableArea table>tbody>tr#area'+ind+'>td:nth-child(2)').empty(); td.loadCache('pages/settingsTask/rtp_edit_path.html', function() { var $type = td.find('#rtp_edit_scopetype'); var $path = td.find('#rtp_edit_path'); var $ok = td.find('#rtp_edit_area_ok'); var $desc = td.find('#rtp_edit_desc'); $('#rtp_edit_path_browse') .bind('treeDialog_enable', function(){ this.disabled = false }) .bind('treeDialog_disable', function(){ this.disabled = true }); $path.treeDialog({ ctlFSType: $type }); function getAreaPath(){ return model.scopes[ind].AreaPath; } function enableOkButton(){ $ok.removeAttr('disabled') .find('#okImg').css({'visibility':'visible'}); } function disableOkButton(){ $ok.attr('disabled', true) .find('#okImg').css({'visibility':'hidden'}); } function onSync(){ model.scopes[ind].AreaDesc = $desc.val(); editTask.setSettingsTaskChange(); } scopePage_synchronizer.bind( $type, $path, $ok, getAreaPath, enableOkButton, disableOkButton, onSync); $desc.val(model.scopes[ind].AreaDesc); function collapseDialog() { setupLinks(ind); td.html(model.getPathCellContent(ind)); } function setNameBack() { window.location.href = this.href; $(this).trigger('collapseDialog'); } td.find('#rtp_edit_area_cancel') .attr('href', taskScanScopeBaseHref()) .bind('collapseDialog', collapseDialog) .icHistory(setNameBack); $type.change(function() { $ok.trigger('click') }) $path.keyup(function() { $ok.trigger('click') }) $desc.keyup(function() { $ok.trigger('click') }) }); } function isAdvancedActionsEquiv(a1, a2) { if ( a1.length != a2.length ) { return false; } var adv1={}; for(var idx in a1) { if (typeof(a1[idx].Verdict) === 'undefined') continue; adv1[a1[idx].Verdict] = { FirstAction: a1[idx].FirstAction, SecondAction: a1[idx].SecondAction }; } for(var idx in a2) { if (typeof(a2[idx].Verdict) === 'undefined') continue; if (typeof(adv1[a2[idx].Verdict]) === 'undefined') return false; if ( a2[idx].FirstAction != adv1[a2[idx].Verdict].FirstAction || a2[idx].SecondAction != adv1[a2[idx].Verdict].SecondAction) { return false; } } return true; } this.calcSecLevel = function(area, _use_ods_seclevel) { var default_settings; if(typeof(_use_ods_seclevel) != 'undefined') default_settings = _use_ods_seclevel ? base_scan_settings_ods : base_scan_settings_oas; else default_settings = model.use_ods_seclevel() ? base_scan_settings_ods : base_scan_settings_oas; is_min=true; function check_states(states, subset){ $(states).each(function(){ if ( this[0] == 'AdvancedActions' ) { if ( this[subset][2] && !isAdvancedActionsEquiv(area.ScanSettings[this[0]], this[subset][0]) ) { is_min = false; return false; } } else { if ( this[subset][2] && area.ScanSettings[this[0]] != this[subset][0] ){ is_min = false; return false; // stop loop iterations } } }); }; check_states(default_settings, 1); if (is_min) return [0,_res('SECURITY_LEVEL_HIGH_SPPED')]; is_min = true; check_states(default_settings, 2); if (is_min) return [1,_res('SECURITY_LEVEL_RECOMMENDED')]; is_min = true; check_states(default_settings, 3); if (is_min) return [2,_res('SECURITY_LEVEL_MAX_PROTECTION')]; return [3,_res('SECURITY_LEVEL_CUSTOM')]; } this.__calcSecLevel = function(_settings, _use_ods_seclevel) { return this.calcSecLevel({ ScanSettings: _settings }, _use_ods_seclevel); } function selectEditorColumn(areaIndex, columnId) { return $('#tableArea').find('#area' + areaIndex + ' #'+ columnId); } function selectEditorColumns(areaIndex) { return $('#tableArea #area' + areaIndex) .find('#scanObjectsColumn,#usersGroupsColumn,#scanSettingsColumn'); } function countEditorColumns(areaIndex) { return selectEditorColumns(areaIndex).length; } function niceShorting(str,len){ if (str.length>len) return str.substr(0,len)+'...'; return str; } var performanceObjectToCheckboxesBinding = [ ['sfx' , 'ScanSfxArchived' ], ['email' , 'ScanMailBases' ], ['packed' , 'ScanPacked' ], ['plain_email' , 'ScanPlainMail' ], ['archives' , 'ScanArchived' ], ['ichecker' , 'UseIChecker' ], ['sizelimit' , 'UseSizeLimit' ], ['sizelimitval' , 'SizeLimit', misc_megabyteTransform ], ['timelimit' , 'UseTimeLimit' ], ['timelimitval' , 'TimeLimit' ], ['cb_ReportCleanObjects' , 'ReportCleanObjects'], ['cb_ReportPackedObjects' , 'ReportPackedObjects'], ['radio_ScanByAccessType_SmartCheck', 'ScanByAccessType'], ['radio_ScanByAccessType_Open', 'ScanByAccessType'], ['radio_ScanByAccessType_OpenAndModify', 'ScanByAccessType'] ]; this.performanceObjectToCheckboxesBinding = performanceObjectToCheckboxesBinding; var seclevelTabs_ = { actions : '/__actions__', performance : '/__performance__', exclusions : '/__exclusions__' }; function showEditCell(ind, cell) { // reset ScanArea $('#tableArea table>tbody>tr[id^=area]>td:nth-child(2) #rtp_edit_area_cancel') .trigger('collapseDialog'); var idval='#tableArea table>tbody>tr#area'+ind+'>td#editrow'+ind; var editIndex=ind; function hilightTab(columnId) { lastEditRowStylesReset(); var $a = selectEditorColumn(ind, columnId) .removeClass('td_box') .addClass('td_box_active') .find('a'); $a.addClass('active'); misc_callAsync(function(){ setupLinks(ind); $a.attr('href', taskScanScopeBaseHref()) }) model.lastEditRow = editIndex; } // display new value of users and groups in scan area interface function UsersGroupsChange() { writeObjectsUsersGroupsLink( selectEditorColumn(editIndex, 'usersGroupsColumn').find('a'), model.usersToString( model.scopes[editIndex] )); } // display new value of AreaMasks in scan area interface function MasksChange() { writeObjectsUsersGroupsLink( selectEditorColumn(editIndex, 'scanObjectsColumn').find('a'), model.masksToString( model.scopes[editIndex] )); } // change 'security level' tab to 'excludes' function switchSubTabExcludes() { if(this && this.hash) window.location.href = this.hash; isInitRTPSettings = true; props_id_ = idval + ' td#properties'; properties_ = $(props_id_); $(properties_).loadCache('pages/settingsTask/rtp_sl_excludes_.html', function(){ redrawSecLevelList(); checks = [ [ 'masks_enable' , 'UseExcludeMasks' ], [ 'threat_enable' , 'UseExcludeThreats' ] ]; bindChangeValuesById(props_id_,model.scopes[editIndex].ScanSettings,checks,redrawSecLevelList); model.bindEntryToList({ entry: $('#masks_entry') , list: $('#masks_list') , name: "masks", store: model.scopes[editIndex].ScanSettings.ExcludeMasks }) model.bindEntryToList({ entry: $('#threat_entry') , list: $('#threat_list') , name: "threat", store: model.scopes[editIndex].ScanSettings.ExcludeThreats }); bindSubTabs(); isInitRTPSettings = false }); }; // change states of checkboxes and input entries according values function change_values(checks, obj) { $(checks).each(function(){ var field = this[0]; el_ = $(idval).find('td#properties').find('#'+this[1]); if(el_.attr('type') == 'checkbox') { el_.attr('checked', obj[field]).triggerHandler('change'); } else { function null_transform_(a){return a;}; var transform_func_ = typeof(this[2])=='function' ? this[2] : null_transform_; el_.val(transform_func_(obj[field], true)).triggerHandler('change'); } }); } function setSecLevel() { var sel_sec_lvl = parseInt($('tr#area'+editIndex).find('td#properties').find('#rtp_sec_level').val()); if( sel_sec_lvl < 0 || sel_sec_lvl > 2 ) sel_sec_lvl = 1; map_controls=[ ['UseAdvancedActions' , 'use_advanced_actions' ], ['UseExcludeThreats' , 'threat_enable'], ['UseExcludeMasks' , 'masks_enable'], ['ScanArchived' , 'archives'], ['ScanMailBases' , 'email'] , ['ScanPacked' , 'packed'] , ['ScanSfxArchived' , 'sfx'] , ['ScanPlainMail' , 'plain_email'], ['UseSizeLimit' , 'sizelimit'], ['UseTimeLimit' , 'timelimit'], ['TimeLimit' , 'timelimitval'], ['SizeLimit' , 'sizelimitval', misc_megabyteTransform ] ]; model.setDefaultScanSettings(model.use_ods_seclevel(), sel_sec_lvl+1, model.scopes[editIndex].ScanSettings); change_values(map_controls, model.scopes[editIndex].ScanSettings); redrawAdvancedActions(); if( isActionsPage() ){ actionsPage_setMainActions( model.scopes[editIndex].ScanSettings, redrawSecLevelList); } redrawSecLevelList(); editTask.setSettingsTaskChange(); } function addSecLevelOptions( $ns, optionsHtml ) { $ns.find('#rtp_sec_level').append( optionsHtml ); } function createSecLevelList( $ns ) { if($ns.find('#rtp_sec_level').length > 0) return; // already created $ns.prepend( '<div class="box_child" id="dataField">'+ '<table class="content_noFon"><tr>'+ '<td style="padding: 3px 6px 0px 0px;" class="w10 nobr"><span id="rtp_sec_level_label" class="res:TABLE_TITLE_SECURITY_LEVEL"></span>:</td>'+ '<td style="padding: 0" class="w90"><select class="w100" id="rtp_sec_level"></select></td>'+ '</tr></table>'+ '</div>'); addSecLevelOptions( $ns, '<OPTION VALUE="0" class="res:SECURITY_LEVEL_HIGH_SPPED"></OPTION>'+ '<OPTION VALUE="1" class="res:SECURITY_LEVEL_RECOMMENDED"></OPTION>'+ '<OPTION VALUE="2" class="res:SECURITY_LEVEL_MAX_PROTECTION"></OPTION>'); } function redrawSecLevelList(){ if (!isInitRTPSettings) editTask.setSettingsTaskChange() var csl = model.calcSecLevel(model.scopes[editIndex]); $element_name = $('tr#area'+editIndex).find('td#properties'); var $secLvlTabText = $('tr#area'+editIndex).find('td#scanSettingsColumn').find('div#dataField'); createSecLevelList( $element_name ); switch(csl[0]) { case 0: $secLvlTabText.text(_res('SECURITY_LEVEL_HIGH_SPPED')); break; case 1: $secLvlTabText.text(_res('SECURITY_LEVEL_RECOMMENDED')); break; case 2: $secLvlTabText.text(_res('SECURITY_LEVEL_MAX_PROTECTION')); break; case 3: $secLvlTabText.text(_res('SECURITY_LEVEL_CUSTOM')); break; } if(csl[0] == 3) { if($element_name.find('#customOption').length == 0) addSecLevelOptions( $element_name, '<OPTION VALUE="3" id="customOption" class="res:SECURITY_LEVEL_CUSTOM">'+_res('SECURITY_LEVEL_CUSTOM')+'</OPTION>' ); } else $element_name.find('#customOption').remove(); $element_name .find('#rtp_sec_level') .change(setSecLevel) .val(csl[0]); }; // change current view of edit area to "security level" view with "performance" subtab enabled function switchSubTabPerfomance() { if(this && this.hash) window.location.href = this.hash; isInitRTPSettings = true lastComboHide(); model.lastComboIndex = editIndex; $('tr#area'+editIndex+' td#scanSettingsColumn#rtp_sec_level_other').hide(); props_id_ = idval+' td#properties'; $(props_id_).loadCache('pages/settingsTask/rtp_sl_perfomance_.html', function(){ redrawSecLevelList(); bindChangeValuesById(props_id_, model.scopes[editIndex].ScanSettings, performanceObjectToCheckboxesBinding, redrawSecLevelList); bindSubTabs(); isInitRTPSettings = false }); }; function isActionsPage(){ var props_id_ = idval + ' td#properties'; var properties_ = $(props_id_); if( properties_.find('#use_advanced_actions').length==0 ) return false; return true; }; function redrawAdvancedActions() { if( !isActionsPage() ) return; var props_id_ = idval + ' td#properties'; var properties_ = $(props_id_); var useAdvActions = $(props_id_+' #use_advanced_actions').attr('checked'); if(useAdvActions){ actionsPage_drawActionsOnVerdict(); for(var verdict in ic.VerdictTypeView){ properties_.find('#adv_cb_' + verdict) .attr('ic_verdict', verdict) .click(toggleAdvOption); var advAction = findAdvActionByVerdict(verdict); if(advAction) actionsPage_drawAdvOptions(verdict, advAction) } } else actionsPage_clearActionsOnVerdict(); } function clickUseAdvancedActions() { redrawAdvancedActions(); redrawSecLevelList(); } function findAdvActionIndexByVerdict(verdict) { var actions = model.scopes[editIndex].ScanSettings.AdvancedActions; for(var i = 0, len = actions.length; i < len; ++i) if(actions[i].Verdict == ic.VerdictType[verdict]) return i; return -1; } function findAdvActionByVerdict(verdict) { var i = findAdvActionIndexByVerdict(verdict); return (i == -1) ? undefined : model.scopes[editIndex].ScanSettings.AdvancedActions[i]; } function removeAdvActionByVerdict(verdict) { var i = findAdvActionIndexByVerdict(verdict); if(i != -1) model.scopes[editIndex].ScanSettings.AdvancedActions.remove(i); } function drawOneAdvAction(verdict) { var advAction = findAdvActionByVerdict(verdict); if(!advAction) { advAction = ic.create_OASSettings_ActionsOnVerdict(); advAction.Verdict = ic.VerdictType[verdict]; var settings = model.scopes[editIndex].ScanSettings; // Get default values from Infected actions advAction.FirstAction = ic.OAS.Action.Recommended; advAction.SecondAction = ic.OAS.Action.Skip; settings.AdvancedActions.push(advAction); } actionsPage_drawAdvOptions(verdict, advAction); } function removeOneAdvAction(verdict) { removeAdvActionByVerdict(verdict); actionsPage_clearAdvOptions(verdict); } function toggleAdvOption() { var verdict = $(this).attr('ic_verdict'); if($(this).attr('checked')) drawOneAdvAction(verdict); else removeOneAdvAction(verdict); editTask.setSettingsTaskChange() } // show 'actions' view of 'security level' tab function switchSubTabActions() { if(this && this.hash) window.location.href = this.hash; isInitRTPSettings = true var props_id_ = idval+' td#properties'; $(props_id_).loadCache('pages/settingsTask/rtp_sl_actions_.html', function(){ redrawSecLevelList(); bindChangeValuesById( props_id_, model.scopes[editIndex].ScanSettings, [['use_advanced_actions','UseAdvancedActions']], clickUseAdvancedActions ); redrawAdvancedActions(); actionsPage_setMainActions( model.scopes[editIndex].ScanSettings, redrawSecLevelList); bindSubTabs(); isInitRTPSettings = false }); }; // bind actions to links to change view of 'security level' tab function bindSubTabs() { var h = window.location.hash .replace(seclevelTabs_.actions, '') .replace(seclevelTabs_.performance, '') .replace(seclevelTabs_.exclusions, ''); $('#tabSL_Actions').icHistory(switchSubTabActions) $('#tabSL_Actions').attr('href', h + seclevelTabs_.actions) $('#tabSL_Excludes').icHistory(switchSubTabExcludes) $('#tabSL_Excludes').attr('href', h + seclevelTabs_.exclusions) $('#tabSL_Perfomance').icHistory(switchSubTabPerfomance); $('#tabSL_Perfomance').attr('href', h + seclevelTabs_.performance) }; if ($(idval).length==0 || $(idval).data('rtp_tab')!=cell) { if ($(idval).length==0) { $('#tableArea table>tbody>tr[id^=area]>td[id^=editrow]').each(function(){ $(this).replaceWith($(this).find('#scanSettingsColumn,#scanObjectsColumn,#usersGroupsColumn')); }) var inEditTbl = $( '<td colspan="'+countEditorColumns(ind)+'" id="editrow'+ind+'" style="padding:0;width:480px">'+ '<table style="width:480px" class="content_noFon">'+ '<tr id="ctlList" class="active"></tr>'+ '<tr><td id="properties" '+ 'class="td_bookmarks_count" '+ 'colspan="' + countEditorColumns(ind) + '">...</td>'+ '</tr>'+ '</table></td>'); $('#tableArea table>tbody>tr#area'+ind) .find('#scanSettingsColumn,#scanObjectsColumn,#usersGroupsColumn') .each(function(){ $(this).appendTo( inEditTbl.find('#ctlList') ); }); inEditTbl.appendTo('#tableArea table>tbody>tr#area'+ind); }; $(idval).data('rtp_tab',cell); $('#tableArea table').trigger('update'); properties_ = $(idval+' td#properties'); switch(cell){ case SA_CELL_SECLEVEL: if(model.enableScanSettings) { var h = window.location.hash; if(h.indexOf(seclevelTabs_.actions) > -1) switchSubTabActions(); else if(h.indexOf(seclevelTabs_.exclusions) > -1) switchSubTabExcludes(); else switchSubTabPerfomance(); } hilightTab('scanSettingsColumn'); break; case SA_CELL_OBJECTS: isInitRTPSettings = true if(model.enableScanSettings) lastComboHide(); hilightTab('scanObjectsColumn'); $(properties_).loadCache('pages/settingsTask/rtp_scan_objects.html', function(){ model.bindEntryToList({ entry: $('#exobj_entry') , list: $('#exobj_list') , name: "exobj", //add_btn: $('#exobj_add'), //del_btn: $('#exobj_del'), store: model.scopes[editIndex].AreaMask, onchange: MasksChange }); isInitRTPSettings = false }); break; case SA_CELL_USERS: isInitRTPSettings = true if(model.enableScanSettings) lastComboHide(); hilightTab('usersGroupsColumn'); $(properties_).loadCache('pages/settingsTask/rtp_users_group_.html', function() { ic.listUsers(function(response){ if(ic.ajaxError(response)) return; model.bindEntryToList({ entry: $('#user_entry') , list: $('#users_list') , name: "user", store: model.scopes[editIndex].AccessUser.UserName, onchange: UsersGroupsChange, users: response }); }) ic.listGroups(function(response){ if(ic.ajaxError(response)) return; model.bindEntryToList({ entry: $('#group_entry') , list: $('#groups_list') , name: "group", store: model.scopes[editIndex].AccessUser.UserGroup, onchange: UsersGroupsChange, users: response }); }) function enableDisableSelection(enable) { if(enable) { model.scopes[editIndex].UseAccessUser = true; $('#checkbox_UseAccessUser').attr('checked', true); $('#tr_usersGroups').show(); } else { model.scopes[editIndex].UseAccessUser = false; $('#checkbox_UseAccessUser').attr('checked', false); $('#tr_usersGroups').hide(); } } $('#checkbox_UseAccessUser').click(function(){ enableDisableSelection($(this).attr('checked')); editTask.setSettingsTaskChange(); }); enableDisableSelection(model.scopes[editIndex].UseAccessUser); isInitRTPSettings = false }) break; } } else { hilightTab('nonexistent'); setupBaseLinks(ind); $('#tableArea table>tbody>tr[id^=area]>td[id^=editrow]').each(function(){ $(this).replaceWith( $(this).find('#scanSettingsColumn,#scanObjectsColumn,#usersGroupsColumn') ); }) } } this.createLink = function(functor, desc) { return FunctionStore.createLink(functor, model.bindDomElement, desc); } this.InitButton = function(){ var count=0 var up = true; var down = true; $('#tableArea>table>tbody>tr[id^=area]').each(function(){ if ($(this).find('td>input').attr('checked')){ count++; ind=parseInt($(this).attr('id').substring(4)); if (ind==0) up = false if (ind==model.scopes.length-1) down= false }; }); if (count>0) { $('#tools [alt=Delete_grey]').hide() $('#tools [alt=Delete]').show() } else { up = false down = false $('#tools [alt=Delete]').hide() $('#tools [alt=Delete_grey]').show() } if (up) { $('#tools [alt=Up_grey]').hide() $('#tools [alt=Up]').show() } else { $('#tools [alt=Up]').hide() $('#tools [alt=Up_grey]').show() } if (down) { $('#tools [alt=Down_grey]').hide() $('#tools [alt=Down]').show() } else { $('#tools [alt=Down]').hide() $('#tools [alt=Down_grey]').show() } if (count!= model.scopes.length || count==0) $('#tableArea .w5 input').attr('checked',false) else $('#tableArea .w5 input').attr('checked',true) } function getMainCheckbox() { return $('#tableArea input:first'); } this.getMainCheckbox = getMainCheckbox; function getSelectedScopes(){ rval = new Array; $('#tableArea>table>tbody>tr[id^=area]').each(function(){ if ($(this).find('td>input').attr('checked')){ ind = parseInt($(this).attr('id').substring(4)); rval.push(ind); }; }); rval.sort(); return rval; } function setSelectedScopes(ids) { $(ids).each(function(){ $('#tableArea >table>tbody>tr#area' + this + '>td>input') .attr('checked', true); }); model.InitButton(); } var hashes_ = { seclevel : 'seclevel', objects : 'objects', users : 'users', path : 'path' }; function taskScanScopeBaseHref() { return taskSettings_baserefImpl([ 'area\\d+/' + hashes_.seclevel, 'area\\d+/' + hashes_.objects, 'area\\d+/' + hashes_.users, 'area\\d+/' + hashes_.path ]); } function setupLinks(ind, $a_path, $a_secLevel, $a_masks, $a_usersGroups) { $a_path = $a_path || $('#area' + ind + '_pathLink'); $a_secLevel = $a_secLevel || $('#area' + ind + '_secLevelLink'); $a_masks = $a_masks || $('#area' + ind + '_objectsLink'); $a_usersGroups = $a_usersGroups || $('#area' + ind + '_usersLink'); function pathLinkClick() { getDialog('editODS').openScopeTab(model.scopes[ind], updateColumns); } function updateColumns() { if($a_path.length > 0) selectEditorColumn(ind, 'td_pathContent') .html(model.getPathCellContent(ind)) .find('a') .click(pathLinkClick); if($a_secLevel.length > 0) selectEditorColumn(ind, 'scanSettingsColumn') .find('#dataField') .updateHtml(model.calcSecLevel(model.scopes[ind])[1]); if($a_masks.length > 0) writeObjectsUsersGroupsLink( selectEditorColumn(ind, 'scanObjectsColumn').find('a'), model.masksToString( model.scopes[ind] )); if($a_usersGroups.length > 0) writeObjectsUsersGroupsLink( selectEditorColumn(ind, 'usersGroupsColumn').find('a'), model.usersToString( model.scopes[ind] )); } if($a_path.length > 0) { $a_path.attr('href', window.location.href); $a_path.click(pathLinkClick); } if($a_secLevel.length > 0) { $a_secLevel.attr('href', window.location.href); $a_secLevel.click(function(){ getDialog('editODS').openSettingsTab(model.scopes[ind], updateColumns); }); } if($a_masks.length > 0) { $a_masks.attr('href', window.location.href); $a_masks.click(function(){ getDialog('editODS').openMasksTab(model.scopes[ind], updateColumns); }); } if($a_usersGroups.length > 0) { $a_usersGroups.attr('href', window.location.href); $a_usersGroups.click(function(){ getDialog('editODS').openUsersTab(model.scopes[ind], updateColumns); }); } } function setupBaseLinks(ind, $a_path, $a_secLevel, $a_masks, $a_usersGroups) { $a_path = $a_path || $('#area' + ind + '_pathLink'); $a_secLevel = $a_secLevel || $('#area' + ind + '_secLevelLink'); $a_masks = $a_masks || $('#area' + ind + '_objectsLink'); $a_usersGroups = $a_usersGroups || $('#area' + ind + '_usersLink'); var baseHref = taskScanScopeBaseHref(); $a_path.attr ('href', baseHref) $a_secLevel.attr ('href', baseHref) $a_masks.attr ('href', baseHref) $a_usersGroups.attr ('href', baseHref) } var SA_CELL_SECLEVEL = 0; var SA_CELL_OBJECTS = 1; var SA_CELL_USERS = 2; function addScanArea(scan_area,ind) { $('#tableArea>table>tbody>#empty_areas').remove(); $('#tableArea>table>tbody:first').append( '<tr id="area' + ind + '">' + scopeTablePage_rowTemplate + '</tr>'); $ns = $('#tableArea>table>tbody>tr#area' + ind); $ns.find('#td_pathContent').html(model.getPathCellContent(ind)); var $use_enable = $ns.find('#td_useScanArea>#use_enable'); var $use_disable = $ns.find('#td_useScanArea>#use_disable'); function useScanAreaCheck() { if ($(this).attr('id') == 'use_disable') { $use_enable.hide(); $use_disable.show(); } else { $use_enable.show(); $use_disable.hide(); } } function useScanAreaClick() { if ($(this).attr('id') == 'use_enable') { $use_enable.hide(); $use_disable.show(); scan_area.UseScanArea = false; } else { $use_enable.show(); $use_disable.hide(); scan_area.UseScanArea = true; } editTask.setSettingsTaskChange(); } useScanAreaCheck.call(scan_area.UseScanArea ? $use_enable : $use_disable); $use_enable.click(useScanAreaClick); $use_disable.click(useScanAreaClick); function selectSecLevel() { window.location.href = this.href; showEditCell(ind, SA_CELL_SECLEVEL); } function selectObjects() { window.location.href = this.href; showEditCell(ind, SA_CELL_OBJECTS); } function selectUsersGroups() { window.location.href = this.href; showEditCell(ind, SA_CELL_USERS); } var $path = $ns.find('#pathLink'); var $secLevelColumn = $ns.find('#a_changeSecLevel'); var $masksColumn = $ns.find('#a_changeMasks'); var $usersColumn = $ns.find('#a_changeUsersGroups'); setupLinks( ind, $path, $secLevelColumn, $masksColumn, $usersColumn ); $path.attr('id', 'area' + ind + '_pathLink'); if($secLevelColumn.length > 0) { $secLevelColumn .attr('id', 'area' + ind + '_secLevelLink') .icHistory(selectSecLevel) .find('#dataField') .html(model.calcSecLevel(scan_area)[1]) } if($masksColumn.length > 0) { $masksColumn .attr('id', 'area' + ind + '_objectsLink') .icHistory(selectObjects); writeObjectsUsersGroupsLink( $masksColumn, model.masksToString(scan_area)); } if($usersColumn.length > 0) { $usersColumn .attr('id', 'area' + ind + '_usersLink') .icHistory(selectUsersGroups); writeObjectsUsersGroupsLink( $usersColumn, model.usersToString(scan_area)); } if(window.location.hash.indexOf('/area' + ind + '/' + hashes_.seclevel) > -1) showEditCell(ind, SA_CELL_SECLEVEL); if(window.location.hash.indexOf('/area' + ind + '/' + hashes_.objects) > -1) showEditCell(ind, SA_CELL_OBJECTS); if(window.location.hash.indexOf('/area' + ind + '/' + hashes_.users) > -1) showEditCell(ind, SA_CELL_USERS); if(window.location.hash.indexOf('/area' + ind + '/' + hashes_.path) > -1) $path.click(); var id_=ind; $('#tableArea>table>tbody>tr#area'+ind+'>td>input[type=checkbox]') .click(function(ev){ shift_lock=(ev.shiftKey==1); model.InitButton();}) .change(function(){ if (last_clicked>=0 && last_clicked!=id_ && shift_lock && last_clicked<model.scopes.length && $('#tableArea>table>tbody>tr#area'+ind+'>td>input[type=checkbox]').attr('checked') == $(this).attr('checked')){ /* select with shift >*/ d = (last_clicked - id_)/Math.abs(last_clicked-id_); ch=$(this).attr('checked'); for (i=id_;i!=last_clicked;i+=d){ $('#tableArea>table>tbody>tr#area'+i+'>td>input[type=checkbox]').attr('checked',ch); }; }; last_clicked=id_; }); }; this.addScanArea = addScanArea; function fillRTPExcludeScanPathes() { $('#tableArea>table>tbody>tr[id^=area]').remove(); $('#tableArea>table>tbody>tr[id^=editrow]').remove(); lastComboHide(); $(model.scopes).each(function(ind){ addScanArea(this, ind); }); if(model.scopes.length==0) { $('#tableArea #empty_areas').remove(); var numColumns = $('#tableArea table>tbody>tr>th').length; $('#tableArea>table>tbody:first').append( '<TR ID="empty_areas">'+ '<TD COLSPAN="' + numColumns + '" ALIGN="center">'+ _res("EMPTY_LIST_AREA")+ '</TD></TR>'); } $('#tableArea>table').trigger('update'); model.InitButton(); }; function bindDeleteButton() { $('#tools [alt=Delete]').unbind('click'); $('#tools [alt=Delete]').click(function(){ removed = 0; ids = getSelectedScopes(); model.scopes.removeIndexes(ids); getMainCheckbox().attr('checked',false); if(model.lastComboIndex != null) { if(model.lastComboIndex > 0) model.lastComboIndex--; else model.lastComboIndex = null; } fillRTPExcludeScanPathes(); editTask.setSettingsTaskChange() }); } function bindDownButton() { $('#tools [alt=Down]').unbind('click'); $('#tools [alt=Down]').click(function(){ ids=getSelectedScopes(); newids=[]; //do nothing if last selected in the bottom if (ids.length == 0 || ids[ids.length-1] == model.scopes.length-1) return; for(i = model.scopes.length-1;i>0;i--){ if (ids[ids.length-1]==i-1){ tmp=model.scopes[i]; model.scopes[i]=model.scopes[i-1]; model.scopes[i-1]=tmp; ids.pop(); newids.push(i) }; }; fillRTPExcludeScanPathes(); setSelectedScopes(newids); editTask.setSettingsTaskChange(); }); } function bindUpButton() { $('#tools [alt=Up]').unbind('click'); $('#tools [alt=Up]').click(function(){ ids = getSelectedScopes(); newids=[]; //do nothing if first selected item at the top if (ids.length==0 || ids[0] == 0) return; for(i=0;i < model.scopes.length-1;i++){ if (ids[0]== i+1){ tmp = model.scopes[i]; model.scopes[i]=model.scopes[i+1]; model.scopes[i+1]=tmp; ids.splice(0,1); newids.push(i) }; }; fillRTPExcludeScanPathes(); setSelectedScopes(newids); editTask.setSettingsTaskChange() }); } function onTitleCheckboxClicked() { $('#tableArea > table > tbody > tr[id^=area] :checkbox') .attr('checked', this.checked); model.InitButton(); } this.validateModelOnStart = function() { if(!this.bindDomElement){ alert('ScanScopeModel.bindDomElement should be set before running'); return false; } if(!this.scopes){ alert('ScanScopeModel.scopes should be set before running'); return false; } if(!this.scopeItemCreator){ alert('ScanScopeModel.scopeItemCreator should be set before running'); return false; } if(typeof(this.scopeItemCreator)!='function'){ alert('ScanScopeModel.scopeItemCreator should be a function'); return false; } return true; } this.run = function() { if(!this.validateModelOnStart()) return; last_clicked=-1, shift_lock=false; var $type = $('#rtp_new_scopetype'); var $path = $('#rtp_new_path'); var $desc = $('#rtp_new_path_description'); var $ok = $('#rtp_new_area_ok'); var scan_area; function getAreaPath() { scan_area = model.scopeItemCreator(); return scan_area.AreaPath; } function enableOkButton() { $ok.removeAttr('disabled'); } function disableOkButton() { $ok.attr('disabled', true); } function onSync() { if(typeof(scan_area.ScanSettings) !== 'undefined') model.setDefaultScanSettings(model.use_ods_seclevel(), 2, scan_area.ScanSettings); var idx = model.scopes.length; scan_area.AreaDesc = $desc.val(); model.scopes[idx] = scan_area; addScanArea(scan_area, idx); $path.val('').change(); $desc.val('').change(); $ok.attr('disabled', true); getMainCheckbox().attr('checked',false); editTask.setSettingsTaskChange(); } scopePage_synchronizer.bind( $type, $path, $ok, getAreaPath, enableOkButton, disableOkButton, onSync); $('#tableArea').loadCache('pages/settingsTask/scope_table.html', function(){ getMainCheckbox().click(onTitleCheckboxClicked); bindDeleteButton(); bindUpButton(); bindDownButton(); function __fillRevert() { if( $('#isScopePageMarker').length > 0 ) { fillRTPExcludeScanPathes(); taskSettings_addRevertFunc(__fillRevert); } } __fillRevert(); }); } this.bindEntryToList = function(data){ var store = data.store; var list = data.list; var entry = data.entry; //var mdm = data data.parent_id = data.name data.last_select = -1 data.isFullView = false // data.users = ["user1","user2","user3","user4","user5","user1"] $('#'+data.name+'_edit_buttons').html('<a href="#" id="'+data.name+'_edit"><img src="./img/buttons/edit.gif" alt="Edit" title="Edit"/></a>'+ '<span id="'+data.name+'_edit_grey"><img src="./img/buttons/edit_grey.gif" /></span>') $('#'+data.name+'_remove_buttons').html('<a href="#" id="'+data.name+'_remove"><img src="./img/buttons/del.gif" alt="Delete" title="Delete"/></a>'+ '<span id="'+data.name+'_remove_grey"><img src="./img/buttons/del_grey.gif"/></span>') $('#'+data.name+'_add_buttons').html('<a href="#" id="'+data.name+'_add"><img src="./img/buttons/plus.gif" alt="Add" title="Add"/></a>'+ '<span id="'+data.name+'_add_grey"><img src="./img/buttons/plus_grey.gif" /></span>') //$('#'+data.name+'_list_buttons').html('<a id="'+data.name+'_mode"><img src="./img/buttons/edit.gif" alt="Edit" title="Edit"/>Edit Mode</a>') data.add_btn = $('#'+data.name+'_add') data.add_btn_grey = $('#'+data.name+'_add_grey') data.del_btn = $('#'+data.name+'_remove') data.del_btn_grey = $('#'+data.name+'_remove_grey') data.edit_btn = $('#'+data.name+'_edit') data.edit_btn_grey = $('#'+data.name+'_edit_grey') data.list_btn = $('#'+data.name+'_list_buttons') //data.list_btn_grey = $('#'+data.name+'_list_grey') //alert(data.list_btn.length) //data.list_btn.attr("checked",false) // alert("init:"+data.list_btn.attr("checked")) data.edit_btn.css("display","none"); data.del_btn.css("display","none"); data.add_btn_grey.css("display","none"); //data.list_btn_grey.css("display","none"); //$('#' + list.attr('id')).disableSelection(); var onchange; //list.parent().css("width",list.parent().width()) //list.click(function(){return}) if (data.onchange) onchange=data.onchange; function do_onchange(){ //alert("do_onchange isInitRTPSettings="+isInitRTPSettings) if (!isInitRTPSettings) editTask.setSettingsTaskChange() if (typeof(onchange)=='function') onchange(); }; function repaintButtons(){ var count_select = 0 $("div[id^='"+data.parent_id+"_']").each( function (){ if($(this).hasClass("kl_list_option_select")) count_select++ } ) data.edit_btn.css("display","none") data.edit_btn_grey.css("display","block") data.del_btn.css("display","block") data.del_btn_grey.css("display","none") if (count_select==0) { data.edit_btn.css("display","none") data.del_btn.css("display","none") data.edit_btn_grey.css("display","block") data.del_btn_grey.css("display","block") } if (count_select==1) { data.edit_btn.css("display","block") data.del_btn.css("display","block") data.edit_btn_grey.css("display","none") data.del_btn_grey.css("display","none") } } function selectKeyHandler(event) { var s = 0 if(event.ctrlKey) s= 1 if(event.shiftKey) s= 2 str= this.id //data.parent_id = $(this).parent().parent().parent().parent().attr("id") if (s==0) { $("div[id^='"+data.parent_id+"_']").each( function (){ $(this).removeClass("kl_list_option_select") } ) $('#'+str).toggleClass("kl_list_option_select") } if (s==2){ name1_array = str.split("_") name2_array = data.last_select.split("_") var num1 = parseInt(name1_array[name1_array.length-1]) var num2 = parseInt(name2_array[name2_array.length-1]) for(var i=Math.min(num1,num2);i<=Math.max(num1,num2);i++){ $('#'+data.parent_id+"_"+i).addClass("kl_list_option_select") } } if (s==1) $('#'+str).toggleClass("kl_list_option_select") repaintButtons() data.last_select = str }; // list.keyup(selectKeyHandler) var k = 0 function addListOption(list, val) { var num = k//list.children('div').length var id = data.name//list.attr("id") list.append('<tr><td style="padding:1px;"><div id="'+id+'_'+num+'">'+val+'</div></td></tr>') //if ($('#'+data.name+'_remove').length==1) $('#'+id+'_'+num).click(selectKeyHandler); k++ } store.sort() $(store).each(function(){ addListOption(list, ''+this); }); function add_item(){ val='' + $(entry).val(); if (val.length>0){ addListOption(list, val); store.push(val); $(entry).val('').focus(); do_onchange(); }; }; function edit() { $("div.kl_list_option_select[id^='"+data.name+"_']").each(function(){ edit_id = data.name+"_edit_text" $(this).removeClass("kl_list_option_select") $(this).html('<input id="'+edit_id+'" type="text" style="width:155px" value="'+$(this).html()+'" />'); $('#'+edit_id) .keyup(enterEditKeyHandler) .fastChange(fastChangeHandler) .blur(function(){ $(this).parent().html($(this).val()) data.add_btn_grey.css("display","none") data.add_btn.css("display","block") }) .focus() .select() }) } function setHref(){ this.href = window.location.href; } var enterKeyHandler = function(event){ if(event.keyCode==13) add_item(); }; function enterEditKeyHandler(event) { var name_array = $(this).parent().attr("id").split("_") if(event.keyCode==13){ $(this).parent().html($(this).val()) data.add_btn_grey.css("display","none") data.add_btn.css("display","block") repaintButtons() } } function fastChangeHandler() { var name_array = $(this).parent().attr("id").split("_") var num = parseInt(name_array[name_array.length-1]) store[num] = $(this).val() if($(this).val()=='') store.removeIndexes([num]) do_onchange(); } function unique(array_){ var result = new Array() for(var i=0;i<array_.length;i++){ num = $.inArray(array_[i],array_) if (i==num) result.push(array_[i]) } return result } function inArray(element,array_){ for(var i=0;i<array_.length;i++){ if (element.localeCompare(array_[i])==0) return i } return -1 } data.del_btn.each(setHref).click(function(){ to_del=[]; i=0; $("div[id^='"+data.parent_id+"_']").each( function (){ // alert($(this).css("background-color")) //if ($(this).css("background-color")=="blue") { if($(this).hasClass("kl_list_option_select")) { /* if(data.isFullView){ num = inArray($(this).html(),store) to_del.push(num); } else */ to_del.push(i); $(this).remove(); } i++; } ) store.removeIndexes(to_del); do_onchange(); repaintButtons() }); data.edit_btn.each(setHref).click(function(){ edit() }); data.add_btn.each(setHref).click(function(){ data.add_btn.css("display","none") data.add_btn_grey.css("display","block") $("div[id^='"+data.parent_id+"_']").each( function (){ $(this).removeClass("kl_list_option_select") } ) num = store.length//list.children('div').length var id = data.name//list.attr("id") list.append('<tr><td style="padding:0px 5px;"><div id="'+id+'_'+num+'"/></td></tr>') $('#'+id+'_'+num).click(selectKeyHandler) $('#'+id+'_'+num).addClass("kl_list_option_select") edit() }); data.list_btn.each(setHref).click(function(){ list.html(" ") // if (!data.list_btn.attr("checked")) { if (data.isFullView) { data.list_btn.html(_res('LABEL_EDIT_MODE')); data.isFullView = false store.sort() $(store).each(function(){ addListOption(list, ''+this); }); return } data.isFullView = true data.list_btn.html(_res('LABEL_VIEW_MODE')); var list_view_A = store.concat(data.users) list_view_A = unique(list_view_A); list_view_A.sort(); var list_view = new Array(); $(list_view_A).each(function(){ f_list = (inArray(this,data.users)>=0) f_select = (inArray(this,store)>=0) list_view.push({value:this,select:f_select,isList:f_list}) }); num = 0 $(list_view).each(function(){ /* if (!this.isList) { num_=inArray(this.value,store) // list.append('<tr><td style="padding:0px 5px;"><div id="'+data.name+'_'+num_+'">'+this.value+'</div></td></tr>') // $('#'+data.name+'_'+num_) // .click(selectKeyHandler); // list.append('<tr><td style="padding:0px 5px;"><div id="'+data.name+'_'+num_+'">'+this.value+'</div></td></tr>') list.append('<tr><td style="padding:0px 5px;"><input type="checkbox" checked id="'+data.name+'_list_'+num+'" value="'+this.value+'"><b>'+this.value+'</b></td></tr>') } else*/ { if(this.select) list.append('<tr><td style="padding:0px 5px;"><input type="checkbox" checked id="'+data.name+'_list_'+num+'" value="'+this.value+'">'+this.value+'</td></tr>') else list.append('<tr><td style="padding:0px 5px;"><input type="checkbox" id="'+data.name+'_list_'+num+'" value="'+this.value+'">'+this.value+'</td></tr>') $('#'+data.name+'_list_'+num) .click(function(){ if ($(this).attr("checked")) { store.push($(this).val()); } else { to_del=[] to_del.push(inArray($(this).val(),store)) store.removeIndexes(to_del); } do_onchange(); }); } num++ }); }); }; } jQuery.fn.extend({ disableSelection : function() { return this.each(function(){ if (typeof this.onselectstart!="undefined") this.onselectstart=function(){return false} else if (typeof this.style.MozUserSelect!="undefined") this.style.MozUserSelect="none" else this.onmousedown=function(){return false} this.style.cursor = "default" }) } }) var scopePage_model = new ScanScopeModel();
💾 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