From: <jen...@us...> - 2013-07-05 10:01:15
|
Revision: 18652 http://sourceforge.net/p/exist/code/18652 Author: jenspetersen Date: 2013-07-05 10:01:12 +0000 (Fri, 05 Jul 2013) Log Message: ----------- [tamboti] moving code from 18641 from session.xql to application.xql, following Wolfgang's advice, to get correct number of vra records found. fixes to vra display. Modified Paths: -------------- apps/tamboti/data/xconf/resources/collection.xconf apps/tamboti/modules/search/application.xql apps/tamboti/themes/default/modules/retrieve-vra.xql apps/tamboti/themes/default/modules/session.xql Added Paths: ----------- apps/tamboti/themes/default/images/image.png Modified: apps/tamboti/data/xconf/resources/collection.xconf =================================================================== --- apps/tamboti/data/xconf/resources/collection.xconf 2013-07-05 09:46:17 UTC (rev 18651) +++ apps/tamboti/data/xconf/resources/collection.xconf 2013-07-05 10:01:12 UTC (rev 18652) @@ -1,6 +1,6 @@ <collection xmlns="http://exist-db.org/collection-config/1.0"> <!--from Tamboti--> - <index xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:tei="http://www.tei-c.org/ns/1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:vra="http://www.vraweb.org/vracore4.htm" xmlns:mods="http://www.loc.gov/mods/v3"> + <index xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:tei="http://www.tei-c.org/ns/1.0" xmlns:vra="http://www.vraweb.org/vracore4.htm" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:mods="http://www.loc.gov/mods/v3"> <fulltext default="none" attributes="no"/> <lucene> <analyzer class="org.apache.lucene.analysis.standard.StandardAnalyzer"> @@ -43,6 +43,8 @@ <!--VRA--> <text qname="vra:vra"/> + <text qname="vra:work"/> + <text qname="vra:image"/> <text qname="vra:titleSet"/> <text qname="vra:subjectSet"/> <text qname="vra:agentSet"/> Modified: apps/tamboti/modules/search/application.xql =================================================================== --- apps/tamboti/modules/search/application.xql 2013-07-05 09:46:17 UTC (rev 18651) +++ apps/tamboti/modules/search/application.xql 2013-07-05 10:01:12 UTC (rev 18652) @@ -673,6 +673,19 @@ let $sort := if ($sort) then $sort else session:get-attribute("sort") let $results := biblio:evaluate-query($query, $sort) (:let $log := util:log("DEBUG", ("##$results): ", $results)):) + let $results-vra-work := $results[vra:work] + let $log := util:log("DEBUG", ("##$results-vra-work-count): ", count($results-vra-work))) + let $results-vra-image := $results[vra:image] + (:by not capturing vra:collection we filter away these records:) + let $results-vra-image-work := $results-vra-image/vra:image/vra:relationSet/vra:relation[@type eq "imageOf"]/@relids + let $results-vra-image-work := collection($config:mods-root)//vra:work[@id = $results-vra-image-work]/.. + let $results-vra := ($results-vra-work union $results-vra-image-work) + (:we assume that all mods records will have a titleInfo element - otherwise we cannot process them:) + let $results-mods := $results[mods:titleInfo] + (:we will have tei objects returned that are not whole documents, so this has to be filtered by namespace, but using namespace-uri() is too expensive:) + let $results-tei := $results[self::tei:p | self::tei:bibl | self::tei:titleStmt | self::tei:person | self::tei:TEI | self::tei:title | self::tei:name | self::tei:persName | self::tei:term | self::tei:head] + (:using "let $results-tei := $results[self::tei:*]" should work, but gives error: context is missing for node 1 !:) + let $results := ($results-vra, $results-mods, $results-tei) let $processed := for $item in $results return @@ -1089,7 +1102,8 @@ }; declare function biblio:query($node as node(), $params as element(parameters)?, $model as item()*) { - session:create(), + session:create() + , (: We receive an HTML template as input :) let $filter := request:get-parameter("filter", ()) let $history := request:get-parameter("history", ()) Added: apps/tamboti/themes/default/images/image.png =================================================================== (Binary files differ) Index: apps/tamboti/themes/default/images/image.png =================================================================== --- apps/tamboti/themes/default/images/image.png 2013-07-05 09:46:17 UTC (rev 18651) +++ apps/tamboti/themes/default/images/image.png 2013-07-05 10:01:12 UTC (rev 18652) Property changes on: apps/tamboti/themes/default/images/image.png ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Modified: apps/tamboti/themes/default/modules/retrieve-vra.xql =================================================================== --- apps/tamboti/themes/default/modules/retrieve-vra.xql 2013-07-05 09:46:17 UTC (rev 18651) +++ apps/tamboti/themes/default/modules/retrieve-vra.xql 2013-07-05 10:01:12 UTC (rev 18652) @@ -197,25 +197,21 @@ let $type := functx:capitalize-first(functx:camel-case-to-words($type, ' ')) let $relids := $relation/@relids let $relids := tokenize($relids, ' ') + for $relid at $i in $relids + let $type := substring($relid, 1, 1) + let $type := + if ($type eq 'i') + then 'Image Record' + else + if ($type eq 'w') + then 'Work Record' + else 'Collection Record' + let $list-view := collection($config:mods-root)//vra:image[@id = $relid]/.. + let $list-view := retrieve-vra:format-list-view('', $list-view, '') return <tr> - <td class="collection-label">Link to</td> - <td>{ - (:NB: move up:) - for $relid in $relids - let $type := substring($relid, 1, 1) - let $type := - if ($type eq 'i') - then 'Image Record' - else - if ($type eq 'w') - then 'Work Record' - else 'Collection Record' - let $relid := concat(replace(request:get-url(), '/retrieve', '/index.html'), '?filter=ID&value=', $relid) - return - <a href="{$relid}">{$type}</a> - } - </td> + <td class="collection-label">{$type}</td> + <td>{$list-view}</td> </tr> , (: subjects :) Modified: apps/tamboti/themes/default/modules/session.xql =================================================================== --- apps/tamboti/themes/default/modules/session.xql 2013-07-05 09:46:17 UTC (rev 18651) +++ apps/tamboti/themes/default/modules/session.xql 2013-07-05 10:01:12 UTC (rev 18652) @@ -96,23 +96,71 @@ ) }; -declare function bs:view-gallery-item($mode as xs:string, $item as element(mods:mods), $currentPos as xs:int) { - let $thumbSize := if ($mode eq "gallery") then $bs:THUMB_SIZE_FOR_GALLERY else $bs:THUMB_SIZE_FOR_GRID - let $title := mods-common:get-short-title($item) - return - <li class="pagination-item {$mode}" xmlns="http://www.w3.org/1999/xhtml"> - <span class="pagination-number">{ $currentPos }</span> - <div class="icon pagination-toggle" title="{$title}"> - <img class="magnify icon-magnifier" src="theme/images/search.png" title="Click to view full screen image"/> - { bs:get-icon($thumbSize, $item, $currentPos) } - </div> - { - if ($mode eq "gallery") then - <h4>{ $title }</h4> - else - () - } - </li> +declare function bs:view-gallery-item($mode as xs:string, $item as element(), $currentPos as xs:int) { + let $thumbSize := + if ($mode eq "gallery") + then $bs:THUMB_SIZE_FOR_GALLERY + else $bs:THUMB_SIZE_FOR_GRID + let $list-view := + if (namespace-uri($item) eq 'http://www.loc.gov/mods/v3') + then retrieve-mods:format-list-view('', $item, '') + else + if (namespace-uri($item) eq 'http://www.vraweb.org/vracore4.htm') + then retrieve-vra:format-list-view('', $item, '') + else + if (namespace-uri($item) eq 'http://www.tei-c.org/ns/1.0') + then retrieve-tei:format-list-view('', $item, '', '', '') + else () + return + if (namespace-uri($item) eq 'http://www.loc.gov/mods/v3') + then + <li class="pagination-item {$mode}" xmlns="http://www.w3.org/1999/xhtml"> + <span class="pagination-number">{ $currentPos }</span> + <div class="icon pagination-toggle" title="{$list-view}"> + <img class="magnify icon-magnifier" src="theme/images/search.png" title="Click to view full screen image"/> + { bs:get-icon($thumbSize, $item, $currentPos) } + </div> + { + if ($mode eq "gallery") then + <span class="mods-gallery">{ $list-view }</span> + else + () + } + </li> + else + if (namespace-uri($item) eq 'http://www.vraweb.org/vracore4.htm') + then + <li class="pagination-item {$mode}" xmlns="http://www.w3.org/1999/xhtml"> + <span class="pagination-number">{ $currentPos }</span> + <div class="icon pagination-toggle" title="{$list-view}"> + <img class="magnify icon-magnifier" src="theme/images/search.png" title="Click to view full screen image"/> + { bs:get-icon($thumbSize, $item, $currentPos) } + </div> + { + if ($mode eq "gallery") then + <span class="vra-gallery">{ $list-view }</span> + else + () + } + </li> + else + if (namespace-uri($item) eq 'http://www.tei-c.org/ns/1.0') + then + <li class="pagination-item {$mode}" xmlns="http://www.w3.org/1999/xhtml"> + <span class="pagination-number">{ $currentPos }</span> + <div class="icon pagination-toggle" title="{$list-view}"> + <img class="magnify icon-magnifier" src="theme/images/search.png" title="Click to view full screen image"/> + { bs:get-icon($thumbSize, $item, $currentPos) } + </div> + { + if ($mode eq "gallery") then + <span class="tei-gallery">{ $list-view }</span> + else + () + } + </li> + else () + }; declare function bs:mods-detail-view-table($item as element(mods:mods), $currentPos as xs:int) { @@ -221,10 +269,7 @@ <img title="{if ($saved) then 'Remove Record from My List' else 'Save Record to My List'}" src="theme/images/{if ($saved) then 'disk_gew.gif' else 'disk.gif'}" class="{if ($saved) then 'stored' else ''}"/> </a> </td> - <td class="list-type icon magnify"> - { bs:get-icon($bs:THUMB_SIZE_FOR_GALLERY, $item, $currentPos)} - </td> - + <td class="detail-type" style="vertical-align:top"><img src="theme/images/image.png" title="Still Image"/></td> <td style="vertical-align:top;"> <div id="image-cover-box"> { @@ -244,10 +289,7 @@ :) } </div> - </td> - <!--<td class="magnify detail-type"> - { bs:get-icon($bs:THUMB_SIZE_FOR_DETAIL_VIEW, $item, $currentPos)} - </td>--> + </td> <td class="detail-xml" style="vertical-align:top;"> { bs:toolbar($item, $isWritable, $id) } <!--NB: why is this phoney HTML tag used to anchor the Zotero unIPA?--> @@ -357,9 +399,7 @@ </a> </td> } - <td class="list-type icon magnify" style="vertical-align:middle"> - { bs:get-icon($bs:THUMB_SIZE_FOR_GALLERY, $item, $currentPos)} - </td> + <td class="list-type" style="vertical-align:middle"><img src="theme/images/image.png" title="Still Image"/></td> { <td class="pagination-toggle" style="vertical-align:middle"> <!--Zotero does not import vra records <abbr class="unapi-id" title="{bs:get-item-uri(concat($item, $id-position))}"></abbr>--> @@ -495,16 +535,8 @@ then ($item/vra:work/@id) else ($item/vra:image/vra:relationSet/vra:relation/@relids) ) - let $imageId := if ( exists($item/vra:work) ) - then ( - if( exists($item/vra:work/vra:relationSet/vra:relation/@pref[.='true']) ) - then ( $item/vra:work/vra:relationSet/vra:relation[@pref='true']/@relids ) - else ( $item/vra:work/vra:relationSet/vra:relation[1]/@relids) - ) else ($item/vra:image/@id) - - let $workdir := if(contains($collection, 'VRA_images')) then ( functx:substring-before-last($collection, "/")) else ($collection) - let $workdir := if(ends-with($workdir,'/')) then ($workdir) else ($workdir || '/') - let $imagepath := $workdir || 'VRA_images/' || $imageId || ".xml" + let $workdir := if(contains($collection, 'VRA_images')) then ( functx:substring-before-last($collection, "/")) else ($collection) + let $workdir := if(ends-with($workdir,'/')) then ($workdir) else ($workdir || '/') let $upload-button:= @@ -522,7 +554,7 @@ then ( if (xmldb:collection-available("/db/apps/ziziphus/") and name($item) eq 'vra') then ( - <a target="_new" href="/exist/apps/ziziphus/record.html?id={$id}&workdir={$workdir}&imagepath={$imagepath}"> + <a target="_new" href="/exist/apps/ziziphus/record.html?id={$id}&workdir={$workdir}"> <img title="Edit VRA Record" src="theme/images/page_edit.png"/> </a> ) else (), @@ -670,43 +702,14 @@ declare function bs:retrieve($start as xs:int, $count as xs:int) { let $mode := request:get-parameter("mode", "gallery") - (:let $log := util:log("DEBUG", ("##$mode): ", $mode)):) - (:let $log := util:log("DEBUG", ("##$count0): ", $count)):) - (:let $log := util:log("DEBUG", ("##$start): ", $start)):) let $cached := session:get-attribute("mods:cached") - (:let $log := util:log("DEBUG", ("##$cached): ", $cached)):) - (:let $log := util:log("DEBUG", ("##$cached-count): ", count($cached))):) - let $stored := session:get-attribute("personal-list") - (:let $log := util:log("DEBUG", ("##$stored): ", $stored)):) - (:let $log := util:log("DEBUG", ("##$stored-count): ", count($stored))):) - - let $cached-vra-work := $cached[vra:work] - (:let $log := util:log("DEBUG", ("##$cached-vra-work-count): ", count($cached-vra-work))):) - let $cached-vra-image := $cached[vra:image] - (:let $log := util:log("DEBUG", ("##$cached-vra-image-count): ", count($cached-vra-image))):) - let $cached-vra-image-work := $cached-vra-image/vra:image/vra:relationSet/vra:relation[@type eq "imageOf"]/@relids - (:let $log := util:log("DEBUG", ("##$cached-vra-image-work-ids): ", string-join($cached-vra-image-work, '|||'))):) - (:let $log := util:log("DEBUG", ("##$cached-vra-image-work-ids-count): ", count($cached-vra-image-work))):) - let $cached-vra-image-work := collection($config:mods-root)//vra:work[@id = $cached-vra-image-work]/.. - (:let $log := util:log("DEBUG", ("##$cached-vra-image-work): ", $cached-vra-image-work)):) - (:let $log := util:log("DEBUG", ("##$cached-vra-image-work-count): ", count($cached-vra-image-work))):) - let $cached-vra := ($cached-vra-work union $cached-vra-image-work) - (:let $log := util:log("DEBUG", ("##$cached-vra-count): ", count($cached-vra))):) - let $cached-mods := $cached[mods:titleInfo] - (:let $log := util:log("DEBUG", ("##$cached-mods-count): ", count($cached-mods))):) - let $cached-tei := $cached[tei:teiHeader] - (:let $log := util:log("DEBUG", ("##$cached-tei-count): ", count($cached-tei))):) - let $cached := ($cached-vra, $cached-mods, $cached-tei) + let $stored := session:get-attribute("personal-list") let $total := count($cached) - (:let $log := util:log("DEBUG", ("##$total): ", $total)):) - let $available := if ($start + $count gt $total) then $total - $start + 1 else $count - (:let $log := util:log("DEBUG", ("##$available): ", $available)):) - (:let $log := util:log("DEBUG", ("##$count): ", $count)):) return (: A single entry is always shown in table view for now :) if ($mode eq "ajax" and $count eq 1) |