Fixing http%3A bug for after adding a new iCal Calendar
[plans.git] / plans_config.pl
blobe8cc69a4f3452be51d6313081b1161cb30bd2cef
1 ########################################################################################################
2 ############################### Plans config file ##############################################
3 ########################################################################################################
4 # This file stores installation-specific settings for the plans calendar.
5 # You may need to change them to match how your server or site is set up.
7 # Each time plans runs, it looks for this file in the same directory
8 # plans.cgi is in. If found, this file is compiled with the rest of
9 # plans. The following statements are perl code.
12 ########################################################################################################
13 ############################### File Locations #############################################
14 ########################################################################################################
15 # This is the default file structure for plans:
17 # plans/
18 # plans.cgi
19 # plans.config
20 # data/
21 # *.xml
22 # theme/
23 # plans.template
24 # plans.css
25 # icons/
26 # graphics/
28 # The theme/ directory contains static files (.css, .js, .gif)
29 # If your server does't allow static files be served from the same
30 # directory (or subdirectories) as scripts,
32 # You can move the theme directory to somewhere outside the plans directory.
33 # If you do this, uncomment the variable below and set it accordingly.
34 # You'll also need to change the default template file in the next section.
35 # $theme_url = "http://www.yoursite.com/theme_directory"; # note there is no end slash!
39 ########################################################################################################
40 ############################### Calendar URL #################################################
41 ########################################################################################################
42 # Plans tries to automatically detect (by asking your webserver) the URL of the installation.
43 # Some webservers don't support this, in which case, some links won't work (like the 'add event' and
44 # 'calendar settings' tabs.
45 # You can fix the problem by uncommenting the line below and setting the URL accordingly:
46 # $options{calendar_url} = 'http://www.yoursite.com/your_plans_directory/';
50 ########################################################################################################
51 ############################### Default Template #################################################
52 ########################################################################################################
53 # All calendars use the same default template file.
55 # Eacn calendar in Plans can have its own custom template file, which override the default file.
56 # this custom template file must be an URL (plans will fetch it across the network, even
57 # if it resides on the same server). This increases security and allows template files to
58 # come from other websites.
60 # If a calendar doesn't specify a custom template file, or plans is unable to fetch a calendar's custom
61 # template file, it will use the default template file below.
63 $options{default_theme_path} = "theme"; # IMPORTANT -- this is not an URL. It's a filesystem path.
65 # On some unix hosts, you need to specify the entire path,
66 # like: "/home/path/to/plans/theme/theme"
68 # On a windows host, the you might need something
69 # like: "C:/path/to/plans/theme"
71 $options{default_template_path} = "$options{default_theme_path}/plans.template";
75 ########################################################################################################
76 ############################### Language ##############################################
77 ########################################################################################################
78 # All user-facing text is stored in a table. When Plans runs, it sources $options{language_file}, which
79 # fills the table with the appropriate stuff.
80 $options{language_files} = "us_english.pl";
81 $options{js_language_file} = "plans_lang.js"; # The first time it runs, and after each upgrade
82 # plans automatically translates the language strings
83 # in its language file(s) into a javascript language file.
85 $options{generate_js_lang} = 0; # this line forces plans to regenerate the javascript language file
86 # every time it runs. If you are testing a translation, set this to 1.
89 ########################################################################################################
90 ############################### Users & Permissions ###################################
91 ########################################################################################################
92 # If you're on an intranet or private server, you can disable
93 # passwords in Plans entirely by setting this option to 1.
94 $options{disable_passwords} = 0;
96 # Set this option to 1 if you want plans to use sessions. You won't have to type passwords over and over again.
97 # This requires the CGI::Session perl module.
98 $options{sessions} = 0;
100 # You may want to force anyone accessing Plans
101 # to login before doing anything. If so then set this to 1.
102 # NOTE - this requires $options{sessions} = 1
103 $options{force_login} = 0;
105 # Events added without the proper password will be stored for
106 # approval by a calendar user or admin. (ignored if passwords are disabled),
107 $options{anonymous_events} = 0;
110 # Requests for new calendars are for approval by an admin.
111 # Disabling this option (possibly because of spam) prevents people from submitting new calendar requests
112 # unless they logged in or supply a password
113 $options{anonymous_calendar_requests} = 1;
116 # If this is 1, calendar admins will have the ability to add 'users' to their calendar.
117 # each user has a name & password of their own.
118 # users can add and edit events, but not change calendar settings.
119 $options{users} = 0;
122 $options{pending_events_display} = 0; # display is different from approval
123 # approval is always by logged-in user or admin
125 # 0 = public - everyone sees *all* pending events
126 # 1 = users - everyone sees pending events for the calendar they're viewing.
127 # 2 = users & admins - only logged-in users see pending events for the calendar they're viewing.
128 # 3 = admins only - only calendar admins see pending events for the calendar they're viewing.
130 # The "salt" variable is used by the encryption algorithm that plans uses to store passwords.
132 # If you want your encrypted passwords to look different from everyone else's encrypted passwords,
133 # change this value to a different (random) string.
135 # However, if you change the salt, all your existing passwords (including the default calendars supplied with Plans)
136 # won't work! You'll have to change them individually, by re-generate them by hand with the new salt value.
138 # If you are enough of a security guru to want to change the salt, re-generating the passwords should be no problem :)
139 $options{salt} = "NaCl";
143 ########################################################################################################
144 ############################### Timezones #############################################
145 ########################################################################################################
146 # Each calendar in Plans can have its own timezone. While this is handy for some folks,
147 # it causes confusion if timezones are changed by accident.
148 # Keep this switch set at 1 to force all calendars to use the main calendar's timezone.
149 $options{force_single_timezone} = 1;
151 ########################################################################################################
152 ############################### Event Times ###########################################
153 ########################################################################################################
154 # New events in Plans are all-day events by default
155 # You can set this switch to 0 to make new events have an event time by default
156 $options{new_events_all_day} = 0;
157 $options{twentyfour_hour_format} = 0;
159 if ($options{twentyfour_hour_format}) {
160 $options{default_event_start_time} = "9:00";
161 $options{default_event_end_time} = "18:00";
162 } else {
163 $options{default_event_start_time} = "9:00 am";
164 $options{default_event_end_time} = "5:00 pm";
169 ########################################################################################################
170 ############################### Selecting Multiple Calendars ##################################
171 ########################################################################################################
172 # Each event in Plans is associated with a calendar.
173 # If this switch is 1, all calendars will always appear in the calendar controls dropdown.
175 # If this switch is 0, each calendar gets to choose what other calendars will be in the dropdown
176 # when it's the active calendar. This can be used to manage a large hierarchy of calendars, but it
177 # requires more oversight, especially when creating new calendars.
179 $options{all_calendars_selectable} = 1;
181 # If this variable is 1, new calendars will automatically be added to all existing
182 # calendars' drop-down selections at creation time.
183 # this option has no visible effect if $options{all_calendars_selectable} = 1.
184 $options{new_calendars_automatically_selectable} = 1;
186 # if $options{calendar_select_order} is blank (totally commented out), calendars will
187 # be listed on the dropdown menu in the order they were created.
188 # You can change this by setting $options{calendar_select_order} to "alpha" (sort alphabetically)
189 # or by explicitly ordering the calendars by id(you may have to look at the calendar data to find the id).
190 #$options{calendar_select_order} = "alpha";
191 #$options{calendar_select_order} = "0,3,4,1,6,7,8";
194 ########################################################################################################
195 ############################### Multi-calendar events ########################################
196 ########################################################################################################
197 # Each event in Plans is associated with one calendar by default.
198 # However, individual events can be associated with multiple calendars
199 # (This is different from Plans' ability to merge entire calendars)
201 # 0 = single calendar (events allowed to be under only one calendar)
203 # 1 = multi-calendar, single password (events can be under multiple calendars,
204 # but only the password from the original calendar can be used to modify the event)
206 # 2 = multi-calendar, multi-password (events can be under multiple calendars,
207 # and any of their passwords can be used to modify the event.)
209 $options{multi_calendar_event_mode} = 0;
213 ########################################################################################################
214 ############################### View Types ############################################
215 ########################################################################################################
216 # Here you can turn on of off Plans' various view types.
217 # This affects the "display" menu in the calendar controls.
218 # 1 to enable, 0 to disable.
219 $options{display_types}[0] = 1; # calendar view
220 $options{display_types}[1] = 1; # list view
221 $options{display_types}[2] = 0; # daily view with event details (not implemented yet!)
225 ########################################################################################################
226 ############################### Data storage #############################################
227 ########################################################################################################
228 # subdirectory beneath plans, where .xml files are kept
229 $options{data_directory} = "data";
231 # You can store calendar data in flat files or a database (like mySQL).
232 # The default storage mode is plain text files.
233 # you can switch modes at any time--plans will convert your existing data.
234 # 0 = flat text files
235 # 1 = mysql
236 # 2 = MS Sql server
237 $options{data_storage_mode} = 0;
239 # This is where plans keeps information that it "discovers". See the file for more details.
240 $options{discovery_file} = "$options{data_directory}/plans_discovery.xml";
242 # This subdirectory is where plans keeps sessions files.
243 $options{sessions_directory} = "sessions";
247 ################################ Flat-file mode (mode 0) ##########################################
248 ########################################################################################################
249 $options{events_file} = "$options{data_directory}/events.xml"; # events for all calendars.
250 $options{pending_actions_file} = "$options{data_directory}/pending_actions.xml"; # new (not yet approved) events
251 $options{calendars_file} = "$options{data_directory}/calendars.xml"; # settings for calendars
252 $options{users_file} = "$options{data_directory}/users.xml"; # users.
254 ################################# SQL DBI mode (modes > 0) ########################################
255 # Perl's database abstraction layer (DBI) can talk to most SQL database types.
256 ########################################################################################################
257 if ($options{data_storage_mode} > 0) {
258 $dbh; # define global database handle
260 require DBD::mysql if ($options{data_storage_mode} == 1); # The driver for the database type you'll be using.
261 require DBD::ODBC if ($options{data_storage_mode} == 2);
264 $options{db_name} = "db_name"; # The name of the database (you have to create it on your own first)
265 $options{db_hostname} = "db_host.domain.com:port"; # The database hostname and port
266 $options{db_username} = "db_user"; # The username you'll use to connect
267 $options{db_password_file} = "../plans_mysql.pwd"; # Put the DB password in this file.
268 # Make sure this file is *not* publically
269 # readable (chmod 400 on unix)
271 # You don't have to create these tables.
272 # Plans will do it for you.
273 $options{calendars_table} = "calendars"; # Table for storing calendar settings.
274 $options{events_table} = "events"; # Table for storing event data.
275 $options{pending_actions_table} = "pending_actions"; # Table for storing pending events & calendars.
276 $options{users_table} = "users"; # Table for storing calendar users.
280 # open the password file
281 open (FH, "$options{db_password_file}") || {$debug_info.= "unable to open file $options{db_password_file}\n"};
282 flock FH,2;
283 $options{mysql_password}=<FH>;
284 close FH;
285 chomp $options{mysql_password};
287 # connect to the db host
288 if ($options{data_storage_mode} == 1) {
289 if (!($dbh = DBI->connect("DBI:mysql:database=$options{db_name};host=$options{db_hostname}","$options{db_username}","$options{mysql_password}"))) {
290 $fatal_error=1;
291 $error_info.= "DB connect error! $DBI::errstr";
292 return 1;
294 } elsif ($options{data_storage_mode} == 2) {
295 if (!($dbh = DBI->connect("DBI:ODBC:database=$options{db_name};host=$options{db_hostname}","$options{db_username}","$options{mysql_password}",{LongReadLen=>1040000, LongTruncOk=>1}))) {
296 $fatal_error=1;
297 $error_info.= "DB connect error! $DBI::errstr";
298 return 1;
304 ########################################################################################################
305 ############################### Email #############################################
306 ########################################################################################################
307 # Plans can send email reminders to visitors
308 # If this is turned on, an email reminder link will appear in the event details.
309 # If a user clicks on it, a record will be added to $options{email_reminders_datafile}
310 # This file is read by email_reminders.cgi, which is what actually sends the email.
312 # email_reminders.cgi does not run automatically when Plans runs. You have to run it
313 # as a cron job (unix) or a scheduled task (windows). You can also run email_reminders.cgi
314 # manually from the command line, or by pointing your browser at it.
316 $options{email_mode} = 1; # 0 = off
317 # 1 = sendmail (unix)
318 # 2 = STMP (windows)
320 if ($options{email_mode} == 1) {
321 $options{sendmail_location} = "/usr/sbin/sendmail";
322 } elsif ($options{email_mode} == 2) {
323 require Net::SMTP;
324 $options{mail_server}="127.0.0.1";
325 $smtp = Net::SMTP->new($options{mail_server});
328 $options{reply_address} = "your\@address.com"; # used for the "reply-to" field of reminder emails
329 $options{from_address} = "your\@address.com"; # used for the "from"field of reminder emails
330 $options{email_reminders_datafile} = "$options{data_directory}/email_reminders.xml"; # xml file where email reminder data is kept.
333 $options{new_calendar_request_notify} = "your\@address.com"; # send an email here when someone requests a new calendar
336 ########################################################################################################
337 ############################### Tabs #############################################
338 ########################################################################################################
339 # You can disable tabs by uncommenting the array below
340 # Specify the numbers of the tabs not to be shown (numbers start with 0)
341 #@disabled_tabs = (0,1,2);
343 # If you want to remove all the tabs, an easier
344 # way is to remove the ###tab menu stuff###
345 # tag from the plans.template file.
348 ########################################################################################################
349 ############################ Right-click menus #########################################
350 ########################################################################################################
351 # If you right-click on a day or event, you get a drop-down menu
352 # with entries like "add event on this day".
353 # To disable these menus, set the following variable to 0.
354 $options{right_click_menus_enabled} = 1;
356 ########################################################################################################
357 ############################ Upcoming Events #########################################
358 ########################################################################################################
359 # You can adjust the value used for the "Cache-control" http header
360 # that is sent back when upcoming events are fetched.
361 # This causes the client browser to use its cached copy of the upcoming events data,
362 # so it won't hit the server for each page load.
363 $options{upcoming_events_cache_seconds} = 0;
366 ########################################################################################################
367 ############################# Event Background Colors ###########################################
368 ########################################################################################################
369 # set this to 1 to have the descriptions in the
370 # second column appear on the colors in the dropdown menu.
371 $options{show_event_background_color_descriptions} = 0;
373 # You can change these or add more.
374 $event_background_colors = <<p1;
375 #ffffff White
376 #eeeeee Off-white
377 #66cc66 Dark Green
378 #99ffcc Sea Green
379 #ccffcc Pastel Green
380 #ccffff Blue
381 #99ccff Darker blue
382 #addadd
383 #ffaa99 Red-orange
384 #ffcc99 Orange
385 #ffddbb Peach
386 #ffccff Pink
387 #eeddff Light Pink
388 #efe7de Tan
389 #fffbba Light orange
390 #ffffcc Yellow
391 #daddad
392 #cabcab
396 # Make sure there are no spaces or tab characters
397 # after the "p1", on the same line. This is a
398 # source of errors for those who aren't familiar with perl :)
400 ########################################################################################################
401 ############################# Default Details ###########################################
402 ############################# (for new calendars) ###########################################
403 ########################################################################################################
404 # You may want some boilerplate text in the "details" section of a
405 # new calendar.
407 $new_calendar_default_details = "You must include a contact email address for the calendar to be approved.";
410 ########################################################################################################
411 ################################ Event Icons #############################################
412 ########################################################################################################
413 # If you want to add your own icons,
414 # you'll need:
415 # - three copies of your icon in the $theme_url/icons/ directory
416 # - a 50 x 50 version, named my_icon_50x50.gif
417 # - a 32 x 32 version, named my_icon_32x32.gif
418 # - a 16 x 16 version, named my_icon_16x16.gif
419 # - a new entry in the menu structure below
421 # The icon menu structure looks like HTML, but it's not really. It's an XML
422 # format that is translated by plans into html. Most browsers display nested submenus
423 # in "flattened" groups, which looks ok. Someday, browsers will support real
424 # nested menus. It's possible to use javascript to fake this, but it's flaky
425 # and has problems with browser form elements.
426 # see http://www.brainjar.com/css/positioning/default5.asp for technical details.
429 $event_icons_menu =<<p1;
430 <menuitem value="blank">Blank (no icon)</menuitem>
431 <menu name="General Icons">
432 <menuitem value="clipboard">Clipboard & pencil</menuitem>
433 <menuitem value="bullet_point">Bullet point</menuitem>
434 <menuitem value="exclamation">Exclamation point</menuitem>
435 <menuitem value="clock">Clock</menuitem>
436 <menuitem value="church">Church</menuitem>
437 <menuitem value="us_flag">Stars & Stripes</menuitem>
438 <menuitem value="news">News</menuitem>
439 <menuitem value="1st_aid">First Aid</menuitem>
440 </menu>
441 <menu name="Outdoor Icons">
442 <menuitem value="bike">Bike</menuitem>
443 <menuitem value="fire">Campfire</menuitem>
444 <menuitem value="axe">Axe</menuitem>
445 <menuitem value="canoe">Canoe</menuitem>
446 <menuitem value="compass">Compass</menuitem>
447 <menuitem value="fish">Fish</menuitem>
448 <menuitem value="e_frame_pack">Pack (ext. frame)</menuitem>
449 <menuitem value="i_frame_pack">Pack (int. frame)</menuitem>
450 <menuitem value="snowflake">Snowflake</menuitem>
451 <menuitem value="tent">Tent</menuitem>
452 </menu>
454 # Again, be careful to avoid putting any characters
455 # (normal or whitespace) after the "p1", on the same line. This is a
456 # source of errors for those who aren't familiar with perl :)
459 ########################################################################################################
460 ############################### iCal Proxy ###############################################
461 ########################################################################################################
462 # In order to access google or other iCal calendars through a proxy server
463 # use the below to set the proxy server and respective port.
464 $options{proxy_server} = "";
465 $options{proxy_port} = "";
467 ########################################################################################################
468 ################################ Other options #############################################
469 ########################################################################################################
471 # Plans was originally devloped as a calendar for a scout troop. This
472 # feature is a holdover from those days. For it to work correctly,
473 # the graphics for unit number icons must be present in the $graphics_url.
474 $options{unit_number_icons} = 0;
477 # if this option is set to 1, you'll be able to add iCal calenars from the "Calendar Settings" tab.
478 $options{ical_import} = 1;
480 return 1;