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

$switchlanglink = 'mod_layout/mod_layout.php?';

ifhave_lang(LANG);//TEST if have lang,if no ,then jump
 
 $leftsidecollapsed='y';//not del

if($pid<>''){
if($type=='common'  or $type=='page' or $type=='cate' or  $type=='read' or  $type=='tag' or  $type=='search'){
	// or  $type=='csubread'  -- no need csubread,bec useing read is enough
}
 else  {echo '出错的TYPE!';exit;}
}
$catename='';
if($type=='cate'  || $type=='read'){

	if($catid=='') {
		echo 'no catid...';exit;
	}
	else $catename = get_field(TABLE_CATE,'name',$catid,'pidname');
}
$alias= $title2 ='';
if($type=='page') {
	$alias= alias($pid,'page');
	//echo $alias;
}

$typepagetemplate=$type;

$title ='页面布局管理';

  $pidstring = substr($pid,0,4);  
    if($pidstring=='comm') {$title2 ='公共布局';}
	else if($pidstring=='inde') {$title2 ='首页布局设置'; //no index.index by region
}
 else if($pidstring=='page') {
 	ifhaspidname(TABLE_PAGE,$pid);
 	$pagename = get_field(TABLE_PAGE,'name',$pid,'pidname');

 	$title2 ='<span style="color:blue">'.$pagename. '</span>的单页布局';

 }
  else if($pidstring=='cate') {
  			ifhaspidname(TABLE_CATE,$pid);
  			$pagename = get_field(TABLE_CATE,'name',$pid,'pidname');

  			if($type=='read') $title2 ='<span style="color:blue">'.$pagename.' </span>的<strong>详情页</strong>布局';
  			else   			$title2 ='<span style="color:blue">'.$pagename.' </span>的<strong>列表</strong>布局';
  		}
    
 else {
 	//echo 'pid出错!';exit;
 }

 $title2 .=' '.$pid; 


 if($type=='search') $title2 = '搜索';
 if($type=='tag') $title2 = '标签';

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

$jumpv='mod_layout.php?lang='.LANG;
//$jumpv='mod_layout.php?lang='.LANG.'&pid='.$pid.'&type='.$type;
$jumpv_file=$jumpv.'&file='.$file;



 
if($act=='del'){
	//ifsuredel_field(TABLE_,'pidname',$pidname,'equal',$jumpv_catid);
   
   //pre($_GET);  exit;
    
	$ss2 = "delete from ".TABLE_LAYOUT." where pid='$pid' and type='$type' and pidstylebh='$curstyle'   ".ANDLANGBH; 
	iquery($ss2);	
	$jumpv2 = $jumpv.'&pid='.$pid.'&catid='.$catid.'&type='.$type;
	jump($jumpv2);
		  
  }

  
if($act=='insert'){
	
		 $pidname='layout'.$bshou;
		 $arr_layoutcan='sidebarlayout:##jcgg==#==banner:##==#==bannermobi:##==#==bannereffect:##jcgg==#==bannercssname:##==#==bannertext:##==#==bannertextstyle:##==#==bannerbg:##==#==bannerbgtmd:##0.0==#==breadposi:##r==#==breadtext:##==#==sidebartop:##==#==sidebar:##==#==sidebarbot:##==#==contenttop:##==#==content:##==#==contentbot:##==#==pagetop:##==#==pagebot:##';

		 $ss = "insert into ".TABLE_LAYOUT." (pid,pidname,pidstylebh,pbh,lang,type,layoutcan) values ('$pid','$pidname','$curstyle','$user2510','".LANG."','$type','$arr_layoutcan')";
		 iquery($ss);
		 $jumpv2 = $jumpv.'&pid='.$pid.'&catid='.$catid.'&type='.$type;
		 jump($jumpv2);
	  }

 
	

require_once HERE_ROOT.'mod_common/tpl_header.php';

?>

<div class="page-title-box">
     <h4 class="page-title">
         <?php echo $title?>
      </h4>
       <div class="clearfix"></div>
    </div>


 
 <div class="row">
      <div class="col-md-12">
          <div class="white-box">


<?php 
require_once HERE_ROOT.'mod_layout/tpl_layout.php';
?>
 
</div></div></div>


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