Updated the timeline to link to the author profile.
This commit is contained in:
parent
5bd4fed8f4
commit
b660c6782f
@ -172,6 +172,8 @@ class IDF_Commit extends Pluf_Model
|
||||
$out = '<tr class="log"><td><a href="'.$url.'">'.
|
||||
Pluf_esc(Pluf_Template_dateAgo($this->creation_dtime, 'without')).
|
||||
'</a></td><td>';
|
||||
$stag = new IDF_Template_ShowUser();
|
||||
$user = $stag->start($this->get_author(), $request, $this->origauthor, false);
|
||||
$tag = new IDF_Template_IssueComment();
|
||||
$out .= $tag->start($this->summary, $request, false);
|
||||
if (0 && $this->fullmessage) {
|
||||
@ -181,7 +183,7 @@ class IDF_Commit extends Pluf_Model
|
||||
</tr>
|
||||
<tr class="extra">
|
||||
<td colspan="2">
|
||||
<div class="helptext right">'.__('Commit').' <a href="'.$url.'" class="mono">'.$this->scm_id.'</a>, '.__('by').' '.strip_tags($this->origauthor).'</div></td></tr>';
|
||||
<div class="helptext right">'.__('Commit').' <a href="'.$url.'" class="mono">'.$this->scm_id.'</a>, '.__('by').' '.$user.'</div></td></tr>';
|
||||
return Pluf_Template::markSafe($out);
|
||||
}
|
||||
|
||||
|
@ -188,11 +188,12 @@ class IDF_Issue extends Pluf_Model
|
||||
$out = '<tr class="log"><td><a href="'.$url.'">'.
|
||||
Pluf_esc(Pluf_Template_dateAgo($this->creation_dtime, 'without')).
|
||||
'</a></td><td>';
|
||||
$submitter = $this->get_submitter();
|
||||
$stag = new IDF_Template_ShowUser();
|
||||
$user = $stag->start($this->get_submitter(), $request, '', false);
|
||||
$ic = (in_array($this->status, $request->project->getTagIdsByStatus('closed'))) ? 'issue-c' : 'issue-o';
|
||||
$out .= sprintf(__('<a href="%1$s" class="%2$s" title="View issue">Issue %3$d</a>, %4$s'), $url, $ic, $this->id, Pluf_esc($this->summary)).'</td>';
|
||||
$out .= "\n".'<tr class="extra"><td colspan="2">
|
||||
<div class="helptext right">'.sprintf(__('Creation of <a href="%s" class="%s">issue %d</a>'), $url, $ic, $this->id).', '.__('by').' '.Pluf_esc($submitter).'</div></td></tr>';
|
||||
<div class="helptext right">'.sprintf(__('Creation of <a href="%s" class="%s">issue %d</a>'), $url, $ic, $this->id).', '.__('by').' '.$user.'</div></td></tr>';
|
||||
return Pluf_Template::markSafe($out);
|
||||
}
|
||||
|
||||
|
@ -136,7 +136,9 @@ class IDF_IssueComment extends Pluf_Model
|
||||
$out = "\n".'<tr class="log"><td><a href="'.$url.'">'.
|
||||
Pluf_esc(Pluf_Template_dateAgo($this->creation_dtime, 'without')).
|
||||
'</a></td><td>';
|
||||
$submitter = $this->get_submitter();
|
||||
$stag = new IDF_Template_ShowUser();
|
||||
$user = $stag->start($this->get_submitter(), $request, '', false);
|
||||
|
||||
$ic = (in_array($issue->status, $request->project->getTagIdsByStatus('closed'))) ? 'issue-c' : 'issue-o';
|
||||
$out .= sprintf(__('<a href="%1$s" class="%2$s" title="View issue">Issue %3$d</a>, %4$s'), $url, $ic, $issue->id, Pluf_esc($issue->summary));
|
||||
|
||||
@ -168,7 +170,7 @@ class IDF_IssueComment extends Pluf_Model
|
||||
|
||||
|
||||
$out .= "\n".'<tr class="extra"><td colspan="2">
|
||||
<div class="helptext right">'.sprintf(__('Comment on <a href="%s" class="%s">issue %d</a>'), $url, $ic, $issue->id).', '.__('by').' '.Pluf_esc($submitter).'</div></td></tr>';
|
||||
<div class="helptext right">'.sprintf(__('Comment on <a href="%s" class="%s">issue %d</a>'), $url, $ic, $issue->id).', '.__('by').' '.$user.'</div></td></tr>';
|
||||
|
||||
return Pluf_Template::markSafe($out);
|
||||
}
|
||||
|
@ -85,6 +85,7 @@ class IDF_Middleware
|
||||
'issuetext' => 'IDF_Template_IssueComment',
|
||||
'timeline' => 'IDF_Template_TimelineFragment',
|
||||
'markdown' => 'IDF_Template_Markdown',
|
||||
'showuser' => 'IDF_Template_ShowUser',
|
||||
));
|
||||
$params['modifiers'] = array_merge($params['modifiers'],
|
||||
array(
|
||||
|
66
src/IDF/Template/ShowUser.php
Normal file
66
src/IDF/Template/ShowUser.php
Normal file
@ -0,0 +1,66 @@
|
||||
<?php
|
||||
/* -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# This file is part of InDefero, an open source project management application.
|
||||
# Copyright (C) 2008 Céondo Ltd and contributors.
|
||||
#
|
||||
# InDefero is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# InDefero is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
# ***** END LICENSE BLOCK ***** */
|
||||
|
||||
Pluf::loadFunction('Pluf_HTTP_URL_urlForView');
|
||||
|
||||
/**
|
||||
* Show the name of a user in a template.
|
||||
*
|
||||
* It will automatically make the link to the profile if needed. In
|
||||
* the future it will allow us to add little badges on the side of the
|
||||
* user based on karma or whatever.
|
||||
*
|
||||
* This will also provide a consistent display of a user name in the
|
||||
* application.
|
||||
*/
|
||||
class IDF_Template_ShowUser extends Pluf_Template_Tag
|
||||
{
|
||||
/**
|
||||
* We need the user object and the request.
|
||||
*
|
||||
* If the user object is null (for example a non associated
|
||||
* commit), we can use the $text value for an alternative display.
|
||||
*
|
||||
* @param Pluf_User
|
||||
* @param Pluf_HTTP_Request
|
||||
* @param string Alternate text ('')
|
||||
*/
|
||||
function start($user, $request, $text='', $echo=true)
|
||||
{
|
||||
if ($user == null) {
|
||||
$out = (strlen($text)) ? strip_tags($text) : __('Anonymous');
|
||||
} else {
|
||||
$url = Pluf_HTTP_URL_urlForView('IDF_Views_User::view',
|
||||
array($user->login));
|
||||
if (!$user->isAnonymous() and $user->id == $request->user->id) {
|
||||
$utext = __('Me');
|
||||
} else {
|
||||
$utext = Pluf_esc($user);
|
||||
}
|
||||
$out = sprintf('<a href="%s" class="username">%s</a>',
|
||||
$url, $utext);
|
||||
}
|
||||
if ($echo) echo $out;
|
||||
else return $out;
|
||||
}
|
||||
}
|
@ -177,11 +177,12 @@ class IDF_Upload extends Pluf_Model
|
||||
$out = '<tr class="log"><td><a href="'.$url.'">'.
|
||||
Pluf_esc(Pluf_Template_dateAgo($this->creation_dtime, 'without')).
|
||||
'</a></td><td>';
|
||||
$submitter = $this->get_submitter();
|
||||
$stag = new IDF_Template_ShowUser();
|
||||
$user = $stag->start($this->get_submitter(), $request, '', false);
|
||||
$out .= sprintf(__('<a href="%1$s" title="View download">Download %2$d</a>, %3$s'), $url, $this->id, Pluf_esc($this->summary)).'</td>';
|
||||
$out .= '</tr>';
|
||||
$out .= "\n".'<tr class="extra"><td colspan="2">
|
||||
<div class="helptext right">'.sprintf(__('Addition of <a href="%s">download %d</a>'), $url, $this->id).', '.__('by').' '.Pluf_esc($submitter).'</div></td></tr>';
|
||||
<div class="helptext right">'.sprintf(__('Addition of <a href="%s">download %d</a>'), $url, $this->id).', '.__('by').' '.$user.'</div></td></tr>';
|
||||
return Pluf_Template::markSafe($out);
|
||||
}
|
||||
|
||||
|
@ -192,10 +192,11 @@ class IDF_WikiPage extends Pluf_Model
|
||||
$out = '<tr class="log"><td><a href="'.$url.'">'.
|
||||
Pluf_esc(Pluf_Template_dateAgo($this->creation_dtime, 'without')).
|
||||
'</a></td><td>';
|
||||
$submitter = $this->get_submitter();
|
||||
$stag = new IDF_Template_ShowUser();
|
||||
$user = $stag->start($this->get_submitter(), $request, '', false);
|
||||
$out .= sprintf(__('<a href="%1$s" title="View page">%2$s</a>, %3$s'), $url, Pluf_esc($this->title), Pluf_esc($this->summary)).'</td>';
|
||||
$out .= "\n".'<tr class="extra"><td colspan="2">
|
||||
<div class="helptext right">'.sprintf(__('Creation of <a href="%s">page %s</a>'), $url, Pluf_esc($this->title)).', '.__('by').' '.Pluf_esc($submitter).'</div></td></tr>';
|
||||
<div class="helptext right">'.sprintf(__('Creation of <a href="%s">page %s</a>'), $url, Pluf_esc($this->title)).', '.__('by').' '.$user.'</div></td></tr>';
|
||||
return Pluf_Template::markSafe($out);
|
||||
}
|
||||
|
||||
|
@ -162,9 +162,9 @@ class IDF_WikiRevision extends Pluf_Model
|
||||
$out = "\n".'<tr class="log"><td><a href="'.$url.'">'.
|
||||
Pluf_esc(Pluf_Template_dateAgo($this->creation_dtime, 'without')).
|
||||
'</a></td><td>';
|
||||
$submitter = $this->get_submitter();
|
||||
$stag = new IDF_Template_ShowUser();
|
||||
$user = $stag->start($this->get_submitter(), $request, '', false);
|
||||
$out .= sprintf(__('<a href="%1$s" title="View page">%2$s</a>, %3$s'), $url, Pluf_esc($page->title), Pluf_esc($this->summary));
|
||||
//$out .= '<strong>'.__('Summary:').'</strong> '.Pluf_esc($this->summary).' ';
|
||||
if ($this->changedRevision()) {
|
||||
$out .= '<div class="issue-changes-timeline">';
|
||||
$changes = $this->changes;
|
||||
@ -186,7 +186,7 @@ class IDF_WikiRevision extends Pluf_Model
|
||||
}
|
||||
$out .= '</td></tr>';
|
||||
$out .= "\n".'<tr class="extra"><td colspan="2">
|
||||
<div class="helptext right">'.sprintf(__('Change of <a href="%s">%s</a>'), $url, Pluf_esc($page->title)).', '.__('by').' '.Pluf_esc($submitter).'</div></td></tr>';
|
||||
<div class="helptext right">'.sprintf(__('Change of <a href="%s">%s</a>'), $url, Pluf_esc($page->title)).', '.__('by').' '.$user.'</div></td></tr>';
|
||||
return Pluf_Template::markSafe($out);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user