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

Christian Bauer christian at hibernate.org
Tue Mar 20 21:24:49 EDT 2007


  User: cbauer  
  Date: 07/03/20 21:24:49

  Modified:    examples/wiki/src/main/org/jboss/seam/wiki/core/ui 
                        WikiUtil.java
  Log:
  Basic blog directory plugin
  
  Revision  Changes    Path
  1.5       +22 -11    jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/WikiUtil.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: WikiUtil.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/WikiUtil.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -b -r1.4 -r1.5
  --- WikiUtil.java	20 Mar 2007 18:40:32 -0000	1.4
  +++ WikiUtil.java	21 Mar 2007 01:24:49 -0000	1.5
  @@ -50,22 +50,33 @@
                  );
       }
   
  -    // Allow calling this as a Facelets function in pages
       public static String renderURL(Node node) {
  +        if (isFile(node)) return renderFileLink((File)node);
           GlobalPreferences globalPrefs = (GlobalPreferences) Component.getInstance("globalPrefs");
  -        String contextPath = FacesContext.getCurrentInstance().getExternalContext().getRequestContextPath();
  -
  -        if (isFile(node)) {
  -            return contextPath + "/files/download?fileId=" + node.getId();
  +        if (globalPrefs.getDefaultURLRendering().equals(GlobalPreferences.URLRendering.PERMLINK)) {
  +            return renderPermLink(node);
  +        } else {
  +            return renderWikiLink(node);
  +        }
           }
   
  -        if (globalPrefs.getDefaultURLRendering().equals(GlobalPreferences.URLRendering.PERMLINK)) {
  +    public static String renderPermLink(Node node) {
  +        if (isFile(node)) return renderFileLink((File)node);
  +        GlobalPreferences globalPrefs = (GlobalPreferences) Component.getInstance("globalPrefs");
  +        String contextPath = FacesContext.getCurrentInstance().getExternalContext().getRequestContextPath();
               return contextPath + "/" + node.getId() + globalPrefs.getPermlinkSuffix();
  -        } else {
  +    }
  +
  +    public  static String renderWikiLink(Node node) {
  +        String contextPath = FacesContext.getCurrentInstance().getExternalContext().getRequestContextPath();
               if (node.getArea().getWikiname().equals(node.getWikiname()))
                   return contextPath + "/" + node.getArea().getWikiname();
               return contextPath + "/" + node.getArea().getWikiname()  + "/" + node.getWikiname();
           }
  +
  +    private static String renderFileLink(File file) {
  +        String contextPath = FacesContext.getCurrentInstance().getExternalContext().getRequestContextPath();
  +        return contextPath + "/files/download?fileId=" + file.getId();
       }
   
       // Creates clean alphanumeric UpperCaseCamelCase
  
  
  



More information about the jboss-cvs-commits mailing list