label_creat.asp
上传用户:jisenq
上传日期:2014-06-29
资源大小:7216k
文件大小:17k
源码类别:

数据库编程

开发平台:

ASP/ASPX

  1. <% Option Explicit %>
  2. <!--#include file="../../FS_Inc/Const.asp" -->
  3. <!--#include file="../../FS_Inc/Function.asp"-->
  4. <!--#include file="../../FS_InterFace/MF_Function.asp" -->
  5. <!--#include file="../../FS_InterFace/NS_Function.asp" -->
  6. <!--#include file="../../FS_InterFace/HS_Function.asp" -->
  7. <!--#include file="../../FS_InterFace/AP_Function.asp" -->
  8. <%
  9. Response.Buffer = True
  10. Response.Expires = -1
  11. Response.ExpiresAbsolute = Now() - 1
  12. Response.Expires = 0
  13. Response.CacheControl = "no-cache"
  14. Dim Conn,obj_Label_Rs,SQL,strShowErr,str_CurrPath,sRootDir
  15. MF_Default_Conn
  16. 'session判断
  17. MF_Session_TF 
  18. Dim LableName,txt_Content,LableClassID,Labelclass_SQL,obj_Labelclass_rs,obj_Count_rs,isDel,tmps_LableName
  19. if G_VIRTUAL_ROOT_DIR<>"" then sRootDir="/"+G_VIRTUAL_ROOT_DIR else sRootDir=""
  20. if Session("Admin_Is_Super") = 1 then
  21. str_CurrPath = sRootDir &"/"&G_UP_FILES_DIR
  22. Else
  23. str_CurrPath = Replace(sRootDir &"/"&G_UP_FILES_DIR&"/adminfiles/"&Session("Admin_Name"),"//","/")
  24. End if
  25. LableClassID = NoSqlHack(Request.QueryString("LableClassID"))
  26. LableName = Trim(Request.Form("LableName"))
  27. txt_Content = Trim(Request.Form("TxtFileds"))
  28. isDel = Trim(Request.Form("isDel"))
  29. if Request.Form("Action") = "add_save" then
  30. if LableName ="" or txt_Content =""  then
  31. strShowErr = "<li>请填写完整</li>"
  32. Response.Redirect("../Error.asp?ErrCodes="&Server.URLEncode(strShowErr)&"&ErrorUrl=")
  33. Response.end
  34. end if
  35. if len(txt_Content) >60000  then
  36. strShowErr = "<li>标签内容不允许大于60000个字符</li>"
  37. Response.Redirect("../Error.asp?ErrCodes="&Server.URLEncode(strShowErr)&"&ErrorUrl=")
  38. Response.end
  39. end if
  40. Labelclass_SQL = "Select LableName,LableContent,AddDate,LableClassID,isDel from FS_MF_Lable where LableName ='"& "{FS400_"&LableName&"}"&"'"
  41. Set obj_Labelclass_rs = server.CreateObject(G_FS_RS)
  42. obj_Labelclass_rs.Open Labelclass_SQL,Conn,1,3
  43. if obj_Labelclass_rs.eof then
  44. obj_Labelclass_rs.addnew
  45. obj_Labelclass_rs("LableName") = "{FS400_"& LableName &"}"
  46. obj_Labelclass_rs("LableContent") = txt_Content
  47. obj_Labelclass_rs("AddDate") =now
  48. if isDel<>"" then
  49. obj_Labelclass_rs("isDel") =1
  50. else
  51. obj_Labelclass_rs("isDel") =0
  52. end if
  53. obj_Labelclass_rs("LableClassID") =Request.Form("LableClassID")
  54. obj_Labelclass_rs.update
  55. else
  56. strShowErr = "<li>名称重复,请重新输入</li>"
  57. Response.Redirect("../Error.asp?ErrCodes="&Server.URLEncode(strShowErr)&"&ErrorUrl=")
  58. Response.end
  59. end if
  60. obj_Labelclass_rs.close:set obj_Labelclass_rs =nothing
  61. strShowErr = "<li>添加成功</li><li><a href=Label/Label_Creat.asp>继续添加</a></li><li><a href=Label/All_Label_Stock.asp?classid="&Request.Form("LableClassID")&">返回标签管理</a></li>"
  62. Response.Redirect("../Success.asp?ErrCodes="&Server.URLEncode(strShowErr)&"&ErrorUrl=Label/Label_Creat.asp")
  63. Response.end
  64. elseif Request.Form("Action") = "edit_save" then
  65. dim rstf
  66. tmps_LableName="{FS400_"&LableName&"}"
  67. Set rstf = Conn.execute("Select LableName,LableContent,AddDate,LableClassID,isDel from FS_MF_Lable where LableName ='"& tmps_LableName &"' and id <>"& NosqlHack(Request.Form("ID")))
  68. if not rstf.eof then
  69. strShowErr = "<li>名称重复,请重新输入</li>"
  70. Response.Redirect("../Error.asp?ErrCodes="&Server.URLEncode(strShowErr)&"&ErrorUrl=")
  71. Response.end
  72. end if
  73. if len(txt_Content) >2000  then
  74. strShowErr = "<li>标签内容不允许大于2000个字符</li>"
  75. Response.Redirect("../Error.asp?ErrCodes="&Server.URLEncode(strShowErr)&"&ErrorUrl=")
  76. Response.end
  77. end if
  78. Labelclass_SQL = "Select id,isDel,LableName,LableContent,AddDate,LableClassID from FS_MF_Lable where id ="& NosqlHack(Request.Form("ID")) 
  79. Set obj_Labelclass_rs = server.CreateObject(G_FS_RS)
  80. obj_Labelclass_rs.Open Labelclass_SQL,Conn,1,3
  81. if not obj_Labelclass_rs.eof then
  82. obj_Labelclass_rs("LableName") = "{FS400_"& LableName &"}"
  83. obj_Labelclass_rs("LableContent") = txt_Content
  84. obj_Labelclass_rs("AddDate") =now
  85. if isDel<>"" then
  86. obj_Labelclass_rs("isDel") =1
  87. else
  88. obj_Labelclass_rs("isDel") =0
  89. end if
  90. obj_Labelclass_rs("LableClassID") =Request.Form("LableClassID")
  91. obj_Labelclass_rs.update
  92. obj_Labelclass_rs.close:set obj_Labelclass_rs =nothing
  93. else
  94. obj_Labelclass_rs.close:set obj_Labelclass_rs =nothing
  95. strShowErr = "<li>错误的参数</li>"
  96. Response.Redirect("../Error.asp?ErrCodes="&Server.URLEncode(strShowErr)&"&ErrorUrl=")
  97. Response.end
  98. end if
  99. strShowErr = "<li>修改成功</li>"
  100. Response.Redirect("../Success.asp?ErrCodes="&Server.URLEncode(strShowErr)&"&ErrorUrl=Label/all_Label_Stock.asp")
  101. Response.end
  102. end if
  103. if Request.QueryString("DelTF")="1" then
  104. Conn.execute("Delete From FS_MF_Labestyle where StyleType='"& Request.QueryString("Label_Sub")&"' and id="&NoSqlHack(Request.QueryString("id")))
  105. strShowErr = "<li>删除成功</li>"
  106. Response.Redirect("../Success.asp?ErrCodes="&Server.URLEncode(strShowErr)&"&ErrorUrl=Label/All_Label_style.asp?Label_Sub="& Request.Form("Label_Sub")&"")
  107. Response.end
  108. end if
  109. dim tmp_LableName,tmp_LableClassID,tmp_LableContent,tmp_isDel,tmp_id,tmp_action
  110. if Request.QueryString("type")="edit" then
  111. dim rs
  112. if not isnumeric(Request.QueryString("id")) then
  113. strShowErr = "<li>错误的参数</li>"
  114. Response.Redirect("../error.asp?ErrCodes="&Server.URLEncode(strShowErr)&"&ErrorUrl=")
  115. Response.end
  116. end if
  117. set rs = Conn.execute("select id,LableName,LableClassID,LableContent,isDel From FS_MF_Lable where id="&Request.QueryString("id"))
  118. if rs.eof then
  119. rs.close:set rs=nothing
  120. strShowErr = "<li>错误的参数</li>"
  121. Response.Redirect("../error.asp?ErrCodes="&Server.URLEncode(strShowErr)&"&ErrorUrl=")
  122. Response.end
  123. else
  124. tmp_LableName=Replace(Replace(rs("LableName"),"{FS400_",""),"}","")
  125. tmp_LableClassID=rs("LableClassID")
  126. tmp_LableContent=rs("LableContent")
  127. tmp_isDel=rs("isDel")
  128. tmp_id = rs("id")
  129. tmp_action = "edit_save"
  130. end if
  131. else
  132. tmp_action = "add_save"
  133. end if
  134. %>
  135. <html>
  136. <head>
  137. <title>标签管理</title>
  138. <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
  139. <link href="../images/skin/Css_<%=Session("Admin_Style_Num")%>/<%=Session("Admin_Style_Num")%>.css" rel="stylesheet" type="text/css">
  140. </head>
  141. <script language="JavaScript" type="text/javascript" src="../../FS_Inc/Get_Domain.asp"></script>
  142. <script language="JavaScript" src="../../FS_Inc/PublicJS.js" type="text/JavaScript"></script>
  143. <script language="JavaScript" src="../../FS_Inc/Prototype.js" type="text/JavaScript"></script>
  144. <script language="JavaScript" src="../../FS_Inc/CheckJs.js" type="text/JavaScript"></script>
  145. <script language="JavaScript" type="text/javascript" src="../../Editor/FS_scripts/editor.js"></script>
  146. <body>
  147. <table width="98%" height="56" border="0" align="center" cellpadding="4" cellspacing="1" class="table">
  148. <tr class="hback" >
  149. <td width="100%" height="20"  align="Left" class="xingmu">标签库</td>
  150. </tr>
  151. <tr class="hback" >
  152. <td height="27" align="center" class="hback">
  153. <div align="left"><a href="All_Label_Stock.asp">所有标签</a>┆<a href="All_Label_Stock.asp?isDel=1">备份库</a>┆<a href="label_creat.asp">创建标签</a>┆<a href="Label_Class.asp" target="_self">标签分类</a>&nbsp;┆<a href="All_label_style.asp">样式管理</a>&nbsp;<a href="../../help?Label=MF_Label_Stock" target="_blank" style="cursor:help;"><img src="../Images/_help.gif" width="50" height="17" border="0"></a></div>
  154. </td>
  155. </tr>
  156. </table>
  157. <table width="98%" border="0" align="center" cellpadding="4" cellspacing="1" class="table">
  158. <tr class="xingmu">
  159. <td colspan="2" class="xingmu">创建标签</td>
  160. </tr>
  161. <form name="NewsForm" method="post" action="" target="_self" onSubmit="return CheckForm(this);">
  162. <tr class="hback">
  163. <td width="8%">
  164. <div align="right">标签名称</div>
  165. </td>
  166. <td width="92%"><span class="tx">{FS400_
  167. <input name="LableName" type="text" value="<%=tmp_LableName%>" id="LableName" size="18"  style="border-top-width: 0px;border-right-width: 0px;border-bottom-width: 0px;border-left-width:0px;border-bottom-color: #000000;"  onFocus="Do.these('LableName',function(){return CheckContentLen('LableName','span_LableName','2-30')})" onKeyUp="Do.these('LableName',function(){return CheckContentLen('LableName','span_LableName','2-30')})">
  168. }</span><span id="span_LableName"></span>
  169. <select name="LableClassID" id="LableClassID">
  170. <option value="0">选择所属栏目</option>
  171. <%
  172.   dim class_rs_obj
  173.   set class_rs_obj=Conn.execute("select id,ParentID,ClassName From FS_MF_LableClass where ParentID=0 order by id desc")
  174.   do while not class_rs_obj.eof
  175. If CStr(tmp_LableClassID)=CStr(class_rs_obj("id")) Then 
  176. response.Write "<option value="""&class_rs_obj("id")&""" selected >"&class_rs_obj("ClassName")&"</option>"
  177. Else
  178. response.Write "<option value="""&class_rs_obj("id")&""">"&class_rs_obj("ClassName")&"</option>"
  179. End If 
  180. response.Write get_childList(class_rs_obj("id"),"")
  181. class_rs_obj.movenext
  182.   loop
  183.   class_rs_obj.close:set class_rs_obj=nothing
  184.   %>
  185. </select>
  186. <label>
  187. <input name="isDel" type="checkbox" id="isDel" value="1" <%if tmp_isDel=1 then response.Write"checked"%>>
  188. 放入备份库</label>
  189. </td>
  190. </tr>
  191. <tr class="hback" <%if request.QueryString("Label_Sub")<>"DS" then response.Write("style=""display:'none';""") else response.Write("style=""display:'';"" ") end if%>> </tr>
  192. <tr class="hback">
  193. <td>&nbsp;</td>
  194. <td>
  195. <table width="100%" border="0" cellspacing="0" cellpadding="0">
  196. <tr>
  197. <td height="16" valign="top">
  198. <!--<OBJECT ID="Lable"
  199. CLASSID="CLSID:389961B3-2025-4E6D-92E8-AE75352096E2"
  200. CODEBASE="Foosun.CAB#version=1,0,0,0">
  201. </OBJECT>
  202. -->
  203. <td height="16" valign="top"> <span onClick="Insertlabel_News('../<%=G_ADMIN_DIR%>/label/News_label.asp',500,460,'obj');" style="cursor:hand;"> <a href="#" title="新闻列表类标签">新闻列表</a> | </span><span onClick="Insertlabel_News('../<%=G_ADMIN_DIR%>/label/News_C_label.asp',500,350,'obj');" style="cursor:hand;"> <a href="#" title="新闻常规类标签">新闻常规</a> | </span><span onClick="Insertlabel_News('../<%=G_ADMIN_DIR%>/label/News_Un_label.asp',500,350,'obj');" style="cursor:hand;"> <a href="#" title="新闻不规则新闻标签">不规则新闻</a> | </span><%if Request.Cookies("FoosunSUBCookie")("FoosunSUBMS")=1 then%><span onClick="Insertlabel_News('../<%=G_ADMIN_DIR%>/label/Mall_label.asp',500,450,'obj');" style="cursor:hand;"> <a href="#" title="商城列表类标签">商城列表</a> | </span><span onClick="Insertlabel_News('../<%=G_ADMIN_DIR%>/label/Mall_C_label.asp',450,350,'obj');" style="cursor:hand;"> <a href="#" title="商城常规类标签">商城常规</a> | </span><%end if%><span onClick="Insertlabel_News('../<%=G_ADMIN_DIR%>/label/down_label.asp',500,450,'obj');" style="cursor:hand;"><a href="#" title="下载列表类标签">下载列表</a> | </span><span onClick="Insertlabel_News('../<%=G_ADMIN_DIR%>/label/down_C_label.asp',300,250,'obj');" style="cursor:hand;"><a href="#" title="下载常规类标签">下载常规</a> | </span><span onClick="Insertlabel_News('../<%=G_ADMIN_DIR%>/label/All_label.asp',500,350,'obj');" style="cursor:hand;display:;"><a href="#" title="通用类标签-所有子系统都可使用">通用标签</a> | </span><a href="All_label_style.asp" target="_self" title="样式管理"> 样式管理</a> | <span  id=item$pval[CatID]) style="CURSOR: hand"  onmouseup="opencat(id_templet);" onMouseOver="this.className='bg'" onMouseOut="this.className='bg1'" language=javascript><a href="#" title="更多标签">更多标签</a></span></td>
  204. </tr>
  205. </table>
  206. <table width="100%" border="0" cellspacing="0" cellpadding="0" id="id_templet" style="display:none;">
  207. <tr>
  208. <td valign="top"> <%if Request.Cookies("FoosunSUBCookie")("FoosunSUBAP")=1 then%><span onClick="Insertlabel_News('../<%=G_ADMIN_DIR%>/label/job_label.asp',500,380,'obj');" style="cursor:hand;"><a href="#" title="人才类标签">人才标签</a> | </span><span onClick="Insertlabel_News('../<%=G_ADMIN_DIR%>/label/job_C_label.asp',300,250,'obj');" style="cursor:hand;display:none"><a href="#" title="人才类标签">人才类标签</a> | </span><%End if%><%if Request.Cookies("FoosunSUBCookie")("FoosunSUBSD")=1 then%><span onClick="Insertlabel_News('../<%=G_ADMIN_DIR%>/label/supply_C_label.asp',450,450,'obj');" style="cursor:hand;"><a href="#" title="供求类标签">供求标签</a> | </span><%end if%><%if Request.Cookies("FoosunSUBCookie")("FoosunSUBHS")=1 then%><span onClick="Insertlabel_News('../<%=G_ADMIN_DIR%>/label/house_label.asp',500,400,'obj');" style="cursor:hand;"><a href="#" title="房产类标签">房产标签</a> | </span><span onClick="Insertlabel_News('../<%=G_ADMIN_DIR%>/label/house_C_label.asp',350,350,'obj');" style="cursor:hand;"><a href="#" title="房产类常规标签">房产常规</a> | </span><%end if%><span onClick="Insertlabel_News('../<%=G_ADMIN_DIR%>/label/FL_C_label.asp',300,350,'obj');" style="cursor:hand;"><a href="#" title="友情连接类标签">友情连接</a> | </span><span onClick="Insertlabel_News('../<%=G_ADMIN_DIR%>/label/st_C_label.asp',300,250,'obj');" style="cursor:hand;"><a href="#" title="常规统计类标签">常规统计</a> | </span><span onClick="Insertlabel_News('../<%=G_ADMIN_DIR%>/label/vote_C_label.asp',380,200,'obj');" style="cursor:hand;"><a href="#" title="投票类标签">投票</a> | </span><span onClick="Insertlabel_News('../<%=G_ADMIN_DIR%>/label/ads_C_label.asp',300,250,'obj');" style="cursor:hand;"><a href="#" title="广告常规类标签">广告</a> | </span><span onClick="Insertlabel_News('../<%=G_ADMIN_DIR%>/label/book_C_label.asp',400,420,'obj');" style="cursor:hand;"><a href="#" title="留言类标签">留言</a> | </span> </span><span onClick="Insertlabel_News('../<%=G_ADMIN_DIR%>/label/log_C_label.asp',400,400,'obj');" style="cursor:hand;"><a href="#" title="日志类标签">日志</a> | </span><span onClick="Insertlabel_News('../<%=G_ADMIN_DIR%>/label/photo_C_label.asp',320,350,'obj');" style="cursor:hand;"><a href="#" title="相册类标签">相册</a> </span></td>
  209. </tr>
  210. </table>
  211. </td>
  212. </tr>
  213. <tr class="hback">
  214. <td>
  215. <div align="right">标签内容</div>
  216. </td>
  217. <td>
  218. <!--编辑器开始-->
  219. <pre id="idTemporary" name="idTemporary" style="display:none"><%=Server.HTMLEncode(tmp_LableContent)%></pre>
  220. <script language="JavaScript">
  221. <!--
  222. var FS_Edit1 = new InnovaEditor("FS_Edit1");
  223. FS_Edit1.cmdAssetManager="modalDialogShow('../../<% = G_ADMIN_DIR %>/CommPages/SelectManageDir/SelectPic.asp?CurrPath=<% = str_CurrPath %>',670,450)";
  224. FS_Edit1.width="100%";
  225. FS_Edit1.height="280";
  226. FS_Edit1.btnFlash=true;
  227. FS_Edit1.btnMedia=true;        
  228. FS_Edit1.RENDER($("idTemporary").innerHTML);
  229. //-->
  230. </script>
  231. <textarea name="TxtFileds" style="display:none" ></textarea>
  232. <!--编辑器结束-->
  233. </td>
  234. </tr>
  235. <tr class="hback">
  236. <td>&nbsp;</td>
  237. <td>
  238. <input type="submit" name="Submit" value="确认保存标签">
  239. <input name="Action" type="hidden" id="Action" value="<%=tmp_action%>">
  240. <input name="id" type="hidden" id="Action" value="<%=tmp_id%>">
  241. <input type="reset" name="Submit2" value="重置">
  242. </td>
  243. </tr>
  244. </form>
  245. </table>
  246. <%
  247. Function get_childList(TypeID,f_CompatStr)  
  248. Dim f_ChildNewsRs,ChildTypeListStr,f_TempStr,f_isUrlStr,lng_GetCount
  249. Set f_ChildNewsRs = Conn.Execute("Select id,ParentID,ClassName from FS_MF_LableClass where ParentID=" & TypeID & " order by id desc" )
  250. f_TempStr =f_CompatStr & "┄"
  251. do while Not f_ChildNewsRs.Eof
  252. get_childList = get_childList & "<option value="""& f_ChildNewsRs("id")&""""
  253. If CStr(tmp_LableClassID)=CStr(f_ChildNewsRs("id")) then
  254. get_childList = get_childList & " selected" & Chr(13) & Chr(10)
  255. End If
  256. get_childList = get_childList & ">├" &  f_TempStr & f_ChildNewsRs("ClassName") 
  257. get_childList = get_childList & "</option>" & Chr(13) & Chr(10)
  258. get_childList = get_childList &get_childList(f_ChildNewsRs("id"),f_TempStr)
  259. f_ChildNewsRs.MoveNext
  260. loop
  261. f_ChildNewsRs.Close
  262. Set f_ChildNewsRs = Nothing
  263. End Function
  264. Set Conn=nothing
  265. %>
  266. </html>
  267. <script language="JavaScript" type="text/JavaScript">
  268. function Insertlabel_News(URL,widthe,heighte,obj)
  269. {
  270.   var obj=window.OpenWindowAndSetValue("../../Fs_Inc/convert.htm?"+URL,widthe,heighte,'window',obj)
  271.   if (obj==undefined)return false;
  272.   if (obj!='')InsertEditor(obj);
  273. }
  274. function InsertEditor(InsertValue)
  275. {
  276. FS_Edit1.insertHTML(InsertValue);
  277. }
  278. function opencat(cat)
  279. {
  280.   if(cat.style.display=="none"){
  281.      cat.style.display="";
  282.   } else {
  283.      cat.style.display="none"; 
  284.   }
  285. }
  286. function CheckForm(FormObj)
  287. {
  288. FormObj.TxtFileds.value = FS_Edit1.getXHTMLBody();
  289. return true;
  290. }
  291. </script>
  292. <!-- Powered by: FoosunCMS4.0系列,Company:Foosun Inc. -->