<input type="hidden" name="channel_id" value="<?=@$channel_id?>" />
<dl class="adminoption">
	<dt></dt>
	<dd class="active"><a href="#tab1">基本信息</a></dd>
	<dd><a href="#tab2">模板设置</a></dd>
	<dd><a href="#tab3">图片设置</a></dd>
</dl>
<div id="tab1" class="tab">
<table class="adminform" cellspacing="0" border="0">
  <tr>
    <th> <?=Kohana::lang("channel_lang.channel_name");?></th>
  </tr>
  <tr>
    <td><input type="text" name="channel[channel_name]" value="<?=@$channel->channel_name?>" dataType="Require"  class="text" style="width:200px;" msg="<?=Kohana::lang("channel_lang.channel_name_error");?>"></td>
  </tr>
  <tr>
    <th><?=Kohana::lang("channel_lang.channel_type");?></th>
  </tr>
  <tr>
    <td><select name="channel[model_id]" id="modelid" onchange="tpl(this.value)">
        <?PHP foreach($modelobj as $model){?>
        <option value="<?=$model->model_id?>" <?php if(@$channel->model_id==$model->model_id){?> selected="selected" <?php }?>>
        <?=$model->model_name?>
        </option>
        <?php }?>
      </select></td>
  </tr>
  <tr>
    <th><?=Kohana::lang("channel_lang.channel_dir");?></th>
  </tr>
  <tr>
    <td><input type="text" name="channel[channel_html_dir]" value="<?=@$channel->channel_html_dir?>"  class="text" style="width:200px;" dataType="Custom" regexp="[a-zA-Z_]+" msg="<?=Kohana::lang('channel_lang.channel_dir_error');?>"></td>
  </tr>
  <tr>
    <th>绑定域名</th>
  </tr>
  <tr>
    <td><input type="text" name="channel[channel_dns]" value="<?=@$channel->channel_dns?>" style="width:200px"  class="text"/></td>
  </tr>
  <tr>
    <th><?=Kohana::lang("channel_lang.order")?></th>
  </tr>
  <tr>
    <td><input type="text" name="channel[channel_order]" value="<?=@$channel->channel_order?$channel->channel_order:0?>" style="width:200px" class="text" dataType="Number" msg="<?=Kohana::lang('channel_lang.must_is_Number');?>"/></td>
  </tr>
  <tr>
    <th><?=Kohana::lang("channel_lang.channel_seo_keywords");?></th>
  </tr>
  <tr>
    <td><input type="text" name="channel[channel_seo_keywords]" value="<?=@$channel->channel_seo_keywords?>" style="width:200px;" class="text"></td>
  </tr>
  <tr>
    <th><?=Kohana::lang('channel_lang.channel_status');?></th>
  </tr>
  <tr>
    <td><input type="radio" name="channel[channel_status]" value="1" <?=@$channel->channel_status==1?"checked=\"checked\"":""?> />
      <?=Kohana::lang('channel_lang.allow');?>
      <input type="radio" name="channel[channel_status]" value="0" <?=@$channel->channel_status==0?"checked=\"checked\"":""?>/>
      <?=Kohana::lang('channel_lang.disabled');?>
    </td>
  </tr>
</table>
</div>
<div id="tab2" class="tab">
<table class="adminform" border="0" cellspacing="0">
<tr>
	<th>封面模板</th>
</tr>
<tr>
	<td><input type="text" name="channel[channel_index_tpl]" value="<?=@$channel->channel_index_tpl;?>" class="text" id="index_tpl"/><input type="button" value="选择" class="button" onclick="window.open('<?=BASEURI?>templates/select/index_tpl')"/></td>
</tr>
<tr>
	<th>列表模板</th>
</tr>
<tr>
	<td><input type="text" name="channel[channel_list_tpl]" value="<?=@$channel->channel_list_tpl;?>" class="text" id="list_tpl"/><input type="button" value="选择" class="button" onclick="window.open('<?=BASEURI?>templates/select/list_tpl')"/></td>
</tr>
<tr>
	<th>内容模板</th>
</tr>
<tr>
	<td><input type="text" name="channel[channel_content_tpl]" value="<?=@$channel->channel_content_tpl;?>" class="text" id="con_tpl"/><input type="button" value="选择" class="button" onclick="window.open('<?=BASEURI?>templates/select/con_tpl')"/></td>
</tr>
<tr>
	<th>大图模板</th>
</tr>
<tr>
	<td><input type="text" name="channel[channel_pictrue_tpl]" value="<?=@$channel->channel_pictrue_tpl?>" class="text" id="pic_tpl"/><input type="button" value="选择" class="button" onclick="window.open('<?=BASEURI?>templates/select/pic_tpl')"/></td>
</tr>
<tr>
	<th>下载模板</th>
</tr>
<tr>
	<td><input type="text" name="channel[channel_down_tpl]" value="<?=@$channel->channel_down_tpl?>" class="text" id="downtpl"/><input type="button" value="选择" class="button" onclick="window.open('<?=BASEURI?>templates/select/downtpl')"/></td>
</tr>
</table>
</div>
<div class="tab" id="tab3">
<table class="adminform" border="0" cellspacing="0">
	<tr>
    	<th>缩略图高度</th>
    </tr>
    <tr>
    	<td><input type="text" name="channel[channel_thumbs_height]" class="text" value="<?=isset($channel->channel_thumbs_height)?$channel->channel_thumbs_height:"120";?>" id="channel_thumbs_height" dataType="Number" msg="缩略图高度只能为数字"/>&nbsp;px</td>
    </tr>
	<tr>
    	<th>缩略图宽度</th>
    </tr>
    <tr>
    	<td><input type="text" name="channel[channel_thumbs_width]" class="text" value="<?=isset($channel->channel_thumbs_width)?$channel->channel_thumbs_width:"120";?>" id="channel_thumbs_width" dataType="Number" msg="缩略图宽度只能为数字"/>&nbsp;px</td>
    </tr>
	<tr>
    	<th>图片质量</th>
    </tr>
    <tr>
    	<td><input type="text" name="channel[channel_picture_quality]" class="text" value="<?=isset($channel->channel_picture_quality)?$channel->channel_picture_quality:"100";?>" id="channel_picture_quality" dataType="Number" msg="图片质量只能为数字"/>&nbsp;%</td>
    </tr>
</table>
</div>
<div>
<input type="submit" name="sb" value="提交" class="submit" />
</div>
<script language="javascript">
	<?php if(!@$channel_id){?>
	tpl($("#modelid").val());
	<?php }?>
	function tpl(modelid){
		$.getJSON('<?=BASEURI?>channel/modeldata/'+modelid,'',function(model){
			$("#index_tpl").attr("value",model.index_tpl);
			$("#list_tpl").attr("value",model.list_tpl);
			$("#con_tpl").attr("value",model.content_tpl);
			$("#pic_tpl").attr("value",model.picture_tpl);
			$("#downtpl").attr("value",model.down_tpl);
		});
		$("body").ajaxError(function(event,request,settings){
			 window.location=settings.url;
			 exit();
		}); 
	}
</script>