<%@ Page Language="C#" AutoEventWireup="true" Codebehind="inputLabel.aspx.cs" Inherits="ZYDN.Web.system.Label.inputLabel" %>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>导入标签</title>
    <link rel="stylesheet" type="text/css" href="../skins/css/main.css" />
    <link rel="stylesheet" type="text/css" href="../skins/css/Sys.css" />

    <script type="text/javascript" language="javascript" src="../js/JFramework.js"></script>

    <script type="text/javascript" language="javascript" src="../js/Sys.js"></script>

    <script type="text/javascript" language="javascript">
       var objAjax=new JAjax();
       
    
        function skip1(){
			var out=objAjax.getText("post","inputLabel.aspx?type=testFile",null,null);
			if (out=="0"){
			    alert("没有找到来源标签库, 请把要导入系统的标签库上传到:\"upfile\tempData\"目录下,文件名为: \"www.zydn.net.Label.mdb\"");
			    return;
			}else if (out=="1"){
			  //  alert("路径正确");
			    skip2();
			}else{
			    alert(erStr(out));
			    return;
			}
			
			
        }
        
        
      function skip2(){ //第二步, 选择标签.

        var obj=document.getElementsByName("Skip");
        obj[0].style.display="none";
        obj[1].style.display="";
        obj[2].style.display="none";

        var t=new outTitle();
        t.add("标签名","","170");
        t.add("模板","","130");
        t.add("所属栏目","","120");
        t.obj=document.getElementById("labelTitle");
        t.create();	

        var objResponse=new JHttpResponse();
        objResponse.write("findKey",$("findKey").value);
        objResponse.write("findType",$("findType").value);
        out=objAjax.getText("post","inputLabel.aspx?type=listLabel",objResponse,null);
			//alert(out);
	
		if (out.length==0){
			alert("没有找到标签");
			return;
		}
		if (out.indexOf(c1)==-1){
			alert(erStr(out.toString()));
			return false;
		}
		  out= comminute(out,c1,c2);  //分割数据
		  lList=out;
		
		//id,labelName,labelType,menuName,labelClass 
		  $("labelList").innerHTML="";
		  var wData=new tabList();
		  wData.obj=$("labelList");
		  wData.rowid="labelRow_";                         //行的ID
		  wData.rowClass="tabListBodyRow";                 //行的样式
		  wData.mode=1;                                    //数据显示的格式
		  wData.isCheckbox=true;                          //加上复选框
		  wData.checkBoxID="labelBox";                     //复选框名
		  wData.onmouseroverRun="rowonmouseover";    //鼠标移上
		  wData.onmouseroutRun="rowonmouseout";      //鼠标移走
		  wData.onclickRun="rowonclick";             //鼠标单击
		  wData.ondblclickRun="";       //鼠标双击
		  wData.add(raadArray(out,1,0),"","170");   //添加一列数据 标签
		  wData.add(raadArray(out,2,0),"","130");   //添加一列数据 模板
		  wData.add(raadArray(out,3,0),"","120");   //添加一列数据  所属栏目
		  wData.addid(raadArray(out,0,0));            //添加行标识 tid
		  wData.create();
		  
		  var cObj=document.getElementsByName("labelRow__1"); //字符处理第二列
		  for (var i=0;i<cObj.length;i++){
			  var str=cObj[i].innerHTML;
			  cObj[i].innerHTML=str.split("|")[0];
		  }
      }  
     
     
 
    function skip3(){ //第三步, 开始导入
        var obj= document.getElementsByName("labelBox");
        //alert(obj.length);
       var idList="";
        for (var i=0;i<obj.length;i++){
            if (obj[i].checked){
                idList =  idList + obj[i].value+",";
            }
        }
        if (idList==""){
            alert("请选择您要导入的标签");
            return;
        }
    
        
        var obj=document.getElementsByName("Skip");
        obj[0].style.display="none";
        obj[1].style.display="none";
        obj[2].style.display="";
        
        var objResponse=new JHttpResponse();
        objResponse.write("idList",idList);
        out=objAjax.getText("post","inputLabel.aspx?type=input",objResponse,null);
        if (out=="1"){
            $("inputMsg").style.display="";
            //alert("导入成功");
            return;
        }else{
            alert(erStr(out));
            return;
        }

    }
    
    
    
    
    
    var selectObj; var tempObj;
      
    rowonmouseover=function rowonmouseover(obj){
		tempObj=obj;
		obj.className="tabListBodyRow_1";
	}
	
	function rowonmouseout(obj){
		tempObj=null;
		if (obj !=selectObj){
			obj.className="tabListBodyRow";
		}
	}
	
      function rowonclick(obj){
		try{
			form1.labelBox[tempObj.i].click();
			if (selectObj!=null & selectObj!=obj){
				selectObj.className="tabListBodyRow";
			}
		}catch(e) {}
		selectObj=tempObj;
	}
      
    
    
    </script>

</head>
<body onload="loadBodyclick();">
    <div id="Skip" name="Skip">
        <div>
            请把需要导入的标签库文件放到\upfile\tempData目录下,文件名为 www.zydn.net.Label.mdb .
        </div>
        <div style="text-align: center;">
            <input type="button" value="下一步" onclick="skip1();" /></div>
    </div>
    <div id="Skip" name="Skip" style="display: none;">
        <form id="form1" name="form1">
            <div>
                标签名:<input style="width: 100px;" type="text" id="findKey"/>
                标签类型:
                <select id="findType">
                    <option value="">请选择</option>
                    <option value="全站通用">全站通用</option>
                    <option value="栏目页">栏目页</option>
                    <option value="内容页">内容页</option>
                    <option value="论坛标签">论坛标签</option>
                    <option value="其它类型">其它类型</option>
                </select>
                <input onclick="skip2()" type="button" value="搜索" />
            </div>
            <div style="border: 1px solid #808080;width:450px;">
                <div id="labelTitle" class="titleRow">
                </div>
                <div id="labelList" style="width: 450px; height: 300px; overflow: scroll;">
                </div>
            </div>
        </form>
        <div>
            请在列表中选择您要导入的标签</div>
        <div style="text-align: center;">
            <input type="button" value="开始" onclick="skip3()"/></div>
    </div>
    <div id="Skip" name="Skip" style="display: none;">
        <div id="inputMsg" style="display:none; text-align:center;">
        <br/>
        标签导入完成,
        </div>
        <div style="text-align: center;">
           </div>
    </div>
</body>
</html>
