Ignore:
Timestamp:
2011-04-29T13:19:47+12:00 (13 years ago)
Author:
sjm84
Message:

Several improvements including fixing realistic books and fixing the client-side xslt interface naming issue

File:
1 edited

Legend:

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

    r23839 r23968  
    205205    else if(excerptTag != null)
    206206    {
     207        /*
    207208        // define a list
    208209       
    209210        Node selectedElement = modifyNodesByTagRecursive(transformed_page, excerptTag);
     211        */
     212       
     213        Node selectedElement = getNodeByTagRecursive(transformed_page, excerptTag);
    210214        return selectedElement;
     215       
    211216    }
    212217    return transformed_page;
     
    285290  protected Node transformPage(Element page) {
    286291   
    287      boolean allowsClientXSLT = (Boolean)config_params.get(GSConstants.ALLOW_CLIENT_SIDE_XSLT);
    288      //System.out.println("Client side transforms allowed? " + allowsClientXSLT);
    289      
    290      // Force it back to traditional
    291      if(!allowsClientXSLT)
    292         config_params.put(GSConstants.INTERFACE_NAME, "traditional");
    293    
    294      Element request = (Element)GSXML.getChildByTagName(page, GSXML.PAGE_REQUEST_ELEM);
    295      String output = request.getAttribute(GSXML.OUTPUT_ATT);   
    296      
    297      String currentInterface = (String)config_params.get(GSConstants.INTERFACE_NAME);
    298      //System.out.println("Current output mode is: " + output + ", current interface name is: " + currentInterface);
    299      
    300      if(allowsClientXSLT) {
    301          if((currentInterface.equals("default") && output.equals("html")) || output.equals("server"))
    302            // Switch the interface
    303            config_params.put(GSConstants.INTERFACE_NAME, "traditional");
    304          else if(currentInterface.equals("traditional") && !output.equals("html"))
    305            // The reverse needs to happen too
    306            config_params.put(GSConstants.INTERFACE_NAME, "default");
     292    boolean allowsClientXSLT = (Boolean)config_params.get(GSConstants.ALLOW_CLIENT_SIDE_XSLT);
     293    //System.out.println("Client side transforms allowed? " + allowsClientXSLT);
     294
     295    String currentInterface = (String)config_params.get(GSConstants.INTERFACE_NAME);
     296
     297    Element request = (Element)GSXML.getChildByTagName(page, GSXML.PAGE_REQUEST_ELEM);
     298    String output = request.getAttribute(GSXML.OUTPUT_ATT);
     299
     300    //System.out.println("Current output mode is: " + output + ", current interface name is: " + currentInterface);
     301
     302    if(allowsClientXSLT) {
     303        if(!currentInterface.endsWith(GSConstants.CLIENT_SIDE_XSLT_INTERFACE_SUFFIX) && output.equals("html"))
     304        {
     305            System.out.println("output is html and we are not currently using a client side version, switching");
     306            // Switch the interface
     307            config_params.put(GSConstants.INTERFACE_NAME, currentInterface.concat(GSConstants.CLIENT_SIDE_XSLT_INTERFACE_SUFFIX));
     308        }
     309        else if((currentInterface.endsWith(GSConstants.CLIENT_SIDE_XSLT_INTERFACE_SUFFIX) && !output.equals("html")) || output.equals("server"))
     310        {
     311            // The reverse needs to happen too
     312            config_params.put(GSConstants.INTERFACE_NAME, currentInterface.substring(0, currentInterface.length() - GSConstants.CLIENT_SIDE_XSLT_INTERFACE_SUFFIX.length()));
     313        }
     314    }
     315    else if (currentInterface.endsWith(GSConstants.CLIENT_SIDE_XSLT_INTERFACE_SUFFIX))
     316    {
     317        config_params.put(GSConstants.INTERFACE_NAME, currentInterface.substring(0, currentInterface.length() - GSConstants.CLIENT_SIDE_XSLT_INTERFACE_SUFFIX.length()));
    307318    }
    308319   
     
    773784    String stylesheet = GSFile.stylesheetFile(GlobalProperties.getGSDL3Home(), (String)this.config_params.get(GSConstants.SITE_NAME), collection, (String)this.config_params.get(GSConstants.INTERFACE_NAME), base_interfaces, name);
    774785    if (stylesheet==null) {
    775       logger.info(" cant find stylesheet for "+name);
    776     }
    777     logger.error("stylesheet:"+stylesheet);
     786      logger.info(" Can't find stylesheet for "+name);
     787    }
     788    logger.debug("Stylesheet: "+stylesheet);
    778789    return stylesheet;
    779790  }
Note: See TracChangeset for help on using the changeset viewer.