<?php
/*	欢迎使用DM企业建站系统，本系统由www.demososo.com开发。
*/
require_once '../config_a/common.inc2010.php';
$switchlanglink = 'mod_jt_region/mod_regioneditcnt.php?file=editlangcnt&pidname='.$pidname.'&pid='.$pid;

 

ifhave_lang(LANG);//TEST if have lang,if no ,then jump
$menuactive_block = 'nav-active';


//$jump = BASEURL.'dmpostform.php?type=editjtmbsqlite&pidname='.$pidname.'&pidname2='.$pidname2.'&lang='.LANG;

 //$jumpsidebar = BASEURL.'dmpostform.php?type=editjtmbsqlite&pidname2='.$pidname2.'&lang='.LANG;

 
$title = '编辑首页内容';

$tablename = TABLE_JTREGION;
$tablename2 =  TABLE_JTREGION;
//echo $ppid;

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


$filearr =  array("home");
if(!in_array($pid,$filearr))   {
 // echo 'pid is limited in home.';exit;
}


if($file=='') $file='list';
$filearr =  array("list", "add","editcan","editlangcnt","addlangcnt","move");
if(!in_array($file,$filearr))   {echo 'file is error.';exit;}

 

$jumpv='../mod_jt_region/mod_regioneditcnt.php?lang='.LANG.'&homeid='.$homeid;

$jumpvf=$jumpv.'&file='.$file;
 
 $jumplinev='../mod_jt_region/mod_regionline.php?lang='.LANG.'&homeid='.$homeid;
//------------------
 

//---
if($act == "sta")
{
   $v = htmlentitdm($v);
     $ss = "update $tablename set sta_visible='$v' where id=$tid";
	// echo $ss;exit;
    iquery($ss);
    jump($jumpv);
}

//-------------
if($act == "pos")
{ 
      dmnodepos_sqlitenolang($_POST,$tablename);
      jump($jumpv);
}



//-----------------------
if($act == "del")
{
 

   $sql = "SELECT * from $tablename  where pid='$pidname'  order by id";
    //echo $sql;exit;
   $rowall = getall($sql);
   if($rowall<>'no'){
          foreach ($rowall as $k => $v) {   
                  $blockimg = $v['jtimg'];
                  $blockimg2 = $v['jtimg2'];
                  $blockimg3 = $v['jtimg3'];
                  $blockimg4 = $v['jtimg4'];           
               
                  if($blockimg<>'')   p2030_delimg($blockimg,'y','n');
                  if($blockimg2<>'')  p2030_delimg($blockimg2,'y','n');
                  if($blockimg3<>'')  p2030_delimg($blockimg3,'y','n');
                  if($blockimg4<>'')  p2030_delimg($blockimg4,'y','n'); 

                    $tid = $v['id'];
                   $ss2 = "delete from $tablename  where id='$tid' ";

                    iquery($ss2);

     }  

   }

     
     $ss = "delete from $tablename  where pidname='$pidname'";
    // echo $ss;
        iquery($ss);
        jump($jumpv); 
}

 

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

 //if($file =='add' || $act =='insert') require_once HERE_ROOT.'mod_common/tpl_header_iframe.php';
//else require_once HERE_ROOT.'mod_common/tpl_header.php';


if($file =='add' || $act =='insert') require_once HERE_ROOT.'mod_common/tpl_header_iframe.php';
else require_once HERE_ROOT.'mod_common/tpl_header.php';

?>

 <div class="page-title-box">
                    <h4 class="page-title"> 
                    <?php


 echo '编辑首页内容';
 if($file == 'list'  ||  $file=='add') {  }
  else{
      echo  '<br /><a style="font-size:20px" href="'.$jumplinev.'">返回列表</a>';
 }
 
?>


</h4>
                   
                    <div class="clearfix"></div>
                 </div>
                  <!--End Page Title-->          
           
           
                  <!--Start row-->
                  <div class="row">
                    <div class="col-md-12">
                       <div class="white-box">



<?php
  if($file=='list'){
?>
  <div class="contenttop">
  <a class="needpopup" href="<?php echo $jumpv?>&file=add"><i class="fa fa-plus-circle"></i> 添加</a>
  &nbsp; &nbsp; &nbsp;
  <?php
  // echo  adm_previewlink($pid);

//if(ENABLEMULTISITE=='y') echo '<a class="needpopup" href="mod_copyregion.php?lang='.LANG.'">复制到其他语言</a>';
   ?>


</div>
<?php
  }
?>

        <?php

          require_once HERE_ROOT.'mod_jt_region/tpl_line_'.$file.'.php';

        ?>
 </div> </div> </div>
<?php
 //if($file =='add' || $act =='insert') require_once HERE_ROOT.'mod_common/tpl_footer_iframe.php';
//else require_once HERE_ROOT.'mod_common/tpl_footer.php';

 
if($file =='add' || $act =='insert') require_once HERE_ROOT.'mod_common/tpl_footer_iframe.php';
else require_once HERE_ROOT.'mod_common/tpl_footer.php';
 
