DEPRECATION WARNING
This documentation is not using the current rendering mechanism and is probably outdated. The extension maintainer should switch to the new system. Details on how to use the rendering mechanism can be found here.
EXT: fe editable events for Extended Calendar¶
Created: | 2005-04-16T18:21:17 |
---|---|
Changed by: | Herbert Roider |
Changed: | 2006-01-29T19:46:49 |
Email: | herbert.roider@utanet.at |
EXT: fe editable events for Extended Calendar¶
Extension Key: calendar_ext
Copyright 2000-2006, herbert.roider@utanet.at, <herbert.roider@utanet.at>
This document is published under the Open Content License
available from http://www.opencontent.org/opl.shtml
The content of this document is related to TYPO3
- a GNU/GPL CMS/Framework available from www.typo3.com
Table of Contents¶
EXT: fe editable events for Extended Calendar 1
Introduction 1
What does it do? 1
Screenshots 2
Users manual 4
Reference 4
Example 6
Tutorial 7
Known Problem 7
Introduction¶
What does it do?¶
- This extention extend the Extended Calendar -Extention (Extention key: calendar), so fe-users can edit calendaritems
- On the eventpage of the calendar-extention a link to the page which contains the formular can be set in the event-template.
- If you call the event page without url-parameters, it shows a list of the events.
- It use the jscalendar 1.0 to edit the dates.but this is optional .
Screenshots¶
Detailview of the event-page with the link to the formular-page shown above (brown bar at the bottom). Formular for editing of events:
This shows the editing formular, which appears, when a user clicks on the edit-link of the eventview (shown at the screenshot above). This looks very generic, but it isn't!You are very free to change the template. I made standardtemplate very simple. Simply copy the standardtemplate from the template-folder of the extention and change it, and change the templatefile in the typoscript as described below.
Users manual¶
This extention extend the Extended Calendar -Extention, so fe-users can edit calendar items. Two new fields are added to the table tx_calendar_item: tx_calendarext_fe_cruser_id and tx_calendarext_fe_crgroup_id. This field take the uid and the first group-uid of the fe_users. So the fe_user can edit his own record, or if configured, the records of his groups.
The plugin.fe.calendar_item provides the formular for editing. It contains the same properties as “fe_adminLib.inc”, plus the properties describe as follow. The property “allowedGroups” is the same as in fe_adminLib.inc, but it also takes a “*”-Symbol for all fe_groups.
This extention is tested with Extended Calendar 1.1.3. and it should work with typo-3.7.0 and 3.8.x.
The Extention uses the ` jscalendar 1.0 <http://www.dynarch.com/projects/calendar/>`_ . But this is optional. The example, which is described in the Tutorial enables the use of the jscalendar. If you want to use this, download it and install it somewhere in your webfolders. The example installation requires the installation in typo3conf/ext/calendar_ext/, but you can change the path in the typoscript template. (“use_jscalendar.path”)
Simply add a new content element: “Extended Calendar Administration” on a page. The fields startingpoint , CODE and Layout are not supported.
Reference¶
plugin.fe.calendar_item (TypoScript)
This is the formular for fe-editing. For the other properties please refer the fe_adminLib.inc : http://typo3.org/documentation/document- library/doc_core_tsref/fe_adminLib_inc/ There some features like required fields which I have not described here.
recycler_pid¶
Property
recycler_pid
Data type
int
Description
point to the recycler page, this is optional
Default
allowedGroups¶
Property
allowedGroups
Data type
string
Description
The property “allowedGroups” is the same as in fe_adminLib.inc, but it also takes a “*”-Symbol for all fe_groups. This means, all fe_users who in the same group as the tx_calendarext_fe_crgroup_id – field, are allowed to edit this record.
Default
fe_userOwnSelf¶
Property
fe_userOwnSelf
Data type
boolean
Description
refer the description for fe_adminLib.inc
Default
use_jscalendar¶
Property
use_jscalendar
Data type
boolean
Description
if you want to use the jscalendar, set this value to 1.
The use of this require another template file! In the folder “template” are 2 template files:
calendar_item_fe_edit.tmpl
and
calendar_item_fe_edit_jscalendar.tmpl
I recommend the use of the jscalendar, because it es really a nice application.
Default
0
use_jscalendar.path¶
Property
use_jscalendar.path
Data type
string
Description
The path to the jscalendar. If you want to use the jscalendar, you have to install it correctly somewhere in your web-folder. For the tutorial below I installed it in:
typo3conf/ext/jscalendar-1.0
but you can change this path.
Default
clearCacheOfPages¶
Property
clearCacheOfPages
Data type
list of integers
Description
The page-ids for which to clear the cache on change a event.. Insert here the ids of month-view, week-view, day-view, event-view and upcoming-view. Refer the description for fe_adminLib.inc.
Default
[tsref:(cObject).TEST]
plugin.tx_calendar_pi1.event (TypoScript)
The extention exdend the calender plugin and add the following properties described in the table below.
edit_pid¶
Property
edit_pid
Data type
int
Description
point to the page with the formular for editing
Default
allowedGroups¶
Property
allowedGroups
Data type
list of integers
Description
this should be the same value as for the plugin.fe.calendar_item
Default
fe_userOwnSelf¶
Property
fe_userOwnSelf
Data type
boolean
Description
this should be the same value as for the plugin.fe.calendar_item
Default
templateFile¶
Property
templateFile
Data type
string
Description
the template File for the event view, you can also insert a template file with the page modul like the other views for month, day and week.
Important: If you insert a template file with the page modul, you must not set this property, because the plugin looks first at this property, if a file is given.
Default
debug¶
Property
debug
Data type
boolean
Description
set this to 1 if you want to debug
Default
0
whereclause¶
Property
whereclause
Data type
string
Description
here you can define additional where-clauses, for example if you want only list all the fourthcoming events, set this to:
“AND (start_date >= UNIX_TIMESTAMP(CURDATE()+0) OR end_date >= UNIX_TIMESTAMP(CURDATE()+0) ) “
The string must begin with “AND”.
This is for the listview.
Default
max_rows¶
Property
max_rows
Data type
int
Description
the count of events, listet on the page. If more events, then a page selector is shown.
Default
[sref:(cObject).TEST]
Subparts and Marks in the template File for the event-view:
Eventlviistew:
Subpart :¶
Subpart
Subpart :
Description
Description:
###TEMPLATE_EVENTLIST###¶
Subpart
###TEMPLATE_EVENTLIST###
Description
the list
###TEMPLATE_EVENT###¶
Subpart
###TEMPLATE_EVENT###
Description
include the same marks and subparts as described in the Extended Calendar – Extention: http://typo3.org/documentation/document- library/calendar/ with the additional subparts described below at the Single event view.
###CREATE_LINK###¶
Subpart
###CREATE_LINK###
Description
create a link to the edit page with the url-parameter to create a new event
###PAGES###¶
Subpart
###PAGES###
Description
if all events fit on a page (less than max_rows) the content of this is not shown. So it is useful to put the mark “###pagelist### and rowcount inside this subpart.
###pagelist###¶
Marker
###pagelist###
Description
create a list with the links to the pages, if more events than max_rows (refer the typoscript properties for the plugin.tx_calendar_pi1.event) .
###rowcount###¶
Marker
###rowcount###
Description
the count of the pages, if more than one page.
###SEARCH_FORM_URL###¶
Marker
###SEARCH_FORM_URL###
Description
is the url to the current page, this is for the search form
###searchstring###¶
Marker
###searchstring###
Description
contains the contens of the searchfield
Single event view:
refer also: http://typo3.org/documentation/document-library/calendar/
Subpart :¶
Subpart
Subpart :
Description
Description:
###TEMPLATE_EVENT###¶
Subpart
###TEMPLATE_EVENT###
Description
the single event refer: http://typo3.org/documentation/document- library/calendar/
###EDIT_LINK###¶
Subpart
###EDIT_LINK###
Description
create a link to the edit page with the url-parameters to edit this event
###DELETE_LINK###¶
Subpart
###DELETE_LINK###
Description
create a link to the edit page with the url-parameters to delete this event
###DETAIL_LINK###¶
Subpart
###DETAIL_LINK###
Description
create a link to the same page, but in the url-parameter the event-id is set, so you get the detail-view of the event. Makes only sense in the eventlist
###BACK_LINK###¶
Subpart
###BACK_LINK###
Description
a link back to the previous page. Makes only sense in the eventlist
Formularpage:
There are much Subpart markers, which are described here: http://typo3.org/documentation/document- library/doc_core_tsref/fe_adminLib_inc/ .
Example¶
This is an example code for the formular page for editing the events. It includes the jscalendar. For this example you have to install it in the folder /typo3conf/ext/calendar_ext/ but you can change this.
plugin.tx_calendar_pi1.event {
edit_pid = 397
allowedGroups = *
fe_userOwnSelf = 0
# only for the list (this selects all events which are in the future or now),
# the string must begin with "AND"
#whereclause = AND (start_date >= UNIX_TIMESTAMP(CURDATE()+0) OR end_date >= UNIX_TIMESTAMP(CURDATE()+0) )
max_rows = 20
# you can also set the template file in the page module.
#Than you must not set a value in templateFile, because this value
# overrides the value in the page module.
templateFile = EXT:calendar_ext/template/event.html
#debug = 1
}
page.config.incT3Lib_htmlmail = 1
plugin.fe.calendar_item {
# This is a exampletemplate for the jscalendar.:
templateFile= EXT:calendar_ext/template/calendar_item_fe_edit_jscalendar.tmpl
# enable the jscalendar:
use_jscalendar = 1
# The path to the jscalendar:
use_jscalendar.path = typo3conf/ext/jscalendar-1.0
#debug = 0
#makes only sense if the table is "fe_user" !!:
#fe_userEditSelf = 0
fe_userOwnSelf = 0
# comma separated list with the fe_group uid, who are allowed to edit the records:
allowedGroups = *
#page, where the records are stored:
pid=391
# optional, if the events should not be deleted:
recycler_pid = 398
# Clear the cache, because a event is changed. This must be
# all of the calendarpages (month, week,day,event,upcoming), without of
# the editpage, because this is not cached by default.
clearCacheOfPages = 396,395,394,393,392
##################
# This is a special feature of the fe_adminLib.inc.
# When a frontenduser create a new event, then the admin get a email with 2 links.
# One link is to approach and one link is to delete the event. It is a really cool feature
# and you should test it.
# Uncomment the following lines and change the email.admin property.
# It is also necessary to insert:
# page.config.incT3Lib_htmlmail = 1
# in your typoscript.
# for further details refer the documentation of the fe_adminLib.inc
#create.overrideValues {
# hidden = 1
#}
#setfixed=1
#setfixed.approve {
# hidden = 0
# _FIELDLIST = uid,pid
#}
#setfixed.DELETE = 1
#setfixed.DELETE._FIELDLIST = uid
#email.fromName = Herbert Roider
## comma separatet list of email addresses:
#email.admin = herbert@localhost
}
#############################################################
# This is to include the header for the jscalendar:
plugin.fe.calendar.header.marks.jscalendar_path.value < plugin.fe.calendar_item.use_jscalendar.path
page.headerData.200 < plugin.fe.calendar.header
Tutorial¶
You have to install the extention Extenden Calendar first (calendar). Then install this extention with the extention manager. This should makes no troubles.
:underline:`Important` :The extention need frontend users !So you have to setup a login-page everywhere in you page-tree.
Insert a calendar in your page as described in the manual of the extended calendar extention.
If the calendar works, you can configure the calendar_ext Extention:
- Insert a new page. this will be our formularpage somewhere in the pagetree.
- Insert the plugin “Extended Calendar Administration” on this page.
- Copy and Paste the example-Typoscript- code from the previus page (plugin.fe.calendar_item) in the setup-field of the Template. This code is for the edit-page and for the eventpage, because of the links for editing and deleting.
- edit the path to the jscalendar in the typoscript
- Change the pid (Typoscriptcode) to the Folder, where the calendar-items are stored.
- create a new sys folder that should be the recycler and change the recycler_pid to the uid of the folder. You also can delete the line with the recycler_id. Then events will be realy deleted.
- Change the plugin.tx_calendar_pi1.event.edit_pid to the pid of the new formular page as described above.
- Change the plugin.fe.calendar_item.clearCacheOfPages to the calendar views, described in the Reference above.
That was it. View the event page with the webbrowser. It should show a list of events. If not then you can create new events by clicking the link “create new event”.
Be careful by editing the template. Links like the delete-link or the edit-link and the back-link should not be modified. At this version the eventlist is shown on the event page, if no urlparameter is given. So I recommend to take the current templatefile from the template directory in “calendar_ext”, because the links should be correct.
There are some hidden fields in the template. Don't delete this fields exept you know what you do. The layout of the formular is very customizeable.
Known Problem¶
There is a problem, if you use utf-8 encoding . If you load the edit-page in the browser, javascript functions insert the current values in the formular fields. I don't know, if it is a problem for 3.8.0 or higher. This is discussed here: http://typo3.org/documentation/mailing-lists/dev-list- archive/thread/59339/
My solution is to change the function getUpdateJS in the file tslib/class.tslib_content.php, but this is not clean.
For this problem exists no really good solution.
function getUpdateJS($dataArray, $formName, $arrPrefix, $fieldList) {
$JSPart='';
$updateValues=t3lib_div::trimExplode(',',$fieldList);
while(list(,$fKey)=each($updateValues)) {
$value = $dataArray[$fKey];
if (is_array($value)) {
reset($value);
while(list(,$Nvalue)=each($value)) {
$JSPart.="
unesc = decodeURIComponent('".rawurlencode($Nvalue)."');
updateForm('".$formName."','".$arrPrefix."[".$fKey."][]',unesc);";
}
} else {
$JSPart.="
unesc = decodeURIComponent('".rawurlencode($value)."');
updateForm('".$formName."','".$arrPrefix."[".$fKey."]',unesc);";
}
}
$JSPart='<script type="text/javascript">
/*<![CDATA[*/ '.$JSPart.'
/*]]>*/
</script>
';
$GLOBALS['TSFE']->additionalHeaderData['JSincludeFormupdate']='<script type="text/javascript" src="'.$GLOBALS['TSFE']->absRefPrefix.'t3lib/jsfunc.updateform.js"></script>';
return $JSPart;
}
EXT: fe editable events for Extended Calendar - 7