示例#1
0
 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', '') . " &nbsp;&nbsp;&nbsp;\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') . ": &nbsp; {$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");
 }
示例#2
0
 function execute($par)
 {
     global $wgOut, $wgRequest, $wgUser, $wgParser;
     wfLoadExtensionMessages("MethodEditor");
     if ($wgUser->isBlocked()) {
         $wgOut->blockedPage();
         return;
     }
     if (!($wgUser->isSysop() || in_array('newarticlepatrol', $wgUser->getRights()))) {
         $wgOut->setRobotpolicy('noindex,nofollow');
         $wgOut->errorpage('nosuchspecialpage', 'nospecialpagetext');
         return;
     }
     $this->skipTool = new ToolSkip("methodeditor", MethodEditor::TABLE_NAME, "ama_checkout", "ama_checkout_user", "ama_id");
     if ($wgRequest->getVal('getNext')) {
         $wgOut->disable();
         $result = $this->getNextMethod();
         echo json_encode($result);
         return;
     } else {
         if ($wgRequest->getVal('skipMethod')) {
             $wgOut->disable();
             $methodId = $wgRequest->getVal('methodId');
             $this->skipTool->skipItem($methodId);
             $this->skipTool->unUseItem($methodId);
             $result = $this->getNextMethod();
             echo json_encode($result);
             return;
         } elseif ($wgRequest->getVal('deleteMethod')) {
             $wgOut->disable();
             $methodId = $wgRequest->getVal('methodId');
             $articleId = $wgRequest->getVal('articleId');
             $method = $wgRequest->getVal('method');
             $this->deleteMethod($methodId, $articleId, $method);
             $result = $this->getNextMethod();
             echo json_encode($result);
             return;
         } elseif ($wgRequest->getVal('keepMethod')) {
             $wgOut->disable();
             $methodId = $wgRequest->getVal('methodId');
             $articleId = $wgRequest->getVal('articleId');
             $altMethod = $wgRequest->getVal('method');
             $altSteps = $wgRequest->getVal('steps');
             $this->keepMethod($methodId, $articleId, $altMethod, $altSteps);
             $result = $this->getNextMethod();
             echo json_encode($result);
             return;
         } elseif ($wgRequest->getVal('quickEdit')) {
             $wgOut->disable();
             $methodId = $wgRequest->getVal('methodId');
             $articleId = $wgRequest->getVal('articleId');
             $this->quickEditRecord($methodId, $articleId);
             $result = $this->getNextMethod();
             echo json_encode($result);
             return;
         } elseif ($wgRequest->getVal('clearSkip')) {
             $wgOut->disable();
             $this->skipTool->clearSkipCache();
             echo "Skip cache has been cleared";
             return;
         }
     }
     $wgOut->setHTMLTitle(wfMsg('methodeditor'));
     $wgOut->setPageTitle(wfMsg('methodeditor'));
     $wgOut->addScript(HtmlSnips::makeUrlTags('js', array('clientscript.js'), 'skins/common', false));
     $wgOut->addScript(HtmlSnips::makeUrlTags('css', array('methodeditor.css'), 'extensions/wikihow/altmethodadder', false));
     $wgOut->addScript(HtmlSnips::makeUrlTags('js', array('methodeditor.js'), 'extensions/wikihow/altmethodadder', false));
     $wgOut->addScript(HtmlSnips::makeUrlTags('js', array('jquery.cookie.js'), 'extensions/wikihow/common', false));
     $wgOut->addHTML(PopBox::getPopBoxJSAdvanced());
     $tmpl = new EasyTemplate(dirname(__FILE__));
     $wgOut->addHTML($tmpl->execute('MethodEditor.tmpl.php'));
     $this->displayLeaderboards();
     $wgOut->addHTML(QuickNoteEdit::displayQuickEdit());
 }
 function execute($par)
 {
     global $wgOut, $wgRequest, $wgParser;
     wfLoadExtensionMessages("MethodEditor");
     $user = $this->getContext()->getUser();
     if (!$user || $user->isBlocked()) {
         $wgOut->blockedPage();
         return;
     }
     if (!$this->userAllowed($user)) {
         $wgOut->setRobotpolicy('noindex,nofollow');
         $wgOut->showErrorPage('nosuchspecialpage', 'nospecialpagetext');
         return;
     }
     $this->skipTool = new ToolSkip("methodeditor", MethodEditor::TABLE_NAME, "ama_checkout", "ama_checkout_user", "ama_page");
     if ($wgRequest->getVal('allarticles')) {
         $wgOut->setArticleBodyOnly(true);
         $dbr = wfGetDB(DB_SLAVE);
         $date = date('Y-m-d');
         header('Content-type: application/force-download');
         header('Content-disposition: attachment; filename="methods_' . $date . '.xls"');
         $res = $dbr->select(MethodEditor::TABLE_NAME, array('ama_page'), array('ama_patrolled' => '1'), __METHOD__, array('GROUP BY' => 'ama_page'));
         foreach ($res as $row) {
             $title = Title::newFromID($row->ama_page);
             if ($title) {
                 echo $title->getFullURL() . "\n";
             }
         }
         return;
     }
     if ($wgRequest->getVal('getNext')) {
         $wgOut->disable();
         $result = $this->getNextMethod($wgRequest->getVal('aid'));
         echo json_encode($result);
         return;
     } else {
         if ($wgRequest->getVal('skipMethod')) {
             $wgOut->disable();
             $articleId = $wgRequest->getVal('articleId');
             $this->skipTool->skipItem($articleId);
             $this->skipTool->unUseItem($articleId);
             $result = $this->getNextMethod();
             echo json_encode($result);
             return;
         } elseif ($wgRequest->getVal('deleteMethod')) {
             $wgOut->disable();
             $methodId = $wgRequest->getVal('methodId');
             $articleId = $wgRequest->getVal('articleId');
             $method = $wgRequest->getVal('method');
             $this->deleteMethod($methodId, $articleId, $method);
             $result = $this->getNextMethod();
             echo json_encode($result);
             return;
         } elseif ($wgRequest->getVal('keepMethod')) {
             $wgOut->disable();
             $methodId = $wgRequest->getVal('methodId');
             $articleId = $wgRequest->getVal('articleId');
             $altMethod = $wgRequest->getVal('method');
             $altSteps = $wgRequest->getVal('steps');
             $this->keepMethod($methodId, $articleId, $altMethod, $altSteps);
             $result = $this->getNextMethod();
             echo json_encode($result);
             return;
         } elseif ($wgRequest->getVal('quickEdit')) {
             $wgOut->disable();
             $methodId = $wgRequest->getVal('methodId');
             $articleId = $wgRequest->getVal('articleId');
             $this->quickEditRecord($methodId, $articleId);
             $result = $this->getNextMethod();
             echo json_encode($result);
             return;
         } elseif ($wgRequest->getVal('clearSkip')) {
             $wgOut->disable();
             $this->skipTool->clearSkipCache();
             echo "Skip cache has been cleared";
             return;
         }
     }
     $wgOut->setPageTitle(wfMessage('methodeditor')->text());
     $wgOut->addJScode('csjs');
     $wgOut->addCSScode('methc');
     $wgOut->addJScode('methj');
     $wgOut->addJScode('jcookj');
     $wgOut->addHTML(PopBox::getPopBoxJSAdvanced());
     $groups = $user->getGroups();
     $showList = in_array('staff', $groups) || in_array('staff_widget', $groups);
     $tmpl = new EasyTemplate(dirname(__FILE__));
     $tmpl->set_vars(array('showList' => $showList));
     $wgOut->addHTML($tmpl->execute('MethodEditor.tmpl.php'));
     $this->displayLeaderboards();
     $wgOut->addHTML(QuickNoteEdit::displayQuickEdit());
 }
示例#4
0
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;
}
 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;
 }
示例#6
0
 /**
  * Shows a bulletin board style toolbar for common editing functions.
  * It can be disabled in the user preferences.
  * The necessary JavaScript code can be found in style/wikibits.js.
  */
 function getEditToolbar()
 {
     global $wgStylePath, $wgContLang, $wgJsMimeType;
     /**
      * toolarray an array of arrays which each include the filename of
      * the button image (without path), the opening tag, the closing tag,
      * and optionally a sample text that is inserted between the two when no
      * selection is highlighted.
      * The tip text is shown when the user moves the mouse over the button.
      *
      * Already here are accesskeys (key), which are not used yet until someone
      * can figure out a way to make them work in IE. However, we should make
      * sure these keys are not defined on the edit page.
      */
     $toolarray = array(array('image' => 'button_bold.png', 'id' => 'mw-editbutton-bold', 'open' => '\'\'\'', 'close' => '\'\'\'', 'sample' => wfMsg('bold_sample'), 'tip' => wfMsg('bold_tip'), 'key' => 'B'), array('image' => 'button_italic.png', 'id' => 'mw-editbutton-italic', 'open' => '\'\'', 'close' => '\'\'', 'sample' => wfMsg('italic_sample'), 'tip' => wfMsg('italic_tip'), 'key' => 'I'), array('image' => 'button_link.png', 'id' => 'mw-editbutton-link', 'open' => '[[', 'close' => ']]', 'sample' => wfMsg('link_sample'), 'tip' => wfMsg('link_tip'), 'key' => 'L'), array('image' => 'button_extlink.png', 'id' => 'mw-editbutton-extlink', 'open' => '[', 'close' => ']', 'sample' => wfMsg('extlink_sample'), 'tip' => wfMsg('extlink_tip'), 'key' => 'X'), array('image' => 'button_headline.png', 'id' => 'mw-editbutton-headline', 'open' => "\n== ", 'close' => " ==\n", 'sample' => wfMsg('headline_sample'), 'tip' => wfMsg('headline_tip'), 'key' => 'H'), array('image' => 'button_image.png', 'id' => 'mw-editbutton-image', 'open' => '[[' . $wgContLang->getNsText(NS_IMAGE) . ":", 'close' => ']]', 'sample' => wfMsg('image_sample'), 'tip' => wfMsg('image_tip'), 'key' => 'D'), array('image' => 'button_media.png', 'id' => 'mw-editbutton-media', 'open' => '[[' . $wgContLang->getNsText(NS_MEDIA) . ':', 'close' => ']]', 'sample' => wfMsg('media_sample'), 'tip' => wfMsg('media_tip'), 'key' => 'M'), array('image' => 'button_math.png', 'id' => 'mw-editbutton-math', 'open' => "<math>", 'close' => "</math>", 'sample' => wfMsg('math_sample'), 'tip' => wfMsg('math_tip'), 'key' => 'C'), array('image' => 'button_nowiki.png', 'id' => 'mw-editbutton-nowiki', 'open' => "<nowiki>", 'close' => "</nowiki>", 'sample' => wfMsg('nowiki_sample'), 'tip' => wfMsg('nowiki_tip'), 'key' => 'N'), array('image' => 'button_sig.png', 'id' => 'mw-editbutton-signature', 'open' => '--~~~~', 'close' => '', 'sample' => '', 'tip' => wfMsg('sig_tip'), 'key' => 'Y'), array('image' => 'button_hr.png', 'id' => 'mw-editbutton-hr', 'open' => "\n----\n", 'close' => '', 'sample' => '', 'tip' => wfMsg('hr_tip'), 'key' => 'R'));
     $toolbar = "<div id='toolbar' style='float: left; margin-bottom:3px;'>\n";
     $toolbar .= "<script type='{$wgJsMimeType}'>\n/*<![CDATA[*/\n";
     foreach ($toolarray as $tool) {
         // XXCHANGED -- use CDN
         $params = array($image = wfGetPad($wgStylePath . '/owl/images/' . $tool['image']), $tip = $tool['tip'], $open = $tool['open'], $close = $tool['close'], $sample = $tool['sample'], $cssId = $tool['id']);
         $paramList = implode(',', array_map(array('Xml', 'encodeJsVar'), $params));
         $toolbar .= "addButton({$paramList});\n";
     }
     //XXADDED
     wfRunHooks('EditPageToolbar', array(&$toolbar, NULL));
     $toolbar .= "/*]]>*/\n</script>";
     $toolbar .= "\n</div>";
     $toolbar .= PopBox::getToolbarButton() . ($wgLanguadeCode == 'en' ? "<div style='float:left;'><input id='fixcaps_button' type='image' src='/skins/WikiHow/images/fixcaps.png' accesskey='o' onclick='javascript:fixcaps(document.editform.wpTextbox1)'/></div>\n" : "");
     //XXADDED
     wfRunHooks('EditPageToolbarPost', array(&$toolbar, NULL));
     return $toolbar;
 }
示例#7
0
 function getPopBoxJSGuided()
 {
     $js = "\n\t\n\t\n\t<script type=\"text/javascript\" src=\"" . wfGetPad('/extensions/min/f/extensions/PopBox/PopBox.js?rev=') . WH_SITEREV . "\"></script>\n\t\t<script language='javascript'>\n\tfunction blurHandler(evt) {\n\t\t//activeElement = null;\n\t}\n\tfunction focusHandler(evt) {\n\t\tif (!resetAccessKey && navigator.userAgent.indexOf(\"MSIE\") >= 0) {\n\t\t\tdocument.getElementById('weave_button').accessKey  = '';\n\t\t}\n\t\tresetAccessKey = true;\n\t\tvar e = evt ? evt : window.event;\n\t\tif (!e) return;\n\t\tif (e.target)\n\t\t\tactiveElement = e.target;\n\t\telse if(e.srcElement) activeElement = e.srcElement;\n\t}\n\tfunction loadHandler() {\n\t\tfor (var j = 0; j < document.editform.elements.length; j++) {\n\t\t\tdocument.editform.elements[j].onfocus = focusHandler;\n\t\t\tdocument.editform.elements[j].onblur  = blurHandler;\n\t\t}\n\t}\n\tvar activeElement = null;\n\tvar resetAccessKey = false;\n\tjQuery(window).load(loadHandler);\n\t//window.onload = loadHandler;\n\t\n\tfunction PopItFromGuided() {\n\t//\tPopIt(document.editform.steps);\n\t\tif (activeElement == null) {\n\t\t\talert(\"" . wfMessage('popbox_noelement')->text() . "\");\n\t\t\treturn;\n\t\t}\n\t\tPopIt(activeElement);\n\t}\n\t\n\t\n\t\t\t</script>\n\t\t";
     return $js . PopBox::getPopBoxJS();
 }