From d4929622bf5d3770ce69a3408d0e309bbcf9005a Mon Sep 17 00:00:00 2001 From: Thomas Keller Date: Mon, 3 Jan 2011 15:10:42 +0100 Subject: [PATCH 1/3] Sort directories before files in source views. Thanks to William Martin! (closes issue 573) --- src/IDF/Views/Source.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/IDF/Views/Source.php b/src/IDF/Views/Source.php index 00b7a69..a0748da 100644 --- a/src/IDF/Views/Source.php +++ b/src/IDF/Views/Source.php @@ -154,6 +154,7 @@ class IDF_Views_Source } $scmConf = $request->conf->getVal('scm', 'git'); $props = $scm->getProperties($commit); + $res->uasort(array('IDF_Views_Source', 'treeSort')); return Pluf_Shortcuts_RenderToResponse('idf/source/'.$scmConf.'/tree.html', array( 'page_title' => $title, @@ -246,6 +247,7 @@ class IDF_Views_Source $previous = substr($request_file, 0, -strlen($l.' ')); $scmConf = $request->conf->getVal('scm', 'git'); $props = $scm->getProperties($commit, $request_file); + $res->uasort(array('IDF_Views_Source', 'treeSort')); return Pluf_Shortcuts_RenderToResponse('idf/source/'.$scmConf.'/tree.html', array( 'page_title' => $page_title, @@ -455,6 +457,28 @@ class IDF_Views_Source $scm->getFile($file_info)); } + /** + * Callback function to sort tree entries + */ + public static function treeSort($a, $b) + { + // compare two nodes of the same type + if ($a->type === $b->type) { + if (mb_convert_case($a->file, MB_CASE_LOWER) < + mb_convert_case ($b->file, MB_CASE_LOWER)) { + return -1; + } + return 1; + } + + // compare two nodes of different types, directories ("tree") + // should come before files ("blob") + if ($a->type > $b->type) { + return -1; + } + return 1; + } + /** * Get the scm type for page title * From 80be99890af13ff565bf2dbe6d29d32ba8decdb4 Mon Sep 17 00:00:00 2001 From: Thomas Keller Date: Tue, 4 Jan 2011 16:51:33 +0100 Subject: [PATCH 2/3] Add a title to the star when viewing an issue (thanks to William Martin) --- src/IDF/templates/idf/issues/view.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/IDF/templates/idf/issues/view.html b/src/IDF/templates/idf/issues/view.html index 24e57d8..4d0e1ba 100644 --- a/src/IDF/templates/idf/issues/view.html +++ b/src/IDF/templates/idf/issues/view.html @@ -1,5 +1,5 @@ {extends "idf/issues/base.html"} -{block titleicon}{if $form}
{/if}{/block} +{block titleicon}{if $form}
{/if}{/block} {block body} {assign $i = 0} {assign $nc = $comments.count()} From 90b9279c3a5bd2e24d4d63ddd047a29e7069f85b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20d=27Anterroches?= Date: Wed, 5 Jan 2011 10:28:25 +0100 Subject: [PATCH 3/3] Fixed not to try to include a document from a non available repository. --- src/IDF/Template/Markdown.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/IDF/Template/Markdown.php b/src/IDF/Template/Markdown.php index 50c9f6a..2489da3 100644 --- a/src/IDF/Template/Markdown.php +++ b/src/IDF/Template/Markdown.php @@ -82,6 +82,9 @@ class IDF_Template_Markdown extends Pluf_Template_Tag function callbackEmbeddedDoc($m) { $scm = IDF_Scm::get($this->request->project); + if (!$scm->isAvailable()) { + return $m[0]; + } $view_source = new IDF_Views_Source(); $match = array('dummy', $this->request->project->shortname); $match[] = (isset($m[2])) ? $m[2] : $scm->getMainBranch();