toolbars['admin_toolbar'] = " [ ['Source','-','Preview'], ['Cut','Copy','Paste','PasteText','PasteWord'], ['Undo','Redo','-','Replace','-','SelectAll','RemoveFormat'], ['FitWindow','-','About'], ['Bold','Italic','Underline','StrikeThrough','-','Subscript','Superscript'], ['OrderedList','UnorderedList','-','Outdent','Indent','Blockquote'], ['JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'], ['Link','Unlink','Anchor'], ['Image','Flash','Rule','Smiley','SpecialChar'], ['Style','FontFormat','FontName','FontSize'], ]"; $this -> toolbars['basic_toolbar'] =$this -> toolbars['user_toolbar'] = "[ ['Preview','FitWindow'], ['Cut','Copy','Paste','PasteWord','Undo','Redo'], ['Image','Link','Unlink'], ['JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'], ['Bold','Italic','Underline','StrikeThrough',], ['OrderedList','UnorderedList','-','Outdent','Indent','Blockquote'], ]"; $this -> toolbars['design_toolbar'] ="[ ['Preview','FitWindow'], ['Cut','Copy','Paste','PasteWord','Undo','Redo'], ['Link','Unlink'], ['JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'], ['Bold','Italic','Underline','StrikeThrough',], ['OrderedList','UnorderedList','-','Outdent','Indent','Blockquote'], ]"; // àäìèíèñòðàòîðó íóæíî äàòü ðàñøèðåííûé íàáîð ôóíêöèé ðåäàêòîðà $c = $MAIN_USER -> is_admin() ? 'admin_toolbar' : 'user_toolbar'; $this -> set_toolbar($c); // íåêîòîðûå ñòàíäàðòíûå ïåðååííûå /*$this -> vars['AutoDetectLanguage'] = false; $this -> vars['DefaultLanguage'] = 'ru'; $this -> vars['theme'] = 'default'; $this -> vars['skin'] = 'v2'; $this -> vars['filebrowserImageUploadUrl'] = '/robots.txt'; $this -> vars['filebrowserUploadUrl'] = '/robots.txt';*/ // ñòàíäàðòíûå àòðèáóòû //$this -> set_attr("rows", 8); //$this -> set_attr("cols", 60); } // óñòàíàâëèâàåì name ðåäàêòîðà public function set_name($v){ if ( empty($v) ){ $this -> make_error(ERROR_500,"1024: bad name '$v' for editor"); } $this -> name = $v; return true; } // óñòàíàâëèàåì ïåðâîí÷àëüíîå ñîäåðæèìîå ðåäàêòîðà public function set_value($v){ $this -> value = $v; return true; } // óñòàíàâëèâàåì àòðèáóòû public function set_attr($k,$v){ if ( empty($k) ){ $this -> make_error(ERROR_500,'1024: empty attr '); } $this -> attr[$k] = $v; return true; } public function set_toolbar($v){ if ( empty($v) ){ $this -> make_error(ERROR_500,'1024: empty toolbar '); } if ( empty($this -> toolbars[$v]) ){ $this -> make_error(ERROR_500,'1024: no toolbar '.$v); } $this -> toolbar = $v; return true; } // âîçâðàùàåì êîä ðåäàêòîðà public function show(){ if ( empty($this -> name) ){ $this -> make_error(ERROR_500,"1024: empty name for editor"); } //$this -> set_attr("id", $this -> name); /*$config = '"toolbar":'.$this ->toolbars[$this -> toolbar].","; foreach($this -> vars as $k=>$v ){ $config.= '"'.$k.'": "'.$v.'",'; }*/ $text = str_replace('{MAIN_SOURCE_URL}',MAIN_SOURCE_URL,SCRIPT_TMPL); //$text = str_replace('{config}','{'.$config.'}',$text); return $text; } private function make_error($type,$msg){ $info = debug_backtrace(); $line = $info[1]['line']; $file = $info[1]['file']; switch($type){ case(ERROR_500): sys_error(ERROR_500,$msg,$file,$line); break; } return true; } } define('SCRIPT_TMPL', <<// SCRIPT_TMPL ); ?>