...

View Full Version : Reload page after no user activity



Jaffa_Kree2k5
05-25-2005, 02:25 AM
Hello, I am trying to incorporate a script that will refresh a page after there has been no activty for 1 minute. My page seems to refresh no matter what. Any insight on what's wrong with my code?


<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
<!--
if (document.layers) {
window.captureEvent(onMouseMove);
}

window.onMouseMove = reloadPage;
var tID = '';

function reloadPage() {
window.clearTimeout(tID); // reset the timer
tID = setTimeout("window.location=\'index.cfm?
fuseaction=printing.checkjobs\'",100000); // refresh the page in 1
minute after no activity
}

//-->
</SCRIPT>

<body onLoad="reloadPage()">

Harry Armadillo
05-25-2005, 02:42 AM
Don't capitalize onmousemove.

window.onmousemove = reloadPage;

Jaffa_Kree2k5
05-25-2005, 01:26 PM
I did that and nothing seems to be happening. No page refresh. I will continue to work on it unless someone else has a suggestion or code that works.

I will strip it out of my app and see what it does indepently.

UPDATE:
After stripping out of my app it reloads all the time whether there is activity or not, but within my app it does not refresh at all. Weird...

Thanks in advance for any insight.

Harry Armadillo
05-25-2005, 10:17 PM
I tested your code snippet with onmousemove and it worked just as expected -- keep moving the mouse, no refresh; hold still too long, refresh.

Got a link to your whole page?

Jaffa_Kree2k5
05-25-2005, 10:32 PM
Well, it works in Firefox, but not in IE6 and that is what everyone uses here. I don't have a link to the specific page since it's an internal application. Also, it exceeds the maximum lines for posting.

Any ideas why it won't work in IE6?

Harry Armadillo
05-25-2005, 10:40 PM
I ran it on IE5.5, I can't imagine why IE6 would be having problems...perhaps try with it document.onmousemove.

Zipping the page is possible - either attaching the zip or posting a link to where you host it.

Jaffa_Kree2k5
05-25-2005, 10:51 PM
Actually, I think it may fit. I tried the script using document.onmousemove in a separate file with just plain text and it worked. When I use it for my page, it does nothing.
------------------------------------------------------------------
<a name="top"></a>

<cfsavecontent variable="sort_script">
<script type="text/javascript" src="scripts/sorttable.js"></script>
<script type="text/javascript" src="scripts/reload.js"></script>
</cfsavecontent>

<cfhtmlhead text="#sort_script#"/>


<body onLoad="reloadPage()">

<cfif attributes.qryGetOrders.recordcount>
<cfquery name="ordsearch" dbtype="query">
SELECT * FROM attributes.qryGetOrders ORDER BY Comp_Order_Ship_Date, EK_ClientName, EK_ProductName, EK_OrderID
</cfquery>
<cfelse>
<cfset ordsearch = attributes.qryGetOrders/>
</cfif>


<CFOUTPUT>

<cfsavecontent variable="table">

#app.GenTable#
<TR BGCOLOR="#app.S_Color.TableHeader#">
<th>Complete</th>
<th>Check Out</th>
<th>Ship Date</th>
<th>Order ID</th>
<th>Product</th>
<th>Plan Sponsor</th>
<th>Order Status</th>
<th>Order Date</th>
<th>Total Qty</th>

</tr>

<!--- Sets up the first line of the tab-delimited file --->

<cfset output="Ship Date" & chr(9) & "Order ID" & chr(9) & "Product" & chr(9) & "Plan Sponsor" & chr(9) & "Order Status" & chr(9) & "Order Date" & chr(9) & "Total Qty" & chr(10)>

<CFLOOP QUERY="ordsearch">
<cfset show = 1>

<cfif len(EK_FullFill_Cmmts) and AcctMgrReleased eq 0>
<cfset show = 0>
</cfif>

<cfif ShippingInstructionsExist and AcctMgrReleased eq 0>
<cfset show = 0>
</cfif>

<cfif show eq 1>
<!--- Process the Plan name filter if any --->
<!--- <cfset orddisp = System_Abbr & "-" & EK_OrderID>
<cfset shipdate = DateFormat(comp_order_ship_date, "mm/dd/yyyy")>
<cfset orderdate = DateFormat(EK_OrderTS, "mm/dd/yyyy")> --->
<!--- Process the order id filter if any --->

<TR BGCOLOR="#app.S_Color.Table#" ALIGN="CENTER">
<td>
<cfif Status_Code eq 3 or Status_Code eq 6>
<cfif CheckedOut EQ 0>
<cfif Status_Code NEQ 6>
<input type="CheckBox" name="CheckInOrderID" value="#OrderID#">
<cfelse>
<img src="../images/icons/Rarrow.gif" alt="&nbsp;">
</cfif>
<cfelse>
<img src="../images/icons/Rarrow.gif" alt="&nbsp;">
</cfif>
<cfelse>
&nbsp;
</cfif>
</td>
<td>
<cfif Status_Code eq 3 or Status_Code eq 6>
<cfif CheckedOut EQ 0>
<a href="index.cfm?fuseaction=printing.checkoutjob&CheckOutOrder=#OrderID#">
<img src="../images/icons/view.gif" alt="View"></a>
<cfelse>

<font color="red">#UserName#</font>
</cfif>
<cfelse>
&nbsp;
</cfif>
</td>
<TD>#shipdate#</TD>
<td><a href="index.cfm?fuseaction=printing.ordrpt&orderid=#OrderID#">#orddisp#
<cfif len(ordsuffix)>_#ordsuffix#</cfif></a>

<cfif MessageExists>
<A HREF="javascript:popUp('../dsp/dsp_viewnotes.cfm?orderid=#OrderID#&maindsn=#request.maindsn#')">
<img src="../images/icons/help3.gif" alt="&nbsp;" border=0></a>
</cfif></td>
<td>#prodname#</td>
<td>#left(compname, 10)#</td>
<TD><cfif Status_Code_Desc EQ "On Hold">
<font color="red">#Status_Code_Desc#</font>
<cfelse>
#Status_Code_Desc#
</cfif>
</TD>
<TD>#orderdate#</TD>
<td>#TotQty#</td>

</tr>

<!--- Prepare the line for the tab delimited file --->

<cfset output = output & shipdate & chr(9) & orddisp& chr(9) & Plan_Sponsor & chr(9) & left(compname, 10)& chr(9) & Status_Code_Desc& chr(9) & orderdate & chr(9) & TotQty & chr(9) >

</cfif>

</cfloop>

</cfsavecontent>


#request.orderQueueSearchForm#

<cfif ordsearch.RecordCount GT 5>
<table width="98%" border="0">
<tr>
<td width="90%" colspan="3">&nbsp;</td>
<td width="8%" align="center" bgcolor="##CCCCCC"><a href="##bottom"><font face="Arial" size="2"><strong>Bottom of Page</strong></font></a></td>
</tr>
<tr>

<td align="right">
<form action="index.cfm?fuseaction=printing.quickcomplete" method="post" >
<input type="Submit" name="QuickC" value="Quick Complete">
</form>
</td>
<td align="right">

<form action="index.cfm?fuseaction=printing.exportcsv" method="post" target="_blank">
<input type="hidden" name="output" value="#output#">
<input type="Submit" name="ExportXL" value="Export to Excel">
</form>

</td>
<td align="center">
<form action="index.cfm?fuseaction=#myfusebox.originalcircuit#.main" method="post">
<input type="Submit" name="Cancel" value="Cancel/Return to #main.section# Menu">
</form>
</td>
<td>&nbsp;</td>
</tr>
</table>
</cfif>
<br>
<br>
<P><B>The following orders are available to print:</B></P>


<!--- Table modified to have Sortable Columns --->

<FORM>

#table#

</TABLE>
<br>
<b>Initials:</b> <input type="text" Name="Initial" Size="20" Maxlength="50">
<br>
<a name="bottom"></a>
<br><br>

<table width="98%" border="0">
<tr>
<td width="90%" colspan="4">&nbsp;</td>
<td width="8%" align="center" bgcolor="##CCCCCC">
<a href="##top"><font face="Arial" size="2"><strong>Top of Page</strong></font></a>
</td>
</tr>
<tr>
<td align="right"><input type="Reset" name="ResetForm" value="Reset Choice"></td>
</form>
<td align="right">
<form action="index.cfm?fuseaction=printing.quickcomplete" method="post" ><br>
<input type="Submit" name="QuickC" value="Quick Complete">
</form>
</td>
<td align="right">
<form action="index.cfm?fuseaction=printing.exportcsv" method="post" target="_blank"><br>

<input type="hidden" name="output" value="#output#">
<input type="Submit" name="ExportXL" value="Export to Excel">
</form>
</td>
<td align="center">
<form action="index.cfm?fuseaction=#myfusebox.originalcircuit#.main" method="post"><br>

<input type="Submit" name="Cancel" value="Cancel/Return to #main.section# Menu">
</form>
</td>
<td>&nbsp;</td>
</tr>
</table>

</cfoutput>

</body>

Harry Armadillo
05-25-2005, 11:34 PM
Yeah, well, that wasn't too useful. A fellow would have to see the page as the browswer sees it, not the assorted coldfusion junk. I got no way of knowing where/how the script could be sabotaged.

Mr J
05-26-2005, 02:31 PM
Try it this way


<HTML>
<HEAD>
<TITLE>Document Title</TITLE>
<script type="text/javascript">
<!--

if (document.layers) {
window.captureEvent(onMouseMove);
}

document.onmousemove = oreset

var tID = '';

function oreset(){
clearTimeout(tID)
count=0
reloadPage()
}

function reloadPage(){
count++
if(count==60){ // 1 minite
window.location=\'index.cfm?fuseaction=printing.checkjobs\'
}
tID = setTimeout("reloadPage()",1000);
}

//-->
</script>
</HEAD>
<BODY onload="oreset()">



</BODY>
</HTML>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum