rough cut at integrating ChiliFresh reviews with OPAC search results and record detai...
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 21 Jun 2010 20:41:59 +0000 (20:41 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 21 Jun 2010 20:41:59 +0000 (20:41 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@16770 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/chilifresh.xml [new file with mode: 0644]
Open-ILS/web/opac/skin/default/xml/rdetail/rdetail_extras.xml
Open-ILS/web/opac/skin/default/xml/result/result_table.xml

index 8af53a5..7adfa00 100644 (file)
@@ -470,6 +470,16 @@ function _rdetailDraw(r) {
 
        // grab added content 
        acCollectData(cleanISBN(record.isbn()), rdetailhandleAC);
+
+    // different type of added content
+    var currentISBN = cleanISBN(record.isbn());
+    if (chilifresh && currentISBN) {
+        $('chilifreshReviewLink').setAttribute('id','isbn_'+currentISBN);
+        $('chilifreshReviewResult').setAttribute('id','chili_review_'+currentISBN);
+        unHideMe($('rdetail_reviews_link'));
+        unHideMe($('rdetail_chilifresh_reviews'));
+        chili_init();
+    }
 }
 
 
index c31f399..743420a 100644 (file)
@@ -15,7 +15,7 @@ if( findCurrentPage() == MRESULT || findCurrentPage() == RRESULT ) {
        G.evt.result.copyCountsReceived.push(resultDisplayCopyCounts);
        G.evt.result.allRecordsReceived.push(resultBuildCaches, resultDrawSubjects, 
       resultDrawAuthors, resultDrawSeries, function(){unHideMe($('result_info_2'))},
-         fetchGoogleBooksLink);
+         fetchGoogleBooksLink,fetchChiliFreshReviews);
 
        attachEvt('result','lowHits',resultLowHits);
        attachEvt('result','zeroHits',resultZeroHits);
@@ -453,6 +453,27 @@ function resultDisplayRecord(rec, pos, is_mr) {
         }
     }
 
+    if (currentISBN && chilifresh) {
+        var cfrow = $n(r, "chilifreshReview");
+        if (cfrow) {
+            removeCSSClass( cfrow, 'hide_me' );
+        }
+        var cflink = $n(r, "chilifreshReviewLink");
+        if (cflink) {
+            cflink.setAttribute(
+                'id',
+                'isbn_' + currentISBN
+            );
+        }
+        var cfdiv = $n(r, "chilifreshReviewResult");
+        if (cfdiv) {
+            cfdiv.setAttribute(
+                'id',
+                'chili_review_' + currentISBN
+            )
+        }
+    }
+
 /*
        try {
                var rank = parseFloat(ranks[pos + getOffset()]);
@@ -650,6 +671,12 @@ function fetchGoogleBooksLink () {
     }
 }
 
+function fetchChiliFreshReviews() {
+    if (chilifresh) {
+        chili_init();
+    }
+}
+
 function resultPageIsDone(pos) {
 
        return (recordsHandled == getDisplayCount() 
diff --git a/Open-ILS/web/opac/skin/default/xml/chilifresh.xml b/Open-ILS/web/opac/skin/default/xml/chilifresh.xml
new file mode 100644 (file)
index 0000000..7cbc40c
--- /dev/null
@@ -0,0 +1,6 @@
+<!-- Specify your ChiliFresh account # below to enable ChiliFresh integration with the OPAC -->
+
+<!--#set var='OILS_CHILIFRESH_ACCOUNT' value=""-->
+<!--#set var='OILS_CHILIFRESH_PROFILE' value=""-->
+<!--#set var='OILS_CHILIFRESH_URL' value="http://chilifresh.com/on-site/js/evergreen.js"-->
+
index 96a8fdc..06a27b5 100644 (file)
                                <div name='review_text' style='width: 100%; padding: 15px; border: 1px solid #E0E0E0;'> </div>
                        </div>
                        -->
+            <div id='rdetail_chilifresh_reviews' class='hide_me'>
+                <div id='chilifreshReviewLink' name='chilifreshReviewLink' class='chili_review'></div>
+                <div id='chilifreshReviewResult' name='chilifreshReviewResult' style='display:none'></div>
+            </div>
                </div>
                
                <div id='rdetail_toc_div' class='rdetail_extras_div hide_me'> </div>
        <div id='rdetail_preview_full_text' class='hide_me'>&rdetail.extras.preview.fulltext;</div>
        <div id='rdetail_preview_title' class='hide_me'>&rdetail.extras.preview.title;</div>
        <div id='rdetail_preview_badge' class='hide_me'>&rdetail.extras.preview.badge;</div>
+
+    <!-- ChiliFresh setup -->
+    <!--#include virtual="../chilifresh.xml"-->
+    <script language='javascript' type='text/javascript'>
+        var chilifresh = '<!--#echo var="OILS_CHILIFRESH_ACCOUNT"-->';
+    </script>
+    <!--if expr="$OILS_CHILIFRESH_ACCOUNT"-->
+        <input type="hidden" id="chilifresh_account" name="chilifresh_account"
+            value="<!--#echo var='OILS_CHILIFRESH_ACCOUNT'-->" />
+        <input type="hidden" id="chilifresh_profile" name="chilifresh_profile"
+            value="<!--#echo var='OILS_CHILIFRESH_PROFILE'-->" />
+        <input type="hidden" id="chilifresh_version" name="chilifresh_version" value="onsite_v1" />
+        <input type="hidden" id="chilifresh_type" name="chilifresh_type" value="search" />
+        <script language="javascript" type="text/javascript" src="<!--#echo var='OILS_CHILIFRESH_URL'-->"></script>
+    <!--endif-->
+
 </div>
index 4c66817..5e6d596 100644 (file)
                                                                                <a style='padding-left: 8px;' class='classic_link' name="googleBooks-link">&result.googleBooks.browse;</a>
                                                                        </span>
 
-
+                                    <!-- Placeholder for ChilFresh Review link -->
+                                    <span name="chilifreshReviewLink" class="chili_review"></span>
                                                                </td>
                                                        </tr>
                                                        <tr name="local_callnumber_list" class="result_table_title_cell hide_me">
-                                                               <td>&result.localCallNumbers;
+                                                               <td colspan="2">&result.localCallNumbers;
                                                                        <span type='opac/slot-data+holdings_xml' query='volumes volume' join=", ">
                                         <!-- Because we clone this template table, and IE won't clone <script>
                                              nodes (yes, even when it doesn't understand the type ARG) we need
                                                                        </span>
                                                                </td>
                                                        </tr>
-
+                            <!-- Placeholder for ChiliFresh Review -->
+                            <tr class="hide_me" name="chilifreshReview">
+                                <td></td>
+                                <td valign="top">
+                                        <div name="chilifreshReviewResult" style="display:none"></div>
+                                </td>
+                            </tr>
                                                </tbody>
                                        </table>
                                </td>
                config.names.result.format_pic = 'format_pic'
        </script>
 
+    <!-- ChiliFresh setup -->
+    <!--#include virtual="../chilifresh.xml"-->
+    <script language='javascript' type='text/javascript'>
+        var chilifresh = '<!--#echo var="OILS_CHILIFRESH_ACCOUNT"-->';
+    </script>
+    <!--if expr="$OILS_CHILIFRESH_ACCOUNT"-->
+        <input type="hidden" id="chilifresh_account" name="chilifresh_account"
+            value="<!--#echo var='OILS_CHILIFRESH_ACCOUNT'-->" />
+        <input type="hidden" id="chilifresh_profile" name="chilifresh_profile"
+            value="<!--#echo var='OILS_CHILIFRESH_PROFILE'-->" />
+        <input type="hidden" id="chilifresh_version" name="chilifresh_version" value="onsite_v1" />
+        <input type="hidden" id="chilifresh_type" name="chilifresh_type" value="search" />
+        <script language="javascript" type="text/javascript" src="<!--#echo var='OILS_CHILIFRESH_URL'-->"></script>
+    <!--endif-->
 </div>