[Koha] URI field link options

Doug Dearden dearden at sarsf.org
Fri Nov 7 13:38:07 NZDT 2008


Joe Atzberger <ohiocore at ...> writes:

> 
> 
> Your approach would change the data in MARC records.  This should be avoided
if possible.  Instead you should use Apache and possibly a proxy layer.  For
example, if you catalog all the records to point towards:
> 
> http://YourContentServer.org/logical_directory1/filename9
> 
> You could set up a VirtualHost in Apache
> on the Koha server with ServerName "YourContentServer.org" (and
NameVirtualHost) or 
> 
> on a separate server.  The DNS would control which would respond.  
> 
> Then for extensibility you could go further with Redirect: Redirect
/logical_directory1 http://my_other_server.com/other_dir
> Or:
> RedirectMatch ^/(logical_directory)(.)/(.)(.*)
http://my_other_server.com.com/$1/$2/$3/$3$4
> 
> That would redirect a request from: 
> /logical_directory3/shakespeare.jpg
> to:
> http://my_other_server.com.com/logical_directory/3/s/shakespeare.jpg
> 
> That splits out the request to a physical directory that is hashed by the
number from the logical directory and the first letter of the filename.  The
mappings are completely arbitrary.  Of course the splitting out could occur on
the second (or third, fourth, etc.) server.  And similar tricks could be
accomplished with ModRewrite.  The point is that the data should be correct
without any variable substitution/interpretation.  You can make that so by
ensuring your servers respond to the request for that address, regardless of
where the physical location endsup.  Just don't use a circle of redirects since
the browser expects the first redirect to get to the right server.  --Joe
AtzbergerOn Mon, Nov 3, 2008 at 3:41 PM, Doug Dearden
<dearden at sarsf.org> wrote:Hello all,
> I have a successful install of Koha 3.0 (revision 17 I believe) running on
> Debian etch, Apache2, Mysql 5.0.  In some cases we will be using this to
 catalog
> a computer file of some sort - text or maybe images or sound.  I find I can
 get
> this to work by putting in the full path to the file

-http://ipaddressofserver/directory/filename,
 but am trying to figure out a way
> to use a variable for the first part of that so that I can move the directory
 in
> the future and not have to reenter all of the links.  For instance, a
 cataloged
> entry pointing to text_directory_variablename/filename is reinterpreted

tohttp://kohaserver_ip_address/localtext/filename.  Or
> sound_directory_variablename is reinterpreted
to
http://another_web_server_ip_address/some_directory/filename.  I have tried
> using some SetEnv statements in the koha-httpd.conf file and also an extra
 entry
> in the <config> section of the koha-conf.xml file, but these did not work -
 the
> link shows up without reinterpreting the variable name.  At this point the
 best
> I have been able to do is to use http://kohaserver/a_directory/filename and
 then
> create a DNS entry for the kohaserver that points to the correct IP address.
  My
> concern is looking toward the future, and trying to make things as flexible as
> possible - so that these files could be moved later and the only change to
 make
> it work would be reconfiguring what the variable points to.
> Writing this I am thinking that there is probably not code in Koha to
> automatically do this, but not being a perl programmer I am not sure where I
> would start looking.  If a code modification is what it would take, a little
> bird dogging to the right place would help me also.
> Thanks,
> Doug
> _______________________________________________
> Koha mailing
listKoha at lists.katipo.co.nzhttp://lists.katipo.co.nz/mailman/listinfo/koha
> 
> 
> 
> 
> 
> _______________________________________________
> Koha mailing list
> Koha at ...
> http://lists.katipo.co.nz/mailman/listinfo/koha
> 


Joe - I am trying this and having mixed results.  Keeping it simple to test
with, I created a directory on the default apache web server called sarimages. 
I then added this directive to the koha-httpd.conf file:

Redirect /image http://192.168.21.249/sarimages 

192.168.21.249 being the address that the default apache server listens on, with
the pertinent directory structure of /var/www/sarimages/test/

This has two files, test.jpg and night_valley.jpg .

I created a test record, with /image/test/test.jpg in the 856u field of the
Biblio, and /image/test/night_valley.jpg in the u - Uniform Resource Identifier
of the item record.  

When I look at the record in the OPAC Normal view, I see the record title - Test
Image with Online Resources under it and a link that reads
http:///image/test/test.jpg.  Checking the properties of this link shows that
the link title is as above, with three slashes and that the link address is
http://image/test/test.jpg with two slashes.  Clicking on the link returns an
Address not found error.

Changing to the MARC view, I see the links listed as /image/test/test.jpg in the
biblio and /image/test/night_valley.jpg in the item listing.  Checking the
properties, I find they are pointing to
http://192.168.21.239:53980/image/test/test.jpg and
http://192.168.21.239:53980/image/test/night_valley.jpg .  192.168.21.239:53980
is the address and port for the koha virtual host.  Clicking on these links
returns the desired result, redirecting to the correct place on the default
apache server and displaying the image.

I cataloged this test record as item type "computer file" in the default
framework, with the minimum info needed - putting in the title and the 856u
field and the returning to the 0 tab and taking the defaults.

So the redirect is working as designed on the links in the MARC view, but in the
normal view the link doesn't work.

Hope all that is clear.

Best,

Doug



More information about the Koha mailing list