Author: tyrell
Date: Thu Jan 17 14:56:21 2008
New Revision: 12436

Log:

Organizing the tasks into taskbar.jsp, so that it can be included in any page.

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

Modified: trunk/mashup/java/modules/www/index.jsp
==============================================================================
--- trunk/mashup/java/modules/www/index.jsp     (original)
+++ trunk/mashup/java/modules/www/index.jsp     Thu Jan 17 14:56:21 2008
@@ -81,7 +81,6 @@
     }
 
     String thisPage = "index.jsp";
-
 %>
 
 <!--Required to keep a user logged in if 'Remember Me' option is selected-->
@@ -90,6 +89,12 @@
 <%
     User userProfile =
             
RegistryUtils.getUserProfile(RegistryUtils.getCurrentUser(registry), registry);
+
+    //Setting variables required for the taskbar.jsp
+    String author = "";
+    String currentUser = RegistryUtils.getCurrentUser(registry);
+    String mashupServiceName = "";
+    String path = "";
 %>
 
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
@@ -269,7 +274,7 @@
     while (iter.hasNext()) {
         QueryResult result = (QueryResult) iter.next();
         String id = "id" + nextId;
-        String path = result.getPath();
+        path = result.getPath();
 
         if (results.getResultsType().equals("activity")) {
             String action = result.getAction();

Modified: trunk/mashup/java/modules/www/mashup.jsp
==============================================================================
--- trunk/mashup/java/modules/www/mashup.jsp    (original)
+++ trunk/mashup/java/modules/www/mashup.jsp    Thu Jan 17 14:56:21 2008
@@ -229,192 +229,9 @@
 
 <%@ include file="header.jsp" %>
 <%@ include file="searchbox.jsp" %>
-<div id="taskbar">
-<table width="100%" border="0" class="box" cellspacing="0" cellpadding="3">
-<tr>
-    <th>Tasks</th>
-</tr>
-<!--Tasks will be available only to logged in users-->
-<% if (RegistryUtils.isLoggedIn(registry)) { %>
-<tr>
-<td>
-<ul>
-<!--Will be available only to users with Admin priviledges OR who are Authors 
of the current Mashup-->
-<% if ((RegistryUtils.isAdminRole(registry)) ||
-        (author.equalsIgnoreCase(currentUser))) { %>
-<li id="service-status">
-    Service status not available
-</li>
-<li id="edit-service">
-    Service editing is not available
-</li>
-
-<script type="text/javascript">
-    //Getting the Current status of the service
-    function handleServiceStartStopCallback() {
-        var params = this.params;
-        var serviceState = params[1];
-
-        if (serviceState) {
-            document.getElementById("service-status").innerHTML =
-            "Service started. [<a href='#' 
onclick='WSO2.MashupUtils.handleServiceStartStop(\"<%=mashupServiceName%>\", 
false, handleServiceStartStopCallback)'>Stop</a>]";
-                                //Enabling service editing
-            document.getElementById("edit-service").innerHTML =
-            '<a href="editor.jsp?action=edit&mashup=<%=path%>">Edit this 
service</a>';
-                                //Enabling service sharing
-            document.getElementById("share-mashup").innerHTML =
-            ' <a href="#" 
onclick="WSO2.MashupUtils.showMashupSharingDialog(\'<%=mashupServiceName%>\');">Share
 this service</a>';
-                        //Enabling service deletion
-            var delElem = document.getElementById("delete-service");
-            if (!(delElem == "undefined")) {
-                delElem.innerHTML =
-                ' <a href="#" onclick="deleteService();">Delete this 
service</a>';
-            }
-        } else {
-            document.getElementById("service-status").innerHTML =
-            "Service stopped. [<a href='#' 
onclick='WSO2.MashupUtils.handleServiceStartStop(\"<%=mashupServiceName%>\", 
true, handleServiceStartStopCallback)'>Start</a>]";
-                                //Disabling service editing
-            document.getElementById("edit-service").innerHTML =
-            "Service editing is not available";
-                                //Disabling service sharing
-            document.getElementById("share-mashup").innerHTML =
-            "Service sharing is not available";
-                        //Disabling service deletion
-            delElem = document.getElementById("delete-service");
-            if (!(delElem == "undefined")) {
-                delElem.innerHTML = "Service deletion is not available";
-            }
-        }
-    }
 
-    function listServiceDataCallback() {
-        var xmlBodyContent = 
this.req.responseXML.getElementsByTagName("return")[0];
-        var serviceMashupObject = 
WSO2.MashupUtils.generateMashupFromXml(xmlBodyContent);
-
-        if (serviceMashupObject.getServiceStatus() == "true") {
-            document.getElementById("service-status").innerHTML =
-            "Service started. [<a href='#' 
onclick='WSO2.MashupUtils.handleServiceStartStop(\"<%=mashupServiceName%>\", 
false, handleServiceStartStopCallback)'>Stop</a>]";
-                                //Enabling service editing
-            document.getElementById("edit-service").innerHTML =
-            '<a href="editor.jsp?action=edit&mashup=<%=path%>">Edit this 
service</a>';
-                                //Enabling service sharing
-            document.getElementById("share-mashup").innerHTML =
-            ' <a href="#" 
onclick="WSO2.MashupUtils.showMashupSharingDialog(\'<%=mashupServiceName%>\');">Share
 this service</a>';
-                        //Enabling service deletion
-            var delElem = document.getElementById("delete-service");
-            if (!(delElem == "undefined")) {
-                delElem.innerHTML =
-                ' <a href="#" onclick="deleteService();">Delete this 
service</a>';
-            }
-        } else {
-            document.getElementById("service-status").innerHTML =
-            "Service stopped. [<a href='#' 
onclick='WSO2.MashupUtils.handleServiceStartStop(\"<%=mashupServiceName%>\", 
true, handleServiceStartStopCallback)'>Start</a>]";
-                                //Disabling service editing
-            document.getElementById("edit-service").innerHTML =
-            "Service editing is not available";
-                                //Disabling service sharing
-            document.getElementById("share-mashup").innerHTML =
-            "Service sharing is not available";
-                        //Disabling service deletion
-            delElem = document.getElementById("delete-service");
-            if (!(delElem == "undefined")) {
-                delElem.innerHTML = "Service deletion is not available";
-            }
-        }
-    }
-
-    wso2.mashup.services.listServiceData('<%=mashupServiceName%>', 
listServiceDataCallback);
-</script>
-<%
-    }
-
-    //Users must be logged in to create mashups
-    if (RegistryUtils.isLoggedIn(registry)) {
-%>
-<li>
-    <a href="#" 
onclick="WSO2.MashupUtils.showCreateMashupDialog('<%=currentUser%>');">Create a
-        new service</a>
-</li>
-
-<%}%>
-<li id="share-mashup">
-    Service sharing is not available
-</li>
-<!--Will be available only to users with Admin priviledges OR who are Authors 
of the current Mashup-->
-<% if ((RegistryUtils.isAdminRole(registry)) ||
-        (author.equalsIgnoreCase(currentUser))) { %>
-<script type="text/javascript">
-    function deleteServiceCallback() {
-        window.location = "index.jsp";
-    }
-
-    function deleteService() {
-        var confirmation = confirm("You are about to permanently delete the 
'<%=mashupServiceName%>' service. Are you sure?")
-
-        if (confirmation) {
-            wso2.mashup.services.deleteService('<%=mashupServiceName%>', 
deleteServiceCallback);
-        }
-    }
-
-    function redeployServiceCallback() {
-        var response ;
-
-        var browser = WSRequest.util._getBrowser();
-        if (browser == "ie" || browser == "ie7") {
-            response =
-            
this.req.responseXML.getElementsByTagName("ns:return")[0].firstChild.nodeValue;
-        } else {
-            response =
-            
this.req.responseXML.getElementsByTagName("return")[0].firstChild.nodeValue;
-        }
-
-        if (response == "true") {
-            alert("Successfully re deployed the service");
-        } else {
-            alert("Re deployment failed.");
-        }
-    }
-
-    function redeployService() {
-        var confirmation = confirm("You are about to re-deploy the 
'<%=mashupServiceName%>' service. Are you sure?")
-
-        if (confirmation) {
-            wso2.mashup.services.reDeployService('<%=mashupServiceName%>', 
redeployServiceCallback);
-        }
-    }
-</script>
-<li id="redeploy-service">
-    <a href="#"
-       onclick="redeployService();">Re deploy this service</a>
-</li>
-<li id="delete-service">
-    <a href="#"
-       onclick="deleteService();">Delete this service</a>
-</li>
-<li>
-    <a href="#"
-       onclick="window.open('../scraper.html', 'remote', 
'width=640,height=480')">Use
-        the scraping assistant</a>
-</li>
-<li>
-    <a href="#"
-       
onclick="WSO2.MashupUtils.showMashupDownloadingDialog('<%=mashupServiceName%>');">Download
-        this mashup</a>
-</li>
-<li>
-    <a href="stub_gen.jsp" target="_blank">Use the Java Script Stub 
Generator</a>
-</li>
-<%}%>
-</ul>
-</td>
-</tr>
-<%} else {%>
-<tr>
-    <td><a href="signin.jsp?bounceback=<%=thisPage%>">Sign in</a> to perform 
tasks</td>
-</tr>
-<%}%>
-</table>
-<%@ include file="taskbar.jsp" %>
+<div id="taskbar">
+    <%@ include file="taskbar.jsp" %>
 </div>
 
 <div id="content">

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 17 14:56:21 2008
@@ -15,33 +15,211 @@
 --%>
 <%@ page errorPage="error.jsp" %>
 <table width="100%" border="0" class="box" cellspacing="0" cellpadding="3">
-    <tr>
-        <th>Resources</th>
-    </tr>
-    <tr>
-        <td>
-            <ul>
-                <li>
-                    <a href="../about.jsp">About the WSO2 Mashup Server</a>
-                </li>
-                <!--<li>
-                    <a href="#">Mashup Server blog</a>
-                </li>-->
-                <li>
-                    <a href="http://www.wso2.org/forum/226";>Mashup Server 
Forum</a>
-                </li>
-                <li>
-                    <a 
href="http://wso2.org/project/mashup/0.2/docs/index.html";>User guide</a>
-                </li>
-                <li>
-                    <a 
href="http://www.wso2.org/wiki/display/mashup/WSO2+Mashup+Server+Reference";>Reference</a>
-                </li>
-                <li>
-                    <a href="https://wso2.org/jira/browse/MASHUP";>File a 
bug</a>
-                </li>
-            </ul>
-        </td>
-    </tr>
+<tr>
+    <th>Tasks</th>
+</tr>
+<!--Tasks will be available only to logged in users-->
+<% if (RegistryUtils.isLoggedIn(registry)) { %>
+<tr>
+<td>
+<ul>
+<!--Will be available only to users with Admin priviledges OR who are Authors 
of the current Mashup, if there is a Mashup service set by the parent page.-->
+<% if (((RegistryUtils.isAdminRole(registry)) ||
+        (author.equalsIgnoreCase(currentUser))) && 
(!mashupServiceName.equalsIgnoreCase(""))) { %>
+<li id="service-status">
+    Service status not available
+</li>
+<li id="edit-service">
+    Service editing is not available
+</li>
+
+<script type="text/javascript">
+    //Getting the Current status of the service
+    function handleServiceStartStopCallback() {
+        var params = this.params;
+        var serviceState = params[1];
+
+        if (serviceState) {
+            document.getElementById("service-status").innerHTML =
+            "Service started. [<a href='#' 
onclick='WSO2.MashupUtils.handleServiceStartStop(\"<%=mashupServiceName%>\", 
false, handleServiceStartStopCallback)'>Stop</a>]";
+                                //Enabling service editing
+            document.getElementById("edit-service").innerHTML =
+            '<a href="editor.jsp?action=edit&mashup=<%=path%>">Edit this 
service</a>';
+                                //Enabling service sharing
+            document.getElementById("share-mashup").innerHTML =
+            ' <a href="#" 
onclick="WSO2.MashupUtils.showMashupSharingDialog(\'<%=mashupServiceName%>\');">Share
 this service</a>';
+                        //Enabling service deletion
+            var delElem = document.getElementById("delete-service");
+            if (!(delElem == "undefined")) {
+                delElem.innerHTML =
+                ' <a href="#" onclick="deleteService();">Delete this 
service</a>';
+            }
+        } else {
+            document.getElementById("service-status").innerHTML =
+            "Service stopped. [<a href='#' 
onclick='WSO2.MashupUtils.handleServiceStartStop(\"<%=mashupServiceName%>\", 
true, handleServiceStartStopCallback)'>Start</a>]";
+                                //Disabling service editing
+            document.getElementById("edit-service").innerHTML =
+            "Service editing is not available";
+                                //Disabling service sharing
+            document.getElementById("share-mashup").innerHTML =
+            "Service sharing is not available";
+                        //Disabling service deletion
+            delElem = document.getElementById("delete-service");
+            if (!(delElem == "undefined")) {
+                delElem.innerHTML = "Service deletion is not available";
+            }
+        }
+    }
+
+    function listServiceDataCallback() {
+        var xmlBodyContent = 
this.req.responseXML.getElementsByTagName("return")[0];
+        var serviceMashupObject = 
WSO2.MashupUtils.generateMashupFromXml(xmlBodyContent);
+
+        if (serviceMashupObject.getServiceStatus() == "true") {
+            document.getElementById("service-status").innerHTML =
+            "Service started. [<a href='#' 
onclick='WSO2.MashupUtils.handleServiceStartStop(\"<%=mashupServiceName%>\", 
false, handleServiceStartStopCallback)'>Stop</a>]";
+                                //Enabling service editing
+            document.getElementById("edit-service").innerHTML =
+            '<a href="editor.jsp?action=edit&mashup=<%=path%>">Edit this 
service</a>';
+                                //Enabling service sharing
+            document.getElementById("share-mashup").innerHTML =
+            ' <a href="#" 
onclick="WSO2.MashupUtils.showMashupSharingDialog(\'<%=mashupServiceName%>\');">Share
 this service</a>';
+                        //Enabling service deletion
+            var delElem = document.getElementById("delete-service");
+            if (!(delElem == "undefined")) {
+                delElem.innerHTML =
+                ' <a href="#" onclick="deleteService();">Delete this 
service</a>';
+            }
+        } else {
+            document.getElementById("service-status").innerHTML =
+            "Service stopped. [<a href='#' 
onclick='WSO2.MashupUtils.handleServiceStartStop(\"<%=mashupServiceName%>\", 
true, handleServiceStartStopCallback)'>Start</a>]";
+                                //Disabling service editing
+            document.getElementById("edit-service").innerHTML =
+            "Service editing is not available";
+                                //Disabling service sharing
+            document.getElementById("share-mashup").innerHTML =
+            "Service sharing is not available";
+                        //Disabling service deletion
+            delElem = document.getElementById("delete-service");
+            if (!(delElem == "undefined")) {
+                delElem.innerHTML = "Service deletion is not available";
+            }
+        }
+    }
+
+    wso2.mashup.services.listServiceData('<%=mashupServiceName%>', 
listServiceDataCallback);
+</script>
+<li id="share-mashup">
+    Service sharing is not available
+</li>
+<script type="text/javascript">
+    function deleteServiceCallback() {
+        window.location = "index.jsp";
+    }
+
+    function deleteService() {
+        var confirmation = confirm("You are about to permanently delete the 
'<%=mashupServiceName%>' service. Are you sure?")
+
+        if (confirmation) {
+            wso2.mashup.services.deleteService('<%=mashupServiceName%>', 
deleteServiceCallback);
+        }
+    }
+
+    function redeployServiceCallback() {
+        var response ;
+
+        var browser = WSRequest.util._getBrowser();
+        if (browser == "ie" || browser == "ie7") {
+            response =
+            
this.req.responseXML.getElementsByTagName("ns:return")[0].firstChild.nodeValue;
+        } else {
+            response =
+            
this.req.responseXML.getElementsByTagName("return")[0].firstChild.nodeValue;
+        }
+
+        if (response == "true") {
+            alert("Successfully re deployed the service");
+        } else {
+            alert("Re deployment failed.");
+        }
+    }
+
+    function redeployService() {
+        var confirmation = confirm("You are about to re-deploy the 
'<%=mashupServiceName%>' service. Are you sure?")
+
+        if (confirmation) {
+            wso2.mashup.services.reDeployService('<%=mashupServiceName%>', 
redeployServiceCallback);
+        }
+    }
+</script>
+<li id="redeploy-service">
+    <a href="#"
+       onclick="redeployService();">Re deploy this service</a>
+</li>
+
+<li id="delete-service">
+    <a href="#"
+       onclick="deleteService();">Delete this service</a>
+</li>
+
+<li>
+    <a href="#"
+       
onclick="WSO2.MashupUtils.showMashupDownloadingDialog('<%=mashupServiceName%>');">Download
+        this mashup</a>
+</li>
+<%
+    }
+%>
+
+<li>
+    <a href="#" 
onclick="WSO2.MashupUtils.showCreateMashupDialog('<%=currentUser%>');">Create a
+        new service</a>
+</li>
+
+<li>
+    <a href="#"
+       onclick="window.open('../scraper.html', 'remote', 
'width=640,height=480')">Use
+        the scraping assistant</a>
+</li>
+
+<li>
+    <a href="stub_gen.jsp" target="_blank">Use the Java Script Stub 
Generator</a>
+</li>
+</ul>
+</td>
+</tr>
+<%} else {%>
+<tr>
+    <td><a href="signin.jsp?bounceback=<%=thisPage%>">Sign in</a> to perform 
tasks</td>
+</tr>
+<%}%>
+<tr>
+    <th>Resources</th>
+</tr>
+<tr>
+    <td>
+        <ul>
+            <li>
+                <a href="../about.jsp">About the WSO2 Mashup Server</a>
+            </li>
+            <!--<li>
+                <a href="#">Mashup Server blog</a>
+            </li>-->
+            <li>
+                <a href="http://www.wso2.org/forum/226";>Mashup Server Forum</a>
+            </li>
+            <li>
+                <a 
href="http://wso2.org/project/mashup/0.2/docs/index.html";>User guide</a>
+            </li>
+            <li>
+                <a 
href="http://www.wso2.org/wiki/display/mashup/WSO2+Mashup+Server+Reference";>Reference</a>
+            </li>
+            <li>
+                <a href="https://wso2.org/jira/browse/MASHUP";>File a bug</a>
+            </li>
+        </ul>
+    </td>
+</tr>
 </table>
 <div id="announcements"></div>
 

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

Reply via email to