function edit() { parent::edit(); // handle "section=new" case $section = $this->app->getGlobal('wgRequest')->getVal('section'); if ($section == 'new') { $this->mSummaryBox['placeholder'] = wfMsg('editpagelayout-pageControls-newSectionLabel'); } }
public function show() { $page = $this->page; $user = $this->getUser(); if (wfRunHooks('CustomEditor', array($page, $user))) { $editor = new EditPage($page); $editor->edit(); } }
public function show() { if ($this->getContext()->getConfig()->get('UseMediaWikiUIEverywhere')) { $out = $this->getOutput(); $out->addModuleStyles(array('mediawiki.ui.input', 'mediawiki.ui.checkbox')); } $page = $this->page; $user = $this->getUser(); if (wfRunHooks('CustomEditor', array($page, $user))) { $editor = new EditPage($page); $editor->edit(); } }
/** * Display the Edit page for an article for an AJAX request. Outputs * HTML. * * @param Title $title title object describing which article to edit */ public static function showEditForm($title) { global $wgRequest, $wgTitle, $wgOut; $wgTitle = $title; $article = new Article($title); $editor = new EditPage($article); $editor->edit(); if ($wgOut->mRedirect != '' && $wgRequest->wasPosted()) { $wgOut->redirect(''); $rev = Revision::newFromTitle($title); $wgOut->addHTML($wgOut->parse($rev->getText())); } }
public function show() { $this->useTransactionalTimeLimit(); $out = $this->getOutput(); $out->setRobotPolicy('noindex,nofollow'); if ($this->getContext()->getConfig()->get('UseMediaWikiUIEverywhere')) { $out->addModuleStyles(array('mediawiki.ui.input', 'mediawiki.ui.checkbox')); } $page = $this->page; $user = $this->getUser(); if (Hooks::run('CustomEditor', array($page, $user))) { $editor = new EditPage($page); $editor->edit(); } }
function edit() { global $wgOut, $wgUser, $wgHooks, $wgTitle; //add some user variables $seqPlayer = new MV_SequencePlayer($wgTitle); mvAddGlobalJSVariables(array('mvSeqExportUrl' => $seqPlayer->getExportUrl())); //add the "switch" link to the top of the page $wgOut->addHTML('<span id="swich_seq_links"> <a id="swich_seq_text" style="display:none" href="javascript:mv_do_sequence_edit_swap(\'text\')">' . wfMsg('mv_sequence_edit_text') . '</a>' . '<a id="switch_seq_wysiwyg" href="javascript:mv_do_sequence_edit_swap(\'seq_update\')">' . wfMsg('mv_sequence_edit_visual_editor') . '</a>' . '</span>' . '<div id="seq_edit_container" style="display:none;position:relative;width:100%;height:580px;background:#AAA"></div>'); $wgOut->addHTML('<div id="mv_text_edit_container"> '); parent::edit(); $wgOut->addHTML('</div>'); }
function edit() { global $wgOut, $wgUser, $wgHooks; //check permission if admin show 'edit files' if ($wgUser->isAllowed('mv_edit_stream')) { //add in the edit stream ajax form: //$wgHooks['EditPage::showEditForm:fields'][] = array($this, 'displayEditStreamFiles'); $this->displayEditStreamFiles(); } if ($this->mv_action == 'new_stream_file' || $this->mv_action == 'edit_stream_files' || $this->mv_action == 'add_existing_stream_file') { //make the request look like a GET //that way we don't run importFormData with empty POST $_SERVER['REQUEST_METHOD'] = 'GET'; } parent::edit(); }
public function show() { $page = $this->page; $request = $this->getRequest(); $user = $this->getUser(); $context = $this->getContext(); if (wfRunHooks('CustomEditor', array($page, $user))) { if (ExternalEdit::useExternalEngine($context, 'edit') && $this->getName() == 'edit' && !$request->getVal('section') && !$request->getVal('oldid')) { $extedit = new ExternalEdit($context); $extedit->execute(); } else { $editor = new EditPage($page); $editor->edit(); } } }
public function show() { $page = $this->page; $request = $this->getRequest(); $user = $this->getUser(); $context = $this->getContext(); if (wfRunHooks('CustomEditor', array($page, $user))) { if (ExternalEdit::useExternalEngine($context, 'edit') && $this->getName() == 'edit' && !$request->getVal('section') && !$request->getVal('oldid')) { $extedit = new ExternalEdit($context); $extedit->execute(); } else { $editor = new EditPage($page); /* Wikia change begin - @author: macbre */ /* Allow extensions to change EditPage class used for rendering edit pages */ wfRunHooks('AlternateEditPageClass', array(&$editor)); /* Wikia change - end */ $editor->edit(); } } }
/** * @param $thread Thread */ function showSummarizeForm($thread) { $submitted_nonce = $this->request->getVal('lqt_nonce'); $nonce_key = wfMemcKey('lqt-nonce', $submitted_nonce, $this->user->getName()); if (!$this->handleNonce($submitted_nonce, $nonce_key)) { return; } if ($thread->summary()) { $article = $thread->summary(); } else { $t = $this->newSummaryTitle($thread); $article = new Article($t, 0); } $html = Xml::openElement('div', array('class' => 'lqt-edit-form lqt-summarize-form')); $this->output->addHTML($html); $this->output->addWikiMsg('lqt-summarize-intro'); $talkpage = $thread->article(); LqtHooks::$editTalkpage = $talkpage; LqtHooks::$editArticle = $article; LqtHooks::$editThread = $thread; LqtHooks::$editType = 'summarize'; LqtHooks::$editAppliesTo = $thread; $e = new EditPage($article); // Add an offset so it works if it's on the wrong page. $dbr = wfGetDB(DB_SLAVE); $offset = wfTimestamp(TS_UNIX, $thread->topmostThread()->sortkey()); $offset++; $offset = $dbr->timestamp($offset); $e->suppressIntro = true; $e->editFormTextBeforeContent .= $this->perpetuate('lqt_method', 'hidden') . $this->perpetuate('lqt_operand', 'hidden') . Html::hidden('lqt_nonce', MWCryptRand::generateHex(32)) . Html::hidden('offset', $offset); $e->edit(); if ($e->didSave) { $bump = !$this->request->getCheck('wpBumpThread') || $this->request->getBool('wpBumpThread'); LqtView::summarizeMetadataUpdates(array('thread' => $thread, 'article' => $article, 'summary' => $e->summary, 'bump' => $bump)); if ($submitted_nonce && $nonce_key) { global $wgMemc; $wgMemc->set($nonce_key, 1, 3600); } } if ($this->output->getRedirect() != '') { $redirectTitle = clone $talkpage->getTitle(); $redirectTitle->setFragment('#' . $this->anchorName($thread)); $this->output->redirect($this->title->getLocalURL()); } $this->output->addHTML('</div>'); }
function edit() { global $wgRequest; $this->importFormData($wgRequest); EditPage::edit(); }
/** * cuteCUTE **/ function execute($par) { global $wgRequest, $wgOut, $wgUser, $wgLang, $wgParser, $efType, $wgTitle; $target = isset($par) ? $par : $wgRequest->getVal('target'); wfLoadExtensionMessages('EditFinder'); self::setTemplatePath(); if ($wgUser->isBlocked()) { $wgOut->blockedPage(); return; } if ($wgUser->getID() == 0) { $wgOut->setRobotpolicy('noindex,nofollow'); $wgOut->errorpage('nosuchspecialpage', 'nospecialpagetext'); return; } $this->topicMode = strtolower($par) == 'topic' || strtolower($wgRequest->getVal('edittype')) == 'topic'; if ($wgRequest->getVal('fetchArticle')) { $wgOut->setArticleBodyOnly(true); echo json_encode($this->getNextArticle()); return; } elseif ($wgRequest->getVal('show-article')) { $wgOut->setArticleBodyOnly(true); if ($wgRequest->getInt('aid') == '') { $catsJs = $this->topicMode ? "editFinder.getThoseInterests();" : "editFinder.getThoseCats();"; $catsTxt = $this->topicMode ? "interests" : "categories"; $wgOut->addHTML('<div class="article_inner">No articles found. <a href="#" onclick="' . $catsJs . '">Select more ' . $catsTxt . '</a> and try again.</div>'); return; } $t = Title::newFromID($wgRequest->getInt('aid')); $articleTitleLink = $t->getLocalURL(); $articleTitle = $t->getText(); //$edittype = $a['edittype']; //get article $a = new Article($t); $r = Revision::newFromTitle($t); $popts = $wgOut->parserOptions(); $popts->setTidy(true); $popts->enableLimitReport(); $parserOutput = $wgParser->parse($r->getText(), $t, $popts, true, true, $a->getRevIdFetched()); $popts->setTidy(false); $popts->enableLimitReport(false); $html = WikihowArticleHTML::processArticleHTML($parserOutput->getText(), array('no-ads', 'ns' => NS_MAIN)); $wgOut->addHTML($html); return; } elseif ($wgRequest->getVal('edit-article')) { // SHOW THE EDIT FORM $wgOut->setArticleBodyOnly(true); $t = Title::newFromID($wgRequest->getInt('aid')); $a = new Article($t); $editor = new EditPage($a); $editor->edit(); return; } elseif ($wgRequest->getVal('action') == 'submit') { $wgOut->setArticleBodyOnly(true); $efType = strtolower($wgRequest->getVal('type')); $t = Title::newFromID($wgRequest->getInt('aid')); $a = new Article($t); //log it $params = array($efType); $log = new LogPage('EF_' . substr($efType, 0, 7), false); // false - dont show in recentchanges $log->addEntry('', $t, 'Repaired an article -- ' . strtoupper($efType) . '.', $params); $text = $wgRequest->getVal('wpTextbox1'); $sum = $wgRequest->getVal('wpSummary'); //save the edit $a->doEdit($text, $sum, EDIT_UPDATE); wfRunHooks("EditFinderArticleSaveComplete", array($a, $text, $sum, $wgUser, $efType)); return; } elseif ($wgRequest->getVal('confirmation')) { $wgOut->setArticleBodyOnly(true); echo $this->confirmationModal($wgRequest->getVal('type'), $wgRequest->getInt('aid')); wfProfileOut(__METHOD__); return; } elseif ($wgRequest->getVal('cancel-confirmation')) { $wgOut->setArticleBodyOnly(true); echo $this->cancelConfirmationModal($wgRequest->getInt('aid')); wfProfileOut(__METHOD__); return; } else { //default view (same as most of the views) $sk = $wgUser->getSkin(); $wgOut->setArticleBodyOnly(false); $wgOut->addScript(HtmlSnips::makeUrlTags('js', array('mousetrap.min.js', 'jquery.cookie.js'), 'extensions/wikihow/common', false)); $wgOut->addScript(HtmlSnips::makeUrlTags('js', array('preview.js'), 'skins/common', false)); $wgOut->addScript(HtmlSnips::makeUrlTags('js', array('clientscript.js', 'preview.js'), 'skins/common', false)); $wgOut->addScript(HtmlSnips::makeUrlTags('js', array('editfinder.js'), 'extensions/wikihow/editfinder', false)); $efType = strtolower($target); if (strpos($efType, '/') !== false) { $efType = substr($efType, 0, strpos($efType, '/')); } if ($efType == '') { //no type specified? send 'em to format... $wgOut->redirect('/Special:EditFinder/Format'); } $wgOut->addHTML('<script>var g_eftype = "' . $target . '";</script>'); //add main article info $vars = array('pagetitle' => wfMsg('app-name') . ': ' . wfMsg($efType), 'question' => wfMsg('editfinder-question'), 'yep' => wfMsg('editfinder_yes'), 'nope' => wfMsg('editfinder_no'), 'helparticle' => wfMsg('help_' . $efType)); $vars['uc_categories'] = $this->topicMode ? 'Interests' : 'Categories'; $vars['lc_categories'] = $this->topicMode ? 'interests' : 'categories'; $vars['editfinder_edit_title'] = wfMsg('editfinder_edit_title'); $vars['editfinder_skip_title'] = wfMsg('editfinder_skip_title'); $vars['css'] = HtmlSnips::makeUrlTags('css', array('editfinder.css'), 'extensions/wikihow/editfinder', false); $vars['css'] .= HtmlSnips::makeUrlTags('css', array('suggestedtopics.css'), 'extensions/wikihow', false); $html = EasyTemplate::html('editfinder_main', $vars); $wgOut->addHTML($html); $wgOut->setHTMLTitle(wfMsg('app-name') . ': ' . wfMsg($efType) . ' - wikiHow'); $wgOut->setPageTitle(wfMsg('app-name') . ': ' . wfMsg($efType) . ' - wikiHow'); } $stats = new EditFinderStandingsIndividual($efType); $stats->addStatsWidget(); $standings = new EditFinderStandingsGroup($efType); $standings->addStandingsWidget(); }
function execute($par) { global $wgUser, $wgOut, $wgRequest, $wgTitle; if ($wgUser->isBlocked()) { $wgOut->blockedPage(); return; } if (!($wgUser->isSysop() || in_array('newarticlepatrol', $wgUser->getRights()))) { $wgOut->setRobotpolicy('noindex,nofollow'); $wgOut->showErrorPage('nosuchspecialpage', 'nospecialpagetext'); return; } wfLoadExtensionMessages("NFDGuardian"); if ($wgRequest->getVal('fetchInnards')) { //get next article to vote on $wgOut->disable(); $result = self::getNextInnards($wgRequest->getVal('nfd_type')); print_r(json_encode($result)); return; } else { if ($wgRequest->getVal('getVoteBlock')) { //get all the votes for the right rail module $wgOut->setArticleBodyOnly(true); $wgOut->addHTML(self::getVoteBlock($wgRequest->getVal('nfd_id'))); return; } else { if ($wgRequest->getVal('edit')) { //get the html that goes into the page when a user clicks the edit tab $wgOut->setArticleBodyOnly(true); $t = Title::newFromID($wgRequest->getVal('articleId')); if ($t) { $a = new Article($t); $editor = new EditPage($a); $editor->edit(); //Old code for when we wanted to remove //the nfd template from the edit window /*$content = $wgOut->getHTML(); $wgOut->clearHTML(); //grab the edit form $data = array(); $data['form'] = $content; //then take out the template $c = new NFDProcessor(); $template = $c->getFullTemplate($wgRequest->getVal('nfd_id')); $articleContent = $a->getContent(); $articleContent = str_replace($template, "", $articleContent); $data['newContent'] = $articleContent; print_r(json_encode($data));*/ } return; } else { if ($wgRequest->getVal('discussion')) { //get the html that goes into the page when a user clicks the discussion tab $wgOut->setArticleBodyOnly(true); $t = Title::newFromID($wgRequest->getVal('articleId')); if ($t) { $tDiscussion = $t->getTalkPage(); if ($tDiscussion) { $a = new Article($tDiscussion); $content = $a->getContent(); $wgOldTitle = $wgTitle; $wgTitle = $tDiscussion; $wgOut->addHTML($wgOut->parse($content)); $wgOut->addHTML(PostComment::getForm(true, $tDiscussion, true)); $wgTitle = $wgOldTitle; } } return; } else { if ($wgRequest->getVal('confirmation')) { //get confirmation dialog after user has edited the article $wgOut->setArticleBodyOnly(true); echo $this->confirmationModal($wgRequest->getVal('articleId')); return; } else { if ($wgRequest->getVal('history')) { //get the html that goes into the page when a user clicks the history tab $wgOut->setArticleBodyOnly(true); $t = Title::newFromID($wgRequest->getVal('articleId')); if ($t) { $historyContext = clone $this->getContext(); $historyContext->setTitle($t); $historyContext->setWikiPage(WikiPage::factory($t)); $pageHistory = Action::factory("history", WikiPage::factory($t), $historyContext); $pageHistory->onView(); return; } } else { if ($wgRequest->getVal('diff')) { //get the html that goes into the page when a user asks for a diffs $wgOut->setArticleBodyOnly(true); $t = Title::newFromID($wgRequest->getVal('articleId')); if ($t) { $a = new Article($t); $wgOut->addHtml('<div class="article_inner">'); $a->view(); $wgOut->addHtml('</div>'); } return; } else { if ($wgRequest->getVal('article')) { //get the html that goes into the page when a user clicks the article tab $wgOut->setArticleBodyOnly(true); $t = Title::newFromId($wgRequest->getVal('articleId')); if ($t) { $r = Revision::newFromTitle($t); if ($r) { $popts = $wgOut->parserOptions(); $popts->setTidy(true); echo WikihowArticleHTML::processArticleHTML($wgOut->parse($r->getText(), $t, $popts), array('no-ads' => true, 'ns' => $t->getNamespace())); } } return; } else { if ($wgRequest->wasPosted()) { $wgOut->setArticleBodyOnly(true); if ($wgRequest->getVal('submitEditForm')) { //user has edited the article from within the NFD Guardian tool $wgOut->disable(); $this->submitEdit(); $result = self::getNextInnards($wgRequest->getVal('nfd_type')); print_r(json_encode($result)); return; } else { //user has voted if ($wgRequest->getVal('nfd_skip', 0) == 1) { NFDProcessor::skip($wgRequest->getVal('nfd_id')); } else { NFDProcessor::vote($wgRequest->getVal('nfd_id'), $wgRequest->getVal('nfd_vote')); } $wgOut->disable(); $result = self::getNextInnards($wgRequest->getVal('nfd_type')); print_r(json_encode($result)); return; } } } } } } } } } } /** * This is the shell of the page, has the buttons, etc. */ $wgOut->addJScode('nfdgj'); $wgOut->addJScode('csjs'); $wgOut->addCSScode('nfdgc'); $wgOut->addCSScode('diffc'); //add delete confirmation to bottom of page $wgOut->addHtml("<div class='waiting'><img src='" . wfGetPad('/extensions/wikihow/rotate.gif') . "' alt='' /></div>"); $tmpl = new EasyTemplate(dirname(__FILE__)); $wgOut->addHTML($tmpl->execute('NFDdelete.tmpl.php')); $wgOut->setHTMLTitle(wfMsg('nfd')); $wgOut->setPageTitle(wfMsg('nfd')); // add standings widget $group = new NFDStandingsGroup(); $indi = new NFDStandingsIndividual(); $indi->addStatsWidget(); $group->addStandingsWidget(); }