From d38f6853c69ef0d683633c4212548bed9816e4d0 Mon Sep 17 00:00:00 2001 From: erickson Date: Thu, 23 Jun 2005 13:22:56 +0000 Subject: [PATCH] added some permission exception handling.. git-svn-id: svn://svn.open-ils.org/ILS/trunk@913 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/src/javascript/opac/GlobalInit.js | 5 +++- .../src/javascript/opac/RecordDetailPage.js | 24 ++++++++++++------- Open-ILS/src/javascript/util/RemoteRequest.js | 9 +++++++ Open-ILS/src/javascript/util/UserSession.js | 2 +- Open-ILS/src/perlmods/OpenILS/EX.pm | 1 + 5 files changed, 30 insertions(+), 11 deletions(-) diff --git a/Open-ILS/src/javascript/opac/GlobalInit.js b/Open-ILS/src/javascript/opac/GlobalInit.js index 05c5cdad65..6ae36b6c25 100644 --- a/Open-ILS/src/javascript/opac/GlobalInit.js +++ b/Open-ILS/src/javascript/opac/GlobalInit.js @@ -117,7 +117,10 @@ function globalInit() { if(paramObj.__location != null) { globalSelectedLocation = findOrgUnit(paramObj.__location); - debug("Setting selected location to " + globalSelectedLocation.name() ); + if(globalSelectedLocation == null) + debug("Invalid location in url : " + paramObj.__location); + else + debug("Setting selected location to " + globalSelectedLocation.name() ); } diff --git a/Open-ILS/src/javascript/opac/RecordDetailPage.js b/Open-ILS/src/javascript/opac/RecordDetailPage.js index 299bac8d02..a2d6005ea5 100644 --- a/Open-ILS/src/javascript/opac/RecordDetailPage.js +++ b/Open-ILS/src/javascript/opac/RecordDetailPage.js @@ -56,14 +56,18 @@ RecordDetailPage.prototype.init = function() { RecordDetailPage.prototype.draw = function() { this.mainBox = getById("record_detail_copy_info"); - var linksDiv = elem("div"); - var leftLink = elem("div", { style: "width: 50%;text-align: left" }); - var rightLink = elem("div", { style: "width: 50%;text-align: right"}); - linksDiv.appendChild(leftLink); - linksDiv.appendChild(rightLink); - this.mainBox.appendChild(linksDiv); - - this.mainBox.appendChild(elem("br")); + var table = elem("table", { width: "100%" } ); + table.width = "100%"; + + var linksDiv = table.insertRow(0); + var leftLink = linksDiv.insertCell(0); + var rightLink = linksDiv.insertCell(1); + + leftLink.width = "50%"; + rightLink.width = "50%"; + leftLink.align = "left"; + rightLink.align = "right"; + this.parentLink = elem("a", { href : "javascript:void(0)", id : "parent_link", @@ -79,8 +83,10 @@ RecordDetailPage.prototype.draw = function() { obj.copyLocationTree.toggle(null, 100, 100); }; + leftLink.appendChild(a); rightLink.appendChild(this.parentLink); + this.mainBox.appendChild(table); /* --------------------------------------------- */ @@ -361,7 +367,7 @@ RecordDetailPage.prototype.displayParentLink = function(orgUnit, record, showMe) } var reg_div = createAppElement("div"); - reg_div.appendChild(href); + //reg_div.appendChild(href); this.mainBox.insertBefore(reg_div, this.treeDiv); } diff --git a/Open-ILS/src/javascript/util/RemoteRequest.js b/Open-ILS/src/javascript/util/RemoteRequest.js index eba4d749eb..3748f42373 100644 --- a/Open-ILS/src/javascript/util/RemoteRequest.js +++ b/Open-ILS/src/javascript/util/RemoteRequest.js @@ -292,6 +292,15 @@ RemoteRequest.prototype.getResultObject = function() { /* these are user level exceptions from the server code */ if(instanceOf(obj, ex)) { debug("Received user level exception: " + obj.err_msg()); + /* the opac will go ahead and spit out the error msg */ + if(!isXUL()) alert(obj.err_msg()); + throw obj; + } + + if(instanceOf(obj, perm_ex)) { + debug("Received permission error: " + obj.err_msg()); + /* the opac will go ahead and spit out the error msg */ + if(!isXUL()) alert(obj.err_msg()); throw obj; } diff --git a/Open-ILS/src/javascript/util/UserSession.js b/Open-ILS/src/javascript/util/UserSession.js index 911c71cca7..a26b2fa695 100644 --- a/Open-ILS/src/javascript/util/UserSession.js +++ b/Open-ILS/src/javascript/util/UserSession.js @@ -118,7 +118,7 @@ UserSession.prototype.login = function( username, password ) { var auth_request = new RemoteRequest( 'open-ils.auth', 'open-ils.auth.authenticate.complete', username, - hex_md5(seed + hex_md5(password))); + hex_md5(seed + hex_md5(password)), "opac"); auth_request.send(true); var auth_result = auth_request.getResultObject(); diff --git a/Open-ILS/src/perlmods/OpenILS/EX.pm b/Open-ILS/src/perlmods/OpenILS/EX.pm index 4309ed0afa..12c74787e1 100644 --- a/Open-ILS/src/perlmods/OpenILS/EX.pm +++ b/Open-ILS/src/perlmods/OpenILS/EX.pm @@ -15,6 +15,7 @@ my %ex_types = ( DUPLICATE_INVALID_USER_BARCODE => 4, DUPLICATE_USER_USERNAME => 5, USER_WRONG_PASSWORD => 6, + PERMISSION_DENIED => 7, ); use overload ( '""' => sub { $_[0]->ex()->err_msg(); } ); -- 2.43.2