?? delete_comment.aspx
字號:
<%@ Page language="C#"%>
<!--
Copyright 2002-2005 Corey Trager
Distributed under the terms of the GNU General Public License
-->
<!-- #include file = "inc.aspx" -->
<script language="C#" runat="server">
String sql;
DbUtil dbutil;
Security security;
///////////////////////////////////////////////////////////////////////
void Page_Load(Object sender, EventArgs e)
{
Util.do_not_cache(Response);
dbutil = new DbUtil();
security = new Security();
if (Util.get_setting("AllowCommentDeletionForNonAdmins","1") == "1")
{
security.check_security(dbutil, Request, Response, Security.ANY_USER_OK_EXCEPT_GUEST);
}
else
{
security.check_security(dbutil, Request, Response, Security.MUST_BE_ADMIN);
}
title.InnerText = Util.get_setting("AppTitle","BugTracker.NET") + " - "
+ "delete comment";
string id = Util.sanitize_integer(Request["id"]);
string bug_id = Util.sanitize_integer(Request["bug_id"]);
string confirm = Request.QueryString["confirm"];
if (confirm == "y")
{
// do delete here
sql = @"delete bug_comments where bc_id = $1";
sql = sql.Replace("$1", id);
dbutil.execute_nonquery(sql);
Response.Redirect ("edit_bug.aspx?id=" + bug_id);
}
else
{
back_href.HRef = "edit_bug.aspx?id=" + bug_id;
confirm_href.HRef = "delete_comment.aspx?confirm=y&id=" + id + "&bug_id=" + bug_id;
sql = @"select bc_comment from bug_comments where bc_id = $1";
sql = sql.Replace("$1", id);
DataRow dr = dbutil.get_datarow(sql);
// show the first few chars of the comment
string s = Convert.ToString(dr["bc_comment"]);
int len = 20;
if (s.Length < len) {len = s.Length;}
confirm_href.InnerText = "confirm delete of comment: "
+ s.Substring(0,len)
+ "...";
}
}
void Page_Unload(Object sender, EventArgs e)
{
if (dbutil != null) {dbutil.close();}
}
</script>
<html>
<head>
<title id="title" runat="server">btnet edit attachment</title>
<link rel="StyleSheet" href="btnet.css" type="text/css">
</head>
<body>
<% security.write_menu(Response, Util.get_setting("PluralBugLabel","bugs")); %>
<p>
<div class=align>
<p> </p>
<a id="back_href" runat="server" href="">back to <% Response.Write(Util.get_setting("SingularBugLabel","bug")); %></a>
<p>
or
<p>
<a id="confirm_href" runat="server" href="">confirm delete</a>
</div>
</body>
</html>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -