Author: tyrell
Date: Thu Jan 17 08:53:40 2008
New Revision: 12430

Log:

Completing the faulty mashup handling functionality of the UI.

Added:
   trunk/mashup/java/modules/www/faulty_mashup.jsp
Modified:
   trunk/mashup/java/modules/www/index.jsp
   trunk/mashup/java/modules/www/mashup.jsp
   trunk/mashup/java/modules/www/search.jsp

Added: trunk/mashup/java/modules/www/faulty_mashup.jsp
==============================================================================
--- (empty file)
+++ trunk/mashup/java/modules/www/faulty_mashup.jsp     Thu Jan 17 08:53:40 2008
@@ -0,0 +1,87 @@
+<%@ page import="org.wso2.registry.RegistryException" %>
+<%@ page import="org.wso2.registry.Resource" %>
+<%@ page import="java.net.URLDecoder" %>
+
+<!--Required to keep a user logged in if 'Remember Me' option is selected-->
+<%@ include file="validate_login.jsp" %>
+
+<%
+    String bounceback = request.getParameter("bounceback");
+
+    if (bounceback == null) {
+        bounceback = "index.jsp";
+    } else {
+        bounceback = URLDecoder.decode(bounceback, "UTF-8");
+    }
+
+    String path = request.getParameter("path");
+    if (path == null) {
+        throw new RegistryException("must specify a path query parameter.");
+    }
+
+    String thisPage = "mashup.jsp?path=" + path;
+
+    Resource resource = registry.get(path);
+
+    String[] parts = path.split(RegistryConstants.PATH_SEPARATOR);
+    String mashup = parts[parts.length - 1];
+
+    String author = resource.getAuthorUserName();
+    String authorFullName = RegistryUtils.getFullName(request, author);
+    String description = resource.getDescription();
+
+    String currentUser = RegistryUtils.getCurrentUser(registry);
+%>
+<html>
+<head>
+    <title>Details of the faulty mashup '<%=mashup%>' by <%=author%>
+    </title>
+    <!-- Required CSS -->
+    <link href="css/styles.css" rel="stylesheet" type="text/css"/>
+    <script language="javascript" src="js/common.js" 
type="text/javascript"></script>
+</head>
+<body>
+<div id="page">
+    <%@ include file="header.jsp" %>
+    <div id="search"></div>
+    <div id="welcome">
+    </div>
+    <div id="content">
+        <h2>Details of the faulty mashup '<%=mashup%>' by <%=author%>
+        </h2>
+
+        <p>The mashup named <i><%=mashup%>
+        </i> authored by <i><%=authorFullName%> (<%=author%>)</i> has been
+            marked as faulty by the system.
+            <%
+
+                if (RegistryUtils.isLoggedIn(registry)) {
+                    // Will be available only to users with Admin priviledges 
OR who are Authors of the current Mashup
+                    if ((RegistryUtils.isAdminRole(registry)) ||
+                            (author.equalsIgnoreCase(currentUser))) {
+
+            %>
+            You may use the <a 
href="editor.jsp?action=edit&mashup=<%=path%>">mashup editor</a> to
+            fix
+            the source code of this mashup.
+
+        <p>The following details regarding the faulty mashup is available at 
this time.</p>
+
+        <div style="background-color: gray;">
+            <pre><%=description%></pre>
+        </div>
+        <%
+            }
+
+        } else {
+        %>
+        Please notify the author of this mashup or an administrator.
+        <%
+            }
+        %>
+        </p>
+    </div>
+    <%@ include file="footer.jsp" %>
+</div>
+</body>
+</html>
\ No newline at end of file

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 08:53:40 2008
@@ -344,12 +344,8 @@
             <%
                 if (RegistryUtils.isFaultyMashup(registry, result.getPath())) {
             %>
-            <div style="color: red;" >This mashup is faulty <a href="#"
-                                     
onclick="showFaultDetails('<%=result.getAuthor() + "_" + 
result.getName()%>');">details</a>
-                </div>
-            <textarea id="txt_<%=result.getAuthor() + "_" + result.getName()%>"
-                      style="height: 50px; width: 100%; display: 
none;"><%=result.getDescription()%>
-            </textarea>
+            <div style="color: red;" >This mashup is marked faulty by the 
system. Please click on its name for further information. 
+                </div>            
             <%
             } else {
             %>

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 08:53:40 2008
@@ -81,6 +81,12 @@
     //This is the service name understood by WSAS and should be used in all 
calls to WSAS services
     String mashupServiceName = author + "-" + mashup;
 
+    //Checking whether this is a faulty service, in which case most of the 
options will be disabled
+    boolean faultyService = RegistryUtils.isFaultyMashup(registry,path);
+    if(faultyService){
+        response.sendRedirect("faulty_mashup.jsp?path=" + path);
+    }
+
 %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
 <html>

Modified: trunk/mashup/java/modules/www/search.jsp
==============================================================================
--- trunk/mashup/java/modules/www/search.jsp    (original)
+++ trunk/mashup/java/modules/www/search.jsp    Thu Jan 17 08:53:40 2008
@@ -887,12 +887,8 @@
             <%
                 if (RegistryUtils.isFaultyMashup(registry, result.getPath())) {
             %>
-            <div style="color: red;" >This mashup is faulty <a href="#"
-                                     
onclick="showFaultDetails('<%=result.getAuthor() + "_" + 
result.getName()%>');">details</a>
+            <div style="color: red;" >This mashup is marked faulty by the 
system. Please click on its name for further information.
                 </div>
-            <textarea id="txt_<%=result.getAuthor() + "_" + result.getName()%>"
-                      style="height: 50px; width: 100%; display: 
none;"><%=result.getDescription()%>
-            </textarea>
             <%
             } else {
             %>

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

Reply via email to