<%'guidedisplay=1%>
<!--#include file="admin_start.asp" -->

<%
id=request("id")
if not MySys.check.isInteger(id) then
   MySys.Error.info = "请提交合法的模板id！"
   MySys.Error.location = "back"
   MySys.Error.err()
End If

id=int(id)
rs.open"select * from jins_template_sort where sort_id="&id&" ",conn,1,1
if rs.eof then
   MySys.Error.info = "您请求的模板不存在！"
   MySys.Error.location = "back"
   MySys.Error.err()
End If
if request("sort_up")<>"" then
sort_up=request("sort_up")
else
sort_up=rs("sort_up")
end if
set rs_s=conn.execute("select * from jins_template_sort where sort_id="&sort_up&"")
MySys.template.get_template_info(sort_up)
if sort_up=0 then MySys.template.template_project_id="" 
%>
<body topmargin="30" marginwidth="10" marginheight="10">
<form name=edit_template target=admin_edit_template method=post><input type=hidden name=c value=''><input type=hidden name=c_sql value=''><input type=hidden name=formname value=''><input type=hidden name=inputname value=''></form>
<form name=template_sort action="admin_template_edit_handle.asp?action=edit&id=<%=id%>" method=post>
<table cellpadding="3" cellspacing="4" width="90%" height="30" align=center style='border:1px solid #ebebeb' >
	<tr>
		<td width="2%" align=right><img alt='点击弹开编辑框' onclick="opencat(basic_open)" style='CURSOR: hand' src="Images/index_search.gif" width="8" height="16"></td>
		<td  width="98%" align=left>
		<font color="#ebebeb"> | </font>
		<img alt='点击弹开提示信息框' onclick="opencat(help_ads_open)" style='CURSOR: hand' src="Images/icon_info.gif" width="13" height="13" hspace="0" align="absmiddle">			
		<font color="#ebebeb"> | </font>
		模板编辑
	    </td>
	</tr>		
	<tr id="help_ads_open" style="display:  ">
		<td colspan="10" align=left>
		<table cellpadding="4" cellspacing="2" width="99%" height="30" align=center style='border:1px dashed #B7B7B7' >
			<tr>
				<td colspan="8" width='100%' style="line-height:150% ">
				·您可以更改用户的类型<br>
				·通过更改登陆ip锁定可以解除用户错误的操作造成的无法登陆！<br>
				·通过重置取回密码问题和答案可以帮助用户在忘记密码和密码提示问题的情况下恢复用户权限！<br>
			</td>
			</tr>
		</table>
		</td>
	</tr>
	
	<tr id="basic_open" >
		<td colspan="10" align=left style='padding-bottom:5px'>
		<table cellpadding="4" cellspacing="2" bgcolor='#f7f7f7' width="99%" height="30" align=center style='border:1px dashed #808080;padding:20px' >
			<tr>
				<td  width="15%" align=right>模板路径:</td>
				<td  width="85%" align=left colspan="3">
				<%
				MySys.GuideSort "jins_template_sort",sort_up,"admin_template_sort.asp" 
				dir_t= "<a href='admin_template_sort.asp'>根目录</a> "&replace(MySys.guide_sort,"$$","") &" > "&rs("sort_name")
				response.write dir_t
				%>
				</td>
			</tr>
			<tr>
				<td  width="15%" align=right>上级模板路径:</td>
				<td  width="85%" align=left colspan="3">
				<select name=sort_up onchange='cc();'>
				<%
				if sort_up<>0 then
				set s=MySys.temp.search
				s.sort_list=""
				s.list_Sort " and sort_id<>"&id&" ", "jins_template_sort",0,"根目录|"&sort_up
				response.write s.sort_list
				set s=nothing
				else
				response.write "<option value=0 >根目录</option>"
				end if
				%>
				</select>
				<script language="javascript" defer>
				function cc(){
				window.location="admin_template_edit.asp?id=<%=id%>&sort_up="+document.template_sort.sort_up.value;
				}
				</script>
				<input type=button value='复制此模版' onclick="newwin=window.open('admin_template_sort_copy.asp?id=<%=request("id")%>','admin_template_style_edit','toolbar=no,location=no,status=no, menubar=no,scrollbars=no,resizable=no,width=50,height=50');newwin.focus();">
				</td>
			</tr>
			<tr>
				<td  width="15%" align=right>模板名称:</td>
				<td  width="85%" align=left colspan="3">
				  <input name=sort_name value='<%=rs("sort_name")%>' size=25 >
				  <% 
				  dim ccc
				  ccc=""
				  if sort_up<>0 then 
				 'response.write sort_up
				 'response.end
					  set rss=conn.execute("select sort_mark,sort_name from jins_template_sort where sort_up=(select sort_id from jins_template_sort where sort_mark='"&rs_s("sort_mark")&"' and sort_sys=1 )  order by sort_num ")  
					  if not rss.eof then 
						  do while not rss.eof 
								  if conn.execute("select sort_id from jins_template_sort where sort_mark='"&rss("sort_mark")&"' and sort_up="&rs_s("sort_id")&" ").eof then
									  ccc=ccc&"<option value='"&rss("sort_mark")&"' "
									  ccc=ccc&">"&rss("sort_name")&"</option>"
								  else
								  'response.write sort_up
									  if sort_up-rs("sort_up")=0 and rs("sort_mark")=rss("sort_mark") then 
										  ccc=ccc&"<option value='"&rs("sort_mark")&"' selected>"&rss("sort_name")&"</option>"
									  end if
								  end if
							  rss.movenext
						  loop

						  if ccc<>"" then 
						  %>
						   模版类型:
						  <select name=sort_mark >
						   <%response.write ccc%>
						  </select>
						  <%
						  else
						  %>
						  新增模版类型 >> 模版标识:<input value='<%if rs_s("sort_up")>0 then response.write rs_s("sort_mark")&"_" %>' name=sort_mark size=25>
				          <%
                          End If
					  else
						  %>
						  新增模版类型 >> 模版标识:<input value='<%if rs_s("sort_up")>0 then response.write rs_s("sort_mark")&"_" %>' name=sort_mark size=25>
				     <%
				      end if
					  set rss=nothing
				 else
				 %>
					  模版类型:模版方案<input value='project' type=hidden name=sort_mark size=25>
				 <%
				 set rs_s=nothing
				  end if
				 %>
				</td>
			</tr>
			<tr>
				<td  width="15%" align=right>加入时间:</td>
				<td  width="85%" align=left colspan="3">
				<input name=sort_addtime value='<%if rs("sort_addtime")<>"" then response.write rs("sort_addtime") else response.write now()%>' size=25 >
				模板开关:
				<select name=sort_open >
				<option value=1 <%if rs("sort_open")=1 then response.write "selected"%> >打开</option>
				<option value=0 <%if rs("sort_open")=0 then response.write "selected"%> >关闭</option>
				</select>
				 
				</td>
			</tr>
			<tr>
				<td  width="15%" align=right >文件路径:</td>
				<td  width="85%" align=left colspan="3">
                <input id="sort_folder" name="sort_folder" size="83" value='<%=rs("sort_folder")%>' >
			    </td>
			</tr>
			<tr>
				<td  width="15%" align=right valign=top >访问权限:</td>
				<td  width="85%" align=left >
				<%MySys.EditGrade(rs("sort_customer_grade"))%>
			    </td>
			</tr>
			<tr>
				<td  width="15%" align=right valign=top >模板描述:</td>
				<td  width="40%" align=left>
                <textarea id="sort_description" name="sort_description" cols="70" rows="10"><%=rs("sort_description")%></textarea>
				</td>
			</tr>
		</table><br>
		<%
		'////////////////////////////////////////////////////////////////////////////////////////////////////////
		%>
		<table cellpadding="4" cellspacing="2" bgcolor='#f7f7f7' width="99%" height="30" align=center style='border:1px dashed #808080;padding:20px' >
			<tr>
				<td  width="15%" align=right valign=top>模板源码:</td>
				<td  width="85%" align=left colspan="3">
				
                <textarea wrap="off" id="sort_content" name="sort_content" cols="70" rows="20"><%=MySys.functions.TransForm(rs("sort_content"))%></textarea>
                <a title='点击进行详细编辑！' href="javascript:openedit_template('template_sort','sort_content','object,private?project=<%=MySys.template.template_project_id%>,public,link','sort_id','<%=rs("sort_id")%>','模版源码编辑 > <%=MySys.functions.cuthtml(dir_t,"")%>');" >
				<img border=0 src="Images/old.gif" width="21" height="20" align="top">
				</a>
				</td>
			</tr>
			<tr>
				<td  width="15%" align=right valign=top>模板样式表:</td>
				<td  width="85%" align=left>
                <textarea wrap="off" id="sort_style" name="sort_style" cols="70" rows="20"><%=rs("sort_style")%></textarea>
				</td>
			</tr>
		</table><br>
		</td>
	</tr>

	<tr>
		<td height='1' colspan="9" background='images/dot03.gif'></td>
	</tr>
	
	<tr>
	  <td height='30' colspan="8" width='100%' align=center >
	  <input type=submit value="提交设置！" >
	   <input type=reset value="重置" > 
	   <input onclick='history.back(-1)' type=button value="返回" >	  </td>
	</tr>
</table>		
<SCRIPT language=javascript>
	function opencat(cat)
	{
 	 	if(cat.style.display=="none"){
     	cat.style.display="";
  		} else {
     	cat.style.display="none"; 
  		}
	}</SCRIPT>
</form>
<%
rs.close
%>
<!--#include file="admin_end.asp" -->