function showEditForm($formCallback = null) { global $wgOut, $wgLanguageCode, $wgRequest, $wgTitle, $wgUser, $wgLang; $whow = null; // conflict resolution if (!$wgRequest->wasPosted()) { EditPage::showEditForm(); } $wgOut->clearHTML(); //echo $this->textbox1; exit; wfRunHooks('EditPage::showEditForm:initial', array(&$this)); // are we called with just action=edit and no title? $newArticle = false; if (($wgRequest->getVal("title") == "" || $wgTitle->getArticleID() == 0) && !$this->preview) { $newArticle = true; } $sk = $wgUser->getSkin(); if (!$this->mTitle->getArticleID() && !$this->preview) { # new article $wgOut->addHTML(wfMsg("newarticletext")); } // do we have a new article? if so, format the title if it's English $wgRequest->getVal("new_article"); if ($new_article && $wgLanguageCode == "en") { $title = $this->mTitle->getText(); $old_title = $title; $title = $this->formatTitle($title); $titleObj = Title::newFromText($title); $this->mTitle = $titleObj; $this->mArticle = new Article($titleObj); } $conflictWikiHow = null; $conflictTitle = false; if ($this->isConflict) { $s = wfMsg("editconflict", $this->mTitle->getPrefixedText()); $wgOut->setPageTitle($s); if ($new_article) { $wgOut->addHTML("<b><font color=red>" . wfMsg('page-name-exists') . "</b></font><br/><br/>"); $conflictTitle = true; } else { $this->edittime = $this->mArticle->getTimestamp(); $wgOut->addHTML(wfMsg("explainconflict")); // let the advanced editor handle the situation if ($this->isConflict) { EditPage::showEditForm(); return; } } $this->textbox2 = $this->textbox1; $conflictWikiHow = WikihowArticleEditor::newFromText($this->textbox1); $this->textbox1 = $this->mArticle->getContent(true, true); $this->edittime = $this->mArticle->getTimestamp(); } else { if ($this->mTitle->getArticleID() == 0) { $s = wfMsg('creating', "\"" . wfMsg('howto', $this->mTitle->getPrefixedText()) . "\""); } else { $s = wfMsg('editing', "\"" . wfMsg('howto', $this->mTitle->getPrefixedText()) . "\""); } if ($this->section != "") { if ($this->section == "new") { $s .= wfMsg("commentedit"); } else { $s .= wfMsg("sectionedit"); } if (!$this->preview) { $sectitle = preg_match("/^=+(.*?)=+/mi", $this->textbox1, $matches); if (!empty($matches[1])) { $this->summary = "/* " . trim($matches[1]) . " */ "; } } } $wgOut->setPageTitle($s); if ($this->oldid) { $this->mArticle->setOldSubtitle($this->oldid); $wgOut->addHTML(wfMsg("editingold")); } } if (wfReadOnly()) { $wgOut->addHTML("<strong>" . wfMsg("readonlywarning") . "</strong>"); } elseif ($isCssJsSubpage and "preview" != $formtype) { $wgOut->addHTML(wfMsg("usercssjsyoucanpreview")); } if (!$newArticle && $this->mTitle->isProtected('edit')) { if ($this->mTitle->isSemiProtected()) { $notice = wfMsg('semiprotectedpagewarning'); if (wfEmptyMsg('semiprotectedpagewarning', $notice) || $notice == '-') { $notice = ''; } } else { $notice = wfMsg('protectedpagewarning'); } $wgOut->addHTML("<div class='article_inner'>\n "); $wgOut->addWikiText($notice); $wgOut->addHTML("</div>\n"); } $q = "action=submit2&override=yes"; #if ( "no" == $redirect ) { $q .= "&redirect=no"; } $action = $this->mTitle->escapeLocalURL($q); if ($newArticle) { $main = str_replace(' ', '-', wfMsg('mainpage')); $action = str_replace("&title=" . $main, "", $action); } $summary = wfMsg("summary"); $subject = wfMsg("subject"); $minor = wfMsg("minoredit"); $watchthis = wfMsg("watchthis"); $save = wfMsg("savearticle"); $prev = wfMsg("showpreview"); $cancel = $sk->makeKnownLink($this->mTitle->getPrefixedText(), wfMsg("cancel")); $edithelpurl = Skin::makeInternalOrExternalUrl(wfMsgForContent('edithelppage')); $edithelp = '<a target="helpwindow" href="' . $edithelpurl . '">' . htmlspecialchars(wfMsg('edithelp')) . '</a> ' . htmlspecialchars(wfMsg('newwindow')); $copywarn = wfMsg("copyrightwarning", $sk->makeKnownLink(wfMsg("copyrightpage"))); $minoredithtml = ''; if ($wgUser->isAllowed('minoredit')) { $minoredithtml = "<input tabindex='11' type='checkbox' value='1' name='wpMinoredit'" . ($this->minoredit ? " checked='checked'" : "") . " accesskey='" . wfMsg('accesskey-minoredit') . "' id='wpMinoredit' />\n" . "<label for='wpMinoredit' title='" . wfMsg('tooltip-minoredit') . "'>{$minor}</label>\n"; } $watchhtml = ''; if ($wgUser->isLoggedIn()) { $watchhtml = "<input tabindex='12' type='checkbox' name='wpWatchthis'" . ($this->watchthis ? " checked='checked'" : "") . " accesskey=\"" . htmlspecialchars(wfMsg('accesskey-watch')) . "\" id='wpWatchthis' />\n" . "<label for='wpWatchthis' title=\"" . htmlspecialchars(wfMsg('tooltip-watch')) . "\">{$watchthis}</label>\n"; } $checkboxhtml = $minoredithtml . $watchhtml; $tabindex = 14; $buttons = $this->getEditButtons($tabindex); $footerbuttons = ""; $buttons['preview'] = "<span id='gatGuidedPreview'>{$buttons['preview']}</span>"; if ($wgUser->getOption('hidepersistantsavebar', 0) == 0) { $footerbuttons .= "<span id='gatPSBSave'>{$buttons['save']}</span>"; $footerbuttons .= "<span id='gatPSBPreview'>{$buttons['preview']}</span>"; } $saveBtn = str_replace('accesskey="s"', "", $buttons['save']); $buttons['save'] = "<span id='gatGuidedSave'>{$saveBtn}</span>"; $buttonshtml = implode($buttons, "\n"); # if this is a comment, show a subject line at the top, which is also the edit summary. # Otherwise, show a summary field at the bottom $summarytext = htmlspecialchars($wgLang->recodeForEdit($this->summary)); # FIXME $editsummary1 = ""; if ($wgRequest->getVal('suggestion')) { $summarytext .= ($summarytext == "" ? "" : ", ") . wfMsg('suggestion_edit_summary'); } if ($this->section == "new") { $commentsubject = "{$subject}: <input tabindex='1' type='text' value=\"{$summarytext}\" name=\"wpSummary\" id='wpSummary' maxlength='200' size='60' />"; $editsummary = ""; } else { $commentsubject = ""; if ($wgTitle->getArticleID() == 0 && $wgTitle->getNamespace() == NS_MAIN && $summarytext == "") { $summarytext = wfMsg('creating_new_article'); } $editsummary = "<input tabindex='10' type='text' value=\"{$summarytext}\" name=\"wpSummary\" id='wpSummary' maxlength='200' size='60' /><br />"; $editsummary1 = "<input tabindex='10' type='text' value=\"{$summarytext}\" name=\"wpSummary1\" id='wpSummary1' maxlength='200' size='60' /><br />"; } // create the wikiHow if ($conflictWikiHow == null) { if ($this->textbox1 != "") { $whow = WikihowArticleEditor::newFromText($this->textbox1); } else { $whow = WikihowArticleEditor::newFromArticle($this->mArticle); } } else { $whow = $conflictWikiHow; } //********** SETTING UP THE FORM // // // // $confirm = "window.onbeforeunload = confirmExit;"; if ($wgUser->getOption('disablewarning') == '1') { $confirm = ""; } $wgOut->addHTML("<script language=\"JavaScript\">\n\t\t\t\tvar isGuided = true;\n\t\t\t\tvar needToConfirm = false;\n\t\t\t\tvar checkMinLength = true;\n\t\t\t\t{$confirm}\n\t\t\t\tfunction confirmExit() {\n\t\t\t\t\tif (needToConfirm)\n\t\t\t\t\t\treturn \"" . wfMsg('all-changes-lost') . "\";\n\t\t\t\t}\n\t\t\t\tfunction addrows(element) {\n\t\t\t\t\tif (element.rows < 32) {\n\t\t\t\t\t\telement.rows += 4;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfunction removerows(element) {\n\t\t\t\t\tif (element.rows > 4) {\n\t\t\t\t\t\telement.rows -= 4;\n\t\t\t\t\t} else {\n\t\t\t\t\t\telement.rows = 4;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfunction saveandpublish() {\n\t\t\t\t\twindow.onbeforeunload = null;\n\t\t\t\t\tdocument.editform.submit();\n\t\t\t\t}\n\t\t\t\t(function (\$) {\n\t\t\t\t\t\$(document).ready(function() {\n\t\t\t\t\t\t\$('.button').click(function () {\n\t\t\t\t\t\t\tvar button = \$(this).not('.submit_button');\n\t\t\t\t\t\t\tif (button.length) {\n\t\t\t\t\t\t\t\tneedToConfirm = true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t\t\$('textarea').focus(function () {\n\t\t\t\t\t\t\tneedToConfirm = true;\n\t\t\t\t\t\t});\n\t\t\t\t\t});\n\t\t\t\t\t\$('#ep_cat').live('click', function(e) {\n\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\tvar title = 'Categorize ' + wgTitle;\n\t\t\t\t\t\tif (title.length > 54) {\n\t\t\t\t\t\t\ttitle = title.substr(0, 54) + '...';\n\t\t\t\t\t\t}\n\t\t\t\t\t\tjQuery('#dialog-box').html('');\n\t\t\t\t\t\t\n\t\t\t\t\t\tjQuery('#dialog-box').load('/Special:Categorizer?a=editpage&id=' + wgArticleId, function() {\n\t\t\t\t\t\t\tjQuery('#dialog-box').dialog({\n\t\t\t\t\t\t\t\twidth: 673,\n\t\t\t\t\t\t\t\theight: 600,\n\t\t\t\t\t\t\t\tmodal: true,\n\t\t\t\t\t\t\t\ttitle: title,\n\t\t\t\t\t\t\t\tcloseText: 'Close',\t\n\t\t\t\t\t\t\t\tdialogClass: 'modal2',\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\treCenter = function() {\n\t\t\t\t\t\t\t\tjQuery('#dialog-box').dialog('option', 'position', 'center');\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tsetTimeout('reCenter()', 100);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\$.getScript('/extensions/wikihow/cattool/categorizer.js');\n\t\t\t\t\t\t});\n\t\t\t\t\t});\n\t\t\t\t})(jQuery);\n\t\t\t</script>\n\t\t\t<script type=\"text/javascript\" src=\"" . wfGetPad('/extensions/min/f/skins/common/clientscript.js,/skins/common/ac.js,/extensions/wikihow/video/importvideo.js&rev=') . WH_SITEREV . "\"></script>\n\n\t\t"); if (!$this->preview) { # Don't select the edit box on preview; this interferes with seeing what's going on. $wgOut->setOnloadHandler("document.editform.title.focus(); load_cats();"); } $title = ""; //$wgOut->setOnloadHandler( "' onbeforeunload='return confirm(\"Are you sure you want to navigate away from this page? All changes will be lost!\");" ); $suggested_title = ""; if (isset($_GET["requested"])) { $t = Title::makeTitle(NS_MAIN, $_GET["requested"]); $suggested_title = $t->getText(); } if ($wgRequest->getVal('title', null) == null || $conflictTitle || $suggested_title != "") { $title = "<div id='title'><h3>" . wfMsg('title') . "</h3><br/>" . wfMsg('howto', '') . " \n\t\t\t<input autocomplete=\"off\" size=60 type=\"text\" name=\"title\" id=category tabindex=\"1\" value=\"{$suggested_title}\"></div>"; } $steps = htmlspecialchars($wgLang->recodeForEdit($whow->getSteps(true)), ENT_QUOTES); $video = htmlspecialchars($wgLang->recodeForEdit($whow->getSection(wfMsg('video')))); $tips = htmlspecialchars($wgLang->recodeForEdit($whow->getSection(wfMsg('tips')))); $warns = htmlspecialchars($wgLang->recodeForEdit($whow->getSection(wfMsg('warnings')))); $related_text = htmlspecialchars($wgLang->recodeForEdit($whow->getSection(wfMsg('relatedwikihows')))); $summary = htmlspecialchars($wgLang->recodeForEdit($whow->getSummary())); if ($newArticle || $whow->mIsNew) { if ($steps == "") { $steps = "# "; } if ($tips == "") { $tips = "* "; } if ($warns == "") { $warns = "* "; } if ($ingredients == "") { $ingredients = "* "; } } $cat = $whow->getCategoryString(); $advanced = ""; $cat_array = explode("|", $whow->getCategoryString()); $i = 0; $cat_string = ""; foreach ($cat_array as $cat) { if ($cat == "") { continue; } if ($i != 0) { $cat_string .= "," . $cat; } else { $cat_string = $cat; } $i++; } $removeButton = ""; $cat_advisory = ""; if ($cat_string != "") { $removeButton = "<input type=\"button\" name=\"change_cats\" onclick=\"removeCategories();\" value=\"" . wfMsg('remove-categories') . "\">"; } else { $cat_advisory = wfMsg('categorization-optional'); } //$cat_string = str_replace("|", ", ", $whow->getCategoryString()); //$cat_string = implode(", ", $raa); if (!$newArticle && !$whow->mIsNew && !$conflictTitle) { $oldparameters = ""; if ($wgRequest->getVal("oldid") != "") { $oldparameters = "&oldid=" . $wgRequest->getVal("oldid"); } if (!$this->preview) { $advanced = "<a class='' href='{$wgScript}?title=" . $wgTitle->getPrefixedURL() . "&action=edit&advanced=true{$oldparameters}'>" . wfMsg('advanced-editing') . "</a>"; } } elseif ($newArticle && $wgRequest->getVal('title', null) != null) { $t = Title::newFromText("CreatePage", NS_SPECIAL); //$advanced = str_replace("href=", "class='guided-button' href=", $sk->makeLinkObj($t, wfMsg('advanced-editing'))) . " |"; //$advanced = "<a href='{$wgScript}?title=" . $wgTitle->getPrefixedURL() . "&action=edit&advanced=true$oldparameters';\">".wfMsg('advanced-editing')."</a>"; $advanced = "<a class='button secondary' style='float:left;' href='{$wgScript}?title=" . $wgTitle->getPrefixedURL() . "&action=edit&advanced=true{$oldparameters}'>" . wfMsg('advanced-editing') . "</a>"; } $section_class = 'minor_section'; // MODIFIED FOR POPUP $categoryHTML = ""; if ($wgUser->getID() > 0) { $ctitle = $this->mTitle->getText(); $css = HtmlSnips::makeUrlTags('css', array('categoriespopup.css'), 'extensions/wikihow', false); if ($wgLanguageCode == 'en') { $editCatMore = "<a href=\"{$wgScriptPath}/Writer%27s-Guide?section=2#" . wfMsg('more-info-categorization') . "\" target=\"new\">" . wfMsg('moreinfo') . "</a>"; $editCatHtml = "<a href='#' id='ep_cat'>[" . wfMsg('editcategory') . "]</a><strong>{$editCatLink}</strong>"; } $categoryHTML = "\n\t\t\t\t{$css}\n\t\t\t\t<div id='categories'>\n\t\t\t\t\t<h5>" . wfMsg('add-optional-categories') . "{$editCatMore}</h5>\n\t\t\t\t\t<div id='option_cats'>\n\t\t\t\t\t{$editCatHtml}" . Categoryhelper::getCategoryOptionsForm2($cat_string, $whow->mCategories) . "\t</div>\n\t\t\t\t</div>"; } $requested = ""; if (isset($_GET['requested'])) { $requested = $_GET['requested']; } $related_vis = "hide"; $related_checked = ""; $relatedHTML = ""; if ($whow->getSection(wfMsg('relatedwikihows')) != "") { $related_vis = "show"; $relatedHTML = $whow->getSection(wfMsg('relatedwikihows')); $relatedHTML = str_replace("*", "", $relatedHTML); $relatedHTML = str_replace("[[", "", $relatedHTML); $relatedHTML = str_replace("]]", "", $relatedHTML); $lines = split("\n", $relatedHTML); $relatedHTML = ""; foreach ($lines as $line) { $xx = strpos($line, "|"); if ($xx !== false) { $line = substr($line, 0, $xx); } // Google+ hack. We don't normally allow + but will for the Goog if (false === stripos($line, 'Google+')) { $line = trim(urldecode($line)); } if ($line == "") { continue; } $relatedHTML .= "<OPTION VALUE=\"" . htmlspecialchars($line) . "\">{$line}</OPTION>\n"; } $related_checked = " CHECKED "; } $vidpreview_vis = "hide"; $vidbtn_vis = "show"; $vidpreview = "<img src='" . wfGetPad('/extensions/wikihow/rotate.gif') . "'/>"; if ($whow->getSection(wfMsg('video')) != "") { $vidpreview_vis = "show"; $vidbtn_vis = "hide"; try { #$vt = Title::makeTitle(NS_VIDEO, $this->mTitle->getText()); #$r = Revision::newFromTitle($vt); $vidtext = $whow->getSection(wfMsg('video')); $vidpreview = $wgOut->parse($vidtext); } catch (Exception $e) { $vidpreview = "Sorry, preview is currently not available."; } } else { $vidpreview = wfMsg('video_novideoyet'); } $video_disabled = ""; $vid_alt = ""; $video_msg = ""; $video_button = "<a id='gatVideoImportEdit' type='button' onclick=\"changeVideo('" . urlencode($wgTitle->getDBKey()) . "'); return false;\" href='#' id='show_preview_button' class='button secondary' >" . wfMsg('video_change') . "</a>"; if ($wgUser->getID() == 0) { $video_disabled = "disabled"; $video_alt = "<input type='hidden' name='video' value=\"" . htmlspecialchars($video) . "\"/>"; $video_msg = wfMsg('video_loggedin'); $video_button = ""; } $things_vis = "hide"; $things = "* "; $things_checked = ""; $tyn = $whow->getSection(wfMsg("thingsyoullneed")); if ($tyn != '') { $things_vis = "show"; $things = $tyn; $things_checked = " CHECKED "; } $ingredients_vis = "hide"; $section = $whow->getSection(wfMsg("ingredients")); $ingredients_checked = ""; if ($section != '') { $ingredients_vis = "show"; $ingredients = $section; $ingredients_checked = " CHECKED "; } $sources_vis = "hide"; $sources = "* "; $sources_checked = ""; $sources = $whow->getSection(wfMsg("sources")); $sources = str_replace('<div class="references-small"><references/></div>', '', $sources); $sources = str_replace('{{reflist}}', '', $sources); if ($sources != "") { $sources_vis = "show"; $sources_checked = " CHECKED "; } $new_field = ""; if ($newArticle || $new_article) { $new_field = "<input type=hidden name=new_article value=true>"; } $lang_links = htmlspecialchars($whow->getLangLinks()); $vt = Title::makeTitle(NS_VIDEO, $this->mTitle->getText()); $vp = SpecialPage::getTitleFor("Previewvideo", $vt->getFullText()); $newArticleWarn = '<script type="text/javascript" src="' . wfGetPad('/extensions/min/f/extensions/wikihow/winpop.js?') . WH_SITEREV . '"></script>'; $popup = Title::newFromText("UploadPopup", NS_SPECIAL); if ($wgUser->isLoggedIn()) { $token = htmlspecialchars($wgUser->editToken()); } else { $token = EDIT_TOKEN_SUFFIX; } if ('preview' == $this->formtype) { $previewOutput = $this->getPreviewText(); $this->showPreview($previewOutput); $show_weave = true; } else { $wgOut->addHTML('<div id="wikiPreview"></div>'); } if ('diff' == $this->formtype) { $this->showDiff(); $show_weave = true; } if ($show_weave) { $relBtn = $wgLanguageCode == 'en' ? PopBox::getGuidedEditorButton() : ''; $relHTML = PopBox::getPopBoxJSGuided() . PopBox::getPopBoxDiv() . PopBox::getPopBoxCSS(); $weave_links = $relHTML . '<div class="wh_block editpage_sublinks">' . $relBtn . '</div>'; } $undo = ''; if ($wgRequest->getVal('undo', null) != null) { $undo_id = $wgRequest->getVal('undo', null); $undo = "\n<input type='hidden' value=\"{$undo_id}\" name=\"wpUndoEdit\" />\n"; } $wgOut->addHTML(Easyimageupload::getUploadBoxJS()); $wgOut->addHTML("\t\n{$newArticleWarn}\n\n<div id='editpage'>\n<form id=\"editform\" name=\"editform\" method=\"post\" action=\"{$action}\"\nenctype=\"application/x-www-form-urlencoded\" onSubmit=\"return checkForm();\">\t\t"); if (is_callable($formCallback)) { call_user_func_array($formCallback, array(&$wgOut)); } $hidden_cats = ""; if (!$wgUser->isLoggedIn()) { $hidden_cats = "<input type=\"hidden\" name=\"categories22\" value=\"{$cat_string}\">"; } $token1 = md5($wgUser->getName() . $this->mTitle->getArticleID() . time()); wfTrackEditToken($wgUser, $token1, $this->mTitle, $this instanceof EditPageWrapper); $wgOut->addHTML("\n\t\t{$new_field}\n\t\t{$hidden_cats}\n\t\t<input type='hidden' value=\"{$this->starttime}\" name=\"wpStarttime\" />\n\n\t\t<input type=\"hidden\" name=\"requested\" value=\"{$requested}\">\n\t\t<input type=\"hidden\" name=\"langlinks\" value=\"{$lang_links}\">\n\t\t<input type='hidden' value=\"{$this->edittime}\" name=\"wpEdittime\" />\n\n\n\t\t{$commentsubject}\n\t\t{$title}\n\t\t<br clear='all'/>\n<script language='javascript'>\n\tvar vp_URL = '{$vp->getLocalUrl()}';\n</script>\n<script language='javascript' src='" . wfGetPad('/extensions/min/f/extensions/wikihow/previewvideo.js?rev=') . "'></script>\n<style type='text/css' media='all'>/*<![CDATA[*/ @import '" . wfGetPad('/extensions/min/f/extensions/wikihow/editpagewrapper.css,/extensions/wikihow/winpop.css,/extensions/wikihow/video/importvideo.css,/extensions/wikihow/cattool/categorizer.css,/extensions/wikihow/cattool/categorizer_editpage.css&rev=') . WH_SITEREV . "'; /*]]>*/</style>\n\n\t{$weave_links}\n\n\t<div id='introduction' class='{$section_class}'>\n\t\t<h2>" . wfMsg('introduction') . "\n\t\t\t<div class='head_details'>" . wfMsg('summaryinfo') . "</div>\n\t\t\t<a href=\"{$wgScriptPath}/" . wfMsg('writers-guide-url') . "?section=2#" . wfMsg('introduction-url') . "\" target=\"new\">" . wfMsg('moreinfo') . "</a>\n\t\t</h2>\n\t\t<textarea rows='4' cols='100' name='summary' id='summary' tabindex=\"2\" wrap=virtual>{$summary}</textarea>\n\t\t<!--a href='#' class='button secondary add_image_button' onclick='easyImageUpload.doEIUModal(\"intro\"); return false;'>" . wfMsg('eiu-add-image-to-introduction') . "</a-->\n\t\t<div class='clearall'></div>\n\t</div>\n\n\n\t<div id='ingredients' class='{$ingredients_vis} {$section_class}'>\n\t\t<h2>" . wfMsg('ingredients') . "\n\t\t\t<div class='head_details'>" . wfMsg('ingredients_tooltip') . "</div>\n\t\t\t<a href=\"{$wgScriptPath}/" . wfMsg('writers-guide-url') . "?section=2#" . wfMsg('ingredients') . "\" target=\"new\">" . wfMsg('moreinfo') . "</a>\n\t\t</h2>\n\t\t<textarea name='ingredients' rows='4' cols='100' onKeyUp=\"addStars(event, document.editform.ingredients);\" tabindex='3' id='ingredients_text'>{$ingredients}</textarea>\n\t\t<a href='#' class='button secondary add_image_button' onclick='easyImageUpload.doEIUModal(\"ingredients\"); return false;'>" . wfMsg('eiu-add-image-to-ingredients') . "</a>\n\t</div>\n\n\t<div id='steps' class='{$section_class}'>\n\t\t<h2>" . wfMsg('steps') . "\n\t\t\t<div class='head_details'>" . wfMsg('stepsinfo') . "</div>\n\t\t\t<a href=\"{$wgScriptPath}/" . wfMsg('writers-guide-url') . "?section=2#" . wfMsg('steps') . "\" target=\"new\">" . wfMsg('moreinfo') . "</a>\n\t\t</h2>\n\t\t<textarea name='steps' rows='{$wgRequest->getVal('txtarea_steps_text', 12)}' cols='100' wrap='virtual' onKeyUp=\"addNumToSteps(event);\" tabindex='4' id='steps_text'>{$steps}</textarea>\n\t\t<a href='#' class='button secondary add_image_button' onclick='easyImageUpload.doEIUModal(\"steps\", 0); return false;'>" . wfMsg('eiu-add-image-to-steps') . "</a>\n\t</div>"); $wgOut->addHTML("<div id='video' class='{$section_class}'>\n\t\t<h2>" . wfMsg('video') . "\n\t\t\t<div class='head_details'>" . wfMsg('videoinfo') . "</div>\n\t\t\t<a href=\"{$wgScriptPath}/" . wfMsg('writers-guide-url') . "?section=2#" . wfMsg('video') . "\" target=\"new\">" . wfMsg('moreinfo') . "</a>\n\t\t</h2>\n\t\t{$video_alt}\n\t\t<input type='text' name='video{$video_disabled}' size='60' id='video_text' style='float:left;' value=\"{$video}\" {$video_disabled}/><br />\n\t\t{$video_button}\n\t\t<a href='javascript:showHideVideoPreview();' id='show_preview_button' class='button secondary {$vidbtn_vis}'>" . wfMsg('show_preview') . "</a>\n\t\t{$video_msg}\n\t</div>\n\t<div id='viewpreview' class='{$vidpreview_vis} {$section_class}' style='text-align: center; margin-top: 5px;'>\n\t\t<center><a onclick='showHideVideoPreview();'>" . wfMsg('ep_hide_preview') . "</a></center><br/>\n\t\t<div id='viewpreview_innards'>{$vidpreview}</div>\n\t</div>\n\n\t<div id='tips' class='{$section_class}'>\n\t\t<h2>" . wfMsg('tips') . "\n\t\t\t<div class='head_details'>" . wfMsg('listhints') . "</div>\n\t\t\t<a href=\"{$wgScriptPath}/" . wfMsg('writers-guide-url') . "?section=2#" . wfMsg('tips') . "\" target=\"new\">" . wfMsg('moreinfo') . "</a>\n\t\t</h2>\n\t\t<textarea name='tips' rows='{$wgRequest->getVal('txtarea_tips_text', 12)}' cols='100' wrap='virtual' onKeyUp='addStars(event, document.editform.tips);' tabindex='5' id='tips_text'>{$tips}</textarea>\n\t\t<a href='#' class='button secondary add_image_button' onclick='easyImageUpload.doEIUModal(\"tips\"); return false;'>" . wfMsg('eiu-add-image-to-tips') . "</a>\n\t</div>\n\n\t<div id='warnings' class='{$section_class}'>\n\t\t<h2>" . wfMsg('warnings') . "\n\t\t\t<div class='head_details'>" . wfMsg('optionallist') . "</div>\n\t\t\t<a href=\"{$wgScriptPath}/" . wfMsg('writers-guide-url') . "?section=3#" . wfMsg('warnings') . "\" target=\"new\">" . wfMsg('moreinfo') . "</a>\n\t\t</h2>\n\t\t<textarea name='warnings' rows='{$wgRequest->getVal('txtarea_warnings_text', 4)}' cols='100' wrap='virtual' onKeyUp='addStars(event, document.editform.warnings);' id='warnings_text' tabindex=\"6\" id='warnings_text'>{$warns}</textarea>\n\t\t<a href='#' class='button secondary add_image_button' onclick='easyImageUpload.doEIUModal(\"warnings\"); return false;'>" . wfMsg('eiu-add-image-to-warnings') . "</a>\n\t</div>\n\n\t<div id='thingsyoullneed' class='{$things_vis} {$section_class}'>\n\t\t<h2>" . wfMsg('thingsyoullneed') . "\n\t\t\t<div class='head_details'>" . wfMsg('items') . "</div>\n\t\t\t<a href=\"{$wgScriptPath}/" . wfMsg('writers-guide-url') . "?section=4#" . wfMsg('thingsyoullneed') . "\" target=\"new\">" . wfMsg('moreinfo') . "</a>\n\t\t</h2>\n\t\t<textarea name='thingsyoullneed' rows='4' cols='65' wrap='virtual' onKeyUp='addStars(event, document.editform.thingsyoullneed);' tabindex='7' id='thingsyoullneed_text'>{$things}</textarea>\n\t\t<a href='#' class='button secondary add_image_button' onclick='easyImageUpload.doEIUModal(\"thingsyoullneed\"); return false;'>" . wfMsg('eiu-add-image-to-thingsyoullneed') . "</a>\n\t</div>\n\n\t<div id='relatedwikihows' class='{$related_vis} {$section_class}'>\n\t\t<h2>" . wfMsg('relatedarticlestext') . "\n\t\t\t<div class='head_details'>" . wfMsg('relatedlist') . "</div>\n\t\t\t<a href=\"{$wgScriptPath}/" . wfMsg('writers-guide-url') . "?section=5#" . wfMsg('related-wikihows-url') . "\" target=\"new\">" . wfMsg('moreinfo') . "</a>\n\t\t</h2>\n\t\t<div id='related_buttons'>\n\t\t\t<a href='#' class='button secondary' onclick='moveRelated(true);return false;' >" . wfMsg('epw_move_up') . "</a>\n\t\t\t<a href='#' class='button secondary' onclick='moveRelated(false);return false;'>" . wfMsg('epw_move_down') . "</a>\n\t\t\t<a href='#' class='button red' onclick='removeRelated(); return false;'>" . wfMsg('epw_remove') . "</a>\n\t\t\t<br />\n\t\t\t<br />\n\t\t</div>\n\t\t<input type=hidden value=\"\" name=\"related_list\">\n\t\t<select size='4' name='related' id='related_select' ondblclick='viewRelated();'>\n\t\t\t{$relatedHTML}\n\t\t</select>\n\t\t<br />\n\t\t<br />\n\t\t<br class='clearall'/>\n\t\t<div>\n\t\t\t<b>" . wfMsg('addtitle') . "</b><br />\n\t\t\t<input type='text' autocomplete=\"off\" maxLength='256' name='q' value='' onKeyPress=\"return keyxxx(event);\" tabindex='8'>\n\t\t</div>\n\t\t<a href='#' id='add_button' class='button secondary' onclick='add_related();return false;'>" . wfMsg('epw_add') . "</a>\n\t\t<br class='clearall'/>\n\t</div>\n\n<script language=\"JavaScript\">\n\tvar js_enabled = document.getElementById('related');\n\t\t if (js_enabled != null) {\n\t\t\t\t js_enabled.className = 'display';\n\t\t\t}\n\t</script>\n\t<noscript>\n\t\t<input type='hidden' name='no_js' value='true'>\n\t\t<div id='related'>\n\t\t\t<textarea name='related_no_js' rows='4' cols='65' wrap='virtual' onKeyUp='addStars(event, document.editform.related_no_js);' id='related_no_js' tabindex='8'>{$related_text}</textarea>\n\t\t</div>\n\t</noscript>\n\n\t<div id='sources' class='{$sources_vis} {$section_class}'>\n\t\t<h2>" . wfMsg('sources') . "\n\t\t\t<div class='head_details'>" . wfMsg('linkstosites') . "</div>\n\t\t\t<a href=\"{$wgScriptPath}/" . wfMsg('writers-guide-url') . "?section=2#" . wfMsg('sources-links-url') . "\" target=\"new\"> " . wfMsg('moreinfo') . "</a>\n\t\t</h2>\n\t\t<textarea name='sources' rows='3' cols='100' wrap='virtual' onKeyUp='addStars(event, document.editform.sources);' id='sources' tabindex='9'>{$sources}</textarea>\n\t</div>\n\n\t<div class='{$section_class}'>\n\t\t<h2>" . wfMsg('optional_options') . "</h2>\n\t\t{$categoryHTML}\n\n\t\t<div id='optional_sections'>\n\t\t\t<h5>" . wfMsg('optionalsections') . "</h5>\n\t\t\t<ul>\n\t\t\t\t<li><input type='checkbox' id='thingsyoullneed_checkbox' name='thingsyoullneed_checkbox' onclick='showhiderow(\"thingsyoullneed\", \"thingsyoullneed_checkbox\");' {$things_checked} /> <label for='thingsyoullneed_checkbox'>" . wfMsg('thingsyoullneed') . "</label></li>\n\t\t\t\t<li><input type='checkbox' id='related_checkbox' name='related_checkbox' onclick='showhiderow(\"relatedwikihows\", \"related_checkbox\");' {$related_checked} > <label for='related_checkbox'>" . wfMsg('relatedwikihows') . "</label></li>\n\t\t\t\t<li><input type='checkbox' id='sources_checkbox' name='sources_checkbox' onclick='showhiderow(\"sources\", \"sources_checkbox\");' {$sources_checked} > <label for='sources_checkbox'>" . wfMsg('sources') . "</label></li>\n\t\t\t\t<li><input type='checkbox' id='ingredients_checkbox' name='ingredients_checkbox' onclick='showhiderow(\"ingredients\", \"ingredients_checkbox\");' {$ingredients_checked} > <label for='ingredients_checkbox'>" . wfMsg('ingredients_checkbox') . "</label></li>\n\t\t\t</ul>\n\t\t</div>\n\t</div>\n\t\n\t<div class='{$section_class}'>\n\t\t<div class='editOptions'>\n\t\t\t<h2>" . wfMsg('editdetails') . "\n\t\t\t\t<div class='head_details'>" . wfMsg('summaryedit') . "</div>\n\t\t\t\t<a href=\"{$wgScriptPath}/" . wfMsg('writers-guide-url') . "?section=2#" . wfMsg('summary') . "\" target=\"new\"> " . wfMsg('moreinfo') . "</a>\n\t\t\t</h2>\n\t\t\t{$editsummary}\n\t\t\t{$checkboxhtml}\n\t\t\t{$undo}\n\t\t\t<input type='hidden' value=\"{$token}\" name=\"wpEditToken\" />\n\t\t\t<input type='hidden' value=\"{$token1}\" name=\"wpEditTokenTrack\" />\n\t\t\t<div class='editButtons'>\n\t\t\t\t<a href=\"javascript:history.back()\" id=\"wpCancel\" class=\"button secondary\">" . wfMsg('cancel') . "</a>\n\t\t\t\t{$buttonshtml}\n\t\t\t</div>\n\t\t\t{$copywarn}\n\t\t</div>\n\t</div>\n\t<input type='hidden' value=\"" . htmlspecialchars($this->section) . "\" name=\"wpSection\" />\n\t<input type='hidden' value=\"{$this->edittime}\" name=\"wpEdittime\" />\n"); if ($this->isConflict) { require_once "DifferenceEngine.php"; $wgOut->addHTML("<h2>" . wfMsg("yourdiff") . "</h2>\n"); DifferenceEngine::showDiff($this->textbox2, $this->textbox1, wfMsg("yourtext"), wfMsg("storedversion")); } if ($wgUser->getOption('hidepersistantsavebar', 0) == 0) { $wgOut->addHTML(" <div id='edit_page_footer'>\n\t\t\t\t<table class='edit_footer'><tr><td class='summary'>\n\t\t\t\t" . wfMsg('editsummary') . ": {$editsummary1}</td>\n\t\t\t\t<td class='buttons'>{$footerbuttons}</td></tr></table>\n\t\t\t\t</div> "); } $wgOut->addHTML("</form></div>\n"); }
static function grabArticleEditLinks($isGuided) { global $wgTitle, $wgUser, $wgLanguageCode, $wgRequest; $article = new Article($wgTitle); $relHTML = ''; $relBtn = ''; $editLink = ''; $edithelp = ''; if (self::articleIsWikiHow($article) || $wgTitle->getArticleID() == 0 && $wgTitle->getNamespace() == NS_MAIN) { $sk = $article->getContext()->getSkin(); if (class_exists('Html5editor') && isHtml5Editable(true)) { $relQuery = array('h5e' => 'true'); // if article doesn't exist, enter into article creation mode if ($wgTitle->getArticleID() <= 0) { $relQuery['create-new-article'] = 'true'; } $editLink = Linker::linkKnown($wgTitle, wfMessage('html5_editor')->text(), array("id" => "othereditlink"), $relQuery) . wfMessage('h5e_save_first')->text(); } else { $oldparameters = ""; if ($wgRequest->getVal("oldid") != "") { $oldparameters = "&oldid=" . $wgRequest->getVal("oldid"); } if ($isGuided) { $editLink = $sk->makeKnownLinkObj($wgTitle, wfMessage('advanced_editing_link')->text(), 'action=edit&advanced=true' . $oldparameters, '', '', ''); //weave links button $relBtn = $wgLanguageCode == 'en' ? PopBox::getGuidedEditorButton() : ''; $relHTML = PopBox::getPopBoxJSGuided() . PopBox::getPopBoxDiv() . PopBox::getPopBoxCSS(); } else { $editLink = $sk->makeKnownLinkObj($wgTitle, wfMessage('guided_editing_link')->text(), 'action=edit&override=yes' . $oldparameters, '', '', ''); } } $edithelpurl = $sk->makeInternalOrExternalUrl(wfMsgForContent('edithelppage')); $edithelp = '<a target="helpwindow" href="' . $edithelpurl . '">' . htmlspecialchars(wfMessage('edithelp_link')->text()) . '</a>'; } // Take out switch to guided editing and editing help on edit page for logged out users on international if ($wgLanguageCode == "en" || $wgTitle->userCan('edit')) { $editlinks = $relHTML . '<div class="editpage_links">' . $editLink . ' ' . $relBtn . ' ' . $edithelp . '</div>'; } else { $editlinks = ''; } return $editlinks; }
function wfEditPageBeforeEditToolbar(&$toolbar) { global $wgStylePath, $wgOut, $wgLanguageCode; $params = array($image = $wgStylePath . '/owl/images/1x1_transparent.gif', $tip = 'Weave links', $open = '', $close = '', $sample = '', $cssId = 'weave_button'); $script = Xml::encodeJsCall('mw.toolbar.addButton', $params); $wgOut->addScript(Html::inlineScript(ResourceLoader::makeLoaderConditionalScript($script))); $params = array($image = $wgStylePath . '/owl/images/1x1_transparent.gif', $tip = 'Add Image', $open = '', $close = '', $sample = '', $cssId = 'easyimageupload_button', $onclick = "easyImageUpload.doEIUModal('advanced');return false;"); $script = Xml::encodeJsCall('mw.toolbar.addButton', $params); $wgOut->addScript(Html::inlineScript(ResourceLoader::makeLoaderConditionalScript($script))); $wgOut->addJScode('advj'); $wgOut->addJScode('eiuj'); if (in_array($wgLanguageCode, array('en', 'de', 'es', 'pt'))) { $popbox = PopBox::getPopBoxJSAdvanced() . PopBox::getPopBoxCSS(); $popbox_div = PopBox::getPopBoxDiv(); $wgOut->addHTML($popbox_div . $popbox); $wgOut->addHTML(Easyimageupload::getUploadBoxJS(true)); } return true; }
/** * Send the edit form and related headers to $wgOut * @param $formCallback Optional callable that takes an OutputPage * parameter; will be called during form output * near the top, for captchas and the like. */ function showEditForm($formCallback = null) { global $wgOut, $wgUser, $wgLang, $wgContLang, $wgMaxArticleSize, $wgTitle; $fname = 'EditPage::showEditForm'; wfProfileIn($fname); $sk = $wgUser->getSkin(); wfRunHooks('EditPage::showEditForm:initial', array(&$this)); $wgOut->setRobotpolicy('noindex,nofollow'); # Enabled article-related sidebar, toplinks, etc. $wgOut->setArticleRelated(true); if ($this->formtype == 'preview') { $wgOut->setPageTitleActionText(wfMsg('preview')); } if ($this->isConflict) { $s = wfMsg('editconflict', $wgTitle->getPrefixedText()); $wgOut->setPageTitle($s); $wgOut->addWikiMsg('explainconflict'); $this->textbox2 = $this->textbox1; $this->textbox1 = $this->getContent(); $this->edittime = $this->mArticle->getTimestamp(); } else { if ($this->section != '') { if ($this->section == 'new') { $s = wfMsg('editingcomment', $wgTitle->getPrefixedText()); } else { $s = wfMsg('editingsection', $wgTitle->getPrefixedText()); $matches = array(); if (!$this->summary && !$this->preview && !$this->diff) { preg_match("/^(=+)(.+)\\1/mi", $this->textbox1, $matches); if (!empty($matches[2])) { global $wgParser; $this->summary = "/* " . $wgParser->stripSectionName(trim($matches[2])) . " */ "; } } } } else { $s = wfMsg('editing', $wgTitle->getPrefixedText()); } $wgOut->setPageTitle($s); if ($this->missingComment) { $wgOut->wrapWikiMsg('<div id="mw-missingcommenttext">$1</div>', 'missingcommenttext'); } if ($this->missingSummary && $this->section != 'new') { $wgOut->wrapWikiMsg('<div id="mw-missingsummary">$1</div>', 'missingsummary'); } if ($this->missingSummary && $this->section == 'new') { $wgOut->wrapWikiMsg('<div id="mw-missingcommentheader">$1</div>', 'missingcommentheader'); } if ($this->hookError !== '') { $wgOut->addWikiText($this->hookError); } if (!$this->checkUnicodeCompliantBrowser()) { $wgOut->addWikiMsg('nonunicodebrowser'); } if (isset($this->mArticle) && isset($this->mArticle->mRevision)) { // Let sysop know that this will make private content public if saved if (!$this->mArticle->mRevision->userCan(Revision::DELETED_TEXT)) { $wgOut->addWikiMsg('rev-deleted-text-permission'); } else { if ($this->mArticle->mRevision->isDeleted(Revision::DELETED_TEXT)) { $wgOut->addWikiMsg('rev-deleted-text-view'); } } if (!$this->mArticle->mRevision->isCurrent()) { $this->mArticle->setOldSubtitle($this->mArticle->mRevision->getId()); $wgOut->addWikiMsg('editingold'); } } } if (wfReadOnly()) { $wgOut->addHTML('<div id="mw-read-only-warning">' . wfMsgWikiHTML('readonlywarning') . '</div>'); } elseif ($wgUser->isAnon() && $this->formtype != 'preview') { $wgOut->addHTML('<div id="mw-anon-edit-warning">' . wfMsgWikiHTML('anoneditwarning') . '</div>'); } else { if ($this->isCssJsSubpage && $this->formtype != 'preview') { # Check the skin exists if ($this->isValidCssJsSubpage) { $wgOut->addWikiMsg('usercssjsyoucanpreview'); } else { $wgOut->addWikiMsg('userinvalidcssjstitle', $wgTitle->getSkinFromCssJsSubpage()); } } } if ($this->mTitle->getNamespace() == NS_MEDIAWIKI) { # Show a warning if editing an interface message $wgOut->addWikiMsg('editinginterface'); } elseif ($this->mTitle->isProtected('edit')) { # Is the title semi-protected? if ($this->mTitle->isSemiProtected()) { $noticeMsg = 'semiprotectedpagewarning'; } else { # Then it must be protected based on static groups (regular) $noticeMsg = 'protectedpagewarning'; } $wgOut->addWikiMsg($noticeMsg); } if ($this->mTitle->isCascadeProtected()) { # Is this page under cascading protection from some source pages? list($cascadeSources, ) = $this->mTitle->getCascadeProtectionSources(); $notice = "\$1\n"; if (count($cascadeSources) > 0) { # Explain, and list the titles responsible foreach ($cascadeSources as $page) { $notice .= '* [[:' . $page->getPrefixedText() . "]]\n"; } } $wgOut->wrapWikiMsg($notice, array('cascadeprotectedwarning', count($cascadeSources))); } if (!$this->mTitle->exists() && $this->mTitle->getRestrictions('create') != array()) { $wgOut->addWikiMsg('titleprotectedwarning'); } if ($this->kblength === false) { $this->kblength = (int) (strlen($this->textbox1) / 1024); } if ($this->tooBig || $this->kblength > $wgMaxArticleSize) { $wgOut->addWikiMsg('longpageerror', $wgLang->formatNum($this->kblength), $wgMaxArticleSize); } elseif ($this->kblength > 29) { $wgOut->addWikiMsg('longpagewarning', $wgLang->formatNum($this->kblength)); } #need to parse the preview early so that we know which templates are used, #otherwise users with "show preview after edit box" will get a blank list if ($this->formtype == 'preview') { $previewOutput = $this->getPreviewText(); } $rows = $wgUser->getIntOption('rows'); $cols = $wgUser->getIntOption('cols'); $ew = $wgUser->getOption('editwidth'); if ($ew) { $ew = " style=\"width:100%\""; } else { $ew = ''; } $q = 'action=submit'; #if ( "no" == $redirect ) { $q .= "&redirect=no"; } $action = $wgTitle->escapeLocalURL($q); $summary = wfMsg('summary'); $subject = wfMsg('subject'); $cancel = $sk->makeKnownLink($wgTitle->getPrefixedText(), wfMsgExt('cancel', array('parseinline')), '', '', '', 'class="button secondary" id="edit_cancel_btn"'); global $wgRightsText; if ($wgRightsText) { $copywarnMsg = array('copyrightwarning', '[[' . wfMsgForContent('copyrightpage') . ']]', $wgRightsText); } else { $copywarnMsg = array('copyrightwarning2', '[[' . wfMsgForContent('copyrightpage') . ']]'); } // XXCHANGED if (!$wgUser->getOption('disablewarning')) { $wgOut->addHTML("<script language=\"JavaScript\">\n\t\t\t\tvar needToConfirm = false;\n\t\t\t\twindow.onbeforeunload = confirmExit;\n\t\t\t\tfunction confirmExit() {\n\t\t\t\t\tif (needToConfirm) \n\t\t\t\t\t\treturn \"" . wfMsg('all-changes-lost') . "\";\n\t\t\t\t}\n\t\t\t\t(function (\$) {\n\t\t\t\t\t\$(document).ready(function() {\n\t\t\t\t\t\t\$('.mw-toolbar-editbutton, #weave_button, #easyimageupload_button').click(function () {\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tneedToConfirm = true;\n\t\t\t\t\t\t});\n\t\t\t\t\t\t\$('textarea').focus(function () {\n\t\t\t\t\t\t\tneedToConfirm = true;\n\t\t\t\t\t\t});\n\t\t\t\t\t});\n\t\t\t\t})(jQuery);\n\n\t\t\t\t</script>"); } if ($wgUser->getOption('showtoolbar') and !$this->isCssJsSubpage) { # prepare toolbar for edit buttons $toolbar = $this->getEditToolbar(); } else { $toolbar = ''; } // activate checkboxes if user wants them to be always active if (!$this->preview && !$this->diff) { # Sort out the "watch" checkbox if ($wgUser->getOption('watchdefault')) { # Watch all edits $this->watchthis = true; } elseif ($wgUser->getOption('watchcreations') && !$this->mTitle->exists()) { # Watch creations $this->watchthis = true; } elseif ($this->mTitle->userIsWatching()) { # Already watched $this->watchthis = true; } if ($wgUser->getOption('minordefault')) { $this->minoredit = true; } } $wgOut->addHTML($this->editFormPageTop); if ($wgUser->getOption('previewontop')) { if ('preview' == $this->formtype) { $this->showPreview($previewOutput); } else { $wgOut->addHTML('<div id="wikiPreview"></div>'); } if ('diff' == $this->formtype) { $this->showDiff(); } } //ADDED FOR WYSIWYG wfRunHooks('EditPage::showEditForm:initial2', array(&$this)); $wgOut->addHTML($this->editFormTextTop); # if this is a comment, show a subject line at the top, which is also the edit summary. # Otherwise, show a summary field at the bottom $summarytext = htmlspecialchars($wgContLang->recodeForEdit($this->summary)); # FIXME if ($this->section == 'new') { $commentsubject = "<span id='wpSummaryLabel'><label for='wpSummary'>{$subject}</label></span>\n<div class='editOptions'>\n<input tabindex='1' type='text' value=\"{$summarytext}\" name='wpSummary' id='wpSummary' maxlength='200' size='60' /><br />"; $editsummary = ''; $subjectpreview = $summarytext && $this->preview ? "<div class=\"mw-summary-preview\">" . wfMsg('subject-preview') . ':' . $sk->commentBlock($this->summary, $this->mTitle) . "</div>\n" : ''; $summarypreview = ''; } else { $commentsubject = ''; $editsummary = "<span id='wpSummaryLabel'><label for='wpSummary'>{$summary}</label></span>\n<div class='editOptions'>\n<input tabindex='2' type='text' value=\"{$summarytext}\" name='wpSummary' id='wpSummary' maxlength='200' size='60' /><br />"; $summarypreview = $summarytext && $this->preview ? "<div class=\"mw-summary-preview\">" . wfMsg('summary-preview') . ':' . $sk->commentBlock($this->summary, $this->mTitle) . "</div>\n" : ''; $subjectpreview = ''; } # Set focus to the edit box on load, except on preview or diff, where it would interfere with the display if (!$this->preview && !$this->diff) { $wgOut->setOnloadHandler('document.editform.wpTextbox1.focus()'); } $templates = $this->preview || $this->section != '' ? $this->mPreviewTemplates : $this->mArticle->getUsedTemplates(); $formattedtemplates = $sk->formatTemplates($templates, $this->preview, $this->section != ''); global $wgUseMetadataEdit; if ($wgUseMetadataEdit) { $metadata = $this->mMetaData; $metadata = htmlspecialchars($wgContLang->recodeForEdit($metadata)); $top = wfMsgWikiHtml('metadata_help'); $metadata = $top . "<textarea name='metadata' rows='3' cols='{$cols}'{$ew}>{$metadata}</textarea>"; } else { $metadata = ""; } $hidden = ''; $recreate = ''; if ($this->deletedSinceEdit) { if ('save' != $this->formtype) { $wgOut->addWikiMsg('deletedwhileediting'); } else { // Hide the toolbar and edit area, use can click preview to get it back // Add an confirmation checkbox and explanation. $toolbar = ''; $hidden = 'type="hidden" style="display:none;"'; $recreate = $wgOut->parse(wfMsg('confirmrecreate', $this->lastDelete->user_name, $this->lastDelete->log_comment)); $recreate .= "<br /><input tabindex='1' type='checkbox' value='1' name='wpRecreate' id='wpRecreate' />" . "<label for='wpRecreate' title='" . wfMsg('tooltip-recreate') . "'>" . wfMsg('recreate') . "</label>"; } } $tabindex = 2; $checkboxes = self::getCheckboxes($tabindex, $sk, array('minor' => $this->minoredit, 'watch' => $this->watchthis)); $checkboxhtml = implode($checkboxes, "\n"); $buttons = $this->getEditButtons($tabindex); $buttonshtml = implode($buttons, "\n"); $safemodehtml = $this->checkUnicodeCompliantBrowser() ? '' : Xml::hidden('safemode', '1'); $jsUrl = wfGetPad('/extensions/min/f/skins/common/clientscript.js?rev=') . WH_SITEREV; $wgOut->addHTML("<script type='text/javascript' src='{$jsUrl}'></script>"); $wgOut->addHTML(<<<END \t<script type='text/javascript'> \t\tvar isGuided = false; \t</script> <form id="editform" name="editform" method="post" action="{$action}" enctype="multipart/form-data"> <div class="minor_section"> {$toolbar} END ); if (is_callable($formCallback)) { call_user_func_array($formCallback, array(&$wgOut)); } wfRunHooks('EditPage::showEditForm:fields', array(&$this, &$wgOut)); // Put these up at the top to ensure they aren't lost on early form submission $popbox = ''; $popbox_div = ''; global $wgLanguageCode; if (in_array($wgLanguageCode, array('en', 'de', 'es'))) { $popbox = PopBox::getPopBoxJSAdvanced() . PopBox::getPopBoxCSS(); $popbox_div = PopBox::getPopBoxDiv(); } // Put these up at the top to ensure they aren't lost on early form submission $wgOut->addHTML("\n<input type='hidden' value=\"" . htmlspecialchars($this->section) . "\" name=\"wpSection\" />\n<input type='hidden' value=\"{$this->starttime}\" name=\"wpStarttime\" />\n\n<input type='hidden' value=\"{$this->edittime}\" name=\"wpEdittime\" />\n\n<input type='hidden' value=\"{$this->scrolltop}\" name=\"wpScrolltop\" id=\"wpScrolltop\" />\n {$popbox}\n"); // XXCHANGED -- use CDN $wgOut->addHTML(<<<END {$recreate} {$commentsubject} {$subjectpreview} {$this->editFormTextBeforeContent} <textarea tabindex='1' accesskey="," name="wpTextbox1" id="wpTextbox1" rows='{$rows}' class="adv_edit_box" cols='{$cols}'{$ew} {$hidden}> END . htmlspecialchars($this->safeUnicodeOutput($this->textbox1)) . "\n</textarea>\n {$popbox_div}\n\t</div>"); $wgOut->addHTML($this->editFormTextAfterWarn); $wgOut->addHTML("<div class=\"minor_section\">\n{$metadata}\n{$editsummary}\n{$summarypreview}\n{$checkboxhtml}\n{$safemodehtml}\n"); // XXCHANGED -- use CDN $wgOut->addHTML("<div class='editButtons'>{$cancel} {$buttonshtml}</div><!-- editButtons --><br />"); $wgOut->addHtml('<div class="mw-editTools">'); $wgOut->addWikiMsgArray('edittools', array(), array('content')); $wgOut->addHtml('</div>'); $wgOut->wrapWikiMsg("<div id=\"editpage-copywarn\">\n\$1\n</div>", $copywarnMsg); $wgOut->addHTML("</div>"); $wgOut->addHTML($this->editFormTextAfterTools); /** * To make it harder for someone to slip a user a page * which submits an edit form to the wiki without their * knowledge, a random token is associated with the login * session. If it's not passed back with the submission, * we won't save the page, or render user JavaScript and * CSS previews. * * For anon editors, who may not have a session, we just * include the constant suffix to prevent editing from * broken text-mangling proxies. */ if (!$this instanceof EditPageWrapper) { $token = md5($wgUser->getName() . $this->mTitle->getArticleID() . time()); wfTrackEditToken($wgUser, $token, $this->mTitle, $this instanceof EditPageWrapper); $wgOut->addHTML("\n<input type='hidden' value=\"{$token}\" name=\"wpEditTokenTrack\" />\n"); } $token = htmlspecialchars($wgUser->editToken()); $wgOut->addHTML("\n<input type='hidden' value=\"{$token}\" name=\"wpEditToken\" />\n"); //XXADDED patrol undone edits automatically global $wgRequest; if ($wgRequest->getVal('undo', null) != null) { $undo_id = $wgRequest->getVal('undo', null); $wgOut->addHTML("\n<input type='hidden' value=\"{$undo_id}\" name=\"wpUndoEdit\" />\n"); } # If a blank edit summary was previously provided, and the appropriate # user preference is active, pass a hidden tag here. This will stop the # user being bounced back more than once in the event that a summary # is not required. if ($this->missingSummary) { $wgOut->addHTML("<input type=\"hidden\" name=\"wpIgnoreBlankSummary\" value=\"1\" />\n"); } # For a bit more sophisticated detection of blank summaries, hash the # automatic one and pass that in a hidden field. $autosumm = $this->autoSumm ? $this->autoSumm : md5($this->summary); $wgOut->addHtml(wfHidden('wpAutoSummary', $autosumm)); if ($this->isConflict) { $wgOut->wrapWikiMsg('==$1==', "yourdiff"); $de = new DifferenceEngine($this->mTitle); $de->setText($this->textbox2, $this->textbox1); $de->showDiff(wfMsg("yourtext"), wfMsg("storedversion")); $wgOut->wrapWikiMsg('==$1==', "yourtext"); $wgOut->addHTML("<textarea tabindex='6' id='wpTextbox2' name=\"wpTextbox2\" rows='{$rows}' cols='{$cols}'>" . htmlspecialchars($this->safeUnicodeOutput($this->textbox2)) . "\n</textarea>"); } $wgOut->addHTML($this->editFormTextBottom); $wgOut->addHTML("</form>\n"); if (!$wgUser->getOption('previewontop')) { if ($this->formtype == 'preview') { $this->showPreview($previewOutput); } else { $wgOut->addHTML('<div id="wikiPreview"></div>'); } if ($this->formtype == 'diff') { $this->showDiff(); } } $wgOut->addHTML("</div> <!--edit page article_inner-->\n"); if ($formattedtemplates) { $wgOut->addHTML("<div class='templatesUsed minor_section'>{$formattedtemplates}</div>"); } wfProfileOut($fname); }