Is it possible, either through external javascript, or using a separate app, to access the value of the number of seconds remaining on the activity timer when a user closes the browser?
Right now, we use a separate timer app that counts down and writes the number of seconds remaining to a web server when the user logs off. This way, users can be given 2 hours per day of total time, but when they log off, the amount of time they've used so far is recorded, and that value is used when they log on again.
I was hoping to simplify the process by using the activity timer in PWB to keep track of time instead of a separate timer app, but this would require access to the value of the timer.
Any ideas/suggestions would be greatly appreciated!
access timer value?
Moderators: Tyler, Scott, PWB v2 Moderator
I guess the text file option would be best. I would need to figure out how to save that number, along with the user's login on a server.
If the user was authenticated by a perl script, and the script returned the user's time remaining and login back to PWB, is there a way for PWB to send both pieces of information back to the server when it exits?
Thank you for the reply!
If the user was authenticated by a perl script, and the script returned the user's time remaining and login back to PWB, is there a way for PWB to send both pieces of information back to the server when it exits?
Thank you for the reply!
What are you storing the login information in? For example if you are using an online database such as MySQL, I could create a PWB add-on that navigates to a specific URL with areguments to pass the information onto the database.
Other wise I could have PWB write the information to a text file and you could use the PWB exit script to read the information and store it as needed.
--Scott
Other wise I could have PWB write the information to a text file and you could use the PWB exit script to read the information and store it as needed.
--Scott
The way we're doing it now, the first time a user logs on for the day, they are authenticated against the ILS database, and the amount of time allotted for the day is sent to the client application, which includes a timer to count down the available time. The login script on the server also records the user's login and the allotted time in a flat text file.
When the user logs off or closes the browser, the client app sends back to the server the amount of time left for that user. The server script replaces the original amount of time left in the flat file with the new value.
If the user logs on again, the server login script first checks the flat file for that login, and if found, returns the amount of time that the user has left in the flat file.
The data could easily be stored in a mysql database instead of a flat file. In fact if a database was used, we could probably give users the ability to save their own favorites files and other preferences in the db as well?
When the user logs off or closes the browser, the client app sends back to the server the amount of time left for that user. The server script replaces the original amount of time left in the flat file with the new value.
If the user logs on again, the server login script first checks the flat file for that login, and if found, returns the amount of time that the user has left in the flat file.
The data could easily be stored in a mysql database instead of a flat file. In fact if a database was used, we could probably give users the ability to save their own favorites files and other preferences in the db as well?
I added the following settings to PWB v2.10.6f currently available on our Beta Download page.
Added [Browser] ExitPage= Sets exit page URL PWB navigates to when exiting.
Added [Java] JavaClose= Closes PWB with bypass for disable exit and restart on close.
Added [Java] JavaSetActivity= Sets activity timer time.
Added [Java] JavaGetActivity= Gets activity timer time.
Using these in conjunction with the [Browser] DisableExit=True you can force the user to an exit page that can record the time left on the activity timer.
For example set the following in your INI file.
[Browser]
DisableExit=True
ExitPage=http://pwb.team2s.com/exit.htm
[Java]
JavaClose=ClosePWB
JavaGetActivity=GetActivity
You could also use the Confirm Close dialog if you have it setup as an HTML type instead of the Exit Page to get the Activity time left.
--Scott
Added [Browser] ExitPage= Sets exit page URL PWB navigates to when exiting.
Added [Java] JavaClose= Closes PWB with bypass for disable exit and restart on close.
Added [Java] JavaSetActivity= Sets activity timer time.
Added [Java] JavaGetActivity= Gets activity timer time.
Using these in conjunction with the [Browser] DisableExit=True you can force the user to an exit page that can record the time left on the activity timer.
For example set the following in your INI file.
[Browser]
DisableExit=True
ExitPage=http://pwb.team2s.com/exit.htm
[Java]
JavaClose=ClosePWB
JavaGetActivity=GetActivity
You could also use the Confirm Close dialog if you have it setup as an HTML type instead of the Exit Page to get the Activity time left.
--Scott
I'm testing the set and get activity javascript functions and I'm having some trouble. I set up a page with the following code:
<body onload="window.external.PWBSetActivity('1');>
When I navigate to this page, the activity timer goes from 1:00 to 325001:59. Does the JavaSetActivity function expect the number of seconds to set the timer to? I've tried higher numbers and numbers less than 1, and the result is always a 6 or 7 digit number.
Another page with the JavaGetActivity function in the body onload event works just fine.
Any help greatly appreciated!
<body onload="window.external.PWBSetActivity('1');>
When I navigate to this page, the activity timer goes from 1:00 to 325001:59. Does the JavaSetActivity function expect the number of seconds to set the timer to? I've tried higher numbers and numbers less than 1, and the result is always a 6 or 7 digit number.
Another page with the JavaGetActivity function in the body onload event works just fine.
Any help greatly appreciated!
In the example you are passing a string instead of a number to the function.
By the way, you were also missing an end quote.
--Scott
Change to the following.<body onload="window.external.PWBSetActivity('1');>
Code: Select all
<body onload="window.external.PWBSetActivity(1200)";>
By the way, you were also missing an end quote.
--Scott