DocMouldAddExt.jsp 22.4 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571

<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@page import="weaver.hrm.moduledetach.ManageDetachComInfo"%>
<%@ include file="/systeminfo/init_wev8.jsp" %>
<%@ taglib uri="/browserTag" prefix="brow"%>
<%@ taglib uri="/WEB-INF/weaver.tld" prefix="wea"%>
<%@ include file="/docs/docs/iWebOfficeConf.jsp" %>
<%@ page import="weaver.general.Util" %>
<jsp:useBean id="MouldManager" class="weaver.docs.mouldfile.MouldManager" scope="page" />
<jsp:useBean id="CheckSubCompanyRight" class="weaver.systeminfo.systemright.CheckSubCompanyRight" scope="page" />
<jsp:useBean id="SubCompanyComInfo" class="weaver.hrm.company.SubCompanyComInfo" scope="page" />
<%
if(!HrmUserVarify.checkUserRight("DocMouldAdd:Add", user)){
    		response.sendRedirect("/notice/noright.jsp");
    		return;
}
if("false".equals(isIE)){	
	request.setAttribute("labelid","125483");
	request.getRequestDispatcher("/wui/common/page/sysRemind.jsp").forward(request,response);		
	return;
}
String isclose = Util.null2String(request.getParameter("isclose"));
String isDialog = Util.null2String(request.getParameter("isdialog"));
String isWorkflowDoc = Util.null2String(request.getParameter("isWorkflowDoc"));
String id = Util.null2String(request.getParameter("id"));
String  docType=Util.null2String(request.getParameter("docType"));
if(docType.equals("")){
    docType=".doc";
}

String url = "/data.jsp?type=-99996&mouldType=3&doctype="+docType;
String urlfrom = Util.null2String(request.getParameter("urlfrom"));	

int detachable = 0;
ManageDetachComInfo comInfo =  new ManageDetachComInfo();
boolean isUseHrmManageDetach=comInfo.isUseDocManageDetach();
if(isUseHrmManageDetach){
	detachable=1;
}
//int detachable=Util.getIntValue(String.valueOf(session.getAttribute("docdetachable")),0);
//int subcompanyid1= -1;
int subcompanyid1 = Util.getIntValue(request.getParameter("subcompanyid1"));
    if(detachable==1){
        if(subcompanyid1 == -1){
            subcompanyid1 = user.getUserSubCompany1();
        }
    }
String  mouldname=Util.null2String(request.getParameter("mouldname"));

String docMouldExistedId=Util.null2String(request.getParameter("docMouldExistedId"));
if(docMouldExistedId==null||"0".equals(docMouldExistedId)) docMouldExistedId = "";

String docid = Util.null2String(request.getParameter("id"));
if(docid==null||"0".equals(docid)) docid = "";

String temStr = request.getRequestURI();
temStr=temStr.substring(0,temStr.lastIndexOf("/")+1);

String mServerUrl=temStr+mServerName;
String mClientUrl="/docs/docs/"+mClientName;

String docMouldExistedName = "";
String docMouldExistedText = "";
String docMouldExistedType = "";
String mouldName = "";
if(!"".equals(id)){
	MouldManager.setId(Util.getIntValue(id,0));
	MouldManager.getMouldInfoById();
	mouldName=MouldManager.getMouldName();
}
int subcompanyid = 0;
if(!docMouldExistedId.equals("")){
	int currentMouldType = 2;
	MouldManager.setId(Util.getIntValue(docMouldExistedId,0));
	MouldManager.getMouldInfoById();
	docMouldExistedName=MouldManager.getMouldName();
	docMouldExistedText=MouldManager.getMouldText();
	currentMouldType = MouldManager.getMouldType();
	subcompanyid = MouldManager.getSubcompanyid();
	docMouldExistedType=".doc";
	if(currentMouldType==2){
		docMouldExistedType=".doc";
	}else if(currentMouldType==3){
		docMouldExistedType=".xls";
	}else if(currentMouldType==4){
		docMouldExistedType=".wps";
	}else if(currentMouldType==5){
		docMouldExistedType=".et";
	}else{
		docMouldExistedType=".doc";
	}
	MouldManager.closeStatement();
}
int operatelevel=0;
if(detachable==1){
	if(subcompanyid==0){
	String hasRightSub=String.valueOf(session.getAttribute("docdftsubcomid"));
	String hasRightSubFirst="";
	if(!hasRightSub.equals("")){
	if(hasRightSub.indexOf(',')>-1){  
	   hasRightSubFirst=Util.null2String(hasRightSub.substring(0,hasRightSub.indexOf(',')));
	 
          }else{
            hasRightSubFirst=hasRightSub;
          }
	 subcompanyid=Util.getIntValue(hasRightSubFirst,0);
    }
	subcompanyid = Util.getIntValue(String.valueOf(session.getAttribute("editMould_subcompanyid")),subcompanyid);
	}
	operatelevel= CheckSubCompanyRight.ChkComRightByUserRightCompanyId(user.getUID(),"DocMouldAdd:Add",subcompanyid);

}else{
    if(HrmUserVarify.checkUserRight("DocMouldAdd:Add", user))
        operatelevel=2;
}
%>
<html><head>
<link href="/css/Weaver_wev8.css" type=text/css rel=STYLESHEET>
<script language="javascript" src="/js/weaver_wev8.js"></script>
<script language="javascript">

var dialog = parent.parent.getDialog(parent); 
var parentWin = parent.parent.getParentWindow(parent);
if("<%=isclose%>"=="1"){
	//parentWin.location="DocMould.jsp";
	if(jQuery("#from",parentWin.document).val()=="attachMould"){
		var data = {};
		data.id="<%=id%>";
		data.name = "<%=mouldName%>";
		dialog.callback(data);
	}else{
		parentWin._table.reLoad();
		dialog.close();	
	}	
}

function StatusMsg(mString){
  StatusBar.innerText=mString;
}

function WebSaveLocal(){
  try{
    weaver.WebOffice.WebSaveLocal();
    StatusMsg(weaver.WebOffice.Status);
  }catch(e){}
}

function WebOpenLocal(){
  try{
    weaver.WebOffice.WebOpenLocal();
    StatusMsg(weaver.WebOffice.Status);
  }catch(e){
  }
}

function changeFileType(xFileType){
	if(xFileType==".docx"||xFileType==".dot"){
		xFileType=".doc";
	}else if(xFileType==".xlsx"||xFileType==".xlt"||xFileType==".xlw"||xFileType==".xla"){
		xFileType=".xls";
	}else if(xFileType==".pptx"){
		xFileType=".ppt";
	}
	return xFileType;
}

function SaveDocument(){

    var tempFileName=document.all("mouldname").value;
	tempFileName=tempFileName.replace(/\\/g,'\');
	tempFileName=tempFileName.replace(/\//g,'/');
	tempFileName=tempFileName.replace(/:/g,':');
	tempFileName=tempFileName.replace(/\*/g,'×');
	tempFileName=tempFileName.replace(/\?/g,'?');
	tempFileName=tempFileName.replace(/\"/g,'“');
	tempFileName=tempFileName.replace(/</g,'<');
	tempFileName=tempFileName.replace(/>/g,'>');
	tempFileName=tempFileName.replace(/\|/g,'|');
	tempFileName=tempFileName.replace(/\./g,'.');
	tempFileName = tempFileName+'<%=docType%>';
    document.getElementById("WebOffice").FileName=tempFileName;

    weaver.WebOffice.FileType=changeFileType(weaver.WebOffice.FileType);

  if (!weaver.WebOffice.WebSave(<%=isNoComment%>)){
     StatusMsg(weaver.WebOffice.Status);
     alert("<%=SystemEnv.getHtmlLabelName(19007,user.getLanguage())%>");
     return false;
  }else{
    StatusMsg(weaver.WebOffice.Status);
    //alert(weaver.WebOffice.WebGetMsgByName("CREATEID"));
    weaver.id.value=weaver.WebOffice.WebGetMsgByName("CREATEID");
    weaver.docType.value=weaver.WebOffice.WebGetMsgByName("DOCTYPE");
    //alert(weaver.id.value);
    //alert(weaver.docType.value);
    return true;
  }
}

function SaveBookmarks(){
<%if(urlfrom.equals("hr")){%>
    return true;
<%}else{%>
  <%if(".doc".equals(docType)||".wps".equals(docType)){%>
    var bookmarkNames="";
    var count =  weaver.WebOffice.WebObject.Bookmarks.Count;
    for (i=1;i<=count;i++){
	    bookmarkNames+=","+weaver.WebOffice.WebObject.Bookmarks.Item(i).Name;
	}
	if(bookmarkNames!=""){
		bookmarkNames=bookmarkNames.substr(1);
    }

    weaver.WebOffice.WebSetMsgByName("BOOKMARKNAMES",bookmarkNames);

    weaver.WebOffice.WebSetMsgByName("ISEDITMOULD","TRUE");
  if(!weaver.WebOffice.WebSaveBookmarks()){
     StatusMsg(weaver.WebOffice.Status);
     top.Dialog.alert(weaver.WebOffice.Status);
     return false;
  }else{
    StatusMsg(weaver.WebOffice.Status);
    return true;
  }
  <%}else{%>
    return true;
  <%}%>
<%}%>


}

function Load(){
  //weaver.WebOffice.WebUrl="<%=mServerUrl%>"
  try{
  weaver.WebOffice.WebUrl="<%=mServerUrl%>";
  weaver.WebOffice.RecordID="<%=docMouldExistedId%>";
  weaver.WebOffice.Template="";
  weaver.WebOffice.FileName="";
  weaver.WebOffice.FileType="<%=docType%>";
<%if(isIWebOffice2006 == true){%>
//iWebOffice2006 鐗规湁鍐呭寮€濮?
  weaver.WebOffice.EditType="1,1";
  weaver.WebOffice.ShowToolBar="0";      //ShowToolBar:鏄惁鏄剧ず宸ュ叿鏍?1鏄剧ず,0涓嶆樉绀?
//iWebOffice2006 鐗规湁鍐呭缁撴潫
<%}else{%>
  weaver.WebOffice.EditType="1";
<%}%>
  weaver.WebOffice.UserName="<%=user.getUsername()%>";
<%if(user.getLanguage()==7){%>
  weaver.WebOffice.Language="CH";
<%}else if(user.getLanguage()==9){%>
  weaver.WebOffice.Language="TW";
<%}else{%>
  weaver.WebOffice.Language="EN";
<%}%>
  weaver.WebOffice.WebOpen();  	//鎵撳紑璇ユ枃妗?
<%if(isIWebOffice2006 == true){%>
//iWebOffice2006 鐗规湁鍐呭寮€濮?
  weaver.WebOffice.ShowType="1";  //鏂囨。鏄剧ず鏂瑰紡  1:琛ㄧず鏂囧瓧鎵规敞  2:琛ㄧず鎵嬪啓鎵规敞  0:琛ㄧず鏂囨。鏍哥
//iWebOffice2006 鐗规湁鍐呭缁撴潫
<%}%>
  StatusMsg(weaver.WebOffice.Status);

  }catch(e){}
}



function UnLoad(){
  try{
  if (!weaver.WebOffice.WebClose()){
     StatusMsg(weaver.WebOffice.Status);
  }else{
     StatusMsg("<%=SystemEnv.getHtmlLabelName(19716,user.getLanguage())%>...");
  }
  }catch(e){}
}


</script>
</head>
<%


//System.out.println("urlfrom#####:"+urlfrom);
String imagefilename = "/images/hdMaintenance_wev8.gif";
String titlename = "";
if(urlfrom.equals("hr")){
  titlename = SystemEnv.getHtmlLabelName(614,user.getLanguage())+":"+SystemEnv.getHtmlLabelName(64,user.getLanguage());
}else{
  titlename = SystemEnv.getHtmlLabelName(82,user.getLanguage())+":"+SystemEnv.getHtmlLabelName(16449,user.getLanguage());
}
String needfav ="1";
String needhelp ="";
%>
<body onLoad="Load()" onUnload="UnLoad()">
<%if("1".equals(isDialog)){ %>
<div class="zDialog_div_content">
<%} %>
<%@ include file="/systeminfo/TopTitle_wev8.jsp" %>

<%@ include file="/systeminfo/RightClickMenuConent_wev8.jsp" %>
<%
RCMenu += "{"+SystemEnv.getHtmlLabelName(86,user.getLanguage())+",javascript:onSave(),_top} " ;
RCMenuHeight += RCMenuHeightStep ;
RCMenu += "{"+SystemEnv.getHtmlLabelName(16381,user.getLanguage())+",javascript:WebOpenLocal(),_top} " ;
RCMenuHeight += RCMenuHeightStep ;
RCMenu += "{"+SystemEnv.getHtmlLabelName(16382,user.getLanguage())+",javascript:WebSaveLocal(),_top} " ;
RCMenuHeight += RCMenuHeightStep ;
if(!isDialog.equals("1")){
RCMenu += "{"+SystemEnv.getHtmlLabelName(1290,user.getLanguage())+",/odoc/docs/mouldfile/DocMould.jsp?urlfrom="+urlfrom+"&subcompanyid1="+subcompanyid1+",_self} " ;
RCMenuHeight += RCMenuHeightStep ;
}
%>
<%@ include file="/systeminfo/RightClickMenu_wev8.jsp" %>

<table id="topTitle" cellpadding="0" cellspacing="0">
	<tr>
		<td>
		</td>
		<td class="rightSearchSpan" style="text-align:right;">
			<input type=button class="e8_btn_top" onclick="onSave();" value="<%=SystemEnv.getHtmlLabelName(86, user.getLanguage())%>"></input>
			<input type=button class="e8_btn_top" onclick="WebOpenLocal();" value="<%=SystemEnv.getHtmlLabelName(16381, user.getLanguage())%>"></input>
			<input type=button class="e8_btn_top" onclick="WebSaveLocal();" value="<%=SystemEnv.getHtmlLabelName(16382, user.getLanguage())%>"></input>
			<span title="<%=SystemEnv.getHtmlLabelName(23036,user.getLanguage())%>" class="cornerMenu"></span>
		</td>
	</tr>
</table>

<form id=weaver name=weaver action="UploadDoc.jsp" method=post enctype="multipart/form-data">
<input TYPE="hidden" id="id" NAME="id" value="">
<input TYPE="hidden" id="docType" NAME="docType" value="">
<input type="hidden" name="isdialog" value="<%=isDialog%>">

<wea:layout>
	<wea:group context='<%=SystemEnv.getHtmlLabelName(1361,user.getLanguage())%>'>
		<wea:item><%=SystemEnv.getHtmlLabelName(18151,user.getLanguage())%></wea:item>
		<wea:item>
			<wea:required id="mouldnamespan" required="true"value='<%=mouldname%>'>
				<input temptitle="<%=SystemEnv.getHtmlLabelName(18151,user.getLanguage())%>" class=InputStyle size=70 name=mouldname value="<%=mouldname%>" onChange="checkinput('mouldname','mouldnamespan')">
			</wea:required>
		</wea:item>
		
		<wea:item>
			<script language=javascript>
				var docSelectIndex=0;
				function onChangeDocType(doPage,docType){
					if(confirm("<%=SystemEnv.getHtmlLabelName(18691,user.getLanguage())%>")){
						location=doPage+'?isWorkflowDoc=<%=isWorkflowDoc%>&isdialog=<%=isDialog%>&mouldname='+weaver.mouldname.value+'&docType='+docType;
					}else{
						weaver.sdoctype[docSelectIndex].checked=true;
					}
					//weaver.sdoctype[docSelectIndex].checked=true;
					return false;

				}
			</script>
			<%=SystemEnv.getHtmlLabelName(20622,user.getLanguage())%>
		</wea:item>
		<wea:item>
			<div >
				<%if(!isWorkflowDoc.equals("1")){ %>
					<input TYPE="radio" NAME="sdoctype" <%=(docType.equals(".htm")?"checked":"")%> onClick="onChangeDocType('/odoc/docs/mouldfile/DocMouldAdd.jsp','.htm')">HTML&nbsp;<%=SystemEnv.getHtmlLabelName(16449,user.getLanguage())%>
				<%} %>
				<input TYPE="radio" NAME="sdoctype" <%=(docType.equals(".doc")?"checked":"")%> onClick="onChangeDocType('/odoc/docs/mouldfile/DocMouldAddExt.jsp','.doc')">WORD&nbsp;<%=SystemEnv.getHtmlLabelName(16449,user.getLanguage())%>
				<%if(!isWorkflowDoc.equals("1")){ %>
				<input TYPE="radio" NAME="sdoctype" <%=(docType.equals(".xls")?"checked":"")%> onClick="onChangeDocType('/odoc/docs/mouldfile/DocMouldAddExt.jsp','.xls')">EXCEL&nbsp;<%=urlfrom.equals("hr")?SystemEnv.getHtmlLabelName(15786,user.getLanguage()):SystemEnv.getHtmlLabelName(16449,user.getLanguage())%>
				<%} %>
				<input TYPE="radio" NAME="sdoctype" <%=(docType.equals(".wps")?"checked":"")%> onClick="onChangeDocType('/odoc/docs/mouldfile/DocMouldAddExt.jsp','.wps')"><%=SystemEnv.getHtmlLabelName(22359,user.getLanguage())%>&nbsp;<%=SystemEnv.getHtmlLabelName(16449,user.getLanguage())%>
				<%if("1".equals(isUseET)){%>
			<input TYPE="radio" NAME="sdoctype" <%=(docType.equals(".et")?"checked":"")%> onClick="onChangeDocType('/odoc/docs/mouldfile/DocMouldAddExt.jsp','.et')"><%=SystemEnv.getHtmlLabelName(24545,user.getLanguage())%>&nbsp;<%=urlfrom.equals("hr")?SystemEnv.getHtmlLabelName(15786,user.getLanguage()):SystemEnv.getHtmlLabelName(16449,user.getLanguage())%>
			<%}%>
			</div>
			<script language=javascript>
			for(i=0; i<weaver.sdoctype.length; i++){
				if(weaver.sdoctype[i].checked){
					docSelectIndex=i;
				}
			}
			</script>
		</wea:item>
		<wea:item><%=SystemEnv.getHtmlLabelName(19333,user.getLanguage())%></wea:item>
		<wea:item>
			<span>
				<%String extraparams = "{'docType':'"+docType+"'}"; %>
				   <brow:browser viewType="0" name="docMouldExistedId" browserValue='<%= ""+docMouldExistedId %>' 
					_callback="afterOnShowMould"
					browserUrl="/systeminfo/BrowserMain.jsp?mouldID=resource&url=/odoc/docs/mouldfile/DocMouldBrowser.jsp?doctype=.doc" language='<%=""+user.getLanguage() %>'
					getBrowserUrlFn="getBrowserUrlFn"
					temptitle='<%=SystemEnv.getHtmlLabelName(19333,user.getLanguage())%>'
					hasInput="true" isSingle="true" hasBrowser = "true" isMustInput='1'
					completeUrl='<%=url %>' linkUrl="#" width="90%"
					browserSpanValue='<%= docMouldExistedName %>' extraParams='<%= extraparams %>'></brow:browser>
			   </span>
		</wea:item>

		<wea:item><%= SystemEnv.getHtmlLabelName(85 ,user.getLanguage())%></wea:item>
			<wea:item>
				<%= SystemEnv.getHtmlLabelName(125484 ,user.getLanguage())%>
			</wea:item>
		<%if(detachable==1){%>
		<%if(urlfrom.equals("hr")){%>
				
					<wea:item><%= SystemEnv.getHtmlLabelName(17868,user.getLanguage())%></wea:item>
					<wea:item>
						<span>
							<brow:browser viewType="0" name="subcompanyid1" browserValue='<%= ""+subcompanyid1 %>' 
									browserUrl="/systeminfo/BrowserMain.jsp?url=/hrm/company/SubcompanyBrowser.jsp"
									hasInput='<%=operatelevel>0?"true":"false" %>' isSingle="true" hasBrowser = "true" isMustInput="2"
									completeUrl="/data.jsp?type=164" width="80%" temptitle='<%= SystemEnv.getHtmlLabelName(17868,user.getLanguage())%>'
									browserSpanValue='<%=subcompanyid1!=0?Util.toScreen(SubCompanyComInfo.getSubCompanyname(subcompanyid1+""),user.getLanguage()):""%>'>
							</brow:browser>
						</span>
					</wea:item>

			<%}else{%>
			<wea:item><%= SystemEnv.getHtmlLabelName(17868,user.getLanguage())%></wea:item>
			<wea:item>
				<span>
					<brow:browser viewType="0" name="subcompanyid" browserValue='<%= ""+subcompanyid %>' 
							browserUrl="/systeminfo/BrowserMain.jsp?url=/hrm/company/SubcompanyBrowser.jsp"
							hasInput='<%=operatelevel>0?"true":"false" %>' isSingle="true" hasBrowser = "true" isMustInput='<%=operatelevel>0?"2":"0" %>'
							completeUrl="/data.jsp?type=164" width="80%" temptitle='<%= SystemEnv.getHtmlLabelName(17868,user.getLanguage())%>'
							browserSpanValue='<%=subcompanyid!=0?Util.toScreen(SubCompanyComInfo.getSubCompanyname(subcompanyid+""),user.getLanguage()):""%>'>
					</brow:browser>
				</span>
			</wea:item>
		<%}}%>
		<wea:item attributes="{'colspan':'full'}"><textarea name=mouldtext style="display:none;width:100%;height:500px"></textarea></wea:item>
		<wea:item attributes="{'colspan':'full'}">
			<iframe id="e8shadowifrm" name="e8shadowifrm" frameborder="none" scrolling="no" style="overflow:hidden;z-index:1;width:100%;height:23px;position:absolute;top:37px;visibility:hidden;left:0px;background-color:#fff;" src="javascript:return false;"></iframe>
			<div style="POSITION: relative;width:100%;height:660;OVERFLOW:hidden;position:relative;">
				<object  id="WebOffice" style="POSITION: relative;top:-23px" width="100%"  height="680"  value="" classid="<%=mClassId%>" codebase="<%=mClientUrl%>" >
				</object>
			</div>
		</wea:item>
		<wea:item attributes="{'colspan':'full'}"><span id=StatusBar>&nbsp;</span></wea:item>
	</wea:group>
</wea:layout>

<input type=hidden name=operation>
<input type=hidden name=urlfrom value="<%=urlfrom%>">
</form>
<%if("1".equals(isDialog)){ %>
	</div>
	<div id="zDialog_div_bottom" class="zDialog_div_bottom">
	<wea:layout needImportDefaultJsAndCss="false">
			<wea:group context=""  attributes="{\"groupDisplay\":\"none\"}">
				<wea:item type="toolbar">
					<input type="button" value="<%=SystemEnv.getHtmlLabelName(309,user.getLanguage())%>" id="zd_btn_cancle"  class="zd_btn_cancle" onclick="dialog.closeByHand();">
				</wea:item>
			</wea:group>
		</wea:layout>
</div>
	<script type="text/javascript">
		jQuery(document).ready(function(){
			resizeDialog(document);
		});
	</script>
<%} %>
<script>
var isdocexisted = false;
function getBrowserUrlFn(){
	if("<%=urlfrom%>"=="hr"){
	  return "/systeminfo/BrowserMain.jsp?mouldID=resource&url=/odoc/docs/mouldfile/DocMouldtwoBrowser.jsp?urlfrom=<%=urlfrom%>&doctype=<%=docType%>&subcompanyid1=<%=subcompanyid1%>";
	}else{
	  return "/systeminfo/BrowserMain.jsp?mouldID=doc&url=/odoc/docs/mouldfile/DocMouldBrowser.jsp?doctype=<%=docType%>";
	}
	
}


function afterOnShowMould(e,id1,fieldid,params){
	if(id1!=null){
		if("<%=urlfrom%>"=="hr"){
			if(isdocexisted)
			location="/odoc/docs/mouldfile/DocMouldAddExt.jsp?isdialog=<%=isDialog%>&id="+weaver.id.value+"&subcompanyid1=<%=subcompanyid1%>&urlfrom=<%=urlfrom%>&mouldname="+document.weaver.mouldname.value+"&docType=<%=docType%>&docMouldExistedId="+id1.id;
			else if("<%=docid%>"!="")
			location="/odoc/docs/mouldfile/DocMouldAddExt.jsp?isdialog=<%=isDialog%>&id=<%=docid%>&subcompanyid1=<%=subcompanyid1%>&urlfrom=<%=urlfrom%>&mouldname="+document.weaver.mouldname.value+"&docType=<%=docType%>&docMouldExistedId="+id1.id;
			else
			location="/odoc/docs/mouldfile/DocMouldAddExt.jsp?isdialog=<%=isDialog%>&subcompanyid1=<%=subcompanyid1%>&urlfrom=<%=urlfrom%>&mouldname="+document.weaver.mouldname.value+"&docType=<%=docType%>&docMouldExistedId="+id1.id;
		}else{
			var idarray = new Array(id1.id, id1.name);
			if(isdocexisted)
			location="DocMouldAddExt.jsp?isdialog=<%=isDialog%>&id="+weaver.id.value+"&mouldname="+document.weaver.mouldname.value+"&docType=<%=docType%>&docMouldExistedId="+idarray[0];
			else if("<%=docid%>"!="")
			location="DocMouldAddExt.jsp?isdialog=<%=isDialog%>&id=<%=docid%>&mouldname="+document.weaver.mouldname.value+"&docType=<%=docType%>&docMouldExistedId="+idarray[0];
			else
			location="DocMouldAddExt.jsp?isdialog=<%=isDialog%>&mouldname="+document.weaver.mouldname.value+"&docType=<%=docType%>&docMouldExistedId="+idarray[0];
		}
	}
}

function onShowMould(){
	if("<%=urlfrom%>"=="hr"){

	var id = window.showModalDialog("DocMouldtwoBrowser.jsp?doctype=<%=docType%>&subcompanyid1=<%=subcompanyid1%>");
	if(id!=null){
		var idarray = new Array(id.id, id.name);
		document.weaver.docMouldExistedId.value = idarray[0];
		docMouldExistedName.innerHTML = "";
		if(isdocexisted)
		location="DocMouldAddExt.jsp?isdialog=<%=isDialog%>&id="+weaver.id.value+"&subcompanyid1=<%=subcompanyid1%>&urlfrom=<%=urlfrom%>&mouldname="+document.weaver.mouldname.value+"&docType=<%=docType%>&docMouldExistedId="+idarray[0];
		else if("<%=docid%>"!="")
		location="DocMouldAddExt.jsp?isdialog=<%=isDialog%>&id=<%=docid%>&subcompanyid1=<%=subcompanyid1%>&urlfrom=<%=urlfrom%>&mouldname="+document.weaver.mouldname.value+"&docType=<%=docType%>&docMouldExistedId="+idarray[0];
		else
		location="DocMouldAddExt.jsp?isdialog=<%=isDialog%>&urlfrom=<%=urlfrom%>&subcompanyid1=<%=subcompanyid1%>&mouldname="+document.weaver.mouldname.value+"&docType=<%=docType%>&docMouldExistedId="+idarray[0];
	}
	}
	else{

	var id = window.showModalDialog("DocMouldBrowser.jsp?doctype=<%=docType%>");
	if(id!=null){
		var idarray = new Array(id.id, id.name);
		document.weaver.docMouldExistedId.value = idarray[0];
		docMouldExistedName.innerHTML = "";
		if(isdocexisted)
		location="DocMouldAddExt.jsp?isdialog=<%=isDialog%>&id="+weaver.id.value+"&mouldname="+document.weaver.mouldname.value+"&docType=<%=docType%>&docMouldExistedId="+idarray[0];
		else if("<%=docid%>"!="")
		location="DocMouldAddExt.jsp?isdialog=<%=isDialog%>&id=<%=docid%>&mouldname="+document.weaver.mouldname.value+"&docType=<%=docType%>&docMouldExistedId="+idarray[0];
		else
		location="DocMouldAddExt.jsp?isdialog=<%=isDialog%>&mouldname="+document.weaver.mouldname.value+"&docType=<%=docType%>&docMouldExistedId="+idarray[0];
	}
}
	}


function onSave(){
	var checkField = "mouldname";
	<%
		if(detachable==1){
		if(urlfrom.equals("hr")){
	%>
			checkField = checkField + ",subcompanyid1";
	<%	}else {
	%>
			checkField = checkField + ",subcompanyid";
	<%
		}}
	%>
	if(check_form(document.weaver,checkField)){
        document.weaver.operation.value='add';
        if(SaveDocument()){
		    if(SaveBookmarks()){
	        	document.weaver.submit();
	    	}
        }
	}
}
</script>
<script language="VBScript">
sub onShowSubcompany()
	id = window.showModalDialog("/systeminfo/BrowserMain.jsp?url=/hrm/company/SubcompanyBrowser2.jsp?rightStr=DocMouldAdd:Add&selectedids="&weaver.subcompanyid1.value)
	issame = false
	if (Not IsEmpty(id)) then
	if id(0)<> 0 then
	if id(0) = weaver.subcompanyid1.value then
		issame = true
	end if
	subcompanyid1span.innerHtml = id(1)
	weaver.subcompanyid1.value=id(0)
	else
	subcompanyid1span.innerHtml = "<IMG src='/images/BacoError_wev8.gif' align=absMiddle>"
	weaver.subcompanyid1.value=""
	end if
	end if
end sub
</script>
</body>