<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv='Content-Type' content='text/html; charset=gb2312'>
<title>栏目管理</title>
<link href="css_body.css" rel="stylesheet" type="text/css" />
<script language="javascript">
var channelArray = new Array();
<?php
$i = 0;
foreach($channelArray as $k=>$arr){
  echo "channelArray[$k] = \"{$arr['nid']}\";\r\n";
}
?>

function SelectTemplets(fname){
   var posLeft = window.event.clientY-200;
   var posTop = window.event.clientX-300;
   window.open("../include/dialog/select_templets.php?f="+fname, "poptempWin", "scrollbars=yes,resizable=yes,statebar=no,width=600,height=400,left="+posLeft+", top="+posTop);
}

function ShowHide(objname){
  var obj = document.getElementById(objname);
  if(obj.style.display == "block" || obj.style.display == "")
	   obj.style.display = "none";
  else
	   obj.style.display = "block";
}

function ShowObj(objname){
   var obj = document.getElementById(objname);
	 obj.style.display = "block";
}

function HideObj(objname){
  var obj = document.getElementById(objname);
	obj.style.display = "none";
}

function ShowItem1(){
  ShowObj('head1'); ShowObj('needset'); HideObj('head2'); HideObj('adset');
}

function ShowItem2(){
  ShowObj('head2'); ShowObj('adset'); HideObj('head1'); HideObj('needset');
}

function CheckTypeDir(){
  var upinyin = document.getElementById('upinyin');
  var tpobj = document.getElementById('typedir');
  if(upinyin.checked) tpobj.style.display = "none";
  else tpobj.style.display = "block";
}

function ParTemplet(obj)
{
  var sevvalue = channelArray[obj.value];
  var tempindex = document.getElementsByName('tempindex');
  var templist = document.getElementsByName('templist');
  var temparticle = document.getElementsByName('temparticle');
  //var dfstyle = document.getElementsByName('dfstyle');
  //var dfstyleValue = dfstyle[0].value;
  tempindex[0].value = "{style}/index_"+sevvalue+".htm";
  templist[0].value = "{style}/list_"+sevvalue+".htm";
  temparticle[0].value = "{style}/article_"+sevvalue+".htm";
}

function checkSubmit()
{
   if(document.form1.typename.value==""){
		  alert("栏目名称不能为空！");
		  return false;
	 }
	 return true;
}

function ShowSonList(){
   if(document.form1.needson.checked){
      ShowObj('sonlist');
   }else{
      HideObj('sonlist');
   }
}

</script>
<style type="text/css">
<!--
.STYLE1 {color: #FFFFFF}
-->
</style>
</head>
<body leftmargin='15' topmargin='10'>
<table width="96%" border="0" cellpadding="1" cellspacing="1" align="center" class="tbtitle" style="	background:#E2F5BC;">
  <tr>
    <td width="100%" height="20" valign="top">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td height="30">&nbsp;<a href="catalog_main.php"><u>栏目管理</u></a>&gt;&gt;修改栏目</td>
        </tr>
      </table></td>
  </tr>
</table>
<table width="96%" border="0" cellpadding="1" cellspacing="1" align="center" class="tbtitle" style="	background:#E2F5BC;">
  <tr>
  <form name="form1" action="catalog_edit.php" method="post" onSubmit="return checkSubmit();">
  <input type="hidden" name="dopost" value="save">
  <input type="hidden" name="ID" value="<?php echo $ID?>">
  <input type="hidden" name="topID" value="<?php echo $myrow['topID']?>">
  <td height="95" align="center" bgcolor="#FFFFFF">
	<table width="100%" border="0" cellspacing="0" id="head1" cellpadding="0" class="htable">
     <tr>
       <td colspan="2" align="left" bgcolor="#EDF9D5">
<table width="168" border="0" cellpadding="0" cellspacing="0">
                <tr>
                  <td width="84" height="24" align="center" bgcolor="#FFFFFF">&nbsp;常规选项&nbsp;</td>
                  <td width="84" align="center" bgcolor="#006600"><a href="#" class="STYLE1" onClick="ShowItem2()"><u>高级选项</u></a>&nbsp;</td>
                </tr>
              </table>
            </td>
          </tr>
        </table>
        <table width="100%" border="0" cellspacing="0" id="head2" cellpadding="0" style="border-bottom:1px solid #CCCCCC;display:none">
          <tr>
            <td colspan="2" align="left" bgcolor="#EDF9D5">
<table width="168" height="24" border="0" cellpadding="0" cellspacing="0">
                <tr>
                  <td width="84" align="center" bgcolor="#006600"><a href="#" class="STYLE1" onClick="ShowItem1()"><u>常规选项</u></a>&nbsp;</td>
                  <td width="84" align="center" bgcolor="#FFFFFF">高级选项&nbsp;</td>
                </tr>
              </table>
            </td>
          </tr>
       </table>
	    <table width="98%" border="0"  id="needset" cellspacing="0" cellpadding="0">
          <tr>
            <td width="120" height="26" align="left" class='bline'>是否支持投稿：</td>
            <td align="left" class='bline'> <input type='radio' name='issend' value='0' class='np' <?php if($myrow['issend']=="0") echo " checked";?>>
              不支持&nbsp; <input type='radio' name='issend' value='1' class='np' <?php if($myrow['issend']=="1") echo " checked";?>>
              支持 </td>
          </tr>
          <tr>
            <td width="120" height="26" align="left" class='bline'>是否隐藏栏目：</td>
            <td align="left" class='bline'> <input type='radio' name='ishidden' value='0' class='np'<?php if($myrow['ishidden']=="0") echo " checked";?>>
              显示　&nbsp; <input type='radio' name='ishidden' value='1' class='np'<?php if($myrow['ishidden']=="1") echo " checked";?>>
              隐藏 </td>
          </tr>
          <tr>
            <td height="26" align="left" class='bline'>栏目名称：</td>
            <td align="left" class='bline'><input name="typename" type="text" id="typename" size="30" value="<?php echo $myrow['typename']?>"></td>
          </tr>
          <tr>
            <td height="26" align="left" class='bline'> 排列顺序： </td>
            <td align="left" class='bline'> <input name="sortrank" size="6" type="text" value="<?php echo $myrow['sortrank']?>">
              （由低 -&gt; 高） </td>
          </tr>
          <tr>
            <td height="26" align="left" class='bline'>浏览权限：</td>
            <td align="left" class='bline'>
			<input type="hidden" name="corank_old" value="<?php echo $myrow['corank']?>">
			<select name="corank" id="corank" style="width:100px">
                <?php
              $dsql->SetQuery("Select * from #@__arcrank where rank >= 0");
              $dsql->Execute();
              while($row = $dsql->GetObject())
              {
              	if($myrow['corank']==$row->rank)
              	  echo "<option value='".$row->rank."' selected>".$row->membername."</option>\r\n";
				        else
				          echo "<option value='".$row->rank."'>".$row->membername."</option>\r\n";
              }
              ?>
              </select>
              (本权限仅对<font color="#0000FF"><strong>最终列表栏目</strong></font>有效，设置后本栏目发布或审核后的所有文档将使用此权限)
            </td>
          </tr>

          <tr>
            <td height="26" align="left" class='bline'>文件保存目录：</td>
            <td align="left" class='bline'> <input name="typedir" type="text" id="typedir" value="<?php echo $myrow['typedir']?>" style="width:300px">
            </td>
          </tr>
          <tr>
            <td height="26" align="left" class='bline'>内容模型： &nbsp; </td>
            <td align="left" class='bline'> <select name="channeltype" id="channeltype" style="width:200px" onChange="ParTemplet(this)">
                <?php
            foreach($channelArray as $k=>$arr)
            {
            	if($k==$channelid) echo "    <option value='{$k}' selected>{$arr['typename']}|{$arr['nid']}</option>\r\n";
              else  echo "    <option value='{$k}'>{$arr['typename']}|{$arr['nid']}</option>\r\n";
            }
            ?>
              </select> </td>
          </tr>
          <tr>
            <td height="26" align="left" class='bline'>栏目列表选项：</td>
            <td align="left" class='bline'> <input type='radio' name='isdefault' value='1' class='np'<?php  if($myrow['isdefault']==1) echo" checked";?>>
              链接到默认页
              <input type='radio' name='isdefault' value='0' class='np'<?php  if($myrow['isdefault']==0) echo" checked";?>>
              链接到列表第一页
              <input type='radio' name='isdefault' value='-1' class='np'<?php  if($myrow['isdefault']==-1) echo" checked";?>>
              使用动态页 </td>
          </tr>
          <tr>
            <td height="26" align="left" class='bline'>默认页的名称： </td>
            <td align="left" class='bline'><input name="defaultname" type="text" value="<?php echo $myrow['defaultname']?>"></td>
          </tr>
          <tr>
            <td height="26" align="left" class='bline'>栏目属性：</td>
            <td align="left" class='bline'> <input name="ispart" type="radio" id="radio" value="0" class='np'<?php  if($myrow['ispart']==0) echo" checked";?>>
              最终列表栏目（允许在本栏目发布文档，并生成文档列表）<br> <input name="ispart" type="radio" id="radio2" value="1" class='np'<?php  if($myrow['ispart']==1) echo" checked";?>>
              频道封面（栏目本身不允许发布文档）<br> 
              <input name="ispart" type="radio" id="radio3" value="2" class='np'<?php  if($myrow['ispart']==2) echo" checked";?>>
              单独页面（栏目本身不允许发布文档） 
              <br>
              <input name="ispart" type="radio" id="radio" value="3" class='np'<?php  if($myrow['ispart']==3) echo" checked";?>>
           跳转网址（在文件保存目录处填写完整网址）
              </td>
          </tr>
		  <?php
		  $needcheckS = "";
		  $needshowS = "none";
		  if(!empty($myrow['smalltypes'])){
		     $needcheckS = " checked";
			 $needshowS = "block";
			 $smalltypes = explode(',',$myrow['smalltypes']);
		  }
		  ?>
		  <tr>
            <td height="26" align="left" class='bline'>启用小分类：</td>
            <td align="left" class='bline'>
			<input name="needson" type="checkbox"  id="needson" value="1" onClick="ShowSonList()"<?php  echo $needcheckS; ?>>
            启用
			（仅适用于分类信息等互动模型）</td>
          </tr>
          <tr id="sonlist" style="display:<?php echo $needshowS; ?>">
            <td height="26" align="left" class='bline'>小分类：</td>
            <td align="left" class='bline' style='padding-top:5px;padding-bottom:5px;'>
			<select name="sonlists[]" id="sonlists" style="width:200px" size="6" multiple="multiple">
       <?php
			  $dsql->SetQuery("select id,name from #@__smalltypes order by disorder asc");
        $dsql->Execute();
			  while($row = $dsql->GetObject())
			  {
			    if(!empty($smalltypes) && in_array($row->id,$smalltypes)) echo "        <option value='{$row->id}' selected>{$row->name}</option>\r\n";
				  else echo "        <option value='{$row->id}'>{$row->name}</option>\r\n";
			  }
			  ?>
       </select>
			(按Ctrl多选)
            </td>
          </tr>
        </table>
	    <table width="98%" border="0" cellspacing="0" cellpadding="0" style="display:none" id="adset">
          <tr>
            <td width="120" height="24" align="left" class='bline'>多站点支持：</td>
            <td align="left" class='bline'>
            	<input name="moresite" type="radio"   value="0"<?php  if($myrow['moresite']==0) echo" checked";?>>
              不启用
              <input type="radio" name="moresite"  value="1"<?php  if($myrow['moresite']==1) echo" checked";?>>
              启用
              </td>
          </tr>
          <tr>
            <td height="24" align="left" bgcolor="#F3F7EA">说明：</td>
            <td align="left" bgcolor="#F3F7EA">绑名绑定仅需要在顶级栏目设定，下级栏目更改无效。</td>
          </tr>
          <tr>
            <td height="24" align="left" class='bline'>绑定域名：</td>
            <td align="left" class='bline'> <input name="siteurl" type="text" id="siteurl" size="35" value="<?php echo $myrow['siteurl']?>">
              (需加 http://，一级或二级域名的根网址) </td>
          </tr>
          <tr>
            <td height="24" align="left" class='bline'>站点根目录：</td>
            <td align="left" class='bline'>
            	<input name="sitepath" type="text" id="sitepath" size="35" value="<?php echo $myrow['sitepath']?>">
              <input name="siterefer" type="radio" id="siterefer1"  value="1"<?php  if($myrow['siterefer']==1) echo" checked";?>>
              相对于当前站点根目录
              <input name="siterefer" type="radio" id="siterefer2"  value="2"<?php  if($myrow['siterefer']==2) echo" checked";?>>
              绝对路径
              </td>
          </tr>
          <tr id='helpvar1' style='display:none'>
            <td height="24" align="left" bgcolor="#F3F7EA">支持变量： </td>
            <td align="left" bgcolor="#F3F7EA"> {tid}表示栏目ID，<br>
              {cid}表示频道模型的'名字ID' <font color='#888888'> （
              <?php
              foreach($channelArray as $k=>$arr)
              {
            	   echo "{$arr['typename']}({$arr['nid']})、";
              }
             ?>
              ） </font> <br/>
              模板文件的默认位置是放在模板目录 "cms安装目录
              <?php echo $cfg_templets_dir ?>
              " 内。
              <input type='hidden' value='{style}' name='dfstyle'> </td>
          </tr>
          <tr>
            <td height="33" align="left">封面模板：</td>
            <td height="33" align="left"> <input name="tempindex" type="text" value="<?php echo $myrow['tempindex']?>" style="width:300px">
              <input type="button" name="set1" value="浏览..." style="width:60px" onClick="SelectTemplets('form1.tempindex');" class="inputbut">
              <img src="img/help.gif" alt="帮助" width="16" height="16" border="0" style="cursor:hand" onClick="ShowHide('helpvar1')">
            </td>
          </tr>
          <tr>
            <td height="33" align="left">列表模板：</td>
            <td height="33" align="left"> <input name="templist" type="text" value="<?php echo $myrow['templist']?>" style="width:300px">
              <input type="button" name="set3" value="浏览..." style="width:60px" onClick="SelectTemplets('form1.templist');" class="inputbut">
            </td>
          </tr>
          <tr>
            <td height="33" align="left">文章模板：</td>
            <td height="33" align="left"><input name="temparticle" type="text" value="<?php echo $myrow['temparticle']?>" style="width:300px">
              <input type="button" name="set4" value="浏览..." style="width:60px" onClick="SelectTemplets('form1.temparticle');" class="inputbut">
            </td>
          </tr>
          <tr>
            <td height="33" align="left">单独页面模板：</td>
            <td height="33" align="left"><input name="tempone" type="text" value="<?php echo $myrow['tempone']?>" style="width:300px">
              <input type="button" name="set2" value="浏览..." style="width:60px" onClick="SelectTemplets('form1.tempone');" class="inputbut">
            </td>
          </tr>
          <tr id='helpvar2' style='display:none'>
            <td height="24" align="left" bgcolor="#F3F7EA">支持变量： </td>
            <td height="24" align="left" bgcolor="#F3F7EA"> {Y}、{M}、{D} 年月日<br/>
              {timestamp} INT类型的UNIX时间戳<br/>
              {aid} 文章ID<br/>
              {pinyin} 拼音+文章ID<br/>
              {py} 拼音部首+文章ID<br/>
              {typedir} 栏目目录 <br/>
              {cc} 日期+ID混编后用转换为适合的字母 <br/>
              </td>
          </tr>
          <tr>
            <td height="26" align="left">文章命名规则：</td>
            <td align="left"> <input name="namerule" type="text" id="namerule" value="<?php echo $myrow['namerule']?>" size="40">
              <img src="img/help.gif" alt="帮助" width="16" height="16" border="0" style="cursor:hand" onClick="ShowHide('helpvar2')">
            </td>
          </tr>
          <tr id='helpvar3' style='display:none'>
            <td height="24" align="left" bgcolor="#F3F7EA">支持变量： </td>
            <td align="left" bgcolor="#F3F7EA">{page} 列表的页码</td>
          </tr>
          <tr>
            <td height="26" align="left">列表命名规则：</td>
            <td align="left"> <input name="namerule2" type="text" id="namerule2" value="<?php echo $myrow['namerule2']?>" size="40">
              <img src="img/help.gif" alt="帮助" width="16" height="16" border="0" style="cursor:hand" onClick="ShowHide('helpvar3')"></td>
          </tr>
          <tr>
            <td height="65" align="left">关键字：</td>
            <td align="left"> <textarea name="keywords" cols="40" rows="3" id="keywords"><?php echo $myrow['keywords']?></textarea>
            </td>
          </tr>
          <tr>
            <td height="65" align="left">栏目描述：</td>
            <td height="65" align="left"><textarea name="description" cols="40" rows="3" id="textarea"><?php echo $myrow['description']?></textarea></td>
          </tr>
          <tr>
            <td height="45" align="left">继承选项：</td>
            <td align="left">
              <input name="upnext" type="checkbox" id="upnext" value="1" >
              同时更改下级栏目的内容类型、模板风格、命名规则等通用属性 </td>
          </tr>
        </table>
          <table width="98%" border="0" cellspacing="0" cellpadding="0">
		       <tr>
            <td height="50" align="center"><input name="imageField" type="submit" class="inputbut" value="确定" />&nbsp;&nbsp;&nbsp;
            <a href="catalog_main.php">
            <input type="button" name="button" id="button" value="返回" class="inputbut"/>
            </a>			    </td>
            </tr>
      </table></td>
	  </form>
  </tr>
</table>
</body>
</html>
