diff --git a/web_service/APIReport.aspx b/web_service/APIReport.aspx index 6ddefa7..29c5678 100644 --- a/web_service/APIReport.aspx +++ b/web_service/APIReport.aspx @@ -1,7 +1,42 @@ -<%@ Page Language="C#" MasterPageFile="~/MoMA.master" AutoEventWireup="true" CodeFile="APIReport.aspx.cs" Inherits="APIReport" Title="Untitled Page" %> +<%@ Page Language="C#" MasterPageFile="~/MoMA.master" AutoEventWireup="true" CodeFile="APIReport.aspx.cs" Inherits="APIReport" Title="MoMA Studio - API Report" %> - - - - + + + + This view is only available to logged-in users. + + + + + <%-- Need something in the filter here so it will actually filter at all --%> + + + + + MISS + NIEX + PINV + TODO + + + + + + + + + + + + + + + + diff --git a/web_service/APIReport.aspx.cs b/web_service/APIReport.aspx.cs index a6ab214..a7a34a4 100644 --- a/web_service/APIReport.aspx.cs +++ b/web_service/APIReport.aspx.cs @@ -17,4 +17,33 @@ public partial class APIReport : System.Web.UI.Page { } + protected void IssuesSqlDataSource_Filtering(object sender, SqlDataSourceFilteringEventArgs e) + { + if (Page.User.Identity.IsAuthenticated) + { + string filter = string.Empty; + + foreach (ListItem item in IssueTypeFilterListBox.Items) + { + if (item.Selected) + { + if (filter != string.Empty) + { + filter += " OR "; + } + filter += "lookup_name='" + item.Value + "'"; + } + } + + // If nothing selected, the empty string will filter nothing + IssuesSqlDataSource.FilterExpression = filter; + } + } + protected void IssueTypeFilterButton_Click(object sender, EventArgs e) + { + if (Page.User.Identity.IsAuthenticated) + { + IssuesGridView.DataBind(); + } + } } diff --git a/web_service/Overview.aspx b/web_service/Overview.aspx index eb08896..46d965a 100644 --- a/web_service/Overview.aspx +++ b/web_service/Overview.aspx @@ -11,7 +11,7 @@
+ SelectCommand="SELECT rep.id, rep.report_date, rep.reporter_name, def.display_name, meta.importance, miss.miss, niex.niex, pinv.pinv, todo.todo, total.total FROM moma_definition def, report rep LEFT JOIN report_metadata meta ON rep.id = meta.report_id LEFT JOIN (SELECT issue_report.report_id, COUNT(issue_report.report_id) AS miss FROM issue_report, issue, issue_type WHERE issue.issue_type_id = issue_type.id AND issue_type.lookup_name = 'MISS' AND issue_report.issue_id = issue.id GROUP BY report_id) AS miss ON rep.id = miss.report_id LEFT JOIN (SELECT issue_report.report_id, COUNT(issue_report.report_id) AS niex FROM issue_report, issue, issue_type WHERE issue.issue_type_id = issue_type.id AND issue_type.lookup_name = 'NIEX' AND issue_report.issue_id = issue.id GROUP BY report_id) AS niex ON rep.id = niex.report_id LEFT JOIN (SELECT issue_report.report_id, COUNT(issue_report.report_id) AS pinv FROM issue_report, issue, issue_type WHERE issue.issue_type_id = issue_type.id AND issue_type.lookup_name = 'PINV' AND issue_report.issue_id = issue.id GROUP BY report_id) AS pinv ON rep.id = pinv.report_id LEFT JOIN (SELECT issue_report.report_id, COUNT(issue_report.report_id) AS todo FROM issue_report, issue, issue_type WHERE issue.issue_type_id = issue_type.id AND issue_type.lookup_name = 'TODO' AND issue_report.issue_id = issue.id GROUP BY report_id) AS todo ON rep.id = todo.report_id LEFT JOIN (SELECT issue_report.report_id, COUNT(issue_report.report_id) AS total FROM issue_report GROUP BY report_id) AS total ON rep.id = total.report_id WHERE rep.moma_definition_id = def.id ORDER BY rep.report_date DESC LIMIT 20;" EnableCaching="True" CacheDuration="300"> @@ -27,12 +27,17 @@ + + + + +
+ ProviderName="<%$ ConnectionStrings:MomaDB.ProviderName %>" SelectCommand="SELECT c.apps, i.method_namespace, i.method_class, i.method_name, i.display_name FROM (SELECT COUNT(DISTINCT(report_id)) AS Apps, issue_id FROM issue_report GROUP BY issue_id) as c, (SELECT issue.id, issue.method_namespace, issue.method_class, issue.method_name, issue_type.display_name FROM issue, issue_type WHERE issue_type.id = issue.issue_type_id) AS i WHERE c.issue_id = i.id ORDER BY Apps DESC LIMIT 20;" EnableCaching="True" CacheDuration="300"> @@ -44,7 +49,7 @@ + ProviderName="<%$ ConnectionStrings:MomaDB.ProviderName %>" SelectCommand="SELECT COUNT(report_id) AS Count FROM issue_report GROUP BY report_id;" EnableCaching="True" CacheDuration="300">
diff --git a/web_service/ReportView.aspx b/web_service/ReportView.aspx index dd14016..e57cb53 100644 --- a/web_service/ReportView.aspx +++ b/web_service/ReportView.aspx @@ -107,7 +107,7 @@ + ProviderName="<%$ ConnectionStrings:MomaDB.ProviderName %>" SelectCommand="SELECT type.lookup_name, iss.method_namespace, iss.method_class, iss.method_name FROM issue_type type, issue iss, issue_report rep WHERE rep.report_id = @id AND rep.issue_id = iss.id AND iss.issue_type_id = type.id;" EnableCaching="True" CacheDuration="300"> diff --git a/web_service/ReportView.aspx.cs b/web_service/ReportView.aspx.cs index 71c1945..e61a7b5 100644 --- a/web_service/ReportView.aspx.cs +++ b/web_service/ReportView.aspx.cs @@ -31,17 +31,16 @@ public partial class ReportView : System.Web.UI.Page { /* Need to create this metadata entry */ int id = this.GetID(); - ds.InsertParameters["id"].DefaultValue = id.ToString(); - ds.Insert(); + MetadataSqlDataSource.InsertParameters["id"].DefaultValue = id.ToString(); + MetadataSqlDataSource.Insert(); } if (!Page.IsPostBack) { // Make the default text go away when the user clicks in the Comments box // (but ensure that it won't blow away a half-entered comment!) - TextBox new_comment_textbox = (TextBox)LoginView1.FindControl("NewComment"); - new_comment_textbox.Text = "Type your comment here..."; - new_comment_textbox.Attributes.Add("onFocus", "if (this.value == 'Type your comment here...') this.value='';"); + NewComment.Text = "Type your comment here..."; + NewComment.Attributes.Add("onFocus", "if (this.value == 'Type your comment here...') this.value='';"); this.UpdateComments(); } @@ -52,19 +51,17 @@ public partial class ReportView : System.Web.UI.Page { if (Page.User.Identity.IsAuthenticated) { - SqlDataSource ds = (SqlDataSource)LoginView1.FindControl("CommentsSqlDataSource"); - DataView comments_data = (DataView)ds.Select(DataSourceSelectArguments.Empty); - TextBox comments_textbox = (TextBox)LoginView1.FindControl("Comments"); - comments_textbox.Text = ""; + DataView comments_data = (DataView)CommentsSqlDataSource.Select(DataSourceSelectArguments.Empty); + Comments.Text = ""; for (int i = 0; i < comments_data.Count; i++) { - comments_textbox.Text += comments_data[i]["comment"]; - comments_textbox.Text += "\n"; - comments_textbox.Text += comments_data[i]["commenter"]; - comments_textbox.Text += " @ "; - comments_textbox.Text += comments_data[i]["comment_date"]; - comments_textbox.Text += "\n\n\n"; + Comments.Text += comments_data[i]["comment"]; + Comments.Text += "\n"; + Comments.Text += comments_data[i]["commenter"]; + Comments.Text += " @ "; + Comments.Text += comments_data[i]["comment_date"]; + Comments.Text += "\n\n\n"; } } @@ -93,19 +90,16 @@ public partial class ReportView : System.Web.UI.Page if (Page.User.Identity.IsAuthenticated) { int id = this.GetID(); - CheckBox send_comment_checkbox = (CheckBox)LoginView1.FindControl("SendCommentCheckBox"); - TextBox newcomment_textbox = (TextBox)LoginView1.FindControl("NewComment"); Label email_content_label = (Label)LoginView1.FindControl("EmailContent"); - SqlDataSource ds = (SqlDataSource)LoginView1.FindControl("CommentsSqlDataSource"); - ds.InsertParameters["id"].DefaultValue = id.ToString(); - ds.InsertParameters["comment"].DefaultValue = newcomment_textbox.Text; - ds.InsertParameters["commenter"].DefaultValue = Page.User.Identity.Name; - ds.InsertParameters["comment_date"].DefaultValue = DateTime.Now.ToString("o"); // ISO format - ds.InsertParameters["emailed"].DefaultValue = send_comment_checkbox.Checked.ToString(); - ds.Insert(); + CommentsSqlDataSource.InsertParameters["id"].DefaultValue = id.ToString(); + CommentsSqlDataSource.InsertParameters["comment"].DefaultValue = NewComment.Text; + CommentsSqlDataSource.InsertParameters["commenter"].DefaultValue = Page.User.Identity.Name; + CommentsSqlDataSource.InsertParameters["comment_date"].DefaultValue = DateTime.Now.ToString("o"); // ISO format + CommentsSqlDataSource.InsertParameters["emailed"].DefaultValue = SendCommentCheckBox.Checked.ToString(); + CommentsSqlDataSource.Insert(); - if (send_comment_checkbox.Checked) + if (SendCommentCheckBox.Checked) { /* Email the comment (we know the address is available, as the checkbox can't be * checked otherwise) @@ -113,7 +107,7 @@ public partial class ReportView : System.Web.UI.Page StringBuilder email_text = new StringBuilder(); email_text.AppendFormat("{0} added a comment to your MoMA report:\n\n", Page.User.Identity.Name); - email_text.AppendFormat("{0}", newcomment_textbox.Text); + email_text.AppendFormat("{0}", NewComment.Text); email_text.AppendFormat("\n\nSee {0} for this report.\n", Page.Request.Url.ToString()); string from_addr = Membership.GetUser().Email; @@ -149,7 +143,7 @@ public partial class ReportView : System.Web.UI.Page * this report simultaneously */ this.UpdateComments(); - newcomment_textbox.Text = ""; + NewComment.Text = ""; } } @@ -163,11 +157,9 @@ public partial class ReportView : System.Web.UI.Page if (!email_content_label.Text.Contains("@")) { - CheckBox send_comment_checkbox = (CheckBox)LoginView1.FindControl("SendCommentCheckBox"); - /* Hide the email checkbox, as we can't email the submitter anyway... */ - send_comment_checkbox.Visible = false; - send_comment_checkbox.Checked = false; + SendCommentCheckBox.Visible = false; + SendCommentCheckBox.Checked = false; } } } diff --git a/web_service/Submissions.aspx b/web_service/Submissions.aspx index d1b15af..2ffce40 100644 --- a/web_service/Submissions.aspx +++ b/web_service/Submissions.aspx @@ -8,9 +8,21 @@ + <%-- Need something in the filter here so it will actually filter at all --%> + ProviderName="<%$ ConnectionStrings:MomaDB.ProviderName %>" + SelectCommand="SELECT rep.id, rep.report_date, meta.importance, meta.application_name, meta.application_type, rep.reporter_name, rep.reporter_organization, def.display_name, miss.miss, niex.niex, pinv.pinv, todo.todo, total.total FROM moma_definition def, report rep LEFT JOIN report_metadata meta ON rep.id = meta.report_id LEFT JOIN (SELECT issue_report.report_id, COUNT(issue_report.report_id) AS miss FROM issue_report, issue, issue_type WHERE issue.issue_type_id = issue_type.id AND issue_type.lookup_name = 'MISS' AND issue_report.issue_id = issue.id GROUP BY report_id) AS miss ON rep.id = miss.report_id LEFT JOIN (SELECT issue_report.report_id, COUNT(issue_report.report_id) AS niex FROM issue_report, issue, issue_type WHERE issue.issue_type_id = issue_type.id AND issue_type.lookup_name = 'NIEX' AND issue_report.issue_id = issue.id GROUP BY report_id) AS niex ON rep.id = niex.report_id LEFT JOIN (SELECT issue_report.report_id, COUNT(issue_report.report_id) AS pinv FROM issue_report, issue, issue_type WHERE issue.issue_type_id = issue_type.id AND issue_type.lookup_name = 'PINV' AND issue_report.issue_id = issue.id GROUP BY report_id) AS pinv ON rep.id = pinv.report_id LEFT JOIN (SELECT issue_report.report_id, COUNT(issue_report.report_id) AS todo FROM issue_report, issue, issue_type WHERE issue.issue_type_id = issue_type.id AND issue_type.lookup_name = 'TODO' AND issue_report.issue_id = issue.id GROUP BY report_id) AS todo ON rep.id = todo.report_id LEFT JOIN (SELECT report_id, COUNT(report_id) AS total FROM issue_report GROUP BY report_id) AS total ON rep.id = total.report_id WHERE rep.moma_definition_id = def.id;" + EnableCaching="True" CacheDuration="300" FilterExpression="importance = 'Important'" + onfiltering="SubmissionsSqlDataSource_Filtering"> + + + Important + Useful + Not useful + + @@ -18,6 +30,8 @@ HeaderText="ID" Text="View" SortExpression="id" /> +