--- /dev/null
+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
--- /dev/null
+// 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;
+}
+
--- /dev/null
+<?xml version="1.0" ?>
+
+<oils_config>
+
+ <!-- General system settings -->
+
+ <system>
+ <hostname>myhostname</hostname>
+
+ <!-- log_level
+ Levels run between 0 and 3. O is no logging. 3 is full debug output -->
+ <log_level>0</log_level>
+
+ <!-- stdout_log
+ When set to 0, no stdout logging is done, when set to 1, all logging
+ goes to both stdout as well as their destined log file, if set to
+ 2, the messages only go to stdout. -->
+ <stdout_log>0</stdout_log>
+ </system>
+
+
+ <!-- Log files -->
+
+ <logs>
+ <debug>debug.log</debug>
+ <transport>transport.log</transport>
+ <error>error.log</error>
+ </logs>
+
+ <!-- Remote services -->
+
+ <remote_service>
+ <math>router@localhost/math</math>
+ <mathdb>router@localhost/mathdb</mathdb>
+ <storage>router@localhost/storage</storage>
+ </remote_service>
+
+ <!-- Transport -->
+
+ <transport>
+ <transport_impl>jabber_connection</transport_impl>
+
+ <!-- connect_timeout doubles as both the low level transport timeout
+ as well as the app connection timeout -->
+ <connect_timeout>15</connect_timeout>
+ <username>math_user</username>
+ <password>math_user_password</password>
+ <primary>localhost</primary>
+ <port>5222</port>
+ <ssl>0</ssl>
+ </transport>
+
+</oils_config>
--- /dev/null
+<?xml version="1.0"?>
+
+<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:chrome="http://www.mozilla.org/rdf/chrome#">
+
+ <RDF:Seq about="urn:mozilla:package:root">
+ <RDF:li resource="urn:mozilla:package:math"/>
+ </RDF:Seq>
+
+ <RDF:Description about="urn:mozilla:package:math"
+ chrome:displayName="Math"
+ chrome:author="PINES"
+ chrome:name="math"
+ chrome:extension="true"/>
+
+</RDF:RDF>
+
--- /dev/null
+<?xml version="1.0"?>
+<!-- Test Application: Math -->
+
+<!-- Stylesheets -->
+<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
+<?xml-stylesheet href="chrome://math/skin/math.css" type="text/css"?>
+
+<!-- Localization -->
+<!DOCTYPE window SYSTEM "chrome://math/locale/math.dtd">
+
+<window id="math_win" title="&math.title;" orient="vertical" style="overflow: auto"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+ <!-- Overlays for this XUL file -->
+ <?xul-overlay href="chrome://math/content/math_overlay.xul"?>
+
+ <!-- OpenSRF -->
+ <script>var myPackageDir = "math";</script>
+ <script src="OpenSRF/JSON.js" />
+ <script src="OpenSRF/md5.js" />
+ <script src="OpenSRF/opensrf_utils.js" />
+ <script src="OpenSRF/opensrf_config.js" />
+ <script src="OpenSRF/opensrf_dom_element.js" />
+ <script src="OpenSRF/opensrf_domain_object.js" />
+ <script src="OpenSRF/opensrf_transport.js" />
+ <script src="OpenSRF/opensrf_jabber_transport.js" />
+ <script src="OpenSRF/opensrf_msg_stack.js" />
+ <script src="OpenSRF/opensrf_app_session.js" />
+
+ <!-- The logic for this app -->
+ <script src="math_app.js" />
+
+ <!-- Layout to be filled in by overlays and javascript -->
+ <vbox id="main_vbox" class="test_class">
+ </vbox>
+
+</window>
+
--- /dev/null
+// connect and stup
+
+var ses;
+
+function execute( opp ) {
+
+ var a = document.getElementById("num1");
+ var b = document.getElementById("num2");
+ do_stuff( opp, a.value, b.value );
+
+}
+
+function do_stuff( opp, a, b ) {
+
+
+
+ try {
+
+ if( ses == null || ! AppSession.transport_handle.connected() ) {
+
+ /* deprecated */
+ ses = new AppSession( "user_name", "12345", "math" );
+ if( ! ses.connect() ) { alert( "Connect timed out!" ); }
+ }
+
+ var meth = new oilsMethod(opp, [ a, b ] );
+
+ var req = new AppRequest( ses, meth );
+ req.make_request();
+ var resp = req.recv( 5000 );
+ if( ! resp ) {
+ alert( "NO response from server!!!" );
+ quit(); return;
+ }
+
+ var scalar = resp.getContent();
+ var value = scalar.getValue();
+
+ var lab = document.getElementById( "answer" );
+ lab.value = "Answer: " + value;
+ req.finish();
+
+ } catch( E ) { alert( E.message ); }
+
+}
+
+
+function quit() { ses.disconnect(); window.close(); }
+
+
--- /dev/null
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
+<?xml-stylesheet href="chrome://math/skin/math.css" type="text/css"?>
+<!DOCTYPE overlay SYSTEM "chrome://math/locale/math.dtd">
+<overlay id="math_overlay"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+<vbox id="main_vbox" flex="1">
+ <label value="&math.title;" />
+ <textbox id="num1" />
+ <textbox id="num2" />
+ <grid flex="1" class="test_class">
+ <columns>
+ <column />
+ <column />
+ </columns>
+ <rows>
+ <row>
+ <button label="&math.add;" oncommand="execute('add');"/>
+ <button label="&math.sub;" oncommand="execute('sub');"/>
+ </row>
+ <row>
+ <button label="&math.mul;" oncommand="execute('mult');"/>
+ <button label="&math.div;" oncommand="execute('div');"/>
+ </row>
+ </rows>
+ </grid>
+ <label id="answer" value="" />
+ <button label="&math.quit;" oncommand="quit();"/>
+</vbox>
+
+</overlay>
--- /dev/null
+<?xml version="1.0"?>
+<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:chrome="http://www.mozilla.org/rdf/chrome#">
+ <RDF:Seq about="urn:mozilla:locale:root">
+ <RDF:li resource="urn:mozilla:locale:en-US"/>
+ </RDF:Seq>
+
+ <RDF:Description about="urn:mozilla:locale:en-US"
+ chrome:displayName="Math"
+ chrome:author="PINES"
+ chrome:name="en-US">
+ <chrome:packages>
+ <RDF:Seq about="urn:mozilla:locale:en-US:packages">
+ <RDF:li resource="urn:mozilla:locale:en-US:math"/>
+ </RDF:Seq>
+ </chrome:packages>
+ </RDF:Description>
+</RDF:RDF>
+
--- /dev/null
+<!ENTITY math.title "Math App">
+<!ENTITY math.add "Add">
+<!ENTITY math.sub "Subtract">
+<!ENTITY math.mul "Multiply">
+<!ENTITY math.div "Divide">
+<!ENTITY math.quit "Quit">
+
--- /dev/null
+<?xml version="1.0"?>
+
+<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:chrome="http://www.mozilla.org/rdf/chrome#">
+
+ <RDF:Seq about="urn:mozilla:skin:root">
+ <RDF:li resource="urn:mozilla:skin:math/1.0"/>
+ </RDF:Seq>
+
+ <RDF:Description about="urn:mozilla:skin:math/1.0"
+ chrome:displayName="Math"
+ chrome:author="PINES"
+ chrome:name="math/1.0">
+
+ <chrome:packages>
+ <RDF:Seq about="urn:mozilla:skin:math/1.0:packages">
+ <RDF:li resource="urn:mozilla:skin:math/1.0:math"/>
+ </RDF:Seq>
+ </chrome:packages>
+ </RDF:Description>
+
+</RDF:RDF>
+
--- /dev/null
+@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
+@namespace html url("http://www.w3.org/TR/REC-html40");
+
+.test_class { border: solid thin blue; }