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, 08 Mar 2001 16:26:51 GMT
ingo        01/03/08 08:26:51

  Modified:    src/java/org/apache/jetspeed/modules/pages
                        JetspeedTemplatePage.java
  Log:
  [MLS] Multi- markup & language support. First "simple" implementation.
  
  Revision  Changes    Path
  1.4       +31 -14    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.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- JetspeedTemplatePage.java	2001/03/07 06:44:14	1.3
  +++ JetspeedTemplatePage.java	2001/03/08 16:26:43	1.4
  @@ -120,7 +120,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.3 2001/03/07 06:44:14 taylor Exp $
  + * @version $Id: JetspeedTemplatePage.java,v 1.4 2001/03/08 16:26:43 ingo Exp $
    */
   public class JetspeedTemplatePage extends DefaultPage
   {
  @@ -143,27 +143,44 @@
               data.setScreenTemplate( "Ecs" );
   
           String template = data.getTemplateInfo().getScreenTemplate();
  -        if ( template.indexOf(".") == -1 ) 
  +        
  +        Log.note("JetspeedTemplatePage: requested template = " + template);
  +        if ( !template.startsWith( "/" ) )
           {
  -            template = template + "." + TurbineTemplate.getDefaultExtension();
  -            data.setScreenTemplate( template );
  -        }
  -
  -        CapabilityMap cm = CapabilityMapFactory.getCapabilityMap( data );
  +            StringBuffer templatePath = new StringBuffer("/");
   
  -        // set the content type (including charset)
  -        data.setContentType( cm.getPreferredType().toString() );  
  -
  -        String type = MimeType.getCode( cm.getPreferredType() );
  -        if ( !template.startsWith( type + "/" ) )
  -        {
  -            template = type + "/" + template;
  +            // 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("/");
  +		
  +            // 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("/");
  +            
  +            template = templatePath.append(template).toString();
               data.setScreenTemplate( template );
  +            Log.note("JetspeedTemplatePage: calculated template = " + template);
           }
   
           // Get the layout template and the correct Screen.
           String layoutTemplate = TurbineTemplate.getLayoutTemplateName(template);
           data.getTemplateInfo().setLayoutTemplate(layoutTemplate);
  +        
  +        String screenTemplate = ( (org.apache.jetspeed.services.template.JetspeedTemplateService)
  +                                  TurbineServices.getInstance().
  +                                  getService(org.apache.turbine.services.template.TemplateService.SERVICE_NAME)
)
  +                                .getScreenTemplateName(template);
  +// FIX ME with new TURBINE        String screenTemplate = TurbineTemplate.getScreenTemplateName(template);
  +        Log.note("JetspeedTemplatePage: screenTemplate is finally " + screenTemplate);
  +        data.setScreenTemplate( screenTemplate );
   
           if ( !data.hasScreen() )
           {
  
  
  

---------------------------------------------------------------------
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