<%@ page contentType="text/html;charset=gbk" %>
<%@ page import="com.jspsmart.upload.SmartUpload" %>
<%@ page import="com.jspsmart.upload.Request" %>
<%@ page import="net.sz600.system.SzAnnex" %>
<%@ include file="/sessionInfo.jsp"%>
<%

  String tableName = SzConvert.toSpaceStr((String)session.getAttribute("SzPicture" + iMKID_SESSION));
  if (tableName.equals("")) {
	  tableName = "SZXT_TPFJ";
  }
  SzAnnex szAnnex = new SzAnnex(tableName);
  String sOPERATOR = SzConvert.toSpaceStr(request.getParameter("OPERATOR"));
     //System.out.println("==============================" + sOPERATOR );
  if (sOPERATOR.equals("delete")) {

	  String sFJID = SzConvert.toZeroStr(request.getParameter("FJID"));
	  szAnnex.deleteAnnex("FJID=" + sFJID);

	  %>
	  <SCRIPT LANGUAGE="JavaScript">
	      //window.opener.pasteImage();
	      window.opener.document.location.reload();
	      window.close();
	  </SCRIPT>
	  <%	  
  } else {
    String sFilePath = ""; 
    String obj = "";
    try {
	  SmartUpload smartUpload = new SmartUpload();
	  smartUpload.initialize(pageContext);
	  smartUpload.setAllowedFilesList("gif,GIF,bmp,BMP,jpeg,JPEG,jpg,JPG,png,PNG");
	  smartUpload.upload();

	  Request requestSu = smartUpload.getRequest();
	  obj = SzConvert.toSpaceStr(requestSu.getParameter("obj"));	  	  
	  int iFJXX = iDLID_SESSION;
	  boolean flag = szAnnex.add(smartUpload, sDLXM_SESSION, iFJXX);	  
	  sFilePath = "" + szAnnex.getLastUploadFile();	  
    }
    catch(java.lang.Exception ex) {
    }
%>
<SCRIPT LANGUAGE="JavaScript">
    var vObj = "<%=obj%>";
    var vPath = "<%=sFilePath%>";
    var oWindow = window.dialogArguments;
    if (vObj != "") {
      eval("oWindow." + vObj + ".value='" + vPath + "';");   
    }
    window.close();
</SCRIPT>
<%
  }
%>