Bugzilla – Attachment 2904 Details for
Bug 4238
OPAC timeout feature for patron privacy
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Re-implementation of the changes in Harley
0001-Partial-fix-for-Bug-4238-OPAC-timeout-feature-for-pa.patch (text/plain), 4.21 KB, created by
Owen Leonard
on 2010-12-23 17:31:26 UTC
(
hide
)
Description:
Re-implementation of the changes in Harley
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2010-12-23 17:31:26 UTC
Size:
4.21 KB
patch
obsolete
>From df11f7746f733c916136c059623f58b12acfb038 Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Thu, 23 Dec 2010 12:21:07 -0500 >Subject: [PATCH] Partial fix for Bug 4238, OPAC timeout feature for patron privacy > >This patch re-implements the changes made by PTFS and included >in Harley. The code seems to work well, but in order for this to >be a complete fix it would have to include an update to the >database and preferences. >--- > C4/Auth.pm | 1 + > .../opac-tmpl/prog/en/includes/doc-head-close.inc | 14 +++++ > koha-tmpl/opac-tmpl/prog/en/js/screensaver.js | 60 ++++++++++++++++++++ > 3 files changed, 75 insertions(+), 0 deletions(-) > create mode 100644 koha-tmpl/opac-tmpl/prog/en/js/screensaver.js > >diff --git a/C4/Auth.pm b/C4/Auth.pm >index 2f13b86..041501f 100644 >--- a/C4/Auth.pm >+++ b/C4/Auth.pm >@@ -439,6 +439,7 @@ sub get_template_and_user { > suggestion => "" . C4::Context->preference("suggestion"), > virtualshelves => "" . C4::Context->preference("virtualshelves"), > OPACSerialIssueDisplayCount => C4::Context->preference("OPACSerialIssueDisplayCount"), >+ ResetOpacInactivityTimeout => C4::Context->preference("ResetOpacInactivityTimeout"), > OpacAddMastheadLibraryPulldown => C4::Context->preference("OpacAddMastheadLibraryPulldown"), > OPACXSLTDetailsDisplay => C4::Context->preference("OPACXSLTDetailsDisplay"), > OPACXSLTResultsDisplay => C4::Context->preference("OPACXSLTResultsDisplay"), >diff --git a/koha-tmpl/opac-tmpl/prog/en/includes/doc-head-close.inc b/koha-tmpl/opac-tmpl/prog/en/includes/doc-head-close.inc >index fe7e7db..d92e523 100644 >--- a/koha-tmpl/opac-tmpl/prog/en/includes/doc-head-close.inc >+++ b/koha-tmpl/opac-tmpl/prog/en/includes/doc-head-close.inc >@@ -84,3 +84,17 @@ > <script type="text/javascript" language="javascript" src="<!-- TMPL_VAR NAME="themelang" -->/js/googleindictransliteration.js"></script> > <!-- /TMPL_IF --> > >+<!-- TMPL_IF NAME="ResetOpacInactivityTimeout" --> >+<script type="text/javascript" language="javascript" src="<!-- TMPL_VAR NAME="themelang" -->/js/screensaver.js"></script> >+<script type="text/javascript"> >+window.onload=function (){ >+ var ss = new ScreenSaver( <!-- TMPL_VAR NAME="ResetOpacInactivityTimeout" --> * 1000); >+ >+ ss.onstart = function () { >+ document.location = '/cgi-bin/koha/opac-main.pl?logout.x=1'; >+ updateBasket(0,null); >+ delCookie("bib_list"); >+ }; >+} >+</script> >+<!-- /TMPL_IF --> >diff --git a/koha-tmpl/opac-tmpl/prog/en/js/screensaver.js b/koha-tmpl/opac-tmpl/prog/en/js/screensaver.js >new file mode 100644 >index 0000000..4257b81 >--- /dev/null >+++ b/koha-tmpl/opac-tmpl/prog/en/js/screensaver.js >@@ -0,0 +1,60 @@ >+/* >+Copyright (c) 2007, Andreas Blixt, http://blixt.org/. All rights reserved. >+Code licensed under the MIT License: >+http://www.opensource.org/licenses/mit-license.php >+*/ >+ >+// waitTime is in milliseconds. >+var ScreenSaver = function (waitTime) { >+ this.lastActivity = new Date().getTime(); >+ this.waitTime = waitTime; >+ >+ var $this = this; >+ this._timer = setInterval(function () { $this._checkTime.call($this) }, 1000); >+ document.onmousemove = function () { $this._mouseHandler.call($this) }; >+}; >+ >+ScreenSaver.prototype = { >+ _timer: null, >+ >+ lastActivity: 0, >+ started: false, >+ waitTime: 0, >+ >+ onstart: function () {}, >+ onend: function () {}, >+ >+ dispose: function () { >+ if (this._timer) clearInterval(this._timer); >+ document.onmousemove = null; >+ }, >+ >+ _checkTime: function () { >+ if (!this.started && new Date().getTime() - this.lastActivity >= this.waitTime) { >+ this.started = true; >+ this.onstart(); >+ } >+ }, >+ >+ _mouseHandler: function () { >+ this.lastActivity = new Date().getTime(); >+ if (this.started) { >+ this.started = false; >+ this.onend(); >+ } >+ } >+}; >+ >+/*********** Begin Example *********** >+ >+var ss = new ScreenSaver(5000); >+ >+ss.onstart = function () { >+ document.getElementsByTagName("body")[0].style.backgroundColor = "#000"; >+}; >+ >+ss.onend = function () { >+ document.getElementsByTagName("body")[0].style.backgroundColor = "#fff"; >+}; >+ >+************* End Example *************/ >\ No newline at end of file >-- >1.7.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 4238
: 2904