diff --git a/forms/HtmlEditorField.php b/forms/HtmlEditorField.php index ac1e161f0..a4ff16a13 100755 --- a/forms/HtmlEditorField.php +++ b/forms/HtmlEditorField.php @@ -279,82 +279,6 @@ class HtmlEditorField_Toolbar extends RequestHandler { $this->name = $name; } - function Buttons() { - return new DataObjectSet( - new HtmlEditorField_button("Bold","bold",_t('HtmlEditorField.BUTTONBOLD', "Bold (Ctrl+B)")), - new HtmlEditorField_button("Italic","italic",_t('HtmlEditorField.BUTTONITALIC', "Italic (Ctrl+I)")), - new HtmlEditorField_button("Underline","underline", _t('HtmlEditorField.BUTTONUNDERLINE', "Underline (Ctrl+U)")), - new HtmlEditorField_button("Strikethrough","strikethrough", _t('HtmlEditorField.BUTTONSTRIKE', "strikethrough")), - new HtmlEditorField_separator(), - new HtmlEditorField_button("JustifyLeft","justifyleft", _t('HtmlEditorField.BUTTONALIGNLEFT', "Align left")), - new HtmlEditorField_button("JustifyCenter","justifycenter", _t('HtmlEditorField.BUTTONALIGNCENTER', "Align center")), - new HtmlEditorField_button("JustifyRight","justifyright",_t('HtmlEditorField.BUTTONALIGNRIGHT',"Align right")), - new HtmlEditorField_button("JustifyFull","justifyfull",_t('HtmlEditorField.BUTTONALIGNJUSTIFY',"Justify")), - - /*new HtmlEditorField_dropdown("mceSetCSSClass", "styleSelect", array( - "mceContentBody" => "mceContentBody", - )),*/ - new HtmlEditorField_dropdown("FormatBlock", "formatSelect", array( - "
" => _t('HtmlEditorField.FORMATP', "Paragraph", PR_MEDIUM, '
tag'), - "
" => _t('HtmlEditorField.FORMATPRE', "Preformatted", PR_MEDIUM, 'tag'), - )), - new HtmlEditorField_separator(), - new HtmlEditorField_button("InsertUnorderedList","bullist",_t('HtmlEditorField.BULLETLIST', "Bullet-point list")), - new HtmlEditorField_button("InsertOrderedList","numlist",_t('HtmlEditorField.OL', "Numbered list")), - new HtmlEditorField_button("Outdent","outdent",_t('HtmlEditorField.OUTDENT', "Decrease outdent")), - new HtmlEditorField_button("Indent","indent",_t('HtmlEditorField.INDENT', "Increase indent")), - new HtmlEditorField_button("inserthorizontalrule","hr",_t('HtmlEditorField.HR', "Insert horizontal line")), - new HtmlEditorField_button("mceCharMap","charmap",_t('HtmlEditorField.CHARMAP', "Insert symbol")), - - new HtmlEditorField_break(), - - new HtmlEditorField_button("Undo","undo",_t('HtmlEditorField.UNDO', "Undo (Ctrl+Z)")), - new HtmlEditorField_button("Redo","redo",_t('HtmlEditorField.REDO', "Redo (Ctrl+Y)")), - new HtmlEditorField_separator(), - new HtmlEditorField_button("Cut","cut",_t('HtmlEditorField.CUT', "Cut (Ctrl+X)")), - new HtmlEditorField_button("Copy","copy",_t('HtmlEditorField.COPY', "Copy (Ctrl+C)")), - new HtmlEditorField_button("Paste","paste",_t('HtmlEditorField.PASTE', "Paste (Ctrl+V)")), - new HtmlEditorField_button("mcePasteText","paste:pastetext",_t('HtmlEditorField.PASTETEXT', "Paste plain text")), - new HtmlEditorField_button("mcePasteWord","paste:pasteword",_t('HtmlEditorField.PASTEWORD', "Paste from Word")), - new HtmlEditorField_button("mceSelectAll","paste:selectall",_t('HtmlEditorField.SELECTALL', "Select All (Ctrl+A)")), - new HtmlEditorField_separator(), - - new HtmlEditorField_button("ssImage","image",_t('HtmlEditorField.IMAGE', "Insert image")), - new HtmlEditorField_button("ssFlash","flash:flash",_t('HtmlEditorField.FLASH', "Insert flash")), - - new HtmlEditorField_button("ssLink","link",_t('HtmlEditorField.LINK', "Insert/edit link for highlighted text")), - new HtmlEditorField_button("unlink","unlink",_t('HtmlEditorField.UNLINK', "Remove link")), - new HtmlEditorField_button("mceInsertAnchor","anchor",_t('HtmlEditorField.ANCHOR', "Insert/edit anchor")), - new HtmlEditorField_separator(), - - new HtmlEditorField_button("mceCodeEditor","code",_t('HtmlEditorField.EDITCODE', "Edit HTML Code")), - - // We don't need this because tinymce is good at auto-tidying - // new HtmlEditorField_button("mceCleanup","cleanup","Clean up code"), - - - new HtmlEditorField_button("mceToggleVisualAid","visualaid",_t('HtmlEditorField.VISUALAID', "Show/hide guidelines")), - - new HtmlEditorField_separator(), - - new HtmlEditorField_button("mceInsertTable","table:table",_t('HtmlEditorField.INSERTTABLE', "Insert table")), - new HtmlEditorField_button("mceTableInsertRowBefore","table:table_insert_row_before",_t('HtmlEditorField.INSERTROWBEF', "Insert row before")), - new HtmlEditorField_button("mceTableInsertRowAfter","table:table_insert_row_after",_t('HtmlEditorField.INSERTROWAFTER', "Insert row after")), - new HtmlEditorField_button("mceTableDeleteRow","table:table_delete_row",_t('HtmlEditorField.DELETEROW', "Delete row")), - new HtmlEditorField_button("mceTableInsertColBefore","table:table_insert_col_before",_t('HtmlEditorField.INSERTCOLBEF', "Insert column before")), - new HtmlEditorField_button("mceTableInsertColAfter","table:table_insert_col_after",_t('HtmlEditorField.INSERTCOLAFTER', "Insert column after")), - new HtmlEditorField_button("mceTableDeleteCol","table:table_delete_col",_t('HtmlEditorField.DELETECOL', "Delete column")) - - ); - } - /** * Return a {@link Form} instance allowing a user to * add links in the TinyMCE content editor. @@ -492,102 +416,3 @@ class HtmlEditorField_Toolbar extends RequestHandler { } } - -/** - * Base class for HTML editor toolbar buttons. - * These controls are used when manually constructing a toolbar, as we do in the CMS. - * @package forms - * @subpackage fields-formattedinput - */ -class HtmlEditorField_control extends ViewableData { - protected $command; - - function Type() { return substr($this->class,strrpos($this->class,'_')+1); } - function Command() { return $this->command; } - - function MceRoot() { - return MCE_ROOT; - } -} - -/** - * Button on the HTML edityor toolbar. - * @package forms - * @subpackage fields-formattedinput - */ -class HtmlEditorField_button extends HtmlEditorField_control { - function __construct($command, $icon, $title = null) { - $this->title = $title ? $title : $command; - $this->command = $command; - $this->icon = $icon; - parent::__construct(); - } - function Command() { - return $this->command; - } - function Icon() { - if(strpos($this->icon,'/') !== false) { - return $this->icon; - - } else if(strpos($this->icon,':') !== false) { - list($plugin,$icon) = explode(':', $this->icon, 2); - return MCE_ROOT . 'plugins/' . $plugin . '/images/' . $icon . '.gif'; - - } else { - return MCE_ROOT . 'themes/advanced/images/' . $this->icon . '.gif'; - } - } - function Title() { - return $this->title; - } - function IDSegment() { - return $this->icon; - } -} - -/** - * Separator on the HTML edityor toolbar. - * @package forms - * @subpackage fields-formattedinput - */ -class HtmlEditorField_separator extends HtmlEditorField_control { -} - -/** - * Dropdown field on the HTML editor toolbar. - * @package forms - * @subpackage fields-formattedinput - */ -class HtmlEditorField_dropdown extends HtmlEditorField_control { - protected $options, $idSegment; - - function __construct($command, $idSegment, $options) { - $this->command = $command; - $this->options = $options; - $this->idSegment = $idSegment; - parent::__construct(); - } - - function Options() { - $options = ''; - foreach($this->options as $k => $v) { - $k = Convert::raw2att($k); - $v = Convert::raw2xml($v); - $options .= "\n"; - } - return $options; - } - function IDSegment() { - return $this->idSegment; - } -} - -/** - * Line break on the HTML editor toolbar. - * @package forms - * @subpackage fields-formattedinput - */ -class HtmlEditorField_break extends HtmlEditorField_control { -} - -?>