class = 'annodex';
$class->max_size = 4*(1 << 20);
$class->mime_ext = Array(
'application/x-annodex'=>'anx',
'application/ogg'=>'ogg',
'application/x-cmml'=>'cmml',
);
$class->create = '_class_annodex_create';
$class->update = '_class_annodex_update';
$class->form = '_class_annodex_form';
$class->destroy = '_class_annodex_destroy';
$class->access = 'create acidfree annodexs';
$class->resize = '_class_annodex_resize';
return $class;
}
/* Create a new annodex node */
function _class_annodex_create(&$node, &$file) {
/* Maybe create an extra node? One node for direct viewing of the
* annodex, one for editing, and maybe Cortado embedding the annodex.
* The normal acidfree policy of having the node for embedding, and
* then linking straight to the file for fullscreen wont work, as the
* annodex is dynamically generated.
*/
$node->large = acidfree_add_file($node, $file->filepath, "{$node->nid}_large.ogg", $node->mime, TRUE);
$node->small = $node->large; // For now there's no distinction between
// high and low resolution of the video.
}
//function _class_annodex_resize(&$node) {
// return( _class_video_resize($node) );
//}
//function _class_annodex_update(&$node) {
// return( _class_video_update($node) );
//}
/* Define the HTML forms shown to users when creating an annodex */
//FIXME Maybe allow CMML upload?
function _class_annodex_form($op, &$node, $name_prefix='') {
switch ($op) {
case 'new':
$nailer = variable_get('acidfree_annodex_thumbnailer', 'none');
$output = '';
switch ($nailer) {
case 'none':
//$output .= form_textfield(t('Annodex width'), $name_prefix.'annodexx', 320, 10, 10);
//$output .= form_textfield(t('Annodex height'), $name_prefix.'annodexy', 240, 10, 10);
break;
case 'user':
$output .= form_file(t('Annodex thumbnail'), $name_prefix.'userthumb', 50, NULL, true);
break;
case 'mplayer':
// possibly allow them to choose frame number? too complex?
// too much decoding time -- no option to tell where to start decoding...
break;
}
break;
case 'preview':
$output .= form_hidden('thumb', is_object($node->thumb)?$node->thumb->fid:$node->thumb);
break;
case 'update':
$output .= form_hidden('thumb', is_object($node->thumb)?$node->thumb->fid:$node->thumb);
break;
}
return $output;
}
function _class_annodex_destroy(&$node) {
}
/*
function _class_annodex_mplayer_options() {
$name = 'acidfree_path_to_mplayer';
$mplayer_path = variable_get($name, '/usr/bin/mplayer');
if (!is_executable($mplayer_path))
form_set_error($name, t('Path to mplayer is not correct — Annodex thumbnails will not be generated'));
return form_textfield(t('Path to mplayer'), $name, $mplayer_path, 64, 64);
}
*/
/*
function _class_annodex_manipulation_options() {
$options = array(
'none'=>t('No thumbnail — use Annodex image'),
'user'=>t('User uploaded thumbnails'),
'mplayer'=>t('Use mplayer to create thumbnails')
);
$name = 'acidfree_annodex_thumbnailer';
$value = variable_get($name, 'none');
return form_radios(t('Annodex thumbnail options'), $name, $value, $options).
acidfree_call("_class_annodex_{$value}_options");
}
*/
/* Display an annodex page */
function theme_acidfree_print_full_annodex(&$node) {
if (!$node->large)
return '';
if ($node->page)
$output = acidfree_pager_creator($node);
$output .= theme_annodex_control( &$node );
return $output;
}
function theme_acidfree_print_thumb_annodex(&$node, $parent=null) {
}
function _annodex_view_help($text, $link, $alt) {
$output = "