xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:xbl="http://www.mozilla.org/xbl">
- <binding id="help">
- <resources/>
-
- <content>
- <!-- FIXME: I18N -->
- <xul:button label="Help" accesskey="H" xbl:inherits="label,accesskey" />
- </content>
-
- <implementation>
-
- <constructor>
- <![CDATA[
- try {
- // This widget will try to load help content from various static and dynamic URL's, stopping at the
- // first one that it finds. Given an example location.href of '/xul/server/patron/display.xul' and
- // a @src of 'foo.html', it will check these URL's in this order:
- //
- // foo.html
- // /xul/server/patron/display.xul.custom_help.html
- // /xul/server/patron/display.xul.help.html
- // /xul/server/patron/custom_help.html
- // /xul/server/patron/help.html
- // /xul/server/custom_help.html
- // /xul/server/help.html
- // /xul/custom_help.html
- // /xul/help.html
- // /custom_help.html
- // /help.html
- //
- // If @pathname is specified, it will override the value from location.pathname
- // If @hostname is specified, it will override the value from location.hostname
- // If @port is specified, it will override the value from location.port
- // If @protocol is specified, it will override the value from location.protocol
-
- this.addEventListener( 'command', function(ev) { this._open_window(); }, false);
- } catch(E) {
- alert('Error constructing help widget in bindings.xml: ' + E);
- throw(E);
- }
- ]]>
- </constructor>
-
- <method name="_open_window">
- <body>
- <![CDATA[
- try {
-
- var obj = this;
- var protocol = obj.getAttribute('protocol') || location.protocol;
- var hostname = obj.getAttribute('hostname') || location.hostname;
- var port = obj.getAttribute('port') || location.port;
- var pathname = obj.getAttribute('pathname') || location.pathname;
-
- function test_url(loc) {
- if (loc == '/' || !loc) { return false; }
- var x = new XMLHttpRequest();
- var url = protocol + '//' + hostname + ( port ? ':' + port : '' ) + loc;
- dump('help widget: testing <'+url+'>\n');
- x.open("HEAD", url, false);
- x.send(null);
- return x.status == 200;
- }
-
- function open_url(loc) {
- var url = protocol + '//' + hostname + ( port ? ':' + port : '' ) + loc +'?id='+obj.id;
- dump('help widget: opening <'+url+'>\n');
- window.open(url, obj.getAttribute('label'), 'resizable,scrollbars');
- }
-
- if (test_url('/'+this.getAttribute('src'))) {
- open_url('/'+this.getAttribute('src'));
- } else {
- if (test_url(pathname + '.custom_help.html')) {
- open_url(pathname + '.custom_help.html');
- } else {
- if (test_url(pathname + '.help.html')) {
- open_url(pathname + '.help.html');
- } else {
- var pathparts = pathname.split('/');
- var base_url; var url; var test_result;
- for (var i = pathparts.length - 2; i>0 && !test_result; i--) {
- base_url = ''; url = '';
- for ( j = 1; j <= i; j++ ) { base_url += '/' + pathparts[j]; };
- url = base_url + '/custom_help.html';
- test_result = test_url(url);
- if (!test_result) {
- url = base_url + '/help.html';
- test_result = test_url(url);
- }
- }
- if (test_result) {
- open_url(url);
- } else {
- if (test_url("/custom_help.html")) {
- open_url("/custom_help.html");
- } else {
- if (test_url("/help.html")) {
- open_url("/help.html");
- } else {
- /* FIXME - I18N */
- alert('No Help Found');
- }
- }
- }
- }
- }
- }
- } catch(E) {
- alert('Error opening window in help widget in bindings.xml: ' + E);
- throw(E);
- }
- ]]>
- </body>
- </method>
-
- </implementation>
- </binding>
-
-
<binding id="messagecatalog">
<resources/>
]]>
</constructor>
+ <destructor>
+ <![CDATA[
+ try {
+ delete this._props;
+ delete this.sprintf;
+ } catch(E) {
+ alert('Error destructing messagecatalog in bindings.xml: ' + E);
+ throw(E);
+ }
+
+ ]]>
+ </destructor>
+
<property name="src">
<getter>
<![CDATA[
</implementation>
</binding>
- <binding id="caption" extends="chrome://global/content/bindings/general.xml#basetext">
- <resources>
- <stylesheet src="chrome://global/skin/groupbox.css"/>
- </resources>
-
- <content>
- <children>
- <xul:image
- onclick="
- var n = document.getAnonymousNodes(parentNode.parentNode)[1];
- if (n.hidden) {
- n.hidden = false;
- this.setAttribute('src','chrome://open_ils_staff_client/skin/media/images/opentriangle.gif');
- } else {
- n.hidden = true;
- this.setAttribute('src','chrome://open_ils_staff_client/skin/media/images/triangle.gif');
- }
- "
- />
- <xul:image class="caption-icon" xbl:inherits="src=image"/>
- <xul:label class="caption-text" flex="1" xbl:inherits="default,value=label,crop,accesskey" />
- </children>
- </content>
-
- <implementation>
- <constructor>
- <![CDATA[
- var n = document.getAnonymousNodes(this)[0];
- n.setAttribute('src','chrome://open_ils_staff_client/skin/media/images/opentriangle.gif');
- ]]>
- </constructor>
- </implementation>
- </binding>
-
</bindings>
--- /dev/null
+<?xml version="1.0"?>
+
+<bindings id="openils_bindings2"
+ xmlns="http://www.mozilla.org/xbl"
+ xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ xmlns:xbl="http://www.mozilla.org/xbl">
+
+ <binding id="help">
+ <resources/>
+
+ <content>
+ <!-- FIXME: I18N -->
+ <xul:button label="Help" accesskey="H" xbl:inherits="label,accesskey" />
+ </content>
+
+ <implementation>
+
+ <constructor>
+ <![CDATA[
+ try {
+ // This widget will try to load help content from various static and dynamic URL's, stopping at the
+ // first one that it finds. Given an example location.href of '/xul/server/patron/display.xul' and
+ // a @src of 'foo.html', it will check these URL's in this order:
+ //
+ // foo.html
+ // /xul/server/patron/display.xul.custom_help.html
+ // /xul/server/patron/display.xul.help.html
+ // /xul/server/patron/custom_help.html
+ // /xul/server/patron/help.html
+ // /xul/server/custom_help.html
+ // /xul/server/help.html
+ // /xul/custom_help.html
+ // /xul/help.html
+ // /custom_help.html
+ // /help.html
+ //
+ // If @pathname is specified, it will override the value from location.pathname
+ // If @hostname is specified, it will override the value from location.hostname
+ // If @port is specified, it will override the value from location.port
+ // If @protocol is specified, it will override the value from location.protocol
+
+ this.addEventListener( 'command', function(ev) { this._open_window(); }, false);
+ } catch(E) {
+ alert('Error constructing help widget in bindings.xml: ' + E);
+ throw(E);
+ }
+ ]]>
+ </constructor>
+
+ <method name="_open_window">
+ <body>
+ <![CDATA[
+ try {
+
+ var obj = this;
+ var protocol = obj.getAttribute('protocol') || location.protocol;
+ var hostname = obj.getAttribute('hostname') || location.hostname;
+ var port = obj.getAttribute('port') || location.port;
+ var pathname = obj.getAttribute('pathname') || location.pathname;
+
+ function test_url(loc) {
+ if (loc == '/' || !loc) { return false; }
+ var x = new XMLHttpRequest();
+ var url = protocol + '//' + hostname + ( port ? ':' + port : '' ) + loc;
+ dump('help widget: testing <'+url+'>\n');
+ x.open("HEAD", url, false);
+ x.send(null);
+ return x.status == 200;
+ }
+
+ function open_url(loc) {
+ var url = protocol + '//' + hostname + ( port ? ':' + port : '' ) + loc +'?id='+obj.id;
+ dump('help widget: opening <'+url+'>\n');
+ window.open(url, obj.getAttribute('label'), 'resizable,scrollbars');
+ }
+
+ if (test_url('/'+this.getAttribute('src'))) {
+ open_url('/'+this.getAttribute('src'));
+ } else {
+ if (test_url(pathname + '.custom_help.html')) {
+ open_url(pathname + '.custom_help.html');
+ } else {
+ if (test_url(pathname + '.help.html')) {
+ open_url(pathname + '.help.html');
+ } else {
+ var pathparts = pathname.split('/');
+ var base_url; var url; var test_result;
+ for (var i = pathparts.length - 2; i>0 && !test_result; i--) {
+ base_url = ''; url = '';
+ for ( j = 1; j <= i; j++ ) { base_url += '/' + pathparts[j]; };
+ url = base_url + '/custom_help.html';
+ test_result = test_url(url);
+ if (!test_result) {
+ url = base_url + '/help.html';
+ test_result = test_url(url);
+ }
+ }
+ if (test_result) {
+ open_url(url);
+ } else {
+ if (test_url("/custom_help.html")) {
+ open_url("/custom_help.html");
+ } else {
+ if (test_url("/help.html")) {
+ open_url("/help.html");
+ } else {
+ /* FIXME - I18N */
+ alert('No Help Found');
+ }
+ }
+ }
+ }
+ }
+ }
+ } catch(E) {
+ alert('Error opening window in help widget in bindings.xml: ' + E);
+ throw(E);
+ }
+ ]]>
+ </body>
+ </method>
+
+ </implementation>
+ </binding>
+
+</bindings>