Author: tyrell
Date: Thu Jan 24 18:15:33 2008
New Revision: 12853

Log:

Fixing MASHUP-581

Modified:
   trunk/mashup/java/modules/www/editor.jsp
   trunk/mashup/java/modules/www/taskbar.jsp

Modified: trunk/mashup/java/modules/www/editor.jsp
==============================================================================
--- trunk/mashup/java/modules/www/editor.jsp    (original)
+++ trunk/mashup/java/modules/www/editor.jsp    Thu Jan 24 18:15:33 2008
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
 --%>
-<%@ page isErrorPage="true" %>
+<%@ page errorPage="error.jsp" %>
 <%@ page contentType="text/html;charset=UTF-8" language="java" %>
 <%@ page import="org.wso2.mashup.webapp.MashupUiFault" %>
 <%@ page import="org.wso2.registry.RegistryConstants" %>
@@ -54,7 +54,8 @@
 
     //Sanity check. Immediately terminate further processing if this fails.
     if (action == null) {
-        throw new MashupUiFault("Mashup Editor validation failure. An action 
was not specified in the request.");
+        throw new MashupUiFault(
+                "Mashup Editor validation failure. An action was not specified 
in the request.");
     } 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.");
@@ -66,7 +67,8 @@
         boolean validReferer = false;
 
         if (pathContents.length < 4) {
-            throw new MashupUiFault("Mashup Editor validation failure. The 
path specified for the mashup is invalid.");
+            throw new MashupUiFault(
+                    "Mashup Editor validation failure. The path specified for 
the mashup is invalid.");
         } else {
             author = pathContents[2];
             mashupName = pathContents[3];
@@ -158,8 +160,10 @@
 
 function saveSourceCallback() {
 
-    var lblInfo = document.getElementById(this.params);
-
+    var params = this.params; 
+    var lblInfo = document.getElementById(params[0]);
+    var isRedirect = params[1];
+    
     var saveSuccess;
 
     var browser = WSRequest.util._getBrowser();
@@ -197,6 +201,11 @@
         lblInfo.innerHTML =
         "<font color=green>Your source edits were successfully updated " + 
timeStamp +
         "</font>";
+
+        if(isRedirect){
+            window.location = "<%=bounceback%>";
+        }
+
     } else {
         lblInfo.innerHTML = "";
         lblInfo.innerHTML =
@@ -205,34 +214,44 @@
 
 }
 
-function saveServiceSource(newSource) {
+function saveServiceSource(newSource, isRedirect) {
+    var params = new Array();
+    params[0] = "source_save_status";
+    params[1] = isRedirect;
 <%
 if(action.equalsIgnoreCase("edit")){
 %>
-    wso2.mashup.services.saveServiceSource('<%=mashup%>', newSource, 
saveSourceCallback, "source_save_status");
+    wso2.mashup.services.saveServiceSource('<%=mashup%>', newSource, 
saveSourceCallback, params);
 <%
 }else if(action.equalsIgnoreCase("new")){
 %>
-    wso2.mashup.services.saveServiceSource('<%="/mashups/" + currentUser + "/" 
+ mashup%>', newSource, saveSourceCallback, "source_save_status");
+    wso2.mashup.services.saveServiceSource('<%="/mashups/" + currentUser + "/" 
+ mashup%>', newSource, saveSourceCallback, params);
 <%
 }
 %>
 }
 
-function saveUiSource(newSource) {
+function saveUiSource(newSource, isRedirect) {
+    var params = new Array();
+    params[0] = "ui_save_status";
+    params[1] = isRedirect;
 <%
  if(action.equalsIgnoreCase("edit")){
 %>
-    wso2.mashup.services.saveUiSource('<%=mashup%>', newSource, 
saveSourceCallback, "ui_save_status");
+    wso2.mashup.services.saveUiSource('<%=mashup%>', newSource, 
saveSourceCallback, params);
 <%
 }else if(action.equalsIgnoreCase("new")){
 %>
-    wso2.mashup.services.saveUiSource('<%="/mashups/" + currentUser + "/" + 
mashup%>', newSource, saveSourceCallback, "ui_save_status");
+    wso2.mashup.services.saveUiSource('<%="/mashups/" + currentUser + "/" + 
mashup%>', newSource, saveSourceCallback, params);
 <%
 }
 %>
 }
 
+function discarChanges(){
+    window.location = "<%=bounceback%>";
+}
+
 </script>
 </head>
 <body onload="init();">
@@ -316,10 +335,10 @@
 
     <div style="padding-top: 10px;"><label id="source_save_status" 
style="float: left;">Tip: You can
         use the button on
-        the right to save changes.</label> <input type="button"
-                                                  value="Save mashup code"
-                                                  
onclick="saveServiceSource(mashup_code_text.getCode());"
-                                                  style="float: right;"/>
+        the right to save changes.</label>
+        <input type="button" value="Disacard changes" 
onclick="discarChanges();" style="float: right;"/>
+        <input type="button" value="Save changes" 
onclick="saveServiceSource(mashup_code_text.getCode(),true);" style="float: 
right;"/>
+        <input type="button" value="Apply changes" 
onclick="saveServiceSource(mashup_code_text.getCode(),false);" style="float: 
right;"/>         
     </div>
 </div>
 <div class="panel" id="ui_code" style="display: block">
@@ -429,10 +448,11 @@
 
 <div style="padding-top: 10px;"><label id="ui_save_status" style="float: 
left;">Tip: You can
     use the button on
-    the right to save changes.</label> <input type="button"
-                                              value="Save custom ui code"
-                                              
onclick="saveUiSource(ui_code_text.getCode());"
-                                              style="float: right;"/>
+    the right to save changes.</label>
+    <input type="button" value="Discard changes" onclick="discarChanges();" 
style="float: right;"/>
+    <input type="button" value="Save changes" 
onclick="saveUiSource(ui_code_text.getCode(),true);" style="float: right;"/>
+    <input type="button" value="Apply changes" 
onclick="saveUiSource(ui_code_text.getCode(),false);" style="float: right;"/>
+
 </div>
 </div>
 </div>

Modified: trunk/mashup/java/modules/www/taskbar.jsp
==============================================================================
--- trunk/mashup/java/modules/www/taskbar.jsp   (original)
+++ trunk/mashup/java/modules/www/taskbar.jsp   Thu Jan 24 18:15:33 2008
@@ -146,7 +146,7 @@
             "Service started. [<a href='#' 
onclick='WSO2.MashupUtils.handleServiceStartStop(\"<%=paramMashupServiceName%>\",
 false, handleServiceStartStopCallback)'>Stop</a>]";
                                 //Enabling service editing
             document.getElementById("edit-service").innerHTML =
-            '<a href="editor.jsp?action=edit&mashup=<%=paramPath%>">Edit this 
service</a>';
+            '<a 
href="editor.jsp?action=edit&mashup=<%=paramPath%>&bounceback=<%=thisPage%>">Edit
 this service</a>';
                                 //Enabling service sharing
             document.getElementById("share-mashup").innerHTML =
             ' <a href="#" 
onclick="WSO2.MashupUtils.showMashupSharingDialog(\'<%=paramMashupServiceName%>\');">Share
 this mashup</a>';
@@ -182,7 +182,7 @@
             "Service started. [<a href='#' 
onclick='WSO2.MashupUtils.handleServiceStartStop(\"<%=paramMashupServiceName%>\",
 false, handleServiceStartStopCallback)'>Stop</a>]";
                                 //Enabling service editing
             document.getElementById("edit-service").innerHTML =
-            '<a href="editor.jsp?action=edit&mashup=<%=paramPath%>">Edit this 
service</a>';
+            '<a 
href="editor.jsp?action=edit&mashup=<%=paramPath%>&bounceback=<%=thisPage%>">Edit
 this service</a>';
                                 //Enabling service sharing
             document.getElementById("share-mashup").innerHTML =
             ' <a href="#" 
onclick="WSO2.MashupUtils.showMashupSharingDialog(\'<%=paramMashupServiceName%>\');">Share
 this mashup</a>';

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

Reply via email to