зеркало из https://github.com/mono/moma-tool.git
APIReport.aspx, APIReport.aspx.cs: Implemented the API report view, filterable on issue type.
Overview.aspx: Cache the database results. Highlight important reports. ReportView.aspx, ReportView.aspx.cs: Cache database results. No need to look up some controls by name when they're in an UpdatePanel. Submissions.aspx, Submissions.aspx.cs: Cache database results. Enable filtering on report importance. svn path=/trunk/moma-tool/; revision=117384
This commit is contained in:
Родитель
df15e4237c
Коммит
2c371e8757
|
@ -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" %>
|
||||
|
||||
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content2" ContentPlaceHolderID="BodyContentPlaceHolder" Runat="Server">
|
||||
</asp:Content>
|
||||
|
||||
<asp:Content ID="BodyContent" ContentPlaceHolderID="BodyContentPlaceHolder" runat="Server">
|
||||
<asp:LoginView ID="LoginView1" runat="server">
|
||||
<AnonymousTemplate>
|
||||
This view is only available to logged-in users.
|
||||
</AnonymousTemplate>
|
||||
<LoggedInTemplate>
|
||||
<asp:UpdatePanel ID="ReportsGridUpdatePanel" runat="server">
|
||||
<ContentTemplate>
|
||||
<%-- Need something in the filter here so it will actually filter at all --%>
|
||||
<asp:SqlDataSource ID="IssuesSqlDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:MomaDB %>"
|
||||
ProviderName="<%$ ConnectionStrings:MomaDB.ProviderName %>"
|
||||
SelectCommand="SELECT c.apps, i.method_namespace, i.method_class, i.method_name, i.display_name, i.lookup_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, issue_type.lookup_name FROM issue, issue_type WHERE issue_type.id = issue.issue_type_id) AS i WHERE c.issue_id = i.id;"
|
||||
CacheDuration="300" EnableCaching="True" FilterExpression="lookup_name = 'TODO'"
|
||||
OnFiltering="IssuesSqlDataSource_Filtering">
|
||||
</asp:SqlDataSource>
|
||||
<asp:Label ID="IssueTypeFilterLabel" runat="server" Text="Show only:"></asp:Label>
|
||||
<asp:ListBox ID="IssueTypeFilterListBox" runat="server"
|
||||
SelectionMode="Multiple" Rows="4">
|
||||
<asp:ListItem>MISS</asp:ListItem>
|
||||
<asp:ListItem>NIEX</asp:ListItem>
|
||||
<asp:ListItem>PINV</asp:ListItem>
|
||||
<asp:ListItem>TODO</asp:ListItem>
|
||||
</asp:ListBox>
|
||||
<asp:Button ID="IssueTypeFilterButton" runat="server" Text="Update" OnClick="IssueTypeFilterButton_Click" />
|
||||
<asp:GridView ID="IssuesGridView" runat="server" AutoGenerateColumns="False" DataSourceID="IssuesSqlDataSource"
|
||||
AllowPaging="True" AllowSorting="True" PageSize="20">
|
||||
<Columns>
|
||||
<asp:BoundField DataField="Apps" HeaderText="Apps" SortExpression="apps" />
|
||||
<asp:BoundField DataField="method_namespace" HeaderText="Namespace" SortExpression="method_namespace" />
|
||||
<asp:BoundField DataField="method_class" HeaderText="Class" SortExpression="method_class" />
|
||||
<asp:BoundField DataField="method_name" HeaderText="Method" SortExpression="method_name" />
|
||||
<asp:BoundField DataField="display_name" HeaderText="Type" SortExpression="display_name" />
|
||||
</Columns>
|
||||
</asp:GridView>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
</LoggedInTemplate>
|
||||
</asp:LoginView>
|
||||
</asp:Content>
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
<br />
|
||||
<asp:SqlDataSource ID="Latest20SqlDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:MomaDB %>"
|
||||
ProviderName="<%$ ConnectionStrings:MomaDB.ProviderName %>"
|
||||
SelectCommand="SELECT rep.id, rep.report_date, rep.reporter_name, def.display_name, miss.miss, niex.niex, pinv.pinv, todo.todo, total.total FROM moma_definition def, report rep 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;">
|
||||
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">
|
||||
</asp:SqlDataSource>
|
||||
<asp:GridView ID="Latest20GridView" runat="server" AutoGenerateColumns="False"
|
||||
DataSourceID="Latest20SqlDataSource">
|
||||
|
@ -27,12 +27,17 @@
|
|||
<asp:BoundField DataField="pinv" HeaderText="PINV" />
|
||||
<asp:BoundField DataField="todo" HeaderText="TODO" />
|
||||
<asp:BoundField DataField="total" HeaderText="Total" />
|
||||
<asp:TemplateField ShowHeader="False">
|
||||
<ItemTemplate>
|
||||
<asp:Image ID="ImportanceImage" runat="server" ImageUrl="~/important.png" Visible='<%# Eval("importance").ToString() == "Important" %>' />
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
</Columns>
|
||||
</asp:GridView>
|
||||
<asp:Label ID="MostNeededLabel" runat="server" Text="Most needed API:"></asp:Label>
|
||||
<br />
|
||||
<asp:SqlDataSource ID="MostNeededSqlDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:MomaDB %>"
|
||||
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;">
|
||||
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">
|
||||
</asp:SqlDataSource>
|
||||
<asp:GridView ID="MostNeededGridView" runat="server" AutoGenerateColumns="False" DataSourceID="MostNeededSqlDataSource">
|
||||
<Columns>
|
||||
|
@ -44,7 +49,7 @@
|
|||
</Columns>
|
||||
</asp:GridView>
|
||||
<asp:SqlDataSource ID="IssuesPerAppSqlDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:MomaDB %>"
|
||||
ProviderName="<%$ ConnectionStrings:MomaDB.ProviderName %>" SelectCommand="SELECT COUNT(report_id) AS Count FROM issue_report GROUP BY report_id;">
|
||||
ProviderName="<%$ ConnectionStrings:MomaDB.ProviderName %>" SelectCommand="SELECT COUNT(report_id) AS Count FROM issue_report GROUP BY report_id;" EnableCaching="True" CacheDuration="300">
|
||||
</asp:SqlDataSource>
|
||||
<asp:Label ID="IssuesPerAppLabel" runat="server" Text="Issues per Application"></asp:Label>
|
||||
<br />
|
||||
|
|
|
@ -107,7 +107,7 @@
|
|||
<asp:UpdatePanel ID="IssuesUpdatePanel" runat="server" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
<asp:SqlDataSource ID="IssuesSqlDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:MomaDB %>"
|
||||
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;">
|
||||
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">
|
||||
<SelectParameters>
|
||||
<asp:QueryStringParameter DefaultValue="1" Name="id" QueryStringField="ReportID"
|
||||
Type="Int32" />
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,9 +8,21 @@
|
|||
<LoggedInTemplate>
|
||||
<asp:UpdatePanel ID="ReportsGridUpdatePanel" runat="server">
|
||||
<ContentTemplate>
|
||||
<%-- Need something in the filter here so it will actually filter at all --%>
|
||||
<asp:SqlDataSource ID="SubmissionsSqlDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:MomaDB %>"
|
||||
ProviderName="<%$ ConnectionStrings:MomaDB.ProviderName %>" SelectCommand="SELECT rep.id, rep.report_date, 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;">
|
||||
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">
|
||||
</asp:SqlDataSource>
|
||||
<asp:Label ID="ImportanceFilterLabel" runat="server" Text="Show only:"></asp:Label>
|
||||
<asp:ListBox ID="ImportanceFilterListBox" runat="server"
|
||||
SelectionMode="Multiple" Rows="3">
|
||||
<asp:ListItem>Important</asp:ListItem>
|
||||
<asp:ListItem>Useful</asp:ListItem>
|
||||
<asp:ListItem>Not useful</asp:ListItem>
|
||||
</asp:ListBox>
|
||||
<asp:Button ID="ImportanceFilterButton" runat="server" Text="Update" onclick="ImportanceFilterButton_Click" />
|
||||
<asp:GridView ID="ReportsGridView" runat="server" DataSourceID="SubmissionsSqlDataSource"
|
||||
AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False">
|
||||
<Columns>
|
||||
|
@ -18,6 +30,8 @@
|
|||
HeaderText="ID" Text="View" SortExpression="id" />
|
||||
<asp:BoundField DataField="report_date" HeaderText="Date"
|
||||
SortExpression="report_date" />
|
||||
<asp:BoundField DataField="importance" HeaderText="Importance"
|
||||
SortExpression="importance" />
|
||||
<asp:BoundField DataField="application_name" HeaderText="Application Name"
|
||||
SortExpression="application_name" />
|
||||
<asp:BoundField DataField="application_type" HeaderText="Application Type"
|
||||
|
|
|
@ -17,4 +17,33 @@ public partial class Submissions : System.Web.UI.Page
|
|||
{
|
||||
|
||||
}
|
||||
protected void SubmissionsSqlDataSource_Filtering(object sender, SqlDataSourceFilteringEventArgs e)
|
||||
{
|
||||
if (Page.User.Identity.IsAuthenticated)
|
||||
{
|
||||
string filter = string.Empty;
|
||||
|
||||
foreach (ListItem item in ImportanceFilterListBox.Items)
|
||||
{
|
||||
if (item.Selected)
|
||||
{
|
||||
if (filter != string.Empty)
|
||||
{
|
||||
filter += " OR ";
|
||||
}
|
||||
filter += "importance='" + item.Value + "'";
|
||||
}
|
||||
}
|
||||
|
||||
// If nothing selected, the empty string will filter nothing
|
||||
SubmissionsSqlDataSource.FilterExpression = filter;
|
||||
}
|
||||
}
|
||||
protected void ImportanceFilterButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (Page.User.Identity.IsAuthenticated)
|
||||
{
|
||||
ReportsGridView.DataBind();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 531 B |
Загрузка…
Ссылка в новой задаче