<?php 
defined('IN_HS') or exit('Access Denied');
include admintpl('header');
?>
<?=$menu?>
<script type="text/javascript">
function ruselinkurl(){
	if($('islink').checked==true){
		$('linkurl').disabled=false;
	}else{
		$('linkurl').disabled=true;
	}
}

function doCheck(){
	if ($F('title')=="") {
		alert("请输入标题");
		$('title').focus();
		return false;
	}
}
function SelectPic(){
  var arr=Dialog('?mod=hs&file=file_select&channelid=<?=$channelid?>&type=thumb','',820,600);
  if(arr!=null){
    var s=arr.split('|');
    $('thumb').value=s[0];
  }
}


function SelectFile(){
  var arr=Dialog('?mod=hs&file=file_select&channelid=<?=$channelid?>&type=thumb&realdir=<?=$MOD['upload_dir']?>','',820,600);
  if(arr!=null){
    var s=arr.split('|');
	var ss = $("pictureurls").value == '' ? '' : "\n";
	$('pictureurls').value += ss+'图片说明|'+s[0].replace(/<?=$HS['uploaddir']?>\/<?=$CHA['channeldir']?>\/<?=$MOD['upload_dir']?>\//g, '');
  }
}
function ShowPreview(){
	var obj = $('pictureurls');
	var r = document.selection.createRange();
	var s = "TMP";
	var rt = r.text;
	var rv = rt+s;
	r.text = rt+s;
	var i = obj.value.indexOf(rv);
	obj.value = obj.value.replace(s, '');
	obj.blur();
	var str;
	if(obj.value.indexOf("\r") == -1){
		str = "\n";
	}else{
		str = "\r\n";
	}
	var p = obj.value.substring(obj.value.lastIndexOf("|", i)+1, i)+obj.value.substring(i, obj.value.indexOf(str, i));
	var l = obj.value.substring(i, obj.value.length);
	if(l.indexOf("\n")==-1) p = obj.value.substring(obj.value.lastIndexOf("|", i)+1, i)+l;
	var u = <?php echo "'";echo imgurl($HS['uploaddir'].'/'.$CHA['channeldir'].'/'.$MOD['upload_dir'].'/');echo "'"; ?>;
	if(p.indexOf("://") != -1) u = '';
	var m = p.match(/^[^\r\n\|]+\.(jpg|gif|png|bmp)$/);
	if(m != null)
	{
		window.open(u+p);
	}
}
function doKeywords(ID)
{
	$(ID).value = $F(ID).replace(new RegExp('，',"gm"),',');
	$(ID).value = $F(ID).replace(new RegExp(' ',"gm"),',');
}
</script>

<table width="100%" height="25" border="0" cellpadding="3" cellspacing="0" class="tableborder">
  <tr>
    <td> <img src="<?=HS_PATH?>admin/skin/images/pos.gif" align="absmiddle" alt="当前位置" > 当前位置：<a href="?mod=<?=$mod?>&file=<?=$file?>&action=main&channelid=<?=$channelid?>">图片首页</a> &gt;&gt; <a href="?mod=<?=$mod?>&file=<?=$file?>&action=add&catid=<?=$catid?>&channelid=<?=$channelid?>">添加图片</a> &gt;&gt; <?=$CAT['catname']?> &gt;&gt; </td>
  </tr>
</table>

<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td height="10"> </td>
</tr>
</table>


<form action="?mod=<?=$mod?>&file=<?=$file?>&action=add&channelid=<?=$channelid?>&dosubmit=1" method="post" name="myform" onsubmit="return doCheck();">
<input type="hidden" name="picture[username]" value="<?=$_username?>" />
<table cellpadding="2" cellspacing="1" class="tableborder">
  <tbody>
  <tr>
    <th colspan=2>基本信息</th>
  </tr>
    <tr> 
      <td width="15%" class="tablerow">所属栏目</td>
      <td class="tablerow"><?=$this_category?></td>
    </tr>

    <tr> 
      <td class="tablerow">标题</td>
      <td class="tablerow"><?=$style_edit?> <input name="picture[title]" type="text" id="title" size="44" maxlength="100" class="inputtitle" value="<?=$title?>"> <font color="#FF0000">*</font></td>
    </tr>


<tr>
      <td class="tablerow"></td>
      <td class="tablerow"><input name="picture[author]" type="hidden" id="author" size="40" value="管理员" />
      <input name="picture[copyfrom]" type="hidden" id="copyfrom" size="40" value="本站"></td>
    </tr>

<tr>
      <td class="tablerow">图片介绍</td>
      <td class="tablerow">
	  <textarea name="picture[introduce]" id="content" cols="80" rows="10"><?=$introduce?></textarea></td>
    </tr>
	<tr>
	<td class="tablerow">图片地址 <font color="#FF0000">*</font></td>
	<td class="tablerow">
	<input name="picture[pictureurls]" type="text" id="pictureurls" style="width:300px;" ondblclick="ShowPreview();" value="<?=$pictureurls?>" /><br>
	<iframe id="uploads" name="uploads" src="?mod=<?=$mod?>&file=upload&channelid=<?=$channelid?>" border="0" vspace="0" hspace="0" marginwidth="0" marginheight="0" framespacing="0" frameborder="0" scrolling="no" width="100%" height="30"></iframe>
	</td>
	</tr>
	<tr> 
      <td class="tablerow">转向链接</td>
      <td class="tablerow">
       <input type="text" name="picture[linkurl]" id="linkurl"  size="50" maxlength="255"<? if(!$islink) { ?>disabled<? } ?> value="<? if($islink) { ?><?=$linkurl?><? } ?>"><input name="picture[islink]" type="checkbox" class="checkbox_style" id="islink" value="1" onclick="ruselinkurl();" <? if($islink) { ?>checked<? } ?>><font color="#FF0000">转向链接</font>
	   <br/><font color="#FF0000">如果使用转向链接则点击标题就直接跳转而内容设置无效</font>     </td>
    </tr>
    <tr> 
      <td class="tablerow">推荐位置</td>
      <td class="tablerow">
<?=$position?>      </td>
	  </tr>
    <tr> 
      <td class="tablerow">图片状态</td>
      <td class="tablerow">


<input name="picture[status]" type="radio" value="3" checked class="radio_style"> 已通过&nbsp;
<input name="picture[status]" type="radio" value="1" class="radio_style"> 待审核&nbsp;
 </td>
	  </tr>
	<tr> 
      <td width="15%" class="tablerow">添加日期</td>
      <td class="tablerow"><?=date_select('picture[addtime]', $addtime,'%Y-%m-%d %H:%M:%S')?></td>
    </tr>
</tbody>

</table>
<table width="100%" height="40" align="center" cellpadding="2" cellspacing="1" >
  <tr>
    <td width="15%">
      <div style="display:none"><?=$php_urlrule?>
    <input type="hidden" name="picture[ishtml]" value="0" /></div></td>
    <td>
	<input type="submit" class="btn" value=" 确定 " />
	&nbsp;&nbsp;&nbsp;&nbsp;
    <input type="reset" class="btn" value=" 清除 " />	</td>
  </tr>
</table>
</form>
</body>
</html>