www.gusucode.com > 深度梦想整站系统(asp) 1.14.02源码程序 > admin/photo/photo_Update.asp
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%> <% projectRootPath = "../../" '相对当前应用程序根的位置 %> <!-- #include file="../web.config.asp"--> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta name="robots" content="noindex,nofollow" /> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>管理</title> <link href="../themes/<%=theme_Path%>/main.css" rel="stylesheet" type="text/css" /> <script type="text/javascript"> function checkForm(){ if(document.form1.fTitle.value==""){ alert("图片标题不能为空!!"); document.form1.fTitle.focus(); return false; } if(document.form1.fclass_ID.value==""){ alert("图片分类必须选择!!"); document.form1.fclass_ID.focus(); return false; } document.form1.button.value="提交中,请稍候..."; document.form1.button.disabled=true; return true; } </script> </head> <body id="bodyBg1"> <br /> <a href="photo_Manage.asp">图片管理</a> | <a href="photo_Add.asp">添加图片</a> <hr class="Nav-hr" /> <br /> <dl class="manageContent"> <dt>图片管理</dt> <dd> <br /> <% if(Request.Form("fTitle")<>"" and Request.Form("fid")<>"")then fid=Request.Form("fid") fclass_ID=Request.Form("fclass_ID") fTitle=Request.Form("fTitle") ftip=Request.Form("ftip") fAuthor=Request.Form("fAuthor") fCopyFrom=Request.Form("fCopyFrom") fContent=Request.Form("fContent") fkeyWord=Request.Form("fkeyWord") fHits=Request.Form("fHits") fdayHits=Request.Form("fdayHits") fweekHits=Request.Form("fweekHits") fmonthHits=Request.Form("fmonthHits") fCreateTime=Request.Form("fCreateTime") fUpdateTime=Request.Form("fUpdateTime") fisHot=Request.Form("fisHot") fisOnTop=Request.Form("fisOnTop") fisElite=Request.Form("fisElite") fisView=Request.Form("fisView") fisIncludePic=Request.Form("fisIncludePic") fuploadFiles=Request.Form("fuploadFiles") fDefaultPicUrl=Request.Form("fDefaultPicUrl") PhotoUrl=Request.Form("PhotoUrl") sql="update deep_Photo set fTitle='"&fTitle&"',fclass_ID="&fclass_ID&",ftip='"&ftip&"',fAuthor='"&fAuthor&"',fCopyFrom='"&fCopyFrom&"',fContent='"&fContent&"',fkeyWord='"&fkeyWord&"',fHits="&fHits&",fdayHits="&fdayHits&",fweekHits="&fweekHits&",fmonthHits="&fmonthHits&",fCreateTime='"&fCreateTime&"',fUpdateTime='"&fUpdateTime&"',fisHot="&fisHot&",fisOnTop="&fisOnTop&",fisElite="&fisElite&",fisView="&fisView&",fisIncludePic="&fisIncludePic&",fuploadFiles='"&fuploadFiles&"',fDefaultPicUrl='"&fDefaultPicUrl&"',PhotoUrl='"&PhotoUrl&"' where fid=" & fid 'response.Write(sql) conn.execute(sql) Response.Write("["&fTitle&"]修改成功!!") end if id=request.QueryString("id") if(id<>"")then sql_soft="select * from deep_Photo where fid=" & id set rsSoft=conn.execute(sql_soft) if(rsSoft.eof and rsSoft.bof)then response.Write("没有记录!") else %> <form id="form1" name="form1" method="post" action="" onSubmit="return checkForm()"> <table width="99%" class="tableBoderForm"> <tr> <td>所属栏目:</td> <td><select name="fclass_ID" id="fclass_ID"> <option value=""> 选择分类 </option> <% SqlArticleClass="Select * from deep_PhotoClass where fparentID=0 order by fOrderID" Set rsArticleClass=conn.execute(SqlArticleClass) if rsArticleClass.Eof and rsArticleClass.Bof then Response.Write("<option>请先添加栏目!</option>") else while (not rsArticleClass.eof) %> <option value="<%=rsArticleClass("fclass_ID")%>" <%if(rsArticleClass("fclass_ID")=rsSoft("fclass_ID"))then%> selected="selected"<%end if%>><%=rsArticleClass("fClassName")%></option> <% call getSubList(rsArticleClass("fclass_ID"),rsSoft("fclass_ID"),0,"select fclass_ID,fparentID,fclassName from deep_PhotoClass") rsArticleClass.MoveNext wend end if rsArticleClass.close Set rsArticleClass =Nothing %> </select></td> </tr> <tr> <td>图片标题:</td> <td><input name="fTitle" type="text" id="fTitle" value="<%=rsSoft("fTitle")%>" size="60" /></td> </tr> <tr> <td>摘要</td> <td><textarea name="ftip" cols="60" id="ftip"><%=rsSoft("ftip")%></textarea></td> </tr> <tr> <td>作者:</td> <td><input name="fAuthor" type="text" id="fAuthor" value="<%=rsSoft("fAuthor")%>" /> <=【<span onClick="document.form1.fAuthor.value='佚名'" style="cursor:pointer;color:#070;">佚名</span>】 【<span onClick="document.form1.fAuthor.value='未知'" style="cursor:pointer;color:#070;">未知</span>】 【<span onClick="document.form1.fAuthor.value='<%=session("adminName")%>'" style="cursor:pointer;color:#070;"><%=session("adminName")%></span>】 </td> </tr> <tr> <td>来源:</td> <td><input name="fCopyFrom" type="text" id="fCopyFrom" size="50" value="<%=rsSoft("fCopyFrom")%>" /> <=【<span onClick="document.form1.fCopyFrom.value='本站原创'" style="cursor:pointer;color:#070;">本站原创</span>】 </td> </tr> <tr> <td>图片内容:</td> <td><script type="text/javascript"> // 当上传图片等文件时,往下拉框中填入图片路径,可根据实际需要更改此函数 function doChange(objText, objDrop){ if (!objDrop) return; var str = objText.value; var arr = str.split("|"); var nIndex = objDrop.selectedIndex; objDrop.length=1; for (var i=0; i<arr.length; i++){ objDrop.options[objDrop.length] = new Option(arr[i], arr[i]); } objDrop.selectedIndex = nIndex; } </script><textarea name="fContent" id="fContent" style="display:none;"><%=rsSoft("fContent")%></textarea> <iframe id="eWebEditor1" src="../include/eWebEditor/eWebEditor.asp?id=fContent&style=deep_light_photo&savepathfilename=fuploadFiles" frameborder="0" scrolling="no" width="650" height="400"></iframe> <input type="hidden" name="fuploadFiles" id="fuploadFiles" onchange="doChange(this,document.form1.fDefaultPicUrl)"/><% ' ewebeditor.asp文件调用的参数: ' id:下面表单项textarea的名称,在此表单中是Content,注意大小写 ' style:编辑器的样式名称,可在eWebEditor的后台设置 ' originalfilename:用于获取源文件名(上传前的原文件名), ' savefilename:用于获取保存文件名(上传后的文件名), 在此表单中是fuploadFiles ' savepathfilename:用于获取保存带路径文件名(上传后的文件名), %> </td> </tr> <tr> <td>关键字:</td> <td><input name="fkeyWord" type="text" id="fkeyWord" value="<%=rsSoft("fkeyWord")%>" size="60" /><br /> <span style="color:#00F;font-family:'宋体';">用来查找关联信息,可输入多个关键字,中间用“<span style="color:#F00; font-weight:bolder;">,</span>”英文逗号分隔。不能出现""'*?,.()等字符。</span></td> </tr> <tr> <td>点击数:</td> <td> 今日:<input name="fdayHits" type="text" id="fdayHits" value="<%=rsSoft("fdayHits")%>" size="5" /> 本周:<input name="fweekHits" type="text" id="fweekHits" value="<%=rsSoft("fweekHits")%>" size="5" /> 本月:<input name="fmonthHits" type="text" id="fmonthHits" value="<%=rsSoft("fmonthHits")%>" size="5" /> 总计:<input name="fHits" type="text" id="fHits" value="<%=rsSoft("fHits")%>" size="5" /> </td> </tr> <tr> <td>生成时间:</td> <td><input name="fCreateTime" type="text" id="fCreateTime" value="<%=rsSoft("fCreateTime")%>" size="30" /> 时间格式为“年-月-日 时:分:秒”,如:2004-11-18 12:32:47 </td> </tr> <tr> <td>更新时间:</td> <td><input name="fUpdateTime" type="text" id="fUpdateTime" value="<%=now()%>" size="30" /> (原日期:<span class="cBlue"><%=rsSoft("fUpdateTime")%></span>) </td> </tr> <tr> <td>热点图片:</td> <td><input name="fisHot" type="radio" id="radio" value="1" <%if(rsSoft("fisHot")=1)then%>checked="checked"<%end if%> /> 是 <input name="fisHot" type="radio" id="radio2" value="0" <%if(rsSoft("fisHot")=0)then%>checked="checked"<%end if%>/> 否</td> </tr> <tr> <td>固顶:</td> <td><input type="radio" name="fisOnTop" id="radio3" value="1" <%if(rsSoft("fisOnTop")=1)then%>checked="checked"<%end if%>/>是 <input name="fisOnTop" type="radio" id="radio4" value="0" <%if(rsSoft("fisOnTop")=0)then%>checked="checked"<%end if%>/>否</td> </tr> <tr> <td>精华图片:</td> <td><input type="radio" name="fisElite" id="radio5" value="1" <%if(rsSoft("fisElite")=1)then%>checked="checked"<%end if%>/>是 <input name="fisElite" type="radio" id="radio6" value="0" <%if(rsSoft("fisElite")=0)then%>checked="checked"<%end if%>/>否</td> </tr> <tr> <td>是否审核:</td> <td><input name="fisView" type="radio" id="radio7" value="1" <%if(rsSoft("fisView")=1)then%>checked="checked"<%end if%> />是 <input name="fisView" type="radio" id="radio8" value="0" <%if(rsSoft("fisView")=0)then%>checked="checked"<%end if%>/>否</td> </tr> <tr> <td>包含图片:</td> <td><input name="fisIncludePic" type="radio" id="radio9" value="1" <%if(rsSoft("fisIncludePic")=1)then%>checked="checked"<%end if%>/>是 <input name="fisIncludePic" type="radio" id="radio10" value="0" <%if(rsSoft("fisIncludePic")=0)then%>checked="checked"<%end if%>/>否</td> </tr> <tr> <td>标题图片:</td> <td><% ' 把带"|"的字符串转为数组,用于初始下拉框表单 if(rsSoft("fuploadFiles")<>"") then uploadFiles=rsSoft("fuploadFiles") else uploadFiles="" end if aSavePathFileName = Split(uploadFiles, "|") ' 根据新闻内容中相关上传文件为数据,初始下拉框表单 ' 函数InitSelect,根据数组值及初始值返回下拉框输出字串,具体请见startup.asp文件中函数的说明部分 Dim sOptionSavePath response.Write( InitSelect("fDefaultPicUrl", aSavePathFileName, aSavePathFileName, rsSoft("fDefaultPicUrl"), "", " 点击选择jpg图片 ") ) %> <br /> 当编辑区有插入图片时,将自动填充此下拉框,标题图片必须是jpg格式 </td> </tr> <tr> <td>图片地址</td> <td><input name="PhotoUrl" type="text" id="PhotoUrl" size="60" value="<%=rsSoft("PhotoUrl")%>" /></td> </tr> <tr> <td> </td> <td><iframe ID="UploadFiles" frameborder="0" scrolling="no" width="600" height="25" src="../include/upload_form.asp?SavePath=../../photo/uploadFile/photo/&parentBackValue=form1.PhotoUrl&MaxSize=500&FileType=gif/jpg/png/bmp&saveName=0"></iframe></td> </tr> <tr> <td><input name="fid" type="hidden" id="fid" value="<%=id%>" /></td> <td><input type="submit" name="button" id="button" value="修改" /> <input type="reset" name="button2" id="button2" value="重置" /></td> </tr> </table> </form> <% end if end if %> <br /> <br /> </dd> </dl> <br /> </body> </html> <% call closeConnDB() %> <% ' =============================================== ' 初始化下拉框 ' s_FieldName : 返回的下拉框名 ' a_Name : 定值名数组 ' a_Value : 定值值数组 ' v_InitValue : 初始值 ' s_Sql : 从数据库中取值时,select name,value from table ' s_AllName : 空值的名称,如:"全部","所有","默认" ' =============================================== Function InitSelect(s_FieldName, a_Name, a_Value, v_InitValue, s_Sql, s_AllName) Dim i InitSelect = "<select name='" & s_FieldName & "' size=1>" If s_AllName <> "" Then InitSelect = InitSelect & "<option value=''>" & s_AllName & "</option>" End If If s_Sql <> "" Then oRs.Open s_Sql, oConn, 0, 1 Do While Not oRs.Eof InitSelect = InitSelect & "<option value=""" & inHTML(oRs(1)) & """" If oRs(1) = v_InitValue Then InitSelect = InitSelect & " selected" End If InitSelect = InitSelect & ">" & outHTML(oRs(0)) & "</option>" oRs.MoveNext Loop oRs.Close Else For i = 0 To UBound(a_Name) InitSelect = InitSelect & "<option value=""" & inHTML(a_Value(i)) & """" If a_Value(i) = v_InitValue Then InitSelect = InitSelect & " selected" End If InitSelect = InitSelect & ">" & outHTML(a_Name(i)) & "</option>" Next End If InitSelect = InitSelect & "</select>" End Function ' ============================================ ' 去除Html格式,用于从数据库中取出值填入输入框时 ' 注意:value="?"这边一定要用双引号 ' ============================================ Function inHTML(str) Dim sTemp sTemp = str inHTML = "" If IsNull(sTemp) = True Then Exit Function End If sTemp = Replace(sTemp, "&", "&") sTemp = Replace(sTemp, "<", "<") sTemp = Replace(sTemp, ">", ">") sTemp = Replace(sTemp, Chr(34), """) inHTML = sTemp End Function ' ============================================ ' 把字符串进行HTML解码,替换server.htmlencode ' 去除Html格式,用于显示输出 ' ============================================ Function outHTML(str) Dim sTemp sTemp = str outHTML = "" If IsNull(sTemp) = True Then Exit Function End If sTemp = Replace(sTemp, "&", "&") sTemp = Replace(sTemp, "<", "<") sTemp = Replace(sTemp, ">", ">") sTemp = Replace(sTemp, Chr(34), """) sTemp = Replace(sTemp, Chr(10), "<br>") outHTML = sTemp End Function %>