## --------------------------------------------------------------------------- ## See the NOTICE file distributed with this work for additional ## information regarding copyright ownership. ## ## This is free software; you can redistribute it and/or modify it ## under the terms of the GNU Lesser General Public License as ## published by the Free Software Foundation; either version 2.1 of ## the License, or (at your option) any later version. ## ## This software is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## Lesser General Public License for more details. ## ## You should have received a copy of the GNU Lesser General Public ## License along with this software; if not, write to the Free ## Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ## 02110-1301 USA, or see the FSF site: http://www.fsf.org. ## --------------------------------------------------------------------------- ### ### Document history table ### ### Displays a paged list of document versions, with the possiblity to view a version, compare two ### versions, delete one or a range of versions, restore a version as the current document. ### ## ## Settings, compute what versions should be displayed. ## #if ($xcontext.action == 'edit') #set ($viewer = 'editor=history') #else #set ($viewer = 'viewer=history') #end #set ($minorVersions = (!$xwiki.hasMinorEdit()) || ("$!request.showminor" == 'true')) ## Revision criteria. The following requests for all versions, filtered by the minorVersions option. #set ($criteria = $xwiki.criteriaService.revisionCriteriaFactory.createRevisionCriteria('', $minorVersions)) #set ($totalVersions = $tdoc.getRevisionsCount($criteria)) #if ($totalVersions == 0) #warning ($services.localization.render('core.viewers.history.empty')) #else #set ($paginationParameters = {'url' : "?${viewer}&showminor=${minorVersions}", 'totalItems' : $totalVersions, 'defaultItemsPerPage' : 20, 'position': 'top'}) #pagination ($paginationParameters) ## Since we're displaying revisions starting from the last one, we need to mirror the range inside ## the total versions range. #set ($startAt = $totalVersions - ${paginationParameters.firstItem}) #set ($endAt = 0 - ${paginationParameters.itemsPerPage}) #set ($range = $xwiki.criteriaService.rangeFactory.createRange($startAt, $endAt)) ## Reuse the old object, just add the range. $criteria.setRange($range) #set ($versions = $tdoc.getRevisions($criteria)) #set ($discard = $collectiontool.reverseModifiable($versions)) #if ("$tdoc.realLocale" != '') #set ($lang = "&language=${tdoc.realLocale}") #else #set ($lang = '') #end ## #set ($documentExtensions = $services.extension.xar.getInstalledExtensions($doc.getDocumentReferenceWithLocale())) #set ($displayCompare = $totalVersions > 1 || ($totalVersions == 1 && $documentExtensions.size() > 0)) ## Pagination style $xwiki.ssfx.use('uicomponents/pagination/pagination.css', true)## ## ## Preamble, output some HTML. ##