From a2342dd941d52c280080f6515509ffbee71a84f4 Mon Sep 17 00:00:00 2001 From: phasefx Date: Fri, 11 Feb 2005 15:50:47 +0000 Subject: [PATCH] A XUL version of the math app example. Some assembly required with the client_config.xml file. git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@46 9efc2488-bf62-4759-914b-345cdb29e865 --- examples/math_xul_client/Makefile | 19 +++++ examples/math_xul_client/install.js | 98 ++++++++++++++++++++++ .../math/content/conf/client_config.xml | 53 ++++++++++++ examples/math_xul_client/math/content/contents.rdf | 17 ++++ examples/math_xul_client/math/content/math.xul | 38 +++++++++ examples/math_xul_client/math/content/math_app.js | 50 +++++++++++ .../math_xul_client/math/content/math_overlay.xul | 32 +++++++ .../math_xul_client/math/locale/en-US/contents.rdf | 19 +++++ .../math_xul_client/math/locale/en-US/math.dtd | 7 ++ examples/math_xul_client/math/skin/contents.rdf | 23 +++++ examples/math_xul_client/math/skin/math.css | 4 + 11 files changed, 360 insertions(+) create mode 100644 examples/math_xul_client/Makefile create mode 100644 examples/math_xul_client/install.js create mode 100644 examples/math_xul_client/math/content/conf/client_config.xml create mode 100644 examples/math_xul_client/math/content/contents.rdf create mode 100644 examples/math_xul_client/math/content/math.xul create mode 100644 examples/math_xul_client/math/content/math_app.js create mode 100644 examples/math_xul_client/math/content/math_overlay.xul create mode 100644 examples/math_xul_client/math/locale/en-US/contents.rdf create mode 100644 examples/math_xul_client/math/locale/en-US/math.dtd create mode 100644 examples/math_xul_client/math/skin/contents.rdf create mode 100644 examples/math_xul_client/math/skin/math.css diff --git a/examples/math_xul_client/Makefile b/examples/math_xul_client/Makefile new file mode 100644 index 0000000..41ac95c --- /dev/null +++ b/examples/math_xul_client/Makefile @@ -0,0 +1,19 @@ +all: clean client + @echo + +client: + @echo We need the OpenSRF javascript code... + mkdir math/content/OpenSRF/ + cp ../../src/javascript/*.js math/content/OpenSRF/ + @echo We need a log directory... + mkdir math/content/log + touch math/content/log/preserve.directory.when.zipping + @echo We also need a math/content/conf/client_config.xml pointing to a running OpenSRF Math application. + @echo Then we package this into a Mozilla XPI file... + zip -q -r math.xpi install.js math/ + @echo After installing the XPI, use the chrome URL: + @echo chrome://math/content/ + +clean: + @echo Removing the OpenSRF javascript code, the log directory, and math.xpi... + rm -rf math/content/OpenSRF/ math/content/log math.xpi diff --git a/examples/math_xul_client/install.js b/examples/math_xul_client/install.js new file mode 100644 index 0000000..0b10d3d --- /dev/null +++ b/examples/math_xul_client/install.js @@ -0,0 +1,98 @@ +// ripped from Evergreen installation file + +/* We'll want to make this more flexible later */ + +install(); + +// ---------------------------------------------------------------------------- +// Performs the install +// ---------------------------------------------------------------------------- +function install() { + + // ---------------------------------------------------------------------------- + var _authors = "PINES"; + var _package = "math"; + var _packg_l = "math"; + var _version = "0.0.1"; + // ---------------------------------------------------------------------------- + + var err; // track the error + + err = initInstall( _package, "/"+_authors+"/"+_package, _version ); + if( err != 0 ) { return warn( "initInstall: " + err );} + + // ---------------------------------------------------------------------------- + // Discovers the path to the install directory + // ---------------------------------------------------------------------------- + install_dir = getFolder("Chrome", _packg_l ); + logComment( "Installing to: " + install_dir ); + + // ---------------------------------------------------------------------------- + // Directory where the 'content' is stored + // ---------------------------------------------------------------------------- + content_dir = getFolder( install_dir, "content" ); + if( err != 0 ) { return warn("getFolder:content_dir: " + err);} + + // ---------------------------------------------------------------------------- + // Directory where the skins are stored + // ---------------------------------------------------------------------------- + skin_dir = getFolder( install_dir, "skin" ); + if( err != 0 ) { return warn("getFolder:skin: " + err);} + + // ---------------------------------------------------------------------------- + // Directory where the local data is stored + // ---------------------------------------------------------------------------- + locale_dir = getFolder( install_dir, "locale" ); + if( err != 0 ) { return warn("getFolder:locale: " + err);} + + // ---------------------------------------------------------------------------- + // Sets the install directory for Evergreen + // ---------------------------------------------------------------------------- + err = setPackageFolder(install_dir); + if( err != 0 ) { return warn("setPackageFolder: " + err);} + + // ---------------------------------------------------------------------------- + // Searches the .xpi file for the directory name stored in _packg_l and + // copies that directory from the .xpi into Mozilla's chrome directory. + // In this case, we are copying over the entire evergreen folder + // ---------------------------------------------------------------------------- + err = addDirectory( _packg_l ) + if( err != 0 ) { return warn("addDirectory: " + err);} + + + // ---------------------------------------------------------------------------- + // Register the content directory + // The final argument is where Mozilla should expect to find the contents.rdf + // file *after* installation for the CONTENT portion of the package + // ---------------------------------------------------------------------------- + err = registerChrome( Install.CONTENT, content_dir ); + if( err != 0 ) { return warn("registerChrome:content " + err );} + + // ---------------------------------------------------------------------------- + // Register the skin directory + // ---------------------------------------------------------------------------- + err = registerChrome( Install.SKIN, skin_dir ); + if( err != 0 ) { return warn("registerChrome:skin " + err );} + + // ---------------------------------------------------------------------------- + // Register the locale directory + // ---------------------------------------------------------------------------- + //err = registerChrome( Install.LOCALE, locale_dir ); + //if( err != 0 ) { return warn("registerChrome:locale " + err );} + + err = registerChrome( Install.LOCALE, getFolder(locale_dir, "en-US") ); + if( err != 0 ) { return warn("registerChrome:locale " + err );} + + // ---------------------------------------------------------------------------- + // Do it. + // ---------------------------------------------------------------------------- + performInstall(); + +} + +function warn( message ) { + alert( message ); + logComment( message ); + return; +} + diff --git a/examples/math_xul_client/math/content/conf/client_config.xml b/examples/math_xul_client/math/content/conf/client_config.xml new file mode 100644 index 0000000..0dc75a9 --- /dev/null +++ b/examples/math_xul_client/math/content/conf/client_config.xml @@ -0,0 +1,53 @@ + + + + + + + + myhostname + + + 0 + + + 0 + + + + + + + debug.log + transport.log + error.log + + + + + + router@localhost/math + router@localhost/mathdb + router@localhost/storage + + + + + + jabber_connection + + + 15 + math_user + math_user_password + localhost + 5222 + 0 + + + diff --git a/examples/math_xul_client/math/content/contents.rdf b/examples/math_xul_client/math/content/contents.rdf new file mode 100644 index 0000000..7a8fb13 --- /dev/null +++ b/examples/math_xul_client/math/content/contents.rdf @@ -0,0 +1,17 @@ + + + + + + + + + + + + diff --git a/examples/math_xul_client/math/content/math.xul b/examples/math_xul_client/math/content/math.xul new file mode 100644 index 0000000..1396a0b --- /dev/null +++ b/examples/math_xul_client/math/content/math.xul @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + +