Popravek editorja za sporocila uporabnikom

This commit is contained in:
pero1203 2021-08-26 10:32:14 +02:00
parent 71c39fd552
commit 16bac04a3f
3 changed files with 25 additions and 3 deletions

View File

@ -156,7 +156,7 @@ class Notifications {
echo '</div>'; echo '</div>';
// Inicializiramo editor // Inicializiramo editor
echo '<script type="text/javascript">create_editor(\'notification\', false);</script>'; echo '<script type="text/javascript">create_editor_notification(\'notification\');</script>';
} }
@ -342,7 +342,7 @@ class Notifications {
echo '<span class="bold">'.$row['title'].' <span class="italic">('.$row['date'].')</span></span>'; echo '<span class="bold">'.$row['title'].' <span class="italic">('.$row['date'].')</span></span>';
// Stara sporocila so brez editorja // Stara sporocila so brez editorja
$text = (strpos($row['text'], '\n') !== false) ? nl2br($row['text']) : $row['text']; $text = (strtotime($row['date']) < strtotime('2021-08-26')) ? nl2br($row['text']) : $row['text'];
echo '<p>'.$text.'</p>'; echo '<p>'.$text.'</p>';
echo '</div>'; echo '</div>';
@ -368,7 +368,7 @@ class Notifications {
echo '<span class="bold">'.$row['title'].' <span class="italic">('.$row['date'].')</span></span>'; echo '<span class="bold">'.$row['title'].' <span class="italic">('.$row['date'].')</span></span>';
// Stara sporocila so brez editorja // Stara sporocila so brez editorja
$text = (strpos($row['text'], '\n') !== false) ? nl2br($row['text']) : $row['text']; $text = (strtotime($row['date']) < strtotime('2021-08-26')) ? nl2br($row['text']) : $row['text'];
echo '<br />'.$text; echo '<br />'.$text;
echo '</li>'; echo '</li>';

View File

@ -1626,6 +1626,19 @@ function create_editor_hotspot (id, focus) {
editor_init = true; editor_init = true;
} }
function create_editor_notification(id) {
CKEDITOR.replace( id, {toolbar: 'Notification'}); // prikazi editor s Notification configuration
CKEDITOR.config.removePlugins = 'elementspath'; //odstrani spodnji tag, kjer po default-u so oznake html (body, p, ipd.)
CKEDITOR.instances[id].on('focus', function () {
this.execCommand('selectAll');
});
editor_init = true;
}
// odstrani editor za ne-spremenljivka (treba preden se odstrani html) // odstrani editor za ne-spremenljivka (treba preden se odstrani html)
function remove_editor (id) { function remove_editor (id) {
//odstranimo CKEDITOR v kolikor je inicializiran -> če preverjanja potem javi error in ostala javascript datoteka ne deluje //odstranimo CKEDITOR v kolikor je inicializiran -> če preverjanja potem javi error in ostala javascript datoteka ne deluje

View File

@ -74,6 +74,15 @@ CKEDITOR.editorConfig = function (config) {
//{name: 'insert', items: ['Image', 'ImageMap']} //{name: 'insert', items: ['Image', 'ImageMap']}
{name: 'insert', items: ['Image']} {name: 'insert', items: ['Image']}
]; ];
config.toolbar_Notification = [
{name: 'document', items: ['Source', '-']},
{name: 'clipboard', items: ['PasteText','RemoveFormat', 'Undo', 'Redo', 'Scayt']},
{name: 'basicstyles', items: ['Bold', 'Underline', 'Italic', 'Strike', '-']},
{name: 'links', items: ['Link', 'Unlink', 'Image', 'SpecialChar']},
{name: 'colors', items: ['TextColor', 'BGColor']},
{name: 'paragraph', items: ['NumberedList', 'BulletedList', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock','-']},
{name: 'vec', items:['-', 'FontSize', 'Font', 'Outdent', 'Indent']}
];
config.removeButtons = 'Cut,Copy,Paste,Subscript,Superscript'; config.removeButtons = 'Cut,Copy,Paste,Subscript,Superscript';