phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] addressbook admin.php, 1.3 csv_import.php, 1.20 index


From: skwashd
Subject: [Phpgroupware-cvs] addressbook admin.php, 1.3 csv_import.php, 1.20 index.php, 1.123
Date: Sun, 15 May 2005 15:34:00 +0200

Update of addressbook

Added Files:
     Branch: MAIN
            admin.php lines: +1 -1
Modified Files:
     Branch: MAIN
            csv_import.php lines: +29 -31
            index.php lines: +13 -16

Log Message:
merge from 16

====================================================
Index: admin.php
<?php
  /**************************************************************************\
  * phpGroupWare - Address Book                                              *
  * http://www.phpgroupware.org                                              *
  * --------------------------------------------                             *
  *  This program is free software; you can redistribute it and/or modify it *
  *  under the terms of the GNU General Public License as published by the   *
  *  Free Software Foundation; either version 2 of the License, or (at your  *
  *  option) any later version.                                              *
  \**************************************************************************/

  /* $Id: admin.php,v 1.3 2005/05/15 13:34:29 skwashd Exp $ */

        $phpgw_info['flags'] = array(
                'currentapp'  => 'addressbook',
                'noheader'    => True,
                'nonavbar'    => True,
                'noappheader' => True,
                'noappfooter' => True,
                'enable_config_class'     => True,
                'enable_nextmatchs_class' => True
        );

        include('../header.inc.php');

        $phpgw->config->read_repository();

        if ($submit)
        {
                if ($usecountrylist)
                {
                        $phpgw->config->config_data['countrylist'] = True;
                }
                else
                {
                        unset($phpgw->config->config_data['countrylist']);
                }

                $phpgw->config->save_repository(True);
                Header('Location: ' . $phpgw->link('/admin/index.php'));
        }

        $phpgw->common->phpgw_header();
        echo parse_navbar();

        $t = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
        $t->set_file(array('admin' => 'admin.tpl'));

        $t->set_var('action_url',$phpgw->link('/addressbook/admin.php'));

        $tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color);
        $t->set_var('tr_color',$tr_color);

        $t->set_var('lang_countrylist',lang('Use Country List'));
        if ($phpgw->config->config_data['countrylist'])
        {
                $t->set_var('countrylist',' checked');
        }
        else
        {
                $t->set_var('countrylist','');
        }

        $t->set_var('lang_admin',lang('Addressbook').' '.lang('Admin'));
        $t->set_var('lang_submit',lang('submit'));

        $t->pparse('out','admin');
        $phpgw->common->phpgw_footer();
?>

====================================================
Index: addressbook/csv_import.php
diff -u addressbook/csv_import.php:1.19 addressbook/csv_import.php:1.20
--- addressbook/csv_import.php:1.19     Tue May 10 13:02:43 2005
+++ addressbook/csv_import.php  Sun May 15 13:34:29 2005
@@ -1,24 +1,22 @@
 <?php
-       /**
-       * Addressbook - CSV - Import
-       *
-       * @author Ralf Becker <address@hidden>
-       * @copyright Copyright (C) 2002-2005 Free Software Foundation, Inc. 
http://www.fsf.org/
-       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
-       * @package addressbook
-       * @version $Id$
-       */
+  /**************************************************************************\
+  * phpGroupWare - Addressbook: CSV - Import                                 *
+  * http://www.phpgroupware.org                                              *
+  * Written by Ralf Becker <address@hidden>                  *
+  * --------------------------------------------                             *
+  *  This program is free software; you can redistribute it and/or modify it *
+  *  under the terms of the GNU General Public License as published by the   *
+  *  Free Software Foundation; either version 2 of the License, or (at your  *
+  *  option) any later version.                                              *
+  \**************************************************************************/

+  /* $Id$ */

        $GLOBALS['phpgw_info']['flags'] = array(
                'currentapp' => 'addressbook',
                'noheader'   => True,
                'enable_contacts_class' => True,
        );
-
-       /**
-       * Include phpgroupware header
-       */
        include('../header.inc.php');

        $GLOBALS['phpgw_info']['flags']['app_header'] = lang('Import CSV-File 
into Addressbook');
@@ -108,7 +106,7 @@
                        unset($field_names['locations']);
                        $comm_name = 
linearize_query($GLOBALS['phpgw']->contacts->get_contact_comm_descr(),'comm_description');
                        $location_types = 
linearize_query($GLOBALS['phpgw']->contacts->get_contact_addr_type(), 
'addr_description');
-
+
                        $loc_names = set_location_type($location_types, 
$loc_names);

                        $addr_names = $field_names + $comm_name + $loc_names;
@@ -150,65 +148,65 @@
                                        
$GLOBALS['phpgw']->template->set_var('trans','');
                                        
$GLOBALS['phpgw']->template->set_var('addr_fields',$addr_name_options);
                                }
-                               
$GLOBALS['phpgw']->template->parse('fieldshandle','fields',True);
+                               
$GLOBALS['phpgw']->template->parse('fieldshandle','fields',True);
                        }

                        
$GLOBALS['phpgw']->template->set_var('csv_field','Categories');
                        
$GLOBALS['phpgw']->template->set_var('csv_idx','cat_id');
                        $GLOBALS['phpgw']->template->set_var('trans','');
                        
$GLOBALS['phpgw']->template->set_var('addr_fields',get_categories());
-                       
$GLOBALS['phpgw']->template->parse('fieldshandle','fields',True);
+                       
$GLOBALS['phpgw']->template->parse('fieldshandle','fields',True);

                        
$GLOBALS['phpgw']->template->set_var('csv_field','Access');
                        
$GLOBALS['phpgw']->template->set_var('csv_idx','access');
                        $GLOBALS['phpgw']->template->set_var('trans','');
                        
$GLOBALS['phpgw']->template->set_var('addr_fields',get_access());
-                       
$GLOBALS['phpgw']->template->parse('fieldshandle','fields',True);
+                       
$GLOBALS['phpgw']->template->parse('fieldshandle','fields',True);

                        
$GLOBALS['phpgw']->template->set_var('csv_field','Owner');
                        $GLOBALS['phpgw']->template->set_var('csv_idx','owner');
                        $GLOBALS['phpgw']->template->set_var('trans','');
                        
$GLOBALS['phpgw']->template->set_var('addr_fields',get_owner());
-                       
$GLOBALS['phpgw']->template->parse('fieldshandle','fields',True);
+                       
$GLOBALS['phpgw']->template->parse('fieldshandle','fields',True);

                        
$GLOBALS['phpgw']->template->set_var('lang_start',lang('Startrecord'));
                        
$GLOBALS['phpgw']->template->set_var('start',$_POST['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('ffooterhandle','ffooter');
+                       
$GLOBALS['phpgw']->template->parse('ffooterhandle','ffooter');
                        fclose($fp);
                        $old = $csvfile; $csvfile = 
$GLOBALS['phpgw_info']['server']['temp_dir'].'/addrbook_import_'.basename($csvfile);
-                       rename($old,$csvfile);
+                       rename($old,$csvfile);
                        $hiddenvars .= '<input type="hidden" name="csvfile" 
value="'.$csvfile.'">';
                        $mktime_lotus = "${PSep}0?([0-9]+)[ .:-]+0?([0-9]*)[ 
.:-]+0?([0-9]*)[ .:-]+0?([0-9]*)[ .:-]+0?([0-9]*)[ 
.:-]+0?([0-9]*)address@hidden(${VPre}4,${VPre}5,${VPre}6,${VPre}2,${VPre}3,${VPre}1)";
                        $help_on_trans = "<a name=\"help\"></a><b>How to use 
Translation's</b><p>".
-                               "Translations enable you to change / adapt the 
content of each CSV field for your needs. <br>".
-                               "General syntax is: <b>pattern1 ${ASep} 
replacement1 ${PSep} ... ${PSep} patternN ${ASep} replacementN</b><br>".
+                               "Translations enable you to change / adapt the 
content of each CSV field for your needs. <br />".
+                               "General syntax is: <b>pattern1 ${ASep} 
replacement1 ${PSep} ... ${PSep} patternN ${ASep} replacementN</b><br />".
                                "If the pattern-part of a pair is ommited it 
will match everything ('^.*$'), which is only ".
                                "usefull for the last pair, as they are worked 
from left to right.<p>".
-                               "First example: 
<b>1${ASep}private${PSep}public</b><br>".
+                               "First example: 
<b>1${ASep}private${PSep}public</b><br />".
                                "This will translate a '1' in the CSV field to 
'privat' and everything else to 'public'.<p>".
                                "Patterns as well as the replacement can be 
regular expressions (the replacement is done via ereg_replace). ".
                                "If, after all replacements, the value starts 
with an '@' the whole value is eval()'ed, so you ".
                                "may use all php, phpgw plus your own 
functions. This is quiet powerfull, but <u>circumvents all ACL</u>.<p>".
-                               "Example using regular expressions and 
'@'-eval(): <br><b>$mktime_lotus</b><br>".
+                               "Example using regular expressions and 
'@'-eval(): <br /><b>$mktime_lotus</b><br />".
                                "It will read a date of the form '2001-05-20 
08:00:00.00000000000000000' (and many more, see the regular expr.). ".
                                "The&nbsp;[&nbsp;.:-]-separated fields are read 
and assigned in different order to @mktime(). Please note to use ".
                                "${VPre} insted of a backslash (I couldn't get 
backslash through all the involved templates and forms.) ".
                                "plus the field-number of the pattern.<p>".
                                "In addintion to the fields assign by the 
pattern of the reg.exp. you can use all other CSV-fields, with the ".
-                               "syntax <b>${CPre}CSV-FIELDNAME$CPos</b>. Here 
is an example: <br>".
-                               "<b>.+$ASep${CPre}Company$CPos: 
${CPre}NFamily$CPos, ${CPre}NGiven$CPos$PSep${CPre}NFamily$CPos, 
${CPre}NGiven$CPos</b><br>".
+                               "syntax <b>${CPre}CSV-FIELDNAME$CPos</b>. Here 
is an example: <br />".
+                               "<b>.+$ASep${CPre}Company$CPos: 
${CPre}NFamily$CPos, ${CPre}NGiven$CPos$PSep${CPre}NFamily$CPos, 
${CPre}NGiven$CPos</b><br />".
                                "It is used on the CSV-field 'Company' and 
constructs a something like <i>Company: FamilyName, GivenName</i> or ".
                                "<i>FamilyName, GivenName</i> if 'Company' is 
empty.<p>".
                                "You can use the 'No CSV #'-fields to assign 
csv-values to more than on field, the following example uses the ".
                                "csv-field 'Note' (which gots already assingned 
to the description) and construct a short subject: ".
                                "<b>@substr(${CPre}Note$CPos,0,60).' 
...'</b><p>".
-                               "Their is one important user-function for the 
Info Log:<br>".
+                               "Their is one important user-function for the 
Info Log:<br />".
                                
"<b>@addr_id(${CPre}NFamily$CPos,${CPre}NGiven$CPos,${CPre}Company$CPos)</b> ".
                                "searches the addressbook for an address and 
returns the id if it founds an exact match of at least ".
                                "<i>NFamily</i> AND (<i>NGiven</i> OR 
<i>Company</i>). This is necessary to link your imported InfoLog-entrys ".
-                               "with the addressbook.<br>".
+                               "with the addressbook.<br />".
                                "<b>@cat_id(Cat1,...,CatN)</b> returns a 
(','-separated) list with the cat_id's. If a category isn't found, it ".
                                "will be automaticaly added.<p>".
                                "I hope that helped to understand the features, 
if not <a href='mailto:address@hidden'>ask</a>.";
@@ -249,7 +247,7 @@
                        $log = "<table border=1>\n\t<tr><td>#</td>\n";

                        foreach($addr_fields as $csv_idx => $addr)
-                       {
+                       {
                                $pat_reps = 
explode($PSep,stripslashes($_POST['trans'][$csv_idx]));
                                $replaces = ''; $values = '';
                                if($pat_reps[0] != '')
@@ -300,7 +298,7 @@
                                                                
while(ereg($reg,$val,$vars))
                                                                {       // 
expand all CSV fields
                                                                        $val = 
str_replace($CPre . $vars[1] . $CPos, $val[0] == '@' ? "'"
-                                                                               
. $GLOBALS['phpgw']->db->db_addslashes($fields[index($vars[1], $csv_fields)])
+                                                                               
. addslashes($fields[index($vars[1], $csv_fields)])
                                                                                
. "'" : $fields[index($vars[1], $csv_fields)], $val);
                                                                }
                                                                if($val[0] == 
'@')
@@ -320,7 +318,7 @@
                                                                }
                                                                if($pattern[0] 
!= '@' || $val)
                                                                {
-                                                                       break;
+                                                                       break;
                                                                }
                                                        }
                                                }

====================================================
Index: addressbook/index.php
diff -u addressbook/index.php:1.122 addressbook/index.php:1.123
--- addressbook/index.php:1.122 Tue May 10 13:02:42 2005
+++ addressbook/index.php       Sun May 15 13:34:29 2005
@@ -1,16 +1,18 @@
 <?php
-       /**
-       * Addressbook
-       *
-       * @author Joseph Engo <address@hidden>
-       * @copyright Copyright (C) 2000-2005 Free Software Foundation, Inc. 
http://www.fsf.org/
-       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
-       * @package addressbook
-       * @version $Id$
-       * @internal Funding for this program was provided by 
http://www.checkwithmom.com
-       */
-
+       
/**************************************************************************\
+       * phpGroupWare - Messenger                                              
   *
+       * http://www.phpgroupware.org                                           
   *
+       * This application written by Joseph Engo <address@hidden>         *
+       * --------------------------------------------                          
   *
+       * Funding for this program was provided by http://www.checkwithmom.com  
   *
+       * --------------------------------------------                          
   *
+       *  This program is free software; you can redistribute it and/or modify 
it *
+       *  under the terms of the GNU General Public License as published by 
the   *
+       *  Free Software Foundation; either version 2 of the License, or (at 
your  *
+       *  option) any later version.                                           
   *
+       
\**************************************************************************/

+       /* $Id$ */
        $GLOBALS['phpgw_info'] = array();

        $GLOBALS['phpgw_info']['flags'] = array(
@@ -18,11 +20,6 @@
                'noheader'   => True,
                'nonavbar'   => True
        );
-
-
-       /**
-       * Include phpgroupware header
-       */
        include('../header.inc.php');

        $parms = Array(






reply via email to

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