Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/07/11 10:41:02 (13 years ago)
Author:
mjesner
Message:

#1499 new (non-recursive) view/architecture

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/WebApplication/MVC2/HLWebOKBQueryPlugin/Views/Filter/Filters.ascx

    r6118 r6141  
    33<%@ Import Namespace="HLWebOKBQueryPlugin.OKBQueryService" %>
    44<!-- Put all into a form that calls the "AddFilter" Action-->
    5 <% using (Html.BeginForm ("AddFilter", "Filter")) %>
    6 <% { %>
    75<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 
    817    Select Filter:
    9     <%: Html.DropDownList("filtersCombobox", new SelectList(((FilterModel)Model).Filters, "FilterTypeName", "Label"))%>
    10     <input type="submit" value="add" />
    11    
     18    <%: Html.Hidden(hiddenName,currentFilter.Id.ToString()) %>
     19    <%: Html.DropDownList(comboboxName, new SelectList(((FilterModel)Model).Filters, "FilterTypeName", "Label"))%>
     20    <input type="submit" value="+" />
    1221</p>
    13 <ul>
    14     <!-- Build the selected filters. The filtesr will be stored in the session and the
     22<!-- Build the selected filters. The filtesr will be stored in the session and the
    1523Controller puts the current filters from the session into the model. Selected Filters
    1624will be iterated. -->
    17     <% if (((FilterModel)Model).SelectedFilters != null)
     25<% if (currentFilter.Filters != null)
     26   {
     27
     28       foreach (Filter f in currentFilter.Filters)
    1829       {
    19 
    20            foreach (Filter f in ((FilterModel)Model).SelectedFilters)
    21            { %>
    22     <li>
    23         <%
    24                 // If type is StringComparisonFilter build thes controls
    25                 if ("StringComparisonFilter".Equals(f.GetType().Name))
    26                 {  %>
    27                     <%: Html.TextBox("valueTextbox." + f.GetType().Name, ((StringComparisonFilter)f).Value)%>
    28                     <%: Html.LabelFor(x => f.Label)%>
    29                    
    30              <% }
    31                // If type is NameStringComparisonFilter build thes controls
    32                else if ("NameStringComparisonFilter".Equals(f.GetType().Name))
    33                { %>
    34                     <%: Html.TextBox("valueTextbox." + f.GetType().Name, ((NameStringComparisonFilter)f).Value) %>
    35                    
    36              <% }
    37                else if ("CombinedFilter".Equals(f.GetType().Name))
    38                { %>
    39                 <% CombinedFilter combiFilter = ((CombinedFilter)f);  %>
    40                  <% List<Filter> comtbiFtilterLis = combiFilter.Filters.ToList<Filter>();
    41                     FilterModel m = new FilterModel();
    42                     m.Filters = ((FilterModel)Model).Filters;
    43                     m.SelectedFilters = comtbiFtilterLis;
    44                     %>
    45                     <%   Html.RenderPartial("Filters", m); %>
    46                    
    47              <% }
     30           if (f != null)
     31           {  %>
     32<div>
     33    <%
     34           
     35// If type is StringComparisonFilter build thes controls
     36if ("StringComparisonFilter".Equals(f.GetType().Name))
     37{  %>
     38    <%: Html.TextBox(f.Id + ".valueTextbox", ((StringComparisonFilter)f).Value)%>
     39    <%: Html.Label(f.GetType().Name)%>
     40    <% }
     41// If type is NameStringComparisonFilter build thes controls
     42else if ("NameStringComparisonFilter".Equals(f.GetType().Name))
     43{ %>
     44    <%: Html.TextBox(f.Id + ".valueTextbox" + f.Id, new{((NameStringComparisonFilter)f).Value})%>
     45    <%: Html.Label(f.GetType().Name)%>
     46    <% }
    4847
    4948
    50               else
    51                 { %>
    52                      <!-- type not supported ... -->
    53                      FilerTypeName =
    54                     <%: Html.Label(f.GetType().Name)%>
    55                <% }
    56                %>
    57     </li>
     49else
     50{ %>
     51    <!-- other types ... must be implemented -->
     52    <%: Html.Label(f.GetType().Name)%>
    5853    <% }
    59 
     54    %>
     55</div>
     56<% }
    6057       }
    6158   }%>
    62 </ul>
     59<% }
     60       
     61%>
Note: See TracChangeset for help on using the changeset viewer.