Пример #1
0
 function run()
 {
     if (!KalturaShim::kaltura_enabled()) {
         echo '<p>Sorry; in order to use this module your instance of Reason must be integrated with Kaltura</p>' . "\n";
         return;
     }
     if (empty($this->admin_page->site_id)) {
         echo '<p>Please pick a site first to use this module.</p>' . "\n";
         return;
     }
     // $this->admin_page->user_id
     // $this->admin_page->site_id
     $d = new Disco();
     $d->form_enctype = 'multipart/form-data';
     $d->add_callback(array($this, 'get_instructions'), 'pre_show_form');
     $d->add_element('zip_file', 'ReasonUpload', array('acceptable_extensions' => array('zip')));
     $d->add_element('url_comment', 'comment', array('text' => '<strong>File larger than the maximum upload size?</strong> Put it in a web-available location and enter its web address below.'));
     $d->add_element('zip_file_url');
     $d->add_callback(array($this, 'error_check'), 'run_error_checks');
     $d->add_callback(array($this, 'process_form'), 'process');
     $d->run();
 }
 /**
  * The upload element is added to the form.
  */
 function _add_file_upload_element()
 {
     if (KalturaShim::kaltura_enabled() && $this->manager->manages_media && $this->manager->get_value('transcoding_status') != 'converting') {
         $authenticator = array("reason_username_has_access_to_site", $this->manager->get_value("site_id"));
         $params = array('authenticator' => $authenticator, 'acceptable_extensions' => $this->recognized_extensions, 'max_file_size' => $this->_get_actual_max_upload_size(), 'head_items' => &$this->manager->head_items);
         $this->manager->add_element('upload_file', 'ReasonUpload', $params);
         $this->manager->add_element('upload_url');
         $this->manager->add_comments('upload_url', form_comment('Or, you can place the media in any web-accessible location and paste its web address in here. <em>Tip: try pasting the address into another tab first, to make sure you have the address right!</em>'));
         $this->manager->set_comments('upload_file', form_comment('If the file is on your computer, browse to it here.') . form_comment('File must have one of the following extensions: .' . implode(', .', $this->recognized_extensions)) . form_comment('<div class="maxUploadSizeNotice">Maximum file size for uploading is ' . format_bytes_as_human_readable($this->_get_actual_max_upload_size()) . '. </div>'));
         if ($this->manager->get_value('transcoding_status') == 'ready') {
             $this->manager->set_display_name('upload_file', 'Upload Replacement File');
         }
     }
 }