<?php
/*
  欢迎使用DM企业建站系统，本系统由www.demososo.com开发。
*/
if(!defined('IN_DEMOSOSO')) {
  exit('this is wrong page,please back to homepage');
}


?>


 <div class="contenttop">            
   <a href="<?php echo $jumpv?>&file=add&act=add"><i class="fa fa-plus-circle"></i> 添加模板</a>
 </div>

 
 <div style="background: #bbdbfb;height: 35px;margin:15px 0;padding:5px">
 <span style="color:red">正在启用的模板：</span>
 </div>
 <ul class="stylegrid gridimghover">

<?php 

$sql = "SELECT * from ".TABLE_STYLE." where $noandlangbh and pidname='$curstyle' and pid='0' order by pos desc,pidname desc,id desc limit 1";
   //echo $sql;
$row = getrow($sql);
 if($row=='no') echo $norr2;
else{

   $kv=$row['kv'];
   $title=$row['title']; 
   $pidnamecur=$row['pidname'];
    $htmldir=$row['htmldir']; 
    $style_blockid=$row['style_blockid']; 
    
    $mbhome=$mbhomemob='';
$bscntarr = explode('==#==',$style_blockid);

if(count($bscntarr)>1){
   foreach ($bscntarr as   $bsvalue) {
      $bsvaluearr = explode(':##',$bsvalue);
      $bsccc = $bsvaluearr[0];
      $$bsccc=$bsvaluearr[1];
   }
}



$kv = '<img src='.get_img($kv, '', '').' alt="" width="200" height="200" />';


  $edit = '<a  class="but1"   href="'.$jumpv.'&pidname='.$pidnamecur.'&file=edit_can&act=edit">修改参数</a>';
 //  $edit2  = ' <a  class="but1"   href="'.$jumpv.'&pidname='.$pidnamecur.'&file=edit_blockid&act=edit">修改标识</a>';


?>

<li style="height: auto;width:96%">
<div class="img fl col-md-3">
<?php 
if(DMFABU=='n'){

  echo '<br/><a target="_blank" href="../../demo-/mb.php?style='.$pidnamecur.'">demo 预览<br> </a>';
 
}

echo '<a href="'.BASEURLPATH.'"  target="_blank">'.$kv.'<br />预览模板</a>';



?>
</div>

<div class="img fl tl col-md-9">

<h3 style="font-size:16px;font-weight:bold"><?php echo $title;?></h3>
<div class="cgray" style="padding:5px 0"><?php echo $pidnamecur;?></div>
<div  style="padding:5px 0;line-height:22px">
 模板目录: <strong class="cblue"><?php echo $htmldir;
 
 if(!is_dir(TPLCURROOT)) {
   echo '<p class="cred">模板目录不存在。检查是否需要到官网下载。</p>';
 }
 
 ?></strong>
 
 <?php 
 
 if(substr($mbhome,0,6)<>'myprog') {
   //echo '<br />首页内容：'.$mbhome;
  //echo  '<br />'.check_blockid($mbhome,$htmldir);
  
 }
 else {
  //echo $mbhome.'<br />';
 }
 echo '<br />首页内容<span class="cblue">pc端：</span>'.$mbhome;
 if($mbhome<>'') echo  check_blockid($mbhome);

 echo  ' <br />首页内容<span class="cblue">移动端：</span>';

if($mbhomemob<>'') {
echo   $mbhomemob;
  echo  check_blockid($mbhomemob);
}
else echo  ' 使用pc端';
  ?>
  </div>
 

<div class="edit"  style="height:30px">
 <?php 
  echo $edit;  
  
echo  ' <a  class="but1"   href="'.$jumpv.'&pidname='.$pidnamecur.'&file=edit_newcssfile&act=edit">修改样式css</a>';

 
   ?>
   
     <a target="_blank"  class="but2" href="../mod_layout/mod_layout.php?lang=<?php echo LANG; ?>">布局管理</a>
 
</div>
 
 

</div> 

</li>


<?php
}


?>
 
 
 </ul>

<div class="c"> </div>
 <div style="background: #bbdbfb;height: 35px;margin:15px 0;padding:5px">其他模板：</div>
<?php
$sql = "SELECT * from ".TABLE_STYLE." where $noandlangbh and pidname<>'$curstyle' and pid='0' order by pos desc,id desc";
   //echo $sql;
$rowlist = getall($sql);
 if($rowlist=='no') echo $norr2;
else{
?>
<form method=post action="<?php echo $jumpv;?>&act=pos">
<ul class="mblist gridimghover">

<?php

foreach($rowlist as $vcat){
   $tid=$vcat['id']; $title=$vcat['title']; 
   $pidnamecur=$vcat['pidname']; $style_blockid=$vcat['style_blockid']; 
    $htmldir=$vcat['htmldir'];  
// if($pidname==$pidnamecur) $curclass=' style="color:#fff;background:red;padding:3px;" ';
// else $curclass=' ';
$mbhome=$mbhomemob='';
$bscntarr = explode('==#==',$style_blockid);

if(count($bscntarr)>1){
   foreach ($bscntarr as   $bsvalue) {
      $bsvaluearr = explode(':##',$bsvalue);
      $bsccc = $bsvaluearr[0];
      $$bsccc=$bsvaluearr[1];
   }
}



$kv=$vcat['kv'];
 //$imgsmall2 = p2030_imgyt($kv, 'y', 'n');
$kv = '<img src='.get_img($kv, '', '').' alt="" width="200" height="200" />';


 $sta_visible=$vcat['sta_visible']; 
 
menu_changesta($sta_visible,$jumpv,$tid,'sta');

   $edit = ' &nbsp; &nbsp; <a  class="but1" target="_blank"  href="'.$jumpv.'&pidname='.$pidnamecur.'&file=edit_can&act=edit">修改</a>';
    $daoout = '<a  class="but1"   href="'.$jumpv.'&pidname='.$pidnamecur.'&file=edit_daoout&act=edit">导出</a>';

    $edit2 = ' <a  class="but1"   href="'.$jumpv.'&pidname='.$pidnamecur.'&file=edit_cssdesp&act=edit">修改样式</a>';
 $edit2 .= ' <a  class="but1"   href="'.$jumpv.'&pidname='.$pidnamecur.'&file=edit_blockid&act=edit">修改标识</a>';
 //$edit2 .=  ' <a class="but2" href="'.$jumpv.'&pidname='.$pidnamecur.'&file=edit_layout&act=edit">公共布局</a>';

 
 $js_back = $jumpv.'&pidname='.$pidnamecur;
$activatestyle= "<a href=javascript:confirmaction('activatestyle','nodel','$js_back','确定启用这个模板？这会直接影响前台效果！')  class=but2>启用模板</a>";


$jthomeerror  = '';
 

if(substr($mbhome,0,6)=='jthome'){
  $filejthome = JTHOMEROOT.$mbhome.'.php';
 // echo $filejthome;
  if(!is_file($filejthome))   $jthomeerror = ' style="background:#b6f3e5" ';
}


 ?>
<li <?php   echo $jthomeerror ?>>
 

<p class="title fb"><?php echo $title;?></p>
<p><?php echo $mbhome;?></p>
<?php
 
if(substr($mbhome,0,6)=='jthome'){
     $filejthome = JTHOMEROOT.$mbhome.'.php';
    // echo $filejthome;
     if(!is_file($filejthome))   echo '<p class="cred notdir">首页内容不存在。请到官网下载。</p>';
}
 
  

 ?>


<?php 
if(DMFABU=='n'){

  echo '<a target="_blank" href="../../demo-/mb.php?style='.$pidnamecur.'">demo 预览<br> '.$kv.'</a>';
 
}
else   echo $kv;

//echo '<a target="_blank" href="../../dmpostform.php?type=colordemo&mb='.$pidnamecur.'">'; //no use,use democookiejump.php
 
//echo '</a>'; 



?>
 <p> 模板目录: <strong class="cblue"><?php echo $htmldir;?></strong>
</p>

<p><?php echo $pidnamecur;?></p>

<div style="height:30px">
<?php  
 echo $activatestyle; 
  echo $edit;
  ?>
  </div>


  <div style="height:30px">
排序号：<input type="text" name="<?php echo $tid;?>"  value="<?php echo $vcat['pos'];?>" size="5" />
</div>

 
 
</li>
<?php 
} 
?>
 </ul>
 <div class="c"></div>
<div class="tc" style="padding-bottom:22px"><input class="mysubmit" type="submit" name="Submit" value="排序" />
<br />
<?php echo $sortid_desc?></div>
</form>
<?php }?>

 


</div>
<div class="c"></div>

