commit 62b04d59451fd57177141dda0dbbb9bfedb406b6 Author: buttle Date: Sat May 8 18:54:43 2021 +0200 first commit diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..9bd6b00 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2018 Neo-Inspiration + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/Module.php b/Module.php new file mode 100644 index 0000000..95a84b3 --- /dev/null +++ b/Module.php @@ -0,0 +1,16 @@ + [ + 'template_path_stack' => [ + dirname(__DIR__) . '/view', + ] + ], + 'block_layouts' => [ + 'factories' => [ + 'simpleMDText' => Service\BlockLayout\SimpleMDTextFactory::class, + ], + ], + 'form_elements' => [ + 'invokables' => [ + Form\SimpleMDTextBlockForm::class => Form\SimpleMDTextBlockForm::class, + ], + ], + 'DefaultSettings' => [ + 'SimpleMDTextBlockForm' => [ + 'markdown_text' => '', + 'wrapStyle' => 'overflow-y: hidden;display: flex;flex-direction: column;justify-content: center;', + //'imgStyle' => '', + 'ui_background' => 'rgba(0,0,0,0.1)', + ] + ] +]; diff --git a/config/module.ini b/config/module.ini new file mode 100644 index 0000000..dcda623 --- /dev/null +++ b/config/module.ini @@ -0,0 +1,12 @@ +[info] +name = "Simple MD Text" +description = "Simple Markdown text" +tags = "" +license = "MIT" +author = "Hangar.org" +author_link = "https://git.hangar.org/chris" +module_link = "https://git.hangar.org/arcHIVE-tech/SimpleMDText" +support_link = "https://git.hangar.org/arcHIVE-tech/SimpleMDText/issues" +configurable = false +version = "1.0.0" +omeka_version_constraint = "^3.0.1" diff --git a/src/Form/SimpleMDTextBlockForm.php b/src/Form/SimpleMDTextBlockForm.php new file mode 100644 index 0000000..a1fcfb7 --- /dev/null +++ b/src/Form/SimpleMDTextBlockForm.php @@ -0,0 +1,22 @@ +add([ + 'name' => 'o:block[__blockIndex__][o:data][markdown_text]', + 'type' => Element\Textarea::class, + 'options' => [ + 'label' => 'Simple text', + ], + ]); + + } +} diff --git a/src/Service/BlockLayout/SimpleMDTextFactory.php b/src/Service/BlockLayout/SimpleMDTextFactory.php new file mode 100644 index 0000000..2044b20 --- /dev/null +++ b/src/Service/BlockLayout/SimpleMDTextFactory.php @@ -0,0 +1,18 @@ +get('FormElementManager'), + $services->get('Config')['DefaultSettings']['SimpleMDTextBlockForm'] + ); + } +} +?> \ No newline at end of file diff --git a/src/Site/BlockLayout/SimpleMDText.php b/src/Site/BlockLayout/SimpleMDText.php new file mode 100644 index 0000000..2a5808a --- /dev/null +++ b/src/Site/BlockLayout/SimpleMDText.php @@ -0,0 +1,68 @@ +formElementManager = $formElementManager; + $this->defaultSettings = $defaultSettings; + } + + public function getLabel() { + return 'Simple Text'; + } + + public function form(PhpRenderer $view, + SiteRepresentation $site, + SitePageRepresentation $page = null, + SitePageBlockRepresentation $block = null + ) { + $form = $this->formElementManager->get(SimpleMDTextBlockForm::class); + $data = $block + ? $block->data() + $this->defaultSettings + : $this->defaultSettings; + $form->setData([ + 'o:block[__blockIndex__][o:data][markdown_text]' => $data['markdown_text'], + ]); + $form->prepare(); + + $html = ''; + $html .= '

' . $view->translate('Options'). '

'; + $html .= '
'; + $html .= $view->formCollection($form); + $html .= '
'; + return $html; + } + + public function render(PhpRenderer $view, SitePageBlockRepresentation $block) + { + return $view->partial('common/block-layout/panorama-viewer', [ + 'markdown_text' => $block->dataValue('markdown_text'), + ]); + } +} diff --git a/view/common/block-layout/panorama-viewer.phtml b/view/common/block-layout/panorama-viewer.phtml new file mode 100644 index 0000000..33f4efa --- /dev/null +++ b/view/common/block-layout/panorama-viewer.phtml @@ -0,0 +1,91 @@ +
+ + headLink()->appendStylesheet($this->assetUrl('vendor/pannellum/pannellum.css', + 'SimpleMDText')); + $this->headScript()->appendFile($this->assetUrl('vendor/pannellum/pannellum.js', + 'SimpleMDText')); + + if ($panorama_type == "video") { + $this->headLink()->appendStylesheet($this->assetUrl('vendor/video.js/video-js.css', + 'SimpleMDText')); + $this->headScript()->appendFile($this->assetUrl('vendor/video.js/video.js', + 'SimpleMDText')); + $this->headScript()->appendFile($this->assetUrl('vendor/pannellum/videojs-pannellum-plugin.js', + 'SimpleMDText')); + } + if ($title !== false && $title !== "") { + $title = sprintf('

%s

', $title); + } else { + $title = false; + } + ?> + + + +
+ + + +
+ +
+ + +