roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agillil...@apache.org
Subject svn commit: r544001 - in /roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger: ui/rendering/model/URLModel.java util/URLUtilities.java
Date Sun, 03 Jun 2007 22:02:09 GMT
Author: agilliland
Date: Sun Jun  3 15:02:08 2007
New Revision: 544001

URL: http://svn.apache.org/viewvc?view=rev&rev=544001
Log:
modify getActionURL() method so that it can receive a map of extra parameters to use for building
the url.


Modified:
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/rendering/model/URLModel.java
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/util/URLUtilities.java

Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/rendering/model/URLModel.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/rendering/model/URLModel.java?view=diff&rev=544001&r1=544000&r2=544001
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/rendering/model/URLModel.java
(original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/rendering/model/URLModel.java
Sun Jun  3 15:02:08 2007
@@ -107,11 +107,11 @@
     public String action(String action, String namespace) {
         if(namespace != null) {
             if("/roller-ui".equals(namespace)) {
-                return URLUtilities.getActionURL(action, namespace, null, true);
+                return URLUtilities.getActionURL(action, namespace, null, null, true);
             } else if("/roller-ui/authoring".equals(namespace)) {
-                return URLUtilities.getActionURL(action, namespace, weblog.getHandle(), true);
+                return URLUtilities.getActionURL(action, namespace, weblog.getHandle(), null,
true);
             } else if("/roller-ui/admin".equals(namespace)) {
-                return URLUtilities.getActionURL(action, namespace, null, true);
+                return URLUtilities.getActionURL(action, namespace, null, null, true);
             }
         }
         return null;

Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/util/URLUtilities.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/util/URLUtilities.java?view=diff&rev=544001&r1=544000&r2=544001
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/util/URLUtilities.java
(original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/util/URLUtilities.java
Sun Jun  3 15:02:08 2007
@@ -429,6 +429,7 @@
     public static final String getActionURL(String action,
                                             String namespace,
                                             String weblogHandle,
+                                            Map<String, String> parameters,
                                             boolean absolute) {
         
         StringBuffer url = new StringBuffer();
@@ -442,10 +443,18 @@
         url.append(namespace);
         url.append("/").append(action).append(".rol");
         
+        // put weblog handle parameter, if necessary
+        Map<String, String> params = new HashMap();
         if(weblogHandle != null) {
-            Map params = new HashMap();
             params.put("weblog", weblogHandle);
-            
+        }
+        
+        // add custom parameters if they exist
+        if(parameters != null) {
+            params.putAll(parameters);
+        }
+        
+        if(!params.isEmpty()) {
             return url.toString() + getQueryString(params);
         } else {
             return url.toString();



Mime
View raw message