@@ -18,7 +18,7 @@ information: Portions Copyright [yyyy] [name of copyright owner]
18
18
19
19
CDDL HEADER END
20
20
21
- Copyright (c) 2005, 2013 , Oracle and/or its affiliates. All rights reserved.
21
+ Copyright (c) 2005, 2016 , Oracle and/or its affiliates. All rights reserved.
22
22
23
23
Portions Copyright 2011 Jens Elkner.
24
24
@@ -87,10 +87,73 @@ document.domReady.push(function() {domReadyHistory();});
87
87
}
88
88
</style>
89
89
<![endif]-->
90
+ <%
91
+ // We have a lots of results to show: create a slider for
92
+ String slider = " " ;
93
+ int thispage; // number of items to display on the current page
94
+ int start = cfg. getSearchStart();
95
+ int max = cfg. getSearchMaxItems();
96
+ int totalHits = hist. getHistoryEntries(). size();
97
+ if (max < totalHits) {
98
+ StringBuilder buf = new StringBuilder (4096 );
99
+ thispage = (start + max) < totalHits ? max : totalHits - start;
100
+ int labelStart = 1 ;
101
+ int sstart = start - max * (start / max % 10 + 1 ) ;
102
+ if (sstart < 0 ) {
103
+ sstart = 0 ;
104
+ labelStart = 1 ;
105
+ } else {
106
+ labelStart = sstart / max + 1 ;
107
+ }
108
+ int label = labelStart;
109
+ int labelEnd = label + 11 ;
110
+ for (int i = sstart; i < totalHits && label <= labelEnd; i+= max) {
111
+ if (i <= start && start < i + max) {
112
+ buf. append(" <span class=\" sel\" >" ). append(label). append(" </span>" );
113
+ } else {
114
+ buf. append(" <a class=\" more\" href=\" ?n=" ). append(max)
115
+ .append(" &start=" ). append(i);
116
+ // append revision parameters
117
+ if (cfg. getIntParam(" r1" , - 1 ) != - 1 ) {
118
+ buf. append(" &r1=" ). append(cfg. getIntParam(" r1" , - 1 ));
119
+ }
120
+ if (cfg. getIntParam(" r2" , - 1 ) != - 1 ) {
121
+ buf. append(" &r2=" ). append(cfg. getIntParam(" r2" , - 1 ));
122
+ }
123
+ buf. append(" \" >" );
124
+ if (label == labelStart && label != 1 ) {
125
+ buf. append(" <<" );
126
+ } else if (label == labelEnd && i < totalHits) {
127
+ buf. append(" >>" );
128
+ } else {
129
+ buf. append(label);
130
+ }
131
+ buf. append(" </a>" );
132
+ }
133
+ label++ ;
134
+ }
135
+ slider = buf. toString();
136
+ } else {
137
+ // set the max index to max or last
138
+ thispage = totalHits - start;
139
+ }
140
+
141
+ int revision2 = cfg. getIntParam(" r2" , - 1 ) < 0 ? 0 : cfg. getIntParam(" r2" , - 1 );
142
+ int revision1 = cfg. getIntParam(" r1" , - 1 ) < revision2 ? revision2 + 1 : cfg. getIntParam(" r1" , - 1 );
143
+ revision2 = revision2 >= hist. getHistoryEntries(). size() ? hist. getHistoryEntries(). size() - 1 : revision2;
144
+
145
+
146
+ % >
147
+
90
148
<form action =" <%= context + Prefix . DIFF_P + uriEncodedName % >" >
91
149
<table class =" src" id =" revisions" >
92
150
<caption >History log of <a href =" <%= context + Prefix . XREF_P
93
- + uriEncodedName % >" ><%= path % > </a ></caption >
151
+ + uriEncodedName % >" ><%= path % > </a >
152
+ (Results <b > <%= start + 1 % > - <%= thispage + start
153
+ % > </b > of <b ><%= totalHits % > </b >)
154
+ <p class =" slider" ><%= slider % > </p >
155
+ </caption >
156
+
94
157
<thead >
95
158
<tr >
96
159
<th >Revision <%
@@ -104,7 +167,14 @@ document.domReady.push(function() {domReadyHistory();});
104
167
% > </th ><%
105
168
if (! cfg. isDir()) {
106
169
% >
107
- <th ><input type =" submit" value =" Compare " /></th ><%
170
+ <th ><input type =" submit" value =" Compare " />
171
+ <% if (hist. getHistoryEntries(). size() > revision1 && revision1 >= 0 ) { % >
172
+ <input type =" hidden" name =" r1" value =" <%= path + ' @' + hist. getHistoryEntries(). get(revision1). getRevision() % >" />
173
+ <% } % >
174
+ <% if (hist. getHistoryEntries(). size() > revision2 && revision2 >= 0 ) { % >
175
+ <input type =" hidden" name =" r2" value =" <%= path + ' @' + hist. getHistoryEntries(). get(revision2). getRevision() % >" />
176
+ <% } % >
177
+ </th ><%
108
178
}
109
179
% >
110
180
<th >Date</th >
@@ -122,9 +192,9 @@ document.domReady.push(function() {domReadyHistory();});
122
192
</tr >
123
193
</thead >
124
194
<tbody >
125
- <%
195
+ <%
126
196
int count= 0 ;
127
- for (HistoryEntry entry : hist. getHistoryEntries()) {
197
+ for (HistoryEntry entry : hist. getHistoryEntries(max, start )) {
128
198
String rev = entry. getRevision();
129
199
if (rev == null || rev. length() == 0 ) {
130
200
rev = " " ;
@@ -157,20 +227,32 @@ document.domReady.push(function() {domReadyHistory();});
157
227
title =" link to revision line" >#</a >
158
228
<a href =" <%= context + Prefix . XREF_P + rp + " ?r=" + Util . URIEncode(rev) % >" ><%=
159
229
rev % > </a ></td >
160
- <td >
161
- <input type =" radio" <%
162
- if (count == 0 ) {
163
- % > disabled="disabled"<%
164
- } else if (count == 1 ) {
165
- % > checked="checked"<%
166
- }
167
- % > name="r1" value="<%= path % > @<%= rev % > "/>
168
- <input type =" radio"
169
- name =" r2" <%
170
- if (count == 0) {
171
- % > checked="checked"<%
172
- }
173
- % > value="<%= path % > @<%= rev % > "/></td ><%
230
+ <td ><%
231
+ String url;
232
+ if (count + start > revision1 || (count + start > revision2 && count + start <= revision1 - 1 )) {
233
+ // revision1 enabled
234
+ url = context + Prefix . HIST_L + uriEncodedName + " ?n=" + max + " &start=" + start + " &r1=" + (start + count) + " &r2=" + revision2;
235
+ % > <input type =" radio" onclick =" javascript: window.location.assign('<%= url % > ');" /><%
236
+ } else if (count + start == revision1 ) {
237
+ // revision1 selected
238
+ % > <input type =" radio" checked /><%
239
+ } else if ( count + start <= revision2 ) {
240
+ // revision1 disabled
241
+ % > <input type =" radio" disabled /><%
242
+ }
243
+
244
+ if ( count + start < revision2 || (count + start > revision2 && count + start <= revision1 - 1 ) ) {
245
+ // revision2 enabled
246
+ url = context + Prefix . HIST_L + uriEncodedName + " ?n=" + max + " &start=" + start + " &r1=" + revision1 + " &r2=" + (start + count);
247
+ % > <input type =" radio" onclick =" javascript: window.location.assign('<%= url % > ');" /><%
248
+ } else if ( count + start == revision2 ) {
249
+ // revision2 selected
250
+ % > <input type =" radio" checked /><%
251
+ } else if (count + start >= revision1 ) {
252
+ // revision2 disabled
253
+ % > <input type =" radio" disabled /><%
254
+ }
255
+ % > </td ><%
174
256
} else {
175
257
striked = true ;
176
258
% >
0 commit comments