<? defined('ROOT_PHPLEFT') or exit(require '../../../404.php');?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
 <link href="css/main.css" type="text/css" rel="stylesheet">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"></head>
<body bottommargin="0" leftmargin="0" topmargin="0" rightmargin="0">
<script type="text/javascript" src="<?=PL_URL?>js/common.js"></script>
<div class="tpis"><img src="images/icos.gif" align="absmiddle"/>当前位置：栏目内容 > <?=modname($menuid,'name')?> > 分类列表</div>
    <table class="usertableborder input" cellspacing="1" cellpadding="3" width="100%" align="center"
        border="0">
        <tr>
            <th>
                提示信息</th>
        </tr>
        </table>
            <div class="tsc"> 
1. 分类支持批量添加。 <br>
2. 可无限添加分类。
</div>
<? include inTemplate(menu);?>

<? if ($show=="add"){?>
   <form action="phpleft.php?file=cat&post=add" method="post" style="margin:0px; padding:0px;">
<input name="alladd[module]" type="hidden" value="<?=$menuid?>">
 <table class="usertableborder bb" cellspacing="1" cellpadding="3" width="100%" align="center"
        border="0">
        <tr>
            <th colspan="3">
                分类添加</th>
        </tr>
       
          <tr>
            <td width="123" height="30" class="text" style="padding-right:10px; text-align:right"><strong>上级分类</strong></td>
            <td width="276" height="30"><? if ($id){?><?=ajax_catid_select('alladd[parent]', '请选择', $id, $menuid,' disabled')?><? }else{?> 添加一级分类<? }?>
      
        <input type="hidden" name="alladd[allparent]" id="allparent" value="<?=allparent($id,$menuid);?><? if($id=='') echo '0'; else echo $id;?>">
      <input type="hidden" name="alladd[noparent]" id="noparent" value="0">
        
        </td>
            <td height="30"></td>
        </tr>
        
       <tr>
            <td width="123" height="30" class="text" style="padding-right:10px; text-align:right"><strong>栏目名称</strong></td>
            <td width="276" height="30"><textarea name="alladd[name]" cols="30" rows="8" id="name"></textarea></td>
            <td width="595" height="30">建议使用中文，可批量添加，用回车键隔开。</td>
        </tr>
      
        
        <tr>
            <td width="123" height="30" class="text" style="padding-right:10px; text-align:right"><strong>分类模板</strong></td>
            <td width="276" height="30">
            
<?=select(filetemplate(modname($menuid),'list'),'','默认模板','alladd[template]');?>
          </td>
            <td height="30"></td>
        </tr>
              <tr>
            <td width="123" height="30" class="text" style="padding-right:10px; text-align:right"><strong>分类内页模板</strong></td>
            <td width="276" height="30">
           
         <?=select(filetemplate(modname($menuid),'show'),'','默认模板','alladd[template_show]');?>
          </td>
            <td height="30"></td>
        </tr>

       
        <tr>
            <td width="123" height="30" class="text" style="padding-right:10px; text-align:right"><strong>是否显示</strong></td>
            <td width="276" height="30"><input name="alladd[is_or]" type="radio" id="is" value="1" class="no"<? if ($alladd[is_or]<>'0'){ ?> checked<? }?>>
            是&nbsp;  <input name="alladd[is_or]" type="radio" id="is_or" class="no" value="0"<? if ($alladd[is_or]=='0'){ ?> checked<? }?>>
            否 </td>
            <td height="30"></td>
        </tr>
         <tr>
          <td height="30" class="text" style="padding-right:10px; text-align:right"></td>
            <td height="30"><input type="submit" name="button" id="button" value=" 确 认 "></td>
            <td height="30">&nbsp;</td>
        </tr>
    </table>
    </form>
    <? }elseif ($show=="bj"){?>
    
<form action="phpleft.php?file=cat&post=bj&id=<?=$id?>" method="post" style="margin:0px; padding:0px;">
<input name="alladd[module]" type="hidden" value="<?=$menuid?>">
 <table class="usertableborder bb" cellspacing="1" cellpadding="3" width="100%" align="center"
        border="0">
        <tr>
            <th colspan="3">
                分类添加</th>
        </tr>
       
          <tr>
            <td width="123" height="30" class="text" style="padding-right:10px; text-align:right"><strong>上级分类</strong></td>
            <td width="276" height="30"> <?=ajax_catid_select('alladd[parent]', '请选择分类', $alladd['parent'], $menuid)?>
      
        <input type="hidden" name="alladd[allparent]" id="allparent" value="<?=allparent($id,$menuid);?><? if($id=='') echo '0'; else echo $id;?>">
      <input type="hidden" name="alladd[noparent]" id="noparent" value="0">
        
        </td>
            <td height="30"></td>
        </tr>
        
       <tr>
            <td width="123" height="30" class="text" style="padding-right:10px; text-align:right"><strong>栏目名称</strong></td>
            <td width="276" height="30"><input name="alladd[name]" type="text" id="name" value="<?=$alladd[name]?>" size="30"></td>
            <td width="595" height="30">建议使用中文，可批量添加，用回车键隔开。</td>
    </tr>
  
        
        <tr>
            <td width="123" height="30" class="text" style="padding-right:10px; text-align:right"><strong>分类模板</strong></td>
            <td width="276" height="30">
            
<?=select(filetemplate(modname($menuid),'list'),$alladd[template],'默认模板','alladd[template]');?>
          </td>
            <td height="30"></td>
        </tr>
              <tr>
            <td width="123" height="30" class="text" style="padding-right:10px; text-align:right"><strong>分类内页模板</strong></td>
            <td width="276" height="30">
           
         <?=select(filetemplate(modname($menuid),'show'),$alladd[template_show],'默认模板','alladd[template_show]');?>
          </td>
            <td height="30"></td>
        </tr>

       
        <tr>
            <td width="123" height="30" class="text" style="padding-right:10px; text-align:right"><strong>是否显示</strong></td>
            <td width="276" height="30"><input name="alladd[is_or]" type="radio" id="is" value="1" class="no"<? if ($alladd[is_or]<>'0'){ ?> checked<? }?>>
            是&nbsp;  <input name="alladd[is_or]" type="radio" id="is_or" class="no" value="0"<? if ($alladd[is_or]=='0'){ ?> checked<? }?>>
            否 </td>
            <td height="30"></td>
        </tr>
         <tr>
          <td height="30" class="text" style="padding-right:10px; text-align:right"></td>
            <td height="30"><input type="submit" name="button" id="button" value=" 确 认 "></td>
            <td height="30">&nbsp;</td>
        </tr>
  </table>
    </form>

<? }else{?>
<script>
function checkall(f, t) {
	var t = t ? t : 1;
	for(var i = 0; i < f.elements.length; i++) {
		var e = f.elements[i];
		if(e.type != 'checkbox') continue;
		if(t == 0) e.checked = false;
		if(t == 1) e.checked = e.checked ? false : true;
		if(t == 2) e.checked = true;	
	}
}
</script>
<form id="form2" name="form2" method="post" action="phpleft.php?file=cat&menuid=<?=$menuid?>&post=del">
<table class="usertableborder input" cellspacing="1" cellpadding="3" width="100%" align="center"
        border="0">
        <tr>
            <th colspan="8">
                分类管理</th>
        </tr>
          <tr align="center" class="list1">
          <td width="34" height="30" align="left" valign="top" style="padding-right:10px;"><input type="checkbox" onClick="checkall(this.form);"/></td>
          <td width="249" height="30" valign="top"  class="usertablerow3">
          id
          </td>
          <td width="85" height="30" class="usertablerow3">分类名称</td>
         
            <td width="93" height="30" class="usertablerow3">上级ID</td>
            
             <td width="249" height="30" class="usertablerow3">分类管理</td>
              <td width="263" height="30" class="usertablerow3">&nbsp;</td>
             
        </tr>
      
         <?php
		 $ii == '0';
		 foreach($catlist as $id=>$m) { 
		 $ii = $ii+1;
		 ?>
        
         <? if ($m['parent']==$catid){?>
        <tr align="center" class="list<?php if($ii%2==0) echo '1'?>">
        <td height="30" valign="top"  class="usertablerow1" style="padding-right:10px;" align="left"><input name="tab[]" type="checkbox" value="<?=$m[id]?>"></td>
          <td width="249" height="30" valign="top" style="padding-right:10px;" align="left"><?=$m['id']?>
          </td>
          <td width="85" height="30"><a href="<?=menurl($menuid)?><?=$m['linkurl']?>" target="_blank"><?=$m['name']?></a></td>
         
          <td width="93" height="30"><?=$m['parent']?></td>
          <td width="249" height="30"><a href="phpleft.php?file=cat&menuid=<?=$menuid?>&show=add&id=<?=$m['id']?>"><img src="<?=PL_URL?>ico/plus.png" align="absmiddle" alt="添加分类" border="0"></a> <a href="phpleft.php?file=cat&menuid=<?=$menuid?>&catid=<?=$m['id']?>"><img src="<?=PL_URL?>ico/database.png" align="absmiddle" alt="管理分类" border="0"></a> <a href="phpleft.php?file=cat&menuid=<?=$menuid?>&show=bj&id=<?=$m['id']?>"><img src="<?=PL_URL?>ico/edit.png" align="absmiddle" alt="编辑分类" border="0"></a></td>
              <td height="30">&nbsp;</td>
             
        </tr>   
        <? } }?>
 </table>
 <table class="usertableborder input" cellspacing="1" cellpadding="3" width="100%" align="center"
        border="0">
    <tr>
          
            <td height="30" class="usertablerow1"><input type="submit" name="button" id="button" value=" 删除 " class="ok" style="font-size:12px"> </td>
            <td height="30" class="usertablerow1">&nbsp;</td>
        </tr>
       
    </table>
    </form>
<? }?>
</body>
</html>
