function ProjView() { global $PH; global $auth; require_once confGet('DIR_STREBER') . "render/render_wiki.inc.php"; ### get current project ### $id = getOnePassedId('prj', 'projects_*'); if ($project = Project::getEditableById($id)) { $editable = true; } else { if ($project = Project::getVisibleById($id)) { $editable = false; } else { $PH->abortWarning(__("invalid project-id")); return; } } ### define from-handle ### $PH->defineFromHandle(array('prj' => $project->id)); ## is viewed by user ## $project->nowViewedByUser(); ## next milestone ## $next = $project->getNextMilestone(); $page = new Page(); $page->crumbs = build_project_crumbs($project); $page->options = build_projView_options($project); $page->cur_tab = 'projects'; $page->title = $project->name; $page->title_minor = __("Project overview"); if ($project->status == STATUS_TEMPLATE) { $page->type = __("Project Template"); } else { if ($project->status >= STATUS_COMPLETED) { $page->type = __("Inactive Project"); } else { $page->type = __("Project", "Page Type"); } } ### page functions ### if ($project->isPersonVisibleTeamMember($auth->cur_user)) { if ($editable) { $page->add_function(new PageFunction(array('target' => 'projEdit', 'params' => array('prj' => $project->id), 'icon' => 'edit', 'tooltip' => __('Edit this project'), 'name' => __('Edit project')))); } /* $item = ItemPerson::getAll(array( 'person'=>$auth->cur_user->id, 'item'=>$project->id )); if((!$item) || ($item[0]->is_bookmark == 0)){ $page->add_function(new PageFunction(array( 'target' =>'itemsAsBookmark', 'params' =>array('proj'=>$project->id), 'tooltip' =>__('Mark this project as bookmark'), 'name' =>__('Bookmark'), ))); } else{ $page->add_function(new PageFunction(array( 'target' =>'itemsRemoveBookmark', 'params' =>array('proj'=>$project->id), 'tooltip' =>__('Remove this bookmark'), 'name' =>__('Remove Bookmark'), ))); } */ /* if($project->state == 1) { $page->add_function(new PageFunction(array( 'target'=>'projDelete', 'params'=>array('prj'=>$project->id), 'icon'=>'delete', 'tooltip'=>__('Delete this project'), 'name'=>__('Delete') ))); } */ #$page->add_function(new PageFunctionGroup(array( # 'name' => __('new') #))); /* $page->add_function(new PageFunction(array( 'target' =>'projAddPerson', 'params' =>array('prj'=>$project->id), 'icon' =>'add', 'tooltip' =>__('Add person as team-member to project'), 'name' =>__('Team member') ))); */ if ($project->settings & PROJECT_SETTING_ENABLE_TASKS) { $page->add_function(new PageFunction(array('target' => 'taskNew', 'params' => array('prj' => $project->id), 'icon' => 'new', 'tooltip' => __('Create task'), 'name' => __('New task')))); } if ($project->settings & PROJECT_SETTING_ENABLE_BUGS) { $page->add_function(new PageFunction(array('target' => 'taskNewBug', 'params' => array('prj' => $project->id, 'add_issue' => 1), 'icon' => 'new', 'tooltip' => __('Create task with issue-report'), 'name' => __('New bug')))); } $page->add_function(new PageFunction(array('target' => 'taskNewDocu', 'params' => array('prj' => $project->id), 'icon' => 'new', 'tooltip' => __('Create wiki documentation page or start discussion topic'), 'name' => __('New topic')))); if ($project->settings & PROJECT_SETTING_ENABLE_EFFORTS && $auth->cur_user->settings & USER_SETTING_ENABLE_EFFORTS) { $page->add_function(new PageFunction(array('target' => 'effortNew', 'params' => array('prj' => $project->id), 'icon' => 'loghours', 'tooltip' => __('Book effort for this project'), 'name' => __('Book effort')))); } } $url = $PH->getUrl("projViewAsRSS", array('prj' => $project->id)); $page->extra_header_html .= '<link rel="alternate" type="application/rss+xml" title="' . asHtml($project->name) . ' ' . __("News") . '"' . ' href="' . $url . '" />'; ### render title ### echo new PageHeader(); echo new PageContentOpen_Columns(); measure_stop('current milestone'); require_once confGet('DIR_STREBER') . 'blocks/current_milestone_block.inc.php'; $block = new CurrentMilestoneBlock($project); $block->render(); measure_stop('current milestone'); measure_start('team'); require_once confGet('DIR_STREBER') . 'lists/list_docustructure.inc.php'; if (Task::getDocuTasks($project->id, 0)) { $list = new Block_DocuNavigation(array('project_id' => $project->id)); $list->print_all(); } #--- list team ----------------------------------------------------------- /* { $list= new ListBlock_projectTeam(); $list->title= __('Team members'); $list->show_icons=true; $list->active_block_function = 'list'; $list->print_automatic($project); } measure_stop('team'); */ echo new PageContentNextCol(); echo "<div class=description>"; echo wikifieldAsHtml($project, 'description', array('empty_text' => "[quote]" . __("This project does not have any text yet.\nDoubleclick here to add some.") . "[/quote]")); echo "</div>"; #--- news ----------------------------------------------------------- if ($project->settings & PROJECT_SETTING_ENABLE_NEWS) { require_once confGet('DIR_STREBER') . './blocks/project_news_block.inc.php'; print new ProjectNewsBlock($project); } require_once confGet('DIR_STREBER') . './lists/list_recentchanges.inc.php'; printRecentChanges(array($project), false); /* measure_start('changes'); { require_once(confGet('DIR_STREBER') . './lists/list_changes.inc.php'); $list= new ListBlock_changes(); $list->query_options['date_min']= $auth->cur_user->last_logout; $list->query_options['not_modified_by']= $auth->cur_user->id; $list->query_options['project']= $project->id; //$list->print_automatic($project); $list->print_automatic(); } measure_stop('changes'); */ echo "<br><br>"; # @@@ hack for firefox overflow problems ### HACKING: 'add new task'-field ### $PH->go_submit = 'taskNew'; echo '<input type="hidden" name="prj" value="' . $project->id . '">'; #$rss_url = confGet('SELF_PROTOCOL').'://'.confGet('SELF_URL'); #$rss_url = str_replace("index.php", "rss/", $rss_url); #$prj_id = $this->page->options[0]->target_params['prj']; $url = $PH->getUrl('projViewAsRSS', array('prj' => $project->id)); echo "<a style='margin:0px; border-width:0px;' href='{$url}' target='_blank'>" . "<img style='margin:0px; border-width:0px;' src='" . getThemeFile("icons/rss_icon.gif") . "'>" . "</a>"; echo new PageContentClose(); echo new PageHtmlEnd(); }
/** * view a task @ingroup pages */ function TaskView() { 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 ($task->category == TCATEGORY_DOCU || $task->category == TCATEGORY_FOLDER && $task->show_folder_as_documentation) { TaskViewAsDocu($task, $editable); exit; } 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; $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)) { if ($editable) { $page->add_function(new PageFunction(array('target' => 'taskEdit', 'params' => array('tsk' => $task->id), 'icon' => 'edit', 'tooltip' => sprintf(__('Edit this %s'), $task->getLabel()), '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 ($editable) { 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')))); } 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')))); } } ### folder ### if ($task->category == TCATEGORY_FOLDER) { $page->add_function(new PageFunctionGroup(array('name' => __('new')))); $page->add_function(new PageFunction(array('target' => 'taskNew', 'params' => array('parent_task' => $task->id), 'icon' => 'new', 'tooltip' => __('new subtask for this folder'), 'name' => __('Task')))); $page->add_function(new PageFunction(array('target' => 'taskNewBug', 'params' => array('parent_task' => $task->id), 'icon' => 'new', 'tooltip' => __('new bug for this folder'), 'name' => __('Bug')))); } else { if ($task->isMilestoneOrVersion()) { $page->add_function(new PageFunctionGroup(array('name' => __('new')))); $page->add_function(new PageFunction(array('target' => 'taskNew', 'params' => array('parent_task' => $task->id, 'for_milestone' => $task->id), 'icon' => 'new', 'tooltip' => __('new task for this milestone'), 'name' => __('Task')))); $page->add_function(new PageFunction(array('target' => 'taskNewBug', 'params' => array('parent_task' => $task->id), 'icon' => 'new', 'tooltip' => __('new bug for this folder'), 'name' => __('Bug')))); } } ### normal task ### #else { # if($editable) { # $page->add_function(new PageFunction(array( # 'target'=>'tasksMoveToFolder', ## 'params'=>array('tsk'=>$task->id), # 'icon'=>'edit', # 'name'=>__('Move', 'page function to move current task'), # ))); # } # #} if ($auth->cur_user->settings & USER_SETTING_ENABLE_BOOKMARKS) { $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')))); } } 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')))); } } ### render title ### echo new PageHeader(); echo new PageContentOpen_Columns(); #--- write info-block ------------ if ($task->isMilestoneOrVersion()) { measure_stop('current milestone'); require_once confGet('DIR_STREBER') . 'blocks/current_milestone_block.inc.php'; $block = new CurrentMilestoneBlock($project); $block->current_milestone = $task; $block->title = __("Open milestone"); $block->render(); measure_stop('current milestone'); } $block = new PageBlock(array('title' => __("Summary", "Block title"), 'id' => 'summary')); $block->render_blockStart(); echo "<div class=text>"; ### milestones and versions ### if ($task->isMilestoneOrVersion()) { global $g_released_names; if ($task->is_released && isset($g_released_names[$task->is_released])) { echo "<div class=labeled><label>" . __("Released as", "Label in Task summary") . "</label>" . $g_released_names[$task->is_released] . " / " . renderDateHtml($task->time_released) . "</div>"; } } else { if ($task->for_milestone) { if ($milestone = Task::getVisibleById($task->for_milestone)) { echo "<div class=labeled><label>" . __("For Milestone", "Label in Task summary") . "</label>" . $milestone->getLink(false) . "</div>"; } } global $g_status_names; if ($status = $g_status_names[$task->status]) { echo "<div class=labeled><label>" . __("Status", "Label in Task summary") . "</label>{$status}</div>"; } echo "<div class=labeled><label>" . __("Opened", "Label in Task summary") . "</label>" . renderDateHtml($task->date_start) . "</div>"; if ($task->estimated) { echo "<div class=labeled><label>" . __("Estimated", "Label in Task summary") . "</label>" . renderDuration($task->estimated) . ' '; if ($task->estimated_max) { echo " ... " . renderDuration($task->estimated_max); } echo "</div>"; } if ($task->completion) { echo "<div class=labeled><label>" . __("Completed", "Label in Task summary") . "</label>" . $task->completion . "%</div>"; } if ($task->planned_start && $task->planned_start != "0000-00-00 00:00:00") { echo "<div class=labeled><label>" . __("Planned start", "Label in Task summary") . "</label>" . renderTimestamp($task->planned_start) . "</div>"; } if ($task->planned_end && $task->planned_end != "0000-00-00 00:00:00") { echo "<div class=labeled><label>" . __("Planned end", "Label in Task summary") . "</label>" . renderTimestamp($task->planned_end) . "</div>"; } if ($task->date_closed != "0000-00-00") { echo "<div class=labeled><label>" . __("Closed", "Label in Task summary") . "</label>" . renderDateHtml($task->date_closed) . "</div>"; } } 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>"; } #} $sum_efforts = $task->getSumEfforts(); if ($sum_efforts) { echo "<div class=labeled><label>" . __("Logged effort", "Label in task-summary") . "</label>" . $PH->getLink('taskViewEfforts', round($sum_efforts / 60 / 60, 1), array('task' => $task->id)) . "</div>"; } if ($tps = $task->getAssignedPeople()) { $value = ""; $sep = ""; foreach ($tps as $tp) { $value .= $sep . $tp->getLink(); $sep = ", "; } $label = __("Assigned to"); echo "<div class=labeled><label>{$label}</label>{$value}</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(); #--- navigation structure for documentation -------------------------------------------- if ($task->category == TCATEGORY_FOLDER) { require_once confGet('DIR_STREBER') . 'lists/list_docustructure.inc.php'; $list = new Block_DocuNavigation(array('current_task' => $task, 'root' => $task)); $list->title = __("Further Documentation"); $list->print_all(); } require_once confGet('DIR_STREBER') . 'lists/list_files.inc.php'; $list = new ListBlock_files(); #$list->query_options['visible_only']= false; $list->query_options['parent_item'] = $task->id; $list->show_functions = false; unset($list->columns['status']); unset($list->columns['mimetype']); unset($list->columns['filesize']); unset($list->columns['created_by']); #unset($list->columns['download']); unset($list->columns['version']); unset($list->columns['_select_col_']); unset($list->columns['modified']); unset($list->columns['name']); unset($list->columns['thumbnail']); unset($list->block_functions['list']); unset($list->block_functions['grouped']); unset($list->functions['fileEdit']); unset($list->functions['filesDelete']); $list->title = __('Attached files'); if ($editable) { $list->summary = buildFileUploadForm($task); } $list->print_automatic($project); $PH->go_submit = $PH->getValidPage('filesUpload')->id; echo new PageContentNextCol(); 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 task 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); } #--- issue report ------------------------------------------------------------- if ($task->category == TCATEGORY_BUG && $task->issue_report) { require_once confGet('DIR_STREBER') . 'db/class_issue.inc.php'; $issue = new Issue($task->issue_report); $buffer = ""; if ($issue->severity) { global $g_severity_names; if (isset($g_severity_names[$issue->severity])) { $buffer .= '<div class=labeled><label>' . __("Severity", "label in issue-reports") . '</label>' . $g_severity_names[$issue->severity] . '</div>'; } } if ($issue->severity) { global $g_reproducibility_names; if (isset($g_reproducibility_names[$issue->reproducibility])) { $buffer .= '<div class=labeled><label>' . __("Reproducibility", "label in issue-reports") . '</label>' . $g_reproducibility_names[$issue->reproducibility] . '</div>'; } } if ($issue->plattform) { $buffer .= '<div class="labeled"><label>' . __('Platform') . '</label>' . asHtml($issue->plattform) . '</div>'; } if ($issue->os) { $buffer .= '<div class=labeled><label>' . __('OS') . '</label>' . asHtml($issue->os) . '</div>'; } if ($issue->version) { $buffer .= '<div class=labeled><label>' . __('Version') . '</label>' . asHtml($issue->version) . '</div>'; } if ($issue->production_build) { $buffer .= '<div class=labeled><label>' . __('Build') . '</label>' . asHtml($issue->production_build) . '</div>'; } if ($issue->steps_to_reproduce) { $text = wikifieldAsHtml($issue, 'steps_to_reproduce'); $buffer .= '<div class="labeled separated"><label>' . __("Steps to reproduce", "label in issue-reports") . "</label>{$text}</div>"; } if ($issue->expected_result) { $text = wikifieldAsHtml($issue, 'expected_result'); $buffer .= '<div class="labeled separated"><label>' . __("Expected result", "label in issue-reports") . "</label>{$text}</div>"; } if ($issue->suggested_solution) { $text = wikifieldAsHtml($issue, 'suggested_solution'); $buffer .= '<div class="labeled separated"><label>' . __("Suggested Solution", "label in issue-reports") . "</label>{$text}</div>"; } if ($buffer) { $block = new PageBlock(array('title' => __('Issue report'), 'id' => 'issue_report')); $block->render_blockStart(); echo "<div class=text>"; echo $buffer; echo "<b class=doclear></b>"; echo "</div>"; $block->render_blockEnd(); } } #--- list tasks ------------------------------------------------------------- if ($task->category == TCATEGORY_FOLDER || $task->getNumSubtasks() > 0) { $list = new ListBlock_tasks(array('active_block_function' => 'tree', 'title' => __('Sub tasks'))); unset($list->columns['project']); unset($list->columns['created_by']); unset($list->columns['planned_start']); unset($list->columns['modified']); unset($list->columns['estimate_complete']); unset($list->columns['pub_level']); $list->filters[] = new ListFilter_status_max(array('value' => STATUS_COMPLETED)); $list->filters[] = new ListFilter_category_in(array('value' => array(TCATEGORY_FOLDER, TCATEGORY_TASK, TCATEGORY_BUG))); $list->print_automatic($project, $task); } #--- list milestone-tasks --------------------------------------------------- if ($task->isOfCategory(array(TCATEGORY_MILESTONE, TCATEGORY_VERSION))) { $list = new ListBlock_tasks(array('active_block_function' => 'tree', 'title' => __('Open tasks for milestone'))); $list->no_items_html = __('No open tasks for this milestone'); unset($list->columns['project']); unset($list->columns['created_by']); unset($list->columns['planned_start']); unset($list->columns['modified']); unset($list->columns['for_milestone']); unset($list->columns['pub_level']); $list->query_options['status_max'] = STATUS_COMPLETED; $list->query_options['for_milestone'] = $task->id; $list->print_automatic($project, NULL, true); } #--- list change log --------------- if ($task->category == TCATEGORY_VERSION) { ### get resolved tasks ### if ($resolved = Task::getAll(array('project' => $task->project, 'resolved_version' => $task->id, 'status_min' => 0, 'status_max' => 200, 'order_by' => 'resolve_reason'))) { $block = new PageBlock(array('title' => __("Resolved tasks", "Block title"), 'id' => 'resolved_tasks')); $block->render_blockStart(); echo "<div class=text>"; $buffer = "<ul>"; foreach ($resolved as $r) { if ($r->resolve_reason && isset($g_resolve_reason_names[$r->resolve_reason])) { $reason = $g_resolve_reason_names[$r->resolve_reason] . ": "; } else { $reason = ""; } $buffer .= '<li>' . $reason . $r->getLink(false) . '</li>'; } $buffer .= "</ul>"; echo $buffer; echo "</div>"; $block->render_blockEnd(); } } require_once confGet('DIR_STREBER') . 'blocks/comments_on_item_block.inc.php'; print new CommentsOnItemBlock($task); #--- task quickedit form ------------------------------------------------------------- echo new PageContentClose(); echo new PageHtmlEnd(); ## is viewed by user ## $task->nowViewedByUser(); }