コード例 #1
0
    function createForm()
    {
        $form = new Am_Form_Admin();
        $form->setAttribute('enctype', 'multipart/form-data');
        $form->setAttribute('target', '_top');
        $maxFileSize = min(ini_get('post_max_size'), ini_get('upload_max_filesize'));
        $el = $form->addElement(new Am_Form_Element_Upload('path', array(), array('prefix' => 'video')))->setLabel(___("Video/Audio File\n" . "(max upload size %s)\n" . "You can use this feature only for video and\naudio formats that %ssupported by %s%s", $maxFileSize, $this->getDi()->config->get('video_player', 'Flowplayer') == 'Flowplayer' ? '<a href="http://flowplayer.org/documentation/installation/formats.html" class="link" target="_blank">' : '<a href="http://www.longtailvideo.com/support/jw-player/28836/media-format-support/" class="link" target="_blank">', $this->getDi()->config->get('video_player', 'Flowplayer') == 'Flowplayer' ? 'Flowplayer' : 'JWPlayer', '</a>'))->setId('form-path');
        $jsOptions = <<<CUT
{
    onFileAdd : function (info) {
        var txt = \$(this).closest("form").find("input[name='title']");
        if (txt.data('changed-value')) return;
        txt.val(info.name);
    }
}
CUT;
        $el->setJsOptions($jsOptions);
        $form->addScript()->setScript(<<<CUT
\$(function(){
    \$("input[name='title']").change(function(){
        \$(this).data('changed-value', true);
    });
});
CUT
);
        $el->addRule('required');
        $form->addUpload('poster_id', null, array('prefix' => 'video-poster'))->setLabel(___("Poster Image\n" . "applicable only for video files"));
        $form->addText('title', array('class' => 'el-wide'))->setLabel(___('Title'))->addRule('required', 'This field is required');
        $form->addText('desc', array('class' => 'el-wide'))->setLabel(___('Description'));
        $form->addAdvCheckbox('hide')->setLabel(___("Hide\n" . "do not display this item link in members area"));
        $form->addElement(new Am_Form_Element_PlayerConfig('config'))->setLabel(___("Player Configuration\n" . 'this option is applied only for video files'));
        $form->addSelect('tpl')->setLabel(___("Template\nalternative template for this video\n" . "aMember will look for templates in [application/default/views/] folder\n" . "and in theme's [/] folder\n" . "and template filename must start with [layout]"))->loadOptions($this->getTemplateOptions());
        $form->addElement(new Am_Form_Element_ResourceAccess())->setName('_access')->setLabel(___('Access Permissions'));
        $form->addText('no_access_url', array('class' => 'el-wide'))->setLabel(___("No Access URL\n" . "customer without required access will see link to this url in " . "the player window\nleave empty if you want to redirect to " . "default 'No access' page"));
        $this->addCategoryToForm($form);
        $fs = $form->addAdvFieldset('meta', array('id' => 'meta'))->setLabel(___('Meta Data'));
        $fs->addText('meta_title', array('class' => 'el-wide'))->setLabel(___('Title'));
        $fs->addText('meta_keywords', array('class' => 'el-wide'))->setLabel(___('Keywords'));
        $fs->addText('meta_description', array('class' => 'el-wide'))->setLabel(___('Description'));
        $form->addEpilog('<div class="info">' . ___('In case of video do not start play before
full download and you use <a class="link" href="http://en.wikipedia.org/wiki/MPEG-4_Part_14">mp4 format</a>
more possible that metadata (moov atom) is located
at the end of file. There is special programs that allow to relocate
this metadata to the beginning of your file and allow play video before full
download (On Linux mashine you can use <em>qt-faststart</em> utility to do it).
Also your video editor can has option to locate metadata at beginning of file
(something like <em>FastStart</em> or <em>Web Optimized</em> option).
You need to relocate metadata for this file and reupload
it to aMember. You can use such utilites as <em>AtomicParsley</em> or similar
to check your file structure.') . '</div>');
        return $form;
    }