/** * Selects a note from the table and returns the contents. * * @param string $id The ID of this note. * @return A string containing the note. */ function getNote($id) { $note = Note::getDetails($id); if (!empty($_GET["ec_id"])) { return Link_Filter::processText(Auth::getCurrentProject(), nl2br($_GET["ec_id"] . ":" . $id . ":" . Misc::highlightQuotedReply($note["not_note"]))); } else { return $note["not_note"]; } }
if (!@empty($HTTP_POST_VARS['new_status'])) { $res = Issue::setStatus($issue_id, $HTTP_POST_VARS['new_status']); if ($res != -1) { $new_status = Status::getStatusTitle($HTTP_POST_VARS['new_status']); History::add($issue_id, $usr_id, History::getTypeID('status_changed'), "Status changed to '{$new_status}' by " . User::getFullName($usr_id)); } } $res = Note::insert($usr_id, $issue_id); $tpl->assign("post_result", $res); // enter the time tracking entry about this phone support entry if (!empty($HTTP_POST_VARS['time_spent'])) { $HTTP_POST_VARS['issue_id'] = $issue_id; $HTTP_POST_VARS['category'] = $HTTP_POST_VARS['time_category']; $HTTP_POST_VARS['summary'] = 'Time entry inserted when sending an internal note.'; Time_Tracking::insertEntry(); } } elseif (@$HTTP_GET_VARS["cat"] == "reply") { if (!@empty($HTTP_GET_VARS["id"])) { $note = Note::getDetails($HTTP_GET_VARS["id"]); $date = Misc::formatReplyDate($note["timestamp"]); $header = "\n\n\nOn {$date}, " . $note["not_from"] . " wrote:\n>\n"; $note["not_body"] = $header . Misc::formatReply($note["not_note"]); $tpl->bulkAssign(array("note" => $note, "parent_note_id" => $HTTP_GET_VARS["id"])); $reply_subject = Mail_API::removeExcessRe($note['not_title']); } } if (empty($reply_subject)) { $reply_subject = 'Re: ' . $details['iss_summary']; } $tpl->assign(array('from' => User::getFromHeader($usr_id), 'users' => Project::getUserAssocList($prj_id, 'active', User::getRoleID('Customer')), 'current_user_prefs' => Prefs::get($usr_id), 'subscribers' => Notification::getSubscribers($issue_id, false, User::getRoleID("Standard User")), 'statuses' => Status::getAssocStatusList($prj_id, false), 'current_issue_status' => Issue::getStatusID($issue_id), 'time_categories' => Time_Tracking::getAssocCategories(), 'note_category_id' => Time_Tracking::getCategoryID('Note Discussion'), 'reply_subject' => $reply_subject)); $tpl->displayTemplate();
public function getExcerpts() { if (count($this->matches) < 1) { return false; } $excerpt_options = array('query_mode' => $this->match_mode, 'before_match' => $this->excerpt_placeholder . '-before', 'after_match' => $this->excerpt_placeholder . '-after', 'allow_empty' => true); $excerpts = array(); foreach ($this->matches as $issue_id => $matches) { $excerpt = array('issue' => array(), 'email' => array(), 'phone' => array(), 'note' => array()); foreach ($matches as $match) { if ($match['index'] == 'issue') { $issue = Issue::getDetails($issue_id); $documents = array($issue['iss_summary']); $res = $this->sphinx->BuildExcerpts($documents, 'issue_stemmed', $this->keywords, $excerpt_options); if ($res[0] != $issue['iss_summary']) { $excerpt['issue']['summary'] = self::cleanUpExcerpt($res[0]); } $documents = array($issue['iss_original_description']); $res = $this->sphinx->BuildExcerpts($documents, 'issue_stemmed', $this->keywords, $excerpt_options); if ($res[0] != $issue['iss_original_description']) { $excerpt['issue']['description'] = self::cleanUpExcerpt($res[0]); error_log(print_r($excerpt['issue']['description'], 1)); } } elseif ($match['index'] == 'email') { $email = Support::getEmailDetails(null, $match['match_id']); $documents = array($email['sup_subject'] . "\n" . $email['message']); $res = $this->sphinx->BuildExcerpts($documents, 'email_stemmed', $this->keywords, $excerpt_options); $excerpt['email'][Support::getSequenceByID($match['match_id'])] = self::cleanUpExcerpt($res[0]); } elseif ($match['index'] == 'phone') { $phone_call = Phone_Support::getDetails($match['match_id']); $documents = array($phone_call['phs_description']); $res = $this->sphinx->BuildExcerpts($documents, 'phonesupport_stemmed', $this->keywords, $excerpt_options); $excerpt['phone'][] = self::cleanUpExcerpt($res[0]); } elseif ($match['index'] == 'note') { $note = Note::getDetails($match['match_id']); $documents = array($note['not_title'] . "\n" . $note['not_note']); $res = $this->sphinx->BuildExcerpts($documents, 'note_stemmed', $this->keywords, $excerpt_options); $note_seq = Note::getNoteSequenceNumber($issue_id, $match['match_id']); $excerpt['note'][$note_seq] = self::cleanUpExcerpt($res[0]); } } foreach ($excerpt as $key => $val) { if (count($val) < 1) { unset($excerpt[$key]); } } $excerpts[$issue_id] = $excerpt; } return $excerpts; }
// +----------------------------------------------------------------------+ require_once dirname(__FILE__) . '/../init.php'; $tpl = new Template_Helper(); $tpl->setTemplate('view_note.tpl.html'); Auth::checkAuthentication(APP_COOKIE, 'index.php?err=5', true); $usr_id = Auth::getUserID(); $note_id = $_GET['id']; $note = Note::getDetails($note_id); if ($note == '') { $tpl->assign('note', ''); $tpl->displayTemplate(); exit; } else { $note['message'] = $note['not_note']; $issue_id = Note::getIssueID($note_id); $usr_id = Auth::getUserID(); } if (User::getRoleByUser($usr_id, Issue::getProjectID($issue_id)) < User::getRoleID('Standard User') || !Access::canViewInternalNotes($issue_id, Auth::getUserID())) { $tpl->setTemplate('permission_denied.tpl.html'); $tpl->displayTemplate(); exit; } $note = Note::getDetails($_GET['id']); $note['message'] = $note['not_note']; $issue_id = Note::getIssueID($_GET['id']); $tpl->assign(array('note' => $note, 'issue_id' => $issue_id, 'extra_title' => 'Note #' . Note::getNoteSequenceNumber($issue_id, $note_id) . ': ' . $note['not_title'], 'recipients' => Mail_Queue::getMessageRecipients('notes', $note_id))); if (!empty($issue_id)) { $sides = Note::getSideLinks($issue_id, $_GET['id']); $tpl->assign(array('previous' => $sides['previous'], 'next' => $sides['next'])); } $tpl->displayTemplate();
/** * Selects a note from the table and returns the contents. * * @param string $id The ID of this note. * @return A string containing the note. */ function getNote($id) { $note = Note::getDetails($id); if (!Issue::canAccess($note['not_iss_id'], $GLOBALS['usr_id'])) { return ''; } if (empty($_GET['ec_id'])) { return $note['not_note']; } return Link_Filter::processText(Auth::getCurrentProject(), nl2br(Misc::highlightQuotedReply($note['not_note']))); }
/** * Returns the nth note for the specific issue. Sequence starts at 1. * * @access public * @param integer $issue_id The id of the issue. * @param integer $sequence The sequential number of the note. * @return array An array of data containing details about the note. */ function getNoteBySequence($issue_id, $sequence) { $issue_id = Misc::escapeInteger($issue_id); $sequence = Misc::escapeInteger($sequence); $stmt = "SELECT\n not_id\n FROM\n " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "note\n WHERE\n not_iss_id = {$issue_id} AND\n not_removed = 0\n ORDER BY\n not_created_date ASC\n LIMIT " . ($sequence - 1) . ", 1"; $res = $GLOBALS["db_api"]->dbh->getOne($stmt); if (PEAR::isError($res)) { Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__); return array(); } else { return Note::getDetails($res); } }
// | You should have received a copy of the GNU General Public License | // | along with this program; if not, write to: | // | | // | Free Software Foundation, Inc. | // | 51 Franklin Street, Suite 330 | // | Boston, MA 02110-1301, USA. | // +----------------------------------------------------------------------+ // | Authors: João Prado Maia <*****@*****.**> | // +----------------------------------------------------------------------+ require_once dirname(__FILE__) . '/../init.php'; $tpl = new Template_Helper(); $tpl->setTemplate('convert_note.tpl.html'); Auth::checkAuthentication(APP_COOKIE, 'index.php?err=5', true); $usr_id = Auth::getUserID(); $note_id = !empty($_GET['id']) ? $_GET['id'] : $_POST['note_id']; $note = Note::getDetails($note_id); $issue_id = $note['not_iss_id']; if (User::getRoleByUser($usr_id, Issue::getProjectID($issue_id)) < User::getRoleID('Standard User') || !Access::canConvertNote($issue_id, Auth::getUserID())) { $tpl->setTemplate('permission_denied.tpl.html'); $tpl->displayTemplate(); exit; } if (@$_POST['cat'] == 'convert') { if (@$_POST['add_authorized_replier'] == 1) { $authorize_sender = true; } else { $authorize_sender = false; } $tpl->assign('convert_result', Note::convertNote($_POST['note_id'], $_POST['target'], $authorize_sender)); } else { $tpl->assign('note_id', $_GET['id']);