From 125500856153760920b618493c37dad0e58e0e13 Mon Sep 17 00:00:00 2001 From: Justin Douma Date: Thu, 17 Jan 2013 10:08:42 -0800 Subject: [PATCH] Adds MARC Edit Window Tiling Feature Adds option in the File menu of the staff client to open all currently open records in new windows and space those windows apropriately on the user's screen. This allows easy side-by-side comparison, and editing, of two or more Marc records. Signed-off-by: Justin Douma --- Open-ILS/web/opac/locale/en-US/lang.dtd | 2 + .../xul/staff_client/chrome/content/main/main.js | 37 ++++++++++++ .../xul/staff_client/chrome/content/main/menu.js | 65 +++++++++++++++++++++- .../chrome/content/main/menu_frame_menus.xul | 4 ++ docs/RELEASE_NOTES_NEXT/marc_tile_windows.txt | 23 ++++++++ 5 files changed, 130 insertions(+), 1 deletion(-) create mode 100644 docs/RELEASE_NOTES_NEXT/marc_tile_windows.txt diff --git a/Open-ILS/web/opac/locale/en-US/lang.dtd b/Open-ILS/web/opac/locale/en-US/lang.dtd index 70063d8ae5..148e70681a 100644 --- a/Open-ILS/web/opac/locale/en-US/lang.dtd +++ b/Open-ILS/web/opac/locale/en-US/lang.dtd @@ -1115,6 +1115,8 @@ + + diff --git a/Open-ILS/xul/staff_client/chrome/content/main/main.js b/Open-ILS/xul/staff_client/chrome/content/main/main.js index a86b64278b..18c7d4fcce 100644 --- a/Open-ILS/xul/staff_client/chrome/content/main/main.js +++ b/Open-ILS/xul/staff_client/chrome/content/main/main.js @@ -820,4 +820,41 @@ function auto_login(loginInfo) { return should_test_server; } +function tileWindows(urlList, isVertical, winCount, winIndex, aContinue) { + if(aContinue == true && tempWindow.closed == false) { + //check if window finished openning + if(tempWindow.g == undefined || tempWindow.g.menu == undefined) { + setTimeout( + function() { + tileWindows(urlList, isVertical, winCount, winIndex, true); + }, 500); + return null; + } + tempWindow = null; + } + var scrWidth = window.screen.width; + var scrHeight = window.screen.height; + var placement = ''; + if (urlList.length > 0) { + var url = urlList.shift(); + //stack windows vertically or horizontally + if (isVertical) { + var winWidth = scrWidth / winCount; + placement = 'screenX=' + winWidth * (winIndex) + ',width=' + winWidth+ ',height=' + scrHeight; + } else { + var winHeight = scrHeight / winCount; + placement = 'screenY=' + winHeight * (winIndex) + ',width=' + scrWidth+ ',height=' + winHeight + } + tempWindow = xulG.window.open(urls.XUL_MENU_FRAME + + '?server=' + window.escape(G.data.server) + '&firstURL=' + window.escape(url), + '_blank','chrome,resizable,sizemode="normal",' + placement); + tempWindow.xulG = xulG; + winIndex++; + setTimeout( + function() { + tileWindows(urlList, isVertical, winCount, winIndex, true); + }, 500); + + } +} dump('exiting main/main.js\n'); diff --git a/Open-ILS/xul/staff_client/chrome/content/main/menu.js b/Open-ILS/xul/staff_client/chrome/content/main/menu.js index f94e9ed435..fd979177ea 100644 --- a/Open-ILS/xul/staff_client/chrome/content/main/menu.js +++ b/Open-ILS/xul/staff_client/chrome/content/main/menu.js @@ -272,6 +272,34 @@ main.menu.prototype = { ['oncommand'], function() { obj.close_all_tabs(); } ], + 'cmd_open_record_windows_horizontal' : [ + ['oncommand'], + function(event) { + var bibURLs = obj.get_opac_record_urls(); + if(bibURLs && bibURLs.length > 0) + { + var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]. + getService(Components.interfaces.nsIWindowMediator); + wm.getMostRecentWindow('eg_main').tileWindows(bibURLs, false, bibURLs.length, 0, false); + } else { + alert("No Records to Display"); + } + } + ], + 'cmd_open_record_windows_vertical' : [ + ['oncommand'], + function(event) { + var bibURLs = obj.get_opac_record_urls(); + if(bibURLs && bibURLs.length > 0) + { + var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]. + getService(Components.interfaces.nsIWindowMediator); + wm.getMostRecentWindow('eg_main').tileWindows(bibURLs, true, bibURLs.length, 0, false); + } else { + alert("No Records to Display"); + } + } + ], /* Edit Menu */ 'cmd_edit_copy_buckets' : [ @@ -2787,7 +2815,42 @@ commands: } catch(E) { alert('Error in menu.js, render_toolbar_layout('+layout+'): ' + E); } + }, + + 'get_opac_record_urls' : function() { + var bibURLs = []; + var panelCount = this.controller.view.panels.childNodes.length; + for (var i = 1; i < panelCount; i++) { + var panel = this.controller.view.panels.childNodes[ i ]; + if (panel + && panel.firstChild + && panel.firstChild.nodeName == 'iframe' + && panel.firstChild.contentWindow + ) + { + var cw = panel.firstChild.contentWindow; + var iframes = cw.document.getElementsByTagName('iframe'); + + if(iframes.length > 0) + { + for (var y = 0; y < iframes.length; y++) { + if(iframes[y].getAttribute('src').match(/^[https|chrome|oils].*/) + && iframes[y].contentDocument + && iframes[y].contentDocument.getElementsByTagName('browser')[0] + && iframes[y].contentDocument.getElementsByTagName('browser')[0].contentWindow + && iframes[y].contentDocument.getElementsByTagName('browser')[0].contentWindow.location) + { + var opac_url = iframes[y].contentDocument.getElementsByTagName('browser')[0].contentWindow.location; + opac_url = opac_url.toString(); + if (opac_url.match(/eg\/opac\/record\/\d+/) || opac_url.match(/\/skin\/default\/xml\/rdetail.xml\?r=\d+/)) { + bibURLs.push(urls.XUL_OPAC_WRAPPER + '?opac_url=' + window.escape( opac_url ) + '&show_nav_buttons=false,&default_view=marc_edit'); + } + } + } + } + } + } + return bibURLs; } } - dump('exiting main/menu.js\n'); diff --git a/Open-ILS/xul/staff_client/chrome/content/main/menu_frame_menus.xul b/Open-ILS/xul/staff_client/chrome/content/main/menu_frame_menus.xul index 2e984d7102..e02cf3c11d 100644 --- a/Open-ILS/xul/staff_client/chrome/content/main/menu_frame_menus.xul +++ b/Open-ILS/xul/staff_client/chrome/content/main/menu_frame_menus.xul @@ -15,6 +15,8 @@ + + @@ -296,6 +298,8 @@ + + diff --git a/docs/RELEASE_NOTES_NEXT/marc_tile_windows.txt b/docs/RELEASE_NOTES_NEXT/marc_tile_windows.txt new file mode 100644 index 0000000000..e9d8d432b1 --- /dev/null +++ b/docs/RELEASE_NOTES_NEXT/marc_tile_windows.txt @@ -0,0 +1,23 @@ +New Feature - MARC Tile Edit Windows +==================================== + +.Overview +New feature which allows MARC edit windows to be viewed side-by-side or above-below. + +Added functionality would allow library staff to view multiple MARC records for ease of editing. + +The new functionality is for staff client only. + +.Feature Access: + +The new functionality is accessed via the menu, where two new menu options would be added. + +* would tile all currently viewed MARC records side-by-side. +* would tile all currently viewed MARC records above-below. + +.Code Changes: +* The following files would be modified: +* Open-ILS/xul/staff_client/chrome/content/main/main.js +* Open-ILS/xul/staff_client/chrome/content/main/menu.js +* Open-ILS/xul/staff_client/chrome/content/main/menu_frame_menus.js +* Open-ILS/web/opac/local/en-us/lang.dtd -- 2.11.0