You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

549 lines
21 KiB

/// <reference name="MicrosoftAjax.js"/>
var Page_Modify = new Array();
var Page_PgName = new Array();
var Pages = new __Pages();
var CurrentPg = -1; //current window
var isDesktopProgram = false;
function __Pages() {
this._Wins = new Array();
this.Add = function __Add(pgid, pgname, pgPath) {
if (!this.Exist(pgid)) {
var Win = new Object();
Win.pgId = pgid;
Win.pgName = pgname;
Win.isModify = "no";
Win.pgPath = pgPath;
this._Wins.push(Win);
this._setArray();
}
}
this.Remove = function __Remove(pgid) {
var pgIndex = this.IndexOf(pgid);
if (pgIndex > -1) {
for (var i = 0; i < Page_Modify.length; i++) {
this._Wins[i].isModify = Page_Modify[i];
}
this._Wins.splice(pgIndex, 1);
this._setArray();
}
}
this.Exist = function __Exist(pgid) {
return (this.IndexOf(pgid) > -1);
}
this.Items = function __Items(pgid) {
var pgIndex = this.IndexOf(pgid)
if (pgIndex == -1)
return null;
else
return this._Wins[pgIndex];
}
this.IndexOf = function __IndexOf(pgid) {
for (var i = 0; i < this._Wins.length; i++) {
if (this._Wins[i].pgId == pgid) {
return i;
break;
}
}
return -1;
}
this._setArray = function __setArray() {
Page_PgName = new Array();
Page_Modify = new Array();
for (var i = 0; i < this._Wins.length; i++) {
Page_PgName.push(this._Wins[i].pgName);
Page_Modify.push(this._Wins[i].isModify);
}
if (this._Wins.length > 0) {
$get("tasksimg").src = "images/examine.png";
$get("taskstd").disabled = false;
$get("tasksspan").style.display = "block";
} else {
$get("tasksimg").src = "images/examine-d.png";
$get("taskstd").disabled = true;
$get("tasksspan").style.display = "none";
}
$get("tasksspan").innerHTML = this._Wins.length;
}
this.Count = function __Count() { return this._Wins.length; }
this.isEmpty = function __isEmpty() { return (this.Count == 0); }
}
function mousedown(thisTd) {
var imgs = thisTd.getElementsByTagName("IMG");
if (imgs.length > 0) {
imgs[0].style.width = (imgs[0].clientWidth - 2) + "px";
imgs[0].style.height = (imgs[0].clientHeight - 2) + "px";
thisTd.style.padding = "2px 2px 2px 2px";
}
}
function mouseup(thisTd) {
var imgs = thisTd.getElementsByTagName("IMG");
if (imgs.length > 0) {
imgs[0].style.width = "";
imgs[0].style.height = "";
thisTd.style.padding = "";
}
}
/*
*开启网页
*pghandle:网页的地址;pgid:网页代号;pgname:网页的路径;isdp:是否为桌面快捷方式;
*例如:loadpg('../common/pghandle7.aspx','CRM010113','客戶履歷查詢','客戶關係>>客戶管理>>客戶履歷查詢')
*/
var pTimer = null;
function loadpg(pghandle, pgid, pgname, programPath, isdp) {
isDesktopProgram = isdp ? true : false;
var _programDiv = document.getElementById("ProgramDiv");
var oIframe = document.getElementById("iframe_" + pgid);
// _programDiv.style.height = $get("TopClassDiv").clientHeight;
if (oIframe == undefined) {
PageMethods.beforepgload(pgid, function _beforepgload(sMsg) {
if (sMsg == "") {
oIframe = document.createElement("iframe");
oIframe.style.display = "none";
_programDiv.appendChild(oIframe);
oIframe.id = "iframe_" + pgid;
oIframe.frameBorder = "0";
oIframe.style.left = "0px";
oIframe.style.width = "100%";
oIframe.style.height = "100%";
oIframe.border = "0";
oIframe.scrolling = "no";
oIframe.src = pghandle + "?pgid=" + pgid;
Pages.Add(pgid, pgname, programPath);
allMinize(pgid);
return;
} else {
alert(sMsg);
return;
}
}, function getFailed(err) { alert(err.get_message()); return; });
} else {
allMinize(pgid);
}
}
function allMinize(pgid) {
if ($get("iframe_" + pgid)) {
var programs = $get("ProgramDiv").getElementsByTagName("IFRAME");
for (var i = 0; i < programs.length; i++) {
programs[i].style.display = "none";
}
// $("#shortCutDiv").hide();
// $("#MenuDiv").hide();
// $("#subMenuContainerDiv").hide();
// $("#otherIframe").hide();
// $("#settingDiv").hide();
// $("#TaskDiv").hide();
// $("#kjDiv").show();
// $get("ProgramPath").innerHTML = pgid.toUpperCase() + "&nbsp;&nbsp;&nbsp;&nbsp;" + Pages.Items(pgid).pgName;
$("#ProgramDiv").fadeIn("slow");
var h = screen.availHeight - (900 - 780);
var w = screen.availWidth;
$get("iframe_" + pgid).style.display = "";
$get("ProgramDiv").style.height = h;
$get("ProgramDiv").style.width = w;
$get("iframe_" + pgid).style.height = h;
$get("iframe_" + pgid).style.width = w;
CurrentPg = Pages.IndexOf(pgid);
}
}
function loadImage() {
}
function showDesktop() {
$("#settingDiv").show();
$("#kjDiv").hide();
$("#otherIframe").hide();
$("#MenuDiv").hide();
$("#subMenuContainerDiv").hide();
$("#ProgramDiv").hide();
$("#TaskDiv").show();
$("#shortCutDiv").show();
$get("ProgramPath").innerHTML = "";
}
function LogOut() {
if (confirm(Const_EIS_MainMenu_Logout)) {
if (document.getElementById("Logout_Frame")) {
document.getElementById("Logout_Frame").src = "Logout.aspx?dt=" + Math.random();
} else {
var oDiv = document.createElement("DIV");
oDiv.style.display = "none";
oDiv.id = "Logout_Div";
var oFrame = document.createElement("IFRAME");
oFrame.id = "Logout_Frame";
oDiv.appendChild(oFrame);
document.body.appendChild(oDiv);
oFrame.src = "Logout.aspx";
}
}
}
function FunctionClick(m) {
if (m == "min") showDesktop();
$("#subMenuContainerDiv").hide();
$("#shortCutDiv").hide();
$("#MenuDiv").slideDown("slow");
}
function HelpClick() {
window.open("../help/help.aspx?pid=&pgid=", "a", "fullscreen=0,width=800,height=600,top=50,left=50,directories=0,toolbar=0,location=0,status=0,menubar=0,scrollbars=1,history=0,resizable=yes", "nomenu");
}
function SettingClick() {
publicShow("ModifyPwd.aspx");
}
function CalendarClick() {
publicShow("apCalendar.aspx");
}
function ReCheckClick() {
publicShow("MessageFrm.aspx?mode=check");
}
function NoticeClick() {
publicShow("MessageFrm.aspx?mode=notice");
}
function MessageClick() { }
function publicShow(url) {
if (document.getElementById("otherIframe").src != url)
document.getElementById("otherIframe").src = url;
$("#settingDiv").hide();
$("#ProgramDiv").hide();
$("#MenuDiv").hide();
$("#subMenuContainerDiv").hide();
$("#shortCutDiv").hide();
$("#TaskDiv").hide();
$("#otherIframe").fadeIn("slow");
$("#kjDiv").show();
}
function showDiv() {
var tString = "";
var dvs = new Array("shortCutDiv", "MenuDiv", "subMenuContainerDiv", "otherIframe", "ProgramDiv", "TaskDivSub");
for (var k = 0; k < dvs.length; k++) {
tString += "DivId:" + dvs[k] + " display:" + $get(dvs[k]).style.display + "\n";
}
tString += "\n\n";
var programs = $get("ProgramDiv").getElementsByTagName("IFRAME");
for (var i = 0; i < programs.length; i++) {
tString += "IframeId:" + programs[i].id + " display:" + programs[i].style.display + "\n";
}
// var ds = document.getElementById("containerDiv").getElementsByTagName("DIV");
// for (var j = 0; j < ds.length; j++) {
// tString += "DivId:" + ds[j].id + " display:" + ds[j].style.display+"\n";
// }
// tString += "other:otherIframe display:" + document.getElementById("otherIframe").style.display + "\n";
alert(tString);
}
function TaskClick(obj) {
if ($get("TaskDivSub").style.display != "none") return;
var tbHtml = "";
var tHeight = 0, tWidth;
if (Pages.Count() == 0) return;
for (var i = 0; i < Pages.Count(); i++) {
tbHtml += "<div onmouseover=\"imgovertask(this)\" onmouseout=\"imgouttask(this)\" style=\"padding:5px 5px 5px 5px; text-align:left;cursor:pointer;width:150px;\" ><table cellSpacing=\"0\" cellPadding=\"0\" border=\"0\"><tr><td onclick=\"allMinize('" + Pages._Wins[i].pgId + "')\" style=\"width:140px;\" >" + (i + 1) + "." + Pages._Wins[i].pgName + "</td><td vailgn=\"top\" onclick=\"closePg('" + Pages._Wins[i].pgId + "');\"><img src='images/off.png' border=\"0\" style='visibility:hidden' ></td></tr></table></div>";
tHeight += 25;
}
$get("TaskDivSub").innerHTML = tbHtml;
tWidth = "160px";
var tLeft = document.body.clientWidth - 160;
var evt = SearchEvent();
if (obj.tagName == "IMG") {
$("#TaskDivSub").css({ position: "absolute",
left: tLeft + "px",
top: "36px"
}).fadeIn("slow", function cs() {
var _docMouseDown = document.body.onclick;
document.body.onclick = function bs2() {
if ($get("TaskDivSub").style.display != "none") { $("#TaskDivSub").hide(); }
document.body.onclick = _docMouseDown;
}
}
);
}
else {
$("#TaskDivSub").css({ position: "absolute",
left: function () { return evt.clientX; },
top: function () { return evt.clientY - tHeight; },
width: tWidth
}).fadeIn("slow", function cs() {
var _docMouseDown = document.body.onclick;
document.body.onclick = function bs2() {
if ($get("TaskDivSub").style.display != "none") { $("#TaskDivSub").hide(); }
document.body.onclick = _docMouseDown;
}
}
);
}
}
function displayPg() {
}
function openSub(objTr) {
}
var isSetting = false;
var subMenus = new Array();
function settingForm(obj) {
var urlString = "../common/FormHandle.aspx?gid=aptabsetg";
new iModalDialog().show(urlString, 500, 500, "Settings", function (args) { $get("RefreshSubMenu").click(); });
//showInput("gid=aptabset","500","500");
return;
var rowsCount = $get("tpSubTable").rows.length;
if (!isSetting) {
subMenus = new Array();
var iCell;
for (var i = 1; i < rowsCount; i++) {
iCell = $get("tpSubTable").rows[i].cells[0];
subMenus.push(iCell.innerHTML);
var dv = document.createElement("DIV");
// dv.innerHTML = "<img src='../common/images/sub2/button_add.jpg' alt='新增' onclick=\"modSubMenu('" + iCell.getAttribute("tabid") + "','" + iCell.getAttribute("tabtitle") + "','add')\">";
// dv.innerHTML += "&nbsp;&nbsp;"
dv.innerHTML += "<img src='../common/images/sub2/button_copy.jpg' alt='修改' onclick=\"modSubMenu('" + iCell.getAttribute("tabid") + "','" + iCell.getAttribute("tabtitle") + "','mod')\">";
dv.innerHTML += "&nbsp;&nbsp;"
dv.innerHTML += "<img src='../common/images/sub2/button_del.jpg' alt='删除' onclick=\"modSubMenu('" + iCell.getAttribute("tabid") + "','" + iCell.getAttribute("tabtitle") + "','del')\">";
iCell.appendChild(dv);
}
var iRow = $get("tpSubTable").insertRow(-1);
iCell = iRow.insertCell(-1);
iCell.style.cursor = "pointer";
iCell.style.backgroundImage = "url(images/menu_bg1.gif)";
iCell.style.height = "48px";
iCell.innerHTML = "<img src='../common/images/sub2/button_add.jpg' alt='新增' onclick=\"modSubMenu('" + iCell.getAttribute("tabid") + "','" + iCell.getAttribute("tabtitle") + "','add')\">";
iCell.innerHTML += "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"
isSetting = true;
} else {
for (var i = 1; i < rowsCount - 1; i++) {
var iCell = $get("tpSubTable").rows[i].cells[0];
iCell.innerHTML = subMenus[i - 1];
iCell.disabled = false;
}
$get("tpSubTable").deleteRow(rowsCount - 1);
isSetting = false;
}
}
function modSubMenu(tabid, tabtitle, tag) {
//tag='mod' 'del'
if (tag == "mod") {
var tb = window.prompt("名稱", tabtitle);
if (tb != null && tb != tabtitle) {
PageMethods.modSubMenu(tabid, tb, "000", tag, modSuccessed, modFailed);
}
}
if (tag == "del" && confirm("確定刪除?")) { PageMethods.modSubMenu(tabid, "", "000", tag, modSuccessed, modFailed); }
if (tag == "add") {
var tb = window.prompt("請輸入新的頁簽名稱", "");
if (tb != null && tb != "") {
PageMethods.modSubMenu(tabid, tb, "000", tag, modSuccessed, modFailed);
}
}
}
function modSuccessed(result) { isSetting = false; $get("RefreshSubMenu").click(); }
function modFailed(err) { alert(err.get_message()); }
function imgover(thisimg) {
thisimg.style.borderWidth = 1;
thisimg.style.borderStyle = 'outset';
thisimg.style.backgroundColor = '#88A9FB';
thisimg.style.color = 'white';
}
function imgout(thisimg) {
thisimg.style.borderWidth = 0;
thisimg.style.borderStyle = 'none';
thisimg.style.backgroundColor = '';
thisimg.style.color = 'black';
}
function imgovertask(thisimg) {
thisimg.style.borderWidth = 1;
thisimg.style.borderStyle = 'outset';
thisimg.style.backgroundColor = '#88A9FB';
thisimg.style.color = 'white';
var imgs = thisimg.getElementsByTagName("IMG");
if (imgs.length > 0) { imgs[0].style.visibility = "visible"; }
}
function imgouttask(thisimg) {
thisimg.style.borderWidth = 0;
thisimg.style.borderStyle = 'none';
thisimg.style.backgroundColor = '';
thisimg.style.color = 'black';
var imgs = thisimg.getElementsByTagName("IMG");
if (imgs.length > 0) { imgs[0].style.visibility = "hidden"; }
}
function showOutLookBarAnsyc(evtTd, oMenu) {
$get("tbmainmenu").disabled = true;
$("#subMenuContainerDiv").hide();
PageMethods.getMenus(oMenu, "apmenu", "", function callBack(result) {
//下层apmenu
var ptb = evtTd.childNodes[0];
var pCell = ptb.rows[0].cells[0];
var pImg = pCell.childNodes[0].src;
pCell.childNodes[0].src = '../common/images/loadingmenu.gif';
$get("subMenuDiv").innerHTML = result;
pCell.childNodes[0].src = pImg;
$("#subMenuContainerDiv").css({ position: "absolute",
left: function () { return $get("tbmainmenu").clientWidth + 50; },
top: "76px",
right: "50px"
}).fadeIn("slow");
$get("tbmainmenu").disabled = false; //RemoveExcuteProgressBar();
}, function getFailed(err) {
$get("tbmainmenu").disabled = false;
alert(err.get_message());
});
}
function closePg(pgid) {
var pgIndex = Pages.IndexOf(pgid);
closePgIndex(pgIndex);
}
function closePgIndex(pgIndex) {
var msg = "";
var _Page = Pages._Wins[pgIndex];
var pgid = _Page.pgId;
if (top.Page_Modify[pgIndex] == "yes") { msg += "[" + _Page.pgName + "] " + Const_NotSave + "\n\n"; }
msg += Const_CloseWindowConfirm;
if (confirm(msg)) {
document.getElementById("ProgramDiv").removeChild($get("iframe_" + pgid));
Pages.Remove(pgid);
if (isDesktopProgram)
showDesktop();
else {
$("#subMenuContainerDiv").show();
$("#shortCutDiv").hide();
$("#ProgramDiv").hide();
$("#TaskDiv").show();
}
$get("ProgramPath").innerHTML = "";
}
}
function closeDiv() {
closePgIndex(top.CurrentPg);
}
window.onbeforeunload = function () {
for (var i = 0; i < top.Page_Modify.length; i++) {
if (i != top.CurrentPg && top.Page_Modify[i] == "yes") {
window.event.returnValue = "[" + top.Page_PgName[i] + "] " + Const_NotSave + "!"
return;
}
}
}
document.onhelp = onhelpmain;
function onhelpmain() {
window.open(HelpUrl, 'new', 'fullscreen=0,width=800,height=600,top=50,left=300,directories=0,toolbar=0,location=0,status=0,menubar=0,scrollbars=1,history=0,resizable=yes', 'nomenu');
return false;
}
var _programid = "";
function openContextMenu(programid) {
_programid = programid;
if (Array.indexOf(ShortCuts, programid.toUpperCase(), 0) > -1) {
$get("setContextMenuDiv").style.display = "none";
$get("ContextMenuDiv_delShortCut").style.display = "block";
} else {
$get("setContextMenuDiv").style.display = "block";
$get("ContextMenuDiv_delShortCut").style.display = "none";
}
$get("ContextMenuDiv_ShortCut").onclick = function a1() {
PageMethods.setShortCut(programid, "",
function d1(result) { $("#RefreshBtn").click(); showDesktop(); },
function getFailed1(err) { alert(err.get_message()); }
);
}
$get("ContextMenuDiv_delShortCut").onclick = function a2() {
PageMethods.delShortCut(programid, $get("TopClass").value,
function d2(result) { $("#RefreshBtn").click(); showDesktop(); },
function getFailed2(err) { alert(err.get_message()); }
);
}
var evt = SearchEvent();
$("#ContextMenuDiv").css({ position: "absolute",
left: function () { return evt.clientX; },
top: function () { return evt.clientY + 10; }
}).slideDown("slow", function c() {
var _docMouseDown = document.body.onclick;
document.body.onclick = function b() {
$("#ContextMenuDiv").hide();
document.body.onclick = _docMouseDown;
}
});
}
function scTabclick(classType) {
//alert(classType);
PageMethods.setShortCut(_programid, classType,
function d1(result) { $("#RefreshBtn").click(); showDesktop(); },
function getFailed1(err) { alert(err.get_message()); }
);
}
function SearchEvent() {
//IE
if (document.all)
return window.event;
func = SearchEvent.caller;
while (func != null) {
var arg0 = func.arguments[0];
if (arg0) {
//if(arg0.constructor==Event||arg0.constructor==MouseEvent)
if (arg0.constructor == Event || arg0.constructor == MouseEvent || (typeof (arg0) == "object" && arg0.preventDefault && arg0.stopPropagation))
return arg0;
}
func = func.caller;
}
return null;
}
function locationSys(pid) {
showProgressbar();
PageMethods.getMenus(pid, "apmenu", "", function callBack(result) {
$("#MenuDiv").hide();
//下层apmenu
if (result.indexOf("__@@__@@__") > -1) {
$get("subMenuDiv").innerHTML = result.split("__@@__@@__")[0];
$get("classTd").innerHTML = result.split("__@@__@@__")[1];
} else {
$get("subMenuDiv").innerHTML = result;
}
$("#subMenuContainerDiv").fadeIn("slow", function () { hideProgressbar(); });
}, function getFailed(err) {
alert(err.get_message());
hideProgressbar();
});
}
function showProgressbar() {
$("#progressDiv").css({ height: function () { return $get("progressDiv").parentNode.clientHeight; } }).fadeIn('normal');
}
function hideProgressbar() {
$("#progressDiv").hide();
}
function displayMenuCode(m) {
if (m == "0") {
$("#classTable").hide();
$("#classDiv").css({ width: "13px", background: "" });
$("#classImg").show();
} else {
$("#classDiv").css({ width: "102px", background: "url(images/menu_mid.gif) repeat-y" });
$("#classTable").fadeIn('normal');
$("#classImg").hide();
}
}
function clickSubMenu(pid, MenuCode) {
if (MenuCode == "") return;
showProgressbar();
PageMethods.getMenus(pid, "apmodel", MenuCode, function callBack(result) {
$get("subMenuDiv").innerHTML = result;
for (var i = 0; cn = $get(pid + "_apmenu").rows[i]; i++) {
$get(pid + "_apmenu").rows[i].cells[0].style.backgroundImage = "url(images/menu_bg1.gif)";
}
$get(pid + "_" + MenuCode).style.backgroundImage = "url(images/menu_bg2.gif)";
hideProgressbar();
}, function getFailed(err) {
alert(err.get_message());
hideProgressbar();
});
}
function displayTopClass(m) {
if (m == "0") {
$("#TopClassTable").hide();
$("#TopClassDiv").css({ width: "13px", background: "" });
$("#TopClassImg").show();
} else {
$("#TopClassDiv").css({ width: "102px", background: "url(images/menu_mid.gif) repeat-y" });
$("#TopClassTable").fadeIn('normal');
$("#TopClassImg").hide();
}
}
function clickTopClass(classType, thisTd) {
if (isSetting) return;
for (var i = 0; cn = $get("tpSubTable").rows[i]; i++) {
$get("tpSubTable").rows[i].cells[0].style.backgroundImage = "url(images/menu_bg1.gif)";
}
thisTd.style.backgroundImage = "url(images/menu_bg2.gif)";
$get("TopClass").value = classType;
$get("RefreshBtn").click();
}