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

if($act=='insert')
 {
  if($abc1=="") {
  	$abc1 = 'pls input title'; exit;
  }

  $pidname='region'.$bshou;


			$ss = "insert into ".TABLE_REGION." (pid,pidstylebh,pidname,pbh,name,cssname,haswow,lang) values ('0','$ppid','$pidname','$user2510','$abc1','$abc2','$abc3','".LANG."')";
			  //echo $ss;exit;
			iquery($ss);
			//alert('添加成功！');
			jump($jumpv);


 }
 if($act=='update')
 {
     if($abc1=="")  {
	  	$abc1 = 'pls input title'; exit;
	  }

	  // $addcss =  htmlentitdm(@$_POST['addcss']);
	  // $addcss=str_replace("\\","/",$addcss);
	  // $addcss=str_replace(chr(13),"|",$addcss);
	  // $addcss=str_replace(chr(32),"",$addcss);

	  // $addjs =  htmlentitdm(@$_POST['addjs']);
	  // $addjs=str_replace("\\","/",$addjs);
	  // $addjs=str_replace(chr(13),"|",$addjs);
	  // $addjs=str_replace(chr(32),"",$addjs);

    $cusstyle =  htmlentitdm(@$_POST['cusstyle']);

 $effect='default';
       $ss = "update ".TABLE_REGION." set name='$abc1',cssname='$abc2',haswow='$abc3',cusstyle='$cusstyle' where id='$tid'  $andlangbh limit 1";
      // echo $ss;exit;
			iquery($ss);
			$jumpv = $jumpvedit.'&tid='.$tid;
			 jump($jumpv);

 }


 if($act=='add')
 { $titleh2= '添加区域';
 $name=$cssname= $addcss=$addjs='';
 $effect = ''; $haswow = 'n';
 }

 if($act=='edit')
 {
 $titleh2= '修改区域';

 $jumpvinsert = $jumpvupdate.'&tid='.$tid;

$sql = "SELECT * from ".TABLE_REGION."  where id='$tid'   $andlangbh order by id limit 1";
$row = getrow($sql);
if($row=='no'){echo 'no record...';exit;}
//$desp=zbdesp_imgpath($row['desp']);
$name= $row['name'];
$cssname= $row['cssname'];
 //$effect= $row['effect']; 
 $effect='default';
   $haswow= $row['haswow'];



$cusstyle=$row['cusstyle'];
$addcss=$row['addcss'];
$addcss=str_replace("|",chr(13),$addcss);
$addjs=$row['addjs'];
$addjs=str_replace("|",chr(13),$addjs);

 }

 if($act=='add' or $act=='edit')
 {
?>

<form  onsubmit="javascript:return checkhere(this)" action="<?php echo $jumpvinsert?>" method="post">
  <table class="formtab">
    <tr>
      <td width="22%" class="tr">页面区域标题：</td>
      <td width="77%"> <input name="name" type="text" value="<?php echo $name?>" class="form-control" />
       </td>
    </tr>


<tr>
            <td   class="tr"> <?php echo $text_cssname; ?> </td>
            <td  >
                <input name="cssname" type="text"  class="inputcss form-control" value="<?php echo $cssname; ?>"  /><?php echo $xz_maybe; ?>

            </td>
        </tr>
        <tr>
            <td   class="tr">开启wow动画</td>
            <td  >
            <select name="haswow"> <?php select_from_arr($arr_yn,$haswow,'');?>
     </select>

            </td>
        </tr>
   
 
 <tr>
      <td   class="tr"> 自定义样式style：  </td>
      <td >
    <textarea class="form-control" rows="10" name="cusstyle" style="font-size: 16px"><?php echo $cusstyle; ?></textarea> <?php echo $xz_maybe; ?>
    </td>
    </tr>
<tr>
      <td></td>
      <td>
      <input  class="mysubmit" type="submit" name="Submit" value="<?php echo $titleh2;?>"></td>
    </tr>
  </table>
</form>



<?php
}
?>

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



   // return;

}


</script>
