<?php
/*  欢迎使用DM企业建站系统，本系统由www.demososo.com开发。
*/
require_once '../config_a/common.inc2010.php';

ifhave_lang(LANG);//TEST if have lang,if no ,then jump


 
 if($act <> "pos") zb_insert($_POST);


 


$jumpv='../mod_region/mod_region_addblock.php?lang='.LANG.'&pidname='.$pidname;
 

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

   
if($act == "sta")
{
   $v = htmlentitdm($v);
     $ss = "update ".TABLE_REGION." set sta_visible='$v' where id=$tid $andlangbh limit 1";
  // echo $ss;exit;
    iquery($ss);
    jump($jumpv);
}

  
   $title='添加区块到页面区域';

 require_once HERE_ROOT.'mod_common/tpl_header.php';
?>

 <div class="page-title-box">
        <h4 class="page-title"> 
                 添加区块到页面区域  
</h4>
  <div class="clearfix"></div>
  </div>
    <!--End Page Title-->          
           

 


<?php
  if($act=='insert'){

       
      // echo $abc1;
        $pidnamesub='sreg'.$bshou;

 
 
 
$arr_cfg = 'cssname:##==#==reganchor:##==#==cssstyle:##==#==titlefg:##titlecenter==#==sta_width_title:##y==#==sta_width_cnt:##n==#==titleimg:##==#==titlestyle:##==#==titlestylesub:##==#==titlelinelong:##==#==titlelineshort:##==#==linktitle:##==#==linkurl:##==#==bgcolor:##==#==bgimg:##==#==bgposi:##center center==#==bgattach:##fixed==#==bgrepeat:##no-repeat==#==bgsize:##cover';

$ss = "insert into ".TABLE_REGION." (pid,blockid,pidname,pbh,name,lang,arr_cfg) values ('$abc2','$pidname','$pidnamesub','$user2510','$abc1','".LANG."','$arr_cfg')";
     //echo $ss;exit;
      iquery($ss);  
      jump('mod_region.php?lang='.LANG.'&pid='.$abc2);


    }
else {
?>
 
 <!--Start row-->
                  <div class="row">
                    <div class="col-md-12">
                       <div class="white-box">
  <form   onsubmit="javascript:return checkhere(this)" action="<?php echo $jumpv;?>&act=insert" method="post">
  <table class="formtab">
    <tr>
      <td width="20%" class="tr">标题：</td>
      <td width="78%">
      <?php
$name = '请输入标题';
$pidbef = substr($pidname,0,5);
if($pidbef=='vbloc') $name =  get_field(TABLE_BLOCK,'name',$pidname,'pidname');
else if($pidbef=='video') $name =  get_field(TABLE_VIDEO,'title',$pidname,'pidname');
else if($pidbef=='album') $name =  get_field(TABLE_ALBUM,'title',$pidname,'pidname');
else if($pidbef=='group') $name =  get_field(TABLE_BLOCKGROUP,'name',$pidname,'pidname');
      ?>
 <input name="name" class="curname form-control" type="text" value="<?php echo $name;?>"  />
<?php echo $xz_must;?>
      </td>
      </tr>
      <tr>
      <td width="20%" class="tr">选择区域：</td>
      <td width="78%">
     <?php
     $sql = "SELECT * from ".TABLE_REGION." where pid = '0' and ( pidstylebh='common' or pidstylebh ='$curstyle')   $andlangbh order by pos desc,id desc";
//and  (pidstylebh='y' or pidstylebh='$curstyle')
  // echo $sql;
if(getnum($sql)>0){

  $rowlist = getall($sql);
   // pre($rowlist);
  echo '<select name="region">';
    foreach($rowlist as $vcat){
       $name=$vcat['name'];

       $sta_visible=$vcat['sta_visible'];
     
       $pidname=$vcat['pidname']; 

       $sta_visiblev=$sta_visible<>'y'?'[隐藏]':'';

        echo '<option value="'.$pidname.'">'.$name.$sta_visiblev.'</option>';


   }
   echo '</select>';


}

?>
        </td>
    </tr>

  
        


<tr>
      <td></td>
      <td>
      <input  class="mysubmit" type="submit" name="Submit" value="提交"></td>
    </tr>
  </table>
</form>

 
<script>
function checkhere(thisForm) {
   if ($.trim(thisForm.name.value)==""){
    alert("请输入标题。");
    thisForm.name.focus();
    return (false);
  }

     
  

 
   // return;

}
 

 </script>
<?php
  }
?>

       
 </div> </div> </div>
<?php
  require_once HERE_ROOT.'mod_common/tpl_footer.php';
?>
