From 94c590f6e6b702492606277131e8ce93ee360787 Mon Sep 17 00:00:00 2001 From: erickson Date: Mon, 8 Aug 2005 17:10:54 +0000 Subject: [PATCH] more web work changed subject handling in ModsParser so subjects are now layed out as a hash of key=subject, val=subject_count git-svn-id: svn://svn.open-ils.org/ILS/trunk@1626 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/css/opac/opac.css | 17 +++------- Open-ILS/src/javascript/lib/js/opac/config.js | 4 +++ .../src/javascript/lib/js/opac/opac_utils.js | 32 ++++++++++--------- .../javascript/lib/js/opac/result_common.js | 9 +++--- .../src/perlmods/OpenILS/Utils/ModsParser.pm | 19 +++++++++-- Open-ILS/src/webxml/advanced.xml | 2 +- Open-ILS/src/webxml/altcanvas.xml | 9 +++++- Open-ILS/src/webxml/js_common.xml | 4 +-- Open-ILS/src/webxml/mresult.xml | 2 +- Open-ILS/src/webxml/rdetail.xml | 21 ++++++++++++ Open-ILS/src/webxml/rresult.xml | 2 +- Open-ILS/src/webxml/sidebar.xml | 6 ++++ 12 files changed, 85 insertions(+), 42 deletions(-) create mode 100644 Open-ILS/src/webxml/rdetail.xml diff --git a/Open-ILS/css/opac/opac.css b/Open-ILS/css/opac/opac.css index b9982c7103..238ca4a624 100644 --- a/Open-ILS/css/opac/opac.css +++ b/Open-ILS/css/opac/opac.css @@ -14,17 +14,10 @@ body table { font-size: inherit; } /* Our color scheme */ -/* -.color_1 { background: #FFE6D4; color: #000000; } -.color_2 { background: #FFCDAA; color: #000000; } -.color_3 { background: #FFE6D4; color: #000000; } -*/ - .color_1 { background: #A7EA9D; color: #000000; } .color_2 { background: #64EA4F; color: #000000; } .color_3 { background: #D8B4BE; color: #000000; } - /* ---------------------------------------------------------------------- */ .canvas { float:right; width: 80%; text-align: left;} #loading_div { width: 100%;} @@ -34,10 +27,14 @@ body table { font-size: inherit; } .org_tree { height: 500px; padding-left: 2px; padding-right: 2px; overflow:-moz-scrollbars-vertical; overflow-y:scroll; overflow-x:hidden; } +.org_link { font-size: 92%; padding-right: 15px; } +#org_link_container { margin-bottom: 5px; padding-left: 4px; padding-bottom: 3px; padding-top: 3px; width 100%; } + /* ---------------------------------------------------------------------- */ .sidebar_div { float: left; width: 19%; } .side_bar_item { padding-left: 15px; padding-right: 10px; padding-top: 5px; padding-bottom: 5px; } .sidebar_chunk {border-right: 1px solid lightgrey;} +.sidebar_extra_item { font-size: 90%; padding: 3px; } /* ---------------------------------------------------------------------- */ #searchbar { position: absolute; text-align: right; top: 2px; right: 3px; } @@ -49,8 +46,6 @@ body table { font-size: inherit; } .searchbar_tag { font-size: 90%; text-align: right; padding-left: 5px; padding-right: 5px; padding-bottom: 3px; } -/*background: #68CE76; */ - #searchbar_main { text-align: right; padding-top: 2px; padding-bottom: 3px; padding-right: 2px; padding-left: 3px; } @@ -58,12 +53,10 @@ body table { font-size: inherit; } #searchbar_table { border-collapse: collapse; } /* ---------------------------------------------------------------------- */ - #login_box { border-top: 1px solid #808080; border-bottom: 1px solid #808080; width: 60%; padding: 5px;} .login_text { margin-left: 8px; } -/*.login_links_div { padding-left: 30px; }*/ /* ---------------------------------------------------------------------- */ #result_table_div { text-align: left; width: 100%; } @@ -95,7 +88,7 @@ body table { font-size: inherit; } .result_table_subtbody { height: 100%; width: 100%; } .result_table_title_cell { text-align: left; } -.copy_count_cell { font-size: 75%; width: 8%; text-align: center; padding: 0px; margin: 0px;} +.copy_count_cell { font-size: 80%; width: 8%; text-align: center; padding: 0px; margin: 0px;} .copy_count_cell_even { border: 1px solid #E0E0E0; } .search_page_nav_link { margin-right: 5px; } diff --git a/Open-ILS/src/javascript/lib/js/opac/config.js b/Open-ILS/src/javascript/lib/js/opac/config.js index c9a08d4957..0366b2b753 100644 --- a/Open-ILS/src/javascript/lib/js/opac/config.js +++ b/Open-ILS/src/javascript/lib/js/opac/config.js @@ -159,6 +159,7 @@ config.ids.searchbar.location_tag = 'search_location_tag_link'; /* sidebar */ config.ids.sidebar = {}; config.css.sidebar = {}; +config.names.sidebar = {}; config.css.sidebar.item = {}; config.ids.sidebar.home = 'home_link_div'; config.ids.sidebar.advanced = 'advanced_link_div'; @@ -172,6 +173,9 @@ config.ids.sidebar.logoutbox = 'logout_link_div'; config.ids.sidebar.loginbox = 'login_link_div'; config.ids.sidebar.logged_in_as = 'logged_in_as_div'; config.ids.sidebar.username_dest = 'username_dest'; +config.ids.sidebar.subject = 'subject_sidebar'; + +config.names.sidebar.subject = "subject_item"; diff --git a/Open-ILS/src/javascript/lib/js/opac/opac_utils.js b/Open-ILS/src/javascript/lib/js/opac/opac_utils.js index 2fdbde16a4..ec796e2e6d 100644 --- a/Open-ILS/src/javascript/lib/js/opac/opac_utils.js +++ b/Open-ILS/src/javascript/lib/js/opac/opac_utils.js @@ -139,11 +139,8 @@ function cleanISBN(isbn) { /* ----------------------------------------------------------------------- */ /* builds a link that goes to the title listings for a metarecord */ function buildTitleLink(rec, link) { - - var t = rec.title(); - t = normalize(truncate(t, 65)); - link.appendChild(text(t)); - + if(!rec) return; + link.appendChild(text(normalize(truncate(rec.title(), 65)))); var args = {}; args.page = RRESULT; args[PARAM_OFFSET] = 0; @@ -152,11 +149,8 @@ function buildTitleLink(rec, link) { } function buildTitleDetailLink(rec, link) { - - var t = rec.title(); - t = normalize(truncate(t, 65)); - link.appendChild(text(t)); - + if(!rec) return; + link.appendChild(text(normalize(truncate(rec.title(), 65)))); var args = {}; args.page = RDETAIL; args[PARAM_OFFSET] = 0; @@ -166,11 +160,8 @@ function buildTitleDetailLink(rec, link) { /* builds an author search link */ function buildAuthorLink(rec, link) { - - var a = rec.author(); - a = normalize(truncate(a, 65)); - link.appendChild(text(a)); - + if(!rec) return; + link.appendChild(text(normalize(truncate(rec.author(), 65)))); var args = {}; args.page = MRESULT; args[PARAM_OFFSET] = 0; @@ -179,6 +170,17 @@ function buildAuthorLink(rec, link) { link.setAttribute("href", buildOPACLink(args)); } + +function buildSubjectLink(subject, link) { + if(subject == null) return; + link.appendChild(text(normalize(truncate(subject, 35)))); + var args = {}; + args.page = MRESULT; + args[PARAM_OFFSET] = 0; + args[PARAM_STYPE] = STYPE_SUBJECT; + args[PARAM_TERM] = subject; + link.setAttribute("href", buildOPACLink(args)); +} /* ----------------------------------------------------------------------- */ diff --git a/Open-ILS/src/javascript/lib/js/opac/result_common.js b/Open-ILS/src/javascript/lib/js/opac/result_common.js index 11fcc25054..6d6e341286 100644 --- a/Open-ILS/src/javascript/lib/js/opac/result_common.js +++ b/Open-ILS/src/javascript/lib/js/opac/result_common.js @@ -7,7 +7,9 @@ function resultSetInfo() { if( getDisplayCount() > (getHitCount() - getOffset())) c = getHitCount(); else c = getDisplayCount() + getOffset(); - var pages = parseInt(getHitCount() / getDisplayCount()) + 1; + var pages = getHitCount() / getDisplayCount(); + if(pages % 1) pages = parseInt(pages) + 1; + G.ui.result.current_page.appendChild(text( (getOffset()/getDisplayCount()) + 1)); G.ui.result.num_pages.appendChild(text(pages + ")")); @@ -48,9 +50,7 @@ function resultSetInfo() { /* display the record info in the record display table */ function resultDisplayRecord(rec, rowtemplate, is_mr) { - if(rec == null) rec = new mvr(); /* if we return we won't build some important UI components */ - - //alert("building record " + rec.title()); + if(rec == null) rec = new mvr(); /* so the page won't die */ /* hide the 'now loading...' message */ hideMe(G.ui.common.loading); @@ -60,7 +60,6 @@ function resultDisplayRecord(rec, rowtemplate, is_mr) { var pic = findNodeByName(r, config.names.result.item_jacket); pic.setAttribute("src", buildISBNSrc(cleanISBN(rec.isbn()))); - var title_link = findNodeByName(r, config.names.result.item_title); var author_link = findNodeByName(r, config.names.result.item_author); diff --git a/Open-ILS/src/perlmods/OpenILS/Utils/ModsParser.pm b/Open-ILS/src/perlmods/OpenILS/Utils/ModsParser.pm index 4a1f5e5754..083bc3e03a 100644 --- a/Open-ILS/src/perlmods/OpenILS/Utils/ModsParser.pm +++ b/Open-ILS/src/perlmods/OpenILS/Utils/ModsParser.pm @@ -233,11 +233,16 @@ sub mods_values_to_mods_slim { } $tmp = $modsperl->{subject}; - if(!$tmp) { $subject = []; } + if(!$tmp) { $subject = {}; } else { for my $key( keys %{$tmp}) { push(@$subject, @{$tmp->{$key}}) if ($tmp->{$key}); } + my $subh = {}; + for my $s (@$subject) { + if(defined($subh->{$s})) { $subh->{$s->[0]}++ } else { $subh->{$s->[0]} = 1;} + } + $subject = $subh } $tmp = $modsperl->{'series'}; @@ -322,8 +327,16 @@ sub push_mods_batch { my $xmlperl = $self->modsdoc_to_values( $mods ); $xmlperl = $self->mods_values_to_mods_slim( $xmlperl ); - for my $subject( @{$xmlperl->{subject}} ) { - push @{$self->{master_doc}->{subject}}, $subject; + # for backwards compatibility, remove the array part when all is decided + if(ref($xmlperl->{subject}) eq 'ARRAY' ) { + for my $subject( @{$xmlperl->{subject}} ) { + push @{$self->{master_doc}->{subject}}, $subject; + } + } else { + for my $subject ( keys %{$xmlperl->{subject}} ) { + my $s = $self->{master_doc}->{subject}; + if(defined($s->{$subject})) { $s->{$subject}++; } else { $s->{$subject} = 1; } + } } push( @{$self->{master_doc}->{type_of_resource}}, diff --git a/Open-ILS/src/webxml/advanced.xml b/Open-ILS/src/webxml/advanced.xml index dad3f6dbcb..860d27ab78 100644 --- a/Open-ILS/src/webxml/advanced.xml +++ b/Open-ILS/src/webxml/advanced.xml @@ -9,7 +9,7 @@ Evergreen: Advanced Search - + diff --git a/Open-ILS/src/webxml/altcanvas.xml b/Open-ILS/src/webxml/altcanvas.xml index c393face21..a06beea2fe 100644 --- a/Open-ILS/src/webxml/altcanvas.xml +++ b/Open-ILS/src/webxml/altcanvas.xml @@ -9,6 +9,13 @@ -
+
+ +
+
diff --git a/Open-ILS/src/webxml/js_common.xml b/Open-ILS/src/webxml/js_common.xml index 17e6af3604..0a1c29cddc 100644 --- a/Open-ILS/src/webxml/js_common.xml +++ b/Open-ILS/src/webxml/js_common.xml @@ -1,6 +1,6 @@ - +
@@ -17,10 +17,8 @@ - -
diff --git a/Open-ILS/src/webxml/mresult.xml b/Open-ILS/src/webxml/mresult.xml index c46aa1d2c1..833ac41b6c 100644 --- a/Open-ILS/src/webxml/mresult.xml +++ b/Open-ILS/src/webxml/mresult.xml @@ -7,7 +7,7 @@ Evergreen: Title Groups - + diff --git a/Open-ILS/src/webxml/rdetail.xml b/Open-ILS/src/webxml/rdetail.xml new file mode 100644 index 0000000000..44bff28b15 --- /dev/null +++ b/Open-ILS/src/webxml/rdetail.xml @@ -0,0 +1,21 @@ + + %ent; ] > + + + + + Evergreen: Titles + + + + + + +
+ + +
+ + + diff --git a/Open-ILS/src/webxml/rresult.xml b/Open-ILS/src/webxml/rresult.xml index 11f4eebe97..9b05ab4e55 100644 --- a/Open-ILS/src/webxml/rresult.xml +++ b/Open-ILS/src/webxml/rresult.xml @@ -7,7 +7,7 @@ Evergreen: Titles - + diff --git a/Open-ILS/src/webxml/sidebar.xml b/Open-ILS/src/webxml/sidebar.xml index 06be024dd8..1d2d87c0db 100644 --- a/Open-ILS/src/webxml/sidebar.xml +++ b/Open-ILS/src/webxml/sidebar.xml @@ -50,5 +50,11 @@ + + + + -- 2.43.2