Some changes for last version

This commit is contained in:
Dimo Belov 2018-07-11 01:10:45 +03:00
parent d1d9e36a4e
commit da21429d07
9 changed files with 59 additions and 47 deletions

View File

@ -44,7 +44,7 @@ class dbList extends dbJSON
return $list;
}
if (count($list) < $amountOfItems) {
if (count($list) < $amountOfItems) {
return $list;
}
@ -99,12 +99,12 @@ class dbList extends dbJSON
public function edit($args)
{
if (isset($this->db[$args['newKey']])) {
Log::set(__METHOD__.LOG_SEP.'The new key already exists. Key: '.$args['newKey']);
//this not allow to edit existing category
//return false;
if ( isset($this->db[$args['newKey']]) && ($args['newKey']!==$args['oldKey']) ) {
Log::set(__METHOD__.LOG_SEP.'The new key already exists. Key: '.$args['newKey'], LOG_TYPE_WARN);
return false;
}
$this->db[$args['newKey']]['name'] = $args['name'];
$this->db[$args['newKey']]['template'] = isset($args['template'])?$args['template']:'';
$this->db[$args['newKey']]['list'] = $this->db[$args['oldKey']]['list'];

View File

@ -12,10 +12,9 @@
<!-- CSS -->
<?php
echo Theme::bootstrapCSS();
echo Bootstrap::css(array(
echo Theme::css(array(
'bludit.css'
));
), DOMAIN_ADMIN_THEME_CSS);
?>
<!-- Javascript -->

View File

@ -74,7 +74,7 @@
<div class="form-group mt-1">
<textarea id="jseditor" style="display:none;"><?php echo $page->contentRaw(false) ?></textarea>
</div>
</div>
</div>
@ -175,9 +175,10 @@
));
?>
</div>
<!-- buttons visible on all tabs -->
<div class="form-group mt-2">
<button id="jsbuttonSave" type="button" class="btn btn-primary">
<?php echo $L->g('Publish') ?>
<?php echo $L->g('Save') ?>
</button>
<button id="jsbuttonDraft" type="button" class="btn btn-secondary">
<?php echo $L->g('Save as draft') ?>
@ -185,6 +186,11 @@
<a href="<?php echo HTML_PATH_ADMIN_ROOT ?>dashboard" class="btn btn-secondary">
<?php echo $L->g('Cancel') ?>
</a>
<?php
if (count($page->children())===0) {
echo '<button id="jsbuttonDelete" type="button" class="btn btn-secondary">'.$L->g('Delete').'</button>';
}
?>
</div>
<!-- Modal for Categories -->
@ -281,9 +287,11 @@
});
});
</script>
</form>
<!-- Modal for Media Manager -->
<?php include(PATH_ADMIN_THEMES.'booty/html/media.php'); ?>
<script>
$(document).ready(function() {
@ -301,6 +309,13 @@ $(document).ready(function() {
$("#jsform").submit();
});
// Button Delete
$("#jsbuttonDelete").on("click", function() {
$("#jsstatus").val("delete");
$("#jscontent").val("");
$("#jsform").submit();
});
// External cover image
$("#jsexternalCoverImage").change(function() {
$("#jscoverImage").val( $(this).val() );
@ -312,15 +327,6 @@ $(document).ready(function() {
$("#jsstatus").val(status);
});
// 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();
@ -371,8 +377,3 @@ $(document).ready(function() {
});
</script>
<?php
// Include Bludit Media Manager
include(PATH_ADMIN_THEMES.'booty/html/media.php');
?>

View File

@ -68,13 +68,7 @@
<div class="form-group mt-1">
<textarea id="jseditor" style="display:none;"></textarea>
</div>
<div class="form-group mt-2">
<button id="jsbuttonSave" type="button" class="btn btn-primary"><?php echo $L->g('Publish') ?></button>
<button id="jsbuttonDraft" type="button" class="btn btn-secondary"><?php echo $L->g('Save as draft') ?></button>
<a href="<?php echo HTML_PATH_ADMIN_ROOT ?>dashboard" class="btn btn-secondary"><?php echo $L->g('Cancel') ?></a>
</div>
</div>
</div>
@ -196,9 +190,21 @@
'label'=>'Template',
'placeholder'=>''
));
?>
?>
</div>
<!-- buttons visible on all tabs -->
<div class="form-group mt-2">
<button id="jsbuttonSave" type="button" class="btn btn-primary">
<?php echo $L->g('Publish') ?>
</button>
<button id="jsbuttonDraft" type="button" class="btn btn-secondary">
<?php echo $L->g('Save as draft') ?>
</button>
<a href="<?php echo HTML_PATH_ADMIN_ROOT ?>dashboard" class="btn btn-secondary">
<?php echo $L->g('Cancel') ?>
</a>
</div>
<!-- Modal for Categories -->
<div id="jscategoryModal" class="modal fade" tabindex="-1" role="dialog">

View File

@ -5,8 +5,11 @@
If you are going to change some variable from here is recommended do it before the installation
*/
// Log separator
// Log
define('LOG_SEP', ' | ');
define('LOG_TYPE_INFO', '[INFO]');
define('LOG_TYPE_WARN', '[WARN]');
define('LOG_TYPE_ERROR', '[ERROR]');
// Protecting against Symlink attacks
define('CHECK_SYMBOLIC_LINKS', TRUE);

View File

@ -91,7 +91,8 @@ class dbPages extends dbJSON
$args['status'] = 'scheduled';
}
// Set type of the page
// Set type of the page
// may be not needed
if ($args['status']=='static') {
$args['type'] = 'static';
}
@ -346,7 +347,8 @@ class dbPages extends dbJSON
{
$tmp = $this->db;
foreach ($tmp as $key=>$fields) {
if ($fields['status']!='published' || $fields['type'] != "") {
// do not want sticky and static pages here
if ($fields['status']!='published' || !empty($fields['type'])) {
unset($tmp[$key]);
}
}

View File

@ -2,18 +2,20 @@
class Log {
public static function set($text, $type=0)
public static function set($text, $type=LOG_TYPE_INFO)
{
$messageType = 0;
if (is_array($text) ) {
error_log('------------------------', $type);
error_log('Array', $type);
error_log('------------------------', $type);
error_log('------------------------', $messageType);
error_log('Array', $messageType);
error_log('------------------------', $messageType);
foreach ($text as $key=>$value) {
error_log($key.'=>'.$value, $type);
error_log($key.'=>'.$value, $messageType);
}
error_log('------------------------', $type);
error_log('------------------------', $messageType);
}
error_log('('.BLUDIT_VERSION.') ('.$_SERVER['REQUEST_URI'].') '.$text, $type);
error_log($type.' ['.BLUDIT_VERSION.'] ['.$_SERVER['REQUEST_URI'].'] '.$text, $messageType);
}
}

View File

@ -147,11 +147,10 @@ class Text {
}
$string = preg_replace("/[^a-zA-Z0-9\/_|+ -]/", '', $string);
$string = trim($string, '-');
$string = self::lowercase($string);
$string = preg_replace("/[\/_|+ -]+/", $separator, $string);
//trim separator
$string = trim($string, $separator);
$string = trim($string, '-');
return $string;
}

View File

@ -408,7 +408,7 @@ class Page {
return $this->getValue('status');
}
public function type()
public function type()
{
return $this->getValue('type');
}