🚸 (content): merge sticky to other lists
This commit is contained in:
parent
518e881543
commit
fd69475e4e
2 changed files with 36 additions and 46 deletions
|
@ -35,11 +35,10 @@ function filterContentOwner($list) {
|
|||
// Main after POST
|
||||
// ============================================================================
|
||||
|
||||
$published = $pages->getList($url->pageNumber(), ITEMS_PER_PAGE_ADMIN, ['article'], ['published'], false, false);
|
||||
$published = $pages->getList($url->pageNumber(), ITEMS_PER_PAGE_ADMIN, ['article'], ['published'], true, true);
|
||||
$drafts = $pages->getDraftDB(['article'], true);
|
||||
$scheduled = $pages->getScheduledDB(['article'],true);
|
||||
$static = $pages->getStaticDB(['published'],true);
|
||||
$sticky = $pages->getStickyDB(['article'],['published'],true);
|
||||
$autosave = $pages->getAutosaveDB(['article'],true);
|
||||
|
||||
// If the user is an Author filter the content he/she can edit
|
||||
|
@ -48,7 +47,6 @@ if (checkRole(array('author'), false)) {
|
|||
$drafts = filterContentOwner($drafts);
|
||||
$scheduled = filterContentOwner($scheduled);
|
||||
$static = filterContentOwner($static);
|
||||
$sticky = filterContentOwner($sticky);
|
||||
}
|
||||
|
||||
// Check if out of range the pageNumber
|
||||
|
|
|
@ -9,7 +9,6 @@ function table($type) {
|
|||
global $drafts;
|
||||
global $scheduled;
|
||||
global $static;
|
||||
global $sticky;
|
||||
global $autosave;
|
||||
|
||||
if ($type=='published') {
|
||||
|
@ -44,14 +43,6 @@ function table($type) {
|
|||
echo '</p>';
|
||||
return false;
|
||||
}
|
||||
} elseif ($type=='sticky') {
|
||||
$list = $sticky;
|
||||
if (empty($list)) {
|
||||
echo '<p class="alert alert-warning">';
|
||||
echo $L->g('There are no sticky pages at this moment.');
|
||||
echo '</p>';
|
||||
return false;
|
||||
}
|
||||
} elseif ($type=='autosave') {
|
||||
$list = $autosave;
|
||||
}
|
||||
|
@ -64,7 +55,7 @@ function table($type) {
|
|||
<th class="border-0" scope="col">'.$L->g('Title').'</th>
|
||||
';
|
||||
|
||||
if ($type=='published' || $type=='static' || $type=='sticky') {
|
||||
if ($type=='published' || $type=='static') {
|
||||
echo '<th class="border-0 d-none d-lg-table-cell" scope="col">'.$L->g('URL').'</th>';
|
||||
}
|
||||
|
||||
|
@ -81,22 +72,27 @@ function table($type) {
|
|||
if (!$page->isChild()) {
|
||||
echo '<tr class="card-tablebody">
|
||||
<td>
|
||||
<div>
|
||||
<a style="font-size: 1.1em" href="'.HTML_PATH_ADMIN_ROOT.'edit-content/'.$page->key().'">'
|
||||
.($page->title()?$page->title():'<span class="label-empty-title">'.$L->g('Empty title').'</span> ')
|
||||
.'</a>
|
||||
</div>
|
||||
<div>
|
||||
<p style="font-size: 0.8em" class="m-0 text-uppercase text-muted">'.( ((ORDER_BY=='position') || ($type!='published'))?$L->g('Position').': '.$page->position():$page->date(MANAGE_CONTENT_DATE_FORMAT) ).'</p>
|
||||
<div class="d-flex align-items-center">'
|
||||
.($page->sticky()?'<div><span><i class="fa fa-fw fa-thumbtack text-secondary"></i></span></div> ':'')
|
||||
.'<div>
|
||||
<div>
|
||||
<a style="font-size: 1.1em" href="'.HTML_PATH_ADMIN_ROOT.'edit-content/'.$page->key().'">'
|
||||
.($page->title()?$page->title():'<span class="label-empty-title">'.$L->g('Empty title').'</span> ')
|
||||
.'</a>
|
||||
</div>
|
||||
<div>
|
||||
<p style="font-size: 0.8em" class="m-0 text-uppercase text-muted">'.( ((ORDER_BY=='position') || ($type!='published'))?$L->g('Position').': '.$page->position():$page->date(MANAGE_CONTENT_DATE_FORMAT) ).'</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>';
|
||||
|
||||
if ($type=='published' || $type=='static' || $type=='sticky') {
|
||||
if ($type=='published' || $type=='static') {
|
||||
$friendlyURL = Text::isEmpty($url->filters('page')) ? '/'.$page->key() : '/'.$url->filters('page').'/'.$page->key();
|
||||
echo '<td class="d-none d-lg-table-cell"><a target="_blank" href="'.$page->permalink().'">'.$friendlyURL.'</a></td>';
|
||||
}
|
||||
|
||||
echo '<td class="contentTools pt-3 text-end d-sm-table-cell">'.PHP_EOL;
|
||||
echo '<td class="contentTools p-2 text-end d-sm-table-cell">'.PHP_EOL;
|
||||
echo '<a class="btn btn-sm btn-secondary d-none d-md-inline" target="_blank" href="'.$page->permalink().'"><i class="fa fa-desktop"></i>'.$L->g('View').'</a>'.PHP_EOL;
|
||||
echo '<a class="btn btn-sm btn-secondary d-none d-md-inline ms-2" href="'.HTML_PATH_ADMIN_ROOT.'edit-content/'.$page->key().'"><i class="fa fa-edit"></i>'.$L->g('Edit').'</a>'.PHP_EOL;
|
||||
if (count($page->children())==0) {
|
||||
|
@ -120,13 +116,13 @@ function table($type) {
|
|||
</div>
|
||||
</td>';
|
||||
|
||||
if ($type=='published' || $type=='static' || $type=='sticky') {
|
||||
if ($type=='published' || $type=='static') {
|
||||
$friendlyURL = Text::isEmpty($url->filters('page')) ? '/'.$child->key() : '/'.$url->filters('page').'/'.$child->key();
|
||||
echo '<td class="d-none d-lg-table-cell"><a target="_blank" href="'.$child->permalink().'">'.$friendlyURL.'</a></td>';
|
||||
}
|
||||
|
||||
echo '<td class="contentTools pt-3 text-end d-sm-table-cell">'.PHP_EOL;
|
||||
if ($type=='published' || $type=='static' || $type=='sticky') {
|
||||
echo '<td class="contentTools p-2 text-end d-sm-table-cell">'.PHP_EOL;
|
||||
if ($type=='published' || $type=='static') {
|
||||
echo '<a class="btn btn-sm btn-secondary d-none d-md-inline" target="_blank" href="'.$child->permalink().'"><i class="fa fa-desktop"></i>'.$L->g('View').'</a>'.PHP_EOL;
|
||||
}
|
||||
echo '<a class="btn btn-sm btn-secondary d-none d-md-inline ms-2" href="'.HTML_PATH_ADMIN_ROOT.'edit-content/'.$child->key().'"><i class="fa fa-edit"></i>'.$L->g('Edit').'</a>'.PHP_EOL;
|
||||
|
@ -146,24 +142,28 @@ function table($type) {
|
|||
try {
|
||||
$page = new Page($pageKey);
|
||||
echo '<tr class="card-tablebody">';
|
||||
echo '<td class="pt-3">
|
||||
<div>
|
||||
<a style="font-size: 1.1em" href="'.HTML_PATH_ADMIN_ROOT.'edit-content/'.$page->key().'">'
|
||||
.($page->title()?$page->title():'<span class="label-empty-title">'.$L->g('Empty title').'</span> ')
|
||||
.'</a>
|
||||
</div>
|
||||
<div>
|
||||
<p style="font-size: 0.8em" class="m-0 text-uppercase text-muted">'.( ($type=='scheduled')?$L->g('Scheduled').': '.$page->date(SCHEDULED_DATE_FORMAT):$page->date(MANAGE_CONTENT_DATE_FORMAT) ).'</p>
|
||||
</div>
|
||||
echo '<td class="p-2">
|
||||
<div class="d-flex align-items-center">'
|
||||
.($page->sticky()?'<div><span><i class="fa fa-fw fa-thumbtack text-secondary"></i></span></div> ':'')
|
||||
.'<div>
|
||||
<div>'
|
||||
.'<a style="font-size: 1.1em" href="'.HTML_PATH_ADMIN_ROOT.'edit-content/'.$page->key().'">'
|
||||
.($page->title()?$page->title():'<span class="label-empty-title">'.$L->g('Empty title').'</span> ')
|
||||
.'</a>
|
||||
</div>
|
||||
<div>
|
||||
<p style="font-size: 0.8em" class="m-0 text-uppercase text-muted">'.( ($type=='scheduled')?$L->g('Scheduled').': '.$page->date(SCHEDULED_DATE_FORMAT):$page->date(MANAGE_CONTENT_DATE_FORMAT) ).'</p>
|
||||
</div>
|
||||
</div>
|
||||
</td>';
|
||||
|
||||
if ($type=='published' || $type=='static' || $type=='sticky') {
|
||||
if ($type=='published' || $type=='static') {
|
||||
$friendlyURL = Text::isEmpty($url->filters('page')) ? '/'.$page->key() : '/'.$url->filters('page').'/'.$page->key();
|
||||
echo '<td class="pt-3 d-none d-lg-table-cell"><a target="_blank" href="'.$page->permalink().'">'.$friendlyURL.'</a></td>';
|
||||
echo '<td class="p-2 d-none d-lg-table-cell"><a target="_blank" href="'.$page->permalink().'">'.$friendlyURL.'</a></td>';
|
||||
}
|
||||
|
||||
echo '<td class="contentTools pt-3 text-end d-sm-table-cell">'.PHP_EOL;
|
||||
if ($type=='published' || $type=='static' || $type=='sticky') {
|
||||
echo '<td class="contentTools p-2 text-end d-sm-table-cell">'.PHP_EOL;
|
||||
if ($type=='published' || $type=='static') {
|
||||
echo '<a class="btn btn-sm btn-secondary d-none d-md-inline" target="_blank" href="'.$page->permalink().'"><i class="fa fa-desktop"></i>'.$L->g('View').'</a>'.PHP_EOL;
|
||||
}
|
||||
echo '<a class="btn btn-sm btn-secondary d-none d-md-inline ms-2" href="'.HTML_PATH_ADMIN_ROOT.'edit-content/'.$page->key().'"><i class="fa fa-edit"></i>'.$L->g('Edit').'</a>'.PHP_EOL;
|
||||
|
@ -196,9 +196,6 @@ function table($type) {
|
|||
<li class="nav-item" role="presentation">
|
||||
<button class="nav-link" id="static-tab" data-bs-toggle="tab" data-bs-target="#static" role="tab"><?php $L->p('Static') ?></button>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<button class="nav-link" id="sticky-tab" data-bs-toggle="tab" data-bs-target="#sticky" role="tab"><?php $L->p('Sticky') ?></button>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<button class="nav-link" id="scheduled-tab" data-bs-toggle="tab" data-bs-target="#scheduled" role="tab"><?php $L->p('Scheduled') ?> <?php if (count($scheduled)>0) { echo '<span class="badge bg-danger" style="position:relative;top:-2px;">'.count($scheduled).'</span>'; } ?></button>
|
||||
</li>
|
||||
|
@ -252,11 +249,6 @@ function table($type) {
|
|||
<?php table('static'); ?>
|
||||
</div>
|
||||
|
||||
<!-- TABS STICKY -->
|
||||
<div class="tab-pane" id="sticky" role="tabpanel">
|
||||
<?php table('sticky'); ?>
|
||||
</div>
|
||||
|
||||
<!-- TABS SCHEDULED -->
|
||||
<div class="tab-pane" id="scheduled" role="tabpanel">
|
||||
<?php table('scheduled'); ?>
|
||||
|
|
Loading…
Reference in a new issue