Ignore:
Timestamp:
08/06/07 08:53:24 (17 years ago)
Author:
niltonneto
Message:

Implementação do FCKEDITOR na edição de artigos no news_admin, para permitir texto rico.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/news_admin/inc/class.uinews.inc.php

    r2 r45  
    1313        \**************************************************************************/ 
    1414 
     15        /* $Id$ */ 
    1516 
    1617        class uinews 
     
    278279                        if($_POST['submitit']) 
    279280                        { 
     281                                $_POST['news']['is_html'] = '1'; 
    280282                                $this->news_data = $_POST['news']; 
    281283                                if(!$this->news_data['subject']) 
    282284                                { 
    283                                         $errors[] = lang('The subject is missing'); 
     285                                        $errors[] = lang('The subject is missing.'); 
    284286                                } 
    285287                                if(!$this->news_data['content']) 
    286288                                { 
    287                                         $errors[] = lang('The news content is missing'); 
     289                                        $errors[] = lang('The news content is missing.'); 
    288290                                } 
    289291                                if(!is_array($errors)) 
    290292                                { 
    291293                                        $this->news_data['date'] = time(); 
    292                                         $this->news_data['content'] = @htmlentities($this->news_data['content']); 
     294                                         
    293295                                        $this->bo->set_dates($_POST['from'],$_POST['until'],$this->news_data); 
    294296                                        $this->news_id = $this->bo->add($this->news_data); 
     
    383385                                if(!is_array($errors)) 
    384386                                { 
    385                                         $this->news_data['content'] = @htmlentities($this->news_data['content']); 
    386387                                        $this->bo->set_dates($_POST['from'],$_POST['until'],$this->news_data); 
    387388                                        $this->bo->edit($this->news_data); 
     
    405406                function modify($type = 'edit') 
    406407                { 
     408                        include_once("fckeditor.php"); 
     409                         
    407410                        $options = $this->bo->get_options($this->news_data); 
    408411                        $GLOBALS['phpgw']->common->phpgw_header(); 
     
    423426 
    424427                        $category_list = $this->selectlist('write', (int)$this->news_data['category']); 
     428                         
     429                        if ($category_list == '') 
     430                                $this->deny(); 
    425431 
    426432                        $this->template->set_var('lang_header',lang($type . ' news item')); 
     
    431437                                ) 
    432438                        ); 
     439                         
     440                        $oFCKeditor = new FCKeditor('news[content]') ; 
     441                        $oFCKeditor->BasePath = 'news_admin/templates/celepar/fckeditor/'; 
     442                        $oFCKeditor->ToolbarSet = 'ExpressoLivre'; 
     443                        $oFCKeditor->Value = $this->news_data['content']; 
     444                         
    433445                        $this->template->set_var(array( 
    434446                                'form_button' => '<input type="submit" name="submitit" value="' . lang('save') . '">', 
     
    436448                                'done_button' => '<input type="submit" name="cancel" value="' . lang('Done') . '">', 
    437449                                'label_subject' => lang('subject') . ':', 
    438                                 'value_subject' => '<input name="news[subject]" size="60" value="' . @htmlspecialchars($this->news_data['subject'],ENT_COMPAT,$GLOBALS['phpgw']->translation->charset()) . '">', 
     450                                'value_subject' => '<input name="news[subject]" autocomplete="off" size="60" value="' . @htmlspecialchars($this->news_data['subject'],ENT_COMPAT,$GLOBALS['phpgw']->translation->charset()) . '">', 
    439451                                'label_teaser' => lang('teaser') . ':', 
    440                                 'value_teaser' => '<input name="news[teaser]" size="60" value="' . @htmlspecialchars($this->news_data['teaser'],ENT_COMPAT,$GLOBALS['phpgw']->translation->charset()) . '" maxLength="100">', 
     452                                'value_teaser' => '<input name="news[teaser]" autocomplete="off" size="60" value="' . @htmlspecialchars($this->news_data['teaser'],ENT_COMPAT,$GLOBALS['phpgw']->translation->charset()) . '" maxLength="100">', 
    441453                                'label_content' => lang('Content') . ':', 
    442                                 'value_content' => '<textarea cols="60" rows="6" name="news[content]" wrap="virtual">' . $this->news_data['content'] . '</textarea>', 
     454                                //'value_content' => '<textarea cols="60" rows="6" name="news[content]" wrap="virtual">' . $this->news_data['content'] . '</textarea>', 
     455                                'value_content' => $oFCKeditor->Create(), 
    443456                                'label_category' => lang('Category') . ':', 
    444457                                'value_category' => '<select name="news[category]">' . $this->selectlist('write', (int)$this->news_data['category']) . '</select>', 
     
    453466                                'value_end_y' =>  $this->sbox->getYears('news[end_y]',date('Y',$this->news_data['end']),date('Y')), 
    454467                                'label_is_html' => lang('Contains HTML'), 
    455                                 'value_is_html' => '<input type="checkbox" value="1" name="news[is_html]"' . ($this->news_data['is_html'] ? ' checked="1"' : '') .'>', 
     468                                'value_is_html' => '<input type="checkbox" value="1" name="news[is_html]  checked="1""' . ($this->news_data['is_html'] ? ' checked="1"' : '') .'>', 
    456469                        )); 
    457470                         
     
    470483                        $GLOBALS['phpgw']->common->phpgw_header(); 
    471484                        echo parse_navbar(); 
     485 
     486                        $category_list = $this->selectlist('write', (int)$this->news_data['category']); 
     487                        if ($category_list == '') 
     488                                $this->deny(); 
     489 
    472490                        $this->template->set_block('main','category'); 
    473491                        $var['lang_read'] = lang('Read'); 
     
    536554                        $this->template->pfp('out','list'); 
    537555                } 
     556                 
     557                function deny() 
     558                { 
     559                        echo '<p><center><b>'.lang('Access not permitted').'</b></center>'; 
     560                        $GLOBALS['phpgw']->common->phpgw_exit(True); 
     561                } 
     562 
    538563        } 
    539564?> 
Note: See TracChangeset for help on using the changeset viewer.