diff --git a/bl-kernel/admin/controllers/content.php b/bl-kernel/admin/controllers/content.php
index 425199bb..69638449 100644
--- a/bl-kernel/admin/controllers/content.php
+++ b/bl-kernel/admin/controllers/content.php
@@ -21,7 +21,7 @@
// ============================================================================
// List of published pages
-$onlyPublished = true;
+$onlyPublished = false;
$amountOfItems = ITEMS_PER_PAGE_ADMIN;
$pageNumber = $Url->pageNumber();
$published = $dbPages->getList($pageNumber, $amountOfItems, $onlyPublished);
diff --git a/bl-kernel/admin/themes/default/css/default.css b/bl-kernel/admin/themes/default/css/default.css
index 543c274a..5e9d4b28 100644
--- a/bl-kernel/admin/themes/default/css/default.css
+++ b/bl-kernel/admin/themes/default/css/default.css
@@ -302,6 +302,10 @@ button.aslink:hover {
padding: 14px 8px !important;
}
+.uk-table td.child-title {
+ padding-left: 20px !important;
+}
+
/* RESPONSIVE
---------------------------------------------------------------- */
diff --git a/bl-kernel/admin/views/content.php b/bl-kernel/admin/views/content.php
index 2249bf98..f0e2f136 100644
--- a/bl-kernel/admin/views/content.php
+++ b/bl-kernel/admin/views/content.php
@@ -20,6 +20,8 @@ echo '
';
+
+
function table($status, $icon='arrow-circle-o-down') {
global $Url;
global $Language;
@@ -40,27 +42,64 @@ function table($status, $icon='arrow-circle-o-down') {
if (!empty($list)) {
echo '
- '.$Language->g($status).' |
+ '.$Language->g($status).' |
|
|
';
}
- foreach($list as $pageKey) {
- $page = buildPage($pageKey);
- if ($page) {
- echo '';
- echo '
- '
- .($page->title()?$page->title():''.$Language->g('Empty title').' ')
- .'
- | ';
+ if (ORDER_BY=='position') {
+ foreach ($list as $pageKey) {
+ $page = buildPage($pageKey);
+ if ($page) {
+ if ($page->isParent()) {
+ echo '
+
+ '
+ .($page->title()?$page->title():''.$Language->g('Empty title').' ')
+ .'
+ |
+ '.$page->position().' | ';
- echo ''.( (ORDER_BY=='date') ? $page->dateRaw(ADMIN_PANEL_DATE_FORMAT) : $page->position() ).' | ';
+ $friendlyURL = Text::isEmpty($Url->filters('page')) ? '/'.$page->key() : '/'.$Url->filters('page').'/'.$page->key();
+ echo ''.$friendlyURL.' | ';
+ echo '
';
- $friendlyURL = Text::isEmpty($Url->filters('page')) ? '/'.$page->key() : '/'.$Url->filters('page').'/'.$page->key();
- echo ''.$friendlyURL.' | ';
- echo '';
+ foreach ($page->children() as $childKey) {
+ $child = buildPage($childKey);
+ echo '
+
+
+ '
+ .($child->title()?$child->title():''.$Language->g('Empty title').' ')
+ .'
+ |
+ '.$child->position().' | ';
+
+ $friendlyURL = Text::isEmpty($Url->filters('page')) ? '/'.$child->key() : '/'.$Url->filters('page').'/'.$child->key();
+ echo ''.$friendlyURL.' | ';
+ echo '
';
+ }
+ }
+ }
+ }
+ } else {
+ foreach ($list as $pageKey) {
+ $page = buildPage($pageKey);
+ if ($page) {
+ echo '';
+ echo '
+ '
+ .($page->title()?$page->title():''.$Language->g('Empty title').' ')
+ .'
+ | ';
+
+ echo ''.( (ORDER_BY=='date') ? $page->dateRaw(ADMIN_PANEL_DATE_FORMAT) : $page->position() ).' | ';
+
+ $friendlyURL = Text::isEmpty($Url->filters('page')) ? '/'.$page->key() : '/'.$Url->filters('page').'/'.$page->key();
+ echo ''.$friendlyURL.' | ';
+ echo '
';
+ }
}
}
}
@@ -70,7 +109,7 @@ if ($Url->pageNumber()==1) {
table('scheduled', 'clock-o');
table('static', 'thumb-tack');
}
-table('published', 'check');
+table('published', 'circle-o');
echo '
diff --git a/bl-kernel/admin/views/edit-content.php b/bl-kernel/admin/views/edit-content.php
index a0333ff3..0baa4e84 100644
--- a/bl-kernel/admin/views/edit-content.php
+++ b/bl-kernel/admin/views/edit-content.php
@@ -285,6 +285,15 @@ $(document).ready(function()
}
});
+ $("#jsstatus").change(function() {
+ if ($(this).val()=='static') {
+ $("#jsparent").val(' ');
+ $("#jsparent").attr('disabled','disabled');
+ } else {
+ $("#jsparent").removeAttr('disabled');
+ }
+ });
+
});
\ No newline at end of file
diff --git a/bl-kernel/admin/views/new-content.php b/bl-kernel/admin/views/new-content.php
index 7ed7096e..674c45e7 100644
--- a/bl-kernel/admin/views/new-content.php
+++ b/bl-kernel/admin/views/new-content.php
@@ -253,6 +253,15 @@ $(document).ready(function()
}
});
+ $("#jsstatus").change(function() {
+ if ($(this).val()=='static') {
+ $("#jsparent").val(' ');
+ $("#jsparent").attr('disabled','disabled');
+ } else {
+ $("#jsparent").removeAttr('disabled');
+ }
+ });
+
});
\ No newline at end of file
diff --git a/bl-kernel/boot/variables.php b/bl-kernel/boot/variables.php
index 8f882202..2c6eb747 100644
--- a/bl-kernel/boot/variables.php
+++ b/bl-kernel/boot/variables.php
@@ -43,7 +43,7 @@ define('PAGE_BREAK', '');
define('PARENT', 'BLUDIT3849abb4cb7abd24c2d8dac17b216f17');
// Items per page for admin area
-define('ITEMS_PER_PAGE_ADMIN', 10);
+define('ITEMS_PER_PAGE_ADMIN', 20);
// Cli mode, status for new pages
define('CLI_STATUS', 'published');
diff --git a/bl-kernel/dbpages.class.php b/bl-kernel/dbpages.class.php
index 95091c26..ad1cdd4e 100644
--- a/bl-kernel/dbpages.class.php
+++ b/bl-kernel/dbpages.class.php
@@ -426,6 +426,8 @@ class dbPages extends dbJSON
return false;
}
+
+
// Returns the amount of pages
// (boolean) $total, TRUE returns the total of pages
// (boolean) $total, FALSE returns the total of published pages (without draft and scheduled)
@@ -439,7 +441,7 @@ class dbPages extends dbJSON
return count($this->db);
}
- // Returns an array with all parents pages key, a parent page is not a child
+ // Returns an array with all parents pages key. A parent page is not a child
public function getParents()
{
$db = $this->getPublishedDB();
@@ -452,6 +454,18 @@ class dbPages extends dbJSON
return $db;
}
+ public function getChildren($parentKey)
+ {
+ $tmp = $this->db;
+ $list = array();
+ foreach ($tmp as $key=>$fields) {
+ if (Text::startsWith($key, $parentKey.'/')) {
+ array_push($list, $key);
+ }
+ }
+ return $list;
+ }
+
// Return TRUE if the page exists, FALSE otherwise
public function exists($key)
{
diff --git a/bl-kernel/functions.php b/bl-kernel/functions.php
index 795f2c13..e52b2865 100644
--- a/bl-kernel/functions.php
+++ b/bl-kernel/functions.php
@@ -58,6 +58,9 @@ function buildPage($key) {
$categoryKey = $page->categoryKey();
$page->setField('categoryMap', $dbCategories->getMap($categoryKey));
+ // Get the keys of the child
+ $page->setField('children', $dbPages->getChildren($key));
+
return $page;
}
@@ -189,9 +192,6 @@ function buildPagesByParent($publishedPages=true, $staticPages=true) {
if ($publishedPages) {
$keys = array_merge($keys, $dbPages->getPublishedDB($onlyKeys));
}
- if ($staticPages) {
- $keys = array_merge($keys, $dbPages->getStaticDB($onlyKeys));
- }
foreach ($keys as $pageKey) {
$page = buildPage($pageKey);
diff --git a/bl-kernel/page.class.php b/bl-kernel/page.class.php
index d48c0de7..95495a14 100644
--- a/bl-kernel/page.class.php
+++ b/bl-kernel/page.class.php
@@ -438,14 +438,9 @@ class Page {
// Returns an array with all children's key
public function children()
{
- $tmp = array();
- $paths = Filesystem::listDirectories(PATH_PAGES.$this->getValue('key').DS);
- foreach ($paths as $path) {
- array_push($tmp, basename($path));
- }
-
- return $tmp;
+ return $this->getValue('children');
}
+
public function subpages()
{
return $this->children();
@@ -458,6 +453,11 @@ class Page {
return !empty($subpages);
}
+ public function isParent()
+ {
+ return $this->hasSubpages();
+ }
+
// Returns relative time (e.g. "1 minute ago")
// Based on http://stackoverflow.com/a/18602474