Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/26/11 23:53:57 (13 years ago)
Author:
mjesner
Message:

#1499 result page, styling, functionality (add/remove) for post actions

Location:
branches/WebApplication/MVC2/HLWebOKBQueryPlugin
Files:
2 added
7 edited

Legend:

Unmodified
Added
Removed
  • branches/WebApplication/MVC2/HLWebOKBQueryPlugin/Controllers/ChartController.cs

    r6242 r6303  
    3131
    3232      // Later, we will get the runs from the session ...
    33       QueryServiceClient client = Query.GetClientFactory("okbtester", "okbtester");
    34 
    35       long[] runIds = new long[104];
    36       for (int i = 0; i < 104; i++) {
    37         runIds[i] = i;
    38       }
    39       Run[] runs = client.GetRuns(runIds, false);
    40       //cm.Runs = runs;
     33      QueryServiceClient client = Query.GetClientFactory();
     34
     35      //long[] runIds = new long[104];
     36      //for (int i = 0; i < 104; i++) {
     37      //  runIds[i] = i;
     38      //}
     39      long[] runIds = client.GetRunIds((CombinedFilter)Session["Content"]);
     40        Run[] runs = client.GetRuns(runIds,false);
     41      //  Run[] runs = Session[""];
     42      cm.Runs = runs;
    4143      cm.UpdateRunCollection(runs);
    4244      cm.UpdateBubbleChart(selectedAxisY, selectedAxisX, selectedBubbleSize);
  • branches/WebApplication/MVC2/HLWebOKBQueryPlugin/Controllers/FilterController.cs

    r6247 r6303  
    88using HLWebOKBQueryPlugin.OKBQueryService;
    99using System.Web.Routing;
     10using HLWebOKBQueryPlugin.Models;
    1011
    1112namespace HLWebOKBQueryPlugin.Controllers
     
    2021        /// </summary>
    2122        /// <returns></returns>
    22         public void GetRuns()
    23         {
    24             FilterModel qm = new FilterModel();
    25             qm.Content = (CombinedFilter)Session["Content"];
    26 
    27             QueryServiceClient client = Query.GetClientFactory("okbtester", "okbtester");
    28 
    29 
    30             long[] ids = client.GetRunIds(qm.Content);
     23        public ActionResult GetRuns()
     24        {
     25            Session["SelectedSubMenu"] = "Filter";
     26
     27            FilterModel fm = new FilterModel();
     28            fm.Content = (CombinedFilter)Session["Content"];
     29
     30            QueryServiceClient client = Query.GetClientFactory();
     31
     32
     33            long[] ids = client.GetRunIds(fm.Content);
    3134
    3235            Response.Write("Found <" + ids.Count() + "> Runs.");
    33 
    34           //  return View("Index", qm); // name of usercontrol
     36            QueryModel qm = new QueryModel();
     37            qm.Runs = ids;
     38            return View("Results", qm); // name of usercontrol
    3539        }
    3640
     
    5155        /// <param name="collection"></param>
    5256        /// <returns></returns>
    53         public ActionResult AddFilterAnd(string submitButton, FormCollection collection)
     57        public ActionResult AddFilter(FormCollection collection)
    5458        {
    5559            FilterModel fm = new FilterModel((CombinedFilter)Session["Content"]);
    56 
    57             Response.Write("Submit:" + submitButton);
     60            string submitAction = collection.Get("action");
     61            Response.Write("Submit:" + submitAction);
    5862           
    5963            //update model with form data
    6064            UpdateModel(collection, fm);
    6165
    62             if (submitButton.StartsWith("+"))
    63             {
    64                 string stringid = submitButton.Substring(2);
     66            if ("add".Equals(submitAction))
     67            {
     68               // string stringid = submitButton.Substring(2);
     69                string stringid = collection.Get("selectedFilter");
    6570                AddNewFilter(collection, fm, stringid);
    6671            }
    67             else if (submitButton.StartsWith("-"))
    68             {
    69                 string stringid = submitButton.Substring(2);
     72            else if ("delete".Equals(submitAction))
     73            {
     74               string stringid= collection.Get("selectedFilter");
     75               // string stringid = submitButton.Substring(2);
    7076                DeleteFilter(new Guid(stringid));
    7177            }
    72             else if (submitButton.Equals("runs"))
    73             {
    74                 GetRuns();
    75             }
    76             else if (submitButton.Equals("or"))
     78            else if ("runs".Equals(submitAction))
     79            {
     80                return GetRuns();
     81            }
     82            else if ("or".Equals(submitAction))
    7783            {
    7884                AddFilterOr( fm);
  • branches/WebApplication/MVC2/HLWebOKBQueryPlugin/Controllers/QueryController.cs

    r6253 r6303  
    1111using System.Reflection;
    1212using System.Text;
    13 using HLWebPluginHost.Models;
     13using HLWebOKBQueryPlugin.Models;
    1414using HLWebOKBQueryPlugin.OKBQueryService;
    1515using HLWebOKBQueryPlugin.Helpers;
     
    4343
    4444        public ActionResult RunCollectionTable() {
     45
     46            // Get runs from filter
     47           
     48
     49            QueryServiceClient client = Query.GetClientFactory();
     50
     51
     52            long[] ids = client.GetRunIds((CombinedFilter)Session["Content"]);
     53
    4554            QueryModel qm = new QueryModel();
    46             Session["QueryRuns"] = qm.getTestRuns();
     55            qm.Runs = ids;
     56            Session["QueryRuns"] = qm.RunCollection;
    4757            return View(qm);
    4858        }
  • branches/WebApplication/MVC2/HLWebOKBQueryPlugin/HLWebOKBQueryPlugin.csproj

    r6253 r6303  
    108108    <Compile Include="ViewModels\ComparisonItem.cs" />
    109109    <Compile Include="ViewModels\ComparisonsHelper.cs" />
    110     <Compile Include="ViewModels\FilterModel.cs" />
     110    <Compile Include="Models\FilterModel.cs" />
    111111    <Compile Include="Models\QueryModel.cs" />
    112112    <Compile Include="Properties\AssemblyInfo.cs" />
     
    161161    <Content Include="Views\Chart\Index.aspx" />
    162162    <Content Include="Views\Filter\Index.aspx" />
     163    <Content Include="Views\Filter\Results.aspx" />
    163164    <Content Include="Views\Home\About.aspx" />
    164165    <Content Include="Views\Home\Index.aspx" />
     
    213214    <Folder Include="App_Data\" />
    214215    <Folder Include="App_LocalResources\" />
    215     <Folder Include="Views\AlgorithmClass\" />
    216216  </ItemGroup>
    217217  <ItemGroup>
  • branches/WebApplication/MVC2/HLWebOKBQueryPlugin/Models/QueryModel.cs

    r6253 r6303  
    88using HLWebOKBQueryPlugin.Helpers;
    99
    10 namespace HLWebPluginHost.Models {
     10namespace HLWebOKBQueryPlugin.Models
     11{
    1112    public class QueryModel {
    1213
    1314        public String SelectedSubMenu { get; set; }
     15        private long[] runs;
     16
     17
    1418
    1519        public IList<Filter> QueryFilterGetAll() {
     
    4145        }
    4246
     47
     48        public long[] Runs
     49        {
     50            get
     51            {
     52                return this.runs;
     53            }
     54            set
     55            {
     56                this.runs = value;
     57            }
     58
     59        }
     60
     61
     62        public IList<RunCollectionData> RunCollection
     63        {
     64            get
     65            {
     66                QueryServiceClient client = Query.GetClientFactory();
     67                if (client != null)
     68                {
     69                    IList<RunCollectionData> runCollection = new List<RunCollectionData>();
     70
     71                    IList<Run> runList = client.GetRuns(runs, false).ToList<Run>();
     72
     73                    foreach (Run r in runList)
     74                        runCollection.Add(new RunCollectionData(r));
     75
     76                    return runCollection;
     77                }
     78                return new List<RunCollectionData>();
     79            }
     80        }
     81
    4382        // just 4 testing
    44         public IList<RunCollectionData> getTestRuns() {
     83        //public IList<RunCollectionData> getTestRuns() {
    4584
    46             QueryServiceClient client = Query.GetClientFactory();
     85        //    QueryServiceClient client = Query.GetClientFactory();
    4786
    48             if (client != null) {
    49                 IList<RunCollectionData> runs = new List<RunCollectionData>();
     87        //    if (client != null) {
     88        //        IList<RunCollectionData> runs = new List<RunCollectionData>();
    5089
    51                 //long[] runIds = client.GetRunIds(new Filter());
    52                 //if (runIds.Length < cnt) cnt = runIds.Length;
     90        //        //long[] runIds = client.GetRunIds(new Filter());
     91        //        //if (runIds.Length < cnt) cnt = runIds.Length;
    5392
    54                 long[] getRuns = new long[2] { 1, 2 };
     93        //        long[] getRuns = new long[2] { 1, 2 };
    5594
    56                 IList<Run> runList = client.GetRuns(getRuns, false).ToList<Run>();
     95        //        IList<Run> runList = client.GetRuns(getRuns, false).ToList<Run>();
    5796
    58                 foreach (Run r in runList)
    59                     runs.Add(new RunCollectionData(r));
     97        //        foreach (Run r in runList)
     98        //            runs.Add(new RunCollectionData(r));
    6099
    61                 return runs;
    62             }
    63             return new List<RunCollectionData>();
    64         }
     100        //        return runs;
     101        //    }
     102        //    return new List<RunCollectionData>();
     103        //}
    65104
    66105    }
  • branches/WebApplication/MVC2/HLWebOKBQueryPlugin/Properties/AssemblyInfo.cs

    r5910 r6303  
    22using System.Runtime.CompilerServices;
    33using System.Runtime.InteropServices;
    4 using HLWebPluginHost.PluginLib;
    54using System.Web.UI;
    65using System.Collections;
     6using HLWebPluginHost.PluginLib;
    77
    88// General Information about an assembly is controlled through the following
  • branches/WebApplication/MVC2/HLWebOKBQueryPlugin/Views/Filter/Filters.ascx

    r6268 r6303  
    88<script src="/Scripts/MicrosoftMvcValidation.js" type="text/javascript"></script>
    99
     10<script type="text/javascript">
     11    function setAction(action, id) {
     12        document.getElementById('selectedFilter').value = id;
     13        document.getElementById('action').value = action;
     14        document.filterForm.submit();
     15    }
     16</script>
     17
     18
    1019<% Html.EnableClientValidation(); %>
     20 <% using (Html.BeginForm("AddFilter", "Filter", FormMethod.Post, new { Name = "filterForm" })) %>
     21    <% {  %> 
     22<!-- Put all into a form that calls the "AddFilter" Action-->
    1123
    12 <!-- Put all into a form that calls the "AddFilter" Action-->
    13 <div><table>
     24    <%
     25     CombinedFilter topFilter = ((FilterModel)Model).Content;
     26    %>
     27    <div><table>
    1428<tr><td>A<br />N<br />D</td><td>
    15 <p>
    16     <%
    17         CombinedFilter topFilter = ((FilterModel)Model).Content;
     29
     30
     31   
     32           <%
     33     foreach (Filter fNode in topFilter.Filters)
     34     {
     35
     36         CombinedFilter currentFilter = (CombinedFilter)fNode;
     37         string comboboxName = FilterModel.ComboboxName + "." + currentFilter.Id;
     38         string hiddenName = FilterModel.ParentIdName + "." + currentFilter.Id;
    1839    %>
    19     <% using (Html.BeginForm("AddFilterAnd", "Filter", FormMethod.Post, new { id = topFilter.Id, name = topFilter.Id })) %>
    20     <% {   
    21            
    22             foreach (Filter fNode in topFilter.Filters)
    23             {
    24 
    25                 CombinedFilter currentFilter = (CombinedFilter)fNode;
    26                 string comboboxName = FilterModel.ComboboxName + "." + currentFilter.Id;
    27                 string hiddenName = FilterModel.ParentIdName + "." + currentFilter.Id;
    28     %>
    29     <%: Html.Hidden(hiddenName,currentFilter.Id.ToString()) %>
    30     <%: Html.DropDownList( comboboxName, new SelectList(((FilterModel)Model).AvailableFilterForCombobox, "FilterTypeName", "Label"))%>
    31     <input type="submit" name="submitButton" value="+.<%:currentFilter.Id%>" />
    32 </p>
     40    <table border="0"><tr><td>
     41    <%: Html.Hidden(hiddenName, currentFilter.Id.ToString())%>
     42      <%: Html.Hidden("selectedFilter",null, new { Id = "selectedFilter" })%>
     43       <%: Html.Hidden("action", null, new { Id = "action" })%>
     44    <%: Html.DropDownList(comboboxName, new SelectList(((FilterModel)Model).AvailableFilterForCombobox, "FilterTypeName", "Label"))%>
     45   
     46   
     47    <input type="button" name="submitButton" value="+" class="hl-button-text-plus"   onClick="setAction('add','<%: currentFilter.Id%>');" />
     48   <!-- <input type="submit" name="submitButton" value="+.<%:currentFilter.Id%>"  />-->
     49</td></tr><tr><td>
    3350<!-- Build the selected filters. The filtesr will be stored in the session and the
    3451Controller puts the current filters from the session into the model. Selected Filters
     
    4259           {  %>
    4360
    44            <table border="0"><tr><td>
     61           <tr><td>
    4562    <%
    4663           
    4764
    48 if ("StringComparisonFilter".Equals(f.GetType().Name))
    49 {  %>
     65     if ("StringComparisonFilter".Equals(f.GetType().Name))
     66     {  %>
    5067    <% StringComparisonFilter filter = ((StringComparisonFilter)f); %>
    5168    <%: Html.Label(filter.Label)%>
    52     <%: Html.DropDownList(f.Id + "." + FilterModel.ComparisonDropDownList, new SelectList(FilterModel.StringComparisons, "Value", "Text",(int)filter.Comparison))%>   
     69    <%: Html.DropDownList(f.Id + "." + FilterModel.ComparisonDropDownList, new SelectList(FilterModel.StringComparisons, "Value", "Text", (int)filter.Comparison))%>   
    5370    <%: Html.TextBox(f.Id + "." + FilterModel.ValueTextbox, (filter.Value))%>
    54     <%: Html.TextBoxFor(model => ((FilterModel)Model).IntValue, (filter.Value)) %>
    55     <%: Html.ValidationMessageFor(model => ((FilterModel)Model).IntValue) %>
     71    <%: Html.TextBoxFor(model => ((FilterModel)Model).IntValue, (filter.Value))%>
     72    <%: Html.ValidationMessageFor(model => ((FilterModel)Model).IntValue)%>
    5673    <% }
    57 else if ("NameStringComparisonFilter".Equals(f.GetType().Name))
    58 { %>
     74     else if ("NameStringComparisonFilter".Equals(f.GetType().Name))
     75     { %>
    5976    <% NameStringComparisonFilter filter = ((NameStringComparisonFilter)f); %>
    6077    <%: Html.Label(filter.Label)%>
    61     <%: Html.DropDownList(f.Id + "." + FilterModel.ComparisonDropDownList, new SelectList(FilterModel.StringComparisons, "Value", "Text",(int)filter.Comparison))%>   
     78    <%: Html.DropDownList(f.Id + "." + FilterModel.ComparisonDropDownList, new SelectList(FilterModel.StringComparisons, "Value", "Text", (int)filter.Comparison))%>   
    6279    <%: Html.TextBox(f.Id + "." + FilterModel.ValueTextbox, filter.Value)%>
    6380    <% }
    64 else if ("StringComparisonAvailableValuesFilter".Equals(f.GetType().Name))
    65 { %>
     81     else if ("StringComparisonAvailableValuesFilter".Equals(f.GetType().Name))
     82     { %>
    6683    <% StringComparisonAvailableValuesFilter filter = ((StringComparisonAvailableValuesFilter)f); %>
    6784    <%: Html.Label(filter.Label)%>
    68     <%: Html.DropDownList(f.Id + "." + FilterModel.ComparisonDropDownList, new SelectList(FilterModel.StringComparisons, "Value", "Text",(int)filter.Comparison))%>   
     85    <%: Html.DropDownList(f.Id + "." + FilterModel.ComparisonDropDownList, new SelectList(FilterModel.StringComparisons, "Value", "Text", (int)filter.Comparison))%>   
    6986    <%: Html.DropDownList(f.Id + "." + FilterModel.ValueTextbox, new SelectList(filter.AvailableValues, filter.Value))%>
    7087    <% }
    71 else if ("NameEqualityComparisonByteArrayFilter".Equals(f.GetType().Name))
    72 { %>
     88     else if ("NameEqualityComparisonByteArrayFilter".Equals(f.GetType().Name))
     89     { %>
    7390    <% NameEqualityComparisonByteArrayFilter filter = ((NameEqualityComparisonByteArrayFilter)f); %>
    7491    <%: Html.Label(filter.Label)%>
    7592    <%: Html.Label("not supported")%>
    7693    <% }
    77 else if ("NameEqualityComparisonBoolFilter".Equals(f.GetType().Name))
    78 { %>
     94     else if ("NameEqualityComparisonBoolFilter".Equals(f.GetType().Name))
     95     { %>
    7996    <% NameEqualityComparisonBoolFilter filter = ((NameEqualityComparisonBoolFilter)f);   %>
    8097    <%: Html.Label(filter.Label)%>
    81     <%: Html.DropDownList(f.Id + "." + FilterModel.ComparisonDropDownList, new SelectList(FilterModel.BoolComparisons, "Value", "Text",(int)filter.Comparison))%>     
     98    <%: Html.DropDownList(f.Id + "." + FilterModel.ComparisonDropDownList, new SelectList(FilterModel.BoolComparisons, "Value", "Text", (int)filter.Comparison))%>     
    8299    <%: Html.DropDownList(f.Id + "." + FilterModel.ValueDropDownList, new SelectList(((FilterModel)Model).BoolStates, filter.Value))%>
    83100    <% }
    84 else if ("NameOrdinalComparisonIntFilter".Equals(f.GetType().Name))
    85 { %>
     101     else if ("NameOrdinalComparisonIntFilter".Equals(f.GetType().Name))
     102     { %>
    86103    <% NameOrdinalComparisonIntFilter filter = ((NameOrdinalComparisonIntFilter)f);   %>
    87104    <%: Html.Label(filter.Label)%>
     
    89106    <%: Html.TextBox(f.Id + "." + FilterModel.ValueTextbox, filter.Value)%>
    90107    <% }
    91 else if ("NameStringComparisonAvailableValuesFilter".Equals(f.GetType().Name))
    92 { %>
     108     else if ("NameStringComparisonAvailableValuesFilter".Equals(f.GetType().Name))
     109     { %>
    93110    <% NameStringComparisonAvailableValuesFilter filter = ((NameStringComparisonAvailableValuesFilter)f);   %>
    94111    <%: Html.Label(filter.Label)%>
    95     <%: Html.DropDownList(f.Id + "." + FilterModel.ComparisonDropDownList, new SelectList(FilterModel.StringComparisons, "Value", "Text",(int)filter.Comparison))%>   
     112    <%: Html.DropDownList(f.Id + "." + FilterModel.ComparisonDropDownList, new SelectList(FilterModel.StringComparisons, "Value", "Text", (int)filter.Comparison))%>   
    96113    <%: Html.DropDownList(f.Id + "." + FilterModel.ValueDropDownList, new SelectList(filter.AvailableValues, filter.Value))%>
    97114    <% }
    98 else if ("NameOrdinalComparisonDoubleFilter".Equals(f.GetType().Name))
    99 { %>
     115     else if ("NameOrdinalComparisonDoubleFilter".Equals(f.GetType().Name))
     116     { %>
    100117    <% NameOrdinalComparisonDoubleFilter filter = ((NameOrdinalComparisonDoubleFilter)f);   %>
    101118    <%: Html.Label(filter.Label)%>
     
    103120    <%: Html.TextBox(f.Id + "." + FilterModel.ValueTextbox, filter.Value)%>
    104121    <% }
    105 else if ("NameOrdinalComparisonFloatFilter".Equals(f.GetType().Name))
    106 { %>
     122     else if ("NameOrdinalComparisonFloatFilter".Equals(f.GetType().Name))
     123     { %>
    107124    <% NameOrdinalComparisonFloatFilter filter = ((NameOrdinalComparisonFloatFilter)f);   %>
    108125    <%: Html.Label(filter.Label)%>
     
    110127    <%: Html.TextBox(f.Id + "." + FilterModel.ValueTextbox, filter.Value)%>
    111128    <% }
    112 else if ("NameOrdinalComparisonLongFilter".Equals(f.GetType().Name))
    113 { %>
     129     else if ("NameOrdinalComparisonLongFilter".Equals(f.GetType().Name))
     130     { %>
    114131    <% NameOrdinalComparisonLongFilter filter = ((NameOrdinalComparisonLongFilter)f);   %>
    115132    <%: Html.Label(filter.Label)%>
     
    117134    <%: Html.TextBox(f.Id + "." + FilterModel.ValueTextbox, filter.Value)%>
    118135    <% }
    119 else if ("OrdinalComparisonDateTimeFilter".Equals(f.GetType().Name))
    120 { %>
     136     else if ("OrdinalComparisonDateTimeFilter".Equals(f.GetType().Name))
     137     { %>
    121138    <% OrdinalComparisonDateTimeFilter filter = ((OrdinalComparisonDateTimeFilter)f);   %>
    122139    <%: Html.Label(filter.Label)%>
     
    126143                 
    127144    %>
    128 
    129     <input type="submit" name="submitButton" value="-.<%:f.Id%>"    />
     145       <!-- <input type="submit" name="submitButton" value="-.<%:f.Id%>"  class="hl-icon-delete"  style="text-indent:-999em;"  />
     146       -->
     147    <input type="button" name="submitButton" value="-"  class="hl-icon-delete"  onClick="setAction('delete','<%: f.Id%>');" />
    130148   
    131149<% }%>
    132     </td></tr></table>
     150    </td></tr>
    133151    <% } %>
     152     </table></td></tr>
    134153 <%  }%>
    135154   <% }%>
    136  <input type="submit" name="submitButton"  value="or" />
     155
     156
     157
     158 
     159  </table> <input type="button" name="submitButton"  value="or"  onClick="setAction('or','');"  />
    137160 </br>
    138  <input type="submit" name="submitButton" value="runs" />
    139 
    140  
    141 
    142 <% }
    143      
    144 %> </td></tr>
    145 </table></div>
     161 <input type="button" name="submitButton" value="runs"  onClick="setAction('runs','');" />
     162 
     163 
     164<% }   
     165%>
     166 </div>
Note: See TracChangeset for help on using the changeset viewer.