From 3afeec5a281326758bf791c8c5a56823bbec4b27 Mon Sep 17 00:00:00 2001
From: "Hahn Axel (hahn)" <axel.hahn@iml.unibe.ch>
Date: Thu, 16 Mar 2017 16:06:29 +0100
Subject: [PATCH] - overview - add headline; - / redirects to /deployment/ -
 login page redirects to last page before login

---
 config/lang/de.json                           |  1 +
 config/lang/en.json                           |  1 +
 public_html/deployment/index.php              |  2 +-
 public_html/deployment/pages/act_login.php    | 19 ++++++-
 public_html/deployment/pages/act_overview.php | 56 +++++++++----------
 public_html/index.php                         |  3 +-
 6 files changed, 49 insertions(+), 33 deletions(-)

diff --git a/config/lang/de.json b/config/lang/de.json
index d24fa994..b9245fe6 100644
--- a/config/lang/de.json
+++ b/config/lang/de.json
@@ -282,6 +282,7 @@
     "versioncontrol": "Versionskontrolle",
     "versions": "Versionen",
     "warning": "WARNUNG",
+    "way-of-packages": "Weg der Pakete",
     
     "onhold": "Queue",
     "ready2install" : "Puppet",
diff --git a/config/lang/en.json b/config/lang/en.json
index 5ea90cf4..003cb0a5 100644
--- a/config/lang/en.json
+++ b/config/lang/en.json
@@ -284,6 +284,7 @@
     "versioncontrol": "Version control",
     "versions": "Versions",
     "warning": "WARNING",
+    "way-of-packages": "Weg der Pakete",
     
     "onhold": "Queue",
     "ready2install" : "Puppet",
diff --git a/public_html/deployment/index.php b/public_html/deployment/index.php
index a076b96b..278ab3a2 100644
--- a/public_html/deployment/index.php
+++ b/public_html/deployment/index.php
@@ -102,7 +102,7 @@ $sPhpOut = '
         ' . $sPhpOut . '
     </div>
     <div id="footer">
-        IML Deployment &copy; ' . date("Y") . ' <a href="https://gitlab.iml.unibe.ch/admins/imldeployment/tree/master" target="_blank">Institut f&uuml;r medizinische Lehre; Universit&auml;t Bern</a>
+        IML Deployment &copy; 2015-' . date("Y") . ' <a href="https://gitlab.iml.unibe.ch/admins/imldeployment/tree/master" target="_blank">Institut f&uuml;r medizinische Lehre; Universit&auml;t Bern</a>
     </div>
     '.$oCLog->render();
 
diff --git a/public_html/deployment/pages/act_login.php b/public_html/deployment/pages/act_login.php
index 57fe7d23..f0ca82f0 100644
--- a/public_html/deployment/pages/act_login.php
+++ b/public_html/deployment/pages/act_login.php
@@ -33,7 +33,13 @@ if (!$oUser->getUsername() && array_key_exists('user', $aParams)) {
 
     // if user is logged in and credentials were sent: reload to remove post vars
     if ($oUser->getUsername() && array_key_exists('user', $aParams)) {
-        header('Location: ?');
+        if (array_key_exists("goback", $_SESSION)){
+            $sUrl=$_SESSION["goback"];
+            unset($_SESSION["goback"]);
+        } else {
+            $sUrl='?';
+        }
+        header("location: $sUrl");
     }
 
 // ----------------------------------------------------------------------
@@ -57,10 +63,19 @@ if ($oUser->getUsername()) {
                 . ' ' . aPrjHome() . ' '
                 . '<a href="?logoff=1" class="btn btn-default btn-danger"><span class="glyphicon glyphicon-off"></span> ' . t('logoff') . '</a>'
             
-                . '<br><br>INFO: <pre style="">roles:<br>' . print_r($oUser->getUserPermission(), true) . '</pre>'
+                // . '<br><br>INFO: <pre style="">roles:<br>' . print_r($oUser->getUserPermission(), true) . '</pre>'
             . '</p>'
             . '</div>';
 } else {
+    if (!array_key_exists("goback", $_SESSION) || true){
+        $sUrlback=$_SERVER["HTTP_REFERER"];
+        if(
+           strpos($sUrlback, $_SERVER["SERVER_NAME"])>0
+           && !strpos($sUrlback, '/all/login/')
+        ){
+            $_SESSION["goback"]=$sUrlback;
+        }
+    }
     $i = 0;
     require_once ("./classes/formgen.class.php");
 
diff --git a/public_html/deployment/pages/act_overview.php b/public_html/deployment/pages/act_overview.php
index d1e78ff1..66bf174d 100644
--- a/public_html/deployment/pages/act_overview.php
+++ b/public_html/deployment/pages/act_overview.php
@@ -37,36 +37,34 @@ if (!array_key_exists("prj", $aParams)) {
         $sListOfBranches.='<li title="'.$aBranch['revision'].'">'.$aBranch['label'] . '</li>';
     }
     $sListOfBranches.='</ol>';
-    $sOut = '
-        ' . $oPrj->renderVisual() . '
-        <div style="clear: both;"></div>
-        
+    $sOut = '<h3 id="h3visual">' . t("way-of-packages") . '</h3>
+            ' . $oPrj->renderVisual() . '
+            <div style="clear: both;"></div>
 
-        <h3 id="h3repo">' . t("repositoryinfos") . '</h3>
-            <div style="max-width: 40em;">
-            ' . $oPrj->renderRepoInfo() . '
-            ' . $sListOfBranches . '
-            ' . ($oPrj->canAcceptPhase() ? '<br>'.$oPrj->renderLink("build") : '') . '
-            </div>
-        
-        <h3 id="h3versions">' . t("packages") . '</h3>
-        ' . $oPrj->renderVersionUsage();
 
-    if ($oPrj->getActivePhases()) {
-        $sOut.='
-            <h3 id="h3phases">' . t("phases") . '</h3>
-                <p>' . t("page-overview-phase-infos") . '</p>
-                ' . $oPrj->renderPhaseInfo() . '
-            ';
-    } else {
-        $sOut.='<h3 id="h3phases">' . t("phases") . '</h3>'
-                . $oPrj->getBox("info", t("page-overview-no-phase")) .
-                $oPrj->renderLink("setup");
-    }
-    $sOut .= '<div style="clear: both"></div>
-            <div id="navbuttom">' . aGotop() . aHome() . '</div>';
+            <h3 id="h3repo">' . t("repositoryinfos") . '</h3>
+                <div style="max-width: 40em;">
+                ' . $oPrj->renderRepoInfo() . '
+                ' . $sListOfBranches . '
+                ' . ($oPrj->canAcceptPhase() ? '<br>'.$oPrj->renderLink("build") : '') . '
+                </div>
+
+            <h3 id="h3versions">' . t("packages") . '</h3>
+            ' . $oPrj->renderVersionUsage();
+
+        if ($oPrj->getActivePhases()) {
+            $sOut.='
+                <h3 id="h3phases">' . t("phases") . '</h3>
+                    <p>' . t("page-overview-phase-infos") . '</p>
+                    ' . $oPrj->renderPhaseInfo() . '
+                ';
+        } else {
+            $sOut.='<h3 id="h3phases">' . t("phases") . '</h3>'
+                    . $oPrj->getBox("info", t("page-overview-no-phase")) .
+                    $oPrj->renderLink("setup");
+        }
+        $sOut .= '<div style="clear: both"></div>
+        <div id="navbuttom">' . aGotop() . aHome() . '</div>';
 }
 // 
-echo $sOut;
-?>
-
+echo $sOut;
\ No newline at end of file
diff --git a/public_html/index.php b/public_html/index.php
index 03d62698..55be081f 100644
--- a/public_html/index.php
+++ b/public_html/index.php
@@ -1,5 +1,6 @@
 <?php
-    echo '<h1>' . php_uname("n") . '</h1><hr>';
+    header("location: /deployment/");
+    // echo '<h1>' . php_uname("n") . '</h1><hr>';
 ?>
 
 <a href="http://www.iml.unibe.ch/">IML Startseite</a> |
-- 
GitLab