protected function createTabs($file) { parent::createTabs($file); $summary = $this->tabs->tab('Summary'); if ($file->is_making()) { $summary->newAction(kill_button($file->id())); } else { $summary->newAction(make_button($file->id(), $file->status() == PROJECTS_MADE)); } $summary->setContent($this->content($file)); $recipe = new Projects_RecipeTab($this->tabs, $file, $this->read_only()); $this->tabs->newTab($recipe); $log = new Projects_LogTab($this->tabs, $file); $this->tabs->newTab($log); }
public function __construct($parent, $file) { global $ID; global $REV; parent::__construct($parent, 'Summary'); $list = $this->newElement('ul'); $this->root->appendChild($list); $info = $this->newElement('li'); $text = ': ' . $file->type() . ' file'; $info->appendChild($this->loadElement(html_wikilink($ID))); $info->appendChild($this->newElement('span', array(), $text)); $list->appendChild($info); $format = 'D M d, Y \\a\\t g:i:s a'; if (date_default_timezone_get() == 'UTC') { $format .= ' e'; } $date = $REV ? $REV : $file->modified_date(); if (!$date) { $meta = Projects_file::file($file->id()); $date = $meta ? $meta->modified_date() : time(); } $updated = $this->newElement('li', array(), 'modified on: ' . date($format, $date)); $list->appendChild($updated); $actions = $this->newElement('li', array(), "Actions: "); $list->appendChild($actions); $this->actions = $this->newElement('span'); $actions->appendChild($this->actions); $this->newAction(manage_files_button($ID)); if (!$REV) { $this->newAction(download_button($ID)); } if (auth_quickaclcheck($ID) >= AUTH_DELETE) { $this->newAction(delete_button($ID)); } $this->content = $this->newElement('div', array('id' => 'PROJECTS_content')); if ($file->is_making()) { $time = time() - $file->status()->started(); $content = '<div id="PROJECTS_progress">The file has been generating for ' . self::format_time($time) . ': ' . kill_button($file->id(), FALSE) . DOKU_LF; foreach ($file->status()->made() as $made) { $content .= '<div class="success">' . html_wikilink($made) . '</div>' . DOKU_LF; } $content .= '<div class="notify">' . html_wikilink($file->status()->making()) . '</div>' . DOKU_LF; foreach ($file->status()->queue() as $queue) { $content .= '<div class="info">' . html_wikilink($queue) . '</div>' . DOKU_LF; } $this->setContent($content . '</div>'); } else { if (is_array($file->status())) { $content = '<div>Error in file generation:' . DOKU_LF; foreach ($file->status() as $id => $errors) { foreach ($errors as $error) { $content .= '<div class="error">' . html_wikilink($id) . ': ' . $error . '</div>' . DOKU_LF; } } $this->setContent($content . '</div>'); } } $this->root->appendChild($this->content); }