xuledit in a tab. From http://ted.mielczarek.org/code/mozilla/index.html. Need...
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 29 Jun 2005 13:31:48 +0000 (13:31 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 29 Jun 2005 13:31:48 +0000 (13:31 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@966 dcc99617-32d9-48b4-a31d-7c20da2025e4

Evergreen/staff_client/chrome/content/evergreen/main/app_shell_menus_overlay.xul
Evergreen/staff_client/chrome/content/evergreen/main/app_shell_overlay.xul
Evergreen/staff_client/chrome/content/evergreen/util/spawn_win.js
Evergreen/staff_client/chrome/content/evergreen/util/xuledit.js [new file with mode: 0644]
Evergreen/staff_client/chrome/content/evergreen/util/xuledit.xul [new file with mode: 0644]
Evergreen/staff_client/chrome/locale/en-US/evergreen/OpenILS.properties

index e4995d5..7721b03 100644 (file)
                <menuitem label="stub" />
                <menuitem label="Test Module" command="cmd_test"/>
                <menuitem label="Javscript Console" command="cmd_console"/>
+               <menuitem label="XUL Test" command="cmd_xuleditor"/>
        </menupopup>
 </menu>
 
index 61aeeb7..7e470e8 100644 (file)
@@ -55,6 +55,9 @@
        <command id="cmd_console" oncommand="
                mw.spawn_javascript_console(document,true,{}); "/>
 
+       <command id="cmd_xuleditor" oncommand="
+               mw.spawn_xuleditor(document,true,{}); "/>
+
        <command id="cmd_test" oncommand="
                "/>
 
index 445a26f..f128e56 100644 (file)
@@ -142,3 +142,8 @@ function spawn_javascript_console(d,tab_flag,passthru_params) {
        var chrome = 'chrome://global/cotnent/console.xul';
        spawn_interface(d,tab_flag,'main_tabbox',chrome,getString('javascript_console_label'),passthru_params);
 }
+
+function spawn_xuleditor(d,tab_flag,passthru_params) {
+       var chrome = 'chrome://evergreen/content/util/xuledit.xul';
+       spawn_interface(d,tab_flag,'main_tabbox',chrome,getString('xuleditor_label'),passthru_params);
+}
diff --git a/Evergreen/staff_client/chrome/content/evergreen/util/xuledit.js b/Evergreen/staff_client/chrome/content/evergreen/util/xuledit.js
new file mode 100644 (file)
index 0000000..9366c88
--- /dev/null
@@ -0,0 +1,62 @@
+// From Ted's Mozilla page: http://ted.mielczarek.org/code/mozilla/index.html 
+var old = '';
+var timeout = -1;
+var xwin = null;
+var newwin = false;
+
+function init()
+{
+  if(xwin)  // for some reason onload gets called when the browser refreshes???
+    return;
+
+  update();
+  document.getElementById('ta').select();
+}
+
+function openwin()
+{
+  toggleBrowser(false);
+  xwin = window.open('about:blank', 'xulwin', 'chrome,all,resizable=yes,width=400,height=400');
+  newwin = true;
+  update();
+}
+
+function toggleBrowser(show)
+{
+  document.getElementById("split").collapsed = !show;
+  document.getElementById("content").collapsed = !show;
+  document.getElementById("open").collapsed = !show;
+}
+
+function update()
+{
+  var textarea = document.getElementById("ta");
+
+  // either this is the first time, or
+  // they closed the window
+  if(xwin == null || (xwin instanceof Window && xwin.document == null)) {
+    toggleBrowser(true);
+    xwin = document.getElementById("content");
+    newwin = true;
+  }
+
+  if (old != textarea.value || newwin) {
+    old = textarea.value;
+    newwin = false;
+    var dataURI = "data:application/vnd.mozilla.xul+xml," + encodeURIComponent(old);
+    if(xwin instanceof Window)
+      xwin.document.location = dataURI;
+    else
+      xwin.setAttribute("src",dataURI);
+  }
+
+  timeout = window.setTimeout(update, 500);
+}
+
+function resetTimeout()
+{
+  if(timeout != -1)
+    window.clearTimeout(timeout);
+
+  timeout = window.setTimeout(update, 500);
+}
diff --git a/Evergreen/staff_client/chrome/content/evergreen/util/xuledit.xul b/Evergreen/staff_client/chrome/content/evergreen/util/xuledit.xul
new file mode 100644 (file)
index 0000000..90df235
--- /dev/null
@@ -0,0 +1,14 @@
+<?xml version="1.0"?>
+<!-- From Ted's Mozilla page: http://ted.mielczarek.org/code/mozilla/index.html -->
+<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
+<window id="xuledit" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" title="Live XUL Editor"
+onload="init()">
+<script type="application/x-javascript" src="xuledit.js"/>
+<vbox flex="1">
+<textbox id="ta" multiline="true" wrap="true" flex="1" onkeydown="resetTimeout()"
+value='&lt;?xml version="1.0"?&gt;&#x0A;&lt;?xml-stylesheet href="chrome://global/skin/" type="text/css"?&gt;&#x0A;&lt;window id="yourwindow" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"&gt;&#x0A;&lt;label value="Put your XUL here!"/&gt;&#x0A;&lt;/window&gt;'/>
+<splitter id="split"/>
+<iframe id="content" src="about:blank" flex="1"/>
+<hbox><button id="open" label="Open preview in new window" onclick="openwin()"/><spacer flex="1"/></hbox>
+</vbox>
+</window>
index 21fa7f0..300ec6a 100644 (file)
@@ -15,3 +15,4 @@ copy_stat_cat_editor_interface_label=COPY STAT-CATS
 patron_stat_cat_editor_interface_label=PATRON STAT-CATS
 z39_50_import_interface_label=Z39.50 IMPORT
 javascript_console_label=CONSOLE
+xuleditor_label=XUL TEST