portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tay...@apache.org
Subject cvs commit: jakarta-jetspeed/src/java/org/apache/jetspeed/modules/pages JetspeedTemplatePage.java
Date Mon, 04 Jun 2001 07:18:36 GMT
taylor      01/06/04 00:18:36

  Modified:    src/java/org/apache/jetspeed/modules/pages
                        JetspeedTemplatePage.java
  Log:
  JetspeedTemplatePage updated to use locator(profiler) service
  
  Revision  Changes    Path
  1.10      +18 -57    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.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- JetspeedTemplatePage.java	2001/04/26 11:12:47	1.9
  +++ JetspeedTemplatePage.java	2001/06/04 07:18:36	1.10
  @@ -71,8 +71,8 @@
   import org.apache.jetspeed.util.MimeType;
   import org.apache.jetspeed.capability.CapabilityMap;
   import org.apache.jetspeed.capability.CapabilityMapFactory;
  +import org.apache.jetspeed.services.Profiler;
   
  -
   //<Temporary FIX: new turbine will make it obsolete>        
   import org.apache.turbine.services.localization.LocaleDetector;
   //</Temporary FIX: new turbine will make it obsolete>        
  @@ -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.9 2001/04/26 11:12:47 ingo Exp $
  + * @version $Id: JetspeedTemplatePage.java,v 1.10 2001/06/04 07:18:36 taylor Exp $
    */
   public class JetspeedTemplatePage extends DefaultPage
   {
  @@ -144,73 +144,34 @@
           // is hardcoded into the Screen in this instance.  In this case this
           // action is skipped.
   
  -//<Temporary FIX: I don't now, why we still need this: the problem is that on logout,

  -//                the user object is replaced by an anynomous user - and we loose the locale
  -//                information that we set in the session validator.
  -//                However, with TDKa13, the sessionvalidator is called _after_ the logout
action
  -//                so I don't understand, why we still need this..?
  -		
  -        // Get the locale store it in the user object
  -        Locale tmplocale = LocaleDetector.getLocale(data);
  -        if (tmplocale == null) {
  -            tmplocale = new Locale(
  -                     TurbineResources.getString("locale.default.language", "en"),
  -                     TurbineResources.getString("locale.default.country", "US"));
  -        }
  -             data.getUser().setTemp("locale", tmplocale);
  -//</Temporary FIX>                
  -
           // 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);
  -
  -        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("/").append(language);
  -        if ((country != null) && (country.length() > 0)) 
  -            templatePath.append("/").append(country);
  -            
  -        if (!template.startsWith("/"))
  -            templatePath.append("/");
  -
  -        template = templatePath.append(template).toString();
  -        data.setScreenTemplate( template );
  -        Log.note("JetspeedTemplatePage: calculated template = " + template);
  +        //Log.note("JetspeedTemplatePage: requested template = " + template);
   
  +        // get real path now - this is a fix to get us thru 1.3a2
  +        // when the TurbineTemplateService can locate resources by NLS and mediatype,
  +        // then it can be removed
  +
  +        String locatedScreen = Profiler.locateScreenTemplate(data, template);
  +        data.setScreenTemplate( locatedScreen );
  +        Log.note("JetspeedTemplatePage: calculated template = " + locatedScreen);
   
           // -----------------------------------------------------------
           // Get screen and layout template (first screen then layout!!) 
           // and the correct Screen from the template service
           // -----------------------------------------------------------
   
  -        String screenTemplate = TurbineTemplate.getScreenTemplateName(template);
  -        Log.note("JetspeedTemplatePage: screenTemplate is finally " + screenTemplate);
  -        data.setScreenTemplate( screenTemplate );
  -
  -        String layoutTemplate = TurbineTemplate.getLayoutTemplateName(template);
  -        data.setLayoutTemplate(layoutTemplate);
  -        Log.note("JetspeedTemplatePage: layoutTemplate is finally " + layoutTemplate);
  +        //String screenTemplate = TurbineTemplate.getScreenTemplateName(located);
  +        //Log.note("JetspeedTemplatePage: screenTemplate is finally " + screenTemplate);
  +        //data.setScreenTemplate( screenTemplate );
  +
  +        String layout = Profiler.locateLayoutTemplate(data, template);
  +        data.setLayoutTemplate(layout);
  +//        Log.note("JetspeedTemplatePage: layoutTemplate is finally " + layoutTemplate);
   
           if ( !data.hasScreen() )
           {
  @@ -222,7 +183,7 @@
                       "services.TurbineTemplateService.default.screen \n" +
                       "property was not set.");
               }
  -            data.setScreen(screen);
  +            data.setScreenTemplate(screen);
           }
       }
       
  
  
  

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