Esempio n. 1
0
 private function showHistory()
 {
     global $wgLang, $wgContLang, $wgUser, $wgOut;
     $this->sk = $wgUser->getSkin();
     $wgOut->setPagetitle(wfMsg("mergehistory"));
     $this->showMergeForm();
     # List all stored revisions
     $revisions = new MergeHistoryPager($this, array(), $this->mTargetObj, $this->mDestObj);
     $haveRevisions = $revisions && $revisions->getNumRows() > 0;
     $titleObj = SpecialPage::getTitleFor("Mergehistory");
     $action = $titleObj->getLocalURL("action=submit");
     # Start the form here
     $top = Xml::openElement('form', array('method' => 'post', 'action' => $action, 'id' => 'merge'));
     $wgOut->addHTML($top);
     if ($haveRevisions) {
         # Format the user-visible controls (comment field, submission button)
         # in a nice little table
         $align = $wgContLang->isRtl() ? 'left' : 'right';
         $table = Xml::openElement('fieldset') . Xml::openElement('table') . "<tr>\n\t\t\t\t\t\t<td colspan='2'>" . wfMsgExt('mergehistory-merge', array('parseinline'), $this->mTargetObj->getPrefixedText(), $this->mDestObj->getPrefixedText()) . "</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td align='{$align}'>" . Xml::label(wfMsg('undeletecomment'), 'wpComment') . "</td>\n\t\t\t\t\t\t<td>" . Xml::input('wpComment', 50, $this->mComment) . "</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>&nbsp;</td>\n\t\t\t\t\t\t<td>" . Xml::submitButton(wfMsg('mergehistory-submit'), array('name' => 'merge', 'id' => 'mw-merge-submit')) . "</td>\n\t\t\t\t\t</tr>" . Xml::closeElement('table') . Xml::closeElement('fieldset');
         $wgOut->addHTML($table);
     }
     $wgOut->addHTML("<h2 id=\"mw-mergehistory\">" . wfMsgHtml("mergehistory-list") . "</h2>\n");
     if ($haveRevisions) {
         $wgOut->addHTML($revisions->getNavigationBar());
         $wgOut->addHTML("<ul>");
         $wgOut->addHTML($revisions->getBody());
         $wgOut->addHTML("</ul>");
         $wgOut->addHTML($revisions->getNavigationBar());
     } else {
         $wgOut->addWikiMsg("mergehistory-empty");
     }
     # Show relevant lines from the deletion log:
     $wgOut->addHTML("<h2>" . htmlspecialchars(LogPage::logName('merge')) . "</h2>\n");
     LogEventsList::showLogExtract($wgOut, 'merge', $this->mTargetObj->getPrefixedText());
     # When we submit, go by page ID to avoid some nasty but unlikely collisions.
     # Such would happen if a page was renamed after the form loaded, but before submit
     $misc = Xml::hidden('targetID', $this->mTargetObj->getArticleID());
     $misc .= Xml::hidden('destID', $this->mDestObj->getArticleID());
     $misc .= Xml::hidden('target', $this->mTarget);
     $misc .= Xml::hidden('dest', $this->mDest);
     $misc .= Xml::hidden('wpEditToken', $wgUser->editToken());
     $misc .= Xml::closeElement('form');
     $wgOut->addHTML($misc);
     return true;
 }
Esempio n. 2
0
    private function showHistory()
    {
        $this->showMergeForm();
        # List all stored revisions
        $revisions = new MergeHistoryPager($this, [], $this->mTargetObj, $this->mDestObj);
        $haveRevisions = $revisions && $revisions->getNumRows() > 0;
        $out = $this->getOutput();
        $titleObj = $this->getPageTitle();
        $action = $titleObj->getLocalURL(['action' => 'submit']);
        # Start the form here
        $top = Xml::openElement('form', ['method' => 'post', 'action' => $action, 'id' => 'merge']);
        $out->addHTML($top);
        if ($haveRevisions) {
            # Format the user-visible controls (comment field, submission button)
            # in a nice little table
            $table = Xml::openElement('fieldset') . $this->msg('mergehistory-merge', $this->mTargetObj->getPrefixedText(), $this->mDestObj->getPrefixedText())->parse() . Xml::openElement('table', ['id' => 'mw-mergehistory-table']) . '<tr>
						<td class="mw-label">' . Xml::label($this->msg('mergehistory-reason')->text(), 'wpComment') . '</td>
					<td class="mw-input">' . Xml::input('wpComment', 50, $this->mComment, ['id' => 'wpComment']) . '</td>
					</tr>
					<tr>
						<td>&#160;</td>
						<td class="mw-submit">' . Xml::submitButton($this->msg('mergehistory-submit')->text(), ['name' => 'merge', 'id' => 'mw-merge-submit']) . '</td>
					</tr>' . Xml::closeElement('table') . Xml::closeElement('fieldset');
            $out->addHTML($table);
        }
        $out->addHTML('<h2 id="mw-mergehistory">' . $this->msg('mergehistory-list')->escaped() . "</h2>\n");
        if ($haveRevisions) {
            $out->addHTML($revisions->getNavigationBar());
            $out->addHTML('<ul>');
            $out->addHTML($revisions->getBody());
            $out->addHTML('</ul>');
            $out->addHTML($revisions->getNavigationBar());
        } else {
            $out->addWikiMsg('mergehistory-empty');
        }
        # Show relevant lines from the merge log:
        $mergeLogPage = new LogPage('merge');
        $out->addHTML('<h2>' . $mergeLogPage->getName()->escaped() . "</h2>\n");
        LogEventsList::showLogExtract($out, 'merge', $this->mTargetObj);
        # When we submit, go by page ID to avoid some nasty but unlikely collisions.
        # Such would happen if a page was renamed after the form loaded, but before submit
        $misc = Html::hidden('targetID', $this->mTargetObj->getArticleID());
        $misc .= Html::hidden('destID', $this->mDestObj->getArticleID());
        $misc .= Html::hidden('target', $this->mTarget);
        $misc .= Html::hidden('dest', $this->mDest);
        $misc .= Html::hidden('wpEditToken', $this->getUser()->getEditToken());
        $misc .= Xml::closeElement('form');
        $out->addHTML($misc);
        return true;
    }
 private function showHistory()
 {
     # List all stored revisions
     $revisions = new MergeHistoryPager($this, [], $this->mTargetObj, $this->mDestObj);
     $haveRevisions = $revisions && $revisions->getNumRows() > 0;
     $out = $this->getOutput();
     $header = '<h2 id="mw-mergehistory">' . $this->msg('mergehistory-list')->escaped() . "</h2>\n";
     if ($haveRevisions) {
         $hiddenFields = ['merge' => true, 'target' => $this->mOpts->getValue('target'), 'dest' => $this->mOpts->getValue('dest')];
         $formDescriptor = ['reason' => ['type' => 'text', 'name' => 'reason', 'label-message' => 'mergehistory-reason']];
         $mergeText = $this->msg('mergehistory-merge', $this->mTargetObj->getPrefixedText(), $this->mDestObj->getPrefixedText())->parse();
         $history = $header . $revisions->getNavigationBar() . '<ul>' . $revisions->getBody() . '</ul>' . $revisions->getNavigationBar();
         $form = HTMLForm::factory('ooui', $formDescriptor, $this->getContext())->addHiddenFields($hiddenFields)->setPreText($mergeText)->setFooterText($history)->setSubmitTextMsg('mergehistory-submit')->setMethod('post')->prepareForm()->displayForm(false);
     } else {
         $out->addHTML($header);
         $out->addWikiMsg('mergehistory-empty');
     }
     # Show relevant lines from the merge log:
     $mergeLogPage = new LogPage('merge');
     $out->addHTML('<h2>' . $mergeLogPage->getName()->escaped() . "</h2>\n");
     LogEventsList::showLogExtract($out, 'merge', $this->mTargetObj);
 }