CX_props_addeventlink_text.txt CalendarX 0.5.3(dev) March 26 2005 (last modified for CalendarX 0.5.3) by +lupa+ (lupaz on sf.net, lupa at zurven dot com) Released under the GPL (see LICENSE.txt) Instructions for properties in CX_props_addeventlink. The "Add New Event" link is a means of making it easier for calendar users to add new events to your calendar. It places a link in the SubjectLinks bar that takes users to an appropriate place to add events. Because there are many places/ways that Plone allows you to add events, we've provided several options for how to control who gets what link. Your suggestions (and code) for more options are gratefully accepted. This link now shows up nicely in the new portlet_calendarx, but only for Authenticated members. NOTE: Add New Event links also show up as plus signs (+) in the calendar cells, and send the specified date and time to the newly created Event. However, as of 0.5.3 this does NOT work properly with portal_factory... the proper date and time parameters are not picked up by the temporary event. By default in 0.5.3 the portal_factory is bypassed so that the parameters are properly passed along. There is an easy one-line change in the script called cxCreateEvent in the CalendarX skins folder that will allow you to use portal_factory despite this lack of passed parameters, and it is documented in the code in that script. This is a priority for fixing in a future release of CalendarX. MOD in 0.5.3: changed default for the createObjectOnClickCommand to "cxCreateEvent" which is the name of the new script used by the +links from the previous default Plone script, which was "createObject?type_name=Event". For more info read below. === List of Attributes === title string Leave this title attribute alone. showAddEventLink boolean Check this to include an "Add New Event" link in the SubjectLinks bar. Controls for this link are below. If more than one of the boolean controls below are checked, the ones below will take priority over the ones above. For example, if both useANEFolder and useRolesAndFolders are checked, but the current user does not have one of the specified Roles, then the link target will fall back to the specified ANEFolderPath. The order of these priorities is determined by the code in the Python script "getAddNewEventURL". If no match is found, then a blank string will be returned to the macro, and a condition there will cause NO "Add New Event" link to be shown. This way you can restrict display of this link to only certain users or to users with certain roles. The first two choices (useMemberFolder and useANEFolder) are shown to all Authenticated users, if selected. showAddEventPlusLinks boolean Check this to include the PLUS (+) links in the views to create new events from inside the calendar cells. These links use the cxCreateEvent script, because the standard Plone createObject script does not allow creation of events with other passed parameters (like start_time). NOTE: As of version 0.5.3, these +links do NOT work properly with use of portal_factory. Actually, it works fine but does NOT pass along the proper start and end date/time parameters. By default, the cxCreateEvent script is set to ignore portal_factory, but this behavior is easily changed by customizing the cxCreateEvent script. NOTE: The +links do NOT use the createObjectOnClickCommand string (next property)... that's only for the Add New Event link found in the subjectlinks bar in the header or in the portlet_cx_choices. useCreateObjectOnClick boolean createObjectOnClickCommand string Together, these two properties tell the link to instantiate a new Event object in the target folder. Check this if you want to have the link automatically initiate editing of a new event for the user. Uncheck this property if you want the Add New Event link to simply take the user to a target folder without starting a new Event object automatically. The createObjectOnClickCommand string is the command that is carried in the query string of the link's URL target if you are using the useCreateObjectOnClick property. The default string is: cxCreateEvent which will create a new CMF Event object in the target folder of the link. If you have a different event type that you would like to create, change the string to call the "type_name" parameter with your custom type, like this: cxCreateEvent?type_name=KoolEvent You can replace the meta_name "KoolEvent" with the appropriate meta_name of your desired event type. Alternatively, you can use the command string that uses the default Plone script for object creation, which is: createObject?type_name=Event "cxCreateEvent" which is the name of the new script used by the +links from the previous default Plone script, which was "createObject?type_name=Event". If you use this feature, it is advisable to also set your portal to use the portal_factory for initiating Events, so that if a user clicks on the link to start a new event but then decides not to finish it, the event will not be abandoned half-finished. Portal_factory will simply create a temporary version and then delete it if left unfinished by the user. useMemberFolder boolean Check this so that the link will take users to their default Member folder where they can add Events. useMemberSubfolder boolean memberSubfolderPath string Check this property if you want events to be instantiated in a subfolder of a user's Member folder. For example, if all your users are musicians in bands (or groupies perhaps) and they post their band gigs on the calendar, then you might want all the events to be saved in a specific subfolder, such as "/Members/username/gigs". The proper format for the target folder is relative to the /Members/username folder and should start with a slash, e.g.: "/gigs" NOTE: ONLY use this if you are certain that users WILL have the named subfolder in their user folder. Otherwise it will return 404, page not found error, or something closely related. useANEFolder boolean ANEFolderPath string Together, these allow you to specify a single folder that will be the target of the link. The proper format for the target folder is relative to the portal_root and should start with a slash, e.g.: "/somefolderintheroot/thefolderforevents" This is a nice simple solution for many use cases because it allows neat and clean storage of all events in a single folder. In order to all this to work, you must take the steps necessary in the Plone security to allow your users permission to write events in that folder. For those with only a few users, you can readily use the Sharing tab on that Plone folder -- simply scroll down and do a search on User Names (leave the Search Term field blank and hit Perform Search to list ALL the current User names). Then select the Users desired, and choose Owner from the Role To Assign list, and then click the button to assign this "local" role to the selected users. Another approach is in the ZMI to give access to this folder for ALL of your Authenticated users. Navigate to the folder where you will store your events, click on the Security tab and change the security setting of "Add portal objects" in your ANE folder. In this case, uncheck "Acquire" and check "Authenticated". A bit more neat (so that ONLY events end up in this folder) is to customize the portal workflow so that users create events in their own Members folders, but then when it moves through workflow and is published, the Event is automatically moved into the proper event folder. At this writing there seems to be a HowTo in plone.org/documentation describing this approach. Of course, if you DO use this approach, you won't need to use this useANEFolder property, because you'll likely use the useMemberFolder property instead. useUsersAndFolders boolean listOfUsersAndFolders lines Together, these allow you to specify a combination of a username and a corresponding single folder that will be the target of the link for that specific user. The proper format for each line is as follows: "username|folderpath" where the "pipe" character (a vertical slash) is used as a separator between the username and folder path. The proper format for the target folder is relative to the portal_root and should start with a slash, e.g.: "/somefolderintheroot/thefolderforevents" An example with two possible role|folder lines: lupa|/calendar/specialevents davos|/calendar/drearyevents If no matching username is found, the priority rules described above will take over to find a suitable target for the user. useRolesAndFolders boolean listOfRolesAndFolders lines Together, these allow you to specify a combination of a Role and a corresponding single folder that will be the target of the link for all users with that Role. The proper format for each line is as follows: "rolename|folderpath" where the "pipe" character (a vertical slash) is used as a separator between the role name and folder path. The proper format for the target folder is relative to the portal_root and should start with a slash, e.g.: "/somefolderintheroot/thefolderforevents" An example with two possible role|folder lines: Manager|/calendar/specialevents Member|/calendar/ordinaryevents The lookup stops when a matching role is found for the user. For example, if the Manager logs in, the link for the Manager will target the folder called "specialevents", even though the Manager is also (likely) a Member of the site. If no matching role is found, the priority rules described above will take over to find a suitable target for the user. Again, you'll need to take the proper steps to make sure the permissions are set appropriately for your members to add events in those folders... CalendarX is not going to presume to do this for you.