continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eveni...@apache.org
Subject svn commit: r384855 - in /maven/continuum/branches/continuum-1.0.x/continuum-web/src/main: java/org/apache/maven/continuum/web/servlet/ java/org/apache/maven/continuum/web/tool/ resources/templates/screens/
Date Fri, 10 Mar 2006 17:17:52 GMT
Author: evenisse
Date: Fri Mar 10 09:17:42 2006
New Revision: 384855

URL: http://svn.apache.org/viewcvs?rev=384855&view=rev
Log:
Refactor working copy. All files are now open in a new window with browse/tunnel servlet.

Modified:
    maven/continuum/branches/continuum-1.0.x/continuum-web/src/main/java/org/apache/maven/continuum/web/servlet/DownloadServlet.java
    maven/continuum/branches/continuum-1.0.x/continuum-web/src/main/java/org/apache/maven/continuum/web/tool/WorkingCopyContentGenerator.java
    maven/continuum/branches/continuum-1.0.x/continuum-web/src/main/resources/templates/screens/WorkingCopy.vm

Modified: maven/continuum/branches/continuum-1.0.x/continuum-web/src/main/java/org/apache/maven/continuum/web/servlet/DownloadServlet.java
URL: http://svn.apache.org/viewcvs/maven/continuum/branches/continuum-1.0.x/continuum-web/src/main/java/org/apache/maven/continuum/web/servlet/DownloadServlet.java?rev=384855&r1=384854&r2=384855&view=diff
==============================================================================
--- maven/continuum/branches/continuum-1.0.x/continuum-web/src/main/java/org/apache/maven/continuum/web/servlet/DownloadServlet.java
(original)
+++ maven/continuum/branches/continuum-1.0.x/continuum-web/src/main/java/org/apache/maven/continuum/web/servlet/DownloadServlet.java
Fri Mar 10 09:17:42 2006
@@ -337,7 +337,7 @@
         }
         else
         {
-            return htmlContent.substring( 0, endA + 1 ) +
+            return htmlContent.substring( 0, endA ) +
                 rewriteHrefInHtml( req, tagName, htmlContent.substring( endA ), fileNameParam
);
         }
     }

Modified: maven/continuum/branches/continuum-1.0.x/continuum-web/src/main/java/org/apache/maven/continuum/web/tool/WorkingCopyContentGenerator.java
URL: http://svn.apache.org/viewcvs/maven/continuum/branches/continuum-1.0.x/continuum-web/src/main/java/org/apache/maven/continuum/web/tool/WorkingCopyContentGenerator.java?rev=384855&r1=384854&r2=384855&view=diff
==============================================================================
--- maven/continuum/branches/continuum-1.0.x/continuum-web/src/main/java/org/apache/maven/continuum/web/tool/WorkingCopyContentGenerator.java
(original)
+++ maven/continuum/branches/continuum-1.0.x/continuum-web/src/main/java/org/apache/maven/continuum/web/tool/WorkingCopyContentGenerator.java
Fri Mar 10 09:17:42 2006
@@ -17,6 +17,8 @@
  */
 
 import org.codehaus.plexus.logging.AbstractLogEnabled;
+import org.codehaus.plexus.summit.pull.RequestTool;
+import org.codehaus.plexus.summit.rundata.RunData;
 import org.codehaus.plexus.util.StringUtils;
 
 import java.io.File;
@@ -29,7 +31,10 @@
  */
 public class WorkingCopyContentGenerator
     extends AbstractLogEnabled
+    implements RequestTool
 {
+    private RunData data;
+
     private File basedir;
 
     public String generate( Object item, String baseUrl, File basedir )
@@ -40,7 +45,7 @@
 
         StringBuffer buf = new StringBuffer();
 
-        buf.append( "+&nbsp;<a href=\"" + baseUrl + "?userDirectory=/\">/</a><br
/>" );
+        buf.append( "+&nbsp;<a href=\"" ).append( baseUrl ).append( "?userDirectory=/\">/</a><br
/>" );
 
         print( directoryEntries, "&nbsp;&nbsp;", baseUrl, buf );
 
@@ -56,19 +61,22 @@
             print( obj, indent, baseUrl, buf );
         }
     }
+
     private void print( Object obj, String indent, String baseUrl, StringBuffer buf )
     {
         if ( obj instanceof File )
         {
-            File f = (File) obj;;
+            File f = (File) obj;
+            ;
 
             if ( !f.isDirectory() )
             {
                 String fileName = f.getName();
 
-                if ( !".cvsignore".equals( fileName ) && !"vssver.scc".equals( fileName
) && !".DS_Store".equals( fileName ) )
+                if ( !".cvsignore".equals( fileName ) && !"vssver.scc".equals( fileName
) &&
+                    !".DS_Store".equals( fileName ) )
                 {
-                    String userDirectory = null;
+                    String userDirectory;
 
                     if ( f.getParentFile().getAbsolutePath().equals( basedir.getAbsolutePath()
) )
                     {
@@ -76,25 +84,30 @@
                     }
                     else
                     {
-                        userDirectory = f.getParentFile().getAbsolutePath().substring( basedir.getAbsolutePath().length()
+ 1 );
+                        userDirectory =
+                            f.getParentFile().getAbsolutePath().substring( basedir.getAbsolutePath().length()
+ 1 );
                     }
 
                     userDirectory = StringUtils.replace( userDirectory, "\\", "/" );
 
-                    buf.append( indent + "&nbsp;&nbsp;&nbsp;<a href=\"" +
baseUrl + "?userDirectory=" + userDirectory + "&file=" + fileName + "\">" + fileName
+ "</a><br />" );
+                    buf.append( indent ).append( "&nbsp;&nbsp;&nbsp;<a target=\"blank\"
href=\"" +
+                        getFileUrl( userDirectory, fileName ) + "\">" + fileName + "</a><br
/>" );
                 }
             }
             else
             {
                 String directoryName = f.getName();
 
-                if ( !"CVS".equals( directoryName ) && !".svn".equals( directoryName
) && !"SCCS".equals( directoryName ) )
+                if ( !"CVS".equals( directoryName ) && !".svn".equals( directoryName
) &&
+                    !"SCCS".equals( directoryName ) && !".bzr".equals( directoryName
) )
                 {
                     String userDirectory = f.getAbsolutePath().substring( basedir.getAbsolutePath().length()
+ 1 );
 
                     userDirectory = StringUtils.replace( userDirectory, "\\", "/" );
 
-                    buf.append( indent + "+&nbsp;<a href=\"" + baseUrl + "?userDirectory="
+ userDirectory + "\">" + directoryName + "</a><br />" );
+                    buf.append( indent ).append( "+&nbsp;<a href=\"" ).append( baseUrl
).append(
+                        "?userDirectory=" ).append( userDirectory ).append( "\">" ).append(
directoryName ).append(
+                        "</a><br />" );
                 }
             }
         }
@@ -102,5 +115,38 @@
         {
             print( (List) obj, indent + "&nbsp;&nbsp;", baseUrl, buf );
         }
+    }
+
+    private String getBrowseServletPath()
+    {
+        return data.getContextPath() + "/servlet/browse?file=";
+    }
+
+    private String getFileUrl( String directory, String fileName )
+    {
+        String dir = directory;
+
+        String filePath;
+
+        if ( StringUtils.isEmpty( dir ) || "/".equals( dir ) )
+        {
+            filePath = basedir.getName() + "/" + fileName;
+        }
+        else
+        {
+            filePath = basedir.getName() + "/" + directory + "/" + fileName;
+        }
+
+        return getBrowseServletPath() + filePath;
+    }
+
+    public void setRunData( RunData data )
+    {
+        this.data = data;
+    }
+
+    public void refresh()
+    {
+        // empty
     }
 }

Modified: maven/continuum/branches/continuum-1.0.x/continuum-web/src/main/resources/templates/screens/WorkingCopy.vm
URL: http://svn.apache.org/viewcvs/maven/continuum/branches/continuum-1.0.x/continuum-web/src/main/resources/templates/screens/WorkingCopy.vm?rev=384855&r1=384854&r2=384855&view=diff
==============================================================================
--- maven/continuum/branches/continuum-1.0.x/continuum-web/src/main/resources/templates/screens/WorkingCopy.vm
(original)
+++ maven/continuum/branches/continuum-1.0.x/continuum-web/src/main/resources/templates/screens/WorkingCopy.vm
Fri Mar 10 09:17:42 2006
@@ -25,12 +25,4 @@
   #set ( $files = $continuum.getFiles( $project.id, $data.getParameters().getString( "userDirectory"
) ) )
   #set ( $baseUrl = $link.setPage('WorkingCopy.vm').addPathInfo('view', "WorkingCopy").addPathInfo('id',
$project.id) )
   $workingCopy.generate( $files, $baseUrl.toString(), $continuum.getWorkingDirectory( $project.id
) )
-
-  #if ( $data.getParameters().getString( "file" ) )
-    #set( $filename = $data.getParameters().getString( "file" ) )
-    <br />
-    <form>
-      <textarea rows="50" cols="100">$continuum.getFileContent( $project.id, $data.getParameters().getString(
"userDirectory" ), $filename )</textarea>
-    </form>
-  #end
 </div>



Mime
View raw message