Skip to content

Commit

Permalink
Merge pull request #207 from emrysr/dark-sidebar
Browse files Browse the repository at this point in the history
Dark sidebar
  • Loading branch information
glynhudson authored May 1, 2019
2 parents 554eb38 + 4223661 commit 8c96fe8
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 41 deletions.
9 changes: 4 additions & 5 deletions Views/dashboard_edit_view.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@
*/

global $session,$path;
$js_css_version = 2;
$domain3 = "vis_messages";
bindtextdomain($domain3, "Modules/vis/locale");
bind_textdomain_codeset($domain3, 'UTF-8');
$js_css_version = 3;

load_language_files("Modules/vis/locale", "vis_messages");

if (!$dashboard['height']) $dashboard['height'] = 400;
if (!isset($dashboard['feedmode'])) $dashboard['feedmode'] = "feedid";
Expand Down Expand Up @@ -45,7 +44,7 @@
</div>
</div>

<div id="toolbox" style="cursor:move; text-align: center; background-color:#ddd; padding-left:5px; padding-right:5px; padding-bottom:15px; position:fixed;z-index:1; border-radius: 5px 5px 5px 5px; border-style:groove; width: 125px; height: auto; top:55px; right: 30px;"><?php echo _('Toolbox'); ?>
<div id="toolbox" style="cursor:move; text-align: center; background-color:#ddd; padding-left:5px; padding-right:5px; padding-bottom:15px; position:fixed;z-index:1; border-radius: 5px 5px 5px 5px; border-style:groove; width: 125px; height: auto; top: 5rem; right: 1rem;"><?php echo _('Toolbox'); ?>
<div id="separator" style="height:1.5px; background:#717171"></div>
<div id="Buttons" style="position:relative; top:5px; cursor:pointer">
<span id="dashboard-config-buttons">
Expand Down
6 changes: 3 additions & 3 deletions Views/dashboard_list.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<p><?php echo _('Maybe you would like to add your first dashboard using the button bellow.') ?></p>
</div>

<div id="table"><div align='center'>loading...</div></div>
<div id="table"><div>loading...</div></div>

<div id="bottomtoolbar" class="hide"><hr>
<button id="addnewdashboard" class="btn btn-small"><i class="icon-plus-sign" ></i>&nbsp;<?php echo _("New"); ?></button>
Expand Down Expand Up @@ -56,9 +56,9 @@
'name':{'title':"<?php echo _('Name'); ?>", 'type':"text"},
'alias':{'title':"<?php echo _('Alias'); ?>", 'type':"text"},
// 'description':{'title':"<?php echo _('Description'); ?>", 'type':"text"},
'main':{'title':"<?php echo _('Main'); ?>", 'type':"icon", 'trueicon':"icon-star", 'falseicon':"icon-star-empty"},
'main':{'title':"<?php echo _('Default'); ?>", 'type':"icon", 'trueicon':"icon-star", 'falseicon':"icon-star-empty"},
'public':{'title':"<?php echo _('Public'); ?>", 'type':"icon", 'trueicon':"icon-globe", 'falseicon':"icon-lock"},
'published':{'title':"<?php echo _('Published'); ?>", 'type':"icon", 'trueicon':"icon-ok", 'falseicon':"icon-remove"},
// 'published':{'title':"<?php echo _('Bookmarked'); ?>", 'type':"icon", 'trueicon':"icon-ok", 'falseicon':"icon-remove"},

// Actions
'clone-action':{'title':'', 'type':"iconbasic", 'icon':'icon-random'},
Expand Down
20 changes: 14 additions & 6 deletions Views/dashboard_view.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,23 @@
*/

global $session,$path,$dashboard_editor_icon;
$js_css_version = 2;
$js_css_version = 3;

$domain3 = "vis_messages";
bindtextdomain($domain3, "Modules/vis/locale");
bind_textdomain_codeset($domain3, 'UTF-8');
load_language_files("Modules/vis/locale", "vis_messages");

if ($session['write']) $dashboard_editor_icon ='<a href="'.$path.'dashboard/edit?id='. $dashboard['id'].'"> <img src="'.$path.'Modules/dashboard/Views/icons/gear-icon-outlined.png" style="width:80%" ></a>';

?>
<style>
#editicon{
text-align: center;
position: fixed;
z-index: 1;
width: 2rem;
top: 3.5rem;
right: .25rem;
}
</style>
<link href="<?php echo $path; ?>Modules/dashboard/Views/js/widget.css?ver=<?php echo $js_css_version; ?>" rel="stylesheet">
<script type="text/javascript"><?php require "Modules/dashboard/dashboard_langjs.php"; ?></script>
<script type="text/javascript"><?php require "Modules/vis/vis_langjs.php"; ?></script>
Expand All @@ -29,7 +37,7 @@

<?php require_once "Modules/dashboard/Views/loadwidgets.php"; ?>

<div id="editicon" class="hidden-phone" style="text-align:center; position:fixed;z-index:1; width: 35px; height: 35px; top:53px; right: 0px;">
<div id="editicon" class="hidden-phone">
<div id="innerbutton" style="cursor: default">
<?php echo $dashboard_editor_icon; ?>
</div>
Expand All @@ -40,7 +48,7 @@

<script type="application/javascript">
var dashid = <?php echo $dashboard['id']; ?>;
var path = "<?php echo $path; ?>";
// var path = "<?php echo $path; ?>";
var widget = <?php echo json_encode($widgets); ?>;
var apikey = "<?php echo get('apikey'); ?>";
var userid = <?php echo $session['userid']; ?>;
Expand Down
64 changes: 37 additions & 27 deletions dashboard_menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,46 @@
require_once "Modules/dashboard/dashboard_model.php";
$dashboard = new Dashboard($mysqli);

$location = 'view';
$sess = (isset($session['write']) && $session['write'] ? 'write':(isset($session['read']) && $session['read'] ? 'read':''));
if (isset($session['profile']) && $session['profile']==1) {
$dashpath = $session['username'];
$sess= 'all';
} else {
if ($route->action == "edit" && $session['write']) $location = 'edit';
$dashpath = 'dashboard/'.$location;
// get the default dashboard
$default = array();
foreach($dashboard->get_list($session['userid'],false,false) as $item){
if($item['main']===true){
$default = $item;
}
}

// Contains a list for the drop down with dashboards available for user session type
$listmenu = $dashboard->build_menu_array($location);

$domain = "messages";
bindtextdomain($domain, "Modules/dashboard/locale");
bind_textdomain_codeset($domain, 'UTF-8');
// navbar link
$menu['tabs'][] = array(
'icon'=>'dashboard',
'title'=> _("Dashboards"),
'path'=> 'dashboard/view',
'order' => 3,
'data'=> array('sidebar' => '#sidebar_dashboard')
);

$publishedDashs = 0;
// Show published dashboards as single items
foreach ($listmenu as $dash){
if ($dash['published']){
$menu_dashboard[] = array('name'=> $dash['name'], 'desc'=> $dash['desc'],'icon'=>'icon-star icon-white', 'published'=>$dash['published'], 'path'=>$dash['path'] , 'session'=>$sess, 'order'=>$dash['order']);
$publishedDashs++;
}
}
// sidebar nav list
// Contains a list for the drop down with dashboards available for user session type
$listmenu = $dashboard->build_menu_array('view');

// show a dropdown menu with all
if (count($listmenu)){
$menu_left[] = array('name'=> dgettext($domain, "Dashboards"), 'icon'=>'icon-th-large icon-white', 'path'=>$dashpath , 'session'=>$sess, 'order'=>0, 'dropdown'=>$listmenu);
foreach ($listmenu as $dash) {
preg_match('#dashboard\/view\&id=(\d+)#', $dash['path'], $matches);
$id = !empty($matches[1]) ? (int) $matches[1]: '';
$icon = !empty($default['id']) && $default['id'] === $id ? 'star': '';
$menu['sidebar']['dashboard'][] = array(
'title' => $dash['desc'],
'text' => $dash['name'],
'path' => str_replace('dashboard/view&id','dashboard/view?id',$dash['path']),
'active' => str_replace('dashboard/view&id','dashboard/edit?id',$dash['path']),
'order' => $dash['order'],
'icon' => $icon,
'data' => array(
'id' => $id
)
);
}

$menu_dropdown_config[] = array('name'=> dgettext($domain, "Dashboards"), 'icon'=>'icon-th-large', 'path'=>"dashboard/list" , 'session'=>"write", 'order'=>30 );

$menu['sidebar']['dashboard'][] = array(
'text'=> _("All Dashboards"),
'path'=> 'dashboard/list',
'order' => 1
);

0 comments on commit 8c96fe8

Please sign in to comment.