global calendar events
Rob Lineweaver
rlineweaver@harrisonburg.k12.va.us
Wed, 09 Jan 2002 13:36:11 -0500
---------------------- multipart/mixed attachment
Hi folks,
I'm new to hacking around with kronolith but my users are requesting the
ability to have me create calendar events that are visible to everyone but
only modifiable by me. In my K-12 school environment, this would be for
events like spring break, first day of school, holidays, exams, etc.
If this capability is already present, I could not find out how to do it.
The attached patch enables basic functionality of this feature. It works
only with the SQL driver, and patches only the file lib/Driver/sql.php. To
use it you will also have to add something like the following to your
config/conf.php for kronolith:
------
// This is the calendar_id (for in the sql database) for
// "global" events (seen by everyone). Usually no reason to change this.
$conf['calendar']['params']['global_id'] = 'global_calendar_id';
------
How it works: in the SQL table kronolith_events, the value of an event's
calendar_id is usually the user's email address. Now, global events will
have a calendar_id of global_calendar_id (or whatever is set in conf.php).
When listing calendar events the sql driver will return both the user's
personal events as well as any global events.
The global events are protected from users changing them at the level of the
sql driver. This means, currently, that it LOOKS to users like they can
edit or delete the global events but in reality nothing happens when they
try to do so.
To create a global event, you would first create the event as yourself.
Then using your favorite MySQL utility, change the calendar_id of the newly
created event from your email address to global_calendar_id. Voila.
If there is interest in further development of this feature, I could look
into doing the following:
1. have global events appear without the trash can, and without the "Save
Event", etc. buttons on the edit page (so users can't even try to edit them)
2. set up an array of calendar administrators who are allowed to create and
edit global events (so nobody has to dig into the backend database to do it)
3. mcal support?
If global events are already possible with kronolith/sql then somebody
please set me straight and tell me to stop wasting my time hacking.
Thanks,
Rob Lineweaver
:)
---------------------- multipart/mixed attachment
LS0tIGtyb25vbGl0aC1jdnNvcmlnL2xpYi9Ecml2ZXIvc3FsLnBocAlXZWQgRGVjIDE5IDE2
OjQzOjA4IDIwMDEKKysrIGtyb25vbGl0aC9saWIvRHJpdmVyL3NxbC5waHAJV2VkIEphbiAg
OSAxMTo0MTo0OSAyMDAyCkBAIC0xMjMsNyArMTIzLDggQEAKICAgICAgICAgJGV0aW1lID0g
c3ByaW50ZigiJyUwNGQtJTAyZC0lMDJkIDAwOj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RVJFIGV2ZW50X2lkID0gJGV2ZW50SUQgQU5E
IGNhbGVuZGFyX2lkICE9ICIgCisJICAgIAkuICR0aGlzLT5kYi0+cXVvdGUoJHRoaXMtPnBh
cmFtc1snZ2xvYmFsX2lkJ10pOwogICAgICAgICAgICAgCiAgICAgICAgICAgICBpZiAoREI6
OmlzRXJyb3IoJHJlcyA9ICR0aGlzLT5kYi0+cXVlcnkoJHF1ZXJ5KSkpIHsKICAgICAgICAg
ICAgICAgICB2YXJfZHVtcCgkcmVzKTsKQEAgLTMxOCw3ICszMjAsOCBAQAogICAgIAogICAg
IGZ1bmN0aW9uIGRlbGV0ZUV2ZW50KCRldmVudElEKQogICAgIHsKLSAgICAgICAgJHF1ZXJ5
ID0gJ0RFTEVURSBmcm9tICcgLiAkdGhpcy0+cGFyYW1zWyd0YWJsZSddIC4gIiBXSEVSRSBl
dmVudF9pZCA9ICRldmVudElEIjsKKyAgICAgICAgJHF1ZXJ5ID0gJ0RFTEVURSBmcm9tICcg
LiAkdGhpcy0+cGFyYW1zWyd0YWJsZSddIC4gIiBXSEVSRSBldmVudF9pZCA9ICRldmVudElE
IEFORCBjYWxlbmRhcl9pZCAhPSAiCisJCS4gJHRoaXMtPmRiLT5xdW90ZSgkdGhpcy0+cGFy
YW1zWydnbG9iYWxfaWQnXSk7CiAgICAgICAgIGlmIChEQjo6aXNFcnJvcigkcmVzID0gJHRo
aXMtPmRiLT5xdWVyeSgkcXVlcnkpKSkgewogICAgICAgICAgICAgdmFyX2R1bXAoJHJlcyk7
CiAgICAgICAgICAgICByZXR1cm4gZmFsc2U7Cg==
---------------------- multipart/mixed attachment--