📄 ad_layout.asp
字号:
<td><strong>模板文件名:</strong></td>
<td><%if Action="Modify" and rs("DesignType")=0 then%>
<input name="LayoutFileName" type="hidden" id="LayoutFileName" value="<%=rs("LayoutFileName")%>">
<%=rs("LayoutFileName")%>
<%else%>
<input name="LayoutFileName" type="text" id="LayoutFileName" value="<%if Action="Modify" then response.write rs("LayoutFileName")%>" size="50" maxlength="100">
<%end if%></td>
</tr>
<tr class="tdbg">
<td width="40%"><strong>版面设计模板预览图:</strong></td>
<td><%if Action="Modify" and rs("DesignType")=0 then%>
<input name="PicUrl" type="hidden" id="PicUrl" value="<%=rs("PicUrl")%>">
<%=rs("PicUrl")%>
<%else%>
<input name="PicUrl" type="text" id="PicUrl" value="<%if Action="Modify" then response.write rs("PicUrl")%>" size="50" maxlength="100">
<%end if%></td>
</tr>
<tr class="tdbg">
<td width="40%"><strong>设计者姓名:</strong></td>
<td><%if Action="Modify" and rs("DesignType")=0 then%>
<input name="DesignerName" type="hidden" id="DesignerName" value="<%=rs("DesignerName")%>">
<%=rs("DesignerName")%>
<%else%>
<input name="DesignerName" type="text" id="DesignerName" value="<%=rs("DesignerName")%>" size="50" maxlength="30">
<%end if%></td>
</tr>
<tr class="tdbg">
<td width="40%"><strong>设计者Email:</strong></td>
<td><%if Action="Modify" and rs("DesignType")=0 then%>
<input name="DesignerEmail" type="hidden" id="DesignerEmail" value="<%=rs("DesignerEmail")%>">
<%=rs("DesignerEmail")%>
<%else%>
<input name="DesignerEmail" type="text" id="DesignerEmail" value="<%=rs("DesignerEmail")%>" size="50" maxlength="100">
<%end if%></td>
</tr>
<tr class="tdbg">
<td width="40%"><strong>设计者主页:</strong></td>
<td><%if Action="Modify" and rs("DesignType")=0 then%>
<input name="DesignerHomepage" type="hidden" id="DesignerHomepage" value="<%=rs("DesignerHomepage")%>">
<%=rs("DesignerHomepage")%>
<%else%>
<input name="DesignerHomepage" type="text" id="DesignerHomepage" value="<%=rs("DesignerHomepage")%>" size="50" maxlength="100">
<%end if%></td>
</tr>
<tr align="center" class="tdbg">
<td height="50" colspan="2"><input name="LayoutID" type="hidden" id="LayoutID" value="<%=LayoutID%>">
<%if Action="Add" then%> <input name="Action" type="hidden" id="Action" value="SaveAdd">
<input type="submit" name="Submit2" value=" 添 加 "> <%else%> <input name="Action" type="hidden" id="Action" value="SaveModify">
<input type="submit" name="Submit2" value=" 保存修改结果 "> <%end if%> </td>
</tr>
</table>
</form>
<%
rs.close
set rs=nothing
end sub
%>
</body>
</html>
<%
sub SaveAdd()
call CheckLayout()
if FoundErr=True then exit sub
sql="select top 1 * from Layout"
Set rs=Server.CreateObject("Adodb.RecordSet")
rs.Open sql,conn,1,3
rs.addnew
rs("IsDefault")=False
rs("DesignType")=1
call SaveLayout()
rs.close
set rs=nothing
call WriteSuccessMsg("成功添加新的版面设计模板:"& trim(request("LayoutName")))
end sub
sub SaveModify()
if LayoutID="" then
FoundErr=True
ErrMsg=ErrMsg & "<br><li>请指定LayoutID</li>"
else
LayoutID=Clng(LayoutID)
end if
call CheckLayout()
if FoundErr=True then exit sub
sql="select * from Layout where LayoutID=" & LayoutID
Set rs=Server.CreateObject("Adodb.RecordSet")
rs.Open sql,conn,1,3
if rs.bof and rs.eof then
FoundErr=True
ErrMsg=ErrMsg & "<br><li>找不到指定的版面设计模板!</li>"
else
call SaveLayout()
call WriteSuccessMsg("保存版面设计模板设置成功!")
end if
rs.close
set rs=nothing
end sub
sub SetDefault()
if LayoutID="" then
FoundErr=True
ErrMsg=ErrMsg & "<br><li>请指定LayoutID</li>"
exit sub
else
LayoutID=Clng(LayoutID)
end if
conn.execute("update Layout set IsDefault=False where IsDefault=True and LayoutType=" & LayoutType)
conn.execute("update Layout set IsDefault=True where LayoutID=" & LayoutID)
call WriteSuccessMsg("成功将选定的模板设置为默认模板")
end sub
sub CheckLayout()
if trim(request("LayoutName"))="" then
FoundErr=True
ErrMsg=ErrMsg & "<br><li>模板名称不能为空!</li>"
end if
if trim(request("LayoutFileName"))="" then
FoundErr=True
ErrMsg=ErrMsg & "<br><li>模板文件名不能为空!</li>"
end if
if trim(request("PicUrl"))="" then
FoundErr=True
ErrMsg=ErrMsg & "<br><li>模板预览图地址不能为空!</li>"
end if
if trim(request("DesignerName"))="" then
FoundErr=True
ErrMsg=ErrMsg & "<br><li>模板设计者姓名不能为空!</li>"
end if
if trim(request("DesignerEmail"))="" then
FoundErr=True
ErrMsg=ErrMsg & "<br><li>模板设计者邮箱不能为空!</li>"
end if
end sub
sub SaveLayout()
rs("LayoutType")=LayoutType
rs("LayoutName")=trim(request("LayoutName"))
rs("LayoutFileName")=trim(request("LayoutFileName"))
rs("PicUrl")=trim(request("PicUrl"))
rs("DesignerName")=trim(request("DesignerName"))
rs("DesignerEmail")=trim(request("DesignerEmail"))
rs("DesignerHomePage")=trim(request("DesignerHomepage"))
rs.update
end sub
sub DelLayout()
'********************新增加的代码********************
dim LayoutType
'********************新增代码结束********************
if LayoutID="" then
FoundErr=True
ErrMsg=ErrMsg & "<br><li>请指定LayoutID</li>"
exit sub
else
LayoutID=Clng(LayoutID)
end if
sql="select * from Layout where LayoutID=" & LayoutID
Set rs=Server.CreateObject("Adodb.RecordSet")
rs.Open sql,conn,1,3
if rs.bof and rs.eof then
FoundErr=True
ErrMsg=ErrMsg & "<br><li>找不到指定的版面设计模板!</li>"
else
if rs("DesignType")=0 then
FoundErr=True
ErrMsg=ErrMsg & "<br><li>不能删除系统自带的模板!</li>"
elseif rs("IsDefault")=True then
FoundErr=True
ErrMsg=ErrMsg & "<br><li>当前模板为默认模板,不能删除。请先将默认模板改为其他模板后再来删除此模板。</li>"
else
'********************新增加的代码********************
LayoutType=rs("LayoutType")
'********************新增代码结束********************
rs.delete
rs.update
dim trs
'********************原始代码屏蔽********************
' set trs=conn.execute("select LayoutID from Layout where IsDefault=True and LayoutType=" & rs("LayoutType"))
'********************新增加的代码********************
set trs=conn.execute("select LayoutID from Layout where IsDefault=True and LayoutType=" & LayoutType)
'********************新增代码结束********************
conn.execute("update ArticleClass set LayoutID=" & trs(0) & " where LayoutID=" & LayoutID)
conn.execute("update Article set LayoutID=" & trs(0) & " where LayoutID=" & LayoutID)
set trs=nothing
end if
end if
rs.close
set rs=nothing
if FoundErr=True then exit sub
call WriteSuccessMsg("成功删除选定的模板。并将使用此模板的栏目和文章改为使用默认模板。")
end sub
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -