Use count parameter on head/tag list
Use count parameter on head/tag list

--- a/include/controller/Controller_Project.class.php
+++ b/include/controller/Controller_Project.class.php
@@ -108,14 +108,22 @@
 			$this->tpl->assign('revlist', $revlist);
 		}
 
-		$taglist = $this->project->GetTags();
-		if (isset($taglist) && (count($taglist) > 0)) {
-			$this->tpl->assign("taglist",$taglist);
+		$taglist = $this->project->GetTags(17);
+		if ($taglist) {
+			if (count($taglist) > 16) {
+				$this->tpl->assign('hasmoretags', true);
+				$taglist = array_slice($taglist, 0, 16);
+			}
+			$this->tpl->assign('taglist', $taglist);
 		}
 
-		$headlist = $this->project->GetHeads();
-		if (isset($headlist) && (count($headlist) > 0)) {
-			$this->tpl->assign("headlist",$headlist);
+		$headlist = $this->project->GetHeads(17);
+		if ($headlist) {
+			if (count($headlist) > 17) {
+				$this->tpl->assign('hasmoreheads', true);
+				$headlist = array_slice($headlist, 0, 16);
+			}
+			$this->tpl->assign('headlist', $headlist);
 		}
 	}
 

--- a/templates/headlist.tpl
+++ b/templates/headlist.tpl
@@ -12,17 +12,18 @@
  <table cellspacing="0">
    {* Loop and display each head *}
    {foreach from=$headlist item=head name=heads}
-     {if ($max > 0) && ($smarty.foreach.heads.iteration == $max)}
-       <td><a href="{$SCRIPT_NAME}?p={$project->GetProject()|urlencode}&amp;a=heads">&hellip;</a></td>
-     {elseif ($max <= 0) || ($smarty.foreach.heads.iteration < $max)}
        {assign var=headcommit value=$head->GetCommit()}
        <tr class="{cycle values="light,dark"}">
          <td><em>{$headcommit->GetAge()|agestring}</em></td>
          <td><a href="{$SCRIPT_NAME}?p={$project->GetProject()|urlencode}&amp;a=shortlog&amp;h=refs/heads/{$head->GetName()}" class="list"><strong>{$head->GetName()}</strong></a></td>
          <td class="link"><a href="{$SCRIPT_NAME}?p={$project->GetProject()|urlencode}&amp;a=shortlog&amp;h=refs/heads/{$head->GetName()}">{t}shortlog{/t}</a> | <a href="{$SCRIPT_NAME}?p={$project->GetProject()|urlencode}&amp;a=log&amp;h=refs/heads/{$head->GetName()}">{t}log{/t}</a> | <a href="{$SCRIPT_NAME}?p={$project->GetProject()|urlencode}&amp;a=tree&amp;hb={$headcommit->GetHash()}">{t}tree{/t}</a></td>
        </tr>
-     {/if}
    {/foreach}
+   {if $hasmoreheads}
+       <tr>
+       <td><a href="{$SCRIPT_NAME}?p={$project->GetProject()|urlencode}&amp;a=heads">&hellip;</a></td>
+       </tr>
+   {/if}
  </table>
 
 

--- a/templates/project.tpl
+++ b/templates/project.tpl
@@ -41,7 +41,7 @@
   
   {include file='title.tpl' target='tags'}
 
-  {include file='taglist.tpl' max=17}
+  {include file='taglist.tpl'}
    
  {/if}
 
@@ -49,7 +49,7 @@
 
   {include file='title.tpl' target='heads'}
 
-  {include file='headlist.tpl' max=17}
+  {include file='headlist.tpl'}
 
  {/if}
 

--- a/templates/taglist.tpl
+++ b/templates/taglist.tpl
@@ -12,9 +12,6 @@
  <table cellspacing="0" class="tagTable">
    {foreach from=$taglist item=tag name=tag}
      <tr class="{cycle name=tags values="light,dark"}">
-       {if ($max > 0) && ($smarty.foreach.tag.iteration == $max)}
-         <td><a href="{$SCRIPT_NAME}?p={$project->GetProject()|urlencode}&amp;a=tags">&hellip;</a></td>
-       {elseif ($max <= 0) || ($smarty.foreach.tag.iteration < $max)}
 	   {assign var=object value=$tag->GetObject()}
 	   {assign var=tagcommit value=$tag->GetCommit()}
 	   {assign var=objtype value=$tag->GetType()}
@@ -39,8 +36,12 @@
              <a href="{$SCRIPT_NAME}?p={$project->GetProject()|urlencode}&amp;a=commit&amp;h={$tagcommit->GetHash()}">{t}commit{/t}</a>
 	      | <a href="{$SCRIPT_NAME}?p={$project->GetProject()|urlencode}&amp;a=shortlog&amp;h={$tagcommit->GetHash()}">{t}shortlog{/t}</a> | <a href="{$SCRIPT_NAME}?p={$project->GetProject()|urlencode}&amp;a=log&amp;h={$tagcommit->GetHash()}">{t}log{/t}</a> | <a href="{$SCRIPT_NAME}?p={$project->GetProject()|urlencode}&amp;a=snapshot&amp;h={$tagcommit->GetHash()}" class="snapshotTip">{t}snapshot{/t}</a>
            </td>
-         {/if}
        </tr>
      {/foreach}
+     {if $hasmoretags}
+       <tr>
+         <td><a href="{$SCRIPT_NAME}?p={$project->GetProject()|urlencode}&amp;a=tags">&hellip;</a></td>
+       </tr>
+     {/if}
    </table>
 

comments