From 9358ac3f3fd26ec743c7aaa2245cdbb7bbe9fced Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Mon, 2 Mar 2015 18:42:52 +0100 Subject: Second Commit --- inc/user.inc.php | 13 ++++++++ modules/login.inc.php | 18 ++++++++++ modules/main.inc.php | 19 ++++++++--- style/default.css | 76 ++++++++++++++++++++++++++++++++++++++----- templates/login/_page.html | 7 ++++ templates/main-menu.html | 7 +--- templates/main/_page.html | 3 +- templates/main/deploy.html | 52 +++++++++++++++++++++-------- templates/main/guest.html | 7 ++++ templates/main/logged-in.html | 23 +++++++++++++ 10 files changed, 190 insertions(+), 35 deletions(-) create mode 100644 modules/login.inc.php create mode 100644 templates/login/_page.html create mode 100644 templates/main/guest.html create mode 100644 templates/main/logged-in.html diff --git a/inc/user.inc.php b/inc/user.inc.php index 30630d4..f023ae7 100644 --- a/inc/user.inc.php +++ b/inc/user.inc.php @@ -28,6 +28,11 @@ class User return self::$user !== false && self::$isShib === false; } + public static function getData() + { + return self::$user; + } + public static function getName() { if (!self::isLoggedIn()) @@ -60,6 +65,14 @@ class User return $org['organizationid']; } + public static function getOrganizationName() + { + $org = self::getOrganization(); + if (!isset($org['name'])) + return false; + return $org['name']; + } + public static function getRemoteOrganizationId() { if (empty(self::$user['organization'])) diff --git a/modules/login.inc.php b/modules/login.inc.php new file mode 100644 index 0000000..517ce4e --- /dev/null +++ b/modules/login.inc.php @@ -0,0 +1,18 @@ + User::getLastName(), - )); + Render::addTemplate('main/_page'); if (User::isLoggedIn()) { // Logged in user -- if (User::getOrganization() !== false) { // Organization is known, show signup form if (User::isShibbolethAuth() && !User::isInDatabase()) { - Render::addTemplate('main/deploy'); + // User comes via Shibboleth and is not known yet + $data = User::getData(); + $data['organization'] = User::getOrganizationName(); + Render::addTemplate('main/deploy', $data); + } else if (User::isInDatabase()) { + // User is known from DB at least + Render::addTemplate('main/logged-in'); } } else if (User::getRemoteOrganizationId() !== false) { + // Organization is not known, see if we at least have an idea Message::addWarning('Ihre Hochschule/Einrichtung {{0}} ist leider nicht bekannt. Bitte kontaktieren Sie den Support.', User::getRemoteOrganizationId()); + } else { + // No idea where the user is coming from + Message::addError('Ihr IdP sendet leider keine Informationen über Ihre Hochschul-/Einrichtungszugehörigkeit'); } + } else { + // Guest + Render::addTemplate('main/guest'); } } diff --git a/style/default.css b/style/default.css index 9fe8fa2..07e8a44 100644 --- a/style/default.css +++ b/style/default.css @@ -1,19 +1,71 @@ body { - padding-top: 70px; - padding-bottom: 10px; + padding-top: 70px; + padding-bottom: 10px; +} + +p { + font-size: 110%; +} + +.form-signin { + max-width: 330px; + padding: 15px; + margin: 0 auto; +} +.form-signin .form-signin-heading, +.form-signin .checkbox { + margin-bottom: 10px; +} +.form-signin .checkbox { + font-weight: normal; +} +.form-signin .form-control, +.form-adduser .form-control { + position: relative; + font-size: 16px; + height: auto; + padding: 10px; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} +.form-control:focus { + z-index: 2; +} +.form-signin input[type="text"] { + margin-bottom: -1px; + border-bottom-left-radius: 0; + border-bottom-right-radius: 0; +} +.form-signin input[type="password"] { + margin-bottom: 10px; + border-top-left-radius: 0; + border-top-right-radius: 0; } .form-narrow { - max-width: 600px; - padding: 10px; - margin: 0 auto; + max-width: 600px; + padding: 10px; + margin: 0 auto; } -.form-narrow .input-group { +.form-narrow > .input-group, .form-narrow > .group-group { margin-bottom: 2em; } -.form-control:focus { - z-index: 2; +.group-group .input-group-addon, .group-group, .form-control { + border-radius: 0; +} +.group-group .input-group:first-child .input-group-addon { + border-top-left-radius: 4px; +} +.group-group .input-group:first-child .form-control { + border-top-right-radius: 4px; +} +.group-group .input-group:last-child .input-group-addon { + border-bottom-left-radius: 4px; +} +.group-group .input-group:last-child .form-control { + border-bottom-right-radius: 4px; } .slx-ga { @@ -37,9 +89,15 @@ body { padding-bottom: 2px; } -.slx-bold { +.linkbox { + margin-bottom: 5px; +} +.linkbox a { font-weight: bold; } +.linkbox div { + font-style: italic; +} .slx-ellipsis { text-overflow: ellipsis; diff --git a/templates/login/_page.html b/templates/login/_page.html new file mode 100644 index 0000000..36dcb0f --- /dev/null +++ b/templates/login/_page.html @@ -0,0 +1,7 @@ +
+

Mit Testaccount anmelden

+ + + + +
diff --git a/templates/main-menu.html b/templates/main-menu.html index 29ded4b..721c0bb 100644 --- a/templates/main-menu.html +++ b/templates/main-menu.html @@ -10,11 +10,6 @@ bwLehrstuhl diff --git a/templates/main/_page.html b/templates/main/_page.html index 2e5525c..521c01a 100644 --- a/templates/main/_page.html +++ b/templates/main/_page.html @@ -1,3 +1,2 @@ -

Guten Morgen, Chefingenieur Dr. {{user}}

- +

Willkommen zu bwLehrpool

diff --git a/templates/main/deploy.html b/templates/main/deploy.html index 976d2b0..c1b9bbf 100644 --- a/templates/main/deploy.html +++ b/templates/main/deploy.html @@ -1,6 +1,6 @@ -
-
- + + +

Hier können Sie sich für den bwLehrpool-Dienst freischalten. Da die Nutzung dieses Dienstes @@ -25,18 +25,42 @@

-
- -
- -
+

+ Sofern Sie am landesweiten VM-Austausch teilnehmen, werden Sie für andere Dozenten + über diese Daten auffindbar sein. Andernfalls werden diese Daten lediglich auf den + bwLehrpool-Satelliten-Server Ihrer eigenen Einrichtung übertragen. Sollten Sie auch + damit nicht einverstanden sein, schicken Sie die Registrierung bitte nicht ab. +

+
- - Vorname - - + + Einrichtung + + {{organization}} +
+
+ + Vorname + + {{firstname}}
+
+ + Nachname + + {{lastname}} +
+
+ + Mail + + {{email}} +
+
+ +
+
- -
\ No newline at end of file +
+ diff --git a/templates/main/guest.html b/templates/main/guest.html new file mode 100644 index 0000000..76b77ab --- /dev/null +++ b/templates/main/guest.html @@ -0,0 +1,7 @@ +
+ Sie sind nicht authentifiziert. Bitte wählen Sie: + +
diff --git a/templates/main/logged-in.html b/templates/main/logged-in.html new file mode 100644 index 0000000..a02c90e --- /dev/null +++ b/templates/main/logged-in.html @@ -0,0 +1,23 @@ +
+

+ Willkommen im bwLehrpool Web Interface. Sie haben sich bereits für den + bwLehrpool-Service registriert. Sie haben folgende Möglichkeiten: +

+ + +
-- cgit v1.2.3-55-g7522