Indefero

Indefero Commit Details


Date:2010-04-29 16:35:57 (14 years 7 months ago)
Author:Thomas Keller
Branch:develop, feature-issue_links, feature.better-home, feature.content-md5, feature.diff-whitespace, feature.download-md5, feature.issue-links, feature.issue-of-others, feature.issue-summary, feature.search-filter, feature.webrepos, feature.wiki-default-page, master, release-1.1, release-1.2, release-1.3
Commit:995f1a13c3b17aac73aa7f0dcdbe5ddb021b404f
Parents: cf22909722bb54602bc8bca2e71737f17351ee5e
Message:Add a new view modifier which allows the shortening of long strings such as branch or tag names. Use that in the tree view and display the full name in a title tag.

Changes:

File differences

src/IDF/Middleware.php
9292
9393
9494
95
9596
9697
9798
......
104105
105106
106107
107
108
108109
109
110
110111
111112
112113
array(
'size' => 'IDF_Views_Source_PrettySize',
'ssize' => 'IDF_Views_Source_PrettySizeSimple',
'shorten' => 'IDF_Views_Source_ShortenString',
));
}
}
$c['isAdmin'] = ($request->user->administrator or $request->user->staff);
if (isset($request->project)) {
$c['project'] = $request->project;
$c['isOwner'] = $request->user->hasPerm('IDF.project-owner',
$c['isOwner'] = $request->user->hasPerm('IDF.project-owner',
$request->project);
$c['isMember'] = $request->user->hasPerm('IDF.project-member',
$c['isMember'] = $request->user->hasPerm('IDF.project-member',
$request->project);
$c = array_merge($c, $request->rights);
}
src/IDF/Views/Source.php
3535
3636
3737
38
39
40
41
38
39
40
41
4242
4343
4444
......
415415
416416
417417
418
418
419419
420420
421421
......
476476
477477
478478
479
479
480480
481481
482482
......
597597
598598
599599
600
601
602
603
604
605
606
607
608
609
610
611
612
* Extension supported by the syntax highlighter.
*/
public static $supportedExtenstions = array(
'ascx', 'ashx', 'asmx', 'aspx', 'browser', 'bsh', 'c', 'cc',
'config', 'cpp', 'cs', 'csh','csproj', 'css', 'cv', 'cyc',
'html', 'html', 'java', 'js', 'master', 'perl', 'php', 'pl',
'pm', 'py', 'rb', 'sh', 'sitemap', 'skin', 'sln', 'svc', 'vala',
'ascx', 'ashx', 'asmx', 'aspx', 'browser', 'bsh', 'c', 'cc',
'config', 'cpp', 'cs', 'csh','csproj', 'css', 'cv', 'cyc',
'html', 'html', 'java', 'js', 'master', 'perl', 'php', 'pl',
'pm', 'py', 'rb', 'sh', 'sitemap', 'skin', 'sln', 'svc', 'vala',
'vb', 'vbproj', 'wsdl', 'xhtml', 'xml', 'xsd', 'xsl', 'xslt');
/**
$scm->getMainBranch()));
return new Pluf_HTTP_Response_Redirect($url);
}
$info = self::getRequestedFileMimeType($request_file_info,
$info = self::getRequestedFileMimeType($request_file_info,
$commit, $scm);
$rep = new Pluf_HTTP_Response($scm->getFile($request_file_info),
$info[0]);
public static function getMimeTypeFromContent($file, $filedata)
{
$info = pathinfo($file);
$res = array('application/octet-stream',
$res = array('application/octet-stream',
$info['basename'],
isset($info['extension']) ? $info['extension'] : 'bin');
if (function_exists('finfo_open')) {
return Pluf_Utils::prettySize($size);
}
function IDF_Views_Source_ShortenString($string, $length)
{
$ellipse = "...";
$length = max(strlen($ellipse) + 2, $length);
$preflen = ceil($length / 10);
if (mb_strlen($string) < $length)
return $string;
return substr($string, 0, $preflen).$ellipse.
substr($string, -($length - $preflen - mb_strlen($ellipse)));
}
src/IDF/templates/idf/source/mtn/tree.html
5858
5959
6060
61
61
62
63
6264
6365
6466
6567
6668
6769
68
70
71
72
6973
7074
7175
<p><strong>{trans 'Branches:'}</strong><br/>
{foreach $branches as $branch => $path}
{aurl 'url', 'IDF_Views_Source::treeBase', array($project.shortname, $branch)}
<span class="label{if in_array($branch, $tree_in)} active{/if}"><a href="{$url}" class="label">{if $path}{$path}{else}{$branch}{/if}</a></span><br/>
<span class="label{if in_array($branch, $tree_in)} active{/if}"><a href="{$url}" class="label" title="{if $path}{$path}{else}{$branch}{/if}">
{if $path}{$path|shorten:25}{else}{$branch|shorten:25}{/if}
</a></span><br/>
{/foreach}
</p>
{if $tags}
<p><strong>{trans 'Tags:'}</strong><br/>
{foreach $tags as $tag => $path}
{aurl 'url', 'IDF_Views_Source::treeBase', array($project.shortname, $tag)}
<span class="label{if in_array($tag, $tags_in)} active{/if}"><a href="{$url}" class="label">{if $path}{$path}{else}{$tag}{/if}</a></span><br/>
<span class="label{if in_array($tag, $tags_in)} active{/if}"><a href="{$url}" class="label" title="{if $path}{$path}{else}{$tag}{/if}">
{if $path}{$path|shorten:25}{else}{$tag|shorten:25}{/if}
</a></span><br/>
{/foreach}
</p>
{/if}

Archive Download the corresponding diff file

Page rendered in 0.09208s using 13 queries.