From 17d5f3f373d739e938176be23c4f47368aeba2de Mon Sep 17 00:00:00 2001
From: Jonathan Druart <jonathan.druart@biblibre.com>
Date: Tue, 8 Apr 2014 16:48:31 +0200
Subject: [PATCH] [SIGNED OFF] Bug 12046: Authentication using CAS - bootstrap

At the OPAC, if the bootstrap theme is used, the modal dialog
does not allow to use the CAS authentication.  A link should be
displayed, as on the opac-user.pl page (and on the prog theme).

Test plan:
- set opacthemes to bootstrap
- enable the casAuthentication pref
- fill the casServerUrl pref with "something"
- go on the opac home page
- click on the "log in" link (top right)
- you should see 2 login blocks 'CAS' and 'Local'

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>

NOTE: Without CAS properly set up, the URL will actually be
      empty for the CAS' click here to login link.
COMMENT: Though this does do what it says it does, would it
         no be better to redirect to the opac-user page and
         get the old page loaded up as before, so not just
         CAS but all potential authentication mechanisms will
         work? Increasing the size of the modal seems to
         defeat the purpose of the modal, in my opinion.
---
 .../opac-tmpl/bootstrap/en/includes/masthead.inc   |   25 +++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc
index 1edc244..86f8311 100644
--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc
+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc
@@ -270,8 +270,31 @@
             <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
             <h3 id="modalLoginLabel">Log in to your account</h3>
         </div>
+        [% IF Koha.Preference('casAuthentication') %]
+          <div class="modal-body">
+            <h4>CAS login</h4>
+            <p>If you have a <acronym title="Central Authentication Service">CAS</acronym> account,
+            [% IF Koha.Preference('casServerUrl') %]
+                please <a href="[% casServerUrl %]">click here to login</a>.<p>
+            [% END %]
+
+            [% IF casServersLoop %]
+                Please choose against which one you would like to authenticate: </p>
+                <ul>
+                    [% FOREACH casServer IN casServersLoop %]
+                    <li><a href="[% casServer.value %]">[% casServer.name %]</a></li>
+                    [% END %]
+                </ul>
+            [% END %]
+
+          </div>
+        [% END # / IF casAuthentication %]
         <form action="/cgi-bin/koha/opac-user.pl" method="post" name="auth" id="modalAuth">
             <div class="modal-body">
+              [% IF Koha.Preference('casAuthentication') %]
+                <h4>Local login</h4>
+                <p>If you do not have a CAS account, but a local account, you can still log in: </p>
+              [% END %]
                     <input type="hidden" name="koha_login_context" value="opac" />
                     <fieldset class="brief">
                         <label for="muserid">Login:</label><input type="text" id="muserid" name="userid" />
@@ -284,4 +307,4 @@
                 <a href="#" data-dismiss="modal" aria-hidden="true" class="cancel">Cancel</a>
             </div>
         </form> <!-- /#auth -->
-    </div>  <!-- /#modalAuth  -->
\ No newline at end of file
+    </div>  <!-- /#modalAuth  -->
-- 
1.7.9.5