diff options
Diffstat (limited to 'common/src/main/webapp/thirdparty/js/core')
5 files changed, 4652 insertions, 0 deletions
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 0000000..66bee91 --- /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 0000000..73ab7f2 --- /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<m; i++) { + var key = this._out(_.key(this._area, i)); + if (key !== undefined) { + if (fn.call(this, key, and || this.get(key)) === false) { + break; + } + } + if (m > _.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 <dev@jpillora.com> - 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 0000000..972e782 --- /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 = "<a href='javascript:'>" + + "<i class='{iconClass}'></i>" + + "<span id='{id}' name_i18n='{i18nName}' class='title'></span>" + + "<span class='selected'></span>" + + "<span class='arrow'></span>" + + "</a>"; + + var templateChild = "<li>" + + "<a href='{url}' class='iframe' id='{hrefId}'>" + + "<i class='{iconClass}'></i>" + + "<span id='{id}' name_i18n='{i18nName}'></span>" + + "</a>" + + "</li>"; + + 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 = "<ul class='sub-menu'>" + childMenuContent + "</ul>"; + + menuContent = menuContent + "<li>" + parentMenuContent + childMenuContent + "</li>"; + } + + 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 0000000..3b7e4b3 --- /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<arguments.length; i++) + s=s.replace(new RegExp("\\{"+i+"\\}","g"), arguments[i]); + return s; +}; +String.prototype.startWith=function(str){ + var reg=new RegExp("^"+str); + return reg.test(this); +}; +String.prototype.endWith=function(str){ + var reg=new RegExp(str+"$"); + return reg.test(this); +}; + +/*鍏ㄥ睆 鍙傝:http://www.alixixi.com/web/a/2015031794521.shtml */ +var s=!function(w,d){ + var fs={ + supportsFullScreen:false, + isFullScreen:false, + requestFullScreen:'', + exitFullScreen:'', + fullscreenchange:'', + prefix:'' + }, + aP=['webkit','moz','ms'], //opera 15 鏀寔鍏ㄥ睆鏄痺ebkit鍐呮牳 + len=aP.length, + i=0; + if(d.exitFullscreen){ + fs.supportsFullScreen=true + }else{ + for(; i<len; i++){ + if(d[aP[i]+'ExitFullscreen']||d[aP[i]+'CancelFullScreen']){ + fs.supportsFullScreen=true; + fs.prefix=aP[i]; + break + } + } + } + if(fs.supportsFullScreen){ + var p=fs.prefix; + fs.fullscreenchange=function(fn){ + d.addEventListener(p=='ms' ? 'MSFullscreenChange' : p+'fullscreenchange',function(){ + fn && fn() + },false) + }; + fs.fullscreenchange(function(){ + fs.isFullScreen=(function(p){ + switch (p) { + case '': + return d.fullscreen; + case 'webkit': + return d.webkitIsFullScreen; + case 'moz': + return d.mozFullScreen; + case 'ms': + return d.msFullscreenElement ? true : false + } + })(p) + }); + fs.requestFullScreen=function(elem){ + var elem=elem||d.documentElement; + try{ + p ? elem[p+'RequestFullScreen']() : elem.requestFullScreen() //chrome锛宖f锛屾爣鍑 + }catch(e){ + elem[p+'RequestFullscreen']() //elem.msRequestFullscreen + } + }; + fs.exitFullScreen=function(){ + try{ + p ? d[p+'ExitFullscreen']() : d.exitFullscreen() //ie锛屾柊鐗坈hrome鎴栨爣鍑 + }catch(e){ + d[p+'CancelFullScreen']() //鑰佺増chrome 鐏嫄 + } + } + } + w.screenfull=fs +}(window,document); +/* + * Purl (A JavaScript URL parser) v2.3.1 + * Developed and maintanined by Mark Perkins, mark@allmarkedup.com + * Source repository: https://github.com/allmarkedup/jQuery-URL-Parser + * Licensed under an MIT-style license. See https://github.com/allmarkedup/jQuery-URL-Parser/blob/master/LICENSE for details. + */ +;(function(factory) { + if (typeof define === 'function' && define.amd) { + define(factory); + } else { + window.purl = factory(); + } +})(function() { + var tag2attr = { + a : 'href', + img : 'src', + form : 'action', + base : 'href', + script : 'src', + iframe : 'src', + link : 'href', + embed : 'src', + object : 'data' + }, + + key = ['source', 'protocol', 'authority', 'userInfo', 'user', 'password', 'host', 'port', 'relative', 'path', 'directory', 'file', 'query', 'fragment'], // keys available to query + aliases = { 'anchor' : 'fragment' }, // aliases for backwards compatability + parser = { + strict : /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/, //less intuitive, more accurate to the specs + loose : /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/ // more intuitive, fails on relative paths and deviates from specs + }, + isint = /^[0-9]+$/; + + function parseUri( url, strictMode ) { + var str = decodeURI( url ), + res = parser[ strictMode || false ? 'strict' : 'loose' ].exec( str ), + uri = { attr : {}, param : {}, seg : {} }, + i = 14; + while ( i-- ) { + uri.attr[ key[i] ] = res[i] || ''; + } + // build query and fragment parameters + uri.param['query'] = parseString(uri.attr['query']); + uri.param['fragment'] = parseString(uri.attr['fragment']); + // split path and fragement into segments + uri.seg['path'] = uri.attr.path.replace(/^\/+|\/+$/g,'').split('/'); + uri.seg['fragment'] = uri.attr.fragment.replace(/^\/+|\/+$/g,'').split('/'); + // compile a 'base' domain attribute + uri.attr['base'] = uri.attr.host ? (uri.attr.protocol ? uri.attr.protocol+'://'+uri.attr.host : uri.attr.host) + (uri.attr.port ? ':'+uri.attr.port : '') : ''; + + return uri; + } + + function getAttrName( elm ) { + var tn = elm.tagName; + if ( typeof tn !== 'undefined' ) return tag2attr[tn.toLowerCase()]; + return tn; + } + + function promote(parent, key) { + if (parent[key].length === 0) return parent[key] = {}; + var t = {}; + for (var i in parent[key]) t[i] = parent[key][i]; + parent[key] = t; + return t; + } + + function parse(parts, parent, key, val) { + var part = parts.shift(); + if (!part) { + if (isArray(parent[key])) { + parent[key].push(val); + } else if ('object' == typeof parent[key]) { + parent[key] = val; + } else if ('undefined' == typeof parent[key]) { + parent[key] = val; + } else { + parent[key] = [parent[key], val]; + } + } else { + var obj = parent[key] = parent[key] || []; + if (']' == part) { + if (isArray(obj)) { + if ('' !== val) obj.push(val); + } else if ('object' == typeof obj) { + obj[keys(obj).length] = val; + } else { + obj = parent[key] = [parent[key], val]; + } + } else if (~part.indexOf(']')) { + part = part.substr(0, part.length - 1); + if (!isint.test(part) && isArray(obj)) obj = promote(parent, key); + parse(parts, obj, part, val); + // key + } else { + if (!isint.test(part) && isArray(obj)) obj = promote(parent, key); + parse(parts, obj, part, val); + } + } + } + + function merge(parent, key, val) { + if (~key.indexOf(']')) { + var parts = key.split('['); + parse(parts, parent, 'base', val); + } else { + if (!isint.test(key) && isArray(parent.base)) { + var t = {}; + for (var k in parent.base) t[k] = parent.base[k]; + parent.base = t; + } + if (key !== '') { + set(parent.base, key, val); + } + } + return parent; + } + + function parseString(str) { + return reduce(String(str).split(/&|;/), function(ret, pair) { + try { + pair = decodeURIComponent(pair.replace(/\+/g, ' ')); + } catch(e) { + // ignore + } + var eql = pair.indexOf('='), + brace = lastBraceInKey(pair), + key = pair.substr(0, brace || eql), + val = pair.substr(brace || eql, pair.length); + + val = val.substr(val.indexOf('=') + 1, val.length); + + if (key === '') { + key = pair; + val = ''; + } + + return merge(ret, key, val); + }, { base: {} }).base; + } + + function set(obj, key, val) { + var v = obj[key]; + if (typeof v === 'undefined') { + obj[key] = val; + } else if (isArray(v)) { + v.push(val); + } else { + obj[key] = [v, val]; + } + } + + function lastBraceInKey(str) { + var len = str.length, + brace, + c; + for (var i = 0; i < len; ++i) { + c = str[i]; + if (']' == c) brace = false; + if ('[' == c) brace = true; + if ('=' == c && !brace) return i; + } + } + + function reduce(obj, accumulator){ + var i = 0, + l = obj.length >> 0, + curr = arguments[2]; + while (i < l) { + if (i in obj) curr = accumulator.call(undefined, curr, obj[i], i, obj); + ++i; + } + return curr; + } + + function isArray(vArg) { + return Object.prototype.toString.call(vArg) === "[object Array]"; + } + + function keys(obj) { + var key_array = []; + for ( var prop in obj ) { + if ( obj.hasOwnProperty(prop) ) key_array.push(prop); + } + return key_array; + } + + function purl( url, strictMode ) { + if ( arguments.length === 1 && url === true ) { + strictMode = true; + url = undefined; + } + strictMode = strictMode || false; + url = url || window.location.toString(); + + return { + data : parseUri(url, strictMode), + // get various attributes from the URI + attr : function( attr ) { + attr = aliases[attr] || attr; + return typeof attr !== 'undefined' ? this.data.attr[attr] : this.data.attr; + }, + // return query string parameters + param : function( param ) { + return typeof param !== 'undefined' ? this.data.param.query[param] : this.data.param.query; + }, + + // return fragment parameters + fparam : function( param ) { + return typeof param !== 'undefined' ? this.data.param.fragment[param] : this.data.param.fragment; + }, + // return path segments + segment : function( seg ) { + if ( typeof seg === 'undefined' ) { + return this.data.seg.path; + } else { + seg = seg < 0 ? this.data.seg.path.length + seg : seg - 1; // negative segments count from the end + return this.data.seg.path[seg]; + } + }, + // return fragment segments + fsegment : function( seg ) { + if ( typeof seg === 'undefined' ) { + return this.data.seg.fragment; + } else { + seg = seg < 0 ? this.data.seg.fragment.length + seg : seg - 1; // negative segments count from the end + return this.data.seg.fragment[seg]; + } + } + }; + } + purl.jQuery = function($){ + if ($ != null) { + $.fn.url = function( strictMode ) { + var url = ''; + if ( this.length ) { + url = $(this).attr( getAttrName(this[0]) ) || ''; + } + return purl( url, strictMode ); + }; + $.url = purl; + } + }; + purl.jQuery(window.jQuery); + return purl; +}); +//鎶婃鏋舵墍鏈夌殑ajax璇锋眰闆嗕腑鍒颁竴璧凤紝鍙戜竴鏉¤姹傦紝鑾峰彇鎵鏈夌殑閰嶇疆淇℃伅銆 +openoFrameWork_conf = { + userName:store("loginUserName"), + changePassItem:FrameConst.change_pass?FrameConst.change_pass:true, + helpMenuItem:false, + aboutMenuItem:false, + flightMenuItem:false, + fullscreenMenuItem:true, + logoutMenuItem:true, + defaultThemeColor:"ztebluelight2", + dbType:"other", + acceptLanguage:"en-US" +}; +$("#currentUser").html(openoFrameWork_conf.userName); + +$.ajax({ + url : FrameConst.REST_FRAMECOMMIFO, + type : "GET", + cache:false, + contentType : 'application/json; charset=utf-8', + success: function(data){ + var tempConf = data; + if( tempConf.helpMenuItem && tempConf.helpMenuItem != "" ){ + openoFrameWork_conf.helpMenuItem = tempConf.helpMenuItem; + } + if( tempConf.aboutMenuItem && tempConf.aboutMenuItem != "" ){ + openoFrameWork_conf.aboutMenuItem = tempConf.aboutMenuItem; + } + if( tempConf.flightMenuItem && tempConf.flightMenuItem != "" ){ + openoFrameWork_conf.flightMenuItem = tempConf.flightMenuItem; + } + if( tempConf.fullscreenMenuItem && tempConf.fullscreenMenuItem != "" ){ + openoFrameWork_conf.fullscreenMenuItem = tempConf.fullscreenMenuItem; + } + if( tempConf.logoutMenuItem && tempConf.logoutMenuItem != "" ){ + openoFrameWork_conf.logoutMenuItem = tempConf.logoutMenuItem; + } + if( tempConf.defaultThemeColor && tempConf.defaultThemeColor != "" ){ + openoFrameWork_conf.defaultThemeColor = tempConf.defaultThemeColor; + } + if( tempConf.dbType && tempConf.dbType != "" ){ + openoFrameWork_conf.dbType = tempConf.dbType; + } + if( tempConf.acceptLanguage && tempConf.acceptLanguage != "" ){ + openoFrameWork_conf.acceptLanguage = tempConf.acceptLanguage; + } + if( tempConf.changePassItem && tempConf.changePassItem != "" ){ + openoFrameWork_conf.changePassItem = tempConf.changePassItem; + } + + setFrameWorkByConf(); + //userName = data; + //console.info('login user is :' + data); + }, + error:function(data){ + setFrameWorkByConf(); + } +}); + +function setThemeColor( configColor ){ + var panel = $('.zte-theme-panel'); + $('.theme-colors > 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("<div>      </div>"); + } + 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('<div class="page-loading"><img src="'+ ICTFRAME_CONST_SPINNER_GIF_PATH +'"/> <span>' + (message ? message : $.i18n.prop('com_zte_ums_ict_framework_ui_loading')) + '</span></div>'); + } + 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("<div>      </div>"); + } + 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("<div id='"+pdiv+"' style='height:800px;overflow:auto'></div>"); + } + 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 = $('<div style="display:none"></div>'); + 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;i<items.length;i++){ + if($(items[i]).parentsUntil('.more-botton-zone .btn-group').hasClass('dropdown-menu')){ + menuitem=$(items[i]); + break; + } + if($(items[i]).parentsUntil('#pageableDiv').hasClass('row1')){ + menuitem=$(items[i]); + break; + } + } + } + if(!!menuitem&&menuitem.length>0) + dealBreadcrumbBtnMenuItemClick(menuitem,e); + } + }, + error: function (xhr, ajaxOptions, thrownError) {//鍔犺浇鎿嶄綔鑿滃崟澶辫触!com_zte_ums_ict_framework_ui_loadmenuerror + $('.page-breadcrumb').append('<h4>'+$.i18n.prop('com_zte_ums_ict_framework_ui_loadmenuerror')+'</h4>'); + 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+"<i class='fa fa-angle-right'></i>"+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+"<i class='fa fa-angle-right'></i>"+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("<i class='fa fa-angle-right'>",index); + var newBreadcrumb = globleCurrentBreadcrumb.substring(0,indexofSign) + "<i class='fa fa-angle-right'></i>"; + 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+"<i class='fa fa-angle-right'></i>"+mhmtl; + } + clieckedObj=clieckedObj.parents('li'); + } + + } + if(clieckedObj[0]&&clieckedObj[0].length>0) { + mhmtl=clieckedObj.children('a')[0].outerHTML+"<i class='fa fa-angle-right'></i>"+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+'<i class="fa fa-angle-right"></i>'+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<styles.length;i++){ + if(styles[i].indexOf(property)>=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('<span class="selected"></span>'); + }); + } + // 澧炲姞涓涓鏈嶅姟绔殑蹇冭烦 + 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('<div class="container"></div>'); + // set content + $('.page-container').appendTo('body > .container'); + // set footer + if (footerOption === 'fixed') { + $('.footer').html('<div class="container">' + $('.footer').html() + '</div>'); + } 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=$('<iframe id="ifm_Proxy" name="ifm_Proxy" oldproxyorigin="'+crossproxysrc+'" src="'+crossproxysrc+proxyHtmlPath+'" style="border: 0px; margin: 0px; padding: 0px; width: 100%; display:none;" ></iframe>'); + 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;i<ifmHeadlins.length;i++){ + if(typeof ifmHeadlins[i].link.href!== "undefined"){ + _src=ifmHeadlins[i].link.href; + linktyps.push("css"); + } + else if(typeof ifmHeadlins[i].link.src!== "undefined"){ + if(!!ifmHeadlins[i].link.src&&ifmHeadlins[i].link.src.length>0){ + _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;i<items.length;i++){ + if($(items[i]).parentsUntil('.header-inner').hasClass('hor-menu')){ + menuitem=$(items[i]); + break; + }else if($(items[i]).parentsUntil('.page-container').hasClass('page-sidebar')){ + menuitem=$(items[i]); + break; + }else if($(items[i]).parentsUntil('.more-botton-zone .btn-group').hasClass('dropdown-menu')){ + menuitem=$(items[i]); + isbreadcrumbMenuItem=true; + break; + }else if($(items[i]).parentsUntil('#pageableDiv').hasClass('row1')){ + menuitem=$(items[i]); + isbreadcrumbMenuItem=true; + break; + } + } + } + + if(menuitem&&menuitem.length>0){ + 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 = $('<a href="'+cssSrc+'"></a>'); + 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;i<ifmHeadlins.length;i++){ + var link=ifrm.contentDocument.getElementById(ifmHeadlins[i].link.id); + if(link){ + if(link.parentNode.tagName.toUpperCase==="HEAD"){ + ifrm.contentDocument.head.removeChild(link); + }else if(link.parentNode.tagName.toUpperCase==="HTML"){ + ifrm.contentDocument.removeChild(link); + } + } + if(ifmHeadlins[i].pos=="head") + ifrm.contentDocument.head.appendChild(ifmHeadlins[i].link); + else if (ifmHeadlins[i].pos=="bodyend") + ifrm.contentDocument.body.appendChild(ifmHeadlins[i].link); + else if (ifmHeadlins[i].pos=="htmlend") + ifrm.contentDocument.body.parentNode.appendChild(ifmHeadlins[i].link); + } + //瀵筰frame涓張鏈夊祵濂椾竴绾frame鐨勫湴鏂硅繘琛屽悓姝ワ紝鍙悓姝cope涓篴ll鐨 + var childifrms=ifrm.contentDocument.getElementsByTagName("iframe"); + if(childifrms&&childifrms.length>0){ + var ifmHeadlins2 = new Array(); + for (i=0;i<ifmHeadlins.length;i++){//绛涢夊嚭scope涓篴ll鐨 + if(ifmHeadlins[i].scope=="one") break; + ifmHeadlins2.push(ifmHeadlins[i]); + } + for(j=0;j<childifrms.length;j++){ + var parm={ifmHeadlins:ifmHeadlins2}; + var childOrign=openoFrameWork.getDomainURL(childifrms[j].src); + if(window.location.origin==childOrign){//鍚屽煙 + var ifrmload=function(e){ + for (i=0;i<e.data.ifmHeadlins.length;i++){ + var ifmheadlink=$(e.data.ifmHeadlins[i].link).clone()[0];////娉ㄦ剰杩欓噷蹇呴』鍏嬮殕锛屽惁鍒欎細鍑虹幇鍏冪礌绉诲姩锛屽墠闈frm娣诲姞鐨勯兘浼氳绉诲嚭 + var link=this.contentDocument.getElementById(ifmheadlink.id); + if(link){ + if(link.parentNode.tagName.toUpperCase==="HEAD"){ + this.contentDocument.head.removeChild(link); + }else if(link.parentNode.tagName.toUpperCase==="HTML"){ + this.contentDocument.removeChild(link); + } + } + if(e.data.ifmHeadlins[i].pos=="head"){ + this.contentDocument.head.appendChild(ifmheadlink); + }else if(e.data.ifmHeadlins[i].pos=="bodyend"){ + this.contentDocument.body.appendChild(ifmheadlink); + }else if (ifmHeadlins2[i].pos=="htmlend"){ + this.contentDocument.body.parentNode.appendChild(ifmheadlink); + } + } + } + $(childifrms[j]).off('onload',parm,ifrmload); + $(childifrms[j]).on('onload',parm,ifrmload); + $(childifrms[j]).trigger("onload"); + + }else{ + if(ifmHeadlins2.length>0){ + 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;i<pagesTags.length;i++){ + var tags=$(pagesTags[i]); + tags.removeClass('active'); + if($('.moreButtonSelected',tags).length>0){ + 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",$("<div>"+globleCurrentBreadcrumb+"</div>")); + var alink,gal; + for(i=0;i<al.length;i++){ + alink=$(al[i]); + gal=$("a[id='"+alink.attr("id")+"']");//浠庢暣涓〉闈㈡煡鎵 + for(j=0;j<gal.length;j++){ + $(gal[j]).attr("name",alink.attr("name")); + } + } + } + if(menuitem&&menuitem.length>0){ + 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;i<items.length;i++){ + if($(items[i]).parentsUntil('.header-inner').hasClass('hor-menu')){ + menuitem=$(items[i]); + break; + }else if($(items[i]).parentsUntil('.page-container').hasClass('page-sidebar')){ + menuitem=$(items[i]); + break; + } + } + } + return menuitem; + }, + + getMenuItemId_From_MoreMenuRelation:function( id ){ + var panel = $('.zte-theme-panel'); + var navPosOption = $('.nav-pos-direction', panel).val(); + var mainMenuId = null; + if (navPosOption === openoFrameWork_menu_vertical){ + relationAry=sideBarMenu_to_moreMenu_frame; + }else if(navPosOption === openoFrameWork_menu_horizontal){ + relationAry=horBarMenu_to_moreMenu_frame; + }else if(navPosOption === openoFrameWork_menu_fmenu){ + relationAry=horBarMenu_to_moreMenu_frame; + } + if ( !relationAry || !id ){ + return; + } + for ( var i = 0 ; i < relationAry.length ; i++ ){ + var eachMain = relationAry[i]; + var moreMenuIds = eachMain.moreMenuIds; + for ( var j = 0 ; j < moreMenuIds.length ; j++ ){ + if( moreMenuIds[j] && moreMenuIds[j] == id ){ + return eachMain.mainMenuId; + } + } + } + return null; + }, + + getMenuItemFoucsByID : function (id) { + if(!id){ + return; + } + 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+"']"); + }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.length>0){ + for(var i=0;i<items.length;i++){ + if($(items[i]).parentsUntil('.header-inner').hasClass('hor-menu')){ + menuitem=$(items[i]); + break; + }else if($(items[i]).parentsUntil('.page-container').hasClass('page-sidebar')){ + menuitem=$(items[i]); + break; + } + } + } + var breadcrumbBtnMenuItemParent=""; + if(!menuitem||menuitem.length<=0){//娌℃湁鎵惧埌璇ヨ彍鍗曪紝鍙兘鏄潰鍖呭墛涓殑锛岄渶瑕侀澶栧鐞 + menuItemID=id; + if (breadcrumbBtnMenus.contains(menuItemID)) {//鏈夌紦瀛 + breadcrumbBtnMenuItemParent="#"+breadcrumbBtnMenus.items(menuItemID); + menuitem=$(breadcrumbBtnMenuItemParent); + } + } + var parm = undefined; + if (breadcrumbBtnMenuItemParent && breadcrumbBtnMenuItemParent.length > 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("<li class='sidebar-toggler-wrapper'><div class='sidebar-toggler hidden-xs hidden-sm'></div></li>"); + $.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('<h4 class="nav-load-error">'+$.i18n.prop('com_zte_ums_ict_framework_ui_loadmenuerror')+'</h4>');//鍔犺浇绯荤粺鑿滃崟澶辫触!;//鍔犺浇绯荤粺鑿滃崟澶辫触! + } + }); +}; +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("<li class='sidebar-toggler-wrapper'><div class='sidebar-toggler hidden-xs hidden-sm'></div></li>"); + 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 0000000..78b2f51 --- /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<l){pageHeight=l}else{pageHeight=i}if(k<j){pageWidth=k}else{pageWidth=j}arrayPageSize=new Array(pageWidth,pageHeight,j,l);return arrayPageSize}var g={};var c=function(i){var k=new RegExp("[\\?&]"+i.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]")+"=([^&#]*)");var j=k.exec(location.search);if(j===null){return""}return decodeURIComponent(j[1].replace(/\+/g," "))};var b=function(j,i){if(i.xdomain!=="*"){if(!j.origin.match(new RegExp(i.xdomain+"$"))){return}}return true};var h=function(l,i,j){var k=["pym",l,i,j];return k.join(a)};var f=function(j){var i=["pym",j,"(\\S+)","(.+)"];return new RegExp("^"+i.join(a)+"$")};var d=function(){var n=document.querySelectorAll("[data-pym-src]:not([data-pym-auto-initialized])");var m=n.length;for(var i=0;i<m;++i){var l=n[i];l.setAttribute("data-pym-auto-initialized","");if(l.id===""){l.id="pym-"+i}var o=l.getAttribute("data-pym-src");var k=l.getAttribute("data-pym-xdomain");var j={};if(k){j.xdomain=k}new g.Parent(l.id,o,j)}};g.Parent=function(m,j,i){this.id=m;this.url=j;this.el=document.getElementById(m);this.iframe=null;this.minHeight="0";this._olddisplay="";this.oldHeight=0;this.childpageType="";this.setMinHeight=function(n){this.minHeight=n;this._onHeightMessage(n)};this.settings={xdomain:"*"};this.messageRegex=f(this.id);this.messageHandlers={};i=(i||{});this._constructIframe=function(){var o=this.el.offsetWidth.toString();this.iframe=document.createElement("iframe");var q="";var n=this.url.indexOf("#");if(n>-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;n<this.messageHandlers[o].length;n++){this.messageHandlers[o][n].call(this,p)}}};this.remove=function(){window.removeEventListener("message",this._processMessage);window.removeEventListener("resize",this._onResize);this.el.removeChild(this.iframe)};this._processMessage=function(q){if(!b(q,this.settings)){return}if(typeof q.data!=="string"){return}var n=q.data.match(this.messageRegex);if(!n||n.length!==3){return false}var o=n[1];var p=n[2];this._fire(o,p)}.bind(this);this._onHeightMessage=function(o){var n=parseInt(o);n=Math.max(this.minHeight,n);if(this.oldHeight!=n){if(this.childpageType&&this.childpageType.length>0&&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.minHeight<n){n=this.minHeight}}this.oldHeight=n;this.iframe.setAttribute("height",n+"px")}};this._onNavigateToMessage=function(n){document.location.href=n};this._onChildpageTypeMessage=function(n){this.childpageType=n};this.onMessage=function(n,o){if(!(n in this.messageHandlers)){this.messageHandlers[n]=[]}this.messageHandlers[n].push(o)};this.sendMessage=function(n,o){this.el.getElementsByTagName("iframe")[0].contentWindow.postMessage(h(this.id,n,o),"*")};this.sendWidth=function(){var n=this.el.offsetWidth.toString();this.sendMessage("width",n)};for(var k in i){this.settings[k]=i[k]}this.onMessage("height",this._onHeightMessage);this.onMessage("navigateTo",this._onNavigateToMessage);this.onMessage("childpageType",this._onChildpageTypeMessage);var l=this;window.addEventListener("message",this._processMessage,false);this._constructIframe();return this};g.Child=function(i){this.parentWidth=null;this.id=null;this.oldHeight=0;this.parentUrl=null;this.settings={renderCallback:null,xdomain:"*",polling:0};this.messageRegex=null;this.messageHandlers={};i=(i||{});this.onMessage=function(m,n){if(!(m in this.messageHandlers)){this.messageHandlers[m]=[]}this.messageHandlers[m].push(n)};this._fire=function(n,o){if(n in this.messageHandlers){for(var m=0;m<this.messageHandlers[n].length;m++){this.messageHandlers[n][m].call(this,o)}}};this._processMessage=function(p){if(!b(p,this.settings)){return}if(typeof p.data!=="string"){return}var m=p.data.match(this.messageRegex);if(!m||m.length!==3){return}var n=m[1];var o=m[2];this._fire(n,o)}.bind(this);this._onWidthMessage=function(n){var m=parseInt(n);if(m!==this.parentWidth){this.parentWidth=m;if(this.settings.renderCallback){this.settings.renderCallback(m)}this.sendHeight()}};this.sendMessage=function(m,n){window.parent.postMessage(h(this.id,m,n),"*")};this.sendHeight=function(){var n=document.getElementsByTagName("body")[0];height=n.offsetHeight;if(typeof isc!="undefined"&&l.oldPageType!="isc"){height=5;console.log("child iframe id="+l.id+" loaded smartclient");l.oldPageType="isc";l.sendMessage("childpageType","isc")}var m=0;if(l.oldHeight>height){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}); |