added some permission exception handling..
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 23 Jun 2005 13:22:56 +0000 (13:22 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 23 Jun 2005 13:22:56 +0000 (13:22 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@913 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/javascript/opac/GlobalInit.js
Open-ILS/src/javascript/opac/RecordDetailPage.js
Open-ILS/src/javascript/util/RemoteRequest.js
Open-ILS/src/javascript/util/UserSession.js
Open-ILS/src/perlmods/OpenILS/EX.pm

index 05c5cda..6ae36b6 100644 (file)
@@ -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() );
        } 
 
 
index 299bac8..a2d6005 100644 (file)
@@ -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);
 }
 
index eba4d74..3748f42 100644 (file)
@@ -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;
        }
 
index 911c71c..a26b2fa 100644 (file)
@@ -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();
index 4309ed0..12c7478 100644 (file)
@@ -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(); } );