function _generate() { global $WikiTheme; $toolbar = "document.writeln(\"<div class=\\\"edit-toolbar\\\" id=\\\"toolbar\\\">\");\n"; if (ENABLE_EDIT_TOOLBAR) { $toolarray = array(array("image" => "ed_format_bold.png", "open" => "*", "close" => "*", "sample" => _("Bold text"), "tip" => _("Bold text")), array("image" => "ed_format_italic.png", "open" => "_", "close" => "_", "sample" => _("Italic text"), "tip" => _("Italic text")), array("image" => "ed_pagelink.png", "open" => "[", "close" => "]", "sample" => _("optional label | PageName"), "tip" => _("Link to page")), array("image" => "ed_link.png", "open" => "[", "close" => "]", "sample" => _("optional label | http://www.example.com"), "tip" => _("External link (remember http:// prefix)")), array("image" => "ed_headline.png", "open" => "\\n!!! ", "close" => "\\n", "sample" => _("Headline text"), "tip" => _("Level 1 headline")), array("image" => "ed_image.png", "open" => "[ ", "close" => " ]", "sample" => _("Example.jpg"), "tip" => _("Embedded image")), array("image" => "ed_nowiki.png", "open" => "\\n\\<verbatim\\>\\n", "close" => "\\n\\</verbatim\\>\\n", "sample" => _("Insert non-formatted text here"), "tip" => _("Ignore wiki formatting")), array("image" => "ed_sig.png", "open" => " --" . $GLOBALS['request']->_user->UserName(), "close" => "", "sample" => "", "tip" => _("Your signature")), array("image" => "ed_hr.png", "open" => "\\n----\\n", "close" => "", "sample" => "", "tip" => _("Horizontal line"))); $btn = new SubmitImageButton(_("Save"), "edit[save]", 'toolbar', $WikiTheme->getImageURL("ed_save.png")); $btn->addTooltip(_("Save")); $toolbar .= 'document.writeln("' . addslashes($btn->asXml()) . '");' . "\n"; $btn = new SubmitImageButton(_("Preview"), "edit[preview]", 'toolbar', $WikiTheme->getImageURL("ed_preview.png")); $btn->addTooltip(_("Preview")); $toolbar .= 'document.writeln("' . addslashes($btn->asXml()) . '");' . "\n"; foreach ($toolarray as $tool) { $image = $WikiTheme->getImageURL($tool["image"]); $open = $tool["open"]; $close = $tool["close"]; $sample = addslashes($tool["sample"]); // Note that we use the tip both for the ALT tag and the TITLE tag of the image. // Older browsers show a "speedtip" type message only for ALT. // Ideally these should be different, realistically they // probably don't need to be. $tip = addslashes($tool["tip"]); $toolbar .= "addTagButton('{$image}','{$tip}','{$open}','{$close}','{$sample}');\n"; } $toolbar .= "addInfobox('" . addslashes(_("Click a button to get an example text")) . "');\n"; } if (JS_SEARCHREPLACE) { $undo_d_btn = $WikiTheme->getImageURL("ed_undo_d.png"); //$redo_btn = $WikiTheme->getImageURL("ed_redo.png"); $sr_btn = $WikiTheme->getImageURL("ed_replace.png"); //TODO: generalize the UNDO button and fix it for Search & Replace $sr_html = HTML(HTML::img(array('class' => "toolbar", 'id' => "sr_undo", 'src' => $undo_d_btn, 'title' => _("Undo Search & Replace"), 'alt' => _("Undo Search & Replace"), 'onclick' => "do_undo()")), HTML::img(array('class' => "toolbar", 'src' => $sr_btn, 'alt' => _("Search & Replace"), 'title' => _("Search & Replace"), 'onclick' => "replace()"))); } else { $sr_html = ''; } //TODO: delegate these calculations to a seperate popup/pulldown action request // using moacdropdown and xmlrpc:titleSearch // action=pulldown or xmlrpc/soap (see google: WebServiceProxyFactory.createProxyAsync) // Button to generate categories, display in extra window as popup and insert $sr_html = HTML($sr_html, $this->categoriesPulldown()); // Button to generate plugins, display in extra window as popup and insert $sr_html = HTML($sr_html, $this->pluginPulldown()); // Button to generate pagenames, display in extra window as popup and insert if (TOOLBAR_PAGELINK_PULLDOWN) { $sr_html = HTML($sr_html, $this->pagesPulldown(TOOLBAR_PAGELINK_PULLDOWN)); } // Button to insert from an template, display pagename in extra window as popup and insert if (TOOLBAR_TEMPLATE_PULLDOWN) { $sr_html = HTML($sr_html, $this->templatePulldown(TOOLBAR_TEMPLATE_PULLDOWN)); } // don't use document.write for replace, otherwise self.opener is not defined. $toolbar_end = "document.writeln(\"</div>\");"; if ($sr_html) { return HTML(Javascript($toolbar), "\n", $sr_html, "\n", Javascript($toolbar_end)); } else { return HTML(Javascript($toolbar . $toolbar_end)); } }
function _generate() { global $WikiTheme, $request; $toolbar = "document.writeln(\"<div class=\\\"edit-toolbar\\\" id=\\\"toolbar\\\">\");\n"; if (ENABLE_EDIT_TOOLBAR) { $username = $request->_user->UserName(); if (FUSIONFORGE or DISABLE_MARKUP_WIKIWORD or !isWikiWord($username)) { $username = '******' . $username . ']]'; } $signature = " ––" . $username . " " . CTime(); $toolarray = array(array("image" => "ed_format_bold.png", "open" => "**", "close" => "**", "sample" => _("Bold text"), "title" => _("Bold text [alt-b]")), array("image" => "ed_format_italic.png", "open" => "//", "close" => "//", "sample" => _("Italic text"), "title" => _("Italic text [alt-i]")), array("image" => "ed_format_strike.png", "open" => "<s>", "close" => "</s>", "sample" => _("Strike-through text"), "title" => _("Strike")), array("image" => "ed_format_color.png", "open" => "%color=green% ", "close" => " %%", "sample" => _("Color text"), "title" => _("Color")), array("image" => "ed_pagelink.png", "open" => "[[", "close" => "]]", "sample" => _("PageName|optional label"), "title" => _("Link to page")), array("image" => "ed_link.png", "open" => "[[", "close" => "]]", "sample" => _("http://www.example.com|optional label"), "title" => _("External link (remember http:// prefix)")), array("image" => "ed_headline.png", "open" => "\\n== ", "close" => " ==\\n", "sample" => _("Headline text"), "title" => _("Level 1 headline")), array("image" => "ed_nowiki.png", "open" => "\\<verbatim\\>\\n", "close" => "\\n\\</verbatim\\>", "sample" => _("Insert non-formatted text here"), "title" => _("Ignore wiki formatting")), array("image" => "ed_sig.png", "open" => $signature, "close" => "", "sample" => "", "title" => _("Your signature")), array("image" => "ed_hr.png", "open" => "\\n----\\n", "close" => "", "sample" => "", "title" => _("Horizontal line")), array("image" => "ed_table.png", "open" => "\\n{| class=\"bordered\"\\n|+ This is the table caption\\n|= This is the table summary\\n|-\\n! Header A !! Header B !! Header C\\n|-\\n| Cell A1 || Cell B1 || Cell C1\\n|-\\n| Cell A2 || Cell B2 || Cell C2\\n|-\\n| Cell A3 || Cell B3 || Cell C3\\n|}\\n", "close" => "", "sample" => "", "title" => _("Sample table")), array("image" => "ed_enumlist.png", "open" => "\\n# Item 1\\n# Item 2\\n# Item 3\\n", "close" => "", "sample" => "", "title" => _("Enumeration")), array("image" => "ed_list.png", "open" => "\\n* Item 1\\n* Item 2\\n* Item 3\\n", "close" => "", "sample" => "", "title" => _("List")), array("image" => "ed_toc.png", "open" => "<<CreateToc with_toclink||=1>>\\n", "close" => "", "sample" => "", "title" => _("Table of Contents")), array("image" => "ed_redirect.png", "open" => "<<RedirectTo page=\"", "close" => "\">>", "sample" => _("Page Name"), "title" => _("Redirect")), array("image" => "ed_templateplugin.png", "open" => "{{", "close" => "}}", "sample" => _("Template Name"), "title" => _("Template"))); $btn = new SubmitImageButton(_("Save"), "edit[save]", 'toolbar', $WikiTheme->getImageURL("ed_save.png")); $btn->addTooltip(_("Save")); $btn->setAccesskey("s"); $toolbar .= 'document.writeln("' . addslashes($btn->asXml()) . '");' . "\n"; // preview not supported yet on Wikiblog if (empty($WikiTheme->_headers_printed)) { $btn = new SubmitImageButton(_("Preview"), "edit[preview]", 'toolbar', $WikiTheme->getImageURL("ed_preview.png")); $btn->addTooltip(_("Preview")); $btn->setAccesskey("p"); $toolbar .= 'document.writeln("' . addslashes($btn->asXml()) . '");' . "\n"; } foreach ($toolarray as $tool) { global $WikiTheme; $image = $WikiTheme->getImageURL($tool["image"]); $open = $tool["open"]; $close = $tool["close"]; $sample = addslashes($tool["sample"]); // Note that we use the title both for the ALT tag and the TITLE tag of the image. // Older browsers show a "speedtip" type message only for ALT. // Ideally these should be different, realistically they // probably don't need to be. $tool = $WikiTheme->fixAccesskey($tool); $title = addslashes($tool["title"]); $toolbar .= "addTagButton('{$image}','{$title}','{$open}','{$close}','{$sample}');\n"; } /* Fails with Chrome */ if (!isBrowserSafari()) { $toolbar .= "addInfobox('" . addslashes(_("Click a button to get an example text")) . "');\n"; } } if (JS_SEARCHREPLACE) { $undo_d_btn = $WikiTheme->getImageURL("ed_undo_d.png"); //$redo_btn = $WikiTheme->getImageURL("ed_redo.png"); $sr_btn = $WikiTheme->getImageURL("ed_replace.png"); //TODO: generalize the UNDO button and fix it for Search & Replace $sr_html = HTML(HTML::img(array('class' => "toolbar", 'id' => "sr_undo", 'src' => $undo_d_btn, 'title' => _("Undo Search & Replace"), 'alt' => _("Undo Search & Replace"), 'onclick' => "do_undo()")), HTML::img(array('class' => "toolbar", 'src' => $sr_btn, 'alt' => _("Search & Replace"), 'title' => _("Search & Replace"), 'onclick' => "replace()"))); } else { $sr_html = ''; } //TODO: Delegate this to run-time with showing an hidden input at the right, and do // a seperate moacdropdown and xmlrpc:titleSearch. // Button to generate categories, display in extra window as popup and insert $sr_html = HTML($sr_html, $this->categoriesPulldown()); // Button to generate plugins, display in extra window as popup and insert $sr_html = HTML($sr_html, $this->pluginPulldown()); // Button to generate pagenames, display in extra window as popup and insert if (TOOLBAR_PAGELINK_PULLDOWN) { $sr_html = HTML($sr_html, $this->pagesPulldown(TOOLBAR_PAGELINK_PULLDOWN)); } // Button to insert from an template, display pagename in extra window as popup and insert if (TOOLBAR_TEMPLATE_PULLDOWN) { $sr_html = HTML($sr_html, $this->templatePulldown(TOOLBAR_TEMPLATE_PULLDOWN)); } // Button to add images, display in extra window as popup and insert if (TOOLBAR_IMAGE_PULLDOWN) { $sr_html = HTML($sr_html, $this->imagePulldown(TOOLBAR_IMAGE_PULLDOWN)); } // don't use document.write for replace, otherwise self.opener is not defined. $toolbar_end = "document.writeln(\"</div>\");"; if ($sr_html) { return HTML(Javascript($toolbar), "\n", $sr_html, "\n", Javascript($toolbar_end)); } else { return HTML(Javascript($toolbar . $toolbar_end)); } }