2018-04-15 22:23:11 +02:00
|
|
|
<!-- TABS -->
|
|
|
|
<ul class="nav nav-tabs" id="dynamicTab" role="tablist">
|
|
|
|
<li class="nav-item">
|
|
|
|
<a class="nav-link active" id="content-tab" data-toggle="tab" href="#content" role="tab" aria-controls="content" aria-selected="true">Content</a>
|
|
|
|
</li>
|
|
|
|
<li class="nav-item">
|
|
|
|
<a class="nav-link" id="images-tab" data-toggle="tab" href="#images" role="tab" aria-controls="images" aria-selected="false">Images</a>
|
|
|
|
</li>
|
|
|
|
<li class="nav-item">
|
|
|
|
<a class="nav-link " id="options-tab" data-toggle="tab" href="#options" role="tab" aria-controls="options" aria-selected="false">Options</a>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<?php
|
2018-05-08 00:15:40 +02:00
|
|
|
echo Bootstrap::formOpen(array(
|
|
|
|
'id'=>'jsform',
|
|
|
|
'class'=>'tab-content mt-4'
|
|
|
|
));
|
|
|
|
|
2018-04-15 22:23:11 +02:00
|
|
|
// Token CSRF
|
|
|
|
echo Bootstrap::formInputHidden(array(
|
|
|
|
'name'=>'tokenCSRF',
|
|
|
|
'value'=>$Security->getTokenCSRF()
|
|
|
|
));
|
|
|
|
|
|
|
|
// Parent
|
|
|
|
echo Bootstrap::formInputHidden(array(
|
|
|
|
'name'=>'parent',
|
|
|
|
'value'=>''
|
|
|
|
));
|
|
|
|
|
2018-05-08 00:15:40 +02:00
|
|
|
// UUID
|
|
|
|
echo Bootstrap::formInputHidden(array(
|
|
|
|
'name'=>'uuid',
|
|
|
|
'value'=>$dbPages->generateUUID()
|
|
|
|
));
|
|
|
|
|
2018-04-15 22:23:11 +02:00
|
|
|
// Status = published, draft, sticky, static
|
|
|
|
echo Bootstrap::formInputHidden(array(
|
|
|
|
'name'=>'status',
|
|
|
|
'value'=>'published'
|
|
|
|
));
|
2018-05-08 23:25:18 +02:00
|
|
|
|
|
|
|
// Cover image
|
|
|
|
echo Bootstrap::formInputHidden(array(
|
|
|
|
'name'=>'coverImage',
|
|
|
|
'value'=>''
|
|
|
|
));
|
2018-04-15 22:23:11 +02:00
|
|
|
?>
|
|
|
|
|
|
|
|
<!-- TABS CONTENT -->
|
|
|
|
<div class="tab-pane show active" id="content" role="tabpanel" aria-labelledby="content-tab">
|
|
|
|
|
|
|
|
<?php
|
|
|
|
// Title
|
|
|
|
echo Bootstrap::formInputTextBlock(array(
|
|
|
|
'name'=>'title',
|
|
|
|
'placeholder'=>'Enter title',
|
2018-05-02 19:59:45 +02:00
|
|
|
'class'=>'form-control-lg',
|
|
|
|
'value'=>''
|
2018-04-15 22:23:11 +02:00
|
|
|
));
|
|
|
|
?>
|
|
|
|
|
|
|
|
<div class="form-group mt-2">
|
|
|
|
<div id="jscontent" name="content"></div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="form-group mt-2">
|
2018-05-08 23:25:18 +02:00
|
|
|
<button id="jsbuttonSave" type="submit" class="btn btn-primary"><?php echo $L->g('Save') ?></button>
|
|
|
|
<button id="jsbuttonDraft" type="button" class="btn"><?php echo $L->g('Save as draft') ?></button>
|
2018-05-08 00:15:40 +02:00
|
|
|
<a href="<?php echo HTML_PATH_ADMIN_ROOT ?>dashboard" class="btn"><?php echo $L->g('Cancel') ?></a>
|
2018-04-15 22:23:11 +02:00
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<!-- TABS IMAGES -->
|
|
|
|
<div class="tab-pane" id="images" role="tabpanel" aria-labelledby="images-tab">
|
|
|
|
|
|
|
|
<?php
|
2018-05-08 23:25:18 +02:00
|
|
|
echo Bootstrap::formTitle(array('title'=>'Select images or upload images'));
|
2018-04-15 22:23:11 +02:00
|
|
|
?>
|
|
|
|
|
|
|
|
<button type="button" class="btn" data-toggle="modal" data-target="#jsbluditMediaModal">Media Manager</button>
|
|
|
|
|
|
|
|
<?php
|
|
|
|
echo Bootstrap::formTitle(array('title'=>'Cover image'));
|
|
|
|
?>
|
|
|
|
|
2018-05-14 00:00:10 +02:00
|
|
|
<img id="jscoverImagePreview" style="width: 350px; height: 200px;" class="img-thumbnail" alt="coverImagePreview" src="<?php echo HTML_PATH_ADMIN_THEME_IMG ?>default.svg" />
|
2018-04-15 22:23:11 +02:00
|
|
|
|
|
|
|
<?php
|
2018-05-14 00:00:10 +02:00
|
|
|
echo Bootstrap::formTitle(array('title'=>$L->g('External Cover Image')));
|
2018-04-15 22:23:11 +02:00
|
|
|
?>
|
|
|
|
|
|
|
|
<?php
|
|
|
|
echo Bootstrap::formInputTextBlock(array(
|
|
|
|
'name'=>'externalCoverImage',
|
2018-05-14 00:00:10 +02:00
|
|
|
'tip'=>$L->g('Full image URL'),
|
|
|
|
'placeholder'=>"https://",
|
|
|
|
'value'=>''
|
2018-04-15 22:23:11 +02:00
|
|
|
));
|
|
|
|
?>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<!-- TABS OPTIONS -->
|
|
|
|
<div class="tab-pane" id="options" role="tabpanel" aria-labelledby="options-tab">
|
|
|
|
<?php
|
2018-05-02 19:59:45 +02:00
|
|
|
echo Bootstrap::formTitle(array('title'=>'General'));
|
|
|
|
|
2018-04-15 22:23:11 +02:00
|
|
|
// Category
|
|
|
|
echo Bootstrap::formSelect(array(
|
|
|
|
'name'=>'category',
|
|
|
|
'label'=>'Category',
|
|
|
|
'selected'=>'',
|
2018-05-08 00:15:40 +02:00
|
|
|
'options'=>$dbCategories->getKeyNameArray()
|
2018-04-15 22:23:11 +02:00
|
|
|
));
|
|
|
|
|
|
|
|
// Tags
|
|
|
|
echo Bootstrap::formInputText(array(
|
|
|
|
'name'=>'tags',
|
|
|
|
'label'=>'Tags',
|
|
|
|
'placeholder'=>'Tags separeted by comma'
|
|
|
|
));
|
|
|
|
|
|
|
|
// Description
|
|
|
|
echo Bootstrap::formTextarea(array(
|
|
|
|
'name'=>'description',
|
|
|
|
'label'=>'Description',
|
|
|
|
'placeholder'=>'Small description about the content',
|
|
|
|
'rows'=>'4'
|
|
|
|
));
|
2018-05-02 19:59:45 +02:00
|
|
|
|
|
|
|
echo Bootstrap::formTitle(array('title'=>'Advanced'));
|
|
|
|
|
2018-04-15 22:23:11 +02:00
|
|
|
// Date
|
|
|
|
echo Bootstrap::formInputText(array(
|
|
|
|
'name'=>'date',
|
|
|
|
'label'=>'Date',
|
2018-05-08 00:15:40 +02:00
|
|
|
'placeholder'=>'YYYY-MM-DD hh:mm:ss',
|
|
|
|
'value'=>Date::current(DB_DATE_FORMAT)
|
2018-04-15 22:23:11 +02:00
|
|
|
));
|
|
|
|
|
|
|
|
// Type
|
|
|
|
echo Bootstrap::formSelect(array(
|
|
|
|
'name'=>'type',
|
|
|
|
'label'=>'Type',
|
|
|
|
'selected'=>'',
|
|
|
|
'options'=>array(
|
|
|
|
''=>'- Default -',
|
|
|
|
'sticky'=>'Sticky',
|
|
|
|
'static'=>'Static'
|
|
|
|
)
|
|
|
|
));
|
|
|
|
|
|
|
|
// Parent
|
|
|
|
echo Bootstrap::formInputText(array(
|
|
|
|
'name'=>'parentTMP',
|
2018-05-14 00:00:10 +02:00
|
|
|
'label'=>$L->g('Parent'),
|
2018-04-15 22:23:11 +02:00
|
|
|
'placeholder'=>'Start writing the title of the page parent'
|
|
|
|
));
|
|
|
|
|
|
|
|
// Position
|
|
|
|
echo Bootstrap::formInputText(array(
|
|
|
|
'name'=>'position',
|
2018-05-14 00:00:10 +02:00
|
|
|
'label'=>$L->g('Position'),
|
|
|
|
'tip'=>$L->g('This field is used when you order the content by position'),
|
|
|
|
'value'=>$dbPages->nextPositionNumber()
|
2018-04-15 22:23:11 +02:00
|
|
|
));
|
|
|
|
|
|
|
|
// Friendly URL
|
|
|
|
echo Bootstrap::formInputText(array(
|
|
|
|
'name'=>'slug',
|
2018-05-14 00:00:10 +02:00
|
|
|
'tip'=>$L->g('URL associated with the content'),
|
|
|
|
'label'=>$L->g('Friendly URL'),
|
2018-04-15 22:23:11 +02:00
|
|
|
'placeholder'=>'Leave empty for automaticly complete'
|
|
|
|
));
|
|
|
|
|
|
|
|
// Template
|
|
|
|
echo Bootstrap::formInputText(array(
|
|
|
|
'name'=>'template',
|
|
|
|
'label'=>'Template',
|
|
|
|
'placeholder'=>''
|
|
|
|
));
|
|
|
|
?>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</form>
|
2015-05-05 03:00:01 +02:00
|
|
|
|
|
|
|
<script>
|
2018-04-15 22:23:11 +02:00
|
|
|
$(document).ready(function() {
|
2017-01-10 17:43:38 +01:00
|
|
|
|
2018-05-08 23:25:18 +02:00
|
|
|
// Button Save
|
|
|
|
$("#jsbuttonSave").on("click", function() {
|
|
|
|
$("#jsstatus").val("published");
|
|
|
|
$("#jsform").submit();
|
|
|
|
});
|
|
|
|
|
2017-01-10 17:43:38 +01:00
|
|
|
// Button Save as draft
|
2018-05-08 23:25:18 +02:00
|
|
|
$("#jsbuttonDraft").on("click", function() {
|
2017-01-10 17:43:38 +01:00
|
|
|
$("#jsstatus").val("draft");
|
2018-05-08 00:15:40 +02:00
|
|
|
$("#jsform").submit();
|
2017-01-10 17:43:38 +01:00
|
|
|
});
|
|
|
|
|
2018-05-08 23:25:18 +02:00
|
|
|
// External cover image
|
|
|
|
$("#jsexternalCoverImage").change(function() {
|
|
|
|
$("#jscoverImage").val( $(this).val() );
|
|
|
|
});
|
|
|
|
|
2018-05-08 00:15:40 +02:00
|
|
|
// Type selector modified the status hidden field
|
2018-04-15 22:23:11 +02:00
|
|
|
$("#jstype").on("change", function() {
|
|
|
|
var status = $("#jstype option:selected").val();
|
|
|
|
$("#jsstatus").val(status);
|
|
|
|
});
|
2017-01-10 17:43:38 +01:00
|
|
|
|
2018-05-08 00:15:40 +02:00
|
|
|
// Generate slug when the user type the title
|
|
|
|
$("#jstitle").keyup(function() {
|
|
|
|
var text = $(this).val();
|
|
|
|
var parent = $("#jsparent").val();
|
|
|
|
var currentKey = "";
|
|
|
|
var ajax = new bluditAjax();
|
|
|
|
ajax.generateSlug(text, parent, currentKey, $("#jsslug"));
|
|
|
|
});
|
|
|
|
|
|
|
|
// Autosave interval
|
|
|
|
setInterval(function() {
|
|
|
|
var uuid = $("#jsuuid").val();
|
|
|
|
var title = $("#jstitle").val();
|
|
|
|
var content = editorGetContent();
|
|
|
|
var ajax = new bluditAjax();
|
|
|
|
// showAlert is the function to display an alert defined in alert.php
|
|
|
|
ajax.autosave(uuid, title, content, showAlert);
|
|
|
|
},
|
2018-05-08 23:25:18 +02:00
|
|
|
60*1000*<?php echo $GLOBALS['AUTOSAVE_TIME'] ?>
|
2018-05-08 00:15:40 +02:00
|
|
|
);
|
|
|
|
|
2018-04-15 22:23:11 +02:00
|
|
|
// Template autocomplete
|
|
|
|
$('input[name="template"]').autoComplete({
|
|
|
|
minChars: 2,
|
|
|
|
source: function(term, suggest){
|
|
|
|
term = term.toLowerCase();
|
|
|
|
var choices = ['ActionScript', 'Acti', 'Asp'];
|
|
|
|
var matches = [];
|
|
|
|
for (i=0; i<choices.length; i++)
|
|
|
|
if (~choices[i].toLowerCase().indexOf(term)) matches.push(choices[i]);
|
|
|
|
suggest(matches);
|
2017-01-10 17:43:38 +01:00
|
|
|
}
|
|
|
|
});
|
2015-05-05 03:00:01 +02:00
|
|
|
|
2018-04-15 22:23:11 +02:00
|
|
|
// Parent autocomplete
|
|
|
|
var parentsXHR;
|
|
|
|
var parentsList; // Keep the parent list returned to get the key by the title page
|
|
|
|
$("#jsparentTMP").autoComplete({
|
2018-05-14 00:00:10 +02:00
|
|
|
minChars: 1,
|
2018-04-15 22:23:11 +02:00
|
|
|
source: function(term, response) {
|
|
|
|
// Prevent call inmediatly another ajax request
|
|
|
|
try { parentsXHR.abort(); } catch(e){}
|
2018-05-14 00:00:10 +02:00
|
|
|
parentsXHR = $.getJSON(HTML_PATH_ADMIN_ROOT+"ajax/get-parents", {query: term},
|
2018-04-15 22:23:11 +02:00
|
|
|
function(data) {
|
|
|
|
parentsList = data;
|
|
|
|
term = term.toLowerCase();
|
|
|
|
var matches = [];
|
|
|
|
for (var title in data) {
|
|
|
|
if (~title.toLowerCase().indexOf(term))
|
|
|
|
matches.push(title);
|
|
|
|
}
|
|
|
|
response(matches);
|
|
|
|
});
|
|
|
|
},
|
|
|
|
onSelect: function(e, term, item) {
|
2018-05-14 00:00:10 +02:00
|
|
|
// parentsList = array( pageTitle => pageKey )
|
2018-04-15 22:23:11 +02:00
|
|
|
var parentKey = parentsList[term];
|
|
|
|
$("#jsparent").attr("value", parentKey);
|
2018-01-21 23:23:22 +01:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2015-05-05 03:00:01 +02:00
|
|
|
});
|
2018-04-15 22:23:11 +02:00
|
|
|
</script>
|
2015-03-27 02:00:01 +01:00
|
|
|
|
2018-04-15 22:23:11 +02:00
|
|
|
<?php
|
|
|
|
// Include Bludit Media Manager
|
|
|
|
include(PATH_ADMIN_THEMES.'booty/html/media.php');
|
2018-05-08 00:15:40 +02:00
|
|
|
?>
|