Changeset 2876


Ignore:
Timestamp:
05/28/10 09:36:15 (14 years ago)
Author:
rodsouza
Message:

Ticket #663 - Atualizando o ckeditor do módulo admin.

Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/inc/class.uiconfig.inc.php

    r2866 r2876  
    185185                         
    186186                        if($appname=="admin") {                                                  
    187                                 /* 
    188                                  * FCK editor to agree term 
    189                                  */ 
    190                                 include_once("news_admin/inc/fckeditor.php"); 
    191                                 $oFCKeditor = new FCKeditor('newsettings[agree_term]');//CreateObject('news_admin.fckeditor','newsettings[agree_term]'); 
    192  
    193                                 $webserver_url = $GLOBALS['phpgw_info']['server']['webserver_url']; 
    194                                 $webserver_url = ( !empty($webserver_url) ) ? $webserver_url : '/'; 
    195  
    196                                 if(strrpos($webserver_url,'/') === false || strrpos($webserver_url,'/') != (strlen($webserver_url)-1)) 
    197                                         $webserver_url .= '/'; 
    198  
    199                                 $oFCKeditor->BasePath = $webserver_url . 'news_admin/templates/default/fckeditor/';  
    200                                 $oFCKeditor->ToolbarSet = 'Basic'; 
    201                                 $oFCKeditor->Value = isset($GLOBALS['phpgw_info']['server']['agree_term']) ? $GLOBALS['phpgw_info']['server']['agree_term'] : ''; 
    202                                 $t->set_var('agree_term_input',$oFCKeditor->Create());                   
     187                                $t->set_var('agree_term_input', '<textarea name="newsettings[agree_term]" id="agree_term">' 
     188                                        . (isset($GLOBALS['phpgw_info']['server']['agree_term']) ? $GLOBALS['phpgw_info']['server']['agree_term'] : '') 
     189                                        . '</textarea>'); 
    203190                        } 
    204191                        $t->set_var('title',lang('Site Configuration')); 
  • trunk/admin/inc/class.uimainscreen.inc.php

    r2802 r2876  
    2323                { 
    2424 
    25                         $html = createObject('phpgwapi.html'); 
     25                        //$html = createObject('phpgwapi.html'); 
    2626                        $section     = addslashes($_REQUEST['section']); 
    2727                        $select_lang = addslashes($_REQUEST['select_lang']); 
     
    9595                        if (empty($section)) 
    9696                        { 
     97                                $GLOBALS['phpgw']->js->validate_file('jscode','openwindow','admin'); 
     98                                //$GLOBALS['phpgw']->common->phpgw_header(); 
     99                                //echo parse_navbar(); 
    97100 
    98                            $GLOBALS['phpgw']->js->validate_file('jscode','openwindow','admin'); 
    99                            //$GLOBALS['phpgw']->common->phpgw_header(); 
    100                            //echo parse_navbar(); 
    101                                    
    102                             
    103                            $GLOBALS['phpgw']->template->set_var('form_action',$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uimainscreen.index')); 
     101                                $GLOBALS['phpgw']->template->set_var('form_action',$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uimainscreen.index')); 
    104102                                $GLOBALS['phpgw']->template->set_var('tr_color',$GLOBALS['phpgw_info']['theme']['th_bg']); 
    105103                                $GLOBALS['phpgw']->template->set_var('value','&nbsp;'); 
     
    140138                                $tr_color = $GLOBALS['phpgw']->nextmatchs->alternate_row_color($tr_color); 
    141139                                $GLOBALS['phpgw']->template->set_var('tr_color',$tr_color); 
    142                                 $GLOBALS['phpgw']->template->set_var('value','<input type="button" value="' . lang('Edit') 
    143                                         . '" onclick="ExpressoLivre.link( \'' . $GLOBALS[ 'phpgw' ] -> link( '/index.php','menuaction=admin.uimainscreen.index' ) 
    144                                         . '\' + \'&section=\' + escape( this.form.section.item( 1 ).value ) + \'&select_lang=\' + escape( this.form.select_lang.item( 1 ).value ) )' 
    145                                         . '"><input type="button" name="cancel" value="'. lang('cancel') .'" onclick="ExpressoLivre.link( \'' . $GLOBALS[ 'phpgw' ] -> link( '/admin/index.php' ) . '\' )">'); 
     140                                $GLOBALS['phpgw']->template->set_var('value', 
     141                                        '<input type="button" value="' 
     142                                                . lang('Edit') . '" onclick="ExpressoLivre.link( \'' 
     143                                                . $GLOBALS[ 'phpgw' ] -> link( '/index.php','menuaction=admin.uimainscreen.index' ) 
     144                                                . '\' + \'&section=\' + escape( this.form.section.item( 1 ).value )' 
     145                                                . ' + \'&select_lang=\' + escape( this.form.select_lang.item( 1 ).value ) )' 
     146                                                . '">' 
     147                                        . '<input type="button" name="cancel" value="' 
     148                                                . lang('cancel') . '" onclick="ExpressoLivre.link( \'' 
     149                                                . $GLOBALS[ 'phpgw' ] -> link( '/admin/index.php' ) 
     150                                                . '\' )">' 
     151                                ); 
    146152                                $GLOBALS['phpgw']->template->fp('rows','row_2',True); 
    147153                        } 
    148154                        else 
    149155                        { 
    150                            $GLOBALS['phpgw']->db->query("SELECT content FROM phpgw_lang WHERE lang='$select_lang' AND message_id='$section" 
     156                                $GLOBALS['phpgw']->template->set_block('message','edit','edit'); 
     157                                $GLOBALS['phpgw']->template->set_block('message','edit_script','edit_script'); 
     158 
     159                                $GLOBALS['phpgw']->js->validate_file('jscode','openwindow','admin'); 
     160 
     161                                $GLOBALS['phpgw']->db->query("SELECT content FROM phpgw_lang WHERE lang='$select_lang' AND message_id='$section" 
    151162                                . "_message'",__LINE__,__FILE__); 
    152163                                $GLOBALS['phpgw']->db->next_record(); 
    153                                  
    154                                 $current_message = $GLOBALS['phpgw']->db->f('content'); 
    155                                  
    156                                 if($_REQUEST['htmlarea']) 
    157                                 { 
    158                                         //$text_or_htmlarea=$html->htmlarea('message',stripslashes($current_message)); 
    159  
    160                                         include_once("news_admin/inc/fckeditor.php"); 
    161                                         $oFCKeditor = new FCKeditor( 'message' ); 
    162  
    163                                         $webserver_url = $GLOBALS['phpgw_info']['server']['webserver_url']; 
    164                                         $webserver_url = ( !empty($webserver_url) ) ? $webserver_url : '/'; 
    165  
    166                                         if(strrpos($webserver_url,'/') === false || strrpos($webserver_url,'/') != (strlen($webserver_url)-1)) 
    167                                                 $webserver_url .= '/'; 
    168  
    169                                         $oFCKeditor->BasePath = $webserver_url . 'news_admin/templates/default/fckeditor/';  
    170                                         $oFCKeditor->ToolbarSet = 'Basic'; 
    171                                         $oFCKeditor->Value = $current_message; 
    172  
    173                                         $text_or_htmlarea = $oFCKeditor->Create( ); 
    174  
    175                                         $htmlarea_button='<input type="button" name="no-htmlarea" onclick="ExpressoLivre.link( \''.$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uimainscreen.index&htmlarea=true&section=' . $section ) . '\');" value="'.lang('disable WYSIWYG-editor').'">';         
    176                                 } 
    177                                 else 
    178                                 { 
    179                                         $text_or_htmlarea='<textarea name="message" style="width:100%; min-width:350px; height:300px;" wrap="virtual">' . stripslashes($current_message) . '</textarea>'; 
    180                                         $htmlarea_button='<input type="button" name="htmlarea" onclick="ExpressoLivre.link( \''.$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uimainscreen.index&htmlarea=true&section=' . $section ) . '\' );" value="'.lang('activate WYSIWYG-editor').'">'; 
    181  
    182                                 }                           
    183  
    184                                 $GLOBALS['phpgw']->js->validate_file('jscode','openwindow','admin'); 
    185                                 //$GLOBALS['phpgw']->common->phpgw_header(); 
    186                                 //echo parse_navbar(); 
    187164 
    188165                                $GLOBALS['phpgw']->template->set_var('form_action',$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uimainscreen.index')); 
    189166                                $GLOBALS['phpgw']->template->set_var('select_lang',$select_lang); 
    190167                                $GLOBALS['phpgw']->template->set_var('section',$section); 
    191                                 $GLOBALS['phpgw']->template->set_var('tr_color',$GLOBALS['phpgw_info']['theme']['th_bg']); 
    192                                 $GLOBALS['phpgw']->template->set_var('value','&nbsp;'); 
    193                                 $GLOBALS['phpgw']->template->fp('rows','row_2',True); 
     168                                $GLOBALS['phpgw']->template->set_var('message', '<textarea name="message"></textarea>'); 
    194169 
    195                                 $tr_color = $GLOBALS['phpgw']->nextmatchs->alternate_row_color($tr_color); 
    196                                 $GLOBALS['phpgw']->template->set_var('tr_color',$tr_color); 
     170                                $GLOBALS['phpgw']->template->fp('scripts','edit_script',True); 
     171                                $GLOBALS['phpgw']->template->fp('rows','edit',True); 
    197172 
    198                                  
    199                                 $GLOBALS['phpgw']->template->set_var('value',$text_or_htmlarea); 
    200                                  
    201                                  
    202                                  
    203                                 $GLOBALS['phpgw']->template->fp('rows','row_2',True); 
     173                                $GLOBALS['phpgw']->template->set_var( 'value', 
     174                                        '<input type="submit" name="submit" value="' 
     175                                                . lang('Save') . '">' 
     176                                        . '<input type="button" name="cancel" value="'. lang('cancel') 
     177                                                .'" onclick="ExpressoLivre.link( \'' 
     178                                                . $GLOBALS[ 'phpgw' ] -> link( '/index.php','menuaction=admin.uimainscreen.index' ) 
     179                                                . '\' )">' 
     180                                ); 
    204181 
    205                                 $tr_color = $GLOBALS['phpgw']->nextmatchs->alternate_row_color($tr_color); 
    206                                 $GLOBALS['phpgw']->template->set_var('tr_color',$tr_color); 
    207                                 $GLOBALS['phpgw']->template->set_var('value','<input type="submit" name="submit" value="' . lang('Save') 
    208                                 . '"><input type="button" name="cancel" value="'. lang('cancel') .'" onclick="ExpressoLivre.link( \'' . $GLOBALS[ 'phpgw' ] -> link( '/index.php','menuaction=admin.uimainscreen.index' ) . '\' )">'.$htmlarea_button); 
    209182                                $GLOBALS['phpgw']->template->fp('rows','row_2',True); 
    210183                        } 
  • trunk/admin/templates/classic/config.tpl

    r2802 r2876  
    11<!-- BEGIN header --> 
    22<script> 
    3 function FCKeditor_OnComplete( editorInstance ) 
     3function send_form( pForm ) 
    44{ 
    5         editorInstance.LinkedField.form.onsubmit = function( ) 
     5        ExpressoLivre.events.fire.onunload( ); 
     6        return ExpressoLivre.form( pForm ); 
     7} 
     8 
     9ExpressoLivre.events.onload( function( ) 
     10{ 
     11        CKEDITOR.replace( "agree_term", 
    612        { 
    7                 document.getElementById( 'newsettings[agree_term]' ).value = FCKeditorAPI.GetInstance( editorInstance.Name ).GetHTML( ); 
    8                 return ExpressoLivre.form( editorInstance.LinkedField.form ); 
    9         }; 
    10 } 
     13                toolbar : 
     14                [ 
     15                        [ 'Styles', 'Format' ], 
     16                        [ 'Bold', 'Italic', '-', 'NumberedList', 'BulletedList' ] 
     17                ] 
     18        } ); 
     19} ); 
     20 
     21ExpressoLivre.events.onunload( function( ) 
     22{ 
     23        CKEDITOR.instances.agree_term.destroy( ); 
     24} ); 
    1125</script> 
    12 <form method="POST" action="{action_url}"> 
     26<form method="POST" action="{action_url}" onsubmit="return send_form( this );"> 
    1327<table align="center" width="85%" callspacing="0" style="{ border: 1px solid #000000; }"> 
    1428   <tr class="th"> 
     
    197211    <td colspan="2" align="center"> 
    198212      <input type="submit" name="submit" value="{lang_submit}"> 
    199       <input type="submit" name="cancel" value="{lang_cancel}"> 
     213      <input type="button" name="cancel" value="{lang_cancel}" onclick="ExpressoLivre.link( '{cancel_button}' )" /> 
    200214                  <br> 
    201215    </td> 
  • trunk/admin/templates/classic/mainscreen_message.tpl

    r1362 r2876  
    11<!-- BEGIN form --> 
    22<div align="center">{error_message}</div> 
    3 <form method="POST" action="{form_action}"> 
     3<form method="POST" action="{form_action}" onsubmit="return send_form( this );"> 
    44 <table border="0" align="center" > 
    55<input type="hidden" name="select_lang" value="{select_lang}"> 
  • trunk/admin/templates/default/config.tpl

    r2802 r2876  
    11<!-- BEGIN header --> 
    22<script> 
    3 function FCKeditor_OnComplete( editorInstance ) 
     3function send_form( pForm ) 
    44{ 
    5         editorInstance.LinkedField.form.onsubmit = function( ) 
     5        ExpressoLivre.events.fire.onunload( ); 
     6        return ExpressoLivre.form( pForm ); 
     7} 
     8 
     9ExpressoLivre.events.onload( function( ) 
     10{ 
     11        CKEDITOR.replace( "agree_term", 
    612        { 
    7                 document.getElementById( 'newsettings[agree_term]' ).value = FCKeditorAPI.GetInstance( editorInstance.Name ).GetHTML( ); 
    8                 return ExpressoLivre.form( editorInstance.LinkedField.form ); 
    9         }; 
    10 } 
     13                toolbar : 
     14                [ 
     15                        [ 'Styles', 'Format' ], 
     16                        [ 'Bold', 'Italic', '-', 'NumberedList', 'BulletedList' ] 
     17                ] 
     18        } ); 
     19} ); 
     20 
     21ExpressoLivre.events.onunload( function( ) 
     22{ 
     23        CKEDITOR.instances.agree_term.destroy( ); 
     24} ); 
    1125</script> 
    12 <form method="POST" action="{action_url}"> 
     26<form method="POST" action="{action_url}" onsubmit="return send_form( this );"> 
    1327<table align="center" width="85%" callspacing="0"> 
    1428   <tr class="th"> 
  • trunk/admin/templates/default/mainscreen_message.tpl

    r2802 r2876  
    11<!-- BEGIN form --> 
    2 <div align="center">{error_message}</div> 
    3 <form method="POST" action="{form_action}" onsubmit="return ExpressoLivre.form( this );"> 
     2{scripts} 
     3<form method="POST" action="{form_action}" onsubmit="return send_form( this );"> 
    44 <table border="0" align="center" > 
    5 <input type="hidden" name="select_lang" value="{select_lang}"> 
    6 <input type="hidden" name="section" value="{section}"> 
     5  <input type="hidden" name="select_lang" value="{select_lang}"> 
     6  <input type="hidden" name="section" value="{section}"> 
    77  {rows} 
    88 </table> 
     
    3636  </tr> 
    3737<!-- END row_2 --> 
     38<!-- BEGIN edit --> 
     39  <tr > 
     40    <td colspan="2"> 
     41         <br /> 
     42          {message} 
     43         <br /> 
     44        </td> 
     45  </tr> 
     46<!-- END edit --> 
     47<!-- BEGIN edit_script --> 
     48<script> 
     49function send_form( pForm ) 
     50{ 
     51        ExpressoLivre.events.fire.onunload( ); 
     52        return ExpressoLivre.form( pForm ); 
     53} 
     54 
     55ExpressoLivre.events.onload( function( ) 
     56{ 
     57        CKEDITOR.replace( "message", 
     58        { 
     59                toolbar : 
     60                [ 
     61                        [ 'Styles', 'Format' ], 
     62                        [ 'Bold', 'Italic', '-', 'NumberedList', 'BulletedList' ] 
     63                ], 
     64                width : 500 
     65        } ); 
     66} ); 
     67 
     68ExpressoLivre.events.onunload( function( ) 
     69{ 
     70        CKEDITOR.instances.message.destroy( ); 
     71} ); 
     72</script> 
     73<!-- END edit_script --> 
  • trunk/phpgwapi/inc/class.common.inc.php

    r2857 r2876  
    403403                                                . '</script>'; 
    404404 
     405                                        $GLOBALS[ 'phpgw' ] -> js -> validate_file( 'ckeditor', 'ckeditor', NULL, true ); 
    405406                                        $GLOBALS[ 'phpgw' ] -> js -> validate_file( 'wz_dragdrop', 'wz_dragdrop', NULL, true ); 
    406407                                        $GLOBALS[ 'phpgw' ] -> js -> validate_file( 'expressoAjax', 'expressoAjax', NULL, true ); 
Note: See TracChangeset for help on using the changeset viewer.