first commit
This commit is contained in:
commit
62b04d5945
|
@ -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.
|
|
@ -0,0 +1,16 @@
|
||||||
|
<?php
|
||||||
|
namespace SimpleMDText;
|
||||||
|
|
||||||
|
use Omeka\Module\AbstractModule;
|
||||||
|
use Laminas\EventManager\SharedEventManagerInterface;
|
||||||
|
use Laminas\Mvc\MvcEvent;
|
||||||
|
|
||||||
|
class Module extends AbstractModule
|
||||||
|
{
|
||||||
|
const NAMESPACE = __NAMESPACE__;
|
||||||
|
|
||||||
|
public function getConfig()
|
||||||
|
{
|
||||||
|
return include __DIR__ . '/config/module.config.php';
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
# A Simple Text for Omeka S
|
||||||
|
|
||||||
|
[Simple Text] is a module for [Omeka S] that integrates a simple text block
|
||||||
|
that does some markdown rendering.
|
||||||
|
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
```
|
||||||
|
cd ./modules
|
||||||
|
https://git.hangar.org/arcHIVE-tech/SimpleMDText/archive/main.zip
|
||||||
|
unzip main.zip
|
||||||
|
mv simpletext/ SimpleMDText
|
||||||
|
```
|
||||||
|
|
||||||
|
## LISENCE
|
||||||
|
The module is released under the [MIT] License.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[arc-hive]: https://arc-hive.zone/
|
||||||
|
[Simple Text]: https://git.hangar.org/arcHIVE-tech/SimpleMDText
|
||||||
|
[Pannellum]: https://pannellum.org/
|
||||||
|
[Omeka S]: https://omeka.org/s
|
||||||
|
[MIT]: http://opensource.org/licenses/MIT
|
|
@ -0,0 +1,28 @@
|
||||||
|
<?php
|
||||||
|
namespace SimpleMDText;
|
||||||
|
|
||||||
|
return [
|
||||||
|
'view_manager' => [
|
||||||
|
'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)',
|
||||||
|
]
|
||||||
|
]
|
||||||
|
];
|
|
@ -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"
|
|
@ -0,0 +1,22 @@
|
||||||
|
<?php
|
||||||
|
namespace SimpleMDText\Form;
|
||||||
|
|
||||||
|
use SimpleMDText\Module;
|
||||||
|
use Laminas\Form\Element;
|
||||||
|
use Laminas\Form\Form;
|
||||||
|
|
||||||
|
class SimpleMDTextBlockForm extends Form
|
||||||
|
{
|
||||||
|
public function init()
|
||||||
|
{
|
||||||
|
|
||||||
|
$this->add([
|
||||||
|
'name' => 'o:block[__blockIndex__][o:data][markdown_text]',
|
||||||
|
'type' => Element\Textarea::class,
|
||||||
|
'options' => [
|
||||||
|
'label' => 'Simple text',
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
<?php
|
||||||
|
namespace SimpleMDText\Service\BlockLayout;
|
||||||
|
|
||||||
|
use Interop\Container\ContainerInterface;
|
||||||
|
use SimpleMDText\Site\BlockLayout\SimpleMDText;
|
||||||
|
use Laminas\ServiceManager\Factory\FactoryInterface;
|
||||||
|
|
||||||
|
class SimpleMDTextFactory implements FactoryInterface
|
||||||
|
{
|
||||||
|
public function __invoke(ContainerInterface $services, $requestedName, array $options = null)
|
||||||
|
{
|
||||||
|
return new SimpleMDText(
|
||||||
|
$services->get('FormElementManager'),
|
||||||
|
$services->get('Config')['DefaultSettings']['SimpleMDTextBlockForm']
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
|
@ -0,0 +1,68 @@
|
||||||
|
<?php
|
||||||
|
namespace SimpleMDText\Site\BlockLayout;
|
||||||
|
|
||||||
|
use Omeka\Api\Representation\SiteRepresentation;
|
||||||
|
use Omeka\Api\Representation\SitePageRepresentation;
|
||||||
|
use Omeka\Api\Representation\SitePageBlockRepresentation;
|
||||||
|
use Omeka\Site\BlockLayout\AbstractBlockLayout;
|
||||||
|
use Laminas\View\Renderer\PhpRenderer;
|
||||||
|
|
||||||
|
use Laminas\Form\FormElementManager;
|
||||||
|
|
||||||
|
use SimpleMDText\Form\SimpleMDTextBlockForm;
|
||||||
|
|
||||||
|
class SimpleMDText extends AbstractBlockLayout
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var FormElementManager
|
||||||
|
*/
|
||||||
|
protected $formElementManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $defaultSettings = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param FormElementManager $formElementManager
|
||||||
|
* @param array $defaultSettings
|
||||||
|
*/
|
||||||
|
public function __construct(FormElementManager $formElementManager, array $defaultSettings)
|
||||||
|
{
|
||||||
|
$this->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 .= '<a href="#" class="collapse" aria-label="collapse"><h4>' . $view->translate('Options'). '</h4></a>';
|
||||||
|
$html .= '<div class="collapsible" style="padding-top:6px;">';
|
||||||
|
$html .= $view->formCollection($form);
|
||||||
|
$html .= '</div>';
|
||||||
|
return $html;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function render(PhpRenderer $view, SitePageBlockRepresentation $block)
|
||||||
|
{
|
||||||
|
return $view->partial('common/block-layout/panorama-viewer', [
|
||||||
|
'markdown_text' => $block->dataValue('markdown_text'),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,91 @@
|
||||||
|
<div class="pannemmul-wrap" style="position:relative;">
|
||||||
|
|
||||||
|
<?php
|
||||||
|
$this->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('<p id="panorama-viewer-title">%s</p>', $title);
|
||||||
|
} else {
|
||||||
|
$title = false;
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
#<?= $id ?> {
|
||||||
|
height: <?= $height ?>px;
|
||||||
|
width: <?= $width ?>px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<div class="pannellum-wrap">
|
||||||
|
<?php if ($panorama_type == "video") { ?>
|
||||||
|
<video id="<?= $id ?>"
|
||||||
|
class="video-js vjs-default-skin vjs-big-play-centered"
|
||||||
|
controls preload="none"
|
||||||
|
poster="<?= $thumbnails[0]['medium'] ?>"
|
||||||
|
crossorigin="anonymous">
|
||||||
|
<?php for($i = 0; $i < count($urls); ++$i) { ?>
|
||||||
|
<source src="<?= $urls[$i] ?>" type="<?= $mediaTypes[$i] ?>"/>
|
||||||
|
<?php } ?>
|
||||||
|
<p class="vjs-no-js">
|
||||||
|
To view this video please enable JavaScript, and consider upgrading to
|
||||||
|
a web browser that <a href="http://videojs.com/html5-video-support/"
|
||||||
|
target="_blank">supports HTML5 video</a>
|
||||||
|
</p>
|
||||||
|
</video>
|
||||||
|
<?php } else { ?>
|
||||||
|
<div id="<?= $id ?>" class="panorama-viewer"></div>
|
||||||
|
<?php } ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
<?php if ($panorama_type == "equirectangular") { ?>
|
||||||
|
pannellum.viewer("<?= $id ?>", {
|
||||||
|
type: "equirectangular",
|
||||||
|
autoLoad: <?= json_encode($autoLoad == false ? false : true) ?>,
|
||||||
|
panorama: "<?= $urls[0]; ?>",
|
||||||
|
});
|
||||||
|
<?php } ?>
|
||||||
|
<?php if ($panorama_type == "cubemap") { ?>
|
||||||
|
pannellum.viewer("<?= $id ?>", {
|
||||||
|
type: "cubemap",
|
||||||
|
autoLoad: <?= json_encode($autoLoad == false ? false : true) ?>,
|
||||||
|
cubeMap: <?= json_encode($urls, JSON_UNESCAPED_SLASHES) ?>,
|
||||||
|
});
|
||||||
|
<?php } ?>
|
||||||
|
<?php if ($panorama_type == "partial") { ?>
|
||||||
|
pannellum.viewer("<?= $id ?>", {
|
||||||
|
type: "equirectangular",
|
||||||
|
autoLoad: <?= json_encode($autoLoad == false ? false : true) ?>,
|
||||||
|
panorama: "<?= $urls[0]; ?>",
|
||||||
|
haov: 149.87,
|
||||||
|
vaov: 54.15,
|
||||||
|
vOffset: 1.17
|
||||||
|
});
|
||||||
|
<?php } ?>
|
||||||
|
<?php if ($panorama_type == "video") { ?>
|
||||||
|
videojs("<?= $id ?>", {
|
||||||
|
plugins: {
|
||||||
|
pannellum: {}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
<?php if ($title !== false): ?>
|
||||||
|
$('#pannellum-ui').append('<?= $title ?>');
|
||||||
|
<?php endif ?>
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</div>
|
Loading…
Reference in New Issue