コード例 #1
0
ファイル: DhtmlTextArea.php プロジェクト: ming-hai/XoopsCore
 /**
  * fontArray
  *
  * @return string
  */
 public function fontArray()
 {
     $textarea_id = $this->getName();
     $hiddentext = $this->hiddenText;
     $fontStr = "<script type=\"text/javascript\" language=\"JavaScript\">";
     $fontStr .= "var _editor_dialog = ''" . "+ '<select class=\"span2\" id=\\'{$textarea_id}Size\\' onchange=\\'xoopsSetElementAttribute(\"size\", this.options[this.selectedIndex].value, \"{$textarea_id}\", \"{$hiddentext}\");\\'>'";
     $fontStr .= "+ '<option value=\\'SIZE\\'>" . \XoopsLocale::SIZE . "</option>'";
     $localeFontSizes = \XoopsLocale::getFontSizes();
     foreach ($localeFontSizes as $_val => $_name) {
         $fontStr .= " + '<option value=\\'{$_val}\\'>{$_name}</option>'";
     }
     $fontStr .= " + '</select> '";
     $fontStr .= "+ '<select class=\"span2\" id=\\'{$textarea_id}Font\\' onchange=\\'xoopsSetElementAttribute(\"font\", this.options[this.selectedIndex].value, \"{$textarea_id}\", \"{$hiddentext}\");\\'>'";
     $fontStr .= "+ '<option value=\\'FONT\\'>" . \XoopsLocale::FONT . "</option>'";
     $localeFonts = \XoopsLocale::getFonts();
     $fontarray = !empty($localeFonts) ? $localeFonts : array("Arial", "Courier", "Georgia", "Helvetica", "Impact", "Verdana", "Haettenschweiler");
     foreach ($fontarray as $font) {
         $fontStr .= " + '<option value=\\'{$font}\\'>{$font}</option>'";
     }
     $fontStr .= " + '</select> '";
     $fontStr .= "+ '<select class=\"span2\" id=\\'{$textarea_id}Color\\' onchange=\\'xoopsSetElementAttribute(\"color\", this.options[this.selectedIndex].value, \"{$textarea_id}\", \"{$hiddentext}\");\\'>'";
     $fontStr .= "+ '<option value=\\'COLOR\\'>" . \XoopsLocale::COLOR . "</option>';";
     $fontStr .= "var _color_array = new Array('00', '33', '66', '99', 'CC', 'FF');\n            for(var i = 0; i < _color_array.length; i ++) {\n                for(var j = 0; j < _color_array.length; j ++) {\n                    for(var k = 0; k < _color_array.length; k ++) {\n                        var _color_ele = _color_array[i] + _color_array[j] + _color_array[k];\n                        _editor_dialog += '<option value=\\''+_color_ele+'\\' style=\\'background-color:#'+_color_ele+';color:#'+_color_ele+';\\'>#'+_color_ele+'</option>';\n                    }\n                }\n            }\n            _editor_dialog += '</select>';";
     $fontStr .= "document.write(_editor_dialog); </script>";
     $styleStr = "<img src='" . \XoopsBaseConfig::get('url') . "/images/bold.gif' alt='" . \XoopsLocale::BOLD . "' title='" . \XoopsLocale::BOLD . "' onmouseover='style.cursor=\"hand\"' onclick='xoopsMakeBold(\"{$hiddentext}\", \"{$textarea_id}\");' />&nbsp;";
     $styleStr .= "<img src='" . \XoopsBaseConfig::get('url') . "/images/italic.gif' alt='" . \XoopsLocale::ITALIC . "' title='" . \XoopsLocale::ITALIC . "' onmouseover='style.cursor=\"hand\"' onclick='xoopsMakeItalic(\"{$hiddentext}\", \"{$textarea_id}\");' />&nbsp;";
     $styleStr .= "<img src='" . \XoopsBaseConfig::get('url') . "/images/underline.gif' alt='" . \XoopsLocale::UNDERLINE . "' title='" . \XoopsLocale::UNDERLINE . "' onmouseover='style.cursor=\"hand\"' onclick='xoopsMakeUnderline(\"{$hiddentext}\", \"{$textarea_id}\");'/>&nbsp;";
     $styleStr .= "<img src='" . \XoopsBaseConfig::get('url') . "/images/linethrough.gif' alt='" . \XoopsLocale::LINE_THROUGH . "' title='" . \XoopsLocale::LINE_THROUGH . "' onmouseover='style.cursor=\"hand\"' onclick='xoopsMakeLineThrough(\"{$hiddentext}\", \"{$textarea_id}\");' />&nbsp;";
     $alignStr = "<img src='" . \XoopsBaseConfig::get('url') . "/images/alignleft.gif' alt='" . \XoopsLocale::LEFT . "' title='" . \XoopsLocale::LEFT . "' onmouseover='style.cursor=\"hand\"' onclick='xoopsMakeLeft(\"{$hiddentext}\", \"{$textarea_id}\");' />&nbsp;";
     $alignStr .= "<img src='" . \XoopsBaseConfig::get('url') . "/images/aligncenter.gif' alt='" . \XoopsLocale::CENTER . "' title='" . \XoopsLocale::CENTER . "' onmouseover='style.cursor=\"hand\"' onclick='xoopsMakeCenter(\"{$hiddentext}\", \"{$textarea_id}\");' />&nbsp;";
     $alignStr .= "<img src='" . \XoopsBaseConfig::get('url') . "/images/alignright.gif' alt='" . \XoopsLocale::RIGHT . "' title='" . \XoopsLocale::RIGHT . "' onmouseover='style.cursor=\"hand\"' onclick='xoopsMakeRight(\"{$hiddentext}\", \"{$textarea_id}\");' />&nbsp;";
     $fontStr = $fontStr . "<br />\n{$styleStr}&nbsp;{$alignStr}&nbsp;\n";
     return $fontStr;
 }