phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] CVS: infolog csv_import.php,1.11,1.12


From: Ralf Becker <address@hidden>
Subject: [Phpgroupware-cvs] CVS: infolog csv_import.php,1.11,1.12
Date: Sat, 01 Jun 2002 09:18:24 -0400

Update of /cvsroot/phpgroupware/infolog
In directory subversions:/tmp/cvs-serv8347

Modified Files:
        csv_import.php 
Log Message:
some more changes to be compatible with seek3r new template-system
output is not longer print, but 
$GLOBALS['phpgw']->template->set_var('phpgw_body',$content);

Index: csv_import.php
===================================================================
RCS file: /cvsroot/phpgroupware/infolog/csv_import.php,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -r1.11 -r1.12
*** csv_import.php      1 Jun 2002 10:55:05 -0000       1.11
--- csv_import.php      1 Jun 2002 13:18:21 -0000       1.12
***************
*** 31,53 ****
        $infolog = createobject('infolog.uiinfolog');
  
!       $t = $GLOBALS['phpgw']->template; 
//CreateObject('phpgwapi.Template',PHPGW_APP_TPL); // $t->unknows = 'keep'; 
$t->debug = 1;
!       $t->set_file(array('import_t' => 'csv_import.tpl'));
!       $t->set_block('import_t','filename');
!       $t->set_block('import_t','fheader');
!       $t->set_block('import_t','fields');
!       $t->set_block('import_t','ffooter');
!       $t->set_block('import_t','imported');
!       $t->set_block('import_t','import');
! 
!       
!       // 
$t->set_var("navbar_bg",$GLOBALS['phpgw_info']["theme"]["navbar_bg"]);
!       // 
$t->set_var("navbar_text",$GLOBALS['phpgw_info']["theme"]["navbar_text"]);
!       
        if ($action == 'download' && (!$fieldsep || !$csvfile || 
!($fp=fopen($csvfile,"r")))) {
                $action = '';
!       }               
!       
$t->set_var("action_url",$GLOBALS['phpgw']->link("/infolog/csv_import.php"));
!       $t->set_var( $infolog->setStyleSheet( ));
!       $t->set_var("lang_info_action",lang("InfoLog - Import CSV-File"));
  
        $PSep = '||'; // Pattern-Separator, separats the 
pattern-replacement-pairs in trans
--- 31,52 ----
        $infolog = createobject('infolog.uiinfolog');
  
!       $GLOBALS['phpgw']->template->set_file(array('import_t' => 
'csv_import.tpl'));
!       $GLOBALS['phpgw']->template->set_block('import_t','filename');
!       $GLOBALS['phpgw']->template->set_block('import_t','fheader');
!       $GLOBALS['phpgw']->template->set_block('import_t','fields');
!       $GLOBALS['phpgw']->template->set_block('import_t','ffooter');
!       $GLOBALS['phpgw']->template->set_block('import_t','imported');
!       $GLOBALS['phpgw']->template->set_block('import_t','import');
! 
! 
!       // 
$GLOBALS['phpgw']->template->set_var("navbar_bg",$GLOBALS['phpgw_info']["theme"]["navbar_bg"]);
!       // 
$GLOBALS['phpgw']->template->set_var("navbar_text",$GLOBALS['phpgw_info']["theme"]["navbar_text"]);
! 
        if ($action == 'download' && (!$fieldsep || !$csvfile || 
!($fp=fopen($csvfile,"r")))) {
                $action = '';
!       }
!       
$GLOBALS['phpgw']->template->set_var("action_url",$GLOBALS['phpgw']->link("/infolog/csv_import.php"));
!       $GLOBALS['phpgw']->template->set_var( $infolog->setStyleSheet( ));
!       $GLOBALS['phpgw']->template->set_var("lang_info_action",lang("InfoLog - 
Import CSV-File"));
  
        $PSep = '||'; // Pattern-Separator, separats the 
pattern-replacement-pairs in trans
***************
*** 78,88 ****
        if (!count($addrs))
                $addrs = $contacts->read( 
0,0,array('id'),'',"n_family=$n_family,org_name=$org_name" );
!       
        if (count($addrs))
                return $addrs[0]['id'];
!               
!       return False;   
  }
!       
  $cat2id = array( );
  
--- 77,87 ----
        if (!count($addrs))
                $addrs = $contacts->read( 
0,0,array('id'),'',"n_family=$n_family,org_name=$org_name" );
! 
        if (count($addrs))
                return $addrs[0]['id'];
! 
!       return False;
  }
! 
  $cat2id = array( );
  
***************
*** 130,142 ****
        switch ($action) {
        case '':        // Start, ask Filename
!               $t->set_var('lang_csvfile',lang('CSV-Filename'));
!               $t->set_var('lang_fieldsep',lang('Fieldseparator'));
!               $t->set_var('fieldsep',$fieldsep ? $fieldsep : ',');
!               $t->set_var('submit',lang('Download'));
!               $t->set_var('csvfile',$csvfile);
!               $t->set_var('enctype','ENCTYPE="multipart/form-data"');
                $hiddenvars .= '<input type="hidden" name="action" 
value="download">'."\n";
  
!               $t->parse('rows','filename');
                break;
  
--- 129,141 ----
        switch ($action) {
        case '':        // Start, ask Filename
!               
$GLOBALS['phpgw']->template->set_var('lang_csvfile',lang('CSV-Filename'));
!               
$GLOBALS['phpgw']->template->set_var('lang_fieldsep',lang('Fieldseparator'));
!               $GLOBALS['phpgw']->template->set_var('fieldsep',$fieldsep ? 
$fieldsep : ',');
!               $GLOBALS['phpgw']->template->set_var('submit',lang('Download'));
!               $GLOBALS['phpgw']->template->set_var('csvfile',$csvfile);
!               
$GLOBALS['phpgw']->template->set_var('enctype','ENCTYPE="multipart/form-data"');
                $hiddenvars .= '<input type="hidden" name="action" 
value="download">'."\n";
  
!               $GLOBALS['phpgw']->template->parse('rows','filename');
                break;
  
***************
*** 148,157 ****
                        $defaults = array();
                }
!               $t->set_var('lang_csv_fieldname',lang('CSV-Fieldname'));
!               $t->set_var('lang_info_fieldname',lang('InfoLog-Fieldname'));
!               $t->set_var('lang_translation',lang("Translation").' <a 
href="#help">'.lang('help').'</a>');
!               $t->set_var('submit',lang('Import'));
!               $t->set_var('lang_debug',lang('Test Import (show importable 
records <u>only</u> in browser)'));
!               $t->parse('rows','fheader');
                $hiddenvars .= '<input type="hidden" name="action" 
value="import">'."\n".
                                                        '<input type="hidden" 
name="fieldsep" value="'.$fieldsep."\">\n";
--- 147,156 ----
                        $defaults = array();
                }
!               
$GLOBALS['phpgw']->template->set_var('lang_csv_fieldname',lang('CSV-Fieldname'));
!               
$GLOBALS['phpgw']->template->set_var('lang_info_fieldname',lang('InfoLog-Fieldname'));
!               
$GLOBALS['phpgw']->template->set_var('lang_translation',lang("Translation").' 
<a href="#help">'.lang('help').'</a>');
!               $GLOBALS['phpgw']->template->set_var('submit',lang('Import'));
!               $GLOBALS['phpgw']->template->set_var('lang_debug',lang('Test 
Import (show importable records <u>only</u> in browser)'));
!               $GLOBALS['phpgw']->template->parse('rows','fheader');
                $hiddenvars .= '<input type="hidden" name="action" 
value="import">'."\n".
                                                        '<input type="hidden" 
name="fieldsep" value="'.$fieldsep."\">\n";
***************
*** 202,222 ****
                $csv_fields[] = 'no CSV 3';
                while (list($csv_idx,$csv_field) = each($csv_fields)) {
!                       $t->set_var('csv_field',$csv_field);
!                       $t->set_var('csv_idx',$csv_idx);
                        if ($def = $defaults[$csv_field]) {
                                list( $info,$trans ) = explode($PSep,$def,2);
!                               $t->set_var('trans',$trans);
!                               
$t->set_var('info_fields',str_replace('="'.$info.'">','="'.$info.'" 
selected>',$info_name_options));
                        } else {
!                               $t->set_var('trans','');
!                               $t->set_var('info_fields',$info_name_options);
                        }
!                       $t->parse('rows','fields',True);
                }
!               $t->set_var('lang_start',lang('Startrecord'));
!               $t->set_var('start',$start);
!               $t->set_var('lang_max',lang('Number of records to read 
(<=200)'));
!               $t->set_var('max',200);
!               $t->parse('rows','ffooter',True);
                fclose($fp);
                $old = $csvfile; $csvfile = 
$GLOBALS['phpgw_info']['server']['temp_dir'].'/info_log_import_'.basename($csvfile);
--- 201,221 ----
                $csv_fields[] = 'no CSV 3';
                while (list($csv_idx,$csv_field) = each($csv_fields)) {
!                       
$GLOBALS['phpgw']->template->set_var('csv_field',$csv_field);
!                       
$GLOBALS['phpgw']->template->set_var('csv_idx',$csv_idx);
                        if ($def = $defaults[$csv_field]) {
                                list( $info,$trans ) = explode($PSep,$def,2);
!                               
$GLOBALS['phpgw']->template->set_var('trans',$trans);
!                               
$GLOBALS['phpgw']->template->set_var('info_fields',str_replace('="'.$info.'">','="'.$info.'"
 selected>',$info_name_options));
                        } else {
!                               
$GLOBALS['phpgw']->template->set_var('trans','');
!                               
$GLOBALS['phpgw']->template->set_var('info_fields',$info_name_options);
                        }
!                       
$GLOBALS['phpgw']->template->parse('rows','fields',True);
                }
!               
$GLOBALS['phpgw']->template->set_var('lang_start',lang('Startrecord'));
!               $GLOBALS['phpgw']->template->set_var('start',$start);
!               $GLOBALS['phpgw']->template->set_var('lang_max',lang('Number of 
records to read (<=200)'));
!               $GLOBALS['phpgw']->template->set_var('max',200);
!               $GLOBALS['phpgw']->template->parse('rows','ffooter',True);
                fclose($fp);
                $old = $csvfile; $csvfile = 
$GLOBALS['phpgw_info']['server']['temp_dir'].'/info_log_import_'.basename($csvfile);
***************
*** 255,259 ****
                                                                "I hope that 
helped to understand the features, if not <a 
href='mailto:address@hidden'>ask</a>.";
  
!               $t->set_var('help_on_trans',lang($help_on_trans));      // I 
don't think anyone will translate this
                break;
  
--- 254,258 ----
                                                                "I hope that 
helped to understand the features, if not <a 
href='mailto:address@hidden'>ask</a>.";
  
!               
$GLOBALS['phpgw']->template->set_var('help_on_trans',lang($help_on_trans));     
// I don't think anyone will translate this
                break;
  
***************
*** 347,359 ****
                $log .= "\t</tr>\n</table>\n";
  
!               $t->set_var('anz_imported',$debug ? lang( '%1 records read (not 
yet imported, you may go back and uncheck Test Import)',
                                                                                
                                                $anz,'<a 
href="javascript:history.back()">','</a>' ) :
                                                                                
                                lang( '%1 records imported',$anz ));
!               $t->set_var('log',$log);
!               $t->parse('rows','imported');
                break;
        }
!       $t->set_var('hiddenvars',$hiddenvars);
!       $t->pfp('out','import');
        $GLOBALS['phpgw']->common->phpgw_footer();
  
--- 346,358 ----
                $log .= "\t</tr>\n</table>\n";
  
!               $GLOBALS['phpgw']->template->set_var('anz_imported',$debug ? 
lang( '%1 records read (not yet imported, you may go back and uncheck Test 
Import)',
                                                                                
                                                $anz,'<a 
href="javascript:history.back()">','</a>' ) :
                                                                                
                                lang( '%1 records imported',$anz ));
!               $GLOBALS['phpgw']->template->set_var('log',$log);
!               $GLOBALS['phpgw']->template->parse('rows','imported');
                break;
        }
!       $GLOBALS['phpgw']->template->set_var('hiddenvars',$hiddenvars);
!       $GLOBALS['phpgw']->template->fp('phpgw_body','import');
        $GLOBALS['phpgw']->common->phpgw_footer();
  




reply via email to

[Prev in Thread] Current Thread [Next in Thread]