Author: tdraier
Date: Fri Sep 14 13:10:40 2007
New Revision: 18469

URL: https://svndev.jahia.net/websvn/listing.php?sc=3D1&rev=3D18469&repname=
=3Djahia
Log:
display logs (port 18283 and other changes)

Modified:
    trunk/core/src/webapp/jsp/jahia/processing/displaylog.jsp
    trunk/core/src/webapp/jsp/jahia/processing/processing.jsp

Modified: trunk/core/src/webapp/jsp/jahia/processing/displaylog.jsp
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/trunk/core/src/webapp=
/jsp/jahia/processing/displaylog.jsp&rev=3D18469&repname=3Djahia
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/core/src/webapp/jsp/jahia/processing/displaylog.jsp (original)
+++ trunk/core/src/webapp/jsp/jahia/processing/displaylog.jsp Fri Sep 14 13=
:10:40 2007
@@ -14,45 +14,75 @@
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
---%><%@ page import=3D"org.apache.log4j.Logger,org.jahia.content.TreeOpera=
tionResult,
- org.jahia.engines.EngineMessage,
- org.jahia.exceptions.JahiaException,
- org.jahia.params.ParamBean,
- org.jahia.registries.ServicesRegistry,
- org.jahia.services.importexport.NodeImportResult,
- org.jahia.services.scheduler.SchedulerService,
- org.jahia.services.usermanager.JahiaUser,
- org.quartz.JobDetail,
- java.text.MessageFormat,
- java.util.ArrayList,
- java.util.List,
- java.util.Locale,
- java.util.ResourceBundle"%><%@ page contentType=3D"text/plain;charset=3DU=
TF-8" language=3D"java" %><%!
-/**
+--%>
+<%@ page import=3D"org.apache.log4j.Logger,
+                 org.jahia.bin.Jahia,
+                 org.jahia.content.NodeOperationResult,
+                 org.jahia.content.TreeOperationResult,
+                 org.jahia.engines.EngineMessage,
+                 org.jahia.exceptions.JahiaException,
+                 org.jahia.params.ParamBean,
+                 org.jahia.registries.ServicesRegistry,
+                 org.jahia.services.scheduler.SchedulerService,
+                 org.jahia.services.usermanager.JahiaUser,
+                 org.quartz.JobDetail,
+                 java.text.MessageFormat,
+                 java.util.ArrayList,
+                 java.util.List,
+                 java.util.Locale,
+                 java.util.ResourceBundle" %>
+<%@ page contentType=3D"text/html;charset=3DUTF-8" language=3D"java" %>
+<%@ taglib uri=3D"JahiaLib" prefix=3D"jahia" %>
+<%@ taglib uri=3D"/WEB-INF/tld/jesi-tags" prefix=3D"jesi" %>
+<%!
+    /**
      * jsp pages to display logs
      * $Id: $
      */
-  private static final Logger logger =3D Logger.getLogger("jsp.jahia.engin=
es");
-  private static SchedulerService service =3D ServicesRegistry.getInstance=
().getSchedulerService();
+    private static final Logger logger =3D Logger.getLogger("jsp.jahia.eng=
ines");
+    private static SchedulerService service =3D ServicesRegistry.getInstan=
ce().getSchedulerService();
+    private static final String bundle_prefix =3D "org.jahia.time";
+
+
+
+
+    /**
+     * internal method to render bundle resources
+     * @return a string empty if resource is non existent
+     * @param label the keylabel
+     * @param l the locale
+     */
+    private String getRessource(String label, Locale l) {
+        try {
+            return ResourceBundle.getBundle("JahiaEnginesResources", l).ge=
tString(label);
+        } catch (Exception e) {
+            return "";
+        }
+    }
 %><%
     response.setHeader("Pragma", "no-cache");
     response.setHeader("Expires", "0");
     response.setHeader("Cache-Control", "no-cache, no-store, must-revalida=
te, post-check=3D0, pre-check=3D0");
-    String command =3D request.getParameter("command");//to choose the pro=
cess to display
+%>
+<jesi:control cache=3D"no"/>
+<%
     JahiaUser theUser =3D (JahiaUser) session.getAttribute(ParamBean.SESSI=
ON_USER);
     Locale locale =3D (Locale) session.getAttribute(ParamBean.SESSION_LOCA=
LE);
+    StringBuffer buff =3D new StringBuffer();
     if (locale =3D=3D null) locale =3D request.getLocale();//fail-over loc=
ale
     boolean dispOK =3D true;//error flag
     String errorMessage =3D "initialization error!";
-    if(theUser=3D=3Dnull || theUser.getUsername().equals("guest")) {
-        dispOK=3Dfalse;
+    if (theUser =3D=3D null || theUser.getUsername().equals("guest")) {
+        dispOK =3D false;
         errorMessage =3D "please this page is reserved to logged users!";
     }
+
     // passed jobs
     List past =3D new ArrayList();
     String theUserKey =3D null;
     if (theUser =3D=3D null) {
         dispOK =3D false;
+        errorMessage =3D "please this page is reserved to logged users!";
     } else {
         theUserKey =3D theUser.getUserKey();
     }
@@ -60,50 +90,207 @@
     try {
         alls =3D service.getAllJobsDetails();
     } catch (JahiaException e) {
-        logger.debug("error",e);
+        logger.debug("error", e);
+        errorMessage =3D "getAllJobsDetails unavailable!";
         dispOK =3D false;
     }
     if (dispOK) {
         //looping to get all jobs
-        JobDetail jd=3Dnull;
-        dispOK=3Dfalse;
+        JobDetail jd =3D null;
+        dispOK =3D false;
+        // check for job requested
         for (java.util.Iterator iterator =3D alls.iterator(); iterator.has=
Next();) {
             jd =3D (JobDetail) iterator.next();
-            if(jd.getName().equals(request.getParameter("jd"))){
-                dispOK=3Dtrue;
+            if (jd.getName().equals(request.getParameter("jd"))) {
+                dispOK =3D true;
                 break;
             }
         }
+               if (!dispOK) {
+               errorMessage =3D "job not found!";
+               }
         if (dispOK) {
+
             TreeOperationResult result =3D (TreeOperationResult) jd.getJob=
DataMap().get("result");
-            if(command!=3Dnull){
-                    // warn only
-                    int count=3D0;
-                    for (java.util.Iterator iterator =3Dresult.getWarnings=
().iterator();iterator.hasNext();) {
-                        NodeImportResult thenode=3D (NodeImportResult)iter=
ator.next();
-                        count++;
-                        EngineMessage msg =3D thenode.getMsg();
-                        String keyValue =3D ResourceBundle.getBundle("Jahi=
aEnginesResources",locale).getString(msg.getKey());
-                        if (keyValue !=3D null && msg.getValues() !=3D nul=
l) {
-                            MessageFormat msgFormat =3D new MessageFormat(=
keyValue);
-                            msgFormat.setLocale(locale);
-                            out.println(msgFormat.format(msg.getValues()));
-                        }
 =

-                        //out.println(count+"-"+thenode.getComment()+" "+t=
henode.getLocalName()+" "+thenode.getQname()+" "+thenode.getImportString());
+                if(result.getWarnings().size()>0){
+                    buff.append("<br/><h2>Warnings</h2>");
+                }
+                // warn messages
+                int count =3D 0;
+                for (java.util.Iterator iterator =3D result.getWarnings().=
iterator(); iterator.hasNext();) {
+                    NodeOperationResult thenode =3D (NodeOperationResult) =
iterator.next();
+                    count++;
+                    EngineMessage msg =3D thenode.getMsg();
+                    String keyValue =3D ResourceBundle.getBundle("JahiaEng=
inesResources", locale).getString(msg.getKey());
+                    if (keyValue !=3D null && msg.getValues() !=3D null) {
+                        MessageFormat msgFormat =3D new MessageFormat(keyV=
alue);
+                        msgFormat.setLocale(locale);
+                        buff.append((msgFormat.format(msg.getValues())));
+                        buff.append("<br/>");
                     }
-            }
-            //out.print(result.toString());
-        } else {
-            out.print("error!!!");
-        }
-    } else {
+
+                    //out.println(count+"-"+thenode.getComment()+" "+theno=
de.getLocalName()+" "+thenode.getQname()+" "+thenode.getImportString());
+                }
+
+                if(result.getErrors().size()>0){
+                    buff.append("<br/><h2>Errors</h2>");
+                }
+                // error messages
+                count =3D 0;
+                for (java.util.Iterator iterator =3D result.getErrors().it=
erator(); iterator.hasNext();) {
+                                       NodeOperationResult thenode =3D 
(NodeOperationResult) iterator.next();
+                    count++;
+                    EngineMessage msg =3D thenode.getMsg();
+                    String keyValue =3D ResourceBundle.getBundle("JahiaEng=
inesResources", locale).getString(msg.getKey());
+                    if (keyValue !=3D null && msg.getValues() !=3D null) {
+                        MessageFormat msgFormat =3D new MessageFormat(keyV=
alue);
+                        msgFormat.setLocale(locale);
+                        buff.append((msgFormat.format(msg.getValues())));
+                        buff.append("<br/>");
+                    }
+                                       }
+                }
+    }
+
+    if (!dispOK) {
+        // error display
 %>
-il y a eu un probleme : <%=3DerrorMessage%>
+<jesi:control cache=3D"no"/>
+<html>
+<head><title><%=3DgetRessource("org.jahia.engines.processDisplay.title", l=
ocale)%>
+</title>
+</head>
+
+<body>
+<%=3DerrorMessage%><br>
+<script language=3D"javascript">
+    //document.close();//closing now!
+</script>
+</body>
+</html>
 <%
 =

 =

+} else {
+    // logs display
+%>
+<html>
+<head><title><%=3DgetRessource("org.jahia.engines.processDisplay.title", l=
ocale)%>
+</title>
+
+    <style type=3D"text/css">
+        body {
+            font-family: Verdana, Arial, Helvetica, sans-serif;
+            font-size: 12px;
+            font-style: normal;
+            font-weight: normal;
+            margin: 10px;
+            color: #838383;
+            background-color: #336699;
+        }
+
+        #poweredby {
+            color: #3E77B0;
+        }
+
+        td, th {
+            font-size: 12px;
+        }
+
+        h3 {
+            font-size: 16px;
+
+        }
+
+        h3, a {
+            color: #398EC3;
+            text-decoration: none;
+            font-weight: bold;
+
+        }
+
+        .version {
+            float: right;
+            text-align: right;
+            font-size: 9px;
+            vertical-align: bottom;
+        }
 =

+        #copyright {
+            font-family: Verdana, Arial, Helvetica, sans-serif;
+            font-size: 12px;
+            color: #838383;
 =

-}
-%>
\ No newline at end of file
+        }
+
+        .greyed {
+            color: #aaaaaa;
+            font-weight: bold;
+            background-color: #EEEEdd;
+        }
+
+        .crons {
+            color: #bbccbb;
+            background-color: #ddEEdd;
+        }
+
+
+    </style>
+
+
+</head>
+
+<body>
+
+<table cellspacing=3D"0" cellpadding=3D"15" width=3D"100%" border=3D"0" bg=
color=3D"#FFFFFF">
+    <tr valign=3D"bottom">
+        <td width=3D"48px">
+            <a href=3D"javascript:history.back()" alt=3D"back" title=3D"ba=
ck"><img src=3D"<%=3Drequest.getContextPath()%>/jsp/jahia/engines/images/ga=
uge.gif" width=3D"48" height=3D"48" border=3D"0"></a></td>
+        <td align=3D"left"><h3>
+            <%=3DgetRessource("org.jahia.engines.processDisplay.label", lo=
cale)%>
+        </h3></td>
+    </tr>
+
+    <tr>
+        <td colspan=3D"2"><%=3Dbuff.toString()%>
+        </td>
+    </tr>
+    <tr>
+        <td colspan=3D"2">
+
+            <table border=3D"0" width=3D"100%">
+                <tr>
+                    <td width=3D"48"><img name=3D"logo"
+                                        src=3D"<%=3Drequest.getContextPath=
()%>/jsp/jahia/images/logo-jahia.gif"
+                                        border=3D"0"
+                                        width=3D"45" height=3D"34"></td>
+                    <td><img
+                            src=3D"<%=3Drequest.getContextPath()%>/jsp/jah=
ia/engines/images/pix.gif" border=3D"0" width=3D"1"
+                            height=3D"10">
+
+                        <div id=3D"copyright"><%=3DJahia.COPYRIGHT%>&nbsp;
+                            <jahia:engineResourceBundle
+                                    resourceName=3D"org.jahia.Jahia.copyri=
ght.label"/>
+                        </div><span
+                            class=3D"version">Jahia <%=3DJahia.VERSION%>.<=
%=3DJahia.PATCH_NUMBER%> r<%=3D
+                        Jahia.BUILD_NUMBER%></span>
+
+                    </td>
+                </tr>
+            </table>
+        </td>
+    </tr>
+</table>
+<div id=3D"poweredby">
+    <span>Powered by Jahia</span>
+</div>
+<script language=3D"javascript">
+    // to erase del from GET request
+    if (window.location.search.indexOf("del=3D") !=3D -1) {
+        window.location =3D window.location.pathname;
+    }
+</script>
+</body>
+</html>
+<% } %>
\ No newline at end of file

Modified: trunk/core/src/webapp/jsp/jahia/processing/processing.jsp
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/trunk/core/src/webapp=
/jsp/jahia/processing/processing.jsp&rev=3D18469&repname=3Djahia
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/core/src/webapp/jsp/jahia/processing/processing.jsp (original)
+++ trunk/core/src/webapp/jsp/jahia/processing/processing.jsp Fri Sep 14 13=
:10:40 2007
@@ -1370,38 +1370,32 @@
 =

     switch (jobstatus) {
         case 0:
-            // errors
 %>
     <img src=3D"<%=3Drequest.getContextPath()%>/jsp/jahia/engines/images/i=
cons/workflow/errors.gif" width=3D"9" height=3D"10"
          border=3D"0"> <%=3DgetRessource("org.jahia.engines.processDisplay=
.error.message", locale)%>
-    <a href=3D"displaylog.jsp?command=3Derrors&jd=3D<%=3Djd.getName()%>">s=
ee <%=3Dresult.getErrors().size()%> errors</a>
     <%
             break;
         case 1:
     %>
     <img src=3D"<%=3Drequest.getContextPath()%>/jsp/jahia/engines/images/i=
cons/workflow/accept.gif" width=3D"9" height=3D"10"
          border=3D"0"> <%=3DgetRessource("org.jahia.engines.processDisplay=
.success.message", locale)%>
-       <a href=3D"displaylog.jsp?command=3Dall&jd=3D<%=3Djd.getName()%>">s=
ee all logs</a>
     <%
             break;
         case 2:
-            //warnings
     %>
     <img src=3D"<%=3Drequest.getContextPath()%>/jsp/jahia/engines/images/i=
cons/workflow/warnings.gif" width=3D"9" height=3D"10"
          border=3D"0"> <%=3DgetRessource("org.jahia.engines.processDisplay=
.error.message", locale)%>
     <%
-       if(result.getWarnings().size()>0){
-    %>
-      <%=3Dresult.getWarnings().size()%><a href=3D"displaylog.jsp?command=
=3Dwarn&jd=3D<%=3Djd.getName()%>">see the <%=3Dresult.getWarnings().size()%=
> warnings </a>
-    <%   }
                 break;
         }
-
-
+       if(result.getErrors().size()>0 || result.getWarnings().size()>0){
+    %>
+     <a href=3D"displaylog.jsp?jd=3D<%=3Djd.getName()%>"><%=3DgetRessource=
("org.jahia.engines.processDisplay.allmessages.message", locale)%></a>
+    <%
+        }
     %>
     <br>
     <br>
-
 </td></tr>
 <%
                 }//end of infoasked

_______________________________________________
cvs_list mailing list
[email protected]
http://lists.jahia.org/cgi-bin/mailman/listinfo/cvs_list

Reply via email to