};
}
],
- 'patron_standing_penalties' : [
- ['render'],
- function(e) {
- return function() {
- util.widgets.remove_children(e);
- var penalties = obj.patron.standing_penalties();
- if (penalties.length == 0) {
- var row = document.createElement('row');
- var label = document.createElement('label');
- util.widgets.set_text(label,patronStrings.getString('staff.patron.summary.standing_penalty.none'));
- addCSSClass(label,'NO_PENALTY');
- row.appendChild(label);
- e.appendChild(row);
- }
- for (var i = 0; i < penalties.length; i++) {
-
- var row = document.createElement('row');
- var label = document.createElement('label');
-
- //util.widgets.set_text(e,penalties[i].penalty_type());
- util.widgets.set_text(label,penalties[i].standing_penalty().label());
- row.appendChild(label);
-
- var button = document.createElement('button');
- button.setAttribute('label', patronStrings.getString('staff.patron.summary.standing_penalty.remove'));
- button.setAttribute('image','/xul/server/skin/media/images/icon_delete.gif');
- button.setAttribute('disabled','true');
- button.setAttribute('hidden','true');
- button.setAttribute('retrieve_ausp_id',penalties[i].id());
- row.appendChild(button);
-
- // XXX check a permission here? How to fire the remove action ??? XXX
- if (penalties[i].standing_penalty().id() > 100) {
- button.setAttribute('disabled','false');
- button.setAttribute('hidden','false');
- button.addEventListener(
- 'command',
- function(ev) {
- try {
- JSAN.use('util.functional');
- var id = ev.target.getAttribute('retrieve_ausp_id');
- var penalty = util.functional.find_list( obj.patron.standing_penalties(), function(o) { return o.id() == id; } );
- penalty.isdeleted(1);
-
- var req = obj.network.simple_request( 'FM_AUSP_REMOVE', [ ses(), penalty ] );
- if (typeof req.ilsevent != 'undefined' || String(req) != '1') {
- obj.error.standard_unexpected_error_alert(
- patronStrings.getFormattedString(
- 'staff.patron.standing_penalty.remove_error',
- [obj.data.hash.csp[id].name()]
- ),
- req
- );
- }
- if (typeof xulG.refresh == 'function') { xulG.refresh(); }
- } catch(F) {
- obj.error.standard_unexpected_error_alert(
- patronStrings.getFormattedString(
- 'staff.patron.standing_penalty.remove_error',
- [ev.target.getAttribute('retrieve_ausp_id')]
- ),
- F
- );
- }
- },
- false
- );
- }
-
- if (penalties[i].standing_penalty().block_list()) {
- if (penalties[i].standing_penalty().block_list().match(/RENEW/)) addCSSClass(label,'PENALTY_RENEW');
- if (penalties[i].standing_penalty().block_list().match(/HOLD/)) addCSSClass(label,'PENALTY_HOLD');
- if (penalties[i].standing_penalty().block_list().match(/CIRC/)) addCSSClass(label,'PENALTY_CIRC');
- }
-
- e.appendChild(row);
- }
- };
- }
- ],
'patron_credit' : [
['render'],
function(e) {