Пример #1
0
 /**
  * Show all applicable editing introductions
  *
  * - new article intro
  * - custom intro (editintro=Foo in URL)
  * - talk page intro
  * - main page educational note (BugId:51755)
  *
  * Handle preloads (BugId:5652)
  */
 protected function showIntro()
 {
     // Code based on EditPage.php
     if (!$this->mTitle->exists()) {
         if ($this->app->wg->User->isLoggedIn()) {
             $msgName = 'newarticletext';
             $class = 'mw-newarticletext';
         } else {
             $msgName = 'newarticletextanon';
             $class = 'mw-newarticletextanon';
         }
         // Give a notice if the user is editing a deleted/moved page...
         $titleText = $this->mTitle->getPrefixedText();
         if (!empty($titleText)) {
             $out = new OutputPage();
             $resultRowsNum = LogEventsList::showLogExtract($out, array('delete', 'move'), $titleText, '', array('lim' => 10, 'conds' => array("log_action != 'revision'"), 'showIfEmpty' => false, 'msgKey' => array('recreate-moveddeleted-warn')));
         }
         $msgParams = [];
         // check for empty message (BugId:6923)
         if (!empty($msgName)) {
             $message = wfMessage($msgName, $msgParams);
             $messageParsed = $message->parse();
             if (!$message->isBlank() && trim(strip_tags($messageParsed)) != '') {
                 $this->mEditPagePreloads['EditPageIntro'] = ['content' => $messageParsed, 'class' => $class];
             }
         }
     }
     wfRunHooks('EditPageLayoutShowIntro', [&$this->mEditPagePreloads, $this->mTitle]);
     // custom intro
     $this->showCustomIntro();
     // Intro text for talk pages (BugId:7092)
     if ($this->mTitle->isTalkPage()) {
         $this->mEditPagePreloads['EditPageTalkPageIntro'] = array('content' => wfmsgExt('talkpagetext', array('parse')), 'class' => 'mw-talkpagetext');
     } elseif ($this->mTitle->isMainPage() && !$this->mTitle->isProtected() && !$this->userDismissedEduNote()) {
         //if this is an unprotected main page and user hasn't seen the main page educational notice -- show it :)
         /** @var $notice EditPageNotice */
         $msg = wfMsgExt('mainpagewarning-notice', array('parse'));
         $notice = new EditPageNotice($msg, 'MainPageEduNote');
         $this->helper->addJsVariable('mainPageEduNoteHash', $notice->getHash());
         $this->addEditNotice($notice);
     }
     // Edit notice (BugId:7616)
     $editnotice_ns_key = 'editnotice-' . $this->mTitle->getNamespace();
     $editnotice_ns_msg = new Message($editnotice_ns_key);
     if (!$editnotice_ns_msg->isDisabled()) {
         $this->mEditPagePreloads['EditPageEditNotice'] = array('content' => $editnotice_ns_msg->parse(), 'class' => 'mw-editnotice');
     }
 }
Пример #2
0
 /**
  * Show a read-only error
  * Parameters are the same as OutputPage:readOnlyPage()
  * Redirect to the article page if redlink=1
  */
 function readOnlyPage($source = null, $protected = false, $reasons = array(), $action = null)
 {
     $this->mIsReadOnlyPage = true;
     $this->helper->addJsVariable('wgEditPageIsReadOnly', true);
     $bridge = F::build('EditPageOutputBridge', array($this, $this->mCoreEditNotices));
     /* @var $bridge EditPageOutputBridge */
     parent::readOnlyPage($source, $protected, $reasons, $action);
     $bridge->close();
     //$this->mCoreEditNotices->get( ??? )->setSummary( $this->app->wf->msgExt( 'editpagelayout-blocked-user' ) );
     $this->mCoreEditNotices->remove('templatesUsed');
     $this->mCoreEditNotices->remove('viewsourcetext');
     $this->mCoreEditNotices->remove(false);
     $this->textbox1 = $source;
     $this->out->clearHTML();
     $this->out->addHtml('<div id="myedit">');
     $this->showTextbox1(array('readonly'));
     $this->out->addHtml('</div>');
 }
 /**
  * initialize article edit page
  */
 protected function initializeEditPage()
 {
     $helper = new EditPageLayoutHelper();
     $editPage = $helper->setupEditPage($this->mEditedArticle, $this->fullScreen, get_class($this));
     //var used by onMakeGlobalVariablesScript in EditPageLayoutHelper
     if (!empty($this->titleNS)) {
         $helper->addJsVariable('wgEditedTitleNS', $this->contLang->getFormattedNsText($this->titleNS));
     } else {
         $helper->addJsVariable('wgEditedTitleNS', '');
     }
     $helper->addJsVariable('wgEditedTitlePrefix', $editPage->titlePrefix = $this->getTitlePrefix());
     if ($this->mode == self::MODE_NEW_SETUP) {
         $helper->addJsVariable('wgEditPageIsNewArticle', true);
     }
     return $editPage;
 }