Skip to content

Commit

Permalink
Added pagination for ArticlePages on AgentTicketZoom.
Browse files Browse the repository at this point in the history
  • Loading branch information
NiklasSchmitt committed Oct 27, 2023
1 parent 51850c7 commit 9f8a6f6
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# 6.5.5 2023-??-??
- 2023-10-26 Added pagination for ArticlePages on AgentTicketZoom.
- 2023-10-10 Updated CKEditor to version 4.22.1.
- 2023-09-29 Added optional caching to web service requests of dynamic field types WebserviceDropdown and WebserviceMultiselect.
- 2023-09-22 Fixed some errors in the customer interface being shown with the agent interface's header navigation. Thanks for reporting/hints to Tim Püttmanns, maxence.
Expand Down
87 changes: 84 additions & 3 deletions Kernel/Output/HTML/Templates/Standard/AgentTicketZoom.tt
Original file line number Diff line number Diff line change
Expand Up @@ -316,9 +316,90 @@

[% RenderBlockStart("ArticlePages") %]
<div class="ArticlePages Icons">
[% FOREACH page IN [1 .. Data.Pages]; %]
<a href="[% Env("Baselink") %]Action=AgentTicketZoom;TicketID=[% Data.TicketID | uri %];ArticlePage=[% page %]" title="[% Translate('Page %s', page) | html %]" data-page="[% page %]" [% IF page == Data.CurrentPage %]class="Active"[% END %]>[% page %]</a>
[% END; %]
<!-- Pagination for ArticlePages for more than 7 pages -->
[% IF Data.Pages > 7 %]
[% FirstPages = 2 %]

[% FirstPagesPlus = FirstPages+(1) %]
[% FirstPagesPlusPlus = FirstPages+(2) %]

[% LastPagesMinusMinus = Data.Pages-FirstPages %]
[% LastPagesMinus = LastPagesMinusMinus+(1) %]

[% CurrentPageMinus = Data.CurrentPage-(1) %]
[% CurrentPagePlus = Data.CurrentPage+(1) %]

<!-- Permanent show the first pages -->
[% FOREACH page IN [1 .. FirstPages]; %]
<a href="[% Env("Baselink") %]Action=AgentTicketZoom;TicketID=[% Data.TicketID | uri %];ArticlePage=[% page %]" title="[% Translate('Page %s', page) | html %]" data-page="[% page %]" [% IF page == Data.CurrentPage %]class="Active"[% END %]>[% page %]</a>
[% END %]

[% IF Data.CurrentPage < FirstPages %]
<a>...</a>
[% END %]

<!-- Special handlings for some special positions of the begin -->
[% IF Data.CurrentPage == FirstPages %]
<a href="[% Env("Baselink") %]Action=AgentTicketZoom;TicketID=[% Data.TicketID | uri %];ArticlePage=[% FirstPagesPlus %]" title="[% Translate('Page %s', FirstPagesPlus) | html %]" data-page="[% FirstPagesPlus %]" >[% FirstPagesPlus %]</a>
<a>...</a>
[% END %]

[% IF Data.CurrentPage == FirstPagesPlus %]
[% FOREACH page IN [FirstPagesPlus .. FirstPagesPlusPlus]; %]
<a href="[% Env("Baselink") %]Action=AgentTicketZoom;TicketID=[% Data.TicketID | uri %];ArticlePage=[% page %]" title="[% Translate('Page %s', page) | html %]" data-page="[% page %]" [% IF page == Data.CurrentPage %]class="Active"[% END %]>[% page %]</a>
[% END %]
<a>...</a>
[% END %]

[% IF Data.CurrentPage == FirstPagesPlusPlus %]
[% FOREACH page IN [FirstPagesPlus .. CurrentPagePlus]; %]
<a href="[% Env("Baselink") %]Action=AgentTicketZoom;TicketID=[% Data.TicketID | uri %];ArticlePage=[% page %]" title="[% Translate('Page %s', page) | html %]" data-page="[% page %]" [% IF page == Data.CurrentPage %]class="Active"[% END %]>[% page %]</a>
[% END %]
<a>...</a>
[% END %]

<!-- The normal pagination loop -->
[% IF Data.CurrentPage > FirstPagesPlusPlus && CurrentPagePlus < LastPagesMinusMinus %]
<a>...</a>
[% FOREACH page IN [CurrentPageMinus .. CurrentPagePlus]; %]
<a href="[% Env("Baselink") %]Action=AgentTicketZoom;TicketID=[% Data.TicketID | uri %];ArticlePage=[% page %]" title="[% Translate('Page %s', page) | html %]" data-page="[% page %]" [% IF page == Data.CurrentPage %]class="Active"[% END %]>[% page %]</a>
[% END %]
<a>...</a>
[% END %]

<!-- Special handlings for some special positions of the end -->
[% IF CurrentPagePlus == LastPagesMinusMinus %]
<a>...</a>
[% FOREACH page IN [CurrentPageMinus .. LastPagesMinusMinus]; %]
<a href="[% Env("Baselink") %]Action=AgentTicketZoom;TicketID=[% Data.TicketID | uri %];ArticlePage=[% page %]" title="[% Translate('Page %s', page) | html %]" data-page="[% page %]" [% IF page == Data.CurrentPage %]class="Active"[% END %]>[% page %]</a>
[% END %]
[% END %]

[% IF CurrentPagePlus == LastPagesMinus %]
<a>...</a>
[% FOREACH page IN [CurrentPageMinus .. Data.CurrentPage]; %]
<a href="[% Env("Baselink") %]Action=AgentTicketZoom;TicketID=[% Data.TicketID | uri %];ArticlePage=[% page %]" title="[% Translate('Page %s', page) | html %]" data-page="[% page %]" [% IF page == Data.CurrentPage %]class="Active"[% END %]>[% page %]</a>
[% END %]
[% END %]

[% IF Data.CurrentPage == LastPagesMinus %]
<a>...</a>
<a href="[% Env("Baselink") %]Action=AgentTicketZoom;TicketID=[% Data.TicketID | uri %];ArticlePage=[% LastPagesMinusMinus %]" title="[% Translate('Page %s', LastPagesMinusMinus) | html %]" data-page="[% page %]">[% LastPagesMinusMinus %]</a>
[% END %]

[% IF Data.CurrentPage == Data.Pages %]
<a>...</a>
[% END %]

<!-- Permanent show last pages -->
[% FOREACH page IN [LastPagesMinus .. Data.Pages]; %]
<a href="[% Env("Baselink") %]Action=AgentTicketZoom;TicketID=[% Data.TicketID | uri %];ArticlePage=[% page %]" title="[% Translate('Page %s', page) | html %]" data-page="[% page %]" [% IF page == Data.CurrentPage %]class="Active"[% END %]>[% page %]</a>
[% END %]
[% ELSE %]
[% FOREACH page IN [1 .. Data.Pages]; %]
<a href="[% Env("Baselink") %]Action=AgentTicketZoom;TicketID=[% Data.TicketID | uri %];ArticlePage=[% page %]" title="[% Translate('Page %s', page) | html %]" data-page="[% page %]" [% IF page == Data.CurrentPage %]class="Active"[% END %]>[% page %]</a>
[% END %]
[% END %]
</div>
[% RenderBlockEnd("ArticlePages") %]
[% RenderBlockStart("ArticleFilterDialogLink") %]
Expand Down

0 comments on commit 9f8a6f6

Please sign in to comment.