formwysiwygtextarea.php

来自「php 开发的内容管理系统」· PHP 代码 · 共 718 行 · 第 1/3 页

PHP
718
字号
            switch (strtolower($tool)) {
                case "bold":
                    $form .= '<img alt="' . _XK_BOLD . '" title="' . _XK_BOLD . '" src="' . $skinUrl . '/bold.gif" onmousedown="XK_doTextFormat(\'bold\',\'\',\'' . $this->getName() . '\')" />';
                    break;

                case "cellalign":
                    $form .= '<img alt="' . _XK_CELLALIGN . '" title="' . _XK_CELLALIGN . '" src="' . $skinUrl . '/cellalign.gif"/>';
                    $form .= '<img alt="' . _XK_CELLALIGN . '" title="' . _XK_CELLALIGN . '" id="cellpropbutton' . $this->getName() . '" src="' . $skinUrl . '/popup.gif" onclick="XK_useTableDivs(\'' . $this->getName() . '\',\'align\')"/>';
                    $extraDivs .= $this->_renderCellAlign();
                    break;

                case "cellborders":
                    $form .= '<img alt="' . _XK_CELLPROPS . '" title="' . _XK_CELLPROPS . '" src="' . $skinUrl . '/cellborders.gif" onmousedown="XK_TTools(\'' . $this->getName() . '\',\'' . $url . '/dialogs.php?id=' . $this->getName() . '&amp;dialog=cellProps&amp;skin=' . $this->getSkin() . '&amp;url=' . $this->getUrl() . '\',\'table\',400,260)"/>';
                    $form .= '<img alt="' . _XK_CELLALIGN . '" title="' . _XK_CELLALIGN . '" id="cbbutton' . $this->getName() . '" src="' . $skinUrl . '/popup.gif" onclick="XK_useTableDivs(\'' . $this->getName() . '\',\'borders\')"/>';
                    $extraDivs .= $this->_renderCellBorders();
                    break;

                case "cellcolor":
                    $form .= '<img alt="' . _XK_FORECOLOR . '" id="cellcolor' . $this->getName() . '" title="' . _XK_FORECOLOR . '" src="' . $skinUrl . '/cellcolor.gif" onclick="XK_color(\'' . $this->getName() . '\',\'cellcolor\',\'cellcolor\')"/>';
                    $colorPalette = true;
                    break;

                case "code":
                    $form .= '<img alt="' . _XK_CODE . '" title="' . _XK_CODE . '" src="' . $skinUrl . '/code.gif" onmousedown="XK_doTextFormat(\'Code\',\'\',\'' . $this->getName() . '\')"/>';
                    break;

                case "copy":
                    $form .= '<img alt="' . _XK_COPY . '" title="' . _XK_COPY . '" src="' . $skinUrl . '/' . $tool . '.gif" onmousedown="XK_doTextFormat(\'copy\',\'\',\'' . $this->getName() . '\')"/>';
                    break;

                case "createlink":
                    $form .= '<img alt="' . _XK_CREATELINK . '" title="' . _XK_CREATELINK . '" src="' . $skinUrl . '/' . $tool . '.gif" onmousedown="XK_doTextFormat(\'createlink\',\'\',\'' . $this->getName() . '\')"/>';
                    break;

                case "createtable":
                    $form .= '<img alt="' . _XK_INSERTTABLE . '" title="' . _XK_INSERTTABLE . '" src="' . $skinUrl . '/' . $tool . '.gif" onmousedown="XK_openPopup(\'' . $url . '/dialogs.php?id=' . $this->getName() . '&amp;dialog=table&amp;url=' . $this->getUrl() . '\',\'table\',400,290)"/>';
                    $form .= '<img alt="' . _XK_CREATEQUICKTABLE . '" id="tablebutton' . $this->getName() . '" title="' . _XK_CREATEQUICKTABLE . '" src="' . $skinUrl . '/popup.gif" onclick="XK_showHideDiv(\'' . $this->getName() . '\',\'tablebutton\',\'tablepicker\')"/>';
                    $extraDivs .= $this->_renderQuickTable();
                    break;

                case "cut":
                    $form .= '<img alt="' . _XK_CUT . '" title="' . _XK_CUT . '" src="' . $skinUrl . '/' . $tool . '.gif" onmousedown="XK_doTextFormat(\'cut\',\'\',\'' . $this->getName() . '\')"/>';
                    break;

                case "fontname":
                    $form .= '<select id="fontname' . $this->getName() . '" class="' . $this->getSkin() . 'selectInput" onchange="XK_doTextFormat(\'fontname\',this.options[this.selectedIndex].value,\'' . $this->getName() . '\')"><option value="">' . _XK_FONT . '</option>';
                    foreach ($this->getFonts() as $fontname => $font) {
                        $form .= '<option value="' . $font . '">' . $fontname . '</option>';
                    } 
                    $form .= '</select>';

                    break;

                case "fontsize":
                    $form .= '
					<select id="fontsize' . $this->getName() . '" class="' . $this->getSkin() . 'selectInput" onchange="XK_doTextFormat(\'fontsize\',this.options[this.selectedIndex].value,\'' . $this->getName() . '\')"">
						<option value="">' . _XK_FONT_SIZE . '</option>
						<option value="-2">' . _XK_FONT_XSMALL . '</option>
						<option value="-1">' . _XK_FONT_SMALL . '</option>
						<option value="+0">' . _XK_FONT_MEDIUM . '</option>
						<option value="+1">' . _XK_FONT_LARGE . '</option>
						<option value="+2">' . _XK_FONT_XLARGE . '</option>
						<option value="+4">' . _XK_FONT_XXLARGE . '</option>
         			 </select>';
                    break;

                case "forecolor":
                    $form .= '<img  alt="' . _XK_FORECOLOR . '" id="forecolor' . $this->getName() . '" title="' . _XK_FORECOLOR . '" src="' . $skinUrl . '/forecolor.gif" onclick="XK_color(\'' . $this->getName() . '\',\'forecolor\',\'forecolor\')"/>';
                    $colorPalette = true;
                    break;

                case "formatblock":
                    $form .= '	 
          			<select id="formatblock' . $this->getName() . '" class="' . $this->getSkin() . 'selectInput" onchange="XK_doTextFormat(\'formatblock\',this.options[this.selectedIndex].value,\'' . $this->getName() . '\')">
           				<option value="">' . _XK_FONT_FORMAT . '</option>
						<option value="&lt;p&gt;">' . _XK_FONT_NONE . '</option>
           				<option value="&lt;h1&gt;">' . _XK_FONT_HEADING1 . '</option>
           				<option value="&lt;h2&gt;">' . _XK_FONT_HEADING2 . '</option>
           				<option value="&lt;h3&gt;">' . _XK_FONT_HEADING3 . '</option>
						<option value="&lt;h4&gt;">' . _XK_FONT_HEADING4 . '</option>
						<option value="&lt;h5&gt;">' . _XK_FONT_HEADING5 . '</option>
						<option value="&lt;h6&gt;">' . _XK_FONT_HEADING6 . '</option>
						<option value="&lt;p&gt;">' . _XK_FONT_PARAGRAPH . '</option>
						<option value="&lt;pre&gt;">' . _XK_FONT_FORMATTED . '</option>
						<option value="&lt;address&gt;">' . _XK_FONT_ADDRESS . '</option>
					</select>';

                    break;

                case "hilitecolor":
                    $form .= '<img  alt="' . _XK_HILITECOLOR . '" id="hilitecolor' . $this->getName() . '" title="' . _XK_HILITECOLOR . '" src="' . $skinUrl . '/hilitecolor.gif" onclick="XK_color(\'' . $this->getName() . '\',\'hilitecolor\',\'hilitecolor\')"/>';
                    $colorPalette = true;
                    break;

                case "imagemanager":
                    $form .= '<img alt="' . _XK_INSERTIMAGEM . '" title="' . _XK_INSERTIMAGEM . '" onmouseover="style.cursor=\'hand\'" onmousedown="javascript:openWithSelfMain(\'' . XOOPS_URL . '/imagemanager.php?target=' . $this->getName() . '&amp;wysiwyg=1\',\'imgmanager\',400,430);" src="' . $skinUrl . '/imagemanager.gif"/>';
                    break;

                case "imageproperties":
                    $form .= '<img alt="' . _XK_EDITIMAGE . '" title="' . _XK_EDITIMAGE . '" src="' . $skinUrl . '/imageprops.gif" onmousedown="XK_openPopup(\'' . $url . '/dialogs.php?id=' . $this->getName() . '&amp;dialog=imageProps&amp;url=' . $this->getUrl() . '&amp;skin=' . $this->getSkin() . '\',\'table\',400,260)"/>';
                    break;

                case "indent":
                    $form .= '<img alt="' . _XK_INDENT . '" title="' . _XK_INDENT . '" src="' . $skinUrl . '/' . $tool . '.gif" onmousedown="XK_doTextFormat(\'indent\',\'\',\'' . $this->getName() . '\')"/>';
                    break;

                case "inserthorizontalrule":
                    $form .= '<img alt="' . _XK_INSERTHORIZONTALRULE . '" title="' . _XK_INSERTHORIZONTALRULE . '" src="' . $skinUrl . '/' . $tool . '.gif" onmousedown="XK_doTextFormat(\'inserthorizontalrule\',\'\',\'' . $this->getName() . '\')"/>';
                    break;

                case 'insertanchor':
                    $form .= '<img alt="' . _XK_INSERTANCHOR . '" title="' . _XK_INSERTANCHOR . '" src="' . $skinUrl . '/insertanchor.gif" onmousedown="XK_insertAnchor(\'' . $this->getName() . '\')"/>';
                    break;

                case "insertdate":
                    $form .= '<img alt="' . _XK_INSERTDATE . '" title="' . _XK_INSERTDATE . '"  src="' . $skinUrl . '/insertdate.gif" onmousedown="XK_insertDate(\'' . $this->getName() . '\')"/>';
                    break;

                case "insertimage":
                    $form .= '<img alt="' . _XK_INSERTIMAGE . '" title="' . _XK_INSERTIMAGE . '" src="' . $skinUrl . '/insertimage.gif" onmousedown="XK_doTextFormat(\'insertimage\',\'\',\'' . $this->getName() . '\')"/>';
                    break;

                case "insertorderedlist":
                    $form .= '<img alt="' . _XK_INSERTORDEREDLIST . '" title="' . _XK_INSERTORDEREDLIST . '" src="' . $skinUrl . '/' . $tool . '.gif" onmousedown="XK_doTextFormat(\'insertorderedlist\',\'\',\'' . $this->getName() . '\')"/>';
                    break;

                case "insertunorderedlist":
                    $form .= '<img alt="' . _XK_INSERTUNORDEREDLIST . '" title="' . _XK_INSERTUNORDEREDLIST . '" src="' . $skinUrl . '/' . $tool . '.gif" onmousedown="XK_doTextFormat(\'insertunorderedlist\',\'\',\'' . $this->getName() . '\')"/>';
                    break;

                case "insertsymbols":
                    $form .= $this->_renderInsertSymbols();
                    break;

                case "italic":
                    $form .= '<img alt="' . _XK_ITALIC . '" title="' . _XK_ITALIC . '" src="' . $skinUrl . '/italic.gif" onmousedown="XK_doTextFormat(\'italic\',\'\',\'' . $this->getName() . '\')"/>';
                    break;

                case "justifycenter":
                    $form .= '<img alt="' . _XK_JUSTIFYCENTER . '" title="' . _XK_JUSTIFYCENTER . '" src="' . $skinUrl . '/justifycenter.gif" onmousedown="XK_doTextFormat(\'justifycenter\',\'\',\'' . $this->getName() . '\')"/>';
                    break;

                case "justifyfull":
                    $form .= '<img alt="' . _XK_JUSTIFYFULL . '" title="' . _XK_JUSTIFYFULL . '" src="' . $skinUrl . '/justifyfull.gif" onmousedown="XK_doTextFormat(\'justifyfull\',\'\',\'' . $this->getName() . '\')"/>';
                    break;

                case "justifyleft":
                    $form .= '<img alt="' . _XK_JUSTIFYLEFT . '" title="' . _XK_JUSTIFYLEFT . '" src="' . $skinUrl . '/justifyleft.gif" onmousedown="XK_doTextFormat(\'justifyleft\',\'\',\'' . $this->getName() . '\')"/>';
                    break;

                case "justifyright":
                    $form .= '<img alt="' . _XK_JUSTIFYRIGHT . '" title="' . _XK_JUSTIFYRIGHT . '" src="' . $skinUrl . '/justifyright.gif" onmousedown="XK_doTextFormat(\'justifyright\',\'\',\'' . $this->getName() . '\')"/>';
                    break;

                case "ltr":
                    $form .= '<img alt="' . _XK_LEFTTORIGHT . '" title="' . _XK_LEFTTORIGHT . '" src="' . $skinUrl . '/ltr.gif" onmousedown="XK_textDirection(\'ltr\',\'' . $this->getName() . '\')"/>';
                    break;

                case "newline":
                    $form .= '<br />';
                    break;

                case 'newparagraph':
                    if ($isie)$form .= '<input class="' . $this->getSkin() . 'checkbox" type="checkbox" alt="' . _XK_NEWPARAGRAPH . '" title="' . _XK_NEWPARAGRAPH . '" id="ptagenabled' . $this->getName() . '" onclick="XK_destroyPTag(\'' . $this->getName() . '\')">';
                    break;

                case "outdent":
                    $form .= '<img alt="' . _XK_OUTDENT . '" title="' . _XK_OUTDENT . '" src="' . $skinUrl . '/' . $tool . '.gif" onmousedown="XK_doTextFormat(\'outdent\',\'\',\'' . $this->getName() . '\')"/>';
                    break;

                case "paste":
                    $form .= '<img alt="' . _XK_PASTE . '" title="' . _XK_PASTE . '" src="' . $skinUrl . '/' . $tool . '.gif" onmousedown="XK_doTextFormat(\'paste\',null,\'' . $this->getName() . '\')"/>';
                    break;

                case "pastespecial":
                    $form .= '<img alt="' . _XK_PASTESPECIAL . '" title="' . _XK_PASTESPECIAL . '" src="' . $skinUrl . '/' . $tool . '.gif" onmousedown="document.getElementById(\'iframe' . $this->getName() . '\').contentWindow.focus();openWithSelfMain(\'' . $url . '/dialogs.php?id=' . $this->getName() . '&amp;skin=' . $this->getSkin() . '&amp;dialog=pastespecial&amp;url=' . $this->getUrl() . '\',\'pastespecial\',350,280);"/>';
                    break;

                case 'print':
                    $form .= '<img alt="' . _XK_PRINT . '" title="' . _XK_PRINT . '" src="' . $skinUrl . '/print.gif" onmousedown="XK_print(\'' . $this->getName() . '\')"/>';
                    break;

                case "quote":
                    $form .= '<img alt="' . _XK_QUOTE . '" title="' . _XK_QUOTE . '" src="' . $skinUrl . '/quote.gif" onmousedown="XK_doTextFormat(\'Quote\',\'\',\'' . $this->getName() . '\')"/>';
                    break;

                case "redo":
                    $form .= '<img alt="' . _XK_REDO . '" title="' . _XK_REDO . '" src="' . $skinUrl . '/' . $tool . '.gif" onmousedown="XK_doTextFormat(\'redo\',\'\',\'' . $this->getName() . '\')"/>';
                    break;

                case "rtl":
                    $form .= '<img alt="' . _XK_RIGHTTOLEFT . '" title="' . _XK_RIGHTTOLEFT . '" src="' . $skinUrl . '/rtl.gif" onmousedown="XK_textDirection(\'rtl\',\'' . $this->getName() . '\')"/>';
                    break;

                case "separator":
                    $form .= '<img alt="|" src="' . $skinUrl . '/separator.gif"/>';
                    break;

                case 'spellcheck':
                    $form .= '<img alt="' . _XK_SPELLCHECK . '" title="' . _XK_SPELLCHECK . '" src="' . $skinUrl . '/spellcheck.gif" onmousedown="XK_checkspell()"/>';
                    break;

                case "strikethrough":
                    $form .= '<img alt="' . _XK_STRIKETHROUGH . '" title="' . _XK_STRIKETHROUGH . '" src="' . $skinUrl . '/strikethrough.gif" onmousedown="XK_doTextFormat(\'strikethrough\',\'\',\'' . $this->getName() . '\')"/>';
                    break;

                case "subscript":
                    $form .= '<img alt="' . _XK_SUBSCRIPT . '" title="' . _XK_SUBSCRIPT . '" src="' . $skinUrl . '/' . $tool . '.gif" onmousedown="XK_doTextFormat(\'subscript\',\'\',\'' . $this->getName() . '\')"/>';
                    break;

                case "superscript":
                    $form .= '<img alt="' . _XK_SUPERSCRIPT . '" title="' . _XK_SUPERSCRIPT . '" src="' . $skinUrl . '/' . $tool . '.gif" onmousedown="XK_doTextFormat(\'superscript\',\'\',\'' . $this->getName() . '\')"/>';
                    break;

                case "removeformat":
                    $form .= '<img alt="' . _XK_REMOVEFORMAT . '" title="' . _XK_REMOVEFORMAT . '" src="' . $skinUrl . '/' . $tool . '.gif" onmousedown="XK_doTextFormat(\'removeformat\',\'\',\'' . $this->getName() . '\')"/>';
                    $form .= '<img alt="' . _XK_REMOVE_DESC . '" title="' . _XK_REMOVE_DESC . '" id="rformatbutton' . $this->getName() . '" src="' . $skinUrl . '/popup.gif" onclick="XK_showHideDiv(\'' . $this->getName() . '\',\'rformatbutton\',\'RemoveFormat\')"/>';
                    $extraDivs .= $this->_renderCleanFormats();
                    break;

                case "themecss":
                    $themeCss = true;
                    break;

                case "tableprops":
                    $form .= '<img alt="' . _XK_TABLEPROPS . '" title="' . _XK_TABLEPROPS . '" src="' . $skinUrl . '/tableprops.gif" onmousedown="XK_TTools(\'' . $this->getName() . '\',\'' . $url . '/dialogs.php?id=' . $this->getName() . '&amp;dialog=tableProps&amp;skin=' . $this->getSkin() . '&amp;url=' . $this->getUrl() . '\',\'table\',400,260)"/>';
                    $form .= '<img alt="' . _XK_TABLETOOLS . '" title="' . _XK_TABLETOOLS . '" id="tpropbutton' . $this->getName() . '" src="' . $skinUrl . '/popup.gif" onclick="XK_useTableOps(\'TableOps\',\'' . $this->getName() . '\')"/>';
                    $extraDivs .= $this->_renderTableProps();
                    break;

                case "toggleborders":
                    $form .= '<img alt="' . _XK_TABLEBORDERS_TOGGLE . '" title="' . _XK_TABLEBORDERS_TOGGLE . '" src="' . $skinUrl . '/toggletableborders.gif" onmousedown="XK_toggleBorders(\'' . $this->getName() . '\',\'document.body\')"/>';
                    break;

                case "togglemode":
                    $toggleMode = true;
                    break;

                case "underline":
                    $form .= '<img alt="' . _XK_UNDERLINE . '" title="' . _XK_UNDERLINE . '" src="' . $skinUrl . '/underline.gif" onmousedown="XK_doTextFormat(\'underline\',\'\',\'' . $this->getName() . '\')"/>';

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?