search.tpl 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. {*
  2. * search.tpl
  3. * gitphp: A PHP git repository browser
  4. * Component: Search view template
  5. *
  6. * Copyright (C) 2009 Christopher Han <xiphux@gmail.com>
  7. *}
  8. {extends file='projectbase.tpl'}
  9. {block name=links append}
  10. {if $page > 0}
  11. <link rel="prev" href="{geturl project=$project action=search hash=$commit search=$search searchtype=$searchtype page=$page-1}" />
  12. {/if}
  13. {if $hasmore}
  14. <link rel="next" href="{geturl project=$project action=search hash=$commit search=$search searchtype=$searchtype page=$page+1}" />
  15. {/if}
  16. {/block}
  17. {block name=main}
  18. {* Nav *}
  19. <div class="page_nav">
  20. {include file='nav.tpl' logcommit=$commit treecommit=$commit}
  21. <br />
  22. {if $page > 0}
  23. <a href="{geturl project=$project action=search hash=$commit search=$search searchtype=$searchtype}">{t}first{/t}</a>
  24. {else}
  25. {t}first{/t}
  26. {/if}
  27. &sdot;
  28. {if $page > 0}
  29. <a href="{geturl project=$project action=search hash=$commit search=$search searchtype=$searchtype page=$page-1}" accesskey="p" title="Alt-p">{t}prev{/t}</a>
  30. {else}
  31. {t}prev{/t}
  32. {/if}
  33. &sdot;
  34. {if $hasmore}
  35. <a href="{geturl project=$project action=search hash=$commit search=$search searchtype=$searchtype page=$page+1}" accesskey="n" title="Alt-n">{t}next{/t}</a>
  36. {else}
  37. {t}next{/t}
  38. {/if}
  39. <br />
  40. </div>
  41. {include file='title.tpl' titlecommit=$commit}
  42. {if $results}
  43. <table>
  44. {* Print each match *}
  45. {foreach from=$results item=result}
  46. <tr class="{cycle values="light,dark"}">
  47. <td title="{if $result->GetAge() > 60*60*24*7*2}{agestring age=$result->GetAge()}{else}{$result->GetCommitterEpoch()|date_format:"%Y-%m-%d"}{/if}"><em><time datetime="{$result->GetCommitterEpoch()|date_format:"%Y-%m-%dT%H:%M:%S+00:00"}">{if $result->GetAge() > 60*60*24*7*2}{$result->GetCommitterEpoch()|date_format:"%Y-%m-%d"}{else}{agestring age=$result->GetAge()}{/if}</time></em></td>
  48. <td>
  49. <em>
  50. {if $searchtype == 'author'}
  51. {$result->GetAuthorName()|escape|highlight:$search}
  52. {elseif $searchtype == 'committer'}
  53. {$result->GetCommitterName()|escape|highlight:$search}
  54. {else}
  55. {$result->GetAuthorName()|escape}
  56. {/if}
  57. </em>
  58. </td>
  59. <td><a href="{geturl project=$project action=commit hash=$result}" class="list commitTip" {if strlen($result->GetTitle()) > 50}title="{$result->GetTitle()|escape}"{/if}><strong>{$result->GetTitle(50)|escape:'html'}</strong></a>
  60. {if $searchtype == 'commit'}
  61. {foreach from=$result->SearchComment($search) item=line name=match}
  62. <br />{$line|escape|highlight:$search:50}
  63. {/foreach}
  64. {/if}
  65. </td>
  66. {assign var=resulttree value=$result->GetTree()}
  67. <td class="link"><a href="{geturl project=$project action=commit hash=$result}">{t}commit{/t}</a> | <a href="{geturl project=$project action=commitdiff hash=$result}">{t}commitdiff{/t}</a> | <a href="{geturl project=$project action=tree hash=$resulttree hashbase=$result}">{t}tree{/t}</a> | <a href="{geturl project=$project action=snapshot hash=$result}" class="snapshotTip">{t}snapshot{/t}</a>
  68. </td>
  69. </tr>
  70. {/foreach}
  71. {if $hasmore}
  72. <tr>
  73. <td><a href="{geturl project=$project action=search hash=$commit search=$search searchtype=$searchtype page=$page+1}" title="Alt-n">{t}next{/t}</a></td>
  74. <td></td>
  75. <td></td>
  76. <td></td>
  77. </tr>
  78. {/if}
  79. </table>
  80. {else}
  81. <div class="message">
  82. {t 1=$search}No matches for "%1"{/t}
  83. </div>
  84. {/if}
  85. {/block}