Changeset 26426 for main

Show
Ignore:
Timestamp:
31.10.2012 10:45:59 (7 years ago)
Author:
sjm84
Message:

Some tidying

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/core/TransformingReceptionist.java

    r26334 r26426  
    4545public class TransformingReceptionist extends Receptionist 
    4646{ 
     47    protected static final int CONFIG_PASS = 1; 
     48    protected static final int TEXT_PASS = 2; 
    4749 
    4850    static Logger logger = Logger.getLogger(org.greenstone.gsdl3.core.TransformingReceptionist.class.getName()); 
     
    923925 
    924926        GSXSLT.inlineImportAndIncludeFiles(skinAndLibraryDoc, null, (String) this.config_params.get(GSConstants.SITE_NAME), collection, (String) this.config_params.get(GSConstants.INTERFACE_NAME), base_interfaces); 
    925         skinAndLibraryDoc = (Document) performTextFormatPass(collection, skinAndLibraryDoc, doc, new UserContext(request)); 
    926         skinAndLibraryDoc = (Document) performConfigFormatPass(collection, skinAndLibraryDoc, doc, new UserContext(request)); 
     927        skinAndLibraryDoc = (Document) performFormatPass(collection, skinAndLibraryDoc, doc, new UserContext(request), TEXT_PASS); 
     928        skinAndLibraryDoc = (Document) performFormatPass(collection, skinAndLibraryDoc, doc, new UserContext(request), CONFIG_PASS); 
    927929 
    928930        if (_debug) 
     
    950952    } 
    951953 
    952     protected Node performConfigFormatPass(String collection, Document skinAndLibraryDoc, Document doc, UserContext userContext) 
    953     { 
    954         String configStylesheet_file = GSFile.stylesheetFile(GlobalProperties.getGSDL3Home(), (String) this.config_params.get(GSConstants.SITE_NAME), collection, (String) this.config_params.get(GSConstants.INTERFACE_NAME), base_interfaces, "config_format.xsl"); 
    955         Document configStylesheet_doc = this.converter.getDOM(new File(configStylesheet_file)); 
    956  
    957         if (configStylesheet_doc != null) 
    958         { 
    959             return this.transformer.transform(configStylesheet_doc, skinAndLibraryDoc, config_params); 
    960         } 
    961         return skinAndLibraryDoc; 
    962     } 
    963  
    964     protected Node performTextFormatPass(String collection, Document skinAndLibraryDoc, Document doc, UserContext userContext) 
    965     { 
    966         String configStylesheet_file = GSFile.stylesheetFile(GlobalProperties.getGSDL3Home(), (String) this.config_params.get(GSConstants.SITE_NAME), collection, (String) this.config_params.get(GSConstants.INTERFACE_NAME), base_interfaces, "text_fragment_format.xsl"); 
     954    protected Node performFormatPass(String collection, Document skinAndLibraryDoc, Document doc, UserContext userContext, int pass) 
     955    { 
     956        String formatFile; 
     957        if (pass == CONFIG_PASS) 
     958        { 
     959            formatFile = "config_format.xsl"; 
     960        } 
     961        else 
     962        { 
     963            formatFile = "text_fragment_format.xsl"; 
     964        } 
     965        String configStylesheet_file = GSFile.stylesheetFile(GlobalProperties.getGSDL3Home(), (String) this.config_params.get(GSConstants.SITE_NAME), collection, (String) this.config_params.get(GSConstants.INTERFACE_NAME), base_interfaces, formatFile); 
    967966        Document configStylesheet_doc = this.converter.getDOM(new File(configStylesheet_file)); 
    968967