示例#1
0
    if (!isset($include_issue_title) || $include_issue_title == false) {
        ?>
margin-top: -7px; margin-bottom: 10px;<?php 
    }
    ?>
">
            <?php 
    switch ($log_action['change_type']) {
        case \thebuggenie\core\entities\tables\Log::LOG_ISSUE_CREATED:
            echo '<i>' . __('Issue created') . '</i>';
            if (isset($include_details) && $include_details) {
                echo '<div class="timeline_inline_details">' . nl2br(__e($issue->getDescription())) . '</div>';
            }
            break;
        case \thebuggenie\core\entities\tables\Log::LOG_COMMENT:
            $comment = \thebuggenie\core\entities\Comment::getB2DBTable()->selectById((int) $log_action['text']);
            echo '<div class="timeline_inline_details">';
            echo nl2br(tbg_truncateText(tbg_decodeUTF8($comment->getContent())));
            echo '</div>';
            break;
        case \thebuggenie\core\entities\tables\Log::LOG_ISSUE_CLOSE:
            echo '<span class="issue_closed"><i>' . __('Issue closed %text', array('%text' => $log_action['text'])) . '</i></span>';
            break;
        case \thebuggenie\core\entities\tables\Log::LOG_ISSUE_REOPEN:
            echo '<i>' . __('Issue reopened') . '</i>';
            break;
        case \thebuggenie\core\entities\tables\Log::LOG_ISSUE_UPDATE:
            echo '<i>' . $log_action['text'] . '</i>';
            break;
        case \thebuggenie\core\entities\tables\Log::LOG_ISSUE_PAIN_BUG_TYPE:
            echo '<i>' . __('Triaged bug type: %text', array('%text' => $log_action['text'])) . '</i>';
示例#2
0
 public function runUpdateComment(framework\Request $request)
 {
     framework\Context::loadLibrary('ui');
     $comment = entities\Comment::getB2DBTable()->selectById($request['comment_id']);
     if ($comment instanceof entities\Comment) {
         if (!$comment->canUserEdit(framework\Context::getUser())) {
             $this->getResponse()->setHttpStatus(400);
             return $this->renderJSON(array('error' => framework\Context::getI18n()->__('You are not allowed to do this')));
         } else {
             if ($request['comment_body'] == '') {
                 $this->getResponse()->setHttpStatus(400);
                 return $this->renderJSON(array('error' => framework\Context::getI18n()->__('The comment must have some content')));
             }
             if ($comment->getTarget() instanceof entities\Issue) {
                 framework\Context::setCurrentProject($comment->getTarget()->getProject());
             }
             $comment->setContent($request->getRawParameter('comment_body'));
             $comment->setIsPublic($request['comment_visibility']);
             $comment->setSyntax($request['comment_body_syntax']);
             $comment->setUpdatedBy($this->getUser()->getID());
             $comment->save();
             framework\Context::loadLibrary('common');
             $body = $comment->getParsedContent();
             return $this->renderJSON(array('title' => framework\Context::getI18n()->__('Comment edited!'), 'comment_body' => $body));
         }
     } else {
         $this->getResponse()->setHttpStatus(400);
         return $this->renderJSON(array('error' => framework\Context::getI18n()->__('Comment ID is invalid')));
     }
 }