1 | <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>
|
---|
2 | <%@ Import Namespace="HLWebOKBQueryPlugin.Models" %>
|
---|
3 | <%@ Import Namespace="HLWebOKBQueryPlugin.OKBQueryService" %>
|
---|
4 | <!-- Put all into a form that calls the "AddFilter" Action-->
|
---|
5 | <div><table>
|
---|
6 | <tr><td>A<br />N<br />D</td><td>
|
---|
7 | <p>
|
---|
8 | <%
|
---|
9 | CombinedFilter currentFilter = ((FilterModel)Model).Content;
|
---|
10 | %>
|
---|
11 | <% using (Html.BeginForm("AddFilterAnd", "Filter", FormMethod.Post, new { id = currentFilter.Id, name = currentFilter.Id })) %>
|
---|
12 | <% { %>
|
---|
13 | <%
|
---|
14 |
|
---|
15 | string comboboxName = FilterModel.ComboboxName + "." + currentFilter.Id;
|
---|
16 | string hiddenName = FilterModel.ParentIdName + "." + currentFilter.Id;
|
---|
17 | %>
|
---|
18 |
|
---|
19 | <%: Html.Hidden(hiddenName,currentFilter.Id.ToString()) %>
|
---|
20 | <%: Html.DropDownList(comboboxName, new SelectList(((FilterModel)Model).AvailableFilterForCombobox, "FilterTypeName", "Label"))%>
|
---|
21 | <input type="submit" value="+" />
|
---|
22 | </p>
|
---|
23 | <!-- Build the selected filters. The filtesr will be stored in the session and the
|
---|
24 | Controller puts the current filters from the session into the model. Selected Filters
|
---|
25 | will be iterated. -->
|
---|
26 | <% if (currentFilter.Filters != null)
|
---|
27 | {
|
---|
28 |
|
---|
29 | foreach (Filter f in currentFilter.Filters)
|
---|
30 | {
|
---|
31 | if (f != null)
|
---|
32 | { %>
|
---|
33 |
|
---|
34 | <table border="0"><tr><td>
|
---|
35 | <%
|
---|
36 |
|
---|
37 |
|
---|
38 | if ("StringComparisonFilter".Equals(f.GetType().Name))
|
---|
39 | { %>
|
---|
40 | <% StringComparisonFilter filter = ((StringComparisonFilter)f); %>
|
---|
41 | <%: Html.Label(filter.Label)%>
|
---|
42 | <%: Html.DropDownList(f.Id + "." + FilterModel.ComparisonDropDownList, new SelectList(FilterModel.StringComparisons,"Value","Text", filter.Comparison))%>
|
---|
43 | <%: Html.TextBox(f.Id + "." + FilterModel.ValueTextbox, (filter.Value))%>
|
---|
44 | <% }
|
---|
45 | else if ("NameStringComparisonFilter".Equals(f.GetType().Name))
|
---|
46 | { %>
|
---|
47 | <% NameStringComparisonFilter filter = ((NameStringComparisonFilter)f); %>
|
---|
48 | <%: Html.Label(filter.Label)%>
|
---|
49 | <%: Html.Label("=")%>
|
---|
50 | <%: Html.TextBox(f.Id + "." + FilterModel.ValueTextbox, filter.Value)%>
|
---|
51 | <% }
|
---|
52 | else if ("StringComparisonAvailableValuesFilter".Equals(f.GetType().Name))
|
---|
53 | { %>
|
---|
54 | <% StringComparisonAvailableValuesFilter filter = ((StringComparisonAvailableValuesFilter)f); %>
|
---|
55 | <%: Html.Label(filter.Label)%>
|
---|
56 | <%: Html.Label("=")%>
|
---|
57 | <%: Html.DropDownList(f.Id + "." + FilterModel.ValueTextbox, new SelectList(filter.AvailableValues, filter.Value))%>
|
---|
58 | <% }
|
---|
59 | else if ("NameEqualityComparisonByteArrayFilter".Equals(f.GetType().Name))
|
---|
60 | { %>
|
---|
61 | <% NameEqualityComparisonByteArrayFilter filter = ((NameEqualityComparisonByteArrayFilter)f); %>
|
---|
62 | <%: Html.Label(filter.Label)%>
|
---|
63 | <%: Html.Label("teby")%>
|
---|
64 | <% }
|
---|
65 | else if ("NameEqualityComparisonBoolFilter".Equals(f.GetType().Name))
|
---|
66 | { %>
|
---|
67 | <% NameEqualityComparisonBoolFilter filter = ((NameEqualityComparisonBoolFilter)f);
|
---|
68 | %>
|
---|
69 | <%: Html.Label(filter.Label)%>
|
---|
70 | <%: Html.Label("is") %>
|
---|
71 | <%: Html.DropDownList(f.Id + "." + FilterModel.ValueDropDownList, new SelectList(((FilterModel)Model).BoolStates, filter.Value))%>
|
---|
72 | <% }
|
---|
73 | else if ("NameOrdinalComparisonIntFilter".Equals(f.GetType().Name))
|
---|
74 | { %>
|
---|
75 | <% NameOrdinalComparisonIntFilter filter = ((NameOrdinalComparisonIntFilter)f); %>
|
---|
76 | <%: Html.Label(filter.Label)%>
|
---|
77 | <%: Html.DropDownList(f.Id + "." + FilterModel.ValueDropDownList, new SelectList(FilterModel.OrdinalComparisons,"Value","Text", filter.Comparison))%>
|
---|
78 | <%: Html.TextBox(f.Id + "." + FilterModel.ValueTextbox, filter.Value)%>
|
---|
79 | <% }
|
---|
80 | else if ("NameStringComparisonAvailableValuesFilter".Equals(f.GetType().Name))
|
---|
81 | { %>
|
---|
82 | <% NameStringComparisonAvailableValuesFilter filter = ((NameStringComparisonAvailableValuesFilter)f); %>
|
---|
83 | <%: Html.Label(filter.Label)%>
|
---|
84 | <%: Html.Label("=")%>
|
---|
85 | <%: Html.DropDownList(f.Id + "." + FilterModel.ValueDropDownList, new SelectList(filter.AvailableValues, filter.Value))%>
|
---|
86 | <% }
|
---|
87 | else if ("NameOrdinalComparisonDoubleFilter".Equals(f.GetType().Name))
|
---|
88 | { %>
|
---|
89 | <% NameOrdinalComparisonDoubleFilter filter = ((NameOrdinalComparisonDoubleFilter)f); %>
|
---|
90 | <%: Html.Label(filter.Label)%>
|
---|
91 | <%: Html.Label("<")%>
|
---|
92 | <%: Html.TextBox(f.Id + "." + FilterModel.ValueTextbox, filter.Value)%>
|
---|
93 | <% }
|
---|
94 | else if ("NameOrdinalComparisonFloatFilter".Equals(f.GetType().Name))
|
---|
95 | { %>
|
---|
96 | <% NameOrdinalComparisonFloatFilter filter = ((NameOrdinalComparisonFloatFilter)f); %>
|
---|
97 | <%: Html.Label(filter.Label)%>
|
---|
98 | <%: Html.Label("<")%>
|
---|
99 | <%: Html.TextBox(f.Id + "." + FilterModel.ValueTextbox, filter.Value)%>
|
---|
100 | <% }
|
---|
101 | else if ("NameOrdinalComparisonFloatFilter".Equals(f.GetType().Name))
|
---|
102 | { %>
|
---|
103 | <% NameOrdinalComparisonLongFilter filter = ((NameOrdinalComparisonLongFilter)f); %>
|
---|
104 | <%: Html.Label(filter.Label)%>
|
---|
105 | <%: Html.Label("<")%>
|
---|
106 | <%: Html.TextBox(f.Id + "." + FilterModel.ValueTextbox, filter.Value)%>
|
---|
107 | <% }
|
---|
108 |
|
---|
109 | %>
|
---|
110 | <%: Html.ActionLink("remove", "DeleteFilter", new { f.Id })%>
|
---|
111 |
|
---|
112 | <% }%>
|
---|
113 | </td></tr></table>
|
---|
114 | <% } %>
|
---|
115 | <% }%>
|
---|
116 | <% }
|
---|
117 |
|
---|
118 | %> </td></tr>
|
---|
119 | </table></div> |
---|