Merged revisions 9515,9520,9525,9527,9532 via svnmerge from
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 8 May 2008 16:06:30 +0000 (16:06 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 8 May 2008 16:06:30 +0000 (16:06 +0000)
svn://svn.open-ils.org/ILS/trunk

........
  r9515 | dbs | 2008-05-06 15:59:06 -0400 (Tue, 06 May 2008) | 2 lines

  After 1.2, domains element is no longer used
........
  r9520 | miker | 2008-05-07 14:17:37 -0400 (Wed, 07 May 2008) | 1 line

  do not record emtpy tcn valuesOpen-ILS/src/perlmods/OpenILS/Application/Cat.pm
........
  r9525 | erickson | 2008-05-07 16:40:13 -0400 (Wed, 07 May 2008) | 1 line

  added content handler no longer tries to pull from the cache when the plugin cannot return data for that type of call anyway.  removed Amazon stub methods because they 1. should have returned explicit undef, but more importantly because having them around means extra calls to memcache
........
  r9527 | erickson | 2008-05-07 16:46:49 -0400 (Wed, 07 May 2008) | 1 line

  applying empty tcn check on marc overlay api call as well
........
  r9532 | erickson | 2008-05-08 12:01:57 -0400 (Thu, 08 May 2008) | 1 line

  dojo-ized CGI parser
........

git-svn-id: svn://svn.open-ils.org/ILS/branches/acq-experiment@9533 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Application/Cat.pm
Open-ILS/src/perlmods/OpenILS/WWW/AddedContent.pm
Open-ILS/src/perlmods/OpenILS/WWW/AddedContent/Amazon.pm
Open-ILS/src/support-scripts/settings-tester.pl
Open-ILS/web/js/dojo/openils/CGI.js [new file with mode: 0644]

index d3eeb1f..ef07d41 100644 (file)
@@ -217,7 +217,7 @@ sub biblio_record_replace_marc  {
 
            return $evt if $evt;
 
-               $rec->tcn_value($tcn);
+               $rec->tcn_value($tcn) if ($tcn);
                $rec->tcn_source($tsource);
 
     } else {
@@ -292,7 +292,7 @@ sub biblio_record_xml_import {
 
        $record->source(bib_source_from_name($source)) if $source;
        $record->tcn_source($tcn_source);
-       $record->tcn_value($tcn);
+       $record->tcn_value($tcn) if ($tcn);
        $record->creator($e->requestor->id);
        $record->editor($e->requestor->id);
        $record->create_date('now');
index 9ef92f7..aca4382 100644 (file)
@@ -86,14 +86,14 @@ sub handler {
     child_init() unless $handler;
 
     return Apache2::Const::NOT_FOUND unless $handler and $type and $format and $key;
-    return $res if defined($res = $AC->serve_from_cache($type, $format, $key));
-    return Apache2::Const::NOT_FOUND unless $AC->lookups_enabled;
 
     my $err;
     my $data;
     my $method = "${type}_${format}";
 
     return Apache2::Const::NOT_FOUND unless $handler->can($method);
+    return $res if defined($res = $AC->serve_from_cache($type, $format, $key));
+    return Apache2::Const::NOT_FOUND unless $AC->lookups_enabled;
 
     try {
         $data = $handler->$method($key);
index 86c19c6..77c6bef 100644 (file)
@@ -47,65 +47,6 @@ sub jacket_large {
 
 # --------------------------------------------------------------------------
 
-sub toc_html {
-    my( $self, $key ) = @_;
-}
-
-sub toc_xml {
-    my( $self, $key ) = @_;
-}
-
-sub toc_json {
-    my( $self, $key ) = @_;
-}
-
-# --------------------------------------------------------------------------
-
-sub anotes_html {
-    my( $self, $key ) = @_;
-}
-
-sub anotes_xml {
-    my( $self, $key ) = @_;
-}
-
-sub anotes_json {
-    my( $self, $key ) = @_;
-}
-
-
-# --------------------------------------------------------------------------
-
-sub excerpt_html {
-    my( $self, $key ) = @_;
-}
-
-sub excerpt_xml {
-    my( $self, $key ) = @_;
-}
-
-sub excerpt_json {
-    my( $self, $key ) = @_;
-}
-
-# --------------------------------------------------------------------------
-
-sub reviews_html {
-    my( $self, $key ) = @_;
-}
-
-# we have to aggregate the reviews
-sub reviews_xml {
-    my( $self, $key ) = @_;
-}
-
-
-sub reviews_json {
-    my( $self, $key ) = @_;
-}
-
-# --------------------------------------------------------------------------
-
 sub send_img {
     my($self, $response) = @_;
     return { 
index 7b9d8aa..342ff4f 100755 (executable)
@@ -70,7 +70,8 @@ my $conf = OpenSRF::Utils::Config->current;
 my $j_username    = $conf->bootstrap->username;
 my $j_password    = $conf->bootstrap->passwd;
 my $j_port    = $conf->bootstrap->port;
-my $j_domain    = $conf->bootstrap->domains->[0];
+# We should check for a domains element to catch likely upgrade errors
+my $j_domain    = $conf->bootstrap->domain;
 my $settings_config = $conf->bootstrap->settings_config;
 my $logfile    = $conf->bootstrap->logfile;
 (my $log_dir = $logfile) =~ s#(.*)/.*#$1#;
diff --git a/Open-ILS/web/js/dojo/openils/CGI.js b/Open-ILS/web/js/dojo/openils/CGI.js
new file mode 100644 (file)
index 0000000..d63576e
--- /dev/null
@@ -0,0 +1,99 @@
+/* ---------------------------------------------------------------------------
+ * Copyright (C) 2008  Georgia Public Library Service
+ * Bill Erickson <erickson@esilibrary.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * ---------------------------------------------------------------------------
+ */
+
+if(!dojo._hasResource["openils.CGI"]) {
+
+    dojo._hasResource["openils.CGI"] = true;
+    dojo.provide("openils.CGI");
+    dojo.declare('openils.CGI', null, {
+
+        constructor : function() {
+
+            this._keys = new Array();
+            this.data = new Object();
+
+            var string = location.search.replace(/^\?/,"");
+            this.server_name = location.href.replace(/^https?:\/\/([^\/]+).+$/,"$1");
+
+            var key = ""; 
+            var value = "";
+            var inkey = true;
+            var invalue = false;
+
+            for( var idx = 0; idx!= string.length; idx++ ) {
+
+                var c = string.charAt(idx);
+
+                if( c == "=" ) {
+                    invalue = true;
+                    inkey = false;
+                    continue;
+                } 
+
+                if(c == "&" || c == ";") {
+                    inkey = 1;
+                    invalue = 0;
+                    if( ! this.data[key] ) this.data[key] = [];
+                    this.data[key].push(decodeURIComponent(value));
+                    this._keys.push(key);
+                    key = ""; value = "";
+                    continue;
+                }
+
+                if(inkey) key += c;
+                else if(invalue) value += c;
+            }
+
+            if( ! this.data[key] ) this.data[key] = [];
+            this.data[key].push(decodeURIComponent(value));
+            this._keys.push(key);
+        },
+
+        /* returns the value for the given param.  If there is only one value for the
+           given param, it returns that value.  Otherwise it returns an array of values
+         */
+        param : function(p) {
+            if(this.data[p] == null) return null;
+            if(this.data[p].length == 1)
+                return this.data[p][0];
+            return this.data[p];
+        },
+
+        /* returns an array of param names */
+        keys : function() {
+            return this._keys;
+        },
+
+        /* debugging method */
+        toString : function() {
+            var string = "";
+            var keys = this.keys();
+
+            for( var k in keys ) {
+                string += keys[k] + " : ";
+                var params = this.param(keys[k]);
+
+                for( var p in params ) {
+                    string +=  params[p] + " ";
+                }
+                string += "\n";
+            }
+            return string;
+        }
+    });
+}
+
+