<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv=Content-Type content="text/html; charset=gbk">
<title>模板管理</title>
<meta http-equiv="X-UA-Compatible" content="IE=7" />
<link href="<?=base_url()?>csdj/admin/images/admin.css" type=text/css id="skincolor" rel="stylesheet" media="all" >
<script type="text/javascript" src="<?=base_url()?>csdj/admin/js/admin.js"></script>
<script type="text/javascript" src="<?=base_url()?>csdj/admin/js/label.js"></script>
<script type="text/javascript" src="<?=base_url()?>csdj/admin/js/ajaxrequest.js"></script>
<script type="text/javascript" src="<?=base_url()?>csdj/admin/js/dialog.js"></script>
<script>function SelectAll() { var checkboxs=document.getElementsByName("CS_ID[]"); for (var i=0;i<checkboxs.length;i++) {  var e=checkboxs[i];  e.checked=!e.checked; }}</script>
</head>
<body style="margin:2px">
<table align="center" width="99%" border="1" cellspacing="0" cellpadding="5" bordercolor="#C4DFF4" style="border-collapse: collapse" id="myTable">
<form method="post" Name="Form2" action="<?=site_url('admin/skins/addsave')?>">
<tr><td class=title align="center" colspan=6>新增模板文件</td></tr>
<tr>
       <td align="center">
          <div id="Help_open" class="style1" style="display:none;text-align:left;position:absolute;z-index:3;overflow:hidden;" onclick="javascript:fnSmall('Help_open',730,80);">
          <strong>注意：</strong><br>①模板名称，如：黑色模板。<br>②模板路径，主站模板列子：<font color=red>index/xxx/xxx/</font>   会员主页模板列子：<font color=red>home/xxx/xxx/</font>   会员中心模板列子：<font color=red>user/xxx/xxx/</font>    <br>③路径必须以：“index、home、user”开头，以“/”结尾 </div><input type="button" value="新增说明" onclick="javascript:emotion('Help_open',730,80,0);" class="italk-st3" />
       </TD>
       <td height=30 align="center">模板名称：<input size="20" name="CS_Name" value=""></td>
       <td align="center">模板路径：<input size="30" name="CS_TempPath" value=""></td>
       <td align="center">模板类型：<select Name="CS_SID" style="Width:100px"><option value="1">主站模板</option><option value="2">会员主页</option><option value="3">会员中心</option></select></td>
       <td align="center"><input type="submit" name="Submit2" class="italk-st3" value="新增模板"></td>
</form></table>
<table align="center" width="99%" border="0" cellspacing="0" cellpadding="5" bordercolor="#C4DFF4" style="border-collapse: collapse" id="myTable">
<tr><td class=title align="center" colspan=8>模板文件管理 — 
 ｜ <a href="<?=site_url('admin/skins/index/')?>?sid=-1">全部模板</a>
 ｜ <a href="<?=site_url('admin/skins/index/')?>?sid=1">主站模板</a>
 ｜ <a href="<?=site_url('admin/skins/index/')?>?sid=2">会员主页模板</a>
 ｜ <a href="<?=site_url('admin/skins/index/')?>?sid=3">会员中心模板</a>
 
</td></tr>
<form method="post" Name="Form" action="<?=site_url('admin/skins/pledit')?>">
<tr>
<td height=35 style="border-bottom:1px solid #C4DFF4;" width="50" align="center">选中</td>
<td height=35 style="border-bottom:1px solid #C4DFF4;" width="100" align="center">模板类型</td>
<td height=35 style="border-bottom:1px solid #C4DFF4;" width="100" align="center">示列图片</td>
<td height=35 style="border-bottom:1px solid #C4DFF4;" width="200" align="center">模板名称</td>
<td height=35 style="border-bottom:1px solid #C4DFF4;" width="200" align="center">模板路径</td>
<td height=35 style="border-bottom:1px solid #C4DFF4;" width="350" align="center">版权信息</td>
<td height=35 style="border-bottom:1px solid #C4DFF4;" width="120" align="center">是否默认</td>
<td height=35 style="border-bottom:1px solid #C4DFF4;" width="150" align="center">可用操作</td>
</tr>
<?php
if(!empty($skins['index'])){
   foreach ($skins['index'] as $value) {
       $sql="SELECT * FROM ".CS_SqlPrefix."skins where cs_sid=1 and CS_TempPath like '%index/".$value['name']."/%'";
       $row=$this->db->query($sql)->row();
       $confpath=$value['relative_path'].$value['name'].'/config.php';
       if (file_exists($confpath)){
            require_once $confpath;
       }else{
            $config='';
       }
       if($row){
               if(Skins_dir==$row->CS_TempPath){
                      $checked='checked';
                      $disabled='disabled';
                      $uinstall="javascript:void(0);";
               }else{
                      $checked='';
                      $disabled='';
                      $uinstall=site_url('admin/skins/uinstall/').'?id='.$row->CS_ID.'&sid='.$row->CS_SID.'&dir='.@$config['dir'];
               }
                 echo '<tr>
                          <td height=35 style="border-bottom:1px solid #C4DFF4;" align="center"><input name="CS_SID'.$row->CS_ID.'" type="hidden" value="'.$row->CS_SID.'"><input type="checkbox" name="CS_ID[]" value="'.$row->CS_ID.'" checked></td>
                          <td style="border-bottom:1px solid #C4DFF4;" align="center"><b style="color:#ff6600">主站模板</b></td>
                          <td height=35 style="border-bottom:1px solid #C4DFF4;" align="center"><img height=30 src="'.Web_Path.substr($value['relative_path'],2).$value['name'].'/preview.jpg" onerror="this.src=\''.Web_Path.'csdj/admin/images/skins_logo.gif\';this.onerror=null" style="cursor:url(\''.Web_Path.'csdj/images/zoomin.cur\'),auto" onload="ResizeImages(this,50,30);" onclick="PreviewImage(this);"></td>
                          <td style="border-bottom:1px solid #C4DFF4;" align="center"><input size="25" name="CS_Name'.$row->CS_ID.'" value="'.$row->CS_Name.'"></td>
                          <td style="border-bottom:1px solid #C4DFF4;" align="center"><input size="25" name="CS_TempPath'.$row->CS_ID.'" value="'.$row->CS_TempPath.'"></td>
                          <td style="border-bottom:1px solid #C4DFF4;" align="center">'.@$config['description'].'</td>
                          <td style="border-bottom:1px solid #C4DFF4;" align="center"><input type="radio" name="CS_IDS'.$row->CS_SID.'" value="'.$row->CS_TempPath.'" '.$checked.'/></td>
                          <td style="border-bottom:1px solid #C4DFF4;" align="center"><a href="'.site_url('admin/skins/lists/').'?path=/skins/'.$row->CS_TempPath.'">打开</a> | <a href="'.$uinstall.'" onClick="return confirm(\'确定要卸载么？\');" '.$disabled.'>卸载</a></td>
                      </tr>';
       }else{
            if(!empty($config)){
                 echo '<tr>
                          <td height=35 style="border-bottom:1px solid #C4DFF4;" align="center"><input type="checkbox" name="CS_ID[]" value="" disabled></td>
                          <td style="border-bottom:1px solid #C4DFF4;" align="center"><b style="color:#ff6600">主站模板</b></td>
                          <td height=35 style="border-bottom:1px solid #C4DFF4;" align="center"><img height=30 src="'.Web_Path.substr($value['relative_path'],2).$value['name'].'/preview.jpg" onerror="this.src=\''.Web_Path.'csdj/admin/images/skins_logo.gif\';this.onerror=null" style="cursor:url(\''.Web_Path.'csdj/images/zoomin.cur\'),auto" onload="ResizeImages(this,50,30);" onclick="PreviewImage(this);"></td>
                          <td style="border-bottom:1px solid #C4DFF4;" align="center">'.$config['name'].'</td>
                          <td style="border-bottom:1px solid #C4DFF4;" align="center">'.$value['relative_path'].$config['dir'].'</td>
                          <td style="border-bottom:1px solid #C4DFF4;" align="center">'.$config['description'].'</td>
                          <td style="border-bottom:1px solid #C4DFF4;" align="center"><input type="radio" name="CS_IDS" value="" disabled/></td>
                          <td style="border-bottom:1px solid #C4DFF4;" align="center"><a href="'.site_url('admin/skins/install/').'?sid=1&path='.$config['path'].'&dir='.$config['dir'].'">安装</a> | <a href="'.site_url('admin/skins/deldir/').'?sid=1&dir='.$config['dir'].'" onClick="return confirm(\'确定要删除选择的文件么？\n此操作不可以恢复！\');">删除</a></td>
                      </tr>';
            }
       }
   }
}
if(!empty($skins['user'])){
   foreach ($skins['user'] as $values) {
       $sql="SELECT * FROM ".CS_SqlPrefix."skins where cs_sid=3 and CS_TempPath like '%user/".$values['name']."/%'";
       $row=$this->db->query($sql)->row();
       $confpath=$values['relative_path'].$values['name'].'/config.php';
       if (file_exists($confpath)){
            require_once $confpath;
       }else{
            $config='';
       }
       if($row){
               if(Skins_user_dir==$row->CS_TempPath){
                      $checked='checked';
                      $disabled='disabled';
                      $uinstall="javascript:void(0);";
               }else{
                      $checked='';
                      $disabled='';
                      $uinstall=site_url('admin/skins/uinstall/').'?id='.$row->CS_ID.'&sid='.$row->CS_SID.'&dir='.@$config['dir'];
               }
                 echo '<tr>
                          <td height=35 style="border-bottom:1px solid #C4DFF4;" align="center"><input name="CS_SID'.$row->CS_ID.'" type="hidden" value="'.$row->CS_SID.'"><input type="checkbox" name="CS_ID[]" value="'.$row->CS_ID.'" checked></td>
                          <td style="border-bottom:1px solid #C4DFF4;" align="center"><b style="color:#258F1D">会员中心</b></td>
                          <td height=35 style="border-bottom:1px solid #C4DFF4;" align="center"><img height=30 src="'.Web_Path.substr($values['relative_path'],2).$values['name'].'/preview.jpg" onerror="this.src=\''.Web_Path.'csdj/admin/images/skins_logo.gif\';this.onerror=null" style="cursor:url(\''.Web_Path.'csdj/images/zoomin.cur\'),auto" onload="ResizeImages(this,50,30);" onclick="PreviewImage(this);"></td>
                          <td style="border-bottom:1px solid #C4DFF4;" align="center"><input size="25" name="CS_Name'.$row->CS_ID.'" value="'.$row->CS_Name.'"></td>
                          <td style="border-bottom:1px solid #C4DFF4;" align="center"><input size="25" name="CS_TempPath'.$row->CS_ID.'" value="'.$row->CS_TempPath.'"></td>
                          <td style="border-bottom:1px solid #C4DFF4;" align="center">'.$config['description'].'</td>
                          <td style="border-bottom:1px solid #C4DFF4;" align="center"><input type="radio" name="CS_IDS'.$row->CS_SID.'" value="'.$row->CS_TempPath.'" '.$checked.'/></td>
                          <td style="border-bottom:1px solid #C4DFF4;" align="center"><a href="'.site_url('admin/skins/lists/').'?path=/skins/'.$row->CS_TempPath.'">打开</a> | <a href="'.$uinstall.'" onClick="return confirm(\'确定要卸载么？\');" '.$disabled.'>卸载</a></td>
                      </tr>';
       }else{
            if(!empty($config)){
                 echo '<tr>
                          <td height=35 style="border-bottom:1px solid #C4DFF4;" align="center"><input type="checkbox" name="CS_ID[]" value="" disabled></td>
                          <td style="border-bottom:1px solid #C4DFF4;" align="center"><b style="color:#258F1D">会员中心</b></td>
                          <td height=35 style="border-bottom:1px solid #C4DFF4;" align="center"><img height=30 src="'.Web_Path.substr($values['relative_path'],2).$values['name'].'/preview.jpg" onerror="this.src=\''.Web_Path.'csdj/admin/images/skins_logo.gif\';this.onerror=null" style="cursor:url(\''.Web_Path.'csdj/images/zoomin.cur\'),auto" onload="ResizeImages(this,50,30);" onclick="PreviewImage(this);"></td>
                          <td style="border-bottom:1px solid #C4DFF4;" align="center">'.$config['name'].'</td>
                          <td style="border-bottom:1px solid #C4DFF4;" align="center">'.$values['relative_path'].$config['dir'].'</td>
                          <td style="border-bottom:1px solid #C4DFF4;" align="center">'.$config['description'].'</td>
                          <td style="border-bottom:1px solid #C4DFF4;" align="center"><input type="radio" name="CS_IDS" value="" disabled/></td>
                          <td style="border-bottom:1px solid #C4DFF4;" align="center"><a href="'.site_url('admin/skins/install/').'?sid=3&path='.$config['path'].'&dir='.$config['dir'].'">安装</a> | <a href="'.site_url('admin/skins/deldir/').'?sid=3&dir='.$config['dir'].'" onClick="return confirm(\'确定要删除选择的文件么？\n此操作不可以恢复！\');">删除</a></td>
                      </tr>';
            }
       }
   }
}
if(!empty($skins['home'])){
   foreach ($skins['home'] as $values) {
       $sql="SELECT * FROM ".CS_SqlPrefix."skins where cs_sid=2 and CS_TempPath like '%home/".$values['name']."/%'";
       $row=$this->db->query($sql)->row();
       $confpath=$values['relative_path'].$values['name'].'/config.php';
       if (file_exists($confpath)){
            require_once $confpath;
       }else{
            $config='';
       }
       if($row){
               if(Skins_home_dir==$row->CS_TempPath){
                      $checked='checked';
                      $disabled='disabled';
                      $uinstall="javascript:void(0);";
               }else{
                      $checked='';
                      $disabled='';
                      $uinstall=site_url('admin/skins/uinstall/').'?id='.$row->CS_ID.'&sid='.$row->CS_SID.'&dir='.@$config['dir'];
               }
                 echo '<tr>
                          <td height=35 style="border-bottom:1px solid #C4DFF4;" align="center"><input name="CS_SID'.$row->CS_ID.'" type="hidden" value="'.$row->CS_SID.'"><input type="checkbox" name="CS_ID[]" value="'.$row->CS_ID.'" checked></td>
                          <td style="border-bottom:1px solid #C4DFF4;" align="center"><b style="color:#0000ff">会员主页</b></td>
                          <td height=35 style="border-bottom:1px solid #C4DFF4;" align="center"><img height=30 src="'.Web_Path.substr($values['relative_path'],2).$values['name'].'/preview.jpg" onerror="this.src=\''.Web_Path.'csdj/admin/images/skins_logo.gif\';this.onerror=null" style="cursor:url(\''.Web_Path.'csdj/images/zoomin.cur\'),auto" onload="ResizeImages(this,50,30);" onclick="PreviewImage(this);"></td>
                          <td style="border-bottom:1px solid #C4DFF4;" align="center"><input size="25" name="CS_Name'.$row->CS_ID.'" value="'.$row->CS_Name.'"></td>
                          <td style="border-bottom:1px solid #C4DFF4;" align="center"><input size="25" name="CS_TempPath'.$row->CS_ID.'" value="'.$row->CS_TempPath.'"></td>
                          <td style="border-bottom:1px solid #C4DFF4;" align="center">'.$config['description'].'</td>
                          <td style="border-bottom:1px solid #C4DFF4;" align="center"><input type="radio" name="CS_IDS'.$row->CS_SID.'" value="'.$row->CS_TempPath.'" '.$checked.'/></td>
                          <td style="border-bottom:1px solid #C4DFF4;" align="center"><a href="'.site_url('admin/skins/lists/').'?path=/skins/'.$row->CS_TempPath.'">打开</a> | <a href="'.$uinstall.'" onClick="return confirm(\'确定要卸载么？\');" '.$disabled.'>卸载</a></td>
                      </tr>';
       }else{
            if(!empty($config)){
                 echo '<tr>
                          <td height=35 style="border-bottom:1px solid #C4DFF4;" align="center"><input type="checkbox" name="CS_ID[]" value="" disabled></td>
                          <td style="border-bottom:1px solid #C4DFF4;" align="center"><b style="color:#0000ff">会员主页</b></td>
                          <td height=35 style="border-bottom:1px solid #C4DFF4;" align="center"><img height=30 src="'.Web_Path.substr($values['relative_path'],2).$values['name'].'/preview.jpg" onerror="this.src=\''.Web_Path.'csdj/admin/images/skins_logo.gif\';this.onerror=null" style="cursor:url(\''.Web_Path.'csdj/images/zoomin.cur\'),auto" onload="ResizeImages(this,50,30);" onclick="PreviewImage(this);"></td>
                          <td style="border-bottom:1px solid #C4DFF4;" align="center">'.$config['name'].'</td>
                          <td style="border-bottom:1px solid #C4DFF4;" align="center">'.$values['relative_path'].$config['dir'].'</td>
                          <td style="border-bottom:1px solid #C4DFF4;" align="center">'.$config['description'].'</td>
                          <td style="border-bottom:1px solid #C4DFF4;" align="center"><input type="radio" name="CS_IDS" value="" disabled/></td>
                          <td style="border-bottom:1px solid #C4DFF4;" align="center"><a href="'.site_url('admin/skins/install/').'?sid=2&path='.$config['path'].'&dir='.$config['dir'].'">安装</a> | <a href="'.site_url('admin/skins/deldir/').'?sid=2&dir='.$config['dir'].'" onClick="return confirm(\'确定要删除选择的文件么？\n此操作不可以恢复！\');">删除</a></td>
                      </tr>';
            }
       }
   }
}
if($skins){
?>
<tr><td colspan='8'>选中<input type="checkbox" name="chkall" onclick="SelectAll()" checked value="ON">
	&nbsp;&nbsp;<input type="submit" name="Submit" class="italk-st3" value="批量修改所选">
</span>
</td></tr>
<?php } ?></form>
</table>
</BODY>
</HTML>

