--- /dev/null
+VERSION=0.1.0
+PACKAGE=Evergreen
+DESCRIPTION=Evergreen Staff Client
+BUILD=2005072719
+
+RETRIEVE_FIELDMAPPER=wget -N http://gapines.org/opac/common/js/util/fieldmapper.js
+RETRIEVE_FM_ALL=wget -N http://gapines.org/opac/common/js/fmall.js
+RETRIEVE_ORG_TREE=wget -N http://gapines.org/opac/common/js/OrgTree.js
+RETRIEVE_CLIENT_CONFIG=cp ../../../../../../../OpenSRF/examples/math_xul_client/math/content/conf/client_config.xml .
+
+all: build package
+ @echo
+ @echo How do makefiles work again?
+ @echo BUILD = ${BUILD}
+ touch application.ini
+
+#build: generated open-ils patron circ
+build: generated open-ils custom
+ @echo
+ @echo Everything before packaging
+
+package: evergreen.xpi
+ @echo
+ @echo Packaging
+
+stamp:
+ sed -i s/^Version=.\*/Version=${VERSION}/ application.ini
+ sed -i s/^BuildID=.\*/BuildID=${BUILD}/ application.ini
+ sed -i s/^Name=.\*/Name=${PACKAGE}/ application.ini
+ sed -i 's/<em:version>.*<\/em:version>/<em:version>${VERSION}<\/em:version>/' install.rdf
+ sed -i 's/<em:name>.*<\/em:name>/<em:name>${PACKAGE}<\/em:name>/' install.rdf
+ sed -i 's/<em:description>.*<\/em:description>/<em:description>${DESCRIPTION}<\/em:description>/' install.rdf
+ sed -i "s/extVersion: '.\*'/extVersion: '${VERSION}'/" install.js
+ sed -i "s/extFullName: '.\*'/extFullName: '${DESCRIPTION}'/" install.js
+ sed -i 's/auth\.title ".*"/auth\.title "${DESCRIPTION}"/' chrome/locale/en-US/evergreen/auth.dtd
+ sed -i 's/auth\.version ".*"/auth\.version "${PACKAGE} ${VERSION} ${BUILD}"/' chrome/locale/en-US/evergreen/auth.dtd
+
+generated:
+ @echo
+ @echo These things are installation specific. The staff client is the last thing you should try to build.
+ #(cd chrome/content/evergreen/util ; ${RETRIEVE_FIELDMAPPER} );
+ #(cd chrome/content/evergreen/util ; ${RETRIEVE_ORG_TREE} );
+ (cd chrome/content/evergreen/conf ; ${RETRIEVE_CLIENT_CONFIG} );
+ (cd chrome/content/evergreen/OpenILS/util/ ; ${RETRIEVE_FM_ALL} );
+
+open-ils:
+ cp ../../../OpenSRF/src/javascript/*.js chrome/content/evergreen/OpenSRF/
+ cp ../../../Open-ILS/web/opac/common/js/*.js chrome/content/evergreen/OpenILS/util/
+ #cp ../../../Open-ILS/src/javascript/widgets/*.js chrome/content/evergreen/OpenILS/widgets/
+ #cp ../../../Open-ILS/src/javascript/widgets/menu/*.js chrome/content/evergreen/OpenILS/widgets/menu/
+
+patron:
+ (cat chrome/content/evergreen/main/paged_tree_overlay.xul | sed s/paged_tree/patron_items/g | sed s/PagedTree/PatronItems/g > chrome/content/evergreen/patron/patron_items_overlay.xul )
+ (cat chrome/content/evergreen/main/paged_tree_overlay.xul | sed s/paged_tree/patron_search_results/g | sed s/PagedTree/PatronSearchResults/g > chrome/content/evergreen/patron/patron_search_results_overlay.xul )
+ (cat chrome/content/evergreen/main/paged_tree_overlay.xul | sed s/paged_tree/patron_checkout_items/g | sed s/PagedTree/PatronCheckoutItems/g > chrome/content/evergreen/patron/patron_checkout_items_overlay.xul )
+ (cat chrome/content/evergreen/main/paged_tree_overlay.xul | sed s/paged_tree/patron_holds/g | sed s/PagedTree/PatronHolds/g > chrome/content/evergreen/patron/patron_holds_overlay.xul )
+ (cp chrome/locale/en-US/evergreen/paged_tree.dtd chrome/locale/en-US/evergreen/patron_items.dtd)
+ (cp chrome/locale/en-US/evergreen/paged_tree.dtd chrome/locale/en-US/evergreen/patron_search_results.dtd)
+ (cp chrome/locale/en-US/evergreen/paged_tree.dtd chrome/locale/en-US/evergreen/patron_checkout_items.dtd)
+ (cp chrome/locale/en-US/evergreen/paged_tree.dtd chrome/locale/en-US/evergreen/patron_holds.dtd)
+
+circ:
+ (cat chrome/content/evergreen/main/paged_tree_overlay.xul | sed s/paged_tree/checkin_items/g | sed s/PagedTree/CheckinItems/g > chrome/content/evergreen/circ/checkin_items_overlay.xul )
+ (cp chrome/locale/en-US/evergreen/paged_tree.dtd chrome/locale/en-US/evergreen/checkin_items.dtd)
+ (cat chrome/content/evergreen/main/paged_tree_overlay.xul | sed s/paged_tree/hold_capture_items/g | sed s/PagedTree/HoldCaptureItems/g > chrome/content/evergreen/circ/hold_capture_items_overlay.xul )
+ (cp chrome/locale/en-US/evergreen/paged_tree.dtd chrome/locale/en-US/evergreen/hold_capture_items.dtd)
+
+custom:
+ #(cd chrome/content/evergreen/OpenILS/util; cp RemoteRequest.js~ RemoteRequest.js)
+
+evergreen.xpi: evergreen.jar
+ @echo
+ @echo make the xpi file
+ zip -r evergreen.xpi chrome/ defaults/ install.js install.rdf application.ini Makefile LICENSE README -x \*CVS\* > /dev/null
+
+evergreen.jar: build
+ @echo
+ @echo make the jar file
+ (cd chrome; zip -r evergreen.jar content/ locale/ skin/ -x \*CVS\* > /dev/null )
+
+clean:
+ @echo
+ @echo delete derived files
+ rm -f evergreen.xpi
+ rm -f chrome/evergreen.jar
+ rm -f chrome/content/evergreen/patron/patron_items_overlay.xul chrome/locale/en-US/evergreen/patron_items.dtd
+ rm -f chrome/content/evergreen/patron/patron_search_results_overlay.xul chrome/locale/en-US/evergreen/patron_search_results.dtd
+ rm -f chrome/content/evergreen/patron/patron_checkout_items_overlay.xul chrome/locale/en-US/evergreen/patron_checkout_items.dtd
+ rm -f chrome/content/evergreen/patron/patron_holds_overlay.xul chrome/locale/en-US/evergreen/patron_holds.dtd
+ rm -f chrome/content/evergreen/circ/checkin_items_overlay.xul chrome/locale/en-US/evergreen/checkin_items.dtd
+ rm -f chrome/content/evergreen/circ/hold_capture_items_overlay.xul chrome/locale/en-US/evergreen/hold_capture_items.dtd
+ rm -f chrome/content/evergreen/conf/client_config.xml
+ rm -f chrome/content/evergreen/util/fieldmapper.js
+ rm -f chrome/content/evergreen/util/OrgTree.js
+ rm -f chrome/content/evergreen/OpenSRF/*js
+ rm -f chrome/content/evergreen/OpenILS/util/*js
+ rm -f chrome/content/evergreen/OpenILS/widgets/*js
+ rm -f chrome/content/evergreen/OpenILS/widgets/menu/*js
--- /dev/null
+[App]
+; Modified by Jason for Evergreen
+; This file is used by XUL Runner like so: xulrunner ./application.ini
+;
+; This field specifies your organization's name. This field is recommended,
+; but optional.
+Vendor=PINES
+;
+; This field specifies your application's name. This field is required.
+Name=Evergreen
+;
+; This field specifies your application's version. This field is optional.
+Version=0.1.0
+;
+; This field specifies your application's build ID (timestamp). This field is
+; required.
+BuildID=2005072719
+;
+; This field specifies a compact copyright notice for your application. This
+; field is optional.
+Copyright=Copyright (c) 2005 GPLS/PINES
+;
+; This ID is just an example. Every XUL app ought to have it's own unique ID.
+; You can use the microsoft "guidgen" or "uuidgen" tools, or go on
+; irc.mozilla.org and /msg botbot uuid. This field is optional.
+ID={c3dd711b-c9b4-4785-b8f8-6157149c8905}
+
+[Gecko]
+;
+; This field is required. It specifies the minimum Gecko version that this
+; application requires. Specifying 1.8 matches all releases with a version
+; prefixed by 1.8 (e.g., 1.8a4, 1.8b, 1.8.2).
+MinVersion=1.8
+;
+; This field is optional. It specifies the maximum Gecko version that this
+; application requires. It should be specified if your application uses
+; unfrozen interfaces. Specifying 1.8 matches all releases with a version
+; prefixed by 1.8 (e.g., 1.8a4, 1.8b, 1.8.2).
+MaxVersion=1.8
--- /dev/null
+content evergreen jar:evergreen.jar!/content/evergreen/
+locale evergreen en-US jar:evergreen.jar!/locale/en-US/evergreen/
+skin evergreen evergreen jar:evergreen.jar!/skin/evergreen/
--- /dev/null
+dump('entering OpenILS/data.js\n');
+
+if (typeof OpenILS == 'undefined') OpenILS = {};
+OpenILS.data = function (mw,G) {
+
+ this.mw = mw; this.G = G;
+
+ var obj = this;
+
+ this.chain = [];
+
+ this.chain.push(
+ function() {
+ try {
+ obj.au = obj.G.network.request(
+ 'open-ils.search',
+ 'open-ils.search.actor.user.session',
+ [ obj.G.auth.session.key ]
+ );
+ } catch(E) {
+ // what should we do?
+ }
+ }
+ );
+
+ function a_get(obj,i) { return [i, obj[i]]; } // funkiness with loops and closures
+
+ for (var i in this._cacheable_fm_objects) {
+ var classname = a_get(this._cacheable_fm_objects,i)[0];
+ var data = a_get(this._cacheable_fm_objects,i)[1];
+ var app = data[0]; var method = data[1]; var params = data[2];
+ this.chain.push(
+ function() {
+ try {
+ obj.list[classname] = obj.G.network.request( app, method, params);
+ // store an offline copy
+ } catch(E) {
+ // try offline
+ }
+ //obj.hash[classname] = convert_object_list_to_hash( obj.list[classname] );
+ }
+ );
+ }
+
+ /*
+ var other_fm_objects = {
+ 'my_aou' : [
+ 'open-ils.actor',
+ 'open-ils.actor.org_unit.full_path.retrieve',
+ [ obj.G.auth.session.key ]
+ ],
+ 'my_actsc' : [
+ 'open-ils.circ',
+ 'open-ils.circ.stat_cat.actor.retrieve.all',
+ [ obj.G.auth.session.key, obj.au.home_ou.id() ]
+ ]
+ }
+ */
+
+ return this;
+};
+
+OpenILS.data.prototype = {
+
+ 'list' : {},
+ 'hash' : {},
+
+ 'init' : function () {
+
+ if (typeof this.on_complete == 'function') {
+
+ this.chain.push( this.on_complete );
+ }
+
+ JSAN.use('util.exec');
+ util.exec.chain( this.chain );
+ },
+
+ '_cacheable_fm_objects' : {
+
+ 'pgt' : [ 'open-ils.actor', 'open-ils.actor.groups.retrieve', [] ],
+ 'cit' : [ 'open-ils.actor', 'open-ils.actor.user.ident_types.retrieve', [] ],
+ 'cst' : [ 'open-ils.actor', 'open-ils.actor.standings.retrieve', [] ],
+ 'acpl' : [ 'open-ils.search', 'open-ils.search.config.copy_location.retrieve.all', [] ],
+ 'ccs' : [ 'open-ils.search', 'open-ils.search.config.copy_status.retrieve.all', [] ],
+ 'aou' : [ 'open-ils.actor', 'open-ils.actor.org_tree.retrieve', [] ],
+ 'aout' : [ 'open-ils.actor', 'open-ils.actor.org_types.retrieve', [] ]
+ }
+
+}
+
+dump('exiting OpenILS/data.js\n');
--- /dev/null
+dump('entering auth/controller.js\n');
+
+if (typeof auth == 'undefined') auth = {};
+auth.controller = function (mw,G) {
+
+ this.mw = mw; this.G = G;
+
+ return this;
+};
+
+auth.controller.prototype = {
+
+ 'init' : function () {
+
+ var obj = this; // so the 'this' in event handlers don't confuse us
+ var mw = obj.mw;
+ var G = obj.G;
+
+ // This talks to our ILS
+ JSAN.use('auth.session');
+ obj.session = new auth.session(obj,mw,G);
+
+ // Attach this object to the XUL through event listeners
+
+ var cmd_login = mw.document.getElementById('cmd_login');
+ if (cmd_login)
+ cmd_login.addEventListener('command',function () { obj.login(); },false);
+
+ var cmd_logoff = mw.document.getElementById('cmd_logoff');
+ if (cmd_logoff)
+ cmd_logoff.addEventListener('command',function () { obj.logoff(); },false);
+
+ var cmd_close_window = mw.document.getElementById('cmd_close_window');
+ if (cmd_close_window)
+ cmd_close_window.addEventListener('command',function () { obj.close(); },false);
+
+ obj.view.name_prompt = mw.document.getElementById('name_prompt');
+ if (obj.view.name_prompt) {
+ obj.view.name_prompt.addEventListener('keypress',handle_keypress,false);
+ obj.view.name_prompt.focus();
+ }
+
+ obj.view.password_prompt = mw.document.getElementById('password_prompt');
+ if (obj.view.password_prompt)
+ obj.view.password_prompt.addEventListener('keypress',handle_keypress,false);
+
+ obj.view.submit_button = mw.document.getElementById('submit_button');
+
+ obj.view.progress_bar = mw.document.getElementById('auth_meter');
+
+ function handle_keypress(ev) {
+ if (ev.keyCode && ev.keyCode == 13) {
+ switch(this) {
+ case obj.name_prompt:
+ ev.preventDefault();
+ obj.view.password_prompt.focus(); obj.view.password_prompt.select();
+ break;
+ case obj.view.password_prompt:
+ ev.preventDefault();
+ obj.view.submit_button.focus();
+ obj.login();
+ break;
+ default: break;
+ }
+ }
+ }
+
+ if (typeof this.on_init == 'function') {
+ this.G.error.sdump('D_AUTH','auth.controller.on_init()\n');
+ this.on_init();
+ }
+ },
+
+ 'view' : {},
+
+ 'login' : function() {
+
+ this.G.error.sdump('D_AUTH','login with ' + this.view.name_prompt.value + ' and ' + this.view.password_prompt.value + '\n');
+ this.view.name_prompt.disabled = true;
+ this.view.password_prompt.disabled = true;
+ this.view.submit_button.disabled = true;
+
+ try {
+
+ if (typeof this.on_login == 'function') {
+ this.G.error.sdump('D_AUTH','auth.controller.session.on_init = ' +
+ 'auth.controller.on_login\n');
+ this.session.on_init = this.on_login;
+ }
+
+ this.session.init();
+
+ } catch(E) {
+ var error = '!! ' + E + '\n';
+ this.G.error.sdump('D_ERROR',error);
+ alert(error);
+ this.logoff();
+
+ if (typeof this.on_login_error == 'function') {
+ this.G.error.sdump('D_AUTH','auth.controller.on_login_error()\n');
+ this.on_login_error(E);
+ }
+ }
+
+ },
+ 'logoff' : function() {
+
+ this.G.error.sdump('D_AUTH','logoff' + this.mw + '\n');
+ this.view.progress_bar.value = 0; this.view.progress_bar.setAttribute('real','0.0');
+ this.view.submit_button.disabled = false;
+ this.view.password_prompt.disabled = false;
+ this.view.password_prompt.value = '';
+ this.view.name_prompt.disabled = false;
+ this.view.name_prompt.focus(); this.view.name_prompt.select();
+
+ this.session.close();
+
+ if (typeof this.on_logoff == 'function') {
+ this.G.error.sdump('D_AUTH','auth.controller.on_logoff()\n');
+ this.on_logoff();
+ }
+
+ },
+ 'close' : function() {
+
+ this.G.error.sdump('D_AUTH','close' + this.mw + '\n');
+ this.logoff();
+ for (var w in this.G.window.appshell_list) {
+ this.G.window.appshell_list[w].close();
+ }
+ this.mw.close(); /* Probably won't go any further */
+
+ if (typeof this.on_close == 'function') {
+ this.G.error.sdump('D_AUTH','auth.controller.on_close()\n');
+ this.on_close();
+ }
+
+ }
+}
+
+dump('exiting auth/controller.js\n');
--- /dev/null
+dump('entering auth/session.js\n');
+
+if (typeof auth == 'undefined') auth = {};
+auth.session = function (controller,mw,G) {
+
+ this.mw = mw; this.G = G; this.controller = controller;
+
+ return this;
+};
+
+auth.session.prototype = {
+
+ 'init' : function () {
+
+ try {
+ var init = this.G.network.request(
+ 'open-ils.auth',
+ 'open-ils.auth.authenticate.init',
+ [ this.controller.view.name_prompt.value ]
+ );
+
+ if (init) {
+
+ this.key = this.G.network.request(
+ 'open-ils.auth',
+ 'open-ils.auth.authenticate.complete',
+ [
+ this.controller.view.name_prompt.value,
+ hex_md5(
+ init +
+ hex_md5(
+ this.controller.view.password_prompt.value
+ )
+ )
+ ]
+ );
+
+ this.G.error.sdump('D_AUTH','auth.session.key = ' + this.key + '\n');
+
+ if (Number(this.key) == 0) {
+ throw('Invalid name/password combination.');
+ } else if (instanceOf(this.key,ex)) {
+ throw(this.key.err_msg());
+ }
+
+ if (typeof this.on_init == 'function') {
+ this.G.error.sdump('D_AUTH','auth.session.on_init()\n');
+ this.on_init();
+ }
+
+ } else {
+
+ var error = 'open-ils.auth.authenticate.init returned false\n';
+ this.G.error.sdump('D_ERROR',error);
+ this.controller.logoff();
+ throw(error);
+ }
+
+ } catch(E) {
+ var error = 'Error on auth.session.init(): ' + E + '\n';
+ this.G.error.sdump('D_ERROR',error);
+
+ if (typeof this.on_init_error == 'function') {
+ this.G.error.sdump('D_AUTH','auth.session.on_init_error()\n');
+ this.on_init_error(E);
+ }
+
+ throw(E);
+ }
+
+ },
+
+ 'close' : function () {
+ this.G.error.sdump('D_AUTH','auth.session.close()\n');
+ this.key = null;
+ if (typeof this.G.on_close == 'function') {
+ this.G.error.sdump('D_AUTH','auth.session.on_close()\n');
+ this.G.on_close();
+ }
+ }
+
+}
+
+dump('exiting auth/session.js\n');
--- /dev/null
+/*
+
+*/
+
+var JSAN = function () { JSAN.addRepository(arguments) }
+
+JSAN.VERSION = 0.10;
+
+/*
+
+*/
+
+JSAN.globalScope = self;
+JSAN.includePath = ['.', 'lib'];
+JSAN.errorLevel = "die";
+JSAN.errorMessage = "";
+JSAN.loaded = {};
+
+/*
+
+*/
+
+JSAN.use = function () {
+ var classdef = JSAN.require(arguments[0]);
+ if (!classdef) return null;
+
+ var importList = JSAN._parseUseArgs.apply(JSAN, arguments).importList;
+ JSAN.exporter(classdef, importList);
+
+ return classdef;
+}
+
+/*
+
+*/
+
+JSAN.require = function (pkg) {
+ var path = JSAN._convertPackageToPath(pkg);
+ if (JSAN.loaded[path]) {
+ return JSAN.loaded[path];
+ }
+
+ try {
+ var classdef = eval(pkg);
+ if (typeof classdef != 'undefined') return classdef;
+ } catch (e) { /* nice try, eh? */ }
+
+
+ for (var i = 0; i < JSAN.includePath.length; i++) {
+ var js;
+ try{
+ var url = JSAN._convertPathToUrl(path, JSAN.includePath[i]);
+ js = JSAN._loadJSFromUrl(url);
+ } catch (e) {
+ if (i == JSAN.includePath.length - 1) throw e;
+ }
+ if (js != null) {
+ var classdef = JSAN._createScript(js, pkg);
+ JSAN.loaded[path] = classdef;
+ return classdef;
+ }
+ }
+ return false;
+
+}
+
+/*
+
+*/
+
+JSAN.exporter = function () {
+ JSAN._exportItems.apply(JSAN, arguments);
+}
+
+/*
+
+*/
+
+JSAN.addRepository = function () {
+ var temp = JSAN._flatten( arguments );
+ // Need to go in reverse to do something as simple as unshift( @foo, @_ );
+ for ( var i = temp.length - 1; i >= 0; i-- )
+ JSAN.includePath.unshift(temp[i]);
+ return JSAN;
+}
+
+JSAN._flatten = function( list1 ) {
+ var list2 = new Array();
+ for ( var i = 0; i < list1.length; i++ ) {
+ if ( typeof list1[i] == 'object' ) {
+ list2 = JSAN._flatten( list1[i], list2 );
+ }
+ else {
+ list2.push( list1[i] );
+ }
+ }
+ return list2;
+};
+
+JSAN._findMyPath = function () {
+ if (document) {
+ var scripts = document.getElementsByTagName('script');
+ for ( var i = 0; i < scripts.length; i++ ) {
+ var src = scripts[i].getAttribute('src');
+ if (src) {
+ var inc = src.match(/^(.*?)\/?JSAN.js/);
+ if (inc && inc[1]) {
+ var repo = inc[1];
+ for (var j = 0; j < JSAN.includePath.length; j++) {
+ if (JSAN.includePath[j] == repo) {
+ return;
+ }
+ }
+ JSAN.addRepository(repo);
+ }
+ }
+ }
+ }
+}
+JSAN._findMyPath();
+
+JSAN._convertPathToUrl = function (path, repository) {
+ return repository.concat('/' + path);
+};
+
+
+JSAN._convertPackageToPath = function (pkg) {
+ var path = pkg.replace(/\./g, '/');
+ path = path.concat('.js');
+ return path;
+}
+
+JSAN._parseUseArgs = function () {
+ var pkg = arguments[0];
+ var importList = [];
+
+ for (var i = 1; i < arguments.length; i++)
+ importList.push(arguments[i]);
+
+ return {
+ pkg: pkg,
+ importList: importList
+ }
+}
+
+JSAN._loadJSFromUrl = function (url) {
+ return new JSAN.Request().getText(url);
+}
+
+JSAN._findExportInList = function (list, request) {
+ if (list == null) return false;
+ for (var i = 0; i < list.length; i++)
+ if (list[i] == request)
+ return true;
+ return false;
+}
+
+JSAN._findExportInTag = function (tags, request) {
+ if (tags == null) return [];
+ for (var i in tags)
+ if (i == request)
+ return tags[i];
+ return [];
+}
+
+JSAN._exportItems = function (classdef, importList) {
+ var exportList = new Array();
+ var EXPORT = classdef.EXPORT;
+ var EXPORT_OK = classdef.EXPORT_OK;
+ var EXPORT_TAGS = classdef.EXPORT_TAGS;
+
+ if (importList.length > 0) {
+ importList = JSAN._flatten( importList );
+
+ for (var i = 0; i < importList.length; i++) {
+ var request = importList[i];
+ if ( JSAN._findExportInList(EXPORT, request)
+ || JSAN._findExportInList(EXPORT_OK, request)) {
+ exportList.push(request);
+ continue;
+ }
+ var list = JSAN._findExportInTag(EXPORT_TAGS, request);
+ for (var i = 0; i < list.length; i++) {
+ exportList.push(list[i]);
+ }
+ }
+ } else {
+ exportList = EXPORT;
+ }
+ JSAN._exportList(classdef, exportList);
+}
+
+JSAN._exportList = function (classdef, exportList) {
+ if (typeof(exportList) != 'object') return null;
+ for (var i = 0; i < exportList.length; i++) {
+ var name = exportList[i];
+
+ if (JSAN.globalScope[name] == null)
+ JSAN.globalScope[name] = classdef[name];
+ }
+}
+
+JSAN._makeNamespace = function(js, pkg) {
+ var spaces = pkg.split('.');
+ var parent = JSAN.globalScope;
+ eval(js);
+ var classdef = eval(pkg);
+ for (var i = 0; i < spaces.length; i++) {
+ var name = spaces[i];
+ if (i == spaces.length - 1) {
+ if (typeof parent[name] == 'undefined') {
+ parent[name] = classdef;
+ if ( typeof classdef['prototype'] != 'undefined' ) {
+ parent[name].prototype = classdef.prototype;
+ }
+ }
+ } else {
+ if (parent[name] == undefined) {
+ parent[name] = {};
+ }
+ }
+
+ parent = parent[name];
+ }
+ return classdef;
+}
+
+JSAN._handleError = function (msg, level) {
+ if (!level) level = JSAN.errorLevel;
+ JSAN.errorMessage = msg;
+
+ switch (level) {
+ case "none":
+ break;
+ case "warn":
+ alert(msg);
+ break;
+ case "die":
+ default:
+ throw new Error(msg);
+ break;
+ }
+}
+
+JSAN._createScript = function (js, pkg) {
+ try {
+ return JSAN._makeNamespace(js, pkg);
+ } catch (e) {
+ JSAN._handleError("Could not create namespace[" + pkg + "]: " + e);
+ }
+ return null;
+}
+
+
+JSAN.prototype = {
+ use: function () { JSAN.use.apply(JSAN, arguments) }
+};
+
+
+// Low-Level HTTP Request
+JSAN.Request = function (jsan) {
+ if (JSAN.globalScope.XMLHttpRequest) {
+ this._req = new XMLHttpRequest();
+ } else {
+ this._req = new ActiveXObject("Microsoft.XMLHTTP");
+ }
+}
+
+JSAN.Request.prototype = {
+ _req: null,
+
+ getText: function (url) {
+ this._req.open("GET", url, false);
+ try {
+ this._req.send(null);
+ if (this._req.status == 200 || this._req.status == 0)
+ return this._req.responseText;
+ } catch (e) {
+ JSAN._handleError("File not found: " + url);
+ return null;
+ };
+
+ JSAN._handleError("File not found: " + url);
+ return null;
+ }
+};
+
+/*
+
+*/
--- /dev/null
+dump('entering main/main.js\n');
+
+function main_init() {
+ dump('entering main_init()\n');
+ try {
+ if (typeof JSAN == 'undefined') {
+ throw(
+ "The JSAN library object is missing."
+ );
+ }
+ /////////////////////////////////////////////////////////////////////////////
+
+ JSAN.errorLevel = "die"; // none, warn, or die
+ JSAN.addRepository('..');
+
+ //JSAN.use('test.test'); test.test.hello_world();
+
+ var mw = self;
+ var G = {};
+ G.OpenILS = {};
+ G.OpenSRF = {};
+
+ JSAN.use('util.error');
+ G.error = new util.error( mw, G );
+
+ JSAN.use('main.window');
+ G.window = new main.window( mw, G );
+
+ JSAN.use('main.network');
+ G.network = new main.network( mw, G );
+
+ JSAN.use('auth.controller');
+ G.auth = new auth.controller( mw, G );
+
+ G.auth.on_login = function() {
+
+ JSAN.use('OpenILS.data');
+ G.OpenILS.data = new OpenILS.data( mw, G );
+ G.OpenILS.data.on_complete = function () {
+
+ alert('spawn app_shell');
+ }
+ G.OpenILS.data.init();
+ }
+
+ G.auth.init();
+
+ /////////////////////////////////////////////////////////////////////////////
+
+ } catch(E) {
+ var error = "!! This software has encountered an error. Please tell your friendly " +
+ "system administrator or software developer the following:\n" + E + '\n';
+ try { G.error.sdump('D_ERROR',error); } catch(E) { dump(error); }
+ alert(error);
+ }
+ dump('exiting main_init()\n');
+}
+
+dump('exiting main/main.js\n');
--- /dev/null
+<?xml version="1.0"?>
+<!-- Application: Evergreen Staff Client -->
+<!-- Screen: Main, Authentication Window -->
+
+<!-- Stylesheets -->
+<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
+
+<!-- Localization -->
+<!DOCTYPE window SYSTEM "chrome://evergreen/locale/auth.dtd">
+
+<window id="main_win"
+ onload="main_init()"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+ <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
+ <!-- PRESENTATION -->
+ <?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
+ <?xml-stylesheet href="chrome://evergreen/skin/evergreen.css" type="text/css"?>
+ <?xml-stylesheet href="chrome://evergreen/skin/auth.css" type="text/css"?>
+
+ <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
+ <!-- BEHAVIOR -->
+ <script type="text/javascript" src="../OpenILS/util/utils.js"></script>
+ <script type="text/javascript" src="../OpenILS/util/md5.js"></script>
+ <script type="text/javascript" src="../OpenILS/util/JSON.js"></script>
+ <script type="text/javascript" src="../OpenILS/util/fmall.js"></script>
+ <script type="text/javascript" src="../OpenILS/util/fmgen.js"></script>
+ <script type="text/javascript">var IAMXUL = true;</script>
+ <script type="text/javascript" src="../OpenILS/util/RemoteRequest.js"></script>
+ <script type="text/javascript" src="../OpenILS/util/OrgTree.js"></script>
+ <script type="text/javascript" src="../OpenILS/util/org_utils.js"></script>
+
+ <script type="text/javascript" src="JSAN.js"></script>
+ <script type="text/javascript" src="main.js"></script>
+
+ <commandset id="auth_cmds">
+ <command id="cmd_login"/>
+ <command id="cmd_logoff"/>
+ <command id="cmd_close_window"/>
+ </commandset>
+
+ <keyset id="auth_keys">
+ <key id="auth-login-key" modifiers="accel" key="S" command="cmd_login"/>
+ <key id="auth-logoff-key" modifiers="accel" key="L" command="cmd_logoff"/>
+ <key id="auth-close-key" modifiers="accel" key="Q" command="cmd_close_window"/>
+ </keyset>
+
+ <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
+ <!-- CONTENT -->
+ <groupbox id="main_groupbox" flex="1">
+ <caption id="main_caption" label="&auth.login_header;"/>
+ <label value="&auth.version;"/>
+ <label value="Development Version"/>
+ <label value=" "/>
+ <grid>
+ <columns>
+ <column />
+ <column />
+ </columns>
+ <rows>
+ <row>
+ <label value="&auth.name_prompt;" control="name_prompt" accesskey="&auth.name_prompt.key;"/>
+ <textbox id="name_prompt" value=""/>
+ </row>
+ <row>
+ <label value="&auth.password_prompt;" control="password_prompt" accesskey="&auth.password_prompt.key;"/>
+ <textbox id="password_prompt" value="" type="password"/>
+ </row>
+ <row>
+ <label/>
+ <hbox>
+ <button id="submit_button" label="&auth.submit_prompt;" accesskey="&auth.submit_prompt.key;" command="cmd_login"/>
+ <button label="&auth.logoff_prompt;" accesskey="&auth.logoff_prompt.key;" command="cmd_logoff"/>
+ </hbox>
+ </row>
+ <row>
+ <label/>
+ <label/>
+ </row>
+ <row>
+ <label/>
+ <button label="&auth.quit_prompt;" accesskey="&auth.quit_prompt.key;" command="cmd_close_window"/>
+ </row>
+ </rows>
+ </grid>
+ <progressmeter id="auth_meter" mode="normal" value="0"/>
+ </groupbox>
+
+</window>
+
--- /dev/null
+dump('entering main/network.js\n');
+
+if (typeof main == 'undefined') main = {};
+main.network = function (mw,G) {
+
+ this.mw = mw; this.G = G;
+
+ // Place a test here for network connectivity
+ // this.offline = true;
+
+ return this;
+};
+
+main.network.prototype = {
+
+ // Flag for whether the staff client should act as if it were offline or not
+ 'offline' : false,
+
+ 'request' : function (app,name,params,f) {
+
+ try {
+
+ this.G.error.sdump('D_SES','=-=-=-=-= user_request("'+app+'","'+name+'",'+js2JSON(params)+')\n');
+ var request = new RemoteRequest( app, name );
+ for(var index in params) {
+ request.addParam(params[index]);
+ }
+
+ if (f) {
+ request.setCompleteCallback(f);
+ request.send(false);
+ this.G.error.sdump('D_SES_RESULT','=-=-= result asynced\n');
+ return null;
+ } else {
+ request.send(true);
+ var result = request.getResultObject();
+ this.G.error.sdump('D_SES_RESULT','=-=-= result = ' + js2JSON(result) + '\n');
+ return result;
+ }
+
+ } catch(E) {
+ if (instanceOf(E,perm_ex)) {
+ alert('permission exception: ' + js2JSON(E));
+ }
+ throw(E);
+ }
+ }
+}
+
+/*
+function sample_callback(request) {
+ var result = request.getResultObject();
+}
+*/
+
+dump('exiting main/network.js\n');
--- /dev/null
+dump('entering main/window.js\n');
+
+if (typeof main == 'undefined') main = {};
+main.window = function (mw,G) {
+ this.main_window = mw;
+ return this;
+};
+
+main.window.prototype = {
+
+ // pointer to the auth window
+ 'main_window' : null,
+
+ // list of open window references, used for debugging in shell
+ 'win_list' : [],
+
+ // list of Top Level menu interface window references
+ 'appshell_list' : [],
+
+ // list of documents for debugging. BROKEN
+ 'doc_list' : [],
+
+ // Windows need unique names. This number helps.
+ 'window_name_increment' : 0,
+
+ // This number gets put into the title bar for Top Level menu interface windows
+ 'appshell_name_increment' : 0
+
+}
+
+dump('exiting main/window.js\n');
--- /dev/null
+dump('entering test/test.js\n');
+
+if (typeof test == 'undefined') var test = {};
+test.test = {};
+
+test.test.EXPORT_OK = [ 'hello_world' ];
+test.test.EXPORT_TAGS = { ':all' : test.test.EXPORT_OK };
+
+test.test.hello_world = function () {
+ alert('Hello World');
+}
+
+dump('exiting test/test.js\n');
--- /dev/null
+dump('entering util/error.js\n');
+
+if (typeof util == 'undefined') util = {};
+util.error = function (mw,G) {
+
+ this.consoleService = Components.classes['@mozilla.org/consoleservice;1']
+ .getService(Components.interfaces.nsIConsoleService);
+
+ this.sdump_last_time = new Date();
+
+ return this;
+};
+
+util.error.prototype = {
+
+ 'printDebug' : true,
+ 'consoleDump' : true,
+ 'debugDump' : true,
+ 'arg_dump_full' : false,
+
+ 'debug' : function(e){
+ dump('-----------------------------------------\n'
+ + e + '\n-----------------------------------------\n' );
+ },
+
+ 'sdump_levels' : {
+
+ 'D_NONE' : false, 'D_ALL' : false, 'D_ERROR' : true, 'D_DEBUG' : true, 'D_TRACE' : false,
+ 'D_TRACE_ENTER' : false, 'D_TRACE_EXIT' : false, 'D_TIMEOUT' : false, 'D_FILTER' : false,
+ 'D_CONSTRUCTOR' : false, 'D_FIREFOX' : false, 'D_LEGACY' : false,
+
+ 'D_CLAM' : false, 'D_PAGED_TREE' : false, 'D_GRID_LIST' : false, 'D_HTML_TABLE' : false,
+ 'D_TAB' : false,
+
+ 'D_AUTH' : true, 'D_OPAC' : true, 'D_CAT' : false,
+
+ 'D_PATRON_SEARCH' : false, 'D_PATRON_SEARCH_FORM' : false, 'D_PATRON_SEARCH_RESULTS' : false,
+
+ 'D_PATRON_DISPLAY' : false, 'D_PATRON_DISPLAY_STATUS' : false, 'D_PATRON_DISPLAY_CONTACT' : false,
+
+ 'D_PATRON_ITEMS' : false, 'D_PATRON_CHECKOUT_ITEMS' : false, 'D_PATRON_HOLDS' : false,
+ 'D_PATRON_BILLS' : false, 'D_PATRON_EDIT' : false,
+
+ 'D_CHECKIN' : false, 'D_CHECKIN_ITEMS' : false,
+
+ 'D_HOLD_CAPTURE' : false, 'D_HOLD_CAPTURE_ITEMS' : false,
+
+ 'D_PATRON_UTILS' : false, 'D_CIRC_UTILS' : false,
+
+ 'D_FILE' : true, 'D_EXPLODE' : false, 'D_FM_UTILS' : false, 'D_PRINT' : false, 'D_SES' : true,
+ 'D_SES_FUNC' : false, 'D_SES_RESULT' : true, 'D_SPAWN' : false, 'D_STRING' : false,
+ 'D_UTIL' : false, 'D_WIN' : false, 'D_WIDGETS' : false
+ },
+
+ 'filter_console_init' : function (p) {
+ this.sdump('D_FILTER',this.arg_dump(arguments,{0:true}));
+
+ var filterConsoleListener = {
+ observe: function( msg ) {
+ try {
+ p.observe_msg( msg );
+ } catch(E) {
+ alert(E);
+ }
+ },
+ QueryInterface: function (iid) {
+ if (!iid.equals(Components.interfaces.nsIConsoleListener) &&
+ !iid.equals(Components.interfaces.nsISupports)) {
+ throw Components.results.NS_ERROR_NO_INTERFACE;
+ }
+ return this;
+ }
+ };
+ try {
+ this.consoleService.registerListener(filterConsoleListener);
+ } catch(E) {
+ alert(E);
+ }
+
+ this.sdump('D_TRACE_EXIT',this.arg_dump(arguments));
+ },
+
+ 'sdump' : function (level,msg) {
+ try {
+ var now = new Date();
+ var message = now.valueOf() + '\tdelta = ' + (now.valueOf() - this.sdump_last_time.valueOf()) + '\t' + level + '\n' + msg;
+ if (this.sdump_levels['D_NONE']) return null;
+ if (this.sdump_levels[level]||this.sdump_levels['D_ALL']) {
+ this.sdump_last_time = now;
+ if (this.debugDump)
+ this.debug(message);
+ if (this.consoleDump)
+ this.consoleService.logStringMessage(message);
+ }
+ } catch(E) {
+ dump('Calling sdump but ' + E + '\n');
+ }
+ },
+
+ 'arg_dump' : function (args,dump_these) {
+ var s = '*>*>*> Called function ';
+ try {
+ if (!dump_these)
+ dump_these = {};
+ s += args.callee.toString().match(/\w+/g)[1] + ' : ';
+ for (var i = 0; i < args.length; i++)
+ s += typeof(args[i]) + ' ';
+ s += '\n';
+ for (var i = 0; i < args.length; i++)
+ if (dump_these[i]) {
+
+ var arg = args[i];
+ //dump('dump_these[i] = ' + dump_these[i] + ' arg = ' + arg + '\n');
+
+ if (typeof(dump_these[i])=='string') {
+
+ if (dump_these[i].slice(0,1) == '.') {
+ var cmd = 'arg' + dump_these[i];
+ var result;
+ try {
+ result = eval( cmd );
+ } catch(E) {
+ result = cmd + ' ==> ' + E;
+ }
+ s += '\targ #' + i + ': ' + cmd + ' = ' + result;
+ } else {
+ var result;
+ try {
+ result = eval( dump_these[i] );
+ } catch(E) {
+ result = dump_these[i] + ' ==> ' + E;
+ }
+ s += '\targ #' + i + ': ' + result;
+ }
+
+ } else {
+ s += '\targ #' + i + ' = ';
+ try {
+ //s += js2JSON( arg );
+ s += arg;
+ } catch(E) {
+ s += arg;
+ }
+ }
+
+ s += '\n';
+ if (this.arg_dump_full)
+ s += 'Definition: ' + args.callee.toString() + '\n';
+
+ }
+ return s;
+ } catch(E) {
+ return s + '\nDEBUG ME: ' + js2JSON(E) + '\n';
+ }
+ },
+
+ 'handle_error' : function (E,annoy) {
+ var s = '';
+ if (instanceOf(E,ex)) {
+ s += E.err_msg();
+ //s += '\n\n=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n\n';
+ //s += 'This error was anticipated.\n\n';
+ //s += js2JSON(E).substr(0,200) + '...\n\n';
+ if (snd_bad) snd_bad();
+ } else {
+ s += '\n\n=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n\n';
+ s += 'This is a bug that we will fix later.\n\n';
+ try {
+ s += js2JSON(E).substr(0,1024) + '\n\n';
+ } catch(E2) {
+ try {
+ s += E.substr(0,1024) + '\n\n';
+ } catch(E3) {
+ s += E + '\n\n';
+ }
+ }
+ if (snd_really_bad) snd_really_bad();
+ }
+ sdump('D_ERROR',s);
+ if (annoy)
+ this.s_alert(s);
+ else
+ alert(s);
+ },
+
+ 's_alert' : function (s) { alert(s); }
+}
+
+dump('exiting util/error.js\n');
--- /dev/null
+dump('entering util/exec.js\n');
+
+if (typeof util == 'undefined') var util = {};
+util.exec = {};
+
+util.exec.EXPORT_OK = [ 'chain_exec' ];
+util.exec.EXPORT_TAGS = { ':all' : util.exec.EXPORT_OK };
+
+// This executes a series of functions, but tries to give other events/functions a chance to
+// execute between each one.
+util.exec.chain = function () {
+ var args = [];
+ for (var i = 0; i < arguments.length; i++) {
+ var arg = arguments[i];
+ switch(arg.constructor.name) {
+ case 'Function' :
+ args.push( arg );
+ break;
+ case 'Array' :
+ for (var j = 0; j < arg.length; j++) {
+ if (typeof arg[j] == 'function') args.push( arg[j] );
+ }
+ break;
+ case 'Object' :
+ for (var j in arg) {
+ if (typeof arg[j] == 'function') args.push( arg[j] );
+ }
+ break;
+ }
+ }
+ if (args.length > 0) setTimeout(
+ function() {
+ args[0]();
+ if (args.length > 1 ) util.exec.chain( args.slice(1) );
+ }, 0
+ );
+}
+
+dump('exiting util/exec.js\n');
--- /dev/null
+<!ENTITY auth.title "Evergreen Staff Client ">
+<!ENTITY auth.version "Evergreen 0.1.0 2005072719">
+
+<!ENTITY auth.login_header "Login">
+<!ENTITY auth.name_prompt "Name:"><!ENTITY auth.name_prompt.key "N">
+<!ENTITY auth.password_prompt "Password:"><!ENTITY auth.password_prompt.key "P">
+<!ENTITY auth.submit_prompt "Submit"><!ENTITY auth.submit_prompt.key "S">
+<!ENTITY auth.logoff_prompt "Log Off"><!ENTITY auth.logoff_prompt.key "L">
+<!ENTITY auth.quit_prompt "Exit Evergreen"><!ENTITY auth.quit_prompt.key "x">
+
+<!ENTITY about.title "About">
+
--- /dev/null
+@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
+@namespace html url("http://www.w3.org/TR/REC-html40");
+
--- /dev/null
+@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
+@namespace html url("http://www.w3.org/TR/REC-html40");
+
+tabpanel { border: 2px groove black; }
+caption { font-weight: bold; }
+
+.my_overflow { overflow: auto; }
+
+.text_left { text-align: left; }
+.text_right { text-align: right; }
+.text_center { text-align: center; }
+.text_justify { text-align: justify; }
+
+.tan { background-color: #D2B48C; }
+.sandy_brown { background-color: #F4A460; }
+.peach_puff { background-color: #FFDAB9; }
+.pale_violet_red { background-color: #D87093; }
+.cadet_blue { background-color: #5F9EA0; }
+.dark_salmon { background-color: #E9967A; }
+.coral { background-color: #FF7F50; }
+
+.deleted_address { background-color: red; }
+
--- /dev/null
+// Preferences that get set when the application is loaded
+
+// Modified by Jason for Evergreen
+
+// This one is required for XUL Runner
+pref("toolkit.defaultChromeURI", "chrome://evergreen/content/main/main.xul");
+
+// This one just makes things speedier. We use a lot of XMLHttpRequest
+pref("network.http.max-persistent-connections-per-server",8);
+
+// This stops the unresponsive script warning, but the code is still too slow for some reason.
+// However, it's better than POEM, which I wasted a day on :)
+pref("dom.max_script_run_time",60);
+
+pref("javascript.options.strict",false);
--- /dev/null
+<?xml version="1.0"?>
+
+<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:em="http://www.mozilla.org/2004/em-rdf#">
+
+ <!-- modified by Jason for Evergreen -->
+
+ <Description about="urn:mozilla:install-manifest">
+ <em:id>{c3dd711b-c9b4-4785-b8f8-6157149c8905}</em:id>
+ <em:version>0.1.0</em:version>
+ <em:type>2</em:type>
+
+ <!-- Target Application this extension can install into,
+ with minimum and maximum supported versions. -->
+ <em:targetApplication>
+ <Description>
+ <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
+ <em:minVersion>1.0</em:minVersion>
+ <em:maxVersion>1.0+</em:maxVersion>
+ </Description>
+ </em:targetApplication>
+
+ <!-- Packages, Skins and Locales that this extension registers -->
+ <em:file>
+ <Description about="urn:mozilla:extension:file:evergreen.jar">
+ <em:package>content/evergreen/</em:package>
+ <em:locale>locale/en-US/evergreen/</em:locale>
+ <em:skin>skin/evergreen/</em:skin>
+ </Description>
+ </em:file>
+
+ <!-- Front End MetaData -->
+ <em:name>Evergreen</em:name>
+ <em:description>Evergreen Staff Client </em:description>
+
+ <em:homepageURL>http://open-ils.org/</em:homepageURL>
+
+ </Description>
+</RDF>