<!--#include file="../../ACT.Function.asp"-->
<!--#include file="../ACT.F.asp"-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>ACT_标签管理</title>
<link href="../../Images/css1/css.css" rel="stylesheet" type="text/css">
</head>
<SCRIPT src="../../../ACT_inc/dtreeFunction.js"></SCRIPT>
<LINK href="../../../ACT_inc/dtree.css" type=text/css rel=StyleSheet>
<SCRIPT src="../../../ACT_inc/dtree.js" type=text/javascript></SCRIPT>
<body>
<%
Dim Action,ID,LabelRS,LabelName,LabelContent,LabelFlag,LabelContentArr,Rs,pages,ModeID
Dim TitleCss,OpenType,NavWord,Navpic,NavType,ClassName,ColNumber,Division,NavHeight,sysdir
sysdir=actcms.ActSys
Action = Request.QueryString("Action")
ID =  actcms.ChkNumeric(Request.QueryString("ID"))
Dim ActF,divid,divclass,ulid,ulclass,liid,liclass,Str,ACTIF,freetp,ATT
If Not ACTCMS.ACTCMS_QXYZ(0,"bqxt","") Then   Call Actcms.Alert("对不起，你没有操作权限！","")
Response.Buffer = True
Response.Expires = -1
Response.ExpiresAbsolute = Now() - 1
Response.Expires = 0
Response.CacheControl = "no-cache"

IF Action = "Add" Then
	NavType = 0
	ModeID=  0
	ColNumber =1
	NavHeight =20
	ATT = 0
	ActF=1
	ClassName = "整站导航"
	pages = "新建网站总导航标签"
	ModeID =  actcms.ChkNumeric(Request.QueryString("ModeID"))
Else
	  Set LabelRS = Server.CreateObject("Adodb.Recordset")
	  LabelRS.Open "Select LabelName,LabelContent,LabelFlag From Label_Act Where ID=" & ID & "", Conn, 1, 1
	  If LabelRS.EOF And LabelRS.BOF Then
		 LabelRS.Close
		 Conn.Close:Set Conn = Nothing
		 Set LabelRS = Nothing
		 Response.Write "参数传递出错!":Response.End
	  End If
		LabelName = Replace(Replace(LabelRS("LabelName"), "{ACTCMS_", ""), "}", "")
		LabelContent = LabelRS("LabelContent")
		LabelFlag = Clng(LabelRS("LabelFlag"))
		LabelRS.Close:Set LabelRS = Nothing
		LabelContent = Replace(Replace(LabelContent, "{$GetClassNavigation(", ""), ")}", "")
		LabelContent = Replace(LabelContent, """", "") 
		LabelContentArr = Split(LabelContent, "§")
		ModeID = LabelContentArr(0)
		OpenType =  LabelContentArr(1)
		ColNumber =  LabelContentArr(2)
		NavHeight =  LabelContentArr(3)
		TitleCss =  LabelContentArr(4)
		Division =  LabelContentArr(5)
		NavType = LabelContentArr(6)
		ActF= LabelContentArr(8)
		divid=LabelContentArr(9)
		divclass=LabelContentArr(10)
		ulid=LabelContentArr(11)
		ulclass=LabelContentArr(12)
		liid=LabelContentArr(13)
		liclass=LabelContentArr(14)
		IF NavType = 0 Then 
			NavWord = LabelContentArr(7)
			Navpic = ""
		Else
			NavWord = ""
			Navpic = LabelContentArr(7)
		End IF
		pages = "修改网站总导航标签"
End IF
Function ReturnAllChannel(FolderID)
  Dim ChannelStr:ChannelStr = ""
      ChannelStr = "<select name=""select1"" onChange=""SelectClass();"">"
      ChannelStr = ChannelStr & "<option value=""0""> 整站导航  </option>"
	  if FolderID="888" then
	  ChannelStr = ChannelStr & "<option value=""888"" style=""color:red"" selected>当前频道通用</option>"
	  else
	  ChannelStr = ChannelStr & "<option value=""888"" style=""color:red"">当前频道通用</option>"
	  end if
	 
	 
	  if  InStr(FolderID, ",") > 0  then
	  ChannelStr = ChannelStr & "<option value=""973"" style=""color:blue"" selected>指定栏目</option>"
	  else
	  ChannelStr = ChannelStr & "<option value=""973"" style=""color:blue"">指定栏目</option>"
	  end if
	  
	 'ChannelStr = ChannelStr & "<option value=""973"" >指定栏目</option>"
		ChannelStr = ChannelStr & "<optgroup  label=""指定到模块"">"
		ChannelStr = ChannelStr & ReturnChannelOption(FolderID)
   ChannelStr = ChannelStr & "</Select>"
   ReturnAllChannel = ChannelStr
End Function
	Public Function ReturnChannelOption(SelectModeID)
	  Dim ChannelRS:Set ChannelRS=Server.CreateObject("ADODB.Recordset")
	  Dim ChannelStr:ChannelStr = ""
	   ChannelRS.Open "Select * From Mode_Act Where ModeStatus=0", Conn, 1, 1
	   If ChannelRS.EOF And ChannelRS.BOF Then
		  ChannelRS.Close:Set ChannelRS = Nothing:Exit Function
	  Else
		
	   Do While Not ChannelRS.EOF
		  If Cstr(ChannelRS("ModeID")) = Cstr(SelectModeID) Then
		  ChannelStr = ChannelStr & "<option selected value=" & ChannelRS("ModeID") & ">" & ChannelRS("ModeName") & "</option>"
		 Else
		   ChannelStr = ChannelStr & "<option value=" & ChannelRS("ModeID") & ">" & ChannelRS("ModeName") & "</option>"
		 End If
		ChannelRS.MoveNext
		Loop
	   ChannelRS.Close:Set ChannelRS = Nothing
	  End If
	   ReturnChannelOption = ChannelStr
	End Function
%>
<form id="myform" name="myform" method="post" action="AddLabelSave.asp">
 <input type="hidden" name="LabelContent"> 
  <input type="hidden" name="LabelType" value="1">
  <input type="hidden" name="Action" value="<%= Action %>"> 
  <input type="hidden" name="ID" value="<%= ID %>"> 
 <input type="hidden" name="FileUrl" value="GetNavigation.asp"> 
  <table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" class="table">
    <tr>
      <td colspan="2" align="center" class="bg_tr"><%= pages %>&nbsp;</td>
    </tr>
    <tr>
      <td width="50%" class="td_bg">标签名称
      <input name="LabelName" class="textbox" type="text" id="LabelName" value="<%= LabelName %>"></td>
      <td width="50%" class="td_bg">&nbsp;</td>
    </tr>
    <tr>
      <td class="td_bg">标签目录      
        <select name="LabelFlag" id="select">
          <option value="0">系统默认</option>
			 <%=AF.ACT_LabelFolder(CInt(LabelFlag))%>
        </select>&nbsp;&nbsp;<a href="ACT.LabelFolder.asp"><font color=red>新建存放目录</font></a></td>
	 <td width="50%" height="24"  class="td_bg">导航排列方式
	     <input type="radio" <% IF ColNumber = 989 Then Response.Write("Checked") %> id="Arrangement1" name="Arrangement" value="0" onClick="Arrangements(0);"><label for="Arrangement1">横排</label>
	     <input type="radio" <% IF ColNumber <> 989 Then Response.Write("Checked") %> id="Arrangement2" name="Arrangement" value="1" onClick="Arrangements(1);"><label for="Arrangement2">竖排</label>
	   <br><font color="red" >横排一般应用网站总导航,竖排应用栏目导航</font></td>
    </tr>


	 <tr>
      <td width="50%" >
	  输出格式
		 <select class='textbox' style='width:70%' name="ActF" id="ActF" onChange="SetActF(this.options[this.selectedIndex].value);"> 
	 <option value="1" <% IF ActF = 1 Then Response.Write("selected") %>>普通Table格式</option>
  <option value="2" <% IF ActF = 2 Then Response.Write("selected") %>>DIV+CSS格式</option>
  </select>   
		 </td>
      <td width="50%" ><font color=red>请选择系统支持的输出格式</font>
	  </td>
    </tr>
  <tr id=ActFs ><td  colspan="2" >&lt;div id=&quot;
 <input name="divid" type="text" value="<%= divid %>" id="divid" size="6"  style="border-top-width: 0px;border-right-width: 0px;border-bottom-width: 1px;border-left-width:0px;border-bottom-color: #000000" class='textbox' title="DIV调用的ID号，必须在CSS中预先定义且不能为空!">
 &quot; Class=&quot; <input name="divclass" class='textbox' type="text" value="<%= divclass %>" id="divclass" size="6" style="border-top-width: 0px;	border-right-width: 0px;border-bottom-width: 1px;border-left-width: 0px;border-bottom-color: #000000" title="DIV调用的Class名称，请在CSS中预先定义,可以为空!">
  &quot;&gt;&nbsp; &lt;ul  id=&quot; <input value="<%= ulid %>" name="ulid" type="text" id="ulid" class='textbox' size="6" style="border-top-width: 0px;border-right-width: 0px;border-bottom-width: 1px;border-left-width: 0px;border-bottom-color: #000000"  title="生成ul调用的ID，请在CSS中预先定义,可以为空!"> 
  &quot; Class=&quot; <input class='textbox' value="<%= ulclass %>" name="ulclass"  type="text" id="ulclass" size="6" style="border-top-width: 0px;border-right-width: 0px;border-bottom-width: 1px;border-left-width: 0px;border-bottom-color: #000000" title="生成ul调用的class名称，请在CSS中预先定义。可以为空!">
  &quot;&gt;&nbsp;&lt;li id=&quot; <input value="<%= liid %>" name="liid" type="text" id="liid" size="6" class='textbox' style="border-top-width: 0px;	border-right-width: 0px;border-bottom-width: 1px;border-left-width: 0px;border-bottom-color: #000000" title="生成li调用的ID，请在CSS中预先定义。可以为空!">
  &quot; Class=&quot; <input value="<%= liclass %>" name="liclass" class='textbox' type="text" id="liclass" size="6" style="border-top-width: 0px;border-right-width: 0px;border-bottom-width: 1px;border-left-width: 0px;border-bottom-color: #000000"  title="生成li调用的class名称，请在CSS中预先定义。可以为空!"> 
  &quot;&gt;<br><font color=green>如果不想输出该标签,请将ID设为0,例:ul的id设为0,将不输出ul</font></td>
	</tr>
	
	
	
	<tr>
      <td class="td_bg">
	所属栏目   <input name="ModeID" type="text" id="ModeID" value="<%= ModeID %>" readonly  disabled=true>
		
	 <%= ReturnAllChannel(ModeID) %> <a href="#" onClick="SelectClass()">快速打开</a></td>
      <td class="td_bg"><div style="position:relative;">链接目标<span style="margin-left:175px;width:18px;overflow:hidden;">
        <select name="select" class='textbox' style="width:185px;margin-left:-167px" onChange="this.parentNode.nextSibling.value=this.value">
          <option value=""></option>
          <option value="_blank"> _blank </option>
          <option value="_parent"> _parent </option>
          <option value="_self"> _self </option>
          <option value="_top"> _top </option>
        </select>
        </span>
            <input class='textbox' name="OpenType" style="width:175px;position:absolute;left:55px;" value="<%= OpenType %>">
      </div></td>
    </tr>
    <tr>
      <td class="td_bg">排列列数
      <input type="text" class="textbox"   size="4"  <% IF ColNumber = 989 Then Response.Write " disabled='true'" %> value="<%= ColNumber %>" name="ColNumber"> &nbsp;高度
      <input name="NavHeight" type="text" class="textbox" id="NavHeight" value="<%= NavHeight %>"   size="4"></td>
      <td class="td_bg">标题样式
	  <input name="TitleCss" type="text" style="width:50%;" id="TitleCss" value="<%= TitleCss %>"></td>
    </tr>
    <tr>
      <td colspan="2" class="td_bg">分隔图片
        <input name="Division" class="textbox" type="text" id="Division" style="width:61%;" value="<%= Division %>" readonly>
        <input class="ACT_btn" type="button" onClick="OpenWindowAndSetValue('../print/SelectPic.asp?CurrPath=<%=sysdir%>',500,320,window,document.myform.Division);" name="Submit3" value="选择图片...">
		 &nbsp;<span style="cursor:hand;color:green;" onClick="javascript:document.myform.Division.value='';" onMouseOver="this.style.color='red'" onMouseOut="this.style.color='green'">清除</span></td>
    </tr>
   
    <tr >
      <td class="td_bg">导航类型
        <input id="NavType1"  <% IF NavType = 0 Then Response.Write("Checked") %> type="radio" name="NavType" value="0" onClick="SetNavStatus(1);"><label for="NavType1">文字导航</label>
         <input id="NavType2" <% IF NavType = 1 Then Response.Write("Checked") %> type="radio" name="NavType" value="1" onClick="SetNavStatus(2);"><label for="NavType2">图片导航</label>
        		</td>
    <td width="50%" height="24" class="td_bg"  id=SetNavStatus1 
	<% if NavType=1 then %>
	style="DISPLAY: none" 
	<% end if %>>
 <input name="NavWord" type="text" class="textbox" id="NavWord" style="width:70%;" value="<%= server.HTMLEncode(NavWord) %>"> 
 支持HTML语法</td>
   <td width="50%" height="24" class="td_bg"  id=SetNavStatus2 
	<% if NavType=0 then %>
	style="DISPLAY: none"
	SetNavStatus1.style.display=''
	<% end if %> >
<input name="NavPic" type="text" class="textbox" id="NavPic" style="width:250;" value="<%= NavPic %>" readonly>
<input class="ACT_btn" type="button"  onClick="OpenWindowAndSetValue('../print/SelectPic.asp?CurrPath=<%=sysdir%>',500,320,window,document.myform.NavPic);" value="选择图片...">&nbsp;<span style="cursor:hand;color:green;" onClick="javascript:document.myform.NavPic.value='';" onMouseOver="this.style.color='red'" onMouseOut="this.style.color='green'">清除</span></td>  
    </tr>

    <tr>
      <td colspan="2" align="center" class="td_bg">
	   <input name="SubmitBtn" class="ACT_btn" type="button"  onClick="InsertScriptFun()"  id="SubmitBtn"  value=" 确 定 ">	
	    &nbsp;&nbsp; <input type="reset" class="ACT_btn" name="Submit" value="  重置  ">  </td>
    </tr>
    </table>
  
</form>
<script language="javascript" >
	
function SetNavStatus(n){
			if (n==1){
			SetNavStatus1.style.display='';
			SetNavStatus2.style.display='none';	
			}
		  else{
			SetNavStatus1.style.display='none';
			SetNavStatus2.style.display='';	
		}
}
function OpenWindowAndSetValue(Url,Width,Height,WindowObj,SetObj)
{
	var ReturnStr=showModalDialog(Url,WindowObj,'dialogWidth:'+Width+'pt;dialogHeight:'+Height+'pt;status:yes;help:no;scroll:yes;');
	if (ReturnStr!='') SetObj.value=ReturnStr;
	return ReturnStr;
}	
function SelectClass()
{

 if(document.myform.select1.value==0)	
	{
	document.all.ModeID.value=0
	}
 if(document.myform.select1.value==1)	
	{
	document.all.ModeID.value=1
	}
 if(document.myform.select1.value==2)	
	{
	document.all.ModeID.value=2
	}
 if(document.myform.select1.value==888 )	
	{
	document.all.ModeID.value=888
	}

 if(document.myform.select1.value==973 )	
	{	
	var result = Selector(2, document.all.ModeID.value);
	if(!result) return false;
	var val = "";
	for(var i=0; i<result.length; i++)
	{
		if(val == "")
		{
			val += result[i].id;
		}else{
			val += "," + result[i].id;
		}
	}
	document.all.ModeID.value = val;
	}
	}
	


function Arrangements(n){
			if (n==0){
document.myform.ColNumber.disabled=true
document.myform.ColNumber.value =989
			}
		  else{
document.myform.ColNumber.disabled=false
document.myform.ColNumber.value =1
		}
}

		function SetActF(Val)
		{
		 if(Val==1)	
			{
			 ActFs.style.display="none";
			}
		 if(Val==2)	
			{
			 ActFs.style.display="";
			}
		}

function OpenWindow(Url,Width,Height,WindowObj)
{
	var ReturnStr=showModalDialog(Url,WindowObj,'dialogWidth:'+Width+'pt;dialogHeight:'+Height+'pt;status:no;help:no;scroll:no;');
	return ReturnStr;
}
		function InsertScriptFun(Obj)
		{   if (document.myform.LabelName.value=='')
			 {
			  alert('请输入标签名称');
			  document.myform.LabelName.focus(); 
			  return false
			  }
			var NavType=1;
			var OpenType='"'+document.myform.OpenType.value+'"';
			var ModeID=document.myform.ModeID.value;
			var TitleCss='"'+document.myform.TitleCss.value+'"';
			var Division='"'+document.myform.Division.value+'"';
			var ColNumber=document.myform.ColNumber.value;
			var NavHeight=document.myform.NavHeight.value;
			for (var i=0;i<document.myform.NavType.length;i++){
				 var TCJ = document.myform.NavType[i];
				if (TCJ.checked==true)	   
					NavType = TCJ.value
				if  (NavType==0) Nav='"'+document.myform.NavWord.value+'"'
				 else  Nav='"'+document.myform.NavPic.value+'"';
				}

			var divid=document.myform.divid.value;
			var divclass=document.myform.divclass.value;
			var ulid=document.myform.ulid.value;
			var ulclass=document.myform.ulclass.value;
			var liid=document.myform.liid.value;
			var liclass=document.myform.liclass.value;
			var ActF=document.myform.ActF.value;

				
			if  (ColNumber=='') ColNumber=1;
			if (NavHeight=='') NavHeight=20
			document.myform.LabelContent.value=	'{$GetClassNavigation('+ModeID+'§'+OpenType+'§'+ColNumber+'§'+NavHeight+'§'+TitleCss+'§'+Division+'§'+NavType+'§'+Nav+'§'+ActF+'§'+divid+'§'+divclass+'§'+ulid+'§'+ulclass+'§'+liid+'§'+liclass+')}';
			document.myform.SubmitBtn.value="正在提交数据,请稍等...";
			document.myform.SubmitBtn.disabled=true;
			document.myform.Submit.disabled=true;	
			document.myform.submit();
		}
</script><script language="javascript">SetActF(<%= ActF %>);</script>
</body>
</html>
