<%@ page contentType="text/html;charset=gbk" %>
<%@ page import="java.util.*" %>
<%@ page import="net.sz600.tool.SzConvert" %>
<%@ page import="net.sz600.dbforeign.*" %>
<%@ page import="net.sz600.system.*" %>
<%@ page import="net.sz600.basicdata.*" %>
<%@ page import="net.sz600.formEngine2.*" %>
<%@ include file="/sessionInfo.jsp"%>
<%
    String sOPERATOR = SzConvert.toSpaceStr(request.getParameter("OPERATOR"));
    String GLSM = SzConvert.toSpaceStr(request.getParameter("relateName") );
    String sObjectType = SzConvert.toSpaceStr(request.getParameter("ObjectType")); 
    boolean flag = true;
    DBReadSelectXMLdb readSelectXML = new DBReadSelectXMLdb();
    if (sOPERATOR.equals("set") || sOPERATOR.equals("add") ) {
    	flag = readSelectXML.add(request);
    } else if (sOPERATOR.equals("delete") || sOPERATOR.equals("delete2")) {
    	flag = readSelectXML.delete(GLSM);    	
    }
    
    String sMessage = SzOut.getMessage();
    if (flag) {    	
        out.println(SzPageHelp.jsAlert("操作成功"));
        if (sOPERATOR.equals("set")) { //保存才可以
        	String sFunction = "OpenSelectWin";
        	if (sObjectType.equals("101")) {
        		sFunction = "OpenDetailSelectWin";
        	}
%>
  <script language="javascript">  
    //把生成的选择html放到
    var oWindow = window.opener;
    //var id = oWindow.getNewObjectCount("6");
    var vHtml = "";
    vHtml += "<input type='button' name='btnSelect' class='btnClassShort' value='选择' ";  
    vHtml += " OnClick=\"javascript:<%=sFunction%>('');\">";
    oWindow.AddSelectHtml(vHtml);
    window.close();
  </script>
<%
        } else if (sOPERATOR.equals("add") || sOPERATOR.equals("delete2")) {
%> 
  <script language="javascript">  
    //把生成的选择html放到
    var oWindow = window.opener;
    if (oWindow != null) {
		oWindow.document.location.reload();
	}
    window.close();
     window.location.href="foreign_db_index.jsp";
  </script>
<%      	
        } else {
%>
  <script language="javascript"> 
    window.close();
   
  </script>
<%        	
    } 
    } else {
        out.println(SzPageHelp.jsAlertBack(sMessage));
    }
%>
