function projViewFiles() { global $PH; global $auth; require_once confGet('DIR_STREBER') . "render/render_wiki.inc.php"; ### get current project ### $id = getOnePassedId('prj', 'projects_*'); $project = Project::getVisibleById($id); if (!$project || !$project->id) { $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 = __("Downloads"); 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"); } } ### render title ### echo new PageHeader(); echo new PageContentOpen(); measure_stop('init2'); measure_start('info'); $block = new PageBlock(array('id' => 'support')); $block->render_blockStart(); echo "<div class=text>"; if ($task = Task::getVisibleById(3645)) { echo wikifieldAsHtml($task, 'description'); } echo "</div>"; $block->render_blockEnd(); echo new PageContentClose(); echo new PageHtmlEnd(); }
/** * 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(); }
/** * test function for development @ingroup pages * * the output of this function could be requested with jquery like: * * $('#sideboard div').load('index.php?go=taskAjax',{ * go: 'taskAjax', * tsk: id * }); */ function taskAjax() { if ($task_id = intval(get('tsk'))) { require_once "render/render_wiki.inc.php"; ### headline ### $editable = false; # flag, if this task can be edited if ($task = Task::getEditableById($task_id)) { $editable = true; } else { if (!($task = Task::getVisibleById($task_id))) { echo "Failure"; return; } } echo "<h3>" . asHtml($task->name) . "</h3>"; echo wikifieldAsHtml($task, 'description'); } }
public function __toString() { global $PH; $news = $this->project->getTasks(array('is_news' => 1, 'order_by' => 'created DESC')); if (!$news) { return ''; } #--- news ----------------------------------------------------------- $this->render_blockStart(); $count = 0; foreach ($news as $n) { if ($count++ >= $this->max_news) { break; } echo "<div class='post_list_entry'>"; if ($creator = Person::getVisibleById($n->created_by)) { $link_creator = ' by ' . $creator->getLink(); } else { $link_creator = ''; } echo "<h3>" . asHtml($n->name) . "</h3>"; echo "<p class= details>"; echo sprintf(__("%s by %s", "time ago by nickname"), renderTimeAgo($n->created), asHtml($creator->nickname)); if ($comments = $n->getComments()) { echo " / "; echo $PH->getLink('taskViewAsDocu', sprintf(__("%s comments"), count($comments)), array('tsk' => $n->id)); } echo " / "; echo $PH->getLink("commentNew", __("Add comment"), array('parent_task' => $n->id)); echo "</p>"; echo wikifieldAsHtml($n, 'description'); echo "</div>"; } $this->render_blockEnd(); return ''; }
/** * Person View @ingroup pages */ function personView() { global $PH; global $auth; ### get current person ### $id = getOnePassedId('person', 'people_*'); if (!($person = Person::getVisibleById($id))) { $PH->abortWarning("invalid person-id"); return; } ### create from handle ### $PH->defineFromHandle(array('person' => $person->id)); ## is viewed by user ## $person->nowViewedByUser(); $page = new Page(); $page->cur_tab = 'people'; if ($person->can_login) { $page->title = $person->nickname; $page->title_minor = $person->name; } else { $page->title = $person->name; if ($person->category) { global $g_pcategory_names; if (isset($g_pcategory_names[$person->category])) { $page->title_minor = $g_pcategory_names[$person->category]; } } } $page->type = __("Person"); $page->crumbs = build_person_crumbs($person); $page->options = build_person_options($person); ### skip edit functions ### if ($edit = Person::getEditableById($person->id)) { ### page functions ### $page->add_function(new PageFunction(array('target' => 'taskNoteOnPersonNew', 'params' => array('person' => $person->id), 'tooltip' => __('Add task for this people (optionally creating project and effort on the fly)', 'Tooltip for page function'), 'name' => __('Add note', 'Page function person')))); #$page->add_function(new PageFunction(array( #'target' =>'personLinkCompanies', #'params' =>array('person'=>$person->id), #'tooltip' =>__('Add existing companies to this person'), #'name' =>__('Companies'), #))); $page->add_function(new PageFunction(array('target' => 'personEdit', 'params' => array('person' => $person->id), 'icon' => 'edit', 'tooltip' => __('Edit this person', 'Tooltip for page function'), 'name' => __('Edit', 'Page function edit person')))); $page->add_function(new PageFunction(array('target' => 'personEditRights', 'params' => array('person' => $person->id), 'icon' => 'edit', 'tooltip' => __('Edit user rights', 'Tooltip for page function'), 'name' => __('Edit rights', 'Page function for edit user rights')))); if ($person->id != $auth->cur_user->id) { $page->add_function(new PageFunction(array('target' => 'personDelete', 'params' => array('person' => $person->id), 'name' => __('Delete')))); } $item = ItemPerson::getAll(array('person' => $auth->cur_user->id, 'item' => $person->id)); if (!$item || $item[0]->is_bookmark == 0) { #$page->add_function(new PageFunction(array( # 'target' =>'itemsAsBookmark', # 'params' =>array('person'=>$person->id), # 'tooltip' =>__('Mark this person as bookmark'), # 'name' =>__('Bookmark'), #))); } else { $page->add_function(new PageFunction(array('target' => 'itemsRemoveBookmark', 'params' => array('person' => $person->id), 'tooltip' => __('Remove this bookmark'), 'name' => __('Remove Bookmark')))); } if ($person->state == ITEM_STATE_OK && $person->can_login && ($person->personal_email || $person->office_email)) { $page->add_function(new PageFunction(array('target' => 'personSendActivation', 'params' => array('person' => $person->id)))); $page->add_function(new PageFunction(array('target' => 'peopleFlushNotifications', 'params' => array('person' => $person->id)))); } } ### render title ### echo new PageHeader(); echo new PageContentOpen_Columns(); ### write info block (but only for registed users) global $auth; if ($auth->cur_user->id != confGet('ANONYMOUS_USER')) { $block = new PageBlock(array('title' => __('Summary', 'Block title'), 'id' => 'summary')); $block->render_blockStart(); echo "<div class=text>"; if ($person->mobile_phone) { echo "<div class=labeled><label>" . __('Mobile', 'Label mobilephone of person') . '</label>' . asHtml($person->mobile_phone) . '</div>'; } if ($person->office_phone) { echo "<div class=labeled><label>" . __('Office', 'label for person') . '</label>' . asHtml($person->office_phone) . '</div>'; } if ($person->personal_phone) { echo "<div class=labeled><label>" . __('Private', 'label for person') . '</label>' . asHtml($person->personal_phone) . '</div>'; } if ($person->office_fax) { echo "<div class=labeled><label>" . __('Fax (office)', 'label for person') . '</label>' . asHtml($person->office_fax) . '</div>'; } if ($person->office_homepage) { echo "<div class=labeled><label>" . __('Website', 'label for person') . '</label>' . url2linkExtern($person->office_homepage) . '</div>'; } if ($person->personal_homepage) { echo "<div class=labeled><label>" . __('Personal', 'label for person') . '</label>' . url2linkExtern($person->personal_homepage) . '</div>'; } if ($person->office_email) { echo "<div class=labeled><label>" . __('E-Mail', 'label for person office email') . '</label>' . url2linkMail($person->office_email) . '</div>'; } if ($person->personal_email) { echo "<div class=labeled><label>" . __('E-Mail', 'label for person personal email') . '</label>' . url2linkMail($person->personal_email) . '</div>'; } if ($person->personal_street) { echo "<div class=labeled><label>" . __('Adress Personal', 'Label') . '</label>' . asHtml($person->personal_street) . '</div>'; } if ($person->personal_zipcode) { echo '<div class=labeled><label></label>' . asHtml($person->personal_zipcode) . '</div>'; } if ($person->office_street) { echo "<div class=labeled><label>" . __('Adress Office', 'Label') . '</label>' . asHtml($person->office_street) . '</div>'; } if ($person->office_zipcode) { echo "<div class=labeled><label></label>" . asHtml($person->office_zipcode) . '</div>'; } if ($person->birthdate && $person->birthdate != "0000-00-00") { echo "<div class=labeled><label>" . __('Birthdate', 'Label') . "</label>" . renderDateHtml($person->birthdate) . "</div>"; } if ($person->last_login) { echo "<div class=labeled><label>" . __('Last login', 'Label') . '</label>' . renderDateHtml($person->last_login) . '</div>'; } ### functions #### echo "</div>"; $block->render_blockEnd(); } require_once confGet('DIR_STREBER') . 'lists/list_companies.inc.php'; $companies = $person->getCompanies(); $list = new ListBlock_companies(); $list->title = __('works for', 'List title'); unset($list->columns['short']); unset($list->columns['homepage']); unset($list->columns['people']); unset($list->functions['companyDelete']); #unset($list->functions['companyNew']); /** * \todo We should provide a list-function to link more * people to this company. But therefore we would need to * pass the company's id, which is not possible right now... */ $list->add_function(new ListFunction(array('target' => $PH->getPage('personLinkCompanies')->id, 'name' => __('Link Companies'), 'id' => 'personLinkCompanies', 'icon' => 'add'))); $list->add_function(new ListFunction(array('target' => $PH->getPage('personCompaniesDelete')->id, 'name' => __('Remove companies from person'), 'id' => 'personCompaniesDelete', 'icon' => 'sub', 'context_menu' => 'submit'))); if ($auth->cur_user->user_rights & RIGHT_PERSON_EDIT) { $list->no_items_html = $PH->getLink('personLinkCompanies', __('link existing Company'), array('person' => $person->id)) . " " . __("or") . " " . $PH->getLink('companyNew', __('create new'), array('person' => $person->id)); } else { $list->no_items_html = __("no companies related"); } #$list->no_items_html=__("no company"); $list->render_list($companies); echo new PageContentNextCol(); #--- description ---------------------------------------------------------------- if ($person->description != "") { $block = new PageBlock(array('title' => __('Person details'), 'id' => 'persondetails')); $block->render_blockStart(); echo "<div class=text>"; echo wikifieldAsHtml($person, 'description'); echo "</div>"; $block->render_blockEnd(); } /** * \Note: passing colum to person->getProject is not simple... * the sql-querry currently just querry project-people, which do not contain anything usefull * Possible solutions: * - rewrite the querry-string * - rewrite all order-keys to something like company.name */ $order_by = get('sort_' . $PH->cur_page->id . "_projects"); require_once confGet('DIR_STREBER') . 'lists/list_projects.inc.php'; $projects = $person->getProjects($order_by); if ($projects || $person->can_login) { $list = new ListBlock_projects(); $list->title = __('works in Projects', 'list title for person projects'); $list->id = "works_in_projects"; unset($list->columns['date_closed']); unset($list->columns['date_start']); unset($list->columns['tasks']); unset($list->columns['efforts']); unset($list->functions['projDelete']); unset($list->functions['projNew']); if ($auth->cur_user->user_rights & RIGHT_PROJECT_CREATE) { $list->no_items_html = $PH->getLink('projNew', '', array()); } else { $list->no_items_html = __("no active projects"); } $list->render_list($projects); } require_once confGet('DIR_STREBER') . 'lists/list_tasks.inc.php'; $list = new ListBlock_tasks(array('active_block_function' => 'list')); $list->query_options['assigned_to_person'] = $person->id; unset($list->columns['created_by']); unset($list->columns['planned_start']); unset($list->columns['assigned_to']); $list->title = __('Assigned tasks'); $list->no_items_html = __('No open tasks assigned'); if (isset($list->block_functions['tree'])) { unset($list->block_functions['tree']); $list->block_functions['grouped']->default = true; } $list->print_automatic(); ### add company-id ### # note: some pageFunctions like personNew can use this for automatical linking # echo "<input type='hidden' name='person' value='{$person->id}'>"; #echo "<a href=\"javascript:document.my_form.go.value='tasksMoveToFolder';document.my_form.submit();\">move to task-folder</a>"; echo new PageContentClose(); echo new PageHtmlEnd(); }
public function __toString() { global $PH; global $auth; #--- news ----------------------------------------------------------- $comments = $this->item_with_comments->getComments(array('order_by' => 'created')); $block = new PageBlock(array('title' => sprintf(__("%s Comments"), count($comments) ? count($comments) : __("No", "As in... >No< Comments")), 'id' => 'news')); $block->render_blockStart(); $count = 0; foreach ($comments as $c) { ### own comment $is_comment_editable = $auth->cur_user->user_rights & RIGHT_EDITALL || $c->created_by == $auth->cur_user->id; if (!($creator = Person::getVisibleById($c->created_by))) { continue; } echo "<div class='post_list_entry'>"; echo "<h3>"; if ($c->created_by == $auth->cur_user->id) { echo $creator->nickname; } else { echo $creator->getLink(); } echo "<span class=separator>:</span>"; echo asHtml($c->name); if ($new = $c->isChangedForUser()) { if ($new == 1) { echo '<span class=new> (' . __('New') . ') </span>'; } else { echo '<span class=new> (' . __('Updated') . ') </span>'; } } echo "</h3>"; echo "<p class= details>"; echo renderTimeAgo($c->created); require_once confGet('DIR_STREBER') . "db/db_itemchange.inc.php"; $versions = ItemVersion::getFromItem($c); if (count($versions) > 1) { echo " (" . $PH->getLink('itemViewDiff', sprintf(__("%s. update", "like in... Nth update"), count($versions)), array('item' => $c->id)); echo " " . renderTimeAgo($c->modified); echo ") "; } if ($c->pub_level != PUB_LEVEL_OPEN) { echo ' - ' . sprintf(__("visible as %s"), renderPubLevelName($c->pub_level)); ### publish ### if (($parent_task = Task::getEditableById($c->task)) && $c->pub_level < PUB_LEVEL_OPEN) { echo " - " . $PH->getLink('itemsSetPubLevel', __('Publish'), array('item' => $c->id, 'item_pub_level' => PUB_LEVEL_OPEN)); } } ### delete if ($is_comment_editable) { echo " - " . $PH->getLink('commentsDelete', __('Delete'), array('comment' => $c->id)); } echo "</p>"; if ($is_comment_editable) { echo wikifieldAsHtml($c, 'description'); } else { echo wikifieldAsHtml($c, 'description', array('editable' => false)); } echo "</div>"; $c->nowViewedByUser(); } $this->render_blockEnd(); return ''; }
function render_tr(&$obj, $style = "") { global $PH; if (!isset($obj) || !$obj instanceof Comment) { trigger_error("ListBlock->render_tr() called without valid object", E_USER_WARNING); return; } global $auth; if ($obj->created_by == $auth->cur_user->id) { $column_text = '<td class="comment_text by_cur_user">'; } else { $column_text = "<td class=comment_text>"; } $column_text .= "<div class=comment_block style='padding-left:" . $obj->level * 2.0 . "em'>"; if ($obj->view_collapsed) { $column_text .= $PH->getLink('commentToggleViewCollapsed', "<img src=\"" . getThemeFile("img/toggle_folder_closed.gif") . "\">", array('comment' => $obj->id), NULL, true); $column_text .= "<span class=title>" . $PH->getLink('commentView', $obj->name, array('comment' => $obj->id)) . "</span>"; if ($obj->num_children) { $column_text .= "<span class=children> ("; if ($obj->num_children == 1) { $column_text .= __("1 sub comment"); } else { $column_text .= printf(__("%s sub comments"), $obj->num_children); } $column_text .= ")</span>"; } } else { $column_text .= $PH->getLink('commentToggleViewCollapsed', "<img src=\"" . getThemeFile("img/toggle_folder_open.gif") . "\">", array('comment' => $obj->id), NULL, true); $column_text .= "<span class=title>" . $PH->getLink('commentView', $obj->name, array('comment' => $obj->id)) . "</span>"; require_once confGet('DIR_STREBER') . 'render/render_wiki.inc.php'; $project = Project::getVisibleById($obj->project); $obj->nowViewedByUser(); ### editable? ### $editable = false; if ($obj->created_by == $auth->cur_user->id) { #if($pp= $obj->getProjectPerson()) { # if($pp->level_edit < $obj->pub_level) { $editable = true; # } #} } $diz = wikifieldAsHtml($obj, 'description'); if ($diz) { $column_text .= "<div class=comment_text>{$diz}</div>"; } } $column_text .= "</div>"; $column_text .= "</td>"; print $column_text; }
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(); }
function render_tr(&$task, $style = "") { global $PH; global $g_resolve_reason_names; if (!isset($task) || !is_object($task)) { trigger_error("ListBlock->render_tr() called without valid object", E_USER_WARNING); return; } $buffer = ''; ### collapsed view ### $html_link = '<b>' . $task->getLink(false, false) . '</b>'; if ($task->view_collapsed) { $buffer .= $PH->getLink('taskToggleViewCollapsed', "<img src=\"" . getThemeFile("img/toggle_folder_closed.gif") . "\">", array('tsk' => $task->id), NULL, true) . $html_link; } else { $buffer .= $PH->getLink('taskToggleViewCollapsed', "<img src=\"" . getThemeFile("img/toggle_folder_open.gif") . "\">", array('tsk' => $task->id), NULL, true) . $html_link . '<br>'; $editable = false; if (Task::getEditableById($task->id)) { $editable = true; } $buffer .= "<div class=description>"; $buffer .= wikifieldAsHtml($task, 'description'); $buffer .= "</div>"; } echo '<td>' . $buffer . '</td>'; }
/** * 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(); }
/** * render completely (overwrites original ListBlock::render()) */ public function renderListHtml(&$tasks = NULL) { global $PH; require_once confGet('DIR_STREBER') . 'render/render_wiki.inc.php'; $this->render_header(); if ($this->groupings) { $this->groupings->getActiveFromCookie(); } /** * for rendering undefined wiki-links we need to know the * project of each task. This is used for caching: */ $last_project_id = 0; $project = NULL; /** * @@@ dummy rending of filters. Should later be placed at ListBlock() */ /*if($this->filters) { echo '<span class=filters>Filters:'; foreach($this->filters as $f) { echo '<span class=filter>'.$f->render().'</span> '; } echo '</span>'; } */ $style = ''; if (!$tasks && $this->no_items_html) { $this->render_tfoot_empty(); } else { ### render table lines ### $this->render_thead(); $count_estimated = 0; $last_group = NULL; foreach ($tasks as $t) { ### grouped style ### if ($this->groupings && $this->active_block_function == 'grouped') { $gr = $this->groupings->active_grouping_key; if ($t->project != $last_project_id) { $project = Project::getVisibleById($t->project); $last_project_id = $t->project; } if ($gr == 'parent_task') { if ($t->category == TCATEGORY_FOLDER) { echo '<tr class=group><td colspan=' . count($this->columns) . '>'; #. $this->groupings->active_grouping_obj->render($t) ### toggle ### $description = ''; if ($t->view_collapsed) { $toggle = $PH->getLink('taskToggleViewCollapsed', '<img src="' . getThemeFile("img/toggle_folder_closed.gif") . '">', array('tsk' => $t->id), 'folder_collapsed', true); ### number of subtasks with folded ### $description = '<span class=diz>( ' . sprintf(__('%s hidden'), $t->getNumSubtasks()) . ')</span>'; } else { $toggle = $PH->getLink('taskToggleViewCollapsed', '<img src="' . getThemeFile("img/toggle_folder_open.gif") . '">', array('tsk' => $t->id), 'folder_open', true); } echo $toggle; if ($parents = $t->getFolderLinks(false)) { echo $parents . '<em>></em>'; } echo $t->getLink(); echo $description; echo '</td></tr>'; continue; } } else { if ($last_group != $t->{$gr}) { echo '<tr class=group><td colspan=' . count($this->columns) . '>' . $this->groupings->active_grouping_obj->render($t) . '</td></tr>'; $last_group = $t->{$gr}; } } } $style = $t->category == TCATEGORY_FOLDER ? ' isFolder' : ''; ### done ### if (@intval($t->status) >= STATUS_COMPLETED) { $style .= ' isDone'; } else { $count_estimated += $t->estimated; } $this->render_trow($t, $style); ### render additional information ### if ($this->groupings && $this->active_block_function == 'grouped') { echo '<tr class=details><td colspan=' . count($this->columns) . '>'; $html_buffer = ''; if ($t->issue_report) { $ir = Issue::getById($t->issue_report); } else { $ir = NULL; } global $g_severity_names; global $g_reproducibility_names; global $g_prio_names; global $g_status_names; #if($t->prio != PRIO_NORMAL && isset($g_prio_names[$t->prio])) { # echo "<p>".$g_prio_names[$t->prio]."</p>"; #} if ($ir && $ir->severity && isset($g_severity_names[$ir->severity])) { $html_buffer .= "<p>" . $g_severity_names[$ir->severity] . "</p>"; } if ($ir && $ir->version) { $html_buffer .= "<p>" . $ir->version . "</p>"; } if ($ir && $ir->production_build) { $html_buffer .= "<p>" . $ir->production_build . "</p>"; } if ($ir && $ir->reproducibility && isset($g_reproducibility_names[$ir->reproducibility])) { $html_buffer .= "<p>" . $g_reproducibility_names[$ir->reproducibility] . "</p>"; } if ($t->status != STATUS_OPEN && $t->status != STATUS_NEW && isset($g_status_names[$t->status])) { $html_buffer .= "<p>" . $g_status_names[$t->status] . "</p>"; } echo '<div class=severity>'; if ($html_buffer) { echo $html_buffer; } else { echo ' '; # dummy content to keep floating } echo '</div>'; echo '<div class=description> '; if ($t->description) { echo "<p>" . wikifieldAsHtml($t, 'description') . "</p>"; } ### steps ### if ($ir && isset($ir->steps_to_reproduce) && $ir->steps_to_reproduce) { echo "<p>" . wikifieldAsHtml($ir, 'steps_to_reproduce') . "</p>"; } if ($ir && isset($ir->expected_result) && $ir->expected_result) { echo "<p>" . wikifieldAsHtml($ir, 'expected_result') . "</p>"; } if ($ir && isset($ir->suggested_solution) && $ir->suggested_solution) { echo "<p>" . wikifieldAsHtml($ir, 'suggested_solution') . "</p>"; } echo ' </div>'; echo '<div class=steps>'; if ($c = $t->getLatestComment()) { echo "<p>" . __('Latest Comment') . " "; if ($person = Person::getVisibleById($c->created_by)) { echo __("by") . ' ' . $person->getLink(); } echo " (" . renderDateHtml($c->modified) . "):"; echo "</p>"; if ($c->name) { echo '<p>' . asHtml($c->name) . '</p>'; } if ($c->description) { #echo "<p>". wikifieldAsHtml($c->description, $project). "</p>"; echo "<p>" . wikifieldAsHtml($c, "description") . "</p>"; } } echo ' </div>'; echo '<div class=assigned_to>'; $people = $t->getAssignedPeople(); if ($people) { $sep = ''; echo "<p>" . __('for') . " "; foreach ($people as $p) { echo $sep . $p->getLink(); $sep = ', '; } echo "</p>"; } echo '</div>'; echo '</td></tr>'; } } #$this->render_trow($t); if ($this->show_summary) { $this->summary = sprintf(__("%s open tasks / %s h"), count($tasks), $count_estimated); } else { $this->summary = ''; } $this->render_tfoot(); $this->render_blockEnd(); } }
function render_tr(&$file, $style = "") { global $PH; if (!isset($file) || !$file instanceof File) { return; } require_once confGet('DIR_STREBER') . 'render/render_wiki.inc.php'; $buffer = '<b>'; $buffer .= $PH->getLink('fileDownload', $file->name, array('file' => $file->id)); $buffer .= '</b>' . '<br />'; ### name ### #$buffer = '<b>' # . $PH->getLink('fileView',$file->name, array('file'=>$file->id),'item file') # .'</b>' # . '<br>'; ### parent task ### $diz_buffer = ""; if ($file->parent_item && ($item = DbProjectItem::getVisibleById($file->parent_item))) { if ($item->type == ITEM_TASK) { if ($task = Task::getVisibleById($file->parent_item)) { $tmp = $task->getFolderLinks(); if ($tmp) { $tmp = $tmp . ">"; } $diz_buffer .= __("in", "... folder") . ": " . $tmp . $task->getLink(false) . "<br/>"; } } } ### details ### $diz_buffer .= $file->filesize . " bytes" . ' / ' . asHtml($file->mimetype) . ' / ' . sprintf(__("ID %s"), $file->id) . ' / ' . "<span class=sub>" . $PH->getLink('fileView', __('Show Details'), array('file' => $file->id)) . "</span>" . "<br/>"; ### description ### $diz_buffer .= wikifieldAsHtml($file, 'description'); if ($diz_buffer) { $buffer .= '<span class=sub>' . $diz_buffer . "</span>"; } echo '<td>' . $buffer . '</td>'; #$str= $PH->getLink('fileView',$obj->name, array('file'=>$obj->id),'item file'); #print "<td>$str</td>"; }
/** * Edit several efforts @ingroup pages */ function effortViewMultiple() { global $PH; global $auth; require_once confGet('DIR_STREBER') . 'render/render_wiki.inc.php'; ### get effort #### $ids = getPassedIds('effort', 'efforts_*'); if (!$ids) { $PH->abortWarning(__("Select one or more efforts")); return; } $number = 0; $sum = 0; $count = 0; foreach ($ids as $id) { if ($e = Effort::getEditableById($id)) { ## array with all efforts ## $e_array[] = $e; ## array with all effort ids (for Effort::getMinMaxTime())## $e_ids[] = $e->id; ## is viewed by user ## $e->nowViewedByUser(); ## number of efforts ## $number++; ## sum of all efforts ## $sum += round((strToGMTime($e->time_end) - strToGMTime($e->time_start)) / 60 / 60, 1); ### check project of first effort if (count($e_array) == 1) { if (!($project = Project::getVisibleById($e->project))) { $PH->abortWarning('could not get project'); } } else { $count = 0; ### check if the efforts are related to the same task ### if ($e->task != $e_array[0]->task) { $count++; } } } else { $PH->abortWarning(__("You do not have enough rights"), ERROR_RIGHTS); } } $page = new Page(); $page->cur_tab = 'projects'; $page->cur_crumb = 'effortViewMultiple'; $page->crumbs = build_project_crumbs($project); $page->options = build_projView_options($project); $type = __('Multiple Efforts', 'page type'); ## same tasks ## if ($count == 0) { $task = $e_array[0]->task ? Task::getVisibleById($e_array[0]->task) : NULL; if ($task) { $folder = $task->getFolderLinks() . "<em>></em>" . $task->getLink(); $page->type = $folder . "<em>></em>" . $type; } else { $page->type = $type; } } else { $page->type = $project->getLink() . "<em>></em>" . $type; } $page->title = __('Multiple Efforts'); $page->title_minor = __('Overview'); ### render title ### echo new PageHeader(); echo new PageContentOpen(); ### summary ### ### title ### echo '<div class="text"><h3>' . __('summary') . "</h3></div>"; ### content ### $block = new PageBlock(array('title' => __('Information'), 'id' => 'info')); $block->render_blockStart(); echo '<div class="text">'; if ($number) { echo "<div class=labeled><label>" . __('Number of efforts', 'label') . "</label>" . asHtml($number) . "</div>"; } if ($sum) { echo "<div class=labeled><label>" . __('Sum of efforts', 'label') . "</label>" . asHtml($sum) . " h</div>"; } $content['e_ids'] = $e_ids; $time = Effort::getMinMaxTime($content); if ($time) { $line = "<div class=labeled><label>" . __('from', 'time label') . "</label>" . renderDateHtml($time[0]) . "</div>"; $line .= "<div class=labeled><label>" . __('to', 'time label') . "</label>" . renderDateHtml($time[1]) . "</div>"; echo $line; } else { echo "<div class=labeled><label>" . __('Time', 'label') . "</label>" . __('not available') . "</div>"; } echo "</div>"; $block->render_blockEnd(); ### start to list efforts ### foreach ($e_array as $effort) { ### title ### echo '<div class="text"><h3>' . asHtml($effort->name) . "</h3></div>"; $block = new PageBlock(array('title' => __('Details'), 'id' => 'details' . $effort->id)); $block->render_blockStart(); echo '<div class="text">'; if ($project) { echo "<div class=labeled><label>" . __('Project', 'label') . "</label>" . $project->getLink(false) . "</div>"; } $task = $effort->task ? Task::getVisibleById($effort->task) : NULL; if ($task) { if ($task->parent_task != 0) { $folder = $task->getFolderLinks(false) . "<em> > </em>" . $task->getLink(false); echo "<div class=labeled><label>" . __('Task', 'label') . "</label>" . $folder . "</div>"; } else { echo "<div class=labeled><label>" . __('Task', 'label') . "</label>" . $task->getLink(false) . "</div>"; } } else { echo "<div class=labeled><label>" . __('Task', 'label') . "</label>" . __('No task related') . "</div>"; } if (!($person = Person::getById($effort->person))) { echo "<div class=labeled><label>" . __('Created by', 'label') . "</label>" . __('not available') . "</div>"; } else { echo "<div class=labeled><label>" . __('Created by', 'label') . "</label>" . $person->getLink() . "</div>"; } if ($effort) { $duration = round((strToGMTime($effort->time_end) - strToGMTime($effort->time_start)) / 60 / 60, 1) . " h"; if ($effort->as_duration) { echo "<div class=labeled><label>" . __('Created at', 'label') . "</label>" . renderDateHtml($effort->time_start) . "</div>"; echo "<div class=labeled><label>" . __('Duration', 'label') . "</label>" . asHtml($duration) . "</div>"; } else { echo "<div class=labeled><label>" . __('Time start', 'label') . "</label>" . renderTimestampHtml($effort->time_start) . "</div>"; echo "<div class=labeled><label>" . __('Time end', 'label') . "</label>" . renderTimestampHtml($effort->time_end) . "</div>"; echo "<div class=labeled><label>" . __('Duration', 'label') . "</label>" . asHtml($duration) . "</div>"; } } echo "</div>"; $block->render_blockEnd(); $block = new PageBlock(array('title' => __('Description'), 'id' => 'description' . $effort->id)); $block->render_blockStart(); if ($effort->description != "") { echo '<div class="text">'; echo wikifieldAsHtml($effort, 'description'); ### update task if relative links have been converted to ids ### if (checkAutoWikiAdjustments()) { $effort->description = applyAutoWikiAdjustments($effort->description); $effort->update(array('description'), false); } echo "</div>"; } else { if ($auth->cur_user->user_rights & RIGHT_PROJECT_ASSIGN) { echo '<div class="empty">' . $PH->getLink('effortEdit', '', array('effort' => $effort->id)) . "</div>"; } else { echo '<div class="text">' . __('No description available') . "</div>"; } } $block->render_blockEnd(); } echo new PageContentClose(); echo new PageHtmlEnd(); }
/** * View a company * * @ingroup pages */ function companyView() { global $PH; global $auth; require_once confGet('DIR_STREBER') . 'render/render_wiki.inc.php'; ### get current company ### $id = getOnePassedId('company', 'companies_*'); $company = Company::getVisibleById($id); if (!$company) { $PH->abortWarning("invalid company-id"); return; } ## is viewed by user ## $company->nowViewedByUser(); $company->validateView(); ### create from handle ### $PH->defineFromHandle(array('company' => $company->id)); $page = new Page(); $page->cur_tab = 'companies'; $page->title = $company->name; $page->title_minor = __("Overview"); $page->type = __("Company"); ### breadcrumbs ### $page->crumbs = build_company_crumbs($company); ### page functions ### $page->add_function(new PageFunctionGroup(array('name' => __('edit')))); $page->add_function(new PageFunction(array('target' => 'companyEdit', 'params' => array('company' => $company->id), 'icon' => 'edit', 'tooltip' => __('Edit this company'), 'name' => __('Company')))); $item = ItemPerson::getAll(array('person' => $auth->cur_user->id, 'item' => $company->id)); if (!$item || $item[0]->is_bookmark == 0) { $page->add_function(new PageFunction(array('target' => 'itemsAsBookmark', 'params' => array('company' => $company->id), 'tooltip' => __('Mark this company as bookmark'), 'name' => __('Bookmark')))); } else { $page->add_function(new PageFunction(array('target' => 'itemsRemoveBookmark', 'params' => array('company' => $company->id), 'tooltip' => __('Remove this bookmark'), 'name' => __('Remove Bookmark')))); } if ($company->state == 1) { $page->add_function(new PageFunction(array('target' => 'companyDelete', 'params' => array('company' => $company->id), 'icon' => 'delete', 'tooltip' => __('Delete this company'), 'name' => __('Delete')))); } $page->add_function(new PageFunctionGroup(array('name' => __('new')))); $page->add_function(new PageFunction(array('target' => 'personNew', 'params' => array('company' => $company->id), 'icon' => 'new', 'tooltip' => __('Create new person for this company'), 'name' => __('Person')))); $page->add_function(new PageFunction(array('target' => 'projNew', 'params' => array('company' => $company->id), 'icon' => 'new', 'tooltip' => __('Create new project for this company'), 'name' => __('Project')))); $page->add_function(new PageFunction(array('target' => 'companyLinkPeople', 'params' => array('company' => $company->id), 'icon' => 'add', 'tooltip' => __('Add existing people to this company'), 'name' => __('People')))); ### render title ### echo new PageHeader(); echo new PageContentOpen_Columns(); $block = new PageBlock(array('title' => __('Summary'), 'id' => 'summary')); $block->render_blockStart(); echo "<div class=text>"; if ($company->comments) { echo wikifieldAsHtml($company, 'comments'); } if ($company->street) { echo '<div class=labeled><label>' . __('Adress') . ':</label>' . asHtml($company->street) . '</div>'; } if ($company->zipcode) { echo '<div class=labeled><label></label>' . asHtml($company->zipcode) . '</div>'; } if ($company->phone) { echo '<div class=labeled><label>' . __('Phone') . ':</label>' . asHtml($company->phone) . '</div>'; } if ($company->fax) { echo '<div class=labeled><label>' . __('Fax') . ':</label>' . asHtml($company->fax) . '</div>'; } if ($company->homepage) { echo '<div class=labeled><label>' . __('Web') . ':</label>' . url2linkExtern($company->homepage) . '</div>'; } if ($company->intranet) { echo '<div class=labeled><label>' . __('Intra') . ':</label>' . url2linkExtern($company->intranet) . '</div>'; } if ($company->email) { echo '<div class=labeled><label>' . __('Mail') . ':</label>' . url2linkMail($company->email) . '</div>'; } $sum = 0; foreach ($company->getProjects() as $p) { $sum += $p->getOpenEffortsSum(); } if ($sum > 0) { echo "<div class=text>"; echo '<div class=labeled><label>' . __('Open efforts') . ':</label>' . round($sum / 60 / 60, 1) . 'h</div>'; echo "</div>"; } echo "</div>"; $block->render_blockEnd(); require_once confGet('DIR_STREBER') . 'pages/person.inc.php'; $list = new ListBlock_people(); $people = $company->getPeople(); $list->title = __('related People'); $list->id = "related_people"; unset($list->columns['tagline']); unset($list->columns['nickname']); unset($list->columns['profile']); unset($list->columns['projects']); unset($list->columns['personal_phone']); unset($list->columns['office_phone']); unset($list->columns['companies']); unset($list->columns['changes']); unset($list->columns['last_login']); unset($list->functions['personDelete']); unset($list->functions['personEditRights']); /** * \NOTE We should provide a list-function to link more * people to this company. But therefore we would need to * pass the company's id, which is not possible right now... */ $list->add_function(new ListFunction(array('target' => $PH->getPage('companyLinkPeople')->id, 'name' => __('Link People'), 'id' => 'companyLinkPeople', 'icon' => 'add'))); $list->add_function(new ListFunction(array('target' => $PH->getPage('companyPeopleDelete')->id, 'name' => __('Remove person from company'), 'id' => 'companyPeopleDelete', 'icon' => 'sub', 'context_menu' => 'submit'))); if ($auth->cur_user->user_rights & RIGHT_COMPANY_EDIT) { $list->no_items_html = $PH->getLink('companyLinkPeople', __('link existing Person'), array('company' => $company->id)) . " " . __("or") . " " . $PH->getLink('personNew', __('create new'), array('company' => $company->id)); } else { $list->no_items_html = __("no people related"); } $list->render_list($people); //$list->print_automatic($people); echo new PageContentNextCol(); require_once confGet('DIR_STREBER') . 'lists/list_projects.inc.php'; $order_by = get('sort_' . $PH->cur_page->id . "_projects"); $list = new ListBlock_projects(); $list->title = __("Active projects"); $list->id = "active_projects"; $list->groupings = NULL; $list->block_functions = NULL; unset($list->columns['company']); unset($list->functions['projNew']); unset($list->functions['projDelete']); $list->query_options['status_min'] = STATUS_UPCOMING; $list->query_options['status_max'] = STATUS_OPEN; $list->query_options['company'] = $company->id; if ($auth->cur_user->user_rights & RIGHT_PROJECT_CREATE) { $list->no_items_html = $PH->getLink('projNew', __('Create new project'), array('company' => $company->id)) . " " . __(" Hint: for already existing projects please edit those and adjust company-setting."); } else { $list->no_items_html = __("no projects yet"); } $list->print_automatic(); $list = new ListBlock_projects(); $list->groupings = NULL; $list->block_functions = NULL; $list->title = __("Closed projects"); $list->id = "closed_projects"; unset($list->columns['company']); unset($list->functions['projNew']); unset($list->functions['projDelete']); $list->query_options['status_min'] = STATUS_BLOCKED; $list->query_options['status_max'] = STATUS_CLOSED; $list->query_options['company'] = $company->id; $list->print_automatic(); ### add company-id ### # note: some pageFunctions like personNew can use this for automatical linking echo "<input type=hidden name=company value='{$company->id}'>"; 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(); }