1 | <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>
|
---|
2 | <%@ Import Namespace="HLWebOKBQueryPlugin.Models" %>
|
---|
3 | <%@ Import Namespace="HLWebOKBQueryPlugin.OKBQueryService" %>
|
---|
4 | <%@ Import Namespace="HLWebOKBQueryPlugin.ViewModels" %>
|
---|
5 | <script src="/Scripts/MicrosoftAjax.js" type="text/javascript"></script>
|
---|
6 | <script src="/Scripts/MicrosoftMvcValidation.js" type="text/javascript"></script>
|
---|
7 | <script type="text/javascript">
|
---|
8 | function setAction(action, id) {
|
---|
9 | document.getElementById('selectedFilter').value = id;
|
---|
10 | document.getElementById('action').value = action;
|
---|
11 | document.filterForm.submit();
|
---|
12 | }
|
---|
13 | </script>
|
---|
14 |
|
---|
15 | <% using (Html.BeginForm("AddFilter", "Filter", FormMethod.Post, new { Name = "filterForm" })) %>
|
---|
16 | <% { %>
|
---|
17 | <!-- Put all into a form that calls the "AddFilter" Action-->
|
---|
18 | <%
|
---|
19 | CombinedFilter topFilter = ((FilterModel)Model).Content;
|
---|
20 | %>
|
---|
21 | <%: Html.Hidden("selectedFilter",null, new { Id = "selectedFilter" })%>
|
---|
22 | <%: Html.Hidden("action", null, new { Id = "action" })%>
|
---|
23 | <div>
|
---|
24 | <%
|
---|
25 | foreach (Filter fNode in topFilter.Filters) {
|
---|
26 |
|
---|
27 | CombinedFilter currentFilter = (CombinedFilter)fNode;
|
---|
28 | string comboboxName = FilterModel.ComboboxName + "." + currentFilter.Id;
|
---|
29 | string hiddenName = FilterModel.ParentIdName + "." + currentFilter.Id;
|
---|
30 | %>
|
---|
31 | <ul style="background-color: #eeeeee;border-style:solid;border-color:#aaa;border-width:1px;padding:10px;list-style-type:none;">
|
---|
32 | <li>
|
---|
33 | <%: Html.Hidden(hiddenName, currentFilter.Id.ToString())%>
|
---|
34 | <%: Html.DropDownList(comboboxName, new SelectList(((FilterModel)Model).AvailableFilterForCombobox, "FilterTypeName", "Label"))%>
|
---|
35 | <input type="button" name="submitButton" value="+" class="hl-button-text-plus" onclick="setAction('add','<%: currentFilter.Id%>');" />
|
---|
36 | <!-- <input type="submit" name="submitButton" value="+.<%:currentFilter.Id%>" />-->
|
---|
37 | </li>
|
---|
38 | <!-- Build the selected filters. The filtesr will be stored in the session and the
|
---|
39 | Controller puts the current filters from the session into the model. Selected Filters
|
---|
40 | will be iterated. -->
|
---|
41 | <% if (currentFilter.Filters != null) {
|
---|
42 |
|
---|
43 | foreach (Filter f in currentFilter.Filters) {
|
---|
44 | if (f != null) { %>
|
---|
45 | <li style="background-color:#FFF380;padding:5px;margin:5px;">
|
---|
46 | <%
|
---|
47 |
|
---|
48 |
|
---|
49 | if ("StringComparisonFilter".Equals(f.GetType().Name)) {
|
---|
50 | %>
|
---|
51 | <% StringComparisonFilter filter = ((StringComparisonFilter)f); %>
|
---|
52 | <%: Html.Label(filter.Label)%>
|
---|
53 | <%: Html.DropDownList(f.Id + "." + FilterModel.ComparisonDropDownList, new SelectList(FilterModel.StringComparisons, "Value", "Text", (int)filter.Comparison))%>
|
---|
54 | <%: Html.TextBox(f.Id + "." + FilterModel.ValueTextbox, (filter.Value))%>
|
---|
55 | <% }
|
---|
56 | else if ("NameStringComparisonFilter".Equals(f.GetType().Name)) { %>
|
---|
57 | <% NameStringComparisonFilter filter = ((NameStringComparisonFilter)f); %>
|
---|
58 | <%: Html.Label(filter.Label)%>
|
---|
59 | <%: Html.DropDownList(f.Id + "." + FilterModel.ComparisonDropDownList, new SelectList(FilterModel.StringComparisons, "Value", "Text", (int)filter.Comparison))%>
|
---|
60 | <%: Html.TextBox(f.Id + "." + FilterModel.ValueTextbox, filter.Value)%>
|
---|
61 | <% }
|
---|
62 | else if ("StringComparisonAvailableValuesFilter".Equals(f.GetType().Name)) { %>
|
---|
63 | <% StringComparisonAvailableValuesFilter filter = ((StringComparisonAvailableValuesFilter)f); %>
|
---|
64 | <%: Html.Label(filter.Label)%>
|
---|
65 | <%: Html.DropDownList(f.Id + "." + FilterModel.ComparisonDropDownList, new SelectList(FilterModel.StringComparisons, "Value", "Text", (int)filter.Comparison))%>
|
---|
66 | <%: Html.DropDownList(f.Id + "." + FilterModel.ValueTextbox, new SelectList(filter.AvailableValues, filter.Value))%>
|
---|
67 | <% }
|
---|
68 | else if ("NameEqualityComparisonByteArrayFilter".Equals(f.GetType().Name)) { %>
|
---|
69 | <% NameEqualityComparisonByteArrayFilter filter = ((NameEqualityComparisonByteArrayFilter)f); %>
|
---|
70 | <%: Html.Label(filter.Label)%>
|
---|
71 | <%: Html.Label("not supported")%>
|
---|
72 | <% }
|
---|
73 | else if ("NameEqualityComparisonBoolFilter".Equals(f.GetType().Name)) { %>
|
---|
74 | <% NameEqualityComparisonBoolFilter filter = ((NameEqualityComparisonBoolFilter)f); %>
|
---|
75 | <%: Html.Label(filter.Label)%>
|
---|
76 | <%: Html.DropDownList(f.Id + "." + FilterModel.ComparisonDropDownList, new SelectList(FilterModel.BoolComparisons, "Value", "Text", (int)filter.Comparison))%>
|
---|
77 | <%: Html.DropDownList(f.Id + "." + FilterModel.ValueDropDownList, new SelectList(((FilterModel)Model).BoolStates, filter.Value))%>
|
---|
78 | <% }
|
---|
79 | else if ("NameOrdinalComparisonIntFilter".Equals(f.GetType().Name)) { %>
|
---|
80 | <% NameOrdinalComparisonIntFilter filter = ((NameOrdinalComparisonIntFilter)f); %>
|
---|
81 | <%: Html.Label(filter.Label)%>
|
---|
82 | <%: Html.DropDownList(f.Id + "." + FilterModel.ComparisonDropDownList, new SelectList(FilterModel.OrdinalComparisons, "Value", "Text", (int)filter.Comparison))%>
|
---|
83 | <%: Html.TextBox(f.Id + "." + FilterModel.ValueTextbox, filter.Value)%>
|
---|
84 | <% }
|
---|
85 | else if ("NameStringComparisonAvailableValuesFilter".Equals(f.GetType().Name)) { %>
|
---|
86 | <% NameStringComparisonAvailableValuesFilter filter = ((NameStringComparisonAvailableValuesFilter)f); %>
|
---|
87 | <%: Html.Label(filter.Label)%>
|
---|
88 | <%: Html.DropDownList(f.Id + "." + FilterModel.ComparisonDropDownList, new SelectList(FilterModel.StringComparisons, "Value", "Text", (int)filter.Comparison))%>
|
---|
89 | <%: Html.DropDownList(f.Id + "." + FilterModel.ValueDropDownList, new SelectList(filter.AvailableValues, filter.Value))%>
|
---|
90 | <% }
|
---|
91 | else if ("NameOrdinalComparisonDoubleFilter".Equals(f.GetType().Name)) { %>
|
---|
92 | <% NameOrdinalComparisonDoubleFilter filter = ((NameOrdinalComparisonDoubleFilter)f); %>
|
---|
93 | <%: Html.Label(filter.Label)%>
|
---|
94 | <%: Html.DropDownList(f.Id + "." + FilterModel.ComparisonDropDownList, new SelectList(FilterModel.OrdinalComparisons, "Value", "Text", (int)filter.Comparison))%>
|
---|
95 | <%: Html.TextBox(f.Id + "." + FilterModel.ValueTextbox, filter.Value)%>
|
---|
96 | <% }
|
---|
97 | else if ("NameOrdinalComparisonFloatFilter".Equals(f.GetType().Name)) { %>
|
---|
98 | <% NameOrdinalComparisonFloatFilter filter = ((NameOrdinalComparisonFloatFilter)f); %>
|
---|
99 | <%: Html.Label(filter.Label)%>
|
---|
100 | <%: Html.DropDownList(f.Id + "." + FilterModel.ComparisonDropDownList, new SelectList(FilterModel.OrdinalComparisons, "Value", "Text", (int)filter.Comparison))%>
|
---|
101 | <%: Html.TextBox(f.Id + "." + FilterModel.ValueTextbox, filter.Value)%>
|
---|
102 | <% }
|
---|
103 | else if ("NameOrdinalComparisonLongFilter".Equals(f.GetType().Name)) { %>
|
---|
104 | <% NameOrdinalComparisonLongFilter filter = ((NameOrdinalComparisonLongFilter)f); %>
|
---|
105 | <%: Html.Label(filter.Label)%>
|
---|
106 | <%: Html.DropDownList(f.Id + "." + FilterModel.ComparisonDropDownList, new SelectList(FilterModel.OrdinalComparisons, "Value", "Text", (int)filter.Comparison))%>
|
---|
107 | <%: Html.TextBox(f.Id + "." + FilterModel.ValueTextbox, filter.Value)%>
|
---|
108 | <% }
|
---|
109 | else if ("OrdinalComparisonDateTimeFilter".Equals(f.GetType().Name)) { %>
|
---|
110 | <% OrdinalComparisonDateTimeFilter filter = ((OrdinalComparisonDateTimeFilter)f); %>
|
---|
111 | <%: Html.Label(filter.Label)%>
|
---|
112 | <%: Html.DropDownList(f.Id + "." + FilterModel.ComparisonDropDownList, new SelectList(FilterModel.OrdinalComparisons, "Value", "Text", (int)filter.Comparison))%>
|
---|
113 | <%: Html.TextBox(f.Id + "." + FilterModel.ValueTextbox, filter.Value)%>
|
---|
114 | <% }
|
---|
115 |
|
---|
116 | %>
|
---|
117 | <!-- <input type="submit" name="submitButton" value="-.<%:f.Id%>" class="hl-icon-delete" style="text-indent:-999em;" />
|
---|
118 | -->
|
---|
119 | <input type="button" name="submitButton" value="-" class="hl-icon-delete" onclick="setAction('delete','<%: f.Id%>');" />
|
---|
120 | <% } // if%>
|
---|
121 | </li>
|
---|
122 | <% } // inner foreach %>
|
---|
123 | </ul>
|
---|
124 | <% } // if%>
|
---|
125 | <%
|
---|
126 | }// foreach
|
---|
127 | %>
|
---|
128 | <a class="hl-button-text-plus" onclick="setAction('or','');" >OR Filter</a>
|
---|
129 | <a class="hl-icon-refresh" onclick="setAction('runs','');" >Refresh</a>
|
---|
130 | <%
|
---|
131 | } // form
|
---|
132 | %>
|
---|
133 | </div>
|
---|