[open-ils-commits] r17513 - in branches/rel_2_0/Open-ILS: web/opac/locale/en-US xul/staff_client/chrome/content/util xul/staff_client/server/cat xul/staff_client/server/skin (phasefx)
svn at svn.open-ils.org
svn at svn.open-ils.org
Wed Sep 8 10:24:15 EDT 2010
Author: phasefx
Date: 2010-09-08 10:24:13 -0400 (Wed, 08 Sep 2010)
New Revision: 17513
Modified:
branches/rel_2_0/Open-ILS/web/opac/locale/en-US/lang.dtd
branches/rel_2_0/Open-ILS/xul/staff_client/chrome/content/util/widgets.js
branches/rel_2_0/Open-ILS/xul/staff_client/server/cat/copy_browser.js
branches/rel_2_0/Open-ILS/xul/staff_client/server/cat/copy_browser.xul
branches/rel_2_0/Open-ILS/xul/staff_client/server/skin/cat.css
Log:
backport 17506, 17507 for saner navigation in Holdings Maintenance
Modified: branches/rel_2_0/Open-ILS/web/opac/locale/en-US/lang.dtd
===================================================================
--- branches/rel_2_0/Open-ILS/web/opac/locale/en-US/lang.dtd 2010-09-08 13:37:29 UTC (rev 17512)
+++ branches/rel_2_0/Open-ILS/web/opac/locale/en-US/lang.dtd 2010-09-08 14:24:13 UTC (rev 17513)
@@ -2425,7 +2425,8 @@
<!ENTITY staff.cat.copy_browser.actions.cmd_refresh_list.label "Refresh Listing">
<!ENTITY staff.cat.copy_browser.actions.cmd_refresh_list.accesskey "R">
<!ENTITY staff.cat.copy_browser.holdings_maintenance.caption "Holdings Maintenance">
-<!ENTITY staff.cat.copy_browser.holdings_maintenance.legend "Green in the list below means the library has volumes for this record.">
+<!ENTITY staff.cat.copy_browser.holdings_maintenance.legend "Green and bold in the list below means the library has volumes for this record.">
+<!ENTITY staff.cat.copy_browser.holdings_maintenance.depth_filter_menu "Limit:">
<!ENTITY staff.cat.copy_browser.holdings_maintenance.consortial_total "Consortial Total:">
<!ENTITY staff.cat.copy_browser.holdings_maintenance.consortial_available "Available:">
<!ENTITY staff.cat.copy_browser.holdings_maintenance.show_acns "Show Volumes">
Modified: branches/rel_2_0/Open-ILS/xul/staff_client/chrome/content/util/widgets.js
===================================================================
--- branches/rel_2_0/Open-ILS/xul/staff_client/chrome/content/util/widgets.js 2010-09-08 13:37:29 UTC (rev 17512)
+++ branches/rel_2_0/Open-ILS/xul/staff_client/chrome/content/util/widgets.js 2010-09-08 14:24:13 UTC (rev 17513)
@@ -113,6 +113,7 @@
var menulist = document.createElement('menulist');
var menupopup = document.createElement('menupopup'); menulist.appendChild(menupopup);
for (var i = 0; i < items.length; i++) {
+ if (typeof items[i] == 'undefined') { continue; }
var label = items[i][0]; var value = items[i][1]; var disabled = items[i][2]; var indent = items[i][3];
if (indent) {
for (var j = 0; j < Number(indent); j++) {
Modified: branches/rel_2_0/Open-ILS/xul/staff_client/server/cat/copy_browser.js
===================================================================
--- branches/rel_2_0/Open-ILS/xul/staff_client/server/cat/copy_browser.js 2010-09-08 13:37:29 UTC (rev 17512)
+++ branches/rel_2_0/Open-ILS/xul/staff_client/server/cat/copy_browser.js 2010-09-08 14:24:13 UTC (rev 17513)
@@ -29,6 +29,48 @@
JSAN.use('util.network'); obj.network = new util.network();
JSAN.use('OpenILS.data'); obj.data = new OpenILS.data(); obj.data.init({'via':'stash'});
+
+ obj.controller_init(params);
+
+ obj.list_init(params);
+
+ obj.controller.render();
+
+ obj.default_depth = obj.depth_menu_init();
+ obj.default_lib = obj.data.hash.aou[ obj.library_menu_init() ];
+
+ document.getElementById('show_acns').addEventListener(
+ 'command',
+ function(ev) {
+ JSAN.use('util.file'); var file = new util.file('copy_browser_prefs.'+obj.data.server_unadorned);
+ util.widgets.save_attributes(file, { 'lib_menu' : [ 'value' ], 'show_acns' : [ 'checked' ], 'show_acps' : [ 'checked' ] });
+ },
+ false
+ );
+
+ document.getElementById('show_acps').addEventListener(
+ 'command',
+ function(ev) {
+ JSAN.use('util.file'); var file = new util.file('copy_browser_prefs.'+obj.data.server_unadorned);
+ util.widgets.save_attributes(file, { 'lib_menu' : [ 'value' ], 'show_acns' : [ 'checked' ], 'show_acps' : [ 'checked' ] });
+ },
+ false
+ );
+
+ obj.show_my_libs( obj.default_lib.id() );
+
+ JSAN.use('util.exec'); var exec = new util.exec(20); exec.timer(obj.funcs,100);
+
+ obj.show_consortial_count();
+
+ } catch(E) {
+ this.error.standard_unexpected_error_alert('cat.copy_browser.init: ',E);
+ }
+ },
+
+ 'controller_init' : function(params) {
+ var obj = this;
+ try {
JSAN.use('util.controller'); obj.controller = new util.controller();
obj.controller.init(
{
@@ -836,18 +878,74 @@
}
);
- obj.list_init(params);
+ } catch(E) {
+ this.error.standard_unexpected_error_alert('cat.copy_browser.controller_init(): ',E);
+ }
+ },
+ 'depth_menu_init' : function(params) {
+ var obj = this;
+ try {
+ var list = [];
+ var max_depth = 0;
+ for (var i = 0; i < obj.data.list.aout.length; i++) {
+ var type = obj.data.list.aout[i];
+ var depth = type.depth();
+ if ( depth > max_depth) { max_depth = depth; }
+ if (typeof list[depth] == 'undefined') {
+ list[depth] = [
+ type.opac_label(),
+ type.depth(),
+ false,
+ ( type.depth() * 2)
+ ];
+ } else {
+ list[depth][0] += ' / ' + type.opac_label();
+ }
+ }
+ ml = util.widgets.make_menulist( list, max_depth );
+ ml.setAttribute('id','depth_menu'); document.getElementById('x_depth_menu').appendChild(ml);
+ ml.addEventListener(
+ 'command',
+ function(ev) {
+ obj.default_depth = ev.target.value;
+ if (document.getElementById('refresh_button')) document.getElementById('refresh_button').focus();
+ JSAN.use('util.file'); var file = new util.file('copy_browser_prefs.'+obj.data.server_unadorned);
+ util.widgets.save_attributes(file, {
+ 'lib_menu' : [ 'value' ],
+ 'depth_menu' : [ 'value' ],
+ 'show_acns' : [ 'checked' ],
+ 'show_acps' : [ 'checked' ]
+ });
+ },
+ false
+ );
+
+ file = new util.file('copy_browser_prefs.'+obj.data.server_unadorned);
+ util.widgets.load_attributes(file);
+ ml.value = ml.getAttribute('value');
+ if (! ml.value) {
+ ml.value = max_depth;
+ ml.setAttribute('value',ml.value);
+ }
+
+ return ml.value;
+ } catch(E) {
+ alert('Error in copy_browser.js, depth_menu_init(): ' + E);
+ }
+ },
+
+ 'library_menu_init' : function(params) {
+ var obj = this;
+ try {
+
obj.org_ids = obj.network.simple_request('FM_AOU_IDS_RETRIEVE_VIA_RECORD_ID.authoritative',[ obj.docid ]);
if (typeof obj.org_ids.ilsevent != 'undefined') throw(obj.org_ids);
JSAN.use('util.functional');
obj.org_ids = util.functional.map_list( obj.org_ids, function (o) { return Number(o); });
var org = obj.data.hash.aou[ obj.data.list.au[0].ws_ou() ];
- //obj.show_libs( org );
- //obj.show_my_libs();
-
JSAN.use('util.file'); JSAN.use('util.widgets');
var file; var list_data; var ml;
@@ -855,6 +953,9 @@
file = new util.file('offline_ou_list');
if (file._file.exists()) {
list_data = file.get_object(); file.close();
+ for (var i = 0; i < list_data[0].length; i++) { // make sure all entries are enabled
+ list_data[0][i][2] = false;
+ }
ml = util.widgets.make_menulist( list_data[0], list_data[1] );
ml.setAttribute('id','lib_menu'); document.getElementById('x_lib_menu').appendChild(ml);
for (var i = 0; i < obj.org_ids.length; i++) {
@@ -877,11 +978,15 @@
ml.addEventListener(
'command',
function(ev) {
- //obj.show_my_libs(ev.target.value);
- //alert('lib picker, command caught - ml = ' + ml + '\nml.value = ' + ml.value + '\n');
+ obj.default_lib = obj.data.hash.aou[ ev.target.value ];
if (document.getElementById('refresh_button')) document.getElementById('refresh_button').focus();
JSAN.use('util.file'); var file = new util.file('copy_browser_prefs.'+obj.data.server_unadorned);
- util.widgets.save_attributes(file, { 'lib_menu' : [ 'value' ], 'show_acns' : [ 'checked' ], 'show_acps' : [ 'checked' ] });
+ util.widgets.save_attributes(file, {
+ 'lib_menu' : [ 'value' ],
+ 'depth_menu' : [ 'value' ],
+ 'show_acns' : [ 'checked' ],
+ 'show_acps' : [ 'checked' ]
+ });
obj.refresh_list();
},
false
@@ -890,8 +995,6 @@
throw(document.getElementById('catStrings').getString('staff.cat.copy_browser.missing_library') + '\n');
}
- JSAN.use('util.widgets');
-
file = new util.file('copy_browser_prefs.'+obj.data.server_unadorned);
util.widgets.load_attributes(file);
ml.value = ml.getAttribute('value');
@@ -900,32 +1003,10 @@
ml.setAttribute('value',ml.value);
}
- document.getElementById('show_acns').addEventListener(
- 'command',
- function(ev) {
- JSAN.use('util.file'); var file = new util.file('copy_browser_prefs.'+obj.data.server_unadorned);
- util.widgets.save_attributes(file, { 'lib_menu' : [ 'value' ], 'show_acns' : [ 'checked' ], 'show_acps' : [ 'checked' ] });
- },
- false
- );
+ return ml.value;
- document.getElementById('show_acps').addEventListener(
- 'command',
- function(ev) {
- JSAN.use('util.file'); var file = new util.file('copy_browser_prefs.'+obj.data.server_unadorned);
- util.widgets.save_attributes(file, { 'lib_menu' : [ 'value' ], 'show_acns' : [ 'checked' ], 'show_acps' : [ 'checked' ] });
- },
- false
- );
-
- obj.show_my_libs( ml.value );
-
- JSAN.use('util.exec'); var exec = new util.exec(20); exec.timer(obj.funcs,100);
-
- obj.show_consortial_count();
-
} catch(E) {
- this.error.standard_unexpected_error_alert('cat.copy_browser.init: ',E);
+ this.error.standard_unexpected_error_alert('cat.copy_browser.library_menu_init(): ',E);
}
},
@@ -957,7 +1038,7 @@
if (typeof org != 'object') org = obj.data.hash.aou[ org ];
}
obj.show_libs( org, false );
-
+/*
var p_org = obj.data.hash.aou[ org.parent_ou() ];
if (p_org) {
obj.funcs.push( function() {
@@ -980,6 +1061,7 @@
document.getElementById('lib_menu').setAttribute('disabled','false');
} );
}
+*/
} catch(E) {
alert(E);
}
@@ -999,13 +1081,17 @@
} );
for (var i = 0; i < obj.data.tree.aou.children().length; i++) {
- obj.funcs.push(
- function(o) {
- return function() {
- obj.show_libs( o );
- }
- }( obj.data.tree.aou.children()[i] )
- );
+ var child = obj.data.tree.aou.children()[i];
+ if (obj.data.hash.aout[child.ou_type()].depth() <= obj.default_depth
+ && orgIsMine(obj.default_lib,child,obj.default_depth)) {
+ obj.funcs.push(
+ function(o) {
+ return function() {
+ obj.show_libs( o );
+ }
+ }( child )
+ );
+ }
}
obj.funcs.push( function() {
document.getElementById('cmd_refresh_list').setAttribute('disabled','false');
@@ -1097,11 +1183,15 @@
x.setAttribute('container','true');
if (show_open) x.setAttribute('open','true');
for (var i = 0; i < start_aou.children().length; i++) {
- obj.funcs.push(
- function(o,p) {
- return function() { obj.append_org(o,p); };
- }( start_aou.children()[i], start_aou )
- );
+ var child = start_aou.children()[i];
+ if (obj.data.hash.aout[child.ou_type()].depth() <= obj.default_depth
+ && orgIsMine(obj.default_lib,child,obj.default_depth)) {
+ obj.funcs.push(
+ function(o,p) {
+ return function() { obj.append_org(o,p); };
+ }( child, start_aou )
+ );
+ }
}
}
}
@@ -1159,44 +1249,54 @@
'on_select_org' : function(org_id,twisty) {
var obj = this;
- var org = obj.data.hash.aou[ org_id ];
- if (obj.data.hash.aout[ org.ou_type() ].depth() == 0 && ! get_bool( obj.data.hash.aout[ org.ou_type() ].can_have_vols() ) ) return;
- obj.funcs.push( function() {
- document.getElementById('cmd_refresh_list').setAttribute('disabled','true');
- document.getElementById('cmd_show_libs_with_copies').setAttribute('disabled','true');
- document.getElementById('lib_menu').setAttribute('disabled','true');
- } );
- if (org.children()) {
- for (var i = 0; i < org.children().length; i++) {
- obj.funcs.push(
- function(o,p) {
- return function() {
- obj.append_org(o,p)
- }
- }(org.children()[i],org)
- );
+ try {
+ var org = obj.data.hash.aou[ org_id ];
+ if (obj.data.hash.aout[ org.ou_type() ].depth() == 0 && ! get_bool( obj.data.hash.aout[ org.ou_type() ].can_have_vols() ) ) return;
+ obj.funcs.push( function() {
+ document.getElementById('cmd_refresh_list').setAttribute('disabled','true');
+ document.getElementById('cmd_show_libs_with_copies').setAttribute('disabled','true');
+ document.getElementById('lib_menu').setAttribute('disabled','true');
+ } );
+ if (org.children()) {
+ for (var i = 0; i < org.children().length; i++) {
+ var child = org.children()[i];
+ if (obj.data.hash.aout[child.ou_type()].depth() <= obj.default_depth
+ && orgIsMine(obj.default_lib,child,obj.default_depth)) {
+ obj.funcs.push(
+ function(o,p) {
+ return function() {
+ obj.append_org(o,p)
+ }
+ }(child,org)
+ );
+ }
+ }
+ }
+ if (obj.map_acn[ 'aou_' + org_id ]) {
+ for (var i = 0; i < obj.map_acn[ 'aou_' + org_id ].length; i++) {
+ obj.funcs.push(
+ function(o,a) {
+ return function() {
+ obj.append_acn(o,a);
+ }
+ }( org, obj.map_acn[ 'aou_' + org_id ][i] )
+ );
+ }
}
- }
- if (obj.map_acn[ 'aou_' + org_id ]) {
- for (var i = 0; i < obj.map_acn[ 'aou_' + org_id ].length; i++) {
- obj.funcs.push(
- function(o,a) {
- return function() {
- obj.append_acn(o,a);
- }
- }( org, obj.map_acn[ 'aou_' + org_id ][i] )
- );
- }
+ obj.funcs.push( function() {
+ document.getElementById('cmd_refresh_list').setAttribute('disabled','false');
+ document.getElementById('cmd_show_libs_with_copies').setAttribute('disabled','false');
+ document.getElementById('lib_menu').setAttribute('disabled','false');
+ } );
+ } catch(E) {
+ alert('Error in copy_browser.js, on_select_org(): ' + E);
}
- obj.funcs.push( function() {
- document.getElementById('cmd_refresh_list').setAttribute('disabled','false');
- document.getElementById('cmd_show_libs_with_copies').setAttribute('disabled','false');
- document.getElementById('lib_menu').setAttribute('disabled','false');
- } );
},
'append_org' : function (org,parent_org,params) {
var obj = this;
+ netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+ obj.error.consoleService.logStringMessage('append_org: org = ' + org.shortname() + ' parent_org = ' + (parent_org ? parent_org.shortname() : '') + ' params = ' + js2JSON(params) + '\n');
try {
if (obj.map_tree[ 'aou_' + org.id() ]) {
var x = obj.map_tree[ 'aou_' + org.id() ];
@@ -1534,8 +1634,6 @@
}
);
- obj.controller.render();
-
} catch(E) {
this.error.sdump('D_ERROR','cat.copy_browser.list_init: ' + E + '\n');
alert(E);
@@ -1632,11 +1730,7 @@
if (typeof obj.org_ids.ilsevent != 'undefined') throw(obj.org_ids);
JSAN.use('util.functional');
obj.org_ids = util.functional.map_list( obj.org_ids, function (o) { return Number(o); });
- /*
- var org = obj.data.hash.aou[ obj.data.list.au[0].ws_ou() ];
- obj.show_libs( org );
- */
- obj.show_my_libs( document.getElementById('lib_menu').value );
+ obj.show_my_libs( obj.default_lib.id() );
// FIXME - we get a null from the copy_count call if we call it too quickly here
setTimeout( function() { obj.show_consortial_count(); }, 2000 );
} catch(E) {
Modified: branches/rel_2_0/Open-ILS/xul/staff_client/server/cat/copy_browser.xul
===================================================================
--- branches/rel_2_0/Open-ILS/xul/staff_client/server/cat/copy_browser.xul 2010-09-08 13:37:29 UTC (rev 17512)
+++ branches/rel_2_0/Open-ILS/xul/staff_client/server/cat/copy_browser.xul 2010-09-08 14:24:13 UTC (rev 17513)
@@ -139,6 +139,8 @@
<hbox><label id="legend" style="font-size: large" class="has_copies" value="&staff.cat.copy_browser.holdings_maintenance.legend;" hidden="true"/></hbox>
<hbox>
<hbox id="x_lib_menu"/>
+ <label value="&staff.cat.copy_browser.holdings_maintenance.depth_filter_menu;" />
+ <hbox id="x_depth_menu"/>
<spacer flex="1"/>
<label value="&staff.cat.copy_browser.holdings_maintenance.consortial_total;"/><label id="consortial_total"/>
<label value="&staff.cat.copy_browser.holdings_maintenance.consortial_available;"/><label id="consortial_available"/>
Modified: branches/rel_2_0/Open-ILS/xul/staff_client/server/skin/cat.css
===================================================================
--- branches/rel_2_0/Open-ILS/xul/staff_client/server/skin/cat.css 2010-09-08 13:37:29 UTC (rev 17512)
+++ branches/rel_2_0/Open-ILS/xul/staff_client/server/skin/cat.css 2010-09-08 14:24:13 UTC (rev 17513)
@@ -3,7 +3,7 @@
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
@namespace html url("http://www.w3.org/TR/REC-html40");
-.has_copies { color: black; background-color: lightgreen; font-weight: bold; }
+.has_copies { border-left: solid thick green; font-weight: bold; }
.copy_editor_field_changed { background: lightgreen; }
.copy_editor_field_required { border: solid thin red; }
More information about the open-ils-commits
mailing list