From a77e22d93b11a18cac9b58a2faba6941ea84e054 Mon Sep 17 00:00:00 2001 From: dignajar Date: Sat, 28 May 2016 00:18:13 -0300 Subject: [PATCH] Improves on pages --- .../admin/themes/default/css/default.css | 5 ++ bl-kernel/admin/views/manage-pages.php | 36 +++++---- bl-kernel/boot/rules/71.pages.php | 73 +++++++++++-------- bl-themes/log/assets/css/bludit.css | 24 ++++++ bl-themes/log/index.php | 2 +- bl-themes/log/php/post.php | 1 - 6 files changed, 94 insertions(+), 47 deletions(-) diff --git a/bl-kernel/admin/themes/default/css/default.css b/bl-kernel/admin/themes/default/css/default.css index ca64e5c6..ecef12a7 100644 --- a/bl-kernel/admin/themes/default/css/default.css +++ b/bl-kernel/admin/themes/default/css/default.css @@ -140,6 +140,11 @@ legend.first-child { padding: 15px 10px; } +.uk-table td.children { + padding: 15px 10px 15px 25px; +} + + .uk-badge { margin-right: 5px !important; font-size: 0.9em; diff --git a/bl-kernel/admin/views/manage-pages.php b/bl-kernel/admin/views/manage-pages.php index b75b7b67..0d3f809b 100644 --- a/bl-kernel/admin/views/manage-pages.php +++ b/bl-kernel/admin/views/manage-pages.php @@ -7,7 +7,6 @@ echo ' '.$L->g('Title').' - '.$L->g('Parent').' '.$L->g('Position').' '.$L->g('Friendly URL').' @@ -15,26 +14,33 @@ echo ' '; + unset($pagesParents[NO_PARENT_CHAR]); + foreach($pagesParents as $parentKey=>$pageList) { + // Parent page + $Page = $pages[$parentKey]; + + $friendlyURL = Text::isEmpty($Url->filters('page')) ? '/'.$Page->key() : '/'.$Url->filters('page').'/'.$Page->key(); + + echo ''; + echo ''; + echo ''.($Page->published()?'':''.$Language->g('Draft').' ').($Page->title()?$Page->title():''.$Language->g('Empty title').' ').''; + echo ''; + echo ''.$Page->position().''; + echo ''.$friendlyURL.''; + echo ''; + + // Children foreach($pageList as $Page) { - if($parentKey!==NO_PARENT_CHAR) { - $parentTitle = $pages[$Page->parentKey()]->title(); - } - else { - $parentTitle = ''; - } - - - - echo ''; - echo ''.($Page->parentKey()?'- ':'').''.($Page->published()?'':''.$Language->g('Draft').' ').($Page->title()?$Page->title():''.$Language->g('Empty title').' ').''; - echo ''.$parentTitle.''; - echo ''.$Page->position().''; - $friendlyURL = Text::isEmpty($Url->filters('page')) ? '/'.$Page->key() : '/'.$Url->filters('page').'/'.$Page->key(); + echo ''; + echo ''; + echo ''.($Page->published()?'':''.$Language->g('Draft').' ').($Page->title()?$Page->title():''.$Language->g('Empty title').' ').''; + echo ''; + echo ''.$Page->position().''; echo ''.$friendlyURL.''; echo ''; } diff --git a/bl-kernel/boot/rules/71.pages.php b/bl-kernel/boot/rules/71.pages.php index 361c4c0c..1a76a231 100644 --- a/bl-kernel/boot/rules/71.pages.php +++ b/bl-kernel/boot/rules/71.pages.php @@ -7,14 +7,18 @@ // Array with all pages. $pages = array(); +$pagesPublished = array(); + // Array with all pages, order by parent. $pagesParents = array(NO_PARENT_CHAR=>array()); +$pagesParentsPublished = array(); + // ============================================================================ // Functions // ============================================================================ -function sortPages($a, $b) +function sortPages2($a, $b) { if ($a->position() == $b->position()) { return 0; @@ -23,6 +27,15 @@ function sortPages($a, $b) return ($a->position() < $b->position()) ? -1 : 1; } +function sortPages($a, $b) +{ + if ($a['position'] == $b['position']) { + return 0; + } + + return ($a['position'] < $b['position']) ? -1 : 1; +} + function buildPage($key) { global $dbPages; @@ -81,63 +94,62 @@ function buildPage($key) function buildAllPages() { global $pagesParents; + global $pagesParentsPublished; + global $pagesPublished; global $dbPages; + // Get the page list $list = $dbPages->getDB(); // Clean pages array. $pages = array(); + // Remove the error page unset($list['error']); + // Sorte pages + uasort($list, 'sortPages'); + foreach($list as $key=>$db) { $Page = buildPage($key); if($Page!==false) { - // --- Order pages by parents --- + // Filter pages, with and without parent - // Generate all posible parents. - if( $Page->parentKey()===false ) - { + // If the page doesn't have a father, it's a parent page :P + if( $Page->parentKey()===false ) { // Add the parent key in the dbPages $dbPages->addParentKey($Page->key()); + // Add the page as a parent page in the array $pagesParents[NO_PARENT_CHAR][$Page->key()] = $Page; + + // If the page is published + if($Page->published()) { + $pagesParentsPublished[NO_PARENT_CHAR][$Page->key()] = $Page; + } } - else - { + else { $pagesParents[$Page->parentKey()][$Page->key()] = $Page; + + // If the page is published + if($Page->published()) { + $pagesParentsPublished[$Page->parentKey()][$Page->key()] = $Page; + } } - // --- All pages in 1 array --- + // All pages in one array $pages[$Page->key()] = $Page; + + // If the page is published + if($Page->published()) { + $pagesPublished[$Page->parentKey()][$Page->key()] = $Page; + } } } - // --- SORT PAGES --- - - // Sort parents. - $parents = $pagesParents[NO_PARENT_CHAR]; - uasort($parents, 'sortPages'); - - // Sort children. - unset($pagesParents[NO_PARENT_CHAR]); - $children = $pagesParents; - $tmpPageWithParent = array(); - foreach($children as $parentKey=>$childrenPages) - { - // If the child doesn't have a valid parent, then doesn't included them. - if(isset($pages[$parentKey])) - { - $tmpPageWithParent[$parentKey] = $childrenPages; - uasort($tmpPageWithParent[$parentKey], 'sortPages'); - } - } - - $pagesParents = array(NO_PARENT_CHAR=>$parents) + $tmpPageWithParent; - return $pages; } @@ -193,3 +205,4 @@ if($Url->notFound()) // Build all pages $pages = buildAllPages(); + diff --git a/bl-themes/log/assets/css/bludit.css b/bl-themes/log/assets/css/bludit.css index 960e7832..ffb5f1e4 100644 --- a/bl-themes/log/assets/css/bludit.css +++ b/bl-themes/log/assets/css/bludit.css @@ -16,6 +16,30 @@ h1, h2, h3, h4, h5, h6 { letter-spacing: 0; } +h1 { + font-size: 1.5em; +} + +h2 { + font-size: 1.4em; +} + +h3 { + font-size: 1.3em; +} + +h4 { + font-size: 1.2em; +} + +h5 { + font-size: 1.1em; +} + +h6 { + font-size: 1em; +} + #header { background-color: #f7f7f7; border-bottom: 0; diff --git a/bl-themes/log/index.php b/bl-themes/log/index.php index bfad24b7..d9f1999f 100644 --- a/bl-themes/log/index.php +++ b/bl-themes/log/index.php @@ -13,7 +13,7 @@