<?php
mb_http_input("utf-8");
mb_http_output("utf-8");
?>
<?php 
	session_start(); 
	require_once('inc/conn.php');
	require_once('inc/constant.php');
	require_once('inc/ls_syscode.php');
	require_once('inc/check.php');
	$opendb=new mydb();
	$lso=$_GET['lso'];
	$id=$_GET['id'];

	switch ($lso)
	{
		case "default":	
		$folderPic=$defaultMotifFolders;
		$motifText="";
		$ls_msg="修改默认主题图";
		$motifTexttitle="默认主题图简介";
		break;


		case "pagemotif":	
		$folderPic=urldecode($_GET['folderPic']);
		$menuName=urldecode($_GET['menuName']);
		
		$ls_msg="修改".$menuName."主题图";
		$motifTexttitle=$menuName."说明";
		$menu_sql2="select * from ls_menu where menuName='".$menuName."' ";
		$menu_query2=$opendb->query($menu_sql2);
		$menu_rows2=mysql_fetch_assoc($menu_query2);
		$motifText=htmlspecialchars_decode($menu_rows2['description'],ENT_QUOTES);
		
		break;
		
		default:
		$motif_sql="select * from ls_motif where ID=".$id." ";
		$motif_query=$opendb->query($motif_sql);
		$motif_rows=mysql_fetch_assoc($motif_query);
		$Pic=$motif_rows['motifPic'];
		$folderPic="../".$MotifFolders."/".$BigFoldersProducts."/".$Pic;
		$motifText=$motif_rows['motifText'];
		$ls_msg="修改主题图片操作";
		$motifTexttitle="主题图简介";
	}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<link href="css/admin.css" rel="stylesheet" type="text/css">
		<script language="JavaScript" src="js/ls.js"></script>
		<title>无标题文档</title>
		
	</head>

	<body>
		<table width="96%" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#6396d6">
			<tr>
				<td height="18" background="images/admin_bg.gif"><div align="center"><font color="#ffffff"><strong>修改主题图片</strong></font></div>
				</td>
			</tr>
			<tr>
				<td height="213" valign="top" bgcolor="#dee7ff"><br>
				 <form name="myform" enctype="multipart/form-data" method="post" action="savemotif.php" >
					<input type="hidden" value="update" name="ls">
					<input type="hidden" value="<?php echo $lso;?>" name="lso">
					<input type="hidden" value="<?php echo $id;?>" name="id">
					<input type="hidden" value="<?php echo urlencode($menuName);?>" name="menuName">
					<input type="hidden" value="<?php echo $Pic;?>" name="Pic">
					<input type="hidden" value="<?php echo urlencode($folderPic);?>" name="folderPic">
					<input type="hidden" name="ChangecatePagePic" value="no">
	      <table border="0" width="96%" align="center">
						<tr>
							<td>提示：<font color="#FF0000"><?php echo $ls_msg; ?></font></td>
							<td align="right"><img src="images/shao.gif">&nbsp;<a href="<?=($lso=="pagemotif"?"ls_menu.php":"motif.php")?>"><u>返回</u></a></td>
						</tr>
					</table>
					<table width="96%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
					 
					  <tr bgcolor="#B9DAFF"> 
						<td height="28" colspan="3"></td>
					  </tr>
					  <tr bgcolor="#f4f4f4"> 
						<td width=12% style="padding-left:15px;" >*缩略图：</td>
						<td width=88% colspan="2" style="padding-left:15px;" ><img src="<?php echo file_exists($folderPic)?$folderPic:"images/noimagelong.png";?>" width="700" height="<?php echo $SmallPicH?>" border="1" name="pic" style="float:left;" />
                        <div  style="padding-left:10px; padding-right:10px; float:left"  >
						<?
                       		if(file_exists($folderPic))
							{
								$picsize=getimagewh($folderPic);
								echo "宽：".$picsize[0]."  高：".$picsize[1];
								echo "<br/>图片文件：<br/>".$folderPic;
							}
						
						?>
                     	</div>
                        <br><br><br><br></td>
					  </tr>
					  <tr bgcolor="#f4f4f4"> 
						<td style="padding-left:15px;" >图片：</td>
						<td style="padding-left:15px;"><input type="file" name="productPic" style="width:300px;" onBlur="document.pic.src=myform.productPic.value"; onChange="myform.ChangecatePagePic.value='yes';">
					    <span style="padding-left:5px;">图片宽度应在900点以内、高度在500点以内，格式为jpg，大小不要超过200KB					    </span></td>
						<td style="padding-left:15px;"><span style="padding-left:5px;">
						  <input type="submit" value="修改" />
						</span></td>
					  </tr>
					  <tr bgcolor="#f4f4f4"> 
						<td style="padding-left:15px;" width="12%"><?=$motifTexttitle?>：</td>
						<td colspan="2" style="padding-left:15px;">
                        
                        <?php
								require_once('fckeditor/fckeditor.php');
								$sBasePath=$_SERVER['PHP_SELF'];
								$sBasePath=substr($sBasePath,0,strpos($sBasePath,"ls_admin"));
								$sBasePath.="ls_admin/fckeditor/";
									
								$oFCKeditor=new FCKeditor('motifText');
								$oFCKeditor->BasePath=$sBasePath;
								$oFCKeditor->Config['SkinPath']=$sBasePath.'editor/skins/silver/';
								//$oFCKeditor->Config['AutoDetectLanguage']=true;
								$oFCKeditor->ToolbarSet='Default';
								$oFCKeditor->Height='350';
								$oFCKeditor->Width = '96%' ;
								$oFCKeditor->Value=htmlspecialchars_decode($motifText,ENT_QUOTES);
								$oFCKeditor->Create();
							?>
                       <!-- <textarea name="motifText" style="width:400px; height:80px;" ><?php echo $motifText;?></textarea> -->
                       </td>
					  </tr>
					  <tr bgcolor="#B9DAFF"> 
						<td height="25" colspan="3" align="center"><input type="submit" value="修改">
							<input type="button" value="刷新本页" onClick="JavaScript:history.go(0);"></td>
					  </tr>
					</table>
					<br />
                 </form>
				</td>
			</tr>
		</table>
	</body>
</html>