portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From i...@apache.org
Subject cvs commit: jakarta-jetspeed/src/java/org/apache/jetspeed/modules/pages JetspeedTemplatePage.java
Date Thu, 26 Apr 2001 11:12:49 GMT
ingo        01/04/26 04:12:49

  Modified:    src/java/org/apache/jetspeed/modules/pages
                        JetspeedTemplatePage.java
  Log:
  better solution for the "template=/Ecs.jsp" problem:
  JetspeedTemplate page can now handle it.
  
  Revision  Changes    Path
  1.9       +38 -26    jakarta-jetspeed/src/java/org/apache/jetspeed/modules/pages/JetspeedTemplatePage.java
  
  Index: JetspeedTemplatePage.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/modules/pages/JetspeedTemplatePage.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- JetspeedTemplatePage.java	2001/04/04 07:38:23	1.8
  +++ JetspeedTemplatePage.java	2001/04/26 11:12:47	1.9
  @@ -125,7 +125,7 @@
    *
    * @author <a href="mailto:john.mcnally@clearink.com">John D. McNally</a>
    * @author <a href="mailto:mbryson@mont.mindspring.com">Dave Bryson</a>
  - * @version $Id: JetspeedTemplatePage.java,v 1.8 2001/04/04 07:38:23 ingo Exp $
  + * @version $Id: JetspeedTemplatePage.java,v 1.9 2001/04/26 11:12:47 ingo Exp $
    */
   public class JetspeedTemplatePage extends DefaultPage
   {
  @@ -160,38 +160,50 @@
                data.getUser().setTemp("locale", tmplocale);
   //</Temporary FIX>                
   
  -        if ( data.hasScreen() )
  +        // if only a screen but no template is specified, then we need to display
  +        // a legacy ecs screen --> screenTemplate = ECS
  +        if ( data.hasScreen() && (data.getTemplateInfo().getScreenTemplate() ==
null) )
               data.setScreenTemplate( "Ecs" );
   
  +
  +        // ------------------------------------------------------------
  +        // Build up the path that will be searched for th template file
  +        // ------------------------------------------------------------
  +
           String template = data.getTemplateInfo().getScreenTemplate();
  -        
           Log.note("JetspeedTemplatePage: requested template = " + template);
  -        if ( !template.startsWith( "/" ) )
  -        {
  -            StringBuffer templatePath = new StringBuffer("/");
  -
  -            // set the content type (including charset)
  -            CapabilityMap cm = CapabilityMapFactory.getCapabilityMap( data );
  -            String type = MimeType.getCode( cm.getPreferredType() );
  -            data.setContentType( cm.getPreferredType().toString() );  
  -            if ((type != null) && (type.length() > 0)) 
  -                templatePath.append(type).append("/");
  +
  +        StringBuffer templatePath = new StringBuffer();
  +
  +        // set the content type (including charset)
  +        CapabilityMap cm = CapabilityMapFactory.getCapabilityMap( data );
  +        String type = MimeType.getCode( cm.getPreferredType() );
  +        data.setContentType( cm.getPreferredType().toString() );  
  +        if ((type != null) && (type.length() > 0)) 
  +            templatePath.append("/").append(type);
   		
  -            // Grab the Locale from the temporary storage in the User object
  -            Locale locale = (Locale)data.getUser().getTemp("locale");
  -            String language = locale.getLanguage();
  -            String country = locale.getCountry();
  -            if ((language != null) && (language.length() > 0)) 
  -                templatePath.append(language).append("/");
  -            if ((country != null) && (country.length() > 0)) 
  -                templatePath.append(country).append("/");
  +        // Grab the Locale from the temporary storage in the User object
  +        Locale locale = (Locale)data.getUser().getTemp("locale");
  +        String language = locale.getLanguage();
  +        String country = locale.getCountry();
  +        if ((language != null) && (language.length() > 0)) 
  +            templatePath.append("/").append(language);
  +        if ((country != null) && (country.length() > 0)) 
  +            templatePath.append("/").append(country);
               
  -            template = templatePath.append(template).toString();
  -            data.setScreenTemplate( template );
  -            Log.note("JetspeedTemplatePage: calculated template = " + template);
  -        }
  +        if (!template.startsWith("/"))
  +            templatePath.append("/");
  +
  +        template = templatePath.append(template).toString();
  +        data.setScreenTemplate( template );
  +        Log.note("JetspeedTemplatePage: calculated template = " + template);
  +
  +
  +        // -----------------------------------------------------------
  +        // Get screen and layout template (first screen then layout!!) 
  +        // and the correct Screen from the template service
  +        // -----------------------------------------------------------
   
  -        // Get screen and layout template (first screen then layout!!) and the correct
Screen.
           String screenTemplate = TurbineTemplate.getScreenTemplateName(template);
           Log.note("JetspeedTemplatePage: screenTemplate is finally " + screenTemplate);
           data.setScreenTemplate( screenTemplate );
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org


Mime
View raw message