Esempio n. 1
0
function Html5Setup()
{
    global $wgOut, $wgRequest, $IP, $wgTitle;
    $articleExists = $wgTitle->getArticleID() > 0;
    $editable = isHtml5Editable();
    if ($editable) {
        wfLoadExtensionMessages('Html5editor');
        $imageUpload = Easyimageupload::getUploadBoxJS(false);
        $wgOut->addScript($imageUpload);
        $vars = array('GOOGLE_SEARCH_API_KEY' => WH_GOOGLE_AJAX_IMAGE_SEARCH_API_KEY, 'articleExists' => $articleExists);
        EasyTemplate::set_path(dirname(__FILE__) . '/');
        $script = EasyTemplate::html('skin.tmpl.php', $vars);
        $wgOut->addScript($script);
    }
    return true;
}
Esempio n. 2
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");
 }
Esempio n. 3
0
 public function execute($par)
 {
     global $wgRequest, $wgOut;
     Easyimageupload::setTemplatePath();
     wfLoadExtensionMessages('Easyimageupload');
     $page = intval($wgRequest->getVal('page', 1));
     $query = $wgRequest->getVal('q');
     if ($wgRequest->getVal('src') == 'flickr') {
         $json = Easyimageupload::findImagesFlickr($query, $page);
     }
     $wgOut->disable(true);
     print $json;
     return;
 }
Esempio n. 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;
}
 /**	
  * show
  * Display the main window.  Right now it's skinless
  **/
 function show()
 {
     global $wgOut, $wgUser;
     $fname = "Introimageadder::show";
     wfProfileIn($fname);
     $sk = $wgUser->getSkin();
     //$wgOut->setArticleBodyOnly(true);
     $wgOut->addHTML(Easyimageupload::getUploadBoxJS());
     $wgOut->addHTML("\n\t<style type='text/css' media='all'>/*<![CDATA[*/ @import '" . wfGetPad('/extensions/min/f/extensions/wikihow/introimageadder.css?rev=') . WH_SITEREV . "'; /*]]>*/</style>\n\t<script type='text/javascript' src='" . wfGetPad('/extensions/min/f/extensions/wikihow/introimageadder.js?rev=') . WH_SITEREV . "'></script>\n\n\t<div id='IntroImageAdder'>\n\t\t<div id='introimageheader'>\n\t\t\t<h1>" . wfMsg('iia_title') . "</h1>\n\t\t\t" . wfMsg('iia_msg_instructions') . "\n\t\t\t<div id='iia_msg'>\n\t\t\t</div>\n\t\t</div><!--end introimageheader-->\n\t\t<div style='clear:both;'></div>\n\t\t<div id='iia_main'><img src='" . wfGetPad('/extensions/wikihow/rotate.gif') . "' alt='' class='eiu-wheel' id='eiu-wheel-details' /></div>\n\t</div>\n<script type='text/javascript'>\nvar replacelinks = false;\nvar pastmessages = [];\n\njQuery(window).load(introImageAdder.init);\n</script>\n\n\t\t");
     wfProfileOut($fname);
     return;
 }