]> git.evergreen-ils.org Git - working/Evergreen.git/commit
Replacing persist mechanism with oils_persist.
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 3 Sep 2009 04:14:48 +0000 (04:14 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 3 Sep 2009 04:14:48 +0000 (04:14 +0000)
commitfee298bd3c58183fc0b5a70ed6cd9362813dbf6b
tree488128fd87a3b7a5153d78ca23c5362cf68805b5
parent34d822c12e10e0583488076aecb7276e6ba3fb13
Replacing persist mechanism with oils_persist.

This changeset isn't as scary as it looks, I promise. :-)

In XUL you can say,   <element attribute1="foo" attribute2="bar" persist="attribute1 attribute2" />
and whenever those specified attributes change, the new values will be remembered the next time that element is loaded.

Problems with persist:
  * No longer works with remote XUL in Xulrunner 1.9 series, only chrome.  Mozilla did this for security reasons.
  * Persist was tied to the window.location of each interface, so:
    1) Settings would be lost on any "upgrade" that effectively changed the URL.  For example, /xul/rel_1_2/server/ versus /xul/rel_1_4/server/
    2) Some interfaces still make use of URL params, which effectively breaks persistance (because the URL changes constantly), and allows localstore.rdf to grow without limit (thanks to Jeff for noticing that last bit)

The solution:
  * We renamed all occurances of @persist to @oils_persist, in case Mozilla changes the behavior again.
  * We created a persist_helper() function and call it alongside font_helper() in the @onload for most windows (all that currently have elements using @oils_persist, at least)

persist_helper grabs all elements that have an @oils_persist, and constructs look-up keys based on the location.hostname, location.path, and element.id, and uses the Mozilla preference system to look for preferences with those
keys.  These keys don't include URL parameters.  For <checkbox> elements, an event listener is added that will set the preference whenever the element fires a command event (is checked or unchecked).

TODO:
  * Tweak the keys further so that they're BUILD_ID (version) agnostic
  * Add more event listeners to accomodate @oils_persist on other elements like window, splitter, and grippy.
  * Possibly remove persist_helper (and font_helper) from the inline @onload, and load it through a window.addEventListener('load',function(){ persist_helper(); },false); in the global util overlay instead.

git-svn-id: svn://svn.open-ils.org/ILS/trunk@13953 dcc99617-32d9-48b4-a31d-7c20da2025e4
40 files changed:
Open-ILS/xul/staff_client/chrome/content/OpenILS/global_util.js
Open-ILS/xul/staff_client/chrome/content/circ/offline_checkin.xul
Open-ILS/xul/staff_client/chrome/content/circ/offline_checkout.xul
Open-ILS/xul/staff_client/chrome/content/circ/offline_in_house_use.xul
Open-ILS/xul/staff_client/chrome/content/circ/offline_renew.xul
Open-ILS/xul/staff_client/chrome/content/main/menu_frame.xul
Open-ILS/xul/staff_client/chrome/content/util/list_clipboard.xul
Open-ILS/xul/staff_client/server/cat/copy_buckets.xul
Open-ILS/xul/staff_client/server/cat/copy_buckets_quick.xul
Open-ILS/xul/staff_client/server/cat/copy_editor.xul
Open-ILS/xul/staff_client/server/cat/copy_summary.xul
Open-ILS/xul/staff_client/server/cat/marcedit.xul
Open-ILS/xul/staff_client/server/cat/record_buckets.xul
Open-ILS/xul/staff_client/server/cat/record_buckets_overlay.xul
Open-ILS/xul/staff_client/server/cat/record_buckets_quick.xul
Open-ILS/xul/staff_client/server/cat/spine_labels.xul
Open-ILS/xul/staff_client/server/cat/volume_editor.xul
Open-ILS/xul/staff_client/server/cat/z3950.xul
Open-ILS/xul/staff_client/server/circ/checkin.xul
Open-ILS/xul/staff_client/server/circ/checkin_overlay.xul
Open-ILS/xul/staff_client/server/circ/checkout.xul
Open-ILS/xul/staff_client/server/circ/checkout_overlay.xul
Open-ILS/xul/staff_client/server/circ/copy_details.xul
Open-ILS/xul/staff_client/server/circ/copy_status.xul
Open-ILS/xul/staff_client/server/circ/copy_status_overlay.xul
Open-ILS/xul/staff_client/server/circ/in_house_use.xul
Open-ILS/xul/staff_client/server/patron/bill_history.xul
Open-ILS/xul/staff_client/server/patron/bills.xul
Open-ILS/xul/staff_client/server/patron/bills_overlay.xul
Open-ILS/xul/staff_client/server/patron/display.xul
Open-ILS/xul/staff_client/server/patron/display_horiz.xul
Open-ILS/xul/staff_client/server/patron/display_horiz_overlay.xul
Open-ILS/xul/staff_client/server/patron/display_overlay.xul
Open-ILS/xul/staff_client/server/patron/hold_details.xul
Open-ILS/xul/staff_client/server/patron/hold_notices.xul
Open-ILS/xul/staff_client/server/patron/holds.xul
Open-ILS/xul/staff_client/server/patron/holds_overlay.xul
Open-ILS/xul/staff_client/server/patron/standing_penalties.xul
Open-ILS/xul/staff_client/server/patron/summary.xul
Open-ILS/xul/staff_client/server/patron/summary_overlay_horiz.xul