From f0d0de378465e1cf91e6becb272413c42af5c4b4 Mon Sep 17 00:00:00 2001 From: Chris Hallberg <crhallberg@gmail.com> Date: Tue, 3 Dec 2013 12:18:31 -0500 Subject: [PATCH] Bootstrap styling for ChoiceAuth. --- themes/bootprint/css/style.css | 21 ++++++++++++- themes/bootstrap/css/styles.css | 1 + .../templates/Auth/AbstractBase/login.phtml | 30 +++++++++++-------- .../Auth/AbstractBase/loginfields.phtml | 12 ++++++++ .../templates/Auth/ChoiceAuth/login.phtml | 11 +++++++ .../templates/Auth/Database/logindesc.phtml | 2 ++ .../templates/Auth/Shibboleth/login.phtml | 3 ++ .../templates/Auth/Shibboleth/logindesc.phtml | 2 ++ .../templates/myresearch/login.phtml | 17 +---------- 9 files changed, 70 insertions(+), 29 deletions(-) create mode 100644 themes/bootstrap/css/styles.css create mode 100644 themes/bootstrap/templates/Auth/AbstractBase/loginfields.phtml create mode 100644 themes/bootstrap/templates/Auth/ChoiceAuth/login.phtml create mode 100644 themes/bootstrap/templates/Auth/Database/logindesc.phtml create mode 100644 themes/bootstrap/templates/Auth/Shibboleth/login.phtml create mode 100644 themes/bootstrap/templates/Auth/Shibboleth/logindesc.phtml diff --git a/themes/bootprint/css/style.css b/themes/bootprint/css/style.css index 958c8e1b734..66588ba559a 100644 --- a/themes/bootprint/css/style.css +++ b/themes/bootprint/css/style.css @@ -155,4 +155,23 @@ select, .btn:not(.btn-link){vertical-align:top} #download-button:active {background:linear-gradient(to bottom, #508033 0%,#72A255 100%)} .inspector_container {margin-top:6px} .siblings-form {margin:3px auto} -.table.details {font-size:10px;border-bottom:1px solid #DDD} \ No newline at end of file +.table.details {font-size:10px;border-bottom:1px solid #DDD} + +/* --- ChoiceAuth --- */ +.authmethod0 { + width:47%; + float:left; + padding:1%; + border-right:1px solid rgb(204, 204, 204); +} +.authmethod1 { + width:47%; + float:left; + padding:1%; + border-left:1px solid rgb(204, 204, 204); + margin:-1px; /* keep the borders on top of one another; longest one will win */ +} +#authcontainer { + float:left; + width:100%; +} diff --git a/themes/bootstrap/css/styles.css b/themes/bootstrap/css/styles.css new file mode 100644 index 00000000000..60c1dfbd52b --- /dev/null +++ b/themes/bootstrap/css/styles.css @@ -0,0 +1 @@ +body {margin-top:1em} \ No newline at end of file diff --git a/themes/bootstrap/templates/Auth/AbstractBase/login.phtml b/themes/bootstrap/templates/Auth/AbstractBase/login.phtml index ef6f561fcf7..5b4bfeaa72a 100644 --- a/themes/bootstrap/templates/Auth/AbstractBase/login.phtml +++ b/themes/bootstrap/templates/Auth/AbstractBase/login.phtml @@ -1,12 +1,18 @@ -<div class="control-group"> - <label class="control-label" for="login_username"><?=$this->transEsc('Username')?>:</label> - <div class="controls"> - <input id="login_username" type="text" name="username" value="<?=$this->escapeHtml($this->request->get('username'))?>"/> - </div> -</div> -<div class="control-group"> - <label class="control-label" for="login_password"><?=$this->transEsc('Password')?>:</label> - <div class="controls"> - <input id="login_password" type="password" name="password"/> - </div> -</div> \ No newline at end of file +<? $account = $this->auth()->getManager(); ?> +<? $sessionInitiator = $account->getSessionInitiator($this->serverUrl($this->url('myresearch-home'))); ?> +<? if (!$sessionInitiator): // display default login form if no login URL provided ?> + <form method="post" class="form-horizontal" action="<?=$this->url('myresearch-home')?>" name="loginForm" id="loginForm"> + <?=$this->auth()->getLoginFields()?> + <input type="hidden" name="auth_method" value="<?=$this->auth()->getActiveAuthMethod()?>"> + <div class="control-group"> + <div class="controls"> + <input class="btn btn-primary" type="submit" name="processLogin" value="Login"> + <? if ($account->supportsCreation()): ?> + <a class="btn btn-link" href="/digitaldev/MyResearch/Account">Create New Account</a> + <? endif; ?> + </div> + </div> + </form> +<? else: ?> + <a href="<?=$this->escapeHtml($sessionInitiator)?>"><?=$this->transEsc("Institutional Login")?></a> +<? endif; ?> diff --git a/themes/bootstrap/templates/Auth/AbstractBase/loginfields.phtml b/themes/bootstrap/templates/Auth/AbstractBase/loginfields.phtml new file mode 100644 index 00000000000..ef6f561fcf7 --- /dev/null +++ b/themes/bootstrap/templates/Auth/AbstractBase/loginfields.phtml @@ -0,0 +1,12 @@ +<div class="control-group"> + <label class="control-label" for="login_username"><?=$this->transEsc('Username')?>:</label> + <div class="controls"> + <input id="login_username" type="text" name="username" value="<?=$this->escapeHtml($this->request->get('username'))?>"/> + </div> +</div> +<div class="control-group"> + <label class="control-label" for="login_password"><?=$this->transEsc('Password')?>:</label> + <div class="controls"> + <input id="login_password" type="password" name="password"/> + </div> +</div> \ No newline at end of file diff --git a/themes/bootstrap/templates/Auth/ChoiceAuth/login.phtml b/themes/bootstrap/templates/Auth/ChoiceAuth/login.phtml new file mode 100644 index 00000000000..36740f43f21 --- /dev/null +++ b/themes/bootstrap/templates/Auth/ChoiceAuth/login.phtml @@ -0,0 +1,11 @@ +<p>Please choose a login method:</p> +<div id="authcontainer"> +<? foreach ($this->auth()->getManager()->getAuthClasses() as $loop=>$class):?> + <div class="authmethod<?=$loop?>"> + <? $this->auth()->setActiveAuthClass($class) ?> + <?=$this->auth()->getLoginDesc($method) ?> + <?=$this->auth()->getLogin($method) ?> + <? $this->auth()->setActiveAuthClass('ChoiceAuth') ?> + </div> +<? endforeach ?> +</div> \ No newline at end of file diff --git a/themes/bootstrap/templates/Auth/Database/logindesc.phtml b/themes/bootstrap/templates/Auth/Database/logindesc.phtml new file mode 100644 index 00000000000..edb066d1967 --- /dev/null +++ b/themes/bootstrap/templates/Auth/Database/logindesc.phtml @@ -0,0 +1,2 @@ +<h3>Local login</h3> +<p>Enter the username and password you created for this site.</p> diff --git a/themes/bootstrap/templates/Auth/Shibboleth/login.phtml b/themes/bootstrap/templates/Auth/Shibboleth/login.phtml new file mode 100644 index 00000000000..94f44ef3d93 --- /dev/null +++ b/themes/bootstrap/templates/Auth/Shibboleth/login.phtml @@ -0,0 +1,3 @@ +<? $account = $this->auth()->getManager(); ?> +<? $sessionInitiator = $account->getSessionInitiator($this->serverUrl($this->url('myresearch-home'))); ?> +<a href="<?=$this->escapeHtml($sessionInitiator)?>"><?=$this->transEsc("Institutional Login")?></a> diff --git a/themes/bootstrap/templates/Auth/Shibboleth/logindesc.phtml b/themes/bootstrap/templates/Auth/Shibboleth/logindesc.phtml new file mode 100644 index 00000000000..6f36b6298d3 --- /dev/null +++ b/themes/bootstrap/templates/Auth/Shibboleth/logindesc.phtml @@ -0,0 +1,2 @@ +<h3>Institutional login</h3> +<p>Enter your campus-wide username and password.</p> diff --git a/themes/bootstrap/templates/myresearch/login.phtml b/themes/bootstrap/templates/myresearch/login.phtml index b9299dcc502..70a305930a5 100644 --- a/themes/bootstrap/templates/myresearch/login.phtml +++ b/themes/bootstrap/templates/myresearch/login.phtml @@ -28,20 +28,5 @@ <? if ($hideLogin): ?> <div class="alert alert-error"><?=$this->transEsc('login_disabled')?></div> <? else: ?> - <? $sessionInitiator = $account->getSessionInitiator($this->serverUrl($this->url('myresearch-home'))); ?> - <? if (!$sessionInitiator): // display default login form if no login URL provided ?> - <form method="post" action="<?=$this->url('myresearch-home')?>" name="loginForm" id="loginForm" class="form-horizontal"> - <?=$this->auth()->getLoginFields()?> - <div class="control-group"> - <div class="controls"> - <input class="btn btn-primary" type="submit" name="processLogin" value="<?=$this->transEsc('Login')?>"/> - <? if ($account->supportsCreation()): ?> - <a class="btn btn-link" href="<?=$this->url('myresearch-account')?>"><?=$this->transEsc('Create New Account')?></a> - <? endif; ?> - </div> - </div> - </form> - <? else: ?> - <a href="<?=$this->escapeHtml($sessionInitiator)?>"><?=$this->transEsc("Institutional Login")?></a> - <? endif; ?> + <?=$this->auth()->getLogin()?> <? endif; ?> -- GitLab