[open-ils-commits] r13038 - in trunk/Open-ILS: examples src/perlmods/OpenILS/Application src/perlmods/OpenILS/WWW web/js/dojo/openils (miker)

svn at svn.open-ils.org svn at svn.open-ils.org
Sat May 2 20:52:16 EDT 2009


Author: miker
Date: 2009-05-02 20:52:14 -0400 (Sat, 02 May 2009)
New Revision: 13038

Modified:
   trunk/Open-ILS/examples/fm_IDL.xml
   trunk/Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm
   trunk/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm
   trunk/Open-ILS/web/js/dojo/openils/BibTemplate.js
Log:
add configurable string joiner instead of hardcoding a space Open-ILS/web/js/dojo/openils/BibTemplate.js

Modified: trunk/Open-ILS/examples/fm_IDL.xml
===================================================================
--- trunk/Open-ILS/examples/fm_IDL.xml	2009-05-02 19:54:59 UTC (rev 13037)
+++ trunk/Open-ILS/examples/fm_IDL.xml	2009-05-03 00:52:14 UTC (rev 13038)
@@ -1516,6 +1516,8 @@
 			<field reporter:label="Owning Library" name="owning_lib" oils_obj:array_position="11" oils_persist:virtual="false"  reporter:datatype="org_unit"/>
 			<field reporter:label="Bib Record" name="record" oils_obj:array_position="12" oils_persist:virtual="false" reporter:datatype="link"/>
 			<field reporter:label="Notes" name="notes" oils_obj:array_position="13" oils_persist:virtual="true" reporter:datatype="link"/>
+			<field reporter:label="URI Maps" name="uri_maps" oils_obj:array_position="14" oils_persist:virtual="true" reporter:datatype="link"/>
+			<field reporter:label="URIs" name="uris" oils_obj:array_position="15" oils_persist:virtual="true" reporter:datatype="link"/>
 		</fields>
 		<links>
 			<link field="editor" reltype="has_a" key="id" map="" class="au"/>
@@ -1524,6 +1526,8 @@
 			<link field="owning_lib" reltype="has_a" key="id" map="" class="aou"/>
 			<link field="notes" reltype="has_many" key="call_number" map="" class="acnn"/>
 			<link field="copies" reltype="has_many" key="call_number" map="" class="acp"/>
+			<link field="uris" reltype="has_many" key="call_number" map="uri" class="auricnm"/>
+			<link field="uri_maps" reltype="has_many" key="call_number" map="" class="auricnm"/>
 		</links>
         <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
             <actions>
@@ -1544,8 +1548,13 @@
 			<field reporter:label="Label" name="label" oils_obj:array_position="5" oils_persist:virtual="false" reporter:datatype="text"/>
 			<field reporter:label="Use Information" name="use_restriction" oils_obj:array_position="6" oils_persist:virtual="false" reporter:datatype="text"/>
 			<field reporter:label="Active" name="active" oils_obj:array_position="7" oils_persist:virtual="false" reporter:datatype="bool"/>
+			<field reporter:label="Call Number Maps" name="call_number_maps" oils_obj:array_position="8" oils_persist:virtual="true" reporter:datatype="link"/>
+			<field reporter:label="Call Numbers" name="call_numbers" oils_obj:array_position="9" oils_persist:virtual="true" reporter:datatype="link"/>
 		</fields>
-		<links/>
+		<links>
+			<link field="call_numbers" reltype="has_many" key="uri" map="call_number" class="auricnm"/>
+			<link field="call_number_maps" reltype="has_many" key="uri" map="" class="auricnm"/>
+        </links>
 	</class>
 	<class id="auricnm" controller="open-ils.cstore" oils_obj:fieldmapper="asset::uri_call_number_map" oils_persist:tablename="asset.uri_call_number_map" reporter:label="Electronic Access URI to Call Number Map">
 		<fields oils_persist:primary="id" oils_persist:sequence="asset.uri_call_number_map_id_seq">

Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm	2009-05-02 19:54:59 UTC (rev 13037)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm	2009-05-03 00:52:14 UTC (rev 13038)
@@ -267,7 +267,7 @@
 	my $orgs = $_storage->request(
 		"open-ils.cstore.direct.actor.org_unit.search",
 		$o_search,
-		{ flesh		=> 3,
+		{ flesh		=> 100,
 		  flesh_fields	=> { aou	=> [qw/children/] }
 		}
 	)->gather(1);
@@ -362,7 +362,7 @@
 		my $orgs = $_storage->request(
 			"open-ils.cstore.direct.actor.org_unit.search",
 			{ shortname => $ou },
-			{ flesh		=> 10,
+			{ flesh		=> 100,
 			  flesh_fields	=> { aou	=> [qw/children/] }
 			}
 		)->gather(1);
@@ -533,7 +533,7 @@
 		my $orgs = $_storage->request(
 			"open-ils.cstore.direct.actor.org_unit.search",
 			{ shortname => $ou },
-			{ flesh		=> 10,
+			{ flesh		=> 100,
 			  flesh_fields	=> { aou	=> [qw/children/] }
 			}
 		)->gather(1);
@@ -651,9 +651,53 @@
 }
 __PACKAGE__->register_method( method => 'holding_data_formats', api_name => 'open-ils.supercat.acn.formats', api_level => 1 );
 __PACKAGE__->register_method( method => 'holding_data_formats', api_name => 'open-ils.supercat.acp.formats', api_level => 1 );
+__PACKAGE__->register_method( method => 'holding_data_formats', api_name => 'open-ils.supercat.auri.formats', api_level => 1 );
 
 
 __PACKAGE__->register_method(
+	method    => 'retrieve_uri',
+	api_name  => 'open-ils.supercat.auri.marcxml.retrieve',
+	api_level => 1,
+	argc      => 1,
+	signature =>
+		{ desc     => <<"		  DESC",
+Returns a fleshed call number object
+		  DESC
+		  params   =>
+		  	[
+				{ name => 'uri_id',
+				  desc => 'An OpenILS asset::uri id',
+				  type => 'number' },
+			],
+		  'return' =>
+		  	{ desc => 'fleshed uri',
+			  type => 'object' }
+		}
+);
+sub retrieve_uri {
+	my $self = shift;
+	my $client = shift;
+	my $cpid = shift;
+	my $args = shift;
+
+    return OpenILS::Application::SuperCat::unAPI
+        ->new(OpenSRF::AppSession
+            ->create( 'open-ils.cstore' )
+            ->request(
+    	    	"open-ils.cstore.direct.asset.uri.retrieve",
+	    	    $cpid,
+    		    { flesh		=> 10,
+        		  flesh_fields	=> {
+	        	  			auri    => [qw/call_number_maps/],
+	        	  			acn	    => [qw/owning_lib record/],
+	        	  			auricnm	=> [qw/uri/],
+    				}
+	    	    })
+            ->gather(1))
+        ->as_xml($args);
+}
+
+__PACKAGE__->register_method(
 	method    => 'retrieve_copy',
 	api_name  => 'open-ils.supercat.acp.marcxml.retrieve',
 	api_level => 1,
@@ -728,9 +772,10 @@
             ->request(
     	    	"open-ils.cstore.direct.asset.call_number.retrieve",
 	    	    $cnid,
-    		    { flesh		=> 2,
+    		    { flesh		=> 5,
         		  flesh_fields	=> {
-	        	  			acn	=> [qw/owning_lib record copies/],
+	        	  			acn	=> [qw/owning_lib record copies uri_maps/],
+	        	  			auricnm	=> [qw/uri/],
 		        			acp	=> [qw/location status circ_lib stat_cat_entries notes/],
     				}
 	    	    })
@@ -792,7 +837,7 @@
 	my $orgs = $_storage->request(
 		"open-ils.cstore.direct.actor.org_unit.search",
 		$o_search,
-		{ flesh		=> 3,
+		{ flesh		=> 100,
 		  flesh_fields	=> { aou	=> [qw/children/] }
 		}
 	)->gather(1);
@@ -871,7 +916,8 @@
 		{ flesh		=> 5,
 		  flesh_fields	=> {
 					bre	=> [qw/call_numbers/],
-		  			acn	=> [qw/copies owning_lib/],
+		  			acn	=> [qw/copies owning_lib uri_maps/],
+		  			auricnm	=> [qw/uri/],
 					acp	=> [qw/location status circ_lib stat_cat_entries notes/],
 					asce	=> [qw/stat_cat/],
 				}
@@ -886,7 +932,7 @@
 	my $orgs = $_storage->request(
 		"open-ils.cstore.direct.actor.org_unit.search",
 		$o_search,
-		{ flesh		=> 3,
+		{ flesh		=> 100,
 		  flesh_fields	=> { aou	=> [qw/children/] }
 		}
 	)->gather(1);
@@ -911,6 +957,10 @@
 			$found = 1;
 			last;
 		}
+
+        if (!$found && ref($cn->uri_maps) && @{$cn->uri_maps}) {
+    		$found = 1 if (grep {$cn->owning_lib->id == $_} @ou_ids);
+        }
 		next unless $found;
 
         $client->respond(
@@ -1604,6 +1654,38 @@
     return $self->{obj};
 }
 
+package OpenILS::Application::SuperCat::unAPI::auri;
+use base qw/OpenILS::Application::SuperCat::unAPI/;
+
+sub as_xml {
+    my $self = shift;
+    my $args = shift;
+
+    my $xml = '<uri xmlns="http://open-ils.org/spec/holdings/v1" ';
+    $xml .= 'id="tag:open-ils.org:asset-uri/' . $self->obj->id . '" ';
+    $xml .= 'use_restriction="' . $self->escape( $self->obj->use_restriction ) . '" ';
+    $xml .= 'label="' . $self->escape( $self->obj->label ) . '" ';
+    $xml .= 'href="' . $self->escape( $self->obj->href ) . '">';
+
+    if (!$args->{no_volumes} && ref($self->obj->call_number_maps) && @{ $self->obj->call_number_maps }) {
+        $xml .= '<volumes>' . join(
+            '',
+            map {
+                OpenILS::Application::SuperCat::unAPI
+                    ->new( $_->call_number )
+                    ->as_xml({ %$args, no_uris=>1, no_copies=>1 })
+            } @{ $self->obj->call_number_maps }
+        ) . '</volumes>';
+
+    } else {
+        $xml .= '<volumes/>';
+    }
+
+    $xml .= '</uri>';
+
+    return $xml;
+}
+
 package OpenILS::Application::SuperCat::unAPI::acn;
 use base qw/OpenILS::Application::SuperCat::unAPI/;
 
@@ -1631,7 +1713,21 @@
         $xml .= '<copies/>';
     }
 
+    if (!$args->{no_uris} && ref($self->obj->uri_maps) && @{ $self->obj->uri_maps }) {
+        $xml .= '<uris>' . join(
+            '',
+            map {
+                OpenILS::Application::SuperCat::unAPI
+                    ->new( $_->uri )
+                    ->as_xml({ %$args, no_volumes=>1 })
+            } @{ $self->obj->uri_maps }
+        ) . '</uris>';
 
+    } else {
+        $xml .= '<uris/>';
+    }
+
+
     $xml .= '<owning_lib xmlns="http://open-ils.org/spec/actors/v1" ';
     $xml .= 'id="tag:open-ils.org:actor-org_unit/' . $self->obj->owning_lib->id . '" ';
     $xml .= 'shortname="'.$self->escape( $self->obj->owning_lib->shortname ) .'" ';
@@ -1664,11 +1760,12 @@
 
     $xml .= '<status>' . $self->escape( $self->obj->status->name  ) . '</status>';
     $xml .= '<location>' . $self->escape( $self->obj->location->name  ) . '</location>';
+    $xml .= '<circlib>' . $self->escape( $self->obj->circ_lib->name  ) . '</circlib>';
 
-    $xml .= '<circlib xmlns="http://open-ils.org/spec/actors/v1" ';
+    $xml .= '<circ_lib xmlns="http://open-ils.org/spec/actors/v1" ';
     $xml .= 'id="tag:open-ils.org:actor-org_unit/' . $self->obj->circ_lib->id . '" ';
     $xml .= 'shortname="'.$self->escape( $self->obj->circ_lib->shortname ) .'" ';
-    $xml .= 'name="'.$self->escape( $self->obj->circ_lib->name ) .'">' . $self->escape( $self->obj->circ_lib->name  ) . '</circlib>';
+    $xml .= 'name="'.$self->escape( $self->obj->circ_lib->name ) .'"/>';
 
 	$xml .= "<copy_notes>";
 	if (ref($self->obj->notes) && $self->obj->notes) {

Modified: trunk/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm	2009-05-02 19:54:59 UTC (rev 13037)
+++ trunk/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm	2009-05-03 00:52:14 UTC (rev 13038)
@@ -352,6 +352,7 @@
 		$type = 'call_number' if ($1 =~ /^call_number/o);
 		$type = 'acp' if ($1 =~ /^asset-copy/o);
 		$type = 'acn' if ($1 =~ /^asset-call_number/o);
+		$type = 'auri' if ($1 =~ /^asset-uri/o);
 		$command = 'retrieve';
 		$command = 'browse' if ($type eq 'call_number');
 	}
@@ -424,7 +425,7 @@
 		print "Location: $root/../../en-US/skin/default/xml/rdetail.xml?r=$id&l=$lib_id&d=$lib_depth\n\n"
 			if ($type eq 'record');
 		return 302;
-	} elsif (OpenILS::WWW::SuperCat::Feed->exists($base_format) && ($type ne 'acn' && $type ne 'acp')) {
+	} elsif (OpenILS::WWW::SuperCat::Feed->exists($base_format) && ($type ne 'acn' && $type ne 'acp' && $type ne 'auri')) {
 		my $feed = create_record_feed(
 			$type,
 			$format => [ $id ],

Modified: trunk/Open-ILS/web/js/dojo/openils/BibTemplate.js
===================================================================
--- trunk/Open-ILS/web/js/dojo/openils/BibTemplate.js	2009-05-02 19:54:59 UTC (rev 13037)
+++ trunk/Open-ILS/web/js/dojo/openils/BibTemplate.js	2009-05-03 00:52:14 UTC (rev 13038)
@@ -28,7 +28,6 @@
 
         render : function() {
             var all_slots = dojo.query('*[type^=opac/slot-data]', this.root);
-            var rec = location.href.split('?')[1];
         
             var slots = {};
             dojo.forEach(all_slots, function(s){
@@ -51,6 +50,8 @@
                         load: function (bib) {
 
                             dojo.forEach(slot_list, function (slot) {
+                                var joiner = slot.getAttribute('join') || ' ';
+
                                 var slot_handler = dojo.query(
                                     'script[type=opac/slot-format]',
                                     slot
@@ -65,7 +66,7 @@
                                 slot.innerHTML = dojo.query(
                                     slot.getAttribute('query'),
                                     bib
-                                ).map(slot_handler).join(' ');
+                                ).map(slot_handler).join(joiner);
                 
                                 delete(slot_handler);
                             



More information about the open-ils-commits mailing list