Example #1
0
 /// <summary>
 /// Default constructor.
 /// </summary>
 public SearchModule()
 {
     // Init inbound actions
     this._inboundModuleActions = new ModuleActionCollection();
     this._inboundModuleActions.Add(new ModuleAction("Search", new string[0]));
     this._currentModuleAction = this._inboundModuleActions[0];
 }
 /// <summary>
 /// Default constructor.
 /// </summary>
 public SearchModule(ISearchService searchService)
 {
     this._searchService = searchService;
     // Init inbound actions
     this._inboundModuleActions = new ModuleActionCollection();
     this._inboundModuleActions.Add(new ModuleAction("Search", new string[0]));
     this._inboundModuleActions.Add(new ModuleAction("Category", new string[0]));
     this._inboundModuleActions.Add(new ModuleAction("AlphabeticIndex", new string[0]));
     this._currentModuleAction = this._inboundModuleActions[0];
 }
 /// <summary>
 /// Remove an ModuleAction from the list.
 /// </summary>
 /// <param name="moduleAction"></param>
 public void Remove(ModuleAction moduleAction)
 {
     this.List.Remove(moduleAction);
 }
 /// <summary>
 /// Does the list contain a given ModuleAction?
 /// </summary>
 /// <param name="moduleAction"></param>
 /// <returns></returns>
 public bool Contains(ModuleAction moduleAction)
 {
     return this.List.Contains(moduleAction);
 }
 /// <summary>
 /// Add an ModuleAction to the list.
 /// </summary>
 /// <param name="moduleAction"></param>
 public void Add(ModuleAction moduleAction)
 {
     this.List.Add(moduleAction);
 }
        protected override void ParsePathInfo()
        {
            base.ParsePathInfo();
            if (base.ModuleParams != null)
            {
                if (base.ModuleParams.Length == 1)
                {
                    // First argument is the module action
                    this._currentModuleAction = this._inboundModuleActions.FindByName(base.ModuleParams[0]);
                    if (this._currentModuleAction != null)
                    {
                        if (this._currentModuleAction.Name == "Search")
                        {
                            this._searchQuery = HttpContext.Current.Server.UrlDecode(HttpContext.Current.Request.QueryString["q"]);
                        }
                        else if (this._currentModuleAction.Name == "Category")
                        {
                            string categoryNames = HttpContext.Current.Server.UrlDecode(HttpContext.Current.Request.QueryString["c"]);
                            this.CategoryNames = new List<string>(categoryNames.Split(','));
                            //reset searchquery (following queries can still be combined with catgories)
                            this._searchQuery = string.Empty;
                        }
                        else if (this._currentModuleAction.Name == "AlphabeticIndex")
                        {
                            string letter = HttpContext.Current.Server.UrlDecode(HttpContext.Current.Request.QueryString["a"]);
                            this._searchQuery = string.Format("title:{0}*", letter );
                        }

                    }
                    else
                    {
                        throw new Exception("Error when parsing module action: " + base.ModuleParams[0]);
                    }
                }
            }
        }
Example #7
0
 protected override void ParsePathInfo()
 {
     base.ParsePathInfo ();
     if (base.ModuleParams != null)
     {
         if (base.ModuleParams.Length == 1)
         {
             // First argument is the module action
             this._currentModuleAction = this._inboundModuleActions.FindByName(base.ModuleParams[0]);
             if (this._currentModuleAction != null)
             {
                 if (this._currentModuleAction.Name == "Search")
                 {
                     this._searchQuery = HttpContext.Current.Server.UrlDecode(HttpContext.Current.Request.QueryString["q"]);
                 }
             }
             else
             {
                 throw new Exception("Error when parsing module action: " + base.ModuleParams[0]);
             }
         }
     }
 }