Skip to content

Commit

Permalink
Improve branch following @Daniel-KM comments on PR #16
Browse files Browse the repository at this point in the history
  • Loading branch information
symac committed Nov 4, 2019
1 parent facca51 commit 270ee02
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 22 deletions.
3 changes: 1 addition & 2 deletions config/module.config.php
Original file line number Diff line number Diff line change
Expand Up @@ -385,8 +385,7 @@
'iiifserver_image_max_size' => 10000000,
'iiifserver_image_tile_dir' => 'tile',
'iiifserver_image_tile_type' => 'deepzoom',
'iiifserver_manifest_service_iiifSearch' => '',
'iiifserver_manifest_service_iiifSearch_extractOcr' => false,
'iiifserver_manifest_service_iiifsearch' => '',
],
],
];
19 changes: 2 additions & 17 deletions src/Form/ConfigForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -214,25 +214,14 @@ public function init()
]);

$manifestFieldset->add([
'name' => 'iiifserver_manifest_service_iiifSearch',
'name' => 'iiifserver_manifest_service_iiifsearch',
'type' => Element\Url::class,
'options' => [
'label' => 'IIIF Search url', // @translate
'info' => 'If any, this url to IIIF Search API will be used in search service and display search bar in the bottom panel of the Universal Viewer.', // @translate
],
]);

$manifestFieldset->add([
'name' => 'iiifserver_manifest_service_iiifSearch_extractOcr',
'type' => Element\Checkbox::class,
'options' => [
'label' => 'IIIF Search provided by ExtractOcr module', // @translate
'info' => 'If you use IiifSearch & ExtractOcr modules to provide IiifSearch results, check this box to disable the search box when there is no OCR.', // @translate
],
]);



$this->add([
'name' => 'iiifserver_image',
'type' => Fieldset::class,
Expand Down Expand Up @@ -383,11 +372,7 @@ public function init()
'required' => false,
]);
$manifestFilter->add([
'name' => 'iiifserver_manifest_service_iiifSearch',
'required' => false,
]);
$manifestFilter->add([
'name' => 'iiifserver_manifest_service_iiifSearch_extractOcr',
'name' => 'iiifserver_manifest_service_iiifsearch',
'required' => false,
]);

Expand Down
12 changes: 9 additions & 3 deletions src/View/Helper/IiifManifest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
use Omeka\Api\Representation\MediaRepresentation;
use Omeka\File\TempFileFactory;
use Zend\View\Helper\AbstractHelper;
use Omeka\Module\Manager as ModuleManager;

class IiifManifest extends AbstractHelper
{
Expand Down Expand Up @@ -159,11 +160,16 @@ protected function buildManifestItem(ItemRepresentation $item)

$manifest['logo'] = $this->view->setting('iiifserver_manifest_logo_default');

$iiifSearch = $this->view->setting('iiifserver_manifest_service_iiifSearch');
$iiifSearch = $this->view->setting('iiifserver_manifest_service_iiifsearch');

if ( $iiifSearch ) {
$searchServiceAvailable = true;
$iiifSearchExtractOcr = $this->view->setting('iiifserver_manifest_service_iiifSearch_extractOcr');
if ($iiifSearchExtractOcr) {

$moduleManager = $item->getServiceLocator()->get('Omeka\ModuleManager');
$extractOcrModule = $moduleManager->getModule("ExtractOcr");

// Checking if module ExtractOcr is installed
if ($extractOcrModule->getState() == ModuleManager::STATE_ACTIVE) {
// Checking if item has at least an XML file that will allow search
$searchServiceAvailable = false;
foreach ( $item->media() as $media ) {
Expand Down

0 comments on commit 270ee02

Please sign in to comment.