R32509 - in /trunk/calendar: inc/ setup/

Author: nathangray
New Revision: 32509

URL: http://www.egroupware.org/viewvc/egroupware?rev=32509&view=rev
Log:
Add exporting iCal and CSV via importexport

Added:
trunk/calendar/inc/class.calendar_egw_record.inc.php
- copied, changed from r32506, trunk/addressbook/inc/class.addressbook_egw_record.inc.php
trunk/calendar/inc/class.calendar_export_csv.inc.php
- copied, changed from r32506, trunk/addressbook/inc/class.addressbook_export_contacts_csv.inc.php
trunk/calendar/inc/class.calendar_wizard_export_csv.inc.php
- copied, changed from r32506, trunk/addressbook/inc/class.addressbook_wizard_export_contacts_csv.inc.php
Modified:
trunk/calendar/setup/etemplates.inc.php

Copied: trunk/calendar/inc/class.calendar_egw_record.inc.php (from r32506, trunk/addressbook/inc/class.addressbook_egw_record.inc.php)
URL: http://www.egroupware.org/viewvc/egroupware/trunk/calendar/inc/class.calendar_egw_record.inc.php?p2=trunk/calendar/inc/class.calendar_egw_record.inc.php&p1=trunk/addressbook/inc/class.addressbook_egw_record.inc.php&r1=32506&r2=32509&rev=32509&view=diff

— trunk/addressbook/inc/class.addressbook_egw_record.inc.php (original)
+++ trunk/calendar/inc/class.calendar_egw_record.inc.php Wed Oct 13 00:45:02 2010
@@ -1,28 +1,26 @@

<?php /** - * eGroupWare - Addressbook - importexport + * eGroupWare - Calendar - importexport * * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License - * @package addressbook + * @package calendar * @subpackage importexport * @link http://www.egroupware.org - * @author Cornelius Weiss - * @copyright Cornelius Weiss - * @version $Id: class.egw_addressbook_record.inc.php 22827 2006-11-10 15:35:35Z nelius_weiss $ + * @author Nathan Gray + * @copyright Nathan Gray + * @version $Id$ */ /** - * class addressbook_egw_record + * class calendar_egw_record * compability layer for iface_egw_record needet for importexport */ -class addressbook_egw_record implements importexport_iface_egw_record +class calendar_egw_record implements importexport_iface_egw_record { private $identifier = ''; - private $contact = array(); - private $bocontacts; - - + private $record = array(); + private static $bo; /** * constructor @@ -32,8 +30,12 @@ */ public function __construct( $_identifier='' ){ $this->identifier = $_identifier; - $this->bocontacts = new addressbook_bo(); - $this->contact = $this->bocontacts->read($this->identifier); + if(!is_object($this->bo)) { + $this->bo = new calendar_bo(); + } + if($this->identifier) { + $this->record = $this->bo->read($this->identifier); + } } /** @@ -64,7 +66,7 @@ * @return array complete record as associative array */ public function get_record_array() { - return $this->contact; + return $this->record; } /** @@ -73,10 +75,10 @@ *@return string tiltle */ public function get_title() { - if (empty($this->contact)) { + if (empty($this->record)) { $this->get_record(); } - return $this->contact['fn']; + return $this->record['title']; } /** @@ -86,7 +88,7 @@ * @return void */ public function set_record(array $_record){ - $this->contact = $_record; + $this->record = $_record; } /** @@ -141,8 +143,7 @@ * */ public function __destruct() { - unset ($this->bocontacts); } -} // end of egw_addressbook_record +} // end of calendar_egw_record ?>

Copied: trunk/calendar/inc/class.calendar_export_csv.inc.php (from r32506, trunk/addressbook/inc/class.addressbook_export_contacts_csv.inc.php)
URL: http://www.egroupware.org/viewvc/egroupware/trunk/calendar/inc/class.calendar_export_csv.inc.php?p2=trunk/calendar/inc/class.calendar_export_csv.inc.php&p1=trunk/addressbook/inc/class.addressbook_export_contacts_csv.inc.php&r1=32506&r2=32509&rev=32509&view=diff

— trunk/addressbook/inc/class.addressbook_export_contacts_csv.inc.php (original)
+++ trunk/calendar/inc/class.calendar_export_csv.inc.php Wed Oct 13 00:45:02 2010
@@ -3,18 +3,18 @@

    • @package addressbook
    • @author Nathan Gray
    • @copyright Nathan Gray
    • @version $Id$
      */

/**

    • export plugin of addressbook
    • export CSV plugin of calendar
      */
      -class addressbook_export_contacts_csv implements importexport_iface_export_plugin {
      +class calendar_export_csv implements importexport_iface_export_plugin {

      /**

      • Exports records as defined in $_definition
        @@ -23,32 +23,28 @@
        */
        public function export( $_stream, importexport_definition $_definition) {
        $options = $_definition->plugin_options;
  •   $uicontacts = new addressbook_ui();
    
  •   $selection = array();
    
  •   if ($options['selection'] == 'use_all') {
    
  •   	// uicontacts selection with checkbox 'use_all'
    
  •   	$query = $GLOBALS['egw']->session->appsession('index','addressbook');
    
  •   	$query['num_rows'] = -1;	// all
    
  •   	$uicontacts->get_rows($query,$selection,$readonlys,true);	// true = only return the id's
    
  •   }
    
  •   elseif ( $options['selection'] == 'all_contacts' ) {
    
  •   	$selection = ExecMethod('addressbook.addressbook_bo.search',array());
    
  •   	//$uicontacts->get_rows($query,$selection,$readonlys,true);
    
  •   } else {
    
  •   	$selection = explode(',',$options['selection']);
    
  •   }
    
  •   $this->bo = new calendar_bo();
    
  •   $events =& $this->bo->search(array(
    
  •   	'start' => $options['selection']['start'],
    
  •   	'end'   => $options['selection']['end'],
    
  •   	'categories'	=> $options['categories'] ? $options['categories'] : $options['selection']['categories'],
    
  •   	'enum_recuring' => false,
    
  •   	'daywise'       => false,
    
  •   	'owner'         => $options['owner'],
    
  •   	'date_format'   => $options['date_format'],
    
  •   ));
    
      $export_object = new importexport_export_csv($_stream, (array)$options);
      $export_object->set_mapping($options['mapping']);
    
      // $options['selection'] is array of identifiers as this plugin doesn't
      // support other selectors atm.
    
  •   foreach ($selection as $identifier) {
    
  •   	$contact = new addressbook_egw_record($identifier);
    
  •   	$export_object->export_record($contact);
    
  •   	unset($contact);
    
  •   $record = new calendar_egw_record();
    
  •   foreach ($events as $event) {
    
  •   	$record->set_record($event);
    
  •   	$export_object->export_record($record);
      }
    
  •   unset($record);
    

    }

    /**
    @@ -57,7 +53,7 @@

    • @return string name
      */
      public static function get_name() {
  •   return lang('Addressbook CSV export');
    
  •   return lang('Calendar CSV export');
    

    }

    /**
    @@ -66,7 +62,7 @@

    • @return string descriprion
      */
      public static function get_description() {
  •   return lang("Exports contacts from your Addressbook into a CSV File.");
    
  •   return lang("Exports events from your Calendar into a CSV File.");
    

    }

    /**
    @@ -78,21 +74,28 @@
    return ‘csv’;
    }

  • /**
    • return html for options.
    • this way the plugin has all opertunities for options tab
    • @return string html
  • */
  • public function get_options_etpl() {
  •   return 'addressbook.export_csv_options';
    
  • public static function get_mimetype() {

  •   return 'text/csv';
    

    }

    /**

    • returns slectors of this plugin via xajax
    • return html for options.
  • */
  • public function get_options_etpl() {
  • }
  • /**
    • returns selectors of this plugin
    */
    public function get_selectors_etpl() {
  •   return 'addressbook.export_csv_selectors';
    
  •   return array(
    
  •   	'name'		=> 'calendar.export_csv_select',
    
  •   	'content'	=> array(
    
  •   		'start'		=> time(),
    
  •   		'end'		=> time()
    
  •   	)
    
  •   );
    
    }
    }

Copied: trunk/calendar/inc/class.calendar_wizard_export_csv.inc.php (from r32506, trunk/addressbook/inc/class.addressbook_wizard_export_contacts_csv.inc.php)
URL: http://www.egroupware.org/viewvc/egroupware/trunk/calendar/inc/class.calendar_wizard_export_csv.inc.php?p2=trunk/calendar/inc/class.calendar_wizard_export_csv.inc.php&p1=trunk/addressbook/inc/class.addressbook_wizard_export_contacts_csv.inc.php&r1=32506&r2=32509&rev=32509&view=diff

— trunk/addressbook/inc/class.addressbook_wizard_export_contacts_csv.inc.php (original)
+++ trunk/calendar/inc/class.calendar_wizard_export_csv.inc.php Wed Oct 13 00:45:02 2010
@@ -3,22 +3,25 @@

    • @package addressbook
    • @version $Id: $
    • @version $Id$
      */

-class addressbook_wizard_export_contacts_csv extends importexport_wizard_basic_export_csv
+class calendar_wizard_export_csv extends importexport_wizard_basic_export_csv
{
public function __construct() {
parent::__construct();
// Field mapping

  •   $bocontacts = new addressbook_bo();
    
  •   $this->export_fields = $bocontacts->contact_fields;
    
  •   foreach($bocontacts->customfields as $name => $data) {
    
  •   $bo = new calendar_tracking();
    
  •   $this->export_fields = $bo->field2label;
    
  •   $custom = config::get_customfields('calendar', true);
    
  •   foreach($custom as $name => $data) {
      	$this->export_fields['#'.$name] = $data['label'];
      }
    
  •   unset($this->export_fields['jpegphoto']);        // can't cvs export that
    
  • }

}

Modified: trunk/calendar/setup/etemplates.inc.php
URL: http://www.egroupware.org/viewvc/egroupware/trunk/calendar/setup/etemplates.inc.php?rev=32509&r1=32508&r2=32509&view=diff

— trunk/calendar/setup/etemplates.inc.php (original)
+++ trunk/calendar/setup/etemplates.inc.php Wed Oct 13 00:45:02 2010
@@ -2,7 +2,7 @@
/**
* eGroupWare - eTemplates for Application calendar
* http://www.egroupware.org

    • generated by soetemplate::dump4setup() 2010-10-07 08:23

$templ_data[] = array(‘name’ => ‘calendar.export’,‘template’ => ‘’,‘lang’ => ‘’,‘group’ => ‘0’,‘version’ => ‘1.0.1.001’,‘data’ => ‘a:1:{i:0;a:6:{s:4:“type”;s:4:“grid”;s:4:“data”;a:8:{i:0;a:2:{s:2:“h5”;s:2:",1";s:2:“h1”;s:6:",!@msg";}i:1;a:2:{s:1:“A”;a:3:{s:4:“type”;s:5:“label”;s:4:“span”;s:11:“all,message”;s:4:“name”;s:3:“msg”;}s:1:“B”;a:1:{s:4:“type”;s:5:“label”;}}i:2;a:2:{s:1:“A”;a:3:{s:4:“type”;s:5:“label”;s:4:“size”;s:8:",start";s:5:“label”;s:5:“Start”;}s:1:“B”;a:3:{s:4:“type”;s:4:“date”;s:4:“name”;s:5:“start”;s:4:“help”;s:23:“Startdate of the export”;}}i:3;a:2:{s:1:“A”;a:3:{s:4:“type”;s:5:“label”;s:4:“size”;s:6:",end";s:5:“label”;s:3:“End”;}s:1:“B”;a:3:{s:4:“type”;s:4:“date”;s:4:“name”;s:3:“end”;s:4:“help”;s:21:“Enddate of the export”;}}i:4;a:2:{s:1:“A”;a:3:{s:4:“type”;s:5:“label”;s:4:“size”;s:7:",file";s:5:“label”;s:8:“Filename”;}s:1:“B”;a:3:{s:4:“type”;s:4:“text”;s:4:“name”;s:4:“file”;s:4:“help”;s:24:“Filename of the download”;}}i:5;a:2:{s:1:“A”;a:3:{s:4:“type”;
s:5:“label”;s:4:“size”;s:10:",version";s:5:“label”;s:7:“Version”;}s:1:“B”;a:2:{s:4:“type”;s:6:“select”;s:4:“name”;s:7:“version”;}}i:6;a:2:{s:1:“A”;a:1:{s:4:“type”;s:5:“label”;}s:1:“B”;a:3:{s:4:“type”;s:6:“button”;s:5:“label”;s:8:“Download”;s:4:“name”;s:8:“download”;}}i:7;a:2:{s:1:“A”;a:2:{s:4:“type”;s:5:“label”;s:4:“span”;s:3:“all”;}s:1:“B”;a:1:{s:4:“type”;s:5:“label”;}}}s:4:“rows”;i:7;s:4:“cols”;i:2;s:5:“align”;s:6:“center”;s:7:“options”;a:0:{}}}’,‘size’ => ‘’,‘style’ => ‘’,‘modified’ => ‘1130738737’,);

+$templ_data[] = array(‘name’ => ‘calendar.export_csv_select’,‘template’ => ‘’,‘lang’ => ‘’,‘group’ => ‘0’,‘version’ => ‘1.9.001’,‘data’ => ‘a:1:{i:0;a:6:{s:4:“type”;s:4:“grid”;s:4:“data”;a:5:{i:0;a:1:{s:2:“h1”;s:6:",!@msg";}i:1;a:2:{s:1:“A”;a:3:{s:4:“type”;s:5:“label”;s:4:“span”;s:11:“all,message”;s:4:“name”;s:3:“msg”;}s:1:“B”;a:1:{s:4:“type”;s:5:“label”;}}i:2;a:2:{s:1:“A”;a:3:{s:4:“type”;s:5:“label”;s:4:“size”;s:8:",start";s:5:“label”;s:5:“Start”;}s:1:“B”;a:3:{s:4:“type”;s:4:“date”;s:4:“name”;s:16:“selection[start]”;s:4:“help”;s:23:“Startdate of the export”;}}i:3;a:2:{s:1:“A”;a:3:{s:4:“type”;s:5:“label”;s:4:“size”;s:6:",end";s:5:“label”;s:3:“End”;}s:1:“B”;a:3:{s:4:“type”;s:4:“date”;s:4:“name”;s:14:“selection[end]”;s:4:“help”;s:21:“Enddate of the export”;}}i:4;a:2:{s:1:“A”;a:2:{s:4:“type”;s:5:“label”;s:4:“span”;s:3:“all”;}s:1:“B”;a:1:{s:4:“type”;s:5:“label”;}}}s:4:“rows”;i:4;s:4:“cols”;i:2;s:5:“align”;s:6:“center”;s:7:“options”;a:0:{}}}’,‘size’ => ‘’,‘style’ => ‘’,‘modif
ied’ => ‘1286919523’,);
+
$templ_data[] = array(‘name’ => ‘calendar.freetimesearch’,‘template’ => ‘’,‘lang’ => ‘’,‘group’ => ‘0’,‘version’ => ‘1.3.001’,‘data’ => ‘a:1:{i:0;a:4:{s:4:“type”;s:4:“grid”;s:4:“data”;a:7:{i:0;a:0:{}i:1;a:2:{s:1:“A”;a:3:{s:4:“type”;s:5:“label”;s:4:“span”;s:9:",size120b";s:5:“label”;s:15:“Freetime Search”;}s:1:“B”;a:4:{s:4:“type”;s:5:“label”;s:4:“span”;s:10:",redItalic";s:7:“no_lang”;s:1:“1”;s:4:“name”;s:3:“msg”;}}i:2;a:2:{s:1:“A”;a:2:{s:4:“type”;s:5:“label”;s:5:“label”;s:17:“Startdate / -time”;}s:1:“B”;a:3:{s:4:“type”;s:9:“date-time”;s:4:“name”;s:5:“start”;s:4:“help”;s:33:“Startdate and -time of the search”;}}i:3;a:2:{s:1:“A”;a:2:{s:4:“type”;s:5:“label”;s:5:“label”;s:8:“Duration”;}s:1:“B”;a:4:{s:4:“type”;s:4:“hbox”;s:4:“size”;s:1:“2”;i:1;a:6:{s:4:“type”;s:6:“select”;s:7:“no_lang”;s:1:“1”;s:4:“name”;s:8:“duration”;s:4:“help”;s:23:“Duration of the meeting”;s:8:“onchange”;s:92:“set_style_by_class(‘table’,‘end_hide’,‘visibility’,this.value == ‘’ ? ‘visible’ : ‘hidden
’);”;s:4:“size”;s:12:“Use end date”;}i:2;a:4:{s:4:“type”;s:9:“date-time”;s:4:“name”;s:3:“end”;s:4:“help”;s:57:“Enddate / -time of the meeting, eg. for more then one day”;s:4:“span”;s:9:",end_hide";}}}i:4;a:2:{s:1:“A”;a:2:{s:4:“type”;s:5:“label”;s:5:“label”;s:9:“Timeframe”;}s:1:“B”;a:7:{s:4:“type”;s:4:“hbox”;s:4:“size”;s:1:“5”;i:1;a:3:{s:4:“type”;s:13:“date-houronly”;s:4:“name”;s:10:“start_time”;s:4:“help”;s:19:“Timeframe to search”;}i:2;a:2:{s:4:“type”;s:5:“label”;s:5:“label”;s:3:“til”;}i:3;a:3:{s:4:“type”;s:13:“date-houronly”;s:4:“name”;s:8:“end_time”;s:4:“help”;s:19:“Timeframe to search”;}i:4;a:2:{s:4:“type”;s:5:“label”;s:5:“label”;s:8:“Weekdays”;}i:5;a:4:{s:4:“type”;s:10:“select-dow”;s:4:“size”;s:1:“3”;s:4:“name”;s:8:“weekdays”;s:4:“help”;s:25:“Weekdays to use in search”;}}}i:5;a:2:{s:1:“A”;a:4:{s:4:“type”;s:6:“button”;s:5:“label”;s:10:“New search”;s:4:“name”;s:6:“search”;s:4:“help”;s:36:“new search with the above parameters”;}s:1:“B”;a:4:{s:4:“type”;s:4:“hbox”;s:4:“size”
;s:1:“2”;i:1;a:4:{s:4:“type”;s:6:“select”;s:7:“no_lang”;s:1:“1”;s:4:“name”;s:13:“search_window”;s:4:“help”;s:34:“how far to search (from startdate)”;}i:2;a:5:{s:4:“type”;s:6:“button”;s:4:“name”;s:6:“cancel”;s:5:“label”;s:6:“Cancel”;s:4:“help”;s:16:“Close the window”;s:7:“onclick”;s:15:“window.close();”;}}}i:6;a:2:{s:1:“A”;a:4:{s:4:“type”;s:8:“template”;s:4:“size”;s:8:“freetime”;s:4:“span”;s:3:“all”;s:4:“name”;s:4:“rows”;}s:1:“B”;a:1:{s:4:“type”;s:5:“label”;}}}s:4:“rows”;i:6;s:4:“cols”;i:2;}}’,‘size’ => ‘’,‘style’ => ‘.size120b { text-size: 120%; font-weight: bold; }
.redItalic { color: red; font-style: italic; }
.end_hide { visibility: hidden; }’,‘modified’ => ‘1149297367’,);


Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3.
Spend less time writing and rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb


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