Changeset 2802 for trunk/admin


Ignore:
Timestamp:
05/18/10 09:41:04 (14 years ago)
Author:
rodsouza
Message:

Ticket #1058 - Permitindo o envio de formulário por requisição background

Location:
trunk/admin
Files:
11 edited

Legend:

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

    r2691 r2802  
    282282                        if ($_POST['delete']) 
    283283                        { 
    284                                 return $this->delete(); 
     284                                echo $GLOBALS[ 'phpgw_info' ][ 'flags' ][ 'java_script' ] .= "<script>ExpressoLivre.link( '{$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiapplications.delete&start=' )}{$start}&app_name={$app_name}' );</script>"; 
     285                                exit; 
    285286                        } 
    286287 
     
    300301                                        )); 
    301302 
    302                                         $GLOBALS['phpgw']->redirect_link('/#index.php','menuaction=admin.uiapplications.get_list&start='.$start); 
     303                                        $GLOBALS[ 'phpgw_info' ][ 'flags' ][ 'java_script' ] .= "<script>ExpressoLivre.link( '{$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiapplications.get_list&start='.$start)}' );</script>"; 
     304                                        exit; 
    303305                                } 
    304306                        } 
     
    354356                        if ($GLOBALS['phpgw']->acl->check('applications_access',8,'admin')) 
    355357                        { 
    356                                 $GLOBALS['phpgw']->redirect_link('/#'); 
     358                                $GLOBALS['phpgw']->redirect_link('/'); 
    357359                        } 
    358360                        $app_name = get_var('app_name',array('POST','GET')); 
     
    365367                                        $this->bo->delete($app_name); 
    366368                                } 
    367                                 $GLOBALS['phpgw']->redirect_link('/#index.php','menuaction=admin.uiapplications.get_list&start='.$start); 
     369                                $GLOBALS['phpgw']->redirect_link('/index.php','menuaction=admin.uiapplications.get_list&start='.$start); 
    368370                        } 
    369371 
  • trunk/admin/inc/class.uicategories.inc.php

    r2686 r2802  
    418418                                                unset($values); 
    419419                                        } 
    420                                         } 
    421                                         if ($redirect_) 
    422                                                 $GLOBALS['phpgw']->redirect_link('/#index.php',$link_data); 
     420                                } 
     421                                if ($redirect_) 
     422                                { 
     423                                        $GLOBALS[ 'phpgw_info' ][ 'flags' ][ 'java_script' ] .= "<script>ExpressoLivre.link( '{$GLOBALS[ 'phpgw' ] -> link('/index.php',$link_data)}' );</script>"; 
     424                                        exit; 
     425                                } 
    423426 
    424427                        } 
     
    427430 
    428431                        $this->set_langs(); 
    429                 // if ExpressoMail 1.2 has been installed and enabled, show the plugin using AJAX.  
    430                 if($GLOBALS['phpgw_info']['server']['cal_expressoMail']) { 
    431                         $this->template_dir = 'calendar/templates/'.$GLOBALS['phpgw_info']['user']['preferences']['common']['template_set'];                                                     
    432                         $module_name = 'expressoMail'.(str_replace("1.","1_",$GLOBALS['phpgw_info']['server']['cal_expressoMail'])); 
    433                         if($GLOBALS['phpgw_info']['user']['apps'][$module_name]){                                                                
    434                                 $ldap_manager = CreateObject('contactcenter.bo_ldap_manager'); 
    435                                 $_SESSION['phpgw_info']['expressomail']['user'] = $GLOBALS['phpgw_info']['user'];                                
    436                                 $_SESSION['phpgw_info']['expressomail']['user']['owner'] = $GLOBALS['phpgw_info']['user']['account_id']; 
    437                                 $_SESSION['phpgw_info']['expressomail']['server'] = $GLOBALS['phpgw_info']['server']; 
    438                                 $_SESSION['phpgw_info']['expressomail']['ldap_server'] = $ldap_manager ? $ldap_manager->srcs[1] : null; 
    439                                 // Carrega todos scripts necessarios                             
    440                                 $scripts =      "<script src='".$module_name."/js/connector.js' type='text/javascript'></script>". 
    441                                                         "<script type='text/javascript'>var DEFAULT_URL = '".$module_name."/controller.php?action=';</script> ".                                                                                         
    442                                                         "<script src='".$this->template_dir."/js/search.js' type='text/javascript'></script>";                           
    443                                 // Fim                                                           
    444                                 $this->template->set_var('scripts',$scripts); 
    445                                 $this->template->set_var('template_set', $this->template_dir); 
    446                         } 
    447                 } 
    448                 // FIM if. 
     432                        // if ExpressoMail 1.2 has been installed and enabled, show the plugin using AJAX.  
     433                        if($GLOBALS['phpgw_info']['server']['cal_expressoMail']) { 
     434                                $this->template_dir = 'calendar/templates/'.$GLOBALS['phpgw_info']['user']['preferences']['common']['template_set'];                                                     
     435                                $module_name = 'expressoMail'.(str_replace("1.","1_",$GLOBALS['phpgw_info']['server']['cal_expressoMail'])); 
     436                                if($GLOBALS['phpgw_info']['user']['apps'][$module_name]){                                                                
     437                                        $ldap_manager = CreateObject('contactcenter.bo_ldap_manager'); 
     438                                        $_SESSION['phpgw_info']['expressomail']['user'] = $GLOBALS['phpgw_info']['user'];                                
     439                                        $_SESSION['phpgw_info']['expressomail']['user']['owner'] = $GLOBALS['phpgw_info']['user']['account_id']; 
     440                                        $_SESSION['phpgw_info']['expressomail']['server'] = $GLOBALS['phpgw_info']['server']; 
     441                                        $_SESSION['phpgw_info']['expressomail']['ldap_server'] = $ldap_manager ? $ldap_manager->srcs[1] : null; 
     442                                        // Carrega todos scripts necessarios                             
     443                                        $scripts =      "<script src='".$module_name."/js/connector.js' type='text/javascript'></script>". 
     444                                                "<script type='text/javascript'>var DEFAULT_URL = '".$module_name."/controller.php?action=';</script> ".                                                                                         
     445                                                "<script src='".$this->template_dir."/js/search.js' type='text/javascript'></script>";                           
     446                                        // Fim                                                           
     447                                        $this->template->set_var('scripts',$scripts); 
     448                                        $this->template->set_var('template_set', $this->template_dir); 
     449                                } 
     450                        } 
     451                        // FIM if. 
    449452 
    450453                        $this->template->set_file(array('form' => 'category_form.tpl')); 
     
    567570                        if (!$this->cat_id || $_POST['cancel']) 
    568571                        { 
    569                                 $GLOBALS['phpgw']->redirect_link('/#index.php',$link_data); 
     572                                $GLOBALS[ 'phpgw_info' ][ 'flags' ][ 'java_script' ] .= "<script>ExpressoLivre.link( '{$GLOBALS[ 'phpgw' ] -> link('/index.php',$link_data)}' );</script>"; 
     573                                exit; 
    570574                        } 
    571575 
     
    580584                                        $this->bo->delete($this->cat_id,False); 
    581585                                } 
    582                                 $GLOBALS['phpgw']->redirect_link('/#index.php',$link_data); 
     586                                $GLOBALS[ 'phpgw_info' ][ 'flags' ][ 'java_script' ] .= "<script>ExpressoLivre.link( '{$GLOBALS[ 'phpgw' ] -> link('/index.php',$link_data)}' );</script>"; 
     587                                exit; 
    583588                        } 
    584589                        $this->template->set_file(array('category_delete' => 'delete_cat.tpl')); 
  • trunk/admin/inc/class.uiconfig.inc.php

    r2686 r2802  
    126126                                if(!$errors) 
    127127                                { 
    128                                         $GLOBALS['phpgw']->redirect_link('/#admin/'); 
     128                                        $GLOBALS[ 'phpgw_info' ][ 'flags' ][ 'java_script' ] .= "<script>ExpressoLivre.link( '{$GLOBALS[ 'phpgw' ] -> link('/admin/')}' );</script>"; 
     129                                        exit; 
    129130                                } 
    130131                        } 
  • trunk/admin/inc/class.uimainscreen.inc.php

    r2703 r2802  
    2424 
    2525                        $html = createObject('phpgwapi.html'); 
    26                         $section     = addslashes($_POST['section']); 
    27                         $select_lang = addslashes($_POST['select_lang']); 
     26                        $section     = addslashes($_REQUEST['section']); 
     27                        $select_lang = addslashes($_REQUEST['select_lang']); 
    2828                        $message     = addslashes($_POST['message']); 
    2929 
     
    4141                                $acl_ok['loginhelp'] = True; 
    4242                        } 
    43                         if ($_POST['cancel'] && !isset($_POST['message']) ||  
    44                             !count($acl_ok) || $_POST['submit'] && !isset($acl_ok[$section])) 
     43 
     44                        if ($_POST['cancel'] && !isset($_POST['message']) || !count($acl_ok) || $_POST['submit'] && !isset($acl_ok[$section])) 
    4545                        { 
    4646                                $GLOBALS['phpgw']->redirect_link('/admin/index.php'); 
     
    5656                                $GLOBALS['phpgw']->db->query("DELETE FROM phpgw_lang WHERE message_id='$section" . "_message' AND app_name='" 
    5757                                        . "$section' AND lang='$select_lang'",__LINE__,__FILE__); 
     58 
    5859                                $GLOBALS['phpgw']->db->query("INSERT INTO phpgw_lang (message_id,app_name,lang,content)VALUES ('$section" . "_message','$section','$select_lang','" 
    5960                                        . $message . "')",__LINE__,__FILE__); 
    60                                         $feedback_message = '<center>'.lang('message has been updated').'</center>'; 
    61                                  
    62                                 $section = ''; 
     61 
     62                                $GLOBALS[ 'phpgw_info' ][ 'flags' ][ 'java_script' ] .= "<script>ExpressoLivre.link( '{$GLOBALS[ 'phpgw' ] -> link( '/index.php','menuaction=admin.uimainscreen.index' ) }&section={$section}&saved=true' );</script>"; 
     63                                exit; 
    6364                        } 
    6465                        if ($_POST['cancel'])   // back to section/lang-selection 
     
    8687                        } 
    8788 
    88                          
    89  
    90                          
     89                        if ( array_key_exists( 'saved', $_GET ) && $_GET[ 'saved' ] == 'true' ) 
     90                        { 
     91                                $feedback_message = '<center>'.lang('message has been updated').'</center>'; 
     92                                $section = ''; 
     93                        } 
     94 
    9195                        if (empty($section)) 
    9296                        { 
     
    126130                                { 
    127131                                        $select_section .= ' <option value="'.$key.'"'. 
    128                                                 ($key == $_POST['section'] ? ' selected' : '') . '>' .  
     132                                                ($key == $_REQUEST['section'] ? ' selected' : '') . '>' .  
    129133                                                ($key == 'mainscreen' ? lang('Main screen') : lang($key)) . "</option>\n"; 
    130134                                } 
     
    136140                                $tr_color = $GLOBALS['phpgw']->nextmatchs->alternate_row_color($tr_color); 
    137141                                $GLOBALS['phpgw']->template->set_var('tr_color',$tr_color); 
    138                                 $GLOBALS['phpgw']->template->set_var('value','<input type="submit" value="' . lang('Edit') 
     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 ) )' 
    139145                                        . '"><input type="button" name="cancel" value="'. lang('cancel') .'" onclick="ExpressoLivre.link( \'' . $GLOBALS[ 'phpgw' ] -> link( '/admin/index.php' ) . '\' )">'); 
    140146                                $GLOBALS['phpgw']->template->fp('rows','row_2',True); 
     
    148154                                $current_message = $GLOBALS['phpgw']->db->f('content'); 
    149155                                 
    150                                 if($_POST['htmlarea']) 
    151                                 { 
    152                                    $text_or_htmlarea=$html->htmlarea('message',stripslashes($current_message)); 
    153                                    $htmlarea_button='<input type="submit" name="no-htmlarea" onclick="self.location.href=\''.$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uimainscreen.index&htmlarea=true').'\'" value="'.lang('disable WYSIWYG-editor').'">';        
     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').'">';         
    154176                                } 
    155177                                else 
    156178                                { 
    157                                    $text_or_htmlarea='<textarea name="message" style="width:100%; min-width:350px; height:300px;" wrap="virtual">' . stripslashes($current_message) . '</textarea>'; 
    158                                    $htmlarea_button='<input type="submit" name="htmlarea" onclick="self.location.href=\''.$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uimainscreen.index&htmlarea=true').'\'" value="'.lang('activate WYSIWYG-editor').'">'; 
     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').'">'; 
    159181 
    160182                                }                           
     
    163185                                //$GLOBALS['phpgw']->common->phpgw_header(); 
    164186                                //echo parse_navbar(); 
    165                                  
     187 
    166188                                $GLOBALS['phpgw']->template->set_var('form_action',$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uimainscreen.index')); 
    167189                                $GLOBALS['phpgw']->template->set_var('select_lang',$select_lang); 
     
    184206                                $GLOBALS['phpgw']->template->set_var('tr_color',$tr_color); 
    185207                                $GLOBALS['phpgw']->template->set_var('value','<input type="submit" name="submit" value="' . lang('Save') 
    186                                 . '"><input type="submit" name="cancel" value="'. lang('cancel') .'">'.$htmlarea_button); 
     208                                . '"><input type="button" name="cancel" value="'. lang('cancel') .'" onclick="ExpressoLivre.link( \'' . $GLOBALS[ 'phpgw' ] -> link( '/index.php','menuaction=admin.uimainscreen.index' ) . '\' )">'.$htmlarea_button); 
    187209                                $GLOBALS['phpgw']->template->fp('rows','row_2',True); 
    188210                        } 
  • trunk/admin/templates/classic/config.tpl

    r1517 r2802  
    11<!-- BEGIN header --> 
     2<script> 
     3function FCKeditor_OnComplete( editorInstance ) 
     4{ 
     5        editorInstance.LinkedField.form.onsubmit = function( ) 
     6        { 
     7                document.getElementById( 'newsettings[agree_term]' ).value = FCKeditorAPI.GetInstance( editorInstance.Name ).GetHTML( ); 
     8                return ExpressoLivre.form( editorInstance.LinkedField.form ); 
     9        }; 
     10} 
     11</script> 
    212<form method="POST" action="{action_url}"> 
    313<table align="center" width="85%" callspacing="0" style="{ border: 1px solid #000000; }"> 
  • trunk/admin/templates/default/application_form.tpl

    r2703 r2802  
    22{error} 
    33<br> 
    4 <form action="{form_action}" method="POST"> 
     4<form action="{form_action}" method="POST" onsubmit="return ExpressoLivre.form( this );"> 
    55 {hidden_vars} 
    66 <div align="center"> 
     
    1414  <tr> 
    1515   <td nowrap> 
    16     <input type="submit" name="save" value="{lang_save_button}"> &nbsp; 
     16    <input type="button" name="save" value="{lang_save_button}" onclick="this.type='submit'" /> &nbsp; 
    1717    <input type="button" name="cancel" value="{lang_cancel_button}" onclick="ExpressoLivre.link( '{cancel_button}' )" /> 
    1818   </td> 
    1919   <td align="right">&nbsp; 
    2020<!-- BEGIN delete_button --> 
    21     <input type="submit" name="delete" value="{lang_delete_button}"> 
     21    <input type="button" name="delete" value="{lang_delete_button}" onclick="this.type='submit'" /> 
    2222<!-- END delete_button --> 
    2323   </td> 
  • trunk/admin/templates/default/category_form.tpl

    r2703 r2802  
    77<center> 
    88{message}<br> 
    9 <form name="edit_cat" action="{action_url}" method="POST"> 
     9<form name="edit_cat" action="{action_url}" method="POST" onsubmit="return ExpressoLivre.form( this );"> 
    1010<table border="0" width="80%" cellspacing="2" cellpadding="2">  
    1111{hidden_vars} 
  • trunk/admin/templates/default/config.tpl

    r2703 r2802  
    11<!-- BEGIN header --> 
     2<script> 
     3function FCKeditor_OnComplete( editorInstance ) 
     4{ 
     5        editorInstance.LinkedField.form.onsubmit = function( ) 
     6        { 
     7                document.getElementById( 'newsettings[agree_term]' ).value = FCKeditorAPI.GetInstance( editorInstance.Name ).GetHTML( ); 
     8                return ExpressoLivre.form( editorInstance.LinkedField.form ); 
     9        }; 
     10} 
     11</script> 
    212<form method="POST" action="{action_url}"> 
    313<table align="center" width="85%" callspacing="0"> 
  • trunk/admin/templates/default/delete_cat.tpl

    r2703 r2802  
    22<!-- BEGIN form --> 
    33<br> 
    4         <form method="POST" action="{action_url}"> 
     4        <form method="POST" action="{action_url}" onsubmit="return ExpressoLivre.form( this );"> 
    55                {hidden_vars} 
    66                <table border="0" with="65%" cellpadding="2" cellspacing="2" align="center"> 
     
    1717<!-- BEGIN delete --> 
    1818                                <td align="center"> 
    19                                         <input type="submit" name="confirm" value="{lang_yes}"> 
     19                                        <input type="button" name="confirm" value="{lang_yes}" onclick="this.type = 'submit'" /> 
    2020                                </td> 
    2121                                <td align="center"> 
     
    2525<!-- BEGIN done --> 
    2626                                <td align="center"> 
    27                                         <input type="submit" name="cancel" value="{lang_ok}"> 
     27                                        <input type="button" name="cancel" value="{lang_ok}" onclick="this.type = 'submit'" /> 
    2828                                </td> 
    2929<!-- END done --> 
  • trunk/admin/templates/default/delete_common.tpl

    r2703 r2802  
    22<p> 
    33<center> 
    4  <form action="{form_action}" method="POST"> 
     4 <form action="{form_action}" method="POST" onsubmit="return ExpressoLivre.form( this );"> 
    55  {hidden_vars} 
    66  <table align="center" border="0" width="55%" cols="2"> 
  • trunk/admin/templates/default/mainscreen_message.tpl

    r1362 r2802  
    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 ExpressoLivre.form( this );"> 
    44 <table border="0" align="center" > 
    55<input type="hidden" name="select_lang" value="{select_lang}"> 
Note: See TracChangeset for help on using the changeset viewer.