Skip to content

Commit

Permalink
Update for Omeka 2.0.
Browse files Browse the repository at this point in the history
This adds, in views/admin, some CSS hacks to reconcile the player with
the more intrusive styles of the new admin theme. Ideally, we'll be able
to remove these.
  • Loading branch information
zerocrates committed Jan 29, 2013
1 parent 9b43650 commit af53515
Show file tree
Hide file tree
Showing 5 changed files with 916 additions and 50 deletions.
26 changes: 14 additions & 12 deletions Html5MediaPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
* @license http://www.gnu.org/licenses/gpl-3.0.txt GPLv3 or any later version
*/

class Html5MediaPlugin extends Omeka_Plugin_Abstract
class Html5MediaPlugin extends Omeka_Plugin_AbstractPlugin
{
protected $_hooks = array('initialize', 'admin_theme_header', 'public_theme_header', 'config', 'config_form', 'install', 'uninstall', 'upgrade');
protected $_hooks = array('initialize', 'admin_head', 'public_head',
'config', 'config_form', 'install', 'uninstall', 'upgrade');

public function hookInstall()
{
Expand Down Expand Up @@ -50,8 +51,9 @@ public function hookUninstall()
delete_option('html5_media_settings');
}

public function hookUpgrade($oldVersion, $newVersion)
public function hookUpgrade($args)
{
$oldVersion = $args['old_version'];
if (version_compare($oldVersion, '1.1', '<')) {
$this->hookInstall();
}
Expand Down Expand Up @@ -117,12 +119,12 @@ public function hookConfig()
set_option('html5_media_settings', serialize($settings));
}

public function hookAdminThemeHeader()
public function hookAdminHead()
{
$this->_head();
}

public function hookPublicThemeHeader()
public function hookPublicHead()
{
$this->_head();
}
Expand All @@ -144,8 +146,8 @@ public static function text($file, $options)

private function _head()
{
queue_js('mediaelement-and-player.min', 'mediaelement');
queue_css('mediaelementplayer', 'screen', false, 'mediaelement');
queue_js_file('mediaelement-and-player.min', 'mediaelement');
queue_css_file('mediaelementplayer', 'screen', false, 'mediaelement');
}

private static function _media($type, $file, $options)
Expand All @@ -166,13 +168,13 @@ private static function _media($type, $file, $options)
if ($options['loop'])
$mediaOptions .= ' loop';

$filename = html_escape($file->getWebPath('archive'));
$filename = html_escape($file->getWebPath('original'));

$tracks = '';
foreach (self::_findTextTrackFiles($file) as $textFile) {
$kind = item_file('Dublin Core', 'Type', array(), $textFile);
$language = item_file('Dublin Core', 'Language', array(), $textFile);
$label = item_file('Dublin Core', 'Title', array(), $textFile);
$kind = metadata($textFile, array('Dublin Core', 'Type'));
$language = metadata($textFile, array('Dublin Core', 'Language'));
$label = metadata($textFile, array('Dublin Core', 'Title'));

if (!$kind) {
$kind = 'subtitles';
Expand All @@ -182,7 +184,7 @@ private static function _media($type, $file, $options)
$language = 'en';
}

$trackSrc = html_escape($textFile->getWebPath('archive'));
$trackSrc = html_escape($textFile->getWebPath('original'));

if ($label) {
$labelPart = ' label="' . $label . '"';
Expand Down
65 changes: 41 additions & 24 deletions config-form.php
Original file line number Diff line number Diff line change
@@ -1,42 +1,55 @@
<?php $view = get_view(); ?>
<div id="html5-media-video-settings">
<h2><?php echo __('Video Settings'); ?></h2>
<div class="field">
<?php echo __v()->formLabel('video[options][width]', __('Width')); ?>
<div class="inputs">
<?php echo __v()->formText('video[options][width]', $video['options']['width']); ?>
<div class="two columns alpha">
<?php echo $view->formLabel('video[options][width]', __('Width')); ?>
</div>
<div class="inputs five columns omega">
<?php echo $view->formText('video[options][width]', $video['options']['width']); ?>
</div>
</div>
<div class="field">
<?php echo __v()->formLabel('video[options][height]', __('Height')); ?>
<div class="inputs">
<?php echo __v()->formText('video[options][height]', $video['options']['height']); ?>
<div class="two columns alpha">
<?php echo $view->formLabel('video[options][height]', __('Height')); ?>
</div>
<div class="inputs five columns omega">
<?php echo $view->formText('video[options][height]', $video['options']['height']); ?>
</div>
</div>
<div class="field">
<?php echo __v()->formLabel('video[types]', __('MIME Types')); ?>
<div class="inputs">
<?php echo __v()->formTextarea('video[types]', $video['types'], array('rows' => 3, 'cols' => 50)); ?>
<div class="two columns alpha">
<?php echo $view->formLabel('video[types]', __('MIME Types')); ?>
</div>
<div class="inputs five columns omega">
<?php echo $view->formTextarea('video[types]', $video['types'], array('rows' => 3, 'cols' => 50)); ?>
</div>
</div>
<div class="field">
<?php echo __v()->formLabel('video[extensions]', __('Extensions')); ?>
<div class="inputs">
<?php echo __v()->formTextarea('video[extensions]', $video['extensions'], array('rows' => 3, 'cols' => 50)); ?>
<div class="two columns alpha">
<?php echo $view->formLabel('video[extensions]', __('Extensions')); ?>
</div>
<div class="inputs five columns omega">
<?php echo $view->formTextarea('video[extensions]', $video['extensions'], array('rows' => 3, 'cols' => 50)); ?>
</div>
</div>
</div>
<div id="html5-media-audio-settings">
<h2><?php echo __('Audio Settings'); ?></h2>
<div class="field">
<?php echo __v()->formLabel('audio[types]', __('MIME Types')); ?>
<div class="inputs">
<?php echo __v()->formTextarea('audio[types]', $audio['types'], array('rows' => 3, 'cols' => 50)); ?>
<div class="two columns alpha">
<?php echo $view->formLabel('audio[types]', __('MIME Types')); ?>
</div>
<div class="inputs five columns omega">
<?php echo $view->formTextarea('audio[types]', $audio['types'], array('rows' => 3, 'cols' => 50)); ?>
</div>
</div>
<div class="field">
<?php echo __v()->formLabel('audio[extensions]', __('Extensions')); ?>
<div class="inputs">
<?php echo __v()->formTextarea('audio[extensions]', $audio['extensions'], array('rows' => 3, 'cols' => 50)); ?>
<div class="two columns alpha">
<?php echo $view->formLabel('audio[extensions]', __('Extensions')); ?>
</div>
<div class="inputs five columns omega">
<?php echo $view->formTextarea('audio[extensions]', $audio['extensions'], array('rows' => 3, 'cols' => 50)); ?>
</div>
</div>
</div>
Expand All @@ -48,15 +61,19 @@
filename on the same item.
</p>
<div class="field">
<?php echo __v()->formLabel('text[types]', __('MIME Types')); ?>
<div class="inputs">
<?php echo __v()->formTextarea('text[types]', $text['types'], array('rows' => 3, 'cols' => 50)); ?>
<div class="two columns alpha">
<?php echo $view->formLabel('text[types]', __('MIME Types')); ?>
</div>
<div class="inputs five columns omega">
<?php echo $view->formTextarea('text[types]', $text['types'], array('rows' => 3, 'cols' => 50)); ?>
</div>
</div>
<div class="field">
<?php echo __v()->formLabel('text[extensions]', __('Extensions')); ?>
<div class="inputs">
<?php echo __v()->formTextarea('text[extensions]', $text['extensions'], array('rows' => 3, 'cols' => 50)); ?>
<div class="two columns alpha">
<?php echo $view->formLabel('text[extensions]', __('Extensions')); ?>
</div>
<div class="inputs five columns omega">
<?php echo $view->formTextarea('text[extensions]', $text['extensions'], array('rows' => 3, 'cols' => 50)); ?>
</div>
</div>
</div>
6 changes: 3 additions & 3 deletions plugin.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ description="Enables HTML5 for media files using MediaElement.js."
license="GPLv3"
link="https://github.com/zerocrates/Html5Media#readme"
support_link="https://github.com/zerocrates/Html5Media/issues"
omeka_minimum_version="1.5"
omeka_target_version="1.5"
version="1.1"
omeka_minimum_version="2.0"
omeka_target_version="2.0"
version="2.0"
11 changes: 0 additions & 11 deletions plugin.php

This file was deleted.

Loading

0 comments on commit af53515

Please sign in to comment.