public function exportFullHistory(SimpleXMLElement $artifact_xml, Tracker_Artifact_Changeset $changeset) { $changeset_xml = $artifact_xml->addChild('changeset'); if ($changeset->getSubmittedBy()) { $this->user_xml_exporter->exportUserByUserId($changeset->getSubmittedBy(), $changeset_xml, 'submitted_by'); } elseif ($changeset->getEmail()) { $this->user_xml_exporter->exportUserByMail($changeset->getEmail(), $changeset_xml, 'submitted_by'); } $submitted_on = $changeset_xml->addChild('submitted_on', date('c', $changeset->getSubmittedOn())); $submitted_on->addAttribute('format', 'ISO8601'); $comments_node = $changeset_xml->addChild('comments'); if ($changeset->getComment()) { $changeset->getComment()->exportToXML($comments_node); } $this->values_exporter->exportChangedFields($artifact_xml, $changeset_xml, $changeset->getArtifact(), $changeset->getValues()); }
private function fetchFormattedMailUserInfo(PFUser $user) { $hp = Codendi_HTMLPurifier::instance(); if ($user && !$user->isAnonymous()) { $user_info = '<a href="mailto:' . $hp->purify($user->getEmail()) . '">' . $hp->purify($user->getRealName()) . ' (' . $hp->purify($user->getUserName()) . ') </a>'; } else { $user = UserManager::instance()->getUserAnonymous(); $user->setEmail($this->changeset->getEmail()); $user_info = $GLOBALS['Language']->getText('tracker_include_artifact', 'anon_user'); } return $user_info; }
public function getFullRESTValueForAnonymous(Tracker_Artifact_Changeset $changeset) { $user = new PFUser(); $user->setEmail($changeset->getEmail()); $user->setRealName($changeset->getEmail()); $class_user_representation = '\\Tuleap\\User\\REST\\UserRepresentation'; $user_representation = new $class_user_representation(); $user_representation->build($user); return $user_representation; }
public function format(Tracker_Artifact_Changeset $changeset) { return array('id' => $changeset->getId(), 'submitted_by' => $changeset->getSubmittedBy(), 'submitted_on' => date('c', $changeset->getSubmittedOn()), 'email' => $changeset->getEmail(), 'html' => $this->getChangeContentForJson($changeset)); }
/** * Returns the HTML code of this comment * * @param String $format Format of the output * @param Boolean $forMail If the output is intended for mail notification then value should be true * @param Boolean $ignoreEmptyBody If true then display the user and the time even if the body is empty * * @return string the HTML code of this comment */ public function fetchFollowUp($format = 'html', $forMail = false, $ignoreEmptyBody = false) { if ($ignoreEmptyBody || !empty($this->body)) { $uh = UserHelper::instance(); $hp = Codendi_HTMLPurifier::instance(); switch ($format) { case 'html': $html = ''; if ($forMail) { $html .= '<div class="tracker_artifact_followup_title">'; $html .= '<span class="tracker_artifact_followup_title_user">'; $user = UserManager::instance()->getUserById($this->submitted_by); if ($user && !$user->isAnonymous()) { $html .= '<a href="mailto:' . $hp->purify($user->getEmail()) . '">' . $hp->purify($user->getRealName()) . ' (' . $hp->purify($user->getUserName()) . ')</a>'; } else { $user = UserManager::instance()->getUserAnonymous(); $user->setEmail($this->changeset->getEmail()); $html .= $GLOBALS['Language']->getText('tracker_include_artifact', 'anon_user'); } $html .= '</span></div>'; $timezone = ''; if ($user->getId() != 0) { $timezone = ' (' . $user->getTimezone() . ')'; } $html .= '<div class="tracker_artifact_followup_date">' . format_date($GLOBALS['Language']->getText('system', 'datefmt'), $this->submitted_on) . $timezone . '</div>'; $html .= '</div>'; if (Config::get('sys_enable_avatars')) { $html .= '<div class="tracker_artifact_followup_avatar">'; $html .= $user->fetchHtmlAvatar(); $html .= '</div>'; } $html .= '<div class="tracker_artifact_followup_content">'; $html .= '<div class="tracker_artifact_followup_comment">'; } else { $html .= '<div class="tracker_artifact_followup_comment_edited_by">'; if ($this->parent_id) { $html .= $GLOBALS['Language']->getText('plugin_tracker_include_artifact', 'last_edited'); $html .= ' ' . $uh->getLinkOnUserFromUserId($this->submitted_by) . ' '; $html .= DateHelper::timeAgoInWords($this->submitted_on, false, true); } $html .= '</div>'; } if (!$forMail || !empty($this->body)) { $html .= '<input type="hidden" id="tracker_artifact_followup_comment_body_format_' . $this->changeset->getId() . '" name="tracker_artifact_followup_comment_body_format_' . $this->changeset->getId() . '" value="' . $this->bodyFormat . '" >'; $html .= '<div class="tracker_artifact_followup_comment_body">'; if ($this->parent_id && !trim($this->body)) { $html .= '<em>' . $GLOBALS['Language']->getText('plugin_tracker_include_artifact', 'comment_cleared') . '</em>'; } else { $html .= $this->getPurifiedBodyForHTML(); } $html .= '</div>'; } if ($forMail) { $html .= '</div>'; } return $html; break; default: $output = ''; //if ($this->parent_id) { //$output .= $GLOBALS['Language']->getText('plugin_tracker_include_artifact', 'last_edited'); //$output .= ' '.$uh->getDisplayNameFromUserId($this->submitted_by); //$output .= ' '.DateHelper::timeAgoInWords($this->submitted_on).PHP_EOL; //} if (!empty($this->body)) { $body = $this->getPurifiedBodyForText(); $output .= PHP_EOL . PHP_EOL . $body . PHP_EOL . PHP_EOL; } return $output; break; } } else { return null; } }
public function getFullRESTValueForAnonymous(Tracker_Artifact_Changeset $changeset) { return array('label' => $changeset->getEmail(), 'display_name' => $changeset->getEmail(), 'user_url' => null, 'avatar_url' => null); }