[OPEN-ILS-DEV] Statusbar vs. Alert

Bill Ott bott at grpl.org
Tue Oct 13 11:16:36 EDT 2009


This was discussed briefly in IRC yesterday.  The concept is, adding a 
status bar to the staff client window to receive messages, instead of 
alert messages that need to have the "OK" responded to.

On the client side, Jason pointed out that a status bar was already 
added in trunk.  In my testing, I've simply added a new panel to that 
bar for messages.  It's not-so-creatively named, statusbarRight.  ...I 
also added a left, but for some reason I've been updating the right.  
Not sure if there's any logic to one side over the other.


This piece of course has to go on each client install:

 xul/staff_client/build/chrome/content/main/menu_frame_overlay.xul

      <statusbarpanel id='statusbarRight'/>


I'm certainly no XUL wizard, so it took some digging to come up with the 
right way to get a hold of the status bar from child windows.  The 
following is a not so elegant way of doing so in global_util.js.  In 
particular, there's got to be a better way to populate mainWindow 
without two separate calls.

In xul/server/Open-ILS/global_util.js

        function updateStatus(panel,value) {

                
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');

                var mainWindow = 
window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
                   .getInterface(Components.interfaces.nsIWebNavigation)
                   
.QueryInterface(Components.interfaces.nsIDocShellTreeItem)
                   .rootTreeItem
                   
.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
                   .getInterface(Components.interfaces.nsIDOMWindow);

          // if it's a dialog, we need to look at the opener

                if (!mainWindow.name.match(/^main/)){
                        mainWindow = 
window.opener.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
                            
.getInterface(Components.interfaces.nsIWebNavigation)
                            
.QueryInterface(Components.interfaces.nsIDocShellTreeItem)
                            .rootTreeItem
                            
.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
                            
.getInterface(Components.interfaces.nsIDOMWindow);

                        var sb = mainWindow.document.getElementById(panel);
                  }else{
                        var sb = mainWindow.document.getElementById(panel);
                }

                sb.setAttribute("label",value);
        }



Then, instead of the alert, I added a call to the above function from 
copy_to_clipboard, in Open-ILS/global_utils.js

                        
Strings.getFormattedString('openils.global_util.clipboard', [text]);
                        updateStatus('statusbarRight',text + ' : copied 
to clipboard');


Or the to replace the "Copies not modified" alert in cat/util.js

            updateStatus('statusbarRight',(typeof 
params.no_copies_modified_msg != 'undefined' ? 
params.no_copies_modified_msg : 
$("catStrings").getString('staff.cat.util.copy_editor.not_modified')));



At one point I had a setTimeout clearing the value after a few seconds, 
but it seemed more overhead than it was worth, and having the last 
status linger didn't seem like a problem.


-- 


More information about the Open-ils-dev mailing list