From d86d5528cb118f62289c7c7f0ce5f009b7e2631a Mon Sep 17 00:00:00 2001 From: phasefx Date: Sun, 26 Sep 2010 09:23:43 +0000 Subject: [PATCH] Call persist_helper() in most interfaces. Give it the ability to handle resizing windows and set some windows up so that their height, width, and maximized state persist git-svn-id: svn://svn.open-ils.org/ILS/trunk@18004 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../chrome/content/OpenILS/global_util.js | 48 ++++++++++++++++++---- .../xul/staff_client/chrome/content/main/main.xul | 2 +- .../xul/staff_client/external/dojo_template.xul | 2 +- Open-ILS/xul/staff_client/external/template.xul | 2 +- .../admin/do_not_auto_attempt_print_setting.xul | 2 +- .../staff_client/server/admin/font_settings.xul | 2 +- .../server/admin/offline_manage_xacts.xul | 2 +- .../xul/staff_client/server/admin/transit_list.xul | 2 +- Open-ILS/xul/staff_client/server/cat/bib_brief.xul | 2 +- .../xul/staff_client/server/cat/copy_browser.xul | 2 +- .../xul/staff_client/server/cat/copy_notes.xul | 3 +- Open-ILS/xul/staff_client/server/cat/marc_new.xul | 2 +- Open-ILS/xul/staff_client/server/cat/marc_view.xul | 2 +- .../xul/staff_client/server/cat/volume_buckets.xul | 2 +- .../server/cat/volume_copy_creator.xul | 4 +- .../xul/staff_client/server/circ/circ_brief.xul | 2 +- .../xul/staff_client/server/circ/circ_summary.xul | 4 +- .../staff_client/server/circ/missing_pieces.xul | 2 +- .../staff_client/server/circ/pre_cat_fields.xul | 4 +- .../server/circ/print_list_template_editor.xul | 2 +- .../xul/staff_client/server/main/simple_auth.xul | 4 +- .../server/main/verify_credentials.xul | 2 +- .../staff_client/server/patron/barcode_entry.xul | 2 +- .../staff_client/server/patron/bill_cc_info.xul | 4 +- .../staff_client/server/patron/bill_check_info.xul | 4 +- .../staff_client/server/patron/bill_details.xul | 4 +- .../xul/staff_client/server/patron/bill_wizard.xul | 4 +- .../server/patron/edit_standing_penalty.xul | 3 +- .../xul/staff_client/server/patron/hold_cancel.xul | 2 +- .../xul/staff_client/server/patron/info_group.xul | 2 +- .../xul/staff_client/server/patron/info_notes.xul | 2 +- .../staff_client/server/patron/info_stat_cats.xul | 2 +- .../staff_client/server/patron/info_surveys.xul | 2 +- Open-ILS/xul/staff_client/server/patron/items.xul | 2 +- .../server/patron/new_standing_penalty.xul | 3 +- .../xul/staff_client/server/patron/search_form.xul | 2 +- .../server/patron/search_form_horiz.xul | 2 +- .../staff_client/server/patron/search_result.xul | 2 +- .../xul/staff_client/server/patron/summary.xul | 2 +- .../staff_client/server/patron/user_buckets.xul | 2 +- Open-ILS/xul/staff_client/server/serial/notes.xul | 4 +- .../staff_client/server/serial/serctrl_main.xul | 2 +- 42 files changed, 93 insertions(+), 58 deletions(-) diff --git a/Open-ILS/xul/staff_client/chrome/content/OpenILS/global_util.js b/Open-ILS/xul/staff_client/chrome/content/OpenILS/global_util.js index 74aaa1fa04..459a6288ee 100644 --- a/Open-ILS/xul/staff_client/chrome/content/OpenILS/global_util.js +++ b/Open-ILS/xul/staff_client/chrome/content/OpenILS/global_util.js @@ -94,6 +94,9 @@ if (ev.explicitOriginalTarget != node) return; } else { target = ev.target; + if (target == window) { + target = window.document.documentElement; + } } var filename = location.pathname.split('/')[ location.pathname.split('/').length - 1 ]; var base_key = 'oils_persist_' + String(location.hostname + '_' + filename + '_' + target.getAttribute('id')).replace('/','_','g') + '_' + base_key_suffix; @@ -108,11 +111,20 @@ } else if ( attribute_list[j] == 'value' && ['textbox'].indexOf( target.nodeName ) > -1 ) { value = target.value; dump('\t' + value + ' <== .' + attribute_list[j] + '\n'); + } else if ( attribute_list[j] == 'sizemode' && ['window'].indexOf( target.nodeName ) > -1 ) { + value = window.windowState; + dump('\t' + value + ' <== window.windowState, @' + attribute_list[j] + '\n'); + } else if ( attribute_list[j] == 'height' && ['window'].indexOf( target.nodeName ) > -1 ) { + value = window.outerHeight; + dump('\t' + value + ' <== window.outerHeight, @' + attribute_list[j] + '\n'); + } else if ( attribute_list[j] == 'width' && ['window'].indexOf( target.nodeName ) > -1 ) { + value = window.outerWidth; + dump('\t' + value + ' <== window.outerWidth, @' + attribute_list[j] + '\n'); } else { dump('\t' + value + ' <== @' + attribute_list[j] + '\n'); } prefs.setCharPref( key, value ); - // TODO: Need to add logic for window resizing, splitter repositioning, grippy state, etc. + // TODO: Need to add logic for splitter repositioning, grippy state, etc. // NOTE: oils_persist_peers and oils_persist="width" on those peers can help with the elements adjacent to a splitter } if (target.hasAttribute('oils_persist_peers') && ! ev.cancelable) { // We abuse the .cancelable field on the oils_persist event to prevent looping @@ -153,6 +165,22 @@ } else if ( attribute_list[j] == 'value' && ['textbox'].indexOf( nodes[i].nodeName ) > -1 ) { nodes[i].value = value; dump('\t' + value + ' ==> .' + attribute_list[j] + '\n'); + } else if ( attribute_list[j] == 'sizemode' && ['window'].indexOf( nodes[i].nodeName ) > -1 ) { + switch(value) { + case window.STATE_MAXIMIZED: + window.maximize(); + break; + case window.STATE_MINIMIZED: + window.minimize(); + break; + }; + dump('\t' + value + ' ==> window.windowState, @' + attribute_list[j] + '\n'); + } else if ( attribute_list[j] == 'height' && ['window'].indexOf( nodes[i].nodeName ) > -1 ) { + window.outerHeight = value; + dump('\t' + value + ' ==> window.outerHeight, @' + attribute_list[j] + '\n'); + } else if ( attribute_list[j] == 'width' && ['window'].indexOf( nodes[i].nodeName ) > -1 ) { + window.outerWidth = value; + dump('\t' + value + ' ==> window.outerWidth, @' + attribute_list[j] + '\n'); } else { nodes[i].setAttribute( attribute_list[j], value); dump('\t' + value + ' ==> @' + attribute_list[j] + '\n'); @@ -192,29 +220,33 @@ false ); } else { + var node = nodes[i]; var event_types = []; - if (nodes[i].hasAttribute('oils_persist_events')) { - var event_type_list = nodes[i].getAttribute('oils_persist_events').split(' '); + if (node.hasAttribute('oils_persist_events')) { + var event_type_list = node.getAttribute('oils_persist_events').split(' '); for (var j = 0; j < event_type_list.length; j++) { event_types.push( event_type_list[j] ); } } else { - if (nodes[i].nodeName == 'textbox') { + if (node.nodeName == 'textbox') { event_types.push('change'); + } else if (node.nodeName == 'window') { + event_types.push('resize'); + node = window; // xul window is an element of window.document } else { event_types.push('command'); } } for (var j = 0; j < event_types.length; j++) { - nodes[i].addEventListener( + node.addEventListener( event_types[j], - gen_event_handler(event_types[j],nodes[i]), + gen_event_handler(event_types[j],node), false ); } - nodes[i].addEventListener( + node.addEventListener( 'oils_persist', - gen_oils_persist_handler( base_key, nodes[i] ), + gen_oils_persist_handler( base_key, node ), false ); } diff --git a/Open-ILS/xul/staff_client/chrome/content/main/main.xul b/Open-ILS/xul/staff_client/chrome/content/main/main.xul index 2ee5c2c58d..1c9d96f68d 100644 --- a/Open-ILS/xul/staff_client/chrome/content/main/main.xul +++ b/Open-ILS/xul/staff_client/chrome/content/main/main.xul @@ -21,7 +21,7 @@ diff --git a/Open-ILS/xul/staff_client/external/dojo_template.xul b/Open-ILS/xul/staff_client/external/dojo_template.xul index 5d509247b7..9cf3e21614 100644 --- a/Open-ILS/xul/staff_client/external/dojo_template.xul +++ b/Open-ILS/xul/staff_client/external/dojo_template.xul @@ -18,7 +18,7 @@ diff --git a/Open-ILS/xul/staff_client/external/template.xul b/Open-ILS/xul/staff_client/external/template.xul index da3522376a..f666257fd2 100644 --- a/Open-ILS/xul/staff_client/external/template.xul +++ b/Open-ILS/xul/staff_client/external/template.xul @@ -18,7 +18,7 @@ diff --git a/Open-ILS/xul/staff_client/server/admin/do_not_auto_attempt_print_setting.xul b/Open-ILS/xul/staff_client/server/admin/do_not_auto_attempt_print_setting.xul index bece26a35b..d556207106 100644 --- a/Open-ILS/xul/staff_client/server/admin/do_not_auto_attempt_print_setting.xul +++ b/Open-ILS/xul/staff_client/server/admin/do_not_auto_attempt_print_setting.xul @@ -18,7 +18,7 @@ diff --git a/Open-ILS/xul/staff_client/server/admin/font_settings.xul b/Open-ILS/xul/staff_client/server/admin/font_settings.xul index 491bf4a3b8..3b968a5dc7 100644 --- a/Open-ILS/xul/staff_client/server/admin/font_settings.xul +++ b/Open-ILS/xul/staff_client/server/admin/font_settings.xul @@ -18,7 +18,7 @@ diff --git a/Open-ILS/xul/staff_client/server/admin/offline_manage_xacts.xul b/Open-ILS/xul/staff_client/server/admin/offline_manage_xacts.xul index 4f57e58b19..9e2ae9261f 100644 --- a/Open-ILS/xul/staff_client/server/admin/offline_manage_xacts.xul +++ b/Open-ILS/xul/staff_client/server/admin/offline_manage_xacts.xul @@ -19,7 +19,7 @@ diff --git a/Open-ILS/xul/staff_client/server/admin/transit_list.xul b/Open-ILS/xul/staff_client/server/admin/transit_list.xul index 5df6609690..5d651f618b 100644 --- a/Open-ILS/xul/staff_client/server/admin/transit_list.xul +++ b/Open-ILS/xul/staff_client/server/admin/transit_list.xul @@ -18,7 +18,7 @@ diff --git a/Open-ILS/xul/staff_client/server/cat/bib_brief.xul b/Open-ILS/xul/staff_client/server/cat/bib_brief.xul index 476ff7e22a..21c36c8cbb 100644 --- a/Open-ILS/xul/staff_client/server/cat/bib_brief.xul +++ b/Open-ILS/xul/staff_client/server/cat/bib_brief.xul @@ -22,7 +22,7 @@ vim: noet:sw=4:ts=4: diff --git a/Open-ILS/xul/staff_client/server/cat/copy_browser.xul b/Open-ILS/xul/staff_client/server/cat/copy_browser.xul index f1e52506a5..242804317f 100644 --- a/Open-ILS/xul/staff_client/server/cat/copy_browser.xul +++ b/Open-ILS/xul/staff_client/server/cat/copy_browser.xul @@ -22,7 +22,7 @@ vim:noet:sw=4:ts=4: diff --git a/Open-ILS/xul/staff_client/server/cat/copy_notes.xul b/Open-ILS/xul/staff_client/server/cat/copy_notes.xul index 86dfe782df..1da6032a27 100644 --- a/Open-ILS/xul/staff_client/server/cat/copy_notes.xul +++ b/Open-ILS/xul/staff_client/server/cat/copy_notes.xul @@ -22,8 +22,9 @@ diff --git a/Open-ILS/xul/staff_client/server/cat/marc_new.xul b/Open-ILS/xul/staff_client/server/cat/marc_new.xul index a7823a03ca..ddc54f3fed 100644 --- a/Open-ILS/xul/staff_client/server/cat/marc_new.xul +++ b/Open-ILS/xul/staff_client/server/cat/marc_new.xul @@ -21,7 +21,7 @@ diff --git a/Open-ILS/xul/staff_client/server/cat/marc_view.xul b/Open-ILS/xul/staff_client/server/cat/marc_view.xul index daa9ea7aad..0f6f8a2dc6 100644 --- a/Open-ILS/xul/staff_client/server/cat/marc_view.xul +++ b/Open-ILS/xul/staff_client/server/cat/marc_view.xul @@ -21,7 +21,7 @@ vim:noet:sw=4:ts=4: diff --git a/Open-ILS/xul/staff_client/server/cat/volume_buckets.xul b/Open-ILS/xul/staff_client/server/cat/volume_buckets.xul index 78ef04771e..c9737b8b6a 100644 --- a/Open-ILS/xul/staff_client/server/cat/volume_buckets.xul +++ b/Open-ILS/xul/staff_client/server/cat/volume_buckets.xul @@ -18,7 +18,7 @@ diff --git a/Open-ILS/xul/staff_client/server/cat/volume_copy_creator.xul b/Open-ILS/xul/staff_client/server/cat/volume_copy_creator.xul index 59f0e82fdf..0c5058752b 100644 --- a/Open-ILS/xul/staff_client/server/cat/volume_copy_creator.xul +++ b/Open-ILS/xul/staff_client/server/cat/volume_copy_creator.xul @@ -18,8 +18,8 @@ diff --git a/Open-ILS/xul/staff_client/server/circ/circ_brief.xul b/Open-ILS/xul/staff_client/server/circ/circ_brief.xul index 22bc2ccb23..ef98ce3e9e 100644 --- a/Open-ILS/xul/staff_client/server/circ/circ_brief.xul +++ b/Open-ILS/xul/staff_client/server/circ/circ_brief.xul @@ -19,7 +19,7 @@ diff --git a/Open-ILS/xul/staff_client/server/circ/circ_summary.xul b/Open-ILS/xul/staff_client/server/circ/circ_summary.xul index 0638212653..269f81a845 100644 --- a/Open-ILS/xul/staff_client/server/circ/circ_summary.xul +++ b/Open-ILS/xul/staff_client/server/circ/circ_summary.xul @@ -19,8 +19,8 @@ diff --git a/Open-ILS/xul/staff_client/server/circ/missing_pieces.xul b/Open-ILS/xul/staff_client/server/circ/missing_pieces.xul index 5c24a0a757..6991013a09 100644 --- a/Open-ILS/xul/staff_client/server/circ/missing_pieces.xul +++ b/Open-ILS/xul/staff_client/server/circ/missing_pieces.xul @@ -18,7 +18,7 @@ diff --git a/Open-ILS/xul/staff_client/server/circ/pre_cat_fields.xul b/Open-ILS/xul/staff_client/server/circ/pre_cat_fields.xul index e8b20d6338..d25552c7e6 100644 --- a/Open-ILS/xul/staff_client/server/circ/pre_cat_fields.xul +++ b/Open-ILS/xul/staff_client/server/circ/pre_cat_fields.xul @@ -21,8 +21,8 @@ diff --git a/Open-ILS/xul/staff_client/server/circ/print_list_template_editor.xul b/Open-ILS/xul/staff_client/server/circ/print_list_template_editor.xul index 9bb56ff7e0..534b16cac1 100644 --- a/Open-ILS/xul/staff_client/server/circ/print_list_template_editor.xul +++ b/Open-ILS/xul/staff_client/server/circ/print_list_template_editor.xul @@ -18,7 +18,7 @@ diff --git a/Open-ILS/xul/staff_client/server/main/simple_auth.xul b/Open-ILS/xul/staff_client/server/main/simple_auth.xul index e67c9bc9af..f30a319062 100644 --- a/Open-ILS/xul/staff_client/server/main/simple_auth.xul +++ b/Open-ILS/xul/staff_client/server/main/simple_auth.xul @@ -21,8 +21,8 @@ - diff --git a/Open-ILS/xul/staff_client/server/main/verify_credentials.xul b/Open-ILS/xul/staff_client/server/main/verify_credentials.xul index 3a6d357618..62aed30a8b 100644 --- a/Open-ILS/xul/staff_client/server/main/verify_credentials.xul +++ b/Open-ILS/xul/staff_client/server/main/verify_credentials.xul @@ -17,7 +17,7 @@ - diff --git a/Open-ILS/xul/staff_client/server/patron/barcode_entry.xul b/Open-ILS/xul/staff_client/server/patron/barcode_entry.xul index 03fee95a18..0de36de019 100644 --- a/Open-ILS/xul/staff_client/server/patron/barcode_entry.xul +++ b/Open-ILS/xul/staff_client/server/patron/barcode_entry.xul @@ -18,7 +18,7 @@ diff --git a/Open-ILS/xul/staff_client/server/patron/bill_cc_info.xul b/Open-ILS/xul/staff_client/server/patron/bill_cc_info.xul index 1c78639055..2d9656e810 100644 --- a/Open-ILS/xul/staff_client/server/patron/bill_cc_info.xul +++ b/Open-ILS/xul/staff_client/server/patron/bill_cc_info.xul @@ -19,8 +19,8 @@ diff --git a/Open-ILS/xul/staff_client/server/patron/bill_check_info.xul b/Open-ILS/xul/staff_client/server/patron/bill_check_info.xul index 668d09c344..0bcbb12b4a 100644 --- a/Open-ILS/xul/staff_client/server/patron/bill_check_info.xul +++ b/Open-ILS/xul/staff_client/server/patron/bill_check_info.xul @@ -19,8 +19,8 @@ diff --git a/Open-ILS/xul/staff_client/server/patron/bill_details.xul b/Open-ILS/xul/staff_client/server/patron/bill_details.xul index 5769590443..a16d4e7520 100644 --- a/Open-ILS/xul/staff_client/server/patron/bill_details.xul +++ b/Open-ILS/xul/staff_client/server/patron/bill_details.xul @@ -20,8 +20,8 @@ - diff --git a/Open-ILS/xul/staff_client/server/patron/bill_wizard.xul b/Open-ILS/xul/staff_client/server/patron/bill_wizard.xul index 0818a9a696..d07f71d952 100644 --- a/Open-ILS/xul/staff_client/server/patron/bill_wizard.xul +++ b/Open-ILS/xul/staff_client/server/patron/bill_wizard.xul @@ -20,8 +20,8 @@ diff --git a/Open-ILS/xul/staff_client/server/patron/edit_standing_penalty.xul b/Open-ILS/xul/staff_client/server/patron/edit_standing_penalty.xul index 1dd512f04a..d27c00152a 100644 --- a/Open-ILS/xul/staff_client/server/patron/edit_standing_penalty.xul +++ b/Open-ILS/xul/staff_client/server/patron/edit_standing_penalty.xul @@ -18,7 +18,8 @@ diff --git a/Open-ILS/xul/staff_client/server/patron/hold_cancel.xul b/Open-ILS/xul/staff_client/server/patron/hold_cancel.xul index fdc8c61adc..fb3830cc6e 100644 --- a/Open-ILS/xul/staff_client/server/patron/hold_cancel.xul +++ b/Open-ILS/xul/staff_client/server/patron/hold_cancel.xul @@ -18,7 +18,7 @@ diff --git a/Open-ILS/xul/staff_client/server/patron/info_group.xul b/Open-ILS/xul/staff_client/server/patron/info_group.xul index abed9b46db..1d4211dc6e 100644 --- a/Open-ILS/xul/staff_client/server/patron/info_group.xul +++ b/Open-ILS/xul/staff_client/server/patron/info_group.xul @@ -19,7 +19,7 @@ diff --git a/Open-ILS/xul/staff_client/server/patron/info_notes.xul b/Open-ILS/xul/staff_client/server/patron/info_notes.xul index f0ef3e859a..f3e5fed9e1 100644 --- a/Open-ILS/xul/staff_client/server/patron/info_notes.xul +++ b/Open-ILS/xul/staff_client/server/patron/info_notes.xul @@ -19,7 +19,7 @@ diff --git a/Open-ILS/xul/staff_client/server/patron/info_stat_cats.xul b/Open-ILS/xul/staff_client/server/patron/info_stat_cats.xul index 9a35d316b0..9dab9160ed 100644 --- a/Open-ILS/xul/staff_client/server/patron/info_stat_cats.xul +++ b/Open-ILS/xul/staff_client/server/patron/info_stat_cats.xul @@ -19,7 +19,7 @@ diff --git a/Open-ILS/xul/staff_client/server/patron/info_surveys.xul b/Open-ILS/xul/staff_client/server/patron/info_surveys.xul index 5787a9657b..2af2ed03ed 100644 --- a/Open-ILS/xul/staff_client/server/patron/info_surveys.xul +++ b/Open-ILS/xul/staff_client/server/patron/info_surveys.xul @@ -19,7 +19,7 @@ diff --git a/Open-ILS/xul/staff_client/server/patron/items.xul b/Open-ILS/xul/staff_client/server/patron/items.xul index 37e47a1b9f..ddc7c5f30b 100644 --- a/Open-ILS/xul/staff_client/server/patron/items.xul +++ b/Open-ILS/xul/staff_client/server/patron/items.xul @@ -20,7 +20,7 @@ diff --git a/Open-ILS/xul/staff_client/server/patron/new_standing_penalty.xul b/Open-ILS/xul/staff_client/server/patron/new_standing_penalty.xul index e576b8d79c..7e9271b61a 100644 --- a/Open-ILS/xul/staff_client/server/patron/new_standing_penalty.xul +++ b/Open-ILS/xul/staff_client/server/patron/new_standing_penalty.xul @@ -18,7 +18,8 @@ diff --git a/Open-ILS/xul/staff_client/server/patron/search_form.xul b/Open-ILS/xul/staff_client/server/patron/search_form.xul index d02a182ab5..6ebb6e1f88 100644 --- a/Open-ILS/xul/staff_client/server/patron/search_form.xul +++ b/Open-ILS/xul/staff_client/server/patron/search_form.xul @@ -20,7 +20,7 @@ diff --git a/Open-ILS/xul/staff_client/server/patron/search_form_horiz.xul b/Open-ILS/xul/staff_client/server/patron/search_form_horiz.xul index 7f726d1192..1ad8553457 100644 --- a/Open-ILS/xul/staff_client/server/patron/search_form_horiz.xul +++ b/Open-ILS/xul/staff_client/server/patron/search_form_horiz.xul @@ -20,7 +20,7 @@ diff --git a/Open-ILS/xul/staff_client/server/patron/search_result.xul b/Open-ILS/xul/staff_client/server/patron/search_result.xul index b1a870ab49..bb31f06868 100644 --- a/Open-ILS/xul/staff_client/server/patron/search_result.xul +++ b/Open-ILS/xul/staff_client/server/patron/search_result.xul @@ -20,7 +20,7 @@ diff --git a/Open-ILS/xul/staff_client/server/patron/summary.xul b/Open-ILS/xul/staff_client/server/patron/summary.xul index df1671febb..c84352ae9d 100644 --- a/Open-ILS/xul/staff_client/server/patron/summary.xul +++ b/Open-ILS/xul/staff_client/server/patron/summary.xul @@ -20,7 +20,7 @@ diff --git a/Open-ILS/xul/staff_client/server/patron/user_buckets.xul b/Open-ILS/xul/staff_client/server/patron/user_buckets.xul index 0d1842dd65..d343a6415c 100644 --- a/Open-ILS/xul/staff_client/server/patron/user_buckets.xul +++ b/Open-ILS/xul/staff_client/server/patron/user_buckets.xul @@ -18,7 +18,7 @@ diff --git a/Open-ILS/xul/staff_client/server/serial/notes.xul b/Open-ILS/xul/staff_client/server/serial/notes.xul index 8ec3eafdaf..2cfa3f79d2 100644 --- a/Open-ILS/xul/staff_client/server/serial/notes.xul +++ b/Open-ILS/xul/staff_client/server/serial/notes.xul @@ -22,8 +22,8 @@ - diff --git a/Open-ILS/xul/staff_client/server/serial/serctrl_main.xul b/Open-ILS/xul/staff_client/server/serial/serctrl_main.xul index 0d9b39347a..f20d688bff 100644 --- a/Open-ILS/xul/staff_client/server/serial/serctrl_main.xul +++ b/Open-ILS/xul/staff_client/server/serial/serctrl_main.xul @@ -25,7 +25,7 @@ vim:noet:sw=4:ts=4: -- 2.11.0