Fix manage content

This commit is contained in:
Diego Najar 2018-01-22 20:33:53 +01:00
parent 019508bcc3
commit ca6d78009c
3 changed files with 20 additions and 10 deletions

View File

@ -52,7 +52,7 @@ function table($status, $icon='arrow-circle-o-down') {
foreach ($list as $pageKey) { foreach ($list as $pageKey) {
$page = buildPage($pageKey); $page = buildPage($pageKey);
if ($page) { if ($page) {
if ($page->isParent() || $status!='published') { if (!$page->isChild() || $status!='published') {
echo '<tr> echo '<tr>
<td> <td>
<a href="'.HTML_PATH_ADMIN_ROOT.'edit-content/'.$page->key().'"><i class="fa fa-'.$icon.'"></i> ' <a href="'.HTML_PATH_ADMIN_ROOT.'edit-content/'.$page->key().'"><i class="fa fa-'.$icon.'"></i> '
@ -71,7 +71,7 @@ function table($status, $icon='arrow-circle-o-down') {
echo '<tr> echo '<tr>
<td class="child-title"> <td class="child-title">
<a href="'.HTML_PATH_ADMIN_ROOT.'edit-content/'.$child->key().'"><i class="fa fa-circle-thin"></i> ' <a href="'.HTML_PATH_ADMIN_ROOT.'edit-content/'.$child->key().'"><i class="fa fa-angle-right"></i> '
.($child->title()?$child->title():'<span class="label-empty-title">'.$Language->g('Empty title').'</span> ') .($child->title()?$child->title():'<span class="label-empty-title">'.$Language->g('Empty title').'</span> ')
.'</a> .'</a>
</td> </td>
@ -111,7 +111,7 @@ if ($Url->pageNumber()==1) {
table('scheduled', 'clock-o'); table('scheduled', 'clock-o');
table('static', 'thumb-tack'); table('static', 'thumb-tack');
} }
table('published', 'circle-o'); table('published', 'chevron-right');
echo ' echo '
</tbody> </tbody>

View File

@ -417,12 +417,6 @@ class Page {
return false; return false;
} }
// Returns TURE if the page has a parent, FALSE otherwise
public function hasParent()
{
return $this->parentKey()!==false;
}
// Returns the parent method output, if the page doesn't have a parent returns FALSE // Returns the parent method output, if the page doesn't have a parent returns FALSE
public function parentMethod($method) public function parentMethod($method)
{ {
@ -435,24 +429,38 @@ class Page {
return false; return false;
} }
// Returns TURE if the page has a parent, FALSE otherwise
public function hasParent()
{
return $this->parentKey()!==false;
}
// Returns TRUE if the page is a child, FALSE otherwise
public function isChild()
{
return $this->parentKey()!==false;
}
// Returns an array with all children's key // Returns an array with all children's key
public function children() public function children()
{ {
return $this->getValue('children'); return $this->getValue('children');
} }
// Returns an array with all children's key
public function subpages() public function subpages()
{ {
return $this->children(); return $this->children();
} }
// Returns TRUE if the page has subpages/children, FALSE otherwise // Returns TRUE if the page has children
public function hasSubpages() public function hasSubpages()
{ {
$subpages = $this->subpages(); $subpages = $this->subpages();
return !empty($subpages); return !empty($subpages);
} }
// Returns TRUE if the page is a parent
public function isParent() public function isParent()
{ {
return $this->hasSubpages(); return $this->hasSubpages();

View File

@ -609,9 +609,11 @@ if( $_SERVER['REQUEST_METHOD'] == 'POST' ) {
<input name="password" id="jspassword" type="password" class="uk-width-1-1 uk-form-large" value="<?php echo isset($_POST['password'])?$_POST['password']:'' ?>" placeholder="<?php echo $Language->get('Password') ?>"> <input name="password" id="jspassword" type="password" class="uk-width-1-1 uk-form-large" value="<?php echo isset($_POST['password'])?$_POST['password']:'' ?>" placeholder="<?php echo $Language->get('Password') ?>">
</div> </div>
<!--
<div class="uk-form-row"> <div class="uk-form-row">
<input name="email" id="jsemail" type="text" class="uk-width-1-1 uk-form-large" placeholder="<?php echo $Language->get('Email') ?>" autocomplete="off" maxlength="100"> <input name="email" id="jsemail" type="text" class="uk-width-1-1 uk-form-large" placeholder="<?php echo $Language->get('Email') ?>" autocomplete="off" maxlength="100">
</div> </div>
-->
<div class="uk-form-row"> <div class="uk-form-row">
<button type="submit" class="uk-width-1-1 uk-button uk-button-primary uk-button-large"><?php $Language->p('Install') ?></button> <button type="submit" class="uk-width-1-1 uk-button uk-button-primary uk-button-large"><?php $Language->p('Install') ?></button>