<script language="javascript">
	function edit_dialog(url,w,h){
		url	=	url;
		var input_img 	=	$('#input_img_url').val();
		if(input_img){
			var src_url	=	Dialog(url,input_img,w,h);
			if(src_url){
				$('#input_img_url').attr("value",src_url);
				$('#preview').attr("src","<?=BASEURL?>"+src_url+"?"+Math.random());
			}
		}
		else{
			alert('请上传图片');
		}
	}
</script>

<input type="hidden" name="demo[channel_id]" value="<?=$channel_id?>">
<table class="adminform" cellspacing="1">
  <tr>
    <th colspan=2>标题<input type="hidden" name="demo[type_id]" value="<?=$type_id?>" /></th>
  </tr>
  <tr>
    <td><input type="text" name="demo[title]" value="<?=@$demo->title?>" dataType="Require" msg="标题不能为空"  class="text" /></td>
    <td>&nbsp;</td>
  </tr>
  
  <tr>
    <th colspan=2>连接地址</th>
  </tr>
  <tr>
    <td><input type="text" name="demo[link]" value="<?=@$demo->link?>" class="text" ></td>
    <td>&nbsp;</td>
  </tr>
  
  <tr>
    <th colspan=2>图片</th>
   </tr>
   <tr>
    <td width="30%"> <input readonly="readonly" type="text" name="demo[img_url]" value="<?=@$demo->img_url?>" id="input_img_url" dataType="Require" msg="必须上传图片"  class="text" />
      <input type="button" name="upload" value="上传"  onclick="window.open('<?=BASEURI?>file_upload/image/input_img_url','上传图片','width=500,height=400')"/>
      <input type="button" name="upload" value="編辑" onclick="edit_dialog('<?=BASEURI?>editimg/index',600,500)"/></td>
    <td><img src="<?=(@$demo->img_url)?(BASEURL.$demo->img_url):(BASEURL."public/share/nopic.png");?>" id='preview' width="150"/></td>
  </tr>
  <tr>
    <th colspan=2>排序</th>
  </tr>
  
  <tr>
    <td><input type="text" name="demo[order]" value="10" class="text" /></td>
    <td>&nbsp;</td>
  </tr>
  
  <tr>
  	<td colspan="2"><input type="submit" name="sub" value="提交" class="button"/></td>
  </tr>
</table>
<input type="hidden" name="demo_id" value="<?=@$demo->id?>" />
