bludit/bl-kernel/admin/views/edit-page.php

209 lines
4.6 KiB
PHP
Raw Normal View History

2015-10-19 00:45:58 +02:00
<?php
2015-05-05 03:00:01 +02:00
2015-10-19 00:45:58 +02:00
HTML::title(array('title'=>$L->g('Edit page'), 'icon'=>'file-text-o'));
2015-05-05 03:00:01 +02:00
2015-10-19 00:45:58 +02:00
HTML::formOpen(array('class'=>'uk-form-stacked'));
2015-05-05 03:00:01 +02:00
2015-10-19 00:45:58 +02:00
// Security token
HTML::formInputHidden(array(
2015-10-20 05:14:28 +02:00
'name'=>'tokenCSRF',
'value'=>$Security->getTokenCSRF()
2015-10-19 00:45:58 +02:00
));
2015-05-05 03:00:01 +02:00
2015-10-19 00:45:58 +02:00
// Key input
HTML::formInputHidden(array(
'name'=>'key',
'value'=>$_Page->key()
));
2015-05-05 03:00:01 +02:00
2015-10-19 00:45:58 +02:00
// ---- LEFT SIDE ----
2016-09-14 04:59:12 +02:00
echo '<div class="uk-grid uk-grid-medium">';
echo '<div class="bl-publish-view uk-width-8-10">';
2015-05-05 03:00:01 +02:00
2015-10-19 00:45:58 +02:00
// Title input
HTML::formInputText(array(
'name'=>'title',
'value'=>$_Page->title(),
'class'=>'uk-width-1-1 uk-form-large',
'placeholder'=>$L->g('Title')
));
2015-05-05 03:00:01 +02:00
2015-10-19 00:45:58 +02:00
// Content input
HTML::formTextarea(array(
'name'=>'content',
'value'=>$_Page->contentRaw(false),
'class'=>'uk-width-1-1 uk-form-large',
2016-01-31 00:01:04 +01:00
'placeholder'=>''
2015-10-19 00:45:58 +02:00
));
2015-05-05 03:00:01 +02:00
2015-10-19 00:45:58 +02:00
// Form buttons
echo '<div class="uk-form-row uk-margin-bottom">';
echo ' <button class="uk-button uk-button-primary" type="submit">'.$L->g('Save').'</button>';
if(count($_Page->children())===0)
{
echo ' <button id="jsdelete" name="delete-page" class="uk-button" type="submit">'.$L->g('Delete').'</button>';
echo ' <a class="uk-button" href="'.HTML_PATH_ADMIN_ROOT.'manage-posts">'.$L->g('Cancel').'</a>';
}
echo '</div>';
echo '</div>';
// ---- RIGHT SIDE ----
2016-09-14 04:59:12 +02:00
echo '<div class="bl-publish-sidebar uk-width-2-10">';
2015-10-19 00:45:58 +02:00
// Tabs, general and advanced mode
echo '<ul class="uk-tab" data-uk-tab="{connect:\'#tab-options\'}">';
echo '<li><a href="">'.$L->g('General').'</a></li>';
2015-11-04 01:28:11 +01:00
echo '<li><a href="">'.$L->g('Images').'</a></li>';
2015-10-19 00:45:58 +02:00
echo '<li><a href="">'.$L->g('Advanced').'</a></li>';
echo '</ul>';
echo '<ul id="tab-options" class="uk-switcher uk-margin">';
// ---- GENERAL TAB ----
echo '<li>';
// Description input
HTML::formTextarea(array(
'name'=>'description',
'label'=>$L->g('description'),
'value'=>$_Page->description(),
'rows'=>'4',
2015-10-19 00:45:58 +02:00
'class'=>'uk-width-1-1 uk-form-medium',
'tip'=>$L->g('this-field-can-help-describe-the-content')
));
// Tags input
2016-02-13 06:50:49 +01:00
HTML::tags(array(
2015-10-19 00:45:58 +02:00
'name'=>'tags',
2016-01-12 04:36:48 +01:00
'label'=>$L->g('Tags'),
2016-02-13 06:50:49 +01:00
'allTags'=>$dbTags->getAll(),
'selectedTags'=>$_Page->tags(true)
2015-10-19 00:45:58 +02:00
));
echo '</li>';
2015-11-04 01:28:11 +01:00
// ---- IMAGES TAB ----
echo '<li>';
// --- BLUDIT COVER IMAGE ---
echo '<hr>';
HTML::bluditCoverImage($_Page->coverImage(false));
echo '<hr>';
// --- BLUDIT QUICK IMAGES ---
HTML::bluditQuickImages();
// --- BLUDIT IMAGES V8 ---
HTML::bluditImagesV8();
2015-11-04 01:28:11 +01:00
// --- BLUDIT MENU V8 ---
HTML::bluditMenuV8();
2015-11-04 01:28:11 +01:00
echo '</li>';
2015-10-19 00:45:58 +02:00
// ---- ADVANCED TAB ----
echo '<li>';
// Status input
HTML::formSelect(array(
'name'=>'status',
'label'=>$L->g('Status'),
'class'=>'uk-width-1-1 uk-form-medium',
'options'=>array('published'=>$L->g('Published'), 'draft'=>$L->g('Draft')),
'selected'=>($_Page->draft()?'draft':'published'),
'tip'=>''
));
2015-10-19 00:45:58 +02:00
// If the page is parent then doesn't can have a parent.
if(count($_Page->children())===0)
{
// Parent input
$options = array();
$options[NO_PARENT_CHAR] = '('.$Language->g('No parent').')';
$options += $dbPages->parentKeyList();
unset($options[$_Page->key()]);
HTML::formSelect(array(
'name'=>'parent',
'label'=>$L->g('Parent'),
'class'=>'uk-width-1-1 uk-form-medium',
'options'=>$options,
'selected'=>$_Page->parentKey(),
'tip'=>''
));
}
// Position input
HTML::formInputText(array(
'name'=>'position',
'value'=>$_Page->position(),
'class'=>'uk-width-1-1 uk-form-large',
'label'=>$L->g('Position')
));
// Slug input
HTML::formInputText(array(
'name'=>'slug',
'value'=>$_Page->slug(),
'class'=>'uk-width-1-1 uk-form-large',
'tip'=>$L->g('you-can-modify-the-url-which-identifies'),
'label'=>$L->g('Friendly URL')
));
echo '</li>';
echo '</ul>';
echo '</div>';
echo '</div>';
HTML::formClose();
?>
2015-05-05 03:00:01 +02:00
<script>
$(document).ready(function()
{
2015-07-03 22:44:26 +02:00
var key = $("#jskey").val();
2015-05-05 03:00:01 +02:00
2015-07-03 22:44:26 +02:00
$("#jsslug").keyup(function() {
2015-05-05 03:00:01 +02:00
var text = $(this).val();
2015-07-03 22:44:26 +02:00
var parent = $("#jsparent").val();
2015-05-05 03:00:01 +02:00
2015-07-03 22:44:26 +02:00
checkSlugPage(text, parent, key, $("#jsslug"));
2015-05-05 03:00:01 +02:00
});
2015-07-03 22:44:26 +02:00
$("#jstitle").keyup(function() {
2015-05-05 03:00:01 +02:00
var text = $(this).val();
2015-07-03 22:44:26 +02:00
var parent = $("#jsparent").val();
2015-05-05 03:00:01 +02:00
2015-07-03 22:44:26 +02:00
checkSlugPage(text, parent, key, $("#jsslug"));
2015-05-05 03:00:01 +02:00
});
2015-07-03 22:44:26 +02:00
$("#jsparent").change(function() {
2015-05-05 03:00:01 +02:00
var parent = $(this).val();
2015-07-03 22:44:26 +02:00
var text = $("#jsslug").val();
2015-05-05 03:00:01 +02:00
if(parent==NO_PARENT_CHAR) {
2015-07-03 22:44:26 +02:00
$("#jsparentExample").text("");
2015-05-05 03:00:01 +02:00
}
else {
2015-07-03 22:44:26 +02:00
$("#jsparentExample").text(parent+"/");
2015-05-05 03:00:01 +02:00
}
2015-07-03 22:44:26 +02:00
checkSlugPage(text, parent, key, $("#jsslug"));
2015-05-05 03:00:01 +02:00
});
2015-07-04 02:14:58 +02:00
$("#jsdelete").click(function() {
2015-08-26 05:42:32 +02:00
if(confirm("<?php $Language->p('confirm-delete-this-action-cannot-be-undone') ?>")==false) {
return false;
2015-07-04 02:14:58 +02:00
}
});
2015-05-05 03:00:01 +02:00
});
</script>