diff --git a/cache/lastCache.txt b/cache/lastCache.txt index 5a63a82..99483be 100644 --- a/cache/lastCache.txt +++ b/cache/lastCache.txt @@ -1 +1 @@ -1543940450 \ No newline at end of file +1544113772 \ No newline at end of file diff --git a/content/01-Welcome/00-Setup.md b/content/00-Welcome/00-Setup.md similarity index 100% rename from content/01-Welcome/00-Setup.md rename to content/00-Welcome/00-Setup.md diff --git a/content/01-Welcome/01-Write-Content.md b/content/00-Welcome/01-Write-Content.md similarity index 100% rename from content/01-Welcome/01-Write-Content.md rename to content/00-Welcome/01-Write-Content.md diff --git a/content/01-Welcome/02-Get-Help.md b/content/00-Welcome/02-Get-Help.md similarity index 100% rename from content/01-Welcome/02-Get-Help.md rename to content/00-Welcome/02-Get-Help.md diff --git a/content/00-Welcome/03-test.txt b/content/00-Welcome/03-test.txt new file mode 100644 index 0000000..c8698b1 --- /dev/null +++ b/content/00-Welcome/03-test.txt @@ -0,0 +1 @@ +["# Add Title","Add Content"] \ No newline at end of file diff --git a/content/01-Welcome/index.md b/content/00-Welcome/index.md similarity index 100% rename from content/01-Welcome/index.md rename to content/00-Welcome/index.md diff --git a/content/01-stellenanzeigen/00-job-einstellen.md b/content/01-stellenanzeigen/00-job-einstellen.md new file mode 100644 index 0000000..f755b30 --- /dev/null +++ b/content/01-stellenanzeigen/00-job-einstellen.md @@ -0,0 +1,16 @@ +# Stellenangebot veröffentlichen + +CMSstash erreicht pro Monat mehrere tausend CMS-Experten in ganz Deutschland. Detaillierte Angaben finden sie in den [Mediadaten](/mediadaten). Unternehmen können diese Reichweite nutzen und ihre Stellenanzeigen mit CMS-Bezug auf CMSstash veröffentlichen. Wir bieten folgende Konditionen an: + +| Kondition | Anzeige Standard | Anzeige Pro | +|-----------|-----------|----------| +| Laufzeit | 8 Wochen | 8 Wochen | +| Exklusiver Teaser auf allen Seiten | Nein | 4 Wochen | +| Tweets | 1 Tweet | 3 Tweets | +| __Preis__ | **59,- Euro** | **159,- Euro** | +| _(keine Ausweisung der Mwst. nach § 19 UStG)_ | | | + +## Stellenanzeige aufgeben + +Bei Interesse schreiben Sie uns gerne über [jobs@cmsstash.de](mailto:jobs@cmsstash.de) an oder nutzen Sie das Kontaktformular. Aufgrund der inhaltlichen Ausrichtung können wir nur Stellenangebote mit einem klaren Bezug zum Thema Content Management Systeme veröffentlichen. + diff --git a/content/01-stellenanzeigen/index.md b/content/01-stellenanzeigen/index.md new file mode 100644 index 0000000..8924756 --- /dev/null +++ b/content/01-stellenanzeigen/index.md @@ -0,0 +1,4 @@ +# Add Title + +Add Content + diff --git a/plugins/contactform/contactform.php b/plugins/contactform/contactform.php new file mode 100644 index 0000000..8ee2b3e --- /dev/null +++ b/plugins/contactform/contactform.php @@ -0,0 +1,69 @@ + 'onSessionSegmentsLoaded', + 'onOriginalLoaded' => 'onOriginalLoaded', + 'onHtmlLoaded' => 'onHtmlLoaded', + ); + } + + public function onSessionSegmentsLoaded($segments) + { + $this->pluginSettings = $this->getPluginSettings('contactform'); + + if($this->getPath() == $this->pluginSettings['page']) + { + $data = $segments->getData(); + $data[] = $this->pluginSettings['page']; + $segments->setData($data); + } + } + + public function onOriginalLoaded($original) + { + if(substr($this->getPath(), 0, strlen($this->pluginSettings['area'])) === $this->pluginSettings['area']) + { + # get original html without manipulations + $this->originalHtml = $original->getHTML(); + } + } + + public function onHtmlLoaded($html) + { + if(substr($this->getPath(), 0, strlen($this->pluginSettings['area'])) === $this->pluginSettings['area']) + { + $content = $this->originalHtml; + + if($this->getPath() == $this->pluginSettings['page']) + { + # add css + # $this->addCSS('/textadds/css/textadds.css'); + + # get Twig Instance and add the cookieconsent template-folder to the path + $twig = $this->getTwig(); + $loader = $twig->getLoader(); + $loader->addPath(__DIR__ . '/templates'); + + # fetch the template and render it with twig + $contactform = $twig->fetch('/contactform.twig', $this->pluginSettings); + + $content = $this->originalHtml . $contactform; + } + + $html->setData($content); + $html->stopPropagation(); + } + } +} \ No newline at end of file diff --git a/plugins/contactform/contactform.yaml b/plugins/contactform/contactform.yaml new file mode 100644 index 0000000..34d2444 --- /dev/null +++ b/plugins/contactform/contactform.yaml @@ -0,0 +1,96 @@ +name: ContactForm +version: 1.0.0 +description: Integrate a google like text-add into each content page (file). +author: Sebastian Schürmanns +homepage: https://typemill.net +licence: MIT + +settings: + page: '' + name: 'Name: ' + email: 'E-Mail: ' + subject: 'Subject: ' + message: 'Message: ' + button: 'Send Message' + +forms: + fields: + + page: + type: text + label: Path to the page where to show the form + placeholder: 'path/to/page' + required: true + + area: + type: text + label: Path to the area with original content + placeholder: 'path/to/rootpage' + required: true + + name: + type: text + label: Label for Name Input Field + placeholder: 'Name: ' + required: true + + email: + type: text + label: Label for E-Mail-Field + placeholder: 'E-Mail: ' + required: true + + subject: + type: text + label: Label for Subject-Field + placeholder: 'Subject: ' + required: true + + message: + type: text + label: Label for Message + placeholder: 'Message: ' + required: true + + button: + type: text + label: Label for Button + placeholder: 'Send Message' + required: true + + hint: + type: textarea + label: Text below button (use markdown) + placeholder: 'Add your legal text or other hints here' + +frontend: + fields: + + name: + type: text + label: Label for Name Input Field + placeholder: 'Name: ' + required: true + + email: + type: text + label: Label for E-Mail-Field + placeholder: 'E-Mail: ' + required: true + + subject: + type: text + label: Label for Subject-Field + placeholder: 'Subject: ' + required: true + + message: + type: text + label: Label for Message + placeholder: 'Message: ' + required: true + + hint: + type: textarea + label: Text below button (use markdown) + placeholder: 'Add your legal text or other hints here' \ No newline at end of file diff --git a/plugins/contactform/css/textadds.css b/plugins/contactform/css/textadds.css new file mode 100644 index 0000000..1883149 --- /dev/null +++ b/plugins/contactform/css/textadds.css @@ -0,0 +1,26 @@ +.contentadd{ + display: block; + position: relative; + width: 100%; + border-top: 1px solid #ccc; + border-bottom: 1px solid #ccc; +} +.contentadd span{ + position: absolute; + right: 10px; + top: 20px; + text-transform: uppercase; + color: #ccc; + font-size: 0.6em; +} +.contentadd h3{ + margin-top: 20px; + margin-bottom: 0px; +} +.contentadd small{ + margin: 0px; +} +.contentadd p{ + margin-top: 0px; + margin-bottom: 20px; +} \ No newline at end of file diff --git a/plugins/contactform/templates/contactform.twig b/plugins/contactform/templates/contactform.twig new file mode 100644 index 0000000..752c3b8 --- /dev/null +++ b/plugins/contactform/templates/contactform.twig @@ -0,0 +1,40 @@ +
+ +
+ +
+ + + {% if errors.contact.title %} + {{ errors.contact.name | first }} + {% endif %} +
+
+ + + {% if errors.contact.title %} + {{ errors.contact.email | first }} + {% endif %} +
+
+ + + {% if errors.contact.title %} + {{ errors.contact.email | first }} + {% endif %} +
+
+ + + {% if errors.contact.title %} + {{ errors.contact.message | first }} + {% endif %} +
+ {{ hint }} + +
+ + + {{ csrf_field() | raw }} + +
\ No newline at end of file diff --git a/system/Controllers/PageController.php b/system/Controllers/PageController.php index 75251d3..acb01d8 100644 --- a/system/Controllers/PageController.php +++ b/system/Controllers/PageController.php @@ -13,6 +13,7 @@ use Typemill\Models\Markdown; use Typemill\Events\OnPagetreeLoaded; use Typemill\Events\OnBreadcrumbLoaded; use Typemill\Events\OnItemLoaded; +use Typemill\Events\OnOriginalLoaded; use Typemill\Events\OnMarkdownLoaded; use Typemill\Events\OnContentArrayLoaded; use Typemill\Events\OnHtmlLoaded; @@ -118,6 +119,9 @@ class PageController extends Controller $contentMD = isset($filePath) ? file_get_contents($filePath) : false; } + # dispatch the original content without plugin-manipulations for case anyone wants to use it + $this->c->dispatcher->dispatch('onOriginalLoaded', new OnOriginalLoaded($contentMD)); + $contentMD = $this->c->dispatcher->dispatch('onMarkdownLoaded', new OnMarkdownLoaded($contentMD))->getData(); /* initialize parsedown */ @@ -136,7 +140,7 @@ class PageController extends Controller /* parse markdown-content-array to content-string */ $contentHTML = $parsedown->markup($contentArray); $contentHTML = $this->c->dispatcher->dispatch('onHtmlLoaded', new OnHtmlLoaded($contentHTML))->getData(); - + /* extract the h1 headline*/ $contentParts = explode("", $contentHTML); $title = isset($contentParts[0]) ? strip_tags($contentParts[0]) : $settings['title']; @@ -155,7 +159,7 @@ class PageController extends Controller $lastSpace = strrpos($description, ' '); $description = substr($description, 0, $lastSpace); } - + /* get url and alt-tag for first image, if exists */ if($firstImage) { diff --git a/system/Controllers/SettingsController.php b/system/Controllers/SettingsController.php index 891168d..df05cc4 100644 --- a/system/Controllers/SettingsController.php +++ b/system/Controllers/SettingsController.php @@ -49,9 +49,14 @@ class SettingsController extends Controller ); $copyright = $this->getCopyright(); - + $validate->settings($newSettings, $copyright, 'settings'); } + else + { + $this->c->flash->addMessage('error', 'Wrong Input'); + return $response->withRedirect($this->c->router->pathFor('settings.show')); + } if(isset($_SESSION['errors'])) { diff --git a/system/Events/OnOriginalLoaded.php b/system/Events/OnOriginalLoaded.php new file mode 100644 index 0000000..8ce78e8 --- /dev/null +++ b/system/Events/OnOriginalLoaded.php @@ -0,0 +1,35 @@ +data = $data; + } + + public function getMarkdown() + { + return $this->data; + } + + public function getHTML() + { + $parsedown = new ParsedownExtension(); + $contentArray = $parsedown->text($this->data); + $contentHTML = $parsedown->markup($contentArray); + + return $contentHTML; + } +} \ No newline at end of file diff --git a/system/Events/OnSessionSegmentsLoaded.php b/system/Events/OnSessionSegmentsLoaded.php new file mode 100644 index 0000000..4530686 --- /dev/null +++ b/system/Events/OnSessionSegmentsLoaded.php @@ -0,0 +1,14 @@ +rule('lengthMax', $fieldName, 200); - $v->rule('regex', $fieldName, '/^[\pL0-9_ \-\.\?\!]*$/u'); + $v->rule('regex', $fieldName, '/^[\pL0-9_ \-\.\?\!\/\:]*$/u'); break; case "textarea": $v->rule('lengthMax', $fieldName, 1000); diff --git a/system/Plugin.php b/system/Plugin.php index 8cabd6c..223015c 100644 --- a/system/Plugin.php +++ b/system/Plugin.php @@ -6,7 +6,7 @@ use \Symfony\Component\EventDispatcher\EventSubscriberInterface; abstract class Plugin implements EventSubscriberInterface { - private $container; + protected $container; /** * Constructor @@ -17,6 +17,16 @@ abstract class Plugin implements EventSubscriberInterface { $this->container = $container; } + + protected function getSettings() + { + return $this->container->get('settings'); + } + + protected function getPluginSettings($plugin) + { + return $this->container->get('settings')['plugins'][$plugin]; + } protected function getRoute() { diff --git a/system/author/js/vue-blox.js b/system/author/js/vue-blox.js index 98b6ea8..2b2e287 100644 --- a/system/author/js/vue-blox.js +++ b/system/author/js/vue-blox.js @@ -19,6 +19,7 @@ const contentComponent = Vue.component('content-block', { methods: { switchToEditMode: function() { + if(this.edit){ return; } eventBus.$emit('closeComponents'); self = this; self.$root.$data.freeze = true; /* freeze the data */ diff --git a/system/system.php b/system/system.php index ddd3640..a8bac0e 100644 --- a/system/system.php +++ b/system/system.php @@ -2,6 +2,7 @@ use Typemill\Events\OnSettingsLoaded; use Typemill\Events\OnPluginsLoaded; +use Typemill\Events\OnSessionSegmentsLoaded; /**************************** * CREATE EVENT DISPATCHER * @@ -103,13 +104,18 @@ $container['assets'] = function($c) * DECIDE FOR SESSION * ************************/ -$session_segments = array('setup', 'tm/', 'api/', '/setup', '/tm/', '/api/'); -$path = $container['request']->getUri()->getPath(); -$container['flash'] = false; -$container['csrf'] = false; +$session_segments = array('setup', 'tm/', 'api/', '/setup', '/tm/', '/api/'); + +# let plugins add own segments for session, eg. to enable csrf for forms +$client_segments = $dispatcher->dispatch('onSessionSegmentsLoaded', new OnSessionSegmentsLoaded([]))->getData(); +$session_segments = array_merge($session_segments, $client_segments); + +$path = $container['request']->getUri()->getPath(); +$container['flash'] = false; +$container['csrf'] = false; foreach($session_segments as $segment) -{ +{ if(substr( $path, 0, strlen($segment) ) === $segment) { // configure session