<?php 
  require_once HERE_ROOT.'mod_block/tpl_block_list_nav.php';

if($type=='search') {
  require  HERE_ROOT.'mod_block/tpl_block_list_searchres.php';
}
else {
?>
<div class="blocklist">
<form method=post action="<?php echo $jumpvppid;?>&act=pos">
<table class="formtab formtabhovertr">

<?php


foreach($arr_block as $k=>$v){
  $type=$k;
  echo '<tr><td colspan="6">';
    $add = ' &nbsp;&nbsp;&nbsp; <i class="fa fa-plus-circle"></i><a href="'.$jumpvppid.'&act=add&type='.$type.'">添加</a>';
  echo '<h3>'.$v.$add.'</h3>';
 echo '</td></tr>';
 ?>

<tr  >
<td  align="center">排序</td>
<td  >标题</td>
<td   align="center" >效果文件</td>
<td  align="center">操作</td>

<td   align="center">状态</td>
</tr>
<?php
///and (pidstylebh='$curstyle' or pidstylebh='common')
//if($ppid=='common') $wherev= " and (pidstylebh='$curstyle' or pidstylebh='common')  ";
//else $wherev ='';
  $sql = "SELECT * from ".TABLE_BLOCK." where   $noandlangbh  and pidstylebh='$ppid' and pid='$type'   and typecolumn<>'column'  order by  pos desc,id desc"; //pos desc,id desc
   //echo $sql;
  $num_rows = getnum($sql);
  if($num_rows>0){

    $res = getall($sql);


 foreach($res as $v){

        // pre($v);
          $tid = $v['id']; $name = $v['name'];    
          $pidname = $v['pidname'];
          $type =  $pid = $v['pid'];
          $pidstylebh = $v['pidstylebh'];

          $template = $v['template'];

          menu_changesta($v['sta_visible'],$jumpvppid,$tid,'sta_block');

      $jsname = jsdelname($v['name']);

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

//---------

$ppid7 = substr($pidstylebh,0,7);

//echo $ppid4;
if($template<>''){
  $file22 = '';

if(substr($template,0,5)=='comm_')  $file22 =   BLOCKROOT.'jtblock/jtblock_common/'.$template;
  else  if($ppid7 =='jthome_')   $file22 = BLOCKROOT.'jthome/'.$ppid.'/'.$template;  
  else if(substr($template,0,5)=='self_')  $file22 =    TPLCURROOT.'selfblock/'.$type.'/'.$template;
  else if(substr($template,0,7)=='bknode_')   $file22 = BLOCKROOT.'jtblock/jtblock_bknode/'.$template;
  else if(substr($template,0,5)=='bkdh_')   $file22 = BLOCKROOT.'jtblock/jtblock_bkdh/'.$template;
  else  $file22 = BLOCKROOT.'jtblock/'.$ppid.'/'.$template;
 
  
//echo $file22;
 $vnoexist =  is_file($file22)?'':' <span class="cblue">(文件不存在)</span>';
}



$templatev = ' <span class="cgray">'.$template.'</span>';

//----------------------

 //---------------
//$edit_text= "<a class='but1'  href='$jumpvt&pidname=$pidname&act=edit'><i class='fa fa-pencil-square-o'></i> 修改</a>";

$edit_text2= " <a class=but1  href='$jumpv&pidname=$pidname&act=edit'>修改</a>";


$del_text= " <a href=javascript:delid('del_block','$tid','$jumpvppid','$jsname')  class=but2><i class='fa fa-trash-o'></i> 删除</a>";


?><tr <?php echo $tr_hide?>>
<td  align="center">
<input type="text" name="<?php echo $tid;?>"  value="<?php echo $v['pos'];?>" size="5" /></td>
<td  ><?php echo $name.' ';
   //if($ppid4<>'dmre') echo  adm_previewlink($pidname);
   echo  adm_previewlink($pidname);


?>
<br /><?php
echo  admblockid($pidname) ;

if($cssname<>'') echo '<div class="cgray">css名称：'.$cssname.'</div>'
 
?>
</td>
<td  align="center"><?php echo $templatev.$vnoexist;

$num_imgfg = num_imgfj2($pidname);
if($num_imgfg>0) echo  '<br />私有编辑器附件('.$num_imgfg.')';


?></td>
<td  align="center"><?php echo $edit_text2.$del_text?></td>
<td  align="center"><?php echo $sta_visible;?></td>


</tr>
<?php
 }//edn foreach
  }//enf if num>0
  else {
    echo '<tr><td colspan="5">'.$norr3.'</td></tr>';
  }
  ?>

<?php
}//end foreach $arr_block

?>
</table>
<div style="padding-bottom:22px"><input class="mysubmit" type="submit" name="Submit" value="修改排序" />
</form>
<?php
echo $sortid_desc;
?>
<p class="cred"><?php echo $text_adminhide2;?></p>
</div>



<?php
      $file='';
      require_once HERE_ROOT.'plugin/page_2010.php';

      ?>

 <script>
   function checksearch(thisForm) {


       if (thisForm.searchword.value == "" || thisForm.searchword.value == "请输入标题或模板" )
       {
           alert("请输入标题或模板。");
           thisForm.searchword.focus();
           return (false);
       }



       // return;

   }


function selectjump(url){
 if(url!='') window.location.href=url;
}


</script>

<?php


}

?>
