/////////////////////////////////////////////////////////////////////// protected void Page_Load(Object sender, EventArgs e) { Util.do_not_cache(Response); if (Request.QueryString["ses"] != (string)Session["session_cookie"]) { Response.Write("session in URL doesn't match session cookie"); Response.End(); } string string_bugid = Util.sanitize_integer(Request["bugid"]); int bugid = Convert.ToInt32(string_bugid); int permission_level = Bug.get_bug_permission_level(bugid, User.Identity); if (permission_level != PermissionLevel.All) { Response.Write("You are not allowed to edit this item"); Response.End(); } string string_tsk_id = Util.sanitize_integer(Request["id"]); int tsk_id = Convert.ToInt32(string_tsk_id); if (IsPostBack) { // do delete here sql = new SQLString(@"delete bug_tasks where tsk_id = @tsk_id and tsk_bug = @bugid"); sql = sql.AddParameterWithValue("tsk_id", string_tsk_id); sql = sql.AddParameterWithValue("bugid", string_bugid); DbUtil.execute_nonquery(sql); Response.Redirect("tasks.aspx?bugid=" + string_bugid); } else { Page.Title = Util.get_setting("AppTitle", "BugTracker.NET") + " - " + "delete task"; back_href.HRef = "tasks.aspx?bugid=" + string_bugid; sql = new SQLString(@"select tsk_description from bug_tasks where tsk_id = @tsk_id and tsk_bug = @bugid"); sql = sql.AddParameterWithValue("tsk_id", string_tsk_id); sql = sql.AddParameterWithValue("bugid", string_bugid); DataRow dr = DbUtil.get_datarow(sql); confirm_href.InnerText = "confirm delete of task: " + Convert.ToString(dr["tsk_description"]); } }
/////////////////////////////////////////////////////////////////////// protected void Page_Load(Object sender, EventArgs e) { Util.do_not_cache(Response); if (User.IsInRole(BtnetRoles.Admin) || User.Identity.GetCanDeleteBugs()) { // } else { Response.Write("You are not allowed to use this page."); Response.End(); } string id = Util.sanitize_integer(Request["id"]); int permission_level = Bug.get_bug_permission_level(Convert.ToInt32(id), User.Identity); if (permission_level != PermissionLevel.All) { Response.Write("You are not allowed to edit this item"); Response.End(); } if (IsPostBack) { Bug.delete_bug(Convert.ToInt32(row_id.Value)); Server.Transfer("bugs.aspx"); } else { Page.Header.Title = Util.get_setting("AppTitle", "BugTracker.NET") + " - " + "delete " + Util.get_setting("SingularBugLabel", "bug"); back_href.HRef = "edit_bug.aspx?id=" + id; sql = new SQLString(@"select bg_short_desc from bugs where bg_id = @bugId"); sql = sql.AddParameterWithValue("bugId", id); DataRow dr = DbUtil.get_datarow(sql); confirm_href.InnerText = "confirm delete of " + Util.get_setting("SingularBugLabel", "bug") + ": " + Convert.ToString(dr["bg_short_desc"]); row_id.Value = id; } }
/////////////////////////////////////////////////////////////////////// protected void Page_Load(Object sender, EventArgs e) { Util.do_not_cache(Response); Page.Header.Title = Util.get_setting("AppTitle", "BugTracker.NET") + " - " + "add attachment"; string string_id = Util.sanitize_integer(Request.QueryString["id"]); if (string_id == null || string_id == "0") { write_msg("Invalid id.", false); Response.End(); return; } else { bugid = Convert.ToInt32(string_id); int permission_level = Bug.get_bug_permission_level(bugid, User.Identity); if (permission_level == PermissionLevel.None || permission_level == PermissionLevel.ReadOnly) { write_msg("You are not allowed to edit this item", false); Response.End(); return; } } if (User.Identity.GetIsExternalUser() || Util.get_setting("EnableInternalOnlyPosts", "0") == "0") { internal_only.Visible = false; internal_only_label.Visible = false; } if (IsPostBack) { on_update(); } }
/////////////////////////////////////////////////////////////////////// protected void Page_Load(Object sender, EventArgs e) { Util.do_not_cache(Response); msg.InnerText = ""; string string_bugid = Util.sanitize_integer(Request["bugid"]); bugid = Convert.ToInt32(string_bugid); int permission_level = Bug.get_bug_permission_level(bugid, User.Identity); if (permission_level != PermissionLevel.All) { Response.Write("You are not allowed to edit tasks for this item"); Response.End(); } if (User.IsInRole(BtnetRoles.Admin) || User.Identity.GetCanEditTasks()) { // allowed } else { Response.Write("You are not allowed to edit tasks"); Response.End(); } string string_tsk_id = Util.sanitize_integer(Request["id"]); tsk_id_static.InnerHtml = string_tsk_id; tsk_id = Convert.ToInt32(string_tsk_id); if (!IsPostBack) { Master.Menu.SelectedItem = "admin"; Page.Title = Util.get_setting("AppTitle", "BugTracker.NET") + " - " + "edit task"; bugid_label.InnerHtml = Util.capitalize_first_letter(Util.get_setting("SingularBugLabel", "bug")) + " ID:"; bugid_static.InnerHtml = Convert.ToString(bugid); load_users_dropdowns(bugid); if (Util.get_setting("ShowTaskAssignedTo", "1") == "0") { assigned_to_tr.Visible = false; } if (Util.get_setting("ShowTaskPlannedStartDate", "1") == "0") { planned_start_date_tr.Visible = false; } if (Util.get_setting("ShowTaskActualStartDate", "1") == "0") { actual_start_date_tr.Visible = false; } if (Util.get_setting("ShowTaskPlannedEndDate", "1") == "0") { planned_end_date_tr.Visible = false; } if (Util.get_setting("ShowTaskActualEndDate", "1") == "0") { actual_end_date_tr.Visible = false; } if (Util.get_setting("ShowTaskPlannedDuration", "1") == "0") { planned_duration_tr.Visible = false; } if (Util.get_setting("ShowTaskActualDuration", "1") == "0") { actual_duration_tr.Visible = false; } if (Util.get_setting("ShowTaskDurationUnits", "1") == "0") { duration_units_tr.Visible = false; } if (Util.get_setting("ShowTaskPercentComplete", "1") == "0") { percent_complete_tr.Visible = false; } if (Util.get_setting("ShowTaskStatus", "1") == "0") { status_tr.Visible = false; } if (Util.get_setting("ShowTaskSortSequence", "1") == "0") { sort_sequence_tr.Visible = false; } // add or edit? if (tsk_id == 0) { tsk_id_tr.Visible = false; sub.Value = "Create"; string default_duration_units = Util.get_setting("TaskDefaultDurationUnits", "hours"); duration_units.Items.FindByText(default_duration_units).Selected = true; string default_hour = Util.get_setting("TaskDefaultHour", "09"); planned_start_hour.Items.FindByText(default_hour).Selected = true; actual_start_hour.Items.FindByText(default_hour).Selected = true; planned_end_hour.Items.FindByText(default_hour).Selected = true; actual_end_hour.Items.FindByText(default_hour).Selected = true; string default_status = Util.get_setting("TaskDefaultStatus", "[no status]"); status.Items.FindByText(default_status).Selected = true; } else { // Get this entry's data from the db and fill in the form sql = new SQLString(@"select * from bug_tasks where tsk_id = @tsk_id and tsk_bug = @bugid"); sql = sql.AddParameterWithValue("tsk_id", Convert.ToString(tsk_id)); sql = sql.AddParameterWithValue("bugid", Convert.ToString(bugid)); DataRow dr = DbUtil.get_datarow(sql); assigned_to.Items.FindByValue(Convert.ToString(dr["tsk_assigned_to_user"])).Selected = true; duration_units.Items.FindByText(Convert.ToString(dr["tsk_duration_units"])).Selected = true; status.Items.FindByValue(Convert.ToString(dr["tsk_status"])).Selected = true; planned_duration.Value = Util.format_db_value(dr["tsk_planned_duration"]); actual_duration.Value = Util.format_db_value(dr["tsk_actual_duration"]); percent_complete.Value = Convert.ToString(dr["tsk_percent_complete"]); sort_sequence.Value = Convert.ToString(dr["tsk_sort_sequence"]); desc.Value = Convert.ToString(dr["tsk_description"]); load_date_hour_min( planned_start_date, planned_start_hour, planned_start_min, dr["tsk_planned_start_date"]); load_date_hour_min( actual_start_date, actual_start_hour, actual_start_min, dr["tsk_actual_start_date"]); load_date_hour_min( planned_end_date, planned_end_hour, planned_end_min, dr["tsk_planned_end_date"]); load_date_hour_min( actual_end_date, actual_end_hour, actual_end_min, dr["tsk_actual_end_date"]); sub.Value = "Update"; } } else { on_update(); } }
/////////////////////////////////////////////////////////////////////// protected void Page_Load(Object sender, EventArgs e) { Master.Menu.SelectedItem = Util.get_setting("PluralBugLabel", "bugs"); Util.do_not_cache(Response); if (User.IsInRole(BtnetRoles.Admin) || User.Identity.GetCanEditAndDeletePosts()) { // } else { Response.Write("You are not allowed to use this page."); Response.End(); } if (IsPostBack) { // do delete here sql = new SQLString(@"delete bug_posts where bp_id = @bpid"); sql = sql.AddParameterWithValue("bpid", Util.sanitize_integer(row_id.Value)); DbUtil.execute_nonquery(sql); Response.Redirect("edit_bug.aspx?id=" + Util.sanitize_integer(redirect_bugid.Value)); } else { string bug_id = Util.sanitize_integer(Request["bug_id"]); redirect_bugid.Value = bug_id; int permission_level = Bug.get_bug_permission_level(Convert.ToInt32(bug_id), User.Identity); if (permission_level != PermissionLevel.All) { Response.Write("You are not allowed to edit this item"); Response.End(); } Page.Header.Title = Util.get_setting("AppTitle", "BugTracker.NET") + " - " + "delete comment"; string id = Util.sanitize_integer(Request["id"]); back_href.HRef = "edit_bug.aspx?id=" + bug_id; sql = new SQLString(@"select bp_comment from bug_posts where bp_id = @bpid"); sql = sql.AddParameterWithValue("bpid", id); DataRow dr = DbUtil.get_datarow(sql); // show the first few chars of the comment string s = Convert.ToString(dr["bp_comment"]); int len = 20; if (s.Length < len) { len = s.Length; } confirm_href.InnerText = "confirm delete of comment: " + s.Substring(0, len) + "..."; row_id.Value = id; } }
/////////////////////////////////////////////////////////////////////// protected void Page_Load(Object sender, EventArgs e) { Master.Menu.SelectedItem = Util.get_setting("PluralBugLabel", "bugs"); Util.do_not_cache(Response); if (User.IsInRole(BtnetRoles.Admin) || User.Identity.GetCanEditAndDeletePosts()) { // } else { Response.Write("You are not allowed to use this page."); Response.End(); } Page.Title = Util.get_setting("AppTitle", "BugTracker.NET") + " - " + "edit comment"; msg.InnerText = ""; id = Convert.ToInt32(Request["id"]); if (!IsPostBack) { sql = new SQLString(@"select bp_comment, bp_type, isnull(bp_comment_search,bp_comment) bp_comment_search, isnull(bp_content_type,'') bp_content_type, bp_bug, bp_hidden_from_external_users from bug_posts where bp_id = @id"); } else { sql = new SQLString(@"select bp_bug, bp_type, isnull(bp_content_type,'') bp_content_type, bp_hidden_from_external_users from bug_posts where bp_id = @id"); } sql = sql.AddParameterWithValue("id", Convert.ToString(id)); DataRow dr = DbUtil.get_datarow(sql); bugid = (int)dr["bp_bug"]; int permission_level = Bug.get_bug_permission_level(bugid, User.Identity); if (permission_level == PermissionLevel.None || permission_level == PermissionLevel.ReadOnly || (string)dr["bp_type"] != "comment") { Response.Write("You are not allowed to edit this item"); Response.End(); } string content_type = (string)dr["bp_content_type"]; if (User.Identity.GetUseFCKEditor() && content_type == "text/html" && Util.get_setting("DisableFCKEditor", "0") == "0") { use_fckeditor = true; } else { use_fckeditor = false; } if (User.Identity.GetIsExternalUser() || Util.get_setting("EnableInternalOnlyPosts", "0") == "0") { internal_only.Visible = false; internal_only_label.Visible = false; } if (!IsPostBack) { internal_only.Checked = Convert.ToBoolean((int)dr["bp_hidden_from_external_users"]); if (use_fckeditor) { comment.Value = (string)dr["bp_comment"]; } else { comment.Value = (string)dr["bp_comment_search"]; } } else { on_update(); } }
/////////////////////////////////////////////////////////////////////// protected void Page_Load(Object sender, EventArgs e) { Util.do_not_cache(Response); this.Master.Menu.SelectedItem = Util.get_setting("PluralBugLabel", "bugs"); if (User.IsInRole(BtnetRoles.Admin) || User.Identity.GetCanEditAndDeleteBugs()) { // } else { Response.Write("You are not allowed to use this page."); Response.End(); } string attachment_id_string = Util.sanitize_integer(Request["id"]); string bug_id_string = Util.sanitize_integer(Request["bug_id"]); int permission_level = Bug.get_bug_permission_level(Convert.ToInt32(bug_id_string), User.Identity); if (permission_level != PermissionLevel.All) { Response.Write("You are not allowed to edit this item"); Response.End(); } if (IsPostBack) { // save the filename before deleting the row sql = new SQLString(@"select bp_file from bug_posts where bp_id = @ba"); sql = sql.AddParameterWithValue("ba", attachment_id_string); string filename = (string)DbUtil.execute_scalar(sql); // delete the row representing the attachment sql = new SQLString(@"delete bug_post_attachments where bpa_post = @ba delete bug_posts where bp_id = @ba"); sql = sql.AddParameterWithValue("ba", attachment_id_string); DbUtil.execute_nonquery(sql); // delete the file too string upload_folder = Util.get_upload_folder(); if (upload_folder != null) { StringBuilder path = new StringBuilder(upload_folder); path.Append("\\"); path.Append(bug_id_string); path.Append("_"); path.Append(attachment_id_string); path.Append("_"); path.Append(filename); if (System.IO.File.Exists(path.ToString())) { System.IO.File.Delete(path.ToString()); } } Response.Redirect("edit_bug.aspx?id=" + bug_id_string); } else { Page.Header.Title = Util.get_setting("AppTitle", "BugTracker.NET") + " - " + "delete attachment"; back_href.HRef = "edit_bug.aspx?id=" + bug_id_string; sql = new SQLString(@"select bp_file from bug_posts where bp_id = @id"); sql = sql.AddParameterWithValue("id", attachment_id_string); DataRow dr = DbUtil.get_datarow(sql); string s = Convert.ToString(dr["bp_file"]); confirm_href.InnerText = "confirm delete of attachment: " + s; row_id.Value = attachment_id_string; } }