<!--{template 'head'}-->
<script type="text/javascript">
setSubject("{$channeltitle}Js文件管理");
</script>
	<table cellspacing=0 align=center cellpadding=0 border=0 class=tableborder>
		<tr>    
			<td height='30' class="tablerow"><strong>管理选项：</strong>&nbsp;&nbsp;<a href='system.php?sys=js&channelid={$channelid}&channelselect={$channelselect}&action=manage'><!--{if $action=='manage'}--><font color=red>JS文件管理首页</font><!--{else}-->JS文件管理首页<!--{/if}--></a>&nbsp;|&nbsp;<a href='system.php?sys=js&channelid={$channelid}&channelselect={$channelselect}&action=add&type=0'><!--{if $action=='add' && $type ==0}--><font color=red>添加新的JS文件</font><!--{else}-->添加新的JS文件<!--{/if}--></a>&nbsp;|&nbsp;<a href='system.php?sys=js&channelid={$channelid}&channelselect={$channelselect}&action=cache'>刷新栏目JS文件</a>&nbsp;</td>
		</tr>
	</table>

	<!--{if $action == 'manage'}-->
		<table width='100%' align=center  border='0' cellspacing='1' cellpadding='1' class="tableborder border">
			<tr align=center>    
				<td width='100' height='24' class="tablerowhighlight">JS代码名称</td>    
				<td class="tablerowhighlight">简介</td>    
				<td class="tablerowhighlight" width='60'>代码类型</td>    
				<td class="tablerowhighlight">JS文件名</td>    
				<td class="tablerowhighlight" width='260'>JS调用代码</td>    
				<td class="tablerowhighlight" width='100' align='center'>操作</td>  
			</tr>  
			<!--{if $jss}-->
			<!--{loop $jss $js}-->
			<tr onmouseout="this.style.backgroundColor='#F1F3F5'" onmouseover="this.style.backgroundColor='#BFDFFF'" bgColor='#F1F3F5'>    
				<td width='100' align='center'>{$js[code_name]}</td>    
				<td>{$js[description]}</td>    
				<td width='60' align='center'><!--{if $js[type]==0}-->普通列表<!--{else}-->图片列表<!--{/if}--></td>    
				<td align=center><!--{if $js[exists]}-->&nbsp; {$js[file_name]}&nbsp; <!--{else}--><font color=red>{$js[file_name]}</font><!--{/if}--></td>    
				<td width='260'>
					<textarea name='textarea' cols='40' rows='3'><script type='text/javascript' src="{W_P}cache/js/{$channelid}/{$js[file_name]}"></script></textarea>
				</td>    
				<td width='100' align='center'>
					<a href='system.php?sys=js&channelid={$channelid}&channelselect={$channelselect}&action=edit&id={$js[id]}'>参数设置</a>&nbsp;&nbsp;
					<a href='system.php?sys=js&channelid={$channelid}&channelselect={$channelselect}&action=cache&id={$js[id]}'>刷新</a><br>
					<a onclick="qmeCms.dialogView.iframe('预览效果',this.href, {type:'abs'});return false;" href='system.php?sys=js&channelid={$channelid}&channelselect={$channelselect}&action=cache&preview=1&id={$js[id]}'>预览效果</a>&nbsp;&nbsp;
					<a href='system.php?sys=js&channelid={$channelid}&channelselect={$channelselect}&action=delete&id={$js[id]}' onclick="return confirm('真的要删除此JS文件吗？如果有文件或模板中使用此JS文件，请注意修改过来呀！');">删除</a>    
				</td>  
			</tr>
			<!--{/loop}-->
			<!--{else}-->
			<tr align=center>  
				<td colspan="6">
					<p style="padding:25px;text-align:center;">还没有相关JS数据</p>
				</td>	
			</tr>
			<!--{/if}-->
		</table>
	<!--{/if}-->

	<!--{if $action == 'add' || $action == 'edit'}-->
		<script language=javascript>
		function doCheck()
		{
			var errorMessage = '';
			if ($('code_name').value == '')
			{
				errorMessage+= '请输入代码名称\n';
			}
			if ($('file_name') !=null && $('file_name').value == '')
			{
				errorMessage+= '请输入JS文件名\n';
			}
			if ($('tpl-data').value == '')
			{
				errorMessage+= '请输入模版代码';
			}
			if (errorMessage.length > 1)
			{
				alert( errorMessage);
				return false;
			}
			$('submit').disabled = true ;
			return true;
		}
		</script>
		<form name=myform method=post action=system.php?sys=js&channelid={$channelid}&channelselect={$channelselect}&action={$action} onsubmit="return doCheck();">   
		<table width='100%' border='0' align='center' cellpadding='1' cellspacing='1' class="tableborder border">    
			<tr>      
				<td height='22' colspan='2' align='center' class="submenu"><strong>添加新的JS文件</strong></td>    
			</tr>
			<tr>      
				<td height='25' width=100 class=tablerowl><strong>代码名称</strong></td>      
				<td height='25' class=tablerow>
					<input name='code_name' type=text class="f-text"  id='code_name' value='{$js[code_name]}' size='40' maxlength='50'> <font color='#FF0000'>*</font>
				</td>    
			</tr>    
			<tr>      
				<td height='25' class=tablerowl><strong>代码简介</strong></td>  
				<td height='25' class=tablerow>
					<textarea name='description' cols='40' rows='3' id='description' class="f-text">{$js[description]}</textarea>
				</td>    
			</tr>    
			<tr>      
				<td height='25' class=tablerowl><strong>JS文件名</strong></td>      
				<td height='25' class=tablerow>
				<!--{if $action == 'edit'}-->
					{$js[file_name]}
				<!--{else}-->
					<input name='file_name' type=text class="f-text"  id='file_name' value='{$js[file_name]}' size='40' maxlength='50'> <font color='#FF0000'>*必须唯一</font>
				<!--{/if}-->
				</td>    
			</tr>    
			<tr> 
				<td height='25' class=submenu colspan='2' align='center' ><strong>参数设置</strong></td>    
			</tr>           
			<tr>      
				<td height='25' class=tablerowl><strong>{$channeltitle}数目</strong></td>      
				<td height='25' class=tablerow>
					<input name='num' type=text class="f-text"  id='num'  value='10' size='5' maxlength='3'> <font color='#FF0000'>*</font>
				</td>    
			</tr>
			<tr>      
				<td height='25' class=tablerowl><strong>所属栏目</strong></td>      
				<td height='25' class=tablerow>        
					<select name='cid' id=cid>
						<option value='0'>所有栏目</option>
						{$strall}
					</select>     
				</td>    
			</tr>    
			<tr>      
				<td height='25' class=tablerowl><strong>{$channeltitle}属性</strong></td>      
				<td height='25' class=tablerow>   
					<select style="margin-right: 15px;" id="is_comend" name="is_comend">
						<option value="0">推荐等级</option>
						<option value="1"<!--{if $is_comend==1}--> selected<!--{/if}-->>☆</option>
						<option value="2"<!--{if $is_comend==2}--> selected<!--{/if}-->>☆☆</option>
						<option value="3"<!--{if $is_comend==3}--> selected<!--{/if}-->>☆☆☆</option>
						<option value="4"<!--{if $is_comend==4}--> selected<!--{/if}-->>☆☆☆☆</option>
						<option value="5"<!--{if $is_comend==5}--> selected<!--{/if}-->>☆☆☆☆☆</option>
					</select>				
				</td>    
			</tr>        
			<tr>
				<td class=tablerowl height=25><strong>调用类型</strong></td>
				<td class=tablerow><select name="order_type" id="order_type">
							  <option value='0' selected>最新{$channeltitle}</option>
							  <option value='1'>热门{$channeltitle}</option>
                 </select>
				</td>
			</tr>
			<tr>
				<td class=tablerowl height=25><strong>过滤条件</strong></td>
				<td class=tablerow>
					<select name="filter" id="filter">
						<option value='0' selected>不限</option>
						<!--{loop $filterData $key $val}-->
						<option value='<!--{echo $key+1;}-->'>{$val}</option>
						<!--{/loop}-->
					</select>
				</td>
			</tr>
			<tr>
				<td class=tablerowl height=25><strong>有封面</strong></td>
				<td class=tablerow>
					<select name="thumb" id="thumb">
						<option value='0' selected>不限</option>
						<option value='1'>有封面</option>
					</select>
				</td>
			</tr> 			
			<tr>      
				<td height='25' class=tablerowl><strong>调用模版</strong></td>  
				<td height='25' class=tablerow>
					<div style="position:relative;">
						<textarea id="tpl-data" name='tpl' style="width:560px;height:150px;" wrap="off" oncontextmenu="return false" class="text-data"><!--{if $js[tpl]}-->{$js[tpl]}<!--{else}-->{$tpl}<!--{/if}--></textarea>
						<textarea id="tpl-index" style="width:35px;height:150px;" readonly="true" class="text-index"></textarea>
						<div style="width:42px;height:152px;"class="text-index-parent"></div>
					</div>
				</td>    
			</tr>    
			<tr>      
				<td height='40' colspan='2' align='center'  class=tablerowl>        
					<input name='id' type='hidden' value='{$id}'>  
					<input name='type' type='hidden' value='{$type}'>  
					<input name='insert' type='hidden' id='insert' value='1'>        
					<input name='Submit' type='submit' id='submit' value='添加 / 编辑' class="f-button" / >
				</td>    
			</tr> 
		</table>
		</form> 
		<!--{if $action == 'edit'}-->
		<script language=javascript>
			selectChecked( 'num', '{$num}');
			selectChecked( 'is_comend', '{$is_comend}');
			selectChecked( 'order_type', '{$order_type}');
			selectChecked( 'filter', '{$filter}');
			selectChecked( 'thumb', '{$thumb}');
		</script>
		<!--{/if}-->
		<script type="text/javascript">
		new qmeCms.areaIndex('tpl');
		</script>
	<!--{/if}-->
<!--{template 'foot'}-->