From: dbs Date: Thu, 2 Apr 2009 03:35:58 +0000 (+0000) Subject: Backport r12670 from trunk: prevent lengthy error messages from spilling off the... X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=51670d3b392fb5cea8cc01c5b41167b08577379f;p=Evergreen.git Backport r12670 from trunk: prevent lengthy error messages from spilling off the bottom of the screen git-svn-id: svn://svn.open-ils.org/ILS/branches/rel_1_4@12761 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/xul/staff_client/chrome/content/util/error.js b/Open-ILS/xul/staff_client/chrome/content/util/error.js index 33bec73fbb..e9650f9b28 100644 --- a/Open-ILS/xul/staff_client/chrome/content/util/error.js +++ b/Open-ILS/xul/staff_client/chrome/content/util/error.js @@ -325,7 +325,7 @@ util.error.prototype = { this.sound.bad(); - //FIMXE - is that good enough of an escape job? + //FIXME - is that good enough of an escape job? s = s.replace(/&/g, '&').replace(//g, '>'); var xml = '' @@ -394,7 +394,7 @@ util.error.prototype = { this.sound.bad(); - //FIMXE - is that good enough of an escape job? + //FIXME - is that good enough of an escape job? s = s.replace(/&/g, '&').replace(//g, '>'); var xml = '' @@ -473,9 +473,27 @@ util.error.prototype = { // the buttons, which are used if BUTTON_TITLE_IS_STRING is assigned to a // particular button. The last two arguments are for an optional check box. var check = {}; - var rv = promptService.confirmEx(window,title, s, flags, b1, b2, b3, c, check); + + // promptService.confirmEx does not offer scrollbars for long + // content, so trim error lines to avoid spilling offscreen + // + // There's probably a better way of doing this. + + var maxlines = 30; + var ss = ''; + var linefeeds = 0; + for (var i = 0; linefeeds < maxlines && i < s.length; i++) { + t = s.charAt(i); + if (t == "\n") { + linefeeds++; + } + ss = ss + t; + i++; + } + + var rv = promptService.confirmEx(window,title, ss, flags, b1, b2, b3, c, check); if (c && !check.value) { - return this.yns_alert(s,title,b1,b2,b3,c); + return this.yns_alert(ss,title,b1,b2,b3,c); } return rv; },