Merge branch 'develop'
This commit is contained in:
		| @@ -82,6 +82,9 @@ class IDF_Template_Markdown extends Pluf_Template_Tag | |||||||
|     function callbackEmbeddedDoc($m) |     function callbackEmbeddedDoc($m) | ||||||
|     { |     { | ||||||
|         $scm = IDF_Scm::get($this->request->project); |         $scm = IDF_Scm::get($this->request->project); | ||||||
|  |         if (!$scm->isAvailable()) { | ||||||
|  |             return $m[0]; | ||||||
|  |         } | ||||||
|         $view_source = new IDF_Views_Source(); |         $view_source = new IDF_Views_Source(); | ||||||
|         $match = array('dummy', $this->request->project->shortname); |         $match = array('dummy', $this->request->project->shortname); | ||||||
|         $match[] = (isset($m[2])) ? $m[2] : $scm->getMainBranch(); |         $match[] = (isset($m[2])) ? $m[2] : $scm->getMainBranch(); | ||||||
|   | |||||||
| @@ -154,6 +154,7 @@ class IDF_Views_Source | |||||||
|         } |         } | ||||||
|         $scmConf = $request->conf->getVal('scm', 'git'); |         $scmConf = $request->conf->getVal('scm', 'git'); | ||||||
|         $props = $scm->getProperties($commit); |         $props = $scm->getProperties($commit); | ||||||
|  |         $res->uasort(array('IDF_Views_Source', 'treeSort')); | ||||||
|         return Pluf_Shortcuts_RenderToResponse('idf/source/'.$scmConf.'/tree.html', |         return Pluf_Shortcuts_RenderToResponse('idf/source/'.$scmConf.'/tree.html', | ||||||
|                                                array( |                                                array( | ||||||
|                                                      'page_title' => $title, |                                                      'page_title' => $title, | ||||||
| @@ -246,6 +247,7 @@ class IDF_Views_Source | |||||||
|         $previous = substr($request_file, 0, -strlen($l.' ')); |         $previous = substr($request_file, 0, -strlen($l.' ')); | ||||||
|         $scmConf = $request->conf->getVal('scm', 'git'); |         $scmConf = $request->conf->getVal('scm', 'git'); | ||||||
|         $props = $scm->getProperties($commit, $request_file); |         $props = $scm->getProperties($commit, $request_file); | ||||||
|  |         $res->uasort(array('IDF_Views_Source', 'treeSort')); | ||||||
|         return Pluf_Shortcuts_RenderToResponse('idf/source/'.$scmConf.'/tree.html', |         return Pluf_Shortcuts_RenderToResponse('idf/source/'.$scmConf.'/tree.html', | ||||||
|                                                array( |                                                array( | ||||||
|                                                      'page_title' => $page_title, |                                                      'page_title' => $page_title, | ||||||
| @@ -455,6 +457,28 @@ class IDF_Views_Source | |||||||
|                                                     $scm->getFile($file_info)); |                                                     $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 |      * Get the scm type for page title | ||||||
|      * |      * | ||||||
|   | |||||||
| @@ -1,5 +1,5 @@ | |||||||
| {extends "idf/issues/base.html"} | {extends "idf/issues/base.html"} | ||||||
| {block titleicon}{if $form}<form class="star" method="post" action="{url 'IDF_Views_Issue::star', array($project.shortname, $issue.id)}"><input type="image" src="{if $starred}{media '/idf/img/star.png'}{else}{media '/idf/img/star-grey.png'}{/if}" name="submit" /></form> {/if}{/block} | {block titleicon}{if $form}<form class="star" method="post" action="{url 'IDF_Views_Issue::star', array($project.shortname, $issue.id)}"><input type="image" src="{if $starred}{media '/idf/img/star.png'}{else}{media '/idf/img/star-grey.png'}{/if}" name="submit" title="{if $starred}{trans 'Remove this issue from your watch list'}{else}{trans 'Add this issue to your watch list'}{/if}" /></form> {/if}{/block} | ||||||
| {block body} | {block body} | ||||||
| {assign $i = 0} | {assign $i = 0} | ||||||
| {assign $nc = $comments.count()} | {assign $nc = $comments.count()} | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user