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 | <p>
|
---|
6 | <%
|
---|
7 | CombinedFilter currentFilter = ((FilterModel)Model).Content;
|
---|
8 | %>
|
---|
9 | <% using (Html.BeginForm("AddFilterAnd", "Filter", FormMethod.Post, new { id = currentFilter.Id, name = currentFilter.Id })) %>
|
---|
10 | <% { %>
|
---|
11 | <%
|
---|
12 |
|
---|
13 | string comboboxName = "filtersCombobox." + currentFilter.Id;
|
---|
14 | string hiddenName = "parentId." + currentFilter.Id;
|
---|
15 | %>
|
---|
16 |
|
---|
17 | Select Filter:
|
---|
18 | <%: Html.Hidden(hiddenName,currentFilter.Id.ToString()) %>
|
---|
19 | <%: Html.DropDownList(comboboxName, new SelectList(((FilterModel)Model).Filters, "FilterTypeName", "Label"))%>
|
---|
20 | <input type="submit" value="+" />
|
---|
21 | </p>
|
---|
22 | <!-- Build the selected filters. The filtesr will be stored in the session and the
|
---|
23 | Controller puts the current filters from the session into the model. Selected Filters
|
---|
24 | will be iterated. -->
|
---|
25 | <% if (currentFilter.Filters != null)
|
---|
26 | {
|
---|
27 |
|
---|
28 | foreach (Filter f in currentFilter.Filters)
|
---|
29 | {
|
---|
30 | if (f != null)
|
---|
31 | { %>
|
---|
32 | <div>
|
---|
33 | <%
|
---|
34 |
|
---|
35 |
|
---|
36 | if ("StringComparisonFilter".Equals(f.GetType().Name))
|
---|
37 | { %>
|
---|
38 | <% StringComparisonFilter filter = ((StringComparisonFilter)f); %>
|
---|
39 |
|
---|
40 | <%: Html.Label(filter.Label)%>
|
---|
41 | <%: Html.Label("=") %>
|
---|
42 | <%: Html.TextBox(f.Id + ".valueTextbox", (filter.Value))%>
|
---|
43 | <%: Html.ActionLink("-","DeleteFilter", f.Id )%>
|
---|
44 | <% }
|
---|
45 | else if ("NameStringComparisonFilter".Equals(f.GetType().Name))
|
---|
46 | { %>
|
---|
47 | <% NameStringComparisonFilter filter = ((NameStringComparisonFilter)f); %>
|
---|
48 | <%: Html.Label(filter.Label)%>
|
---|
49 | <%: Html.Label("= xxx" + f.Id)%>
|
---|
50 | <%: Html.TextBox(f.Id + ".valueTextbox" + f.Id, filter.Value )%>
|
---|
51 | <%: Html.ActionLink("-", "DeleteFilter", new { f.Id })%>
|
---|
52 | <% }
|
---|
53 | else if ("StringComparisonAvailableValuesFilter".Equals(f.GetType().Name))
|
---|
54 | { %>
|
---|
55 | <% StringComparisonAvailableValuesFilter filter = ((StringComparisonAvailableValuesFilter)f); %>
|
---|
56 | <%: Html.Label(filter.Label)%>
|
---|
57 | <%: Html.Label("=")%>
|
---|
58 | <%: Html.DropDownList(f.Id + ".valueDropDownList", new SelectList(filter.AvailableValues,filter.Value))%>
|
---|
59 | <%: Html.ActionLink("-","DeleteFilter", f.Id )%>
|
---|
60 | <% }
|
---|
61 | else if ("NameEqualityComparisonByteArrayFilter".Equals(f.GetType().Name))
|
---|
62 | { %>
|
---|
63 | <% NameEqualityComparisonByteArrayFilter filter = ((NameEqualityComparisonByteArrayFilter)f); %>
|
---|
64 | <%: Html.Label(filter.Label)%>
|
---|
65 | <%: Html.ActionLink("-","DeleteFilter", f.Id )%>
|
---|
66 | <% }
|
---|
67 | else if ("NameEqualityComparisonBoolFilter".Equals(f.GetType().Name))
|
---|
68 | { %>
|
---|
69 | <% NameEqualityComparisonBoolFilter filter = ((NameEqualityComparisonBoolFilter)f);
|
---|
70 | %>
|
---|
71 | <%: Html.Label(filter.Label)%>
|
---|
72 | <%: Html.Label("is")%>
|
---|
73 | <%: Html.DropDownList(f.Id + ".valueDropDownList", new SelectList(((FilterModel)Model).GetBoolStates(),filter.Value)) %>
|
---|
74 | <%: Html.ActionLink("-","DeleteFilter", f.Id )%>
|
---|
75 | <% }
|
---|
76 | else if ("NameOrdinalComparisonIntFilter".Equals(f.GetType().Name))
|
---|
77 | { %>
|
---|
78 | <% NameOrdinalComparisonIntFilter filter = ((NameOrdinalComparisonIntFilter)f); %>
|
---|
79 | <%: Html.Label(filter.Label)%>
|
---|
80 | <%: Html.Label("is")%>
|
---|
81 |
|
---|
82 | <%: Html.ActionLink("-","DeleteFilter", f.Id )%>
|
---|
83 | <% }
|
---|
84 | else if ("NameStringComparisonAvailableValuesFilter".Equals(f.GetType().Name))
|
---|
85 | { %>
|
---|
86 | <% NameStringComparisonAvailableValuesFilter filter = ((NameStringComparisonAvailableValuesFilter)f); %>
|
---|
87 | <%: Html.Label(filter.Label)%>
|
---|
88 | <%: Html.Label("=")%>
|
---|
89 | <%: Html.DropDownList(f.Id + ".valueDropDownList", new SelectList(filter.AvailableValues,filter.Value))%>
|
---|
90 | <%: Html.ActionLink("-","DeleteFilter", f.Id )%>
|
---|
91 | <% }
|
---|
92 | else if ("NameOrdinalComparisonDoubleFilter".Equals(f.GetType().Name))
|
---|
93 | { %>
|
---|
94 | <% NameOrdinalComparisonDoubleFilter filter = ((NameOrdinalComparisonDoubleFilter)f); %>
|
---|
95 | <%: Html.Label(filter.Label)%>
|
---|
96 | <%: Html.Label("=")%>
|
---|
97 | <%: Html.TextBox(f.Id + ".valueTextbox" + f.Id, filter.Value )%>
|
---|
98 | <%: Html.ActionLink("-","DeleteFilter", f.Id )%>
|
---|
99 | <% }
|
---|
100 | else if ("NameOrdinalComparisonFloatFilter".Equals(f.GetType().Name))
|
---|
101 | { %>
|
---|
102 | <% NameOrdinalComparisonFloatFilter filter = ((NameOrdinalComparisonFloatFilter)f); %>
|
---|
103 | <%: Html.Label(filter.Label)%>
|
---|
104 | <%: Html.Label("=")%>
|
---|
105 | <%: Html.TextBox(f.Id + ".valueTextbox" + f.Id, filter.Value )%>
|
---|
106 | <%: Html.ActionLink("-","DeleteFilter", f.Id )%>
|
---|
107 | <% }
|
---|
108 | else if ("NameOrdinalComparisonFloatFilter".Equals(f.GetType().Name))
|
---|
109 | { %>
|
---|
110 | <% NameOrdinalComparisonLongFilter filter = ((NameOrdinalComparisonLongFilter)f); %>
|
---|
111 | <%: Html.Label(filter.Label)%>
|
---|
112 | <%: Html.Label("=")%>
|
---|
113 | <%: Html.TextBox(f.Id + ".valueTextbox" + f.Id, filter.Value )%>
|
---|
114 | <%: Html.ActionLink("-","DeleteFilter", f.Id )%>
|
---|
115 | <% }
|
---|
116 |
|
---|
117 |
|
---|
118 |
|
---|
119 |
|
---|
120 |
|
---|
121 |
|
---|
122 |
|
---|
123 |
|
---|
124 |
|
---|
125 | else
|
---|
126 | { %>
|
---|
127 | <!-- other types ... must be implemented -->
|
---|
128 | <%: Html.Label(f.GetType().Name)%>
|
---|
129 | <% }
|
---|
130 | %>
|
---|
131 | </div>
|
---|
132 | <% }
|
---|
133 | }
|
---|
134 | }%>
|
---|
135 | <% }
|
---|
136 |
|
---|
137 | %> |
---|