123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- <?php
- namespace dokuwiki\Ui;
- use dokuwiki\ChangeLog\PageChangeLog;
- use dokuwiki\ChangeLog\RevisionInfo;
- use dokuwiki\Form\Form;
- class PageRevisions extends Revisions
- {
-
- protected $changelog;
-
- public function __construct($id = null)
- {
- global $INFO;
- if (!isset($id)) $id = $INFO['id'];
- parent::__construct($id);
- }
-
- protected function setChangeLog()
- {
- $this->changelog = new PageChangeLog($this->id);
- }
-
- public function show($first = -1)
- {
- global $lang, $REV;
- $changelog =& $this->changelog;
-
- if ($first === null) $first = -1;
- $hasNext = false;
- $revisions = $this->getRevisions($first, $hasNext);
-
- print p_locale_xhtml('revisions');
-
- $form = new Form([
- 'id' => 'page__revisions',
- 'class' => 'changes',
- ]);
- $form->addTagOpen('div')->addClass('no');
-
- $form->addTagOpen('ul');
- foreach ($revisions as $info) {
- $rev = $info['date'];
- $info['media'] = false;
- $RevInfo = new RevisionInfo($info);
- $RevInfo->isCurrent($changelog->isCurrentRevision($rev));
- $class = ($RevInfo->val('type') === DOKU_CHANGE_TYPE_MINOR_EDIT) ? 'minor' : '';
- $form->addTagOpen('li')->addClass($class);
- $form->addTagOpen('div')->addClass('li');
- if ($RevInfo->isCurrent()) {
- $form->addCheckbox('rev2[]')->val($rev);
- } elseif ($rev == $REV) {
- $form->addCheckbox('rev2[]')->val($rev)->attr('checked','checked');
- } elseif (page_exists($this->id, $rev)) {
- $form->addCheckbox('rev2[]')->val($rev);
- } else {
- $form->addCheckbox('')->val($rev)->attr('disabled','disabled');
- }
- $form->addHTML(' ');
- $html = implode(' ', [
- $RevInfo->showEditDate(true),
- $RevInfo->showIconCompareWithCurrent(),
- $RevInfo->showFileName(),
- $RevInfo->showEditSummary(),
- $RevInfo->showEditor(),
- $RevInfo->showSizechange(),
- $RevInfo->showCurrentIndicator(),
- ]);
- $form->addHTML($html);
- $form->addTagClose('div');
- $form->addTagClose('li');
- }
- $form->addTagClose('ul');
-
- $form->addButton('do[diff]', $lang['diff2'])->attr('type', 'submit');
- $form->addTagClose('div');
- print $form->toHTML('Revisions');
-
- print $this->navigation($first, $hasNext, function ($n) {
- return array('do' => 'revisions', 'first' => $n);
- });
- }
- }
|