[jboss-cvs] jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/ui ...

Christian Bauer christian at hibernate.org
Sat Aug 25 13:59:25 EDT 2007


  User: cbauer  
  Date: 07/08/25 13:59:25

  Modified:    examples/wiki/src/main/org/jboss/seam/wiki/core/ui    
                        WikiFormattedTextHandler.java Converters.java
                        UIWikiFormattedText.java FileServlet.java
  Log:
  Major refactoring of navigation
  
  Revision  Changes    Path
  1.11      +3 -4      jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/WikiFormattedTextHandler.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: WikiFormattedTextHandler.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/WikiFormattedTextHandler.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -b -r1.10 -r1.11
  --- WikiFormattedTextHandler.java	17 Aug 2007 13:00:29 -0000	1.10
  +++ WikiFormattedTextHandler.java	25 Aug 2007 17:59:25 -0000	1.11
  @@ -220,14 +220,13 @@
   
       /*
        * If this plugin has preferences and editing is enabled, instantiate a
  -     * plugin preferences editor and put it in the PAGE context
  +     * plugin preferences editor and put it in the conversation context
        */
       private void createPreferencesEditor(String macroName) {
   
           String pluginPreferenceName = macroName + "Preferences";
  -        Boolean showPluginPreferences = (Boolean) Component.getInstance("showPluginPreferences");
  -        Object existingEditor = Contexts.getConversationContext()
  -                .get(pluginPreferenceName + "Editor");
  +        Boolean showPluginPreferences = (Boolean) Contexts.getPageContext().get("showPluginPreferences");
  +        Object existingEditor = Contexts.getConversationContext().get(pluginPreferenceName + "Editor");
           if (showPluginPreferences != null && showPluginPreferences && existingEditor == null) {
               PluginPreferenceEditor pluginPreferenceEditor = new PluginPreferenceEditor(
                       pluginPreferenceName);
  
  
  
  1.9       +11 -12    jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/Converters.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: Converters.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/Converters.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -b -r1.8 -r1.9
  --- Converters.java	17 Aug 2007 13:00:29 -0000	1.8
  +++ Converters.java	25 Aug 2007 17:59:25 -0000	1.9
  @@ -6,19 +6,14 @@
    */
   package org.jboss.seam.wiki.core.ui;
   
  +import org.jboss.seam.Component;
  +import org.jboss.seam.ScopeType;
   import org.jboss.seam.annotations.Name;
  +import org.jboss.seam.annotations.Scope;
   import org.jboss.seam.annotations.Transactional;
  -import org.jboss.seam.annotations.Factory;
   import org.jboss.seam.wiki.core.model.Role;
  -import org.jboss.seam.wiki.core.model.Node;
  -import org.jboss.seam.wiki.core.model.Directory;
  -import org.jboss.seam.wiki.core.search.metamodel.SearchableEntity;
   import org.jboss.seam.wiki.core.search.metamodel.SearchRegistry;
  -import org.jboss.seam.wiki.util.WikiUtil;
  -import org.jboss.seam.Component;
  -import org.jboss.seam.ScopeType;
  -import org.jboss.seam.security.Identity;
  -import org.richfaces.component.TreeNode;
  +import org.jboss.seam.wiki.core.search.metamodel.SearchableEntity;
   
   import javax.faces.component.UIComponent;
   import javax.faces.context.FacesContext;
  @@ -26,12 +21,16 @@
   import javax.faces.convert.ConverterException;
   import java.io.Serializable;
   import java.util.List;
  -import java.util.Map;
  -import java.util.Iterator;
  -import java.util.LinkedHashMap;
  +
  + at Name("converters")
  + at Scope(ScopeType.APPLICATION)
   
   public class Converters {
   
  +    public String[] getMonthNames() {
  +        return new String[]{"NULL","January","February","March","April","May","June","July","August","September","October","November","December"};
  +    }
  +
       @Name("searchableEntityConverter")
       @org.jboss.seam.annotations.faces.Converter(forClass = SearchableEntity.class)
       public static class SearchableEntityConverter implements Converter, Serializable {
  
  
  
  1.27      +4 -5      jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/UIWikiFormattedText.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: UIWikiFormattedText.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/UIWikiFormattedText.java,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -b -r1.26 -r1.27
  --- UIWikiFormattedText.java	17 Aug 2007 13:00:29 -0000	1.26
  +++ UIWikiFormattedText.java	25 Aug 2007 17:59:25 -0000	1.27
  @@ -95,11 +95,11 @@
   
               public String renderExternalLink(WikiLink externalLink) {
                   return "<a href=\""
  -                        + WikiUtil.escapeEmailAddress(externalLink.getUrl())
  +                        + WikiUtil.escapeEmailURL(externalLink.getUrl())
                           + "\" class=\""
                           + (externalLink.isBroken() ? getAttributes().get(ATTR_BROKEN_LINK_STYLE_CLASS)
                           : getAttributes().get(ATTR_LINK_STYLE_CLASS)) + "\">"
  -                        + WikiUtil.escapeEmailAddress(externalLink.getDescription()) + "</a>";
  +                        + WikiUtil.escapeEmailURL(externalLink.getDescription()) + "</a>";
               }
   
               public String renderFileAttachmentLink(int attachmentNumber, WikiLink attachmentLink) {
  @@ -112,12 +112,11 @@
   
               public String renderThumbnailImageInlineLink(WikiLink inlineLink) {
                   File file = (File) inlineLink.getNode();
  -                Conversation conversation = (Conversation) Component.getInstance("conversation");
   
                   if (file.getImageMetaInfo().getThumbnail() == 'F') {
                       // Full size display, no thumbnail
   
  -                    String imageUrl = WikiUtil.renderURL(inlineLink.getNode()) + "&amp;cid=" + conversation.getId();
  +                    String imageUrl = WikiUtil.renderURL(inlineLink.getNode()) + "&amp;cid=" + Conversation.instance().getId();
                       return "<img src='"+ imageUrl + "'" +
                               " width='"+ file.getImageMetaInfo().getSizeX()+"'" +
                               " height='"+ file.getImageMetaInfo().getSizeY() +"'/>";
  @@ -127,7 +126,7 @@
                       // I have no idea why this needs HTML entities for the & symbol -
                       // Firefox complains about invalid XML if an & is in an attribute
                       // value!
  -                    String thumbnailUrl = WikiUtil.renderURL(inlineLink.getNode()) + "&amp;thumbnail=true&amp;cid=" + conversation.getId();
  +                    String thumbnailUrl = WikiUtil.renderURL(inlineLink.getNode()) + "&amp;thumbnail=true&amp;cid=" + Conversation.instance().getId();
   
                       return "<a href=\""
                               + (inlineLink.isBroken() ? inlineLink.getUrl() : WikiUtil.renderURL(inlineLink
  
  
  
  1.9       +9 -0      jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/FileServlet.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: FileServlet.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/FileServlet.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -b -r1.8 -r1.9
  --- FileServlet.java	12 Jun 2007 17:51:00 -0000	1.8
  +++ FileServlet.java	25 Aug 2007 17:59:25 -0000	1.9
  @@ -115,6 +115,15 @@
   
               if (data != null) {
                   response.setContentType(contentType);
  +                response.setContentLength(data.length);
  +                // If it's not a picture or if it's a picture that is an attachment, tell the browser to download
  +                // the file instead of displaying it
  +                // TODO: What about PDFs? Lot's of people want to show PDFs inline...
  +                if ( file.getImageMetaInfo() == null ||
  +                     (file.getImageMetaInfo() != null && file.getImageMetaInfo().getThumbnail() == 'A')
  +                    ) {
  +                    response.setHeader("Content-Disposition", "attachement; filename=\"" + file.getFilename() + "\"" );
  +                }
                   response.getOutputStream().write(data);
               }
   
  
  
  



More information about the jboss-cvs-commits mailing list