<!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=<?php echo $cfg_soft_lang; ?>">
<title>欄目管理</title>
<link href="css/base.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 Nav(){
    if(window.navigator.userAgent.indexOf("MSIE")>=1) return 'IE';
  else if(window.navigator.userAgent.indexOf("Firefox")>=1) return 'FF';
  else return "OT";
}

function SelectTemplets(fname){
   if(document.all){
     var posLeft = window.event.clientY-100;
     var posTop = window.event.clientX-400;
   }
   else{
     var posLeft = 100;
     var posTop = 100;
   }
   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 != "none")
       obj.style.display = "none";
  else {
       if(Nav()=='IE') obj.style.display = "block";
       else obj.style.display = "table-row";
    }
}

function ShowObj(objname)
{
   var obj = document.getElementById(objname);
     if(Nav()=='IE') obj.style.display = "block";
     else obj.style.display = "table";
}

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

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

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

function ShowItem3(){
  ShowObj('head3'); ShowObj('ctset');
  HideObj('head1'); HideObj('needset');
  HideObj('head2'); HideObj('adset');
}

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 tobj = document.getElementById('smclass');
  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 = dfstyleValue+"/index_"+sevvalue+".htm";
  templist[0].value = dfstyleValue+"/list_"+sevvalue+".htm";
  temparticle[0].value = dfstyleValue+"/article_"+sevvalue+".htm";
  if(obj.value < 0)
  {
      if(Nav()=='IE') tobj.style.display = "block";
      else tobj.style.display = "table-row";
  }
  else
  {
      tobj.style.display = "none";
  }
}

function checkSubmit()
{
   if(document.form1.typename.value==""){
          alert("欄目名稱不能為空！");
          document.form1.typename.focus();
          return false;
     }
     return true;
}

function CheckPathSet()
{
    var surl = document.getElementById("siteurl");
    var sreid = document.getElementById("reid");
    var mysel = document.getElementById("truepath3");
    if(surl.value!=""){
        if(sreid.value=="0" || sreid.value==""){
            mysel.checked = true;
        }
    }
}

function CheckCross()
{
    var cross2 = document.getElementById('cross2');
    var crossid = document.getElementById('crossid');
    if(cross2.checked) crossid.style.display = 'block';
    else crossid.style.display = 'none';
}

</script>
</head>
<body leftmargin='15' topmargin='10' bgcolor="#FFFFFF">
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="#111111" style="BORDER-COLLAPSE: collapse">
  <tr>
    <td width="100%" height="20" valign="top">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td height="30"><IMG height=14 src="images/book1.gif" width=20>&nbsp;<a href="catalog_main.php"><u>欄目管理</u></a>&nbsp;&gt;&gt;&nbsp;增加欄目</td>
        </tr>
      </table></td>
  </tr>
  <tr>
    <td width="100%" height="1" background="images/sp_bg.gif"></td>
  </tr>
</table>
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr><td height="10"></td></tr>
  <tr>
  <form name="form1" action="catalog_add.php" method="post" onSubmit="return checkSubmit();">
  <input type="hidden" name="dopost" value="save" />
  <input type="hidden" name="reid" id="reid" value="<?php echo $id; ?>" />
  <input type='hidden' name='topid' id='topid' value='<?php echo $topid; ?>' />
<?php
  if($id>0)
  {
      echo "  <input type='hidden' name='moresite' value='{$myrow['moresite']}' />\r\n";
      echo "  <input type='hidden' name='siteurl' value='{$myrow['siteurl']}' />\r\n";
      echo "  <input type='hidden' name='sitepath' value='{$myrow['sitepath']}' />\r\n";
  }
?>
    <td height="95" align="center" bgcolor="#FFFFFF">
    <table width="100%" border="0" cellspacing="0" id="head1" cellpadding="0">
          <tr>
            <td colspan="2" bgcolor="#FFFFFF" align="left">
           <table border="0" cellpadding="0" cellspacing="0">
                <tr>
                  <td width="84" height="24" align="center" background="images/itemnote1.gif">&nbsp;常規選項&nbsp;</td>
                  <td width="84" align="center" background="images/itemnote2.gif"><a href="#" onClick="ShowItem2()"><u>高級選項</u></a>&nbsp;</td>
                  <td width="84" align="center" background="images/itemnote2.gif"><a href="#" onClick="ShowItem3()"><u>欄目內容</u></a>&nbsp;</td>
                </tr>
              </table>
            </td>
          </tr>
        </table>

        <table width="100%" border="0" cellspacing="0" id="head2" cellpadding="0" style="display:none">
          <tr>
            <td colspan="2" bgcolor="#FFFFFF"  style="text-align:left;">
          <table height="24" border="0" cellpadding="0" cellspacing="0">
                <tr>
                  <td width="84" align="center" background="images/itemnote2.gif" bgcolor="#F2F7DF"><a href="#" onClick="ShowItem1()"><u>常規選項</u></a>&nbsp;</td>
                  <td width="84" align="center" background="images/itemnote1.gif">高級選項&nbsp;</td>
                  <td width="84" align="center" background="images/itemnote2.gif"><a href="#" onClick="ShowItem3()"><u>欄目內容</u></a>&nbsp;</td>
                </tr>
              </table>
            </td>
          </tr>
       </table>

       <table width="100%" border="0" cellspacing="0" id="head3" cellpadding="0" style="display:none">
          <tr>
            <td colspan="2" bgcolor="#FFFFFF" style="text-align:left;">
             <table height="24" border="0" cellpadding="0" cellspacing="0">
                <tr>
                  <td width="84" align="center" background="images/itemnote2.gif" bgcolor="#F2F7DF"><a href="#" onClick="ShowItem1()"><u>常規選項</u></a>&nbsp;</td>
                  <td width="84" align="center" background="images/itemnote2.gif"><a href="#" onClick="ShowItem2()"><u>高級選項</u>&nbsp;</td>
                  <td width="84" align="center" background="images/itemnote1.gif">欄目內容&nbsp;</td>
                </tr>
              </table>
            </td>
          </tr>
       </table>
        <table width="100%" border="0"  id="needset" cellspacing="0" cellpadding="0" style="text-align:left;border:1px solid #cfcfcf;background:#ffffff;">
          <tr>
            <td width="150" class='bline' height="26" style="padding-left:10px;">是否支持投稿：</td>
            <td class='bline'>
                <input type='radio' name='issend' value='0' class='np' <?php if($issend==0) echo " checked='checked' ";?> />
              不支持&nbsp;
              <input type='radio' name='issend' value='1' class='np' <?php if($issend==1) echo " checked='checked' ";?> />
              支持
             </td>
          </tr>
          <tr>
            <td width="150" class='bline' height="26" style="padding-left:10px;">是否隱藏欄目：</td>
            <td class='bline'>
                <input type='radio' name='ishidden' value='0' class='np' checked="checked" />
              顯示　&nbsp;
              <input type='radio' name='ishidden' value='1' class='np' />
              隱藏
             </td>
          </tr>
          <tr>
            <td class='bline' height="26" style="padding-left:10px;"><font color='red'>內容模型：</font></td>
            <td class='bline'>
                
           <select name="channeltype" id="channeltype" style="width:200px" onChange="ParTemplet(this)">
            <?php
            foreach($channelArray as $k=>$arr)
            {
                if($k==$channelid) {
                    $nid = $arr['nid'];
                    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 class='bline' height="26" style="padding-left:10px;"><font color='red'>欄目名稱：</font></td>
            <td class='bline'><input name="typename" type="text" id="typename" size="30" class="iptxt" /></td>
          </tr>
          <tr>
            <td class='bline' height="26" style="padding-left:10px;"> 排列順序： </td>
            <td class='bline'><input name="sortrank" size="6" type="text" value="50" class="pubinputs" style="width:60px" />
              （由低 -&gt; 高） </td>
          </tr>
          <tr>
            <td class='bline' height="26" style="padding-left:10px;">瀏覽權限：</td>
            <td class='bline'>
                <select name="corank" id="corank" style="width:100px">
                <?php
              $dsql->SetQuery("Select * from `#@__arcrank` where rank >= 0");
              $dsql->Execute();
              while($row = $dsql->GetObject())
              {
                  if($corank==$row->rank) echo "<option value='".$row->rank."' selected>".$row->membername."</option>\r\n";
                        else
                        {
                            //如果上級目錄的corank>0，下級必須繼承
                            if($corank==0)
                            { echo "<option value='".$row->rank."'>".$row->membername."</option>\r\n"; }
                        }
              }
              ?>
              </select>
              (僅限制欄目裡的文檔瀏覽權限) </td>
          </tr>
          <tr>
            <td class='bline' height="26" style="padding-left:10px;">上級目錄：</td>
            <td class='bline'>
                <?php
                    $pardir = '{cmspath}'.$cfg_arcdir;
                    if(!empty($typedir)) $pardir = $typedir.'/';
                    $pardir = preg_replace("#\/{1,}#", '/', $pardir);
                    echo $pardir;
                ?>
              <input name="nextdir" type="hidden" id="nextdir" value="<?php echo $pardir?>" />
            </td>
          </tr>
          <tr>
            <td height="26" style="padding-left:10px;">文件保存目錄：</td>
            <td>
                <table border="0" cellspacing="1" cellpadding="1">
                <tr>
                  <td>
                      <input name="typedir" type="text" id="typedir" class="pubinputs" style="width:300px">
                  </td>
                  <td>
                  <input name="upinyin" type="checkbox" id="upinyin" class="np" value="1" onClick="CheckTypeDir()" />
                  拼音
                  </td>
                </tr>
              </table>
              </td>
          </tr>
          <tr>
            <td class='bline' height="26" style="padding-left:10px;">目錄相對位置：</td>
            <td class='bline'>
                    <input name="referpath" type="radio" id="truepath1" class="np" value="parent" checked="chekced" />
              上級目錄
              <?php
              if($moresite==0){
              ?>
              <input name="referpath" type="radio" id="truepath2" class="np" value="cmspath" />
              CMS根目錄
              <input name="referpath" type="radio" id="truepath3" class="np" value="basepath" />
              站點根目錄
              <?php } ?>
              </td>
          </tr>
          
          <tr>
            <td height="26" style="padding-left:10px;">欄目列表選項：</td>
            <td>
            <input type='radio' name='isdefault' value='1' class='np' checked="checked" />
              鏈接到默認頁
              <input type='radio' name='isdefault' value='0' class='np' />
              鏈接到列表第一頁
              <input type='radio' name='isdefault' value='-1' class='np' />
              使用動態頁
            </td>
          </tr>
          <tr>
            <td height="26" class='bline' style="padding-left:10px;">默認頁的名稱： </td>
            <td class='bline'>
            <input name="defaultname" type="text" value="index.html" class="iptxt" />
            </td>
          </tr>
          <tr>
            <td height="26" class='bline' style="padding-left:10px;">欄目屬性：</td>
            <td class='bline'>
                <input name="ispart" type="radio" id="radio" value="0" class='np' checked="checked"/>
              最終列表欄目（允許在本欄目發佈文檔，並生成文檔列表） <br>
              <input name="ispart" type="radio" id="radio" value="1" class='np'/>
              頻道封面（欄目本身不允許發佈文檔） <br>
              <input name="ispart" type="radio" id="radio" value="2" class='np'/>
              外部連接（在"文件保存目錄"處填寫網址）
             </td>
          </tr>
          <tr id='helpvarco' style='display:none'>
            <td height="80" bgcolor="#F3F7EA" style="padding-left:10px;">欄目交叉說明： </td>
            <td bgcolor="#F3F7EA">
            交叉欄目是指一個大欄目與另一個非下級的子欄目出現交叉的情況，相當於系統原來的副欄目功能，不過現在改在欄目裡預先設置好。<br />例如：
            網站上有大欄目——智能手機、音樂手機，另外又有欄目——諾基亞-&gt;智能手機、諾基亞-&gt;音樂手機，這樣頂級的大欄目就和另一個大欄目的子欄目形成了交叉，這樣只需要在大欄目中指定交叉的欄目即可。
            <br />註：會自動索引交叉欄目的內容，但不會索引交叉欄目下級欄目的內容，這種應用也適用於按地區劃分資訊的站點。
            </td>
          </tr>
          <tr>
            <td style="padding-left:10px;">欄目交叉： <img src="images/help.gif" alt="幫助" width="16" height="16" border="0" style="cursor:pointer" onClick="ShowHide('helpvarco')" /> <br />僅適用[最終列表欄目]</td>
            <td style="padding:3px 0px 3px 0px">
                <input name="cross" type="radio" id="cross0" value="0" class='np' onClick="CheckCross()" checked='1' />
                不交叉
                <input name="cross" type="radio" id="cross1" value="1" class='np' onClick="CheckCross()" />
                自動獲取同名欄目內容
                <input name="cross" type="radio" id="cross2" value="2" class='np' onClick="CheckCross()" />
                手工指定交叉欄目ID(用逗號分開)
                <br />
                <textarea name="crossid" cols="50" rows="3" id="crossid" style="display:none" class="alltxt"></textarea>
            </td>
          </tr>
          <tr id='smclass' style='<?php echo ($channelid<0 ? '' : 'display:none'); ?>'>
            <td class='bline' style="padding-left:10px;">綁定小分類：  <br />僅適用[分類信息模型]</td>
            <td class='bline' style="padding:3px 0px 3px 0px">
                <select name='smalltype[]' size='5' style='width:120px' multiple='yes'>
                    <?php
                    $sql = "SELECT * FROM `#@__sys_enum` WHERE egroup LIKE 'infotype' ORDER BY disorder ASC, id DESC ";
                    $dsql->Execute('s',$sql);
                    while($arr = $dsql->GetArray('s'))
                    {
                        if($arr['evalue']%500==0) {
                            echo "<option value='{$arr['evalue']}'>{$arr['ename']}</option>\r\n";
                        }
                        else if(preg_match("#\.#", $arr['evalue']))
                        {
                            echo "<option value='{$arr['evalue']}'> └───{$arr['ename']}</option>\r\n";
                        }
                        else {
                            echo "<option value='{$arr['evalue']}'> └─{$arr['ename']}</option>\r\n";
                        }
                    }
                    ?>
                </select>    
                按 Ctrl 多選，不選系統將調用全部分類，在<a href='stepselect_main.php'>「<u>聯動類別管理</u>」</a>中管理
            </td>
          </tr>
        </table>

        <table width="100%" border="0" cellspacing="0" cellpadding="0" style="border:1px solid #cfcfcf;background:#ffffff;display:none;text-align:left;" id="adset">
          <?php
          if($id==0)
          {
          ?>
          <tr>
            <td class='bline' width="150" height="24" style="padding-left:10px;">多站點支持：</td>
            <td class='bline'>
            <input name="moresite" type="radio"  class="np" value="0" checked="checked"/>
              不啟用
              <input type="radio" name="moresite" class="np" value="1"/>
              啟用
             </td>
          </tr>
          <tr>
            <td height="24" bgcolor="#F3F7EA" style="padding-left:10px;">說明：</td>
            <td bgcolor="#F3F7EA">如果需要綁定二級域名，必須在「系統參數」中設定「支持多站點」。</td>
          </tr>
          <tr>
            <td class='bline' height="24" style="padding-left:10px;">綁定域名：</td>
            <td class='bline'>
                <input name="siteurl" type="text" id="siteurl" size="35" onChange="CheckPathSet();" class="pubinputs" />
              (需加 http://，一級或二級域名的根網址)
            </td>
          </tr>
          <tr>
            <td class='bline' height="24" style="padding-left:10px;">站點根目錄：</td>
            <td class='bline'>
                為簡化操作，站點根目錄與當前欄目目錄一致，請注意當前欄目文件保存目錄的設置，域名需自行手工綁定到這個目錄。
            </td>
          </tr>
          <?php
          }
          ?>
          <tr id='helpvar1' style='display:none'>
            <td height="24" bgcolor="#F3F7EA" style="padding-left:10px;">支持變量： </td>
            <td 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' class="pubinputs" />
            </td>
          </tr>
          <tr>
            <td height="24" bgcolor="#F3F7EA" style="padding-left:10px;">規則選項：</td>
            <td bgcolor="#F3F7EA">按不同的內容類型設定相關模板及命名規則。</td>
          </tr>
          <tr>
            <td height="26" style="padding-left:10px;">封面模板：</td>
            <td> <input name="tempindex" type="text" value="{style}/index_<?php echo $nid?>.htm" class="pubinputs" style="width:300px"/>
              <input type="button" name="set1" value="瀏覽..." class="coolbg np" style="width:60px" onClick="SelectTemplets('form1.tempindex');" />
              <img src="images/help.gif" alt="幫助" width="16" height="16" border="0" style="cursor:pointer" onClick="ShowHide('helpvar1')"/>
            </td>
          </tr>
          <tr>
            <td height="26" style="padding-left:10px;">列表模板：</td>
            <td> <input name="templist" type="text" value="{style}/list_<?php echo $nid?>.htm"  class="pubinputs" style="width:300px" />
              <input type="button" name="set3" value="瀏覽... "class="coolbg np" style="width:60px" onClick="SelectTemplets('form1.templist');" />
            </td>
          </tr>
          <tr>
            <td height="26" style="padding-left:10px;">文章模板：</td>
            <td><input name="temparticle" type="text" value="{style}/article_<?php echo $nid?>.htm" class="pubinputs"  style="width:300px" />
              <input type="button" name="set4" value="瀏覽..." class="coolbg np" style="width:60px" onClick="SelectTemplets('form1.temparticle');"/>
            </td>
          </tr>
          <tr id='helpvar2' style='display:none'>
            <td height="24" bgcolor="#F3F7EA" style="padding-left:10px;">支持變量： </td>
            <td height="24" 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" style="padding-left:10px;">文章命名規則：</td>
            <td> <input name="namerule" type="text" id="namerule" value="<?php echo $cfg_df_namerule;?>" class="pubinputs"  style="width:250px" />
              <img src="images/help.gif" alt="幫助" width="16" height="16" border="0" style="cursor:pointer" onClick="ShowHide('helpvar2')" />
            </td>
          </tr>
          <tr id='helpvar3' style='display:none'>
            <td height="24" bgcolor="#F3F7EA" style="padding-left:10px;">支持變量： </td>
            <td bgcolor="#F3F7EA">{page} 列表的頁碼</td>
          </tr>
          <tr>
            <td height="26" style="padding-left:10px;">列表命名規則：</td>
            <td>
              <input name="namerule2" type="text" id="namerule2" value="{typedir}/list_{tid}_{page}.html"  class="pubinputs"  style="width:250px" />
              <img src="images/help.gif" alt="幫助" width="16" height="16" border="0" style="cursor:pointer" onClick="ShowHide('helpvar3')"/></td>
          </tr>
          <tr>
            <td height="65" style="padding-left:10px;">SEO標題：</td>
            <td>
                <input name="seotitle" type="text" style="width:250px" id="seotitle" class="alltxt" value="" />
                (欄目模板裡用{dede:field.seotitle /}調用)
            </td>
          </tr>
          <tr>
            <td height="65" style="padding-left:10px;">關鍵字：</td>
            <td>
                <textarea name="keywords" cols="70" rows="4" id="keywords" class="alltxt"></textarea>
            </td>
          </tr>
          <tr>
            <td height="65" style="padding-left:10px;">欄目描述：</td>
            <td height="65"> <textarea name="description" cols="70" style="height:50px" rows="4" id="description" class="alltxt"></textarea></td>
          </tr>
        </table>

        <table width="100%" border="0" cellspacing="0" cellpadding="0" style="border:1px solid #cfcfcf;background:#ffffff;display:none;text-align:left;" id="ctset">
          <tr>
            <td height="28" style="padding-left:10px;">說明：欄目內容是替代原來欄目單獨頁的更靈活的一種方式，可在欄目模板中用{dede:field.content/}調用，通常用於企業簡介之類的用途。</td>
          </tr>
          <tr>
            <td style="padding:10px;">
                <?php
                GetEditor("content","","450","Default","print","false");
                ?>
            </td>
          </tr>
      </table>

          <table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#F9FCEF" style="border:1px solid #cfcfcf;border-top:none;">
          <tr>
            <td width="1%" height="35"></td>
            <td width="99%" valign="bottom">
<input name="imageField" type="image" src="images/button_ok.gif" width="60" height="22" border="0" class="np" />
&nbsp;&nbsp;&nbsp;
            <a href="catalog_main.php"><img src="images/button_back.gif" width="60" height="22" border="0" /></a>
            </td>
          </tr>
        </table></td>
      </form>
  </tr>
</table>
</body>
</html>
