Changeset 26325 for main/trunk/greenstone3/src/java/org/greenstone/gsdl3/core/TransformingReceptionist.java
- Timestamp:
- 2012-10-17T13:51:35+13:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/core/TransformingReceptionist.java
r26320 r26325 21 21 import org.greenstone.gsdl3.util.GSFile; 22 22 import org.greenstone.gsdl3.util.GSParams; 23 import org.greenstone.gsdl3.util.GSPath;24 23 import org.greenstone.gsdl3.util.GSXML; 25 24 import org.greenstone.gsdl3.util.GSXSLT; … … 181 180 } 182 181 183 GetRequiredMetadataNamesFromXSLFiles();182 getRequiredMetadataNamesFromXSLFiles(); 184 183 185 184 return true; 186 185 } 187 186 188 protected void GetRequiredMetadataNamesFromXSLFiles()187 protected void getRequiredMetadataNamesFromXSLFiles() 189 188 { 190 189 ArrayList<File> xslFiles = GSFile.getAllXSLFiles((String) this.config_params.get(GSConstants.INTERFACE_NAME), (String) this.config_params.get(GSConstants.SITE_NAME)); … … 345 344 ArrayList<String> requiredMetadata = _metadataRequiredMap.get(stylesheetFile); 346 345 347 if(requiredMetadata !=null){ 348 Element extraMetadataList = this.doc.createElement(GSXML.EXTRA_METADATA + GSXML.LIST_MODIFIER); 349 350 for (String metadataString : requiredMetadata) 351 { 352 Element metadataElem = this.doc.createElement(GSXML.EXTRA_METADATA); 353 metadataElem.setAttribute(GSXML.NAME_ATT, metadataString); 354 extraMetadataList.appendChild(metadataElem); 355 } 356 request.appendChild(request.getOwnerDocument().importNode(extraMetadataList, true)); 357 } 358 } 359 360 protected Node postProcessPage(Element page) 361 { 346 if (requiredMetadata != null) 347 { 348 Element extraMetadataList = this.doc.createElement(GSXML.EXTRA_METADATA + GSXML.LIST_MODIFIER); 349 350 for (String metadataString : requiredMetadata) 351 { 352 Element metadataElem = this.doc.createElement(GSXML.EXTRA_METADATA); 353 metadataElem.setAttribute(GSXML.NAME_ATT, metadataString); 354 extraMetadataList.appendChild(metadataElem); 355 } 356 request.appendChild(request.getOwnerDocument().importNode(extraMetadataList, true)); 357 } 358 } 359 360 protected Node postProcessPage(Element page) 361 { 362 362 // might need to add some data to the page 363 363 addExtraInfo(page); … … 633 633 } 634 634 635 config_params.put("collName", collection); 636 635 637 Document style_doc = getXSLTDocument(action, subaction, collection); 636 638 if (style_doc == null) … … 909 911 910 912 GSXSLT.inlineImportAndIncludeFiles(skinAndLibraryDoc, null, (String) this.config_params.get(GSConstants.SITE_NAME), collection, (String) this.config_params.get(GSConstants.INTERFACE_NAME), base_interfaces); 911 skinAndLibraryDoc = (Document) secondConfigFormatPass(collection, skinAndLibraryDoc, doc, new UserContext(request)); 913 skinAndLibraryDoc = (Document) performTextFormatPass(collection, skinAndLibraryDoc, doc, new UserContext(request)); 914 skinAndLibraryDoc = (Document) performConfigFormatPass(collection, skinAndLibraryDoc, doc, new UserContext(request)); 912 915 913 916 if (_debug) … … 935 938 } 936 939 937 protected Node secondConfigFormatPass(String collection, Document skinAndLibraryDoc, Document doc, UserContext userContext)940 protected Node performConfigFormatPass(String collection, Document skinAndLibraryDoc, Document doc, UserContext userContext) 938 941 { 939 942 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"); 943 Document configStylesheet_doc = this.converter.getDOM(new File(configStylesheet_file)); 944 945 if (configStylesheet_doc != null) 946 { 947 return this.transformer.transform(configStylesheet_doc, skinAndLibraryDoc, config_params); 948 } 949 return skinAndLibraryDoc; 950 } 951 952 protected Node performTextFormatPass(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, "text_fragment_format.xsl"); 940 955 Document configStylesheet_doc = this.converter.getDOM(new File(configStylesheet_file)); 941 956 … … 997 1012 name = this.xslt_map.get(action); 998 1013 } 999 if (name== null) { 1000 // so we can reandomly create any named page 1001 if (action.equals("p") && !subaction.equals("")) { 1002 // TODO: pages/ won't work for interface other than default!! 1003 name="pages/"+subaction+".xsl"; 1004 } 1005 1014 if (name == null) 1015 { 1016 // so we can reandomly create any named page 1017 if (action.equals("p") && !subaction.equals("")) 1018 { 1019 // TODO: pages/ won't work for interface other than default!! 1020 name = "pages/" + subaction + ".xsl"; 1021 } 1022 1006 1023 } 1007 1024 Document finalDoc = GSXSLT.mergedXSLTDocumentCascade(name, (String) this.config_params.get(GSConstants.SITE_NAME), collection, (String) this.config_params.get(GSConstants.INTERFACE_NAME), base_interfaces, _debug);
Note:
See TracChangeset
for help on using the changeset viewer.