예제 #1
0
 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()
예제 #2
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)
예제 #3
0
 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()
예제 #4
0
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)
예제 #5
0
파일: chrome.py 프로젝트: sylvestre/indico
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)
예제 #6
0
 def getVars(self):
     vars = WTemplated.getVars(self)
     vars["defaultSearchEngine"] = SearchRegister(
     ).getDefaultSearchEngineAgentName()
     return vars
예제 #7
0
 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()
예제 #8
0
 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()
예제 #9
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)