dpillot 2005/12/22 15:27:48 CET
Modified files:
src/view/jsp/include processing_inc.jsp
Log:
js changes management of process popup window
Revision Changes Path
1.9 +43 -26
corporate_portal_templates/src/view/jsp/include/processing_inc.jsp
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/corporate_portal_templates/src/view/jsp/include/processing_inc.jsp.diff?r1=1.8&r2=1.9&f=h
Index: processing_inc.jsp
===================================================================
RCS file:
/home/cvs/repository/corporate_portal_templates/src/view/jsp/include/processing_inc.jsp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- processing_inc.jsp 21 Dec 2005 17:28:22 -0000 1.8
+++ processing_inc.jsp 22 Dec 2005 14:27:48 -0000 1.9
@@ -1,41 +1,51 @@
-<%@ page import="org.jahia.params.ParamBean" %>
-<%@ page import="org.jahia.services.usermanager.JahiaUser" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
-
<%
/**
* include jsp file to display inside a top admin bar in mode edit<br>
*
- * @version $Id: processing_inc.jsp,v 1.8 2005/12/21 17:28:22 dpillot
Exp $
+ * @version $Id: processing_inc.jsp,v 1.9 2005/12/22 14:27:48 dpillot
Exp $
*/
- String urlpdisp = "#";
- String server = request.getServerName();
- int port = request.getServerPort();
- String context = request.getContextPath();
- String ajaxpath = "http://" + server + ":" + port + context +
"/ajaxaction/PDisp";
+ String urlpdisp = "#";//the url of detailed process window
+ String path = "http://" + request.getServerName() + ":" +
request.getServerPort() + request.getContextPath();//jahia path
+ String ajaxpath = path + "/ajaxaction/PDisp";//url of ajax call
- //urlpdisp = "javascript:openDisp('http://" + server + ":" + port +
context + "/jsp/jahia/engines/importexport/processing.jsp',900,400)";
+ urlpdisp = "javascript:openDisp('" + path +
"/jsp/jahia/engines/importexport/processing.jsp',900,400)";
%>
<script src="<jahia:serverHttpPath
/>/jsp/jahia/javascript/prototype.js"></script>
<script>
+ //default values
+ monitordisp = null;//window
+ oldvalue1 = 0;
+ freqCall = 10;//frequency of call ajax
+
- monitordisp=null;//window
+ //functions
// open display
- function openDisp(url,width,height) {
+ function openDisp(url, width, height) {
- if(monitordisp !=null && !monitordisp.closed) {
- monitordisp.close();
- return;
- }
- params = "width=" + width + ",height=" + height +
",resizable=yes,scrollbars=yes,status=no";
- monitordisp=window.open(url,"monitordisp",params);
+ closeDisplay();
+ params = "width=" + width + ",height=" + height +
",resizable=yes,scrollbars=yes,status=no";
+ monitordisp = window.open(url, "monitordisp", params);
+
+ }
- }
+ //close display
+ function closeDisplay() {
+ if (monitordisp != null && !monitordisp.closed) {
+ monitordisp.close();
+ }
+ }
+ //refresh
+ function refreshDisplay() {
+ if (monitordisp != null && !monitordisp.closed) {
+ monitordisp.location.reload();
+ }
+ }
// failure case
function stopping(request) {
//alert("authentication pbms");
@@ -47,7 +57,7 @@
{
// the ajax updater object without a update container (see
documentation)
var url = '<%=ajaxpath%>';
- var myAjax = new Ajax.PeriodicalUpdater({}, url, {onSuccess:
showResponse, onFailure:stopping, frequency: 30});
+ var myAjax = new Ajax.PeriodicalUpdater({}, url, {onSuccess:
showResponse, onFailure:stopping, frequency: freqCall});
myAjax.start();
}
@@ -58,18 +68,23 @@
value1 = xdoc.getElementsByTagName('count')[0].firstChild.data;
value2 = xdoc.getElementsByTagName('running')[0].firstChild.data;
- //alert("v1="+value1);
- //alert("v2="+value2);
+
+ if (value1 != oldvalue1) {
+ if (value1 > 0) {
+ refreshDisplay();
+ } else {
+ closeDisplay();
+ }
+ oldvalue = value1;
+ }
if (value1 == 0) {
// empty table
stringh = '<table border="0" cellspacing="0"
cellpadding="0"><tr><td bgcolor="#AAAAAA"><img src="<jahia:serverHttpPath
/>/jsp/jahia/engines/images/pix.gif" width="25" height="12"
/></td></tr></table>';
document.getElementById('plink').href = "#";
- //close the window since there is no process to display
- if(monitordisp !=null && !monitordisp.closed) {
- monitordisp.close();
- }
+ //close the window since there is no process to display
+ closeDisplay();
} else {
document.getElementById('plink').href = "<%=urlpdisp%>";
@@ -94,8 +109,10 @@
document.getElementById('running').innerHTML = " (" + value2 +
") ";
}
+
//start the monitor display
monitor();
+
</script>
<tr><td>
<img src="<jahia:contextURL/>/images/pix.gif" width="1" height="3"/>