From 16faa54e910f1de2b447a05a30e3ea2ddc25df9a Mon Sep 17 00:00:00 2001 From: erickson Date: Wed, 26 Dec 2007 17:23:44 +0000 Subject: [PATCH] subcontexts can now register functions to be passed into the template. added a new global util context. added some more basic style git-svn-id: svn://svn.open-ils.org/ILS/branches/acq-experiment@8278 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/web/oilsweb/oilsweb/controllers/acq.py | 8 +------- Open-ILS/web/oilsweb/oilsweb/lib/__init__.py | 9 +++++++++ Open-ILS/web/oilsweb/oilsweb/lib/context.py | 1 - .../public/oils/media/css/skin/acq_default.css | 6 ++++-- .../oilsweb/public/oils/media/css/skin/default.css | 2 +- .../public/oils/media/css/theme/acq_default.css | 13 +++++++++---- .../templates/oils/default/acq/picklist.html | 7 +++---- .../templates/oils/default/acq/pl_builder.html | 21 +++++++++------------ .../templates/oils/default/acq/record_list.html | 4 ++-- .../oilsweb/templates/oils/default/header.html | 4 +++- 10 files changed, 41 insertions(+), 34 deletions(-) diff --git a/Open-ILS/web/oilsweb/oilsweb/controllers/acq.py b/Open-ILS/web/oilsweb/oilsweb/controllers/acq.py index ef33ce9d17..b6ef26e12a 100644 --- a/Open-ILS/web/oilsweb/oilsweb/controllers/acq.py +++ b/Open-ILS/web/oilsweb/oilsweb/controllers/acq.py @@ -22,6 +22,7 @@ class AcqContext(SubContext): self.record_id = ContextItem(cgi_name='acq.r') self.record = ContextItem(cgi_name='acq.r') self.picklist_item = ContextItem(cgi_name='acq.pi', multi=True) + self.extract_bib_field = ContextItem(default_value=oilsweb.lib.acq.search.extract_bib_field) Context.applySubContext('acq', AcqContext) @@ -53,9 +54,6 @@ class AcqController(BaseController): if ctx.acq.search_source: c.oils_acq_records, ctx.acq.search_cache_key = self._build_z39_search(ctx) - - 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) @@ -109,13 +107,9 @@ class AcqController(BaseController): records.append(rec) c.oils_acq_records = records - 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/picklist.html' % c.oils.core.skin) - return "PL" - def _find_cached_record(self, results, cache_id): for res in results: for rec in res['records']: diff --git a/Open-ILS/web/oilsweb/oilsweb/lib/__init__.py b/Open-ILS/web/oilsweb/oilsweb/lib/__init__.py index 4c56ca491b..440936e605 100644 --- a/Open-ILS/web/oilsweb/oilsweb/lib/__init__.py +++ b/Open-ILS/web/oilsweb/oilsweb/lib/__init__.py @@ -48,3 +48,12 @@ class CoreContext(SubContext): Context.applySubContext('core', CoreContext) + +class UtilContext(SubContext): + ''' The UtilContext maintains a set of general use functions ''' + def __init__(self): + import oilsweb.lib.bib + self.scrub_isbn = ContextItem(default_value=oilsweb.lib.bib.scrub_isbn) + +Context.applySubContext('util', UtilContext) + diff --git a/Open-ILS/web/oilsweb/oilsweb/lib/context.py b/Open-ILS/web/oilsweb/oilsweb/lib/context.py index 84d51824e3..9294e27697 100644 --- a/Open-ILS/web/oilsweb/oilsweb/lib/context.py +++ b/Open-ILS/web/oilsweb/oilsweb/lib/context.py @@ -19,7 +19,6 @@ class SubContext(object): def _fields(self): ''' Returns all public fields for this subcontext ''' return [ f for f in dir(self) if f[0:1] != '_' and - getattr(self, f).__class__.__name__.find('function') < 0 and getattr(self, f).__class__.__name__.find('method') < 0 ] def postinit(self): diff --git a/Open-ILS/web/oilsweb/oilsweb/public/oils/media/css/skin/acq_default.css b/Open-ILS/web/oilsweb/oilsweb/public/oils/media/css/skin/acq_default.css index a97d5a935a..0a5dc70f7b 100644 --- a/Open-ILS/web/oilsweb/oilsweb/public/oils/media/css/skin/acq_default.css +++ b/Open-ILS/web/oilsweb/oilsweb/public/oils/media/css/skin/acq_default.css @@ -16,8 +16,9 @@ .oils-acq-search-subsources-label { margin-top: 5px; } #oils-acq-search-sources-label { margin-bottom: 10px; } #oils-acq-search-fields-label { margin-bottom: 10px; } +#oils-acq-search-fields-submit-block { margin: 5px; text-align: center;} -#oils-acq-pl_builder-table td {} +#oils-acq-pl_builder-table { width: 100%; } .oils-acq-record_list-records-jacket { width: 42px; height: 54px; padding-left: 10px; } .oils-acq-record_list-records-title-row {} .oils-acq-record_list-records-author-row td { padding-left: 30px; } @@ -25,4 +26,5 @@ .oils-acq-record_list-records-phys_desc-row {} #oils-acq-rdetail-marc-block { margin-top: 10px; padding: 10px; } -#oils-acq-search-fields-submit-block { margin: 5px; text-align: center;} + +#oils-acq-picklist-table { width: 100%; } diff --git a/Open-ILS/web/oilsweb/oilsweb/public/oils/media/css/skin/default.css b/Open-ILS/web/oilsweb/oilsweb/public/oils/media/css/skin/default.css index 03f46fcdc4..ef498ee6b6 100644 --- a/Open-ILS/web/oilsweb/oilsweb/public/oils/media/css/skin/default.css +++ b/Open-ILS/web/oilsweb/oilsweb/public/oils/media/css/skin/default.css @@ -17,7 +17,7 @@ body { margin-top: 0px; padding-top: 0px;} #oils-base-navigate-table { width: 100%; } #oils-base-navigate-table td { width: 100%; } -#oils-base-header-block { width: 100%; text-align: right; margin-top: 0px;} +#oils-base-header-block { width: 100%; text-align: right; margin-top: 0px; padding-bottom: 4px;} #oils-base-footer-block { width: 100%; text-align: center; vertical-align: bottom;} diff --git a/Open-ILS/web/oilsweb/oilsweb/public/oils/media/css/theme/acq_default.css b/Open-ILS/web/oilsweb/oilsweb/public/oils/media/css/theme/acq_default.css index a48ca91b02..468f67501f 100644 --- a/Open-ILS/web/oilsweb/oilsweb/public/oils/media/css/theme/acq_default.css +++ b/Open-ILS/web/oilsweb/oilsweb/public/oils/media/css/theme/acq_default.css @@ -1,5 +1,6 @@ #oils-acq-index-div { font-weight:bold; } + #oils-acq-search-container { width:100%; } #oils-acq-search-sources-div { width:20%; float:left; } #oils-acq-search-form-div { width:80%; float:right; } @@ -8,10 +9,14 @@ #oils-acq-search-sources-label { font-weight: bold; border-bottom: 1px solid #6BA160;} #oils-acq-search-fields-label { font-weight: bold; border-bottom: 1px solid #6BA160;} #oils-acq-search-subsources-label { font-weight: bold; } +#oils-acq-search-fields-submit-block { border: 2px solid #A1A1A1; } + #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; } -.oils-acq-record_list-picklist-td { background: #D0D0D0; } +/* #oils-acq-pl_builder-table tr { border-bottom: 1px solid #808080;} */ +.oils-acq-record_list-records-phys_desc-row { border-bottom: 1px solid #6BA160; } +.oils-acq-record_list-picklist-td { border-style: solid; border-color: #A1A1A1; border-width: 0px 1px 0px 1px; } .oils-acq-record_list-records-service-td { font-size: 85%; } #oils-acq-pl_builder-picklist-submit { text-align: right; } -#oils-acq-search-fields-submit-block { border: 2px solid #A1A1A1; } + + +#oils-acq-rdetail-marc-block { border-top: 1px solid #808080; } diff --git a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/picklist.html b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/picklist.html index 76607bbce1..3114ae061a 100644 --- a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/picklist.html +++ b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/picklist.html @@ -1,13 +1,12 @@ <%inherit file='../base.html'/> <%def name="block_title()">${_('Evergreen ACQ Picklist')} <%def name="block_content()"> -
Building picklist with...
- +
% for rec in c.oils_acq_records: diff --git a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/pl_builder.html b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/pl_builder.html index 4b3d4f5a13..6cfbf035d3 100644 --- a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/pl_builder.html +++ b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/pl_builder.html @@ -6,39 +6,36 @@
+ src='${c.oils.core.ac_prefix}/jacket/small/${c.oils.util.scrub_isbn(c.oils.acq.extract_bib_field(rec,"isbns.isbn"))}'/> ${c.oils.acq.extract_bib_field(rec, 'title')} @@ -21,7 +20,7 @@
- ${c.oils.scrub_isbn(c.oils.acq.extract_bib_field(rec, 'isbns.isbn'))} | + ${c.oils.util.scrub_isbn(c.oils.acq.extract_bib_field(rec, 'isbns.isbn'))} | ${c.oils.acq.extract_bib_field(rec, 'pubdate')} | ${c.oils.acq.extract_bib_field(rec, 'physicalSize')}
- <%include file="record_list.html"/> - diff --git a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/header.html b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/header.html index 17cd246d31..df49c55cf5 100644 --- a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/header.html +++ b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/header.html @@ -1,3 +1,5 @@
- ${c.oils.core.user.usrname()} / ${c.oils.core.workstation.name()} + + ${c.oils.core.user.usrname()} / ${c.oils.core.workstation.name()} +
-- 2.11.0
diff --git a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/record_list.html b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/record_list.html index 334b700dd3..c4ecf1d483 100644 --- a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/record_list.html +++ b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/record_list.html @@ -3,7 +3,7 @@
+ src='${c.oils.core.ac_prefix}/jacket/small/${c.oils.util.scrub_isbn(c.oils.acq.extract_bib_field(rec,"isbns.isbn"))}'/> ${c.oils.acq.extract_bib_field(rec, 'title')} @@ -21,7 +21,7 @@
- ${c.oils.scrub_isbn(c.oils.acq.extract_bib_field(rec, 'isbns.isbn'))} | + ${c.oils.util.scrub_isbn(c.oils.acq.extract_bib_field(rec, 'isbns.isbn'))} | ${c.oils.acq.extract_bib_field(rec, 'pubdate')} | ${c.oils.acq.extract_bib_field(rec, 'physicalSize')}