diff --git a/src/IDF/Diff.php b/src/IDF/Diff.php index f097183..a9be715 100644 --- a/src/IDF/Diff.php +++ b/src/IDF/Diff.php @@ -71,7 +71,7 @@ class IDF_Diff $current_chunk = 0; $indiff = true; continue; - } else if (0 === strpos($line, '=========')) { + } else if (!$indiff && 0 === strpos($line, '=========')) { // ignore pseudo stanzas with a hint of a binary file if (preg_match("/^# (.+) is binary/", $this->lines[$i])) continue; diff --git a/src/IDF/Key.php b/src/IDF/Key.php index 2320d8f..8896bdc 100644 --- a/src/IDF/Key.php +++ b/src/IDF/Key.php @@ -84,7 +84,7 @@ class IDF_Key extends Pluf_Model return array('ssh', $m[2], $m[1]); } - throw new Exception('invalid or unknown key data detected'); + throw new Exception(__('Invalid or unknown key data detected.')); } /** diff --git a/src/IDF/Plugin/SyncGit/Cron.php b/src/IDF/Plugin/SyncGit/Cron.php index cbcf8f6..f47063d 100644 --- a/src/IDF/Plugin/SyncGit/Cron.php +++ b/src/IDF/Plugin/SyncGit/Cron.php @@ -48,7 +48,13 @@ class IDF_Plugin_SyncGit_Cron $out = ''; $keys = Pluf::factory('IDF_Key')->getList(array('view'=>'join_user')); foreach ($keys as $key) { - if ($key->getType() == 'ssh' and preg_match('/^[a-zA-Z][a-zA-Z0-9_.-]*(@[a-zA-Z][a-zA-Z0-9.-]*)?$/', $key->login)) { + try { + $key_type = $key->getType(); + } catch (Exception $e) { + // The key is a bad key, skip it + continue; + } + if ($key_type == 'ssh' and preg_match('/^[a-zA-Z][a-zA-Z0-9_.-]*(@[a-zA-Z][a-zA-Z0-9.-]*)?$/', $key->login)) { $content = trim(str_replace(array("\n", "\r"), '', $key->content)); $out .= sprintf($template, $cmd, $key->login, $content)."\n"; } diff --git a/src/IDF/Scm/Svn.php b/src/IDF/Scm/Svn.php index ce90403..1904079 100644 --- a/src/IDF/Scm/Svn.php +++ b/src/IDF/Scm/Svn.php @@ -433,6 +433,9 @@ class IDF_Scm_Svn extends IDF_Scm $res['date'] = gmdate('Y-m-d H:i:s', strtotime((string) $xml->logentry->date)); $res['title'] = (string) $xml->logentry->msg; $res['commit'] = (string) $xml->logentry['revision']; + $res['parents'] = $xml->logentry['revision'] > 1 + ? array((string) $xml->logentry['revision'] - 1) + : array(); $res['diff'] = ($getdiff) ? $this->getDiff($commit) : ''; $res['tree'] = ''; $res['branch'] = ''; diff --git a/src/IDF/templates/idf/list-filter.html b/src/IDF/templates/idf/list-filter.html index a2a606a..e788464 100644 --- a/src/IDF/templates/idf/list-filter.html +++ b/src/IDF/templates/idf/list-filter.html @@ -8,29 +8,35 @@ {literal} $(document).ready(function() { $("input.filter-list").each(function() { - var lists = $("ul#" + $(this).attr("rel")); + var input = $(this); + var lists = $("ul#" + input.attr("rel")); if (lists.length == 0) return; var list = $(lists[0]); + var wrapper = input.parent(); // a list should contain a reasonable amount of items // to be filterable - we also give the filter input a // special class here so we recognize it later in case // we have to hide it when the list view is collapsed if (list.children("li").length > 10) { - $(this).addClass("activated"); - $(this).focus(function() { + wrapper.addClass("activated"); + input.focus(function() { // ensure that the parent of the list keeps activated / opened list.parent().addClass("activated"); - if ($(this)[0].value == $(this).attr("title")) - $(this).attr("value", "").removeClass("default"); + if (input.attr("value") == input.attr("title")) { + input.attr("value", ""); + wrapper.removeClass("default"); + } }); - $(this).blur(function() { + input.blur(function() { list.parent().removeClass("activated"); - if ($(this)[0].value.length == 0) - $(this).attr("value", $(this).attr("title")).addClass("default"); + if (input.attr("value").length == 0) { + input.attr("value", input.attr("title")); + wrapper.addClass("default"); + } }); - $(this).keyup(function(ev) { + input.keyup(function(ev) { var filter = $(this)[0]; list.children("li").css('display', 'block'); list.children("li").filter(function(index) { @@ -41,9 +47,11 @@ $(document).ready(function() { return true; }).css('display', 'none'); }); + wrapper.children('span').click(function() { + input.val('').keyup().blur(); + }); // initialize it with the default - $(this)[0].value = ""; - $(this).blur(); + input.val('').blur(); } }); }); diff --git a/src/IDF/templates/idf/source/commit.html b/src/IDF/templates/idf/source/commit.html index 4c5814e..e07d373 100644 --- a/src/IDF/templates/idf/source/commit.html +++ b/src/IDF/templates/idf/source/commit.html @@ -29,20 +29,20 @@ {foreach $changes.deletions as $filename} - + {/foreach} {foreach $changes.renames as $oldname => $newname} - + {/foreach} {foreach $changes.additions as $filename} - + {/foreach} {foreach $changes.patches as $filename} {assign $ndiff = count($diff.files[$filename]['chunks'])} - + {/foreach} {foreach $changes.properties as $filename => $properties} -
D{$filename}{if !empty($diff.files[$filename])} ({trans 'full'}){/if}
D{$filename}{if !empty($diff.files[$filename])} ({trans 'full'}){/if}
R{$oldname} -> {$newname}
R{$oldname} → {$newname}
A{$filename}{if !empty($diff.files[$filename])} ({trans 'full'}){/if}
A{$filename}{if !empty($diff.files[$filename])} ({trans 'full'}){/if}
M{$filename}{if !empty($diff.files[$filename])} ({blocktrans $ndiff}{$ndiff} diff{plural}{$ndiff} diffs{/blocktrans}){/if}
M{$filename}{if !empty($diff.files[$filename])} ({blocktrans $ndiff}{$ndiff} diff{plural}{$ndiff} diffs{/blocktrans}){/if}
P{$filename} +
P{$filename} {foreach $properties as $key => $value} diff --git a/src/IDF/templates/idf/source/git/branch_tag_list.html b/src/IDF/templates/idf/source/git/branch_tag_list.html new file mode 100644 index 0000000..b9c4026 --- /dev/null +++ b/src/IDF/templates/idf/source/git/branch_tag_list.html @@ -0,0 +1,39 @@ +{if !$view_url} +{assign $view_url = 'IDF_Views_Source::treeBase'} +{/if} +
+
+

+ {trans 'Branches'} + + + + +

+ +{if $tags} +

+ {trans 'Tags'} + + + + +

+ +{/if} +
+ diff --git a/src/IDF/templates/idf/source/git/changelog.html b/src/IDF/templates/idf/source/git/changelog.html index fa92f24..a5a82bd 100644 --- a/src/IDF/templates/idf/source/git/changelog.html +++ b/src/IDF/templates/idf/source/git/changelog.html @@ -1,17 +1,5 @@ {extends "idf/source/changelog.html"} {block context} -

{trans 'Branches:'}
-{foreach $branches as $branch => $path} -{aurl 'url', 'IDF_Views_Source::changeLog', array($project.shortname, $branch)} -{if $path}{$path}{else}{$branch}{/if}
-{/foreach} -

-{if $tags} -

{trans 'Tags:'}
-{foreach $tags as $tag => $path} -{aurl 'url', 'IDF_Views_Source::changeLog', array($project.shortname, $tag)} -{if $path}{$path}{else}{$tag}{/if}
-{/foreach} -

-{/if} +{assign $view_url = 'IDF_Views_Source::changeLog'} +{include 'idf/source/git/branch_tag_list.html'} {/block} diff --git a/src/IDF/templates/idf/source/git/commit.html b/src/IDF/templates/idf/source/git/commit.html index f177d30..8421adf 100644 --- a/src/IDF/templates/idf/source/git/commit.html +++ b/src/IDF/templates/idf/source/git/commit.html @@ -1,18 +1,5 @@ {extends "idf/source/commit.html"} {block context} -

{trans 'Branches:'}
-{foreach $branches as $branch => $path} -{aurl 'url', 'IDF_Views_Source::treeBase', array($project.shortname, $branch)} -{$branch}
-{/foreach} -

-{if $tags} -

{trans 'Tags:'}
-{foreach $tags as $tag => $path} -{aurl 'url', 'IDF_Views_Source::treeBase', array($project.shortname, $tag)} -{if $path}{$path}{else}{$tag}{/if}
-{/foreach} -

-{/if} +{include 'idf/source/git/branch_tag_list.html'} {/block} diff --git a/src/IDF/templates/idf/source/git/file.html b/src/IDF/templates/idf/source/git/file.html index 77b33d8..01691ad 100644 --- a/src/IDF/templates/idf/source/git/file.html +++ b/src/IDF/templates/idf/source/git/file.html @@ -6,7 +6,7 @@
{$key}
{if !$tree_in and !$tags_in} -{aurl 'url', 'IDF_Views_Source::commit', array($project.shortname, $commit)} +{aurl 'url', 'IDF_Views_Source::commit', array($project.shortname, $commit)}
{blocktrans}Source at commit {$commit} created {$cobject.date|dateago}.{/blocktrans}
{blocktrans}By {$cobject.author|strip_tags|trim}, {$cobject.title}{/blocktrans} @@ -22,20 +22,7 @@ {/block} {block context} -

{trans 'Branches:'}
-{foreach $branches as $branch => $path} -{aurl 'url', 'IDF_Views_Source::treeBase', array($project.shortname, $branch)} -{if $path}{$path}{else}{$branch}{/if}
-{/foreach} -

-{if $tags} -

{trans 'Tags:'}
-{foreach $tags as $tag => $path} -{aurl 'url', 'IDF_Views_Source::treeBase', array($project.shortname, $tag)} -{if $path}{$path}{else}{$tag}{/if}
-{/foreach} -

-{/if} +{include 'idf/source/git/branch_tag_list.html'} {/block} {block javascript} diff --git a/src/IDF/templates/idf/source/git/tree.html b/src/IDF/templates/idf/source/git/tree.html index 0f5d0eb..e349376 100644 --- a/src/IDF/templates/idf/source/git/tree.html +++ b/src/IDF/templates/idf/source/git/tree.html @@ -52,18 +52,5 @@ {/block} {block context} -

{trans 'Branches:'}
-{foreach $branches as $branch => $path} -{aurl 'url', 'IDF_Views_Source::treeBase', array($project.shortname, $branch)} -{if $path}{$path}{else}{$branch}{/if}
-{/foreach} -

-{if $tags} -

{trans 'Tags:'}
-{foreach $tags as $tag => $path} -{aurl 'url', 'IDF_Views_Source::treeBase', array($project.shortname, $tag)} -{if $path}{$path}{else}{$tag}{/if}
-{/foreach} -

-{/if} +{include 'idf/source/git/branch_tag_list.html'} {/block} diff --git a/src/IDF/templates/idf/source/mercurial/branch_tag_list.html b/src/IDF/templates/idf/source/mercurial/branch_tag_list.html new file mode 100644 index 0000000..98b3312 --- /dev/null +++ b/src/IDF/templates/idf/source/mercurial/branch_tag_list.html @@ -0,0 +1,39 @@ +{if !$view_url} +{assign $view_url = 'IDF_Views_Source::treeBase'} +{/if} +
+
+

+ {trans 'Branches'} + + + + +

+
    +{foreach $branches as $branch => $path} +{aurl 'url', $view_url, array($project.shortname, $branch)} +
  • + {$branch} +
  • +{/foreach} +
+{if $tags} +

+ {trans 'Tags'} + + + + +

+
    +{foreach $tags as $tag => $path} +{aurl 'url', $view_url, array($project.shortname, $tag)} +
  • + {$tag} +
  • +{/foreach} +
+{/if} +
+ diff --git a/src/IDF/templates/idf/source/mercurial/changelog.html b/src/IDF/templates/idf/source/mercurial/changelog.html index c3c5772..8fb2ac3 100644 --- a/src/IDF/templates/idf/source/mercurial/changelog.html +++ b/src/IDF/templates/idf/source/mercurial/changelog.html @@ -1,18 +1,6 @@ {extends "idf/source/changelog.html"} {block context} -

{trans 'Branches:'}
-{foreach $branches as $branch => $path} -{aurl 'url', 'IDF_Views_Source::changeLog', array($project.shortname, $branch)} -{$branch}
-{/foreach} -

-{if $tags} -

{trans 'Tags:'}
-{foreach $tags as $tag => $path} -{aurl 'url', 'IDF_Views_Source::changeLog', array($project.shortname, $tag)} -{$tag}
-{/foreach} -

-{/if} +{assign $view_url = 'IDF_Views_Source::changeLog'} +{include 'idf/source/mercurial/branch_tag_list.html'} {/block} diff --git a/src/IDF/templates/idf/source/mercurial/commit.html b/src/IDF/templates/idf/source/mercurial/commit.html index f177d30..707cb23 100644 --- a/src/IDF/templates/idf/source/mercurial/commit.html +++ b/src/IDF/templates/idf/source/mercurial/commit.html @@ -1,18 +1,5 @@ {extends "idf/source/commit.html"} {block context} -

{trans 'Branches:'}
-{foreach $branches as $branch => $path} -{aurl 'url', 'IDF_Views_Source::treeBase', array($project.shortname, $branch)} -{$branch}
-{/foreach} -

-{if $tags} -

{trans 'Tags:'}
-{foreach $tags as $tag => $path} -{aurl 'url', 'IDF_Views_Source::treeBase', array($project.shortname, $tag)} -{if $path}{$path}{else}{$tag}{/if}
-{/foreach} -

-{/if} +{include 'idf/source/mercurial/branch_tag_list.html'} {/block} diff --git a/src/IDF/templates/idf/source/mercurial/file.html b/src/IDF/templates/idf/source/mercurial/file.html index c2e2968..25d4572 100644 --- a/src/IDF/templates/idf/source/mercurial/file.html +++ b/src/IDF/templates/idf/source/mercurial/file.html @@ -7,7 +7,7 @@ {if !$tree_in} -{aurl 'url', 'IDF_Views_Source::commit', array($project.shortname, $commit)} +{aurl 'url', 'IDF_Views_Source::commit', array($project.shortname, $commit)} {if !$tree_in and !$tags_in} -{aurl 'url', 'IDF_Views_Source::commit', array($project.shortname, $commit)} +{aurl 'url', 'IDF_Views_Source::commit', array($project.shortname, $commit)} + {else}{/if} {/if} @@ -47,17 +47,6 @@ {/block} {block context} -

{trans 'Branches:'}
-{foreach $branches as $branch => $path} -{aurl 'url', 'IDF_Views_Source::treeBase', array($project.shortname, $branch)} -{$branch}
-{/foreach} -

-{if $tags}

{trans 'Tags:'}
-{foreach $tags as $tag => $path} -{aurl 'url', 'IDF_Views_Source::treeBase', array($project.shortname, $tag)} -{$tag}
-{/foreach} -

{/if} +{include 'idf/source/mercurial/branch_tag_list.html'} {/block} diff --git a/src/IDF/templates/idf/source/mtn/branch_tag_list.html b/src/IDF/templates/idf/source/mtn/branch_tag_list.html new file mode 100644 index 0000000..c0a772f --- /dev/null +++ b/src/IDF/templates/idf/source/mtn/branch_tag_list.html @@ -0,0 +1,39 @@ +{if !$view_url} +{assign $view_url = 'IDF_Views_Source::treeBase'} +{/if} +
+
+

+ {trans 'Branches'} + + + + +

+
    +{foreach $branches as $selector => $branch} +{aurl 'url', $view_url, array($project.shortname, $selector)} +
  • + {$branch} +
  • +{/foreach} +
+{if $tags} +

+ {trans 'Tags'} + + + + +

+
    +{foreach $tags as $selector => $tag} +{aurl 'url', $view_url, array($project.shortname, $selector)} +
  • + {$tag} +
  • +{/foreach} +
+{/if} +
+ diff --git a/src/IDF/templates/idf/source/mtn/changelog.html b/src/IDF/templates/idf/source/mtn/changelog.html index 3db65d6..cb124a6 100644 --- a/src/IDF/templates/idf/source/mtn/changelog.html +++ b/src/IDF/templates/idf/source/mtn/changelog.html @@ -1,32 +1,5 @@ {extends "idf/source/changelog.html"} {block context} -
-
-

- {trans 'Branches'} - -

-
    -{foreach $branches as $selector => $branch} -{aurl 'url', 'IDF_Views_Source::changeLog', array($project.shortname, $selector)} -
  • - {$branch} -
  • -{/foreach} -
-{if $tags} -

- {trans 'Tags'} - -

-
    -{foreach $tags as $selector => $tag} -{aurl 'url', 'IDF_Views_Source::changeLog', array($project.shortname, $selector)} -
  • - {$tag} -
  • -{/foreach} -
-{/if} -
+{assign $view_url = 'IDF_Views_Source::changeLog'} +{include 'idf/source/mtn/branch_tag_list.html'} {/block} diff --git a/src/IDF/templates/idf/source/mtn/commit.html b/src/IDF/templates/idf/source/mtn/commit.html index ee97616..bec83e2 100644 --- a/src/IDF/templates/idf/source/mtn/commit.html +++ b/src/IDF/templates/idf/source/mtn/commit.html @@ -1,32 +1,4 @@ {extends "idf/source/commit.html"} {block context} -
-
-

- {trans 'Branches'} - -

-
    -{foreach $branches as $selector => $branch} -{aurl 'url', 'IDF_Views_Source::treeBase', array($project.shortname, $selector)} -
  • - {$branch} -
  • -{/foreach} -
-{if $tags} -

- {trans 'Tags'} - -

-
    -{foreach $tags as $selector => $tag} -{aurl 'url', 'IDF_Views_Source::treeBase', array($project.shortname, $selector)} -
  • - {$tag} -
  • -{/foreach} -
-{/if} -
+{include 'idf/source/mtn/branch_tag_list.html'} {/block} diff --git a/src/IDF/templates/idf/source/mtn/file.html b/src/IDF/templates/idf/source/mtn/file.html index 6190557..2901c60 100644 --- a/src/IDF/templates/idf/source/mtn/file.html +++ b/src/IDF/templates/idf/source/mtn/file.html @@ -19,33 +19,12 @@
{blocktrans}Source at commit {$commit} created {$cobject.date|dateago}.{/blocktrans}
{blocktrans}By {$cobject.author|strip_tags|trim}, {$cobject.title}{/blocktrans} @@ -23,20 +23,7 @@ {/block} {block context} -

{trans 'Branches:'}
-{foreach $branches as $branch => $path} -{aurl 'url', 'IDF_Views_Source::treeBase', array($project.shortname, $branch)} -{$branch}
-{/foreach} -

-{if $tags} -

{trans 'Tags:'}
-{foreach $tags as $tag => $path} -{aurl 'url', 'IDF_Views_Source::tree', array($project.shortname, 'HEAD', $path)} -{$tag}
-{/foreach} -

-{/if} +{include 'idf/source/mercurial/branch_tag_list.html'} {/block} {block javascript} diff --git a/src/IDF/templates/idf/source/mercurial/tree.html b/src/IDF/templates/idf/source/mercurial/tree.html index 373e6a0..4df5a30 100644 --- a/src/IDF/templates/idf/source/mercurial/tree.html +++ b/src/IDF/templates/idf/source/mercurial/tree.html @@ -12,7 +12,7 @@
{trans 'Size'}
{blocktrans}Source at commit {$commit} created {$cobject.date|dateago}.{/blocktrans}
{blocktrans}By {$cobject.author|strip_tags|trim}, {$cobject.title}{/blocktrans} @@ -34,7 +34,7 @@ {$file.file} {if $file.type == 'blob'} {if isset($file.date)} -
{$file.date|dateago:"without"}{$file.date|dateago:"without"} {$file.author|strip_tags|trim}{trans ':'} {$file.log}
{aurl 'url', 'IDF_Views_Source::getFile', array($project.shortname, $commit, $fullpath)}

{trans 'Archive'} {trans 'Download this file'}

- -{/block} -{block context} -

{trans 'Branches:'}
-{foreach $branches as $selector => $branch} -{aurl 'url', 'IDF_Views_Source::treeBase', array($project.shortname, $selector)} - - - {$branch|shorten:25} - -
-{/foreach} -

-{if $tags} -

{trans 'Tags:'}
-{foreach $tags as $selector => $tag} -{aurl 'url', 'IDF_Views_Source::treeBase', array($project.shortname, $selector)} - - - {$tag|shorten:25} - -
-{/foreach} -

-{/if} {/block} {block javascript} {/block} +{block context} +{include 'idf/source/mtn/branch_tag_list.html'} +{/block} + diff --git a/src/IDF/templates/idf/source/mtn/tree.html b/src/IDF/templates/idf/source/mtn/tree.html index 24462f6..5ca9db5 100644 --- a/src/IDF/templates/idf/source/mtn/tree.html +++ b/src/IDF/templates/idf/source/mtn/tree.html @@ -51,37 +51,8 @@ {trans 'Archive'} {trans 'Download this version'} {trans 'or'} mtn clone {$project.getSourceAccessUrl($user, $commit)} {trans 'Help'}

- - {/block} {block context} -
-
-

- {trans 'Branches'} - -

-
    -{foreach $branches as $selector => $branch} -{aurl 'url', 'IDF_Views_Source::treeBase', array($project.shortname, $selector)} -
  • - {$branch} -
  • -{/foreach} -
-{if $tags} -

- {trans 'Tags'} - -

-
    -{foreach $tags as $selector => $tag} -{aurl 'url', 'IDF_Views_Source::treeBase', array($project.shortname, $selector)} -
  • - {$tag} -
  • -{/foreach} -
-{/if} -
+{include 'idf/source/mtn/branch_tag_list.html'} {/block} + diff --git a/www/media/idf/css/style.css b/www/media/idf/css/style.css index 86b5551..1e6cafe 100644 --- a/www/media/idf/css/style.css +++ b/www/media/idf/css/style.css @@ -863,7 +863,7 @@ ol > li { */ .context {} -.context h1 { +.context h3 { font-size: 13px; font-weight: bold; margin: 10px 0 5px; @@ -918,24 +918,79 @@ ol > li { display: none; } -.context > .expander input.filter-list { +.context > .expander span.input-with-delete { + padding: 1px; + border: 1px dotted #474747; + display: none; + float: right; + margin-left: 10px; + margin-top: -3px; +} + +.context > .expander span.input-with-delete * { + vertical-align: middle; +} + +.context > .expander span.input-with-delete span { + display: inline-block; + width: 13px; + height: 12px; + background: url(../img/clear.png) left top no-repeat; + cursor: pointer; +} + +.context > .expander span.input-with-delete input.filter-list { font-size: 11px; font-weight: normal; color: #333; - border: 1px dotted #474747; - margin-left: 10px; - padding: 2px; - width: 80px; - display: none; - float: right; + border: 0; + width: 100px; + height: 11px; } -.context > .expander:hover input.filter-list.activated, -.context > .expander.activated input.filter-list.activated { +.context > .expander:hover span.input-with-delete.activated, +.context > .expander.activated span.input-with-delete.activated { display: block; } -.context > .expander input.filter-list.default { - color: #aaa; - border-color: #aaa; +.context > .expander div.input-with-delete.default { + opacity: 0.5; +} + +/** + * SCM action icons in the commit view + */ +span.scm-action { + display: inline-block; + line-height: 9px; + font-size: 9px; + text-align: center; + padding: 2px; + width: 9px; + -moz-border-radius: 3px; + -webkit-border-radius: 3px; + border-radius: 3px; + color: white; + cursor: default; + margin-top: 2px; +} + +span.scm-action.added { + background-color: darkgreen; +} + +span.scm-action.deleted { + background-color: darkred; +} + +span.scm-action.patched { + background-color: orange; +} + +span.scm-action.renamed { + background-color: purple; +} + +span.scm-action.property-changed { + background-color: blue; } diff --git a/www/media/idf/img/clear.png b/www/media/idf/img/clear.png new file mode 100644 index 0000000..11079dd Binary files /dev/null and b/www/media/idf/img/clear.png differ