From 16bac04a3f11b516c88e3097ba36ee5b0e4f84fa Mon Sep 17 00:00:00 2001 From: pero1203 Date: Thu, 26 Aug 2021 10:32:14 +0200 Subject: [PATCH] Popravek editorja za sporocila uporabnikom --- admin/survey/classes/class.Notifications.php | 6 +++--- admin/survey/script/script.js | 13 +++++++++++++ editors/ckeditor_4_4/config.js | 9 +++++++++ 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/admin/survey/classes/class.Notifications.php b/admin/survey/classes/class.Notifications.php index 20d057087..b4b68a21e 100644 --- a/admin/survey/classes/class.Notifications.php +++ b/admin/survey/classes/class.Notifications.php @@ -156,7 +156,7 @@ class Notifications { echo ''; // Inicializiramo editor - echo ''; + echo ''; } @@ -342,7 +342,7 @@ class Notifications { echo ''.$row['title'].' ('.$row['date'].')'; // 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 '

'.$text.'

'; echo ''; @@ -368,7 +368,7 @@ class Notifications { echo ''.$row['title'].' ('.$row['date'].')'; // 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 '
'.$text; echo ''; diff --git a/admin/survey/script/script.js b/admin/survey/script/script.js index 170fc6ac3..5b176e62c 100644 --- a/admin/survey/script/script.js +++ b/admin/survey/script/script.js @@ -1626,6 +1626,19 @@ function create_editor_hotspot (id, focus) { 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) function remove_editor (id) { //odstranimo CKEDITOR v kolikor je inicializiran -> če preverjanja potem javi error in ostala javascript datoteka ne deluje diff --git a/editors/ckeditor_4_4/config.js b/editors/ckeditor_4_4/config.js index 6c6930bb9..4dba442d5 100644 --- a/editors/ckeditor_4_4/config.js +++ b/editors/ckeditor_4_4/config.js @@ -74,6 +74,15 @@ CKEDITOR.editorConfig = function (config) { //{name: 'insert', items: ['Image', 'ImageMap']} {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';