Skip to content
Snippets Groups Projects
Commit 43932556 authored by Hahn Axel (hahn)'s avatar Hahn Axel (hahn)
Browse files

add adminlte

parent c17bf98a
Branches
No related tags found
1 merge request!62V2.0
<?php
/* ######################################################################
define("APP_VERSION", '2.0.0-ALPHA');
IML DEPLOYMENT
require_once('./classes/render-adminlte.class.php');
require_once('./classes/queryparam.class.php');
# require_once('./classes/icon.class.php');
webgui - index file - controller like
ensure that you activated the rewrite rules
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^/server-status$
RewriteRule ^(.*)$ index.php [QSA,L]
$sPpage=queryparam::get('page', '/^[a-z]*$/');
---------------------------------------------------------------------
2013-11-08 Axel <axel.hahn@iml.unibe.ch>
###################################################################### */
$renderAdminLTE=new renderadminlte();
$aReplace=include("./ui/page_replacements.php");
session_start();
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
require_once("./classes/page.class.php");
require_once("./classes/plugins_renderer.class.php");
// detect first run
$bFirstRun=!file_exists("../../config/config_custom.php") || !file_exists("../../config/inc_user2roles.php");
......@@ -34,8 +22,10 @@ require_once("./classes/user.class.php");
global $oCLog;
$oCLog = new logger();
$oCLog->enableDebugByIp($aConfig['showdebug']['ip']);
require_once("./inc_functions.php");
require_once("./classes/htmlguielements.class.php");
require_once("./classes/plugins_renderer.class.php");
$oHtml=new htmlguielements();
$sPrj = "";
......@@ -113,14 +103,26 @@ foreach ($aEnabledShellPlugins as $sPlugin){
}
}
// ----------------------------------------------------------------------
// html body
// ----------------------------------------------------------------------
$BODY="WARNING: $sAction did not set \$BODY";
$TITLE="WARNING: $sAction did not set \$TITLE";
$sTopArea=getTopArea(['right'=>$sTopRight]);
$sBanner=isset($aConfig['banner']) && $aConfig['banner'] ? '<div class="alert alert-info">'.$aConfig['banner'].'</div>' : '';
$sTopAction=getAction();
if(isset($aParams["prj"])){
$oPrj = new project($aParams["prj"]);
$TITLE=$oPrj->getLabel().' <div class="description">'.$oPrj->getDescription().'</div>';
} else {
$TITLE=t("overview-label") . '<div class="description">' . t("overview-hint") . '</div>';
}
// $sReturn.='<h1>' . $oPrj->getLabel() . '</h1>'
// . '<span class="description">' . $oPrj->getDescription() . '</span>';
// ------ action
$oUser=new user();
if (isset($aConfig["auth"]['forceuser']) && $aConfig["auth"]['forceuser']){
......@@ -137,7 +139,7 @@ if ($oUser->hasPermission('page_'.$sAction)){
if (!@include($sActionFile)) {
include("./pages/error_404.php");
}
$sPhpOut = ob_get_contents();
$BODY = ob_get_contents();
ob_end_clean();
$oCLog->add("including done $sActionFile");
......@@ -150,42 +152,102 @@ if ($oUser->hasPermission('page_'.$sAction)){
$aFilter['project']=$sPrj;
}
$oLog=new Actionlog($sPrj);
$sPhpOut.='<div class="logs">' . $oLog->renderLogs($aFilter).'</div>';
$BODY.='<div class="logs">' . $oLog->renderLogs($aFilter).'</div>';
}
$oCLog->add("adding actionlog.class done");
} else {
$sPhpOut=$oUser->showDenied();
$BODY=$oUser->showDenied();
// return false;
}
// ----------------------------------------------------------------------
// render page
// ----------------------------------------------------------------------
$oCLog->add("Finally: rendering page ...");
$sPhpOut = '
<br>
$BODY = '
'
. $sTopArea
. $sHeader
// . $sTopArea
. $sShellOuptut
.'
<div id="content">
' . $sBanner . $sTopAction . '
' . $sPhpOut . '
<div id="content">
' . $BODY . '
</div>
<!--
<div id="footer">
'.t("menu-brand").' &copy; 2013-' . date("Y") . ' <a href="https://git-repo.iml.unibe.ch/iml-open-source/imldeployment/" target="_blank">Institut f&uuml;r Medizinische Lehre; Universit&auml;t Bern</a>
</div>
-->
'
.$oCLog->render();
/*
$oPage = new Page();
$oPage->addResponseHeader("Pragma: no-cache");
$oPage->setOutputtype('html');
$oPage->setHeader($sHeader);
$oPage->addJsOnReady('');
$oPage->setContent($sPhpOut);
$oPage->setContent($BODY);
echo $oPage->render();
*/
/*
$sObject=queryparam::get('object', '/^[a-z\_]*$/');
$sTabApp=queryparam::get('app', '/^[a-z\-]*$/');
if(!$sTabApp && !$sPpage){
// $sTabApp=array_key_first($aObjects);
header('location: ?page=home');
return true;
}
*/
$aTopnav = [
['href'=>'#', 'label'=>'Menu A', 'icon'=>'fa-solid fa-home' ],
['href'=>'#', 'label'=>'Menu B', 'icon'=>'fa-solid fa-tv'],
['href'=>'#', 'label'=>'Menu C', 'icon'=>'fa-solid fa-truck-pickup', 'class'=>'active',
'children'=>[
['href'=>'#', 'label'=>'FAQ' , 'icon'=>'fa-solid fa-truck-monster'],
['href'=>'#', 'label'=>'Support' , 'icon'=>'fa-solid fa-truck-moving'],
]
]
];
$aReplace['{{NAVI_TOP}}']=''
. $renderAdminLTE->addWrapper(
'nav', ['class'=>'main-header navbar navbar-expand navbar-white navbar-light'],
$renderAdminLTE->getTopNavigation($aTopnav)
// add 2nd navbar if needed
)
;
$aSidebarNav=[];
$aReplace['{{NAVI_LEFT}}']=''
. $renderAdminLTE->addWrapper(
'nav', ['class'=>'mt-2'],
$renderAdminLTE->getSidebarNavigation($aSidebarNav)
);
// ---------- include page content
$sIncfile='pages/'.$sPpage.'.php';
if(!file_exists($sIncfile)){
$sIncfile='pages/error404.php';
}
// include($sIncfile);
// ---------- generate output
$aReplace['{{PAGE_BODY}}']=$BODY;
$aReplace['{{PAGE_BODY}}']=$BODY;
$aReplace['{{PAGE_HEADER_LEFT}}']='<h2>'.$TITLE.'</h2>';
$sTemplate=file_get_contents('ui/page.tpl.php');
echo $renderAdminLTE->render($sTemplate,$aReplace);
<?php
/* ######################################################################
IML DEPLOYMENT
webgui - index file - controller like
ensure that you activated the rewrite rules
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^/server-status$
RewriteRule ^(.*)$ index.php [QSA,L]
---------------------------------------------------------------------
2013-11-08 Axel <axel.hahn@iml.unibe.ch>
###################################################################### */
session_start();
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
require_once("./classes/page.class.php");
require_once("./classes/plugins_renderer.class.php");
// detect first run
$bFirstRun=!file_exists("../../config/config_custom.php") || !file_exists("../../config/inc_user2roles.php");
require_once("../../config/inc_projects_config.php");
require_once("./classes/logger.class.php");
require_once("./classes/user.class.php");
global $oCLog;
$oCLog = new logger();
$oCLog->enableDebugByIp($aConfig['showdebug']['ip']);
require_once("./inc_functions.php");
require_once("./classes/htmlguielements.class.php");
$oHtml=new htmlguielements();
$sPrj = "";
$sAction = "overview";
// ----------------------------------------------------------------------
// check params
// ----------------------------------------------------------------------
if (array_key_exists("prj", $aParams)) {
$sPrj = $aParams["prj"];
}
if (array_key_exists("action", $aParams)) {
if (file_exists(__DIR__ . '/pages/act_' . $aParams["action"] . ".php")) {
$sAction = $aParams["action"];
}
}
$oCLog->add("parsing params "
. '<pre>GET '.print_r($_GET, true).'</pre>'
. '<pre>POST '.print_r($_POST, true).'</pre>'
. '<pre>aParams: '.print_r($aParams, true).'</pre>'
);
if($bFirstRun){
$sAction='installer';
}
// ----------------------------------------------------------------------
// html header
// ----------------------------------------------------------------------
$sHeader = "\n<!-- generated CSS for phases -->\n<style>\n";
foreach ($aConfig["phases"] as $sPhase => $aData) {
$sHeader.=array_key_exists("bgdark", $aData["css"]) ? 'th.' . $sPhase . '{' . $aData["css"]["bgdark"] . '}' : '';
$sHeader.=array_key_exists("bglight", $aData["css"]) ? 'td.' . $sPhase . ', div.' . $sPhase . '{' . $aData["css"]["bglight"] . '}' : '';
$sHeader.=array_key_exists("bgbutton", $aData["css"]) ? 'a.' . $sPhase . ',a.' . $sPhase . ':hover,button.' . $sPhase . ',button.' . $sPhase . ':hover{' . $aData["css"]["bgbutton"] . '}' : '';
}
$sHeader.="</style>\n";
// add shellcmd files
$sShellOuptut='';
$sTopRight='';
$CI_plugins=new plugin_renderer(isset($aConfig['plugins']) ? $aConfig['plugins'] : []);
$CI_plugins->setType('shellcmd');
$aEnabledShellPlugins=$CI_plugins->getEnabledPlugins('shellcmd');
$sHeader.= count($aEnabledShellPlugins)
? ''
."\n<!-- for shellcmd plugins -->\n"
.'<script src="/vendor/axelhahn/js/ubd.class.js"></script>'."\n"
.'<script src="/vendor/winbox/0.2.82/winbox.min.js"></script>'."\n"
.'<link rel="stylesheet" type="text/css" href="/vendor/winbox/0.2.82/winbox.min.css"/>'."\n"
."<!-- shellcmd scripts -->\n"
: ''
;
foreach ($aEnabledShellPlugins as $sPlugin){
if ($CI_plugins->testPlugin($sPlugin)){
$aPluginConfig=$CI_plugins->getPluginConfig();
$sHeader.=$CI_plugins->getHtmlLoadScript('render.js');
$sShellOuptut.=$CI_plugins->getHtmlOutwindow();
$sTopRight.=''
.'<li >'
.$oHtml->getLink(array(
'href'=>'#',
// 'onclick'=>'toggleShellWindow(\''.$CI_plugins->getHtmlOutIdWrapper().'\', this);',
'onclick'=>'toggleShellWindow(\''.$CI_plugins->getHtmlOutId().'\', this);',
'role'=>'button',
'aria-expanded'=>'false',
'icon'=> (isset($aPluginConfig['icon']) ? $aPluginConfig['icon'] : ''),
'label'=>$sPlugin,
))
.'</li>'
;
}
}
// ----------------------------------------------------------------------
// html body
// ----------------------------------------------------------------------
$sTopArea=getTopArea(['right'=>$sTopRight]);
$sBanner=isset($aConfig['banner']) && $aConfig['banner'] ? '<div class="alert alert-info">'.$aConfig['banner'].'</div>' : '';
$sTopAction=getAction();
// ------ action
$oUser=new user();
if (isset($aConfig["auth"]['forceuser']) && $aConfig["auth"]['forceuser']){
$oCLog->add("Found config -> auth -> forceuser: using fake identity [".$aConfig["auth"]['forceuser'].']', "warning");
$oUser->setUser($aConfig["auth"]['forceuser']);
}
if ($oUser->hasPermission('page_'.$sAction)){
$sActionFile = __DIR__ . '/pages/act_' . $sAction . ".php";
$oCLog->add("including $sActionFile");
ob_start();
if (!@include($sActionFile)) {
include("./pages/error_404.php");
}
$sPhpOut = ob_get_contents();
ob_end_clean();
$oCLog->add("including done $sActionFile");
$oCLog->add("adding actionlog.class");
if ($oUser->getUsername()){
require_once("./classes/actionlog.class.php");
$aFilter=array('limit'=>'0, 10');
if ($sPrj && $sPrj!="all"){
$aFilter['project']=$sPrj;
}
$oLog=new Actionlog($sPrj);
$sPhpOut.='<div class="logs">' . $oLog->renderLogs($aFilter).'</div>';
}
$oCLog->add("adding actionlog.class done");
} else {
$sPhpOut=$oUser->showDenied();
// return false;
}
// ----------------------------------------------------------------------
// render page
// ----------------------------------------------------------------------
$oCLog->add("Finally: rendering page ...");
$sPhpOut = '
<br>
'
. $sTopArea
. $sShellOuptut
.'
<div id="content">
' . $sBanner . $sTopAction . '
' . $sPhpOut . '
</div>
<div id="footer">
'.t("menu-brand").' &copy; 2013-' . date("Y") . ' <a href="https://git-repo.iml.unibe.ch/iml-open-source/imldeployment/" target="_blank">Institut f&uuml;r Medizinische Lehre; Universit&auml;t Bern</a>
</div>
'
.$oCLog->render();
$oPage = new Page();
$oPage->addResponseHeader("Pragma: no-cache");
$oPage->setOutputtype('html');
$oPage->setHeader($sHeader);
$oPage->addJsOnReady('');
$oPage->setContent($sPhpOut);
echo $oPage->render();
......@@ -16,7 +16,9 @@ body{padding-top: 0;
border-top: 0px solid #ddd;
margin-top: 5em;
}
/*
.navbar {background:#436; border-radius: 0; position: fixed; top: 0px; width: 100%; left: 0; z-index: 100;}
*/
.navbar-inverse .navbar-nav > li > a {
color: #fff;
}
......@@ -28,7 +30,7 @@ body{padding-top: 0;
}
.description{font-weight:bold; color:rgba(0,0,0,0.3); font-size: 150%; font-style: italic;}
.description{font-weight:normal; color:rgba(0,0,0,0.5); font-size: 70%; font-style: italic;}
.navbar-brand {font-size: 150%;}
.navbar-inverse .navbar-brand {color:#ddd !important;}
......@@ -47,15 +49,15 @@ body{padding-top: 0;
}
#content{
background: #fff;
margin: 0 2% 0;
padding: 0.5em;
border: 1px solid rgba(0,0,0,0.06);
/*
margin: 0 2% 0;
box-shadow: 1em 1em 2em #fff;
*/
}
div#navtop, div#navbuttom{background: #dde; padding: 0.5em;}
div#navtop, div#navbuttom{background: #d0d8e0; padding: 0.5em;}
div#navtop{margin-bottom: 2em;}
div#navtop .current{font-size: 170%; color: #667; padding: 0 0.2em; position: absolute;}
div#navbuttom{
......@@ -296,6 +298,11 @@ input[type="radio"]:checked+label, input[type="checkbox"]:checked+label{
.ciwinbox .bar{background: rgba(255,255,255,0.1);}
.ciwinbox .progress{background: #85a;}
/* showIdAsModalMessage() - when using winbox */
.ciwinboxinfos .wb-body{
background: #fff !important;
}
.float-right{float: right;}
.cmd-lines-10{height: 10em; max-height: 10em;}
......
li.nav-item .active{background-color: #e8e8e8;}
pre.config{background:#f4f4f4; color:#448; border-radius: 0.5em; max-height: auto; transition: all ease-in-out 0.2s;}
.hidden{max-height: 0px; padding: 0; margin: 0;}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{{PAGE_TITLE}}</title>
<!--
<script type="text/javascript" src="js/asimax.class.js"></script>
visjs
<script type="text/javascript" src="vendor/vis/4.21.0/vis.min.js"></script>
<link href="vendor/vis/4.21.0/vis-timeline-graph2d.min.css" rel="stylesheet" type="text/css"/>
-->
<script type="text/javascript" src="/vendor/jquery/3.6.1/jquery.js"></script>
<!-- datatable
<script type="text/javascript" src="../vendor/datatables/1.10.15/js/jquery.dataTables.min.js"></script>
<link href="../vendor/datatables/1.10.15/css/jquery.dataTables.min.css" rel="stylesheet" type="text/css"/>
-->
<!-- fontawesome -->
<link href="/vendor/font-awesome/6.4.0/css/all.min.css" rel="stylesheet" type="text/css"/>
<!-- Adminlte -->
<link rel="stylesheet" href="{{DIR_ADMINLTE}}/css/adminlte.min.css?v=3.2.0">
<link rel="stylesheet" href="{{DIR_ADMINLTEPLUGINS}}/summernote/summernote-bs4.min.css">
<link rel="stylesheet" href="{{DIR_ADMINLTEPLUGINS}}/dropzone/dropzone.css" type="text/css" />
<link rel="stylesheet" href="/deployment/main.css">
<link rel="stylesheet" href="/deployment/main_new_ui.css">
</head>
<body class="hold-transition {{PAGE_SKIN}} {{PAGE_LAYOUT}}">
<div class="wrapper">
{{NAVI_TOP}}
<aside class="main-sidebar sidebar-dark-primary elevation-4">
{{BRAND}}
<div class="sidebar">
{{NAVI_LEFT}}
</div>
</aside>
<div class="content-wrapper px-4 py-2">
<div class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
{{PAGE_HEADER_LEFT}}
<!-- <h1 class="m-0">Starter Page</h1> -->
</div>
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
{{PAGE_HEADER_RIGHT}}
<!--
<li class="breadcrumb-item"><a href="#">Home</a></li>
<li class="breadcrumb-item active">Starter Page</li>
-->
</ol>
</div>
</div>
</div>
</div>
<div class="content">
<div class="container-fluid">
{{PAGE_BODY}}
</div>
</div>
</div>
<aside class="control-sidebar control-sidebar-dark">
<div class="p-3">
<h5>Title</h5>
<p>Sidebar content</p>
</div>
</aside>
<footer class="main-footer">
<div class="float-right d-none d-sm-inline">
{{PAGE_FOOTER_RIGHT}}
</div>
{{PAGE_FOOTER_LEFT}}
</footer>
</div>
<div id="divmodal">
<div id="divmodalmessage">please wait ...</div>
</div>
<script>{{INJECT_JS}}</script>
<script src="{{DIR_ADMINLTEPLUGINS}}/bootstrap/js/bootstrap.bundle.min.js"></script>
<!--
<script src="{{DIR_ADMINLTEPLUGINS}}/summernote/summernote-bs4.min.js"></script>
<script src="{{DIR_ADMINLTEPLUGINS}}/dropzone/dropzone.js"></script>
-->
<script src="{{DIR_ADMINLTE}}/js/adminlte.min.js?v=3.2.0"></script>
<script type="text/javascript" src="js/functions.js"></script>
</body>
</html>
\ No newline at end of file
<?php
/*
this file is included by ../index.php
$cr=new cronlogrenderer();
*/
return [
'{{DIR_ADMINLTE}}' =>'/vendor/admin-lte/3.2.0',
'{{DIR_ADMINLTEPLUGINS}}' =>'/vendor/admin-lte-plugins',
'{{PAGE_SKIN}}' =>'',
'{{PAGE_TITLE}}' =>'',
'{{PAGE_LAYOUT}}' =>'layout-navbar-fixed layout-fixed sidebar-mini',
// '{{NAVI_TOP}}' =>'<nav class="main-header navbar navbar-expand navbar-white navbar-light"><ul class="navbar-nav" id="instances"></ul></nav>',
'{{BRAND}}' =>'<a href="?" class="brand-link bg-red">
<i class="fa-solid fa-cubes"></i>
IML <span class="brand-text">CI server</span>
<span class="brand-text font-weight-light">v2</span>
</a>',
'{{NAVI_LEFT}}' =>'
<br>
<ul class="nav nav-pills nav-sidebar flex-column" data-widget="treeview" role="menu" data-accordion="false">
<li class="nav-item">
<a href="#" class="nav-link">
<i class="far fa-pack"></i>
<p>Server</p>
</a>
</li>
</ul>
<!--
-->
<div class="form-inline">
<div class="input-group">
<input id="serverfiltertext" class="form-control form-control-sidebar" type="search" placeholder="Search"
onchange="filterServers();"
onkeypress="filterServers();"
onkeyup="filterServers();"
>
<div class="input-group-append">
<button class="btn btn-sidebar"
onclick="$(\'#serverfiltertext\').val(\'\'); filterServers();" >
×
</button>
</div>
</div>
</div>
<br>
<div class="form-inline">
<div id="selectserver" class="form-control-sidebar"></div>
</div>
<br>
<div class="sidebar-infobox bottom">
<i class="fas fa-info-circle"></i> PDO Class Admin v'.APP_VERSION.'<br>
<i class="fab fa-php"></i> PHP '.PHP_VERSION.'<br>
</div>
',
'{{PAGE_HEADER_LEFT}}'=>'{{PAGE_HEADER_LEFT}}',
'{{PAGE_HEADER_RIGHT}}'=>'{{PAGE_HEADER_RIGHT}}',
'{{PAGE_BODY}}'=>'{{PAGE_BODY}}',
// '{{INJECT_JS}}' => $cr->renderJSLang(),
'{{INJECT_JS}}' => '',
'{{PAGE_FOOTER_LEFT}}'=>' &copy; 2013-' . date("Y") . ' <a href="https://www.iml.unibe.ch/" target="_blank">Institut f&uuml;r Medizinische Lehre; Universit&auml;t Bern</a>',
'{{PAGE_FOOTER_RIGHT}}'=>'Source: <a href="https://git-repo.iml.unibe.ch/iml-open-source/imldeployment/" target="_blank">Git</a>',
];
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment