Changeset 32549

Show
Ignore:
Timestamp:
30.10.2018 10:30:53 (3 weeks ago)
Author:
kjdon
Message:

receptionist now passes languageList (from interfaceConfig) to teh actions, so an action can add it into the page response if it needs to, rather than the receptionist adding it in to every page. its only ever used in prefs page

Location:
main/trunk/greenstone3/src/java/org/greenstone/gsdl3
Files:
5 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/action/Action.java

    r32448 r32549  
    2727    protected HashMap<String, Object> config_params = null; 
    2828     
    29      
     29  /** the xml element languageList */ 
     30  protected Element language_list = null; 
    3031    /** a converter class to parse XML and create Docs */ 
    3132    protected XMLConverter converter = null; 
     
    5859    } 
    5960 
     61  /** give the action access to the list of languages */ 
     62  public void setLanguageList(Element lang_list) { 
     63    this.language_list = lang_list; 
     64  } 
    6065    public boolean configure() 
    6166    { 
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/action/PageAction.java

    r32141 r32549  
    5858        else if (page_name.equals(ABOUT_PAGE) || page_name.equals(PREFS_PAGE)) 
    5959        { 
    60           response = aboutPage(request); 
     60          response = aboutOrPrefsPage(request, page_name); 
    6161            //}else if (page_name.equals(PREFS_PAGE)) { 
    6262            //response = prefsPage(request); 
     
    227227    } // homePage 
    228228 
    229     protected Element aboutPage(Element request) 
     229  protected Element aboutOrPrefsPage(Element request, String page_name) 
    230230    { 
    231231      Document doc = XMLConverter.newDOM(); 
     
    239239        if (coll_name == null || coll_name.equals("")) 
    240240        { 
    241             logger.error("about page requested with no collection or cluster specified!"); 
    242             // return an empty response 
     241          // return a response with no collection info - must be prefs from home page 
    243242            Element response = doc.createElement(GSXML.RESPONSE_ELEM); 
    244243            addSiteMetadata(response, userContext); 
    245244            addInterfaceOptions(response); 
     245            if (this.language_list != null) { 
     246              response.appendChild(doc.importNode(this.language_list, true)); 
     247            } 
    246248            return response; 
    247249        } 
     
    303305        addSiteMetadata(response, userContext); 
    304306        addInterfaceOptions(response); 
     307        if (page_name.equals(PREFS_PAGE) && this.language_list != null) { 
     308          response.appendChild(response.getOwnerDocument().importNode(this.language_list, true)); 
     309        } 
    305310        return response; 
    306311    } 
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/core/DefaultReceptionist.java

    r28966 r32549  
    7171        boolean get_service_description = false; 
    7272        Element page_response = (Element) GSXML.getChildByTagName(page, GSXML.PAGE_RESPONSE_ELEM); 
    73         if (this.language_list != null) 
    74         { 
    75           page_response.appendChild(doc.importNode(this.language_list, true)); 
    76         } 
     73 
    7774        Element coll_description = (Element) GSXML.getChildByTagName(page_response, GSXML.COLLECTION_ELEM); 
    7875        if (coll_description == null) 
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/core/Receptionist.java

    r32366 r32549  
    133133        setUpInterfaceOptions(config_elem); 
    134134 
     135        this.language_list = (Element) GSXML.getChildByTagName(config_elem, "languageList"); 
     136        if (this.language_list == null) 
     137        { 
     138            logger.error(" didn't find a language list in the config file!!"); 
     139        } 
     140         
    135141        // load up the actions 
    136142        Element action_list = (Element) GSXML.getChildByTagName(config_elem, GSXML.ACTION_ELEM + GSXML.LIST_MODIFIER); 
     
    157163            ac.configure(); 
    158164            ac.addActionParameters(this.params); 
     165            ac.setLanguageList(this.language_list); 
    159166            this.action_map.put(action_name, ac); 
    160167        } 
    161168 
    162         this.language_list = (Element) GSXML.getChildByTagName(config_elem, "languageList"); 
    163         if (language_list == null) 
    164         { 
    165             logger.error(" didn't find a language list in the config file!!"); 
    166         } 
    167169 
    168170        return true; 
     
    230232                ac.configure(); 
    231233                ac.addActionParameters(this.params); 
     234                ac.setLanguageList(this.language_list); 
    232235                this.action_map.put(action, ac); 
    233236                a = ac; 
     
    317320        Element p = (Element)params.item(j); 
    318321        if (!p.getAttribute(GSXML.SENSITIVE_ATT).equals("")) { 
    319           logger.error("removing param "+p.getAttribute("name")); 
     322          logger.debug("removing param "+p.getAttribute("name")); 
    320323          param_list.removeChild(p); 
    321324        } 
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/core/TransformingReceptionist.java

    r31871 r32549  
    133133        setUpInterfaceOptions(config_elem); 
    134134 
     135        Element lang_list = (Element) GSXML.getChildByTagName(config_elem, "languageList"); 
     136        if (lang_list == null) 
     137        { 
     138            logger.error(" didn't find a language list in the config file!!"); 
     139        } 
     140        else 
     141        { 
     142          this.language_list = lang_list; 
     143        } 
     144         
    135145        Element action_list = (Element) GSXML.getChildByTagName(config_elem, GSXML.ACTION_ELEM + GSXML.LIST_MODIFIER); 
    136146        NodeList actions = action_list.getElementsByTagName(GSXML.ACTION_ELEM); 
     
    156166            ac.configure(); 
    157167            ac.addActionParameters(this.params); 
     168            ac.setLanguageList(this.language_list); 
    158169            this.action_map.put(action_name, ac); 
    159170 
     
    175186                this.xslt_map.put(map_key, subxslt); 
    176187            } 
    177         } 
    178         Element lang_list = (Element) GSXML.getChildByTagName(config_elem, "languageList"); 
    179         if (lang_list == null) 
    180         { 
    181             logger.error(" didn't find a language list in the config file!!"); 
    182         } 
    183         else 
    184         { 
    185           //this.language_list = (Element) this.doc.importNode(lang_list, true); 
    186           this.language_list = lang_list; 
    187188        } 
    188189