function render_tr(&$obj, $style = "") { if (!isset($obj) || !is_object($obj)) { trigger_error("ListBlock->render_tr() called without valid object", E_USER_WARNING); return; } $key = $this->key; $format = $this->format; $rest = $this->format; $style = $this->style ? "class='{$this->style}'" : ''; while (preg_match("/\\{\\?([a-z_]*)\\}(.*)/", $rest, $matches)) { $key = $matches[1]; $rest = $matches[2]; $value = isset($obj->{$key}) ? $obj->{$key} : "??{$key}"; $format = preg_replace("/\\{\\?{$key}\\}/", asHtml($value), $format); } print "<td {$style}>" . $format . '</td>'; }
/** * 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(); }
/** * writes a changeline as html * * */ function printChangeLine($c) { global $PH; global $auth; if ($c->person_by == $auth->cur_user->id) { $changed_by_current_user = true; } else { $changed_by_current_user = false; } if ($c->item->type == ITEM_TASK) { if ($changed_by_current_user) { echo '<li class=by_cur_user>'; } else { echo '<li>'; } echo $c->item->getLink(false); } elseif ($c->item->type == ITEM_FILE) { echo '<li>' . $PH->getLink('fileView', $c->item->name, array('file' => $c->item->id)); } else { trigger_error('printChangeLine() for unknown item item', E_USER_WARNING); return; } /** * remarks on new, updated or item that require feedback */ if ($c->item) { if ($c->item->isFeedbackRequestedForUser()) { echo '<span class=new> (' . __('Needs feedback') . ') </span>'; } elseif ($new = $c->item->isChangedForUser()) { if ($new == 1) { echo '<span class=new> (' . __('New') . ') </span>'; } else { echo '<span class=new> (' . __('Updated') . ') </span>'; } } } echo "<span class=sub>{$c->txt_what}"; if ($person = Person::getVisibleById($c->person_by)) { echo ' ' . __('by') . ' <span class=person>' . asHtml($person->name) . "</span>"; } echo ' ' . renderTimeAgo($c->timestamp); echo "</span>"; echo '</li>'; return; }
/** * move comments to folder... */ function commentsMoveToFolder() { global $PH; $comment_ids = getPassedIds('comment', 'comments_*'); if (!$comment_ids) { $PH->abortWarning(__("Select some comments to move")); return; } /** * if folder was given, directly move tasks... */ $target_id = -1; # target is unknown $folder_ids = getPassedIds('folder', 'folders_*'); if (count($folder_ids) == 1) { if ($folder_task = Task::getVisibleById($folder_ids[0])) { $target_id = $folder_task->id; } } else { if (get('from_selection')) { $target_id = 0; # to ungrout to root? } } if ($target_id != -1) { if ($target_id != 0) { if (!($target_task = Task::getEditableById($target_id))) { $PH->abortWarning(__("insufficient rights")); } } $count = 0; foreach ($comment_ids as $id) { if ($comment = Comment::getEditableById($id)) { $comment->task = $target_id; /** * @@@ do we have to reset ->comment as well? * * this splits discussions into separate comments... */ $comment->comment = 0; $comment->update(); } else { new FeedbackWarning(sprintf(__("Can not edit comment %s"), asHtml($comment->name))); } } ### return to from-page? ### if (!$PH->showFromPage()) { $PH->show('home'); } exit; } /** * build page folder list to select target... */ require_once confGet('DIR_STREBER') . 'lists/list_tasks.inc.php'; ### get project #### if (!($comment = Comment::getVisibleById($comment_ids[0]))) { $PH->abortWarning("could not get comment", ERROR_BUG); } if (!($project = Project::getVisibleById($comment->project))) { $PH->abortWarning("task without project?", ERROR_BUG); } $page = new Page(array('use_jscalendar' => false, 'autofocus_field' => 'company_name')); $page->cur_tab = 'projects'; $page->type = __("Edit tasks"); $page->title = $project->name; $page->title_minor = __("Select one folder to move comments into"); $page->crumbs = build_project_crumbs($project); $page->options[] = new NaviOption(array('target_id' => 'commentsMoveToFolder')); echo new PageHeader(); echo new PageContentOpen(); echo __("... or select nothing to move to project root"); ### write selected comments as hidden fields ### foreach ($comment_ids as $id) { if ($comment = Comment::getEditableById($id)) { echo "<input type=hidden name='comments_{$id}_chk' value='1'>"; } } $list = new ListBlock_tasks(); $list->reduced_header = true; $list->query_options['show_folders'] = true; $list->query_options['folders_only'] = true; $list->query_options['project'] = $project->id; $list->groupings = NULL; $list->block_functions = NULL; $list->id = 'folders'; unset($list->columns['project']); unset($list->columns['status']); unset($list->columns['date_start']); unset($list->columns['days_left']); unset($list->columns['created_by']); unset($list->columns['label']); $list->no_items_html = __("No folders in this project..."); $list->functions = array(); $list->active_block_function = 'tree'; $list->print_automatic($project); echo "<input type=hidden name='from_selection' value='1'>"; # keep flag to ungroup comments echo "<input type=hidden name='project' value='{$project->id}'>"; $button_name = __("Move items"); echo "<input class=button2 type=submit value='{$button_name}'>"; $PH->go_submit = 'commentsMoveToFolder'; echo new PageContentClose(); echo new PageHtmlEnd(); }
protected function _render_commentField() { global $PH; echo "<div class=footer_form>"; require_once confGet('DIR_STREBER') . "render/render_form.inc.php"; $project = new Project($this->item_with_comments->project); $form = new PageForm(); $form->button_cancel = false; $form->add(new Form_CustomHTML('<h3>' . __("Add Comment") . "</h3>")); ### Comment ### $comment_name = ''; $comment = new Comment(array('id' => 0, 'name' => $comment_name)); $e = $comment->fields['description']->getFormElement($comment, __('Comment')); $e->rows = 8; $form->add($e); $form->add($comment->fields['name']->getFormElement($comment, __('Summary'))); ### request feedback $form->add(buildRequestFeedbackInput($project)); /** * to reduce spam, enforce captcha test for guests */ global $auth; if ($auth->cur_user->id == confGet('ANONYMOUS_USER')) { $form->addCaptcha(); } ### some required hidden fields for correct data passing ### $form->add(new Form_HiddenField('comment_task', '', $this->item_with_comments->id)); $form->add(new Form_HiddenField('comment', '', 0)); if ($return = get('return')) { $form->add(new Form_HiddenField('return', '', asHtml($return))); } $PH->go_submit = 'commentEditSubmit'; echo $form; echo "</div>"; }
public function getLink($short_name = true, $strikeDone = true) { $style_isdone = $this->isOfCategory(array(TCATEGORY_TASK, TCATEGORY_BUG)) && ($strikeDone && $this->status >= STATUS_COMPLETED) ? 'isDone' : ''; global $PH; if ($short_name) { return '<span title="' . asHtml($this->name) . '" class="item task">' . $PH->getLink('taskView', $this->getShort(), array('tsk' => $this->id), $style_isdone) . '</span>'; } else { return $PH->getLink('taskView', $this->name, array('tsk' => $this->id), $style_isdone); } }
function getServerVar($name, $as_html = false) { if (isset($_SERVER[$name])) { if ($as_html) { return asHtml($_SERVER[$name]); } return $_SERVER[$name]; } }
public function __toString() { $buffer = ""; $buffer .= '<div id="headline">'; if ($this->page->type) { $buffer .= '<div class="type">' . $this->page->type . '</div>'; } $buffer .= '<h1 class="title">' . asHtml($this->page->title); if ($this->page->title_minor_html) { $buffer .= '<span class="minor"><span class="separator">/</span>' . $this->page->title_minor_html . '</span>'; } else { if ($this->page->title_minor) { $buffer .= '<span class="minor"><span class="separator">/</span>' . asHtml($this->page->title_minor) . '</span>'; } } $buffer .= "</h1>"; $buffer .= "</div>"; return $buffer; }
/** * Activate account from notification mail @ingroup pages */ function activateAccount() { global $auth; global $PH; $auth->removeUserCookie(); if ($tuid = get('tuid')) { $tuid = asKey($tuid); # clean string if ($user = $auth->setCurUserByIdentifier($tuid)) { $auth->storeUserCookie(); $PH->messages[] = sprintf(__("Welcome %s. Please adjust your profile and insert a good password to activate your account."), asHtml($user->name)); global $g_person_fields; $PH->show('personEdit', array('person' => $user->id)); exit; } } $PH->messages[] = __("Sorry, but this activation code is no longer valid. If you already have an account, you could enter your name and use the <b>forgot password link</b> below."); $PH->show('loginForm'); }
/** * implodes an array of strings into save html output * * - used for rendering differences */ function arrayAsHtml($strings) { $buffer = ''; $sep = ''; foreach ($strings as $s) { $buffer .= $sep . asHtml($s); $sep = '<br>'; } $buffer = str_replace(" ", " ", $buffer); return $buffer; }
public function __toString() { $buffer = "<p " . $this->renderCssClasses() . " {$this->id} {$this->display}><label>{$this->title}</label>"; $buffer .= "<select size=1 name='{$this->name}' id='{$this->name}'>"; foreach ($this->options as $group_title => $group_options) { if ($group_title != NO_OPTION_GROUP) { $buffer .= "<optgroup label='" . asHtml($group_title) . "'>"; } foreach ($group_options as $option_value => $option_name) { $str_selected = $this->value == $option_value ? 'selected=1' : ''; $buffer .= '<option ' . $str_selected . ' label="' . asHtml($option_name) . '" value="' . asHtml($option_value) . '" >' . asHtml($option_name) . '</option>'; } if ($group_title != NO_OPTION_GROUP) { $buffer .= "</optgroup>"; } } $buffer .= "</select></p>"; return $buffer; }
/** * 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; } #$buffer = $PH->getLink('fileView',__("Details"), array('file'=>$file->id),'item file'); $buffer = ''; if ($file->mimetype == 'image/png' || $file->mimetype == 'image/x-png' || $file->mimetype == 'image/jpeg' || $file->mimetype == 'image/pjpeg' || $file->mimetype == 'image/jpg' || $file->mimetype == 'image/gif') { $buffer .= "<a target='blank' href='" . $PH->getUrl('fileDownloadAsImage', array('file' => $file->id)) . "'>"; #$buffer.= "<img class='left' title='".asHtml($file->name)."' alt='".asHtml($file->name)."' src='".$PH->getUrl('fileDownloadAsImage',array('file'=>$file->id,'max_size'=>100))."'>" $buffer .= "<img class='left' title='" . asHtml($file->name) . "' " . " alt='" . asHtml($file->name) . "'" . " src='" . $file->getCachedUrl(100) . "'" . ">"; $buffer .= "</a>"; } print "<td>{$buffer}</td>"; }
public function render_tr(&$obj, $style = "") { global $PH; if (!isset($obj) || !$obj instanceof Company) { return; } $str = $PH->getLink('companyView', asHtml($obj->name), array('company' => $obj->id), 'item company', true); print "<td>{$str}</td>"; }
/** * Show error log @ingroup pages */ function showLog() { global $PH; echo "<pre>"; ### get contents of a file into a string $filename = "_tmp/errors.log.php"; $handle = fopen($filename, "r"); $last_error_time = NULL; $hide_errors = get('hide_errors'); $hide_error_hash = array(); foreach (explode(',', $hide_errors) as $error) { if ($error) { $hide_error_hash[$error] = true; } } if ($hide_error_hash) { echo "hidden:<br>"; foreach ($hide_error_hash as $key => $value) { $list = ''; foreach ($hide_error_hash as $key2 => $value2) { if ($key2 != $key) { $list .= "," . $key2; } } echo "{$key} (" . $PH->getLink('showLog', 'show', array('hide_errors' => $list)); echo ")<br>"; } } echo $PH->getLink('systemInfo', 'back to sysInfo') . " | "; echo $PH->getLink('showLog', 'log', array('showlog' => 1)) . " | "; echo $PH->getLink('showLog', 'errors', array()) . " | "; echo $PH->getLink('showLog', 'newbots', array('newbots' => 1)) . " | "; echo "<hr>"; $count_requests = 0; $count_requests_by_crawlers = 0; $new_bots = array(); while (!feof($handle)) { $line = fgets($handle); #echo asHtml($line) . "<br>"; if (preg_match("/(\\w+) (\\d+)\\s*(.*)/", $line, $matches)) { $cat = $matches[1]; $time = $matches[2]; $rest = $matches[3]; if (get('newbots')) { if ($cat == 'Log') { $count_requests++; if (preg_match("/\\((.*)\\)/", $rest, $matches_bot)) { $agent_string = $matches_bot[1]; ### skip known crawlers. if (!Auth::agentStringMatchesCrawler($agent_string)) { if (preg_match("/bot|crawler|spider/i", $agent_string)) { if (!isset($new_bots[$agent_string])) { $new_bots[$agent_string] = 1; #echo asHtml($agent_string) . "<br>"; } else { $new_bots[$agent_string]++; } } } else { $count_requests_by_crawlers++; } } } } else { if (get('time')) { if ($time && $time == get('time')) { echo asHtml($line); } } else { if ($cat == 'Error') { if (preg_match("/(\\w+):\\s*([^\\:\\s]+)\\s*:\\s*(\\d+)(.*)/", $rest, $matches)) { $type = $matches[1]; $file = trim($matches[2]); $line = $matches[3]; $rest = $matches[4]; if (!isset($hide_error_hash[$file . ':' . $line])) { if ($time != $last_error_time) { echo $PH->getLink('showLog', $time, array('time' => $time)); echo " {$type}: <b>{$file}:{$line}</b> - {$rest} ("; echo $PH->getLink('showLog', __('hide'), array('hide_errors' => $hide_errors . ',' . $file . ':' . $line)); echo ")<br>"; $last_error_time = $time; } } } } else { if (get('showlog')) { echo "{$line}"; } } } } } } fclose($handle); if (get('newbots')) { foreach ($new_bots as $bot => $count) { printf("%6d %s<br>", $count, $bot); } } }
public function getLink($short_name = true) { $style_isdone = $this->status >= EFFORT_STATUS_BALANCED ? 'isDone' : ''; global $PH; if ($short_name) { return '<span title="' . asHtml($this->name) . '" class="item task">' . $PH->getLink('effortView', $this->getShort(), array('effort' => $this->id), $style_isdone) . '</span>'; } else { return '<span class="item task">' . $PH->getLink('effortView', $this->name, array('effort' => $this->id), $style_isdone) . '</span>'; } }
/** * trimmed output with with full name as html-title */ function getShortWithTitle() { if (isset($this->short) && $this->short && $this->short != "") { return "<span title='" . asHtml($this->name) . "'>" . asHtml($this->short) . "</span>"; } $length = confGet('STRING_LENGTH_SHORT'); if (isset($this->name) && $this->name != "") { preg_match("/(.{0,{$length}})(.*)/", asHtml($this->name), $matches); if (!$matches[2]) { return $matches[1]; } return "<span title='" . asHtml($this->name) . "'>" . $matches[1] . "...</span>"; } else { return __("unnamed"); } }
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; } }
protected function getPlaintextBody() { return sprintf(__('Hello %s,', 'notification'), $this->recipient->name) . "\n\n" . sprintf(__('Your account at %s is still active.', 'notification'), "<a href='" . $this->url . "'>" . confGet('SELF_DOMAIN') . "</a>") . "\n" . __('Your login name is', 'notification') . " '" . asHtml($this->recipient->nickname) . "'.\n" . "\n" . __('Please use the following link to update your account settings:') . "\n" . $this->url . "?go=activateAccount&tuid=" . $this->recipient->identifier . "\n" . "\n" . "\n" . " " . __('Thanks for your time', 'notification') . "\n" . " " . __('the management', 'notification') . "\n"; }
static function getChangeLines($query_options) { global $PH; global $auth; fillMissingValues($query_options, array('alive_only' => false)); $date_compare = isset($query_options['date_min']) ? $query_options['date_min'] : "0000-00-00"; /** * get list of items touched by other people */ $changed_items = DbProjectItem::getAll($query_options); /** * go through list */ $changes = array(); foreach ($changed_items as $i) { $change_type = NULL; if (!isset($query_options['project'])) { $project = Project::getVisibleById($i->project); } else { $project = NULL; } /** * get item-change-type depeding on dates */ if ($i->deleted >= $i->modified) { $change_type = ITEM_DELETED; } else { if ($i->modified > $i->created) { $change_type = ITEM_MODIFIED; } else { $change_type = ITEM_NEW; } } /** * build up change-list */ switch ($change_type) { case ITEM_NEW: if ($i->type == ITEM_TASK) { if (!($task = Task::getVisibleById($i->id))) { continue; } if ($assigned_people = $task->getAssignedPeople()) { $tmp = array(); foreach ($assigned_people as $ap) { $tmp[] = $ap->getLink(); } $html_assignment = __('to', 'very short for assigned tasks TO...') . ' ' . implode(', ', $tmp); } else { $html_assignment = ''; } $html_details = ''; if ($tmp = $task->getFolderLinks(true, $project)) { $html_details .= __('in', 'very short for IN folder...') . ' ' . $tmp; } if ($task->prio != PRIO_NORMAL && $task->prio != PRIO_UNDEFINED) { global $g_prio_names; $html_details .= ' / ' . $g_prio_names[$task->prio]; } $change = new ChangeLine(array('item' => $task, 'person_by' => $i->created_by, 'timestamp' => $i->created, 'item_id' => $i->id, 'html_what' => '<span class=new>' . __('new') . ' ' . $task->getLabel() . '</span>', 'txt_what' => __('new') . ' ' . $task->getLabel(), 'type' => ChangeLine::NEW_TASK, 'html_assignment' => $html_assignment, 'html_details' => $html_details)); $changes[] = $change; } else { if ($i->type == ITEM_FILE) { require_once confGet('DIR_STREBER') . 'db/class_file.inc.php'; if ($file = File::getVisibleById($i->id)) { $change = new ChangeLine(array('item' => $file, 'person_by' => $i->created_by, 'timestamp' => $i->created, 'item_id' => $i->id, 'html_what' => __('New file'), 'txt_what' => __('New file'), 'type' => ChangeLine::NEW_FILE, 'html_details' => $file->name)); $changes[] = $change; } } } break; case ITEM_MODIFIED: $timestamp_last_change = $date_compare; # make sure we use the last occured change type /** * modified tasks */ $type = ChangeLine::UPDATED; if ($i->type == ITEM_TASK) { if (!($task = Task::getVisibleById($i->id))) { continue; } if ($assigned_people = $task->getAssignedPeople()) { $tmp = array(); foreach ($assigned_people as $ap) { $tmp[] = $ap->getLink(); } $html_assignment = __('to', 'very short for assigned tasks TO...') . ' ' . implode(', ', $tmp); } else { $html_assignment = ''; } $html_details = ''; if ($tmp = $task->getFolderLinks(true, $project)) { $html_details .= __('in', 'very short for IN folder...') . ' ' . $tmp; } $txt_what = $html_what = __('modified'); $type = ChangeLine::UPDATED; $html_comment = ''; if ($comments = Comment::getAll(array('person' => $i->modified_by, 'task' => $task->id, 'date_min' => $timestamp_last_change, 'order_by' => 'created ASC'))) { $last_comment = $comments[count($comments) - 1]; $timestamp_last_change = $last_comment->created; if ($last_comment->name && $last_comment->name != __('New Comment')) { # ignore default title $html_comment = strip_tags($last_comment->name) . ': '; } $html_comment .= strip_tags($last_comment->description); $html_comment = asHtml($html_comment); } ### get changed fields ### $changed_fields_hash = array(); $html_functions = false; if ($changed_fields_list = ItemChange::getItemChanges(array('item' => $i->id, 'person' => $i->modified_by, 'date_min' => $date_compare))) { foreach ($changed_fields_list as $cf) { $changed_fields_hash[$cf->field] = $cf; } if (isset($changed_fields_hash['status'])) { $status_old = $changed_fields_hash['status']->value_old; if ($task->status == STATUS_COMPLETED && $task->status > $status_old) { $txt_what = $html_what = __('completed') . ' ' . $task->getLabel(); $html_functions = $PH->getLink('tasksApproved', __('Approve Task'), array('tsk' => $task->id)); unset($changed_fields_hash['status']); } else { if ($task->status == STATUS_APPROVED && $task->status > $status_old) { $txt_what = $html_what = __('approved'); unset($changed_fields_hash['status']); } else { if ($task->status == STATUS_CLOSED && $task->status > $status_old) { $txt_what = $html_what = __('closed'); unset($changed_fields_hash['status']); } else { if ($task->status == STATUS_OPEN && $task->status < $status_old) { $txt_what = $html_what = __('reopened'); unset($changed_fields_hash['status']); } else { if ($task->status == STATUS_OPEN) { unset($changed_fields_hash['status']); } else { if ($task->status == STATUS_BLOCKED) { $txt_what = $html_what = __('is blocked'); unset($changed_fields_hash['status']); } } } } } } } } if (isset($changed_fields_hash['parent_task'])) { $txt_what = $html_what = __('moved'); $type = ChangeLine::MOVED; unset($changed_fields_hash['parent_task']); } else { if (count($changed_fields_hash) == 1 && isset($changed_fields_hash['name'])) { $txt_what = $html_what = __('renamed'); $type = ChangeLine::RENAMED; } else { if (count($changed_fields_hash) == 1 && isset($changed_fields_hash['description'])) { $txt_what = $html_what = __('edit wiki'); $type = ChangeLine::EDITED_WIKI; } else { if (count($changed_fields_hash)) { # status does not count $html_details .= ' / ' . __('changed:') . ' ' . implode(', ', array_keys($changed_fields_hash)); } else { if ($html_comment) { $txt_what = $html_what = __('commented'); $type = ChangeLine::COMMENTED; } } } } } if ($html_comment) { $html_details .= ' / ' . $html_comment; } /** * any recents assignments ? * - to avoid confusion only list assignmets if it was to last action, * */ require_once "db/class_taskperson.inc.php"; $count_assignments = 0; if ($assignments = TaskPerson::getTaskPeople(array('task' => $task->id, 'project' => $task->project, 'date_min' => $task->modified))) { $t_timestamp = ''; foreach ($assignments as $a) { if ($a->person != $task->modified_by && $a->created_by == $task->modified_by && $a->assigntype != ASSIGNTYPE_INITIAL) { $t_timestamp = $a->created; $count_assignments++; } } if ($count_assignments && $timestamp_last_change < $t_timestamp) { $type = ChangeLine::ASSIGNED; $txt_what = $html_what = __('assigned'); $timestamp_last_change = $t_timestamp; } if ($html_comment) { $html_details .= ' / ' . $html_comment; } } /** * any recents attachments by last editor ? */ require_once "db/class_file.inc.php"; if ($files = File::getAll(array('parent_item' => $task->id, 'project' => $task->project, 'date_min' => $date_compare, 'created_by' => $task->modified_by))) { $count_attached_files = 0; $html_attached = __("attached") . ": "; $t_timestamp = ''; $separator = ''; foreach ($files as $f) { if ($task->modified_by == $f->modified_by) { $t_timestamp = $f->created; $count_attached_files++; $html_attached .= $separator . $PH->getLink('fileView', $f->name, array('file' => $f->id)); $separator = ', '; } } if ($count_attached_files) { $type = ChangeLine::ATTACHED_FILE; $txt_what = $html_what = __('attached file to'); if ($timestamp_last_change < $t_timestamp) { $html_details .= ' / ' . $html_attached; $timestamp_last_change = $t_timestamp; } } } if (count($changed_fields_hash)) { $html_details .= " / " . $PH->getLink('itemViewDiff', NULL, array('item' => $task->id, 'date1' => $date_compare, 'date2' => gmdate("Y-m-d H:i:s"))); } if ($html_functions) { $html_details .= " | " . $html_functions; } $change = new ChangeLine(array('person_by' => $i->modified_by, 'timestamp' => $i->modified, 'item_id' => $i->id, 'item' => $task, 'type' => $type, 'txt_what' => $txt_what, 'html_what' => $html_what, 'html_assignment' => $html_assignment, 'html_details' => $html_details)); $changes[] = $change; } else { if ($i->type == ITEM_FILE) { require_once confGet('DIR_STREBER') . 'db/class_file.inc.php'; if ($file = File::getVisibleById($i->id)) { $change = new ChangeLine(array('item' => $file, 'person_by' => $i->created_by, 'timestamp' => $i->created, 'item_id' => $i->id, 'html_what' => __('changed File'), 'txt_what' => __('changed File'), 'type' => ChangeLine::NEW_FILE, 'html_details' => $file->name)); $changes[] = $change; } } } break; case ITEM_DELETED: /** * deleted tasks */ if ($i->type == ITEM_TASK) { if (!($task = Task::getVisibleById($i->id))) { continue; } if ($assigned_people = $task->getAssignedPeople()) { $tmp = array(); foreach ($assigned_people as $ap) { $tmp[] = $ap->getLink(); } $html_assignment = __('to', 'very short for assigned tasks TO...') . ' ' . implode(', ', $tmp); } else { $html_assignment = ''; } $html_details = ''; if ($tmp = $task->getFolderLinks(true, $project)) { $html_details .= __('in', 'very short for IN folder...') . ' ' . $tmp; } $html_details .= '|' . $PH->getLink('itemsRestore', __('restore'), array('item' => $task->id)); $txt_what = $html_what = __('deleted'); $change = new ChangeLine(array('item' => $task, 'person_by' => $i->deleted_by, 'timestamp' => $i->deleted, 'item_id' => $i->id, 'type' => ChangeLine::DELETED, 'txt_what' => $txt_what, 'html_what' => $html_what, 'html_assignment' => $html_assignment, 'html_details' => $html_details)); $changes[] = $change; } else { if ($i->type == ITEM_FILE) { require_once confGet('DIR_STREBER') . 'db/class_file.inc.php'; if ($file = File::getVisibleById($i->id)) { $change = new ChangeLine(array('item' => $file, 'person_by' => $i->created_by, 'timestamp' => $i->created, 'item_id' => $i->id, 'html_what' => __('deleted File'), 'txt_what' => ChangeLine::DELETED, 'html_details' => $file->name)); $changes[] = $change; } } } break; default: trigger_error("unknown change-type {$change_type}", E_USER_WARNING); break; } } return $changes; }
function render_tr(&$item, $style = "") { global $PH; $str_date = ''; $str_name = ''; $str_url = ''; if ($i = DbProjectItem::getById($item->id)) { if ($i->modified) { $mod_date = $i->modified; $str_date = renderDateHtml($mod_date); if ($i->modified_by) { if ($person = Person::getVisibleById($i->modified_by)) { $str_name = asHtml($person->name); $str_url = $person->getLink(); } } print '<td><span class=date>' . $str_date . '</span><br><span class="sub who">' . __('by') . ' ' . $str_url . '</span></td>'; } else { print "<td class='nowrap'> </td>"; } } else { $PH->abortWarning("Could not get modification date of the element.", ERROR_BUG); print "<td class='nowrap'> </td>"; } }
function render_tr(&$person, $style = "") { global $PH; print "<td>" . $PH->getLink('personView', asHtml($person->nickname), array('person' => $person->id)) . "</td>"; }
static function renderLinkFromTargetName($target, $name) { measure_start("BlockLink::renderLinkFromTargetName"); global $PH; global $g_replace_list; global $g_wiki_project; $html = ""; /** * start with looking for tasks... */ $decoded_name = strtr($target, array_flip(get_html_translation_table(HTML_SPECIALCHARS, ENT_QUOTES))); measure_start("BlockLink::renderLinkFromTargetName::getTasks"); if ($g_wiki_project) { $tasks = Task::getAll(array('name' => $decoded_name, 'project' => $g_wiki_project->id, 'status_max' => STATUS_CLOSED)); } else { $tasks = Task::getAll(array('name' => $decoded_name, 'status_max' => STATUS_CLOSED)); } measure_stop("BlockLink::renderLinkFromTargetName::getTasks"); if (count($tasks) == 1) { ### matches name ### if (!strcasecmp(asHtml($tasks[0]->name), $target)) { $style_isdone = $tasks[0]->status >= STATUS_COMPLETED ? 'isDone' : ''; if ($name) { $html = "<a class='item task {$style_isdone}' href='" . $PH->getUrl('taskView', array('tsk' => intval($tasks[0]->id))) . "'>" . asHtml($name) . "</a>"; global $g_replace_list; $g_replace_list[$target] = '#' . $tasks[0]->id . '|' . $name; } else { $html = "<a class='item task {$style_isdone}' href='" . $PH->getUrl('taskView', array('tsk' => intval($tasks[0]->id))) . "'>" . asHtml($tasks[0]->name) . "</a>"; global $g_replace_list; $g_replace_list[$target] = '#' . $tasks[0]->id . '|' . $tasks[0]->name; } } else { if (!strcasecmp($tasks[0]->short, $target)) { $style_isdone = $tasks[0]->status >= STATUS_COMPLETED ? 'isDone' : ''; if ($name) { $html = "<a class='item task {$style_isdone}' href='" . $PH->getUrl('taskView', array('tsk' => intval($tasks[0]->id))) . "'>" . asHtml($name) . "</a>"; global $g_replace_list; $g_replace_list[$target] = '#' . $tasks[0]->id . '|' . $name; } else { $html = "<a class='item task {$style_isdone}' href='" . $PH->getUrl('taskView', array('tsk' => intval($tasks[0]->id))) . "'>" . asHtml($tasks[0]->name) . "</a>"; global $g_replace_list; $g_replace_list[$target] = '#' . $tasks[0]->id . '|' . $tasks[0]->short; } } else { $title = __('No task matches this name exactly'); $title2 = __('This task seems to be related'); $html = "<span title='{$title}' class=not_found>{$name}</span>" . "<a href='" . $PH->getUrl('taskView', array('tsk' => intval($tasks[0]->id))) . "' title='{$title2}'>?</a>"; } } } else { if (count($tasks) > 1) { measure_start("BlockLink::renderLinkFromTargetName::iterateSeveralTasks"); $matches = array(); $best = -1; $best_rate = 0; foreach ($tasks as $t) { if (!strcasecmp($t->name, $target) && $g_wiki_project && $t->project == $g_wiki_project->id) { $matches[] = $t; } else { if (!strcasecmp($t->short, $target)) { $matches[] = $t; } } } if (count($matches) == 1) { $html = "<a href='" . $PH->getUrl('taskView', array('tsk' => intval($matches[0]->id))) . "'>" . $matches[0]->name . "</a>"; } else { if (count($matches) > 1) { $title = __('No item excactly matches this name.'); $title2 = sprintf(__('List %s related tasks'), count($tasks)); $html = "<a class=not_found title= '{$title2}' href='" . $PH->getUrl('search', array('search_query' => $target)) . "'> " . $target . " (" . count($matches) . ' ' . __('identical') . ")</a>"; } else { if ($g_wiki_project) { $title = __('No item matches this name. Create new task with this name?'); $url = $PH->getUrl('taskNew', asHtml($target), array('prj' => $g_wiki_project->id)); $html = "<a href='{$url}' title='{$title}' class=not_found>{$target}</a>"; } else { $title = __('No item matches this name...'); $html = "<span title='{$title}' class=not_found>{$target}</span>"; } } } measure_stop("BlockLink::renderLinkFromTargetName::iterateSeveralTasks"); } else { if (0 == count($tasks)) { measure_start("BlockLink::renderLinkFromTargetName::notATaskItem"); /** * now check for team-members... */ if ($g_wiki_project) { $people = Person::getPeople(array('project' => $g_wiki_project->id, 'search' => $target)); if (count($people) == 1) { return "<a class='item person' title= '" . asHtml($people[0]->name) . "' href='" . $PH->getUrl('personView', array('person' => $people[0]->id)) . "'>" . asHtml($target) . "</a>"; } measure_stop("BlockLink::renderLinkFromTargetName::getPeople"); } /** * Link to create new task or topic */ if ($g_wiki_project) { $title = __('No item matches this name. Create new task with this name?'); global $g_wiki_task; if (isset($g_wiki_task) && $g_wiki_task->type == ITEM_TASK) { if ($g_wiki_task->category == TCATEGORY_FOLDER) { $parent_task = $g_wiki_task->id; } else { $parent_task = $g_wiki_task->parent_task; } } else { $parent_task = 0; } $url = $PH->getUrl('taskNew', array('prj' => $g_wiki_project->id, 'new_name' => urlencode($target), 'parent_task' => $parent_task)); $html = "<a href='{$url}' title='{$title}' class=not_found>{$target}</a>"; } else { $title = __('No item matches this name'); $html = "<span title='{$title}' class=not_found>{$target}</span>"; trigger_error('g_wiki_project was not defined. Could not provide create-link.', E_USER_NOTICE); } measure_stop("BlockLink::renderLinkFromTargetName::notATaskItem"); } } } measure_stop("BlockLink::renderLinkFromTargetName"); return $html; }
/** * getLink (return nothing, if not enough user-rights) * - link name will be converted to html */ public function getLink($id = NULL, $name = NULL, $params = NULL, $style = NULL, $allow_html = false) { ### try to get url ### if ($url = $this->getUrl($id, $params)) { if (!$name && $this->hash[$id]->title) { $name = $this->hash[$id]->title; } else { if (!$allow_html) { $name = asHtml($name); } } $class = $style ? "class='{$style}'" : ''; $buffer = '<a ' . $class . ' href="' . $url . '">' . $name . '</a>'; return $buffer; } else { return NULL; } }
/** * revert changes of a person * * Notes: * - This function is only available of people with RIGHT_PROJECT_EDIT. * - This will only effect changes to fields. * - Following changes will not be reverted: * - Creation of new items (Tasks, Topis, Efforts, Projects, etc.) * - Task-assignments * - Uploading of files * * person - id of person who did the changes * data - date to with revert changes * delete_history (Default off) - Reverting can't be undone! The person's modification are lost forever! * This can be useful on massive changes to avoid sending huge * notification mails. */ function personRevertChanges() { global $PH; global $auth; ### check rights ### if (!$auth->cur_user->user_rights & RIGHT_PROJECT_EDIT) { $PH->abortWarning("You require the right to edit projects."); } ### get person ### $person_id = getOnePassedId('person', 'people_*'); if (!($person = Person::getVisibleById($person_id))) { $PH->abortWarning(sprintf(__("invalid Person #%s"), $person_id)); return; } $page = new Page(); $page->tabs['admin'] = array('target' => "index.php?go=systemInfo", 'title' => __('Admin', 'top navigation tab'), 'bg' => "misc"); $page->cur_tab = 'admin'; $page->crumbs[] = new NaviCrumb(array('target_id' => 'systemInfo')); $page->title = __("Reverting user changes"); $page->type = __("Admin"); #$page->title_minor=get('go'); echo new PageHeader(); echo new PageContentOpen(); $block = new PageBlock(array('title' => __('Overview'), 'id' => 'overview')); $block->render_blockStart(); echo "<div class=text>"; echo "<ul>"; ### get changes of person ### $count_reverted_fields = 0; $changes = ItemChange::getItemChanges(array('person' => $person_id, 'order_by' => 'id DESC')); foreach ($changes as $c) { if (!($project_item = DbProjectItem::getObjectById($c->item))) { #print "unable to get item %s" % $c->item; } else { ### Only revert changes, if item has not be editted by other person if ($project_item->modified_by == $person_id) { $field_name = $c->field; echo "<li>" . "<strong>" . asHtml($project_item->name) . "." . asHtml($field_name) . "</strong>" . " '" . asHtml($project_item->{$field_name}) . "' = '" . asHtml($c->value_old) . "'" . "</li>"; $count_reverted_fields++; if ($field_name == 'state') { if ($project_item->state == -1 && $c->value_old == 1) { $project_item->deleted_by = "0"; $project_item->deleted = "0000-00-00 00-00-00"; } } $project_item->{$field_name} = $c->value_old; $project_item->update(array($field_name, 'deleted_by', 'deleted'), false, false); } else { echo "<li>" . sprintf(__("Skipped recently editted item #%s: <b>%s<b>"), $project_item->id, asHtml($project_item->name)) . "</li>"; } $c->deleteFull(); } } echo "</ul>"; echo "<p>" . sprintf(__("Reverted all changes (%s) of user %s"), $count_reverted_fields, asHtml($person->nickname)) . "</p>"; echo "<p>" . __("newly created items by this user remain unaffected.") . "</p>"; echo "</div>"; $block->render_blockEnd(); ### close page echo new PageContentClose(); echo new PageHtmlEnd(); }
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(); }
protected function getItemLink($id, $title) { return "<a href='" . $this->getUrlToItem($id) . "'>" . asHtml($title) . "</a>"; }
/** * Submit changes to a task * * @ingroup pages */ function taskEditSubmit() { global $PH; global $auth; require_once confGet('DIR_STREBER') . 'db/class_taskperson.inc.php'; /** * keep a list of items linking to this task, task is new * we have to change the linking id after(!) inserting the task */ $link_items = array(); ### temporary object or from database? ### $tsk_id = getOnePassedId('tsk', '', true, 'invalid id'); if ($tsk_id == 0) { $task = new Task(array('id' => 0, 'project' => get('task_project'))); $was_category = 0; # undefined category for new tasks $was_resolved_version = 0; } else { if (!($task = Task::getVisiblebyId($tsk_id))) { $PH->abortWarning("invalid task-id"); } $was_category = $task->category; $was_resolved_version = $task->resolved_version; $task->validateEditRequestTime(); } ### cancel? ### if (get('form_do_cancel')) { if (!$PH->showFromPage()) { $PH->show('taskView', array('tsk' => $task->id)); } exit; } ### Validate integrety ### if (!validateFormCrc()) { $PH->abortWarning(__('Invalid checksum for hidden form elements')); } validateFormCaptcha(true); $was_a_folder = $task->category == TCATEGORY_FOLDER ? true : false; $was_released_as = $task->is_released; ### get project ### if (!($project = Project::getVisiblebyId($task->project))) { $PH->abortWarning("task without project?"); } /** * adding comment (from quick edit) does only require view right... */ $added_comment = false; ### check for request feedback if ($request_feedback = get('request_feedback')) { $team_members_by_nickname = array(); foreach ($project->getProjectPeople() as $pp) { $team_members_by_nickname[$pp->getPerson()->nickname] = $pp->getPerson(); } $requested_people = array(); foreach (explode('\\s*,\\s*', $request_feedback) as $nickname) { ### now check if this nickname is a team member if ($nickname = trim($nickname)) { if (isset($team_members_by_nickname[$nickname])) { $person = $team_members_by_nickname[$nickname]; ### update to itemperson table... if ($view = ItemPerson::getAll(array('person' => $person->id, 'item' => $task->id))) { $view[0]->feedback_requested_by = $auth->cur_user->id; $view[0]->update(); } else { $new_view = new ItemPerson(array('item' => $task->id, 'person' => $person->id, 'feedback_requested_by' => $auth->cur_user->id)); $new_view->insert(); } $requested_people[] = "<b>" . asHtml($nickname) . "</b>"; } else { new FeedbackWarning(sprintf(__("Nickname not known in this project: %s"), "<b>" . asHtml($nickname) . "</b>")); } } } if ($requested_people) { new FeedbackMessage(sprintf(__('Requested feedback from: %s.'), join($requested_people, ", "))); } } ### only insert the comment, when comment name or description are valid if (get('comment_name') || get('comment_description')) { require_once confGet('DIR_STREBER') . 'pages/comment.inc.php'; $valid_comment = true; ### new object? ### $comment = new Comment(array('name' => get('comment_name'), 'description' => get('comment_description'), 'project' => $task->project, 'task' => $task->id)); validateNotSpam($comment->name . $comment->description); ### write to db ### if ($valid_comment) { if (!$comment->insert()) { new FeedbackWarning(__("Failed to add comment")); } else { ### change task update modification date ### if (isset($task)) { ### Check if now longer new ### if ($task->status == STATUS_NEW) { global $auth; if ($task->created < $auth->cur_user->last_login) { $task->status = STATUS_OPEN; } } $task->update(array('modified', 'status')); } $added_comment = true; } } } if ($task->id != 0 && !Task::getEditableById($task->id)) { if ($added_comment) { ### display taskView #### if (!$PH->showFromPage()) { $PH->show('home', array()); } exit; } else { $PH->abortWarning(__("Not enough rights to edit task")); } } $task->validateEditRequestTime(); $status_old = $task->status; # retrieve all possible values from post-data (with field->view_in_forms == true) # NOTE: # - this could be an security-issue. # @@@ TODO: as some kind of form-edit-behaviour to field-definition foreach ($task->fields as $f) { $name = $f->name; $f->parseForm($task); } $task->fields['parent_task']->parseForm($task); ### category ### $was_of_category = $task->category; if (!is_null($c = get('task_category'))) { global $g_tcategory_names; if (isset($g_tcategory_names[$c])) { $task->category = $c; } else { trigger_error("ignoring unknown task category '{$c}'", E_USER_NOTICE); } } /** * @@@pixtur 2006-11-17: actually this has been depreciated. is_folder updated * for backward compatibility only. */ $task->is_folder = $task->category == TCATEGORY_FOLDER ? 1 : 0; ### Check if now longer new ### if ($status_old == $task->status && $task->status == STATUS_NEW) { global $auth; if ($task->created < $auth->cur_user->last_login) { $task->status = STATUS_OPEN; } } $assigned_people = array(); $task_assignments = array(); if ($task->id) { foreach ($task->getAssignedPeople() as $p) { $assigned_people[$p->id] = $p; } foreach ($task->getAssignments() as $ta) { $task_assignments[$ta->person] = $ta; } } $team = array(); foreach ($project->getPeople() as $p) { $team[$p->id] = $p; } $new_task_assignments = array(); # store assigments after(!) validation $forwarded = 0; $forward_comment = ''; $old_task_assignments = array(); if (isset($task_assignments)) { foreach ($task_assignments as $id => $t_old) { $id_new = get('task_assigned_to_' . $id); $forward_state = get('task_forward_to_' . $id); if ($forward_state) { $forwarded = 1; } else { $forwarded = 0; } $forward_comment = get('task_forward_comment_to_' . $id); if ($id_new === NULL) { log_message("failure. Can't change no longer existing assigment (person-id={$id} item-id={$t_old->id})", LOG_MESSAGE_DEBUG); #$PH->abortWarning("failure. Can't change no longer existing assigment",ERROR_NOTE); continue; } if ($id == $id_new) { if ($tp = TaskPerson::getTaskPeople(array('person' => $id, 'task' => $task->id))) { $tp[0]->forward = $forwarded; $tp[0]->forward_comment = $forward_comment; $old_task_assignments[] = $tp[0]; } #echo " [$id] {$team[$id]->name} still assigned<br>"; continue; } if ($id_new == 0) { if (!$t_old) { continue; } #echo " [$id] {$team[$id]->name} unassigned<br>"; $t_old->delete(); continue; } #$t_new= $task_assignments[$id_new]; $p_new = @$team[$id_new]; if (!isset($p_new)) { $PH->abortWarning("failure during form-value passing", ERROR_BUG); } #echo " [$id] assignment changed from {$team[$id]->name} to {$team[$id_new]->name}<br>"; $t_old->comment = sprintf(__("unassigned to %s", "task-assignment comment"), $team[$id_new]->name); $t_old->update(); $t_old->delete(); $new_assignment = new TaskPerson(array('person' => $team[$id_new]->id, 'task' => $task->id, 'comment' => sprintf(__("formerly assigned to %s", "task-assigment comment"), $team[$id]->name), 'project' => $project->id, 'forward' => $forwarded, 'forward_comment' => $forward_comment)); $new_task_assignments[] = $new_assignment; $link_items[] = $new_assignment; } } ### check new assigments ### $count = 0; while ($id_new = get('task_assign_to_' . $count)) { $forward_state = get('task_forward_to_' . $count); if ($forward_state) { $forwarded = 1; } else { $forwarded = 0; } $forward_comment = get('task_forward_comment_to_' . $count); $count++; ### check if already assigned ### if (isset($task_assignments[$id_new])) { if ($tp = TaskPerson::getTaskPeople(array('person' => $id_new, 'task' => $task->id))) { $tp[0]->forward = $forwarded; $tp[0]->forward_comment = $forward_comment; $old_task_assignments[] = $tp[0]; } #new FeedbackMessage(sprintf(__("task was already assigned to %s"),$team[$id_new]->name)); } else { if (!isset($team[$id_new])) { $PH->abortWarning("unknown person id {$id_new}", ERROR_DATASTRUCTURE); } $new_assignment = new TaskPerson(array('person' => $team[$id_new]->id, 'task' => $task->id, 'comment' => "", 'project' => $project->id, 'forward' => $forwarded, 'forward_comment' => $forward_comment)); /** * BUG? * - inserting the new assigment before sucessfully validating the * task will lead to double-entries in the database. */ $new_task_assignments[] = $new_assignment; #$new_assignment->insert(); $link_items[] = $new_assignment; } } if ($task->isOfCategory(array(TCATEGORY_VERSION, TCATEGORY_MILESTONE))) { if ($is_released = get('task_is_released')) { if (!is_null($is_released)) { $task->is_released = $is_released; } } } ### pub level ### if ($pub_level = get('task_pub_level')) { if ($task->id) { if ($pub_level > $task->getValidUserSetPublicLevels()) { $PH->abortWarning('invalid data', ERROR_RIGHTS); } } #else { # #@@@ check for person create rights #} $task->pub_level = $pub_level; } ### check project ### if ($task->id == 0) { if (!($task->project = get('task_project'))) { $PH->abortWarning("task requires project to be set"); } } ### get parent_task ### $is_ok = true; $parent_task = NULL; if ($task->parent_task) { $parent_task = Task::getVisibleById($task->parent_task); } ### validate ### if (!$task->name) { new FeedbackWarning(__("Task requires name")); $task->fields['name']->required = true; $task->fields['name']->invalid = true; $is_ok = false; } else { if ($task->id == 0) { $other_tasks = array(); if ($parent_task) { $other_tasks = Task::getAll(array('project' => $project->id, 'parent_task' => $parent_task->id, 'status_min' => STATUS_NEW, 'status_max' => STATUS_CLOSED, 'visible_only' => false)); } else { $other_tasks = Task::getAll(array('project' => $project->id, 'parent_task' => 0, 'status_min' => STATUS_NEW, 'status_max' => STATUS_CLOSED, 'visible_only' => false)); } foreach ($other_tasks as $ot) { if (!strcasecmp($task->name, $ot->name)) { $is_ok = false; new FeedbackWarning(sprintf(__('Task called %s already exists'), $ot->getLink(false))); break; } } } } ### automatically close resolved tasks ### if ($task->resolve_reason && $task->status < STATUS_COMPLETED) { $task->status = STATUS_COMPLETED; new FeedbackMessage(sprintf(__('Because task is resolved, its status has been changed to completed.'))); } ### Check if resolved tasks should be completed ### if ($task->resolved_version != 0 && $task->status < STATUS_COMPLETED) { new FeedbackWarning(sprintf(__('Task has resolved version but is not completed?'))); $task->fields['resolved_version']->invalid = true; $task->fields['status']->invalid = true; $is_ok = false; } ### Check if completion should be 100% ### if ($task->status >= STATUS_COMPLETED) { $task->completion = 100; } ### repeat form if invalid data ### if (!$is_ok) { $PH->show('taskEdit', NULL, $task); exit; } #--- write to database ----------------------------------------------------------------------- #--- be sure parent-task is folder --- if ($parent_task) { if ($parent_task->isMilestoneOrVersion()) { if ($parent_task->is_folder) { $parent_task->is_folder = 0; $parent_task->update(array('is_folder'), false); } $PH->abortWarning(__("Milestones may not have sub tasks")); } else { if ($parent_task->category != TCATEGORY_FOLDER) { $parent_task->category = TCATEGORY_FOLDER; $parent_task->is_folder = 1; if ($parent_task->update()) { new FeedbackMessage(__("Turned parent task into a folder. Note, that folders are only listed in tree")); } else { trigger_error(__("Failed, adding to parent-task"), E_USER_WARNING); $PH->abortWarning(__("Failed, adding to parent-task")); } } } } ### ungroup child tasks? ### if ($was_a_folder && $task->category != TCATEGORY_FOLDER) { $num_subtasks = $task->ungroupSubtasks(); # @@@ does this work??? /** * note: ALSO invisible tasks should be updated, so do not check for visibility here. */ $parent = Task::getById($task->parent_task); $parent_str = $parent ? $parent->name : __('Project'); if ($num_subtasks) { new FeedbackMessage(sprintf(__("NOTICE: Ungrouped %s subtasks to <b>%s</b>"), $num_subtasks, $parent_str)); } } if ($task->id && !get('task_issue_report')) { $task_issue_report = $task->issue_report; } else { if ($task->issue_report != get('task_issue_report')) { trigger_error("Requesting invalid issue report id for task!", E_USER_WARNING); $task_issue_report = get('task_issue_report'); } else { $task_issue_report = 0; } } ### consider issue-report? ### #$task_issue_report= get('task_issue_report'); if ($task->category == TCATEGORY_BUG || isset($task_issue_report) && $task_issue_report) { ### new report as / temporary ### if ($task_issue_report == 0 || $task_issue_report == -1) { $issue = new Issue(array('id' => 0, 'project' => $project->id, 'task' => $task->id)); ### querry form-information ### foreach ($issue->fields as $f) { $name = $f->name; $f->parseForm($issue); } global $g_reproducibility_names; if (!is_null($rep = get('issue_reproducibility'))) { if (isset($g_reproducibility_names[$rep])) { $issue->reproducibility = intval($rep); } else { $issue->reproducibility = REPRODUCIBILITY_UNDEFINED; } } global $g_severity_names; if (!is_null($sev = get('issue_severity'))) { if (isset($g_severity_names[$sev])) { $issue->severity = intval($sev); } else { $issue->severity = SEVERITY_UNDEFINED; } } ### write to db ### if (!$issue->insert()) { trigger_error("Failed to insert issue to db", E_USER_WARNING); } else { $link_items[] = $issue; $task->issue_report = $issue->id; } } else { if ($issue = Issue::getById($task_issue_report)) { ### querry form-information ### foreach ($issue->fields as $f) { $name = $f->name; $f->parseForm($issue); } global $g_reproducibility_names; if (!is_null($rep = get('issue_reproducibility'))) { if (isset($g_reproducibility_names[$rep])) { $issue->reproducibility = intval($rep); } else { $issue->reproducibility = REPRODUCIBILITY_UNDEFINED; } } global $g_severity_names; if (!is_null($sev = get('issue_severity'))) { if (isset($g_severity_names[$sev])) { $issue->severity = intval($sev); } else { $issue->severity = SEVERITY_UNDEFINED; } } ### write to db ### if (!$issue->update()) { trigger_error("Failed to write issue to DB (id={$issue->id})", E_USER_WARNING); } if ($task->issue_report != $issue->id) { # additional check, actually not necessary trigger_error("issue-report as invalid id ({$issue->id}). Should be ({$task->issue_report}) Please report this bug.", E_USER_WARNING); } } else { trigger_error("Could not get issue with id {$task->issue_report} from database", E_USER_WARNING); } } } ### write to db ### if ($task->id == 0) { $task->insert(); ### write task-assigments ### foreach ($new_task_assignments as $nta) { $nta->insert(); } ### now we now the id of the new task, link the other items foreach ($link_items as $i) { $i->task = $task->id; $i->update(); } new FeedbackMessage(sprintf(__("Created %s %s with ID %s", "Created <type> <name> with ID <id>..."), $task->getLabel(), $task->getLink(false), $task->id)); } else { ### write task-assigments ### foreach ($new_task_assignments as $nta) { $nta->insert(); } foreach ($old_task_assignments as $ota) { $ota->update(); } new FeedbackMessage(sprintf(__("Changed %s %s with ID %s", "type,link,id"), $task->getLabel(), $task->getLink(false), $task->id)); $task->update(); $project->update(array(), true); } ### add any recently resolved tasks if this is a just released version ### if ($task->category == TCATEGORY_VERSION && $was_category != TCATEGORY_VERSION) { if ($resolved_tasks = Task::getAll(array('project' => $task->project, 'status_min' => 0, 'status_max' => 10, 'resolved_version' => RESOLVED_IN_NEXT_VERSION))) { foreach ($resolved_tasks as $rt) { $rt->resolved_version = $task->id; $rt->update(array('resolved_version')); } new FeedbackMessage(sprintf(__('Marked %s tasks to be resolved in this version.'), count($resolved_tasks))); } } ### notify on change ### $task->nowChangedByUser(); ### create another task ### if (get('create_another')) { ### build dummy form ### $newtask = new Task(array('id' => 0, 'name' => __('Name'), 'project' => $task->project, 'state' => 1, 'prio' => $task->prio, 'label' => $task->label, 'parent_task' => $task->parent_task, 'for_milestone' => $task->for_milestone, 'category' => $task->category)); $PH->show('taskEdit', array('tsk' => $newtask->id), $newtask); } else { ### go to task, if new if ($tsk_id == 0) { $PH->show('taskView', array('tsk' => $task->id)); exit; } else { if (!$PH->showFromPage()) { $PH->show('home', array()); } } } }