<!--#include file="../Inc/Consts.inc" -->
<!--#include file="../Inc/common.Asp" -->
<!--#include file="Admin_htmlconfig.Asp"-->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" href="Images/Admin_style.css">
<script src="../tqeditor/TQEditor.js" type="text/javascript"></script>
<script language="javascript" src="Admin.js"></script>
<script language=javascript>
ie = (document.all)? true:false
if (ie){
function ctlent(eventobject){if(event.ctrlKey && window.event.keyCode==13){this.document.editForm.submit();}}
}
</script>
<script language="javascript">
<!--
function CheckTag()
{
	if(document.editAboutForm.Tag.value==""){
	enter_Tag.innerHTML = "&nbsp;<font color='green'>请输入标签…（允许为空,多个标签请使用英文逗号分隔）</font>";	
	}
	else{
if(document.editAboutForm.Tag.value.length<2||document.editAboutForm.Tag.value.length>90)
{
   enter_Tag.innerHTML = "<font color='red'>×</font>&nbsp;<font color='#FF0000'>标签长度不符合要求（2~90字符）!</font>";
}
else
{	var TagArr=document.editAboutForm.Tag.value.split(",");
	if(TagArr.length>5){
		enter_Tag.innerHTML = "<font color='red'>×</font>&nbsp;<font color='#FF0000'>标签不允许超过5个!</font>";
		}
	else{
   enter_Tag.innerHTML = "<font color='green'>√</font>&nbsp;<font color='#2F5FA1'>符合要求!多个标签请用英文逗号间隔，不允许输入空格。</font>";}
}
	}
}
-->
</script>
<script language=javascript>
	function addtag(newtag)
	{
		if(document.editAboutForm.Tag.value==""){
			document.editAboutForm.Tag.value=newtag;
		}
		else
		{
			var str;
			str=document.editAboutForm.Tag.value.split("");
		  if(str[str.length-1]==","){
			document.editAboutForm.Tag.value+=newtag;
		  }
		  else
		  {
			document.editAboutForm.Tag.value+=","+newtag;
		  }
		}
		CheckTag();
		}	
</script>
<%
' Ss简单网站管理系统-开源版 
'晴天设计www.xxzwz.com
If InStr(SsMasterPurview, "|10,") = 0 Then
    response.Write ("<br /><br /><div align=""center""><font style=""color:red; font-size:9pt; "")>您没有管理该模块的权限！</font></div>")
    response.End
End If
Dim Result
Result = request.QueryString("Result")
Dim ID, AboutName, ViewFlag, Content,OrderNum
Dim Tag,oTag
ID = request.QueryString("ID")
Call AboutEdit()
%>
<br />
<table class="tableBorder" width="95%" border="0" align="center" cellpadding="5" cellspacing="1">
  <form name="editAboutForm" id="editAboutForm" method="post" action="Ss_AboutEdit.asp?Action=SaveEdit&Result=<%=Result%>&ID=<%=ID%>">
    <tr>
      <th height="22" colspan="2" sytle="line-height:150%">【<%If Result = "Add" then%>添加<%ElseIf Result = "Modify" then%>修改<%End If%>单页信息】</th>
    </tr>
    <tr>
      <td width="10%" nowrap align="right" class="forumRow">信息标题：</td>
      <td width="90%" class="forumRowHighlight"><input name="AboutName" type="text" id="AboutName" style="width: 280" value="<%=AboutName%>" maxlength="100">
        是否生效：<input name="ViewFlag" type="checkbox" value="1" <%if ViewFlag then response.write ("checked")%>> <font color="red">*</font></td>
    </tr>
    <tr>
      <td align="right" class="forumRow">排序：</td>
      <td class="forumRowHighlight"><input name="OrderNum" type="text" size="8" maxlength="5" value="<%=OrderNum%>" onkeyup="value=value.replace(/[^\d]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))"  />
        只允许输入数字</td>
    </tr>
    <tr>
      <td align="right" class="forumRow">单页标签：</td>
      <td class="forumRowHighlight"><input name="Tag" type="text" id="Tag" style="width: 280px" value="<%=Tag%>" maxlength="100"  onBlur="CheckTag();" onChange="CheckTag();" onKeyUp="CheckTag();value=value.replace(/(^\s*)|(\s*$)/g, '');" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/(^\s*)|(\s*$)/g, ''));CheckTag();" /><input type="hidden" name="oTag" id="oTag" value="<%=Tag%>" /><span id="enter_Tag"></span></td>
    </tr>
    <tr>
      <td align="right" class="forumRow"><a title="单击标签可快速添加到单页标签" href="">常用标签</a>：</td>
      <td class="forumRowHighlight">&nbsp;<a href="javascript:" onClick="addtag('关于我们')">关于我们</a>|<a href="javascript:" onClick="addtag('公司简介')">公司简介</a>|<a href="javascript:" onClick="addtag('自定义')">自定义</a></td>
    </tr>
    <tr>
      <td align="right" class="forumRow">信息内容：</td>
      <td class="forumRowHighlight"><textarea id="content" rows="18" cols="100"  name="content" wrap="virtual" onkeydown="ctlent()"><% = Content%></textarea>
<script type="text/javascript" defer> 
 new tqEditor('content', {toolbar:'full',advToolbarMode:true, uploadFieldName:'filedata',imageUploadUrl:'./upload.asp', imageFileTypes:'*.jpg;*.gif;*.png;*.jpeg',directInsertUploadImage:'true'}); 
</script></td>
    </tr>
    <tr>
      <td align="right" class="forumRow"></td>
      <td class="forumRowHighlight"><input accesskey="s" name="submitSaveEdit" type="submit" id="submitSaveEdit" value="(Alt+S)提交"> <input type="button" value="返回上一页" onclick="history.back(-1)"></td>
    </tr>
  </form>
</table>
<%
Sub AboutEdit()
    Dim Action, rsCheckAdd, rs, sql
    Action = request.QueryString("Action")
    If Action = "SaveEdit" Then
        
    If Len(Trim(request.Form("AboutName")))<1 Then call Alert("请填写信息标题！","b-1"):response.End
        If Trim(request.Form("Content")) = "" Then call Alert("请填写信息内容！","b-1"):response.End()

        If Result = "Add" Then
            sql = "select [ID],[AboutName],[ViewFlag],[Content],[OrderNum],[Tag] from ["&Datapre&"_About]"
            set rs=db(sql,3)
            rs.addnew
            rs("AboutName") = Trim(Request.Form("AboutName"))
            If Request.Form("ViewFlag") = 1 Then rs("ViewFlag") = 1
            rs("Content") = RTrim(Request.Form("Content"))
			if request.Form("OrderNum")="" then 
			rs("OrderNum") = 999
			else
			rs("OrderNum")=request.Form("OrderNum")
			end if
				rs("Tag")=","&trim(request.Form("Tag"))&","
            'rs("AddTime") = Now()
            'rs("UpdateTime") = Now()
            rs.update            
            ID = rs("ID")
            rs.Close:Set rs = Nothing
            If ISHTML = 1 Then
                Call htmll("", "", ""&AboutNameDiy&""&Separated&""&ID&"."&HTMLName&"", "About.Asp", "ID=", ID, "", "")
            End If
        End If
        If Result = "Modify" Then
            sql = "select [AboutName],[ViewFlag],[Content],[OrderNum],[UpdateTime],[Tag] from ["&Datapre&"_About] where ID="&ID
            set rs=db(sql,3)
            rs("AboutName") = Trim(Request.Form("AboutName"))
            If Request.Form("ViewFlag") = 1 Then
                rs("ViewFlag") = 1
            Else
                rs("ViewFlag") = 0
            End If
            rs("Content") = Request.Form("Content")
            if request.Form("OrderNum")="" then 
			rs("OrderNum") = 999
			else
			rs("OrderNum")=request.Form("OrderNum")
			end if
            rs("UpdateTime") = Now()
			if request.Form("Tag")<>request.Form("oTag") then 				rs("Tag")=","&trim(request.Form("Tag"))&","
            rs.update
            rs.Close:Set rs = Nothing
            If ISHTML = 1 Then
                Call htmll("", "", ""&AboutNameDiy&""&Separated&""&ID&"."&HTMLName&"", "About.Asp", "ID=", ID, "", "")
            End If
        End If
        If ISHTML = 1 Then
         Call   Alert("提交成功，相关静态页面已更新！","AboutList.Asp")
        Else
         Call Alert("提交成功！","Ss_AboutList.Asp")
        End If
    Else
        If Result = "Modify" Then
            sql = "select [AboutName],[ViewFlag],Content,[OrderNum],[Tag] from ["&Datapre&"_About] where ID="& ID
            set rs=db(sql,2)
            AboutName = rs("AboutName")
            ViewFlag = rs("ViewFlag")
            Content = rs("Content")
            OrderNum = rs("OrderNum")
			Tag= rs("Tag")
			if Tag<>"" and not isnull(Tag) then Tag=mid(Tag,2,len(Tag)-2)
            rs.Close:Set rs = Nothing
        End If
    End If
End Sub


' Ss简单网站管理系统-开源版 
'晴天设计www.xxzwz.com
%>