[open-ils-commits] SPAM: r8268 - in
branches/acq-experiment/Open-ILS/web/oilsweb: .
oilsweb/controllers oilsweb/lib oilsweb/public
oilsweb/public/oils/media/css/skin
oilsweb/public/oils/media/css/theme oilsweb/public/oils/media/xsl
oilsweb/templates/oils/default/acq
svn at svn.open-ils.org
svn at svn.open-ils.org
Fri Dec 21 10:45:09 EST 2007
Author: erickson
Date: 2007-12-21 10:23:11 -0500 (Fri, 21 Dec 2007)
New Revision: 8268
Added:
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/lib/bib.py
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/xsl/oilsMARC21slim2HTML.xsl
Removed:
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/index.html
Modified:
branches/acq-experiment/Open-ILS/web/oilsweb/development.ini
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq.py
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/lib/context.py
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/css/skin/acq_default.css
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/css/theme/acq_default.css
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/pl_builder.html
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/rdetails.html
Log:
added a field extractor for the marc data. added an isbn scrubber to clean up the interface some. added initial marc2html logic
Modified: branches/acq-experiment/Open-ILS/web/oilsweb/development.ini
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/development.ini 2007-12-21 15:02:12 UTC (rev 8267)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/development.ini 2007-12-21 15:23:11 UTC (rev 8268)
@@ -32,6 +32,7 @@
oils_password = open-ils
oils_xsl_prefix = oilsweb/public/oils/media/xsl
oils_xsl_acq_bib = acq-bibdata-marc.xslt
+oils_xsl_marc2html = oilsMARC21slim2HTML.xsl
# If you'd like to fine-tune the individual locations of the cache data dirs
Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq.py
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq.py 2007-12-21 15:02:12 UTC (rev 8267)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq.py 2007-12-21 15:23:11 UTC (rev 8268)
@@ -5,6 +5,7 @@
import oilsweb.lib.context
import oilsweb.lib.util
import oilsweb.lib.acq.search
+import oilsweb.lib.bib
import osrf.cache, osrf.json
from oilsweb.lib.context import Context, SubContext, ContextItem
@@ -43,14 +44,16 @@
def pl_builder(self):
- c.oils = oilsweb.lib.context.Context.init(request)
+ ctx = oilsweb.lib.context.Context.init(request)
# add logic to see where we are fetching bib data from
- if c.oils.acq.search_source:
- c.oils_acq_records, c.oils.acq.search_cache_key = self._build_z39_search(c.oils)
+ if ctx.acq.search_source:
+ c.oils_acq_records, ctx.acq.search_cache_key = self._build_z39_search(ctx)
- c.oils.acq.extract_bib_field = oilsweb.lib.acq.search.extract_bib_field
- return render('oils/%s/acq/pl_builder.html' % c.oils.core.skin)
+ ctx.scrub_isbn = oilsweb.lib.bib.scrub_isbn # XXX add more generically to the context object
+ ctx.acq.extract_bib_field = oilsweb.lib.acq.search.extract_bib_field
+ c.oils = ctx
+ return render('oils/%s/acq/pl_builder.html' % ctx.core.skin)
def _build_z39_search(self, ctx):
@@ -63,13 +66,13 @@
}
# collect the sources and credentials
- for src in c.oils.acq.search_source:
+ for src in ctx.acq.search_source:
search['service'].append(src)
search['username'].append("") # XXX config values? in-db?
search['password'].append("") # XXX config values? in-db?
# collect the search classes
- for cls in c.oils.acq.search_class:
+ for cls in ctx.acq.search_class:
if request.params[cls]:
search['search'][cls] = request.params[cls]
@@ -85,6 +88,7 @@
for rec in res['records']:
if str(rec['cache_id']) == str(rec_id):
c.oils.acq.record = rec
+ #c.oils.acq.record_html = oilsweb.lib.bib.marc_to_html(rec['marcxml'])
return render('oils/%s/acq/rdetails.html' % c.oils.core.skin)
return 'exception -> no record'
Added: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/lib/bib.py
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/lib/bib.py (rev 0)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/lib/bib.py 2007-12-21 15:23:11 UTC (rev 8268)
@@ -0,0 +1,19 @@
+import os, re
+import pylons
+import osrf.ses
+import oils.utils.csedit
+import oilsweb.lib.util
+
+def marc_to_html(marcxml):
+ # create a path building utility function ....
+ xslFile = os.path.join(os.getcwd(), pylons.config['oils_xsl_prefix'], pylons.config['oils_xsl_marc2html'])
+ html = oilsweb.lib.util.apply_xsl(marcxml, xslFile)
+ # XXX encoding problems need resolving...
+ return html
+
+def scrub_isbn(isbn):
+ ''' removes trailing data from an ISBN '''
+ if not isbn: return isbn
+ return re.sub('\s.*','', isbn)
+
+
Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/lib/context.py
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/lib/context.py 2007-12-21 15:02:12 UTC (rev 8267)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/lib/context.py 2007-12-21 15:23:11 UTC (rev 8268)
@@ -21,8 +21,10 @@
def wrap(self):
return {'oils': self}
+ '''
def applySubContext(self, app, subContext):
setattr(self, app, subContext)
+ '''
def make_query_string(self):
q = ''
@@ -44,7 +46,7 @@
def applySubContext(app, ctx):
global _subContexts
_subContexts[app] = ctx
-
+
@staticmethod
def getContext():
global _context
Deleted: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/index.html
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/index.html 2007-12-21 15:02:12 UTC (rev 8267)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/index.html 2007-12-21 15:23:11 UTC (rev 8268)
@@ -1,108 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
- "http://www.w3.org/TR/html4/loose.dtd">
-<html>
-<head>
- <title>Pylons Default Page</title>
- <style>
- body { background-color: #fff; color: #333; }
-
- body, p {
- font-family: verdana, arial, helvetica, sans-serif;
- font-size: 12px;
- line-height: 18px;
- }
- pre {
- background-color: #eee;
- padding: 10px;
- font-size: 11px;
- line-height: 13px;
- }
-
- a { color: #000; }
- a:visited { color: #666; }
- a:hover { color: #fff; background-color:#000; }
- </style>
-</head>
-<body>
-
-<h1>Welcome to your Pylons Web Application</h1>
-
-<h2>Weren't expecting to see this page?</h2>
-
-<p>The <tt>oilsweb/public/</tt> directory is searched for static files
- <i>before</i> your controllers are run. Remove this file (<tt>oilsweb/public/index.html</tt>)
- and edit the routes in <tt>oilsweb/config/routing.py</tt> to point the
- <a href="/">root path</a> to a 'hello' controller we'll create below:
- <pre> map.connect('', controller='hello', action='index')</pre>
-</p>
-
-<h2>Getting Started</h2>
-<p>You're now ready to start creating your own web application. To create a 'hello' controller,
- run the following command in your project's root directory:
-<pre>
-oilsweb$ paster controller hello
-</pre>
-
- This generates the following the following code in <tt>oilsweb/controllers/hello.py</tt>:
-<pre>
-import logging
-
-from oilsweb.lib.base import *
-
-log = logging.getLogger(__name__)
-
-class HelloController(BaseController):
-
- def index(self):
- # Return a rendered template
- # return render('/some/template.mako)
- # or, Return a response
- return 'Hello World'
-</pre>
-</p>
-<p>This controller simply prints out 'Hello World' to the browser. Pylons' default routes
- automatically set up this controller to respond at the <a href="/hello">/hello</a> URL.
- With the additional route described above, this controller will also respond at the
- <a href="/">root path</a>.
-</p>
-
-<h3>Using a template</h3>
-<p>To call a template and do something a little more complex, this following example
- shows how to print out some request information from a
- <a href="http://www.makotemplates.org">Mako</a> template.
-</p>
-<p>Create a <tt>serverinfo.mako</tt> file in your project's <tt>oilsweb/templates/</tt>
- directory with the following contents:
-</p>
-<pre>
-<h2>
-Server info for ${request.host}
-</h2>
-
-<p>
-The URL you called: ${h.url_for()}
-</p>
-
-<p>
-The name you set: ${c.name}
-</p>
-
-<p>The WSGI environ:<br />
-<pre>${c.pretty_environ}</pre>
-</p>
-</pre>
-
-Then add the following to your 'hello' controller class:
-<pre>
- def serverinfo(self):
- import cgi
- import pprint
- c.pretty_environ = cgi.escape(pprint.pformat(request.environ))
- c.name = 'The Black Knight'
- return render('/serverinfo.mako')
-</pre>
-
-You can now view the page at: <tt><a href="/hello/serverinfo">/hello/serverinfo</a></tt>
-</p>
-</body>
-</html>
Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/css/skin/acq_default.css
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/css/skin/acq_default.css 2007-12-21 15:02:12 UTC (rev 8267)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/css/skin/acq_default.css 2007-12-21 15:23:11 UTC (rev 8268)
@@ -15,4 +15,4 @@
.oils-acq-pl_builder-records-author-row td { padding-left: 30px; }
.oils-acq-pl_builder-records-phys_desc-row td { padding-left: 30px; }
.oils-acq-pl_builder-records-phys_desc-row {}
-
+#oils-acq-rdetail-marc-block { margin-top: 10px; padding: 10px; }
Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/css/theme/acq_default.css
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/css/theme/acq_default.css 2007-12-21 15:02:12 UTC (rev 8267)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/css/theme/acq_default.css 2007-12-21 15:23:11 UTC (rev 8268)
@@ -8,3 +8,4 @@
#oils-acq-search-sources-label { font-weight: bold; }
#oils-acq-pl_builder-table thead td { font-weight: bold; }
#oils-acq-pl_builder-table td { border-bottom: 1px solid #808080;}
+#oils-acq-rdetail-marc-block { border-top: 1px solid #808080; }
Added: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/xsl/oilsMARC21slim2HTML.xsl
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/xsl/oilsMARC21slim2HTML.xsl (rev 0)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/xsl/oilsMARC21slim2HTML.xsl 2007-12-21 15:23:11 UTC (rev 8268)
@@ -0,0 +1,91 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0" xmlns:marc="http://www.loc.gov/MARC21/slim" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+ <xsl:output method="html"/>
+
+ <xsl:template match="/">
+ <html>
+ <head>
+
+ <style>
+
+ .marc_table {}
+ .marc_tag_row {}
+ .marc_tag_data {}
+ .marc_tag_col {}
+ .marc_tag_ind {}
+ .marc_subfields {}
+ .marc_subfield_code {
+ color: blue;
+ padding-left: 5px;
+ padding-right: 5px;
+ }
+
+ </style>
+
+ <link href='/css/opac_marc.css' rel='stylesheet' type='text/css'></link>
+ </head>
+ <body>
+ <div><button onclick='window.print();'>Print Page</button></div>
+ <xsl:apply-templates/>
+ </body>
+ </html>
+ </xsl:template>
+
+ <xsl:template match="marc:record">
+ <table class='marc_table'>
+ <tr class='marc_tag_row'>
+ <th class='marc_tag_col' NOWRAP="TRUE" ALIGN="RIGHT" VALIGN="middle">
+ LDR
+ </th>
+ <td class='marc_tag_data' COLSPAN='3'>
+ <xsl:value-of select="marc:leader"/>
+ </td>
+ </tr>
+ <xsl:apply-templates select="marc:datafield|marc:controlfield"/>
+ </table>
+ </xsl:template>
+
+ <xsl:template match="marc:controlfield">
+ <tr class='marc_tag_row'>
+ <th class='marc_tag_col' NOWRAP="TRUE" ALIGN="RIGHT" VALIGN="middle">
+ <xsl:value-of select="@tag"/>
+ </th>
+ <td class='marc_tag_data' COLSPAN='3'>
+ <xsl:value-of select="."/>
+ </td>
+ </tr>
+ </xsl:template>
+
+ <xsl:template match="marc:datafield">
+ <tr class='marc_tag_row'>
+ <th class='marc_tag_col' NOWRAP="TRUE" ALIGN="RIGHT" VALIGN="middle">
+ <xsl:value-of select="@tag"/>
+ </th>
+ <td class='marc_tag_ind'>
+ <xsl:value-of select="@ind1"/>
+ </td>
+
+ <td class='marc_tag_ind' style='border-left: 1px solid #A0A0A0; padding-left: 3px;'>
+ <xsl:value-of select="@ind2"/>
+ <span style='color:#FFF'>.</span>
+ </td>
+
+ <td class='marc_subfields'>
+ <xsl:apply-templates select="marc:subfield"/>
+ </td>
+ </tr>
+ </xsl:template>
+
+ <xsl:template match="marc:subfield">
+ <span class='marc_subfield_code' >
+ ‡<xsl:value-of select="@code"/>
+ </span><xsl:value-of select="."/>
+ </xsl:template>
+
+</xsl:stylesheet>
+
+<!-- Stylus Studio meta-information - (c)1998-2002 eXcelon Corp.
+<metaInformation>
+<scenarios ><scenario default="no" name="Ray Charles" userelativepaths="yes" externalpreview="no" url="..\xml\MARC21slim\raycharles.xml" htmlbaseurl="" outputurl="" processortype="internal" commandline="" additionalpath="" additionalclasspath="" postprocessortype="none" postprocesscommandline="" postprocessadditionalpath="" postprocessgeneratedext=""/><scenario default="yes" name="s7" userelativepaths="yes" externalpreview="no" url="..\ifla\sally7.xml" htmlbaseurl="" outputurl="" processortype="internal" commandline="" additionalpath="" additionalclasspath="" postprocessortype="none" postprocesscommandline="" postprocessadditionalpath="" postprocessgeneratedext=""/></scenarios><MapperInfo srcSchemaPath="" srcSchemaRoot="" srcSchemaPathIsRelative="yes" srcSchemaInterpretAsXML="no" destSchemaPath="" destSchemaRoot="" destSchemaPathIsRelative="yes" destSchemaInterpretAsXML="no"/>
+</metaInformation>
+-->
Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/pl_builder.html
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/pl_builder.html 2007-12-21 15:02:12 UTC (rev 8267)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/pl_builder.html 2007-12-21 15:23:11 UTC (rev 8268)
@@ -13,12 +13,12 @@
<tr class='oils-acq-pl_builder-records-title-row'>
<td rowspan='3'>
<img class='oils-acq-pl_builder-records-jacket'
- src='${c.oils.core.ac_prefix}/jacket/small/${c.oils.acq.extract_bib_field(rec,"isbns.isbn")}'/>
+ src='${c.oils.core.ac_prefix}/jacket/small/${c.oils.scrub_isbn(c.oils.acq.extract_bib_field(rec,"isbns.isbn"))}'/>
</td>
<td>
<a href='rdetails?${c.oils.make_query_string()}&${c.oils.acq.record_id_.cgi_name}=${rec["cache_id"]}&${c.oils.acq.search_cache_key_.cgi_name}=${c.oils.acq.search_cache_key}'>${c.oils.acq.extract_bib_field(rec, 'title')}</a>
</td>
- <td>${c.oils.acq.extract_bib_field(rec, 'isbns.isbn')}</td>
+ <td>${c.oils.scrub_isbn(c.oils.acq.extract_bib_field(rec, 'isbns.isbn'))}</td>
<td>${res['service']}</td>
</tr>
Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/rdetails.html
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/rdetails.html 2007-12-21 15:02:12 UTC (rev 8267)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/rdetails.html 2007-12-21 15:23:11 UTC (rev 8268)
@@ -9,5 +9,10 @@
</tr>
% endfor
</table>
+ <!--
+ <div id='oils-acq-rdetail-marc-block'>
+ {c.oils.acq.record_html}
+ </div>
+ -->
</%def>
More information about the open-ils-commits
mailing list