/** * View a comment * * @ingroup pages */ function commentView() { global $PH; global $auth; require_once confGet('DIR_STREBER') . 'render/render_wiki.inc.php'; ### get task #### if (!($comment = Comment::getVisibleById(get('comment')))) { $PH->abortWarning("invalid comment-id", ERROR_FATAL); } if (!($project = Project::getVisibleById($comment->project))) { $PH->abortWarning("invalid project-id", ERROR_FATAL); } $task = $comment->task ? Task::getVisibleById($comment->task) : NULL; ### create from handle ### $from_handle = $PH->defineFromHandle(array('comment' => $comment->id)); ## is viewed by user ## $comment->nowViewedByUser(); $page = new Page(); initPageForComment($page, $comment, $project); if ($comment->state == -1) { $page->title_minor = sprintf(__('(deleted %s)', 'page title add on with date of deletion'), renderTimestamp($comment->deleted)); } ### page functions ### $page->add_function(new PageFunction(array('target' => 'commentEdit', 'params' => array('comment' => $comment->id), 'icon' => 'edit', 'tooltip' => __('Edit this comment'), 'name' => __('Edit')))); $item = ItemPerson::getAll(array('person' => $auth->cur_user->id, 'item' => $comment->id)); if (!$item || $item[0]->is_bookmark == 0) { $page->add_function(new PageFunction(array('target' => 'itemsAsBookmark', 'params' => array('comment' => $comment->id), 'tooltip' => __('Mark this comment as bookmark'), 'name' => __('Bookmark')))); } else { $page->add_function(new PageFunction(array('target' => 'itemsRemoveBookmark', 'params' => array('comment' => $comment->id), 'tooltip' => __('Remove this bookmark'), 'name' => __('Remove Bookmark')))); } if ($comment->state == ITEMSTATE_DELETED) { $page->add_function(new PageFunction(array('target' => 'commentsUndelete', 'params' => array('comment' => $comment->id), 'icon' => 'delete', 'tooltip' => __('Delete this comment'), 'name' => __('Restore')))); } else { $page->add_function(new PageFunction(array('target' => 'commentsDelete', 'params' => array('comment' => $comment->id), 'icon' => 'delete', 'tooltip' => __('Delete this comment'), 'name' => __('Delete')))); } ### render title ### echo new PageHeader(); echo new PageContentOpen(); $block = new PageBlock(array('title' => __('Description'), 'id' => 'description', 'noshade' => true)); $block->render_blockStart(); $str = wikifieldAsHtml($comment, 'description'); echo "<div class=text>"; echo "{$str}"; echo "</div>"; $block->render_blockEnd(); echo '<input type="hidden" name="prj" value="' . $comment->project . '">'; echo new PageContentClose(); echo new PageHtmlEnd(); }
/** * view details of a version @ingroup pages */ function versionView() { global $PH; global $auth; require_once "render/render_wiki.inc.php"; ### get task #### if (!($version = Version::getVisibleById(get('version')))) { $PH->abortWarning("invalid version-id", ERROR_FATAL); } if (!($project = Project::getVisibleById($version->project))) { $PH->abortWarning("invalid project-id", ERROR_FATAL); } ### create from handle ### $from_handle = $PH->defineFromHandle(array('version' => $version->id)); ## is viewed by user ## $version->isViewedByUser($auth->cur_user); $page = new Page(); $page->cur_tab = 'projects'; $page->cur_crumb = 'projViewTasks'; $page->crumbs = build_project_crumbs($project); $page->options = build_projView_options($project); $type = __('Version', 'page type'); if ($task) { $folder = $task->getFolderLinks() . "<em>></em>" . $task->getLink(); $page->type = $folder . " > " . $type; } else { $page->type = $type; } $page->title = $version->name; $page->title_minor = ""; if ($version->state == -1) { $page->title_minor = sprintf(__('(deleted %s)', 'page title add on with date of deletion'), renderTimestamp($version->deleted)); } ### page functions ### $page->add_function(new PageFunction(array('target' => 'versionEdit', 'params' => array('version' => $version->id), 'icon' => 'edit', 'tooltip' => __('Edit this version'), 'name' => __('Edit')))); $item = ItemPerson::getAll(array('person' => $auth->cur_user->id, 'item' => $version->id)); if (!$item || $item[0]->is_bookmark == 0) { $page->add_function(new PageFunction(array('target' => 'itemsAsBookmark', 'params' => array('version' => $version->id), 'tooltip' => __('Mark this version as bookmark'), 'name' => __('Bookmark')))); } else { $page->add_function(new PageFunction(array('target' => 'itemsRemoveBookmark', 'params' => array('version' => $version->id), 'tooltip' => __('Remove this bookmark'), 'name' => __('Remove Bookmark')))); } ### render title ### echo new PageHeader(); echo new PageContentOpen(); $block = new PageBlock(array('title' => __('Description'), 'id' => 'description', 'noshade' => true)); $block->render_blockStart(); $str = wikifieldAsHtml($version, 'description'); echo "<div class=text>"; echo "{$str}"; echo "</div>"; $block->render_blockEnd(); echo '<input type="hidden" name="prj" value="' . $version->project . '">'; /** * give parameter for create of new items (subtasks, efforts, etc) */ #echo '<input type="hidden" name="parent_task" value="'.$task->id.'">'; echo new PageContentClose(); echo new PageHtmlEnd(); }
private function addRecentChanges() { ### list project changes ### require_once confGet('DIR_STREBER') . './lists/list_changes.inc.php'; $updates_html = ''; $updates_txt = ''; foreach ($this->projects as $p) { if ($changes = ChangeLine::getChangeLinesForPerson($this->recipient, $p, $this->recipient->notification_last)) { $this->information_count++; $updates_html .= "<h4>"; $updates_html .= $this->getItemLink($p->id, $p->name); $updates_html .= "</h4><ul>"; $updates_txt .= "\n\r" . $p->name . "\n\r"; foreach ($changes as $c) { $updates_html .= "<li>"; $updates_txt .= "\n\r- "; ### task if ($c->item && $c->item->type == ITEM_TASK) { $task = $c->item; $updates_html .= $this->getItemLink($task->id, $task->name); $updates_txt .= $task->name; } else { if ($c->item && $c->item->type == ITEM_FILE) { $file = $c->item; $updates_html .= $this->getItemLink($file->id, $file->name); $updates_txt .= $file->name; } } $updates_html .= '<br><span class="details">'; # invisible user $updates_txt .= "\n\r"; # invisible user ### what... if ($c->html_what) { $updates_html .= $c->html_what . ' '; if ($c->txt_what) { $updates_txt .= ' ' . $c->txt_what; } else { $updates_txt .= ' ' . strip_tags($c->html_what); } } $updates_html .= ' ' . __("by") . ' '; # invisible user $updates_txt .= ' ' . __("by") . ' '; # invisible user ### who... if ($c->person_by) { if ($p_who = Person::getVisibleById($c->person_by)) { $updates_html .= "<b>" . asHtml($p_who->nickname) . "</b>" . " "; $updates_txt .= $p_who->nickname; } else { $updates_html .= '??? '; # invisible user $updates_txt .= '???: '; # invisible user } } ### when... if ($c->timestamp) { $updates_html .= ' - ' . renderTimestamp($c->timestamp); $updates_txt .= ' - ' . renderTimestamp($c->timestamp); } ### to... /** * @@@ bug: this contains internal links that can be viewed from mail **/ if ($c->html_assignment) { $updates_html .= ' (' . $c->html_assignment . ') '; } $updates_html .= "</span>"; $updates_html .= "<div class='details'>" . $c->html_details . "</div>"; $updates_html .= "</li>"; $updates_txt .= "\n\r"; } $updates_html .= "</ul>"; $updates_txt .= "\n\r"; } } if ($updates_html) { $this->body_html .= "<h3>" . __('Project Updates') . "</h3>" . $updates_html; $this->body_plaintext .= "\n\r" . __('Project Updates') . "\n\r" . str_repeat("=", strlen(__('Project Updates'))) . "\n\r" . $updates_txt; } }
function renderTimestampHtml($t) { if (!($str = renderTimestamp($t))) { return "-"; } if (is_string($t)) { $t = strToClientTime($t); } /* ### hilight new dates ### if(isset($auth) && isset($auth->cur_user) && gmdate("Y-m-d H:i:s",$t) > $auth->cur_user->last_logout) { $str_tooltip= __("new since last logout"); return "<span class=new title='$str_tooltip'>$str</span>"; } else { */ return $str; }
function render_tr(&$obj, $style = "") { measure_start('col_timedue'); $class = ""; $title = "planned end undefined."; $value = ""; if ($obj->planned_end && $obj->planned_end != '0000-00-00' && $obj->planned_end != '0000-00-00 00:00:00') { if ($obj->status >= STATUS_COMPLETED) { if ($obj->status == STATUS_COMPLETED) { $value = __("Review"); $title = __("Task status set to completed and needs approval."); } else { $title = sprintf(__("Item was approved on: %s:", "date a task was approved"), renderDate($obj->date_closed)); $value = __("done"); } } else { $daysLeft = floor((strToGMTime($obj->planned_end) - time()) / 24 / 60 / 60); switch ($daysLeft) { case 0: $value = __("Today"); $title = __("This task is planned to be completed today."); break; case 1: $value = __("Tomorrow"); $title = __("This task is planned to be completed tomorrow."); break; case 7: case 8: case 9: case 10: case 11: case 12: case 13: case 14: $value = __("Next week"); $title = sprintf(__("due: %s"), renderDate($obj->planned_end)); break; default: $value = abs($daysLeft) . " <span class='entity'>" . __("days"); if ($daysLeft < 0) { $class = "overDue"; $title = __("this task is overdue!"); $value .= __("late", "time status of a task"); } else { $value .= __("remain", "time status of a task"); if ($obj->planned_start && $obj->planned_start != '0000-00-00' && $obj->planned_start != '0000-00-00 00:00:00') { if (floor((strToGMTime($obj->planned_start) - time()) / 24 / 60 / 60) + 1 >= 1) { $value = __("Pending"); $title = sprintf(__("planned for %s", "a certain date"), renderTimestamp($obj->planned_start)); } else { $title = sprintf(__("start: %s"), renderDate($obj->planned_start)) . " / " . sprintf(__("due: %s"), renderDate($obj->planned_end)); } } else { $title = sprintf(__("due: %s"), renderDate($obj->planned_end)); } } break; } } $value .= "</span>"; print "<td class='timeDue {$class}' title='{$title}'>{$value}</td>"; measure_stop('col_timedue'); } else { print "<td></td>"; } }
/** * renders a comparision between two versions of an item @ingroup pages */ function itemViewDiff() { global $PH; global $auth; require_once confGet('DIR_STREBER') . 'render/render_wiki.inc.php'; ### get task #### $item_id = get('item'); if (!($item = DbProjectItem::getObjectById($item_id))) { $PH->abortWarning("invalid item-id", ERROR_FATAL); } if (!($project = Project::getVisibleById($item->project))) { $PH->abortWarning("this item has an invalid project id", ERROR_DATASTRUCTURE); } require_once confGet('DIR_STREBER') . "db/db_itemchange.inc.php"; $versions = ItemVersion::getFromItem($item); $date1 = get('date1'); $date2 = get('date2'); if (!$date1) { #if(count($versions) > 1) { # if($auth->cur_user->last_logout < $versions[count($versions)-2]->date_to) # { # $date1 = $auth->cur_user->last_logout; # } # else { # $date1 = $versions[count($versions)-2]->date_from; # } #} #else { foreach (array_reverse($versions) as $v) { if ($v->author == $auth->cur_user->id) { $date1 = $v->date_from; break; } } #} } if (!$date2) { $date2 = getGMTString(); } $page = new Page(); $page->cur_tab = 'projects'; $page->crumbs = build_project_crumbs($project); $page->options = build_projView_options($project); $page->title = $item->name; $page->title_minor = __('changes'); $page->add_function(new PageFunction(array('target' => 'itemView', 'params' => array('item' => $item->id), 'icon' => 'edit', 'name' => __('View item')))); ### render title ### echo new PageHeader(); echo new PageContentOpen(); if ($date1 > $date2) { new FeedbackMessage(__("date1 should be smaller than date2. Swapped")); $t = $date1; $date1 = $date2; $date2 = $t; } if (count($versions) == 1) { echo __("item has not been edited history"); } else { $old_version = NULL; $version_right = NULL; $version_left = $versions[0]; foreach ($versions as $v) { if ($v->date_from <= $date1) { $version_left = $v; } if ($v->date_from >= $date2) { if (isset($version_right)) { if ($version_right->date_from > $v->date_from) { $version_right = $v; } } else { $version_right = $v; } } } if (!isset($version_right)) { $version_right = $versions[count($versions) - 1]; } $options_left = array(); $options_right = array(); ### list versions left ### for ($i = 0; $i < count($versions) - 1; $i++) { $v = $versions[$i]; if ($person = Person::getVisibleById($v->author)) { $author = $person->name; } else { $author = __('unknown'); } if ($v->version_number == $version_left->version_number) { $str_link = $PH->getUrl('itemViewDiff', array('item' => $item->id, 'date1' => $versions[$i]->date_from, 'date2' => $versions[$i]->date_to)); $name = ' v.' . $v->version_number . ' -- ' . $author . " -- " . $v->date_from; $options_left[] = "<option selected=1 value='" . $str_link . "'>" . $name . "</option>"; } else { if ($v->version_number > $version_left->version_number) { if ($v->version_number < $version_right->version_number) { $str_link = $PH->getUrl('itemViewDiff', array('item' => $item->id, 'date1' => $versions[$i]->date_from, 'date2' => $versions[$i]->date_to)); $name = '> v.' . $v->version_number . ' -- ' . $author . " -- " . renderDate($v->date_from); } else { $str_link = $PH->getUrl('itemViewDiff', array('item' => $item->id, 'date1' => $versions[$i]->date_from, 'date2' => $version_right->date_to)); $name = '>> v.' . $v->version_number . ' -- ' . $author . " -- " . renderDate($v->date_from); } $options_left[] = "<option value='" . $str_link . "'>" . $name . "</option>"; } else { $str_link = $PH->getUrl('itemViewDiff', array('item' => $item->id, 'date1' => $versions[$i]->date_from, 'date2' => $version_right->date_from)); $name = '< v.' . $v->version_number . ' -- ' . $author . " -- " . renderDate($v->date_from); $options_left[] = "<option value='" . $str_link . "'>" . $name . "</option>"; } } } ### list versions right ### for ($i = 1; $i < count($versions); $i++) { $v = $versions[$i]; if ($person = Person::getVisibleById($v->author)) { $author = $person->name; } else { $author = __('unknown'); } if ($v->version_number == $version_right->version_number) { $str_link = $PH->getUrl('itemViewDiff', array('item' => $item->id, 'date1' => $versions[$i]->date_from, 'date2' => $versions[$i]->date_to)); $name = ' v.' . $v->version_number . ' -- ' . $author . " -- " . $v->date_from; $options_right[] = "<option selected=1 value='" . $str_link . "'>" . $name . "</option>"; } else { if ($v->version_number > $version_right->version_number) { $str_link = $PH->getUrl('itemViewDiff', array('item' => $item->id, 'date1' => $version_left->date_from, 'date2' => $versions[$i]->date_from)); $name = '> v.' . $v->version_number . ' -- ' . $author . ' -- ' . renderDate($v->date_from); $options_right[] = "<option value='" . $str_link . "'>" . $name . "</option>"; } else { if ($v->version_number > $version_left->version_number) { $str_link = $PH->getUrl('itemViewDiff', array('item' => $item->id, 'date1' => $version_left->date_from, 'date2' => $versions[$i]->date_from)); $name = '< v.' . $v->version_number . ' -- ' . $author . " -- " . renderDate($v->date_from); } else { $str_link = $PH->getUrl('itemViewDiff', array('item' => $item->id, 'date1' => $versions[$i]->date_from, 'date2' => $versions[$i]->date_to)); $name = '<< v.' . $v->version_number . ' -- ' . $author . ' -- ' . renderDate($v->date_from); } $options_right[] = "<option value='" . $str_link . "'>" . $name . "</option>"; } } } ### prev ### if ($version_left->version_number > 1) { $link_prev = $PH->getLink('itemViewDiff', '<< ' . __('prev change'), array('item' => $item->id, 'date1' => $versions[$version_left->version_number - 2]->date_from, 'date2' => $versions[$version_left->version_number - 2]->date_to), NULL, true); } else { $link_prev = ''; } ### next ### if ($version_right->version_number < count($versions)) { $link_next = $PH->getLink('itemViewDiff', __('next') . '>>', array('item' => $item->id, 'date1' => $versions[$version_right->version_number - 1]->date_from, 'date2' => $versions[$version_right->version_number - 1]->date_to), NULL, true); } else { $link_next = ''; } ### summary ### $link_summary = $PH->getLink('itemViewDiff', __('summary'), array('item' => $item->id, 'date1' => $auth->cur_user->last_logout, 'date2' => getGMTString()), NULL, true); echo "<div class=diff>"; echo "<table class=nav><tr>"; echo "<td class=older>" . "<select onChange='location.href=this.options[this.selectedIndex].value'>" . join(array_reverse($options_left)) . "</select>" . '<br><b class=doclear></b>' . $link_prev . "</td>"; echo "<td class=newer>" . "<select onChange='location.href=this.options[this.selectedIndex].value'>" . join(array_reverse($options_right)) . "</select>" . '<br><b class=doclear></b>' . $link_next . $link_summary . "</td>"; echo "</table>"; #if(!$date2 || !$date1) { # echo sprintf(__("Item did not exists at %s"), renderTime($date2)); #} if ($old_version == $version_right) { echo sprintf(__('no changes between %s and %s'), renderTime($date1), renderTime($date2)); } ### collect changes ### $old_field_values = array(); $new_field_values = array(); foreach ($versions as $v) { if ($v->version_number <= $version_left->version_number) { foreach ($v->values as $name => $value) { $old_field_values[$name] = $value; } } if ($v->version_number >= $version_left->version_number && $v->version_number < $version_right->version_number) { foreach ($v->values_next as $name => $value) { $new_field_values[$name] = $value; } } } foreach ($new_field_values as $field_name => $value) { echo "<h2>{$field_name}</h2>"; $old_value = isset($old_field_values[$field_name]) ? $old_field_values[$field_name] : ""; $new_value = isset($new_field_values[$field_name]) ? $new_field_values[$field_name] : ''; $field_type = $item->fields[$field_name]->type; if ($field_type == 'FieldText') { echo render_changes($old_value, $new_value); } else { if ($field_type == 'FieldOption') { if ($field_name == 'status') { global $g_status_names; $old_value = isset($g_status_names[$old_value]) ? $g_status_names[$old_value] : __('undefined'); $new_value = isset($g_status_names[$new_value]) ? $g_status_names[$new_value] : __('undefined'); } else { if ($field_name == 'label') { if ($project = Project::getVisibleById($item->project)) { $labels = explode(",", $project->labels); $old_value = isset($labels[$old_value - 1]) ? $labels[$old_value - 1] : __('undefined'); $new_value = isset($labels[$new_value - 1]) ? $labels[$new_value - 1] : __('undefined'); } } } echo render_changes($old_value, $new_value); } else { if ($field_type == 'FieldInternal') { if ($field_name == 'parent_item') { if ($task_parent_old = Task::getVisibleById($old_value)) { $ar = array(); foreach ($task_parent_old->getFolder() as $f) { $ar[] = $f->name; } $ar[] = $task_parent_old->name; $old_value = join($ar, " > "); } if ($task_parent_new = Task::getVisibleById($new_value)) { $ar = array(); foreach ($task_parent_new->getFolder() as $f) { $ar[] = $f->name; } $ar[] = $task_parent_new->name; $new_value = join($ar, " > "); } } else { if ($field_name == 'state') { $old_value = $old_value == -1 ? __('deleted') : __('ok'); $new_value = $new_value == -1 ? __('deleted') : __('ok'); } else { if ($field_name == 'pub_level') { global $g_pub_level_names; $old_value = isset($g_pub_level_names[$old_value]) ? $g_pub_level_names[$old_value] : __('undefined'); $new_value = isset($g_pub_level_names[$new_value]) ? $g_pub_level_names[$new_value] : __('undefined'); } } } echo render_changes($old_value, $new_value); } else { if ($field_type == 'FieldPercentage') { echo render_changes($old_value, $new_value); } else { if ($field_type == 'FieldInt') { echo render_changes($old_value, $new_value); } else { if ($field_type == 'FieldString') { echo render_changes($old_value, $new_value); } else { if ($field_type == 'FieldDate') { echo render_changes(renderDate($old_value), renderDate($new_value)); } else { if ($field_type == 'FieldDatetime') { echo render_changes(renderTimestamp($old_value), renderTimestamp($new_value)); } } } } } } } } } } echo "</div>"; echo new PageContentClose(); echo new PageHtmlEnd(); }
/** * view task a documentation page @ingroup pages */ function taskViewAsDocu() { global $PH; global $auth; require_once confGet('DIR_STREBER') . 'render/render_wiki.inc.php'; require_once confGet('DIR_STREBER') . 'db/db_itemperson.inc.php'; ### get task #### $tsk = get('tsk'); $editable = false; # flag, if this task can be edited if ($task = Task::getEditableById($tsk)) { $editable = true; } else { if (!($task = Task::getVisibleById($tsk))) { $PH->abortWarning("invalid task-id", ERROR_FATAL); } } if (!($project = Project::getVisibleById($task->project))) { $PH->abortWarning("this task has an invalid project id", ERROR_DATASTRUCTURE); } ### create from handle ### $from_handle = $PH->defineFromHandle(array('tsk' => $task->id)); global $g_wiki_task; $g_wiki_task = $task; ### set up page and write header #### measure_start("page_render"); $page = new Page(); $page->use_autocomplete = true; initPageForTask($page, $task, $project); $page->title_minor_html = $PH->getLink('taskView', sprintf('#%d', $task->id), array('tsk' => $task->id)); if ($task->state == -1) { $page->title_minor_html .= ' ' . sprintf(__('(deleted %s)', 'page title add on with date of deletion'), renderTimestamp($task->deleted)); } ### page functions ### if ($project->isPersonVisibleTeamMember($auth->cur_user)) { ### edit ### if ($editable) { $page->add_function(new PageFunction(array('target' => 'taskEdit', 'params' => array('tsk' => $task->id), 'icon' => 'edit', 'tooltip' => __('Edit this task'), 'name' => __('Edit')))); $page->add_function(new PageFunction(array('target' => 'tasksMoveToFolder', 'params' => array('tsk' => $task->id), 'icon' => 'edit', 'name' => __('Move', 'page function to move current task')))); if ($task->state == 1) { $page->add_function(new PageFunction(array('target' => 'tasksDelete', 'params' => array('tsk' => $task->id), 'icon' => 'delete', 'tooltip' => __('Delete this task'), 'name' => __('Delete')))); } else { if ($task->state == -1) { $page->add_function(new PageFunction(array('target' => 'tasksUndelete', 'params' => array('tsk' => $task->id), 'icon' => 'undelete', 'tooltip' => __('Restore this task'), 'name' => __('Undelete')))); } } } if ($auth->cur_user->settings & USER_SETTING_ENABLE_EFFORTS && $project->settings & PROJECT_SETTING_ENABLE_EFFORTS) { $page->add_function(new PageFunction(array('target' => 'effortNew', 'params' => array('parent_task' => $task->id), 'icon' => 'effort', 'name' => __('Book Effort')))); } ### new ### if ($task->category == TCATEGORY_FOLDER) { $page->add_function(new PageFunction(array('target' => 'taskNew', 'params' => array('parent_task' => $task->id, 'task_category' => TCATEGORY_DOCU, 'task_show_folder_as_documentation' => 1), 'icon' => 'edit', 'name' => __('New topic')))); } else { if ($task->parent_task) { $page->add_function(new PageFunction(array('target' => 'taskNew', 'params' => array('parent_task' => $task->parent_task, 'task_category' => TCATEGORY_DOCU, 'task_show_folder_as_documentation' => 1), 'icon' => 'edit', 'name' => __('New topic')))); } else { $page->add_function(new PageFunction(array('target' => 'taskNew', 'params' => array('prj' => $task->project, 'task_category' => TCATEGORY_DOCU), 'icon' => 'edit', 'name' => __('New topic')))); } } if ($auth->cur_user->settings & USER_SETTING_ENABLE_BOOKMARKS) { require_once confGet('DIR_STREBER') . 'db/db_itemperson.inc.php'; $item = ItemPerson::getAll(array('person' => $auth->cur_user->id, 'item' => $task->id)); if (!$item || $item[0]->is_bookmark == 0) { $page->add_function(new PageFunction(array('target' => 'itemsAsBookmark', 'params' => array('task' => $task->id), 'tooltip' => __('Mark this task as bookmark'), 'name' => __('Bookmark')))); } else { $page->add_function(new PageFunction(array('target' => 'itemsRemoveBookmark', 'params' => array('task' => $task->id), 'tooltip' => __('Remove this bookmark'), 'name' => __('Remove Bookmark')))); } } } ### render title ### echo new PageHeader(); echo new PageContentOpen_Columns(); require_once confGet('DIR_STREBER') . 'lists/list_docustructure.inc.php'; $list = new Block_DocuNavigation(array('current_task' => $task)); $list->print_all(); $block = new PageBlock(array('id' => 'summary', 'reduced_header' => true)); $block->render_blockStart(); echo "<div class=text>"; if ($person_creator = Person::getVisibleById($task->created_by)) { echo "<div class=labeled><label>" . __("Created", "Label in Task summary") . "</label>" . renderDateHtml($task->created) . ' / ' . $person_creator->getLink() . '</div>'; } if ($person_modify = Person::getVisibleById($task->modified_by)) { echo "<div class=labeled><label>" . __("Modified", "Label in Task summary") . "</label>" . renderDateHtml($task->modified) . ' / ' . $person_modify->getLink() . '</div>'; } require_once confGet('DIR_STREBER') . "db/db_itemchange.inc.php"; $versions = ItemVersion::getFromItem($task); if (count($versions) > 1) { $str_version = $PH->getLink('itemViewDiff', sprintf(__("View previous %s versions"), count($versions)), array('item' => $task->id)); echo "<div class=labeled><label></label>{$str_version}</div>"; } ### publish to ### global $g_pub_level_names; if ($task->pub_level != PUB_LEVEL_OPEN && isset($g_pub_level_names[$task->pub_level])) { echo "<div class=labeled><label>" . __("Publish to", "Label in Task summary") . "</label>" . $g_pub_level_names[$task->pub_level]; if ($editable) { echo '<br>(' . $PH->getLink('itemsSetPubLevel', __('Set to Open'), array('item' => $task->id, 'item_pub_level' => PUB_LEVEL_OPEN)) . ')'; } echo "</div>"; } echo "</div>"; $block->render_blockEnd(); require_once confGet('DIR_STREBER') . 'blocks/files_attached_to_item.inc.php'; print new FilesAttachedToItemBlock($task); echo new PageContentNextCol(); require_once confGet('DIR_STREBER') . 'db/db_itemperson.inc.php'; if ($view = ItemPerson::getAll(array('person' => $auth->cur_user->id, 'item' => $task->id, 'feedback_requested_by' => true))) { if ($requested_by = Person::getPeople(array('id' => $view[0]->feedback_requested_by))) { echo "<div class=item_notice>"; echo "<h3>" . sprintf(__("Your feedback is requested by %s."), asHtml($requested_by[0]->nickname)) . "</h3>"; echo __("Please edit or comment this item."); echo "</div>"; } } #$descriptionWithUpdates= $task->getTextfieldWithUpdateNotes('description'); echo "<div class=description>"; echo wikifieldAsHtml($task, 'description', array('empty_text' => "[quote]" . __("This topic does not have any text yet.\nDoubleclick here to add some.") . "[/quote]")); echo "</div>"; ### Apply automatic link conversions if (checkAutoWikiAdjustments()) { $task->description = applyAutoWikiAdjustments($task->description); $task->update(array('description'), false); } require_once confGet('DIR_STREBER') . 'blocks/comments_on_item_block.inc.php'; print new CommentsOnItemBlock($task); echo new PageContentClose(); echo new PageHtmlEnd(); measure_stop("page_render"); $task->nowViewedByUser(); }
/** * View details of a file (versions, etc) @ingroup pages */ function fileView() { global $PH; global $auth; require_once confGet('DIR_STREBER') . 'render/render_wiki.inc.php'; ### get object #### $file_id = getOnePassedId('file'); if (!($file = File::getVisibleById($file_id))) { $PH->abortWarning("invalid file-id", ERROR_FATAL); } $file_org = $file->getOriginal(); if ($file->is_latest) { $file_latest = $file; } else { $file_latest = $file->getLatest(); } if (!($project = Project::getVisibleById($file->project))) { $PH->abortWarning("invalid project-id", ERROR_FATAL); } /** * parent item (not implemented yet) */ $parent_task = NULL; if ($file->parent_item) { #trigger_error('@@@not implemented yet', E_USER_ERROR); if (!($parent_task = Task::getVisibleById(intval($file->parent_item)))) { $PH->messages[] = sprintf(__("Could not access parent task Id:%s"), $file->parent_item); } } ### create from handle ### $from_handle = $PH->defineFromHandle(array('file' => $file->id)); ## is viewed by user ## $file->nowViewedByUser(); $page = new Page(); initPageForFile($page, $file, $project); #$page->title_minor=sprintf('#%d', $file_org->id);; if ($file->state == -1) { $page->title_minor = sprintf(__('(deleted %s)', 'page title add on with date of deletion'), renderTimestamp($file->deleted)); } ### page functions ### $page->add_function(new PageFunction(array('target' => 'fileEdit', 'params' => array('file' => $file->id), 'icon' => 'edit', 'tooltip' => __('Edit this file'), 'name' => __('Edit')))); $page->add_function(new PageFunction(array('target' => 'filesMoveToFolder', 'params' => array("file" => $file->id), 'tooltip' => __('Move this file to another task'), 'name' => __('Move')))); if ($auth->cur_user->settings & USER_SETTING_ENABLE_BOOKMARKS) { $item = ItemPerson::getAll(array('person' => $auth->cur_user->id, 'item' => $file->id)); if (!$item || $item[0]->is_bookmark == 0) { $page->add_function(new PageFunction(array('target' => 'itemsAsBookmark', 'params' => array('file' => $file->id), 'tooltip' => __('Mark this file as bookmark'), 'name' => __('Bookmark')))); } else { $page->add_function(new PageFunction(array('target' => 'itemsRemoveBookmark', 'params' => array('file' => $file->id), 'tooltip' => __('Remove this bookmark'), 'name' => __('Remove Bookmark')))); } } ### render title ### echo new PageHeader(); echo new PageContentOpen(); $block = new PageBlock(array('title' => __('Upload new version', 'block title'), 'id' => 'summary')); $block->render_blockStart(); echo "<div class=text>"; echo '<input type="hidden" name="MAX_FILE_SIZE" value="' . confGet('FILE_UPLOAD_SIZE_MAX') . '" />'; echo '<input id="userfile" name="userfile" type="file" size="40" accept="*" />'; echo '<input type="submit" value="' . __('Upload') . '" />'; echo '</div>'; $block->render_blockEnd(); $block = new PageBlock(array('title' => sprintf(__('Version #%s (current): %s'), $file_latest->version, $file_latest->name), 'id' => 'description')); $block->render_blockStart(); echo "<div class=text>"; ### show thumbnail if ($file_latest->mimetype == "image/png" || $file_latest->mimetype == "image/x-png" || $file_latest->mimetype == "image/jpeg" || $file_latest->mimetype == "image/gif") { echo "<div class=image style='float:right;'><a href='index.php?go=fileDownloadAsImage&file={$file_latest->id}'>"; echo "<img src='index.php?go=fileDownloadAsImage&file={$file_latest->id}&max_size=128'>"; echo "</a></div>"; } if ($parent_task) { echo "<div class=labeled><label>" . __('For task') . "</label><span>" . $parent_task->getLink(false) . "</span></div>"; } echo "<div class=labeled><label>" . __('Filesize') . "</label><span>{$file_latest->filesize} bytes</span></div>"; echo "<div class=labeled><label>" . __('Type') . "</label><span>{$file_latest->mimetype}</span></div>"; echo "<div class=labeled><label>" . __('Uploaded') . "</label><span>" . renderDateHtml($file_latest->created) . "</span></div>"; if ($uploader = Person::getVisibleById($file->created_by)) { echo "<div class=labeled><label>" . __('Uploaded by') . "</label><span>" . $uploader->getLink() . "</span></div>"; } if ($file_latest->created != $file_latest->modified) { echo "<div class=labeled><label>" . __('Modified') . "</label><span>" . renderDateHtml($file_latest->created) . "</span></div>"; } echo "<div class=labeled><label>" . __('Download') . "</label><span>" . $PH->getLink('fileDownload', $file_latest->org_filename, array('file' => $file_latest->id)) . "</span></div>"; $str = wikifieldAsHtml($file_latest, 'description'); echo "<br>"; echo "{$str}"; echo "</div>"; $block->render_blockEnd(); /** * build list of old versions, * because org_file is zero for the original file, with have to append it */ $old_files = File::getAll(array('latest_only' => false, 'org_file' => $file_org->id, 'order_by' => 'version DESC', 'project' => $project->id)); if ($file_latest->id != $file_org->id) { $old_files[] = $file_org; } foreach ($old_files as $of) { if ($of->id != $file_latest->id) { $block = new PageBlock(array('title' => sprintf(__('Version #%s : %s'), $of->version, $of->name), 'id' => 'version_' . $of->id)); $block->render_blockStart(); echo "<div class=text>"; ### show thumbnail if ($of->mimetype == "image/png" || $of->mimetype == "image/x-png" || $of->mimetype == "image/jpeg" || $of->mimetype == "image/gif") { echo "<div class=image style='float:right;'><a href='index.php?go=fileDownloadAsImage&file={$of->id}'>"; echo "<img src='index.php?go=fileDownloadAsImage&file={$of->id}&max_size=128'>"; echo "</a></div>"; } $str = wikifieldAsHtml($of, 'description'); echo "{$str}"; echo "<div class=labeled><label>" . __('Filesize') . "</label><span>{$of->filesize} bytes</span></div>"; echo "<div class=labeled><label>" . __('Type') . "</label><span>{$of->mimetype}</span></div>"; echo "<div class=labeled><label>" . __('Uploaded') . "</label><span>" . renderDateHtml($of->created) . "</span></div>"; #echo "<div class=labeled><label>" . __('Version') . "</label><span>". intval($of->version) ."</span></div>"; echo "<div class=labeled>" . $PH->getLink('fileDownload', '', array('file' => $of->id)) . "</div>"; echo "</div>"; $block->render_blockEnd(); } } $PH->go_submit = 'fileUpdate'; /** * list comments * NOTE: can files have comments? */ /* { $comments= $file->getComments(); $list=new ListBlock_comments(); $list->no_items_html=$PH->getLink('commentNew','',array('parent_task'=>$task->id)); $list->render_list($comments); } */ echo '<input type="hidden" name="prj" value="' . $file->project . '">'; echo '<input type="hidden" name="org_file" value="' . $file->id . '">'; /** * give parameter for create of new items (subtasks, efforts, etc) */ #echo '<input type="hidden" name="parent_task" value="'.$task->id.'">'; echo new PageContentClose(); echo new PageHtmlEnd(); }