function ConfigManger(configPath) { var m_configPath = ""; var m_xmlDoc = null; if (configPath != null && configPath != "") m_configPath = configPath; else m_configPath = "config_local.xml"; if (m_configPath == null || m_configPath == "") return null; var xmlHelper = new XmlHelper(); var m_xmlDoc = xmlHelper.loadFileXml(m_configPath); //获取工具栏信息 if (m_xmlDoc == null) return null; //获取配置信息 this.GetConfigValue = function (keyName) { if (m_xmlDoc == null) return null; var data = m_xmlDoc.getElementsByTagName(keyName); //获得所有子节点 //var value = data[0].text; var xmlHelper = new XmlHelper(); var value = xmlHelper.getNodeValue(data[0]); return value; } } var xmlUtil; var xmlDoc; function GetConfigData(){ xmlUtil = new XMLUtil(); xmlDoc = xmlUtil.loadXmlFromFile(getRootPath_dc()+"/config/config_local.xml"); } function GetConfigValueByTagName(tagName) { if(isEmptyValue(xmlUtil)) GetConfigData(); var configNode = xmlDoc.getElementsByTagName(tagName); var stringUrl = xmlUtil.getNodeValue(configNode[0]); return stringUrl; } function getRootPath_web() { //获取当前网址,如: http://localhost:8083/uimcardprj/share/meun.jsp var curWwwPath = window.document.location.href; //获取主机地址之后的目录,如: uimcardprj/share/meun.jsp var pathName = window.document.location.pathname; var pos = curWwwPath.indexOf(pathName); //获取主机地址,如: http://localhost:8083 var localhostPaht = curWwwPath.substring(0, pos); //获取带"/"的项目名,如:/uimcardprj var projectName = pathName.substring(0, pathName.substr(1).indexOf('/') + 1); return (localhostPaht + projectName); } function getRootPath_dc() { var pathName = window.location.pathname.substring(1); var webName = pathName == '' ? '' : pathName.substring(0, pathName.indexOf('/')); if (webName == "") { return window.location.protocol + '//' + window.location.host; } else { return window.location.protocol + '//' + window.location.host + '/' + webName; } } function GetConfigDataByName(nodeName) { var nodeXml = xmlDoc.getElementsByTagName(nodeName); var nodeValue = xmlUtil.getNodeValue(nodeXml[0]); return nodeValue; }