obj.controller.view.tabs = window.document.getElementById('main_tabs');
obj.controller.view.panels = window.document.getElementById('main_panels');
obj.controller.view.tabscroller = window.document.getElementById('main_tabs_scrollbox');
+
+ obj.sort_menu(document.getElementById('main.menu.admin'), true);
+
if(params['firstURL']) {
obj.new_tab(params['firstURL'],{'focus':true},null);
}
return "user_false";
},
+ 'sort_menu' : function(menu, recurse) {
+ var curgroup = new Array();
+ var curstart = 1;
+ var curordinal = 0;
+ for (var itemid = 0; itemid < menu.firstChild.children.length; itemid++) {
+ var item = menu.firstChild.children[itemid];
+ curordinal++;
+ if (item.getAttribute('forceFirst')) {
+ item.setAttribute('ordinal', curstart);
+ curstart++;
+ continue;
+ }
+ if (item.nodeName == 'menuseparator') {
+ this.sort_menu_items(curgroup, curstart);
+ item.setAttribute('ordinal', curordinal);
+ curstart = curordinal + 1;
+ curgroup = new Array();
+ continue;
+ }
+ if (item.nodeName == 'menu' && recurse) {
+ this.sort_menu(item, recurse);
+ }
+ curgroup.push(item);
+ }
+ this.sort_menu_items(curgroup, curstart);
+ },
+
+ 'sort_menu_items' : function(itemgroup, start) {
+ var curpos = start;
+ var sorted = itemgroup.sort(function(a,b) {
+ var labelA = a.getAttribute('label').toUpperCase();
+ var labelB = b.getAttribute('label').toUpperCase();
+ return labelA.localeCompare(labelB);
+ });
+ for(var item = 0; item < sorted.length; item++) {
+ sorted[item].setAttribute('ordinal', curpos++);
+ }
+ },
+
'observe' : function(subject, topic, data) {
if (topic != "nsPref:changed") {
return;
<menu id="main.menu.admin" label="&staff.main.menu.admin.label;" accesskey="&staff.main.menu.admin.accesskey;">
<menupopup id="main.menu.admin.popup">
<menuitem id="oc_menuitem" label="&staff.main.menu.admin.change_session.label;" label_orig="&staff.main.menu.admin.change_session.label;"
- accesskey="O" command="cmd_change_session"/>
+ accesskey="O" command="cmd_change_session" forceFirst="true"/>
<menuitem label="&staff.main.menu.admin.offline_xacts.label;" accesskey="&staff.main.menu.admin.offline_xacts.accesskey;" command="cmd_manage_offline_xacts"/>
<menuitem label="&staff.main.menu.admin.download_patrons.label;" accesskey="&staff.main.menu.admin.download_patrons.accesskey;" command="cmd_download_patrons"/>
<menuseparator />