From 6b711536a727010322e14dd60b3549849095f22b Mon Sep 17 00:00:00 2001 From: "severoiuliano@gmail.com" Date: Tue, 21 Jul 2020 20:46:38 +0200 Subject: [PATCH 01/11] i18n: round brackets not replaced --- system/author/js/vue-meta.js | 2 +- system/author/languages/de.yaml | 6 +++--- system/author/languages/en.yaml | 8 ++++---- system/author/languages/fr.yaml | 4 ++-- system/author/languages/it.yaml | 8 ++++---- system/author/languages/nl.yaml | 6 +++--- system/author/languages/ru.yaml | 6 +++--- 7 files changed, 20 insertions(+), 20 deletions(-) diff --git a/system/author/js/vue-meta.js b/system/author/js/vue-meta.js index 225a302..bbfeb1e 100644 --- a/system/author/js/vue-meta.js +++ b/system/author/js/vue-meta.js @@ -2,7 +2,7 @@ const FormBus = new Vue(); Vue.filter('translate', function (value) { if (!value) return '' - transvalue = value.replace(/[ ]/g,"_").replace(/[.]/g, "_").replace(/[,]/g, "_").replace(/[-]/g, "_").replace(/[,]/g,"_").replace(/[(]/g,"_").replace(/[)]/g,"_").toUpperCase() + transvalue = value.replace(/[ ]/g,"_").replace(/[.]/g, "_").replace(/[,]/g, "_").replace(/[-]/g, "_").replace(/[,]/g,"_").toUpperCase() translated_string = labels[transvalue] if(!translated_string || translated_string.length === 0){ return value diff --git a/system/author/languages/de.yaml b/system/author/languages/de.yaml index cc6c258..6a1eed3 100644 --- a/system/author/languages/de.yaml +++ b/system/author/languages/de.yaml @@ -34,8 +34,8 @@ CODE: Code COG: Einstellungen CONTENT: Inhalt COPYRIGHT: Copyright -CREATED_AT__READ_ONLY_: Erstellt am (nur lesen) -CREATED_AT__READONLY_: Erstellt am (nur lesen) +CREATED_AT_(READ_ONLY): Erstellt am (nur lesen) +CREATED_AT_(READONLY): Erstellt am (nur lesen) CREATE_NEW_USER: + Neuen Nutzer CREATE_USER: + Nutzer CROSS: Kreuz @@ -91,7 +91,7 @@ ITALIC: kursiv LANGUAGE: Language LANGUAGE_ADMIN: Sprache (Admin-UI) LANGUAGE_ATTR: Sprach-Attribut (website) -LAST_MODIFIED_LIVE__READONLY_: Live zuletzt geändert (nur lesen) +LAST_MODIFIED_LIVE_(READONLY): Live zuletzt geändert (nur lesen) LAST_NAME: Zuname LEFT: Links LICENCE: Lizenz diff --git a/system/author/languages/en.yaml b/system/author/languages/en.yaml index 6d3b373..0a4c8a5 100644 --- a/system/author/languages/en.yaml +++ b/system/author/languages/en.yaml @@ -36,8 +36,8 @@ COG: cog CONTENT: Content CONTENT: Content COPYRIGHT: Copyright -CREATED_AT__READ_ONLY_: Created at (readonly) -CREATED_AT__READONLY_: Created at (read only) +CREATED_AT_(READ_ONLY): Created at (readonly) +CREATED_AT_(READONLY): Created at (read only) CREATE_NEW_USER: Create New User CREATE_USER: Create User CROSS: cross @@ -89,13 +89,13 @@ HR: hr IF_NOT_FILLED__THE_DESCRIPTION_IS_EXTRACTED_FROM_CONTENT_: If not filled, the description is extracted from content. IMAGE: Image IMAGES: Images -IMAGE_URL__READ_ONLY_: Image URL (read only) +IMAGE_URL_(READ_ONLY): Image URL (read only) ITALIAN: Italian ITALIC: italic LANGUAGE: Language LANGUAGE_ADMIN: Language (admin-ui) LANGUAGE_ATTR: Language Attribute (website) -LAST_MODIFIED_LIVE__READONLY_: Last modified live (readonly) +LAST_MODIFIED_LIVE_(READONLY): Last modified live (readonly) LAST_NAME: Last Name LEFT: Left LICENCE: Licence diff --git a/system/author/languages/fr.yaml b/system/author/languages/fr.yaml index 201df6c..29985e7 100644 --- a/system/author/languages/fr.yaml +++ b/system/author/languages/fr.yaml @@ -34,7 +34,7 @@ CODE: Code COG: cog CONTENT: Contenu COPYRIGHT: Copyright -CREATED_AT__READ_ONLY_: Date de création (lecture seule) +CREATED_AT_(READ_ONLY): Date de création (lecture seule) CREATE_NEW_USER: Créer un nouvel utilisateur CREATE_USER: Créer un utilisateur CROSS: croix @@ -90,7 +90,7 @@ ITALIC: Italique LANGUAGE: Langue LANGUAGE_ADMIN: Langue de l'interface d'administration LANGUAGE_ATTR: Langue du site (website) -LAST_MODIFIED_LIVE__READONLY_: Dernière modification (lecture seule) +LAST_MODIFIED_LIVE_(READONLY): Dernière modification (lecture seule) LAST_NAME: Prénom LEFT: Gauche LICENCE: Licence diff --git a/system/author/languages/it.yaml b/system/author/languages/it.yaml index 7375004..d760a96 100644 --- a/system/author/languages/it.yaml +++ b/system/author/languages/it.yaml @@ -36,8 +36,8 @@ COG: ingranaggio CONTENT: Contenuto CONTENT: Contenuto COPYRIGHT: Diritti d'autore -CREATED_AT__READ_ONLY_: Creato il (sola lettura) -CREATED_AT__READONLY_: Creato il (sola lettura) +CREATED_AT_(READ_ONLY): Creato il (sola lettura) +CREATED_AT_(READONLY): Creato il (sola lettura) CREATE_NEW_USER: Crea nuovo utente CREATE_USER: Crea utente CROSS: croce @@ -89,13 +89,13 @@ HR: Linea orizzontale IF_NOT_FILLED__THE_DESCRIPTION_IS_EXTRACTED_FROM_CONTENT_: Se non compilato, la descrizione viene estratta dal contenuto. IMAGE: Immagine IMAGES: Immagini -IMAGE_URL__READ_ONLY_: Immagine URL (sola lettura) +IMAGE_URL_(READ_ONLY): URL immagine (sola lettura) ITALIAN: Italiano ITALIC: corsivo LANGUAGE: Lingua LANGUAGE_ADMIN: Lingua (admin-ui) LANGUAGE_ATTR: Attributo Lingua (sito) -LAST_MODIFIED_LIVE__READONLY_: Ultima modifica (sola lettura) +LAST_MODIFIED_LIVE_(READONLY): Ultima modifica (sola lettura) LAST_NAME: Cognome LEFT: Sinistra LICENCE: Licenza diff --git a/system/author/languages/nl.yaml b/system/author/languages/nl.yaml index a2ac48f..8e944c3 100644 --- a/system/author/languages/nl.yaml +++ b/system/author/languages/nl.yaml @@ -31,8 +31,8 @@ CODE: Code COG: tandwiel CONTENT: Inhoud COPYRIGHT: Auteursrecht -CREATED_AT__READ_ONLY_: Gemaakt om (alleen lezen) -CREATED_AT__READONLY_: Gemaakt om (alleen lezen) +CREATED_AT_(READ_ONLY): Gemaakt om (alleen lezen) +CREATED_AT_(READONLY): Gemaakt om (alleen lezen) CREATE_NEW_USER: Nieuwe gebruiker maken CREATE_USER: Gebruiker maken CROSS: kruis @@ -75,7 +75,7 @@ ITALIC: cursief LANGUAGE: Taal LANGUAGE_ADMIN: Taal (admin-ui) LANGUAGE_ATTR: Language Attribute (website) -LAST_MODIFIED_LIVE__READONLY_: Laatst gewijzigd live (alleen-lezen) +LAST_MODIFIED_LIVE_(READONLY): Laatst gewijzigd live (alleen-lezen) LAST_NAME: achternaam LEFT: Links LICENCE: Licentie diff --git a/system/author/languages/ru.yaml b/system/author/languages/ru.yaml index 5a488cc..f8ce84e 100644 --- a/system/author/languages/ru.yaml +++ b/system/author/languages/ru.yaml @@ -36,8 +36,8 @@ COG: cog CONTENT: Редактор CONTENT: Контент COPYRIGHT: Копирайт -CREATED_AT__READ_ONLY_: Создано в (только просмотр) -CREATED_AT__READONLY_: Создано в (только просмотр) +CREATED_AT_(READ_ONLY): Создано в (только просмотр) +CREATED_AT_(READONLY): Создано в (только просмотр) CREATE_NEW_USER: Создание нового пользователя CREATE_USER: Создать пользователя CROSS: Зачёркнутый @@ -83,7 +83,7 @@ ITALIC: Наклонный LANGUAGE: Язык LANGUAGE_ADMIN: Язык (admin-ui) LANGUAGE_ATTR: Language Attribute (website) -LAST_MODIFIED_LIVE__READONLY_: Последнее изменение (только просмотр) +LAST_MODIFIED_LIVE_(READONLY): Последнее изменение (только просмотр) LAST_NAME: Фамилия LEFT: Слева LICENCE: Лицензия From 2ecd173d0c7d78f61cd5e764626498d17f781637 Mon Sep 17 00:00:00 2001 From: "severoiuliano@gmail.com" Date: Tue, 21 Jul 2020 20:53:52 +0200 Subject: [PATCH 02/11] i18n: new translations for roles and rights --- system/author/languages/en.yaml | 13 +++++++++++++ system/author/languages/it.yaml | 17 +++++++++++++++-- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/system/author/languages/en.yaml b/system/author/languages/en.yaml index 0a4c8a5..466252c 100644 --- a/system/author/languages/en.yaml +++ b/system/author/languages/en.yaml @@ -13,16 +13,20 @@ ADD_LEFT_COLUMN: add left column ADD_RIGHT_COLUMN: add right column ADD_ROW_ABOVE: add row above ADD_ROW_BELOW: add row below +ADMINISTRATOR: administrator +ALL: all ALL_USERS: All users ALT_TEXT: Alt-Text ALTERNATIVE_TEXT_FOR_THE_HERO_IMAGE: Alternative Text for the hero image AUTHOR: Author +AUTHOR_DESCRIPTION_(MARKDOWN): Author-Description (Markdown) BACK_TO_STARTPAGE: back to startpage BOLD: bold BOTTOM: Bottom BROWSE: BROWSE BULLET_LIST: Bullet List BY: by +CAN_BE_USED_FOR_AUTHOR_LINE_IN_FRONTEND_: Can be used for author line in frontend. CANCEL: cancel CAPTION: Caption CELL: cell @@ -61,6 +65,7 @@ DRAFT: Draft DRAG_A_PICTURE_OR_CLICK_TO_SELECT: upload an image DUTCH__FLEMISH: Dutch, Flemish EDIT: edit +EDITOR: editor EDIT_USER: Edit User E_G_: e.g. E_MAIL: E-Mail @@ -76,6 +81,7 @@ FORMAT: Format GENERAL_PRESENTATION: General Presentation GERMAN: German GOOGLE_SITEMAP: Google Sitemap +HAS_EDIT_RIGHTS_FOR_THIS_ARTICLE_: Has edit rights for this article. HEAD: Head HEADLINE_ANCHORS: Headline Anchors HEADLINE: Headline @@ -89,6 +95,7 @@ HR: hr IF_NOT_FILLED__THE_DESCRIPTION_IS_EXTRACTED_FROM_CONTENT_: If not filled, the description is extracted from content. IMAGE: Image IMAGES: Images +IMAGE_URL: Image URL IMAGE_URL_(READ_ONLY): Image URL (read only) ITALIAN: Italian ITALIC: italic @@ -107,6 +114,7 @@ LOGOUT: Logout MANUAL_DATE: Manual date MARKDOWN: markdown MAXIMUM_SIZE_FOR_AN_IMAGE_IS_5_MB__HERO_IMAGES_ARE_NOT_SUPPORTED_BY_ALL_THEMES_: Maximum size for an image is 5 MB. Hero images are not supported by all themes. +MEMBER: member MENU: Menu META_DESCRIPTION: Meta description META: meta @@ -125,6 +133,7 @@ NUMBERED_LIST: Numbered List OLIST: olist ONLINE: online ONLY_THE_FOLLOWING_SPECIAL_CHARACTERS_ARE_ALLOWED: Only the following special characters are allowed: +OWNER_(USERNAME): owner (username) PARAGRAPH: Paragraph PASSWORD: Password PLEASE_CONFIRM: Please confirm @@ -132,6 +141,7 @@ PLEASE_CORRECT_THE_ERRORS_ABOVE: Please correct the errors above PLUGINS: Plugins PLUGIN_STORE: Plugin Store POWER_OFF: power-off +PROFILE_IMAGE: Profile-Image PUBLISH: Publish QUOTE: Quote QUOTES: Quote @@ -140,6 +150,7 @@ RAW_MARKDOWN_EDITOR: Raw Markdown Editor RAW_MODE: raw mode RAW: raw READONLY: Readonly +REGISTERED_USERS_ONLY: registered users only REMEMBER_TO_BOOKMARK_THIS_PAGE: Remember to bookmark this page REQUIRED: Required RIGHT: Right @@ -181,6 +192,7 @@ USE_A_VALID_LANGUAGE_ATTRIBUTE: Use a valid language attribute USE_A_VALID_YEAR: Use a valid year USED_AS_FALLBACK_WHEN_NO_MANUAL_DATE_IS_SET_: Used as fallback when no manual date is set. USERNAME: Username +USERNAME_(READ_ONLY): Username (read only) USERS: Users USER: User VIDEO: Video @@ -193,6 +205,7 @@ VISUAL: visual WAIT: wait WEBSITE_TITLE: Website Title WEB: Web +WEBSITE_VISIBLE_FOR: Website visible for WRITING: Writing YEAR: Year YOU_CAN_OVERWRITE_THE_THEME_CSS_WITH_YOUR_OWN_CSS_HERE_: You can overwrite the theme-css with your own css here. diff --git a/system/author/languages/it.yaml b/system/author/languages/it.yaml index d760a96..02da3ff 100644 --- a/system/author/languages/it.yaml +++ b/system/author/languages/it.yaml @@ -13,16 +13,20 @@ ADD_LEFT_COLUMN: aggiungi colonna a sinistra ADD_RIGHT_COLUMN: aggiungi colonna a destra ADD_ROW_ABOVE: aggiungi la riga sopra ADD_ROW_BELOW: aggiungi la riga sotto +ADMINISTRATOR: Amministratore +ALL: Tutti ALL_USERS: Tutti gli utenti ALT_TEXT: Testo alternativo ALTERNATIVE_TEXT_FOR_THE_HERO_IMAGE: Testo alternativo per l'immagine hero AUTHOR: Autore +AUTHOR_DESCRIPTION_(MARKDOWN): Descrizione dell'autore (Markdown) BACK_TO_STARTPAGE: torna alla pagina iniziale BOLD: grassetto BOTTOM: Sotto BROWSE: Sfoglia BULLET_LIST: Elenco puntato BY: di +CAN_BE_USED_FOR_AUTHOR_LINE_IN_FRONTEND_: Può essere usato per la linea autore nel sito. CANCEL: Annulla CAPTION: Didascalia CELL: cella @@ -60,7 +64,8 @@ DO_YOU_WANT_TO_DISCARD_YOUR_CHANGES_AND_SET_THE_CONTENT_BACK_TO_THE_LIVE_VERSION DRAFT: Bozza DRAG_A_PICTURE_OR_CLICK_TO_SELECT: trascina un'immagine o fai clic per selezionare DUTCH__FLEMISH: Olandese, Fiammingo -EDIT: modifica +EDIT: Modifica +EDITOR: Curatore EDIT_USER: Modifica utente E_G_: per es.: E_MAIL: Posta elettronica @@ -76,6 +81,7 @@ FORMAT: Format GENERAL_PRESENTATION: Presentazione generale GERMAN: Tedesco GOOGLE_SITEMAP: Sitemap di Google +HAS_EDIT_RIGHTS_FOR_THIS_ARTICLE_: Ha i diritti di modifica per questo articolo. HEAD: Intestazione HEADLINE_ANCHORS: Ancoraggi del titolo HEADLINE: Titolo @@ -89,6 +95,7 @@ HR: Linea orizzontale IF_NOT_FILLED__THE_DESCRIPTION_IS_EXTRACTED_FROM_CONTENT_: Se non compilato, la descrizione viene estratta dal contenuto. IMAGE: Immagine IMAGES: Immagini +IMAGE_URL: URL immagine IMAGE_URL_(READ_ONLY): URL immagine (sola lettura) ITALIAN: Italiano ITALIC: corsivo @@ -107,6 +114,7 @@ LOGOUT: Esci MANUAL_DATE: Data manuale MARKDOWN: Markdown MAXIMUM_SIZE_FOR_AN_IMAGE_IS_5_MB__HERO_IMAGES_ARE_NOT_SUPPORTED_BY_ALL_THEMES_: La dimensione massima per un'immagine è di 5 MB. Le immagini hero non sono supportate da tutti i temi. +MEMBER: Membro MENU: Menu META_DESCRIPTION: Descrizione META: Metadati @@ -125,6 +133,7 @@ NUMBERED_LIST: Elenco numerato OLIST: Elenchi ordinati ONLINE: in linea ONLY_THE_FOLLOWING_SPECIAL_CHARACTERS_ARE_ALLOWED: Sono ammessi solo i seguenti caratteri speciali: +OWNER_(USERNAME): proprietario (nome utente) PARAGRAPH: Paragrafo PASSWORD: Parola d'ordine PLEASE_CONFIRM: Per favore conferma @@ -132,6 +141,7 @@ PLEASE_CORRECT_THE_ERRORS_ABOVE: Si prega di correggere gli errori sopra PLUGINS: Plugin PLUGIN_STORE: Deposito plugin POWER_OFF: spegni +PROFILE_IMAGE: Immagine del profilo PUBLISH: Pubblica QUOTE: Citazione QUOTES: Citazione @@ -140,7 +150,8 @@ RAW: grezzo RAW_MARKDOWN_EDITOR: Editore grezzo Markdown RAW_MODE: modo grezzo READONLY: Sola lettura -REMEMBER_TO_BOOKMARK_THIS_PAGE: Ricorda di aggiungere questa pagina ai segnalibri +REGISTERED_USERS_ONLY: Solo utenti registrati +REMEMBER_TO_BOOKMARK_THIS_PAGE: Ricorda di creare un segnalibro per la pagina REQUIRED: Richiesto RIGHT: Destra ROLE: Ruolo @@ -181,6 +192,7 @@ USE_A_VALID_LANGUAGE_ATTRIBUTE: Use a valid language attribute USE_A_VALID_YEAR: Usa un anno valido USED_AS_FALLBACK_WHEN_NO_MANUAL_DATE_IS_SET_: Utilizzato come ripiego quando non è impostata alcuna data manuale. USERNAME: Nome utente +USERNAME_(READ_ONLY): Nome utente (sola lettura) USERS: Utenti USER: Utente VIDEO: Video @@ -193,6 +205,7 @@ VISUAL: visivo WAIT: aspetta WEBSITE_TITLE: Titolo del sito WEB: Sito +WEBSITE_VISIBLE_FOR: Sito visibile per WRITING: Scrittura YEAR: Anno YOU_CAN_OVERWRITE_THE_THEME_CSS_WITH_YOUR_OWN_CSS_HERE_: È possibile sovrascrivere il css del tema con il proprio CSS qui. From 8b06e817d5ef9276738c76c2656d1a26e95971db Mon Sep 17 00:00:00 2001 From: "severoiuliano@gmail.com" Date: Tue, 21 Jul 2020 20:56:57 +0200 Subject: [PATCH 03/11] i18n: twig file adjustment for roles and rights --- system/author/partials/fields.twig | 4 ++-- system/author/settings/userlist.twig | 10 +++++----- system/author/settings/usernew.twig | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/system/author/partials/fields.twig b/system/author/partials/fields.twig index 6238d3e..a73f2bf 100644 --- a/system/author/partials/fields.twig +++ b/system/author/partials/fields.twig @@ -18,7 +18,7 @@
{{ __('Upload an image') }}
- +
@@ -69,7 +69,7 @@ diff --git a/system/author/settings/userlist.twig b/system/author/settings/userlist.twig index 3344337..8ec6be3 100644 --- a/system/author/settings/userlist.twig +++ b/system/author/settings/userlist.twig @@ -14,10 +14,10 @@ '; - return $markup; } @@ -434,7 +441,8 @@ class ParsedownExtension extends \ParsedownExtra $href = $element['element']['element']['attributes']['href']; - $element['element']['element']['attributes']['href'] = $this->relurl . $href; +# $element['element']['element']['attributes']['href'] = $this->relurl . $href; + $element['element']['element']['attributes']['href'] = $href; return $element; } @@ -487,8 +495,9 @@ class ParsedownExtension extends \ParsedownExtra $backLinkElements[] = array( 'name' => 'a', 'attributes' => array( - 'href' => $this->relurl . "#fnref$number:$definitionId", - 'rev' => 'footnote', +# 'href' => $this->relurl . "#fnref$number:$definitionId", + 'href' => "#fnref$number:$definitionId", + 'rev' => 'footnote', 'class' => 'footnote-backref', ), 'rawHtml' => '↩', @@ -704,98 +713,188 @@ class ParsedownExtension extends \ParsedownExtra protected $regexAttribute = '(?:[#.][-\w:\\\]+[ ]*|[-\w:\\\]+(?:=(?:["\'][^\n]*?["\']|[^\s]+)?)?[ ]*)'; - # turn markdown into an array of markdown blocks for typemill edit mode - function markdownToArrayBlocks($markdown) + + + # manipulated method linesElements, returns array of markdown blocks + public function markdownToArrayBlocks($markdown) { + + # make sure no definitions are set + $this->DefinitionData = array(); + # standardize line breaks - $markdown = str_replace(array("\r\n", "\r"), "\n", $markdown); + $text = str_replace(array("\r\n", "\r"), "\n", $markdown); # remove surrounding line breaks - $markdown = trim($markdown, "\n"); + $text = trim($text, "\n"); - # trim to maximum two linebreaks - - # split text into blocks - $blocks = explode("\n\n", $markdown); - - # clean up code blocks - $cleanBlocks = array(); - - # holds the content of codeblocks - $codeBlock = ''; - - # flag if codeblock is on or off. - $codeBlockOn = false; - - # holds the content of a definition list - $definitionList = ""; + # split text into lines + $lines = explode("\n", $text); - # flag if definition-list is on or off. - $definitionListOn = false; + # manipulated method linesElements - foreach($blocks as $block) + $Elements = array(); + $CurrentBlock = null; +/*new*/ $mdElements = array(); + + foreach ($lines as $line) { - # remove empty lines - if (chop($block) === '') continue; - - # if the block starts with a fenced code - if(substr($block,0,2) == '``') + if (chop($line) === '') { - # and if we are in an open code-block - if($codeBlockOn) + if (isset($CurrentBlock)) { - # it must be the end of the codeblock, so add it to the codeblock - $block = $codeBlock . "\n" . $block; - - # reset codeblock-value and close the codeblock. - $codeBlock = ''; - $codeBlockOn = false; + $CurrentBlock['interrupted'] = (isset($CurrentBlock['interrupted']) + ? $CurrentBlock['interrupted'] + 1 : 1 + ); } - else - { - # it must be the start of the codeblock. - $codeBlockOn = true; - } - } - if($codeBlockOn) - { - # if the codeblock is complete - if($this->isComplete($block)) - { - $block = $codeBlock . "\n" . $block; - # reset codeblock-value and close the codeblock. - $codeBlock = ''; - $codeBlockOn = false; - } - else + continue; + } + + while (($beforeTab = strstr($line, "\t", true)) !== false) + { + $shortage = 4 - mb_strlen($beforeTab, 'utf-8') % 4; + + $line = $beforeTab + . str_repeat(' ', $shortage) + . substr($line, strlen($beforeTab) + 1) + ; + } + + $indent = strspn($line, ' '); + + $text = $indent > 0 ? substr($line, $indent) : $line; + + # ~ + + $Line = array('body' => $line, 'indent' => $indent, 'text' => $text); + + # ~ + + # if we are in a multiline block element + if (isset($CurrentBlock['continuable'])) + { + $methodName = 'block' . $CurrentBlock['type'] . 'Continue'; + $Block = $this->$methodName($Line, $CurrentBlock); + + # if this line still belongs to the current multiline block + if (isset($Block)) { - $codeBlock .= "\n" . $block; + $CurrentBlock = $Block; +/*new*/ $mdCurrentBlock = $mdCurrentBlock . "\n" . $line; continue; } + # if this line does not belong to the current multiline block + else + { + # if multiline block element is finished + if ($this->isBlockCompletable($CurrentBlock['type'])) + { + $methodName = 'block' . $CurrentBlock['type'] . 'Complete'; + $CurrentBlock = $this->$methodName($CurrentBlock); +/*new*/ $mdCurrentBlock = $mdCurrentBlock; + } + } } - - # handle definition lists - $checkDL = preg_split('/\r\n|\r|\n/',$block); - if(isset($checkDL[1]) && substr($checkDL[1],0,2) == ': ') + + # ~ + + $marker = $text[0]; + + # ~ + + $blockTypes = $this->unmarkedBlockTypes; + + if (isset($this->BlockTypes[$marker])) { - $definitionList .= $block . "\n\n"; - $definitionListOn = true; - continue; + foreach ($this->BlockTypes[$marker] as $blockType) + { + $blockTypes []= $blockType; + } } - elseif($definitionListOn) + + # + # ~ + + foreach ($blockTypes as $blockType) { - $cleanBlocks[] = $definitionList; - $definitionList = ""; - $definitionListOn = false; + $Block = $this->{"block$blockType"}($Line, $CurrentBlock); +/*new*/ $mdBlock = $line; + if (isset($Block)) + { + $Block['type'] = $blockType; + if ( ! isset($Block['identified'])) + { + if (isset($CurrentBlock)) + { + $Elements[] = $this->extractElement($CurrentBlock); +/*new*/ $mdElements[] = $mdCurrentBlock; + } + + $Block['identified'] = true; + } + + if ($this->isBlockContinuable($blockType)) + { + $Block['continuable'] = true; + } + + $CurrentBlock = $Block; +/*new*/ $mdCurrentBlock = $mdBlock; + continue 2; + } } - - $block = trim($block, "\n"); - - $cleanBlocks[] = $block; + + # ~ + + if (isset($CurrentBlock) and $CurrentBlock['type'] === 'Paragraph') + { + $Block = $this->paragraphContinue($Line, $CurrentBlock); +/*new*/ $mdBlock = $mdCurrentBlock . "\n" . $line; + } + + if (isset($Block)) + { + $CurrentBlock = $Block; +/*new*/ $mdCurrentBlock = $mdBlock; + } + else + { + if (isset($CurrentBlock)) + { + $Elements[] = $this->extractElement($CurrentBlock); +/*new*/ $mdElements[] = $mdCurrentBlock; + } + + $CurrentBlock = $this->paragraph($Line); +/*new*/ $mdCurrentBlock = $line; + $CurrentBlock['identified'] = true; + } + } - return $cleanBlocks; + + # ~ + + if (isset($CurrentBlock['continuable']) and $this->isBlockCompletable($CurrentBlock['type'])) + { + $methodName = 'block' . $CurrentBlock['type'] . 'Complete'; + $CurrentBlock = $this->$methodName($CurrentBlock); +/*new*/ $mdCurrentBlock = $mdCurrentBlock; + } + + # ~ + + if (isset($CurrentBlock)) + { + $Elements[] = $this->extractElement($CurrentBlock); +/*new*/ $mdElements[] = $mdCurrentBlock; + } + + # ~ +/*new*/ return $mdElements; +# return $Elements; } + public function arrayBlocksToMarkdown(array $arrayBlocks) { @@ -823,4 +922,106 @@ class ParsedownExtension extends \ParsedownExtra } return false; } + + + protected function inlineLink($Excerpt) + { + $Element = array( + 'name' => 'a', + 'handler' => array( + 'function' => 'lineElements', + 'argument' => null, + 'destination' => 'elements', + ), + 'nonNestables' => array('Url', 'Link'), + 'attributes' => array( + 'href' => null, + 'title' => null, + ), + ); + + $extent = 0; + + $remainder = $Excerpt['text']; + + if (preg_match('/\[((?:[^][]++|(?R))*+)\]/', $remainder, $matches)) + { + $Element['handler']['argument'] = $matches[1]; + + $extent += strlen($matches[0]); + + $remainder = substr($remainder, $extent); + } + else + { + return; + } + + if (preg_match('/^[(]\s*+((?:[^ ()]++|[(][^ )]+[)])++)(?:[ ]+("[^"]*+"|\'[^\']*+\'))?\s*+[)]/', $remainder, $matches)) + { + # start typemill: if relative link or media-link + $href = $matches[1]; + if($href[0] == '/') + { + $href = $this->baseUrl . $href; + } + elseif(substr( $href, 0, 6 ) === "media/") + { + $href = $this->baseUrl . '/' . $href; + } + # end typemill + + $Element['attributes']['href'] = $href; + + if (isset($matches[2])) + { + $Element['attributes']['title'] = substr($matches[2], 1, - 1); + } + + $extent += strlen($matches[0]); + } + else + { + if (preg_match('/^\s*\[(.*?)\]/', $remainder, $matches)) + { + $definition = strlen($matches[1]) ? $matches[1] : $Element['handler']['argument']; + $definition = strtolower($definition); + + $extent += strlen($matches[0]); + } + else + { + $definition = strtolower($Element['handler']['argument']); + } + + if ( ! isset($this->DefinitionData['Reference'][$definition])) + { + return; + } + + $Definition = $this->DefinitionData['Reference'][$definition]; + + $Element['attributes']['href'] = $Definition['url']; + $Element['attributes']['title'] = $Definition['title']; + } + + $Link = array( + 'extent' => $extent, + 'element' => $Element, + ); + + # Parsedown Extra + $remainder = $Link !== null ? substr($Excerpt['text'], $Link['extent']) : ''; + + if (preg_match('/^[ ]*{('.$this->regexAttribute.'+)}/', $remainder, $matches)) + { + $Link['element']['attributes'] += $this->parseAttributeData($matches[1]); + + $Link['extent'] += strlen($matches[0]); + } + + return $Link; + + } + } \ No newline at end of file diff --git a/system/Extensions/TwigMarkdownExtension.php b/system/Extensions/TwigMarkdownExtension.php index 4d0c0c7..ae4aa6c 100644 --- a/system/Extensions/TwigMarkdownExtension.php +++ b/system/Extensions/TwigMarkdownExtension.php @@ -19,6 +19,6 @@ class TwigMarkdownExtension extends \Twig_Extension $markdownArray = $parsedown->text($markdown); - return $parsedown->markup($markdownArray, false); + return $parsedown->markup($markdownArray); } } \ No newline at end of file diff --git a/system/Models/ProcessAssets.php b/system/Models/ProcessAssets.php index 4752e89..b64c08d 100644 --- a/system/Models/ProcessAssets.php +++ b/system/Models/ProcessAssets.php @@ -249,5 +249,5 @@ class ProcessAssets } return $bytes; - } + } } \ No newline at end of file diff --git a/system/Models/ProcessImage.php b/system/Models/ProcessImage.php index a62c58f..4bfceee 100644 --- a/system/Models/ProcessImage.php +++ b/system/Models/ProcessImage.php @@ -177,7 +177,7 @@ class ProcessImage extends ProcessAssets $new = imagecreatetruecolor($desired['width'], $desired['height']); // preserve transparency - if($imageType == "gif" or $imageType == "png") + if($imageType == "gif" or $imageType == "png" or $imageType == "webp") { imagecolortransparent($new, imagecolorallocatealpha($new, 0, 0, 0, 127)); imagealphablending($new, false); @@ -214,6 +214,10 @@ class ProcessImage extends ProcessAssets { $result = imagegif( $image, $folder . $name . '.gif' ); } + elseif($type == "webp") + { + $result = imagewebp( $image, $folder . $name . '.webp', 100); + } elseif($type == "jpg" OR $type == "jpeg") { $result = imagejpeg( $image, $folder . $name . '.' . $type ); @@ -400,6 +404,7 @@ class ProcessImage extends ProcessAssets case 'jpg' : case 'jpeg': $image = imagecreatefromjpeg($imagePath); break; case 'png': $image = imagecreatefrompng($imagePath); break; + case 'webp': $image = imagecreatefromwebp($imagePath); break; default: return 'image type not supported'; } diff --git a/system/Models/User.php b/system/Models/User.php index d990b5f..ec2f6e9 100644 --- a/system/Models/User.php +++ b/system/Models/User.php @@ -38,26 +38,12 @@ class User extends WriteYaml } public function createUser($params) - { - $userdata = array( - 'username' => $params['username'], - 'email' => $params['email'], - 'password' => $this->generatePassword($params['password']), - 'userrole' => $params['userrole'] - ); - - if(isset($params['firstname'])) - { - $userdata['firstname'] = $params['firstname']; - } - if(isset($params['lastname'])) - { - $userdata['lastname'] = $params['lastname']; - } + { + $params['password'] = $this->generatePassword($params['password']); - if($this->updateYaml('settings/users', $userdata['username'] . '.yaml', $userdata)) + if($this->updateYaml('settings/users', $params['username'] . '.yaml', $params)) { - return $userdata['username']; + return $params['username']; } return false; } @@ -81,11 +67,14 @@ class User extends WriteYaml } $update = array_merge($userdata, $params); + + # cleanup data here + $this->updateYaml('settings/users', $userdata['username'] . '.yaml', $update); # if user updated his own profile, update session data - if($_SESSION['user'] == $params['username']) + if(isset($_SESSION['user']) && $_SESSION['user'] == $params['username']) { $_SESSION['role'] = $update['userrole']; diff --git a/system/Models/Validation.php b/system/Models/Validation.php index 84b0554..fedb492 100644 --- a/system/Models/Validation.php +++ b/system/Models/Validation.php @@ -29,12 +29,12 @@ class Validation Validator::addRule('image_types', function($field, $value, array $params, array $fields) use ($user) { - $allowed = ['jpg', 'jpeg', 'png']; + $allowed = ['jpg', 'jpeg', 'png', 'webp']; $pathinfo = pathinfo($value); $extension = strtolower($pathinfo['extension']); - if(array_search($extension, $allowed)){ return true; } + if(in_array($extension, $allowed)){ return true; } return false; - }, 'only jpg, jpeg, png allowed'); + }, 'only jpg, jpeg, png, webp, allowed'); Validator::addRule('userAvailable', function($field, $value, array $params, array $fields) use ($user) { diff --git a/system/Models/WriteCache.php b/system/Models/WriteCache.php index 2d0f461..cfb80c2 100644 --- a/system/Models/WriteCache.php +++ b/system/Models/WriteCache.php @@ -46,11 +46,16 @@ class WriteCache extends Write public function updateCache($folderName, $cacheFileName, $requestFileName, $cacheData) { $sCacheData = serialize($cacheData); - $this->writeFile($folderName, $cacheFileName, $sCacheData); - if($requestFileName) + if($this->writeFile($folderName, $cacheFileName, $sCacheData)) { - $this->writeFile($folderName, $requestFileName, time()); + if($requestFileName) + { + $this->writeFile($folderName, $requestFileName, time()); + } + + return true; } + return false; } /** diff --git a/system/Plugin.php b/system/Plugin.php index 216f4cc..2ec3eaa 100644 --- a/system/Plugin.php +++ b/system/Plugin.php @@ -153,7 +153,7 @@ abstract class Plugin implements EventSubscriberInterface $parsedown = new ParsedownExtension(); $contentArray = $parsedown->text($markdown); - $html = $parsedown->markup($contentArray,false); + $html = $parsedown->markup($contentArray); return $html; } diff --git a/system/Plugins.php b/system/Plugins.php index f40000a..5e4ba9e 100644 --- a/system/Plugins.php +++ b/system/Plugins.php @@ -77,8 +77,7 @@ class Plugins if( isset($route['httpMethod']) AND in_array($route['httpMethod'], array('get','post','put','delete','head','patch','options')) AND isset($route['route']) AND is_string($route['route']) - AND isset($route['class']) AND is_string($route['class']) - AND !$this->in_array_r(strtolower($route['route']),$routes)) + AND isset($route['class']) AND is_string($route['class'])) { return true; } diff --git a/system/Routes/Api.php b/system/Routes/Api.php index f1095a6..ab786a5 100644 --- a/system/Routes/Api.php +++ b/system/Routes/Api.php @@ -10,6 +10,7 @@ use Typemill\Controllers\MetaApiController; use Typemill\Middleware\RestrictApiAccess; $app->get('/api/v1/themes', SettingsController::class . ':getThemeSettings')->setName('api.themes')->add(new RestrictApiAccess($container['router'])); +$app->delete('/api/v1/clearcache', SettingsController::class . ':clearCache')->setName('api.clearcache')->add(new RestrictApiAccess($container['router'])); $app->post('/api/v1/article/markdown', ArticleApiController::class . ':getArticleMarkdown')->setName('api.article.markdown')->add(new RestrictApiAccess($container['router'])); $app->post('/api/v1/article/html', ArticleApiController::class . ':getArticleHtml')->setName('api.article.html')->add(new RestrictApiAccess($container['router'])); diff --git a/system/Settings.php b/system/Settings.php index b553cea..27c9fc9 100644 --- a/system/Settings.php +++ b/system/Settings.php @@ -20,8 +20,11 @@ class Settings $settings = array_merge($defaultSettings, $userSettings); } - # no individual image sizes are allowed sind 1.3.4 - $settings['images'] = $defaultSettings['images']; + # no individual image sizes are allowed since 1.3.4 + # $settings['images'] = $defaultSettings['images']; + # make sure that thumb sizes are still there. + $images = array_merge($defaultSettings['images'], $settings['images']); + $settings['images'] = $images; # we have to check if the theme has been deleted $themefolder = $settings['rootPath'] . $settings['themeFolder'] . DIRECTORY_SEPARATOR; @@ -60,10 +63,9 @@ class Settings public static function getDefaultSettings() { $rootPath = __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR; - + return [ 'determineRouteBeforeAppMiddleware' => true, - 'displayErrorDetails' => false, 'title' => 'TYPEMILL', 'author' => 'Unknown', 'copyright' => 'Copyright', @@ -80,8 +82,6 @@ class Settings 'editor' => 'visual', 'formats' => ['markdown', 'headline', 'ulist', 'olist', 'table', 'quote', 'notice', 'image', 'video', 'file', 'toc', 'hr', 'definition', 'code'], 'contentFolder' => 'content', - 'cache' => true, - 'cachePath' => $rootPath . 'cache', 'version' => '1.3.8', 'setup' => true, 'welcome' => true, @@ -166,11 +166,15 @@ class Settings 'setup' => true, 'welcome' => true, 'images' => true, + 'live' => true, + 'width' => true, + 'height' => true, 'plugins' => true, 'themes' => true, 'latestVersion' => true, 'logo' => true, - 'favicon' => true + 'favicon' => true, + 'twigcache' => true ]; # cleanup the existing usersettings diff --git a/system/Translations.php b/system/Translations.php index 3bd1abf..9f7b854 100644 --- a/system/Translations.php +++ b/system/Translations.php @@ -62,7 +62,9 @@ class Translations } } foreach($plugin_labels as $key => $value) { - $plugins_labels = array_merge($plugins_labels, $value); + if(is_array($value)){ + $plugins_labels = array_merge($plugins_labels, $value); + } } } } diff --git a/system/author/css/style.css b/system/author/css/style.css index 7911176..20c86e8 100644 --- a/system/author/css/style.css +++ b/system/author/css/style.css @@ -185,6 +185,7 @@ body,input,select,textarea{ -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } + header, nav, h1, h2, h3, h4, h5, h6{ font-family: arial, sans-serif; } @@ -593,9 +594,6 @@ footer{ margin-left: auto; margin-right: auto; } -.setupWrapper label{ - font-weight: 700; -} .setupWrapper input[type="submit"] { border-radius: 0px; @@ -607,7 +605,7 @@ footer{ border: 2px solid #f9f8f6; } .setupWrapper .formElement{ - margin: 0 0 20px 0; + margin: 0 0 30px 0; } /************************ @@ -899,6 +897,9 @@ form .hidden{ .large img{ width: 100%; } +.large.img-component img, .large .img-upload img{ + width: auto; +} fieldset{ display: block; position: relative; @@ -911,20 +912,19 @@ fieldset{ label,.label{ display: inline-block; width: 100%; - font-size: 0.75em; + font-size: 0.9em; font-weight: 300; padding: 0px; line-height: 1.5em; - text-transform: uppercase; } -input, select, textarea{ +input, select, textarea{ display: inline-block; box-shadow: none; width: 100%; font-size: 1em; box-sizing: border-box; min-height: 42px; - border: 1px solid #f9f8f6; + border: 1px solid #eee; background: #f9f8f6; } input:focus, select:focus, textarea:focus{ @@ -1150,11 +1150,15 @@ ul.cardInfo{ overflow: hidden; border: 1px; } +.description{ + font-size: .8em; + font-style: italic; +} .cardFields .cardField:first-child{ margin-top: 50px; } .cardFields input, .cardFields select, .cardFields textarea, .cardFields .onoffswitch{ - margin-bottom: 12px; + margin-bottom: 6px; } .cardFields label{ margin-top: 12px; @@ -1168,7 +1172,7 @@ ul.cardInfo{ position: relative; width: 100%; display: inline-block; - margin: 10px 0; + margin: 26px 0 0; } .cardField.full{ width: 100%; @@ -1660,8 +1664,8 @@ label .help, .label .help{ background:#e0474c; color: #fff; } -.editor button:disabled, -.editor button[disabled]{ +button:disabled, +button[disabled]{ border: 1px solid #eee; background: #eee; color: #444; diff --git a/system/author/editor/editor-blox.twig b/system/author/editor/editor-blox.twig index 5a037d5..cf249e0 100644 --- a/system/author/editor/editor-blox.twig +++ b/system/author/editor/editor-blox.twig @@ -51,7 +51,7 @@
- +
diff --git a/system/author/js/author.js b/system/author/js/author.js index 372e401..8ddc12b 100644 --- a/system/author/js/author.js +++ b/system/author/js/author.js @@ -297,8 +297,39 @@ visiblefilename.value = ''; } - }()); + }()); } + + /************************************* + ** Clear Cache ** + *************************************/ + + var cachebutton = document.getElementById("clearcache"); + + if(cachebutton) + { + + cachebutton.addEventListener("click", function(event){ + + event.preventDefault(); + + myaxios.delete('/api/v1/clearcache',{ + data: { + 'csrf_name': document.getElementById("csrf_name").value, + 'csrf_value': document.getElementById("csrf_value").value, + } + }) + .then(function (response) { + cachebutton.disabled = true; + document.getElementById("cacheresult").innerHTML = "Done!"; + }) + .catch(function (error) + { + document.getElementById("cacheresult").innerHTML = "" + error.response.data.errors + ""; + }); + }); + } + /************************************* ** COLOR PICKER ** diff --git a/system/author/js/vue-blox.js b/system/author/js/vue-blox.js index 2433121..615462c 100644 --- a/system/author/js/vue-blox.js +++ b/system/author/js/vue-blox.js @@ -16,7 +16,7 @@ const contentComponent = Vue.component('content-block', { '' + '
' + '' + - '' + + '' + '
' + '
' + '
' + @@ -79,6 +79,10 @@ const contentComponent = Vue.component('content-block', { }, updateMarkdown: function($event) { + eventBus.$emit('markdownChanged'); + self.$root.$data.unsafed = true; + this.edit = true; + this.unsafed = true; this.compmarkdown = $event; this.setComponentSize(); }, @@ -105,10 +109,19 @@ const contentComponent = Vue.component('content-block', { switchToEditMode: function() { if(this.edit){ return; } + + if(this.$root.$data.unsafed) + { + publishController.errors.message = "Please save or cancel your changes."; + return; + } + eventBus.$emit('closeComponents'); + self = this; + self.$root.$data.freeze = true; /* freeze the data */ - self.$root.$data.sortdisabled = true; /* disable sorting */ + self.$root.$data.sortdisabled = true; /* disable sorting */ this.preview = 'hidden'; /* hide the html-preview */ this.edit = true; /* show the edit-mode */ this.compmarkdown = self.$root.$data.blockMarkdown; /* get markdown data */ @@ -125,19 +138,25 @@ const contentComponent = Vue.component('content-block', { this.$refs.preview.style.minHeight = "auto"; } }, + cancel: function() + { + self = this; + self.$root.$data.unsafed = false; + this.switchToPreviewMode(); + }, switchToPreviewMode: function() { self = this; - self.$root.$data.freeze = false; /* activate the data again */ - self.$root.sortdisabled = false; /* activate sorting again */ - this.preview = 'visible'; /* show the html-preview */ - this.edit = false; /* hide the edit mode */ - this.compmarkdown = ''; /* clear markdown content */ - this.componentType = false; /* delete the component type */ + self.$root.$data.freeze = false; /* activate the data again */ + self.$root.sortdisabled = false; /* activate sorting again */ + this.preview = 'visible'; /* show the html-preview */ + this.edit = false; /* hide the edit mode */ + this.compmarkdown = ''; /* clear markdown content */ + this.componentType = false; /* delete the component type */ self.$root.$data.blockType = false; self.$root.$data.blockMarkdown = false; self.$root.$data.file = false; - publishController.errors.message = false; /* delete all error messages */ + publishController.errors.message = false; /* delete all error messages */ this.$refs.preview.style.minHeight = "auto"; }, freezePage: function() @@ -216,7 +235,8 @@ const contentComponent = Vue.component('content-block', { { if(this.compmarkdown == undefined || this.compmarkdown.replace(/(\r\n|\n|\r|\s)/gm,"") == '') { - this.switchToPreviewMode(); + this.$root.$data.unsafed = false; + this.switchToPreviewMode(); } else { @@ -263,6 +283,7 @@ const contentComponent = Vue.component('content-block', { var oldVideoID = this.$root.$data.blockMarkdown.match(/#.*? /); if(this.compmarkdown.indexOf(oldVideoID[0].substring(1).trim()) !== -1) { + this.$root.$data.unsafed = false; this.activatePage(); this.switchToPreviewMode(); return; @@ -294,6 +315,7 @@ const contentComponent = Vue.component('content-block', { { if(httpStatus == 400) { + this.$root.$data.unsafed = false; self.activatePage(); publishController.errors.message = "Looks like you are logged out. Please login and try again."; } @@ -305,12 +327,14 @@ const contentComponent = Vue.component('content-block', { if(result.errors) { + self.$root.$data.unsafed = false; publishController.errors.message = result.errors.message; } else { var thisBlockType = self.$root.$data.blockType; - + + self.$root.$data.unsafed = false; self.switchToPreviewMode(); if(self.$root.$data.blockId == 99999) @@ -374,6 +398,7 @@ const contentComponent = Vue.component('content-block', { } else if(httpStatus != 200) { + self.$root.$data.unsafed = false; self.activatePage(); publishController.errors.message = "Sorry, something went wrong. Please refresh the page and try again."; } @@ -405,11 +430,13 @@ const contentComponent = Vue.component('content-block', { { if(httpStatus == 400) { + self.$root.$data.unsafed = false; self.activatePage(); publishController.errors.message = "Looks like you are logged out. Please login and try again."; } if(response) { + self.$root.$data.unsafed = false; self.activatePage(); var result = JSON.parse(response); @@ -798,8 +825,9 @@ const noticeComponent = Vue.component('notice-component', { this.prefix = this.getNoticePrefix(this.compmarkdown); var lines = this.compmarkdown.match(/^.*([\n\r]+|$)/gm); - for (var i = 0; i < lines.length; i++) { - lines[i] = lines[i].replace(/(^[\! ]+)/mg, ''); + for (var i = 0; i < lines.length; i++) + { + lines[i] = lines[i].replace(/(^[\! ]+(?!\[))/mg, ''); } this.notice = lines.join(''); @@ -1432,11 +1460,11 @@ const imageComponent = Vue.component('image-component', { } } - var imgpreview = imgmarkdown.match(/\(.*?\)/); - if(imgpreview) + var imgfile = imgmarkdown.match(/\(.*?\)/); + if(imgfile) { - this.imgpreview = imgpreview[0].slice(1,-1); - this.imgfile = this.imgpreview; + this.imgfile = imgfile[0].slice(1,-1); + this.imgpreview = this.$root.$data.root + '/' + this.imgfile; } } }, @@ -1822,500 +1850,6 @@ const fileComponent = Vue.component('file-component', { } }) -const medialib = Vue.component('medialib', { - props: ['parentcomponent'], - template: '
' + - '
' + - '
' + - '' + - '
' + - '
' + - '
' + - '' + - '' + - '
' + - '
' + - '
{{errors}}
' + - '' + - '
' + - '' + - ' click to select' + - '' + - '
' + - '
{{ image.name }}
' + - '' + - '' + - '
' + - '
' + - '
' + - '
' + - '
' + - '
' + - '
' + - '' + - '
' + - '
' + - '
' + - '
Name
{{ imagedetaildata.name}}
' + - '
URL
{{ imagedetaildata.src_live}}
' + - '
' + - '
' + - '
Size
{{ getSize(imagedetaildata.bytes) }}
' + - '
' + - '
' + - '
Dimensions
{{ imagedetaildata.width }}x{{ imagedetaildata.height }} px
' + - '
' + - '
' + - '
Type
{{ imagedetaildata.type }}
' + - '
' + - '
' + - '
Date
{{ getDate(imagedetaildata.timestamp) }}
' + - '
' + - '
' + - '
' + - '' + - '' + - '
' + - '
' + - '
' + - '' + - '
' + - '

Image used in:

' + - '' + - '
No pages found.
'+ - '
' + - '
' + - '' + - '
' + - '' + - '
' + - '' + - '
' + - '
' + - '
{{ file.name }}
' + - '' + - '' + - '
' + - '
' + - '
' + - '
' + - '
' + - '
' + - '
' + - '
{{ filedetaildata.info.extension }}
' + - '
' + - '
' + - '
' + - '
Name
{{ filedetaildata.name}}
' + - '
URL
{{ filedetaildata.url}}
' + - '
' + - '
' + - '
Size
{{ getSize(filedetaildata.bytes) }}
' + - '
' + - '
' + - '
Type
{{ filedetaildata.info.extension }}
' + - '
' + - '
' + - '
Date
{{ getDate(filedetaildata.timestamp) }}
' + - '
' + - '
' + - '
' + - '' + - '' + - '
' + - '
' + - '
' + - '' + - '
' + - '

File used in:

' + - '' + - '
No pages found.
'+ - '
' + - '
' + - '
' + - '
' + - '
', - data: function(){ - return { - imagedata: false, - showimages: true, - imagedetaildata: false, - showimagedetails: false, - filedata: false, - showfiles: false, - filedetaildata: false, - showfiledetails: false, - detailindex: false, - load: false, - baseurl: false, - search: '', - errors: false, - } - }, - mounted: function(){ - - if(this.parentcomponent == 'files') - { - this.showFiles(); - } - - this.errors = false; - var self = this; - - myaxios.get('/api/v1/medialib/images',{ - params: { - 'url': document.getElementById("path").value, - 'csrf_name': document.getElementById("csrf_name").value, - 'csrf_value': document.getElementById("csrf_value").value, - } - }) - .then(function (response) - { - self.imagedata = response.data.images; - }) - .catch(function (error) - { - if(error.response) - { - self.errors = error.response.data.errors; - } - }); - }, - computed: { - filteredImages() { - - var searchimages = this.search; - var filteredImages = {}; - var images = this.imagedata; - if(images) - { - Object.keys(images).forEach(function(key) { - var searchindex = key + ' ' + images[key].name; - if(searchindex.toLowerCase().indexOf(searchimages.toLowerCase()) !== -1) - { - filteredImages[key] = images[key]; - } - }); - } - return filteredImages; - }, - filteredFiles() { - - var searchfiles = this.search; - var filteredFiles = {}; - var files = this.filedata; - if(files) - { - Object.keys(files).forEach(function(key) { - var searchindex = key + ' ' + files[key].name; - if(searchindex.toLowerCase().indexOf(searchfiles.toLowerCase()) !== -1) - { - filteredFiles[key] = files[key]; - } - }); - } - return filteredFiles; - } - }, - methods: { - isImagesActive: function() - { - if(this.showimages) - { - return 'bg-tm-green white'; - } - return 'bg-light-gray black'; - }, - isFilesActive: function() - { - if(this.showfiles) - { - return 'bg-tm-green white'; - } - return 'bg-light-gray black'; - }, - closemedialib: function() - { - this.$parent.showmedialib = false; - }, - getBackgroundImage: function(image) - { - return 'background-image: url(' + image.src_thumb + ');width:250px'; - }, - showImages: function() - { - this.errors = false; - this.showimages = true; - this.showfiles = false; - this.showimagedetails = false; - this.showfiledetails = false; - this.imagedetaildata = false; - this.detailindex = false; - }, - showFiles: function() - { - this.showimages = false; - this.showfiles = true; - this.showimagedetails = false; - this.showfiledetails = false; - this.imagedetaildata = false; - this.filedetaildata = false; - this.detailindex = false; - - if(!this.files) - { - this.errors = false; - var filesself = this; - - myaxios.get('/api/v1/medialib/files',{ - params: { - 'url': document.getElementById("path").value, - 'csrf_name': document.getElementById("csrf_name").value, - 'csrf_value': document.getElementById("csrf_value").value, - } - }) - .then(function (response) - { - filesself.filedata = response.data.files; - }) - .catch(function (error) - { - if(error.response) - { - filesself.errors = error.response.data.errors; - } - }); - } - }, - showImageDetails: function(image,index) - { - this.errors = false; - this.showimages = false; - this.showfiles = false; - this.showimagedetails = true; - this.detailindex = index; - this.baseurl = myaxios.defaults.baseURL + '/tm/content/visual'; - - var imageself = this; - - myaxios.get('/api/v1/image',{ - params: { - 'url': document.getElementById("path").value, - 'name': image.name, - 'csrf_name': document.getElementById("csrf_name").value, - 'csrf_value': document.getElementById("csrf_value").value, - } - }) - .then(function (response) - { - imageself.imagedetaildata = response.data.image; - }) - .catch(function (error) - { - if(error.response) - { - imageself.errors = error.response.data.errors; - } - }); - }, - showFileDetails: function(file,index) - { - this.errors = false; - this.showimages = false; - this.showfiles = false; - this.showimagedetails = false; - this.showfiledetails = true; - this.detailindex = index; - - this.baseurl = myaxios.defaults.baseURL + '/tm/content/visual'; - - var fileself = this; - - myaxios.get('/api/v1/file',{ - params: { - 'url': document.getElementById("path").value, - 'name': file.name, - 'csrf_name': document.getElementById("csrf_name").value, - 'csrf_value': document.getElementById("csrf_value").value, - } - }) - .then(function (response) - { - fileself.filedetaildata = response.data.file; - }) - .catch(function (error) - { - if(error.response) - { - fileself.errors = error.response.data.errors; - } - }); - }, - selectImage: function(image) - { - this.showImages(); - - if(this.parentcomponent == 'images') - { - var imgmarkdown = {target: {value: '![alt]('+ image.src_live +')' }}; - - this.$parent.imgfile = image.src_live; - this.$parent.imgpreview = image.src_live; - this.$parent.imgmeta = true; - - this.$parent.showmedialib = false; - - this.$parent.createmarkdown(image.src_live); -/* this.$parent.updatemarkdown(imgmarkdown, image.src_live); */ - } - if(this.parentcomponent == 'files') - { - var filemarkdown = {target: {value: '[' + image.name + '](' + image.src_live +'){.tm-download}' }}; - - this.$parent.filemeta = true; - this.$parent.filetitle = image.name; - - this.$parent.showmedialib = false; - - this.$parent.updatemarkdown(filemarkdown, image.src_live); - } - }, - selectFile: function(file) - { - /* if image component is open */ - if(this.parentcomponent == 'images') - { - var imgextensions = ['png','jpg', 'jpeg', 'gif', 'svg']; - if(imgextensions.indexOf(file.info.extension) == -1) - { - this.errors = "you cannot insert a file into an image component"; - return; - } - var imgmarkdown = {target: {value: '![alt]('+ file.url +')' }}; - - this.$parent.imgfile = file.url; - this.$parent.imgpreview = file.url; - this.$parent.imgmeta = true; - - this.$parent.showmedialib = false; - - this.$parent.createmarkdown(file.url); -/* this.$parent.updatemarkdown(imgmarkdown, file.url);*/ - } - if(this.parentcomponent == 'files') - { - var filemarkdown = {target: {value: '['+ file.name +']('+ file.url +'){.tm-download file-' + file.info.extension + '}' }}; - - this.$parent.showmedialib = false; - - this.$parent.filemeta = true; - this.$parent.filetitle = file.info.filename + ' (' + file.info.extension.toUpperCase() + ')'; - - this.$parent.updatemarkdown(filemarkdown, file.url); - } - this.showFiles(); - }, - removeImage: function(index) - { - this.imagedata.splice(index,1); - }, - removeFile: function(index) - { - this.filedata.splice(index,1); - }, - deleteImage: function(image, index) - { - imageself = this; - - myaxios.delete('/api/v1/image',{ - data: { - 'url': document.getElementById("path").value, - 'name': image.name, - 'index': index, - 'csrf_name': document.getElementById("csrf_name").value, - 'csrf_value': document.getElementById("csrf_value").value, - } - }) - .then(function (response) - { - imageself.showImages(); - imageself.removeImage(index); - }) - .catch(function (error) - { - if(error.response) - { - imageself.errors = error.response.data.errors; - } - }); - }, - deleteFile: function(file, index) - { - fileself = this; - - myaxios.delete('/api/v1/file',{ - data: { - 'url': document.getElementById("path").value, - 'name': file.name, - 'index': index, - 'csrf_name': document.getElementById("csrf_name").value, - 'csrf_value': document.getElementById("csrf_value").value, - } - }) - .then(function (response) - { - fileself.showFiles(); - fileself.removeFile(index); - }) - .catch(function (error) - { - if(error.response) - { - fileself.errors = error.response.data.errors; - } - }); - }, - getDate(timestamp) - { - date = new Date(timestamp * 1000); - - datevalues = { - 'year': date.getFullYear(), - 'month': date.getMonth()+1, - 'day': date.getDate(), - 'hour': date.getHours(), - 'minute': date.getMinutes(), - 'second': date.getSeconds(), - }; - return datevalues.year + '-' + datevalues.month + '-' + datevalues.day; - }, - getSize(bytes) - { - var i = Math.floor(Math.log(bytes) / Math.log(1024)), - sizes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']; - - return (bytes / Math.pow(1024, i)).toFixed(2) * 1 + ' ' + sizes[i]; - }, - isChecked: function(classname) - { - if(this.imgclass == classname) - { - return ' checked'; - } - }, - }, -}) - let activeFormats = []; @@ -2342,6 +1876,7 @@ let editor = new Vue({ blockMarkdown: false, file: false, freeze: false, + unsafed: false, newBlocks: [], addblock: false, draftDisabled: true, @@ -2495,7 +2030,8 @@ let editor = new Vue({ }, setData: function(event, blocktype, body) { - // change this, not needed anymore. + if(this.unsafed){ return; } + this.blockId = event.currentTarget.dataset.id; this.blockMarkdown = this.markdown[this.blockId]; if(blocktype) diff --git a/system/author/js/vue-shared.js b/system/author/js/vue-shared.js index 1a13a8e..31790b3 100644 --- a/system/author/js/vue-shared.js +++ b/system/author/js/vue-shared.js @@ -1,6 +1,6 @@ Vue.component('component-image', { props: ['class', 'id', 'description', 'maxlength', 'hidden', 'readonly', 'required', 'disabled', 'placeholder', 'label', 'name', 'type', 'value', 'errors'], - template: '
' + + template: '
' + '' + '
' + '
' + @@ -52,7 +52,7 @@ Vue.component('component-image', { } }, mounted: function(){ - this.imgpreview = this.value; + this.imgpreview = myaxios.defaults.baseURL + '/' + this.value; }, methods: { update: function(value) @@ -138,4 +138,503 @@ Vue.component('component-image', { } } }, -}) \ No newline at end of file +}) + +const medialib = Vue.component('medialib', { + props: ['parentcomponent'], + template: '
' + + '
' + + '
' + + '' + + '
' + + '
' + + '
' + + '' + + '' + + '
' + + '
' + + '
{{errors}}
' + + '' + + '
' + + '' + + ' click to select' + + '' + + '
' + + '
{{ image.name }}
' + + '' + + '' + + '
' + + '
' + + '
' + + '
' + + '
' + + '
' + + '
' + + '' + + '
' + + '
' + + '
' + + '
Name
{{ imagedetaildata.name}}
' + + '
URL
{{ getImageUrl(imagedetaildata.src_live)}}
' + + '
' + + '
' + + '
Size
{{ getSize(imagedetaildata.bytes) }}
' + + '
' + + '
' + + '
Dimensions
{{ imagedetaildata.width }}x{{ imagedetaildata.height }} px
' + + '
' + + '
' + + '
Type
{{ imagedetaildata.type }}
' + + '
' + + '
' + + '
Date
{{ getDate(imagedetaildata.timestamp) }}
' + + '
' + + '
' + + '
' + + '' + + '' + + '
' + + '
' + + '
' + + '' + + '
' + + '

Image used in:

' + + '' + + '
No pages found.
'+ + '
' + + '
' + + '' + + '
' + + '' + + '
' + + '' + + '
' + + '
' + + '
{{ file.name }}
' + + '' + + '' + + '
' + + '
' + + '
' + + '
' + + '
' + + '
' + + '
' + + '
{{ filedetaildata.info.extension }}
' + + '
' + + '
' + + '
' + + '
Name
{{ filedetaildata.name}}
' + + '
URL
{{ filedetaildata.url}}
' + + '
' + + '
' + + '
Size
{{ getSize(filedetaildata.bytes) }}
' + + '
' + + '
' + + '
Type
{{ filedetaildata.info.extension }}
' + + '
' + + '
' + + '
Date
{{ getDate(filedetaildata.timestamp) }}
' + + '
' + + '
' + + '
' + + '' + + '' + + '
' + + '
' + + '
' + + '' + + '
' + + '

File used in:

' + + '' + + '
No pages found.
'+ + '
' + + '
' + + '
' + + '
' + + '
', + data: function(){ + return { + imagedata: false, + showimages: true, + imagedetaildata: false, + showimagedetails: false, + filedata: false, + showfiles: false, + filedetaildata: false, + showfiledetails: false, + detailindex: false, + load: false, + baseurl: myaxios.defaults.baseURL, + adminurl: false, + search: '', + errors: false, + } + }, + mounted: function(){ + + if(this.parentcomponent == 'files') + { + this.showFiles(); + } + + this.errors = false; + var self = this; + + myaxios.get('/api/v1/medialib/images',{ + params: { + 'url': document.getElementById("path").value, + 'csrf_name': document.getElementById("csrf_name").value, + 'csrf_value': document.getElementById("csrf_value").value, + } + }) + .then(function (response) + { + self.imagedata = response.data.images; + }) + .catch(function (error) + { + if(error.response) + { + self.errors = error.response.data.errors; + } + }); + }, + computed: { + filteredImages() { + + var searchimages = this.search; + var filteredImages = {}; + var images = this.imagedata; + if(images) + { + Object.keys(images).forEach(function(key) { + var searchindex = key + ' ' + images[key].name; + if(searchindex.toLowerCase().indexOf(searchimages.toLowerCase()) !== -1) + { + filteredImages[key] = images[key]; + } + }); + } + return filteredImages; + }, + filteredFiles() { + + var searchfiles = this.search; + var filteredFiles = {}; + var files = this.filedata; + if(files) + { + Object.keys(files).forEach(function(key) { + var searchindex = key + ' ' + files[key].name; + if(searchindex.toLowerCase().indexOf(searchfiles.toLowerCase()) !== -1) + { + filteredFiles[key] = files[key]; + } + }); + } + return filteredFiles; + } + }, + methods: { + isImagesActive: function() + { + if(this.showimages) + { + return 'bg-tm-green white'; + } + return 'bg-light-gray black'; + }, + isFilesActive: function() + { + if(this.showfiles) + { + return 'bg-tm-green white'; + } + return 'bg-light-gray black'; + }, + closemedialib: function() + { + this.$parent.showmedialib = false; + }, + getBackgroundImage: function(image) + { + return 'background-image: url(' + this.baseurl + '/' + image.src_thumb + ');width:250px'; + }, + getImageUrl(relativeUrl) + { + return this.baseurl + '/' + relativeUrl; + }, + showImages: function() + { + this.errors = false; + this.showimages = true; + this.showfiles = false; + this.showimagedetails = false; + this.showfiledetails = false; + this.imagedetaildata = false; + this.detailindex = false; + }, + showFiles: function() + { + this.showimages = false; + this.showfiles = true; + this.showimagedetails = false; + this.showfiledetails = false; + this.imagedetaildata = false; + this.filedetaildata = false; + this.detailindex = false; + + if(!this.files) + { + this.errors = false; + var filesself = this; + + myaxios.get('/api/v1/medialib/files',{ + params: { + 'url': document.getElementById("path").value, + 'csrf_name': document.getElementById("csrf_name").value, + 'csrf_value': document.getElementById("csrf_value").value, + } + }) + .then(function (response) + { + filesself.filedata = response.data.files; + }) + .catch(function (error) + { + if(error.response) + { + filesself.errors = error.response.data.errors; + } + }); + } + }, + showImageDetails: function(image,index) + { + this.errors = false; + this.showimages = false; + this.showfiles = false; + this.showimagedetails = true; + this.detailindex = index; + this.adminurl = myaxios.defaults.baseURL + '/tm/content/visual'; + + var imageself = this; + + myaxios.get('/api/v1/image',{ + params: { + 'url': document.getElementById("path").value, + 'name': image.name, + 'csrf_name': document.getElementById("csrf_name").value, + 'csrf_value': document.getElementById("csrf_value").value, + } + }) + .then(function (response) + { + imageself.imagedetaildata = response.data.image; + }) + .catch(function (error) + { + if(error.response) + { + imageself.errors = error.response.data.errors; + } + }); + }, + showFileDetails: function(file,index) + { + this.errors = false; + this.showimages = false; + this.showfiles = false; + this.showimagedetails = false; + this.showfiledetails = true; + this.detailindex = index; + + this.adminurl = myaxios.defaults.baseURL + '/tm/content/visual'; + + var fileself = this; + + myaxios.get('/api/v1/file',{ + params: { + 'url': document.getElementById("path").value, + 'name': file.name, + 'csrf_name': document.getElementById("csrf_name").value, + 'csrf_value': document.getElementById("csrf_value").value, + } + }) + .then(function (response) + { + fileself.filedetaildata = response.data.file; + }) + .catch(function (error) + { + if(error.response) + { + fileself.errors = error.response.data.errors; + } + }); + }, + selectImage: function(image) + { + this.showImages(); + + if(this.parentcomponent == 'images') + { + var imgmarkdown = {target: {value: '![alt]('+ image.src_live +')' }}; + + this.$parent.imgfile = image.src_live; + this.$parent.imgpreview = this.baseurl + '/' + image.src_live; + this.$parent.imgmeta = true; + + this.$parent.showmedialib = false; + + this.$parent.createmarkdown(image.src_live); +/* this.$parent.updatemarkdown(imgmarkdown, image.src_live); */ + } + if(this.parentcomponent == 'files') + { + var filemarkdown = {target: {value: '[' + image.name + '](' + image.src_live +'){.tm-download}' }}; + + this.$parent.filemeta = true; + this.$parent.filetitle = image.name; + + this.$parent.showmedialib = false; + + this.$parent.updatemarkdown(filemarkdown, image.src_live); + } + }, + selectFile: function(file) + { + /* if image component is open */ + if(this.parentcomponent == 'images') + { + var imgextensions = ['png','jpg', 'jpeg', 'gif', 'svg', 'webp']; + if(imgextensions.indexOf(file.info.extension) == -1) + { + this.errors = "you cannot insert a file into an image component"; + return; + } + var imgmarkdown = {target: {value: '![alt]('+ file.url +')' }}; + + this.$parent.imgfile = file.url; + this.$parent.imgpreview = file.url; + this.$parent.imgmeta = true; + + this.$parent.showmedialib = false; + + this.$parent.createmarkdown(file.url); +/* this.$parent.updatemarkdown(imgmarkdown, file.url);*/ + } + if(this.parentcomponent == 'files') + { + var filemarkdown = {target: {value: '['+ file.name +']('+ file.url +'){.tm-download file-' + file.info.extension + '}' }}; + + this.$parent.showmedialib = false; + + this.$parent.filemeta = true; + this.$parent.filetitle = file.info.filename + ' (' + file.info.extension.toUpperCase() + ')'; + + this.$parent.updatemarkdown(filemarkdown, file.url); + } + this.showFiles(); + }, + removeImage: function(index) + { + this.imagedata.splice(index,1); + }, + removeFile: function(index) + { + this.filedata.splice(index,1); + }, + deleteImage: function(image, index) + { + imageself = this; + + myaxios.delete('/api/v1/image',{ + data: { + 'url': document.getElementById("path").value, + 'name': image.name, + 'index': index, + 'csrf_name': document.getElementById("csrf_name").value, + 'csrf_value': document.getElementById("csrf_value").value, + } + }) + .then(function (response) + { + imageself.showImages(); + imageself.removeImage(index); + }) + .catch(function (error) + { + if(error.response) + { + imageself.errors = error.response.data.errors; + } + }); + }, + deleteFile: function(file, index) + { + fileself = this; + + myaxios.delete('/api/v1/file',{ + data: { + 'url': document.getElementById("path").value, + 'name': file.name, + 'index': index, + 'csrf_name': document.getElementById("csrf_name").value, + 'csrf_value': document.getElementById("csrf_value").value, + } + }) + .then(function (response) + { + fileself.showFiles(); + fileself.removeFile(index); + }) + .catch(function (error) + { + if(error.response) + { + fileself.errors = error.response.data.errors; + } + }); + }, + getDate(timestamp) + { + date = new Date(timestamp * 1000); + + datevalues = { + 'year': date.getFullYear(), + 'month': date.getMonth()+1, + 'day': date.getDate(), + 'hour': date.getHours(), + 'minute': date.getMinutes(), + 'second': date.getSeconds(), + }; + return datevalues.year + '-' + datevalues.month + '-' + datevalues.day; + }, + getSize(bytes) + { + var i = Math.floor(Math.log(bytes) / Math.log(1024)), + sizes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']; + + return (bytes / Math.pow(1024, i)).toFixed(2) * 1 + ' ' + sizes[i]; + }, + isChecked: function(classname) + { + if(this.imgclass == classname) + { + return ' checked'; + } + }, + }, +}) diff --git a/system/author/layouts/layout.twig b/system/author/layouts/layout.twig index 7284f58..b63a8af 100644 --- a/system/author/layouts/layout.twig +++ b/system/author/layouts/layout.twig @@ -7,8 +7,6 @@ - - @@ -21,44 +19,13 @@ + + {{ assets.renderCSS() }} + - - - - external-link - - - - text-file - - - - cog - - - - power-off - - - - - - - - - - - - - - - - - - {{ assets.renderSvg() }} - - + + {% include 'partials/symbols.twig' %}
{% include 'partials/navi.twig' %} @@ -79,11 +46,16 @@ const myaxios = axios.create(); myaxios.defaults.baseURL = "{{ base_url }}"; + + + + {{ assets.renderJS() }} + \ No newline at end of file diff --git a/system/author/layouts/layoutAuth.twig b/system/author/layouts/layoutAuth.twig index 67c75f8..24ce000 100644 --- a/system/author/layouts/layoutAuth.twig +++ b/system/author/layouts/layoutAuth.twig @@ -7,8 +7,6 @@ - - @@ -21,34 +19,12 @@ - + + {{ assets.renderCSS() }} + - - - - external-link - - - - text-file - - - - cog - - - - power-off - - - - bookmark-o - - - - - + {% include 'partials/symbols.twig' %} {% include 'partials/flash.twig' %}
diff --git a/system/author/layouts/layoutBlank.twig b/system/author/layouts/layoutBlank.twig index 6263470..55a25e2 100644 --- a/system/author/layouts/layoutBlank.twig +++ b/system/author/layouts/layoutBlank.twig @@ -6,9 +6,7 @@ - - - + @@ -20,28 +18,11 @@ + - - - - external-link - - - - text-file - - - - cog - - - - power-off - - - - + + {% include 'partials/symbols.twig' %}
{% include 'partials/navi.twig' %} @@ -54,5 +35,6 @@
+ \ No newline at end of file diff --git a/system/author/layouts/layoutBlox.twig b/system/author/layouts/layoutBlox.twig index d033196..8e68602 100644 --- a/system/author/layouts/layoutBlox.twig +++ b/system/author/layouts/layoutBlox.twig @@ -6,9 +6,7 @@ - - - + @@ -27,162 +25,8 @@ - - - - - {{ __('EXTERNAL_LINK') }} - - - - {{ __('TEXT_FILE') }} - - - - {{ __('COG') }} - - - - {{ __('POWER_OFF') }} - - - - - {{ __('DELETE') }} - - - - {{ __('ADD') }} - - - - {{ __('DELETE_CLOSE') }} - - - - {{ __('HOME') }} - - - - {{ __('MOVE_VERTICAL') }} - - - - {{ __('FOLDER') }} - - - - {{ __('UPLOAD') }} - - - - {{ __('IMAGE') }} - - - - - - {{ __('NOTICE') }} - - - - {{ __('PAPERCLIP') }} - - - - {{ __('VIDEO') }} - - - - {{ __('QUOTES') }} - - - - {{ __('NUMBERED_LIST') }} - - - - {{ __('BULLET_LIST') }} - - - - {{ ('LINK') }} - - - - - {{ __('BOLD') }} - - - - {{ __('ITALIC') }} - - - - {{ __('HORIZONTAL_LINE') }} - - - - {{ __('TABLE') }} - - - - {{ __('PARAGRAPH') }} - - - - {{ __('CODE') }} - - - - - {{ __('HEADLINE') }} - - - - {{ __('TABLE_OF_CONTENTS') }} - - - - {{ __('DEFINITION') }} - - - - {{ __('CHECK') }} - - - - {{ __('CROSS') }} - - - - {{ __('TRASH') }} - - - - {{ __('INFO') }} - - - - - - {{ __('EYE_BLOCKED') }} - - - - - - {{ __('SEARCH') }} - - - - {{ __('CANCEL') }} - - - - {{ assets.renderSvg() }} - - + + {% include 'partials/symbols.twig' %}
{% include 'partials/navi.twig' %} diff --git a/system/author/layouts/layoutEditor.twig b/system/author/layouts/layoutEditor.twig index 6e934d3..c50f816 100644 --- a/system/author/layouts/layoutEditor.twig +++ b/system/author/layouts/layoutEditor.twig @@ -7,8 +7,6 @@ - - @@ -25,50 +23,8 @@ - - - - {{ __('EXTERNAL_LINK') }} - - - - {{ __('TEXT_FILE') }} - - - - {{ __('DELETE') }} - - - - {{ __('ADD') }} - - - - {{ __('DELETE_CLOSE') }} - - - - {{ __('HOME') }} - - - - {{ __('MOVE_VERTICAL') }} - - - - {{ __('FOLDER') }} - - - - {{ __('COG') }} - - - - {{ __('POWER_OFF') }} - - - - + + {% include 'partials/symbols.twig' %}
{% include 'partials/navi.twig' %} diff --git a/system/author/partials/fields.twig b/system/author/partials/fields.twig index 6238d3e..3433adb 100644 --- a/system/author/partials/fields.twig +++ b/system/author/partials/fields.twig @@ -9,7 +9,7 @@
- +
diff --git a/system/author/partials/navi.twig b/system/author/partials/navi.twig index b1d01d0..de04e0c 100644 --- a/system/author/partials/navi.twig +++ b/system/author/partials/navi.twig @@ -10,9 +10,9 @@ {{ __('Content') }}
  • {% endif %} {% if acl.isAllowed(get_role(), 'system', 'view') %} - {{ __('Settings') }}
  • + {{ __('Settings') }}
  • {% else %} - {{ __('Settings') }}
  • + {{ __('Settings') }}
  • {% endif %} {{ __('View Site') }}
  • {{ __('Logout') }}
  • diff --git a/system/author/partials/symbols.twig b/system/author/partials/symbols.twig new file mode 100644 index 0000000..89e9abb --- /dev/null +++ b/system/author/partials/symbols.twig @@ -0,0 +1,173 @@ + + + + {{ __('EXTERNAL_LINK') }} + + + + {{ __('TEXT_FILE') }} + + + + {{ __('COG') }} + + + + {{ __('POWER_OFF') }} + + + + {{ __('DELETE') }} + + + + {{ __('ADD') }} + + + + {{ __('DELETE_CLOSE') }} + + + + {{ __('HOME') }} + + + + {{ __('MOVE_VERTICAL') }} + + + + {{ __('FOLDER') }} + + + + {{ __('UPLOAD') }} + + + + {{ __('IMAGE') }} + + + + + + {{ __('NOTICE') }} + + + + {{ __('PAPERCLIP') }} + + + + {{ __('VIDEO') }} + + + + {{ __('QUOTES') }} + + + + {{ __('NUMBERED_LIST') }} + + + + {{ __('BULLET_LIST') }} + + + + {{ ('LINK') }} + + + + + {{ __('BOLD') }} + + + + {{ __('ITALIC') }} + + + + {{ __('HORIZONTAL_LINE') }} + + + + {{ __('TABLE') }} + + + + {{ __('PARAGRAPH') }} + + + + {{ __('CODE') }} + + + + + {{ __('HEADLINE') }} + + + + {{ __('TABLE_OF_CONTENTS') }} + + + + {{ __('DEFINITION') }} + + + + {{ __('CHECK') }} + + + + {{ __('CROSS') }} + + + + {{ __('TRASH') }} + + + + {{ __('INFO') }} + + + + + + {{ __('EYE_BLOCKED') }} + + + + + + {{ __('SEARCH') }} + + + + {{ __('CANCEL') }} + + + + + bookmark-o + + + + + + + + + + + + + + + + + + {{ assets.renderSvg() }} + + diff --git a/system/author/settings/blank.twig b/system/author/settings/blank.twig index 70063a6..dca410a 100644 --- a/system/author/settings/blank.twig +++ b/system/author/settings/blank.twig @@ -8,7 +8,10 @@
    {{ content }}
    - + + + {{ csrf_field() | raw }} +
    {% endblock %} \ No newline at end of file diff --git a/system/author/settings/system.twig b/system/author/settings/system.twig index 4fb337d..9eb29a3 100644 --- a/system/author/settings/system.twig +++ b/system/author/settings/system.twig @@ -147,7 +147,46 @@ {% endfor %} -
    +
    +
    +
    +

    {{ __('Developer') }}

    +

    The following options are only for developers and experienced administrators. Only change the options if you really understand them. For example: Never activate the error reporting for a live website, use this option only for bug-fixing.

    +
    +
    + + +
    +
    + + +
    +
    +
    {{ __('Delete all cache files') }}
    +
    +
    +
    + + +
    This applies only for future images in the content area.
    + {% if errors.settings.images.live.width %} + {{ errors.settings.images.live.width | first }} + {% endif %} +
    +
    + + +
    If you add a value for the height, then the image will be cropped.
    + {% if errors.settings.images.live.height %} + {{ errors.settings.images.live.height | first }} + {% endif %} +
    diff --git a/system/system.php b/system/system.php index 72360fa..b36a235 100644 --- a/system/system.php +++ b/system/system.php @@ -149,6 +149,8 @@ $container['dispatcher'] = function($container) use ($dispatcher) # delete username and password from uri $uri = $container['request']->getUri()->withUserInfo(''); +define("TM_BASE_URL", $uri->getBaseUrl()); + /******************************** * ADD ASSET-FUNCTION FOR TWIG * ********************************/ @@ -224,8 +226,10 @@ $container['view'] = function ($container) use ($uri) { $path = array($container->get('settings')['themePath'], $container->get('settings')['authorPath']); + $cache = ( isset($container->get('settings')['twigcache']) && $container->get('settings')['twigcache'] ) ? $container->get('settings')['rootPath'] . '/cache/twig' : false; + $view = new \Slim\Views\Twig( $path, [ - 'cache' => false, + 'cache' => $cache, 'autoescape' => false, 'debug' => true ]); diff --git a/themes/cyanine/404.twig b/themes/cyanine/404.twig index d9826ee..eaa2431 100644 --- a/themes/cyanine/404.twig +++ b/themes/cyanine/404.twig @@ -4,18 +4,18 @@ {% block content %} -
    +
    -

    Not Found

    +

    Not Found

    Sorry, but we did not find the page that you are looking for.

    - Home + Home
    diff --git a/themes/cyanine/css/style.css b/themes/cyanine/css/style.css index 07c81f1..49022d1 100644 --- a/themes/cyanine/css/style.css +++ b/themes/cyanine/css/style.css @@ -76,7 +76,10 @@ article h6{ font-size: 1em; font-style: italic; font-weight:300; margin: 1em 0 0 article .h1, article .h2, article .h3, article .h4, article .h5, article .h6{ height: auto; /* fix for tachyons */ } -hr{} +hr{ + border: none; + border-top: 1px solid; +} ol{} footer ul{ padding-left:1em; } li{} @@ -114,7 +117,10 @@ a, a:link, a:visited, a:focus, a:hover, a:active, button{ transition: all .15s ease!important; transition-property: color, background-color, text-shadow, border; } - +article a:hover, article a:focus, article a:active, +footer a:hover, footer a:focus, footer a:active{ + text-decoration: none; +} /* Fix background for hightlight plugin */ code.hljs{ background: transparent; } @@ -180,12 +186,12 @@ ul.TOC,.TOC ul{ text-decoration: none; display: inline-block; width: 100%; - border-bottom: 1px dashed lightseagreen; + border-bottom: 1px dashed; line-height: 1em; margin: .3em 0; } .TOC li a:hover,.TOC li a:focus,.TOC li a:active{ - border-bottom: 1px solid lightseagreen; + border-bottom: 1px solid; } .TOC li a:after{ content: '\203A'; @@ -199,14 +205,10 @@ ul.TOC,.TOC ul{ .notice1 { margin: 1em 0; padding: 10px 1em; - background-color: #ffded4; - border-left: 4px solid #f65a3c; } .notice2 { margin: 1em 0; padding: 10px 1em; - background-color: #fff3d4; - border-left: 4px solid #f6b73c; } .notice3, .notice4, @@ -310,6 +312,15 @@ button.play-video::after { content: ' '; } +.landingpageinfo h2{ + font-size: 2.25rem; +} +.landingpageinfo h3{ + font-size: 1.5rem; +} +.landingpageinfo h4{ + font-size: 1.25rem; +} /************************************ * TACHYONS ADDITIONS * diff --git a/themes/cyanine/cyanine.yaml b/themes/cyanine/cyanine.yaml index b05eb60..4bffa34 100644 --- a/themes/cyanine/cyanine.yaml +++ b/themes/cyanine/cyanine.yaml @@ -18,6 +18,14 @@ settings: forms: fields: + layoutsize: + type: select + label: Layout Size + options: + standard: Standard + large: Large + full: Full Width + landingpage: type: checkbox checkboxlabel: Activate a landingpage @@ -30,6 +38,15 @@ forms: type: number label: Position of Intro Segment description: Use 0 to disable the section + introTitle: + type: text + label: Title for your landingpage intro + placeholder: Typemill + description: Leave empty to use the title of your base content page. + introMarkdown: + type: textarea + label: Text for your landingpage intro (use markdown) + description: Leave empty to use the content of your base content page. introButtonLink: type: text label: Link for startbutton @@ -247,76 +264,137 @@ forms: fields: font: type: select - label: Basic font-family - description: All fonts are system fonts with (fallbacks) if the font is not installed - options: - serif: serif - sans-serif-tm: sans-serif - courier: courier (sans-serif) - helvetica: helvetica (sans-serif) - avenir: avenir (sans-serif) - athelas: athelas (serif) - georgia: georgia (serif) - times: times (serif) - bodoni: bodoni (serif) - calisto: calisto (serif) - garamond: garamond (serif) - baskerville: baskerville (serif) + label: General font-family + description: All fonts are system fonts with fallbacks + options: + BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif: sans-serif + georgia,times,serif: serif + courier,sans-serif: courier (sans-serif) + helvetica,sans-serif: helvetica (sans-serif) + avenir,sans-serif: avenir (sans-serif) + athelas,serif: athelas (serif) + georgia,serif: georgia (serif) + times,serif: times (serif) + bodoni,serif: bodoni (serif) + calisto,serif: calisto (serif) + garamond,serif: garamond (serif) + baskerville,serif: baskerville (serif) fontheadline: type: select label: Font-family for headlines - description: All fonts are system fonts with (fallbacks) if the font is not installed - options: - serif: serif - sans-serif-tm: sans-serif + description: All fonts are system fonts with fallbacks + options: + BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif: sans-serif + georgia,times,serif: serif + courier,sans-serif: courier (sans-serif) + helvetica,sans-serif: helvetica (sans-serif) + avenir,sans-serif: avenir (sans-serif) + athelas,serif: athelas (serif) + georgia,serif: georgia (serif) + times,serif: times (serif) + bodoni,serif: bodoni (serif) + calisto,serif: calisto (serif) + garamond,serif: garamond (serif) + baskerville,serif: baskerville (serif) fontnavi: type: select label: Font-family for navigations - description: All fonts are system fonts with (fallbacks) if the font is not installed - options: - serif: serif - sans-serif-tm: sans-serif - courier: courier (sans-serif) - helvetica: helvetica (sans-serif) - avenir: avenir (sans-serif) - athelas: athelas (serif) - georgia: georgia (serif) - times: times (serif) - bodoni: bodoni (serif) - calisto: calisto (serif) - garamond: garamond (serif) - baskerville: baskerville (serif) + description: All fonts are system fonts with fallbacks + options: + BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif: sans-serif + georgia,times,serif: serif + courier,sans-serif: courier (sans-serif) + helvetica,sans-serif: helvetica (sans-serif) + avenir,sans-serif: avenir (sans-serif) + athelas,serif: athelas (serif) + georgia,serif: georgia (serif) + times,serif: times (serif) + bodoni,serif: bodoni (serif) + calisto,serif: calisto (serif) + garamond,serif: garamond (serif) + baskerville,serif: baskerville (serif) fieldsetColors: type: fieldset legend: Colors fields: brandcolorprimary: type: text - label: Primary brand color + label: Background color for body placeholder: 'leightseagreen' - description: Used for the body background and borders - brandcolorsecondary: - type: text - label: Secondary brand color - placeholder: '#f7f7f7' - description: Used for content background, font-colors on hover and more + fieldsize: half fontcolorprimary: type: text - label: Primary font color - placeholder: 'lightseagreen' - description: Used for text - fontcolorsecondary: + label: Font color for body + placeholder: 'white' + fieldsize: half + newsbackground: type: text - label: Secondary font color + label: Background color for news-box + placeholder: 'white' + fieldsize: half + newscolor: + type: text + label: Font color for news-box + placeholder: '#333' + fieldsize: half + brandcolortertiary: + type: text + label: Background color for buttons + placeholder: 'lightseagreen' + fieldsize: half + fontcolortertiary: + type: text + label: Font color for buttons placeholder: '#F7F7F7' - description: Used as contrary color for hovers in navigation and buttons + fieldsize: half + bordercolortertiary: + type: text + label: Border color for buttons + placeholder: '#F7F7F7' + fieldsize: half fontcolorlink: type: text - label: text-links + label: Font color for content links placeholder: '#007F7F' - description: Used for links, check contrast for a11y. + fieldsize: half + brandcolorsecondary: + type: text + label: Background color for content + placeholder: '#f7f7f7' + fieldsize: half + fontcolorsecondary: + type: text + label: Font color for content + placeholder: '#333' + fieldsize: half + codebackground: + type: text + label: Background color for code + placeholder: '#ddd' + fieldsize: half + codecolor: + type: text + label: Font color for code + placeholder: '#333' + fieldsize: half + contentnavihoverbackground: + type: text + label: Background color for hover of content navigation + placeholder: 'lightseagreen' + fieldsize: half + contentnavihovercolor: + type: text + label: Font color for hover of content navigation + placeholder: 'white' + fieldsize: half thinbordercolor: type: text label: Thin border color placeholder: 'lightgray' - description: Used for thin borders in navigations and tables + description: Used for content navigation, table and horizontal line + fieldsize: half + noticecolors: + type: checkbox + label: Color for notices + checkboxlabel: Use grayscale color schema for notices + fieldsize: half diff --git a/themes/cyanine/home/landingpageContrast.twig b/themes/cyanine/home/landingpageContrast.twig index 72dbaf8..c95098b 100644 --- a/themes/cyanine/home/landingpageContrast.twig +++ b/themes/cyanine/home/landingpageContrast.twig @@ -1,9 +1,9 @@ -
    +
    -

    {{ settings.themes.cyanine.contrastTitle }}

    +

    {{ settings.themes.cyanine.contrastTitle }}

    {{ settings.themes.cyanine.contrastText }}

    - {{ settings.themes.cyanine.contrastLabel }} + {{ settings.themes.cyanine.contrastLabel }}
    diff --git a/themes/cyanine/home/landingpageInfo.twig b/themes/cyanine/home/landingpageInfo.twig index 34beb02..75d0ffc 100644 --- a/themes/cyanine/home/landingpageInfo.twig +++ b/themes/cyanine/home/landingpageInfo.twig @@ -1,6 +1,6 @@ -
    +
    -
    +
    {{ markdown(settings.themes.cyanine.infoMarkdown) }} diff --git a/themes/cyanine/home/landingpageIntro.twig b/themes/cyanine/home/landingpageIntro.twig index afb286f..383abb7 100644 --- a/themes/cyanine/home/landingpageIntro.twig +++ b/themes/cyanine/home/landingpageIntro.twig @@ -1,17 +1,25 @@ -
    +
    -

    {{ title }}

    + {% if settings.themes.cyanine.introTitle %} +

    {{ settings.themes.cyanine.introTitle }}

    + {% else %} +

    {{ title }}

    + {% endif %}
    - {{ content }} + {% if settings.themes.cyanine.introMarkdown %} + {{ markdown(settings.themes.cyanine.introMarkdown) }} + {% else %} + {{ content }} + {% endif %}
    {% if settings.themes.cyanine.introButtonLink %} - {{ settings.themes.cyanine.introButtonLabel }} + {{ settings.themes.cyanine.introButtonLabel }} {% endif %} diff --git a/themes/cyanine/home/landingpageNavi.twig b/themes/cyanine/home/landingpageNavi.twig index 8f2ad06..fde7c0c 100644 --- a/themes/cyanine/home/landingpageNavi.twig +++ b/themes/cyanine/home/landingpageNavi.twig @@ -1,9 +1,9 @@ -
    +
    -

    {{ settings.themes.cyanine.naviTitle }}

    -