From 93e29ad7d5c9ba017252cb7b25aca94657023dd7 Mon Sep 17 00:00:00 2001 From: nancylizi Date: Mon, 20 Mar 2017 16:47:42 +0800 Subject: Resolve the dependent problem. Issue-Id: CLIENT-171 Change-Id: Ifad1deec7b7c737b5b2e44950720189248c2666d Signed-off-by: nancylizi --- common/src/main/webapp/thirdparty/js/core/const.js | 46 + .../src/main/webapp/thirdparty/js/core/hk.min.js | 819 +++++ .../webapp/thirdparty/js/core/load_menuList.js | 70 + .../webapp/thirdparty/js/core/openoFrameWork.js | 3701 ++++++++++++++++++++ .../src/main/webapp/thirdparty/js/core/pym.min.js | 16 + 5 files changed, 4652 insertions(+) create mode 100644 common/src/main/webapp/thirdparty/js/core/const.js create mode 100644 common/src/main/webapp/thirdparty/js/core/hk.min.js create mode 100644 common/src/main/webapp/thirdparty/js/core/load_menuList.js create mode 100644 common/src/main/webapp/thirdparty/js/core/openoFrameWork.js create mode 100644 common/src/main/webapp/thirdparty/js/core/pym.min.js (limited to 'common/src/main/webapp/thirdparty/js/core') diff --git a/common/src/main/webapp/thirdparty/js/core/const.js b/common/src/main/webapp/thirdparty/js/core/const.js new file mode 100644 index 00000000..66bee91a --- /dev/null +++ b/common/src/main/webapp/thirdparty/js/core/const.js @@ -0,0 +1,46 @@ +/* + * Copyright 2016, CMCC Technologies Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +var fMenuSiderDivId = 'page-f-sidebar-menu'; +var ICTFRAME_CONST_SPINNER_GIF_PATH="image/loading-spinner-grey.gif"; +var ICTFRAME_CONST_IFRAME_HEIGHT_AJUST = 10; +var ICTFRAME_CONST_IFRAME_HEIGHT_AJUST_IE = 5; +var ICTFRAME_CONST_THEME_COLOR_CSS_PREFFIX = "css/themes/"; +var ICTFRAME_CONST_DEFAULTPAGE_PATH = "default.html?"; +var ICTFRAME_CONST_DATABACKUP_PATH = 'menus/dataBackup-mysql.html'; +var IS_V5_TESTVERSION = true; + +var FrameConst={}; +//默认登录成功跳转页面 +FrameConst.DEFAULT_LOGINSKIP_PAGE = "common/main-page.html"; +FrameConst.DEFAULT_PAGE = "default.html"; + +FrameConst.do_heartbeat = false; +FrameConst.change_pass = false; +//是否加密 +FrameConst.isEncypt = "false"; +FrameConst.REST_FRAMECOMMIFO = "../../api/uiframe/v1/frameCommInfo"; +FrameConst.REST_HEARTBEAT = "../../api/uiframe/v1/heartbeat"; +FrameConst.REST_GETLICENSEINFO = "../../api/uiframe/v1/licensevalueinfo"; +FrameConst.REST_CHECKRIGHT = "../../api/uiframe/v1/checkRight"; +FrameConst.REST_LOGIN = "../../api/uiframe/v1/login"; +FrameConst.REST_GET_FRAME_MENUDIRECTION = "../../api/uiframe/v1/confByKey?key=usf.mainframe.web.navigation.direction"; +FrameConst.REST_GET_USERNAME = "../../api/uiframe/v1/userName"; + + +FrameConst.REST_GET_VERSIONINFO = "../../api/uiframe/v1/versionInfo"; +var zte_http_headers=new Array(); +zte_http_headers.push({"key":"ICTAuthentication","value":"icttka","store":true}); +zte_http_headers.push({"key":"isFromWeb","value":"1","store":false}); \ No newline at end of file diff --git a/common/src/main/webapp/thirdparty/js/core/hk.min.js b/common/src/main/webapp/thirdparty/js/core/hk.min.js new file mode 100644 index 00000000..73ab7f2c --- /dev/null +++ b/common/src/main/webapp/thirdparty/js/core/hk.min.js @@ -0,0 +1,819 @@ +/* + * Copyright 2016, CMCC Technologies Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +;(function(window, define) { + var _ = { + version: "2.3.0", + areas: {}, + apis: {}, + + // utilities + inherit: function(api, o) { + for (var p in api) { + if (!o.hasOwnProperty(p)) { + o[p] = api[p]; + } + } + return o; + }, + stringify: function(d) { + return d === undefined || typeof d === "function" ? d+'' : JSON.stringify(d); + }, + parse: function(s) { + // if it doesn't parse, return as is + try{ return JSON.parse(s); }catch(e){ return s; } + }, + + // extension hooks + fn: function(name, fn) { + _.storeAPI[name] = fn; + for (var api in _.apis) { + _.apis[api][name] = fn; + } + }, + get: function(area, key){ return area.getItem(key); }, + set: function(area, key, string){ area.setItem(key, string); }, + remove: function(area, key){ area.removeItem(key); }, + key: function(area, i){ return area.key(i); }, + length: function(area){ return area.length; }, + clear: function(area){ area.clear(); }, + + // core functions + Store: function(id, area, namespace) { + var store = _.inherit(_.storeAPI, function(key, data, overwrite) { + if (arguments.length === 0){ return store.getAll(); } + if (data !== undefined){ return store.set(key, data, overwrite); } + if (typeof key === "string"){ return store.get(key); } + if (!key){ return store.clear(); } + return store.setAll(key, data);// overwrite=data, data=key + }); + store._id = id; + try { + var testKey = '_safariPrivate_'; + area.setItem(testKey, 'sucks'); + store._area = area; + area.removeItem(testKey); + } catch (e) {} + if (!store._area) { + store._area = _.inherit(_.storageAPI, { items: {}, name: 'fake' }); + } + store._ns = namespace || ''; + if (!_.areas[id]) { + _.areas[id] = store._area; + } + if (!_.apis[store._ns+store._id]) { + _.apis[store._ns+store._id] = store; + } + return store; + }, + storeAPI: { + // admin functions + area: function(id, area) { + var store = this[id]; + if (!store || !store.area) { + store = _.Store(id, area, this._ns);//new area-specific api in this namespace + if (!this[id]){ this[id] = store; } + } + return store; + }, + namespace: function(namespace, noSession) { + if (!namespace){ + return this._ns ? this._ns.substring(0,this._ns.length-1) : ''; + } + var ns = namespace, store = this[ns]; + if (!store || !store.namespace) { + store = _.Store(this._id, this._area, this._ns+ns+'.');//new namespaced api + if (!this[ns]){ this[ns] = store; } + if (!noSession){ store.area('session', _.areas.session); } + } + return store; + }, + isFake: function(){ return this._area.name === 'fake'; }, + toString: function() { + return 'store'+(this._ns?'.'+this.namespace():'')+'['+this._id+']'; + }, + + // storage functions + has: function(key) { + if (this._area.has) { + return this._area.has(this._in(key));//extension hook + } + return !!(this._in(key) in this._area); + }, + size: function(){ return this.keys().length; }, + each: function(fn, and) { + for (var i=0, m=_.length(this._area); i _.length(this._area)) { m--; i--; }// in case of removeItem + } + return and || this; + }, + keys: function() { + return this.each(function(k, list){ list.push(k); }, []); + }, + get: function(key, alt) { + var s = _.get(this._area, this._in(key)); + return s !== null ? _.parse(s) : alt || s;// support alt for easy default mgmt + }, + getAll: function() { + return this.each(function(k, all){ all[k] = this.get(k); }, {}); + }, + set: function(key, data, overwrite) { + var d = this.get(key); + if (d != null && overwrite === false) { + return data; + } + return _.set(this._area, this._in(key), _.stringify(data), overwrite) || d; + }, + setAll: function(data, overwrite) { + var changed, val; + for (var key in data) { + val = data[key]; + if (this.set(key, val, overwrite) !== val) { + changed = true; + } + } + return changed; + }, + remove: function(key) { + var d = this.get(key); + _.remove(this._area, this._in(key)); + return d; + }, + clear: function() { + if (!this._ns) { + _.clear(this._area); + } else { + this.each(function(k){ _.remove(this._area, this._in(k)); }, 1); + } + return this; + }, + clearAll: function() { + var area = this._area; + for (var id in _.areas) { + if (_.areas.hasOwnProperty(id)) { + this._area = _.areas[id]; + this.clear(); + } + } + this._area = area; + return this; + }, + + // internal use functions + _in: function(k) { + if (typeof k !== "string"){ k = _.stringify(k); } + return this._ns ? this._ns + k : k; + }, + _out: function(k) { + return this._ns ? + k && k.indexOf(this._ns) === 0 ? + k.substring(this._ns.length) : + undefined : // so each() knows to skip it + k; + } + },// end _.storeAPI + storageAPI: { + length: 0, + has: function(k){ return this.items.hasOwnProperty(k); }, + key: function(i) { + var c = 0; + for (var k in this.items){ + if (this.has(k) && i === c++) { + return k; + } + } + }, + setItem: function(k, v) { + if (!this.has(k)) { + this.length++; + } + this.items[k] = v; + }, + removeItem: function(k) { + if (this.has(k)) { + delete this.items[k]; + this.length--; + } + }, + getItem: function(k){ return this.has(k) ? this.items[k] : null; }, + clear: function(){ for (var k in this.list){ this.removeItem(k); } }, + toString: function(){ return this.length+' items in '+this.name+'Storage'; } + }// end _.storageAPI + }; + + // setup the primary store fn + if (window.store){ _.conflict = window.store; } + var store = + // safely set this up (throws error in IE10/32bit mode for local files) + _.Store("local", (function(){try{ return localStorage; }catch(e){}})()); + store.local = store;// for completeness + store._ = _;// for extenders and debuggers... + // safely setup store.session (throws exception in FF for file:/// urls) + store.area("session", (function(){try{ return sessionStorage; }catch(e){}})()); + + //Expose store to the global object + window.store = store; + + if (typeof define === 'function' && define.amd !== undefined) { + define(function () { + return store; + }); + } else if (typeof module !== 'undefined' && module.exports) { + module.exports = store; + } + +})(this, null); + +// XHook - v1.3.3 - https://github.com/jpillora/xhook +// Jaime Pillora - MIT Copyright 2015 +(function(window,undefined) { +var AFTER, BEFORE, COMMON_EVENTS, EventEmitter, FIRE, FormData, NativeFormData, NativeXMLHttp, OFF, ON, READY_STATE, UPLOAD_EVENTS, XHookFormData, XHookHttpRequest, XMLHTTP, convertHeaders, depricatedProp, document, fakeEvent, mergeObjects, msie, proxyEvents, slice, xhook, _base, + __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; + +document = window.document; + +BEFORE = 'before'; + +AFTER = 'after'; + +READY_STATE = 'readyState'; + +ON = 'addEventListener'; + +OFF = 'removeEventListener'; + +FIRE = 'dispatchEvent'; + +XMLHTTP = 'XMLHttpRequest'; + +FormData = 'FormData'; + +UPLOAD_EVENTS = ['load', 'loadend', 'loadstart']; + +COMMON_EVENTS = ['progress', 'abort', 'error', 'timeout']; + +msie = parseInt((/msie (\d+)/.exec(navigator.userAgent.toLowerCase()) || [])[1]); + +if (isNaN(msie)) { + msie = parseInt((/trident\/.*; rv:(\d+)/.exec(navigator.userAgent.toLowerCase()) || [])[1]); +} + +(_base = Array.prototype).indexOf || (_base.indexOf = function(item) { + var i, x, _i, _len; + for (i = _i = 0, _len = this.length; _i < _len; i = ++_i) { + x = this[i]; + if (x === item) { + return i; + } + } + return -1; +}); + +slice = function(o, n) { + return Array.prototype.slice.call(o, n); +}; + +depricatedProp = function(p) { + return p === "returnValue" || p === "totalSize" || p === "position"; +}; + +mergeObjects = function(src, dst) { + var k, v; + for (k in src) { + v = src[k]; + if (depricatedProp(k)) { + continue; + } + try { + dst[k] = src[k]; + } catch (_error) {} + } + return dst; +}; + +proxyEvents = function(events, src, dst) { + var event, p, _i, _len; + p = function(event) { + return function(e) { + var clone, k, val; + clone = {}; + for (k in e) { + if (depricatedProp(k)) { + continue; + } + val = e[k]; + clone[k] = val === src ? dst : val; + } + return dst[FIRE](event, clone); + }; + }; + for (_i = 0, _len = events.length; _i < _len; _i++) { + event = events[_i]; + if (dst._has(event)) { + src["on" + event] = p(event); + } + } +}; + +fakeEvent = function(type) { + var msieEventObject; + if (document.createEventObject != null) { + msieEventObject = document.createEventObject(); + msieEventObject.type = type; + return msieEventObject; + } else { + try { + return new Event(type); + } catch (_error) { + return { + type: type + }; + } + } +}; + +EventEmitter = function(nodeStyle) { + var emitter, events, listeners; + events = {}; + listeners = function(event) { + return events[event] || []; + }; + emitter = {}; + emitter[ON] = function(event, callback, i) { + events[event] = listeners(event); + if (events[event].indexOf(callback) >= 0) { + return; + } + i = i === undefined ? events[event].length : i; + events[event].splice(i, 0, callback); + }; + emitter[OFF] = function(event, callback) { + var i; + if (event === undefined) { + events = {}; + return; + } + if (callback === undefined) { + events[event] = []; + } + i = listeners(event).indexOf(callback); + if (i === -1) { + return; + } + listeners(event).splice(i, 1); + }; + emitter[FIRE] = function() { + var args, event, i, legacylistener, listener, _i, _len, _ref; + args = slice(arguments); + event = args.shift(); + if (!nodeStyle) { + args[0] = mergeObjects(args[0], fakeEvent(event)); + } + legacylistener = emitter["on" + event]; + if (legacylistener) { + legacylistener.apply(undefined, args); + } + _ref = listeners(event).concat(listeners("*")); + for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) { + listener = _ref[i]; + listener.apply(undefined, args); + } + }; + emitter._has = function(event) { + return !!(events[event] || emitter["on" + event]); + }; + if (nodeStyle) { + emitter.listeners = function(event) { + return slice(listeners(event)); + }; + emitter.on = emitter[ON]; + emitter.off = emitter[OFF]; + emitter.fire = emitter[FIRE]; + emitter.once = function(e, fn) { + var fire; + fire = function() { + emitter.off(e, fire); + return fn.apply(null, arguments); + }; + return emitter.on(e, fire); + }; + emitter.destroy = function() { + return events = {}; + }; + } + return emitter; +}; + +xhook = EventEmitter(true); + +xhook.EventEmitter = EventEmitter; + +xhook[BEFORE] = function(handler, i) { + if (handler.length < 1 || handler.length > 2) { + throw "invalid hook"; + } + return xhook[ON](BEFORE, handler, i); +}; + +xhook[AFTER] = function(handler, i) { + if (handler.length < 2 || handler.length > 3) { + throw "invalid hook"; + } + return xhook[ON](AFTER, handler, i); +}; + +xhook.enable = function() { + window[XMLHTTP] = XHookHttpRequest; + if (NativeFormData) { + window[FormData] = XHookFormData; + } +}; + +xhook.disable = function() { + window[XMLHTTP] = xhook[XMLHTTP]; + window[FormData] = NativeFormData; +}; + +convertHeaders = xhook.headers = function(h, dest) { + var header, headers, k, name, v, value, _i, _len, _ref; + if (dest == null) { + dest = {}; + } + switch (typeof h) { + case "object": + headers = []; + for (k in h) { + v = h[k]; + name = k.toLowerCase(); + headers.push("" + name + ":\t" + v); + } + return headers.join('\n'); + case "string": + headers = h.split('\n'); + for (_i = 0, _len = headers.length; _i < _len; _i++) { + header = headers[_i]; + if (/([^:]+):\s*(.+)/.test(header)) { + name = (_ref = RegExp.$1) != null ? _ref.toLowerCase() : void 0; + value = RegExp.$2; + if (dest[name] == null) { + dest[name] = value; + } + } + } + return dest; + } +}; + +NativeFormData = window[FormData]; + +XHookFormData = function(form) { + var entries; + this.fd = form ? new NativeFormData(form) : new NativeFormData(); + this.form = form; + entries = []; + Object.defineProperty(this, 'entries', { + get: function() { + var fentries; + fentries = !form ? [] : slice(form.querySelectorAll("input,select")).filter(function(e) { + var _ref; + return ((_ref = e.type) !== 'checkbox' && _ref !== 'radio') || e.checked; + }).map(function(e) { + return [e.name, e.type === "file" ? e.files : e.value]; + }); + return fentries.concat(entries); + } + }); + this.append = (function(_this) { + return function() { + var args; + args = slice(arguments); + entries.push(args); + return _this.fd.append.apply(_this.fd, args); + }; + })(this); +}; + +if (NativeFormData) { + xhook[FormData] = NativeFormData; + window[FormData] = XHookFormData; +} + +NativeXMLHttp = window[XMLHTTP]; + +xhook[XMLHTTP] = NativeXMLHttp; + +XHookHttpRequest = window[XMLHTTP] = function() { + var ABORTED, currentState, emitFinal, emitReadyState, facade, hasError, hasErrorHandler, readBody, readHead, request, response, setReadyState, status, transiting, writeBody, writeHead, xhr; + ABORTED = -1; + xhr = new xhook[XMLHTTP](); + request = {}; + status = null; + hasError = void 0; + transiting = void 0; + response = void 0; + readHead = function() { + var key, name, val, _ref; + response.status = status || xhr.status; + if (!(status === ABORTED && msie < 10)) { + response.statusText = xhr.statusText; + } + if (status !== ABORTED) { + _ref = convertHeaders(xhr.getAllResponseHeaders()); + for (key in _ref) { + val = _ref[key]; + if (!response.headers[key]) { + name = key.toLowerCase(); + response.headers[name] = val; + } + } + } + }; + readBody = function() { + if (!xhr.responseType || xhr.responseType === "text") { + response.text = xhr.responseText; + response.data = xhr.responseText; + } else if (xhr.responseType === "document") { + response.xml = xhr.responseXML; + response.data = xhr.responseXML; + } else { + response.data = xhr.response; + } + if ("responseURL" in xhr) { + response.finalUrl = xhr.responseURL; + } + }; + writeHead = function() { + facade.status = response.status; + facade.statusText = response.statusText; + }; + writeBody = function() { + if ('text' in response) { + facade.responseText = response.text; + } + if ('xml' in response) { + facade.responseXML = response.xml; + } + if ('data' in response) { + facade.response = response.data; + } + if ('finalUrl' in response) { + facade.responseURL = response.finalUrl; + } + }; + emitReadyState = function(n) { + while (n > currentState && currentState < 4) { + facade[READY_STATE] = ++currentState; + if (currentState === 1) { + facade[FIRE]("loadstart", {}); + } + if (currentState === 2) { + writeHead(); + } + if (currentState === 4) { + writeHead(); + writeBody(); + } + facade[FIRE]("readystatechange", {}); + if (currentState === 4) { + setTimeout(emitFinal, 0); + } + } + }; + emitFinal = function() { + if (!hasError) { + facade[FIRE]("load", {}); + } + facade[FIRE]("loadend", {}); + if (hasError) { + facade[READY_STATE] = 0; + } + }; + currentState = 0; + setReadyState = function(n) { + var hooks, process; + if (n !== 4) { + emitReadyState(n); + return; + } + hooks = xhook.listeners(AFTER); + process = function() { + var hook; + if (!hooks.length) { + return emitReadyState(4); + } + hook = hooks.shift(); + if (hook.length === 2) { + hook(request, response); + return process(); + } else if (hook.length === 3 && request.async) { + return hook(request, response, process); + } else { + return process(); + } + }; + process(); + }; + facade = request.xhr = EventEmitter(); + xhr.onreadystatechange = function(event) { + try { + if (xhr[READY_STATE] === 2) { + readHead(); + } + } catch (_error) {} + if (xhr[READY_STATE] === 4) { + transiting = false; + readHead(); + readBody(); + } + setReadyState(xhr[READY_STATE]); + }; + hasErrorHandler = function() { + hasError = true; + }; + facade[ON]('error', hasErrorHandler); + facade[ON]('timeout', hasErrorHandler); + facade[ON]('abort', hasErrorHandler); + facade[ON]('progress', function() { + if (currentState < 3) { + setReadyState(3); + } else { + facade[FIRE]("readystatechange", {}); + } + }); + if ('withCredentials' in xhr || xhook.addWithCredentials) { + facade.withCredentials = false; + } + facade.status = 0; + facade.open = function(method, url, async, user, pass) { + currentState = 0; + hasError = false; + transiting = false; + request.headers = {}; + request.headerNames = {}; + request.status = 0; + response = {}; + response.headers = {}; + request.method = method; + request.url = url; + request.async = async !== false; + request.user = user; + request.pass = pass; + setReadyState(1); + }; + facade.send = function(body) { + var hooks, k, modk, process, send, _i, _len, _ref; + _ref = ['type', 'timeout', 'withCredentials']; + if(navigator.userAgent.indexOf("Firefox/") != -1){http://atmosphere-framework.2306103.n4.nabble.com/Atmosphere-js-withCredentials-true-does-not-work-in-Firefox-td4656661.html + _ref = ['type', 'timeout']; + } + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + k = _ref[_i]; + modk = k === "type" ? "responseType" : k; + if (modk in facade) { + request[k] = facade[modk]; + } + } + request.body = body; + send = function() { + var header, value, _j, _len1, _ref1, _ref2; + proxyEvents(COMMON_EVENTS, xhr, facade); + if (facade.upload) { + proxyEvents(COMMON_EVENTS.concat(UPLOAD_EVENTS), xhr.upload, facade.upload); + } + transiting = true; + xhr.open(request.method, request.url, request.async, request.user, request.pass); + _ref1 = ['type', 'timeout', 'withCredentials']; + if(navigator.userAgent.indexOf("Firefox/") != -1){//http://atmosphere-framework.2306103.n4.nabble.com/Atmosphere-js-withCredentials-true-does-not-work-in-Firefox-td4656661.html + _ref1 = ['type', 'timeout']; + } + for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) { + k = _ref1[_j]; + modk = k === "type" ? "responseType" : k; + if (k in request) { + xhr[modk] = request[k]; + } + } + _ref2 = request.headers; + for (header in _ref2) { + value = _ref2[header]; + xhr.setRequestHeader(header, value); + } + if (request.body instanceof XHookFormData) { + request.body = request.body.fd; + } + xhr.send(request.body); + }; + hooks = xhook.listeners(BEFORE); + process = function() { + var done, hook; + if (!hooks.length) { + return send(); + } + done = function(userResponse) { + if (typeof userResponse === 'object' && (typeof userResponse.status === 'number' || typeof response.status === 'number')) { + mergeObjects(userResponse, response); + if (__indexOf.call(userResponse, 'data') < 0) { + userResponse.data = userResponse.response || userResponse.text; + } + setReadyState(4); + return; + } + process(); + }; + done.head = function(userResponse) { + mergeObjects(userResponse, response); + return setReadyState(2); + }; + done.progress = function(userResponse) { + mergeObjects(userResponse, response); + return setReadyState(3); + }; + hook = hooks.shift(); + if (hook.length === 1) { + return done(hook(request)); + } else if (hook.length === 2 && request.async) { + return hook(request, done); + } else { + return done(); + } + }; + process(); + }; + facade.abort = function() { + status = ABORTED; + if (transiting) { + xhr.abort(); + } else { + facade[FIRE]('abort', {}); + } + }; + facade.setRequestHeader = function(header, value) { + var lName, name; + lName = header != null ? header.toLowerCase() : void 0; + name = request.headerNames[lName] = request.headerNames[lName] || header; + if (request.headers[name]) { + value = request.headers[name] + ', ' + value; + } + request.headers[name] = value; + }; + facade.getResponseHeader = function(header) { + var name; + name = header != null ? header.toLowerCase() : void 0; + return response.headers[name]; + }; + facade.getAllResponseHeaders = function() { + return convertHeaders(response.headers); + }; + if (xhr.overrideMimeType) { + facade.overrideMimeType = function() { + return xhr.overrideMimeType.apply(xhr, arguments); + }; + } + if (xhr.upload) { + facade.upload = request.upload = EventEmitter(); + } + return facade; +}; +/* +if (typeof this.define === "function" && this.define.amd) { + define("xhook", [], function() { + return xhook; + }); +} else {*/ + (this.exports || this).xhook = xhook; +//} + +}.call(this,window)); + +xhook.before(function(request) { + var zte_headers = store('zte_http_headers'); + if (zte_headers && zte_headers.length > 0) { + for (i = 0; i < zte_headers.length; i++) { + if (zte_headers[i].store === true) { + if ( !! store(zte_headers[i].value)) { + request.headers[zte_headers[i].key] = store(zte_headers[i].value).toUpperCase() + } + } else { + request.headers[zte_headers[i].key] = zte_headers[i].value + } + } + } +}); \ No newline at end of file diff --git a/common/src/main/webapp/thirdparty/js/core/load_menuList.js b/common/src/main/webapp/thirdparty/js/core/load_menuList.js new file mode 100644 index 00000000..972e782b --- /dev/null +++ b/common/src/main/webapp/thirdparty/js/core/load_menuList.js @@ -0,0 +1,70 @@ +/* + * Copyright 2016, CMCC Technologies Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +var initLeftMenu = function() { + var i18nName = "openo_frame_left_menu_i18n"; + var parentMenus; + var childMenus; + + $.ajax({ + async : false, + "type" : "GET", + url : "json/menu_list.json", + dataType : "json", + "success" : function (res, textStatus, jqXHR) { + parentMenus = res.parentMenus; + childMenus = res.childMenus; + }, + error : function () { + } + }); + + var templateParent = "" + + "" + + "" + + "" + + "" + + ""; + + var templateChild = "
  • " + + "" + + "" + + "" + + "" + + "
  • "; + + var menuContent = ""; + for (var i = 0; i < parentMenus.length; i++) { + var parentMenuContent = templateParent.replace("{id}", parentMenus[i].id) + .replace("{iconClass}", parentMenus[i].iconClass) + .replace("{i18nName}", i18nName); + + var childMenuContent = ""; + for (var j = 0; j < childMenus.length; j++) { + if (childMenus[j].parentId == parentMenus[i].id) { + childMenuContent = childMenuContent + templateChild.replace("{id}", childMenus[j].id) + .replace("{url}", childMenus[j].url) + .replace("{iconClass}", childMenus[j].iconClass) + .replace("{hrefId}", childMenus[j].id + "_href") + .replace("{i18nName}", i18nName); + } + } + childMenuContent = ""; + + menuContent = menuContent + "
  • " + parentMenuContent + childMenuContent + "
  • "; + } + + return menuContent; +} \ No newline at end of file diff --git a/common/src/main/webapp/thirdparty/js/core/openoFrameWork.js b/common/src/main/webapp/thirdparty/js/core/openoFrameWork.js new file mode 100644 index 00000000..3b7e4b38 --- /dev/null +++ b/common/src/main/webapp/thirdparty/js/core/openoFrameWork.js @@ -0,0 +1,3701 @@ +锘/* +涓绘鏋 +*/ +/*string绫诲瀷鐨勫幓鍓嶅悗绌烘牸鍜宖ormat鏂规硶*/ +String.prototype.trim = function() { + return this.replace(/(^\s*)|(\s*$)/g, ""); +}; +String.prototype.format=function() { + if(arguments.length==0) return this; + for(var s=this, i=0; i ul > li', panel).each(function () { + var color = $(this).attr("data-style"); + if (color == configColor) { + // 鍖归厤涓婁簡鎵嶉噸璁鹃粯璁や富棰 + $(this).addClass("current"); + $('#style_color').attr("href", "css/themes/" + color + ".css"); + //if (store) { + store('style_color', color); + //} + } + }); +}; + +function setFrameWorkByConf() { + //璁剧疆鐢ㄦ埛鐩稿叧鐨勬鏋朵笅鎷夎彍鍗曟槸鍚﹀彲鐢 + var helpMenuItem = openoFrameWork_conf.helpMenuItem; + var aboutMenuItem = openoFrameWork_conf.aboutMenuItem; + var flightMenuItem = openoFrameWork_conf.flightMenuItem; + var fullscreenMenuItem = openoFrameWork_conf.fullscreenMenuItem; + var logoutMenuItem = openoFrameWork_conf.logoutMenuItem; + var changePassMenuItem = openoFrameWork_conf.changePassMenuItem; + if (!helpMenuItem || helpMenuItem === "false") { + $('#uep_ict_help_url').parent('li').remove(); + } + if (!aboutMenuItem|| aboutMenuItem === "false") { + $('[data-target="#aboutDlg"]').parent('li').remove(); + } + if (!helpMenuItem && !aboutMenuItem) { + $('#uep_ict_help_div').remove(); + } + if (!flightMenuItem|| flightMenuItem === "false") { + $('#header_notification_bar').html("
          
    "); + } + if (!fullscreenMenuItem|| fullscreenMenuItem === "false") { + //$('#trigger_fullscreen').parent().css("display", "none"); + $('#trigger_fullscreen_div').html(""); + } + if (!logoutMenuItem || logoutMenuItem === "false") { + //$('#trigger_logout').parent().css("display", "none"); + $('#trigger_logout_div').html(""); + } + if ((!fullscreenMenuItem && !logoutMenuItem) || (fullscreenMenuItem === "false" && logoutMenuItem === "false")) { + $('#full_logout_divider').css("display", "none"); + } + if (!changePassMenuItem ) { + $('#changePwd_labellink').css('display','none'); + $('#full_logout_divider').css('display','none'); + } + + //璁剧疆浜屾寮鍙戣呴夋嫨鐨勬鏋剁毊鑲 + var defaultColor = openoFrameWork_conf.defaultThemeColor; + var panel = $('.zte-theme-panel'); + $('ul > li', panel).removeClass("current"); + if (store && !store('style_color')) { // cookie娌℃湁鎵嶈缃粯璁や富棰 + setThemeColor(defaultColor); + } else { + setThemeColor(store('style_color')); + } +}; + +/*鏂板鐨刪ashtabel瀹炵幇绫伙紝鐢ㄦ埛鍚庣画iframe鐨勭紦瀛橈紝鍓嶈繘鍚庨鏃舵墦寮杩囩殑椤甸潰鐨勮彍鍗昳d鐨勭紦瀛樼瓑*/ +function Hashtable() +{ + this._hash = {}; + this._count = 0; + this.add = function(key, value) + { + if (this._hash.hasOwnProperty(key)) + return false; + else { + this._hash[key] = value; this._count++; return true; + } + } ; + this.hash = function() { return this._hash; }; + this.remove = function(key) { delete this._hash[key]; this._count--; } ; + this.count = function() { return this._count; }; + this.items = function(key) { if (this.contains(key)) return this._hash[key]; }; + this.contains = function(key) { return this._hash.hasOwnProperty(key); }; + this.clear = function() { this._hash = {}; this._count = 0; }; + this.replace = function(key, value) + { //鏈夊垯鍒犻櫎鍚庡鍔///鐩稿綋浜庢洿鏂 + if(this.contains(key)){ + this.remove(key); + } + return this.add(key, value); + } ; +}; + +var fMenuSiderDivId = 'page-f-sidebar-menu'; +var fMenuMegaDivId = 'f_hormenu'; +var megaSiderDivId = 'page-megachild-sidebar-menu'; +var megaDivId = 'main_hormenu'; +var openoFrameWork_menu_horizontal = "horizontal"; +var openoFrameWork_menu_vertical = "vertical"; +var openoFrameWork_menu_fmenu = "fmenu"; +var openoFrameWork_showNav = "true"; +var openoFrameWork_smallView = 960;//鍘熸潵涓992锛屼絾鏄湪鎶曞奖浠笂涓嶅噯锛堟姇褰变华璁剧疆涓1024锛屼絾鏄疄闄呭昂瀵告瘮1024灏忥級锛岃竟鏍忚彍鍗曚篃浼氳绉婚櫎锛岃繖涓缃竴涓◢灏忕殑鍊笺 + +/*涓嬮潰鏄富妗嗘灦鐨勬牳蹇*/ +var openoFrameWork = function () { + var defaultLanage=getLanguage(); + var isRTL = false;//鏂囨。椤哄簭 + var isTouch=function(){ + try { + document.createEvent("TouchEvent"); + return true; + } catch (e) { + return false; + } + }; + var isDesktop = !isTouch; + var isIE8 = false; + var isIE9 = false; + var isIE10 = false; + var gdocTitle=""; + var _sidebarWidth = 225; + var _sidebarCollapsedWidth = 35; + var responsiveHandlers = []; + var cachedIframes=new Hashtable(); + var cachedIframesObject=new Hashtable(); + var breadcrumbBtnMenus=new Hashtable(); + var _menuCategorys=new Hashtable(); + var _iframe="page-mainIframe"; //鍏ㄥ眬鍙橀噺淇濆瓨鐨勬槸褰撳墠姝e湪鎵撳紑浣跨敤鐨刬frame + var _sceneURLRootPath=""; + var _hashSource="";//淇″彿閲 + var _isClicked=false;//淇″彿閲 + //var _breadcrumbSource=false; + + // 鐨偆棰滆壊 + var layoutColorCodes = { + 'blue': '#4b8df8', + 'red': '#e02222', + 'green': '#35aa47', + 'purple': '#852b99', + 'grey': '#555555', + 'light-grey': '#fafafa', + 'yellow': '#ffb848', + 'ztebluelight': '#3366cc' + }; + // 鑾峰彇鐪熷疄鐨勮澶囩獥鍙eぇ灏忥紝鍙傝冧簡 http://andylangton.co.uk/articles/javascript/get-viewport-size-javascript/ + var _getViewPort = function () { + var e = window, a = 'inner'; + if (!('innerWidth' in window)) { + a = 'client'; + e = document.documentElement || document.body; + } + return { + width: e[a + 'Width'], + height: e[a + 'Height'] + } + } + // 鍒濆鍖 + var dealInit = function () { + var sence = '0'; + var menuSence = getUrlParam("menu"); + var confSence = 0; + if (menuSence) { + sence = menuSence; + } else { + sence = confSence; + } + switch (sence) { + case "1": + gdocTitle = $('#com_zte_ums_ict_framework_ui_page_title_1').text().trim(); + break; + case "2": + gdocTitle = $('#com_zte_ums_ict_framework_ui_page_title_2').text().trim(); + break; + case "3": + gdocTitle = $('#com_zte_ums_ict_framework_ui_page_title_3').text().trim(); + break; + case "0": + default: + gdocTitle = $('#com_zte_ums_ict_framework_ui_page_title').text().trim(); + break; + } + if ($('body').css('direction') === 'rtl') { + isRTL = true; + } + isIE8 = !! navigator.userAgent.match(/MSIE 8.0/); + isIE9 = !! navigator.userAgent.match(/MSIE 9.0/); + isIE10 = !! navigator.userAgent.match(/MSIE 10.0/); + if (isIE10) { + $('html').addClass('ie10'); // IE10 + } + if (isIE10 || isIE9 || isIE8) { + $('html').addClass('ie'); // IE10 + } + var deviceAgent = navigator.userAgent.toLowerCase(); + if (deviceAgent.match(/(iphone|ipod|ipad)/)) { + $(document).on('focus', 'input, textarea', function () { + $('.page-header').hide(); + if($('.page-footer')&&$('.page-footer').length>0) + $('.page-footer').hide(); + }); + $(document).on('blur', 'input, textarea', function () { + $('.page-header').show(); + if($('.page-footer')&&$('.page-footer').length>0) + $('.page-footer').show(); + }); + } else { + $(document).on('focus', 'input, textarea', function () { + if($('.page-footer')&&$('.page-footer').length>0) + $('.page-footer').hide(); + }); + $(document).on('blur', 'input, textarea', function () { + if($('.page-footer')&&$('.page-footer').length>0) + $('.page-footer').show(); + }); + } + } + //澶勭悊婊氬姩鍒 + var dealScrollTo=function (el, offeset) { + + } + var dealstartPageLoading=function(message) { + $('.page-loading').remove(); + $('body').append('
      ' + (message ? message : $.i18n.prop('com_zte_ums_ict_framework_ui_loading')) + '
    '); + } + var dealstopPageLoading=function() { + $('.page-loading').remove(); + } + var dealSidebarState = function () { + // 绐椾綋瀹藉害灏忓昂瀵革紙骞虫澘鍜宨phone妯″紡涓嬶級鏃剁Щ鍑哄乏杈规爮 + var viewport = _getViewPort(); + if (viewport.width < openoFrameWork_smallView) { + $('body').removeClass("page-sidebar-closed"); + }else{ + if (getCookie('sidebar_closed') === '1') { + $('body').addClass('page-sidebar-closed'); + } + } + } + // openoFrameWork.addResponsiveHandler()鍥炶皟鍑芥暟. + var runResponsiveHandlers = function () { + //閲嶆柊鍒濆鍖栧叾浠栬闃呯殑鍏冪礌elements + for (var i = 0; i < responsiveHandlers.length; i++) { + var each = responsiveHandlers[i]; + each.call(); + } + } + // 绐椾綋閲嶆柊璋冩暣澶у皬鏃跺垵濮嬪寲璋冩暣杈规爮鐘舵侀珮搴 + var dealResponsive = function () { + dealSidebarState(); + ajustHorMenuDropDirection(); + dealSidebarAndContentHeight(); + dealFixedSidebar(); + runResponsiveHandlers(); + } + // 椤甸潰閲嶈浇鍏ユ椂鍒濆鍖栬皟鏁村唴閮ㄥ竷灞 + var dealResponsiveOnInit = function () { + dealSidebarState(); + dealSidebarAndContentHeight(); + setTimeout(function () { + ajustHorMenuDropDirection(true); + }, 100); + } + // 绐椾綋閲嶆柊璋冩暣澶у皬鏃跺垵濮嬪寲璋冩暣甯冨眬 + var dealResponsiveOnResize = function () { + var resize; + if (isIE8) { + var currheight; + $(window).resize(function () { + if (currheight == document.documentElement.clientHeight) { + return; + } + if (resize) { + clearTimeout(resize); + } + resize = setTimeout(function () { + dealResponsive(); + }, 50); + currheight = document.documentElement.clientHeight; + }); + } else { + $(window).resize(function () { + if (resize) { + clearTimeout(resize); + } + resize = setTimeout(function () { + dealResponsive(); + }, 50); + }); + } + } + var changeSiderBar = function(hideAllMenu){ + var siderbarpos = $(".nav-pos-direction", $(".zte-theme-panel")).val(); + var sidermenu = $("#page-sidebar-menu"); + var hormenu = $("#main_hormenu"); + var fhorMenu = $("#" + fMenuMegaDivId); + var fsiderMenu = $("#" + fMenuSiderDivId); + if(hideAllMenu){ + sidermenu.css('display','block');// 渚ц竟鏍忔樉绀 + hormenu.css("display", "none");//闅愯棌姘村钩鑿滃崟鏍 + fhorMenu.css('display','none'); + fsiderMenu.css('display','none'); + return; + } + + sidermenu.css('display','none'); + hormenu.css("display", "none"); + fhorMenu.css('display','block'); + fsiderMenu.css('display','block'); + //闄や簡toggle鎸夐挳涔嬪锛屾槸鍚﹁繕鏈夊叾浠栧効瀛愭槸瑕佹樉绀虹殑锛屽鏋滄病鏈夛紝閭d箞绔栬彍鍗曚笉鏄剧ず锛涘弽涔嬶紝鏄剧ず銆 + var lis = fsiderMenu.children(".sidebar-toggler-wrapper").siblings(); + if(lis.length > 0 && lis.css('display') != "none"){ + fsiderMenu.css('display','block'); + $("body").removeClass("page-full-width"); + if ($('body').hasClass("page-sidebar-closed")) { + $(".page-content").css("marginLeft", _sidebarCollapsedWidth); + } else { + $(".page-content").css("marginLeft", _sidebarWidth); + } + } + } + //鏍规嵁褰撳墠鑿滃崟鍦ㄥ睆骞曠殑浣嶇疆锛屽拰涓绾ц彍鍗曚笅浜岀骇鑿滃崟鐨勬帓鍒楋紝鏉ュ喅瀹氳彍鍗曟槸鍚戝乏灞曞紑杩樻槸鍚戝彸灞曞紑 + var ajustHorMenuDropDirection = function( isInit ){ + //鑾峰彇灞忓箷瀹藉害 + var bodyWidth = document.body.clientWidth; + //寰幆锛岃幏鍙栨瘡涓竴绾ц彍鍗曞湪灞忓箷涓殑浣嶇疆 + var levelOneAdropdowns = $('a.dropdown-toggle', '#main_hormenu' ); + //姣忎竴涓枃瀛梥pan鐨勫浘鏍囥佷粬鐖朵翰鐨刴argin\padding绛夊崰鐢ㄧ殑浣嶇疆 + var marginCount = 5 * 2 + 17.5 + 2 * 2 + 30 + 15 * 2 + 3; + for( var i = 0 ; i < levelOneAdropdowns.length ; i++ ){ + var a = $(levelOneAdropdowns[i]); + var leftOffset = a.offset().left; + //鑾峰彇浜岀骇鑿滃崟鐨勬暟閲 + var ul = a.parent().children('.dropdown-menu'); + var groupDivs = $('.zteDivWidth' , ul); + var widthOfDropDownMenu = 0; + for(var j = 0 ; j < groupDivs.length && groupDivs.length >0 ; j++ ){//寰幆鑾峰彇姣忎釜鍒嗙粍鐨勫搴 + var eachDiv = groupDivs[j]; + var maxLengthText = ""; + var maxLength = 0; + var spans = $('span' , eachDiv).each(function(){ + var innerText = this.innerText; + if( innerText.length > maxLength ){ + maxLength= innerText.length; + maxLengthText = innerText; + } + }); + widthOfDropDownMenu = widthOfDropDownMenu + getStringWidth(maxLengthText , 14) + marginCount; + } + //棰勪及姣忎釜缁勫崰瀹藉害150PX锛屽棰勮涓鐐 + if( widthOfDropDownMenu + leftOffset > bodyWidth ){ + console.log("ajust class dropdown-menu-right ,id = "+ a.attr("id") ); + ul.addClass('dropdown-menu-right'); + //var right = bodyWidth - (leftOffset + a.width() + 15); + //ul.attr('style' ,'right:' + right ); + }else{ + ul.removeClass('dropdown-menu-right'); + //ul.removeAttr('style'); + } + } + } + // 灞忓箷澶у皬鍙戠敓鍙樺寲鎴栬呯Щ鍔ㄨ澶囨棆杞睆骞曟椂澶勭悊鍝嶅簲寮忓竷灞. + var dealSidebarAndContentHeight = function (isToggler) { + var content = $('.page-content'); + var contentbody = $('.page-content-body'); + var sidebar = $('.page-sidebar'); + var body = $('body'); + var height; + var viewport = _getViewPort(); + var scrAvaHeight=Math.min(window.screen.availHeight,viewport.height)-5; + var footer=$('.footer'); + var pgbread=$('.page-breadcrumb'); + var pageableDiv=$('#pageableDiv'); + console.log("pageableDiv height:"+pageableDiv.outerHeight(true)); + var pheader=$('.header'); + var childPagetype=!!cachedIframesObject.items(_iframe)?cachedIframesObject.items(_iframe).childpageType:""; + if(childPagetype==="isc")//smartclient鐨勫瓙椤甸潰鍥哄畾楂樺害涓鸿鍙e彲鐢ㄥ唴瀹瑰尯楂樺害 + { + $('.sidebar-option', panel).val("fixed"); + } + dealShownav(); + var available_height =scrAvaHeight - ((!footer||footer.length<=0)?0:footer.outerHeight(true)) - pheader.outerHeight(true); + var _pageableDivHeight=(!pageableDiv||pageableDiv.length<=0||pageableDiv.is(":visible")==false)?0:pageableDiv.outerHeight(true); + var h= scrAvaHeight-pheader.outerHeight(true)-((!footer||footer.length<=0||footer.is(":visible")==false)?0:footer.outerHeight(true))-pgbread.outerHeight(true)-_pageableDivHeight-(contentbody.outerHeight(true)-contentbody.height()); + var miframe=_iframe==""?"page-mainIframe": _iframe; + var pagemyIframe=$('.page-content .page-content-body .'+miframe); //.page-mainIframe + if(pagemyIframe&&pagemyIframe.length>0){ + //澶勭悊iframe,涓嬮潰璁$畻涓棿iframe鐨勯珮搴 + var deviceAgent = navigator.userAgent.toLowerCase(); + if (deviceAgent.match(/(iphone|ipod|ipad)/)) { //||viewport.height<=480 + var w=viewport.width-content.offset().left-(pagemyIframe.offset().left-content.offset().left)*2;//瀹藉害=鎬诲搴-宸﹁竟鏍忓搴-鍐呭鍖哄唴杈硅窛銆傚乏鍙充袱涓 + pagemyIframe.width(w); + } + //瀵规闈㈠繀椤昏绠楅珮搴 + var tmp_style = sidebar.attr('style');// firefox涓嬫墽琛 sidebar.height()浼氭敼鍙榮tyle鏍峰紡锛岃繖閲岀紦瀛樹笅鎵ц鍓嶇殑style鏍峰紡锛屾墽琛屽畬鍚庨噸鏂拌祴缁欓〉闈㈠厓绱 + console.log("pym:parent iframe "+miframe+" sidebar.height:"+sidebar.height()+" h:"+h); + h=sidebar.height()>h?sidebar.height():h; + //IE涓嬶紝鎶奿frame鐨勯珮搴﹀啀鍑忔帀7锛屽洜涓篒E10鍙婁互涓嬬増鏈紝璁$畻鐨勯珮搴︿細姣擨E瀹為檯鏄剧ず鍖哄煙澶э紝瀵艰嚧鍑虹幇IE婊氬姩鏉° + /*h=h-ICTFRAME_CONST_IFRAME_HEIGHT_AJUST; + if(isIE){ + h=h-ICTFRAME_CONST_IFRAME_HEIGHT_AJUST_IE; + }*/ + sidebar.attr('style',tmp_style); + if (isDesktop) { + //pagemyIframe.attr("height",h); + if(cachedIframesObject.items(miframe).setMinHeight){ + var minHeight=Math.min(scrAvaHeight,h); + console.log("pym:parent iframe "+miframe+" window.screen.availHeight:"+scrAvaHeight+" viewport.height:"+viewport.height+" h:"+h+" minHeight:"+minHeight); + cachedIframesObject.items(miframe).setMinHeight(minHeight); + } + }else{ + //pagemyIframe.attr("height","100%");//鍘绘帀杩欓噷閿欒鐨勮缃,ipad涓婃祴璇曢珮搴︿笉姝g‘ + var _h=h; + try{ + _h=pagemyIframe.contents().height(); + }catch(e){} + h=_h>h?_h:h; + if(cachedIframesObject.items(miframe).setMinHeight){ + var minHeight=Math.min(scrAvaHeight,h); + console.log("pym:parent iframe "+miframe+" window.screen.availHeight:"+scrAvaHeight+" viewport.height:"+viewport.height+" h:"+h+" minHeight:"+minHeight); + cachedIframesObject.items(miframe).setMinHeight(minHeight); + } + } + } + + if (body.hasClass("page-footer-fixed") === true && body.hasClass("page-sidebar-fixed") === true) { + if (content.height() < available_height) { + //content.attr('style', 'min-height:' + available_height + 'px !important'); + dealAddStyle(content,'min-height',available_height + 'px',true); + } + } else{ + if (body.hasClass("page-footer-fixed") === true && body.hasClass("page-sidebar-fixed") === false) { + if (content.height() < available_height) { + //content.attr('style', 'min-height:' + available_height + 'px !important'); + dealAddStyle(content,'min-height',available_height + 'px',true); + } + } else { + if (body.hasClass('page-sidebar-fixed')) { + height = _calculateFixedSidebarViewportHeight(); + } else { + // firefox涓嬫墽琛 sidebar.height()浼氭敼鍙榮tyle鏍峰紡锛岃繖閲岀紦瀛樹笅鎵ц鍓嶇殑style鏍峰紡锛屾墽琛屽畬鍚庨噸鏂拌祴缁欓〉闈㈠厓绱 + var tmp_style = sidebar.attr('style'); + // height = sidebar.height() + 20; + sidebar.attr('style',tmp_style); + var headerHeight = pheader.outerHeight(true); + var footerHeight = (!footer||footer.length<=0)?0:footer.outerHeight(true); + if ($(window).width() > 1024 && (height + headerHeight + footerHeight) < scrAvaHeight) { + height = scrAvaHeight - headerHeight - footerHeight; + } + } + if (height <= content.height()) {//杩欓噷涓轰簡閬垮厤鍐呭鍖哄煙寰堝皬鐨勬椂鍊欏嚭鐜板唴瀹瑰尯鍩熸棤娉曞厖婊″睆骞,鎶妋in-height淇敼涓篽eight + //content.attr('style', 'min-height:' + height + 'px !important'); + dealAddStyle(content,'min-height',height + 'px',true); + } + } + } + // 灞忓箷灏忓昂瀵告椂浼氶殣钘忚竟鏍忥紝杩欐椂鑿滃崟鐢卞皬灞忓箷鍙充笂鍥炬爣鎺у埗锛屽綋灞忓箷鍙樺寲鍒板ぇ灏哄灞忓箷鏃讹紝 + // 闇瑕佹寜鍘熻彍鍗曞嚭鐜版柟寮忔仮澶嶈彍鍗曟樉绀恒 + var screenwidth = $(window).width(); + if(screenwidth >= openoFrameWork_smallView){ + changeSiderBar(); + if($(".page-sidebar-menu li").css('display') != "none"){ + if ($('body').hasClass("page-sidebar-closed") && $(".sidebar-toggler").hasClass("close-by-viewportChange")) { + if( !isToggler ){ + $(".sidebar-toggler")[1].click(); + } + $(".sidebar-toggler").removeClass("close-by-viewportChange"); + } + } + } + else { + changeSiderBar(true); + } + } + var showIframe=function(iframe){ + var resize,pagemainIframe; + if (cachedIframes.count()>0) { + for (var i in cachedIframes.hash()) { + cachedIframes.replace(i,0); + var pagemyIframe=$('.page-content .page-content-body .'+i); + if(pagemyIframe&&pagemyIframe.length>0){ + if(iframe==i){ + pagemyIframe.show(); + cachedIframes.replace(i,1); + } else{ + if("page-mainIframe"===i){//2015骞12鏈10鏃 wimax瑕佹眰椤甸潰鍒囨崲鍚庡垹闄ゆ病鏈夐厤缃甤acheNum鐨勭紦瀛橀〉闈 + pagemainIframe=i; + pagemyIframe.attr("src",""); + pagemyIframe.remove(); + }else{ + pagemyIframe.hide(); + } + cachedIframes.replace(i,0); + } + } + } + } + if(pagemainIframe){ + delete cachedIframes._hash[pagemainIframe]; + delete cachedIframesObject._hash[pagemainIframe]; + } + if (!cachedIframes.contains(iframe)) { + cachedIframes.add(iframe,1); + //澧炲姞鐨刬frame鍔犺浇瀹屾瘯鍚 鍋滄鍔犺浇涓彁绀轰俊鎭 + myIframe=$('.'+iframe); + myIframe.show(); + myIframe.load(function(){ + /*if (!isDesktop) { + if (resize) { + clearInterval(resize); + } + resize = setInterval(dealIframeHeight, 400,$(this)); + }*/ + openoFrameWork.stopPageLoading(); + }); + } + } + var hidemenu=function(){ + $('.hor-menu').hide(); + dealAddStyle($('.page-content'),'margin-left','0px',true); + dealAddStyle($('.page-sidebar'),'display','none',true); + var fsiderMenu = $("#" + fMenuSiderDivId); + fsiderMenu.children().css('display' , 'none'); + } + var hideAlarmLight=function(){ + //$('#header_notification_bar').hide(); + //$('#header_notification_bar').empty(); + $('#header_notification_bar').html("
          
    "); + } + var dealShownav=function(){ + var showNav=openoFrameWork.getLocationURLParameter('showNav'); + if( showNav=="false"){ + openoFrameWork_showNav = showNav; + hidemenu(); + hideAlarmLight(); + } + } + /* 鐐瑰嚮鑿滃崟鏃讹紝澶勭悊瀵瑰簲璇ヨ彍鍗曢」鐨勬í锛屽乏鑿滃崟椤 */ + var dealRelateMenu = function(source) { + // 鐐瑰嚮瀛愯彍鍗曟椂锛屽搴旂殑妯珫鑿滃崟椤逛篃鑱斿姩涓洪夋嫨鏍峰紡锛(楂樹寒,绠ご鍙樺寲) + var panel = $('.zte-theme-panel'); + var navPosOption = $('.nav-pos-direction', panel).val(); + var targetsource = null; + var targetContainer = null; + if (navPosOption === "vertical") { + // 褰撳墠鏄乏鑿滃崟锛屽垯澶勭悊瀵瑰簲鐨勬í鑿滃崟 + targetsource = $("#"+source.attr("id"), $("#main_hormenu")); + targetContainer = $(".header ul"); + } else if (navPosOption === "horizontal") { + var rtn = dealMgaBarRelated(source); + dealFMenuRelated(source , megaSiderDivId); + targetContainer = rtn[0]; + targetsource = rtn[1]; + }else if(navPosOption === openoFrameWork_menu_fmenu){ + dealFMenuRelated(source , fMenuSiderDivId); + } + if (targetContainer) { + // 绉婚櫎鍘熸湁鑿滃崟椤圭殑娲诲姩鍙婄澶存牱寮 + targetContainer.children('li.active').removeClass('active'); + targetContainer.find('.arrow.open').removeClass('open'); + } + if (targetsource) { + // 澧炲姞娲诲姩鍙婄澶存牱寮 + targetsource.parents('li').each(function () { + $(this).addClass('iframe active'); + $(this).find('a > span.arrow').addClass('open'); + }); + targetsource.parents('li').addClass('active'); + if (navPosOption === "horizontal") { + if (targetsource.parent().parent().parent().is("li")) { + $('.arrow', targetsource.parent().parent().parent()).addClass("open"); + } + } + } + } + var dealMgaBarRelated = function(source){ + // 褰撳墠鏄í鑿滃崟锛屽垯澶勭悊瀵瑰簲鐨勫乏鑿滃崟 + targetsource = $("#"+source.attr("id"), $("[class='page-sidebar-menu']")); + targetContainer = $("#page-sidebar-menu ul"); + // 灏嗗厛鍓嶅乏鑿滃崟灞曞紑鐨勫瓙鑿滃崟鏀剁缉 + $("li.open",targetContainer).each(function() { + var style = $("ul.sub-menu", this).attr("style"); + if (style) { + $("ul.sub-menu", this).removeAttr("style"); + $(this).removeClass('open'); + } + }); + // 褰撳墠鏄í鑿滃崟锛屼絾鍦ㄥ睆骞曠缉灏忕殑鎯呭喌涓嬫樉绀虹殑鏄痶ip鍨傜洿鑿滃崟锛岃屾í鑿滃崟鏄殣钘忕殑锛屾墍浠ラ渶棰濆澶勭悊妯彍鍗 + if (source.parent().parent().parent().parent().attr("class").indexOf("page-sidebar-menu") >= 0) { + var tiptargetsource = $("#"+source.attr("id"), $("#main_hormenu")); + var tiptargetContainer = $(".header ul"); + tiptargetContainer.children('li.active').removeClass('active'); + tiptargetContainer.find('.arrow.open').removeClass('open'); + tiptargetsource.parents('li').each(function () { + $(this).addClass('iframe active'); + $(this).find('a > span.arrow').addClass('open'); + }); + tiptargetsource.parents('li').addClass('active'); + } + return [targetContainer ,targetsource ]; + } + var dealFMenuRelated = function(source , siderDivId ){ + var fsiderMenu = $("#" + siderDivId); + if(isMoreMenuItemClick){//鏇村鑿滃崟鐐瑰嚮 , 涓存椂鏂规锛屽鍔犱俊鍙烽噺锛屼娇鐢ㄤ箣鍚庡氨缃负false + isMoreMenuItemClick = false + }else if($(source).parents('li').hasClass('mega-menu-dropdown')){//F鐨勬í鍚戣彍鍗曠殑鐐瑰嚮 + var id = source.attr('id'); + //闈炶鐐瑰嚮鐨勪竴绾ц彍鍗曠殑浜岀骇鑿滃崟閮戒笉鏄剧ず + $('#' + siderDivId + '>li').hide(); + var level2Lis = $("a[hparentid= " + id + "]" , fsiderMenu).parent(); + level2Lis.show(); + if(level2Lis.length > 0){//鎶婄珫鍚戣彍鍗曠殑鏀惰捣鏀惧ぇ鎸夐挳鏄剧ず鍑烘潵 + $('#' + siderDivId + '>li.sidebar-toggler-wrapper').show(); + } + if($("a[hparentid= " + id + "]" , fsiderMenu).length > 0){ //鏈夊瓙瀛欒彍鍗曟椂锛屾妸F鑿滃崟鐨勭珫鑿滃崟鏄剧ず鍑烘潵 + dealFSidermenu(source ,siderDivId ); + }else{//鍚﹀垯闅愯棌绔栬彍鍗 + fsiderMenu.css('display','none'); + $("body").addClass("page-full-width"); + $(".page-content").css("marginLeft", _sidebarWidth); + } + + }else{//F鑿滃崟鐨勭珫鍚戣彍鍗曠偣鍑 + //澶勭悊涓绉嶇壒娈婃儏鍐碉紝鍛婅鐏墦寮鏂伴〉闈紝鎵鏈夌殑鑿滃崟閮戒笉鍑虹幇锛屽洜姝わ紝铏界劧杩欎釜source鍦ㄧ珫鑿滃崟锛屼絾绔栬彍鍗曡繖涓椂鍊欏疄闄呬笂鏄病鏈夋樉绀虹殑 + if( openoFrameWork_showNav == "true") { + $('#' + siderDivId + '>li').hide(); + var lis = $(source).parents('li'); + var id = lis.eq(lis.length-1).children( 'a' ).attr('hparentid'); + //var id = $(source).parents('li').children('a').attr('hparentId'); + var level2Lis = $("a[hparentid=" + id + "]" , fsiderMenu).parent(); + level2Lis.show(); + if(level2Lis.length > 0) {//鎶婄珫鍚戣彍鍗曠殑鏀惰捣鏀惧ぇ鎸夐挳鏄剧ず鍑烘潵 + $('#'+ siderDivId + '>li.sidebar-toggler-wrapper').show(); + } + //$('#' + siderDivId + '>li')[0].show(); + dealFSidermenu(source , siderDivId); + } + } + } + var dealFSidermenu = function(source , siderDivId){ + var fsiderMenu = $("#" + siderDivId); + fsiderMenu.css('display','block'); + $('ul.sub-menu',fsiderMenu).css('display','block'); + $('.arrow',fsiderMenu).addClass('open'); + $("body").removeClass("page-full-width"); + if ($('body').hasClass("page-sidebar-closed")) { + $(".page-content").css("marginLeft", _sidebarCollapsedWidth); + } else { + $(".page-content").css("marginLeft", _sidebarWidth); + } + var href = source.attr("href"); + $('li.iframe' ,fsiderMenu ).removeClass('active'); + var selectedIframeLi = $("a[href ='" + href + "']" ,fsiderMenu ).parent(); + selectedIframeLi.addClass('active'); + selectedIframeLi.parent().parent().addClass("open").addClass("active"); + selectedIframeLi.parent().css('display','block'); + selectedIframeLi.parent().parent().children('a').children('.arrow').addClass('open'); + } + var dealMenuItemClick=function(source,e,menuContainerStr){ + var url = source.attr("href"); + if(!url||url.length<2) + return; + e.preventDefault(); + if(!_isClicked){//瀵艰埅鎯呭喌涓,棣栧厛瑕佹ā鎷熺偣寮鑿滃崟鍒嗙粍 + _isClicked=true;//濡傛灉鑿滃崟鏈夊瓙鑿滃崟鐐瑰嚮涓娆℃潵灞曞紑瀛愯彍鍗曪紝娉ㄦ剰杩欎釜淇″彿閲忕殑鍙樺寲锛岄伩鍏嶆寰幆 + var mainMenu=source.parents('li').last(); + if(!mainMenu.hasClass('open')){ + dealLiAClick(mainMenu.children('a:eq(0)')); + } + } + if(menuContainerStr&&menuContainerStr.length>0){ + var menuContainer = $('.'+menuContainerStr+' ul'); + + menuContainer.children('li.active').removeClass('active'); + // menuContainer.children('arrow.open').removeClass('open'); + //menuContainer.find('.arrow.open').addClass('open'); + } + source.parents('li').each(function () { + $(this).addClass('iframe active'); + $(this).children('a > span.arrow').addClass('open'); + }); + source.parents('li').addClass('active'); + // 澶勭悊鐐瑰嚮鑿滃崟瀵瑰簲鐨勬í鎴栧乏鑿滃崟椤圭殑閫夋嫨鏍峰紡 + dealRelateMenu(source); + if(menuContainerStr&&menuContainerStr.length>0){ + if ($(window).width() <= 991 && $('.'+menuContainerStr).hasClass("in")) { + $('.navbar-toggle').click(); + } + } + if(dealMultTabPage(source)) + return true; + dealScrollTo(); + var breadmenuID=e.data&&e.data.breadcrumbBtnMenuItem&&e.data.breadcrumbBtnMenuItem.length>0?e.data.breadcrumbBtnMenuItem:""; + if(breadmenuID.length>0){//闈㈠寘鍓婂鑸潵鐨勶紝鍙渶瑕侀噸鏂扮敓鎴愰潰鍖呭墛鍗冲彲 + //鎵惧埌鏇村鑿滃崟鎸夐挳 + var moreMenuItem = $('#' + breadmenuID , $('#pageableDiv')); + if( moreMenuItem.length == 0 ){ + moreMenuItem = $('#' + breadmenuID , $('.more-botton-zone')); + } + dealBreadcrumbBtnMenuItemClick(moreMenuItem,e); + //dealBreadcrumb(source,false,e); + }else{//闈為潰鍖呭墛瀵艰埅鏉ョ殑锛 + dealstartPageLoading(); + if(dealIframe(source,e))//褰撹繑鍥瀟rue鏃惰鏄庢槸姝e父鍔犺浇iframe浜嗭紝鍚﹀垯闈㈠寘鍓婁笉鑳藉垏鎹 + dealBreadcrumb(source,false,e); + } + //dealShownav(); + }; + var dealMenuItemGetFocus=function(source,e,menuContainerStr){ + var url = source.attr("href"); + if(!url||url.length<2) + return; + e.preventDefault(); + if(!_isClicked){//瀵艰埅鎯呭喌涓,棣栧厛瑕佹ā鎷熺偣寮鑿滃崟鍒嗙粍 + _isClicked=true;//濡傛灉鑿滃崟鏈夊瓙鑿滃崟鐐瑰嚮涓娆℃潵灞曞紑瀛愯彍鍗曪紝娉ㄦ剰杩欎釜淇″彿閲忕殑鍙樺寲锛岄伩鍏嶆寰幆 + var mainMenu=source.parents('li').last(); + dealLiAClick(mainMenu.children('a:eq(0)')); + } + if(menuContainerStr&&menuContainerStr.length>0){ + var menuContainer = $('.'+menuContainerStr+' ul'); + + menuContainer.children('li.active').removeClass('active'); + menuContainer.children('arrow.open').removeClass('open'); + } + source.parents('li').each(function () { + $(this).addClass('iframe active'); + $(this).children('a > span.arrow').addClass('open'); + }); + source.parents('li').addClass('active'); + + if(menuContainerStr&&menuContainerStr.length>0){ + if ($(window).width() <= 991 && $('.'+menuContainerStr).hasClass("in")) { + $('.navbar-toggle').click(); + } + } + }; + //澶勭悊iframe鐨勬牳蹇冨鐞嗙被锛岄昏緫杈冧负澶嶆潅锛屾敞鎰忓悇绉嶅弬鏁扮殑澶勭悊 + var dealIframe=function(aObject,e){ + _hashSource=""; + var url = aObject.attr("href"); + if(!url||url.length<2) + return; + url=openoFrameWork.handlBaseURL(url); + //-----------2015骞9鏈21鏃ユ柊澧濾5涓ぇO闇瑕佺殑鎸夌収瀹炰緥锛堟牴鎹夋嫨鐨勭郴缁熷疄渚嬪彉鍖杣rl鐨刬p鍜岀鍙e湴鍧锛夎繘琛屽姩鎬佸垏鎹㈣彍鍗曠殑鍔熻兘 + var category= aObject.attr("category");//澶勭悊鑿滃崟涓畾涔夌殑Category灞炴 + if(category&&category.length>0){//澶勭悊Category灞炴 + var newIpPort=_menuCategorys.items(category); + if(newIpPort&&newIpPort.ipPort&&newIpPort.ipPort.trim()!=""){//濡傛灉鎵惧埌浜 + var newIpPortstr=openoFrameWork.getDomainURL(newIpPort.ipPort);//鍘绘帀ip鍜宲ort鍚庡浣欑殑閮ㄥ垎 + var urlipport=openoFrameWork.getDomainURL(url); + console.log("old url:"+url); + url=newIpPortstr+url.replace(urlipport,""); + console.log("newIpPort:"+newIpPortstr+" newURL:"+url); + } + } + //------------ + dealstartPageLoading(); + var cacheNum= aObject.attr("cacheNum");//褰撶涓夋柟搴旂敤闇瑕佹鏋剁紦瀛樻浘缁忔墦寮杩囩殑椤甸潰鏃朵娇鐢ㄣ + var shiftJS= aObject.attr("shiftJS");//褰撶涓夋柟搴旂敤涓嶉渶瑕佸悗闈㈢殑href椤甸潰杩涜閲嶆柊鍔犺浇浠呬粎鎵ц鏌愪釜鑴氭湰鎵撳紑鏌愪釜鍔熻兘鏃朵娇鐢 + var _iframeName= aObject.attr("iframeName");//瀵规湁浜涚涓夋柟搴旂敤璁剧疆浜嗛《灞俧rame鍚嶅瓧鐨勶紝杩欎釜蹇呴』璁剧疆 + var _iframeAutoScroll= aObject.attr("iframeAutoScroll");//璁剧疆iframe鐨勬粴鍔ㄦ潯鏄惁鍑虹幇,鍙互璁剧疆涓篴uto,yes鎴栬卬o,榛樿涓簄o 涓嶅嚭鐜. + _iframeAutoScroll=!!_iframeAutoScroll?(_iframeAutoScroll==='yes'?'yes':_iframeAutoScroll==='auto'?'auto':'no'):'no'; + _xdomain= aObject.attr("xdomain");//瀵规湁浜涚涓夋柟搴旂敤濡傛灉璺ㄥ煙浜,闇瑕佽缃繖涓俊浠诲煙灞炴,浠ヤ究浜庢潵璺ㄥ煙閫氳.杩欓噷鍙栧兼槸涓涓鍒欒〃杈惧紡 + _xdomain=_xdomain&&_xdomain.length>0?_xdomain:"*"; + var _cssfile= aObject.attr("cssSrc");//璁剧疆iframe涓〉闈㈤渶瑕佸姩鎬佸姞杞界殑css鏂囦欢. + _cssfile=(_cssfile&&_cssfile.length>0)?_cssfile:""; + var _runShiftJS=""; + var pageContentBody=$('.page-content .page-content-body'); + var tabHtml=""; + var tabContentHtml=""; + var tabID=""; + var tabContentID=""; + var iframename=''; + function createIframe(pdiv,url,id,name,clsname,xdom,autoScroll){ + var pymParent = new pym.Parent(pdiv, url, {xdomain:xdom}); + pymParent.iframe.id=id; + pymParent.iframe.name=name; + //pymParent.iframe.setAttribute('display', "none"); + //pymParent.iframe.style.height="100%"; + //pymParent.iframe.setAttribute('height', "100%"); + pymParent.iframe.setAttribute('class', clsname); + pymParent.iframe.setAttribute('allowfullscreen',''); + pymParent.iframe.setAttribute('mozallowfullscreen',''); + pymParent.iframe.setAttribute('oallowfullscreen',''); + pymParent.iframe.setAttribute('msallowfullscreen',''); + pymParent.iframe.setAttribute('webkitallowfullscreen',''); + //pymParent.iframe.setAttribute('scrolling',autoScroll); + pymParent.iframe.setAttribute('onload', 'openoFrameWork.SyncCSS(this,0,"'+_cssfile+'");openoFrameWork.stopPageLoading();'); + cachedIframesObject.replace(id,pymParent);//缂撳瓨iframe瀵硅薄瀹炰綋 + pymParent.onMessage('height', function(he){ + console.log("The frame "+id+" receive message height is "+he); + var pagemyIframe=$('.page-content .page-content-body .'+id); + var h=Math.max(this.minHeight,he); + pagemyIframe.height(h); + }); + return pymParent; + }; + + if(cacheNum){//澶勭悊缂撳瓨iframe鍜宨framename鏍囩 + cacheNum="page-mainIframe"+cacheNum; + iframename="fraMain"+cacheNum; + }else{ + cacheNum="page-mainIframe"; + iframename="fraMain"; + } + iframename=!!_iframeName?_iframeName:iframename; + _iframe= cacheNum;//娉ㄦ剰杩欓噷_iframe鏄竴涓叏灞鍙橀噺 + + var miframe=_iframe==""?"page-mainIframe": _iframe; + var pagemyIframe=$('.page-content .page-content-body .'+miframe); + var nagivJS=e&&e.data&&e.data.action?e.data.action:""; + nagivJS=(!!nagivJS&&nagivJS.length>0)?(nagivJS.trim().toLowerCase()=="null"?nagivJS:"javascript:$('.page-content .page-content-body ."+miframe+"')[0].contentWindow."+nagivJS.trim()+";"):""; + nagivJS=nagivJS.trim(); + + _runShiftJS=(!!shiftJS&&shiftJS.length>0)?(shiftJS.trim().toLowerCase()=="null"?shiftJS:"javascript:$('.page-content .page-content-body ."+miframe+"')[0].contentWindow."+shiftJS+";"):""; + if(pagemyIframe&&pagemyIframe.length>0){//濡傛灉iframe宸茬粡娣诲姞浜嗭紝鍒欑洿鎺ユ洿鏀箄rl鎴栬呮墽琛屽垏鎹㈡垨瀵艰埅鍑芥暟 + var src=pagemyIframe.attr("src"); + if((!!shiftJS||nagivJS.length>0)&&(src==url||src.split('?')[0]==url.split('?')[0])&& cacheNum!="page-mainIframe") { //url鐩稿悓鏃,澶勭悊缂撳瓨shiftJS鏍囩 + //杩欓噷shiftJS蹇呴』瀹氫箟iframe涓殑椤甸潰瀹氫箟鍒皐indow涓婄殑鍑芥暟锛 + //pagemyIframe.attr("scrolling",_iframeAutoScroll); + cachedIframesObject.items(miframe).settings.xdomain=_xdomain; + if(nagivJS.length>0&&nagivJS.toLowerCase()!="null") + _runShiftJS=nagivJS;//濡傛灉鏄痭agivJS瀵艰埅杩囨潵鐨勶紝nagivJS浼樺厛绾ч珮浜巗hiftJS锛屽鏋滄湁nagivJS灏辩敤nagivJS鏇挎崲_runShiftJS锛 鐩存帴鎵ц涓娆″鑸垏鎹 + try{ + if(_runShiftJS.trim().toLowerCase()!="null") + eval(_runShiftJS); + }catch(e){ + if (e instanceof EvalError) { + console.log(e.name + " EvalError: " + e.message); + } else if (e instanceof SyntaxError) { + console.log(e.name + " SyntaxError: " + e.message); + }else if (e instanceof Error) { + if(e.name.toLowerCase().trim()=="typeerror") + { + //console.log($.i18n.prop('com_zte_ums_ict_framework_ui_clickTooFast')); + var parm={runShiftJS:_runShiftJS}; + pagemyIframe.one('load',parm,function(e){ + var runShiftJS=e&&e.data&&e.data.runShiftJS?e.data.runShiftJS:""; + if(runShiftJS.length>0&&runShiftJS.toLowerCase()!="null") + eval(runShiftJS);//鐐瑰嚮澶揩浜嗭紝椤甸潰娌℃湁鍔犺浇瀹屾瘯锛岄偅灏卞姞杞藉畬姣曚簡鍐嶆鎵ц + }) + } + } + return false;//杩斿洖false 鍚庣画涓嶅啀鍋氬叾浠栧姩浣滀簡 + } + finally{ + openoFrameWork.stopPageLoading(); + } + }else{//鍚﹀垯url涓嶅悓,鎴栬卽rl鐩稿悓浣嗘病鏈塻hiftjs + if(nagivJS.length>0&&nagivJS.toLowerCase()!="null"){//濡傛灉鏄唬鐮佸鑸繃鏉ョ殑鍘绘帀url鍙傛暟涓殑榛樿action鍔ㄤ綔 + url=url.split('?')[0];//鍘绘帀锛熷弬鏁帮紝闃叉榛樿鎵ц鍔ㄤ綔锛屽彧鍝嶅簲nagivJS鎸囧畾鐨勫姩浣滐紱 + } + if(src.split('#')[0]!=url.split('#')[0])//濡傛灉鐩哥瓑璇存槑鏄氳繃閿氱偣瀵艰埅鐨勶紝鐪熷疄url娌℃湁鍙樺寲锛屽SPA搴旂敤姣旇緝鏅亶 + { + pagemyIframe.attr("src","");//url鍜宻rc涓嶅悓璇存槑鏇存崲浜嗛〉闈紝闇瑕佹竻绌洪噸鏂板姞杞 + }else //if (src.trim()==url.trim()) //娌℃湁shiftjs骞朵笖url鐩稿悓锛岃鏄庝笉闇瑕佸啀娆″姞杞戒簡,宸茬粡鍔犺浇杩囦簡 + { + openoFrameWork.stopPageLoading(); + } + pagemyIframe.attr("src",url); + + if(nagivJS.length>0&&nagivJS.toLowerCase()!="null"){//濡傛灉鏄痭agivJS瀵艰埅杩囨潵鐨勶紝iframe鍔犺浇瀹屾瘯鍚庢墽琛屼竴娆″鑸垏鎹㈣剼鏈 + var parm={nagivJS:nagivJS}; + pagemyIframe.one('load',parm,function(e){ + var nagivJS=e&&e.data&&e.data.nagivJS?e.data.nagivJS:""; + if(nagivJS.length>0&&nagivJS.toLowerCase()!="null") + eval(nagivJS);//濡傛灉娌℃湁鍔犺浇杩囷紝鍔犺浇鍚庝篃瑕佹墽琛岃烦杞殑鍑芥暟 + }); + } + if(_cssfile.length>0&&_cssfile.toLowerCase()!="null"){//濡傛灉閰嶇疆浜哻ssSrc锛屾瘡娆″垏鎹㈤兘閲嶆柊鎵ц涓杈硅繖涓猚ss鏂囦欢锛岄槻姝㈡湁閬楁紡 + parm={syncCSSJS:'openoFrameWork.SyncCSS(this,10,"'+_cssfile+'");openoFrameWork.stopPageLoading();'}; + pagemyIframe.one('load',parm,function(e){ + var syncCSSJS=e&&e.data&&e.data.syncCSSJS?e.data.syncCSSJS:""; + if(syncCSSJS.length>0&&syncCSSJS.toLowerCase()!="null") + eval(syncCSSJS); + }); + } + } + + }else{//鍚﹀垯娣诲姞鏂扮殑iframe鍏冪礌 overflow:visible; + if(nagivJS.length>0&&nagivJS.toLowerCase()!="null"){//濡傛灉鏄唬鐮佸鑸繃鏉ョ殑鍘绘帀url鍙傛暟涓殑榛樿action鍔ㄤ綔 + url=url.split('?')[0];//鍘绘帀锛熷弬鏁帮紝闃叉榛樿鎵ц鍔ㄤ綔锛屽彧鍝嶅簲nagivJS鎸囧畾鐨勫姩浣滐紱 + } + var pdiv="pdiv_"+miframe; + if($("#"+pdiv).length<=0){//妫鏌ヤ笅锛屽鏋滆div娌℃湁娣诲姞杩囧氨娣诲姞 + pageContentBody.append("
    "); + } + dealstartPageLoading(); + pymParent=createIframe(pdiv, url,miframe,miframe,miframe,_xdomain,_iframeAutoScroll); + pagemyIframe=$(pymParent.iframe); + + if(nagivJS.length>0&&nagivJS.toLowerCase()!="null"){//濡傛灉鏄痭agivJS瀵艰埅杩囨潵鐨勶紝iframe鍔犺浇瀹屾瘯鍚庢墽琛屼竴娆″鑸垏鎹 + var parm={nagivJS:nagivJS}; + pagemyIframe=$('.page-content .page-content-body .'+miframe); + if(pagemyIframe&&pagemyIframe.length>0){ + pagemyIframe.one('load',parm,function(e){ + var nagivJS=e&&e.data&&e.data.nagivJS?e.data.nagivJS:""; + if(nagivJS.length>0&&nagivJS.toLowerCase()!="null") + eval(nagivJS);//濡傛灉娌℃湁鍔犺浇杩囷紝鍔犺浇鍚庝篃瑕佹墽琛岃烦杞殑鍑芥暟 + }) + } + } + + } + showIframe(miframe); + openoFrameWork.fixContentHeight(); // 璋冩暣楂樺害 + return true; + } + // 澶勭悊杈规爮鑿滃崟 + var dealLiAClick=function(source){ + if (source.next().hasClass('sub-menu') == false) { + if ($('.btn-navbar').hasClass('collapsed') == false) { + $('.btn-navbar').click(); + } + return; + } + + if (source.next().hasClass('sub-menu always-open')) { + return; + } + var parent = source.parent().parent(); + var the = source; + var menu = $('.page-sidebar-menu'); + var sub = source.next(); + var autoScroll = menu.data("auto-scroll") ? menu.data("auto-scroll") : true; + var slideSpeed = menu.data("slide-speed") ? parseInt(menu.data("slide-speed")) : 200; + parent.children('li.open').children('a').children('.arrow').removeClass('open'); + parent.children('li.open').children('.sub-menu:not(.always-open)').slideUp(200); + parent.children('li.open').removeClass('open'); + var slideOffeset = -200; + if (sub.is(":visible")) { + $('.arrow', source).removeClass("open"); + source.parent().removeClass("open"); + sub.slideUp(slideSpeed, function () { + if (autoScroll == true && $('body').hasClass('page-sidebar-closed') == false) { + if ($('body').hasClass('page-sidebar-fixed')) { + + } else { + dealScrollTo(the, slideOffeset); + } + } + dealSidebarAndContentHeight(); + }); + } else { + $('.arrow', source).addClass("open"); + source.parent().addClass("open"); + sub.slideDown(slideSpeed, function () { + if (autoScroll == true && $('body').hasClass('page-sidebar-closed') == false) { + if ($('body').hasClass('page-sidebar-fixed')) { + dealScrollTo(the, slideOffeset); + } + } + dealSidebarAndContentHeight(); + }); + } + } + var dealSidebarMenu = function () {//杩欓噷娉ㄥ唽鍜屽鐞嗚竟鏍忚彍鍗曠殑鍚勭被鐐瑰嚮浜嬩欢 + $('.page-sidebar').on('click', 'li > a', function (e) { + if ($(this).next().hasClass('sub-menu') == false) { + if ($('.btn-navbar').hasClass('collapsed') == false) { + $('.btn-navbar').click(); + } + return; + } + if ($(this).next().hasClass('sub-menu always-open')) { + return; + } + dealLiAClick($(this)); + e.preventDefault(); + }); + + // 澶勭悊宸﹁竟瀵艰埅涓殑鑿滃崟杩炴帴锛屾樉绀哄湪iframe涓 + $('.page-sidebar').on('click', ' li > a.iframe', function (e) { + //dealMenuItemClick($(this),e,"page-sidebar") + e.preventDefault(); + var menuItemID=$(this).attr("id"); + if(!!menuItemID&&menuItemID.length>0){ + _setLocationHash(menuItemID); + _hashSource="dhByInterface"; + }//else{ + _isClicked=true; + dealMenuItemClick($(this),e,"page-sidebar"); + //} + }); + // 澶勭悊鏇村鑿滃崟鐨勮彍鍗曡繛鎺ワ紝鏄剧ず鍦╥frame涓璬ropdown-menu + $('.page-breadcrumb').on('click', ' li > a.iframe', function (e) { + var url = $(this).attr("href"); + if(url.length<2) + return; + e.preventDefault(); + dealBreadcrumbBtnMenuItemClick($(this),e); + }); + // 澶勭悊鍙炕椤垫洿澶氳彍鍗曚腑鐨勮彍鍗曡繛鎺ワ紝鏄剧ず鍦╥frame涓璬ropdown-menu + $('#pageableDiv').on('click', ' div > a.iframe', function (e) { + var url = $(this).attr("href"); + if(url.length<2) + return; + e.preventDefault(); + dealBreadcrumbBtnMenuItemClick($(this),e); + }); + // 澶勭悊鍙炕椤垫洿澶氳彍鍗曚腑鐨勮彍鍗曡繛鎺ワ紝鏄剧ず鍦╥frame涓璬ropdown-menu + $('#pageableDiv').on('click', ' li > a.iframe', function (e) { + var url = $(this).attr("href"); + if(url.length<2) + return; + e.preventDefault(); + if(e.target){ + var tg=$("span",e.target); + tg=tg.length>0?tg[0]:e.target; + $(".open a>div>span",e.target.parentNode.parentNode.parentNode.parentNode.parentNode).replaceWith(tg.outerHTML); + } + dealBreadcrumbBtnMenuItemClick($(this),e); + }); + + // 澶勭悊header涓嬫媺鑿滃崟涓殑鑿滃崟杩炴帴锛屾樉绀哄湪iframe涓 + $('.dropdown').on('click', ' li > a.iframe', function (e) { + var url = $(this).attr("href"); + if(url.length<2) + return; + e.preventDefault(); + dealScrollTo(); + dealstartPageLoading(); + + dealIframe($(this),e) + dealBreadcrumb($(this),false,e); + }); + } + var getSceneURL=function(url){ + if(url&&url.trim().length>0){ + url=url.trim(); + //url= + _sceneURLRootPath=_sceneURLRootPath+url; + } + } + var gurl="";//涓存椂鍏ㄥ眬鍙橀噺锛屽瓨鍌ㄥ綋鍓嶅姞杞界殑more鑿滃崟锛屽鏋滃姞杞借繃浜嗭紝灏变笉鍐嶅姞杞戒簡銆備笅闈㈢殑鏂规硶涓細鐢ㄥ埌 + var moreMenusisLoaded=true; + var waittime=null; + var getBreadcrumbRightButtons=function(url,e){ + if (url.length<2){ + return; + } + url=openoFrameWork.handlBaseURL(url); + if (gurl==url){ + if(e===true){ + $('#pageableDiv').show(); + }else if(e&&e.target&&e.currentTarget){ + var defaultDisplay=$(e.target).attr("defaultDisplay"); + defaultDisplay=(!defaultDisplay)?$(e.currentTarget).attr("defaultDisplay"):defaultDisplay; + if(defaultDisplay&&defaultDisplay.trim()=="false"){ + $('#pageableDiv').hide(); + }else{ + $('#pageableDiv').show(); + } + } + return; + + }else{ + gurl=url; + clearMoreOperations(); + } + //澶勭悊e鍙傛暟锛屾敞鎰廵鍙兘涓簄ull + var breadmenuID=e&&e.data&&e.data.breadcrumbBtnMenuItem&&e.data.breadcrumbBtnMenuItem.length>0?e.data.breadcrumbBtnMenuItem:""; + breadmenuID=breadmenuID.length<=0?(e&&e.breadcrumbBtnMenuItem&&e.breadcrumbBtnMenuItem.length>0?e.breadcrumbBtnMenuItem:""):breadmenuID; + moreMenusisLoaded=false; + $.ajax({ + type: "GET", + cache: false, + url: url, + dataType: "html", + success: function (res) { + try{ + //$('.page-breadcrumb').append(res); + var resScriptsSriped = stripHtmlScripts(res); + //$('.page-breadcrumb').append(resScriptsSriped); + $('.more-botton-zone').children().remove(); + //V5鏂板閫昏緫锛屽鏋渄isplayType = pageableDiv,閭d箞灏辩敤婊戝姩鐨凞IV鏉ユ樉绀烘洿澶氳彍鍗曢噷闈㈢殑鍐呭锛屽鏋滄病鏈夐厤缃紝鎴栦负鍏朵粬鍊硷紝灏辨寜鍘熸湁鏂瑰紡鏄剧ず + var tempDiv = $('
    '); + tempDiv.children().remove(); + tempDiv.append(resScriptsSriped); + + //鑾峰彇UL灞炴 + var displayType = $('.dropdown-menu',tempDiv).attr('displayType'); + if( displayType && displayType != 'pageableDiv'){ + $('.more-botton-zone').append(resScriptsSriped); + $('#pageableDiv').hide(); + }else{ + var tempUl = $('.dropdown-menu',tempDiv); + if(tempUl.length>0){ + moreOperations(tempUl[0]); + if(e&&e.target&&e.currentTarget){ + var defaultDisplay=$(e.target).attr("defaultDisplay"); + defaultDisplay=(!defaultDisplay)?$(e.currentTarget).attr("defaultDisplay"):defaultDisplay; + if(defaultDisplay&&defaultDisplay.trim()=="false"){ + $('#pageableDiv').hide(); + }else{ + $('#pageableDiv').show(); + } + } + } + } + runHtmlScripts(res); + }catch(ex){ + }finally{ + moreMenusisLoaded=true; + } + groupButtonAuthentication(); + if(breadmenuID.length>0){//闈㈠寘鍓婂鑸潵鐨勶紝鍙渶瑕侀噸鏂扮敓鎴愰潰鍖呭墛鍗冲彲 + var menuitem=undefined; + var panel = $('.zte-theme-panel'); + var navPosOption = $('.nav-pos-direction', panel).val(); + //var items=$("a[id='"+breadmenuID+"']"); + var items = undefined; + if (navPosOption === "vertical"){ //浠庡瀭鐩磋彍鍗曢噷闈㈡壘 + items=$("#page-sidebar-menu a[id='"+breadmenuID+"']"); + + }else{//浠庢按骞宠彍鍗曢噷闈㈡壘 + items=$(".hor-menu a[id='"+breadmenuID+"']"); + } + if (!items || items.length < 1) { + items=$(".page-content a[id='"+breadmenuID+"']"); + } + if(items.length>0){ + for(var i=0;i0) + dealBreadcrumbBtnMenuItemClick(menuitem,e); + } + }, + error: function (xhr, ajaxOptions, thrownError) {//鍔犺浇鎿嶄綔鑿滃崟澶辫触!com_zte_ums_ict_framework_ui_loadmenuerror + $('.page-breadcrumb').append('

    '+$.i18n.prop('com_zte_ums_ict_framework_ui_loadmenuerror')+'

    '); + moreMenusisLoaded=true; + } + }); + } + + //澶勭悊澶歵ab涔熷満鏅 ----redirect 璇ユ爣绛炬殏鏃朵繚鐣,涓嶅缓璁娇鐢ㄤ簡 + dealMultTabPage=function(clickedObject){ + var url = clickedObject.attr("href"); + if(!url||url.length<2) + return; + var redirect=clickedObject.attr("redirect"); //澶勭悊澶歵ab椤甸潰鐨勯渶姹 + if (!!redirect&&redirect.length>0){ + var miframe=_iframe==""?"page-mainIframe": _iframe; + var pagemyIframe=$('.page-content .page-content-body .'+miframe); //.page-mainIframe + //var pagemyIframe=$('.page-content .page-content-body .page-mainIframe'); + var oldhref=""; + if(pagemyIframe&&pagemyIframe.length>0){ + oldhref=pagemyIframe.attr("src"); + if(url.split("?")[0]==oldhref.split("?")[0]) + { + eval(redirect); + dealBreadcrumb(clickedObject,false,e); + return true; + } + } + }; + return false; + }; + //澶勭悊涓昏彍鍗曢潰鍖呭墛瀵艰埅 + var globleCurrentBreadcrumb=""; + var globleCurrentMainMenuItemID=""; + var dhByBreadcrumb = false; + var dealBreadcrumb=function(clickedObject,notGenUID,e){//notGenUID涓簍rue灏变笉閲嶆柊鐢熸垚id + var mbreadcrumb=$('.breadcrumbUl'); + openoFrameWork.setPageTitle(clickedObject.find('span').text().trim()); + var clieckedObj= clickedObject.parent('li'); + if(clieckedObj.length == 0){ //鍒嗛〉寮忔洿澶氳彍鍗曪紝a閾炬帴鐨勭埗浜叉槸div + clieckedObj= clickedObject.parent('div'); + } + //濡傛灉鐐瑰嚮鐨勬槸F鑿滃崟鐨勭珫鑿滃崟锛岃繕闇瑕佹壘鍒版í鑿滃崟涓婄殑瀵瑰簲鐖朵翰鍔犲叆鍒癱lieckedObj + var navPosOption = $('.nav-pos-direction', panel).val(); + var parentid = clickedObject.attr('hparentid'); + var breadcrumGroupButtonSrc=clickedObject.attr("breadcrumGroupButtonSrc"); + globleCurrentMainMenuItemID=clickedObject.attr("id"); + var mhmtl=""; + var url=""; + var tempObj=null; + //var breadChangeType = e? (e.data ? e.data.breadChangeType:null):null; + if( dhByBreadcrumb ){ + mhmtl = dealClickBreadcrumb(clieckedObj); + dhByBreadcrumb = ""; + }else{ + while (clieckedObj&&clieckedObj.length>0){ + if(clieckedObj.children('a')){ + if(!notGenUID){ + url=openoFrameWork.getUniqueID("aid");//+Math.floor(Math.random() * (new Date()).getTime()); + clieckedObj.children('a').attr("name",url); + }else{ + url=clieckedObj.children('a').attr("name"); + } + tempObj=clieckedObj.clone(); + tempObj.children('a').removeClass('iframe'); + tempObj.children('a').removeClass('active'); + tempObj.children('a').attr("href","javascript:openoFrameWork.goToURL('"+url+"');"); + var arrowdown = $(".fa-angle-down", tempObj.children('a')); + if (arrowdown) { + arrowdown.remove(); + } + if(tempObj.children('a').length>0){ + mhmtl=tempObj.children('a')[0].outerHTML+""+mhmtl; + } + //濡傛灉鏄疐鑿滃崟鍜屾í鑿滃崟鐨勫瓙绔栬彍鍗曠偣鍑伙紝闇瑕佸仛鐗规畩澶勭悊 + if( clieckedObj.parent('ul').attr('id') == fMenuSiderDivId || clieckedObj.parent('ul').attr('id') == megaSiderDivId){ + var id = clieckedObj.children( 'a' ).attr('hparentid'); + //鍒ゆ柇鏄疐鑿滃崟杩樻槸妯彍鍗 + var megaMenu = null; + if(navPosOption == openoFrameWork_menu_horizontal){ + magaMenu = $('#'+megaDivId); + }else if(navPosOption == openoFrameWork_menu_fmenu){ + magaMenu = $('#'+fMenuMegaDivId); + } + clieckedObj = $("a[id=" + id + "]" , magaMenu).parent('li'); + }else{ + clieckedObj=clieckedObj.parents('li'); + } + } + } + if(clieckedObj[0]&&clieckedObj[0].length>0) { + mhmtl=clieckedObj.children('a')[0].outerHTML+""+mhmtl; + } + } + mbreadcrumb.empty(); + $('.more-botton-zone').empty(); + globleCurrentBreadcrumb=mhmtl; + store("globleCurrentBreadcrumb",globleCurrentBreadcrumb); + mbreadcrumb.append(mhmtl); + if(breadcrumGroupButtonSrc&&breadcrumGroupButtonSrc.length>0){ + getBreadcrumbRightButtons(breadcrumGroupButtonSrc,e); + }else{ + $('#pageableDiv').hide(); + } + + }; + //闈㈠寘灞戝彂璧风殑鐐瑰嚮锛屽氨涓嶉噸鏂扮敓鎴愰潰鍖呭睉锛屽彧鏄妸璇ラ潰鍖呭睉鐨勫悗缁妭鐐圭Щ鍑恒 + var dealClickBreadcrumb = function(clieckedObj){ + var index = globleCurrentBreadcrumb.indexOf(clieckedObj.children('a').attr("name")); + if( index > -1 ){//鎴彇 + var indexofSign = globleCurrentBreadcrumb.indexOf("",index); + var newBreadcrumb = globleCurrentBreadcrumb.substring(0,indexofSign) + ""; + return newBreadcrumb; + } + } + //澶勭悊闈㈠寘鍓婁腑鑿滃崟鐐瑰嚮鍚庣殑瀵艰埅(鏇村鑿滃崟鐨勯潰鍖呭睉) + var dealBreadcrumbBtnGroupMenus=function(clickedObject,notGenUID , e ){ + var mbreadcrumb=$('.breadcrumbUl'); + var clieckedObj= clickedObject.parent(); + var breadcrumGroupButtonSrc=clickedObject.attr("breadcrumGroupButtonSrc"); + var mhmtl=""; + var url=""; + var tempObj=null; + var menuid=clickedObject.attr("id"); + if (!breadcrumbBtnMenus.contains(menuid)) {//鎶婂綋鍓嶉潰鍖呭墛涓殑鑿滃崟id鍜岃瀛愯彍鍗曞搴旂殑鐖惰彍鍗曞叧鑱旂紦瀛樿捣鏉 + breadcrumbBtnMenus.add(menuid,globleCurrentMainMenuItemID); + } + while (clieckedObj&&clieckedObj.length>0){ + tempObj=clieckedObj.clone(); + if(tempObj.children('a')){ + tempObj.children('a').removeClass('iframe'); + url=tempObj.children('a').attr("href"); + tempObj.children('a').attr("onclick","openoFrameWork.openbreadcrumbLink($(this),event);"); + var tempdiv = tempObj.children('a').children('div'); + if( tempdiv.length > 0 ){ + var innerofDiv = tempdiv[0].innerHTML; + tempdiv.remove(); + tempObj.children('a')[0].innerHTML = innerofDiv; + } + if(tempObj.children('a').length>0){ + mhmtl=tempObj.children('a')[0].outerHTML+""+mhmtl; + } + clieckedObj=clieckedObj.parents('li'); + } + + } + if(clieckedObj[0]&&clieckedObj[0].length>0) { + mhmtl=clieckedObj.children('a')[0].outerHTML+""+mhmtl; + } + + if(breadcrumGroupButtonSrc&&breadcrumGroupButtonSrc.length>0){ + getBreadcrumbRightButtons(breadcrumGroupButtonSrc,true); + }else{ + $('#pageableDiv').hide(); + } + mbreadcrumb.empty(); + var category= clickedObject.attr("category");//澶勭悊鑿滃崟涓畾涔夌殑Category灞炴 + if(category&&category.length>0){//澶勭悊Category灞炴 + var newIpPort=_menuCategorys.items(category); + if(newIpPort&&newIpPort.ipTitle&&newIpPort.ipTitle.trim()!=""){//濡傛灉鎵惧埌浜 + mhmtl=newIpPort.ipTitle+''+mhmtl; + } + } + mhmtl=globleCurrentBreadcrumb+mhmtl; + mbreadcrumb.append(mhmtl); + }; + var isMoreMenuItemClick = false; + var dealBreadcrumbBtnMenuItemClick=function(clickObj,e){ + dealScrollTo(); + var menuItemID=clickObj.attr("id"); + if(!!menuItemID&&menuItemID.length>0){ + _setLocationHash(menuItemID); + var breadmenuID=e&&e.data&&e.data.breadcrumbBtnMenuItem&&e.data.breadcrumbBtnMenuItem.length>0?e.data.breadcrumbBtnMenuItem:""; + _hashSource=breadmenuID&&breadmenuID.length>0?"":"dhByInterface";//hash杩涙潵鐨勶紝涓嶆槸瀵艰埅杩涙潵鐨勩 + } + if(!(e&&e.breadcrumbBtnMenuItem&&e.breadcrumbBtnMenuItem.length>0)){//濡傛灉浠呬粎鏄痶ab璺宠浆璁剧疆bread杩涙潵鐨勶紝灏辨鏋朵笉澶勭悊鑿滃崟鐐瑰嚮锛岀洿鎺ラ噸鏂板缓绔媌read鍗冲彲 + dealstartPageLoading(); + dealIframe(clickObj,e); + } + dealBreadcrumbBtnGroupMenus(clickObj,false,e); + } + // 鍥哄畾杈规爮甯冨眬鏃惰绠楄竟鏍忛珮搴. + var _calculateFixedSidebarViewportHeight = function () { + var viewport = _getViewPort(); + var sidebarHeight =viewport.height - $('.header').height() + 1; + if ($('body').hasClass("page-footer-fixed")) { + sidebarHeight = sidebarHeight - (!$('.footer')||$('.footer').length<=0)?0:$('.footer').outerHeight(); + } + return sidebarHeight; + } + // 澶勭悊鍥哄畾杈规爮 + var dealFixedSidebar = function () { + var menu = $('.page-sidebar-menu'); + if (menu.parent('.slimScrollDiv').size() === 1) { + menu.removeAttr('style'); + $('.page-sidebar').removeAttr('style'); + } + + if ($('.page-sidebar-fixed').size() === 0) { + dealSidebarAndContentHeight(); + return; + } + + var viewport = _getViewPort(); + if (viewport.width >= openoFrameWork_smallView) { + var sidebarHeight = _calculateFixedSidebarViewportHeight(); + dealSidebarAndContentHeight(); + } + } + // 鍥哄畾杈规爮鏃跺鐞嗚彍鍗 hover 鏁堟灉. + var dealFixedSidebarHoverable = function () { + if ($('body').hasClass('page-sidebar-fixed') === false) { + return; + } + $('.page-sidebar').off('mouseenter').on('mouseenter', function () { + dealSiderBarMouseenter(); + }); + $('.page-sidebar').off('mouseleave').on('mouseleave', function () { + dealSiderBarMouseLeave(); + }); + } + var dealSiderBarMouseenter=function(){ + var body = $('body'); + var siderbar=$('.page-sidebar'); + if ((body.hasClass('page-sidebar-closed') === false || body.hasClass('page-sidebar-fixed') === false) || $(this).hasClass('page-sidebar-hovering')) { + return; + } + body.removeClass('page-sidebar-closed').addClass('page-sidebar-hover-on'); + var siderbartoggle=$('.sidebar-toggler'); + + if (body.hasClass("page-sidebar-reversed")) { + siderbar.width(_sidebarWidth); + dealSiderBarWidthChange(); + } else { + siderbar.addClass('page-sidebar-hovering'); + siderbar.animate({ + width: _sidebarWidth + }, 350, '', function () { + siderbar.removeClass('page-sidebar-hovering'); + dealSiderBarWidthChange(); + }); + } + } + var dealSiderBarMouseLeave=function(){ + var body = $('body'); + if ((body.hasClass('page-sidebar-hover-on') === false || body.hasClass('page-sidebar-fixed') === false) || $(this).hasClass('page-sidebar-hovering')) { + return; + } + var siderbar=$('.page-sidebar'); + var siderbartoggle=$('.sidebar-toggler'); + if (body.hasClass("page-sidebar-reversed")) { + body.addClass('page-sidebar-closed').removeClass('page-sidebar-hover-on'); + siderbar.width(_sidebarCollapsedWidth); + if(siderbartoggle){ + siderbartoggle.removeAttr('style'); + } + dealSiderBarWidthChange(); + } else { + siderbar.addClass('page-sidebar-hovering'); + siderbar.animate({ + width: _sidebarCollapsedWidth + }, 350, '', function () { + body.addClass('page-sidebar-closed').removeClass('page-sidebar-hover-on'); + dealSiderBarWidthChange(); + siderbar.removeClass('page-sidebar-hovering'); + if(siderbartoggle){ + siderbartoggle.removeAttr('style'); + } + }); + } + + } + //澶勭悊style css + var dealAddStyle=function(element, property, value, important) { + var styleText=element.attr('style')?element.attr('style'):""; + styles=styleText.split(";"); + var find=""; + for(i=0;i=0){ + find=styles[i];//鐪嬫槸鍚﹀凡缁忔坊鍔犺繃,濡傛灉娣诲姞杩囧氨闇瑕佹浛鎹㈡帀 + break; + } + } + styleText=find.length>0?styleText.replace(find,""):styleText; + styleText=(styleText + ';'+property + ':' + value + ((important) ? ' !important' : '') + ';').replace(/;;/g,";"); + element.attr('style',styleText ); + } + var dealSiderBarWidthChange=function(){ + + } + // 澶勭悊杈规爮鑿滃崟鍒囨崲鏃剁殑鍏抽棴鍜岄殣钘. + var dealSidebarToggler = function () { + var viewport = _getViewPort(); + if (getCookie('sidebar_closed') === '1' && viewport.width >= openoFrameWork_smallView) { + $('body').addClass('page-sidebar-closed'); + } + $('.page-sidebar, .sidebar-toggler').on('click', '.sidebar-toggler', function (e) { + e.preventDefault(); + var body = $('body'); + var sidebar = $('.page-sidebar'); + if(body.hasClass('page-sidebar-closed')){ + $(this).removeAttr('style'); + } + } ); + $('.page-sidebar, .header').on('click', '.sidebar-toggler', function (e) { + var body = $('body'); + var sidebar = $('.page-sidebar'); + if ((body.hasClass("page-sidebar-hover-on") && body.hasClass('page-sidebar-fixed')) || sidebar.hasClass('page-sidebar-hovering')) { + body.removeClass('page-sidebar-hover-on'); + sidebar.css('width', '').hide().show(); + dealSidebarAndContentHeight(); //fix content & sidebar height + setCookie('sidebar_closed', '0'); + dealSiderBarWidthChange(); + e.stopPropagation(); + runResponsiveHandlers(); + return; + } + $(".sidebar-search", sidebar).removeClass("open"); + var panel = $('.zte-theme-panel'); + var sidebarPosOption = $('.sidebar-pos-option', panel).val(); + var pcontent = $("[class='page-content']"); + if (body.hasClass("page-sidebar-closed")) { + body.removeClass("page-sidebar-closed"); + if (body.hasClass('page-sidebar-fixed')) { + sidebar.css('width', ''); + } + setCookie('sidebar_closed', '0'); + pcontent.css("marginLeft",_sidebarWidth); + dealSiderBarWidthChange(); + } else { + body.addClass("page-sidebar-closed"); + $(this).removeAttr('style'); + setCookie('sidebar_closed', '1'); + pcontent.css("marginLeft", _sidebarCollapsedWidth); + dealSiderBarWidthChange(); + } + //閽堝渚ц竟鏍忎几缂╃殑鎯呭喌闇鍔犲叆瀵.page-content鐨勫垽鏂 + dealSidebarAndContentHeight(true); + runResponsiveHandlers(); + }); + } + // 澶勭悊姘村钩鑿滃崟 + var dealHorizontalMenu = function () { + $('.header').on('click', '.hor-menu .hor-menu-search-form-toggler', function (e) { + if ($(this).hasClass('off')) { + $(this).removeClass('off'); + $('.header .hor-menu .search-form').hide(); + } else { + $(this).addClass('off'); + $('.header .hor-menu .search-form').show(); + } + e.preventDefault(); + }); + // 澶勭悊姘村钩鑿滃崟 澶勭悊header涓嬫媺鑿滃崟涓殑鑿滃崟杩炴帴锛屾樉绀哄湪iframe涓 + $('.header').on('click', ' li > a.iframe', function (e) { + //dealMenuItemClick($(this),e,"header"); + e.preventDefault(); + var menuItemID=$(this).attr("id"); + if(!!menuItemID&&menuItemID.length>0){ + _setLocationHash(menuItemID); + _hashSource="dhByInterface"; + }//else{ + _isClicked=true; + dealMenuItemClick($(this),e,"header"); + //} + }); + //澶勭悊TAB鐐瑰嚮 + $('.header').on('click', '.hor-menu a[data-toggle="tab"]', function (e) { + e.preventDefault(); + var nav = $(".hor-menu .nav"); + var active_link = nav.find('li.current'); + $('li.active', active_link).removeClass("active"); + $('.selected', active_link).remove(); + var new_link = $(this).parents('li').last(); + new_link.addClass("current"); + new_link.find("a:first").append(''); + }); + } + // 澧炲姞涓涓鏈嶅姟绔殑蹇冭烦 + var doHeartbeat = function() { + //蹇冭烦瓒呮椂娆℃暟 + var heartBeatTimes = 0; + return setInterval(function() { + var userName; + if( userName == null ){ + var userName = openoFrameWork_conf.userName; + } + var heartUrl = FrameConst.REST_HEARTBEAT + "?username=" + encodeURIComponent(userName); + $.ajax(heartUrl, { + dataType : "text", + cache : false + }).done(function(data) { + // if (data != "true") { //鏀跺埌涓嶅睘浜庡彇鍊艰寖鍥村唴鐨勫洖澶嶏紝璇存槑鍑虹幇涓嶅彲棰勭煡鎯呭喌锛屽彇娑堝績璺炽傛槸鍘焒ramework.js涓殑閫昏緫锛屾瘮杈冨鎬紝鍏堜繚鐣欐敞閲娿 + // disableHeartbeat(); + // } + //鏀跺埌蹇冭烦鍥炲簲娑堟伅锛屽績璺宠秴鏃舵鏁扮疆0 + if( data == "true" ){ + heartBeatTimes = 0; + } + }); + heartBeatTimes++; + //蹇冭烦瓒呮椂6娆″嵆1鍒嗛挓锛岃浆鍒扮櫥褰曠晫闈紝璁や负閾捐矾鏂 + if(heartBeatTimes >= 6){ + disableHeartbeat(); + //console.log(com_zte_ums_aos_framework_ui_heartbeat_timeout); + bootbox.alert($.i18n.prop('com_zte_ums_aos_framework_ui_heartbeat_fail'), function () { + window.location.replace("login.html"); + }); + } + }, 10000); + }; + if( FrameConst.do_heartbeat ){ + var heartbeatTimer = doHeartbeat(); + } + window.enableHeartbeat = function() { + if (!heartbeatTimer) { + //閲嶆柊鍚姩蹇冭烦鍔熻兘锛屽績璺宠秴鏃舵鏁扮疆0 + heartBeatTimes = 0; + heartbeatTimer = doHeartbeat(); + return "Enabled"; + } + return "Already enabled!"; + }; + window.disableHeartbeat = function() { + if (heartbeatTimer) { + clearInterval(heartbeatTimer); + heartbeatTimer = null; + return "Disabled"; + } + return "Already disabled!"; + }; + window.doLogout = function(){ + logoutSubmit(); + }; + //澶勭悊ict娉ㄩ攢纭 + $('#trigger_logout').click(function(){ + bootbox.confirm($.i18n.prop('com_zte_ums_ict_framework_ui_confirmlogout'), function(result) { //浣犵‘璁よ娉ㄩ攢鍚? + if(result){ + doLogout(); + } + }); + }); + // Handle full screen mode toggle + var isscreenFull=false; + var dealFullScreenMode = function() { + // 澶勭悊鍏ㄥ睆浜嬩欢 + function toggleFullScreen() { + if(!screenfull.supportsFullScreen){//涓嶆敮鎸佸叏灞 + if (isIE&&typeof window.ActiveXObject !== "undefined") { // Older IE. + var wscript = new ActiveXObject("WScript.Shell"); + if (wscript !== null) { + wscript.SendKeys("{F11}"); + isscreenFull=!isscreenFull; + } + }else{ + isscreenFull=screenfull.supportsFullScreen; + }; + }else{ + screenfull.isFullScreen?screenfull.exitFullScreen():screenfull.requestFullScreen(); + isscreenFull= screenfull.isFullscreen; + } + setTimeout(function(){ + if(isscreenFull){ + $("#fullscreen_label").text($.i18n.prop('com_zte_ums_ict_framework_ui_group_exitfullscreen')); + }else{ + $("#fullscreen_label").text($.i18n.prop('com_zte_ums_ict_framework_ui_group_fullscreen')); + } + },500); + } + + $('#trigger_fullscreen').click(function() { + toggleFullScreen(); + }); + } + //娓呯悊褰撳墠姝e湪鏄剧ず鐨刬frame涔嬪缂撳瓨鐨刬frame锛 + var dealClearCachedIframes=function(isall){ + if (cachedIframes.count()>0) { + for (var i in cachedIframes.hash()) { + var pagemyIframe=$('.page-content .page-content-body .'+i); + if(pagemyIframe&&pagemyIframe.length>0){ + if(isall==true){ + pagemyIframe.attr("src",""); + pagemyIframe.remove(); + }else if(i!=_iframe) + pagemyIframe.attr("src",""); + pagemyIframe.remove(); + } + } + } + cachedIframes.clear(); + if (cachedIframesObject.count()>0) {//娓呯悊缂撳瓨鐨刬frame瀹炰綋瀵硅薄銆 + for (var i in cachedIframesObject.hash()) { + if(i!=_iframe) + cachedIframesObject.remove(i); + } + } + } + var lastSelectedLayout = ''; + var dealTheme = function () { + var panel = $('.zte-theme-panel'); + if ($('body').hasClass('page-boxed') == false) { + $('.layout-option', panel).val("fluid"); + } + $('.sidebar-option', panel).val("default"); + $('.language-option', panel).val(defaultLanage); + $('.header-option', panel).val("fixed"); + $('.footer-option', panel).val("default"); + if ( $('.sidebar-pos-option').attr("disabled") === false) { + $('.sidebar-pos-option', panel).val(openoFrameWork.isRTL() ? 'right' : 'left'); + } + var _resetLayout = function () { + dealResetLayout(); + } + var _setLayout = function () { + dealSetLayout(); + } + var setColor = function (color) { + var color_ = (openoFrameWork.isRTL() ? color + '-rtl' : color); + $('#style_color').attr("href", ICTFRAME_CONST_THEME_COLOR_CSS_PREFFIX + color_ + ".css"); + setCookie('style_color', color); + syncColorCSS(); + } + $('.toggler', panel).click(function () { + $('.toggler').hide(); + $('.toggler-close').show(); + $('.zte-theme-panel > .theme-options').show(); + }); + + $('.toggler-close', panel).click(function () { + $('.toggler').show(); + $('.toggler-close').hide(); + $('.zte-theme-panel > .theme-options').hide(); + }); + $('.theme-colors > ul > li', panel).click(function () { + var color = $(this).attr("data-style"); + setColor(color); + $('ul > li', panel).removeClass("current"); + $(this).addClass("current"); + }); + $('.layout-option,.header-option, .sidebar-option, .footer-option, .sidebar-pos-option, .nav-pos-direction', panel).change(_setLayout); + if (getCookie('style_color') != undefined) { + setColor(getCookie('style_color')); + } + $('.language-option', panel).change(function(){ + var languageOption = $('.language-option', panel).val(); + setCookie('language-option', languageOption); + window.location.reload(); + }); + } + var dealResetLayout = function () { + $("body"). + removeClass("page-boxed"). + removeClass("page-footer-fixed"). + removeClass("page-sidebar-fixed"). + removeClass("page-header-fixed"). + removeClass("page-sidebar-reversed"); + $('.header > .header-inner').removeClass("container"); + if ($('.page-container').parent(".container").size() === 1) { + $('.page-container').insertAfter('body > .clearfix'); + } + if ($('.footer > .container').size() === 1) { + $('.footer').html($('.footer > .container').html()); + } else if ($('.footer').parent(".container").size() === 1) { + $('.footer').insertAfter('.page-container'); + } + $('body > .container').remove(); + } + /* + * 姝ゆ柟娉曞湪瀹㈡埛绔垵濮嬪寲鍜岃缃潰鏉夸笂閫夋嫨鑿滃崟鏂瑰悜鐨勬椂鍊欑敤銆 + * param navPosOption + */ + var dealNavPos = function(navPosOption) { + // 妯珫杈规爮鍒囨崲鍔熻兘绂佺敤锛屽垯杩斿洖 + var panel = $('.zte-theme-panel'); + if ($('.nav-pos-direction', panel).attr("disabled") == "disabled") { + return; + } + var sidermenu = $("#page-sidebar-menu"); + var hormenu = $("#main_hormenu"); + var sidermenu = $("#page-sidebar-menu"); + var hormenu = $("#main_hormenu"); + var horSiderMenu = $('#' + megaSiderDivId ); + var fhorMenu = $("#" + fMenuMegaDivId); + var fsiderMenu = $("#" + fMenuSiderDivId); + var pcontent = $("[class='page-content']"); + if (sidermenu && sidermenu.length > 0 && hormenu && hormenu.length > 0 && fhorMenu && fhorMenu.length > 0) { + if (navPosOption === openoFrameWork_menu_horizontal) { + sidermenu.css('display','none');// 渚ц竟鏍忛殣钘 + fhorMenu.css('display','none'); + fsiderMenu.css('display','none'); + pcontent.css("marginLeft",0); + $("body").addClass("page-full-width");//璋冩暣鍐呭鏄剧ず + hormenu.css("display", "block");//鏄剧ず姘村钩鑿滃崟鏍 + // 瀵艰埅浣嶇疆涓烘按骞宠彍鍗曟椂锛岃竟鏍忓拰杈规爮浣嶇疆涓洪粯璁ゅ拰闈犲乏锛屼笖灏嗗叾鍒囨崲鍔熻兘绂佺敤鎺 + $('.sidebar-option', panel).val("default"); + $('.sidebar-option', panel).attr("disabled", true); + $('.sidebar-pos-option', panel).val("left"); + $('.sidebar-pos-option', panel).attr("disabled", true); + } else if (navPosOption === openoFrameWork_menu_vertical ) { + $("body").removeClass("page-full-width"); + sidermenu.css('display','block');//渚ц竟鏍忔樉绀 + var body = $('body'); + if (body.hasClass("page-sidebar-closed")) { + pcontent.css("marginLeft", _sidebarCollapsedWidth); + } else { + pcontent.css("marginLeft", _sidebarWidth); + } + hormenu.css("display", "none");//闅愯棌姘村钩鑿滃崟鏍 + fhorMenu.css('display','none'); + fsiderMenu.css('display','none'); + horSiderMenu.css('display','none'); + $('.sidebar-option', panel).attr("disabled", false); + $('.sidebar-pos-option', panel).attr("disabled", false); + } else if(navPosOption === openoFrameWork_menu_fmenu ){ + sidermenu.css('display','none');// 渚ц竟鏍忛殣钘 + hormenu.css("display", "none");//闅愯棌姘村钩鑿滃崟鏍 + fsiderMenu.css('display','none'); + fhorMenu.css('display','block'); + pcontent.css("marginLeft",0); + $("body").addClass("page-full-width");//璋冩暣鍐呭鏄剧ず + // 瀵艰埅浣嶇疆涓烘按骞宠彍鍗曟椂锛岃竟鏍忓拰杈规爮浣嶇疆涓洪粯璁ゅ拰闈犲乏锛屼笖灏嗗叾鍒囨崲鍔熻兘绂佺敤鎺 + $('.sidebar-option', panel).val("default"); + $('.sidebar-option', panel).attr("disabled", true); + $('.sidebar-pos-option', panel).val("left"); + $('.sidebar-pos-option', panel).attr("disabled", true); + } + } + } + var dealSetLayout = function(){ + var panel = $('.zte-theme-panel'); + var layoutOption = $('.layout-option', panel).val(); + var languageOption = $('.language-option', panel).val(); + var headerOption = $('.header-option', panel).val(); + var footerOption = $('.footer-option', panel).val(); + var navPosOption = $('.nav-pos-direction', panel).val(); + dealNavPos(navPosOption); + var sidebarOption = $('.sidebar-option', panel).val(); + var sidebarPosOption = $('.sidebar-pos-option', panel).val(); + if (sidebarOption == "fixed" && headerOption == "default") { + alert($.i18n.prop('com_zte_ums_ict_framework_ui_fixedsidedefaultheaderError')); //椤靛ご涓嶆敮鎸佸浐瀹氳竟鏍,鍏堝浐瀹氶〉澶存墠鑳藉浐瀹氳竟鏍. + $('.header-option', panel).val("fixed"); + $('.sidebar-option', panel).val("fixed"); + sidebarOption = 'fixed'; + headerOption = 'fixed'; + } + if (sidebarOption == "fixed" && sidebarPosOption == "right") { + alert($.i18n.prop('com_zte_ums_ict_framework_ui_fixedsiderightpositionError')); //鍥哄畾杈规爮鎯呭喌涓嬶紝杈规爮涓嶈兘闈犲彸銆. + $('.sidebar-pos-option', panel).val("left"); + sidebarPosOption = 'left'; + } + dealResetLayout(); // reset layout to default state + if (layoutOption === "boxed") { + $("body").addClass("page-boxed"); + // set header + $('.header > .header-inner').addClass("container"); + var cont = $('body > .clearfix').after('
    '); + // set content + $('.page-container').appendTo('body > .container'); + // set footer + if (footerOption === 'fixed') { + $('.footer').html('
    ' + $('.footer').html() + '
    '); + } else { + $('.footer').appendTo('body > .container'); + } + } + if (lastSelectedLayout != layoutOption) { + runResponsiveHandlers(); + } + lastSelectedLayout = layoutOption; + //header + if (headerOption === 'fixed') { + $("body").addClass("page-header-fixed"); + $(".header").removeClass("navbar-static-top").addClass("navbar-fixed-top"); + } else { + $("body").removeClass("page-header-fixed"); + $(".header").removeClass("navbar-fixed-top").addClass("navbar-static-top"); + } + //sidebar + if ($('body').hasClass('page-full-width') === false) { + if (sidebarOption === 'fixed') { + $("body").addClass("page-sidebar-fixed"); + } else { + $("body").removeClass("page-sidebar-fixed"); + } + } + //footer + if (footerOption === 'fixed') { + $("body").addClass("page-footer-fixed"); + } else { + $("body").removeClass("page-footer-fixed"); + } + //sidebar position + if (openoFrameWork.isRTL()) { + if (sidebarPosOption === 'left') { + $("body").addClass("page-sidebar-reversed"); + $('#frontend-link').tooltip('destroy').tooltip({placement: 'right'}); + } else { + var pcontent = $("[class='page-content']"); + pcontent.css("marginLeft",0);//渚ц竟鏍忛潬鍙筹紝鍒欏乏杈瑰唴瀹瑰~鍏呬负0 + $("body").removeClass("page-sidebar-reversed"); + $('#frontend-link').tooltip('destroy').tooltip({placement: 'left'}); + } + } else { + if (sidebarPosOption === 'right') { + var pcontent = $("[class='page-content']"); + pcontent.css("marginLeft",0);//渚ц竟鏍忛潬鍙筹紝鍒欏乏杈瑰唴瀹瑰~鍏呬负0 + $("body").addClass("page-sidebar-reversed"); + $('#frontend-link').tooltip('destroy').tooltip({placement: 'left'}); + } else { + $("body").removeClass("page-sidebar-reversed"); + $('#frontend-link').tooltip('destroy').tooltip({placement: 'right'}); + } + } + dealSidebarAndContentHeight(); + dealFixedSidebar(); + dealFixedSidebarHoverable(); + dealSiderBarWidthChange(); + setCookie('layout-option', layoutOption); + setCookie('language-option', languageOption); + setCookie('header-option', headerOption); + setCookie('sidebar-option', sidebarOption); + setCookie('sidebar-pos-option', sidebarPosOption); + setCookie('nav-pos-direction', navPosOption); + } + var setCookie = function (key, value) { + if (store) { + store(key, value); + } + } + var getCookie = function (key) { + if (store) { + return store(key); + } else { + return undefined; + } + } + /*涓嬮潰澶勭悊鍓嶈繘鍚庨鍜岄敋鐐硅闂*/ + var _getLocationHash = function() { + return location.hash.replace("#_", ""); + } + /*缁熶竴鍏ュ彛璁剧疆閿氱偣*/ + var _setLocationHash = function(menuItemID) { + location.hash = getLocationHashByMenuId(menuItemID); + } + var getLocationHashByMenuId = function(menuItemID){ + return "#_" + menuItemID; + } + // hash control + var loadCurrentHash = function(e,data){ + var locationhash = _getLocationHash(); //important + if(!!locationhash&&locationhash.length>0){ + if(_hashSource.trim()=="dhByInterface"){ + _hashSource=""; + }else{ + processChangedHash(locationhash,data); + } + } + } + // hash control 杩欑鍐欐硶瀹夊叏鐐 + var processChangedHash = function(path) { + var id = path; + var action = undefined; + var spIndex = path.indexOf("/"); + if(spIndex != -1) { + id = path.substring(0,spIndex); + action = path.substring(spIndex+1); + } + openoFrameWork.goToURLByIDAndNewAction(id,action); + } + var syncColorCSS=function(){//娉ㄥ唽鐨偆鍒囨崲浜嬩欢澶勭悊鍑芥暟锛屽鐞唅frame涓殑鐨偆鍒囨崲 + var pagemyIframe=null; + if (cachedIframes.count()>0) { + for (var i in cachedIframes.hash()) { + pagemyIframe=$('.page-content .page-content-body .'+i); + if(pagemyIframe&&pagemyIframe.length>0){ + openoFrameWork.SyncCSS(pagemyIframe[0],1,""); + } + } + } + } + var getCurrentVisibleIframe=function(){ + var pagemyIframe=null; + if (cachedIframes.count()>0) { + for (var i in cachedIframes.hash()) { + if(cachedIframes.items(i)===1){ + pagemyIframe=$('.page-content .page-content-body .'+i); + } + } + } + return pagemyIframe; + } + //澶勭悊璺ㄥ煙璇锋眰浠g悊锛岄氳繃璇ヤ唬鐞嗚繘琛宨frame闂翠紶閫掑弬鏁帮紝娉ㄦ剰杩欓噷鐨勪唬鐞嗛〉闈roxy.html蹇呴』閮ㄧ讲鍒拌璺ㄥ煙鐨勫绔煙鐨勬湇鍔″櫒web鏍圭洰褰曚笅 + var dealCrossProxy=function(ifrm,crossproxysrc,ifmHeadlins,flag){//crossproxysrc杩欎釜鏄痯roxy.html瀵瑰簲鐨剈rl鏍硅矾寰 + var url=$.url(openoFrameWork.getCurrentScript(document)); + var proxyHtmlPath=url.attr("directory")+"proxy/proxy.html"//杩欎腑鎯呭喌閫傜敤浜庝娇鐢ㄤ簡璇ョ晫闈㈤泦鎴愭鏋剁殑搴旂敤绯荤粺 + var _ifmProxy=$(''); + var _ifm=$('#ifm_Proxy'); + _ifm.hide(); + var pageContentBody=$('.page-content .page-content-body'); + var linksrcs=new Array(); + var linksids=new Array(); + var linktyps=new Array(); + var _src=""; + for (i=0;i0){ + _src=ifmHeadlins[i].link.src; + linktyps.push("javascriptfile"); + }else{ + _src=ifmHeadlins[i].link.text; + linktyps.push("javascripttext"); + } + }else{ + linktyps.push("undefined"); + } + linksrcs.push(_src); + linksids.push({"pos":ifmHeadlins[i].pos,"scope":ifmHeadlins[i].scope,"id":ifmHeadlins[i].link.id}); + } + var parm={iFrame:ifrm,cssLinktyps:linktyps,cssLinksrcs:linksrcs,cssLinkids:linksids,origin:crossproxysrc,flag:flag}; + if(_ifm&&_ifm.length<=0){//娌℃湁娣诲姞杩 + _ifmProxy.appendTo(pageContentBody); + _ifmProxy.one('load',parm,function(e){ + var data={iFrame:e.data.iFrame,cssLinktyps:e.data.cssLinktyps,cssLinksrcs:e.data.cssLinksrcs,cssLinkids:e.data.cssLinkids,flag:flag}; + $('#ifm_Proxy')[0].contentWindow.postMessage(data,e.data.origin);//window.location.origin + }); + }else if(_ifm.attr("oldproxyorigin")!=crossproxysrc){//浠g悊宸茬粡娣诲姞杩囦簡锛岀湅鏄惁鏄悓涓涓綉绔欑殑浠g悊锛屽鏋滀笉鏄渶瑕侀噸鏂板姞杞 + _ifm.attr("src",""); + _ifm.attr("oldproxyorigin",crossproxysrc); + _ifm.one('load',parm,function(e){ + var data={iFrame:e.data.iFrame,cssLinktyps:e.data.cssLinktyps,cssLinksrcs:e.data.cssLinksrcs,cssLinkids:e.data.cssLinkids,flag:flag}; + $('#ifm_Proxy')[0].contentWindow.postMessage(data,e.data.origin);//window.location.origin + }); + _ifm.attr("src",_ifmProxy.attr("src")); + }else{//宸茬粡娣诲姞杩囷紝鐩存帴瑙﹀彂娑堟伅鍙戦佸嵆鍙 + var data={iFrame:parm.iFrame,cssLinktyps:parm.cssLinktyps,cssLinksrcs:parm.cssLinksrcs,cssLinkids:parm.cssLinkids,flag:flag}; + _ifm[0].contentWindow.postMessage(data,parm.origin);//window.location.origin + } + } + return { + init: function () { + if(zte_http_headers){ + store("zte_http_headers",zte_http_headers); + } + dealInit(); + dealResponsiveOnResize(); + dealResponsiveOnInit(); + dealClearCachedIframes(true); ////娓呯悊褰撳墠姝e湪鏄剧ず鐨刬frame涔嬪缂撳瓨鐨刬frame锛 + breadcrumbBtnMenus.clear(); + dealFixedSidebar(); // deals fixed sidebar menu + dealFixedSidebarHoverable(); // deals fixed sidebar on hover effect + dealSidebarMenu(); // deals main menu + dealHorizontalMenu(); // deals horizontal menu + dealSidebarToggler(); // deals sidebar hide/show + dealTheme(); // deals style customer tool + dealSetLayout(); + $(function() { + $(window).on('hashchange',function(){ + loadCurrentHash(); + }); + }); + dealFullScreenMode(); // deals full screen + $("#header_dropdown_user").css('display','block'); + $("#com_zte_ums_ict_framework_img_netnumenLogo").css('display','inline'); + $("#com_zte_ums_ict_framework_ui_main_title").css('display','inline'); + handeCtxMenuitem(); + }, + //鍏紑娓呯悊缂撳瓨鐨勬墍鏈塈frame鐨勬柟娉曪細isALL==true鍒欐竻鐞嗘墍鏈夛紝鍚﹀垯娓呯悊褰撳墠姝e湪鏄剧ず鐨刬frame涔嬪缂撳瓨鐨刬frame锛屻 + clearCachedIframes:function(isAll){ + dealClearCachedIframes(isAll); + }, + + setBaseURLRoot:function(ipportStr){//鑿滃崟url鐨勮窡ip鍜岀鍙d緥濡:http://10.74.151.122:21180 + if (store) { + store('baseURLRoot', ipportStr); + } + var url = $.url(ipportStr); + location.hash=url.attr('fragment'); + var auth=url.attr('query'); + if (store) { + store('baseURLRootAuth', auth); + } + }, + getBaseURLRoot:function(ipportStr){//鑿滃崟url鐨勮窡ip鍜岀鍙d緥濡:http://10.74.151.122:21180 + var rooturl=""; + if (store) { + rooturl=store('baseURLRoot'); + } + return !rooturl?"":rooturl; + }, + clearBaseURLRoot:function(){//鑿滃崟url鐨勮窡ip鍜岀鍙d緥濡:http://10.74.151.122:21180 + if (store) { + store('baseURLRoot', "",-1); + } + }, + setPageTitle:function(title){//璁剧疆椤甸潰鏍囬 + $('title').html(title+" - "+gdocTitle); + }, + getLanguage:function(){//鑾峰彇璇█ + return openoFrameWork_conf.acceptLanguage; + }, + + getLocationHash:function(){ + return _getLocationHash(); + }, + setSceneURLRootPath:function(sceneURLRootPath){ + if(sceneURLRootPath&&sceneURLRootPath.trim().length>0){//濡傛灉瀹氫箟浜嗗満鏅殑鍏ㄥ眬鍙傛暟 + _sceneURLRootPath=sceneURLRootPath.trim(); + if(_sceneURLRootPath.charAt(_sceneURLRootPath.length-1)!='/') + { + _sceneURLRootPath=_sceneURLRootPath+'/'; + } + } + }, + //public function to add callback a function which will be called on window resize + addResponsiveHandler: function (func) { + responsiveHandlers.push(func); + }, + + hiddenAlarmLight:function(){ + hideAlarmLight(); + }, + + hiddenMenu:function(){ + hidemenu(); + }, + setBreadcrumbByMenuID:function(id){ + //var breaditem=$('#'+id); + var menuitem=undefined; + // var items=$("a[id='"+id+"']"); + var items = undefined; + var panel = $('.zte-theme-panel'); + var navPosOption = $('.nav-pos-direction', panel).val(); + if (navPosOption === "vertical"){ //浠庡瀭鐩磋彍鍗曢噷闈㈡壘 + items=$("#page-sidebar-menu a[id='"+id+"']"); + if (!items || items.length < 1) { + items=$(".page-content a[id='"+id+"']"); + } + }else if(navPosOption === openoFrameWork_menu_horizontal){//浠庢按骞宠彍鍗曢噷闈㈡壘 + items=$("#main_hormenu a[id='"+id+"']"); + if(items.length == 0){ + //妯彍鍗曟病鏈夋壘鍒帮紝鍐嶅湪妯彍鍗曠殑瀛愯彍鍗曟壘涓娆 + items=$("#page-megachild-sidebar-menu a[id='"+id+"']"); + } + }else if(navPosOption === openoFrameWork_menu_fmenu){ + items=$("#f_hormenu a[id='"+id+"']"); + if(items.length == 0){ + //妯彍鍗曟病鏈夋壘鍒帮紝鍐嶅湪绔栬彍鍗曟壘涓娆° + items=$("#page-f-sidebar-menu a[id='"+id+"']"); + } + } + var isbreadcrumbMenuItem=false; + if(items.length>0){ + for(var i=0;i0){ + if(isbreadcrumbMenuItem){ + dealBreadcrumbBtnGroupMenus(menuitem,false); + }else{ + dealBreadcrumb(menuitem,true,null); + } + }else{ + var breadcrumbBtnMenuItemParent=""; + if(!menuitem||menuitem.length<=0){//娌℃湁鎵惧埌璇ヨ彍鍗曪紝鍙兘鏄潰鍖呭墛涓殑锛岄渶瑕侀澶栧鐞 + var menuItemID=id; + if (breadcrumbBtnMenus.contains(menuItemID)) {//鏈夌紦瀛 + breadcrumbBtnMenuItemParent="#"+breadcrumbBtnMenus.items(menuItemID); + menuitem=$(breadcrumbBtnMenuItemParent); + //_breadcrumbSource=true; + } + } + var parm=undefined; + if(breadcrumbBtnMenuItemParent&&breadcrumbBtnMenuItemParent.length>0){ + parm={breadcrumbBtnMenuItem:menuItemID}; + } + if(parm&&menuitem&&menuitem.length>0) { + dealBreadcrumb(menuitem,true,parm); + } + } + }, + setSiderbarCollapseWidth:function(width){ + _sidebarCollapsedWidth = width; + }, + getSiderbarCollapseWidth:function(){ + return _sidebarCollapsedWidth; + }, + setSidebarWidth:function(width){ + _sidebarWidth = width; + }, + getSidebarWidth:function(){ + return _sidebarWidth; + }, + //2015骞10鏈26鏃ユ柊澧炲姩鎬佸垏鎹㈣彍鍗曠殑鍔熻兘锛岃繖閲岀殑鑿滃崟杩橀渶瑕佸啀娆℃洿鎹㈣彍鍗曢」璁块棶鐨刬p绔彛淇℃伅 + handlBaseURL:function(url){ + var baseURLRoot=openoFrameWork.getBaseURLRoot(); + if (baseURLRoot.length>0) {//2015骞10鏈26鏃ユ柊澧炲姩鎬佸垏鎹㈣彍鍗曠殑鍔熻兘锛岃繖閲岀殑鑿滃崟杩橀渶瑕佸啀娆℃洿鎹㈣彍鍗曢」璁块棶鐨刬p绔彛淇℃伅 + baseURLRoot=openoFrameWork.getDomainURL(baseURLRoot);//鍘绘帀ip鍜宲ort鍚庡浣欑殑閮ㄥ垎 + console.log("old a link href url:"+url); + url=baseURLRoot+url.replace(openoFrameWork.getDomainURL(url),""); + console.log("baseURLRoot:"+baseURLRoot+" newURL:"+url); + }; + return url; + }, + + startPageLoading: function(message) { + dealstartPageLoading(message); + }, + stopPageLoading: function() { + dealstopPageLoading(); + }, + //public function to get a paremeter by name from URL + getLocationURLParameter: function (paramName,separator) { + var searchString = decodeURIComponent(window.location.search.substring(1)).toLowerCase(), + i, val, params = searchString.split(separator?separator:"&"); + paramName=paramName.toLowerCase(); + for (i = 0; i < params.length; i++) { + val = params[i].split("="); + if (val[0] == paramName) { + return unescape(val[1]); + } + } + return null; + }, + //public function to get a paremeter by name from URL + getURLParameter: function (paramName,url) { + var searchString = decodeURIComponent(url).toLowerCase(), + i, val, params = searchString.split("&"); + paramName=paramName.toLowerCase(); + for (i = 0; i < params.length; i++) { + val = params[i].split("="); + if (val[0] == paramName) { + return unescape(val[1]); + } + } + return null; + }, + // check for device touch support + isTouchDevice: function () { + return isTouch; + }, + getUniqueID: function(prefix) { + return prefix+'_' + Math.floor(Math.random() * (new Date()).getTime()); + }, + // check IE8 mode + isIE8: function () { + return isIE8; + }, + // check IE9 mode + isIE9: function () { + return isIE9; + }, + //check RTL mode + isRTL: function () { + return isRTL; + }, + getViewPort:function(){ + return _getViewPort(); + }, + // get layout color code by color name + getLayoutColorCode: function (name) { + if (layoutColorCodes[name]) { + return layoutColorCodes[name]; + } else { + return ''; + } + } , + fixContentHeight: function () { + dealSidebarAndContentHeight(); + }, + dealAtoIframe:function(aObj,event){ + var containerStr=aObj.parentsUntil('.page-container').hasClass('page-sidebar')?'page-sidebar':"";// + containerStr=aObj.parentsUntil('.header-inner').hasClass('hor-menu')?'header':containerStr; + dealMenuItemClick(aObj,event,containerStr); + _isClicked=false; + }, + getDomainURL:function(urlAddress){ + var url = $.url(urlAddress); + var protocol=url.attr('protocol'); + var host=url.attr('host'); + var port=url.attr('port'); + var crossOrign=protocol+"://"+host+(port.length>0?":"+port:""); + return crossOrign; + }, + getCurrentScript:function(doc) {//doc涓 document瀵硅薄 + /* 娉ㄦ剰璇ュ姛鑳藉湪鍏朵粬鑴氭湰涓皟鐢ㄦ椂鍑簊afari鑾峰彇鍒扮殑鑴氭湰璺緞涓烘湰鏂规硶鎵鍦ㄨ剼鏈殑璺緞锛 + 鍏朵粬娴忚鍣ㄨ幏鍙栧埌鐨勪负璋冪敤璇ユ柟娉曠殑鑴氭湰鎵鍦ㄨ矾寰 + 鍙栧緱姝e湪瑙f瀽鐨剆cript鑺傜偣 + */ + if(doc&&doc.currentScript) { //firefox 4+ + console.log("0銆 "+doc.currentScript.src); + return doc.currentScript.src; + } + // 鍙傝 https://github.com/samyk/jiagra/blob/master/jiagra.js + var stack; + try { + a.b.c(); //寮哄埗鎶ラ敊,浠ヤ究鎹曡幏e.stack + } catch(e) {//safari鐨勯敊璇璞″彧鏈塴ine,sourceId 鎴栬呴珮鐗堟湰杩樻湁sourceURL + stack = e.stack; + if(e.sourceURL){//safari 娴忚鍣ㄦ病鏈塭.stack浣嗘湁e.sourceURL + stack=e.sourceURL; + }else if(!stack && window.opera){ + //opera 9娌℃湁e.stack,浣嗘湁e.Backtrace,浣嗕笉鑳界洿鎺ュ彇寰,闇瑕佸e瀵硅薄杞瓧绗︿覆杩涜鎶藉彇 + stack = (String(e).match(/of linked script \S+/g) || []).join(" "); + } + console.log("1銆 "+stack); + } + if(stack) { + /*e.stack鏈鍚庝竴琛屽湪鎵鏈夋敮鎸佺殑娴忚鍣ㄥぇ鑷村涓: + *chrome23: + * at http://113.93.50.63/data.js:4:1 + *firefox17: + *@http://113.93.50.63/query.js:4 + *opera12: + *@http://113.93.50.63/data.js:4 + *IE10: + * at Global code (http://113.93.50.63/data.js:4:1) + */ + console.log("2銆 "+stack); + stack = stack.split( /[@ ]/g).pop();//鍙栧緱鏈鍚庝竴琛,鏈鍚庝竴涓┖鏍兼垨@涔嬪悗鐨勯儴鍒 + stack = stack[0] == "(" ? stack.slice(1,-1) : stack; + console.log("3銆 "+stack); + return stack.replace(/(:\d+)?:\d+$/i, "");//鍘绘帀琛屽彿涓庢垨璁稿瓨鍦ㄧ殑鍑洪敊瀛楃璧峰浣嶇疆 + } + if(doc){ + var nodes = doc.getElementsByTagName("script"); //鍙湪head鏍囩涓鎵 + for(var i = 0, node; node = nodes[i++];) { + if(node.readyState === "interactive") { + console.log("4銆 "+(node.className = node.src)); + return node.className = node.src; + } + } + } + }, + /*涓嬮潰鐨刦lag涓0琛ㄧず榛樿涓嶈Е鍙戝瓩瀛恑frame涓殑onload浜嬩欢,涓1琛ㄧず瑕佽Е鍙,flag涓10鍒欏cssSrc閲嶅鎵ц锛屽叾浠栦笉鍋氶噸澶嶆墽琛*/ + SyncCSS:function(ifrm,flag,cssSrc){//灏嗕富妗嗘灦涓殑鐨偆css搴旂敤鍒版墦寮鐨刬frame椤甸潰涓 + if(!ifrm)return; + var ifmHeadlins = new Array(); + if(cssSrc&&cssSrc.length>0&&cssSrc.endWith(".css")){ + var _div = $(''); + var csslink=document.createElement("link"); + csslink.href=_div[0].href;//杩欓噷鍚屾鑿滃崟瀹氫箟涓璫ssSrc灞炴ф寚瀹氱殑css鏂囦欢鍒癷frame + _div = null; + csslink.rel="stylesheet"; + csslink.type="text/css"; + csslink.id="ifram_csssrc"; + ifmHeadlins.push({"pos":"head","scope":"all","link":csslink});//pos鏄坊鍔犲埌瀛恑frame涓殑浣嶇疆锛宻cope鏄瓙绐椾綋浣滅敤杩斿洖锛宱ne琛ㄧず鐩存帴瀛愮獥浣擄紝all琛ㄧず宓屽鎵鏈夊瓙绐椾綋 + } + if(flag!=10){//褰揻lag涓10鏃朵笅闈㈢殑css鍜宩s閮戒笉鎵ц + if($('#style_color').length>0){ + var csslink=document.createElement("link"); + csslink.href=$('#style_color')[0].href.replace(".css","_ifrm.css");//杩欓噷鍚屾鐨勭毊鑲ら〉闈慨鏀逛负鍘熺毊鑲ら〉闈㈡枃浠跺悕鍚庣紑娣诲姞ifrm鐨刢ss鐨偆鏂囦欢 + csslink.rel="stylesheet"; + csslink.type="text/css"; + csslink.id="style_color"; + ifmHeadlins.push({"pos":"head","scope":"all","link":csslink});//pos鏄坊鍔犲埌瀛恑frame涓殑浣嶇疆锛宻cope鏄瓙绐椾綋浣滅敤杩斿洖锛宱ne琛ㄧず鐩存帴瀛愮獥浣擄紝all琛ㄧず宓屽鎵鏈夊瓙绐椾綋 + } + // 灏 font-awesome瀛椾綋鍥炬爣搴旂敤鍒版ā鍧梚frame + if($('#font_awesome').length>0){ + var awesomelink=document.createElement("link"); + awesomelink.href=$('#font_awesome')[0].href; + awesomelink.rel="stylesheet"; + awesomelink.type="text/css"; + awesomelink.id="font_awesome"; + ifmHeadlins.push({"pos":"head","scope":"all","link":awesomelink}); + } + // 灏唒ym.js or pym.min.js搴旂敤鍒版ā鍧梚frame + var pymjsObj=$("script[src*='/pym.']");//妯$硦鏌ユ壘 + pymjsObj=pymjsObj.length>0?pymjsObj:$("script[src*='/pym1.']"); + if(pymjsObj.length>0){ + var pymjs=document.createElement("script"); + pymjs.src=pymjsObj[0].src; + pymjs.type="text/javascript"; + pymjs.id=!!pymjsObj[0].id?pymjsObj[0].id:"pymjs"; + ifmHeadlins.push({"pos":"head","scope":"one","link":pymjs}); + pymjs=document.createElement("script"); //pym鑴氭湰鏂囦欢鍔犺浇鍚庤鎵цnew pym.Child()杩涜iframe瀛愮獥浣撳疄渚嬪寲,渚夸簬瀛愮獥浣撳拰鐖剁獥浣撻氳new pym.Child({ id: '"+_iframe+"' ,polling: 1000}) + var frameid=(_iframe.split('-').length>0?_iframe.split('-')[1]:"1"); + pymjs.text="var t1;function pmchd(){console.log('In the frame "+_iframe+",pym code call is begining; '+(typeof pym!= 'undefined'));if(typeof pym != 'undefined'){pymChild"+frameid+" = new pym.Child({ id: 'pdiv_"+_iframe+"' ,polling: 500});window.clearInterval(t1); }};t1 = window.setInterval(pmchd,5);"; + pymjs.type="text/javascript"; + pymjs.id="pymChild"; + ifmHeadlins.push({"pos":"htmlend","scope":"one","link":pymjs}); + } + // 灏唄k.js or hk.min.js搴旂敤鍒版ā鍧梚frame + var hkjsObj=$("script[src*='/hk.']");//妯$硦鏌ユ壘 + hkjsObj=hkjsObj.length>0?hkjsObj:$("script[src*='/hk1.']"); + if(hkjsObj.length>0){ + var hkjs=document.createElement("script"); + hkjs.src=hkjsObj[0].src; + hkjs.type="text/javascript"; + hkjs.id=!!hkjsObj[0].id?hkjsObj[0].id:"hkjs"; + ifmHeadlins.push({"pos":"head","scope":"one","link":hkjs}); + hkjs=document.createElement("script"); ////hk.js 鍔犺浇鍚庢嫤鎴猘jax璇锋眰杩涜杞彂 + } + } + var crossOrign=openoFrameWork.getDomainURL(ifrm.src); + if( window.location.origin==crossOrign){ //绗竴灞傚悓鍩熷鐞 + for (i=0;i0){ + var ifmHeadlins2 = new Array(); + for (i=0;i0){ + console.log('璺ㄥ煙璁块棶: 绯荤粺灏嗚繘鍏ヨ法鍩熻闂唬鐞嗗鐞嗘祦绋 '); + dealCrossProxy(childifrms[j].name,childOrign,ifmHeadlins2,flag); + } + } + } + } + }else{ + if(ifmHeadlins.length>0){ + console.log('璺ㄥ煙璁块棶: 绯荤粺灏嗚繘鍏ヨ法鍩熻闂唬鐞嗗鐞嗘祦绋 '); + dealCrossProxy(ifrm.name,crossOrign,ifmHeadlins,flag); + } + } + }, + goToURL:function(url){ + dhByBreadcrumb = true;//鍏ㄥ眬鍙橀噺锛屽0鏄庢娆′簨浠舵槸鐢辩偣鍑婚潰鍖呭睉鍙戣捣鐨 + var showNav=openoFrameWork.getLocationURLParameter('showNav'); + if(showNav=="false"){//濡傛灉涓嶆樉绀鸿彍鍗,灏卞己鍒跺埛鏂版湰椤 + location.reload(); + }else{ + url="a[name='"+url+"']"; + $(url).click(); + } + }, + goToURLByName:function(name){ + var showNav=openoFrameWork.getLocationURLParameter('showNav'); + if(showNav=="false"){//濡傛灉涓嶆樉绀鸿彍鍗,灏卞己鍒跺埛鏂版湰椤 + location.reload(); + }else{ + url="a[name='"+name+"']"; + $(url).click(); + } + }, + goToURLByID:function(id){ + if(!id){ + return; + } + var showNav=openoFrameWork.getLocationURLParameter('showNav'); + if(showNav=="false"){//濡傛灉涓嶆樉绀鸿彍鍗,灏卞己鍒跺埛鏂版湰椤 + location.reload(); + }else{ + if(id.indexOf("#")<0){ + id="#"+id; + } + $(id).click(); + } + }, + goToPortal:function(id){ + var _url=top.location.href; + console.log(_url); + //_url="/ngict/iui/framework/"; + var url=$.url(_url); + top.location=url.attr("directory")+"uifportal.html#"+id+"/"; + }, + //Category + goToURLByIDAndNewIPPort:function(id,newIPPort,newActionStr){ + //鍏堟妸NewIPPort瀵硅薄:newIPPort={menuCategoryID:'vim',ipPortStr:'htpp://10.74.151.123:31180',newTitle:''}缂撳瓨鍒癈ategory鏁扮粍涓紝 + //menuCategoryID灞炴ф槸鏇村鑿滃崟涓婇厤缃殑鑿滃崟鐨勫垎绫籭d锛; + //ipPortStr灞炴ф槸璇d鐨勮彍鍗曡鏇挎崲鐨勬柊鐨刬p鍜岀鍙e湴鍧瀛楃涓诧紝鍖呮嫭鍗忚閮ㄥ垎锛屾瘮濡俬ttp://10.74.151.64:21169 + //newTitle灞炴х敤浜庢斁缃柊寮ip鐨勯〉闈㈠搴斿埌闈㈠寘灞戜笂鐨勫悕瀛楋紝鍙互涓衡溾濓紝绌烘爣璇嗕笉鍏虫敞 + _menuCategorys.replace(newIPPort.menuCategoryID,{ipPort:newIPPort.ipPortStr,ipTitle:newIPPort.newTitle});//鎶婂綋鍓嶉潰鍖呭墛涓殑鑿滃崟id鍜岃瀛愯彍鍗曞搴旂殑鐖惰彍鍗曞叧鑱旂紦瀛樿捣鏉 + if (store) { + store('menuCategoryID', newIPPort.menuCategoryID+"[menuCategoryID]"+newIPPort.ipPortStr+"[menuCategoryID]"+(!!newIPPort.newTitle?newIPPort.newTitle:"")); + } + //杩欓噷澧炲姞鎸夌収newIPPort.menuCategoryID鍒嗙被鍔犺浇more鑿滃崟鐨勫鐞嗛昏緫 + //棣栧厛鏍规嵁id鎵惧埌瀵瑰簲鐨勪富鑿滃崟鑿滃崟椤 + var menuitem = this.findMenuItemByMenuId(id); + if(!menuitem||menuitem.length<=0){//涓昏彍鍗曚腑娌℃湁鎵惧埌锛屽氨鎵緈ore鑿滃崟锛屾壘鍒癷d瀵瑰簲鐨刴ore鑿滃崟椤规墍灞炵殑涓昏彍鍗曢」 + var mainMenuId = this.getMenuItemId_From_MoreMenuRelation(id); + if( !!mainMenuId&&mainMenuId.length>0 ){//more鑿滃崟涓壘鍒颁簡id瀵瑰簲鐨勪富鑿滃崟椤筰d锛屾牴鎹甶d杩斿洖涓昏彍鍗曢」 + menuitem = this.findMenuItemByMenuId(mainMenuId); + if(!!menuitem&&menuitem.length>0){ + var more=$("#"+id,$('#pageableDiv')).parent(); + $(".box.boxOperation", $(".carousel-inner")).removeClass("moreButtonSelected"); + more=$('a>div.box',more); + if (more.hasClass('moreButtonSelected') == false){ + more.addClass('moreButtonSelected'); + } + var pagesTags=$('.item.moreButtonsTag'); + if(pagesTags.length>0){ + for(var i=0;i0){ + tags.addClass('active'); + } + } + } + } + } + } + //鍏舵鎵惧埌鐨勮彍鍗曢」涓璶ewIPPort.menuCategoryID瀵瑰簲鐨剆rc瑕嗙洊breadcrumgroupbuttonsrc灞炴у硷紝 + if(!!menuitem&&menuitem.length>0){ + var mulsrc=menuitem.attr(newIPPort.menuCategoryID+"-multiInsrc"); + if(!!mulsrc){ + menuitem.attr("breadcrumgroupbuttonsrc" ,mulsrc); + getBreadcrumbRightButtons(mulsrc,true); + } + } + if (waittime) { + clearInterval(waittime); + } + waittime = setInterval(function () { + if(moreMenusisLoaded==true){ + clearInterval(waittime); + openoFrameWork.goToURLByIDAndNewAction(id,newActionStr,null); + } + }, 10); + }, + goToURLByIDAndNewAction:function(id,newActionStr,newBrowserPageOption){ + if(!id){ + return; + } + + /*if(id.indexOf("#")<0){ + id="#"+id; + }*/ + var menuitem = this.findMenuItemByMenuId(id); + //澶勭悊鏂板紑椤甸潰鎯呭喌 + if(newBrowserPageOption){ + var href = ICTFRAME_CONST_DEFAULTPAGE_PATH; + var hash = getLocationHashByMenuId(id); + var newin=window.open(href + newBrowserPageOption.paramStr + hash,newBrowserPageOption.windowTitle); + newin.name=newActionStr;//娉ㄦ剰杩欑浼犻掑弬鏁扮殑鏂规硶锛岃鎵撳紑鐨勯〉闈腑闇瑕侀氳繃top.name涓幏鍙栬浼犻掔殑鍙傛暟銆 + return; + } + //$(window).off('hashchange', loadCurrentHash); + var menuItemID=menuitem?menuitem.attr("id"):""; + if(!!menuItemID&&menuItemID.length>0){ + //menuItemID="#" + menuItemID; + //menuItemID=!!newActionStr?menuItemID:menuItemID+"/no"; + _setLocationHash(menuItemID); + } + var breadcrumbBtnMenuItemParent=""; + if(!menuitem||menuitem.length<=0){//娌℃湁鎵惧埌璇ヨ彍鍗曪紝鍙兘鏄潰鍖呭墛涓殑锛岄渶瑕侀澶栧鐞 + menuItemID=id; + if (breadcrumbBtnMenus.contains(menuItemID)) {//鏈夌紦瀛 + breadcrumbBtnMenuItemParent=breadcrumbBtnMenus.items(menuItemID); + menuitem=this.findMenuItemByMenuId(breadcrumbBtnMenuItemParent); + //_breadcrumbSource=true; + } + // else{//鍦ㄦ柊澧炵殑鍙炕椤电殑鏇村鑿滃崟閲岄潰鎵 + // var pageDiv = $('#pageableDiv'); + // menuitem=$('#' + menuItemID , pageDiv); + // } + if( menuitem && menuitem.length > 0){ + isMoreMenuItemClick = true; + } + } + if(!menuitem||menuitem.length<=0){ + //闈㈠寘灞戝拰涓昏彍鍗曢兘娌℃湁鎵惧埌锛屾儏鍐靛彲鑳芥槸锛氭洿澶氳彍鍗曠偣鍑绘墦寮鍚庯紝鍒锋柊锛宧ash宸茬粡鏇存敼锛屼絾鏄搴旂殑鏇村鑿滃崟鐨刪tml娌℃湁鍔犺浇锛岄渶瑕佹壘鍒版洿澶氳彍鍗曞拰涓昏彍鍗曠殑瀵瑰簲鍏崇郴 + var mainMenuId = this.getMenuItemId_From_MoreMenuRelation( id ); + if( mainMenuId ){ + menuitem = this.findMenuItemByMenuId(mainMenuId); + } + + } + if (store&&store("globleCurrentBreadcrumb")){ + globleCurrentBreadcrumb=store("globleCurrentBreadcrumb"); + //涓嬮潰澶勭悊涓嬪埛鏂版暣涓〉闈㈠悗浠巆ookie涓幏鍙栨潵鐨勬渶鍚庝竴娆℃搷浣滅殑闈㈠寘灞戝搴旂殑瀵瑰簲鑿滃崟鐨刵ame灞炴у洖鍐欙紝渚夸簬闈㈠寘灞戜簨浠跺搷搴旇兘澶熸壘鍒板搴旂殑鑿滃崟 + var al=$("a",$("
    "+globleCurrentBreadcrumb+"
    ")); + var alink,gal; + for(i=0;i0){ + var panel = $('.zte-theme-panel'); + var navPosOption = $('.nav-pos-direction', panel).val(); + if(navPosOption === openoFrameWork_menu_fmenu){ + var hparentid=menuitem.attr("hparentid"); + var id=menuitem.attr("id"); + var i=0,menuItemH=menuitem; + while (id!=hparentid&&i<20){ + menuItemH=openoFrameWork.findMenuItemByMenuId(hparentid); + hparentid=menuItemH.attr("hparentid"); + id=menuItemH.attr("id"); + i++; + }; + if(!menuItemH.hasClass('active')) + menuItemH.parent().addClass("active"); + } + }else{ + console.log("goToURLByIDAndNewAction():Can't find the menuitem.The menu ID is:"+id+".Please check if the ID or ID cache is correct."); + } + //try{ + var parm=undefined; + if(!!newActionStr&&breadcrumbBtnMenuItemParent&&breadcrumbBtnMenuItemParent.length>0){ + parm={action:newActionStr,breadcrumbBtnMenuItem:menuItemID}; + }else if(!!newActionStr){ + parm={action:newActionStr}; + }else if(breadcrumbBtnMenuItemParent&&breadcrumbBtnMenuItemParent.length>0){ + parm={breadcrumbBtnMenuItem:menuItemID}; + }else if(mainMenuId){ + isMoreMenuItemClick = true; + parm={breadcrumbBtnMenuItem:menuItemID}; + } + //if(breadChangeType){ + // if(!parm){ + // parm = {}; + // } + // parm.breadChangeType = breadChangeType; + //} + if(parm&&parm.action || parm&&parm.breadChangeType) { + _hashSource="dhByInterface"; + } + + if(menuitem&&menuitem.length>0){ + menuitem.one('click',parm,function(e){ //涓存椂涓娆℃х殑娉ㄥ唽涓娆lick浜嬩欢澶勭悊鍑芥暟锛屾墽琛屽畬姣曚細鑷姩鍒犻櫎 + openoFrameWork.dealAtoIframe($(this),e); + //$(window).one('hashchange', loadCurrentHash); + return false; + }); + menuitem.click();//鍚庢墽琛 + } + /*}catch(e){} + finally{ + //$(window).on('hashchange', loadCurrentHash); + }*/ + }, + + getBreadcrumbEle:function(){ + return $('.breadcrumbUl')[0]; + }, + + + findMenuItemByMenuId:function( id ){ + var menuitem=undefined; + var panel = $('.zte-theme-panel'); + var navPosOption = $('.nav-pos-direction', panel).val(); + + var items = undefined; + if (navPosOption === "vertical"){ //浠庡瀭鐩磋彍鍗曢噷闈㈡壘 + items=$("#page-sidebar-menu a[id='"+id+"']"); + }else if(navPosOption === openoFrameWork_menu_horizontal){//浠庢按骞宠彍鍗曢噷闈㈡壘 + items=$("#main_hormenu a[id='"+id+"']"); + if(items.length == 0){ + //妯彍鍗曟病鏈夋壘鍒帮紝鍐嶅湪妯彍鍗曠殑瀛愯彍鍗曟壘涓娆 + items=$("#page-megachild-sidebar-menu a[id='"+id+"']"); + } + }else if(navPosOption === openoFrameWork_menu_fmenu){ + items=$("#f_hormenu a[id='"+id+"']"); + if(items.length == 0){ + //妯彍鍗曟病鏈夋壘鍒帮紝鍐嶅湪绔栬彍鍗曟壘涓娆° + items=$("#page-f-sidebar-menu a[id='"+id+"']"); + + } + + } + if( items&&items.length == 0 ){ + console.log( 'fmenu alink length is :' + $("#page-f-sidebar-menu a").length ); + console.log( 'cant find menu in sidemenu銆乵egamenu and fmenu , the menu id is ' + id ); + } + if(items&&items.length>0){ + for(var i=0;i0){ + for(var i=0;i 0) { + parm = { + breadcrumbBtnMenuItem : menuItemID + }; + } + if (menuitem && menuitem.length > 0) { + menuitem.one('click', parm, function (e) { //涓存椂涓娆℃х殑娉ㄥ唽涓娆lick浜嬩欢澶勭悊鍑芥暟锛屾墽琛屽畬姣曚細鑷姩鍒犻櫎 + var containerStr = $(this).parentsUntil('.page-container').hasClass('page-sidebar') ? 'page-sidebar' : ""; // + containerStr = $(this).parentsUntil('.header-inner').hasClass('hor-menu') ? 'header' : containerStr; + _isClicked = false; + dealMenuItemGetFocus($(this),e,containerStr); + return false; + }); + menuitem.click(); //鍚庢墽琛 + } + }, + // 澶勭悊闈㈠寘鍓婁腑鐨勬寜閽彍鍗曞鍔犵殑瀵艰埅杩炴帴锛屾樉绀哄湪iframe涓 + openbreadcrumbLink:function(aObject,e) { + var url = aObject.attr("href"); + if(!url||url.length<2) + return; + e.preventDefault(); + dealScrollTo(); + var menuItemID=aObject.attr("id"); + if(!!menuItemID&&menuItemID.length>0){ + _setLocationHash(menuItemID); + _hashSource="dhByInterface"; + } + dealstartPageLoading(); + dealIframe(aObject,e); + }, + getURLParam:function(name){ + var reg = new RegExp("(^|&)" + name.toLowerCase() + "=([^&]*)(&|$)"); //鏋勯犱竴涓惈鏈夌洰鏍囧弬鏁扮殑姝e垯琛ㄨ揪寮忓璞 + var search =decodeURIComponent(location.search.substring(1)).toLowerCase(); + var r =search.match(reg); //鍖归厤鐩爣鍙傛暟 + if (r != null) return unescape(r[2]); + return null; //杩斿洖鍙傛暟鍊 + } + }; +}(); + +//鎶藉彇html鐗囨涓换鎰忎綅缃殑script鏍囩锛堝寘鎷唬鐮佹槸鍐呭祵鐨勬儏鍐碉級閫愪釜杩愯锛堜笉浼氬湪鍗曚釜script鍔犺浇涓嶅埌鐨勬椂鍊欏仠涓嬫潵锛 +function runHtmlScripts(s) { + var div = document.createElement('div'); + div.innerHTML = s; + var scripts = div.getElementsByTagName('script'); + + var currentRunningScriptSrcPath = {}; + $(scripts).each(function() { + var src = this.src; + src = openoFrameWork.handlBaseURL(src); + if (src) { + currentRunningScriptSrcPath[src.substring(src.lastIndexOf("/") + 1)] = src.substring(0, src.lastIndexOf("/") + 1); + $.getScript(src); + } else { + $.globalEval(this.text || this.textContent || this.innerHTML || ''); + } + }); +}; + +function stripHtmlScripts(htmlContent) { + var divContent = document.createElement('div'); + divContent.innerHTML = htmlContent; + var scripts = divContent.getElementsByTagName('script'); + + $(scripts).each(function() { + this.src = openoFrameWork.handlBaseURL(this.src); + this.parentNode.removeChild(this); + }); + return divContent.innerHTML; +}; + +function getsiderBarMenu(url){ + if (url.length<2){ + return; + } + url=openoFrameWork.handlBaseURL(url); + openoFrameWork.startPageLoading();//鑿滃崟鍔犺浇涓绋嶅.... + var pagesidebar=$('#page-sidebar-menu'); + pagesidebar.empty(); + pagesidebar.append(""); + $.ajax({ + type: "GET", + cache: false, + url: url, + dataType: "html", + success: function (res) { + //鍘婚櫎script鏍囩浠ュ悗娣诲姞鍒颁富妗嗘灦浠ラ槻姝ppend鏂规硶鍥犱负鍔犺浇script鏍囩澶辫触瀵艰嚧鍚庨潰鐨勪唬鐮佹棤娉曡繍琛 + //res = stripHtmlScripts(res); + var resScriptsSriped = stripHtmlScripts(res); + pagesidebar.append(resScriptsSriped); + runHtmlScripts(res); + + siderBarMenuAuthentication(); + dealMysqlBackupMenu(); + //loadi18n_WebFramework_sideMenu(); + setTimeout(function () { + openoFrameWork.stopPageLoading(); + goToHomePage(); + }, 1000); + }, + error: function (xhr, ajaxOptions, thrownError) { + //$('#page-sidebar-menu').append('');//鍔犺浇绯荤粺鑿滃崟澶辫触!;//鍔犺浇绯荤粺鑿滃崟澶辫触! + } + }); +}; +var setLayoutValueByCookie = function () { + var panel = $('.zte-theme-panel'); + if (store('layout-option') != undefined) { + $('.layout-option', panel).val(store('layout-option')); + } + if (store('language-option') != undefined) { + $('.language-option', panel).val(store('language-option')); + } + if (store('sidebar-option') != undefined) { + $('.sidebar-option', panel).val(store('sidebar-option')); + } + if (store('header-option') != undefined) { + $('.header-option', panel).val(store('header-option')); + } + if (store('sidebar-pos-option') != undefined) { + $('.sidebar-pos-option', panel).val(store('sidebar-pos-option')); + } + var horMenuLoadTip = $("[class='nav-load-error']", $(".hormenu")); + var sideMenuLoadTip = $("[class='nav-load-error']", $("[class='page-sidebar-menu']")); + // 妯珫鑿滃崟閮芥棤閿欒鎻愮ず,閮芥纭姞杞 + // if ((!horMenuLoadTip || horMenuLoadTip.length <= 0) && (!sideMenuLoadTip || sideMenuLoadTip.length <= 0)) { + // if (store('nav-pos-direction') != undefined) { + // var navPosOption = store('nav-pos-direction'); + // $('.nav-pos-direction', panel).val(navPosOption); + // } else { + $('.nav-pos-direction', panel).val('fmenu'); + // $.ajax({ + // "dataType" : 'json', + // "type" : "GET", + // "async" : false, + // url : FrameConst.REST_GET_FRAME_MENUDIRECTION + "&tmpstamp=" + new Date().getTime(), + // "success" : function (obj) { + // if (obj.value && (obj.value != "")) { + // $('.nav-pos-direction', panel).val(obj.value); + // } + // } + // }); + //} + // } else { + // $('.nav-pos-direction', panel).attr("disabled", true); + // } +}; + + +function iniFMenu() { + var fsidemenu = $('#' + fMenuSiderDivId); + + if (fsidemenu) { + openoFrameWork.startPageLoading(); + + var menuContent = initLeftMenu(); + fsidemenu.empty(); + fsidemenu.append(""); + fsidemenu.append(menuContent); + loadi18n_WebFramework('web-framework-menu-i18n', 'i18n/', 'openo_frame_left_menu_i18n'); + + openoFrameWork.stopPageLoading(); + } +}; + +function goToHomePage(){ + locationhash = openoFrameWork.getLocationHash(); + if(!!locationhash&&locationhash.length>0){//鏈夐敋鐐癸紝鐩存帴瑙﹀彂 + var newIPPort=null; + if (store&&store('menuCategoryID')) { + var s=store('menuCategoryID').split('[menuCategoryID]'); + if(s.length>2){ + newIPPort={menuCategoryID:s[0],ipPortStr:s[1],newTitle:s[2]}; + } + } + if(!!newIPPort){ + openoFrameWork.goToURLByIDAndNewIPPort(locationhash,newIPPort,null); + }else{ + openoFrameWork.goToURLByIDAndNewAction(locationhash,null,null); + } + }else{//鍚﹀垯杩樻槸妯℃嫙鐐瑰嚮閰嶇疆浜唖tart绫荤殑鑿滃崟 + var containerStr = ""; + //var sidermenu = $("[class='page-sidebar-menu']", $("[class='page-sidebar navbar-collapse collapse']")); + var sidermenu = $("#page-sidebar-menu"); + var hormenu = $("#main_hormenu"); + var fhormenu = $('#' + fMenuMegaDivId); + var fhormenusider = $('#page-f-sidebar-menu'); + var startmenu = null; + var navPosOption = $('.nav-pos-direction', panel).val(); + // 渚ц竟鏍忔樉绀猴紝鏍规嵁渚ц竟鏍廋SS閫夋嫨 + if (navPosOption === "vertical") { + //containerStr=$('.page-sidebar').length>0?'.page-sidebar':""; + startmenu = $('.iframe.start' , sidermenu); + dealStartMenu( startmenu, sidermenu ); + } + // 姘村钩鑿滃崟鏄剧ず锛屾牴鎹按骞宠彍鍗旵SS閫夋嫨 + else if (navPosOption === "horizontal") { + //containerStr=$('.hor-menu').length>0?'.header':containerStr; + startmenu = $('.iframe.start' , hormenu); + dealStartMenu( startmenu, hormenu ); + + } + //F鑿滃崟鐨勬亽鑿滃崟鏄剧ず + else if (navPosOption === openoFrameWork_menu_fmenu) { + //containerStr=$('.hor-menu').length>0?'.header':containerStr; + startmenu = $('.iframe.start' ,fhormenu); + if (startmenu && startmenu.length < 1) { + startmenu = $('.iframe.start' ,fhormenusider); + } + dealStartMenu( startmenu, fhormenu,fhormenusider ); + } + } +}; +var dealStartMenu = function(startmenu , menuContainer,menuContainer2 ){ + var timer =setInterval(function () { + if(startmenu&&startmenu.length>0){ + startmenu.click(); + clearInterval(timer); + }else{ + console.log('the start menu click event is not be triggerd ,so do it repeat!!'); + $('a[operation]', menuContainer).each(function () { + startmenu = $(this); + return false; + }); + if (menuContainer2&&startmenu && startmenu.length < 1) { + $('a[operation]', menuContainer2).each(function () { + startmenu = $(this); + return false; + }); + } + } + }, 100); + handeCtxMenuitem(); + } +// 灞忚斀妯珫鑿滃崟椤圭殑鍙抽敭鍔熻兘 +function handeCtxMenuitem() { + $(".page-sidebar ul li a").each(function() { + if ($(this).attr("href") && $(this).attr("href") != "javascript:;" && $(this).attr("href") != "#") { + $(this).attr("oncontextmenu", "return false"); + } + }); + $(".hormenu li a").each(function() { + if ($(this).attr("href") && $(this).attr("href") != "javascript:;" && $(this).attr("href") != "#") { + $(this).attr("oncontextmenu", "return false"); + } + }); +} +function initBaseInfo(){ + $("#logout_label").text($.i18n.prop('com_zte_ums_ict_framework_ui_group_logout')); + $("#fullscreen_label").text($.i18n.prop('com_zte_ums_ict_framework_ui_group_fullscreen')); + $("#changePwd_label").text($.i18n.prop('com_zte_ums_ict_framework_ui_changePwd')); + $("#com_zte_ums_ict_framework_moudle_about").text($.i18n.prop('com_zte_ums_ict_framework_moudle_about')); + $("#com_zte_ums_ict_framework_moudle_help").text($.i18n.prop('com_zte_ums_ict_framework_moudle_help')); + $("#zte_menu-toggler").attr("title",$.i18n.prop('com_zte_ums_ict_framework_moudle_menutoggler')); +}; +window.closeModal = function(modalid) { + if(!modalid){ + return; + } + if(modalid.indexOf("#")<0){ + modalid="#"+modalid; + } + $(modalid).modal('hide'); +}; +function getLcsRight(lcsoperations) { + var lcsrights = new Array(); + if (lcsoperations && (lcsoperations.length > 0)) { + // 璇锋眰鍚庡彴license value + //----test data---- + // var testjson = '{"data":[{"id":"mylcs","name":"xxx","value":"false"}]}'; + // var testopt = eval('(' + testjson + ')'); + // var testarray = testopt.data; + //-----end test data--- + var keys = { + "keys" : lcsoperations + }; + var jsonvalues = JSON.stringify(keys); + var data = { + "data" : jsonvalues + }; + var url=FrameConst.REST_GETLICENSEINFO + "?tmpstamp=" + new Date().getTime(); + url=openoFrameWork.handlBaseURL(url); + $.ajax({ + "dataType" : 'json', + "type" : "GET", + "async" : false, + "url" : url, + "data" : data, + //"contentType" : 'application/json; charset=utf-8', + "success" : function (response) { + if (response) { + lcsrights = response.data; + } + }, + "error" : function (XMLHttpRequest, textStatus, errorThrown) { + lcsrights = null; + } + }); + return lcsrights; + } + return lcsrights; +} +// 渚ц竟鏍忚彍鍗曢壌鏉 +function siderBarMenuAuthentication() { + // license 閴存潈 + var menuids = new Array(); + var lcsoperations = new Array(); + //浠庨〉闈OM鍙栧緱鑿滃崟license椤广 + $('a[licenseid]', $('.page-sidebar-menu')).each(function () { + var licenseid = $(this).attr("licenseid"); + if (licenseid) { + lcsoperations.push(licenseid); + var id = $(this).attr("id"); + menuids.push(id); + } + }); + var lcsrights = getLcsRight(lcsoperations);// 鍙栧緱license鏁版嵁銆 + if (lcsrights && (lcsrights.length == menuids.length)) { + // 鏍规嵁鍚庡彴license鍊煎垽鏂墍鍦ㄨ彍鍗曢」鏄惁鏄剧ず + for (var i = 0; i < menuids.length; i++) { + var id = menuids[i]; + var lcskey = lcsoperations[i]; + var lcsitem = lcsrights[i]; + // 鑿滃崟椤瑰鏋滈厤浜唋icenseid, 骞朵笖涓嶆槸true瀛楃涓, 鍒欑Щ闄よ彍鍗曢」 + if (lcsitem.value != "True") { + $('#'+id, $('.page-sidebar-menu')).parent().remove(); + } + } + } + var operations = new Array(); + $('a[operation]', $('.page-sidebar-menu')).each(function () { + var operation = $(this).attr("operation"); + if (operation) { + operations.push(operation); + } + }); // 閬嶅巻鑿滃崟椤癸紝鎻愬彇鎵鏈夌殑鎿嶄綔鐮 + var rightObj = getAllOperCodeRights(operations); // 瀵规搷浣滅爜杩涜閴存潈鍒ゆ柇 + $('a[operation]', $('.page-sidebar-menu')).each(function () { + var operation = $(this).attr("operation"); + if (operation) { + if (!hasRight(operation, rightObj)) { + $(this).parent("li").remove(); // 鍒犻櫎娌℃湁鏉冮檺鐨勮彍鍗曢」 + } + } + }); + rebuildSiderBarMenu(); +}; +// 妯悜鑿滃崟鏍忛壌鏉 +function horMenuAuthentication( horMenuId ) { + // license 閴存潈 + var menuids = new Array(); + var lcsoperations = new Array(); + //浠庨〉闈OM鍙栧緱鑿滃崟license椤广 + $('a[licenseid]', $('#'+ horMenuId)).each(function () { + var licenseid = $(this).attr("licenseid"); + if (licenseid) { + lcsoperations.push(licenseid); + var id = $(this).attr("id"); + menuids.push(id); + } + }); + var lcsrights = getLcsRight(lcsoperations);// 鍙栧緱license鏁版嵁銆 + if (lcsrights && (lcsrights.length == menuids.length)) { + // 鏍规嵁鍚庡彴license鍊煎垽鏂墍鍦ㄨ彍鍗曢」鏄惁鏄剧ず + for (var i = 0; i < menuids.length; i++) { + var id = menuids[i]; + var lcskey = lcsoperations[i]; + var lcsitem = lcsrights[i]; + // 鑿滃崟椤瑰鏋滈厤浜唋icenseid, 骞朵笖涓嶆槸true瀛楃涓, 鍒欑Щ闄よ彍鍗曢」 + if (lcsitem.value != "True") { + $('#'+id, $('#'+ horMenuId)).parent().remove(); + } + } + } + var operations = new Array(); + $('a[operation]', $('#'+ horMenuId)).each(function () { + var operation = $(this).attr("operation"); + if (operation) { + operations.push(operation); + } + }); // 閬嶅巻鑿滃崟椤癸紝鎻愬彇鎵鏈夌殑鎿嶄綔鐮 + var rightObj = getAllOperCodeRights(operations); // 瀵规搷浣滅爜杩涜閴存潈鍒ゆ柇 + $('a[operation]', $('#'+ horMenuId)).each(function () { + var operation = $(this).attr("operation"); + if (operation) { + if (!hasRight(operation, rightObj)) { + $(this).parent("li").remove(); // 鍒犻櫎娌℃湁鏉冮檺鐨勮彍鍗曢」 + } + } + }); + rebuildHorMenu(); +}; + +// 鈥滄洿澶氭搷浣溾濆垎缁勬寜閽壌鏉 +function groupButtonAuthentication() { + // license 閴存潈 + var menuids = new Array(); + var lcsoperations = new Array(); + //浠庨〉闈OM鍙栧緱鑿滃崟license椤广 + $('a[licenseid]', $('.more-botton-zone > li.btn-group')).each(function () { + var licenseid = $(this).attr("licenseid"); + if (licenseid) { + lcsoperations.push(licenseid); + var id = $(this).attr("id"); + menuids.push(id); + } + }); + var lcsrights = getLcsRight(lcsoperations);// 鍙栧緱license鏁版嵁銆 + if (lcsrights && (lcsrights.length == menuids.length)) { + // 鏍规嵁鍚庡彴license鍊煎垽鏂墍鍦ㄨ彍鍗曢」鏄惁鏄剧ず + for (var i = 0; i < menuids.length; i++) { + var id = menuids[i]; + var lcskey = lcsoperations[i]; + var lcsitem = lcsrights[i]; + // 鑿滃崟椤瑰鏋滈厤浜唋icenseid, 骞朵笖涓嶆槸true瀛楃涓, 鍒欑Щ闄よ彍鍗曢」 + if (lcsitem.value != "True") { + $('#'+id, $('.more-botton-zone > li.btn-group')).parent().remove(); + } + } + } + // 澧炲姞mysql鍒ゆ柇锛屽鏋滄暟鎹簱涓簃ysql锛屽幓鎺夊熀纭鏁版嵁澶囦唤鍔熻兘鑿滃崟椤 + var dbType = openoFrameWork_conf.dbType; + if (dbType == "mysql") { + $("#uep-ict-backup-baseDataBack",$('.more-botton-zone > li.btn-group')).parent().remove(); + } + var operations = new Array(); + $('a[operation]', $('.more-botton-zone > li.btn-group')).each(function () { + var operation = $(this).attr("operation"); + if (operation) { + operations.push(operation); + } + }); // 閬嶅巻鑿滃崟椤癸紝鎻愬彇鎵鏈夌殑鎿嶄綔鐮 + var rightObj = getAllOperCodeRights(operations); // 瀵规搷浣滅爜杩涜閴存潈鍒ゆ柇 + $('a[operation]', $('.more-botton-zone > li.btn-group')).each(function () { + var operation = $(this).attr("operation"); + if (operation) { + if (!hasRight(operation, rightObj)) { + $(this).parent("li").remove(); // 鍒犻櫎娌℃湁鏉冮檺鐨勮彍鍗曢」 + } + } + }); + // 濡傛灉鈥滄洿澶氳彍鍗曗濅笅娌℃湁瀛愯彍鍗曚簡锛屽垯鍒犻櫎鏁翠釜鈥滄洿澶氳彍鍗曗濅笅鎷夋銆 + if ($('li > a', $('.more-botton-zone > li.btn-group')).length == 0) { + $('.more-botton-zone > li.btn-group').remove(); + } +}; +// 鍒犻櫎娌℃湁瀛愯彍鍗曠殑涓绾ц彍鍗曪紝鏌ョ湅鏂拌彍鍗曟槸鍚﹂厤浜嗙櫥褰曢粯璁ら〉闈紝濡傛病鏈夊垯鎸囧畾绗竴涓湁鏉冮檺鐨勮彍鍗曚綔涓虹櫥褰曞悗榛樿椤甸潰 +function rebuildSiderBarMenu() { + if ($('a.start').length == 0) { + $('li > a[href!="javascript:;"]', $('.page-sidebar-menu')).eq(0).addClass("start"); + } + $('ul.sub-menu', $('.page-sidebar-menu')).each(function () { + if ($(this).has('li').length == 0) { + $(this).parent("li").remove(); + } + }); +}; +// 鍒犻櫎娌℃湁瀛愯彍鍗曠殑涓绾ц彍鍗曪紝鏌ョ湅鏂拌彍鍗曟槸鍚﹂厤浜嗙櫥褰曢粯璁ら〉闈紝濡傛病鏈夊垯鎸囧畾绗竴涓湁鏉冮檺鐨勮彍鍗曚綔涓虹櫥褰曞悗榛樿椤甸潰 +function rebuildHorMenu() { + if ($('a.start').length == 0) { + $('li > a[href!="#"]', $('#main_hormenu')).eq(0).addClass("start"); + } + $('ul.mega-menu-submenu', $('#main_hormenu')).each(function () { + if ($(this).has('li > a').length == 0) { + $(this).remove(); // 鍒犵┖鐨勫垎缁勫垪 + } + }); + //鍒犻櫎澧炲姞鐨勫垎缁刣iv + $('div.zteDivWidth', $('#main_hormenu')).each(function () { + if ($(this).has('ul').length == 0) { + $(this).remove(); // 鍒犵┖鐨勫垎缁勫垪 + } + }); + $('ul.dropdown-menu', $('#main_hormenu')).each(function () { + if ($(this).has('ul').length == 0) { + $(this).parent("li").remove(); // 鍒犵┖鐨勪竴绾ц彍鍗曟爮 + } + }); + $('li.divider', $('#main_hormenu')).each(function () { + if ($(this).next().hasClass('divider')) { + $(this).remove(); // 杩炵画鍑虹幇鍒嗛殧绾垮垯鍒犻櫎涓涓 + } + }); + $('li.divider', $('#main_hormenu')).each(function () { + if ($(this).next().length == 0) { + $(this).remove(); // 濡傛灉鍒嗛殧绾垮湪鏈鍚庝竴琛岋紝鍒欏垹闄や箣 + } + }); +} +//鑾峰彇椤甸潰鑿滃崟鏍忔墍鏈夌殑鎿嶄綔鐮佹潈闄 +function getAllOperCodeRights(operations) { + var rights = new Array(); + if( operations && operations.length > 0 ){ + var data = { + "operations" : operations + }; + var sendData = JSON.stringify(data); + var url=FrameConst.REST_CHECKRIGHT + "?data=" + sendData + "&tmpstamp=" + new Date().getTime(); + url=openoFrameWork.handlBaseURL(url); + $.ajax({ + "dataType" : 'json', + "type" : "GET", + "async" : false, + "url" : url, + "data" : null, + //"contentType" : 'application/json; charset=utf-8', + "success" : function (response) { + rights = response.value; + }, + "error" : function (XMLHttpRequest, textStatus, errorThrown) { + if (XMLHttpRequest.status == 401) { + window.location.replace("login.html"); + } else { + console.log('Communication Error!'); + } + } + }); + } + return { + opCodes : operations, + rights : rights + }; +}; +// 鍒ゆ柇鎿嶄綔鐮佹槸鍚︽湁鏉冮檺 +function hasRight(opCode, rightObj) { + for (var i = 0; i < rightObj.opCodes.length; i++) { + if (rightObj.opCodes[i] == opCode) { + return (rightObj.rights[i] == true); + } + } + return false; +}; +// 澶勭悊mysql鐜涓嬪浠借彍鍗曠殑鍚堝苟闂 +function dealMysqlBackupMenu() { + var dbType = openoFrameWork_conf.dbType; + if (dbType !== undefined && dbType !== "mysql") { + return; + } + var sidermenu = $("[class='page-sidebar-menu']"); + var hormenu = $(".hormenu"); + //杩欐浠g爜鍏堣繖涔堝啓,html鐨勪綅缃笉涓瀹氭纭紝濡傛灉鍚庨潰浣嶇疆涓嶄竴鑷达紝鍐嶄慨鏀广 + if (sidermenu.length > 0 && $('#uep-ict-backup-dataBackup').length > 0) { + $('#uep-ict-backup-dataBackup', sidermenu).attr("breadcrumGroupButtonSrc", ICTFRAME_CONST_DATABACKUP_PATH); + } + if (hormenu.length > 0 && $('#uep-ict-backup-dataBackup').length > 0) { + $('#uep-ict-backup-dataBackup', hormenu).attr("breadcrumGroupButtonSrc", ICTFRAME_CONST_DATABACKUP_PATH); + $('#uep-ict-backup-dataBackup').parent('li').attr('style', 'display:block'); + $('#uep-ict-backup-allDbStructBackup').parent('li').attr('style', 'display:none'); + $('#uep-ict-backup-baseDataBack').parent('li').attr('style', 'display:none'); + } +}; +// 娴忚鍣ㄧ缉灏忓悗瀵艰埅鏍忛殣钘忕殑鎯呭喌涓嬬偣鍑籲avbar-toggle鏄剧ず鑿滃崟鐨勫墠缃伐浣滐紝 +// 娴忚鍣ㄧ缉灏忓悗瀵艰埅鏍忛殣钘忕殑鎯呭喌涓嬬偣鍑籲avbar-toggle鏄剧ず鑿滃崟鐨勫墠缃伐浣滐紝 +function dealMavToggle(navtoggle) { + var sidermenu = $("#page-sidebar-menu"); + var hormenu = $("#main_hormenu"); + var panel = $(".zte-theme-panel"); + var siderbarpos = $(".nav-pos-direction", panel).val() + if ("hidden" == $(navtoggle).attr("navtoggledispattr")) { + $(navtoggle).attr("navtoggledispattr", "display"); + sidermenu.css('display','block');//渚ц竟鏍忔樉绀 + hormenu.css("display", "none");//闅愯棌姘村钩鑿滃崟鏍 + } else { + $(navtoggle).attr("navtoggledispattr", "hidden"); + sidermenu.css('display','none');//渚ц竟鏍忛殣钘 + hormenu.css("display", "none"); + } +}; diff --git a/common/src/main/webapp/thirdparty/js/core/pym.min.js b/common/src/main/webapp/thirdparty/js/core/pym.min.js new file mode 100644 index 00000000..78b2f513 --- /dev/null +++ b/common/src/main/webapp/thirdparty/js/core/pym.min.js @@ -0,0 +1,16 @@ +/* + * Copyright 2016, CMCC Technologies Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +(function(a){if(typeof define==="function"&&define.amd){define("pym",[],a)}else{if(typeof module!=="undefined"&&module.exports){module.exports=a()}else{window.pym=a.call(this)}}window.pym=a.call(this)})(function(){var a="xPYMx";function e(){var k,i;if(window.innerHeight&&window.scrollMaxY){k=window.innerWidth+window.scrollMaxX;i=window.innerHeight+window.scrollMaxY}else{if(document.body.scrollHeight>document.body.offsetHeight){k=document.body.scrollWidth;i=document.body.scrollHeight}else{k=document.body.offsetWidth;i=document.body.offsetHeight}}var j,l;if(self.innerHeight){if(document.documentElement.clientWidth){j=document.documentElement.clientWidth}else{j=self.innerWidth}l=self.innerHeight}else{if(document.documentElement&&document.documentElement.clientHeight){j=document.documentElement.clientWidth;l=document.documentElement.clientHeight}else{if(document.body){j=document.body.clientWidth;l=document.body.clientHeight}}}if(i-1){q=this.url.substring(n,this.url.length);this.url=this.url.substring(0,n)}if(this.url.indexOf("?")<0){this.url+="?"}else{this.url+="&"}this.iframe.src=this.url.trim().indexOf("javascript:")>=0?"":this.url+"initialWidth="+o+"&childId="+this.id;"&parentUrl="+encodeURIComponent(window.location.href)+q;this.iframe.setAttribute("width","100%");this.iframe.setAttribute("scrolling","no");this.iframe.setAttribute("marginheight","0");this.iframe.setAttribute("frameborder","0");this.el.appendChild(this.iframe);var p=this;window.addEventListener("resize",this._onResize)};this._onResize=function(){this.sendWidth()}.bind(this);this._fire=function(o,p){if(o in this.messageHandlers){for(var n=0;n0&&this.childpageType==="isc"){console.log("parent window detect that the child iframe page loaded smartclient,the iframe height will ignore the child's Height change message;");if(this.minHeightheight){m=l.oldHeight-height}else{m=height-l.oldHeight}if(m<=70){return}if(l.oldHeight!=height){l.oldHeight=height;console.log("child iframe id="+l.id+" sedHeight:"+height);l.sendMessage("height",height)}}.bind(this);this.scrollParentTo=function(m){this.sendMessage("navigateTo","#"+m)};this.navigateParentTo=function(m){this.sendMessage("navigateTo",m)};this.id=c("childId")||i.id;this.messageRegex=new RegExp("^pym"+a+this.id+a+"(\\S+)"+a+"(.+)$");var k=parseInt(c("initialWidth"));this.parentUrl=c("parentUrl");this.onMessage("width",this._onWidthMessage);for(var j in i){this.settings[j]=i[j]}var l=this;window.addEventListener("message",this._processMessage,false);if(this.settings.renderCallback){this.settings.renderCallback(k)}this.sendHeight();if(this.settings.polling){window.setInterval(this.sendHeight,this.settings.polling)}return this};d();return g}); -- cgit 1.2.3-korg