Author: ktlili
Date: Tue Oct 16 16:33:36 2007
New Revision: 18883

URL: https://svndev.jahia.net/websvn/listing.php?sc=3D1&rev=3D18883&repname=
=3Djahia
Log:
- JAHIA-2465: pDisplay --> un-reference var when they are no longer used + =
pretty print

Modified:
    branches/JAHIA-5-0-SP-BRANCH/core/src/webapp/jsp/jahia/topbar/processin=
g.inc

Modified: branches/JAHIA-5-0-SP-BRANCH/core/src/webapp/jsp/jahia/topbar/pro=
cessing.inc
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/branches/JAHIA-5-0-SP=
-BRANCH/core/src/webapp/jsp/jahia/topbar/processing.inc&rev=3D18883&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
--- branches/JAHIA-5-0-SP-BRANCH/core/src/webapp/jsp/jahia/topbar/processin=
g.inc (original)
+++ branches/JAHIA-5-0-SP-BRANCH/core/src/webapp/jsp/jahia/topbar/processin=
g.inc Tue Oct 16 16:33:36 2007
@@ -14,8 +14,9 @@
 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"java.util.Locale" %>
-<%@ page import=3D"java.util.ResourceBundle"%>
+--%>
+<%@ page import=3D"java.util.Locale" %>
+<%@ page import=3D"java.util.ResourceBundle" %>
 =

 =

 <%
@@ -28,45 +29,55 @@
     String urlpdisp =3D "";//the url of detailed process window
 =

     String ajaxpath =3D path + "/ajaxaction/PDisp";//url of ajax call
-    Locale loc=3DjParams.getLocale();
+    Locale loc =3D jParams.getLocale();
     String reloadmessage =3D ResourceBundle.getBundle("jahiatemplates.comm=
on", loc).getString("reload");
-    urlpdisp =3D "javascript:openDisp('" + path + "/jsp/jahia/processing/p=
rocessing.jsp',900,500)";
+    urlpdisp =3D "javascript:openDisp('" + path + "/jsp/jahia/processing/p=
rocessing.jsp',900,700)";
 %>
 =

 =

-
-
 <script language=3D"javascript">
 =

 =

 //default values
-monitordisp =3D null;//window
-oldvalue1 =3D 0;
-oldvalue2 =3D 0;
-freqCall =3D 5;//frequency
-count =3D 0;
-cronlimit =3D 1;// set the limit in hour to display crons
-var watchcount=3D0;
+var monitordisp =3D null;
+//window
+var oldvalue1 =3D 0;
+var oldvalue2 =3D 0;
+var freqCall =3D 5;
+//frequency
+var count =3D 0;
+var cronlimit =3D 1;
+// set the limit in hour to display crons
+var watchcount =3D 0;
 var watcher;
 //functions
 =

 //internal function to get a value in a xml document
 // xdoc: xml doc, id: tagname, def: default return value
-function getElementValueFromXmlDoc(xdoc,id,def){
-       if(!xdoc || !xdoc.getElementsByTagName(id)) return def;
-       var currentagobject =3D xdoc.getElementsByTagName(id);
-       if(currentagobject.length>0) return currentagobject[0].firstChild.data;
-       return def;
+function getElementValueFromXmlDoc(xdoc, id, def) {
+    if (!xdoc || !xdoc.getElementsByTagName(id)) {
+        return def;
+    }
+    var currentagobject =3D xdoc.getElementsByTagName(id);
+    if (currentagobject.length > 0) {
+        return currentagobject[0].firstChild.data;
+    }
+    return def;
 }
 =

 // open display
 function openDisp(url, width, height) {
 =

-    closeDisplay();//close previous if any
-    url=3Durl+"?cl=3D"+cronlimit;
-    params =3D "width=3D" + width + ",height=3D" + height + ",resizable=3D=
yes,scrollbars=3Dyes,status=3Dno";
+    closeDisplay();
+    //close previous if any
+    var url =3D url + "?cl=3D" + cronlimit;
+    var params =3D "width=3D" + width + ",height=3D" + height + ",resizabl=
e=3Dyes,scrollbars=3Dyes,status=3Dno";
     monitordisp =3D window.open(url, "monitordisp", params);
 =

+    //un-reference var.
+    url =3D null;
+    params =3D null;
+
 }
 =

 //close display function
@@ -76,18 +87,24 @@
 =

 //refresh function
 function refreshDisplay() {
-    if (monitordisp !=3D null && !monitordisp.closed) monitordisp.location=
.reload();
+    if (monitordisp !=3D null && !monitordisp.closed) {
+        monitordisp.location.reload();
+    }
 }
 =

 // failure case
 function stopping(request) {
-    document.write=3Drequest.responseText;
-    watcher.currentlyExecuting=3Dtrue;//stopping the process watcher
-    if(notifier) notifier.currentlyExecuting=3Dtrue;//stopping the chat no=
tifier
+    document.write =3D request.responseText;
+    watcher.currentlyExecuting =3D true;
+    //stopping the process watcher
+    if (notifier) {
+        notifier.currentlyExecuting =3D true;
+        //stopping the chat notifier
+    }
 }
 =

-function watch(){
-       //the ajax periodical object
+function watch() {
+    //the ajax periodical object
     watcher =3D new PeriodicalExecuter(monitor, freqCall);
 }
 =

@@ -96,50 +113,53 @@
 {
     // the ajax updater object without a update container (see documentati=
on)
     var url =3D '<%=3Dajaxpath%>';
-    var pars =3D 'cl=3D'+cronlimit;
-    do_ajax =3D new Ajax.Request(url, {parameters: pars, onSuccess: showRe=
sponse, onFailure: stopping});
-//alert("monitor");
+    var pars =3D 'cl=3D' + cronlimit;
+    var do_ajax =3D new Ajax.Request(url, {parameters: pars, onSuccess: sh=
owResponse, onFailure: stopping});
+
+    // un reference var
+    url =3D null;
+    pars =3D null;
+    do_ajax =3D null;
+
 }
 =

 function refreshMonitor() {
     //myAjax.start();
-    watcher.currentlyExecuting=3Dfalse;
+    watcher.currentlyExecuting =3D false;
 }
 =

 function stopMonitor() {
-    watcher.currentlyExecuting=3Dtrue;
-    watcher=3Dnull;
-    watchcount=3D0;
+    watcher.currentlyExecuting =3D true;
+    watcher =3D null;
+    watchcount =3D 0;
 }
 //to render results
-function showResponse(request)
-{
-
+function showResponse(request) {
 =

     watchcount++;
     var xdoc =3D request.responseXML;
     //alert(xdoc);
-    var value1 =3D getElementValueFromXmlDoc(xdoc,'started',0);
-    var value2 =3D getElementValueFromXmlDoc(xdoc,'running',0);
-    var value3 =3D getElementValueFromXmlDoc(xdoc,'otherrunning',0);
-    var value4 =3D getElementValueFromXmlDoc(xdoc,'waiting',0);
-    var value5 =3D getElementValueFromXmlDoc(xdoc,'otherwaiting',0);
-    var value6 =3D getElementValueFromXmlDoc(xdoc,'pooled',0);
-    var value7 =3D getElementValueFromXmlDoc(xdoc,'reload',"false");
+    var value1 =3D getElementValueFromXmlDoc(xdoc, 'started', 0);
+    var value2 =3D getElementValueFromXmlDoc(xdoc, 'running', 0);
+    var value3 =3D getElementValueFromXmlDoc(xdoc, 'otherrunning', 0);
+    var value4 =3D getElementValueFromXmlDoc(xdoc, 'waiting', 0);
+    var value5 =3D getElementValueFromXmlDoc(xdoc, 'otherwaiting', 0);
+    var value6 =3D getElementValueFromXmlDoc(xdoc, 'pooled', 0);
+    var value7 =3D getElementValueFromXmlDoc(xdoc, 'reload', "false");
 =

     //if(watchcount<2) value7=3D"false";
     var x =3D parseInt(value3);
     var y =3D parseInt(value5);
     var other =3D x + y;
 =

-       var thereload=3Ddocument.getElementById('mx');
-       var thebar=3Ddocument.getElementById('bar');
+    var thereload =3D document.getElementById('mx');
+    var thebar =3D document.getElementById('bar');
 =

-     // update the message
-    if (value2 < oldvalue2 || value7=3D=3D"true") {
+    // update the message
+    if (value2 < oldvalue2 || value7 =3D=3D "true") {
         //reload the page
         //window.reload();
-               // display reloading message warning
+        // display reloading message warning
         //stringmx =3D "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src=3D\"<conten=
t:serverHttpPath />/jsp/jahia/engines/images/reloadicon.gif\" width=3D\"10\=
" height=3D\"10\"/><a href=3D'javascript:window.location.reload()'><%=3Drel=
oadmessage%></a>";
         thereload.innerHTML =3D "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src=3D=
\"<content:serverHttpPath />/jsp/jahia/engines/images/reloadicon.gif\" widt=
h=3D\"10\" height=3D\"10\"/><a href=3D'javascript:window.location.reload()'=
><%=3Dreloadmessage%></a>";
     } else {
@@ -150,7 +170,7 @@
         count++;
     }
 =

-       // update the processing window if open
+    // update the processing window if open
     if (value1 !=3D oldvalue1) {
         if (value1 > 0) refreshDisplay();
         oldvalue1 =3D value1;
@@ -163,79 +183,96 @@
     var stringh =3D '<table border=3D"0" cellspacing=3D"0" cellpadding=3D"=
0"><tr>';
     var barcount =3D 0;
 =

-    //1st running bars
-    for (var n =3D 0; n < value2; n++) {
-        //add my running bar(s)
-         stringh =3D stringh + '<td bgcolor=3D"#AAAAAA"><img src=3D"<conte=
nt:serverHttpPath />/jsp/jahia/engines/images/p0.gif" width=3D"5" height=3D=
"12" /></td>';
-         barcount ++;
-        if(barcount>9){
-            stringh =3D stringh + '</tr></table>';
-            thebar.innerHTML =3D stringh;
-            return ;
+    try {
+        //1st running bars
+        for (var n =3D 0; n < value2; n++) {
+            //add my running bar(s)
+            stringh =3D stringh + '<td bgcolor=3D"#AAAAAA"><img src=3D"<co=
ntent:serverHttpPath />/jsp/jahia/engines/images/p0.gif" width=3D"5" height=
=3D"12" /></td>';
+            barcount ++;
+            if (barcount > 9) {
+                stringh =3D stringh + '</tr></table>';
+                thebar.innerHTML =3D stringh;
+                return;
             }
-    }
+        }
 =

-    //2nd waiting bars
-    for (var n =3D 0; n < value4; n++) {
-        //add my waiting bar(s)
-         stringh =3D stringh + '<td bgcolor=3D"#AAAAAA"><img src=3D"<conte=
nt:serverHttpPath />/jsp/jahia/engines/images/p1.gif" width=3D"5" height=3D=
"12" /></td>';
-         barcount ++;
-        if(barcount>9){
-            stringh =3D stringh + '</tr></table>';
-            thebar.innerHTML =3D stringh;
-            return ;
+        //2nd waiting bars
+        for (var n =3D 0; n < value4; n++) {
+            //add my waiting bar(s)
+            stringh =3D stringh + '<td bgcolor=3D"#AAAAAA"><img src=3D"<co=
ntent:serverHttpPath />/jsp/jahia/engines/images/p1.gif" width=3D"5" height=
=3D"12" /></td>';
+            barcount ++;
+            if (barcount > 9) {
+                stringh =3D stringh + '</tr></table>';
+                thebar.innerHTML =3D stringh;
+                return;
             }
-    }
-    // 3rd other runnings
-    for (var n =3D 0; n < value3; n++) {
-        //add other running bar(s)
-         stringh =3D stringh + "<td bgcolor=3D'#AAAA00'><a href=3D'' style=
=3D'color: #CCCC00; font-size: 10px;' title=3D'<content:resourceBundle reso=
urceBundle=3D"jahiatemplates.common" resourceName=3D"process" defaultValue=
=3D"Process"/> "+(n+1)+"'>I</a></td>";
-         barcount ++;
-        if(barcount>9){
-            stringh =3D stringh + '</tr></table>';
-            thebar.innerHTML =3D stringh;
-            return ;
+        }
+        // 3rd other runnings
+        for (var n =3D 0; n < value3; n++) {
+            //add other running bar(s)
+            stringh =3D stringh + "<td bgcolor=3D'#AAAA00'><a href=3D'' st=
yle=3D'color: #CCCC00; font-size: 10px;' title=3D'<content:resourceBundle r=
esourceBundle=3D"jahiatemplates.common" resourceName=3D"process" defaultVal=
ue=3D"Process"/> " + (n + 1) + "'>I</a></td>";
+            barcount ++;
+            if (barcount > 9) {
+                stringh =3D stringh + '</tr></table>';
+                thebar.innerHTML =3D stringh;
+                return;
             }
-    }
+        }
 =

-    // 4th other waintings
-    for (var n =3D 0; n < value5; n++) {
-        //add other waitings bar(s)
-         stringh =3D stringh + "<td bgcolor=3D'#AAAA00'><a href=3D'' style=
=3D'color: #CCCC00; font-size: 10px;' title=3D'other waitings:"+n+"'>I</a><=
/td>";
-         barcount ++;
-        if(barcount>9){
-            stringh =3D stringh + '</tr></table>';
-            thebar.innerHTML =3D stringh;
-            return ;
+        // 4th other waintings
+        for (var n =3D 0; n < value5; n++) {
+            //add other waitings bar(s)
+            stringh =3D stringh + "<td bgcolor=3D'#AAAA00'><a href=3D'' st=
yle=3D'color: #CCCC00; font-size: 10px;' title=3D'other waitings:" + n + "'=
>I</a></td>";
+            barcount ++;
+            if (barcount > 9) {
+                stringh =3D stringh + '</tr></table>';
+                thebar.innerHTML =3D stringh;
+                return;
             }
-    }
+        }
 =

-    // finally display crons
-    for (var n =3D 0; n < value6; n++) {
-        //add other waitings bar(s)
-         stringh =3D stringh + "<td bgcolor=3D'#00AA00'><a href=3D'' style=
=3D'color: #00CC00; font-size: 10px;' title=3D'crons:" + n + "'>I</a></td>";
-         barcount ++;
-        if(barcount>9){
-            stringh =3D stringh + '</tr></table>';
-            thebar.innerHTML =3D stringh;
-            return ;
+        // finally display crons
+        for (var n =3D 0; n < value6; n++) {
+            //add other waitings bar(s)
+            stringh =3D stringh + "<td bgcolor=3D'#00AA00'><a href=3D'' st=
yle=3D'color: #00CC00; font-size: 10px;' title=3D'crons:" + n + "'>I</a></t=
d>";
+            barcount ++;
+            if (barcount > 9) {
+                stringh =3D stringh + '</tr></table>';
+                thebar.innerHTML =3D stringh;
+                return;
             }
-    }
-    // complete with empty bars
+        }
+        // complete with empty bars
 =

-    if(barcount<9){
+        if (barcount < 9) {
 =

-        for (var n =3D 0; n < 9-barcount; n++) {
-           stringh =3D stringh + "<td bgcolor=3D'#AAAAAA'><img src=3D'<con=
tent:serverHttpPath />/jsp/jahia/engines/images/pix.gif' width=3D'5' height=
=3D'12' /></td>";
+            for (var n =3D 0; n < 9 - barcount; n++) {
+                stringh =3D stringh + "<td bgcolor=3D'#AAAAAA'><img src=3D=
'<content:serverHttpPath />/jsp/jahia/engines/images/pix.gif' width=3D'5' h=
eight=3D'12' /></td>";
             }
-    }
+        }
 =

-   stringh =3D stringh + '</tr></table>';
-   thebar.innerHTML =3D stringh;
+        stringh =3D stringh + '</tr></table>';
+        thebar.innerHTML =3D stringh;
 =

-    if(watchcount>90) {
-        // stop the watcher of the pdisplay after 6 min iddle
-        stopMonitor();
+        if (watchcount > 90) {
+            // stop the watcher of the pdisplay after 6 min iddle
+            stopMonitor();
+        }
+    } finally {
+        value1 =3D null;
+        value2 =3D null;
+        value3 =3D null;
+        value4 =3D null;
+        value5 =3D null;
+        value6 =3D null;
+        value7 =3D null;
+        x =3D null;
+        y =3D null;
+        other =3D null;
+        thereload =3D null;
+        thebar =3D null;
+        stringh =3D null;
+        barcount =3D null;
     }
 }
 =

@@ -246,15 +283,26 @@
 =

 </script>
 <table border=3D"0" cellspacing=3D"0" cellpadding=3D"0">
-<tr height=3D"12" id=3D"processingBoxFirstRow">
-    <td height=3D"12"><img src=3D"<content:serverHttpPath />/jsp/jahia/eng=
ines/images/fondp1.gif" width=3D"6" height=3D"12"/></td>
-    <td bgcolor=3D"#EEEEEE"><a href=3D"<%=3Durlpdisp%>" id=3D"plink"><cont=
ent:resourceBundle resourceBundle=3D"jahiatemplates.common" resourceName=3D=
"process" defaultValue=3D"Process"/></a>&nbsp;</td>
-    <td bgcolor=3D"#AAAAAA"><div id=3D"bar"></div></td>
-    <td><img src=3D"<content:serverHttpPath />/jsp/jahia/engines/images/fo=
ndp2.gif" width=3D"6" height=3D"12"/></td>
-    <td><img src=3D"<content:serverHttpPath />/jsp/jahia/engines/images/pi=
x.gif" width=3D"30" height=3D"1" border=3D"0"/></td>
-</tr>
-<tr>
-  <td colspan=3D"9"><div id=3D"mx" style=3D"color: black; font-size: 9px; =
font-family: Arial, Helvetica, sans-serif;"><img src=3D"<content:serverHttp=
Path />/jsp/jahia/engines/images/pix.gif" width=3D"100" height=3D"5" border=
=3D"0"/></div></td>
-</tr>
+    <tr height=3D"12" id=3D"processingBoxFirstRow">
+        <td height=3D"12"><img src=3D"<content:serverHttpPath />/jsp/jahia=
/engines/images/fondp1.gif" width=3D"6"
+                             height=3D"12"/></td>
+        <td bgcolor=3D"#EEEEEE"><a href=3D"<%=3Durlpdisp%>" id=3D"plink">
+            <content:resourceBundle resourceBundle=3D"jahiatemplates.commo=
n" resourceName=3D"process"
+                                    defaultValue=3D"Process"/>
+        </a>&nbsp;</td>
+        <td bgcolor=3D"#AAAAAA">
+            <div id=3D"bar"></div>
+        </td>
+        <td><img src=3D"<content:serverHttpPath />/jsp/jahia/engines/image=
s/fondp2.gif" width=3D"6" height=3D"12"/></td>
+        <td><img src=3D"<content:serverHttpPath />/jsp/jahia/engines/image=
s/pix.gif" width=3D"30" height=3D"1" border=3D"0"/>
+        </td>
+    </tr>
+    <tr>
+        <td colspan=3D"9">
+            <div id=3D"mx" style=3D"color: black; font-size: 9px; font-fam=
ily: Arial, Helvetica, sans-serif;"><img
+                    src=3D"<content:serverHttpPath />/jsp/jahia/engines/im=
ages/pix.gif" width=3D"100" height=3D"5"
+                    border=3D"0"/></div>
+        </td>
+    </tr>
 </table>
 =


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

Reply via email to