searchfiles.tpl 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. {*
  2. * searchfiles.tpl
  3. * gitphp: A PHP git repository browser
  4. * Component: Search files 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. <div class="title">
  42. <a href="{geturl project=$project action=commit hash=$commit}" class="title">{$commit->GetTitle()|escape:'html'}</a>
  43. </div>
  44. {if $results}
  45. <table>
  46. {* Print each match *}
  47. {foreach from=$results item=result}
  48. <tr class="{cycle values="light,dark"}">
  49. {assign var=resultobject value=$result->GetObject()}
  50. {if $resultobject instanceof GitPHP_Tree}
  51. <td>
  52. <a href="{geturl project=$project action=tree hash=$resultobject hashbase=$commit file=$result->GetPath()}" class="list"><strong>{$result->GetPath()|highlight:$search}</strong></a>
  53. </td>
  54. <td class="link">
  55. <a href="{geturl project=$project action=tree hash=$resultobject hashbase=$commit file=$result->GetPath()}">{t}tree{/t}</a>
  56. </td>
  57. {else}
  58. <td>
  59. <a href="{geturl project=$project action=blob hash=$resultobject hashbase=$commit file=$result->GetPath()}" class="list"><strong>{$result->GetPath()|highlight:$search}</strong></a>
  60. {foreach from=$result->GetMatchingLines() item=line name=match key=lineno}
  61. {if $smarty.foreach.match.first}<br />{/if}<span class="matchline">{$lineno}. {$line|highlight:$search:50:true}</span><br />
  62. {/foreach}
  63. </td>
  64. <td class="link">
  65. <a href="{geturl project=$project action=blob hash=$resultobject hashbase=$commit file=$result->GetPath()}">{t}blob{/t}</a> | <a href="{geturl project=$project action=history hash=$commit file=$result->GetPath()}">{t}history{/t}</a>
  66. </td>
  67. {/if}
  68. </tr>
  69. {/foreach}
  70. {if $hasmore}
  71. <tr>
  72. <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>
  73. <td></td>
  74. </tr>
  75. {/if}
  76. </table>
  77. {else}
  78. <div class="message">
  79. {t 1=$search}No matches for "%1"{/t}
  80. </div>
  81. {/if}
  82. {/block}