Free cookie consent management tool by TermsFeed Policy Generator

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

#1499 new (non-recursive) view/architecture

Location:
branches/WebApplication/MVC2/HLWebOKBQueryPlugin/Views/Filter
Files:
2 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%>
  • branches/WebApplication/MVC2/HLWebOKBQueryPlugin/Views/Filter/Index.aspx

    r6097 r6141  
    11<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>
    22
     3<%@ Import Namespace="HLWebOKBQueryPlugin.Models" %>
     4<%@ Import Namespace="HLWebOKBQueryPlugin.OKBQueryService" %>
    35<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    46    Index
    57</asp:Content>
    68<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    7     <h2>Filter</h2>
     9    <h2>
     10        Filter</h2>
    811    <!--
    912     This is the "user control" for the filters. This will call the action "AddFilter"
    1013     in the controller, after the Action "Index" is called (for rendering the page).
     14
     15
     16     ch130 TSP (imported from TSPLIB)
     17
     18
    1119     -->
    12     <% Html.RenderPartial("Filters"); %>
     20    <%
     21         
     22        FilterModel model = (FilterModel)Model;
     23
     24        if (model != null && model.Content != null)
     25        {
     26            foreach (Filter f in model.Content.Filters)
     27            {
     28    %>
     29 
     30    <% FilterModel fm = new FilterModel((CombinedFilter)f);
     31             
     32    %>
     33    <% Html.RenderPartial("Filters", fm); %>
     34    <%}
     35         }%>
     36
     37         
     38     
     39  <% using (Html.BeginForm("AddFilterOr", "Filter")) %>
     40  <% {     %>
     41 Or filter <input type="submit" value="+" />
     42  <% }     %>
     43
     44
     45 
     46  <% using (Html.BeginForm("GetRuns", "Filter")) %>
     47  <% {     %>
     48 <input type="submit" value="get runs" />
     49  <% }     %>
     50
    1351</asp:Content>
Note: See TracChangeset for help on using the changeset viewer.