From 814b4e5dfa075869fb9fa70f32167184bbd6cf0b Mon Sep 17 00:00:00 2001
From: Jonathan Druart <jonathan.druart@biblibre.com>
Date: Tue, 18 Feb 2014 10:45:56 +0100
Subject: [PATCH] Bug 8992: Interfacing with the Idref webservice - bootstrap
 theme

This patch is the changes for the bootstrap theme at the OPAC.
The test plan is the same as for the first patch.
---
 .../opac-tmpl/bootstrap/en/includes/greybox.inc    |    7 ++
 .../opac-tmpl/bootstrap/en/modules/opac-idref.tt   |   68 ++++++++++++++++++++
 2 files changed, 75 insertions(+)
 create mode 100644 koha-tmpl/opac-tmpl/bootstrap/en/includes/greybox.inc
 create mode 100644 koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-idref.tt

diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/greybox.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/greybox.inc
new file mode 100644
index 0000000..92ef62d
--- /dev/null
+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/greybox.inc
@@ -0,0 +1,7 @@
+<script type="text/javascript">
+    var GB_ROOT_DIR = "[% interface %]/[% theme %]/lib/greybox/";
+</script>
+<script type="text/javascript" src="[% interface %]/[% theme %]/lib/greybox/AJS.js"></script>
+<script type="text/javascript" src="[% interface %]/[% theme %]/lib/greybox/AJS_fx.js"></script>
+<script type="text/javascript" src="[% interface %]/[% theme %]/lib/greybox/gb_scripts.js"></script>
+<link href="[% interface %]/[% theme %]/lib/greybox/gb_styles.css" rel="stylesheet" type="text/css" />
diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-idref.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-idref.tt
new file mode 100644
index 0000000..05255db
--- /dev/null
+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-idref.tt
@@ -0,0 +1,68 @@
+[% INCLUDE 'doc-head-open.inc' %]
+[% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog &rsaquo; Your search IDREF for ppn [% unimarc3 %]
+[% INCLUDE 'doc-head-close.inc' %]
+[% BLOCK cssinclude %]
+  <style type="text/css">ul.ui-tabs-nav li a, ul.ui-tabs-nav li span.a  { padding:0.6em 1em; }</style>
+[% END %]
+
+</head>
+<body>
+<div id="idref">
+  [% IF error %]
+    This ppn is not found on the idref service.
+  [% ELSE %]
+    [% FOREACH role IN content %]
+      <div>
+        <h2 class="role" title="Click to expand this role">[% role.role_name %] ([% role.count %])</h2>
+          <div class="docs">
+            <table>
+              <thead>
+                <th>Citation</th>
+                <th>Koha</th>
+                <th>Sudoc</th>
+              </thead>
+              <tbody>
+                [% FOREACH doc IN role.docs %]
+                  <tr>
+                    <td>[% doc.citation %]</td>
+                    <td><a href="/cgi-bin/koha/opac-search.pl?q=kw,phr=[% doc.ppn %]" target="_blank">Koha</a></td>
+                    <td><a href="http://www.sudoc.fr/[% doc.ppn %]" target="_blank">Sudoc</a></td>
+                  </tr>
+                [% END %]
+              </tbody>
+            </table>
+          </div>
+      </div>
+    [% END %]
+  [% END %]
+</div>
+[% BLOCK jsinclude %]
+[% INCLUDE 'datatables.inc' %]
+<script type="text/javascript">
+  $(document).ready(function (){
+      $("table").dataTable($.extend(true, {}, dataTablesDefaults, {
+          "oLanguage": {
+              "sSearch": _("Search all columns:")
+          },
+          'bFilter': false,
+          'sPaginationType': 'four_button',
+          'aoColumnDefs': [
+              { 'aTargets': [-1, -2], 'bSortable': false }
+          ],
+          'aLengthMenu': [[10, 25, 50, 100, 250, 500, 1000, -1], [10, 25, 50, 100, 250, 500, 1000, _("All")]],
+      }));
+
+      $(".role").click(function(){
+          var docs_node = $(this).parent().find("div.docs");
+          if ( $(docs_node).is(":visible") ) {
+              $(".docs").hide();
+          } else {
+              $(".docs").hide();
+              docs_node.show();
+          }
+      });
+      $(".docs").hide();
+  });
+</script>
+[% END %]
+[% INCLUDE 'opac-bottom.inc' %]
-- 
1.7.10.4