[open-ils-commits] r12008 - branches/staff-client-experiment/Open-ILS/xul/staff_client/server/patron
svn at svn.open-ils.org
svn at svn.open-ils.org
Wed Jan 28 22:52:04 EST 2009
Author: phasefx
Date: 2009-01-28 22:52:02 -0500 (Wed, 28 Jan 2009)
New Revision: 12008
Modified:
branches/staff-client-experiment/Open-ILS/xul/staff_client/server/patron/summary.xul
Log:
ah, document.loadOverlay.. this lovely thing is going to make it easier for us to load alternate interfaces
Modified: branches/staff-client-experiment/Open-ILS/xul/staff_client/server/patron/summary.xul
===================================================================
--- branches/staff-client-experiment/Open-ILS/xul/staff_client/server/patron/summary.xul 2009-01-28 19:02:01 UTC (rev 12007)
+++ branches/staff-client-experiment/Open-ILS/xul/staff_client/server/patron/summary.xul 2009-01-29 03:52:02 UTC (rev 12008)
@@ -19,10 +19,9 @@
<!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
<!-- OVERLAYS -->
<?xul-overlay href="/xul/server/OpenILS/util_overlay.xul"?>
-<?xul-overlay href="/xul/server/patron/summary_overlay.xul"?>
<window id="patron_summary_win"
- onload="try { my_init(); font_helper(); } catch(E) { alert(E); }"
+ onload="try { my_init(); } catch(E) { alert(E); }" onunload="try { observer.unregister(); } catch(E) { alert(E); }"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
@@ -35,9 +34,39 @@
<![CDATA[
function $(id) { return document.getElementById(id); }
+ var observer;
+ function myObserver() { this.register(); }
+ myObserver.prototype = {
+ register: function() {
+ netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+ var observerService = Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService);
+ observerService.addObserver(this, "xul-overlay-merged", false);
+ },
+ unregister: function() {
+ netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+ var observerService = Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService);
+ observerService.removeObserver(this, "xul-overlay-merged");
+ },
+ observe: function(subject,topic,data) {
+ dump('observe: <'+subject+','+topic+','+data+'>\n');
+ // setTimeout is needed here for xulrunner 1.8
+ setTimeout( function() { try { post_overlay(); } catch(E) { alert(E); } }, 0 );
+ }
+ }
+
function my_init() {
try {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+ observer = new myObserver();
+ document.loadOverlay(location.protocol + '//' + location.hostname + '/xul/server/patron/summary_overlay.xul',observer)
+ } catch(E) {
+ alert(E);
+ }
+ }
+
+ function post_overlay() {
+ try {
+ netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
if (typeof JSAN == 'undefined') { throw( $("commonStrings").getString('common.jsan.missing') ); }
JSAN.errorLevel = "die"; // none, warn, or die
JSAN.addRepository('/xul/server/');
@@ -55,14 +84,13 @@
} );
window.refresh = function () { g.summary.retrieve(); }
-
+ font_helper();
} catch(E) {
var err_msg = $("commonStrings").getFormattedString('common.exception', ['patron/summary.xul', E]);
try { g.error.sdump('D_ERROR',err_msg); } catch(E) { dump(err_msg); }
alert(err_msg);
}
}
-
]]>
</script>
More information about the open-ils-commits
mailing list