trying to move towards lassos
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 4 Apr 2008 20:32:28 +0000 (20:32 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 4 Apr 2008 20:32:28 +0000 (20:32 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@9233 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/opac/common/js/opac_utils.js
Open-ILS/web/opac/common/js/org_utils.js
Open-ILS/web/opac/skin/default/js/depth_selector.js
Open-ILS/web/opac/skin/default/xml/common/js_common.xml

index b8b4499..0b166f6 100644 (file)
@@ -111,16 +111,21 @@ function initParams() {
        var loc = cgi.param(PARAM_LOCATION);
 
     if (loc) {
-       if(isNaN(loc)) org = findOrgUnitSN(loc);
+               org = findOrgUnit(loc);
+               LOCATION = org ? org.id() : null;
 
-           if( !org ) {
-            if ( parseInt(loc) < 0 ) org = findOrgLasso( -1 * loc );
-               else org = findOrgUnit(loc);
+           if( !LOCATION ) {
+            if ( loc < 0 ) {
+                               org = findOrgLasso( -loc );
+                               LOCATION = org ? -org.id() : null;
+                       }
+                       if ( !LOCATION ){
+                               org = findOrgUnit(loc);
+                               LOCATION = org ? org.id() : null;
+                       }
        } 
     }
 
-       LOCATION = org ? org.id() : null;
-
        org = null;
        loc = cgi.param(PARAM_ORIGLOC);
        if( loc ) {
index 2acf826..53186f1 100644 (file)
@@ -44,7 +44,9 @@ function findOrgType(type_id) {
 /* returns an org unit by id.  if an object is passed in as the id,
        then the object is assumed to be an org unit and is returned */
 function findOrgUnit(org_id) {
-       return (typeof org_id == 'object') ? org_id : orgArraySearcher[org_id];
+       var o = (typeof org_id == 'object') ? org_id : orgArraySearcher[org_id];
+       if (!o) o = new aou();
+       return o;
 }
 
 function findOrgLasso(lasso_id) {
index ea865e7..1bd983e 100644 (file)
@@ -75,7 +75,8 @@ function buildLocationSelector(newLoc) {
        removeChildren(selector);
        
        var location = findOrgUnit(loc);
-       var type = findOrgType(location.ou_type());
+       var type;
+       if (location) type = findOrgType(location.ou_type());
 
        while( type && location ) {
                var n = node.cloneNode(true);   
index 59b2d8d..d1c17ab 100644 (file)
@@ -11,6 +11,7 @@
        <script language='javascript' src='<!--#echo var="OILS_JS_BASE"-->/fmgen.js' type='text/javascript'></script>
        <script language='javascript' src='<!--#echo var="OILS_JS_BASE"-->/opac_utils.js' type='text/javascript'></script>
        <script language='javascript' src='<!--#echo var="OILS_JS_BASE"-->/OrgTree.js' type='text/javascript'></script>
+       <script language='javascript' src='<!--#echo var="OILS_JS_BASE"-->/OrgLasso.js' type='text/javascript'></script>
        <script language='javascript' src='<!--#echo var="OILS_JS_BASE"-->/org_utils.js' type='text/javascript'></script>
        <script language='javascript' src='<!--#echo var="OILS_JS_BASE"-->/RemoteRequest.js' type='text/javascript'></script>
        <script language='javascript' src='<!--#echo var="OILS_JS_BASE"-->/init.js' type='text/javascript'></script>