Compare commits

...

4 commits

Author SHA1 Message Date
Kazhnuz
3f125edd08 💄 (admin): improve about 2025-01-18 20:04:58 +01:00
Kazhnuz
e0308d4e57 💄 (admin): improve sidebar 2025-01-18 19:49:29 +01:00
Kazhnuz
e073dab335 🐛 (admin): make feature poking work everywhere 2025-01-18 19:45:32 +01:00
Kazhnuz
e26aaa72b9 (admin): show the sidebar page only if the theme support it 2025-01-18 19:34:20 +01:00
12 changed files with 63 additions and 25 deletions

View file

@ -12,6 +12,7 @@ First forked version from bludit
### Added
- Admin: Added a sidebar panel that show all sidebar widget to be activated/deactivated
- Admin: Show some pages only if the theme support their features
### Changed

View file

@ -12,15 +12,16 @@ checkRole(array('admin'));
// This function is used on the VIEW to show the tables
function printTable($title, $array) {
echo '<h2 class="mb-2 mt-4">'.$title.'</h2>';
echo '<table class="table table-striped mt-3">
echo '<h2 class="mb-2">'.$title.'</h2>';
echo '<div class="card mb-4">';
echo '<table class="table m-0">
<tbody>
';
foreach ($array as $key=>$value) {
if($value===false) { $value = 'false'; }
elseif($value===true) { $value = 'true'; }
echo '<tr>';
echo '<tr class="card-tablebody">';
echo '<td>'.$key.'</td>';
if (is_array($value)) {
echo '<td>'.json_encode($value).'</td>';
@ -33,6 +34,7 @@ function printTable($title, $array) {
echo '
</tbody>
</table>
</div>
';
}

View file

@ -18,7 +18,5 @@ checkRole(array('admin'));
// Main after POST
// ============================================================================
$themes = buildThemes();
// Title of the page
$layout['title'] .= ' - '.$L->g('Themes');

View file

@ -5,28 +5,25 @@
</li>
<?php if (!checkRole(array('admin'),false)): ?>
<li class="nav-item">
<a class="nav-link" href="<?php echo HTML_PATH_ADMIN_ROOT.'content' ?>"><span class="fa fa-archive fa-fw"></span><?php $L->p('Content') ?></a>
<li class="nav-item mt-3">
<h4><?php $L->p('Content') ?></h4>
</li>
<li class="nav-item">
<a class="nav-link" href="<?php echo HTML_PATH_ADMIN_ROOT.'edit-user/'.$login->username() ?>"><span class="fa fa-user fa-fw"></span><?php $L->p('Profile') ?></a>
<a class="nav-link" href="<?php echo HTML_PATH_ADMIN_ROOT.'content' ?>"><span class="fa fa-archive fa-fw"></span><?php $L->p('Articles and pages') ?></a>
</li>
<?php endif; ?>
<?php if (checkRole(array('admin'),false)): ?>
<li class="nav-item mt-3">
<h4><?php $L->p('Manage') ?></h4>
<h4><?php $L->p('Content') ?></h4>
</li>
<li class="nav-item">
<a class="nav-link" href="<?php echo HTML_PATH_ADMIN_ROOT.'content' ?>"><span class="fa fa-folder fa-fw"></span><?php $L->p('Content') ?></a>
<a class="nav-link" href="<?php echo HTML_PATH_ADMIN_ROOT.'content' ?>"><span class="fa fa-archive fa-fw"></span><?php $L->p('Articles and pages') ?></a>
</li>
<li class="nav-item">
<a class="nav-link" href="<?php echo HTML_PATH_ADMIN_ROOT.'categories' ?>"><span class="fa fa-bookmark fa-fw"></span><?php $L->p('Categories') ?></a>
</li>
<li class="nav-item">
<a class="nav-link" href="<?php echo HTML_PATH_ADMIN_ROOT.'users' ?>"><span class="fa fa-users fa-fw"></span><?php $L->p('Users') ?></a>
<a class="nav-link" href="<?php echo HTML_PATH_ADMIN_ROOT.'categories' ?>"><span class="fa fa-tags fa-fw"></span><?php $L->p('Categories') ?></a>
</li>
<li class="nav-item mt-3">
@ -35,9 +32,11 @@
<li class="nav-item">
<a class="nav-link" href="<?php echo HTML_PATH_ADMIN_ROOT.'themes' ?>"><span class="fa fa-desktop fa-fw"></span><?php $L->p('Themes') ?></a>
</li>
<?php if (Theme::supports("sidebar", false)): ?>
<li class="nav-item">
<a class="nav-link" href="<?php echo HTML_PATH_ADMIN_ROOT.'sidebar' ?>"><span class="fa fa-list fa-fw"></span><?php $L->p('Sidebar') ?></a>
</li>
<?php endif; ?>
<li class="nav-item mt-3">
<h4><?php $L->p('Settings') ?></h4>
@ -45,6 +44,9 @@
<li class="nav-item">
<a class="nav-link" href="<?php echo HTML_PATH_ADMIN_ROOT.'settings' ?>"><span class="fa fa-gear fa-fw"></span><?php $L->p('General') ?></a>
</li>
<li class="nav-item">
<a class="nav-link" href="<?php echo HTML_PATH_ADMIN_ROOT.'users' ?>"><span class="fa fa-users fa-fw"></span><?php $L->p('Users') ?></a>
</li>
<li class="nav-item">
<a class="nav-link" href="<?php echo HTML_PATH_ADMIN_ROOT.'plugins' ?>"><span class="fa fa-puzzle-piece fa-fw"></span><?php $L->p('Plugins') ?></a>
</li>

View file

@ -3,36 +3,37 @@
echo Bootstrap::pageTitle(array('title'=>$L->g('About'), 'icon'=>'info-circle'));
echo '
<table class="table table-striped mt-3">
<div class="card">
<table class="table m-0">
<tbody>
';
echo '<tr>';
echo '<tr class="card-tablebody">';
echo '<td>Engine</td>';
echo '<td>KOBLOG</td>';
echo '</tr>';
echo '<tr>';
echo '<tr class="card-tablebody">';
echo '<td>Koblog Version</td>';
echo '<td>'.KOBLOG_VERSION.'</td>';
echo '</tr>';
echo '<tr>';
echo '<tr class="card-tablebody">';
echo '<td>Koblog Codename</td>';
echo '<td>'.KOBLOG_CODENAME.'</td>';
echo '</tr>';
echo '<tr>';
echo '<tr class="card-tablebody">';
echo '<td>Koblog Build Number</td>';
echo '<td>'.KOBLOG_BUILD.'</td>';
echo '</tr>';
echo '<tr>';
echo '<tr class="card-tablebody">';
echo '<td>Disk usage</td>';
echo '<td>'.Filesystem::bytesToHumanFileSize(Filesystem::getSize(PATH_ROOT)).'</td>';
echo '</tr>';
echo '<tr>';
echo '<tr class="card-tablebody">';
echo '<td><a href="'.HTML_PATH_ADMIN_ROOT.'developers'.'">Koblog Developers</a></td>';
echo '<td></td>';
echo '</tr>';
@ -40,4 +41,5 @@ echo '</tr>';
echo '
</tbody>
</table>
</div>
';

View file

@ -1,6 +1,6 @@
<?php
echo Bootstrap::pageTitle(array('title'=>$L->g('Content'), 'icon'=>'archive'));
echo Bootstrap::pageTitle(array('title'=>$L->g('Articles and pages'), 'icon'=>'archive'));
function table($type) {
global $url;

View file

@ -3,7 +3,7 @@
<?php echo Bootstrap::formOpen(array('id'=>'jsform')); ?>
<div class="d-flex justify-content-between mb-2">
<?php echo Bootstrap::pageTitle(array('title'=>$L->g('Edit Category'), 'icon'=>'cog')); ?>
<?php echo Bootstrap::pageTitle(array('title'=>$L->g('Edit Category'), 'icon'=>'tag')); ?>
<div>
<button type="submit" class="btn btn-primary" name="save"><?php $L->p('Save') ?></button>
<button type="button" class="btn btn-danger" data-bs-toggle="modal" data-bs-target="#jsdeleteModal"><?php $L->p('Delete') ?></button>

View file

@ -82,6 +82,9 @@ else
// Load plugins before the admin area will be load.
Theme::plugins('beforeAdminLoad');
// Build the themes to know informations about them.
$themes = buildThemes();
// Load init.php if the theme has one.
if (Sanitize::pathFile(PATH_ADMIN_THEMES, $site->adminTheme().DS.'init.php')) {
include(PATH_ADMIN_THEMES.$site->adminTheme().DS.'init.php');

View file

@ -282,4 +282,31 @@ class Theme
// https://github.com/psfpro/bootstrap-html5sortable
return '<script ' . $attributes . ' src="' . DOMAIN_CORE_JS . 'jquery.sortable.min.js?version=' . KOBLOG_VERSION . '"></script>' . PHP_EOL;
}
public static function supports($featureToCheck, $verifySidebar = true)
{
global $site;
global $themes;
$themeName = $site->theme();
if (isset($themes)) {
foreach ($themes as $theme) {
if ($theme['dirname'] == $site->theme()) {
if (isset($theme['supports'])) {
foreach ($theme['supports'] as $feature) {
if ($featureToCheck == $feature) {
return true;
}
if ($verifySidebar && $feature == "sidebar") {
// TODO: add check to see if a plugin support it in the sidebar
return true;
}
}
return false;
}
}
}
}
return false;
}
}

View file

@ -194,6 +194,7 @@
"order-content-by": "Organiser le contenu par",
"edit-or-delete-content-from-your-site": "Gestionnaire de contenu",
"order-the-content-by-date-to-build-a-blog": "Trier le contenu par date pour créer un blog ou par position pour créer un site.",
"articles-and-pages": "Articles et pages",
"page-not-found-content": "Hé! il semblerait que la page nexiste pas.",
"page-not-found": "Page non trouvée.",
"predefined-pages": "Pages prédéfinies",

View file

@ -7,5 +7,6 @@
"license": "MIT",
"compatible": "3.15",
"notes": "",
"plugin": "alternative"
"plugin": "alternative",
"supports": []
}

View file

@ -6,5 +6,6 @@
"releaseDate": "2024-08-23",
"license": "MIT",
"compatible": "kb_0.0.1",
"notes": ""
"notes": "",
"supports": ["sidebar"]
}