Author: tyrell
Date: Tue Jul  8 08:10:00 2008
New Revision: 18989
URL: http://wso2.org/svn/browse/wso2?view=rev&revision=18989

Log:
Adding mashup and author parameters to the URLs instead of path

Modified:
   
trunk/mashup/java/modules/admin/service/src/org/wso2/mashup/admin/service/MashupAdminService.java
   trunk/mashup/java/modules/www/editor.jsp
   trunk/mashup/java/modules/www/taskbar.jsp

Modified: 
trunk/mashup/java/modules/admin/service/src/org/wso2/mashup/admin/service/MashupAdminService.java
URL: 
http://wso2.org/svn/browse/wso2/trunk/mashup/java/modules/admin/service/src/org/wso2/mashup/admin/service/MashupAdminService.java?rev=18989&r1=18988&r2=18989&view=diff
==============================================================================
--- 
trunk/mashup/java/modules/admin/service/src/org/wso2/mashup/admin/service/MashupAdminService.java
   (original)
+++ 
trunk/mashup/java/modules/admin/service/src/org/wso2/mashup/admin/service/MashupAdminService.java
   Tue Jul  8 08:10:00 2008
@@ -174,6 +174,10 @@
                 uiSourceFile = new File(wwwDir, "gadget.xml");
             } else {
                 uiSourceFile = new File(wwwDir, "index.htm");
+
+                if (!uiSourceFile.exists()) {
+                    uiSourceFile = new File(wwwDir, "index.html");
+                }
             }
 
             //Writing the file with the source provided
@@ -590,7 +594,7 @@
         TransportDO transportDO = pm.getTransport(transportName);
         if (!axisService.isEnableAllTransports()) {
             if (axisService.getExposedTransports().size() == 1) {
-                               throw new AxisFault(
+                throw new AxisFault(
                         "Cannot remove transport binding of service" + 
serviceName +
                                 ". <br/>A service must contain at least one 
transport binding!");
             } else {
@@ -603,7 +607,7 @@
             TransportSummary[] transports = new TransportAdmin()
                     .listTransports();
             if (transports.length == 1) {
-                               throw new AxisFault(
+                throw new AxisFault(
                         "Cannot remove transport binding of service" + 
serviceName +
                                 ". <br/>A service must contain at least one 
transport binding!");
             } else {

Modified: trunk/mashup/java/modules/www/editor.jsp
URL: 
http://wso2.org/svn/browse/wso2/trunk/mashup/java/modules/www/editor.jsp?rev=18989&r1=18988&r2=18989&view=diff
==============================================================================
--- trunk/mashup/java/modules/www/editor.jsp    (original)
+++ trunk/mashup/java/modules/www/editor.jsp    Tue Jul  8 08:10:00 2008
@@ -54,7 +54,7 @@
     String action = request.getParameter("action");
     String mashup = request.getParameter("mashup");
     String mashupName = mashup;
-    String author = "";
+    String author = request.getParameter("author");
     String currentUser = RegistryUtils.getCurrentUser(userRegistry);
 
     //Sanity check. Immediately terminate further processing if this fails.
@@ -64,20 +64,10 @@
     } else if ((action.equalsIgnoreCase("edit")) && (mashup == null)) {
         throw new MashupUiFault(
                 "Mashup Editor validation failure. An edit request was made 
without a valid mashup being named for editing.");
-    } else if ((action.equalsIgnoreCase("edit")) && (mashup != null)) {
-        String[] pathContents = mashup.split("/");
-
-        //Restricting mashup editing for particular referer pages
-        String[] validReferers = { "mashup.jsp" };
-        boolean validReferer = false;
-
-        if (pathContents.length < 4) {
-            throw new MashupUiFault(
-                    "Mashup Editor validation failure. The path specified for 
the mashup is invalid.");
-        } else {
-            author = pathContents[2];
-            mashupName = pathContents[3];
-        }
+    } else if ((action.equalsIgnoreCase("edit")) && (author == null)) {
+        throw new MashupUiFault(
+                "Mashup Editor validation failure. An edit request was made 
without a valid Author name.");
+    } else if ((action.equalsIgnoreCase("edit")) && (mashup != null) && 
(author != null)) {      
 
         if (!((author.equals(currentUser) || 
RegistryUtils.isAdminRole(userRegistry)))) {
             throw new MashupUiFault(
@@ -98,6 +88,8 @@
     }
 
     String httpUrl = MashupUtils.getServerURL(request.getServerName());
+
+    String mashupPath = RegistryConstants.PATH_SEPARATOR + "mashups" + 
RegistryConstants.PATH_SEPARATOR + author + RegistryConstants.PATH_SEPARATOR + 
mashup;
 %>
 <html>
 <head>
@@ -227,7 +219,7 @@
 <%
 if(action.equalsIgnoreCase("edit")){
 %>
-    wso2.mashup.services.saveServiceSource('<%=mashup%>', newSource, 
saveSourceCallback, params);
+    wso2.mashup.services.saveServiceSource('<%=mashupPath%>', newSource, 
saveSourceCallback, params);
 <%
 }else if(action.equalsIgnoreCase("new")){
 %>
@@ -239,12 +231,18 @@
 
 function saveUiSource(newSource, isRedirect, type) {
     var params = new Array();
-    params[0] = "ui_save_status";
+
+    if(type == "gadget"){
+       params[0] = "gadget_save_status";
+    }else{
+       params[0] = "ui_save_status";
+    }
+
     params[1] = isRedirect;
 <%
  if(action.equalsIgnoreCase("edit")){
 %>
-    wso2.mashup.services.saveUiSource('<%=mashup%>', newSource, 
saveSourceCallback, params, type);
+    wso2.mashup.services.saveUiSource('<%=mashupPath%>', newSource, 
saveSourceCallback, params, type);
 <%
 }else if(action.equalsIgnoreCase("new")){
 %>
@@ -369,7 +367,7 @@
 
 
         } else if (action.equalsIgnoreCase("edit")) {
-            serviceSource = MashupUtils.readServiceSource(mashup);
+            serviceSource = MashupUtils.readServiceSource(mashupPath);
         }
     %>
     <textarea id="mashup_code_text" rows="" cols="" class="codepress 
javascript"
@@ -387,7 +385,7 @@
 </div>
 <div class="panel" id="ui_code" style="display: block">
 <%
-    String uiSource = MashupUtils.readServiceUiSource(mashup);
+    String uiSource = MashupUtils.readServiceUiSource(mashupPath);
 
     if (uiSource.equals("404")) {
         uiSource = "A custom UI was not found for this mashup. You can use the 
'Generate Template' button below to generate a sample.";
@@ -411,7 +409,7 @@
 </div>
 <div class="panel" id="gadget_code" style="display: block">
 <%
-    String gadgetSource = MashupUtils.readGadgetUiSource(mashup);
+    String gadgetSource = MashupUtils.readGadgetUiSource(mashupPath);
     
     if (gadgetSource.equals("404")) {
         gadgetSource = "A gadget UI was not found for this mashup. You can use 
the 'Generate New' button below to generate a sample.";

Modified: trunk/mashup/java/modules/www/taskbar.jsp
URL: 
http://wso2.org/svn/browse/wso2/trunk/mashup/java/modules/www/taskbar.jsp?rev=18989&r1=18988&r2=18989&view=diff
==============================================================================
--- trunk/mashup/java/modules/www/taskbar.jsp   (original)
+++ trunk/mashup/java/modules/www/taskbar.jsp   Tue Jul  8 08:10:00 2008
@@ -120,7 +120,7 @@
 </li>
 
 <li id="edit-service">
-    <a 
href="editor.jsp?action=edit&mashup=<%=paramPath%>&bounceback=<%=thisPage%>">Edit
 this mashup</a>
+    <a 
href="editor.jsp?action=edit&mashup=<%=paramMashup%>&author=<%=author%>&bounceback=<%=thisPage%>">Edit
 this mashup</a>
 </li>
 
 <li id="delete-service">

_______________________________________________
Mashup-dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/mashup-dev

Reply via email to