InDefero

Sign in or create your account | Project List | Help

InDefero Commit Details

Date:2009-06-19 16:01:17 (8 months 20 days ago)
Author:Baptiste Durand-Bret
Commit:29e053bf6b800beee8f55405fe92f7566b6a1917
Message:Fixed issue 217, can't link directly to a user comment when linking to an issue

Files: src/IDF/Template/IssueComment.php (3 diffs)

Change Details

src/IDF/Template/IssueComment.php
4444                                 '<a href="\1">\1</a>', $text);
4545        }
4646        if ($request->rights['hasIssuesAccess']) {
47            $text = preg_replace_callback('#(issues?|bugs?|tickets?)\s+(\d+)((\s+and|\s+or|,)\s+(\d+)){0,}#im',
47            $text = preg_replace_callback('#(issues?|bugs?|tickets?)\s+(\d+)(\#ic\d*){0,1}((\s+and|\s+or|,)\s+(\d+)(\#ic\d*){0,1}){0,}#im',
4848                                          array($this, 'callbackIssues'), $text);
4949        }
5050        if ($request->rights['hasSourceAccess']) {
...... 
6666     */
6767    function callbackIssues($m)
6868    {
69        if (count($m) == 3) {
69        if (count($m) == 3 || count($m) == 4) {
7070            $issue = new IDF_Issue($m[2]);
7171            if ($issue->id > 0 and $issue->project == $this->project->id) {
72                return $this->linkIssue($issue, $m[1].' '.$m[2]);
72                if (count($m) == 3) {
73                    return $this->linkIssue($issue, $m[1].' '.$m[2]);
74                } else {
75                    return $this->linkIssue($issue, $m[1].' '.$m[2], $m[3]);
76                }
7377            } else {
7478                return $m[0]; // not existing issue.
7579            }
...... 
156160     * @param string Name of the link.
157161     * @return string Linked issue.
158162     */
159    public function linkIssue($issue, $title)
163    public function linkIssue($issue, $title, $anchor='')
160164    {
161165        $ic = (in_array($issue->status, $this->project->getTagIdsByStatus('closed'))) ? 'issue-c' : 'issue-o';
162166        return '<a href="'.Pluf_HTTP_URL_urlForView('IDF_Views_Issue::view',
163                                                    array($this->project->shortname, $issue->id)).'" class="'.$ic.'" title="'.Pluf_esc($issue->summary).'">'.Pluf_esc($title).'</a>';
167                                                    array($this->project->shortname, $issue->id)).$anchor.'" class="'.$ic.'" title="'.Pluf_esc($issue->summary).'">'.Pluf_esc($title).'</a>';
164168    }
165169}

Archive Download the corresponding diff file

Branches:
dev
master
newdiff
svn