R55624 - in /trunk: addressbook/inc/ calendar/inc/ egroupware/api/src/CalDAV/ phpgwapi/inc/

Author: ralfbecker
New Revision: 55624

URL: http://svn.stylite.de/viewvc/egroupware?rev=55624&view=rev
Log:
move egw_ical_iterator to Api\CalDAV\IcalIterator

Added:
trunk/egroupware/api/src/CalDAV/IcalIterator.php
- copied, changed from r55605, trunk/phpgwapi/inc/class.egw_ical_iterator.inc.php
Removed:
trunk/phpgwapi/inc/class.egw_ical_iterator.inc.php
Modified:
trunk/addressbook/inc/class.addressbook_import_vcard.inc.php
trunk/calendar/inc/class.calendar_ical.inc.php

Modified: trunk/addressbook/inc/class.addressbook_import_vcard.inc.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/addressbook/inc/class.addressbook_import_vcard.inc.php?rev=55624&r1=55623&r2=55624&view=diff

— trunk/addressbook/inc/class.addressbook_import_vcard.inc.php (original)
+++ trunk/addressbook/inc/class.addressbook_import_vcard.inc.php Tue Apr 5 01:45:39 2016
@@ -10,6 +10,7 @@

  • @version $Id$
    */

+use EGroupware\Api;

/**

  • Plugin to import vCard files
    @@ -17,7 +18,7 @@
    class addressbook_import_vcard implements importexport_iface_import_plugin {

    private static $plugin_options = array(

  •   'contact_owner'
    
    );

@@ -124,7 +125,7 @@
// Fix for Apple Addressbook
$vCard = preg_replace(’/item\d.(ADR|TEL|EMAIL|URL)/’, ‘\1’, stream_get_contents($_stream));

  •   $contacts = new egw_ical_iterator($vCard, '', $charset, array($this, '_vcard'),array(
    
  •   $contacts = new Api\CalDAV\IcalIterator($vCard, '', $charset, array($this, '_vcard'),array(
      	// Owner (addressbook)
      	$contact_owner
      ));
    

@@ -147,7 +148,7 @@
$count++;
$contacts->next();
}

  •   return $count;
    
    }

@@ -166,8 +167,8 @@
if(!array_key_exists($record[‘owner’], $this->bocontacts->get_addressbooks()))
{
$this->errors[$this->current] = lang(“Unable to import into %1, using %2”,

  •   		common::grab_owner_name($record['owner']),
    
  •   		common::grab_owner_name($this->user)
    
  •   		Api\Accounts::username($record['owner']),
    
  •   		Api\Accounts::username($this->user)
      	);
      	$record['owner'] = $this->user;
      }
    

@@ -220,7 +221,7 @@
} else {
//error_log(METHOD.LINE.array2string($changed).’ Old:’.$old[‘adr_one_countryname’].’ (’.$old[‘adr_one_countrycode’].’) New:’.$_data[‘adr_one_countryname’].’ (’.$_data[‘adr_one_countryname’].’)’);
}

  •   		// Make sure n_fn gets updated
      		unset($_data['n_fn']);
    

@@ -249,8 +250,8 @@
return $result;
}
default:

  •   		throw new egw_exception('Unsupported action: '. $_action);
    
  •   		throw new Api\Exception('Unsupported action: '. $_action);
    
  •   }
    
    }

@@ -289,7 +290,7 @@
$row += $record;
$rows[] = $row;
}

  •   return html::table($rows);
    
  •   return Api\Html::table($rows);
    

    }

    /**
    @@ -380,4 +381,3 @@
    return $this->results;
    }
    } // end of iface_export_plugin
    -?>

Modified: trunk/calendar/inc/class.calendar_ical.inc.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/calendar/inc/class.calendar_ical.inc.php?rev=55624&r1=55623&r2=55624&view=diff

— trunk/calendar/inc/class.calendar_ical.inc.php (original)
+++ trunk/calendar/inc/class.calendar_ical.inc.php Tue Apr 5 01:45:39 2016
@@ -2249,10 +2249,10 @@

	if (!is_array($this->supportedFields)) $this->setSupportedFields();
  •   // we use egw_ical_iterator only on resources, as calling importVCal() accesses single events like an array (eg. $events[0])
    
  •   // we use Api\CalDAV\IcalIterator only on resources, as calling importVCal() accesses single events like an array (eg. $events[0])
      if (is_resource($_vcalData))
      {
    
  •   	return new egw_ical_iterator($_vcalData,'VCALENDAR',$charset,array($this,'_ical2egw_callback'),array($this->tzid,$principalURL));
    
  •   	return new Api\CalDAV\IcalIterator($_vcalData,'VCALENDAR',$charset,array($this,'_ical2egw_callback'),array($this->tzid,$principalURL));
      }
    
      if ($this->tzid)
    

@@ -2317,7 +2317,7 @@
}

/**
    • Callback for egw_ical_iterator to convert Horde_iCalendar_Vevent to EGw event array
    • Callback for Api\CalDAV\IcalIterator to convert Horde_iCalendar_Vevent to EGw event array
    • @param Horde_iCalendar $component
    • @param string $tzid timezone

Copied: trunk/egroupware/api/src/CalDAV/IcalIterator.php (from r55605, trunk/phpgwapi/inc/class.egw_ical_iterator.inc.php)
URL: http://svn.stylite.de/viewvc/egroupware/trunk/egroupware/api/src/CalDAV/IcalIterator.php?p2=trunk/egroupware/api/src/CalDAV/IcalIterator.php&p1=trunk/phpgwapi/inc/class.egw_ical_iterator.inc.php&r1=55605&r2=55624&rev=55624&view=diff

— trunk/phpgwapi/inc/class.egw_ical_iterator.inc.php (original)
+++ trunk/egroupware/api/src/CalDAV/IcalIterator.php Tue Apr 5 01:45:39 2016
@@ -5,11 +5,16 @@

    • @subpackage groupdav

+namespace EGroupware\Api\CalDAV;
+
+use EGroupware\Api;
+use Horde_Icalendar;

// required for tests at the end of this file (run if file called directly)
if (isset($_SERVER[‘SCRIPT_FILENAME’]) && $_SERVER[‘SCRIPT_FILENAME’] == FILE)
@@ -20,7 +25,7 @@
‘nonavbar’ => ‘true’,
),
);

  • include(’…/…/header.inc.php’);
  • include(’…/…/…/header.inc.php’);
    }

/**
@@ -28,7 +33,7 @@
*

  • try {
  • 	$ical_file = fopen($path,'r');
    
    • 	$ical_it = new egw_ical_iterator($ical_file,'VCALENDAR');
      
    • 	$ical_it = new Api\CalDAV\IcalIterator($ical_file,'VCALENDAR');
      
    • }
    • catch (Exception $e)
    • {
      @@ -40,7 +45,7 @@
    • }
    • fclose($ical_file)
      /
      -class egw_ical_iterator extends Horde_Icalendar implements Iterator
      +class IcalIterator extends Horde_Icalendar implements \Iterator
      {
      /
      *
      • File we work on
        @@ -124,7 +129,7 @@
        }
        if (!is_resource($this->ical_file))
        {
  •   	throw new egw_exception_wrong_parameter(__METHOD__.'($ical_file, ...) NO resource! $ical_file='.substr(array2string($ical_file),0,100));
    
  •   	throw new Api\Exception\WrongParameter(__METHOD__.'($ical_file, ...) NO resource! $ical_file='.substr(array2string($ical_file),0,100));
      }
    
    }

@@ -425,12 +430,12 @@
END:VEVENT
END:VCALENDAR
’;

  • common::egw_header();
  • $GLOBALS[‘egw’]->framework->header();
    //$ical_file = fopen(’/tmp/KalenderFelicitasKubala.ics’);
    if (!is_resource($ical_file)) echo “
    $ical_file
    \n”;
    //$calendar_ical = new calendar_ical();
    //$calendar_ical->setSupportedFields(‘file’);
  • $ical_it = new egw_ical_iterator($ical_file);//,‘VCALENDAR’,‘iso-8859-1’,array($calendar_ical,’_ical2egw_callback’),array(‘Europe/Berlin’));
  • $ical_it = new IcalIterator($ical_file);//,‘VCALENDAR’,‘iso-8859-1’,array($calendar_ical,’_ical2egw_callback’),array(‘Europe/Berlin’));
    foreach($ical_it as $uid => $vevent)
    {
    echo “$uid
    ”.print_r($vevent->toHash(), true)."
    \n";


eGroupWare-cvs mailing list
eGroupWare-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/egroupware-cvs