don't need filter console anymore. Convert other tools to new framework
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Sun, 11 Dec 2005 08:04:03 +0000 (08:04 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Sun, 11 Dec 2005 08:04:03 +0000 (08:04 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@2334 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/xul/staff_client/chrome/content/evergreen/util/filter_console.xul [deleted file]
Open-ILS/xul/staff_client/chrome/content/evergreen/util/fm_view.xul
Open-ILS/xul/staff_client/chrome/content/evergreen/util/shell.html
Open-ILS/xul/staff_client/chrome/content/evergreen/util/xuledit.js
Open-ILS/xul/staff_client/server/main/menu.js
Open-ILS/xul/staff_client/server/main/menu_frame_menus.xul

diff --git a/Open-ILS/xul/staff_client/chrome/content/evergreen/util/filter_console.xul b/Open-ILS/xul/staff_client/chrome/content/evergreen/util/filter_console.xul
deleted file mode 100644 (file)
index 2b8b9c3..0000000
+++ /dev/null
@@ -1,166 +0,0 @@
-<?xml version="1.0"?>
-<!-- Application: Evergreen Staff Client -->
-<!-- Screen: About -->
-
-<!-- Stylesheets -->
-<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
-<?xml-stylesheet href="chrome://evergreen/skin/evergreen.css" type="text/css"?>
-
-<window id="filter_console_win" 
-       onload="try { my_init(); } catch(E) { alert(E); }"
-       xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
-
-       <script>mw.sdump('D_TRACE','Loading filter_console.xul\n');</script>
-
-       <script>
-       <![CDATA[
-
-               var rows; var containing; var not_containing;
-
-               function my_init() {
-
-                       rows = document.getElementById('filter_console_grid_rows');
-                       containing = document.getElementById('filter_console_containing');
-                       not_containing = document.getElementById('filter_console_not_containing');
-                       
-                       mw.filter_console_init( {'observe_msg':observe_msg} );
-                       build_sdump_menu();
-               }
-
-               function build_sdump_menu() {
-                       try {
-                               var mp = document.getElementById('fcmp');
-                               for (var i in mw.sdump_levels) {
-                                       var m = document.createElement( 'menuitem' );
-                                       mp.appendChild(m);
-                                       m.setAttribute('type','checkbox');
-                                       m.setAttribute('label',i);
-                                       m.setAttribute('checked',mw.sdump_levels[i]);
-                                       m.setAttribute('oncommand',
-                                               "mw.sdump_levels."+i+"=!mw.sdump_levels."+i+
-                                               "; this.setAttribute('checked',mw.sdump_levels."+i+");");
-                               }
-                       } catch(E) {
-                               alert(E);
-                       }
-               }
-
-               function observe_msg(msg) {
-
-                       try {
-                               var row = document.createElement('row');
-                               rows.appendChild(row);
-
-                               var hbox = document.createElement('hbox');
-                               row.appendChild(hbox);
-                               hbox.flex = 1;
-
-                               var tb = document.createElement('textbox');
-                               hbox.appendChild(tb);
-                               tb.setAttribute('multiline','true');
-                               tb.setAttribute('readonly','true');
-                               tb.setAttribute('rows','5');
-                               tb.setAttribute('flex','1');
-                               tb.setAttribute('value',msg.message);
-
-                       } catch(E) { dump(E) }
-               }
-
-               function test_filter(msg) {
-                       var pass = true;
-                       var c_array = containing.value.split(' ');
-                       var nc_array = not_containing.value.split(' ');
-                       for (var i = 0; i < c_array.length; i++) {
-                               var term = c_array[i];
-                               if (term != '' && term != null && term != undefined)
-                                       if (! msg.match( term ) )
-                                               pass = false;
-                       }
-                       for (var i = 0; i < nc_array.length; i++) {
-                               var term = nc_array[i];
-                               if (term != '' && term != null && term != undefined)
-                                       if (msg.match( term ) )
-                                               pass = false;
-                       }
-                       return pass;
-               }
-
-               function clear_rows(prune) {
-                       var delete_these = [];
-                       for (var i = 0; i < rows.childNodes.length; i++) {
-                               var row = rows.childNodes[i];
-                               var tb = row.firstChild.firstChild;
-                               var delete_me = ! test_filter(tb.value);
-                               if (!prune) delete_me = true;
-                               if (delete_me) delete_these.push( row ); 
-                       }
-                       var row; while (row = delete_these.pop()) { rows.removeChild(row); }
-               }
-
-               function hide_rows() {
-                       for (var i = 0; i < rows.childNodes.length; i++) {
-                               var row = rows.childNodes[i];
-                               var tb = row.firstChild.firstChild;
-                               row.hidden = ! test_filter(tb.value);
-                       }
-               }
-
-               function calc_delta() {
-                       var first;
-                       var last;
-                       for (var i = 0; i < rows.childNodes.length; i++) {
-                               var row = rows.childNodes[i];
-                               if (! row.hidden ) {
-                                       var tb = row.firstChild.firstChild;
-                                       if (!first) first = parseInt( tb.value.split(' ')[0] );
-                                       last = parseInt( tb.value.split(' ')[0] );
-                               }
-                       }
-                       document.getElementById('fc_calc_delta_label').setAttribute('value',last-first);
-               }
-
-       ]]>
-       </script>
-
-       <popupset>
-               <menupopup id="fcmp" position="after_start">
-               </menupopup>
-       </popupset>
-
-       <vbox id="filter_console_vbox" flex="1">
-               <groupbox id="filter_console_groupbox" orient="vertical" flex="1">
-                       <caption id="fcgbc" label="Filterable Javascript Console"/>
-                       <grid id="filter_console_nav_grid">
-                               <columns id="fcnvc"><column id="fcnvc1"/><column id="fcnvc2" flex="1"/></columns>
-                               <rows id="fcnvr">
-                                       <row id="fcnvr1">
-                                               <label id="fcgbhb1l" value="Containing:" class="text_right" accesskey="o" control="filter_console_containing"/>
-                                               <textbox id="filter_console_containing" flex="1"/>
-                                       </row>
-                                       <row id="fcnvr2">
-                                               <label id="fcgbhb1l" value="Not Containing:" class="text_right" accesskey="N" control="filter_console_not_containing"/>
-                                               <textbox id="filter_console_not_containing" flex="1"/>
-                                       </row>
-                                       <row id="fcnvr3">
-                                               <spacer id="fcnvr3s1"/>
-                                               <hbox id="fcnvr3hb1" flex="1">
-                                                       <button id="fc_sdump_levels" popup="fcmp" label="Set SDUMP Logging" accesskey="S"/>
-                                                       <button id="fc_filter_view" label="View with Filters" accesskey="V" oncommand="hide_rows();"/>
-                                                       <button id="fc_calc_delta" label="Delta (Last-1st sdump)" accesskey="D" oncommand="calc_delta();"/>
-                                                       <label id="fc_calc_delta_label" />
-                                                       <spacer id="fcnvr3hb1s1" flex="1"/>
-                                                       <button id="fc_filter_prune" label="Prune Hidden" accesskey="P" oncommand="clear_rows(true);"/>
-                                                       <button id="fc_clear" label="Clear" accesskey="C" oncommand="clear_rows(false);"/>
-                                               </hbox>
-                                       </row>
-                               </rows>
-                       </grid>
-                       <grid id="filter_console_grid" flex="1" style="overflow: auto;">
-                               <columns id="fcgc"><column id="fcgc1" flex="1"/></columns>
-                               <rows id="filter_console_grid_rows"/>
-                       </grid>
-               </groupbox>
-       </vbox>
-
-</window>
-
index ddbd561..52b753c 100644 (file)
 <?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
 <?xml-stylesheet href="chrome://evergreen/skin/evergreen.css" type="text/css"?>
 
+<!-- OVERLAYS -->
+<?xul-overlay href="/xul/server/OpenILS/util_overlay.xul"?>
+
 <window id="fm_view_win" 
-       onload="try { my_init(); } catch(E) { alert(E); }"
+       onload="try { my_init(); } catch(E) { dump(E+'\n'); alert(E); }"
        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
 
-       <script>mw.sdump('D_TRACE','Loading fm_view.xul\n');</script>
+        <script type="text/javascript">var myPackageDir = 'evergreen'; var IAMXUL = true; var g = {};</script>
+        <scripts id="openils_util_scripts"/>
+
+       <script type="text/javascript" src="/xul/server/main/JSAN.js"/>
 
        <script>
        <![CDATA[
                var tree;
+               var mw = {
+                       'get_list_from_tree_selection' : function() {
+                               var d = document; var tree_w;
+                               if (arguments.length == 1) {
+                                       tree_w = arguments[0];
+                               } else {
+                                       d = arguments[0];
+                                       tree_w = arguments[1];
+                               }
+                               var hitlist;
+                               if (typeof(tree_w) != 'object') {
+                                       hitlist = d.getElementById(tree_w);
+                               } else {
+                                       hitlist = tree_w;
+                               }
+                               var list = [];
+                               var start = new Object();
+                               var end = new Object();
+                               var numRanges = hitlist.view.selection.getRangeCount();
+                               for (var t=0; t<numRanges; t++){
+                                       hitlist.view.selection.getRangeAt(t,start,end);
+                                       for (var v=start.value; v<=end.value; v++){
+                                               var i = hitlist.contentView.getItemAtIndex(v);
+                                               list.push( i );
+                                       }
+                               }
+                               return list;
+                       }
+               };
 
                function my_init() {
-                       var treechildren = window.document.getElementById('tc');
-                       var fm = mw.user_request('open-ils.actor','opensrf.open-ils.system.fieldmapper',[])[0];
-                       var fma = []; var fmh = {} ; 
-                       for (var i in fm) { fmh[ fm[i].hint ] = fm[i]; fma.push( [ fm[i].hint, i ] ); }
-                       fma.sort();
-                       for (var i = 0; i < fma.length; i++) {
-                               var hint = fma[i][0]; var name = fma[i][1]; var o = fmh[ hint ];
-                               var ti = window.document.createElement('treeitem');
-                               treechildren.appendChild( ti );
-                               ti.setAttribute( 'container', 'true' );
-                               var tr = window.document.createElement('treerow');
-                               ti.appendChild( tr );
-                               var tc = window.document.createElement('treecell');
-                               tr.appendChild( tc );
-                               tc.setAttribute('label',hint);
-                               tc = window.document.createElement('treecell');
-                               tr.appendChild( tc );
-                               tc.setAttribute('label', name );
-                               var _treechildren = window.document.createElement( 'treechildren' );
-                               ti.appendChild( _treechildren );
-                               for (var j in o.fields) {
-                                       var _ti = window.document.createElement( 'treeitem' );
-                                       _treechildren.appendChild( _ti );
-                                       _ti.setAttribute('fm_class',hint);
-                                       _ti.setAttribute('fm_field',j);
-                                       _ti.setAttribute('fm_virtual',o.fields[j].virtual);
-                                       _ti.setAttribute('fm_position',o.fields[j].position);
-                                       var _tr = window.document.createElement( 'treerow' );
-                                       _ti.appendChild( _tr );
-                                       var _tc = window.document.createElement( 'treecell' );
-                                       _tr.appendChild( _tc );
-                                       _tc.setAttribute('label',j);
-                                       _tc = window.document.createElement( 'treecell' );
-                                       _tr.appendChild( _tc );
-                                       _tc.setAttribute('label','\t         Position: ' + o.fields[j].position + '  Virtual: ' + o.fields[j].virtual);
+                       try {
+                               netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+                               if (typeof JSAN == 'undefined') { throw( "The JSAN library object is missing."); }
+                               JSAN.errorLevel = "die"; // none, warn, or die
+                               JSAN.addRepository('/xul/server/');
+                               JSAN.use('util.error'); g.error = new util.error();
+                               JSAN.use('main.network'); g.network = new main.network();
+                               JSAN.use('main.window'); g.window = new main.window();
+                               JSAN.use('util.functional');
+                               g.error.sdump('D_TRACE','my_init() for fm_view.xul');
+
+                               var treechildren = window.document.getElementById('tc');
+                               var fm = g.network.request('open-ils.actor','opensrf.open-ils.system.fieldmapper',[]);
+                               var fma = []; var fmh = {} ; 
+                               for (var i in fm) { fmh[ fm[i].hint ] = fm[i]; fma.push( [ fm[i].hint, i ] ); }
+                               fma.sort();
+                               for (var i = 0; i < fma.length; i++) {
+                                       var hint = fma[i][0]; var name = fma[i][1]; var o = fmh[ hint ];
+                                       var ti = window.document.createElement('treeitem');
+                                       treechildren.appendChild( ti );
+                                       ti.setAttribute( 'container', 'true' );
+                                       var tr = window.document.createElement('treerow');
+                                       ti.appendChild( tr );
+                                       var tc = window.document.createElement('treecell');
+                                       tr.appendChild( tc );
+                                       tc.setAttribute('label',hint);
+                                       tc = window.document.createElement('treecell');
+                                       tr.appendChild( tc );
+                                       tc.setAttribute('label', name );
+                                       var _treechildren = window.document.createElement( 'treechildren' );
+                                       ti.appendChild( _treechildren );
+                                       for (var j in o.fields) {
+                                               var _ti = window.document.createElement( 'treeitem' );
+                                               _treechildren.appendChild( _ti );
+                                               _ti.setAttribute('fm_class',hint);
+                                               _ti.setAttribute('fm_field',j);
+                                               _ti.setAttribute('fm_virtual',o.fields[j].virtual);
+                                               _ti.setAttribute('fm_position',o.fields[j].position);
+                                               var _tr = window.document.createElement( 'treerow' );
+                                               _ti.appendChild( _tr );
+                                               var _tc = window.document.createElement( 'treecell' );
+                                               _tr.appendChild( _tc );
+                                               _tc.setAttribute('label',j);
+                                               _tc = window.document.createElement( 'treecell' );
+                                               _tr.appendChild( _tc );
+                                               _tc.setAttribute('label','\t         Position: ' + o.fields[j].position + '  Virtual: ' + o.fields[j].virtual);
+                                       }
                                }
+                               tree = window.document.getElementById('t');
+                               tree.view.selection.select( 0 ); tree.focus();
+                       } catch(E) {
                        }
-                       tree = window.document.getElementById('t');
-                       tree.view.selection.select( 0 ); tree.focus();
                }
 
                function gen_cols() {
                        var data_url = 'data:application/vnd.mozilla.xul+xml,<?xml version="1.0"?><window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"><?xml-stylesheet href="chrome://global/skin" type="text/css"?><vbox flex="1"><textbox id="desc" multiline="true" flex="1"/></vbox></window>';
-                       var w = mw.SafeWindowOpen(data_url,'paged_tree cols','chrome,resizable,width=800,height=600');
+                       var w = g.window.SafeWindowOpen(data_url,'paged_tree cols','chrome,resizable,width=800,height=600');
                        var css = '<?xml-stylesheet href="data:text/css,#a{-moz-box-flex:1;}"?>';
                        var treeitems = mw.get_list_from_tree_selection( tree );
                        setTimeout(
 
                function gen_properties() {
                        var data_url = 'data:application/vnd.mozilla.xul+xml,<?xml version="1.0"?><window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"><?xml-stylesheet href="chrome://global/skin" type="text/css"?><vbox flex="1"><textbox id="desc" multiline="true" flex="1"/></vbox></window>';
-                       var w = mw.SafeWindowOpen(data_url,'paged_tree cols','chrome,resizable,width=800,height=600');
+                       var w = g.window.SafeWindowOpen(data_url,'paged_tree cols','chrome,resizable,width=800,height=600');
                        var css = '<?xml-stylesheet href="data:text/css,#a{-moz-box-flex:1;}"?>';
                        var treeitems = mw.get_list_from_tree_selection( tree );
                        setTimeout(
                                        for (var i = 0; i < treeitems.length; i++) {
                                                var hint = treeitems[i].getAttribute('fm_class');
                                                var field = treeitems[i].getAttribute('fm_field');
-                                               var pretty = mw.map_list(
+                                               var pretty = util.functional.map_list(
                                                        field.split('_'),
                                                        function (s) {
                                                                return s.substr(0,1).toUpperCase() + s.substr(1);
 
                function gen_wikitable() {
                        var data_url = 'data:application/vnd.mozilla.xul+xml,<?xml version="1.0"?><window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"><?xml-stylesheet href="chrome://global/skin" type="text/css"?><vbox flex="1"><textbox id="desc" multiline="true" flex="1"/></vbox></window>';
-                       var w = mw.SafeWindowOpen(data_url,'paged_tree cols','chrome,resizable,width=800,height=600');
+                       var w = g.window.SafeWindowOpen(data_url,'paged_tree cols','chrome,resizable,width=800,height=600');
                        var css = '<?xml-stylesheet href="data:text/css,#a{-moz-box-flex:1;}"?>';
                        var treeitems = mw.get_list_from_tree_selection( tree );
                        setTimeout(
index ca5a215..88c1185 100644 (file)
@@ -679,7 +679,7 @@ form { margin: 0; padding: 0; }
 </style>
 </head>
 
-<body onload="params.w = window; params.app = 'Shell'; mw.OpenILS_init(params); init();" onunload="mw.OpenILS_exit(params);">
+<body onload="try { init(); } catch(E) { dump(E+'\n'); alert(E); }"> 
 
  <div id="output"><h3>JavaScript Shell 1.3.1</h3><div>Features: autocompletion of property names with Tab, multiline input with Shift+Enter, input history with (Ctrl+) Up/Down, <a accesskey=M href="javascript:go('scope(Math); mathHelp();');">Math</a>, <a accesskey=H href="http://www.squarefree.com/shell/?ignoreReferrerFrom=shell1.3.1">help</a></div><div>Values and functions: ans, print(string), <a accesskey=P href="javascript:go('props(ans)')">props(object)</a>, <a accesskey=B href="javascript:go('blink(ans)')">blink(node)</a>, load(scriptURL), scope(object), cls()</div></div>
 
index ca0df4e..f32429a 100644 (file)
@@ -50,8 +50,6 @@ function update()
     else
       xwin.setAttribute("src",dataURI);
   }
-  try { xwin.contentWindow.mw = mw; } catch(E) {}
-  try { xwin.mw = mw; } catch(E) {}
 
   timeout = window.setTimeout(update, 500);
 }
index 6d0ee58..f63a95f 100644 (file)
@@ -93,12 +93,6 @@ main.menu.prototype = {
                                        obj.set_tab(urls.remote_debug_xuleditor,{},{});
                                }
                        ],
-                       'cmd_filter_console' : [
-                               ['command','keypress'],
-                               function() {
-                                       obj.set_tab(urls.remote_debug_filter_console,{},{});
-                               }
-                       ],
                        'cmd_fieldmapper' : [
                                ['command','keypress'],
                                function() {
index c40c892..37708a8 100644 (file)
@@ -28,7 +28,6 @@
        <command id="cmd_console" />
        <command id="cmd_shell" />
        <command id="cmd_xuleditor" />
-       <command id="cmd_filter_console" />
        <command id="cmd_fieldmapper" />
        <command id="cmd_test_html" />
        <command id="cmd_test_xul" />
                <menuitem label="Test Module" accesskey="T" command="cmd_test"/>
                <menuitem label="XUL Test" accesskey="X" command="cmd_xuleditor"/>
                <menuitem label="Fieldmapper" accesskey="m" command="cmd_fieldmapper"/>
-               <menuitem label="Filterable Console" accesskey="F" command="cmd_filter_console"/>
                <menuitem label="Javscript Console" accesskey="J" command="cmd_console"/>
                <menuitem label="Javscript Shell" accesskey="H" command="cmd_shell"/>
                <menuitem label="server/main/test.html" accesskey="1" command="cmd_test_html"/>