def fillCategoryHeader(self, obj, params): # Search box, in case search is active defaultSearchEngine = SearchRegister().getDefaultSearchEngineAgent() if defaultSearchEngine is not None and defaultSearchEngine.isActive(): params["searchBox"] = WSearchBox.forModule( defaultSearchEngine.getImplementationPackage(), params.get("categId", 0)).getHTML()
def _checkParams(self, params): self._params = params self._getTarget() self._seAdapter = SearchRegister().getDefaultSearchEngineAgent()( target=self._target, page=int(params.get('page', 1)), userLoggedIn=self.getAW().getUser() != None)
def fillConferenceHeader(self, obj, params): # Search box, in case search is active defaultSearchEngine = SearchRegister().getDefaultSearchEngineAgent() if params["dm"].getSearchEnabled( ) and defaultSearchEngine is not None and defaultSearchEngine.isActive( ): params["searchBox"] = WMiniSearchBox.forModule( defaultSearchEngine.getImplementationPackage(), params.get("confId", 0)).getHTML()
class RHSearchBase(RHCustomizable): def _checkProtection(self): if not PluginsHolder().hasPluginType("search"): raise PluginError(_("Search plugin is not active.")) def _getTarget(self): try: self._target = self._conf = ConferenceHolder().getById(self._params.get("confId","")) except: self._target = CategoryManager().getById(self._params.get('categId', 0)) def _checkParams( self, params ): self._params = params self._getTarget() self._seAdapter = SearchRegister().getDefaultSearchEngineAgent()(target=self._target, page=int(params.get('page', 1)), userLoggedIn=self.getAW().getUser() != None) def _filterParams(self, params, seaInstance): ret = {} allowedParams = seaInstance.getAllowedParams() for param in allowedParams: if param in params: ret[param] = params[param] else: ret[param] = '' return ret def _process(self): params = self._filterParams(self._params, self._seAdapter) result = self._seAdapter.process(params) if result is not None: wp_class = WPSearchResultConference if isinstance(self._target, Conference) else WPSearchResultCategory return wp_class(self, self._target, WSearchResult, self._seAdapter).display(**result)
class RHSearchBase(RHCustomizable): _url = r"^/search/?$" def _checkProtection(self): if not PluginsHolder().hasPluginType("search"): raise PluginError(_("Search plugin is not active.")) def _getTarget(self): try: self._target = self._conf = ConferenceHolder().getById( self._params.get("confId", "")) except: self._target = CategoryManager().getById( self._params.get('categId', 0)) def _checkParams(self, params): self._params = params self._getTarget() self._seAdapter = SearchRegister().getDefaultSearchEngineAgent()( target=self._target, page=int(params.get('page', 1)), userLoggedIn=self.getAW().getUser() != None) def _filterParams(self, params, seaInstance): ret = {} allowedParams = seaInstance.getAllowedParams() for param in allowedParams: if param in params: ret[param] = params[param] else: ret[param] = '' return ret def _process(self): params = self._filterParams(self._params, self._seAdapter) result = self._seAdapter.process(params) if result is not None: wp_class = WPSearchResultConference if isinstance( self._target, Conference) else WPSearchResultCategory return wp_class(self, self._target, WSearchResult, self._seAdapter).display(**result)
def getVars(self): vars = WTemplated.getVars(self) vars["defaultSearchEngine"] = SearchRegister( ).getDefaultSearchEngineAgentName() return vars
def fillConferenceHeader(self, obj, params): # Search box, in case search is active defaultSearchEngine = SearchRegister().getDefaultSearchEngineAgent() if params["dm"].getSearchEnabled() and defaultSearchEngine is not None and defaultSearchEngine.isActive(): params["searchBox"] = WMiniSearchBox.forModule(defaultSearchEngine.getImplementationPackage(), params.get("confId", 0)).getHTML()
def fillCategoryHeader(self, obj, params): # Search box, in case search is active defaultSearchEngine = SearchRegister().getDefaultSearchEngineAgent() if defaultSearchEngine is not None and defaultSearchEngine.isActive(): params["searchBox"] = WSearchBox.forModule(defaultSearchEngine.getImplementationPackage(), params.get("categId", 0)).getHTML()
def _checkParams( self, params ): self._params = params self._getTarget() self._seAdapter = SearchRegister().getDefaultSearchEngineAgent()(target=self._target, page=int(params.get('page', 1)), userLoggedIn=self.getAW().getUser() != None)