Example #1
0
 /**
  * Get the specified UniversalViewer.
  *
  * @param array $args Associative array of optional values:
  *   - (string) id: The unique main id.
  *   - (integer|Record) record: The record is the item if it's an integer.
  *   - (string) type: Type of record if record is integer (item by default).
  *   - (integer|Item) item
  *   - (integer|Collection) collection
  *   - (integer|File) file
  *   - (string) class
  *   - (string) width
  *   - (string) height
  *   - (string) locale
  * The only one record is defined according to the priority above.
  * @return string. The html string corresponding to the UniversalViewer.
  */
 public function universalViewer($args = array())
 {
     $record = $this->_getRecord($args);
     if (empty($record)) {
         return '';
     }
     // Some specific checks.
     switch (get_class($record)) {
         case 'Item':
             // Currently, item without files is unprocessable.
             if ($record->fileCount() == 0) {
                 return __('This item has no files and is not displayable.');
             }
             break;
         case 'Collection':
             if ($record->totalItems() == 0) {
                 return __('This collection has no item and is not displayable.');
             }
             break;
     }
     $class = isset($args['class']) ? $args['class'] : get_option('universalviewer_class');
     if (!empty($class)) {
         $class = ' ' . $class;
     }
     $width = isset($args['width']) ? $args['width'] : get_option('universalviewer_width');
     if (!empty($width)) {
         $width = ' width:' . $width . ';';
     }
     $height = isset($args['height']) ? $args['height'] : get_option('universalviewer_height');
     if (!empty($height)) {
         $height = ' height:' . $height . ';';
     }
     $locale = isset($args['locale']) ? $args['locale'] : get_option('universalviewer_locale');
     if (!empty($locale)) {
         $locale = ' data-locale="' . $locale . '"';
     }
     if (isset($args['only_images'])) {
         $manif = 'universalviewer_presentation_alternative_manifest';
     } else {
         $manif = 'universalviewer_presentation_manifest';
     }
     if (isset($args['current_image'])) {
         $currentImage = $args['current_image'];
     } else {
         $currentImage = 99999;
     }
     $urlManifest = absolute_url(array('recordtype' => Inflector::tableize(get_class($record)), 'id' => $record->id, 'image' => $currentImage), $manif);
     if (isset($args['only_images'])) {
         $config = src('config-images', 'universal-viewer', 'json');
     } else {
         $config = src('config', 'universal-viewer', 'json');
     }
     $urlJs = src('embed', 'javascripts/uv/lib', 'js');
     $imageClass = 'images';
     $html = sprintf('<div class="uv%s %s" data-config="%s" data-uri="%s"%s style="background-color: #000;%s%s"></div>', $class, $imageClass, $config, $urlManifest, $locale, $width, $height);
     $html .= sprintf('<script type="text/javascript" id="embedUV" src="%s"></script>', $urlJs);
     $html .= '<script type="text/javascript">/* wordpress fix */</script>';
     return $html;
 }
/**
 * Queues JavaScript and CSS for NeatlineTime in the page header.
 *
 * @since 1.0
 * @return void.
 */
function queue_timeline_assets()
{
    $headScript = get_view()->headScript();
    $headScript->appendFile(src('neatline-time-scripts.js', 'javascripts'));
    // Check useInternalJavascripts in config.ini.
    $config = Zend_Registry::get('bootstrap')->getResource('Config');
    $useInternalJs = isset($config->theme->useInternalJavascripts) ? (bool) $config->theme->useInternalJavascripts : false;
    if ($useInternalJs) {
        $timelineVariables = 'Timeline_ajax_url="' . src('simile-ajax-api.js', 'javascripts/simile/ajax-api') . '"; ' . 'Timeline_urlPrefix="' . dirname(src('timeline-api.js', 'javascripts/simile/timeline-api')) . '/"; ' . 'Timeline_parameters="bundle=true";';
        $headScript->appendScript($timelineVariables);
        $headScript->appendFile(src('timeline-api.js', 'javascripts/simile/timeline-api'));
    } else {
        $headScript->appendFile('http://api.simile-widgets.org/timeline/2.3.1/timeline-api.js?bundle=true');
    }
    $headScript->appendScript('SimileAjax.History.enabled = false; window.jQuery = SimileAjax.jQuery');
    queue_css_file('neatlinetime-timeline');
}
Example #3
0
/**
 * Get a tag for including a local JavaScript file.
 *
 * @package Omeka\Function\View\Asset
 * @uses src()
 * @param string $file The name of the file, without .js extension.
 * @param string $dir The directory in which to look for javascript files.
 * Recommended to leave the default value.
 * @return string
 */
function js_tag($file, $dir = 'javascripts')
{
    $href = src($file, $dir, 'js');
    return '<script type="text/javascript" src="' . html_escape($href) . '" charset="utf-8"></script>';
}
Example #4
0
 /**
  * Create an IIIF canvas object for a place holder.
  *
  * @return Standard object
  */
 protected function _iiifCanvasPlaceholder()
 {
     $canvas = array();
     $canvas['@id'] = WEB_ROOT . '/iiif/ixif-message/canvas/c1';
     $canvas['@type'] = 'sc:Canvas';
     $canvas['label'] = __('Placeholder image');
     $placeholder = 'images/placeholder.jpg';
     $canvas['thumbnail'] = src($placeholder);
     list($widthPlaceholder, $heightPlaceholder) = $this->_getWidthAndHeight(physical_path_to($placeholder));
     $canvas['width'] = $widthPlaceholder;
     $canvas['height'] = $heightPlaceholder;
     $image = array();
     $image['@id'] = WEB_ROOT . '/iiif/ixif-message/imageanno/placeholder';
     $image['@type'] = 'oa:Annotation';
     $image['motivation'] = "sc:painting";
     // There is only one image (parallel is not managed).
     $imageResource = array();
     $imageResource['@id'] = WEB_ROOT . '/iiif/ixif-message-0/res/placeholder';
     $imageResource['@type'] = 'dctypes:Image';
     $imageResource['width'] = $widthPlaceholder;
     $imageResource['height'] = $heightPlaceholder;
     $imageResource = (object) $imageResource;
     $image['resource'] = $imageResource;
     $image['on'] = WEB_ROOT . '/iiif/ixif-message/canvas/c1';
     $image = (object) $image;
     $images = array($image);
     $canvas['images'] = $images;
     $canvas = (object) $canvas;
     return $canvas;
 }
<?php

$button_path = src('images/', 'openseadragon');
?>
<div class="openseadragon">
    <?php 
foreach ($images as $image) {
    $image_url = html_escape($image->getWebPath('original'));
    $unique_id = "openseadragon_" . hash("md5", $image_url);
    ?>
    <div class="openseadragon_viewer" id="<?php 
    echo $unique_id;
    ?>
">
        <img src="<?php 
    echo $image_url;
    ?>
" class="openseadragon-image tmp-img" alt="">
    </div>

    <script type="text/javascript">
        var config = osdSettings({ // shared/openseadragon/settings.js
            _id: "<?php 
    echo $unique_id;
    ?>
",
            prefixUrl: "<?php 
    echo $button_path;
    ?>
"
        });
Example #6
0
    echo '</body></html>';
    return;
}
$title = metadata($item, array('Dublin Core', 'Title'));
$creator = metadata($item, array('Dublin Core', 'Creator'));
if ($creator) {
    $title .= ' - ' . $creator;
}
$title = BookReader::htmlCharacter($title);
$coverFile = $bookreader->getCoverFile();
list($pageIndexes, $pageNumbers, $pageLabels, $imgWidths, $imgHeights) = $bookreader->imagesData();
$server = preg_replace('#^https?://#', '', WEB_ROOT);
$serverFullText = $server . '/book-reader/index/fulltext';
$imgDir = WEB_PLUGIN . '/BookReader/views/shared/images/';
try {
    $favicon = src('favicon.ico');
} catch (Exception $e) {
    $favicon = '';
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html <?php 
echo $ui == 'embed' ? 'id="embedded" ' : '';
?>
lang="fr">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width, maximum-scale=1.0" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black" />
    <base target="_parent" />