diff --git a/bl-kernel/admin/controllers/edit-page.php b/bl-kernel/admin/controllers/edit-page.php
index 350bb2fc..bf8e98ed 100644
--- a/bl-kernel/admin/controllers/edit-page.php
+++ b/bl-kernel/admin/controllers/edit-page.php
@@ -16,8 +16,7 @@
// POST Method
// ============================================================================
-if( $_SERVER['REQUEST_METHOD'] == 'POST' )
-{
+if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if( isset($_POST['delete-page']) ) {
if( deletePage($_POST['key']) ) {
Alert::set( $Language->g('The changes have been saved') );
@@ -38,13 +37,12 @@ if( $_SERVER['REQUEST_METHOD'] == 'POST' )
// ============================================================================
// Main after POST
// ============================================================================
-
-if( !$dbPages->exists($layout['parameters']) ) {
- Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to get the page: '.$layout['parameters']);
+$pageKey = $layout['parameters'];
+$page = buildPage($pageKey);
+if ($page===false) {
+ Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to get the page: '.$pageKey);
Redirect::page('pages');
}
-$page = $pagesByKey[$layout['parameters']];
-
// Title of the page
$layout['title'] .= ' - '.$Language->g('Edit Content').' - '.$page->title();
\ No newline at end of file
diff --git a/bl-kernel/admin/controllers/new-page.php b/bl-kernel/admin/controllers/new-page.php
index 7043e657..699bfefd 100644
--- a/bl-kernel/admin/controllers/new-page.php
+++ b/bl-kernel/admin/controllers/new-page.php
@@ -16,11 +16,8 @@
// POST Method
// ============================================================================
-if( $_SERVER['REQUEST_METHOD'] == 'POST' ) {
- if (createPage($_POST)!==false) {
- Alert::set( $Language->g('Page added successfully') );
- }
-
+if ($_SERVER['REQUEST_METHOD'] == 'POST') {
+ createPage($_POST);
Redirect::page('pages');
}
diff --git a/bl-kernel/admin/controllers/pages.php b/bl-kernel/admin/controllers/pages.php
index de09fb7b..7cbcb013 100644
--- a/bl-kernel/admin/controllers/pages.php
+++ b/bl-kernel/admin/controllers/pages.php
@@ -20,5 +20,23 @@
// Main after POST
// ============================================================================
+// List of published pages
+$onlyPublished = true;
+$amountOfItems = ITEMS_PER_PAGE_ADMIN;
+$pageNumber = $Url->pageNumber();
+$published = $dbPages->getList($pageNumber, $amountOfItems, $onlyPublished);
+
+// Check if out of range the pageNumber
+if (empty($published)) {
+ Redirect::page('pages');
+}
+
+// List of drafts pages
+$drafts = $dbPages->getDraftDB();
+
+$scheduled = $dbPages->getScheduledDB();
+
+$fixed = $dbPages->getFixedDB();
+
// Title of the page
$layout['title'] .= ' - '.$Language->g('Manage Content');
\ No newline at end of file
diff --git a/bl-kernel/admin/views/pages.php b/bl-kernel/admin/views/pages.php
index 382abeba..33512419 100644
--- a/bl-kernel/admin/views/pages.php
+++ b/bl-kernel/admin/views/pages.php
@@ -22,42 +22,53 @@ echo '
';
function table($status, $icon='arrow-circle-o-down') {
- global $pages;
global $Url;
global $Language;
+ global $published;
+ global $drafts;
+ global $scheduled;
+ global $fixed;
- $showLegend = true;
- foreach ($pages as $key=>$page) {
- if ($page->status()==$status) {
- if ($showLegend) {
- $showLegend = false;
- echo '
- '.$status.' |
- |
- |
-
';
- }
- unset($pages[$key]);
- echo '';
- echo '
- '
- .($page->title()?$page->title():''.$Language->g('Empty title').' ')
- .'
- | ';
+ if ($status=='published') {
+ $list = $published;
+ } elseif ($status=='draft') {
+ $list = $drafts;
+ } elseif ($status=='scheduled') {
+ $list = $scheduled;
+ } elseif ($status=='fixed') {
+ $list = $fixed;
+ }
- echo ''.( (ORDER_BY=='date') ? $page->dateRaw() : $page->position() ).' | ';
+ if (!empty($list)) {
+ echo '
+ '.$status.' |
+ |
+ |
+
';
+ }
- $friendlyURL = Text::isEmpty($Url->filters('page')) ? '/'.$page->key() : '/'.$Url->filters('page').'/'.$page->key();
- echo ''.$friendlyURL.' | ';
- echo '';
- }
+ foreach($list as $pageKey=>$fields) {
+ $page = buildPage($pageKey);
+ echo '';
+ echo '
+ '
+ .($page->title()?$page->title():''.$Language->g('Empty title').' ')
+ .'
+ | ';
+
+ echo ''.( (ORDER_BY=='date') ? $page->dateRaw() : $page->position() ).' | ';
+
+ $friendlyURL = Text::isEmpty($Url->filters('page')) ? '/'.$page->key() : '/'.$Url->filters('page').'/'.$page->key();
+ echo ''.$friendlyURL.' | ';
+ echo '
';
}
}
-table('draft', 'spinner');
-table('scheduled', 'clock-o');
-table('fixed', 'thumb-tack');
-table('sticky', 'sticky-note-o');
+if ($Url->pageNumber()==1) {
+ table('draft', 'spinner');
+ table('scheduled', 'clock-o');
+ table('fixed', 'thumb-tack');
+}
table('published', 'check');
echo '
diff --git a/bl-kernel/boot/admin.php b/bl-kernel/boot/admin.php
index 8e53517c..ee574961 100644
--- a/bl-kernel/boot/admin.php
+++ b/bl-kernel/boot/admin.php
@@ -88,5 +88,4 @@ else
// Load plugins after the admin area is loaded.
Theme::plugins('afterAdminLoad');
-
}
\ No newline at end of file
diff --git a/bl-kernel/boot/rules/69.pages.php b/bl-kernel/boot/rules/69.pages.php
index e807c0aa..685cdabc 100644
--- a/bl-kernel/boot/rules/69.pages.php
+++ b/bl-kernel/boot/rules/69.pages.php
@@ -16,18 +16,6 @@
*/
$pages = array();
-// Array with pages, each page is a Page Object
-// Filtered by pagenumber and amount of items per page
-/*
- array(
- "pageKey1" => Page Object,
- "pageKey2" => Page Object,
- ...
- "pageKeyN" => Page Object,
- )
-*/
-$pagesByKey = array();
-
// Page filtered by the user, is a Page Object
$page = $Page = false;
@@ -127,10 +115,6 @@ elseif ($Url->whereAmI()==='category') {
elseif ($Url->whereAmI()==='home') {
buildPagesForHome();
}
-// Build pages for the admin area
-elseif ($Url->whereAmI()==='admin') {
- buildPagesForAdmin();
-}
// Set page 404 not found
if ($Url->notFound()) {
diff --git a/bl-kernel/functions.php b/bl-kernel/functions.php
index 300af12e..14bc8a46 100644
--- a/bl-kernel/functions.php
+++ b/bl-kernel/functions.php
@@ -100,10 +100,6 @@ function buildThePage() {
return true;
}
-function buildPagesForAdmin() {
- return buildPagesFor('admin');
-}
-
function buildPagesForHome() {
return buildPagesFor('home');
}
@@ -128,27 +124,21 @@ function buildPagesFor($for, $categoryKey=false, $tagKey=false) {
global $dbTags;
global $Site;
global $Url;
- global $pagesByKey;
global $pages;
// Get the page number from URL
$pageNumber = $Url->pageNumber();
- if($for=='admin') {
- $onlyPublished = false;
- $amountOfItems = ITEMS_PER_PAGE_ADMIN;
- $list = $dbPages->getList($pageNumber, $amountOfItems, $onlyPublished);
- }
- elseif($for=='home') {
+ if ($for=='home') {
$onlyPublished = true;
$amountOfItems = $Site->itemsPerPage();
$list = $dbPages->getList($pageNumber, $amountOfItems, $onlyPublished);
}
- elseif($for=='category') {
+ elseif ($for=='category') {
$amountOfItems = $Site->itemsPerPage();
$list = $dbCategories->getList($categoryKey, $pageNumber, $amountOfItems);
}
- elseif($for=='tag') {
+ elseif ($for=='tag') {
$amountOfItems = $Site->itemsPerPage();
$list = $dbTags->getList($tagKey, $pageNumber, $amountOfItems);
}
@@ -160,14 +150,9 @@ function buildPagesFor($for, $categoryKey=false, $tagKey=false) {
}
$pages = array(); // global variable
- $pagesByKey = array(); // global variable
foreach($list as $pageKey=>$fields) {
$page = buildPage($pageKey);
if($page!==false) {
- // $pagesByKey
- $pagesByKey[$pageKey] = $page;
-
- // $pages
array_push($pages, $page);
}
}
@@ -309,6 +294,7 @@ function printDebug($array) {
function createPage($args) {
global $dbPages;
global $Syslog;
+ global $Language;
// The user is always the one loggued
$args['username'] = Session::get('username');
@@ -339,6 +325,8 @@ function createPage($args) {
'notes'=>$args['title']
));
+ Alert::set( $Language->g('new-page-created') );
+
return $key;
}
@@ -550,6 +538,7 @@ function editSettings($args) {
global $Site;
global $Syslog;
global $Language;
+ global $dbPages;
if (isset($args['language'])) {
if ($args['language']!=$Site->language()) {
diff --git a/bl-languages/en.json b/bl-languages/en.json
index fda66f00..cfb571c0 100644
--- a/bl-languages/en.json
+++ b/bl-languages/en.json
@@ -199,5 +199,7 @@
"this-title-is-almost-always-used-in-the-sidebar-of-the-site": "This title is almost always used in the sidebar of the site.",
"password-must-be-at-least-6-characters-long": "Password must be at least 6 characters long",
"ip-address-has-been-blocked": "IP address has been blocked",
- "try-again-in-a-few-minutes": "Try again in a few minutes"
+ "try-again-in-a-few-minutes": "Try again in a few minutes",
+ "page-published-from-scheduler": "Page published from scheduler",
+ "installer-page-about-content": "The about page is an important and powerful for potential clients and partners. For those who wonder who is behind the website, your About page is the first source of information."
}
\ No newline at end of file