mirror of
https://github.com/danpros/htmly.git
synced 2026-04-19 03:56:21 +05:30
Improve pages/subpages
Allow to reorder the pages and subpages position. Added doks theme
This commit is contained in:
parent
672aec1278
commit
8d142b7f37
46 changed files with 4860 additions and 94 deletions
|
|
@ -550,6 +550,8 @@ function add_page($title, $url, $content, $draft, $description = null)
|
|||
function add_sub_page($title, $url, $content, $static, $draft, $description = null)
|
||||
{
|
||||
|
||||
$post = find_page($static);
|
||||
$static = pathinfo($post['current']->md, PATHINFO_FILENAME);
|
||||
$post_title = safe_html($title);
|
||||
$post_url = strtolower(preg_replace(array('/[^a-zA-Z0-9 \-\p{L}]/u', '/[ -]+/', '/^-|-$/'), array('', '-', ''), remove_accent($url)));
|
||||
$description = safe_html($description);
|
||||
|
|
@ -604,10 +606,17 @@ function add_sub_page($title, $url, $content, $static, $draft, $description = nu
|
|||
function edit_page($title, $url, $content, $oldfile, $revertPage, $publishDraft, $destination = null, $description = null, $static = null)
|
||||
{
|
||||
$dir = pathinfo($oldfile, PATHINFO_DIRNAME);
|
||||
$fn = explode('.', pathinfo($oldfile, PATHINFO_FILENAME));
|
||||
if (isset($fn[1])) {
|
||||
$num = $fn[0] . '.';
|
||||
} else {
|
||||
$num = null;
|
||||
}
|
||||
$views = array();
|
||||
$viewsFile = "content/data/views.json";
|
||||
$post_title = safe_html($title);
|
||||
$post_url = strtolower(preg_replace(array('/[^a-zA-Z0-9 \-\p{L}]/u', '/[ -]+/', '/^-|-$/'), array('', '-', ''), remove_accent($url)));
|
||||
$pUrl = strtolower(preg_replace(array('/[^a-zA-Z0-9 \-\p{L}]/u', '/[ -]+/', '/^-|-$/'), array('', '-', ''), remove_accent($url)));
|
||||
$post_url = $num . $pUrl;
|
||||
$description = safe_html($description);
|
||||
if ($description !== null) {
|
||||
if (!empty($description)) {
|
||||
|
|
@ -663,10 +672,16 @@ function edit_page($title, $url, $content, $oldfile, $revertPage, $publishDraft,
|
|||
}
|
||||
}
|
||||
|
||||
if (!empty($static)) {
|
||||
$posturl = site_url() . $static .'/'. $post_url;
|
||||
$cl = explode('.', $post_url);
|
||||
if (isset($cl[1])) {
|
||||
$pu = $cl[1];
|
||||
} else {
|
||||
$posturl = site_url() . $post_url;
|
||||
$pu = $post_url;
|
||||
}
|
||||
if (!empty($static)) {
|
||||
$posturl = site_url() . $static .'/'. $pu;
|
||||
} else {
|
||||
$posturl = site_url() . $pu;
|
||||
}
|
||||
|
||||
rebuilt_cache('all');
|
||||
|
|
@ -957,14 +972,20 @@ function find_draft_page($static = null)
|
|||
$post = new stdClass;
|
||||
|
||||
// The static page URL
|
||||
$url= $v['filename'];
|
||||
$fn = explode('.', $v['filename']);
|
||||
|
||||
if (isset($fn[1])) {
|
||||
$url = $fn[1];
|
||||
} else {
|
||||
$url= $v['filename'];
|
||||
}
|
||||
|
||||
$post->url = site_url() . $url;
|
||||
|
||||
$post->file = $v['dirname'] . '/' . $v['basename'];
|
||||
$post->lastMod = strtotime(date('Y-m-d H:i:s', filemtime($post->file)));
|
||||
|
||||
$post->md = $url;
|
||||
$post->md = $v['basename'];
|
||||
$post->slug = $url;
|
||||
$post->parent = null;
|
||||
|
||||
|
|
@ -1010,8 +1031,14 @@ function find_draft_subpage($static = null, $sub_static = null)
|
|||
|
||||
$post = new stdClass;
|
||||
|
||||
// The static file
|
||||
$url= $v['filename'];
|
||||
// The static page URL
|
||||
$fn = explode('.', $v['filename']);
|
||||
|
||||
if (isset($fn[1])) {
|
||||
$url = $fn[1];
|
||||
} else {
|
||||
$url= $v['filename'];
|
||||
}
|
||||
|
||||
if (is_null($static)) {
|
||||
$parent = str_replace('content/static/', '', dirname($v['dirname']));
|
||||
|
|
@ -1025,7 +1052,7 @@ function find_draft_subpage($static = null, $sub_static = null)
|
|||
$post->file = $v['dirname'] . '/' . $v['basename'];
|
||||
$post->lastMod = strtotime(date('Y-m-d H:i:s', filemtime($post->file)));
|
||||
|
||||
$post->md = $url;
|
||||
$post->md = $v['basename'];
|
||||
$post->slug = $url;
|
||||
|
||||
// Get the contents and convert it to HTML
|
||||
|
|
@ -1463,3 +1490,60 @@ function rename_category_folder($new_name, $old_file)
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
// reorder the static page
|
||||
function reorder_pages($pages = null)
|
||||
{
|
||||
|
||||
$i = 1;
|
||||
$arr = array();
|
||||
$dir = 'content/static/';
|
||||
foreach ($pages as $p) {
|
||||
$fn = pathinfo($p, PATHINFO_FILENAME);
|
||||
$num = str_pad($i, 2, 0, STR_PAD_LEFT);
|
||||
$arr = explode('.' , $fn);
|
||||
if (isset($arr[1])) {
|
||||
rename ($dir . $p, $dir . $num . '.' . $arr[1] . '.md');
|
||||
|
||||
if (is_dir($dir . $fn)) {
|
||||
rename($dir . $fn, $dir . $num . '.' . $arr[1]);
|
||||
}
|
||||
|
||||
} else {
|
||||
rename($dir . $p, $dir . $num . '.' . $fn . '.md');
|
||||
|
||||
if (is_dir($dir . $fn)) {
|
||||
rename($dir . $fn, $dir . $num . '.' . $fn);
|
||||
}
|
||||
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
rebuilt_cache();
|
||||
|
||||
}
|
||||
|
||||
// reorder the subpage
|
||||
function reorder_subpages($subpages = null)
|
||||
{
|
||||
$i = 1;
|
||||
$arr = array();
|
||||
$dir = 'content/static/';
|
||||
foreach ($subpages as $sp) {
|
||||
$dn = $dir . pathinfo($sp, PATHINFO_DIRNAME) . '/';
|
||||
$fn = pathinfo($sp, PATHINFO_FILENAME);
|
||||
$num = str_pad($i, 2, 0, STR_PAD_LEFT);
|
||||
$arr = explode('.' , $fn);
|
||||
if (isset($arr[1])) {
|
||||
rename ($dir . $sp, $dn . $num . '.' . $arr[1] . '.md');
|
||||
} else {
|
||||
rename($dir . $sp, $dn . $num . '.' . $fn . '.md');
|
||||
}
|
||||
|
||||
$i++;
|
||||
|
||||
}
|
||||
|
||||
rebuilt_cache();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ $( function() {
|
|||
<label for="pCategory"><?php echo i18n('Category');?> <span class="required">*</span></label>
|
||||
<select id="pCategory" class="form-control" name="category">
|
||||
<?php foreach ($desc as $d):?>
|
||||
<option value="<?php echo $d->md;?>"><?php echo $d->title;?></option>
|
||||
<option value="<?php echo $d->slug;?>"><?php echo $d->title;?></option>
|
||||
<?php endforeach;?>
|
||||
</select>
|
||||
<br>
|
||||
|
|
|
|||
|
|
@ -7,20 +7,24 @@ $desc = get_category_info(null);
|
|||
<a class="btn btn-primary " href="<?php echo site_url();?>add/category"><?php echo i18n('Add_category');?></a>
|
||||
<br><br>
|
||||
<table class="table category-list">
|
||||
<thead>
|
||||
<tr class="head">
|
||||
<th><?php echo i18n('Name');?></th>
|
||||
<th><?php echo i18n('Description');?></th>
|
||||
<th><?php echo i18n('Contents');?></th>
|
||||
<th><?php echo i18n('Operations');?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($desc as $d):?>
|
||||
<tr>
|
||||
<td><a href="<?php echo site_url();?>admin/categories/<?php echo $d->md;?>"><?php echo $d->title;?></a></td>
|
||||
<td><a href="<?php echo site_url();?>admin/categories/<?php echo $d->slug;?>"><?php echo $d->title;?></a></td>
|
||||
<td><?php echo $d->body;?></td>
|
||||
<td><?php $total = get_draftcount($d->md) + $d->count + get_scheduledcount($d->md); echo $total?></td>
|
||||
<?php if($d->md !== 'uncategorized'):?>
|
||||
<td><a class="btn btn-primary btn-xs" href="<?php echo $d->url;?>/edit?destination=admin/categories"><?php echo i18n('Edit');?></a> <?php if ($d->count == 0 && get_draftcount($d->md) == 0 && get_scheduledcount($d->md) == 0){echo '<a class="btn btn-danger btn-xs" href="' . $d->url . '/delete?destination=admin/categories">' . i18n('Delete') . '</a>';}?></td>
|
||||
<?php endif;?>
|
||||
<td><?php $total = get_draftcount($d->slug) + $d->count + get_scheduledcount($d->slug); echo $total?></td>
|
||||
<?php if($d->slug !== 'uncategorized'):?>
|
||||
<td><a class="btn btn-primary btn-xs" href="<?php echo $d->url;?>/edit?destination=admin/categories"><?php echo i18n('Edit');?></a> <?php if ($d->count == 0 && get_draftcount($d->slug) == 0 && get_scheduledcount($d->slug) == 0){echo '<a class="btn btn-danger btn-xs" href="' . $d->url . '/delete?destination=admin/categories">' . i18n('Delete') . '</a>';}?></td>
|
||||
<?php endif;?>
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
|
|||
|
|
@ -6,18 +6,21 @@
|
|||
<br><br>
|
||||
<?php if (!empty($posts)) { ?>
|
||||
<table class="table post-list">
|
||||
<thead>
|
||||
<tr class="head">
|
||||
<th><?php echo i18n('Title');?></th>
|
||||
<th><?php echo i18n('Published');?></th>
|
||||
<th><?php echo i18n('Operations');?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($posts as $p): ?>
|
||||
<tr>
|
||||
<td><a target="_blank" href="<?php echo $p->url ?>"><?php echo $p->title ?></a></td>
|
||||
<td><?php echo format_date($p->date) ?></td>
|
||||
<?php if ($category->url !== site_url() . 'category/uncategorized') {?>
|
||||
<td><a class="btn btn-primary btn-xs" href="<?php echo $p->url ?>/edit?destination=admin/categories/<?php echo $category->md;?>"><?php echo i18n('Edit');?></a> <a
|
||||
class="btn btn-danger btn-xs" href="<?php echo $p->url ?>/delete?destination=admin/categories/<?php echo $category->md;?>"><?php echo i18n('Delete');?></a></td>
|
||||
<td><a class="btn btn-primary btn-xs" href="<?php echo $p->url ?>/edit?destination=admin/categories/<?php echo $category->slug;?>"><?php echo i18n('Edit');?></a> <a
|
||||
class="btn btn-danger btn-xs" href="<?php echo $p->url ?>/delete?destination=admin/categories/<?php echo $category->slug;?>"><?php echo i18n('Delete');?></a></td>
|
||||
<?php } else {?>
|
||||
<td><a class="btn btn-primary btn-xs" href="<?php echo $p->url ?>/edit?destination=admin/categories/uncategorized"><?php echo i18n('Edit');?></a> <a
|
||||
class="btn btn-danger btn-xs" href="<?php echo $p->url ?>/delete?destination=admin/categories/uncategorized"><?php echo i18n('Delete');?></a></td>
|
||||
|
|
@ -25,6 +28,7 @@
|
|||
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php if (!empty($pagination['prev']) || !empty($pagination['next'])): ?>
|
||||
<br>
|
||||
|
|
|
|||
|
|
@ -143,7 +143,7 @@ $( function() {
|
|||
<label for="pCategory"><?php echo i18n('Category');?> <span class="required">*</span></label>
|
||||
<select id="pCategory" class="form-control" name="category">
|
||||
<?php foreach ($desc as $d):?>
|
||||
<option value="<?php echo $d->md;?>" <?php if($category === $d->md) { echo 'selected="selected"';} ?>><?php echo $d->title;?></option>
|
||||
<option value="<?php echo $d->slug;?>" <?php if($category === $d->slug) { echo 'selected="selected"';} ?>><?php echo $d->title;?></option>
|
||||
<?php endforeach;?>
|
||||
</select>
|
||||
<br>
|
||||
|
|
|
|||
|
|
@ -34,8 +34,8 @@ if ($type == 'is_frontpage') {
|
|||
$oldtitle = $p->title;
|
||||
$olddescription = $p->description;
|
||||
$oldcontent = $p->body;
|
||||
$oldmd = $p->md;
|
||||
$url = 'content/data/category/'. $p->md . '.md';
|
||||
$oldmd = $p->slug;
|
||||
$url = 'content/data/category/'. $p->slug . '.md';
|
||||
} else {
|
||||
|
||||
if (isset($p->file)) {
|
||||
|
|
@ -55,7 +55,13 @@ if ($type == 'is_frontpage') {
|
|||
}
|
||||
$dir = pathinfo($url, PATHINFO_DIRNAME);
|
||||
$oldurl = pathinfo($url, PATHINFO_BASENAME);
|
||||
$oldmd = pathinfo($url, PATHINFO_FILENAME);
|
||||
|
||||
$fn = explode('.', pathinfo($url, PATHINFO_FILENAME));
|
||||
if (isset($fn[1])) {
|
||||
$oldmd = $fn[1];
|
||||
} else {
|
||||
$oldmd = pathinfo($url, PATHINFO_FILENAME);
|
||||
}
|
||||
|
||||
if (isset($p->url)) {
|
||||
$delete = $p->url . '/delete?destination=' . $destination;
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
<link href="<?php echo site_url() ?>system/resources/css/adminlte.min.css" rel="stylesheet">
|
||||
<link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700" rel="stylesheet">
|
||||
<script src="<?php echo site_url() ?>system/resources/js/jquery.min.js"></script>
|
||||
<script src="<?php echo site_url() ?>system/resources/js/jquery-ui.min.js"></script>
|
||||
</head>
|
||||
<?php if (login()) { ?>
|
||||
<body class="hold-transition sidebar-mini">
|
||||
|
|
|
|||
|
|
@ -107,6 +107,7 @@ function parseMenu($menu) {
|
|||
data: {'json': js},
|
||||
success: function (response) {
|
||||
alert(response.message);
|
||||
location.reload();
|
||||
},
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
<br><br>
|
||||
<?php if (!empty($posts)) { ?>
|
||||
<table class="table post-list">
|
||||
<thead>
|
||||
<tr class="head">
|
||||
<th><?php echo i18n('Title');?></th>
|
||||
<th><?php echo i18n('Published');?></th><?php if (config("views.counter") == "true"): ?>
|
||||
|
|
@ -14,6 +15,8 @@
|
|||
<th><?php echo i18n('Tags');?></th>
|
||||
<th><?php echo i18n('Operations');?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($posts as $p): ?>
|
||||
<?php if (strpos($p->file, '/scheduled/') == false && strpos($p->file, '/draft/') == false) { ?>
|
||||
<tr>
|
||||
|
|
@ -29,6 +32,7 @@
|
|||
</tr>
|
||||
<?php } ?>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php } else {
|
||||
echo i18n('No_posts_found') . '!';
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
<br><br>
|
||||
<?php if (!empty($posts)) { ?>
|
||||
<table class="table post-list">
|
||||
<thead>
|
||||
<tr class="head">
|
||||
<th><?php echo i18n('Title');?></th>
|
||||
<th><?php echo i18n('Published');?></th><?php if (config("views.counter") == "true"): ?>
|
||||
|
|
@ -14,6 +15,8 @@
|
|||
<th><?php echo i18n('Tags');?></th>
|
||||
<th><?php echo i18n('Operations');?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($posts as $p): ?>
|
||||
<tr>
|
||||
<td><a target="_blank" href="<?php echo $p->url ?>"><?php echo $p->title ?></a></td>
|
||||
|
|
@ -27,6 +30,7 @@
|
|||
class="btn btn-danger btn-xs" href="<?php echo $p->url ?>/delete?destination=admin/posts"><?php echo i18n('Delete');?></a></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php if (!empty($pagination['prev']) || !empty($pagination['next'])): ?>
|
||||
<br>
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
<br><br>
|
||||
<?php if (!empty($posts)) { ?>
|
||||
<table class="table post-list">
|
||||
<thead>
|
||||
<tr class="head">
|
||||
<th><?php echo i18n('Title');?></th>
|
||||
<th><?php echo i18n('Publish');?></th>
|
||||
|
|
@ -12,6 +13,8 @@
|
|||
<th><?php echo i18n('Tags');?></th>
|
||||
<th><?php echo i18n('Operations');?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($posts as $p): ?>
|
||||
<tr>
|
||||
<td><?php echo $p->title ?></td>
|
||||
|
|
@ -21,6 +24,7 @@
|
|||
<td><a class="btn btn-primary btn-xs" href="<?php echo $p->url ?>/edit?destination=admin/scheduled"><?php echo i18n('Edit');?></a> <a class="btn btn-danger btn-xs" href="<?php echo $p->url ?>/delete?destination=admin/scheduled"><?php echo i18n('Delete');?></a></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php if (!empty($pagination['prev']) || !empty($pagination['next'])): ?>
|
||||
<br>
|
||||
|
|
|
|||
|
|
@ -3,52 +3,68 @@
|
|||
<br>
|
||||
<a class="btn btn-primary right" href="<?php echo site_url();?>add/page"><?php echo i18n('Add_new_page');?></a>
|
||||
<br><br>
|
||||
<script>
|
||||
$(function() {
|
||||
|
||||
var order;
|
||||
$( "tbody" ).sortable({update: function(e, ui) {
|
||||
order = $(this).sortable('toArray');
|
||||
$("#saveButton").css({"display": "block"});
|
||||
}});
|
||||
|
||||
$("#saveButton").click(function(){
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '<?php echo site_url();?>admin/pages',
|
||||
dataType: 'json',
|
||||
data: {'json': order},
|
||||
success: function (response) {
|
||||
alert(response.message);
|
||||
location.reload();
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
<?php if (isset($_SESSION[site_url()]['user'])):?>
|
||||
<?php $posts = find_page();
|
||||
if (!empty($posts)): ?>
|
||||
<table class="table post-list">
|
||||
<tr class="head">
|
||||
<table class="table post-list" id="sortable">
|
||||
<thead>
|
||||
<tr class="head" id="head">
|
||||
<th><?php echo i18n('Title');?> </th>
|
||||
<?php if (config("views.counter") == "true"):?>
|
||||
<th><?php echo i18n('Views');?></th>
|
||||
<?php endif;?>
|
||||
<th><?php echo i18n('Description');?></th>
|
||||
<th><?php echo i18n('Operations');?></th>
|
||||
<th>Subpages</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($posts as $p):?>
|
||||
<?php $dd = find_subpage($p->md); ?>
|
||||
<?php $dr = find_draft_subpage($p->md);?>
|
||||
<tr>
|
||||
<td><a target="_blank" href="<?php echo $p->url;?>"><?php echo $p->title;?></a></td>
|
||||
<?php if (config("views.counter") == "true"):?>
|
||||
<td><i class="nav-icon fa fa-line-chart"></i> <?php echo $p->views;?></td>
|
||||
<?php endif;?>
|
||||
<td><a class="btn btn-primary btn-xs" href="<?php echo $p->url;?>/add?destination=admin/pages"><?php echo i18n('Add_sub');?></a> <a class="btn btn-primary btn-xs" href="<?php echo $p->url;?>/edit?destination=admin/pages"><?php echo i18n('Edit');?></a> <?php if (empty($dd) && empty($dr)):?><a class="btn btn-danger btn-xs" href="<?php echo $p->url;?>/delete?destination=admin/pages"><?php echo i18n('Delete');?></a><?php endif;?></td>
|
||||
<?php $dd = find_subpage($p->slug); ?>
|
||||
<?php $dr = find_draft_subpage($p->slug);?>
|
||||
<tr id="<?php echo $p->md;?>" class="sort-item" style="cursor:move;">
|
||||
<td><a href="<?php echo site_url();?>admin/pages/<?php echo $p->slug;?>"><?php echo $p->title;?></a></td>
|
||||
<td><?php echo shorten($p->description, '50');?>...</td>
|
||||
<td><a class="btn btn-primary btn-xs" href="<?php echo $p->url;?>/add?destination=admin/pages/<?php echo $p->slug;?>"><?php echo i18n('Add_sub');?></a> <a class="btn btn-primary btn-xs" href="<?php echo $p->url;?>/edit?destination=admin/pages"><?php echo i18n('Edit');?></a> <?php if (empty($dd) && empty($dr)):?><a class="btn btn-danger btn-xs" href="<?php echo $p->url;?>/delete?destination=admin/pages"><?php echo i18n('Delete');?></a><?php endif;?></td>
|
||||
<td>
|
||||
<table>
|
||||
<?php $subPages = find_subpage($p->md);
|
||||
foreach ($subPages as $sp):?>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-6 col-md-4">
|
||||
<span><a target="_blank" href="<?php echo $sp->url;?>"><?php echo $sp->title;?></a></span>
|
||||
</div>
|
||||
<div class="col-6 col-md-4">
|
||||
<?php if (config("views.counter") == "true"):?>
|
||||
<span><i class="nav-icon fa fa-line-chart"></i> <?php echo $sp->views;?></span>
|
||||
<?php endif;?></div>
|
||||
<div class="col-6 col-md-4">
|
||||
<span><a class="btn btn-primary btn-xs" href="<?php echo $sp->url;?>/edit?destination=admin/pages"><?php echo i18n('Edit');?></a> <a class="btn btn-danger btn-xs" href="<?php echo $sp->url;?>/delete?destination=admin/pages"><?php echo i18n('Delete');?></a></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php endforeach;?>
|
||||
|
||||
</table>
|
||||
<div><a class="btn btn-primary btn-xs" href="<?php echo site_url();?>admin/pages/<?php echo $p->slug;?>">Manage subpages</a></div><hr>
|
||||
<?php foreach ($dd as $sp):?>
|
||||
<div class="row">
|
||||
<div class="col-sm">
|
||||
<span><a target="_blank" href="<?php echo $sp->url;?>"><?php echo $sp->title;?></a></span>
|
||||
</div>
|
||||
<div class="col-sm">
|
||||
<span><a class="btn btn-primary btn-xs" href="<?php echo $sp->url;?>/edit?destination=admin/pages"><?php echo i18n('Edit');?></a> <a class="btn btn-danger btn-xs" href="<?php echo $sp->url;?>/delete?destination=admin/pages"><?php echo i18n('Delete');?></a></span>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach;?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php endforeach;?>
|
||||
</tbody>
|
||||
</table>
|
||||
<br>
|
||||
<button class="btn btn-primary" style="display:none" id="saveButton">Save page order</button>
|
||||
<?php endif;?>
|
||||
<?php endif;?>
|
||||
57
system/admin/views/static-subpages.html.php
Normal file
57
system/admin/views/static-subpages.html.php
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
<?php if (!defined('HTMLY')) die('HTMLy'); ?>
|
||||
<a href="<?php echo $static->url;?>/edit?destination=admin/pages"><?php echo i18n('Edit');?></a>
|
||||
<h2 class="post-index"><?php echo $static->title ?></h2>
|
||||
<div><?php echo $static->description;?></div>
|
||||
<br>
|
||||
<a class="btn btn-primary right" href="<?php echo $static->url;?>/add?destination=admin/pages/<?php echo $static->slug;?>"><?php echo i18n('Add_sub');?></a>
|
||||
<br><br>
|
||||
<script>
|
||||
$(function() {
|
||||
|
||||
var order;
|
||||
$( "tbody" ).sortable({update: function(e, ui) {
|
||||
order = $(this).sortable('toArray');
|
||||
$("#saveButton").css({"display": "block"});
|
||||
}});
|
||||
|
||||
$("#saveButton").click(function(){
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '<?php echo site_url();?>admin/pages/<?php echo $static->slug;?>',
|
||||
dataType: 'json',
|
||||
data: {'json': order},
|
||||
success: function (response) {
|
||||
alert(response.message);
|
||||
location.reload();
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
<?php $posts = find_subpage($p->slug);?>
|
||||
<?php if (!empty($posts)) { ?>
|
||||
<table class="table post-list">
|
||||
<thead>
|
||||
<tr class="head">
|
||||
<th><?php echo i18n('Title');?></th>
|
||||
<th><?php echo i18n('Description');?></th>
|
||||
<th><?php echo i18n('Operations');?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($posts as $sp): ?>
|
||||
<tr id="<?php echo $sp->parent;?>/<?php echo $sp->md;?>" style="cursor:move;">
|
||||
<td><a href="<?php echo $sp->url ?>"><?php echo $sp->title ?></a></td>
|
||||
<td><?php echo $sp->description;?></td>
|
||||
<td> <span><a class="btn btn-primary btn-xs" href="<?php echo $sp->url;?>/edit?destination=admin/pages/<?php echo $static->slug;?>"><?php echo i18n('Edit');?></a> <a class="btn btn-danger btn-xs" href="<?php echo $sp->url;?>/delete?destination=admin/pages/<?php echo $static->slug;?>"><?php echo i18n('Delete');?></a></span></td>
|
||||
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<br>
|
||||
<button class="btn btn-primary" style="display:none" id="saveButton">Save page order</button>
|
||||
<?php } else {
|
||||
echo i18n('No_posts_found') . '!';
|
||||
} ?>
|
||||
|
|
@ -5,6 +5,7 @@
|
|||
<br><br>
|
||||
<?php if (!empty($posts)) { ?>
|
||||
<table class="table post-list">
|
||||
<thead>
|
||||
<tr class="head">
|
||||
<th><?php echo i18n('Title');?></th>
|
||||
<th><?php echo i18n('Created');?></th>
|
||||
|
|
@ -12,6 +13,8 @@
|
|||
<th><?php echo i18n('Tags');?></th>
|
||||
<th><?php echo i18n('Operations');?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($posts as $p): ?>
|
||||
<tr>
|
||||
<td><?php echo $p->title ?></td>
|
||||
|
|
@ -21,6 +24,7 @@
|
|||
<td><a class="btn btn-primary btn-xs" href="<?php echo $p->url ?>/edit?destination=admin/draft"><?php echo i18n('Edit');?></a> <a class="btn btn-danger btn-xs" href="<?php echo $p->url ?>/delete?destination=admin/draft"><?php echo i18n('Delete');?></a></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php if (!empty($pagination['prev']) || !empty($pagination['next'])): ?>
|
||||
<br>
|
||||
|
|
@ -55,7 +59,7 @@
|
|||
<th><?php echo i18n('Operations');?></th>
|
||||
</tr>
|
||||
<?php foreach ($draftPages as $d): ?>
|
||||
<?php $count = count(find_subpage($d->md)); ?>
|
||||
<?php $count = count(find_subpage($d->md)); ?>
|
||||
<tr>
|
||||
<td><?php echo $d->title ?></td>
|
||||
<td><?php echo format_date($d->lastMod) ?></td>
|
||||
|
|
@ -74,15 +78,15 @@
|
|||
<th><?php echo i18n('Title');?></th>
|
||||
<th><?php echo i18n('Created');?></th>
|
||||
<th><?php echo i18n('Operations');?></th>
|
||||
<th><?php echo i18n('Static_pages');?></th>
|
||||
<th><?php echo i18n('Static_pages');?></th>
|
||||
</tr>
|
||||
<?php foreach ($draftSubpages as $sp): ?>
|
||||
<?php $parent = find_page($sp->parent);?>
|
||||
<?php $parent = find_page($sp->parent);?>
|
||||
<tr>
|
||||
<td><?php echo $sp->title ?></td>
|
||||
<td><?php echo format_date($sp->lastMod) ?></td>
|
||||
<td><a class="btn btn-primary btn-xs" href="<?php echo $sp->url ?>/edit?destination=admin/draft"><?php echo i18n('Edit');?></a> <a class="btn btn-danger btn-xs" href="<?php echo $sp->url ?>/delete?destination=admin/draft"><?php echo i18n('Delete');?></a></td>
|
||||
<td><a href="<?php echo $parent['current']->url;?>"><?php echo $parent['current']->title;?></a></td>
|
||||
<td><a href="<?php echo $parent['current']->url;?>"><?php echo $parent['current']->title;?></a></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
<br><br>
|
||||
<?php if (!empty($posts)) { ?>
|
||||
<table class="table post-list">
|
||||
<thead>
|
||||
<tr class="head">
|
||||
<th><?php echo i18n('Title');?></th>
|
||||
<th><?php echo i18n('Published');?></th>
|
||||
|
|
@ -15,6 +16,8 @@
|
|||
<th><?php echo i18n('Tags');?></th>
|
||||
<th><?php echo i18n('Operations');?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($posts as $p): ?>
|
||||
<tr>
|
||||
<td><a target="_blank" href="<?php echo $p->url ?>"><?php echo $p->title ?></a></td>
|
||||
|
|
@ -27,6 +30,7 @@
|
|||
<td><a class="btn btn-primary btn-xs" href="<?php echo $p->url ?>/edit?destination=admin/mine"><?php echo i18n('Edit');?></a> <a class="btn btn-danger btn-xs" href="<?php echo $p->url ?>/delete?destination=admin/mine"><?php echo i18n('Delete');?></a></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php if (!empty($pagination['prev']) || !empty($pagination['next'])): ?>
|
||||
<br>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue