Compare commits

..

No commits in common. "1028adab8aa6b41e9aa860783888ce0b31358f85" and "ded1d57d16e7ef5e360e1ada835ab13c96854874" have entirely different histories.

7 changed files with 11 additions and 56 deletions

View File

@ -9,8 +9,6 @@ video and audio media.
cd ./modules cd ./modules
https://git.hangar.org/arcHIVE-tech/ArchiveOrg/archive/main.zip https://git.hangar.org/arcHIVE-tech/ArchiveOrg/archive/main.zip
unzip main.zip unzip main.zip
mv archiveorg/ ArchiveOrg
rm main.zip
``` ```
## LISENCE ## LISENCE

View File

@ -31,7 +31,6 @@ return [
'ArchiveOrgBlockForm' => [ 'ArchiveOrgBlockForm' => [
'media_type' => 'video', 'media_type' => 'video',
'title' => '', 'title' => '',
'renderSourceLink' => true,
'width' => 600, 'width' => 600,
'ratio' => '2', 'ratio' => '2',
'autoLoad' => false, 'autoLoad' => false,

View File

@ -10,6 +10,14 @@ class ArchiveOrgBlockForm extends Form
public function init() public function init()
{ {
$this->add([
'name' => 'o:block[__blockIndex__][o:data][title]',
'type' => Element\Text::class,
'options' => [
'label' => 'Title (option)',
]
]);
$this->add([ $this->add([
'name' => 'o:block[__blockIndex__][o:data][media_type]', 'name' => 'o:block[__blockIndex__][o:data][media_type]',
'type' => Element\Select::class, 'type' => Element\Select::class,
@ -39,24 +47,5 @@ class ArchiveOrgBlockForm extends Form
], ],
]); ]);
$this->add([
'type' => Element\Checkbox::class,
'name' => 'o:block[__blockIndex__][o:data][renderSourceLink]',
'options' => [
'label' => 'Display a link to the item',
//'use_hidden_element' => true,
'checked_value' => true,
'unchecked_value' => false,
],
]);
$this->add([
'name' => 'o:block[__blockIndex__][o:data][title]',
'type' => Element\Text::class,
'options' => [
'label' => 'Sub-title',
]
]);
} }
} }

View File

@ -5,20 +5,16 @@ use Omeka\Api\Request;
use Omeka\Entity\Media; use Omeka\Entity\Media;
use Omeka\Media\Ingester\IngesterInterface; use Omeka\Media\Ingester\IngesterInterface;
use Omeka\Stdlib\ErrorStore; use Omeka\Stdlib\ErrorStore;
use Omeka\File\Downloader;
use Zend\Form\Element\Text; use Zend\Form\Element\Text;
use Zend\Http\Client; use Zend\Http\Client;
use Zend\View\Renderer\PhpRenderer; use Zend\View\Renderer\PhpRenderer;
class ArchiveOrgMediaIngester implements IngesterInterface class ArchiveOrgMediaIngester implements IngesterInterface
{ {
protected $downloader;
protected $client; protected $client;
public function __construct($client)
public function __construct($client, Downloader $downloader)
{ {
$this->client = $client; $this->client = $client;
$this->downloader = $downloader;
} }
public function getLabel() public function getLabel()
{ {
@ -47,16 +43,7 @@ class ArchiveOrgMediaIngester implements IngesterInterface
$errorStore->addError('o:identifier', 'No identifier specified'); $errorStore->addError('o:identifier', 'No identifier specified');
return; return;
} }
$identifier = trim($data['o:identifier']); $url = 'https://archive.org/embed/' . $data['o:identifier'];
$mediaData = ['identifier' => $identifier];
$url = 'https://archive.org/embed/' . $identifier;
$thumbnail_url = 'https://archive.org/services/img/' . $identifier;
$tempFile = $this->downloader->download($thumbnail_url);
if ($tempFile) {
$tempFile->mediaIngestFile($media, $request, $errorStore, false);
}
$media->setData($mediaData);
$media->setSource($url); $media->setSource($url);
} }
} }

View File

@ -11,9 +11,6 @@ class ArchiveOrgMediaFactory implements FactoryInterface
$requestedName, $requestedName,
array $options = null) array $options = null)
{ {
return new ArchiveOrgMediaIngester( return new ArchiveOrgMediaIngester($services->get('Omeka\HttpClient'));
$services->get('Omeka\HttpClient'),
$services->get('Omeka\File\Downloader')
);
} }
} }

View File

@ -51,7 +51,6 @@ class ArchiveOrg extends AbstractBlockLayout
'o:block[__blockIndex__][o:data][title]' => $data['title'], 'o:block[__blockIndex__][o:data][title]' => $data['title'],
'o:block[__blockIndex__][o:data][width]' => $data['width'], 'o:block[__blockIndex__][o:data][width]' => $data['width'],
'o:block[__blockIndex__][o:data][ratio]' => $data['ratio'], 'o:block[__blockIndex__][o:data][ratio]' => $data['ratio'],
'o:block[__blockIndex__][o:data][renderSourceLink]' => $data['renderSourceLink'],
]); ]);
$form->prepare(); $form->prepare();
@ -81,8 +80,6 @@ class ArchiveOrg extends AbstractBlockLayout
return $view->partial('common/block-layout/archiveOrg', [ return $view->partial('common/block-layout/archiveOrg', [
'media_type' => $block->dataValue('media_type'), 'media_type' => $block->dataValue('media_type'),
'title' => $block->dataValue('title'), 'title' => $block->dataValue('title'),
'renderSourceLink' => $block->dataValue('renderSourceLink'),
'item_url' => $attachments[0]->item()->url(),
'width' => $width, 'width' => $width,
'height' => $height, 'height' => $height,
'url' => $media->source(), 'url' => $media->source(),

View File

@ -1,11 +1,5 @@
<div class="archive_org-wrap" style="position:relative;"> <div class="archive_org-wrap" style="position:relative;">
<?php if ($renderSourceLink) { ?>
<div class="source-link">
<a href="<?= $item_url ?>">Source</a>
</div>
<?php } ?>
<?php <?php
if ($title !== false && $title !== "") { if ($title !== false && $title !== "") {
$title = sprintf('<p id="achive_org_media-title">%s</p>', $title); $title = sprintf('<p id="achive_org_media-title">%s</p>', $title);
@ -32,10 +26,4 @@
allowfullscreen > allowfullscreen >
</iframe> </iframe>
<?php if ($title) { ?>
<div class="item_title">
<?= $title ?>
</div>
<?php } ?>
</div> </div>