var ie = document.all ? 1 : 0; var wx = screen.availWidth + 'px'; var wy = screen.availHeight + 'px'; /*****修改(调整)页面大小 function editing at 2010-10-11****/ /* 重新调整窗口大小 * bodyid : 当前页面body对象 * tabContainerid : * contentTabid : centet obj * minRectangleid(boolean) :窗口缩小到600X400是出现滚动条 */ function reSizePage(bodyid,tabContainerid,contentTabid,minRectangleid){ var obj = document.getElementById(tabContainerid); var contentObj = document.getElementById(contentTabid); //var browserHeight = document.documentElement.offsetHeight; //var browserWidth = document.documentElement.offsetWidth; var browserHeight = document.body.offsetHeight; var browserWidth = document.body.offsetWidth; //alert("body.W-->"+document.body.offsetWidth+" getBodyid.W-->"+document.getElementById(bodyid).offsetWidth); if(!minRectangleid){ if(browserWidth<600){ contentObj.style.overflow="auto"; }else{ contentObj.style.overflow="hidden"; } if(browserHeight<400){ contentObj.style.overflow="auto"; } }else{ contentObj.style.overflow="auto"; } if (obj) { obj.style.height = browserHeight-5 + "px"; obj.style.width = browserWidth +"px"; contentObj.style.height = browserHeight-55 + "px"; contentObj.style.width = browserWidth-3 + "px"; } } // 调整父窗口对应的IFrame大小 function adjustFrameSize(){ var iframeid = document.getElementById("_viewid").value; var oIFrame = parent.document.getElementById(iframeid); if(oIFrame){ oIFrame.style.height = document.getElementById('doc_divid').offsetHeight + 40; } } // 调整本窗口内容高度 function adjustContentTable() { var container = document.getElementById("container"); var contentTable = document.getElementById("contentTable"); var activityTable = document.getElementById("activityTable"); var containerHeight = document.body.clientHeight-10; var containerWidth = document.body.clientWidth-5; if (containerHeight <= 0) { containerHeight = 480; } if (containerWidth <= 0) { containerWidth = 640; } if(containerHeight){ container.style.height = containerHeight + 'px'; var contentTableHeight = containerHeight; if (activityTable) { contentTableHeight = contentTableHeight - activityTable.offsetHeight; } contentTable.style.height = contentTableHeight+ 'px'; //contentTable.style.width = containerWidth + 'px'; } container.style.visibility = "visible"; } /******end ****/ function doBack() { window.history.back(); } function exit() { parent.close(); } function doExit() { window.close(); } function doEmpty() { window.returnValue = ""; window.close(); } function doEnter() { var rtn = document.uploadForm.fileFileName.value; window.returnValue = rtn; window.close(); } // Trim whitespace from left and right sides of s. function trim(s) { return s.replace(/^\s*/, "").replace(/\s*$/, ""); } function showViewDialog(str, viewid, fieldname, className) { wx = '640px'; wy = '480px'; var url = contextPath + '/portal/share/dynaform/view/dialogFram.jsp?_viewid=' + viewid; url += '&className=' + className; var rtn = window.showModalDialog(url, str, 'font-size:9pt;dialogWidth:' + wx + ';dialogHeight:' + wy + ';status:no;scroll=no;'); var field = document.getElementById(fieldname); if (field) { if (rtn) { field.value = rtn.id; } else { field.value = ''; } dy_view_refresh(); } } function showWordDialog(title, str, docid, formName, value, fieldname, versions, opentype, displayType, saveable, isOnlyRead,signature,isSignature) { wx = '900px'; wy = '600px'; var field = document.getElementById(fieldname); var _versions = document.getElementById(versions); var application = document.getElementById("application").value; var url = contextPath + '/portal/dynaform/document/newword.action?_docid=' + docid + "&type=word&_fieldname=" + fieldname + "&_opentype=" + opentype+"&_displayType="+displayType + "&saveable=" + saveable + "&isSignature=" + isSignature + "&application=" + application + "&formname=" + encodeURI(formName) +"&isOnlyRead="+isOnlyRead +"&signature="+signature + "&versions=" + _versions.value; if (field == null) { url += '&filename=' + value; } else { url += '&filename=' + field.value; } // div弹出式 if (opentype == '3' || opentype == 3 ) { OBPM.dialog.show({ width : 900, height : 600, url : url, args : {}, title : title, close : function(result) { var fieldVal = ''; if (result) { var rv = result.split(';'); fieldVal = rv[0]; _versions.value = rv[1]; } if (field && fieldVal != '') { field.value = fieldVal; } } }); } else { var rtn = window.showModalDialog(url, str, 'font-size:9pt;dialogWidth:' + wx + ';dialogHeight:' + wy + ';status:no;scroll=no;'); if (field) { if (rtn) { field.value = rtn; } else { field.value = ''; } doc.frames['main_iframe'].frames['detail'].dy_view_refresh(""); } } } function headerElements(d) { var oSelect; var doc = window.top; if (doc) { oSelect = doc.document.getElementsByTagName("SELECT"); } else { doc = window.top; if (doc) { oSelect = doc.document.getElementsByTagName("SELECT"); } else { doc = window.top.document; oSelect = doc.getElementsByTagName("SELECT"); } } if (oSelect.length > 0) { for (var i = 0; i < oSelect.length; i++) { oSelect[i].disabled = d; } } } /** * 隐藏document中的select元素 */ function hiddenElement() { var falg = true; headerElements(falg); } function showElement() { var falg = false; headerElements(falg); } /* * 获得word控件的返回值 */ function getWordValue(field, rtn) { var fields = parent.document.getElementById(field); if (fields) { if (rtn) { fields.value = rtn; } else { fields.value = ''; } } } /** * 获取左右选择框值 * * @param {} * fieldName */ function getSelectAboutFieldValue(name, rightId) { var oRight = document.getElementById(rightId); var valueList = ""; if (oRight && oRight.options.length > 0) { for (var i = 0; i < oRight.options.length; i++) { valueList += oRight.options(i).value + ";"; } valueList = valueList.substring(0, valueList.lastIndexOf(";")); } return valueList; } function showViewDialogField(title, str, viewid, mappStr, params, openType, viewType, divWidth, divHeight, maximization) { var url = contextPath + '/portal/share/dynaform/view/dialogTemp.jsp'; url += '?_viewid=' + viewid; url += '&datetime=' + new Date().getTime(); url += '&' + jQuery.param(params,true); if(divWidth == null || divWidth == "" && maximization == false){ url += '&_defaultSize=true';//后台显示大小为默认时,允许页面根据内容设置弹出层大小 } var width = 640; var height = 400; if(divWidth != "" && divWidth.trim().length > 0){ width = divWidth; } if(divHeight != "" && divHeight.trim().length > 0){ height = divHeight; } OBPM.dialog.show({ width : width, // 默认宽度 height : height, // 默认高度 url : url, args : {'html': new String(str), 'parent': window}, maximization: maximization, title : title, close : function(result) { var rtn = result; // 0x0000011 为树形视图, 0x0000010为日历视图 if (viewType!=0x0000011 && viewType!=0x0000010) { if(params.selectOne=="false"|| params.selectOne==false){ getDialogValue(mappStr, rtn); }else{ getDialogSelectValue(mappStr, rtn); } } else { getDialogValue(mappStr, rtn); } dy_view_refresh(""); } }); } function getDialogSelectValue(mappStr,rtn){ var mappStr = HTMLDencode(mappStr); var mapps = mappStr.split(";"); if (rtn != undefined) { for (var i = 0; i < mapps.length; i++) { var rel = mapps[i].split(":"); var colName = rel[0]; var fldName = rel[1]; var valStr = rtn; //alert(valStr); var fields = document.getElementsByName(fldName); if (fields.length > 0 && fields[0].tagName.toUpperCase() == 'SELECT') { if (!isOptionExisted(fields[0], valStr)) { var oOption = document.createElement("OPTION"); oOption.text = ""; oOption.value = valStr; fields[0].add(oOption); } selectOne(fields[0], valStr); } else if (fields.length > 0 && (fields[0].type.toUpperCase() == 'RADIO' || fields[0].type .toUpperCase() == 'CHECKBOX')) { for (n = 0; fields.length > n; n++) { var vals = valStr.split(";"); if (vals.indexOf(fields[n].value) != -1) { fields[n].checked = true; } else { fields[n].checked = false; } } } else { if (fields.length == 0) { fields.value = valStr; } else { fields[0].value = valStr; } } } return true; } else { return false; } } function doAfterPopup(value) { var mappStr = window.top.document.getElementById("mappStr"); getDialogValue(mappStr.value, value); window.top.frames['main_iframe'].frames['detail'].dy_view_refresh(''); } function getDialogValue(mappStr, rtn) { var mappStr = HTMLDencode(mappStr); var mapps = mappStr.split(";"); var isOptionExisted = function(oSel, selectedText) { for (var i = 0; i < oSel.options.length; i++) { if (oSel.options[i].text == selectedText) { return true; } } return false; } var selectOne = function(oSel, selectedText) { for (n = 0; oSel.options.length > n; n++) { if (selectedText == oSel.options[n].text) { oSel.options[n].selected = true; } } } if (rtn != undefined) { if (rtn) { rtn = jQuery.parseJSON(rtn); } for (var i = 0; i < mapps.length; i++) { var rel = mapps[i].split(":"); var colName = rel[0]; var fldName = rel[1]; var valStr = ''; if (jQuery.jQueryValues(rtn).length > 0) { var values = jQuery.jQueryValues(rtn);//jquery-obpm-extend.js jQuery.each(values,function(val) { if (values[val][colName] != undefined) valStr += values[val][colName] + ";"; }); } valStr = valStr.substring(0, valStr.lastIndexOf(";")); valStr = HTMLDencode(valStr); var reg = / /g; valStr = valStr.replace(reg, ""); if(valStr==" "){ valStr = ""; } //alert(valStr); var fields = document.getElementsByName(fldName); if (fields.length > 0 && fields[0].tagName.toUpperCase() == 'SELECT') { if (!isOptionExisted(fields[0], valStr)) { var oOption = document.createElement("OPTION"); oOption.text = ""; oOption.value = valStr; fields[0].add(oOption); } selectOne(fields[0], valStr); } else if (fields.length > 0 && (fields[0].type.toUpperCase() == 'RADIO' || fields[0].type .toUpperCase() == 'CHECKBOX')) { for (n = 0; fields.length > n; n++) { var vals = valStr.split(";"); if (vals.indexOf(fields[n].value) != -1) { fields[n].checked = true; } else { fields[n].checked = false; } } } else { if (fields.length == 0) { fields.value = valStr; } else { fields[0].value = valStr; } } } return true; } else { return false; } } function selectDate(d) { var arg = new Object(); arg.str_datetime = d; arg.time_comp = false; var rtn = window.showModalDialog(contextPath + '/script/calendar.html', arg, 'dialogWidth=400px;dialogHeight=240px;status:no;scroll=no;'); // alert("rtn->"+ rtn); return (rtn == null ? "" : rtn); } function selectDatetime(d) { var arg = new Object(); arg.str_datetime = d; arg.time_comp = true; var rtn = window.showModalDialog(contextPath + '/script/calendar.html', arg, 'dialogWidth=210px;dialogHeight=240px;status:no;scroll=no;'); return (rtn == null ? "" : rtn); } function selectTime(t) { var rtn = window.showModalDialog(contextPath + '/js/time.htm', t, 'dialogWidth=260px;dialogHeight=50px;status:no;scroll=no;'); return (rtn == null ? "" : rtn); } function selectDeptEx(fieldId, fieldName, parentDept, multiSelect, selectChild, selectUrl) { if (fieldId == null) { return; } var rtn = selectDept(parentDept, multiSelect, selectChild, selectUrl); if (rtn == null || rtn == 'undefined') { } else if (rtn == '') { fieldId.value = ''; if (fieldName != null) fieldName.value = ''; } else { if (multiSelect != null && multiSelect) { fieldId.value = ''; if (fieldName != null) fieldName.value = ''; for (var i = 0; i < rtn.length; i++) { var t = rtn[i].split(';'); fieldId.value += t[0] + ';'; if (fieldName != null) fieldName.value += t[1] + ';'; } } else { var t = rtn.split(';'); fieldId.value = t[0]; if (fieldName != null) fieldName.value = t[1]; } } } function selectDeptByChildEx(fieldId, fieldName, childDept, multiSelect, selectChild, selectUrl) { if (fieldId == null) { return; } var rtn = selectDeptByChild(childDept, multiSelect, selectChild, selectUrl); if (rtn == null || rtn == 'undefined') { } else if (rtn == '') { fieldId.value = ''; if (fieldName != null) fieldName.value = ''; } else { if (multiSelect != null && multiSelect) { fieldId.value = ''; if (fieldName != null) fieldName.value = ''; for (var i = 0; i < rtn.length; i++) { var t = rtn[i].split(';'); fieldId.value += t[0] + ';'; if (fieldName != null) fieldName.value += t[1] + ';'; } } else { var t = rtn.split(';'); fieldId.value = t[0]; if (fieldName != null) fieldName.value = t[1]; } } } function selectGroupEx(fieldId, fieldName, type, multiSelect, selectUrl) { if (fieldId == null) { return; } var rtn = selectGroup(type, multiSelect, selectUrl); if (rtn == null || rtn == 'undefined') { } else if (rtn == '') { fieldId.value = ''; if (fieldName != null) fieldName.value = ''; } else { if (multiSelect != null && multiSelect) { fieldId.value = ''; if (fieldName != null) fieldName.value = ''; for (var i = 0; i < rtn.length; i++) { var t = rtn[i].split(';'); fieldId.value += t[0] + ';'; if (fieldName != null) fieldName.value += t[1] + ';'; } } else { var t = rtn.split(';'); fieldId.value = t[0]; if (fieldName != null) fieldName.value = t[1]; } } } function selectUserEx(fieldId, fieldName, type, multiSelect, parentDept, selectChild) { if (fieldId == null) { return; } var rtn = selectUser(type, multiSelect, parentDept, selectChild); if (rtn == null || rtn == 'undefined') { } else if (rtn == '') { fieldId.value = ''; if (fieldName != null) fieldName.value = ''; } else { if (multiSelect != null && multiSelect) { fieldId.value = ''; if (fieldName != null) fieldName.value = ''; for (var i = 0; i < rtn.length; i++) { var t = rtn[i].split(';'); fieldId.value += t[0] + ';'; if (fieldName != null) fieldName.value += t[1] + ';'; } } else { var t = rtn.split(';'); fieldId.value = t[0]; if (fieldName != null) fieldName.value = t[1]; } } } function selectAll(oldValue, multiSelect, selectChild) { wx = '600px'; wy = '400px'; var url = contextPath + '/core/department/select.action'; // alert("oldValue->" + oldValue); var selectid = ""; if (oldValue != null && oldValue != "") { oldValue = oldValue.replace("(", ""); oldValue = oldValue.replace(")", ""); oldValue = oldValue.replace("{", ""); oldValue = oldValue.replace("}", ""); var tmp = oldValue.split(";"); for (var i = 0; i < tmp.length; i++) { var t = tmp[i].split("|"); if (t != null && t[0] != '') { selectid = selectid + t[0] + ";"; } } } url = url + '?SELECTEDID=' + selectid; if (multiSelect != null && multiSelect) { url = url + '&MULTISELECT=TRUE'; } if (selectChild != null && selectChild) { url = url + '&SELECTCHILD=TRUE'; } // // if (type == 'U' && parentDept != null) { // url = url + '&sm_deptid=' + parentDept; // } // alert("url->"+url); var rtn = showframe('', url); return rtn; } function selectAllEx(fieldId, fieldName, multiSelect, selectChild) { if (fieldId == null) { return; } var rtn = selectAll(fieldId.value, multiSelect, selectChild); if (rtn == null || rtn == 'undefined') { } else if (rtn == '') { fieldId.value = ''; if (fieldName != null) fieldName.value = ''; } else { if (multiSelect != null && multiSelect) { fieldId.value = ''; if (fieldName != null) fieldName.value = ''; for (var i = 0; i < rtn.length; i++) { var t = rtn[i].split(';'); fieldId.value += t[0] + ';'; if (fieldName != null) fieldName.value += t[1] + ';'; } } else { var t = rtn.split(';'); fieldId.value = t[0]; if (fieldName != null) fieldName.value = t[1]; } } } /** * 显示前台弹出框 * * @param {} * options */ function showfrontframe(options) { var title = options.title; var querystr = options.url; var width = options.w ? options.w : 300; var height = options.h ? options.h : 400; var arg = new Object(); arg.title = title; arg.url = querystr; arg.windowObj = options.windowObj; var url = contextPath + '/portal/share/frame.jsp?title=' + title; OBPM.dialog.show({ width : width, height : height, url : url, args : arg, title : title, close : function(result) { var rtn = result; options.callback(rtn); } }); } function showframe(title, querystr, isDiv) { var pth = window.location.pathname; var pos1 = pth.lastIndexOf("/"); var pos2 = pth.lastIndexOf("\\"); var pos = Math.max(pos1, pos2); querystr.title = title; if (querystr.url != null) { if (!(querystr.url.indexOf("/") == 0 || querystr.url.indexOf("\\") == 0)) querystr.url = pth.substring(0, pos) + "/" + querystr.url; } else { if (!(querystr.indexOf("/") == 0 || querystr.indexOf("\\") == 0)) querystr = pth.substring(0, pos) + "/" + querystr; } var arg = new Object(); arg.title = title; arg.url = querystr; arg.window = this.window; // alert(isDiv); if (!isDiv) { return parent.showModalDialog( contextPath + '/frame.jsp?title=' + title, arg, 'resizable=yes;help=no;status=no;font-size:9pt;dialogWidth:' + wx + ';dialogHeight:' + wy + ';status:no;scroll:no;'); } else { showFrameByDiv(arg.url, arg.title); } } // 以div的方式弹出(showfrmae) function showFrameByDiv(url, title, wx, wy) { var doc; if (window.top) { var div1 = window.top.document.getElementById("closeWindow_DIV"); if (div1) { hiddenElement(); doc = window.top.document; } else { hiddenElement(); doc = window.document; } doc.getElementById('dbody').innerHTML = "