adding unAPI links (JS generated :( ) to the OPAC
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Sat, 4 Mar 2006 07:43:28 +0000 (07:43 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Sat, 4 Mar 2006 07:43:28 +0000 (07:43 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@3258 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/opac/skin/default/js/rdetail.js
Open-ILS/web/opac/skin/default/js/result_common.js
Open-ILS/web/opac/skin/default/xml/header.xml
Open-ILS/web/opac/skin/default/xml/result/result_table.xml

index 69786a8..9c10ce2 100644 (file)
@@ -38,9 +38,32 @@ function rdetailDraw() {
 }
 
 var rdeatilMarcFetched = false;
-function rdetailViewMarc(r) {
+function rdetailViewMarc(r,id) {
        hideMe($('rdetail_extras_loading'));
        $('rdetail_view_marc_box').innerHTML = r.getResultObject();
+
+       var d = new Date();
+
+       /* add the unapi span inside a hidden div */
+       $('rdetail_view_marc_box').insertBefore(
+               elem('div', { class : 'hide_me' }).appendChild(
+                       elem(   'span',
+                               { class : 'unAPI',
+                                 title :
+                                       'tag:open-ils.org,' +
+                                       d.getFullYear() + '-' +
+                                       (1 + d.getMonth()) + '-' +
+                                       d.getDate() +
+                                       ':biblio-record_entry/' + id },
+                                 'tag:open-ils.org,' +
+                                 d.getFullYear() + '-' +
+                                 (1 + d.getMonth()) + '-' +
+                                 d.getDate() +
+                                 ':biblio-record_entry/' + id
+                       )
+               ),
+               $('rdetail_view_marc_box').firstChild
+       );
 }
 
 
@@ -212,7 +235,7 @@ function rdetailShowExtra(type) {
                        unHideMe($('rdetail_extras_loading'));
                        rdetailMarcFetched = true;
                        var req = new Request( FETCH_MARC_HTML, record.doc_id() );
-                       req.callback(rdetailViewMarc); 
+                       req.callback(rdetailViewMarc, record.doc_id()); 
                        req.send();
                        break;
 
index a6de30c..a87fad8 100644 (file)
@@ -254,9 +254,31 @@ function resultDisplayRecord(rec, pos, is_mr) {
        var title_link = $n(r, config.names.result.item_title);
        var author_link = $n(r, config.names.result.item_author);
 
+       var d = new Date();
+
        if( is_mr )  {
                var onlyrec = onlyrecord[ getOffset() + pos ];
                if(onlyrec) {
+                       var unapi_span = $n(r,'unapi');
+                       unapi_span.appendChild(
+                               text(
+                                       normalize( rec.title() ) +
+                                               ' (tag:open-ils.org,' +
+                                               d.getFullYear() + '-' +
+                                               (1 + d.getMonth()) + '-' + 
+                                               d.getDate() + 
+                                               ':biblio-record_entry/' + onlyrec + ')'
+                               )
+                       );
+                       unapi_span.setAttribute(
+                               'title',
+                               'tag:open-ils.org,' +
+                                       d.getFullYear() + '-' +
+                                       (1 + d.getMonth()) + '-' + 
+                                       d.getDate() + 
+                                       ':biblio-record_entry/' + onlyrec
+                       );
+
                        var args = {};
                        args.page = RDETAIL;
                        args[PARAM_OFFSET] = 0;
@@ -267,6 +289,26 @@ function resultDisplayRecord(rec, pos, is_mr) {
                        title_link.appendChild(text(normalize(truncate(rec.title(), 65))));
                        
                } else {
+                       var unapi_span = $n(r,'unapi');
+                       unapi_span.appendChild(
+                               text(
+                                       normalize( rec.title() ) +
+                                               ' (tag:open-ils.org,' +
+                                               d.getFullYear() + '-' +
+                                               (1 + d.getMonth()) + '-' + 
+                                               d.getDate() + 
+                                               ':metabib-metarecord/' + rec.doc_id() + ')'
+                               )
+                       );
+                       unapi_span.setAttribute(
+                               'title'
+                               'tag:open-ils.org,' +
+                                       d.getFullYear() + '-' +
+                                       (1 + d.getMonth()) + '-' + 
+                                       d.getDate() + 
+                                       ':biblio-record_entry/' + rec.doc_id()
+                       );
+
                        buildTitleLink(rec, title_link); 
                        var args = {};
                        args.page = RRESULT;
@@ -276,6 +318,26 @@ function resultDisplayRecord(rec, pos, is_mr) {
                }
 
        } else {
+               var unapi_span = $n(r,'unapi');
+               unapi_span.appendChild(
+                       text(
+                               normalize( rec.title() ) +
+                                       ' (tag:open-ils.org,' +
+                                       d.getFullYear() + '-' +
+                                       (1 + d.getMonth()) + '-' + 
+                                       d.getDate() + 
+                                       ':biblio-record_entry/' + rec.doc_id() + ')'
+                       )
+               );
+               unapi_span.setAttribute(
+                       'title',
+                       'tag:open-ils.org,' +
+                               d.getFullYear() + '-' +
+                               (1 + d.getMonth()) + '-' + 
+                               d.getDate() + 
+                               ':biblio-record_entry/' + rec.doc_id()
+               );
+
                buildTitleDetailLink(rec, title_link); 
                var args = {};
                args.page = RDETAIL;
index 76bb10f..5aa7d35 100644 (file)
@@ -4,6 +4,7 @@
        <!--#include virtual="common/css_common.xml"-->
 
        <title>&<!--#echo var="OILS_TITLE"-->;</title>
+       <link rel="meta" type="application/xml" title="unAPI" href="../../../../extras/unapi"/>
 
        <!--#if expr="$slimpac!='true'"-->
                <!--#include virtual="common/js_common.xml"-->
index 3c5f20c..ffa5bba 100644 (file)
                                                                </td>
 
                                                                <td class='result_table_title_cell' name='result_table_title_cell'>
+                                                                       <!-- Title goes here -->
                                                                        <a title="View titles for this record" name='item_title' class='search_link'> 
                                                                                <!-- Title goes here -->
                                                                        </a>
+                                                                       <!-- Empty span used for creating unAPI links -->
+                                                                       <span name="unapi" class="unapi-uri hide_me">
+                                                                               <!-- unAPI URI goes here -->
+                                                                       </span>
                                                                </td>
 
                                                                <!-- Copy this td for each copy count appended -->