aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Jardine <kevinjardine@yahoo.com>2011-06-27 12:49:05 +0200
committerKevin Jardine <kevinjardine@yahoo.com>2011-06-27 12:49:05 +0200
commitc07218b9c7b256e998f0a31c0226b3bd6d8011d7 (patch)
treeb13c83d01bf4cb488a783a4b65cdfc9837bdc514
parent446a0679509f2206cbf26f4a795fe0468b715f64 (diff)
downloadelgg-c07218b9c7b256e998f0a31c0226b3bd6d8011d7.tar.gz
elgg-c07218b9c7b256e998f0a31c0226b3bd6d8011d7.tar.bz2
added main code
-rw-r--r--trunk/CHANGES.txt150
-rw-r--r--trunk/CONTRIBUTIONS.txt7
-rw-r--r--trunk/README.txt83
-rw-r--r--trunk/actions/add_to_group.php11
-rw-r--r--trunk/actions/addtocalendar.php36
-rw-r--r--trunk/actions/killrequest.php23
-rw-r--r--trunk/actions/manage.php105
-rw-r--r--trunk/actions/remove_from_group.php8
-rw-r--r--trunk/actions/request_personal_calendar.php18
-rw-r--r--trunk/actions/toggle_personal_calendar.php30
-rw-r--r--trunk/datepicker.css234
-rw-r--r--trunk/delete_confirm.php36
-rw-r--r--trunk/display_event_users.php42
-rw-r--r--trunk/flora.datepicker.css234
-rw-r--r--trunk/images/calendar.gifbin0 -> 269 bytes
-rw-r--r--trunk/images/event_icon.gifbin0 -> 1254 bytes
-rw-r--r--trunk/images/event_icon_old.gifbin0 -> 1531 bytes
-rw-r--r--trunk/images/river_icon_event.gifbin0 -> 586 bytes
-rw-r--r--trunk/languages/en.php210
-rw-r--r--trunk/languages/es.php124
-rw-r--r--trunk/languages/fr.php125
-rw-r--r--trunk/manage_event.php57
-rw-r--r--trunk/manifest.xml10
-rw-r--r--trunk/models/model.php1045
-rw-r--r--trunk/pages/review_requests.php33
-rw-r--r--trunk/show_event.php60
-rw-r--r--trunk/show_events.php213
-rw-r--r--trunk/start.php190
-rw-r--r--trunk/ui.core.min.js9
-rw-r--r--trunk/ui.datepicker.css62
-rw-r--r--trunk/ui.datepicker.js212
-rw-r--r--trunk/ui.datepicker.min.js12
-rw-r--r--trunk/ui.datepicker.packed.js2
-rw-r--r--trunk/views/default/event_calendar/agenda_footer.php5
-rw-r--r--trunk/views/default/event_calendar/agenda_header.php12
-rw-r--r--trunk/views/default/event_calendar/agenda_item_view.php26
-rw-r--r--trunk/views/default/event_calendar/agenda_view.php34
-rw-r--r--trunk/views/default/event_calendar/calendar.php61
-rw-r--r--trunk/views/default/event_calendar/css.php150
-rw-r--r--trunk/views/default/event_calendar/entities/entity_list.php66
-rw-r--r--trunk/views/default/event_calendar/entities/gallery.php44
-rw-r--r--trunk/views/default/event_calendar/entities/gallery_item.php63
-rw-r--r--trunk/views/default/event_calendar/forms/add_to_group.php64
-rw-r--r--trunk/views/default/event_calendar/forms/delete_confirm.php13
-rw-r--r--trunk/views/default/event_calendar/forms/manage_event.php22
-rw-r--r--trunk/views/default/event_calendar/forms/manage_event_content.php254
-rw-r--r--trunk/views/default/event_calendar/groupprofile_calendar.php42
-rw-r--r--trunk/views/default/event_calendar/input/longtext.php25
-rw-r--r--trunk/views/default/event_calendar/metatags.php2
-rw-r--r--trunk/views/default/event_calendar/nav.php38
-rw-r--r--trunk/views/default/event_calendar/paged_footer.php4
-rw-r--r--trunk/views/default/event_calendar/paged_header.php15
-rw-r--r--trunk/views/default/event_calendar/paged_item_view.php29
-rw-r--r--trunk/views/default/event_calendar/paged_view.php51
-rw-r--r--trunk/views/default/event_calendar/personal_toggle_js.php20
-rw-r--r--trunk/views/default/event_calendar/region_select.php23
-rw-r--r--trunk/views/default/event_calendar/review_requests.php25
-rw-r--r--trunk/views/default/event_calendar/show_events.php53
-rw-r--r--trunk/views/default/event_calendar/strapline.php18
-rw-r--r--trunk/views/default/icon/object/event_calendar/small.php3
-rw-r--r--trunk/views/default/input/datepicker_inline.php52
-rw-r--r--trunk/views/default/input/datepicker_popup.php30
-rw-r--r--trunk/views/default/input/timepicker.php38
-rw-r--r--trunk/views/default/object/event_calendar.php66
-rw-r--r--trunk/views/default/river/object/event_calendar/create.php12
-rw-r--r--trunk/views/default/river/object/event_calendar/update.php12
-rw-r--r--trunk/views/default/settings/event_calendar/edit.php363
-rw-r--r--trunk/views/default/widgets/event_calendar/edit.php35
-rw-r--r--trunk/views/default/widgets/event_calendar/view.php39
-rw-r--r--trunk/views/rss/event_calendar/show_events.php16
-rw-r--r--trunk/views/rss/object/event_calendar.php60
71 files changed, 5266 insertions, 0 deletions
diff --git a/trunk/CHANGES.txt b/trunk/CHANGES.txt
new file mode 100644
index 000000000..0a484cebe
--- /dev/null
+++ b/trunk/CHANGES.txt
@@ -0,0 +1,150 @@
+CHANGE LOG
+0.84
+
+Fixed tag search so it works for Elgg 1.7.x.
+
+Added French and Spanish language files provided by UNESCO. These are not
+quite complete and additions are welcome.
+
+There is now an option to allow group admins to add any existing event to a
+group calendar
+
+Fixed a bug which incorrectly removed the ability to change the date and year.
+
+Renamed a date picker view to avoid a conflict with the Profile Manager.
+
+Added unpacked js for ease in customisation and localisation.
+
+Restored the vanished RSS feed link.
+
+Fixed a bug in the region dropdown behaviour on listing pages.
+
+Fixed a case where the page was not properly displayed when clicking on a
+pagination link.
+
+Added a sanity check for date formats.
+
+Changed the listing limit from 4 events to a more reasonable 15 events.
+
+Added real_end_time as an internal metadata value to compute collisions.
+
+Added three features that are turned off by default but can be enabled
+through plugin settings:
+
+The spots feature allows you to specify how many users can add an event to
+their personal calendars. This also adds an "open" filter to the show events page
+so that you can see how many events are not full.
+
+The no collisions feature prevents someone from adding an event
+if they already have another event on their personal calendar within
+the same time period. (This will only work with new events or events that
+you have resaved after updating this plugin as it needs the new real_end_time
+field.)
+
+The add users feature provides a magic JavaScript field that
+allows an event creator to add the event to the personal calendars of other users.
+This appears on the event edit form. (Requires the separate autocomplete plugin.)
+
+There is a separate option (turned off by default) to send notifications to
+users who have events added to their calendars through the add users feature.
+
+0.83
+
+Fixed a bug that prevented region filtering with embedded blanks from
+working properly (thanks Patrick!).
+
+Added a new paged view for events (not month specific) that allows adding/removing events
+to a calendar with one click.
+
+Fixed some issues with the personal event calendar widget.
+
+0.82
+
+Fixed a bug in displaying dates when the start and end date were the same.
+
+Fixed the form redisplay bug described here:
+http://community.elgg.org/mod/groups/topicposts.php?topic=423853&group_guid=263011
+
+Removed an error_log message that was accidentally left in.
+
+Added RSS feeds.
+
+Added the ability to filter events by regions if the region option is turned on.
+
+Added security tokens for Elgg 1.7
+
+0.81
+
+Fixed a problem with the group "widget" not displaying when it should.
+
+Hid the "Today" link as it was not behaving as most people expected.
+
+Forced the display into Month mode after Prev and Next is clicked.
+
+0.8
+
+Removed a debugging message left in the event delete action.
+
+Sorted events properly by date/time rather than time created.
+
+Fixed an error in the parameters passed to elgg_view_entity_list that caused
+problems with Elgg 1.6.1.
+
+Added an admin toggle to allow event times as well as dates.
+
+Added an admin toggle to show the venue in event listings.
+
+Added an admin toggle for an agenda view which should be useful for conferences
+with multiple events on one day.
+
+Added the ability to "lock" the show_events page so that the calendar only
+allows navigation between a first date and a last date.
+
+Added an admin toggle for an autogroup function that automatically adds all
+group events to a user's calendar for all groups that the user is a member of.
+Group events are also automatically removed if the user leaves the group.
+
+Added an admin toggle to add a region drop down to the event form and a field to
+enter the allowable regions.
+
+0.7
+
+Reworked design for Elgg 1.5
+
+Fixed several bugs, including in the list of people who added an event to
+their personal calendar (now shows the proper group navigation if this is
+a group event).
+
+Added the ability to view all/friends/mine events for logged-in users.
+
+Added numerous configuration options (accessible via event_calendar settings
+on the admin tools configuration page). This allows, for example, any logged-in
+user to add events to the site calendar, to remove group calendars, etc.
+
+People who create an event now have the event automatically added to their
+personal event calendar. This behaviour can be configured via the admin event
+calendar settings.
+
+0.6
+
+Fixed a bug that prevented more than one person adding a given event to
+his/her personal calendar.
+
+Fixed a bug that made the page owner the person who created the event. This
+is now the group for group events, otherwise the currently logged in user.
+
+Added river support.
+
+0.51
+
+Fixed event overlap detection
+
+0.5
+
+Initial release
+
+
+
+
+
+
diff --git a/trunk/CONTRIBUTIONS.txt b/trunk/CONTRIBUTIONS.txt
new file mode 100644
index 000000000..edadc2407
--- /dev/null
+++ b/trunk/CONTRIBUTIONS.txt
@@ -0,0 +1,7 @@
+Pete Harris from Curverider contributed the icons. Thanks Pete!
+
+Igor Nuk from UNESCO sent me Spanish and French language files as well
+as a version tweaked to make it easier to customise.
+
+Many clients too numerous to mention have funded enhancements since the
+original version was funded by the Royal Institute of British Architects. \ No newline at end of file
diff --git a/trunk/README.txt b/trunk/README.txt
new file mode 100644
index 000000000..3cb68ee3b
--- /dev/null
+++ b/trunk/README.txt
@@ -0,0 +1,83 @@
+/**
+ * Manage and display events
+ *
+ * @package event_calendar
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Kevin Jardine <kevin@radagast.biz>
+ * @copyright Radagast Solutions 2008
+ * @link http://radagast.biz/
+ *
+ */
+
+ Note: this README.txt file is a bit outdated because it does not describe numerous
+ recently added features. For more information, check the CHANGES.txt file
+ or look at the event calendar settings available through Tools Administration.
+
+Version: 0.8
+
+Requires: Elgg 1.5 or higher
+
+*Description*
+
+The event_calendar plugin adds a site-wide event calendar as well as
+an event calendar to each group. Various options related to the site and group
+calendars can be set using the event calendar settings on the tool
+administration page.
+
+Group members can view events by month, week and day using a jQuery date
+picker widget, and submit event descriptions including the venue, start date,
+end date, tags, description, organiser, contact person, event access level,
+and fees if any.
+
+Group events are aggregated into the site wide event calendar accessible from
+the Tools menu drop down.
+
+Site admins (or optionally any user) can also add non-group-specific events to
+the site-wide calendar.
+
+Users can add group or site-wide events to a personal calendar to showcase
+events that they plan to attend or are interested in. They can optionally
+display these events by dragging an Event calendar widget onto their profile
+or dashboard.
+
+The number of users who have added an event to their personal gallery is listed
+on each event page along with a link to a page that displays these users in a
+gallery format. It is thus easy to find other people interested in the same
+event.
+
+*Admin settings*
+
+Numerous options for the event calendar can be set in the event_calendar settings
+area under Tool Administration.
+
+These include:
+
+Add starting and ending times as well as dates to events (default: no)
+
+Automatically add events a user creates to his/her personal calendar (default: yes)
+
+Automatically add group events for all members to their personal calendars (default: no)
+
+(If activated, the autogroup function automatically adds all group events to a
+user's calendar for all groups that the user is a member of. Group events are
+also automatically removed if the user leaves the group.)
+
+Use Agenda view (default: no)
+
+Useful for conferences with multiple events on the same day.
+
+Display venue in event listings (default: no)
+
+Add region dropdown (default: no), plus a way to specify the allowable regions
+
+First date displayable on show events pages (default: no first date)
+
+Last date displayable on show events pages (default: no last date)
+
+As well, there are numerous options for configuring the site wide and group calendars.
+
+*Acknowledgment*
+
+The initial development of the event calendar plugin was funded by the Research
+& Development department at the Royal Institute of British Architects
+(RIBA). Several other clients have funded enhancements. \ No newline at end of file
diff --git a/trunk/actions/add_to_group.php b/trunk/actions/add_to_group.php
new file mode 100644
index 000000000..b8c18ebb0
--- /dev/null
+++ b/trunk/actions/add_to_group.php
@@ -0,0 +1,11 @@
+<?php
+$event_id = get_input("event_id",0);
+$group_id = get_input("group_id",0);
+$event = get_entity($event_id);
+$group = get_entity($group_id);
+if ($group && $group->canEdit()) {
+ add_entity_relationship($event_id, "display_on_group", $group_id );
+ system_message(elgg_echo('event_calendar:add_to_group:success'));
+}
+forward($event->getUrl());
+?> \ No newline at end of file
diff --git a/trunk/actions/addtocalendar.php b/trunk/actions/addtocalendar.php
new file mode 100644
index 000000000..cb83aab88
--- /dev/null
+++ b/trunk/actions/addtocalendar.php
@@ -0,0 +1,36 @@
+<?php
+
+// this action allows an admin or event owner to approve a calendar request
+
+// Load configuration
+global $CONFIG;
+
+gatekeeper();
+
+$user_guid = get_input('user_guid', get_loggedin_userid());
+$event_id = get_input('event_id');
+
+$user = get_entity($user_guid);
+$event = get_entity($event_id);
+
+// If join request made
+if (event_calendar_personal_can_manage($event,$user_guid)
+ && check_entity_relationship($user_guid, 'event_calendar_request', $event_id)) {
+ if (event_calendar_add_personal_event($event_id,$user_guid)) {
+ remove_entity_relationship($user_guid, 'event_calendar_request', $event_id);
+ notify_user($user_guid, $CONFIG->site->guid, elgg_echo('event_calendar:add_users_notify:subject'),
+ sprintf(
+ elgg_echo('event_calendar:add_users_notify:body'),
+ $user->name,
+ $event->title,
+ $event->getURL()
+ )
+ );
+ system_message(elgg_echo('event_calendar:request_approved'));
+
+ }
+} else {
+ register_error(elgg_echo('event_calendar:review_requests_error'));
+}
+
+forward($_SERVER['HTTP_REFERER']);
diff --git a/trunk/actions/killrequest.php b/trunk/actions/killrequest.php
new file mode 100644
index 000000000..66257230c
--- /dev/null
+++ b/trunk/actions/killrequest.php
@@ -0,0 +1,23 @@
+<?php
+
+ // Load configuration
+ global $CONFIG;
+
+ gatekeeper();
+
+ $user_guid = get_input('user_guid', get_loggedin_userid());
+ $event_id = get_input('event_id');
+
+ $user = get_entity($user_guid);
+ $event = get_entity($event_id);
+
+ // If join request made
+ if (event_calendar_personal_can_manage($event,$user_guid) && check_entity_relationship($user->guid, 'event_calendar_request', $event->guid))
+ {
+ remove_entity_relationship($user->guid, 'event_calendar_request', $event->guid);
+ system_message(elgg_echo('event_calendar:requestkilled'));
+ }
+
+ forward($_SERVER['HTTP_REFERER']);
+
+?> \ No newline at end of file
diff --git a/trunk/actions/manage.php b/trunk/actions/manage.php
new file mode 100644
index 000000000..5acf5c279
--- /dev/null
+++ b/trunk/actions/manage.php
@@ -0,0 +1,105 @@
+<?php
+
+/**
+ * Manage actions
+ *
+ * @package event_calendar
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Kevin Jardine <kevin@radagast.biz>
+ * @copyright Radagast Solutions 2008
+ * @link http://radagast.biz/
+ *
+ */
+
+// Load RIBA event model
+require_once(dirname(dirname(__FILE__)) . "/models/model.php");
+
+gatekeeper();
+
+$event_action = get_input('event_action','');
+if ($event_action == 'add_event' || $event_action == 'manage_event') {
+ $result = event_calendar_set_event_from_form();
+ if ($result->success) {
+ if ($event_action == 'manage_event') {
+ add_to_river('river/object/event_calendar/update','update',$_SESSION['user']->guid,$result->event->guid);
+ system_message(elgg_echo('event_calendar:manage_event_response'));
+ } else {
+ $event_calendar_autopersonal = get_plugin_setting('autopersonal', 'event_calendar');
+ if (!$event_calendar_autopersonal || ($event_calendar_autopersonal == 'yes')) {
+ event_calendar_add_personal_event($result->event->guid,$_SESSION['user']->guid);
+ }
+ add_to_river('river/object/event_calendar/create','create',$_SESSION['user']->guid,$result->event->guid);
+ system_message(elgg_echo('event_calendar:add_event_response'));
+ }
+
+ forward($result->event->getURL());
+ } else {
+ // redisplay form with error message
+ register_error(elgg_echo('event_calendar:manage_event_error'));
+ $group_guid = (int) get_input('group_guid',0);
+
+ if ($result->form_data->event_id) {
+ $event = get_entity($result->form_data->event_id);
+ if (!$event) {
+ register_error(elgg_echo('event_calendar:no_such_event_edit_error'));
+ forward();
+ } else {
+ set_page_owner($event->container_guid);
+ if (page_owner_entity() instanceof ElggGroup) {
+ set_context('groups');
+ }
+ }
+
+ $title = elgg_echo('event_calendar:manage_event_title');
+ } else {
+ $title = elgg_echo('event_calendar:add_event_title');
+ if ($group_guid && $group = get_entity($group_guid)) {
+ // redefine context
+ set_context('groups');
+ set_page_owner($group_guid);
+ }
+ }
+ $body = elgg_view('event_calendar/forms/manage_event', array('event'=>$result->form_data,'event_id'=>$result->form_data->event_id,'group_guid'=>$group_guid));
+
+ page_draw($title,elgg_view_layout("two_column_left_sidebar", '', elgg_view_title($title) . $body));
+ }
+} else if ($event_action == 'delete_event') {
+ $event_id = get_input('event_id',0);
+ if (($event_id = get_input('event_id',0)) && ($event = get_entity($event_id)) && $event->canEdit()) {
+ if (get_input('cancel','')) {
+ system_message(elgg_echo('event_calendar:delete_cancel_response'));
+ forward($event->getUrl());
+ } else {
+ $container = get_entity($event->container_guid);
+ $event->delete();
+ system_message(elgg_echo('event_calendar:delete_response'));
+ forward($container->getUrl());
+ }
+ } else {
+ register_error(elgg_echo('event_calendar:error_delete'));
+ }
+} else if ($event_action == 'add_personal') {
+ $event_id = get_input('event_id',0);
+ if (($event_id = get_input('event_id',0)) && ($event = get_entity($event_id))) {
+ $user_id = $_SESSION['user']->getGUID();
+ if (!event_calendar_has_personal_event($event_id,$user_id)) {
+ if (event_calendar_add_personal_event($event_id,$user_id)) {
+ system_message(elgg_echo('event_calendar:add_to_my_calendar_response'));
+ } else {
+ register_error(elgg_echo('event_calendar:add_to_my_calendar_error'));
+ }
+ forward($event->getUrl());
+ }
+ }
+} else if ($event_action == 'remove_personal') {
+ $event_id = get_input('event_id',0);
+ if (($event_id = get_input('event_id',0)) && ($event = get_entity($event_id))) {
+ event_calendar_remove_personal_event($event_id,$_SESSION['user']->getGUID());
+ system_message(elgg_echo('event_calendar:remove_from_my_calendar_response'));
+ forward($event->getUrl());
+ }
+}
+
+forward();
+
+?> \ No newline at end of file
diff --git a/trunk/actions/remove_from_group.php b/trunk/actions/remove_from_group.php
new file mode 100644
index 000000000..4a7185245
--- /dev/null
+++ b/trunk/actions/remove_from_group.php
@@ -0,0 +1,8 @@
+<?php
+$event_id = get_input("event_id",0);
+$group_id = get_input("group_id",0);
+$event = get_entity($event_id);
+remove_entity_relationship($event_id, "display_on_group", $group_id );
+system_message(elgg_echo('event_calendar:remove_from_group:success'));
+forward($event->getUrl());
+?> \ No newline at end of file
diff --git a/trunk/actions/request_personal_calendar.php b/trunk/actions/request_personal_calendar.php
new file mode 100644
index 000000000..4160326a6
--- /dev/null
+++ b/trunk/actions/request_personal_calendar.php
@@ -0,0 +1,18 @@
+<?php
+// asks the event owner to add you to the event
+$event_id = get_input('event_id',0);
+$user_id = get_loggedin_userid();
+$event = get_entity($event_id);
+if ($event && ($event->getSubtype() == 'event_calendar')) {
+ if (event_calendar_send_event_request($event,$user_id)) {
+ system_message(elgg_echo('event_calendar:request_event_response'));
+ } else {
+ register_error(elgg_echo('event_calendar:request_event_error'));
+ }
+
+ forward($event->getUrl());
+
+ exit;
+}
+
+forward();
diff --git a/trunk/actions/toggle_personal_calendar.php b/trunk/actions/toggle_personal_calendar.php
new file mode 100644
index 000000000..f36b5836f
--- /dev/null
+++ b/trunk/actions/toggle_personal_calendar.php
@@ -0,0 +1,30 @@
+<?php
+$event_id = get_input('event_id',0);
+$user_id = get_input('user_id',get_loggedin_userid());
+$other = get_input('other','');
+$success = '@s@';
+$failure = '@f@';
+if ($other) {
+ $remove_response = elgg_echo('event_calendar:add_to_the_calendar');
+ $add_response = elgg_echo('event_calendar:remove_from_the_calendar');
+ $add_error = elgg_echo('event_calendar:add_to_the_calendar_error');
+} else {
+ $remove_response = $success.elgg_echo('event_calendar:remove_from_my_calendar_response');
+ $add_response = $success.elgg_echo('event_calendar:add_to_my_calendar_response');
+ $add_error = $failure.elgg_echo('event_calendar:add_to_my_calendar_error');
+}
+// three character prefix to indicate success or failure
+
+if (event_calendar_has_personal_event($event_id,$user_id)) {
+ event_calendar_remove_personal_event($event_id,$user_id);
+ echo $remove_response;
+} else {
+ if (event_calendar_add_personal_event($event_id,$user_id)) {
+ echo $success.$add_response;
+ } else {
+ echo $failure.$add_error;
+ }
+}
+
+exit;
+?> \ No newline at end of file
diff --git a/trunk/datepicker.css b/trunk/datepicker.css
new file mode 100644
index 000000000..64f486908
--- /dev/null
+++ b/trunk/datepicker.css
@@ -0,0 +1,234 @@
+/* Main Style Sheet for jQuery UI ui-datepicker */
+#ui-datepicker-div, .ui-datepicker-inline {
+ font-family: Arial,Helvetica,sans-serif;
+ font-size: 14px;
+ padding: 0;
+ margin: 0;
+ background: #F5F5F5;
+ width: 185px;
+}
+#ui-datepicker-div {
+ display: none;
+ border: 1px solid #FF9900;
+ z-index: 10;
+}
+.ui-datepicker-inline {
+ float: left;
+ display: block;
+ border: 0;
+}
+.ui-datepicker-rtl {
+ direction: rtl;
+}
+.ui-datepicker-dialog {
+ padding: 5px !important;
+ border: 4px ridge #83C948 !important;
+}
+button.ui-datepicker-trigger {
+ width: 25px;
+}
+img.ui-datepicker-trigger {
+ margin: 2px;
+ vertical-align: middle;
+}
+.ui-datepicker-prompt {
+ float: left;
+ padding: 2px;
+ background: #F5F5F5;
+ color: #000;
+}
+*html .ui-datepicker-prompt {
+ width: 185px;
+}
+.ui-datepicker-control, .ui-datepicker-links, .ui-datepicker-header, .ui-datepicker {
+ clear: both;
+ float: left;
+ width: 100%;
+ color: #FFF;
+}
+.ui-datepicker-control {
+ background: #FF9900;
+ padding: 2px 0px;
+}
+.ui-datepicker-links {
+ background: #F5F5F5;
+ padding: 2px 0px;
+}
+.ui-datepicker-control, .ui-datepicker-links {
+ font-weight: bold;
+ font-size: 80%;
+ letter-spacing: 1px;
+}
+
+/* KJ change this to avoid weird display change */
+/*.ui-datepicker-links label {
+ padding: 2px 5px;
+ color: #888;
+}*/
+
+.ui-datepicker-links label {
+ font-weight: bold;
+ font-size: 100%;
+ padding: 2px 5px;
+ letter-spacing: 1px;
+}
+.ui-datepicker-clear, .ui-datepicker-prev {
+ float: left;
+ width: 34%;
+}
+.ui-datepicker-rtl .ui-datepicker-clear, .ui-datepicker-rtl .ui-datepicker-prev {
+ float: right;
+ text-align: right;
+}
+.ui-datepicker-current {
+ float: left;
+ width: 30%;
+ text-align: center;
+}
+.ui-datepicker-close, .ui-datepicker-next {
+ float: right;
+ width: 34%;
+ text-align: right;
+}
+.ui-datepicker-rtl .ui-datepicker-close, .ui-datepicker-rtl .ui-datepicker-next {
+ float: left;
+ text-align: left;
+}
+.ui-datepicker-header {
+ padding: 1px 0 3px;
+ background: #3873B6;
+ text-align: center;
+ font-weight: bold;
+ height: 1.3em;
+ color: #FFFFFF;
+}
+.ui-datepicker-header select {
+ background: #3873B6;
+ color: #FFFFFF;
+ border: 0px;
+ font-weight: bold;
+}
+.ui-datepicker {
+ background: #CCC;
+ text-align: center;
+ font-size: 100%;
+}
+.ui-datepicker a {
+ display: block;
+ width: 100%;
+}
+.ui-datepicker-title-row {
+ background: #E3E3E3;
+ color: #000;
+}
+.ui-datepicker-title-row .ui-datepicker-week-end-cell {
+ background: #E3E3E3;
+}
+.ui-datepicker-days-row {
+ background: #FFF;
+ /*color: #666;*/
+}
+.ui-datepicker-week-col {
+ background: #E3E3E3;
+ color: #000;
+}
+.ui-datepicker-days-cell {
+ /*color: #000;*/
+ border: 1px solid #DDD;
+}
+.ui-datepicker-days-cell a {
+ display: block;
+}
+.ui-datepicker-week-end-cell {
+ background: #F5F5F5;
+}
+.ui-datepicker-unselectable {
+ color: #888;
+}
+.ui-datepicker-week-over, .ui-datepicker-week-over .ui-datepicker-week-end-cell {
+ background: #E3E3E3 !important;
+}
+.ui-datepicker-days-cell-over, .ui-datepicker-days-cell-over.ui-datepicker-week-end-cell {
+ background: #FFF !important;
+ border: 1px solid #777;
+}
+* html .ui-datepicker-title-row .ui-datepicker-week-end-cell {
+ background: #E3E3E3 !important;
+}
+* html .ui-datepicker-week-end-cell {
+ background: #F5F5F5 !important;
+ border: 1px solid #DDD !important;
+}
+* html .ui-datepicker-days-cell-over {
+ background: #FFF !important;
+ border: 1px solid #777 !important;
+}
+* html .ui-datepicker-current-day {
+ background: #3873B6 !important;
+ color: #FFFFFF !important;
+}
+.ui-datepicker-today {
+ background: #E3E3E3 !important;
+}
+.ui-datepicker-current-day {
+ background: #3873B6 !important;
+ color: #FFFFFF !important;
+}
+
+.ui-datepicker-current-day a {
+ background: #3873B6 !important;
+ color: #FFFFFF !important;
+}
+
+.ui-datepicker-status {
+ background: #F5F5F5;
+ width: 100%;
+ font-size: 80%;
+ text-align: center;
+}
+#ui-datepicker-div a, .ui-datepicker-inline a {
+ cursor: pointer;
+ margin: 0;
+ padding: 0;
+ background: none;
+ color: 000000;
+}
+.ui-datepicker-inline .ui-datepicker-links a {
+ padding: 0 5px !important;
+}
+.ui-datepicker-control a, .ui-datepicker-links a {
+ padding: 2px 5px !important;
+ color: #000 !important;
+}
+.ui-datepicker-title-row a {
+ color: #000 !important;
+}
+.ui-datepicker-control a:hover {
+ background: #FDD !important;
+ color: #333 !important;
+}
+.ui-datepicker-links a:hover, .ui-datepicker-title-row a:hover {
+ background: #FFF !important;
+ color: #333 !important;
+}
+.ui-datepicker-multi .ui-datepicker {
+ border: 1px solid #3873B6;
+}
+.ui-datepicker-one-month {
+ float: left;
+ width: 185px;
+}
+.ui-datepicker-new-row {
+ clear: left;
+}
+.ui-datepicker-cover {
+ display: none;
+ display/**/: block;
+ position: absolute;
+ z-index: -1;
+ filter: mask();
+ top: -4px;
+ left: -4px;
+ width: 193px;
+ height: 200px;
+}
diff --git a/trunk/delete_confirm.php b/trunk/delete_confirm.php
new file mode 100644
index 000000000..81bcd9118
--- /dev/null
+++ b/trunk/delete_confirm.php
@@ -0,0 +1,36 @@
+<?php
+
+/**
+ * Show event
+ *
+ * @package event_calendar
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Kevin Jardine <kevin@radagast.biz>
+ * @copyright Radagast Solutions 2008
+ * @link http://radagast.biz/
+ *
+ */
+
+// Load Elgg engine
+require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+
+// Define context
+set_context('event_calendar');
+
+global $CONFIG;
+
+$event_id = get_input('event_id',0);
+if ($event_id && ($event = get_entity($event_id))) {
+ set_page_owner($event->container_guid);
+ if (page_owner_entity() instanceOf ElggGroup) {
+ // Re-define context
+ set_context('groups');
+ }
+ $body = elgg_view('event_calendar/forms/delete_confirm',array('event_id'=>$event_id,'title'=>$event->title));
+ $title = elgg_echo('event_calendar:delete_confirm_title');
+ page_draw($title,elgg_view_layout("two_column_left_sidebar", '', elgg_view_title($title) . $body));
+} else {
+ register_error('event_calendar:error_nosuchevent');
+ forward();
+}
+?> \ No newline at end of file
diff --git a/trunk/display_event_users.php b/trunk/display_event_users.php
new file mode 100644
index 000000000..c5d06cd8f
--- /dev/null
+++ b/trunk/display_event_users.php
@@ -0,0 +1,42 @@
+<?php
+/**
+ * Display users who have added a given event to their personal calendars
+ *
+ * @package event_calendar
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Kevin Jardine <kevin@radagast.biz>
+ * @copyright Radagast Solutions 2008
+ * @link http://radagast.biz/
+ *
+ */
+
+// Load Elgg engine
+require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+
+// Load event calendar model
+require_once(dirname(__FILE__) . "/models/model.php");
+
+set_context('event_calendar');
+$limit = get_input('limit', 12);
+$offset = get_input('offset', 0);
+if (($event_id = get_input('event_id', 0)) && $event = get_entity($event_id)) {
+ $event_container = get_entity($event->container_guid);
+ if ($event_container instanceOf ElggGroup) {
+ // Re-define context
+ set_context('groups');
+ set_page_owner($event_container->getGUID());
+ }
+ set_input('search_viewtype','gallery');
+ $count = event_calendar_get_users_for_event($event_id,$limit,$offset,true);
+ $users = event_calendar_get_users_for_event($event_id,$limit,$offset,false);
+ $body = event_calendar_view_entity_list($users, $count, $offset, $limit, true, false);
+
+ $body .= elgg_view('event_calendar/personal_toggle_js');
+
+ $title = sprintf(elgg_echo('event_calendar:users_for_event_title'),$event->title);
+ page_draw($title,elgg_view_layout("two_column_left_sidebar", '', elgg_view_title($title) . $body));
+} else {
+ register_error('event_calendar:error_nosuchevent');
+ forward();
+}
+?> \ No newline at end of file
diff --git a/trunk/flora.datepicker.css b/trunk/flora.datepicker.css
new file mode 100644
index 000000000..20c3dabb3
--- /dev/null
+++ b/trunk/flora.datepicker.css
@@ -0,0 +1,234 @@
+/* Main Flora Style Sheet for jQuery UI ui-datepicker */
+#ui-datepicker-div, .ui-datepicker-inline {
+ font-family: Arial,Helvetica,sans-serif;
+ font-size: 14px;
+ padding: 0;
+ margin: 0;
+ background: #E0F4D7;
+ width: 185px;
+}
+#ui-datepicker-div {
+ display: none;
+ border: 1px solid #FF9900;
+ z-index: 10;
+}
+.ui-datepicker-inline {
+ float: left;
+ display: block;
+ border: 0;
+}
+.ui-datepicker-rtl {
+ direction: rtl;
+}
+.ui-datepicker-dialog {
+ padding: 5px !important;
+ border: 4px ridge #83C948 !important;
+}
+button.ui-datepicker-trigger {
+ width: 25px;
+}
+img.ui-datepicker-trigger {
+ margin: 2px;
+ vertical-align: middle;
+}
+.ui-datepicker-prompt {
+ float: left;
+ padding: 2px;
+ background: #E0F4D7;
+ color: #000;
+}
+*html .ui-datepicker-prompt {
+ width: 185px;
+}
+.ui-datepicker-control, .ui-datepicker-links, .ui-datepicker-header, .ui-datepicker {
+ clear: both;
+ float: left;
+ width: 100%;
+ color: #FFF;
+}
+.ui-datepicker-control {
+ background: #FF9900;
+ padding: 2px 0px;
+}
+.ui-datepicker-links {
+ background: #E0F4D7;
+ padding: 2px 0px;
+}
+.ui-datepicker-control, .ui-datepicker-links {
+ font-weight: bold;
+ font-size: 80%;
+ letter-spacing: 1px;
+}
+
+/* KJ change this to avoid weird display change */
+/*.ui-datepicker-links label {
+ padding: 2px 5px;
+ color: #888;
+}*/
+
+.ui-datepicker-links label {
+ font-weight: bold;
+ font-size: 100%;
+ padding: 2px 5px;
+ letter-spacing: 1px;
+}
+.ui-datepicker-clear, .ui-datepicker-prev {
+ float: left;
+ width: 34%;
+}
+.ui-datepicker-rtl .ui-datepicker-clear, .ui-datepicker-rtl .ui-datepicker-prev {
+ float: right;
+ text-align: right;
+}
+.ui-datepicker-current {
+ float: left;
+ width: 30%;
+ text-align: center;
+}
+.ui-datepicker-close, .ui-datepicker-next {
+ float: right;
+ width: 34%;
+ text-align: right;
+}
+.ui-datepicker-rtl .ui-datepicker-close, .ui-datepicker-rtl .ui-datepicker-next {
+ float: left;
+ text-align: left;
+}
+.ui-datepicker-header {
+ padding: 1px 0 3px;
+ background: #478787;
+ text-align: center;
+ font-weight: bold;
+ height: 1.3em;
+ color: #FFFFFF;
+}
+.ui-datepicker-header select {
+ background: #478787;
+ color: #FFFFFF;
+ border: 0px;
+ font-weight: bold;
+}
+.ui-datepicker {
+ background: #CCC;
+ text-align: center;
+ font-size: 100%;
+}
+.ui-datepicker a {
+ display: block;
+ width: 100%;
+}
+.ui-datepicker-title-row {
+ background: #DAE5DC;
+ color: #000;
+}
+.ui-datepicker-title-row .ui-datepicker-week-end-cell {
+ background: #DAE5DC;
+}
+.ui-datepicker-days-row {
+ background: #FFF;
+ /*color: #666;*/
+}
+.ui-datepicker-week-col {
+ background: #DAE5DC;
+ color: #000;
+}
+.ui-datepicker-days-cell {
+ /*color: #000;*/
+ border: 1px solid #DDD;
+}
+.ui-datepicker-days-cell a {
+ display: block;
+}
+.ui-datepicker-week-end-cell {
+ background: #E0F4D7;
+}
+.ui-datepicker-unselectable {
+ color: #888;
+}
+.ui-datepicker-week-over, .ui-datepicker-week-over .ui-datepicker-week-end-cell {
+ background: #DAE5DC !important;
+}
+.ui-datepicker-days-cell-over, .ui-datepicker-days-cell-over.ui-datepicker-week-end-cell {
+ background: #FFF !important;
+ border: 1px solid #777;
+}
+* html .ui-datepicker-title-row .ui-datepicker-week-end-cell {
+ background: #DAE5DC !important;
+}
+* html .ui-datepicker-week-end-cell {
+ background: #E0F4D7 !important;
+ border: 1px solid #DDD !important;
+}
+* html .ui-datepicker-days-cell-over {
+ background: #FFF !important;
+ border: 1px solid #777 !important;
+}
+* html .ui-datepicker-current-day {
+ background: #478787 !important;
+ color: #FFFFFF !important;
+}
+.ui-datepicker-today {
+ background: #DAE5DC !important;
+}
+.ui-datepicker-current-day {
+ background: #478787 !important;
+ color: #FFFFFF !important;
+}
+
+.ui-datepicker-current-day a {
+ background: #478787 !important;
+ color: #FFFFFF !important;
+}
+
+.ui-datepicker-status {
+ background: #E0F4D7;
+ width: 100%;
+ font-size: 80%;
+ text-align: center;
+}
+#ui-datepicker-div a, .ui-datepicker-inline a {
+ cursor: pointer;
+ margin: 0;
+ padding: 0;
+ background: none;
+ color: 000000;
+}
+.ui-datepicker-inline .ui-datepicker-links a {
+ padding: 0 5px !important;
+}
+.ui-datepicker-control a, .ui-datepicker-links a {
+ padding: 2px 5px !important;
+ color: #000 !important;
+}
+.ui-datepicker-title-row a {
+ color: #000 !important;
+}
+.ui-datepicker-control a:hover {
+ background: #FDD !important;
+ color: #333 !important;
+}
+.ui-datepicker-links a:hover, .ui-datepicker-title-row a:hover {
+ background: #FFF !important;
+ color: #333 !important;
+}
+.ui-datepicker-multi .ui-datepicker {
+ border: 1px solid #478787;
+}
+.ui-datepicker-one-month {
+ float: left;
+ width: 185px;
+}
+.ui-datepicker-new-row {
+ clear: left;
+}
+.ui-datepicker-cover {
+ display: none;
+ display/**/: block;
+ position: absolute;
+ z-index: -1;
+ filter: mask();
+ top: -4px;
+ left: -4px;
+ width: 193px;
+ height: 200px;
+}
diff --git a/trunk/images/calendar.gif b/trunk/images/calendar.gif
new file mode 100644
index 000000000..d0abaa7c0
--- /dev/null
+++ b/trunk/images/calendar.gif
Binary files differ
diff --git a/trunk/images/event_icon.gif b/trunk/images/event_icon.gif
new file mode 100644
index 000000000..a0ac7da52
--- /dev/null
+++ b/trunk/images/event_icon.gif
Binary files differ
diff --git a/trunk/images/event_icon_old.gif b/trunk/images/event_icon_old.gif
new file mode 100644
index 000000000..154d5af09
--- /dev/null
+++ b/trunk/images/event_icon_old.gif
Binary files differ
diff --git a/trunk/images/river_icon_event.gif b/trunk/images/river_icon_event.gif
new file mode 100644
index 000000000..d02e5395a
--- /dev/null
+++ b/trunk/images/river_icon_event.gif
Binary files differ
diff --git a/trunk/languages/en.php b/trunk/languages/en.php
new file mode 100644
index 000000000..785b7392c
--- /dev/null
+++ b/trunk/languages/en.php
@@ -0,0 +1,210 @@
+<?php
+
+ $english = array(
+
+ 'item:object:event_calendar' => "Event calendar",
+ 'tag_names:event_tags' => "Tags",
+ 'event_calendar:optional' => "Optional.",
+ 'event_calendar:required' => "Required.",
+ 'event_calendar:new_event' => "New event",
+ 'event_calendar:no_such_event_edit_error' => "Error: There is no such event or you do not have permission to edit it.",
+ 'event_calendar:add_event_title' => "Add event",
+ 'event_calendar:manage_event_title' => "Edit event",
+ 'event_calendar:manage_event_description' => "Enter the details of your event below. "
+ ."The title, venue, and start date are required. "
+ ."You can click on the calendar icons to set the start and end dates.",
+ 'event_calendar:title_label' => "Title",
+ 'event_calendar:title_description' => "One to four words",
+ 'event_calendar:brief_description_label' => "Brief description",
+ 'event_calendar:brief_description_description' => "A short phrase.",
+ 'event_calendar:venue_label' => "Venue",
+ 'event_calendar:venue_description' => "Where will this event be held?",
+ 'event_calendar:start_date_label' => "Start date",
+ 'event_calendar:start_date_description' => "When will this event start?",
+ 'event_calendar:end_date_label' => "End date",
+ 'event_calendar:end_date_description' => "When will this event end? The start date will be "
+ ."used as the end date if this is not supplied.",
+ 'event_calendar:start_time_label' => "Start time",
+ 'event_calendar:start_time_description' => "What time will this event start?",
+ 'event_calendar:end_time_label' => "End time",
+ 'event_calendar:end_time_description' => "What time will this event end?",
+ 'event_calendar:fees_label' => "Fees",
+ 'event_calendar:fees_description' => "The cost of this event, if any.",
+ 'event_calendar:contact_label' => "Contact",
+ 'event_calendar:contact_description' => "The person to contact for more information, "
+ ."preferably with a telephone number or email address.",
+ 'event_calendar:organiser_label' => "Organiser",
+ 'event_calendar:organiser_description' => "The individual or organisation responsible for this event.",
+ 'event_calendar:event_tags_label' => "Tags",
+ 'event_calendar:event_tags_description' => "A comma-separated list of tags relevant to this event.",
+ 'event_calendar:long_description_label' => "Long description",
+ 'event_calendar:long_description_description' => "Can be a paragraph or more as required.",
+ 'event_calendar:manage_event_response' => "Your event has been saved.",
+ 'event_calendar:add_event_response' => "Your event has been added.",
+ 'event_calendar:manage_event_error' => "Error: There was an error in saving your event. "
+ ."Please make sure that you have provided the required fields.",
+ 'event_calendar:error_nosuchevent' => "Error: there is no such event.",
+ 'event_calendar:show_events_title' => "Event calendar",
+ 'event_calendar:day_label' => "Day",
+ 'event_calendar:week_label' => "Week",
+ 'event_calendar:month_label' => "Month",
+ 'event_calendar:group' => "Group calendar",
+ 'event_calendar:new' => "Add event",
+ 'event_calendar:submit' => "Submit",
+ 'event_calendar:cancel' => "Cancel",
+ 'event_calendar:widget_title' => "Event calendar",
+ 'event_calendar:widget:description' => "Displays your events.",
+ 'event_calendar:num_display' => "Number of events to display",
+ 'event_calendar:groupprofile' => "Upcoming events",
+ 'event_calendar:view_calendar' => "view calendar",
+ 'event_calendar:when_label' => "When",
+ 'event_calendar:site_wide_link' => "View all events",
+ 'event_calendar:view_link' => "View this event",
+ 'event_calendar:edit_link' => "Edit this event",
+ 'event_calendar:delete_link' => "Delete this event",
+ 'event_calendar:delete_confirm_title' => "Confirm event deletion",
+ 'event_calendar:delete_confirm_description' => "Are you sure that you want to delete this event (\"%s\")? This action cannot be undone.",
+ 'event_calendar:delete_response' => "This event has been deleted.",
+ 'event_calendar:error_delete' => "This event does not exist or you do not have the right to delete it.",
+ 'event_calendar:delete_cancel_response' => "Event delete cancelled.",
+ 'event_calendar:add_to_my_calendar' => "Add to my calendar",
+ 'event_calendar:remove_from_my_calendar' => "Remove from my calendar",
+ 'event_calendar:add_to_my_calendar_response' => "This event has been added to your personal calendar.",
+ 'event_calendar:add_to_my_calendar_error' => "This event could not added to your personal calendar. "
+ ."(Perhaps the event is full or is scheduled at the same time as another event in your personal calendar?)",
+ 'event_calendar:remove_from_my_calendar_response' => "This event has been removed from your personal calendar.",
+ 'event_calendar:add_to_the_calendar' => "Add to calendar",
+ 'event_calendar:remove_from_the_calendar' => "Remove from calendar",
+ 'event_calendar:add_to_the_calendar_response' => "Event added to this person's calendar.",
+ 'event_calendar:add_to_the_calendar_error' => "This event could not added to this person's calendar. "
+ ."(Perhaps the event is full or is scheduled at the same time as another event in this person's calendar?)",
+ 'event_calendar:remove_from_the_calendar_response' => "Event removed from this person's calendar.",
+
+ 'event_calendar:users_for_event_title' => "People interested in event \"%s\"",
+ 'event_calendar:personal_event_calendars_link' => "Personal event calendars (%s)",
+ 'event_calendar:settings:group_profile_display:title' => "Group calendar profile display (if group calendars are enabled)",
+ 'event_calendar:settings:group_profile_display_option:left' => "left column",
+ 'event_calendar:settings:group_profile_display_option:right' => "right column",
+ 'event_calendar:settings:group_profile_display_option:none' => "none",
+ 'event_calendar:settings:times:title' => "Add time as well as date to events",
+ 'event_calendar:settings:autopersonal:title' => "Automatically add events a user creates to his/her personal calendar.",
+ 'event_calendar:settings:autogroup:title' => "Automatically add group events for all members to their personal calendars.",
+ 'event_calendar:settings:agenda_view:title' => "Use Agenda view",
+ 'event_calendar:settings:venue_view:title' => "Display venue in summary view (event listings)",
+ 'event_calendar:settings:yes' => "yes",
+ 'event_calendar:settings:no' => "no",
+ 'event_calendar:settings:site_calendar:title' => "Site calendar",
+ 'event_calendar:settings:site_calendar:admin' => "yes, only admins can post events",
+ 'event_calendar:settings:site_calendar:loggedin' => "yes, any logged-in user can post an event",
+ 'event_calendar:settings:group_calendar:title' => "Group calendars",
+ 'event_calendar:settings:group_calendar:admin' => "yes, only admins and group owners can post events",
+ 'event_calendar:settings:group_calendar:members' => "yes, any group member can post an event",
+ 'event_calendar:settings:group_default:title' => "New groups should by default have a group calendar (if group calendars are enabled)",
+ 'event_calendar:settings:group_default:no' => "no (but admins or group owners can turn a group calendar on if desired)",
+ 'event_calendar:settings:group_default:yes' => "yes (but admins or group owners can turn a group calendar off if desired)",
+ 'event_calendar:settings:group_always_display:title' => "If group calendar is enabled, always display it (even if empty)",
+ 'event_calendar:settings:region_display:title' => "Add region field to events",
+ 'event_calendar:settings:region_list:title' => "List of regions (one per line)",
+ 'event_calendar:region_label' => "Region",
+ 'event_calendar:region_description' => "Select the region that this event will be held in.",
+ 'event_calendar:settings:type_display:title' => "Add event type to events",
+ 'event_calendar:settings:type_list:title' => "List of event types (one per line)",
+ 'event_calendar:type_label' => "Type of event",
+ 'event_calendar:type_description' => "Select the type of event.",
+ 'event_calendar:all' => "All",
+ 'event_calendar:region_filter_by_label' => "Filter by region:",
+ 'event_calendar:settings:first_date:title' => "First allowable date (in YYYY-MM-DD format)",
+ 'event_calendar:settings:last_date:title' => "Last allowable date (in YYYY-MM-DD format)",
+ 'event_calendar:enable_event_calendar' => "Enable group event calendar",
+ 'event_calendar:no_events_found' => "No events found.",
+ 'event_calendar:mine' => "Mine",
+ 'event_calendar:feature' => "Feature",
+ 'event_calendar:unfeature' => "Unfeature",
+ 'event_calendar:agenda:column:time' => "Time",
+ 'event_calendar:agenda:column:session' => "Session",
+ 'event_calendar:agenda:column:venue' => "Location",
+ 'event_calendar:upcoming_events_title' => "Upcoming events",
+ 'event_calendar:settings:paged' => "paged",
+ 'event_calendar:settings:month' => "by month",
+ 'event_calendar:settings:listing_format:title' => "Event listing format",
+ 'event_calendar:paged:column:date' => "Date",
+ 'event_calendar:paged:column:time' => "Time",
+ 'event_calendar:paged:column:event' => "Event",
+ 'event_calendar:paged:column:venue' => "Location",
+ 'event_calendar:paged:column:calendar' => "Calendar",
+ 'event_calendar:settings:spots_display:title' => "Add a spots field for each "
+ ."event to allow you to limit the number of people who can add the event to their calendar",
+ 'event_calendar:settings:no_collisions:title' => "Collision detection: prevent people from adding two events at the same time to their personal calendar",
+ 'event_calendar:settings:collision_length:title' => "How long (in seconds) should an event be assumed to last if no end date or time is specified "
+ ."(used for collision detection). Defaults to 3600 seconds = 1 hour.",
+ 'event_calendar:spots_label' => "Spots",
+ 'event_calendar:spots_description' => "How many people are allowed to add this event to their personal calendars?",
+ 'event_calendar:open' => "Open",
+ 'event_calendar:settings:add_users:title' => "Allow event creators to add their event to other personal calendars (requires autocomplete plugin).",
+ 'event_calendar:add_user_label' => "Add users",
+ 'event_calendar:add_user_description' => "Add this event to personal calendars by typing two or more characters in the above text autocomplete field to select a user. "
+ ."You can add multiple users by clicking the \"+\" link. (You must submit this form to actually add the event to the calendars.)",
+ 'event_calendar:settings:add_users_notify:title' => "Notify users who have had an event added to their personal calendar by an admin or event creator.",
+ 'event_calendar:add_users_notify:subject' => "A new event has been added to your personal calendar",
+ 'event_calendar:add_users_notify:body' => "%s,\n\nThe \"%s\" event has been added to your calendar.\n\nYou can view it here: \n\n%s\n",
+
+ 'event_calendar:settings:region_list_handles:title' => "The region strings above are string handles. Use the Elgg translation system to resolve them.",
+ 'event_calendar:settings:type_list_handles:title' => "The type strings above are string handles. Use the Elgg translation system to resolve them.",
+
+ 'event_calendar:settings:personal_manage:title' => "Allow users to add/remove any event they can see to/from their personal calendars. (If no, only admins and the event creator can add/remove them).",
+
+ 'event_calendar:strapline' => "Posted %s by %s",
+
+ 'event_calendar:request_event_response' => "Your request to be added to this event has been sent.",
+ 'event_calendar:request_event_error' => "Error: Could not send your request to be added to this event.",
+ 'event_calendar:request_subject' => "You have received an event request",
+ 'event_calendar:request_message' => " %s has asked to have the event \"%s\", here:
+
+ %s
+
+ added to his/her personal calendar.
+
+ You can manage calendar requests here:
+
+ %s",
+
+ 'event_calendar:review_requests_error' => "This event either does not exist or you do not have the authority to approve requests for it.",
+ 'event_calendar:review_requests_request_none' => "There are no requests to review for this event.",
+ 'event_calendar:request:remove:check' => 'Are you sure you want to reject this request?',
+ 'event_calendar:requestkilled' => 'The request has been removed.',
+ 'event_calendar:request_approved' => "This request has been approved.",
+ 'event_calendar:review_requests_title' => 'Review requests',
+ 'event_calendar:make_request_title' => 'Request this event',
+
+ 'event_calendar:settings:hide_access:title' => "Hide event access drop down",
+ 'event_calendar:settings:default_access:title' => "If the event access is hidden, what should it default to?",
+ 'event_calendar:settings:hide_end:title' => "Hide end time and date fields",
+ 'event_calendar:settings:more_required:title' => "Make all visible fields except long description required.",
+
+ 'event_calendar:add_to_group:remove_group_title' => "Remove this event from group",
+ 'event_calendar:add_to_group:remove_group_button' => "Remove from group",
+ 'event_calendar:remove_from_group:success' => "Event removed from group calendar",
+ 'event_calendar:add_to_group:add_group_title' => "Add this event to group",
+ 'event_calendar:add_to_group:add_group_button' => "Add to group",
+ 'event_calendar:add_to_group:success' => "Event added to group calendar",
+ 'event_calendar:settings:add_to_group_calendar:title' => "Allow group admins to add any existing event to a group calendar",
+
+ /**
+ * Event calendar river
+ **/
+
+ //generic terms to use
+ 'event_calendar:river:created' => "%s added",
+ 'event_calendar:river:updated' => "%s updated",
+ 'event_calendar:river:annotated1' => "%s added",
+ 'event_calendar:river:annotated2' => "to his/her personal calendar.",
+
+ //these get inserted into the river links to take the user to the entity
+ 'event_calendar:river:create' => "a new event titled",
+ 'event_calendar:river:the_event' => "an event titled",
+
+ );
+
+ add_translation("en",$english);
+
+?> \ No newline at end of file
diff --git a/trunk/languages/es.php b/trunk/languages/es.php
new file mode 100644
index 000000000..1eefff2a3
--- /dev/null
+++ b/trunk/languages/es.php
@@ -0,0 +1,124 @@
+<?php
+$language = array (
+ 'item:object:event_calendar' => 'Calendario de eventos',
+ 'event_calendar:new_event' => 'Nuevo evento',
+ 'event_calendar:no_such_event_edit_error' => 'Error: No existe tal evento o usted no tiene autorización para editarlo.',
+ 'event_calendar:add_event_title' => 'Agregar evento',
+ 'event_calendar:manage_event_title' => 'Editar evento',
+ 'event_calendar:manage_event_description' => 'Introduzca los detalles de su evento a continuación. El título, lugar y fecha de inicio se requieren. Puede hacer clic en los íconos del calendario para establecer las fechas de inicio y fin.',
+ 'event_calendar:title_label' => 'Título',
+ 'event_calendar:title_description' => 'Una a cuatro palabras',
+ 'event_calendar:brief_description_label' => 'Descripción breve',
+ 'event_calendar:brief_description_description' => 'Una frase corta.',
+ 'event_calendar:venue_label' => 'Sede',
+ 'event_calendar:venue_description' => '¿Dónde se llevará a cabo este evento?',
+ 'event_calendar:start_date_label' => 'Fecha de inicio',
+ 'event_calendar:start_date_description' => '¿Cuándo comenzará este evento?',
+ 'event_calendar:end_date_label' => 'Fecha final',
+ 'event_calendar:end_date_description' => '¿Cuándo terminará este evento? La fecha de inicio será usada como la fecha de finalización si no se suministra esta información.',
+ 'event_calendar:start_time_label' => 'Hora de inicio',
+ 'event_calendar:start_time_description' => '¿A qué hora comenzará este evento?',
+ 'event_calendar:end_time_label' => 'Hora de finalización',
+ 'event_calendar:end_time_description' => '¿A qué hora terminará este evento?',
+ 'event_calendar:fees_label' => 'Tarifas',
+ 'event_calendar:fees_description' => 'El costo de este evento, si hay caso.',
+ 'event_calendar:contact_label' => 'Contacto',
+ 'event_calendar:contact_description' => 'Persona que será el contacto para brindar mayor información, preferiblemente con número de teléfono o dirección de correo electrónico.',
+ 'event_calendar:organiser_label' => 'Origanizador',
+ 'event_calendar:organiser_description' => 'La persona u organización responsable por este evento.',
+ 'event_calendar:event_tags_label' => 'Etiquetas',
+ 'event_calendar:event_tags_description' => 'Lista de etiquetas relativas al eventos, separadas por una coma.',
+ 'event_calendar:long_description_label' => 'Descripción larga',
+ 'event_calendar:long_description_description' => 'Puede ser un parágrafo o más, según lo requerido.',
+ 'event_calendar:manage_event_response' => 'Su evento ha sido guardado.',
+ 'event_calendar:add_event_response' => 'Su evento ha sido agregado.',
+ 'event_calendar:manage_event_error' => 'Error: Hubo un error al guardar su evento. Por favor asegúrese que todos los campos requeridos hayan sido proporcionados.',
+ 'event_calendar:error_nosuchevent' => 'Error: no existe tal evento.',
+ 'event_calendar:show_events_title' => 'Calendario del evento',
+ 'event_calendar:day_label' => 'Día',
+ 'event_calendar:week_label' => 'Semana',
+ 'event_calendar:month_label' => 'Mes',
+ 'event_calendar:group' => 'Calendario de grupo',
+ 'event_calendar:new' => 'Agregar evento',
+ 'event_calendar:submit' => 'Enviar',
+ 'event_calendar:cancel' => 'Cancelar',
+ 'event_calendar:widget_title' => 'Calendario del evento',
+ 'event_calendar:widget:description' => 'Exponer sus eventos.',
+ 'event_calendar:num_display' => 'Número de eventos expuestos',
+ 'event_calendar:groupprofile' => 'Eventos venideros',
+ 'event_calendar:view_calendar' => 'ver calendario',
+ 'event_calendar:when_label' => 'Cuando',
+ 'event_calendar:site_wide_link' => 'Ver todos los eventos',
+ 'event_calendar:view_link' => 'Ver este evento',
+ 'event_calendar:edit_link' => 'Editar este evento',
+ 'event_calendar:delete_link' => 'Eliminar este evento',
+ 'event_calendar:delete_confirm_title' => 'Confirmar eliminación de este evento',
+ 'event_calendar:delete_confirm_description' => '¿Está seguro que desea eliminar este evento ("%s")? Esta acción es irreversible.',
+ 'event_calendar:delete_response' => 'Este evento ha sido eliminado.',
+ 'event_calendar:error_delete' => 'Este evento no existe o usted no tiene el derecho de eliminarlo.',
+ 'event_calendar:delete_cancel_response' => 'Eliminación del evento cancelada.',
+ 'event_calendar:add_to_my_calendar' => 'Agregar a mi calendario',
+ 'event_calendar:remove_from_my_calendar' => 'Retirar de mi calendario',
+ 'event_calendar:add_to_my_calendar_response' => 'Este evento ha sido agregado a su calendario personal.',
+ 'event_calendar:remove_from_my_calendar_response' => 'Este evento ha sido retirado de su calendario personal.',
+ 'event_calendar:users_for_event_title' => 'Personas interesadas en el evento "%s"',
+ 'event_calendar:personal_event_calendars_link' => 'Eventos personales del calendario (%s)',
+ 'event_calendar:settings:group_profile_display:title' => 'Perfil de visualización del calendario de grupo (si están habilitados los calendarios de grupo)',
+ 'event_calendar:settings:group_profile_display_option:left' => 'Columna de la izquierda',
+ 'event_calendar:settings:group_profile_display_option:right' => 'Columna de la derecha',
+ 'event_calendar:settings:group_profile_display_option:none' => 'Ninguno',
+ 'event_calendar:settings:times:title' => 'Agregar hora y fecha a los eventos',
+ 'event_calendar:settings:autopersonal:title' => 'Agregar automáticamente a su calendario personal eventos que un usuario cree.',
+ 'event_calendar:settings:autogroup:title' => 'Agregar automáticamente los eventos de grupo al calendario personal de sus miembros.',
+ 'event_calendar:settings:agenda_view:title' => 'Usar Vista previa de Agenda',
+ 'event_calendar:settings:venue_view:title' => 'Mostrar sede en vista rápida (listados de eventos)',
+ 'event_calendar:settings:yes' => 'sí',
+ 'event_calendar:settings:no' => 'no',
+ 'event_calendar:settings:site_calendar:title' => 'Sitio del calendario',
+ 'event_calendar:settings:site_calendar:admin' => 'sí, solamente si administradores pueden anunciar eventos',
+ 'event_calendar:settings:site_calendar:loggedin' => 'sí, cualquier usuario registrado puede anunciar un evento',
+ 'event_calendar:settings:group_calendar:title' => 'Calendarios de grupo',
+ 'event_calendar:settings:group_calendar:admin' => 'sí, solamente administradores y propietarios de grupos pueden anunciar eventos',
+ 'event_calendar:settings:group_calendar:members' => 'sí, cualquier miembro de un grupo puede anunciar un evento',
+ 'event_calendar:settings:group_default:title' => 'Grupos nuevos deben tener un calendario de grupo por defecto (si los calendarios de grupo están activados)',
+ 'event_calendar:settings:group_default:no' => 'no (sin embargo administradores y propietarios de grupos pueden desactivar un calendario de grupo si lo desean)',
+ 'event_calendar:settings:group_default:yes' => 'sí (sin embargo administradores y propietarios de grupos pueden desactivar un calendario de grupo si lo desean)',
+ 'event_calendar:settings:group_always_display:title' => 'Si un calendario de grupo está activo, siempre exponerlo (aun si está vacío)',
+ 'event_calendar:settings:region_display:title' => 'Agregar campo región a eventos',
+ 'event_calendar:settings:region_list:title' => 'Lista de regiones (una por línea)',
+ 'event_calendar:region_label' => 'Región',
+ 'event_calendar:region_description' => 'Selecciona la región en la cual el evento se llevará a cabo',
+ 'event_calendar:settings:type_display:title' => 'Agregar tipo de eventos a eventos',
+ 'event_calendar:settings:type_list:title' => 'Lista de tipos de eventos (uno por línea)',
+ 'event_calendar:type_label' => 'Tipo de eventos',
+ 'event_calendar:type_description' => 'Seleccione un tipo de evento.',
+ 'event_calendar:all' => 'Todos',
+ 'event_calendar:region_filter_by_label' => 'Filtro por región:',
+ 'event_calendar:settings:first_date:title' => 'Primera fecha permitida (en el formato AAAA - MM- DD)',
+ 'event_calendar:settings:last_date:title' => 'Última fecha permitida (en el formato AAAA - MM- DD)',
+ 'event_calendar:enable_event_calendar' => 'Permitir clanedario de eventos de grupo',
+ 'event_calendar:no_events_found' => 'No se encontraron eventos.',
+ 'event_calendar:mine' => 'Mío',
+ 'event_calendar:feature' => 'Presentar',
+ 'event_calendar:unfeature' => 'No presentar',
+ 'event_calendar:agenda:column:time' => 'Hora',
+ 'event_calendar:agenda:column:session' => 'Sesión',
+ 'event_calendar:agenda:column:venue' => 'Lugar',
+ 'event_calendar:upcoming_events_title' => 'Eventor venideros',
+ 'event_calendar:settings:paged' => 'Paginado',
+ 'event_calendar:settings:month' => 'Por mes',
+ 'event_calendar:settings:listing_format:title' => 'Formato del listado de eventos',
+ 'event_calendar:paged:column:date' => 'Fecha',
+ 'event_calendar:paged:column:time' => 'Hora',
+ 'event_calendar:paged:column:event' => 'Evento',
+ 'event_calendar:paged:column:venue' => 'Lugar',
+ 'event_calendar:paged:column:calendar' => 'Calendario',
+ 'event_calendar:river:created' => '%s agregado',
+ 'event_calendar:river:updated' => '%s actualizado',
+ 'event_calendar:river:annotated1' => '%s agregado',
+ 'event_calendar:river:annotated2' => 'a su calendario personal.',
+ 'event_calendar:river:create' => 'un nuevo evento titulado',
+ 'event_calendar:river:the_event' => 'un evento titulado',
+);
+add_translation("es", $language);
+?> \ No newline at end of file
diff --git a/trunk/languages/fr.php b/trunk/languages/fr.php
new file mode 100644
index 000000000..876a53ecb
--- /dev/null
+++ b/trunk/languages/fr.php
@@ -0,0 +1,125 @@
+<?php
+$language = array (
+ 'event_calendar:manage_event_description' => 'Entrez les détails de votre événement ci-dessous. Le titre, le lieu et la date de début sont obligatoires. Vous pouvez cliquer sur les icônes du calendrier pour indiquer les dates de début et de fin.',
+ 'event_calendar:start_time_label' => 'Horaire de départ',
+ 'event_calendar:start_time_description' => 'À quelle heure cet événement commence?',
+ 'event_calendar:end_time_label' => 'Horaire de fin',
+ 'event_calendar:end_time_description' => 'À quelle heure se termine cet événement?',
+ 'event_calendar:event_tags_label' => 'Balises',
+ 'event_calendar:event_tags_description' => 'Optionnel. Une liste de balises séparées par des virgules.',
+ 'event_calendar:error_nosuchevent' => 'Erreur: il n\'y a pas de tel événement.',
+ 'event_calendar:settings:times:title' => 'Ajouter du temps et la date aux événements',
+ 'event_calendar:settings:autogroup:title' => 'Ajouter automatiquement des événements de groupe à tous les membres dans leurs agendas personnels.',
+ 'event_calendar:settings:agenda_view:title' => 'Utilisez la vue Agenda',
+ 'event_calendar:settings:venue_view:title' => 'Afficher le lieu en vue sommaire (listings des événements)',
+ 'event_calendar:settings:group_always_display:title' => 'Si un calendrier de groupe est activé, toujours l\'afficher (même vides)',
+ 'event_calendar:settings:region_display:title' => 'Ajouter un champ région aux événements',
+ 'event_calendar:settings:region_list:title' => 'Liste des rListe des régions (un par ligne)
+ (une seule par ligne)',
+ 'event_calendar:region_label' => 'Régions',
+ 'event_calendar:region_description' => 'Sélectionnez la région dans laquelle cet événement aura lieu',
+ 'event_calendar:settings:type_display:title' => 'Ajouter le type d\'événement aux événements',
+ 'event_calendar:settings:type_list:title' => 'Liste des types d\'événement (un seul par ligne)',
+ 'event_calendar:type_label' => 'Type d\'événement',
+ 'event_calendar:type_description' => 'Sélectionnez le type d\'événement.',
+ 'event_calendar:all' => 'Tous',
+ 'event_calendar:region_filter_by_label' => 'Filtrer par région:',
+ 'event_calendar:settings:first_date:title' => 'Première date d\'entrée admissible (au format AAAA-MM-JJ)',
+ 'event_calendar:settings:last_date:title' => 'Dernière date admissible (au format AAAA-MM-JJ)',
+ 'event_calendar:mine' => 'Le mien',
+ 'event_calendar:feature' => 'Mise en vedette',
+ 'event_calendar:unfeature' => 'Enlever la mise en vedette',
+ 'event_calendar:agenda:column:time' => 'Heure',
+ 'event_calendar:agenda:column:session' => 'Session',
+ 'event_calendar:agenda:column:venue' => 'Lieu',
+ 'event_calendar:upcoming_events_title' => 'Événements à venir',
+ 'event_calendar:settings:paged' => 'Pagé',
+ 'event_calendar:settings:month' => 'par mois',
+ 'event_calendar:settings:listing_format:title' => 'Format des listes d\'événements',
+ 'event_calendar:paged:column:date' => 'Date',
+ 'event_calendar:paged:column:time' => 'Heure',
+ 'event_calendar:paged:column:event' => 'Evénement',
+ 'event_calendar:paged:column:venue' => 'Lieu',
+ 'event_calendar:paged:column:calendar' => 'Calendrier',
+ 'item:object:event_calendar' => 'Agenda',
+ 'event_calendar:new_event' => 'Nouvel événement',
+ 'event_calendar:no_such_event_edit_error' => 'Erreur: Il n\'y a pas de tel événement, ou vous n\'avez pas la permission de le modifier.',
+ 'event_calendar:add_event_title' => 'Ajouter un événement',
+ 'event_calendar:manage_event_title' => 'Modifier un événement',
+ 'event_calendar:title_label' => 'Titre',
+ 'event_calendar:title_description' => 'Obligatoire. Un à quatre mots',
+ 'event_calendar:brief_description_label' => 'Courte description',
+ 'event_calendar:brief_description_description' => 'Optionnel. Une phrase courte.',
+ 'event_calendar:venue_label' => 'Lieu',
+ 'event_calendar:venue_description' => 'Obligatoire. Où se tiendra l\'événement?',
+ 'event_calendar:start_date_label' => 'Date de départ',
+ 'event_calendar:start_date_description' => 'Obligatoire. A quelle date cet événement démarera?',
+ 'event_calendar:end_date_label' => 'Date de fin de l\'événement',
+ 'event_calendar:end_date_description' => 'Optionnel. Quand c\'est événement s\'achèvera-t-il? La date de départ sera utilisée comme date de fin si ce champ n\'est pas rempli.',
+ 'event_calendar:fees_label' => 'Prix d\'entrée',
+ 'event_calendar:fees_description' => 'Optionnel. Le côut de l\'événement.',
+ 'event_calendar:contact_label' => 'Contact',
+ 'event_calendar:contact_description' => 'Optionnel. La personne à contacter pour avoir plus de renseignements, préférablement avec un numéro de téléphone ou une adresse emailpreferably with a telephone number or email address.',
+ 'event_calendar:organiser_label' => 'Organisateur',
+ 'event_calendar:organiser_description' => 'Optionnel. La personne ou l\'organisation responsable de l\'événement.',
+ 'event_calendar:long_description_label' => 'Description longue',
+ 'event_calendar:long_description_description' => 'Optionnel. Peut être un paragraphe ou plus si nécessaire.',
+ 'event_calendar:manage_event_response' => 'Votre événement a été sauvegardé.',
+ 'event_calendar:add_event_response' => 'Votre événement a été ajouté.',
+ 'event_calendar:manage_event_error' => 'Erreur: Une erreur s\'est produite lors de l\'enregistrement de votre événement. Assurez-vous que les champs spécifiés ont bien été remplis.',
+ 'event_calendar:show_events_title' => 'Agenda des événements',
+ 'event_calendar:day_label' => 'Jour',
+ 'event_calendar:week_label' => 'Semaine',
+ 'event_calendar:month_label' => 'Mois',
+ 'event_calendar:group' => 'Agenda de groupe',
+ 'event_calendar:new' => 'Ajouter un événement',
+ 'event_calendar:submit' => 'Ok',
+ 'event_calendar:cancel' => 'Annuler',
+ 'event_calendar:widget_title' => 'Agenda des événements',
+ 'event_calendar:widget:description' => 'Afficher vos événements.',
+ 'event_calendar:num_display' => 'Nombre d\'événement à afficher',
+ 'event_calendar:groupprofile' => 'Les prochains événements',
+ 'event_calendar:view_calendar' => 'Voir l\'agenda',
+ 'event_calendar:when_label' => 'Quand',
+ 'event_calendar:site_wide_link' => 'Voir tous les événements',
+ 'event_calendar:view_link' => 'Voir cet événement',
+ 'event_calendar:edit_link' => 'Modifier cet événement',
+ 'event_calendar:delete_link' => 'Supprimer cet événement',
+ 'event_calendar:delete_confirm_title' => 'Confirmer la suppression de l\'événement',
+ 'event_calendar:delete_confirm_description' => 'Etes-vous sur de vouloir supprimer cet événement ("%s")? Cette action est irréversible.',
+ 'event_calendar:delete_response' => 'Cet événement a été supprimé.',
+ 'event_calendar:error_delete' => 'Cet événement n\'existe pas ou vous n\'avez pas le droit de le supprimer.',
+ 'event_calendar:delete_cancel_response' => 'Suppression de l\'événement annulé.',
+ 'event_calendar:add_to_my_calendar' => 'Ajouter à mon agenda',
+ 'event_calendar:remove_from_my_calendar' => 'Supprimer de mon agenda',
+ 'event_calendar:add_to_my_calendar_response' => 'Cet événement a été ajouté à votre agenda personnel.',
+ 'event_calendar:remove_from_my_calendar_response' => 'Cet événement a été supprimé de votre agenda personnel.',
+ 'event_calendar:users_for_event_title' => 'Membre du site intéressé par l\'événement "%s"\'',
+ 'event_calendar:personal_event_calendars_link' => 'Agenda des événements personnels de (%s)',
+ 'event_calendar:settings:group_profile_display:title' => 'Afficher le profil de l\'agenda du groupe (Si les agendas de groupe ont été permis)',
+ 'event_calendar:settings:group_profile_display_option:left' => 'Colonne de gauche',
+ 'event_calendar:settings:group_profile_display_option:right' => 'Colonne de droite',
+ 'event_calendar:settings:group_profile_display_option:none' => 'aucun',
+ 'event_calendar:settings:autopersonal:title' => 'Ajouter automatiquement les événements d\'un utilisateur à son agenda personnelA.',
+ 'event_calendar:settings:yes' => 'oui',
+ 'event_calendar:settings:no' => 'non',
+ 'event_calendar:settings:site_calendar:title' => 'Side de l\'agenda',
+ 'event_calendar:settings:site_calendar:admin' => 'oui, seuls les administrateurs peuvent proposer des événements',
+ 'event_calendar:settings:site_calendar:loggedin' => 'oui, seuls les utilisateurs identifiés peuvent publier un événement',
+ 'event_calendar:settings:group_calendar:title' => 'Les agendas du groupe',
+ 'event_calendar:settings:group_calendar:admin' => 'oui seuls les administrateurs et les créateurs du groupe peuvent publier un événement',
+ 'event_calendar:settings:group_calendar:members' => 'oui, les membres du groupe peuvent publier un événement',
+ 'event_calendar:settings:group_default:title' => 'Les nouveaux groupes par défaut peuvent avoir leur propre agenda (Si les agendas de groupe sont permis)',
+ 'event_calendar:settings:group_default:no' => 'non (mais les administrateurs du groupe peuvement ajouter la fonction agenda si désiré)',
+ 'event_calendar:settings:group_default:yes' => 'oui (mais les administrateurs ou les créateurs du groupe peuvent supprimer la fonction agenda si désiré)',
+ 'event_calendar:enable_event_calendar' => 'Ajouter la fonction agenda au groupe',
+ 'event_calendar:no_events_found' => 'Aucun événement trouvé.',
+ 'event_calendar:river:created' => '%s ajouté',
+ 'event_calendar:river:updated' => '%s mis à jour',
+ 'event_calendar:river:annotated1' => '%s ajouté',
+ 'event_calendar:river:annotated2' => 'à son agenda personnel.',
+ 'event_calendar:river:create' => 'un nouvel événement intitulé',
+ 'event_calendar:river:the_event' => 'un événement intitulé',
+);
+add_translation("fr", $language);
+?> \ No newline at end of file
diff --git a/trunk/manage_event.php b/trunk/manage_event.php
new file mode 100644
index 000000000..0464a31df
--- /dev/null
+++ b/trunk/manage_event.php
@@ -0,0 +1,57 @@
+<?php
+
+/**
+ * Manage event
+ *
+ * @package event_calendar
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Kevin Jardine <kevin@radagast.biz>
+ * @copyright Radagast Solutions 2008
+ * @link http://radagast.biz/
+ *
+ */
+
+// Load Elgg engine
+require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+
+// Load event calendar model
+require_once(dirname(__FILE__) . "/models/model.php");
+
+// Define context
+set_context('event_calendar');
+
+global $CONFIG;
+
+gatekeeper();
+
+$event = '';
+
+$group_guid = (int) get_input('group_guid',0);
+
+if ($event_id = get_input('event_id',0)) {
+ $event = event_calendar_get_event_for_edit($event_id);
+ if (!$event) {
+ register_error(elgg_echo('event_calendar:no_such_event_edit_error'));
+ forward();
+ } else {
+ set_page_owner($event->container_guid);
+ if (page_owner_entity() instanceof ElggGroup) {
+ set_context('groups');
+ }
+ }
+
+ $title = elgg_echo('event_calendar:manage_event_title');
+} else {
+ $title = elgg_echo('event_calendar:add_event_title');
+ if ($group_guid && $group = get_entity($group_guid)) {
+ // redefine context
+ set_context('groups');
+ set_page_owner($group_guid);
+ }
+}
+
+$body = elgg_view('event_calendar/forms/manage_event', array('event'=>$event,'event_id'=>$event_id,'group_guid'=>$group_guid));
+
+page_draw($title,elgg_view_layout("two_column_left_sidebar", '', elgg_view_title($title) . $body));
+
+?> \ No newline at end of file
diff --git a/trunk/manifest.xml b/trunk/manifest.xml
new file mode 100644
index 000000000..c3ce812c1
--- /dev/null
+++ b/trunk/manifest.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<plugin_manifest>
+ <field key="author" value="Kevin Jardine &lt;kevin@radagast.biz&gt;" />
+ <field key="version" value="0.8" />
+ <field key="description" value="Elgg event calendar plugin" />
+ <field key="website" value="http://radagast.biz/" />
+ <field key="copyright" value="(C) Radagast Solutions 2009" />
+ <field key="licence" value="GNU Public License version 2" />
+ <field key="elgg_version" value="2009030101" />
+</plugin_manifest>
diff --git a/trunk/models/model.php b/trunk/models/model.php
new file mode 100644
index 000000000..04a168e55
--- /dev/null
+++ b/trunk/models/model.php
@@ -0,0 +1,1045 @@
+<?php
+/**
+ * Elgg event model
+ *
+ * @package event_calendar
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Kevin Jardine <kevin@radagast.biz>
+ * @copyright Radagast Solutions 2008
+ * @link http://radagast.biz/
+ *
+ */
+
+function event_calendar_get_event_for_edit($event_id) {
+ if ($event_id && $event = get_entity($event_id)) {
+ if ($event->canEdit()) {
+ return $event;
+ } else {
+ return false;
+ }
+ } else {
+ return false;
+ }
+}
+
+function event_calendar_get_event_from_form() {
+
+ // returns an event data object (not an ElggObject)
+
+ $event_data = new stdClass();
+ $event_data->form_data = true;
+ // debug message to test new add user feature
+ $event_data->event_id = get_input('event_id',0);
+ $event_data->access_id = get_input('access',ACCESS_PRIVATE);
+ $event_data->title = get_input('title','');
+ $event_data->description = get_input('brief_description','');
+ $event_data->venue = get_input('venue','');
+ $event_calendar_times = get_plugin_setting('times', 'event_calendar');
+ $event_calendar_region_display = get_plugin_setting('region_display', 'event_calendar');
+ $event_calendar_type_display = get_plugin_setting('type_display', 'event_calendar');
+ $event_calendar_spots_display = get_plugin_setting('spots_display', 'event_calendar');
+ if ($event_calendar_times == 'yes') {
+ $sh = get_input('start_time_h','');
+ $sm = get_input('start_time_m','');
+ if (is_numeric($sh) && is_numeric($sm)) {
+ // workaround for pulldown zero value bug
+ $sh--;
+ $sm--;
+ $event_data->start_time = $sh*60+$sm;
+ } else {
+ $event_data->start_time = '';
+ }
+ $eh = get_input('end_time_h','');
+ $em = get_input('end_time_m','');
+ if (is_numeric($eh) && is_numeric($em)) {
+ // workaround for pulldown zero value bug
+ $eh--;
+ $em--;
+ $event_data->end_time = $eh*60+$em;
+ } else {
+ $event_data->end_time = '';
+ }
+ }
+ $event_data->start_date = get_input('start_date','');
+ $event_data->end_date = get_input('end_date','');
+ if ($event_calendar_spots_display == 'yes') {
+ $event_data->spots = get_input('spots','');
+ }
+ if ($event_calendar_region_display == 'yes') {
+ $region = get_input('region','');
+ if ($region == '-') {
+ $region = '';
+ }
+ $event_data->region = $region;
+ }
+ if ($event_calendar_type_display == 'yes') {
+ $event_type = get_input('event_type','');
+ if ($event_type == '-') {
+ $event_type = '';
+ }
+ $event_data->event_type = $event_type;
+ }
+ $event_data->fees = get_input('fees','');
+ $event_data->contact = get_input('contact','');
+ $event_data->organiser = get_input('organiser','');
+ $event_data->event_tags = get_input('event_tags','');
+ $event_data->long_description = get_input('long_description','');
+
+ return $event_data;
+}
+
+function event_calendar_set_event_from_form() {
+ global $CONFIG;
+
+ $group_guid = 0;
+ $result = new stdClass();
+ $ed = event_calendar_get_event_from_form();
+ $result->form_data = $ed;
+ $fields_are_valid = TRUE;
+ $event_calendar_times = get_plugin_setting('times', 'event_calendar');
+ $event_calendar_region_display = get_plugin_setting('region_display', 'event_calendar');
+ $event_calendar_type_display = get_plugin_setting('type_display', 'event_calendar');
+ $event_calendar_spots_display = get_plugin_setting('spots_display', 'event_calendar');
+ $event_calendar_hide_end = get_plugin_setting('hide_end', 'event_calendar');
+ $event_calendar_more_required = get_plugin_setting('more_required', 'event_calendar');
+
+ if ($event_calendar_more_required == 'yes') {
+ $required_fields = array('title','venue','start_date',
+ 'brief_description','fees','contact','organiser',
+ 'event_tags');
+
+ if ($event_calendar_times == 'yes') {
+ $required_fields[] = 'start_time';
+ if ($event_calendar_hide_end != 'yes') {
+ $required_fields[] = 'end_time';
+ }
+ }
+ if ($event_calendar_region_display == 'yes') {
+ $required_fields[] = 'region';
+ }
+ if ($event_calendar_type_display == 'yes') {
+ $required_fields[] = 'event_type';
+ }
+ if ($event_calendar_spots_display == 'yes') {
+ $required_fields[] = 'spots';
+ }
+ } else {
+ $required_fields = array('title','venue','start_date');
+ }
+ foreach ($required_fields as $fn) {
+ if (!trim($ed->$fn)) {
+ $fields_are_valid = FALSE;
+ break;
+ }
+ }
+ if ($fields_are_valid) {
+ if ($ed->event_id) {
+ $event = get_entity($ed->event_id);
+ if (!$event) {
+ // do nothing because this is a bad event id
+ $result->success = false;
+ }
+ } else {
+ $event = new ElggObject();
+ $event->subtype = 'event_calendar';
+ $event->owner_guid = $_SESSION['user']->getGUID();
+ $group_guid = (int) get_input('group_guid',0);
+ if ($group_guid) {
+ $event->container_guid = $group_guid;
+ } else {
+ $event->container_guid = $event->owner_guid;
+ }
+ }
+ $event->access_id = $ed->access_id;
+ $event->title = $ed->title;
+ $event->description = $ed->description;
+ $event->venue = $ed->venue;
+ $event->start_date = strtotime($ed->start_date);
+ if ($ed->end_date) {
+ $event->end_date = strtotime($ed->end_date);
+ } else {
+ $event->end_date = $ed->end_date;
+ }
+ if ($event_calendar_times == 'yes') {
+ $event->start_time = $ed->start_time;
+ //$event->original_start_date = $event->start_date;
+ if (is_numeric($ed->start_time)) {
+ // Set start date to the Unix start time, if set.
+ // This allows sorting by date *and* time.
+ $event->start_date += $ed->start_time*60;
+ }
+ $event->end_time = $ed->end_time;
+ }
+ if ($event_calendar_spots_display == 'yes') {
+ $event->spots = trim($ed->spots);
+ }
+ if ($event_calendar_region_display == 'yes') {
+ $event->region = $ed->region;
+ }
+ if ($event_calendar_type_display == 'yes') {
+ $event->event_type = $ed->event_type;
+ }
+ $event->fees = $ed->fees;
+ $event->contact = $ed->contact;
+ $event->organiser = $ed->organiser;
+ $event->event_tags = array_reverse(string_to_tag_array($ed->event_tags));
+ $event->long_description = $ed->long_description;
+ $event->real_end_time = event_calendar_get_end_time($event);
+ $result->success = $event->save();
+ if ($result->success) {
+ if ($group_guid && (get_plugin_setting('autogroup', 'event_calendar') == 'yes')) {
+ event_calendar_add_personal_events_from_group($event->getGUID(),$group_guid);
+ }
+ if (get_plugin_setting('add_users', 'event_calendar') == 'yes') {
+ if (function_exists('autocomplete_member_to_user')) {
+ $addusers = get_input('adduser',array());
+ foreach($addusers as $adduser) {
+ if ($adduser) {
+ $user = autocomplete_member_to_user($adduser);
+ $user_id = $user->guid;
+ event_calendar_add_personal_event($event->guid,$user_id);
+ if (get_plugin_setting('add_users_notify', 'event_calendar') == 'yes') {
+ notify_user($user_id, $CONFIG->site->guid, elgg_echo('event_calendar:add_users_notify:subject'),
+ sprintf(
+ elgg_echo('event_calendar:add_users_notify:body'),
+ $user->name,
+ $event->title,
+ $event->getURL()
+ )
+ );
+ }
+ }
+ }
+ }
+ }
+ }
+ $result->event = $event;
+ } else {
+ // required data missing
+ $result->success = false;
+ }
+
+ return $result;
+}
+
+function event_calendar_get_events_between($start_date,$end_date,$is_count,$limit=10,$offset=0,$container_guid=0,$region='-') {
+ if ($is_count) {
+ $count = event_calendar_get_entities_from_metadata_between('start_date','end_date',
+ $start_date, $end_date, "object", "event_calendar", 0, $container_guid, $limit,$offset,"",0,false,true,$region);
+ return $count;
+ } else {
+ $events = event_calendar_get_entities_from_metadata_between('start_date','end_date',
+ $start_date, $end_date, "object", "event_calendar", 0, $container_guid, $limit,$offset,"",0,false,false,$region);
+ //return event_calendar_vsort($events,'start_date');
+ return $events;
+ }
+}
+
+function event_calendar_get_open_events_between($start_date,$end_date,
+$is_count,$limit=10,$offset=0,$container_guid=0,$region='-', $meta_max = 'spots', $annotation_name = 'personal_event') {
+ if ($is_count) {
+ $count = event_calendar_get_entities_from_metadata_between2('start_date','end_date',
+ $start_date, $end_date, "object", "event_calendar", 0, $container_guid, $limit,$offset,"",0,false,true,$region,$meta_max,$annotation_name);
+ return $count;
+ } else {
+ $events = event_calendar_get_entities_from_metadata_between2('start_date','end_date',
+ $start_date, $end_date, "object", "event_calendar", 0, $container_guid, $limit,$offset,"",0,false,false,$region,$meta_max,$annotation_name);
+ //return event_calendar_vsort($events,'start_date');
+ return $events;
+ }
+}
+
+function event_calendar_get_events_for_user_between($start_date,$end_date,$is_count,$limit=10,$offset=0,$user_guid,$container_guid=0,$region='-') {
+ if ($is_count) {
+ $count = event_calendar_get_entities_from_metadata_between('start_date','end_date',
+ $start_date, $end_date, "object", "event_calendar", $user_guid, $container_guid, $limit,$offset,"",0,true,true,$region);
+ return $count;
+ } else {
+ $events = event_calendar_get_entities_from_metadata_between('start_date','end_date',
+ $start_date, $end_date, "object", "event_calendar", $user_guid, $container_guid, $limit,$offset,"",0,true,false,$region);
+ //return event_calendar_vsort($events,'start_date');
+ return $events;
+ }
+}
+
+// TODO - replace the original version with this one
+function event_calendar_get_events_for_user_between2($start_date,$end_date,$is_count,$limit=10,$offset=0,$user_guid,$container_guid=0,$region='-') {
+ if ($is_count) {
+ $count = event_calendar_get_entities_from_metadata_between('start_date','real_end_time',
+ $start_date, $end_date, "object", "event_calendar", $user_guid, $container_guid, $limit,$offset,"",0,true,true,$region);
+ return $count;
+ } else {
+ $events = event_calendar_get_entities_from_metadata_between('start_date','real_end_time',
+ $start_date, $end_date, "object", "event_calendar", $user_guid, $container_guid, $limit,$offset,"",0,true,false,$region);
+ //return event_calendar_vsort($events,'start_date');
+ return $events;
+ }
+}
+
+function event_calendar_get_events_for_friends_between($start_date,$end_date,$is_count,$limit=10,$offset=0,$user_guid,$container_guid=0,$region='-') {
+ if ($user_guid) {
+ $friends = get_user_friends($user_guid,"",5000);
+ if ($friends) {
+ $friend_guids = array();
+ foreach($friends as $friend) {
+ $friend_guids[] = $friend->getGUID();
+ }
+ if ($is_count) {
+ $count = event_calendar_get_entities_from_metadata_between('start_date','end_date',
+ $start_date, $end_date, "object", "event_calendar", $friend_guids, $container_guid, $limit,$offset,"",0,true,true,$region);
+ return $count;
+ } else {
+ $events = event_calendar_get_entities_from_metadata_between('start_date','end_date',
+ $start_date, $end_date, "object", "event_calendar", $friend_guids, $container_guid, $limit,$offset,"",0,true,false,$region);
+ //return event_calendar_vsort($events,'start_date');
+ return $events;
+ }
+ }
+ }
+ return array();
+}
+
+function event_calendar_vsort($original,$field, $descending = false) {
+ if (!$original) {
+ return $original;
+ }
+ $sortArr = array();
+
+ foreach ( $original as $key => $item ) {
+ $sortArr[ $key ] = $item->$field;
+ }
+
+ if ( $descending ) {
+ arsort( $sortArr );
+ } else {
+ asort( $sortArr );
+ }
+
+ $resultArr = array();
+ foreach ( $sortArr as $key => $value ) {
+ $resultArr[ $key ] = $original[ $key ];
+ }
+
+ return $resultArr;
+}
+
+/**
+ * Return a list of entities based on the given search criteria.
+ * In this case, returns entities with the given metadata between two values inclusive
+ *
+ * @param mixed $meta_start_name
+ * @param mixed $meta_end_name
+ * @param mixed $meta_start_value - start of metadata range, must be numerical value
+ * @param mixed $meta_end_value - end of metadata range, must be numerical value
+ * @param string $entity_type The type of entity to look for, eg 'site' or 'object'
+ * @param string $entity_subtype The subtype of the entity.
+ * @param mixed $owner_guid Either one integer user guid or an array of user guids
+ * @param int $container_guid If supplied, the result is restricted to events associated with a specific container
+ * @param int $limit
+ * @param int $offset
+ * @param string $order_by Optional ordering.
+ * @param int $site_guid The site to get entities for. Leave as 0 (default) for the current site; -1 for all sites.
+ * @param boolean $filter Filter by events in personal calendar if true
+ * @param true|false $count If set to true, returns the total number of entities rather than a list. (Default: false)
+ *
+ * @return int|array A list of entities, or a count if $count is set to true
+ */
+function event_calendar_get_entities_from_metadata_between($meta_start_name, $meta_end_name, $meta_start_value, $meta_end_value, $entity_type = "", $entity_subtype = "", $owner_guid = 0, $container_guid = 0, $limit = 10, $offset = 0, $order_by = "", $site_guid = 0, $filter = false, $count = false, $region='-')
+{
+ global $CONFIG;
+
+ // This should not be possible, but a sanity check just in case
+ if (!is_numeric($meta_start_value) || !is_numeric($meta_end_value)) {
+ return FALSE;
+ }
+
+ $meta_start_n = get_metastring_id($meta_start_name);
+ $meta_end_n = get_metastring_id($meta_end_name);
+ if ($region && $region != '-') {
+ $region_n = get_metastring_id('region');
+ $region_value_n = get_metastring_id($region);
+ if (!$region_n || !$region_value_n) {
+ if ($count) {
+ return 0;
+ } else {
+ return FALSE;
+ }
+ }
+ }
+
+ $entity_type = sanitise_string($entity_type);
+ $entity_subtype = get_subtype_id($entity_type, $entity_subtype);
+ $limit = (int)$limit;
+ $offset = (int)$offset;
+ //if ($order_by == "") $order_by = "e.time_created desc";
+ if ($order_by == "") $order_by = "v.string asc";
+ $order_by = sanitise_string($order_by);
+ $site_guid = (int) $site_guid;
+ if ((is_array($owner_guid) && (count($owner_guid)))) {
+ foreach($owner_guid as $key => $guid) {
+ $owner_guid[$key] = (int) $guid;
+ }
+ } else {
+ $owner_guid = (int) $owner_guid;
+ }
+
+ if ((is_array($container_guid) && (count($container_guid)))) {
+ foreach($container_guid as $key => $guid) {
+ $container_guid[$key] = (int) $guid;
+ }
+ } else {
+ $container_guid = (int) $container_guid;
+ }
+ if ($site_guid == 0)
+ $site_guid = $CONFIG->site_guid;
+
+ //$access = get_access_list();
+
+ $where = array();
+
+ if ($entity_type!="")
+ $where[] = "e.type='$entity_type'";
+ if ($entity_subtype)
+ $where[] = "e.subtype=$entity_subtype";
+ $where[] = "m.name_id='$meta_start_n'";
+ $where[] = "m2.name_id='$meta_end_n'";
+ $where[] = "((v.string >= $meta_start_value AND v.string <= $meta_end_value) OR ( v2.string >= $meta_start_value AND v2.string <= $meta_end_value) OR (v.string <= $meta_start_value AND v2.string >= $meta_start_value) OR ( v2.string <= $meta_end_value AND v2.string >= $meta_end_value))";
+ if ($region && $region != '-') {
+ $where[] = "m3.name_id='$region_n'";
+ $where[] = "m3.value_id='$region_value_n'";
+ }
+ if ($site_guid > 0)
+ $where[] = "e.site_guid = {$site_guid}";
+ if ($filter) {
+ if (is_array($owner_guid)) {
+ $where[] = "ms2.string in (".implode(",",$owner_guid).")";
+ } else if ($owner_guid > 0) {
+ $where[] = "ms2.string = {$owner_guid}";
+ }
+
+ $where[] = "ms.string = 'personal_event'";
+ } else {
+ if (is_array($owner_guid)) {
+ $where[] = "e.owner_guid in (".implode(",",$owner_guid).")";
+ } else if ($owner_guid > 0) {
+ $where[] = "e.owner_guid = {$owner_guid}";
+ }
+ }
+
+ if (is_array($container_guid)) {
+ $where[] = "e.container_guid in (".implode(",",$container_guid).")";
+ } else if ($container_guid > 0)
+ $where[] = "e.container_guid = {$container_guid}";
+
+ if (!$count) {
+ $query = "SELECT distinct e.* ";
+ } else {
+ $query = "SELECT count(distinct e.guid) as total ";
+ }
+
+ $query .= "from {$CONFIG->dbprefix}entities e JOIN {$CONFIG->dbprefix}metadata m on e.guid = m.entity_guid JOIN {$CONFIG->dbprefix}metadata m2 on e.guid = m2.entity_guid ";
+ if ($filter) {
+ $query .= "JOIN {$CONFIG->dbprefix}annotations a ON (a.entity_guid = e.guid) ";
+ $query .= "JOIN {$CONFIG->dbprefix}metastrings ms ON (a.name_id = ms.id) ";
+ $query .= "JOIN {$CONFIG->dbprefix}metastrings ms2 ON (a.value_id = ms2.id) ";
+ }
+ if ($region && $region != '-') {
+ $query .= "JOIN {$CONFIG->dbprefix}metadata m3 ON (e.guid = m3.entity_guid) ";
+ }
+ $query .= "JOIN {$CONFIG->dbprefix}metastrings v on v.id = m.value_id JOIN {$CONFIG->dbprefix}metastrings v2 on v2.id = m2.value_id where";
+ foreach ($where as $w)
+ $query .= " $w and ";
+ $query .= get_access_sql_suffix("e"); // Add access controls
+ $query .= ' and ' . get_access_sql_suffix("m"); // Add access controls
+ $query .= ' and ' . get_access_sql_suffix("m2"); // Add access controls
+
+
+
+ if (!$count) {
+ $query .= " order by $order_by limit $offset, $limit"; // Add order and limit
+ $entities = get_data($query, "entity_row_to_elggstar");
+ if (get_plugin_setting('add_to_group_calendar', 'event_calendar') == 'yes') {
+ if (get_entity($container_guid) instanceOf ElggGroup) {
+ $entities = event_calendar_get_entities_from_metadata_between_related($meta_start_name, $meta_end_name,
+ $meta_start_value, $meta_end_value, $entity_type,
+ $entity_subtype, $owner_guid, $container_guid,
+ $limit = 10, $offset = 0, $order_by = "", $site_guid = 0,
+ $filter = false, $count = false, $region='-',$entities);
+ }
+ }
+ return $entities;
+ } else {
+ if ($row = get_data_row($query))
+ return $row->total;
+ }
+ return false;
+}
+
+// adds any related events (has the display_on_group relation)
+// that meet the appropriate criteria
+
+function event_calendar_get_entities_from_metadata_between_related($meta_start_name, $meta_end_name,
+ $meta_start_value, $meta_end_value, $entity_type = "",
+ $entity_subtype = "", $owner_guid = 0, $container_guid = 0,
+ $limit = 10, $offset = 0, $order_by = "", $site_guid = 0,
+ $filter = false, $count = false, $region='-',$main_events) {
+
+ $main_list = array();
+ if ($main_events) {
+ foreach ($main_events as $event) {
+ $main_list[$event->guid] = $event;
+ }
+ }
+ $related_list = array();
+ $related_events = get_entities_from_relationship("display_on_group", $container_guid, TRUE);
+ if ($related_events) {
+ foreach ($related_events as $event) {
+ $related_list[$event->guid] = $event;
+ }
+ }
+ // get all the events (across all containers) that meet the criteria
+ $all_events = event_calendar_get_entities_from_metadata_between($meta_start_name, $meta_end_name,
+ $meta_start_value, $meta_end_value, $entity_type, $entity_subtype, $owner_guid,
+ 0, $limit, $offset, $order_by, $site_guid, $filter, $count, $region);
+
+ if ($all_events) {
+ foreach($all_events as $event) {
+ if (array_key_exists($event->guid,$related_list)
+ && !array_key_exists($event->guid,$main_list)) {
+ // add to main events
+ $main_events[] = $event;
+ }
+ }
+ }
+ return event_calendar_vsort($main_events,$meta_start_name);
+}
+
+// TODO: replace the original version with this one
+/**
+ * Return a list of entities based on the given search criteria.
+ * In this case, returns entities with the given metadata between two values inclusive
+ *
+ * @param mixed $meta_start_name
+ * @param mixed $meta_end_name
+ * @param mixed $meta_start_value - start of metadata range, must be numerical value
+ * @param mixed $meta_end_value - end of metadata range, must be numerical value
+ * @param string $entity_type The type of entity to look for, eg 'site' or 'object'
+ * @param string $entity_subtype The subtype of the entity.
+ * @param mixed $owner_guid Either one integer user guid or an array of user guids
+ * @param int $container_guid If supplied, the result is restricted to events associated with a specific container
+ * @param int $limit
+ * @param int $offset
+ * @param string $order_by Optional ordering.
+ * @param int $site_guid The site to get entities for. Leave as 0 (default) for the current site; -1 for all sites.
+ * @param boolean $filter Filter by events in personal calendar if true
+ * @param true|false $count If set to true, returns the total number of entities rather than a list. (Default: false)
+ * @param string $meta_max metadata name containing maximum annotation count
+ * @param string $annotation_name annotation name to count
+ *
+ * @return int|array A list of entities, or a count if $count is set to true
+ */
+function event_calendar_get_entities_from_metadata_between2
+($meta_start_name, $meta_end_name, $meta_start_value, $meta_end_value,
+$entity_type = "", $entity_subtype = "", $owner_guid = 0, $container_guid = 0,
+$limit = 10, $offset = 0, $order_by = "", $site_guid = 0, $filter = false,
+$count = false, $region='-', $meta_max = '', $annotation_name = '')
+{
+ global $CONFIG;
+
+ // This should not be possible, but a sanity check just in case
+ if (!is_numeric($meta_start_value) || !is_numeric($meta_end_value)) {
+ return FALSE;
+ }
+
+ $meta_start_n = get_metastring_id($meta_start_name);
+ $meta_end_n = get_metastring_id($meta_end_name);
+ if ($region && $region != '-') {
+ $region_n = get_metastring_id('region');
+ $region_value_n = get_metastring_id($region);
+ if (!$region_n || !$region_value_n) {
+ if ($count) {
+ return 0;
+ } else {
+ return false;
+ }
+ }
+ }
+
+ $entity_type = sanitise_string($entity_type);
+ $entity_subtype = get_subtype_id($entity_type, $entity_subtype);
+ $limit = (int)$limit;
+ $offset = (int)$offset;
+ //if ($order_by == "") $order_by = "e.time_created desc";
+ if ($order_by == "") $order_by = "v.string asc";
+ $order_by = sanitise_string($order_by);
+ $site_guid = (int) $site_guid;
+ if ((is_array($owner_guid) && (count($owner_guid)))) {
+ foreach($owner_guid as $key => $guid) {
+ $owner_guid[$key] = (int) $guid;
+ }
+ } else {
+ $owner_guid = (int) $owner_guid;
+ }
+
+ if ((is_array($container_guid) && (count($container_guid)))) {
+ foreach($container_guid as $key => $guid) {
+ $container_guid[$key] = (int) $guid;
+ }
+ } else {
+ $container_guid = (int) $container_guid;
+ }
+ if ($site_guid == 0)
+ $site_guid = $CONFIG->site_guid;
+
+ //$access = get_access_list();
+
+ $where = array();
+
+ if ($entity_type!="")
+ $where[] = "e.type='$entity_type'";
+ if ($entity_subtype)
+ $where[] = "e.subtype=$entity_subtype";
+ $where[] = "m.name_id='$meta_start_n'";
+ $where[] = "m2.name_id='$meta_end_n'";
+ $where[] = "((v.string >= $meta_start_value AND v.string <= $meta_end_value) OR ( v2.string >= $meta_start_value AND v2.string <= $meta_end_value) OR (v.string <= $meta_start_value AND v2.string >= $meta_start_value) OR ( v2.string <= $meta_end_value AND v2.string >= $meta_end_value))";
+ if ($region && $region != '-') {
+ $where[] = "m3.name_id='$region_n'";
+ $where[] = "m3.value_id='$region_value_n'";
+ }
+ if ($site_guid > 0)
+ $where[] = "e.site_guid = {$site_guid}";
+ if ($filter) {
+ if (is_array($owner_guid)) {
+ $where[] = "ms2.string in (".implode(",",$owner_guid).")";
+ } else if ($owner_guid > 0) {
+ $where[] = "ms2.string = {$owner_guid}";
+ }
+
+ $where[] = "ms.string = 'personal_event'";
+ } else {
+ if (is_array($owner_guid)) {
+ $where[] = "e.owner_guid in (".implode(",",$owner_guid).")";
+ } else if ($owner_guid > 0) {
+ $where[] = "e.owner_guid = {$owner_guid}";
+ }
+ }
+
+ if (is_array($container_guid)) {
+ $where[] = "e.container_guid in (".implode(",",$container_guid).")";
+ } else if ($container_guid > 0)
+ $where[] = "e.container_guid = {$container_guid}";
+
+ if (!$count) {
+ $query = "SELECT distinct e.* ";
+ } else {
+ $query = "SELECT count(distinct e.guid) as total ";
+ }
+
+ $query .= "FROM {$CONFIG->dbprefix}entities e JOIN {$CONFIG->dbprefix}metadata m on e.guid = m.entity_guid JOIN {$CONFIG->dbprefix}metadata m2 on e.guid = m2.entity_guid ";
+ if ($filter) {
+ $query .= "JOIN {$CONFIG->dbprefix}annotations a ON (a.entity_guid = e.guid) ";
+ $query .= "JOIN {$CONFIG->dbprefix}metastrings ms ON (a.name_id = ms.id) ";
+ $query .= "JOIN {$CONFIG->dbprefix}metastrings ms2 ON (a.value_id = ms2.id) ";
+ }
+ if ($region && $region != '-') {
+ $query .= "JOIN {$CONFIG->dbprefix}metadata m3 ON (e.guid = m3.entity_guid) ";
+ }
+ if ($meta_max && $annotation_name) {
+ // This groups events for which the meta max name is defined
+ // perhaps this should be a left join and accept null values?
+ // so it would return groups with no spots defined as well
+ $meta_max_n = get_metastring_id($meta_max);
+ $ann_n = get_metastring_id($annotation_name);
+ if (!$meta_max_n || !$ann_n) {
+ if ($count) {
+ return 0;
+ } else {
+ return false;
+ }
+ }
+
+ $query .= " LEFT JOIN {$CONFIG->dbprefix}metadata m4 ON (e.guid = m4.entity_guid AND m4.name_id=$meta_max_n) ";
+ $query .= " LEFT JOIN {$CONFIG->dbprefix}metastrings ms4 ON (m4.value_id = ms4.id) ";
+ $where[] = "((ms4.string is null) OR (ms4.string = \"\") OR (CONVERT(ms4.string,SIGNED) > (SELECT count(id) FROM {$CONFIG->dbprefix}annotations ann WHERE ann.entity_guid = e.guid AND name_id = $ann_n GROUP BY entity_guid)))";
+ }
+ $query .= "JOIN {$CONFIG->dbprefix}metastrings v on v.id = m.value_id JOIN {$CONFIG->dbprefix}metastrings v2 on v2.id = m2.value_id where";
+ foreach ($where as $w)
+ $query .= " $w AND ";
+ $query .= get_access_sql_suffix("e"); // Add access controls
+ $query .= ' AND ' . get_access_sql_suffix("m"); // Add access controls
+ $query .= ' AND ' . get_access_sql_suffix("m2"); // Add access controls
+
+ if (!$count) {
+ $query .= " order by $order_by limit $offset, $limit"; // Add order and limit
+ return get_data($query, "entity_row_to_elggstar");
+ } else {
+ if ($row = get_data_row($query))
+ return $row->total;
+ }
+ return false;
+}
+
+function event_calendar_has_personal_event($event_id,$user_id) {
+ $annotations = get_annotations($event_id, "object", "event_calendar", "personal_event", (int) $user_id, $user_id);
+ if ($annotations && count($annotations) > 0) {
+ return true;
+ } else {
+ return false;
+ }
+}
+
+function event_calendar_add_personal_event($event_id,$user_id) {
+ if ($event_id && $user_id) {
+ if ( !event_calendar_has_personal_event($event_id,$user_id)
+ && !event_calendar_has_collision($event_id,$user_id)) {
+ if (!event_calendar_is_full($event_id)) {
+ create_annotation($event_id, "personal_event", (int) $user_id, 'integer', $user_id, ACCESS_PUBLIC);
+ return TRUE;
+ }
+ }
+ }
+ return FALSE;
+}
+
+function event_calendar_add_personal_events_from_group($event_id,$group_guid) {
+ $members = get_group_members($group_guid, 100000);
+ foreach($members as $member) {
+ $member_id = $member->getGUID();
+ event_calendar_add_personal_event($event_id,$member_id);
+ }
+}
+
+function event_calendar_remove_personal_event($event_id,$user_id) {
+ $annotations = get_annotations($event_id, "object", "event_calendar", "personal_event", (int) $user_id, $user_id);
+ if ($annotations) {
+ foreach ($annotations as $annotation) {
+ $annotation->delete();
+ }
+ }
+}
+
+function event_calendar_get_personal_events_for_user($user_id,$limit) {
+ $events = get_entities_from_annotations("object", "event_calendar", "personal_event", $user_id,0, 0, 1000);
+ $final_events = array();
+ if ($events) {
+ $now = time();
+ $one_day = 60*60*24;
+ // don't show events that have been over for more than a day
+ foreach($events as $event) {
+ if (($event->start_date > $now-$one_day) || ($event->end_date && ($event->end_date > $now-$one_day))) {
+ $final_events[] = $event;
+ }
+ }
+ }
+ $sorted = event_calendar_vsort($final_events,'start_date');
+ return array_slice($sorted,0,$limit);
+}
+
+function event_calendar_get_users_for_event($event_id,$limit,$offset,$is_count) {
+ if ($is_count) {
+ return count_annotations($event_id, "object", "event_calendar", "personal_event");
+ } else {
+ $users = array();
+ $annotations = get_annotations($event_id, "object", "event_calendar", "personal_event", "", 0, $limit, $offset);
+ if ($annotations) {
+ foreach($annotations as $annotation) {
+ if (($user = get_entity($annotation->value)) && ($user instanceOf ElggUser)) {
+ $users[] = $user;
+ }
+ }
+ }
+ return $users;
+ }
+}
+
+function event_calendar_security_fields() {
+ $ts = time();
+ $token = generate_action_token($ts);
+ return "__elgg_token=$token&__elgg_ts=$ts";
+}
+
+function event_calendar_get_events_for_group($group_guid) {
+ return get_entities('object','event_calendar',0,"",0,0,false,0,$group_guid);
+}
+
+function event_calendar_handle_join($event, $object_type, $object) {
+ $group = $object['group'];
+ $user = $object['user'];
+ $user_guid = $user->getGUID();
+ $events = event_calendar_get_events_for_group($group->getGUID());
+ foreach ($events as $event) {
+ $event_id = $event->getGUID();
+ event_calendar_add_personal_event($event_id,$user_guid);
+ }
+}
+
+function event_calendar_handle_leave($event, $object_type, $object) {
+ $group = $object['group'];
+ $user = $object['user'];
+ $user_guid = $user->getGUID();
+ $events = event_calendar_get_events_for_group($group->getGUID());
+ foreach ($events as $event) {
+ $event_id = $event->getGUID();
+ event_calendar_remove_personal_event($event_id,$user_guid);
+ }
+}
+
+function event_calendar_convert_time($time) {
+ $hour = floor($time/60);
+ $minute = sprintf("%02d",$time-60*$hour);
+ return "$hour:$minute";
+}
+
+function event_calendar_format_time($date,$time1,$time2='') {
+ if (is_numeric($time1)) {
+ $t = event_calendar_convert_time($time1);
+ if (is_numeric($time2)) {
+ $t .= " - ".event_calendar_convert_time($time2);
+ }
+ return "$t, $date";
+ } else {
+ return $date;
+ }
+}
+
+function event_calendar_activated_for_group($group) {
+ $group_calendar = get_plugin_setting('group_calendar', 'event_calendar');
+ $group_default = get_plugin_setting('group_default', 'event_calendar');
+ if ($group && ($group_calendar != 'no')) {
+ if ( ($group->event_calendar_enable == 'yes') || ((!$group->event_calendar_enable && (!$group_default || $group_default == 'yes')))) {
+ return true;
+ }
+ }
+ return false;
+}
+
+function event_calendar_get_region($event) {
+ $event_calendar_region_list_handles = get_plugin_setting('region_list_handles', 'event_calendar');
+ $region = trim($event->region);
+ if ($event_calendar_region_list_handles == 'yes') {
+ $region = elgg_echo('event_calendar:region:'.$region);
+ }
+ return htmlspecialchars($region);
+}
+
+function event_calendar_get_type($event) {
+ $event_calendar_type_list_handles = get_plugin_setting('type_list_handles', 'event_calendar');
+ $type = trim($event->event_type);
+ if ($event_calendar_type_list_handles == 'yes') {
+ $type = elgg_echo('event_calendar:type:'.$type);
+ }
+ return htmlspecialchars($type);
+}
+
+function event_calendar_get_formatted_full_items($event) {
+ $time_bit = event_calendar_get_formatted_time($event);
+ $event_calendar_region_display = get_plugin_setting('region_display', 'event_calendar');
+ $event_calendar_type_display = get_plugin_setting('type_display', 'event_calendar');
+ $event_items = array();
+ $item = new stdClass();
+ $item->title = elgg_echo('event_calendar:when_label');
+ $item->value = $time_bit;
+ $event_items[] = $item;
+ $item = new stdClass();
+ $item->title = elgg_echo('event_calendar:venue_label');
+ $item->value = htmlspecialchars($event->venue);
+ $event_items[] = $item;
+ if ($event_calendar_region_display == 'yes') {
+ $item = new stdClass();
+ $item->title = elgg_echo('event_calendar:region_label');
+ $item->value = event_calendar_get_region($event);
+ $event_items[] = $item;
+ }
+ if ($event_calendar_type_display == 'yes') {
+ $item = new stdClass();
+ $item->title = elgg_echo('event_calendar:type_label');
+ $item->value = event_calendar_get_type($event);
+ $event_items[] = $item;
+ }
+ $item = new stdClass();
+ $item->title = elgg_echo('event_calendar:fees_label');
+ $item->value = htmlspecialchars($event->fees);
+ $event_items[] = $item;
+ $item = new stdClass();
+ $item->title = elgg_echo('event_calendar:organiser_label');
+ $item->value = htmlspecialchars($event->organiser);
+ $event_items[] = $item;
+ $item = new stdClass();
+ $item->title = elgg_echo('event_calendar:contact_label');
+ $item->value = htmlspecialchars($event->contact);
+ $event_items[] = $item;
+ $item = new stdClass();
+ $item->title = elgg_echo('event_calendar:event_tags_label');
+ $item->value = elgg_view("output/tags",array('value'=>$event->event_tags));
+ $event_items[] = $item;
+
+ return $event_items;
+}
+
+function event_calendar_get_formatted_time($event) {
+ $date_format = 'j M Y';
+ $event_calendar_times = get_plugin_setting('times', 'event_calendar');
+
+ $start_date = date($date_format,$event->start_date);
+ if ((!$event->end_date) || ($event->end_date == $event->start_date)) {
+ if ($event_calendar_times) {
+ $start_date = event_calendar_format_time($start_date,$event->start_time,$event->end_time);
+ }
+ $time_bit = $start_date;
+ } else {
+ $end_date = date($date_format,$event->end_date);
+ if ($event_calendar_times) {
+ $start_date = event_calendar_format_time($start_date,$event->start_time);
+ $end_date = event_calendar_format_time($end_date,$event->end_time);
+ }
+ $time_bit = "$start_date - $end_date";
+ }
+
+ return $time_bit;
+}
+
+function event_calendar_get_formatted_date($ts) {
+ // TODO: make the date format configurable
+ return date('j/n/Y',$ts);
+}
+
+function event_calendar_is_full($event_id) {
+ $event_calendar_spots_display = get_plugin_setting('spots_display', 'event_calendar');
+ if ($event_calendar_spots_display == 'yes') {
+ $count = event_calendar_get_users_for_event($event_id,0,0,TRUE);
+ $event = get_entity($event_id);
+ if ($event) {
+ $spots = $event->spots;
+ if (is_numeric($spots)) {
+ if ($count >= $spots) {
+ return TRUE;
+ }
+ }
+ }
+ }
+ return FALSE;
+}
+
+function event_calendar_has_collision($event_id, $user_id) {
+ $no_collisions = get_plugin_setting('no_collisions', 'event_calendar');
+ if ($no_collisions == 'yes') {
+ $event = get_entity($event_id);
+ if ($event) {
+ $start_time = $event->start_date;
+ $end_time = event_calendar_get_end_time($event);
+ // look to see if the user already has events within this period
+ $count = event_calendar_get_events_for_user_between2($start_time,$end_time,TRUE,10,0,$user_id);
+ if ($count > 0) {
+ return TRUE;
+ } else {
+ return FALSE;
+ }
+ }
+ }
+
+ return FALSE;
+}
+
+// this complicated bit of code determines the event end time
+function event_calendar_get_end_time($event) {
+ $default_length = get_plugin_setting('collision_length', 'event_calendar');
+ $start_time = $event->start_date;
+ $end_time = $event->end_time;
+ $end_date = $event->end_date;
+ if($end_date) {
+ if ($end_time) {
+ $end_time = $end_date+$end_time*60;
+ } else if ($start_time == $end_date) {
+ if (is_numeric($default_length)) {
+ $end_time = $end_date + $default_length;
+ } else {
+ // default to an hour length
+ $end_time = $start_time + 3600;
+ }
+ } else {
+ $end_time = $end_date;
+ }
+ } else {
+ if ($end_time) {
+ if ($event->start_time) {
+ $end_time = $start_time + ($end_time*60 - $event->start_time*60);
+ } else {
+ $end_time = $start_time + $end_time*60;
+ }
+ } else {
+ if (is_numeric($default_length)) {
+ $end_time = $start_time + $default_length;
+ } else {
+ // default to an hour length
+ $end_time = $start_time + 3600;
+ }
+ }
+ }
+
+ return $end_time;
+}
+
+// a version to allow for some customised options
+function event_calendar_view_entity_list($entities, $count, $offset, $limit, $fullview = true, $viewtypetoggle = true, $pagination = true) {
+ $count = (int) $count;
+ $limit = (int) $limit;
+
+ // do not require views to explicitly pass in the offset
+ if (!$offset = (int) $offset) {
+ $offset = sanitise_int(get_input('offset', 0));
+ }
+
+ $context = get_context();
+
+ $html = elgg_view('event_calendar/entities/entity_list',array(
+ 'entities' => $entities,
+ 'count' => $count,
+ 'offset' => $offset,
+ 'limit' => $limit,
+ 'baseurl' => $_SERVER['REQUEST_URI'],
+ 'fullview' => $fullview,
+ 'context' => $context,
+ 'viewtypetoggle' => $viewtypetoggle,
+ 'viewtype' => get_input('search_viewtype','list'),
+ 'pagination' => $pagination
+ ));
+
+ return $html;
+}
+
+function event_calendar_personal_can_manage($event,$user_id) {
+ $authorised = FALSE;
+ $event_calendar_personal_manage = get_plugin_setting('personal_manage', 'event_calendar');
+ if ($event_calendar_personal_manage != 'no') {
+ $authorised = TRUE;
+ } else {
+ if(isadminloggedin()) {
+ $authorised = TRUE;
+ } else {
+ // load the event from the database
+ if ($event && ($event->owner_guid == $user_id)) {
+ $authorised = TRUE;
+ }
+ }
+ }
+
+ return $authorised;
+}
+
+function event_calendar_send_event_request($event,$user_id) {
+ global $CONFIG;
+ $result = FALSE;
+ if(add_entity_relationship($user_id, 'event_calendar_request', $event->guid)) {
+ $subject = elgg_echo('event_calendar:request_subject');
+ $name = get_entity($user_id)->name;
+ $title = $event->title;
+ $url = $event->getUrl();
+ $link = $CONFIG->wwwroot.'pg/event_calendar/review_requests/'.$event->guid;
+ $message = sprintf(elgg_echo('event_calendar:request_message'),$name,$title,$url,$link);
+ notify_user($event->owner_guid,$CONFIG->site->guid,$subject,$message);
+ $result = TRUE;
+ }
+ return $result;
+}
+
+?> \ No newline at end of file
diff --git a/trunk/pages/review_requests.php b/trunk/pages/review_requests.php
new file mode 100644
index 000000000..fc6c3726a
--- /dev/null
+++ b/trunk/pages/review_requests.php
@@ -0,0 +1,33 @@
+<?php
+
+gatekeeper();
+
+$event_id = get_input('event_id',0);
+
+$title = elgg_echo('event_calendar:review_requests_title');
+
+$event = get_entity($event_id);
+$user_id = get_loggedin_userid();
+
+if (event_calendar_personal_can_manage($event,$user_id)) {
+ $requests = elgg_get_entities_from_relationship(
+ array(
+ 'relationship' => 'event_calendar_request',
+ 'relationship_guid' => $event_id,
+ 'inverse_relationship' => TRUE,
+ 'limit' => 9999)
+ );
+ if ($requests) {
+ $body = elgg_view('event_calendar/review_requests',array('requests' => $requests, 'entity' => $event));
+ //$body = elgg_view('page_elements/contentwrapper',array('body'=>$body));
+ } else {
+ $body = elgg_view('page_elements/contentwrapper',array('body'=>elgg_echo('event_calendar:review_requests_request_none')));
+ }
+} else {
+ $body = elgg_view('page_elements/contentwrapper',array('body'=>elgg_echo('event_calendar:review_requests_error')));
+}
+
+$body = elgg_view_layout('two_column_left_sidebar', '', elgg_view_title($title).$body);
+
+page_draw($title, $body);
+?> \ No newline at end of file
diff --git a/trunk/show_event.php b/trunk/show_event.php
new file mode 100644
index 000000000..f2869c36d
--- /dev/null
+++ b/trunk/show_event.php
@@ -0,0 +1,60 @@
+<?php
+
+/**
+ * Show event
+ *
+ * @package event_calendar
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Kevin Jardine <kevin@radagast.biz>
+ * @copyright Radagast Solutions 2008
+ * @link http://radagast.biz/
+ *
+ */
+
+// Load Elgg engine
+require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+
+// Load event calendar model
+require_once(dirname(__FILE__) . "/models/model.php");
+
+// Define context
+set_context('event_calendar');
+
+global $CONFIG;
+
+$event_id = get_input('event_id',0);
+if ($event_id && ($event = get_entity($event_id))) {
+ $event_container = get_entity($event->container_guid);
+ if ($event_container instanceOf ElggGroup) {
+ // Re-define context
+ set_context('groups');
+ set_page_owner($event_container->getGUID());
+ }
+ $count = event_calendar_get_users_for_event($event_id,0,0,true);
+ if ($count > 0) {
+ add_submenu_item(sprintf(elgg_echo('event_calendar:personal_event_calendars_link'),$count), $CONFIG->url . "mod/event_calendar/display_event_users.php?event_id=".$event_id, '0eventnonadmin');
+ }
+ if (isloggedin()) {
+ $user_id = get_loggedin_userid();
+ if (event_calendar_personal_can_manage($event,$user_id)) {
+ if (event_calendar_has_personal_event($event_id,$user_id)) {
+ add_submenu_item(elgg_echo('event_calendar:remove_from_my_calendar'), $CONFIG->url . "action/event_calendar/manage?event_action=remove_personal&event_id=".$event_id.'&'.event_calendar_security_fields(), '0eventnonadmin');
+ } else {
+ if (!event_calendar_is_full($event_id) && !event_calendar_has_collision($event_id,$user_id)) {
+ add_submenu_item(elgg_echo('event_calendar:add_to_my_calendar'), $CONFIG->url . "action/event_calendar/manage?event_action=add_personal&event_id=".$event_id.'&'.event_calendar_security_fields(), '0eventnonadmin');
+ }
+ }
+ } else {
+ if (!check_entity_relationship($user_id, 'event_calendar_request', $event_id)) {
+ add_submenu_item(elgg_echo('event_calendar:make_request_title'), $CONFIG->url . "action/event_calendar/request_personal_calendar?event_id=".$event_id.'&'.event_calendar_security_fields(), '0eventnonadmin');
+ }
+ }
+ }
+ $body = elgg_view('object/event_calendar',array('entity'=>$event,'full'=>true));
+ $title = $event->title;
+ page_draw($title,elgg_view_layout("two_column_left_sidebar", '', elgg_view_title($title) . $body));
+} else {
+ register_error('event_calendar:error_nosuchevent');
+ forward();
+}
+?> \ No newline at end of file
diff --git a/trunk/show_events.php b/trunk/show_events.php
new file mode 100644
index 000000000..4d8f09702
--- /dev/null
+++ b/trunk/show_events.php
@@ -0,0 +1,213 @@
+<?php
+
+/**
+ * Show events
+ *
+ * @package event_calendar
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Kevin Jardine <kevin@radagast.biz>
+ * @copyright Radagast Solutions 2008
+ * @link http://radagast.biz/
+ *
+ */
+
+// Load Elgg engine
+require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+
+// Load event model
+require_once(dirname(__FILE__) . "/models/model.php");
+
+// Define context
+set_context('event_calendar');
+
+global $CONFIG;
+
+global $autofeed;
+$autofeed = true;
+
+$event = '';
+
+$event_calendar_listing_format = get_plugin_setting('listing_format', 'event_calendar');
+$event_calendar_spots_display = trim(get_plugin_setting('spots_display', 'event_calendar'));
+$event_calendar_first_date = trim(get_plugin_setting('first_date', 'event_calendar'));
+$event_calendar_last_date = trim(get_plugin_setting('last_date', 'event_calendar'));
+
+$original_start_date = get_input('start_date',date('Y-m-d'));
+if ( $event_calendar_first_date && ($original_start_date < $event_calendar_first_date) ) {
+ $original_start_date = $event_calendar_first_date;
+}
+if ( $event_calendar_last_date && ($original_start_date > $event_calendar_last_date) ) {
+ $original_start_date = $event_calendar_first_date;
+}
+
+if ($event_calendar_listing_format == 'paged') {
+ $start_ts = strtotime($original_start_date);
+ $start_date = $original_start_date;
+ if ($event_calendar_last_date) {
+ $end_ts = strtotime($event_calendar_last_date);
+ } else {
+ // set to a large number
+ $end_ts = 2000000000;
+ }
+} else {
+
+ // the default interval is one month
+ $day = 60*60*24;
+ $week = 7*$day;
+ $month = 31*$day;
+
+ $mode = trim(get_input('mode',''));
+
+ if ($mode == "day") {
+ $start_date = $original_start_date;
+ $end_date = $start_date;
+ $start_ts = strtotime($start_date);
+ $end_ts = strtotime($end_date)+$day-1;
+ } else if ($mode == "week") {
+ // need to adjust start_date to be the beginning of the week
+ $start_ts = strtotime($original_start_date);
+ $start_ts -= date("w",$start_ts)*$day;
+ $end_ts = $start_ts + 6*$day;
+
+ $start_date = date('Y-m-d',$start_ts);
+ $end_date = date('Y-m-d',$end_ts);
+ } else {
+ $start_ts = strtotime($original_start_date);
+ $month = date('m',$start_ts);
+ $year = date('Y',$start_ts);
+ $start_date = $year.'-'.$month.'-1';
+ $end_date = $year.'-'.$month.'-'.getLastDayOfMonth($month,$year);
+ //$subtitle = elgg_echo('event_calendar:month_label').': '.date('F Y',$start_ts);
+ // RIBA wants month prefix removed
+ }
+
+ if ($event_calendar_first_date && ($start_date < $event_calendar_first_date)) {
+ $start_date = $event_calendar_first_date;
+ }
+
+ if ($event_calendar_last_date && ($end_date > $event_calendar_last_date)) {
+ $end_date = $event_calendar_last_date;
+ }
+
+ $start_ts = strtotime($start_date);
+
+ if ($mode == "day") {
+ $end_ts = strtotime($end_date)+$day-1;
+ $subtitle = elgg_echo('event_calendar:day_label').': '.date('j F Y',strtotime($start_date));
+ } else if ($mode == "week") {
+ $end_ts = $start_ts + 6*$day;
+ $subtitle = elgg_echo('event_calendar:week_label').': '.date('j F',$start_ts) . ' - '.date('j F Y',$end_ts);
+ } else {
+ //$subtitle = elgg_echo('event_calendar:month_label').': '.date('F Y',$start_ts);
+ // RIBA wants month prefix removed
+ $end_ts = strtotime($end_date);
+ $subtitle = date('F Y',$start_ts);
+ }
+}
+
+$group_guid = (int) get_input('group_guid',0);
+if ($group_guid && $group = get_entity($group_guid)) {
+ // redefine context
+ set_context('groups');
+ set_page_owner($group_guid);
+ $group_calendar = get_plugin_setting('group_calendar', 'event_calendar');
+ if (!$group_calendar || $group_calendar == 'members') {
+ if (page_owner_entity()->canWriteToContainer($_SESSION['user'])){
+ add_submenu_item(elgg_echo('event_calendar:new'), $CONFIG->url . "pg/event_calendar/new/?group_guid=" . page_owner(), '1eventcalendaradmin');
+ }
+ } else if ($group_calendar == 'admin') {
+ if (isadminloggedin() || ($group->owner_guid == get_loggedin_userid())) {
+ add_submenu_item(elgg_echo('event_calendar:new'), $CONFIG->url . "pg/event_calendar/new/?group_guid=" . page_owner(), '1eventcalendaradmin');
+ }
+ }
+}
+
+$offset = get_input('offset');
+
+if ($offset != NULL) {
+ // don't allow ajax magic during pagination
+ $offset = (int) $offset;
+ $callback='';
+} else {
+ $offset = 0;
+ $callback = get_input('callback','');
+}
+
+$limit = 15;
+if ($event_calendar_spots_display == 'yes') {
+ $filter = get_input('filter','open');
+} else {
+ $filter = get_input('filter','all');
+}
+$region = get_input('region','-');
+if ($filter == 'all') {
+ $count = event_calendar_get_events_between($start_ts,$end_ts,true,$limit,$offset,$group_guid,$region);
+ $events = event_calendar_get_events_between($start_ts,$end_ts,false,$limit,$offset,$group_guid,$region);
+} else if ($filter == 'open') {
+ $count = event_calendar_get_open_events_between($start_ts,$end_ts,true,$limit,$offset,$group_guid,$region);
+ $events = event_calendar_get_open_events_between($start_ts,$end_ts,false,$limit,$offset,$group_guid,$region);
+} else if ($filter == 'friends') {
+ $user_guid = get_loggedin_userid();
+ $count = event_calendar_get_events_for_friends_between($start_ts,$end_ts,true,$limit,$offset,$user_guid,$group_guid,$region);
+ $events = event_calendar_get_events_for_friends_between($start_ts,$end_ts,false,$limit,$offset,$user_guid,$group_guid,$region);
+} else if ($filter == 'mine') {
+ $user_guid = get_loggedin_userid();
+ $count = event_calendar_get_events_for_user_between($start_ts,$end_ts,true,$limit,$offset,$user_guid,$group_guid,$region);
+ $events = event_calendar_get_events_for_user_between($start_ts,$end_ts,false,$limit,$offset,$user_guid,$group_guid,$region);
+}
+
+extend_view('metatags','event_calendar/metatags');
+
+$vars = array( 'original_start_date' => $original_start_date,
+ 'start_date' => $start_date,
+ 'end_date' => $end_date,
+ 'first_date' => $event_calendar_first_date,
+ 'last_date' => $event_calendar_last_date,
+ 'mode' => $mode,
+ 'events' => $events,
+ 'count' => $count,
+ 'offset' => $offset,
+ 'limit' => $limit,
+ 'group_guid' => $group_guid,
+ 'filter' => $filter,
+ 'region' => $region,
+ 'listing_format' => $event_calendar_listing_format,
+);
+
+if ($callback) {
+ if (isloggedin()) {
+ $nav = elgg_view('event_calendar/nav',$vars);
+ } else {
+ $nav = '';
+ }
+ if ($events) {
+ if (get_plugin_setting('agenda_view', 'event_calendar') == 'yes') {
+ $event_list = elgg_view('event_calendar/agenda_view',$vars);
+ } else {
+ $event_list = elgg_view_entity_list($events, $count, $offset, $limit, false, false);
+ }
+ } else {
+ $event_list = '<p>'.elgg_echo('event_calendar:no_events_found').'</p>';
+ }
+ echo $nav.'<br />'.$event_list;
+} else {
+
+ $body = elgg_view('event_calendar/show_events', $vars);
+
+ if ($event_calendar_listing_format == 'paged') {
+ $title = elgg_echo('event_calendar:upcoming_events_title');
+ } else {
+ $title = elgg_echo('event_calendar:show_events_title'). ' ('.$subtitle.')';
+ }
+
+ $body = elgg_view('page_elements/contentwrapper',array('body' =>$body, 'subclass' => 'events'));
+
+ page_draw($title,elgg_view_layout("two_column_left_sidebar", '', elgg_view_title($title).$body));
+}
+
+function getLastDayOfMonth($month,$year) {
+ return idate('d', mktime(0, 0, 0, ($month + 1), 0, $year));
+}
+
+
+?> \ No newline at end of file
diff --git a/trunk/start.php b/trunk/start.php
new file mode 100644
index 000000000..d12f56848
--- /dev/null
+++ b/trunk/start.php
@@ -0,0 +1,190 @@
+<?php
+
+ /**
+ * Event calendar plugin
+ *
+ * @package RIBA event
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Kevin Jardine <kevin@radagast.biz>
+ * @copyright Radagast Solutions 2008
+ * @link http://radagast.biz/
+ */
+ // Load event calendar model
+ require_once(dirname(__FILE__) . "/models/model.php");
+ /**
+ * event calendar initialisation
+ *
+ * These parameters are required for the event API, but we won't use them:
+ *
+ * @param unknown_type $event
+ * @param unknown_type $object_type
+ * @param unknown_type $object
+ */
+
+ function event_calendar_init() {
+
+ // Load system configuration
+ global $CONFIG;
+
+ // Register a page handler, so we can have nice URLs
+ register_page_handler('event_calendar','event_calendar_page_handler');
+
+ // Register URL handler
+ register_entity_url_handler('event_calendar_url','object', 'event_calendar');
+
+ // Register granular notification for this type
+ if (is_callable('register_notification_object'))
+ register_notification_object('object', 'event_calendar', elgg_echo('event_calendar:new_event'));
+
+ // Set up menu for users
+ if (isloggedin()) {
+ $site_calendar = get_plugin_setting('site_calendar', 'event_calendar');
+ if (!$site_calendar || $site_calendar != 'no') {
+ add_menu(elgg_echo('item:object:event_calendar'), $CONFIG->wwwroot . "pg/event_calendar/");
+ }
+ }
+ // make tags searchable for Elgg 1.7.4
+ if (function_exists('elgg_register_tag_metadata_name')) {
+ elgg_register_tag_metadata_name('event_tags');
+ }
+
+ //add to group profile page
+ $group_calendar = get_plugin_setting('group_calendar', 'event_calendar');
+ if (!$group_calendar || $group_calendar != 'no') {
+ $group_profile_display = get_plugin_setting('group_profile_display', 'event_calendar');
+ if (!$group_profile_display || $group_profile_display == 'right') {
+ extend_view('groups/right_column', 'event_calendar/groupprofile_calendar');
+ } else if ($group_profile_display == 'left') {
+ extend_view('groups/left_column', 'event_calendar/groupprofile_calendar');
+ }
+ }
+
+ //add to the css
+ extend_view('css', 'event_calendar/css');
+
+ //add a widget
+ add_widget_type('event_calendar',elgg_echo("event_calendar:widget_title"),elgg_echo('event_calendar:widget:description'));
+
+ // add the event calendar group tool option
+ if (function_exists('add_group_tool_option')) {
+ $event_calendar_group_default = get_plugin_setting('group_default', 'event_calendar');
+ if (!$event_calendar_group_default || ($event_calendar_group_default == 'yes')) {
+ add_group_tool_option('event_calendar',elgg_echo('event_calendar:enable_event_calendar'),true);
+ } else {
+ add_group_tool_option('event_calendar',elgg_echo('event_calendar:enable_event_calendar'),false);
+ }
+ }
+
+ // if autogroup is set, listen and respond to join/leave events
+ if (get_plugin_setting('autogroup', 'event_calendar') == 'yes') {
+ register_elgg_event_handler('join', 'group', 'event_calendar_handle_join');
+ register_elgg_event_handler('leave', 'group', 'event_calendar_handle_leave');
+ }
+
+ register_entity_type('object','event_calendar');
+ }
+
+ function event_calendar_pagesetup() {
+
+ global $CONFIG;
+
+ $page_owner = page_owner_entity();
+
+ $context = get_context();
+
+ // Group submenu option
+ if ($page_owner instanceof ElggGroup && $context == 'groups') {
+ if (event_calendar_activated_for_group($page_owner)) {
+ add_submenu_item(elgg_echo("event_calendar:group"), $CONFIG->wwwroot . "pg/event_calendar/group/" . $page_owner->getGUID());
+ }
+ } else if ($context == 'event_calendar'){
+ add_submenu_item(elgg_echo("event_calendar:site_wide_link"), $CONFIG->wwwroot . "pg/event_calendar/");
+ $site_calendar = get_plugin_setting('site_calendar', 'event_calendar');
+ if (!$site_calendar || $site_calendar == 'admin') {
+ if (isadminloggedin()) {
+ // only admins can post directly to the site-wide calendar
+ add_submenu_item(elgg_echo('event_calendar:new'), $CONFIG->url . "pg/event_calendar/new/", 'eventcalendaractions');
+ }
+ } else if ($site_calendar == 'loggedin') {
+ // any logged-in user can post to the site calendar
+ if (isloggedin()) {
+ add_submenu_item(elgg_echo('event_calendar:new'), $CONFIG->url . "pg/event_calendar/new/", 'eventcalendaractions');
+ }
+ }
+ }
+
+ if (($context == 'groups') || ($context == 'event_calendar')) {
+ if (($event_id = get_input('event_id',0)) && ($event = get_entity($event_id))) {
+ if (isadminloggedin() && (get_plugin_setting('allow_featured', 'event_calendar') == 'yes')) {
+ if ($event->featured) {
+ add_submenu_item(elgg_echo('event_calendar:unfeature'), $CONFIG->url . "action/event_calendar/unfeature?event_id=".$event_id.'&'.event_calendar_security_fields(), 'eventcalendaractions');
+ } else {
+ add_submenu_item(elgg_echo('event_calendar:feature'), $CONFIG->url . "action/event_calendar/feature?event_id=".$event_id.'&'.event_calendar_security_fields(), 'eventcalendaractions');
+ }
+ }
+ add_submenu_item(elgg_echo("event_calendar:view_link"), $CONFIG->wwwroot . "pg/event_calendar/view/" . $event_id,'0eventcalendaradmin');
+ if ($event->canEdit()) {
+ add_submenu_item(elgg_echo("event_calendar:edit_link"), $CONFIG->wwwroot . "mod/event_calendar/manage_event.php?event_id=" . $event_id,'0eventcalendaradmin');
+ add_submenu_item(elgg_echo("event_calendar:delete_link"), $CONFIG->wwwroot . "mod/event_calendar/delete_confirm.php?event_id=" . $event_id,'0eventcalendaradmin');
+ $event_calendar_personal_manage = get_plugin_setting('personal_manage', 'event_calendar');
+ if ($event_calendar_personal_manage == 'no') {
+ add_submenu_item(elgg_echo('event_calendar:review_requests_title'), $CONFIG->wwwroot . "pg/event_calendar/review_requests/".$event_id, '0eventcalendaradmin');
+ }
+ }
+ }
+ }
+ }
+
+ function event_calendar_url($entity) {
+ global $CONFIG;
+ return $CONFIG->url . 'pg/event_calendar/view/'.$entity->getGUID();
+ }
+
+ /**
+ * Page handler; allows the use of fancy URLs
+ *
+ * @param array $page From the page_handler function
+ * @return true|false Depending on success
+ */
+ function event_calendar_page_handler($page) {
+ if (isset($page[0]) && $page[0]) {
+ if (($page[0] == 'group') && isset($page[1])) {
+ set_input('group_guid',$page[1]);
+ if (isset($page[2])) {
+ set_input('filter',$page[2]);
+ }
+ @include(dirname(__FILE__) . "/show_events.php");
+ } else if (($page[0] == 'view') && isset($page[1])) {
+ set_input('event_id',$page[1]);
+ @include(dirname(__FILE__) . "/show_event.php");
+ } else if ($page[0] == 'new') {
+ @include(dirname(__FILE__) . "/manage_event.php");
+ } else if ($page[0] == 'review_requests' && isset($page[1])) {
+ set_input('event_id',$page[1]);
+ @include(dirname(__FILE__) . "/pages/review_requests.php");
+ } else if (in_array($page[0],array('all','friends','mine'))) {
+ set_input('filter',$page[0]);
+ @include(dirname(__FILE__) . "/show_events.php");
+ }
+ } else {
+ @include(dirname(__FILE__) . "/show_events.php");
+ }
+ return true;
+ }
+
+// Make sure the event calendar functions are called
+ register_elgg_event_handler('init','system','event_calendar_init');
+ register_elgg_event_handler('pagesetup','system','event_calendar_pagesetup');
+
+// Register actions
+
+ global $CONFIG;
+ register_action("event_calendar/manage",false,$CONFIG->pluginspath . "event_calendar/actions/manage.php");
+ register_action("event_calendar/request_personal_calendar",false,$CONFIG->pluginspath . "event_calendar/actions/request_personal_calendar.php");
+ register_action("event_calendar/toggle_personal_calendar",false,$CONFIG->pluginspath . "event_calendar/actions/toggle_personal_calendar.php");
+ register_action("event_calendar/killrequest",false,$CONFIG->pluginspath . "event_calendar/actions/killrequest.php");
+ register_action("event_calendar/addtocalendar",false,$CONFIG->pluginspath . "event_calendar/actions/addtocalendar.php");
+ register_action("event_calendar/add_to_group",false,$CONFIG->pluginspath . "event_calendar/actions/add_to_group.php");
+ register_action("event_calendar/remove_from_group",false,$CONFIG->pluginspath . "event_calendar/actions/remove_from_group.php");
+
+?> \ No newline at end of file
diff --git a/trunk/ui.core.min.js b/trunk/ui.core.min.js
new file mode 100644
index 000000000..b2352c67f
--- /dev/null
+++ b/trunk/ui.core.min.js
@@ -0,0 +1,9 @@
+/*
+ * jQuery UI 1.7.2
+ *
+ * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
+ * and GPL (GPL-LICENSE.txt) licenses.
+ *
+ * http://docs.jquery.com/UI
+ */ jQuery.ui||(function(c){var i=c.fn.remove,d=c.browser.mozilla&&(parseFloat(c.browser.version)<1.9);c.ui={version:"1.7.2",plugin:{add:function(k,l,n){var m=c.ui[k].prototype;for(var j in n){m.plugins[j]=m.plugins[j]||[];m.plugins[j].push([l,n[j]])}},call:function(j,l,k){var n=j.plugins[l];if(!n||!j.element[0].parentNode){return}for(var m=0;m<n.length;m++){if(j.options[n[m][0]]){n[m][1].apply(j.element,k)}}}},contains:function(k,j){return document.compareDocumentPosition?k.compareDocumentPosition(j)&16:k!==j&&k.contains(j)},hasScroll:function(m,k){if(c(m).css("overflow")=="hidden"){return false}var j=(k&&k=="left")?"scrollLeft":"scrollTop",l=false;if(m[j]>0){return true}m[j]=1;l=(m[j]>0);m[j]=0;return l},isOverAxis:function(k,j,l){return(k>j)&&(k<(j+l))},isOver:function(o,k,n,m,j,l){return c.ui.isOverAxis(o,n,j)&&c.ui.isOverAxis(k,m,l)},keyCode:{BACKSPACE:8,CAPS_LOCK:20,COMMA:188,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38}};if(d){var f=c.attr,e=c.fn.removeAttr,h="http://www.w3.org/2005/07/aaa",a=/^aria-/,b=/^wairole:/;c.attr=function(k,j,l){var m=l!==undefined;return(j=="role"?(m?f.call(this,k,j,"wairole:"+l):(f.apply(this,arguments)||"").replace(b,"")):(a.test(j)?(m?k.setAttributeNS(h,j.replace(a,"aaa:"),l):f.call(this,k,j.replace(a,"aaa:"))):f.apply(this,arguments)))};c.fn.removeAttr=function(j){return(a.test(j)?this.each(function(){this.removeAttributeNS(h,j.replace(a,""))}):e.call(this,j))}}c.fn.extend({remove:function(){c("*",this).add(this).each(function(){c(this).triggerHandler("remove")});return i.apply(this,arguments)},enableSelection:function(){return this.attr("unselectable","off").css("MozUserSelect","").unbind("selectstart.ui")},disableSelection:function(){return this.attr("unselectable","on").css("MozUserSelect","none").bind("selectstart.ui",function(){return false})},scrollParent:function(){var j;if((c.browser.msie&&(/(static|relative)/).test(this.css("position")))||(/absolute/).test(this.css("position"))){j=this.parents().filter(function(){return(/(relative|absolute|fixed)/).test(c.curCSS(this,"position",1))&&(/(auto|scroll)/).test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0)}else{j=this.parents().filter(function(){return(/(auto|scroll)/).test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0)}return(/fixed/).test(this.css("position"))||!j.length?c(document):j}});c.extend(c.expr[":"],{data:function(l,k,j){return !!c.data(l,j[3])},focusable:function(k){var l=k.nodeName.toLowerCase(),j=c.attr(k,"tabindex");return(/input|select|textarea|button|object/.test(l)?!k.disabled:"a"==l||"area"==l?k.href||!isNaN(j):!isNaN(j))&&!c(k)["area"==l?"parents":"closest"](":hidden").length},tabbable:function(k){var j=c.attr(k,"tabindex");return(isNaN(j)||j>=0)&&c(k).is(":focusable")}});function g(m,n,o,l){function k(q){var p=c[m][n][q]||[];return(typeof p=="string"?p.split(/,?\s+/):p)}var j=k("getter");if(l.length==1&&typeof l[0]=="string"){j=j.concat(k("getterSetter"))}return(c.inArray(o,j)!=-1)}c.widget=function(k,j){var l=k.split(".")[0];k=k.split(".")[1];c.fn[k]=function(p){var n=(typeof p=="string"),o=Array.prototype.slice.call(arguments,1);if(n&&p.substring(0,1)=="_"){return this}if(n&&g(l,k,p,o)){var m=c.data(this[0],k);return(m?m[p].apply(m,o):undefined)}return this.each(function(){var q=c.data(this,k);(!q&&!n&&c.data(this,k,new c[l][k](this,p))._init());(q&&n&&c.isFunction(q[p])&&q[p].apply(q,o))})};c[l]=c[l]||{};c[l][k]=function(o,n){var m=this;this.namespace=l;this.widgetName=k;this.widgetEventPrefix=c[l][k].eventPrefix||k;this.widgetBaseClass=l+"-"+k;this.options=c.extend({},c.widget.defaults,c[l][k].defaults,c.metadata&&c.metadata.get(o)[k],n);this.element=c(o).bind("setData."+k,function(q,p,r){if(q.target==o){return m._setData(p,r)}}).bind("getData."+k,function(q,p){if(q.target==o){return m._getData(p)}}).bind("remove",function(){return m.destroy()})};c[l][k].prototype=c.extend({},c.widget.prototype,j);c[l][k].getterSetter="option"};c.widget.prototype={_init:function(){},destroy:function(){this.element.removeData(this.widgetName).removeClass(this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").removeAttr("aria-disabled")},option:function(l,m){var k=l,j=this;if(typeof l=="string"){if(m===undefined){return this._getData(l)}k={};k[l]=m}c.each(k,function(n,o){j._setData(n,o)})},_getData:function(j){return this.options[j]},_setData:function(j,k){this.options[j]=k;if(j=="disabled"){this.element[k?"addClass":"removeClass"](this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").attr("aria-disabled",k)}},enable:function(){this._setData("disabled",false)},disable:function(){this._setData("disabled",true)},_trigger:function(l,m,n){var p=this.options[l],j=(l==this.widgetEventPrefix?l:this.widgetEventPrefix+l);m=c.Event(m);m.type=j;if(m.originalEvent){for(var k=c.event.props.length,o;k;){o=c.event.props[--k];m[o]=m.originalEvent[o]}}this.element.trigger(m,n);return !(c.isFunction(p)&&p.call(this.element[0],m,n)===false||m.isDefaultPrevented())}};c.widget.defaults={disabled:false};c.ui.mouse={_mouseInit:function(){var j=this;this.element.bind("mousedown."+this.widgetName,function(k){return j._mouseDown(k)}).bind("click."+this.widgetName,function(k){if(j._preventClickEvent){j._preventClickEvent=false;k.stopImmediatePropagation();return false}});if(c.browser.msie){this._mouseUnselectable=this.element.attr("unselectable");this.element.attr("unselectable","on")}this.started=false},_mouseDestroy:function(){this.element.unbind("."+this.widgetName);(c.browser.msie&&this.element.attr("unselectable",this._mouseUnselectable))},_mouseDown:function(l){l.originalEvent=l.originalEvent||{};if(l.originalEvent.mouseHandled){return}(this._mouseStarted&&this._mouseUp(l));this._mouseDownEvent=l;var k=this,m=(l.which==1),j=(typeof this.options.cancel=="string"?c(l.target).parents().add(l.target).filter(this.options.cancel).length:false);if(!m||j||!this._mouseCapture(l)){return true}this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){k.mouseDelayMet=true},this.options.delay)}if(this._mouseDistanceMet(l)&&this._mouseDelayMet(l)){this._mouseStarted=(this._mouseStart(l)!==false);if(!this._mouseStarted){l.preventDefault();return true}}this._mouseMoveDelegate=function(n){return k._mouseMove(n)};this._mouseUpDelegate=function(n){return k._mouseUp(n)};c(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);(c.browser.safari||l.preventDefault());l.originalEvent.mouseHandled=true;return true},_mouseMove:function(j){if(c.browser.msie&&!j.button){return this._mouseUp(j)}if(this._mouseStarted){this._mouseDrag(j);return j.preventDefault()}if(this._mouseDistanceMet(j)&&this._mouseDelayMet(j)){this._mouseStarted=(this._mouseStart(this._mouseDownEvent,j)!==false);(this._mouseStarted?this._mouseDrag(j):this._mouseUp(j))}return !this._mouseStarted},_mouseUp:function(j){c(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;this._preventClickEvent=(j.target==this._mouseDownEvent.target);this._mouseStop(j)}return false},_mouseDistanceMet:function(j){return(Math.max(Math.abs(this._mouseDownEvent.pageX-j.pageX),Math.abs(this._mouseDownEvent.pageY-j.pageY))>=this.options.distance)},_mouseDelayMet:function(j){return this.mouseDelayMet},_mouseStart:function(j){},_mouseDrag:function(j){},_mouseStop:function(j){},_mouseCapture:function(j){return true}};c.ui.mouse.defaults={cancel:null,distance:1,delay:0}})(jQuery); \ No newline at end of file
diff --git a/trunk/ui.datepicker.css b/trunk/ui.datepicker.css
new file mode 100644
index 000000000..567f8c97b
--- /dev/null
+++ b/trunk/ui.datepicker.css
@@ -0,0 +1,62 @@
+/* Datepicker
+----------------------------------*/
+.ui-datepicker { width: 17em; padding: .2em .2em 0; }
+.ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; }
+.ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; }
+.ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 1px; }
+.ui-datepicker .ui-datepicker-prev { left:2px; }
+.ui-datepicker .ui-datepicker-next { right:2px; }
+.ui-datepicker .ui-datepicker-prev-hover { left:1px; }
+.ui-datepicker .ui-datepicker-next-hover { right:1px; }
+.ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px; }
+.ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; }
+.ui-datepicker .ui-datepicker-title select { float:left; font-size:1em; margin:1px 0; }
+.ui-datepicker select.ui-datepicker-month-year {width: 100%;}
+.ui-datepicker select.ui-datepicker-month,
+.ui-datepicker select.ui-datepicker-year { width: 49%;}
+.ui-datepicker .ui-datepicker-title select.ui-datepicker-year { float: right; }
+.ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; }
+.ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0; }
+.ui-datepicker td { border: 0; padding: 1px; }
+.ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; }
+.ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding:0 .2em; border-left: 0; border-right: 0; border-bottom: 0; }
+.ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width:auto; overflow:visible; }
+.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float:left; }
+
+/* with multiple calendars */
+.ui-datepicker.ui-datepicker-multi { width:auto; }
+.ui-datepicker-multi .ui-datepicker-group { float:left; }
+.ui-datepicker-multi .ui-datepicker-group table { width:95%; margin:0 auto .4em; }
+.ui-datepicker-multi-2 .ui-datepicker-group { width:50%; }
+.ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; }
+.ui-datepicker-multi-4 .ui-datepicker-group { width:25%; }
+.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; }
+.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; }
+.ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; }
+.ui-datepicker-row-break { clear:both; width:100%; }
+
+/* RTL support */
+.ui-datepicker-rtl { direction: rtl; }
+.ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; }
+.ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; }
+.ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; }
+.ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; }
+.ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; }
+.ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; }
+.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; }
+.ui-datepicker-rtl .ui-datepicker-group { float:right; }
+.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
+.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
+
+/* IE6 IFRAME FIX (taken from datepicker 1.5.3 */
+.ui-datepicker-cover {
+ display: none; /*sorry for IE5*/
+ display/**/: block; /*sorry for IE5*/
+ position: absolute; /*must have*/
+ z-index: -1; /*must have*/
+ filter: mask(); /*must have*/
+ top: -4px; /*must have*/
+ left: -4px; /*must have*/
+ width: 200px; /*must have*/
+ height: 200px; /*must have*/
+} \ No newline at end of file
diff --git a/trunk/ui.datepicker.js b/trunk/ui.datepicker.js
new file mode 100644
index 000000000..009582c7d
--- /dev/null
+++ b/trunk/ui.datepicker.js
@@ -0,0 +1,212 @@
+(function($){
+ var PROP_NAME="datepicker";
+ function Datepicker(){
+ this.debug=false;
+ this._curInst=null;
+ this._disabledInputs=[];
+ this._datepickerShowing=false;
+ this._inDialog=false;
+ this._mainDivId="ui-datepicker-div";
+ this._inlineClass="ui-datepicker-inline";
+ this._appendClass="ui-datepicker-append";
+ this._triggerClass="ui-datepicker-trigger";
+ this._dialogClass="ui-datepicker-dialog";
+ this._promptClass="ui-datepicker-prompt";
+ this._disableClass="ui-datepicker-disabled";
+ this._unselectableClass="ui-datepicker-unselectable";
+ this._currentClass="ui-datepicker-current-day";
+ this.regional=[];
+ this.regional[""]={
+ clearText:"Clear",
+ clearStatus:"Erase the current date",
+ closeText:"Close",
+ closeStatus:"Close without change",
+ prevText:"&#x3c;Prev",
+ prevStatus:"Show the previous month",
+ prevBigText:"&#x3c;&#x3c;",
+ prevBigStatus:"Show the previous year",
+ nextText:"Next&#x3e;",
+ nextStatus:"Show the next month",
+ nextBigText:"&#x3e;&#x3e;",
+ nextBigStatus:"Show the next year",
+ currentText:"Today",
+ currentStatus:"Show the current month",
+ monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],
+ monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],
+ monthStatus:"Show a different month",
+ yearStatus:"Show a different year",
+ weekHeader:"Wk",
+ weekStatus:"Week of the year",
+ dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],
+ dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],
+ dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],
+ dayStatus:"Set DD as first week day",
+ dateStatus:"Select DD, M d",
+ dateFormat:"mm/dd/yy",
+ firstDay:0,
+ initStatus:"Select a date",
+ isRTL:false
+ };
+ this._defaults={
+ onChangeToday: false,
+ showOn:"focus",
+ showAnim:"show",
+ showOptions:{},
+ defaultDate:null,
+ appendText:"",
+ buttonText:"...",
+ buttonImage:"",
+ buttonImageOnly:false,
+ closeAtTop:true,
+ mandatory:false,
+ hideIfNoPrevNext:false,
+ navigationAsDateFormat:false,
+ showBigPrevNext:false,
+ gotoCurrent:false,
+ changeMonth:true,
+ changeYear:true,
+ showMonthAfterYear:false,
+ yearRange:"-10:+10",
+ changeFirstDay:true,
+ highlightWeek:false,
+ showOtherMonths:false,
+ showWeeks:false,
+ calculateWeek:this.iso8601Week,
+ shortYearCutoff:"+10",
+ showStatus:false,
+ statusForDate:this.dateStatus,
+ minDate:null,
+ maxDate:null,
+ duration:"normal",
+ beforeShowDay:null,
+ beforeShow:null,
+ onSelect:null,
+ onChangeMonthYear:null,
+ onClose:null,
+ numberOfMonths:1,
+ showCurrentAtPos:0,
+ stepMonths:1,
+ stepBigMonths:12,
+ rangeSelect:false,
+ rangeSeparator:" - ",
+ altField:"",
+ altFormat:""
+ };
+ $.extend(this._defaults,this.regional[""]);
+ this.dpDiv=$('<div id="'+this._mainDivId+'" style="display: none;"></div>')}
+ $.extend(
+ Datepicker.prototype,
+ {
+ markerClassName:"hasDatepicker",
+ log:function(){
+ if(this.debug){
+ console.log.apply("",arguments)
+ }
+ },
+ setDefaults:
+ function(settings){
+ extendRemove(this._defaults,settings||{});
+ return this
+ },
+
+ _attachDatepicker:
+ function(target,settings){
+ var inlineSettings=null;
+ for(attrName in this._defaults){
+ var attrValue=target.getAttribute("date:"+attrName);
+ if(attrValue){inlineSettings=inlineSettings||{};try{inlineSettings[attrName]=eval(attrValue)}catch(err){inlineSettings[attrName]=attrValue}}}var nodeName=target.nodeName.toLowerCase();var inline=(nodeName=="div"||nodeName=="span");if(!target.id){target.id="dp"+(++this.uuid)}var inst=this._newInst($(target),inline);inst.settings=$.extend({},settings||{},inlineSettings||{});if(nodeName=="input"){this._connectDatepicker(target,inst)}else{if(inline){this._inlineDatepicker(target,inst)}}},_newInst:function(target,inline){var id=target[0].id.replace(/([:\[\]\.])/g,"\\\\$1");return{id:id,input:target,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:inline,dpDiv:(!inline?this.dpDiv:$('<div class="'+this._inlineClass+'"></div>'))}},_connectDatepicker:function(target,inst){var input=$(target);if(input.hasClass(this.markerClassName)){return}var appendText=this._get(inst,"appendText");var isRTL=this._get(inst,"isRTL");if(appendText){input[isRTL?"before":"after"]('<span class="'+this._appendClass+'">'+appendText+"</span>")}var showOn=this._get(inst,"showOn");if(showOn=="focus"||showOn=="both"){input.focus(this._showDatepicker)}if(showOn=="button"||showOn=="both"){var buttonText=this._get(inst,"buttonText");var buttonImage=this._get(inst,"buttonImage");var trigger=$(this._get(inst,"buttonImageOnly")?$("<img/>").addClass(this._triggerClass).attr({src:buttonImage,alt:buttonText,title:buttonText}):$('<button type="button"></button>').addClass(this._triggerClass).html(buttonImage==""?buttonText:$("<img/>").attr({src:buttonImage,alt:buttonText,title:buttonText})));input[isRTL?"before":"after"](trigger);trigger.click(function(){if($.datepicker._datepickerShowing&&$.datepicker._lastInput==target){$.datepicker._hideDatepicker()}else{$.datepicker._showDatepicker(target)}return false})}input.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).bind("setData.datepicker",function(event,key,value){inst.settings[key]=value}).bind("getData.datepicker",function(event,key){return this._get(inst,key)});$.data(target,PROP_NAME,inst)},_inlineDatepicker:function(target,inst){var divSpan=$(target);if(divSpan.hasClass(this.markerClassName)){return}divSpan.addClass(this.markerClassName).append(inst.dpDiv).bind("setData.datepicker",function(event,key,value){inst.settings[key]=value}).bind("getData.datepicker",function(event,key){return this._get(inst,key)});$.data(target,PROP_NAME,inst);this._setDate(inst,this._getDefaultDate(inst));this._updateDatepicker(inst)},_inlineShow:function(inst){var numMonths=this._getNumberOfMonths(inst);inst.dpDiv.width(numMonths[1]*$(".ui-datepicker",inst.dpDiv[0]).width())},
+
+ _dialogDatepicker:
+ function(input,dateText,onSelect,settings,pos){
+ var inst=this._dialogInst;
+ if(!inst){var id="dp"+(++this.uuid);
+ this._dialogInput=$('<input type="text" id="'+id+'" size="1" style="position: absolute; top: -100px;"/>');
+ this._dialogInput.keydown(this._doKeyDown);
+ $("body").append(this._dialogInput);
+ inst=this._dialogInst=this._newInst(this._dialogInput,false);
+ inst.settings={};
+ $.data(this._dialogInput[0],PROP_NAME,inst)}
+ extendRemove(inst.settings,settings||{});
+ this._dialogInput.val(dateText);
+ this._pos=(pos?(pos.length?pos:[pos.pageX,pos.pageY]):null);
+ if(!this._pos){
+ var browserWidth=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth;var browserHeight=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight;
+ var scrollX=document.documentElement.scrollLeft||document.body.scrollLeft;var scrollY=document.documentElement.scrollTop||document.body.scrollTop;this._pos=[(browserWidth/2)-100+scrollX,(browserHeight/2)-150+scrollY]}this._dialogInput.css("left",this._pos[0]+"px").css("top",this._pos[1]+"px");
+ inst.settings.onSelect=onSelect;
+ this._inDialog=true;
+ this.dpDiv.addClass(this._dialogClass);
+ this._showDatepicker(this._dialogInput[0]);if($.blockUI){$.blockUI(this.dpDiv)}$.data(this._dialogInput[0],PROP_NAME,inst);return this},_destroyDatepicker:function(target){var $target=$(target);if(!$target.hasClass(this.markerClassName)){return}var nodeName=target.nodeName.toLowerCase();$.removeData(target,PROP_NAME);if(nodeName=="input"){$target.siblings("."+this._appendClass).remove().end().siblings("."+this._triggerClass).remove().end().removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress)}else{if(nodeName=="div"||nodeName=="span"){$target.removeClass(this.markerClassName).empty()}}},_enableDatepicker:function(target){var $target=$(target);if(!$target.hasClass(this.markerClassName)){return}var nodeName=target.nodeName.toLowerCase();if(nodeName=="input"){target.disabled=false;$target.siblings("button."+this._triggerClass).each(function(){this.disabled=false}).end().siblings("img."+this._triggerClass).css({opacity:"1.0",cursor:""})}else{if(nodeName=="div"||nodeName=="span"){$target.children("."+this._disableClass).remove()}}this._disabledInputs=$.map(this._disabledInputs,function(value){return(value==target?null:value)})},_disableDatepicker:function(target){var $target=$(target);if(!$target.hasClass(this.markerClassName)){return}var nodeName=target.nodeName.toLowerCase();if(nodeName=="input"){target.disabled=true;$target.siblings("button."+this._triggerClass).each(function(){this.disabled=true}).end().siblings("img."+this._triggerClass).css({opacity:"0.5",cursor:"default"})}else{if(nodeName=="div"||nodeName=="span"){var inline=$target.children("."+this._inlineClass);var offset=inline.offset();var relOffset={left:0,top:0};inline.parents().each(function(){if($(this).css("position")=="relative"){relOffset=$(this).offset();return false}});$target.prepend('<div class="'+this._disableClass+'" style="'+($.browser.msie?"background-color: transparent; ":"")+"width: "+inline.width()+"px; height: "+inline.height()+"px; left: "+(offset.left-relOffset.left)+"px; top: "+(offset.top-relOffset.top)+'px;"></div>')}}this._disabledInputs=$.map(this._disabledInputs,function(value){return(value==target?null:value)});this._disabledInputs[this._disabledInputs.length]=target},_isDisabledDatepicker:function(target){if(!target){return false}for(var i=0;i<this._disabledInputs.length;i++){if(this._disabledInputs[i]==target){return true}}return false},_getInst:function(target){try{return $.data(target,PROP_NAME)}catch(err){throw"Missing instance data for this datepicker"}},_changeDatepicker:function(target,name,value){var settings=name||{};if(typeof name=="string"){settings={};settings[name]=value}var inst=this._getInst(target);if(inst){if(this._curInst==inst){this._hideDatepicker(null)}extendRemove(inst.settings,settings);var date=new Date();extendRemove(inst,{rangeStart:null,endDay:null,endMonth:null,endYear:null,selectedDay:date.getDate(),selectedMonth:date.getMonth(),selectedYear:date.getFullYear(),currentDay:date.getDate(),currentMonth:date.getMonth(),currentYear:date.getFullYear(),drawMonth:date.getMonth(),drawYear:date.getFullYear()});this._updateDatepicker(inst)}},_refreshDatepicker:function(target){var inst=this._getInst(target);if(inst){this._updateDatepicker(inst)}},_setDateDatepicker:function(target,date,endDate){var inst=this._getInst(target);if(inst){this._setDate(inst,date,endDate);this._updateDatepicker(inst);this._updateAlternate(inst)}},_getDateDatepicker:function(target){var inst=this._getInst(target);if(inst&&!inst.inline){this._setDateFromField(inst)}return(inst?this._getDate(inst):null)},_doKeyDown:function(e){var inst=$.datepicker._getInst(e.target);var handled=true;if($.datepicker._datepickerShowing){switch(e.keyCode){case 9:$.datepicker._hideDatepicker(null,"");break;case 13:$.datepicker._selectDay(e.target,inst.selectedMonth,inst.selectedYear,$("td.ui-datepicker-days-cell-over",inst.dpDiv)[0]);return false;break;case 27:$.datepicker._hideDatepicker(null,$.datepicker._get(inst,"duration"));break;case 33:$.datepicker._adjustDate(e.target,(e.ctrlKey?-$.datepicker._get(inst,"stepBigMonths"):-$.datepicker._get(inst,"stepMonths")),"M");break;case 34:$.datepicker._adjustDate(e.target,(e.ctrlKey?+$.datepicker._get(inst,"stepBigMonths"):+$.datepicker._get(inst,"stepMonths")),"M");break;case 35:if(e.ctrlKey){$.datepicker._clearDate(e.target)}handled=e.ctrlKey;break;case 36:if(e.ctrlKey){$.datepicker._gotoToday(e.target)}handled=e.ctrlKey;break;case 37:if(e.ctrlKey){$.datepicker._adjustDate(e.target,-1,"D")}handled=e.ctrlKey;break;case 38:if(e.ctrlKey){$.datepicker._adjustDate(e.target,-7,"D")}handled=e.ctrlKey;break;case 39:if(e.ctrlKey){$.datepicker._adjustDate(e.target,+1,"D")}handled=e.ctrlKey;break;case 40:if(e.ctrlKey){$.datepicker._adjustDate(e.target,+7,"D")}handled=e.ctrlKey;break;default:handled=false}}else{if(e.keyCode==36&&e.ctrlKey){$.datepicker._showDatepicker(this)}else{handled=false}}if(handled){e.preventDefault();e.stopPropagation()}},_doKeyPress:function(e){var inst=$.datepicker._getInst(e.target);var chars=$.datepicker._possibleChars($.datepicker._get(inst,"dateFormat"));var chr=String.fromCharCode(e.charCode==undefined?e.keyCode:e.charCode);return e.ctrlKey||(chr<" "||!chars||chars.indexOf(chr)>-1)},_showDatepicker:function(input){input=input.target||input;if(input.nodeName.toLowerCase()!="input"){input=$("input",input.parentNode)[0]}if($.datepicker._isDisabledDatepicker(input)||$.datepicker._lastInput==input){return}var inst=$.datepicker._getInst(input);var beforeShow=$.datepicker._get(inst,"beforeShow");extendRemove(inst.settings,(beforeShow?beforeShow.apply(input,[input,inst]):{}));$.datepicker._hideDatepicker(null,"");$.datepicker._lastInput=input;$.datepicker._setDateFromField(inst);if($.datepicker._inDialog){input.value=""}if(!$.datepicker._pos){$.datepicker._pos=$.datepicker._findPos(input);$.datepicker._pos[1]+=input.offsetHeight}var isFixed=false;$(input).parents().each(function(){isFixed|=$(this).css("position")=="fixed";return!isFixed});if(isFixed&&$.browser.opera){$.datepicker._pos[0]-=document.documentElement.scrollLeft;$.datepicker._pos[1]-=document.documentElement.scrollTop}var offset={left:$.datepicker._pos[0],top:$.datepicker._pos[1]};$.datepicker._pos=null;inst.rangeStart=null;inst.dpDiv.css({position:"absolute",display:"block",top:"-1000px"});$.datepicker._updateDatepicker(inst);inst.dpDiv.width($.datepicker._getNumberOfMonths(inst)[1]*$(".ui-datepicker",inst.dpDiv[0])[0].offsetWidth);offset=$.datepicker._checkOffset(inst,offset,isFixed);inst.dpDiv.css({position:($.datepicker._inDialog&&$.blockUI?"static":(isFixed?"fixed":"absolute")),display:"none",left:offset.left+"px",top:offset.top+"px"});if(!inst.inline){var showAnim=$.datepicker._get(inst,"showAnim")||"show";var duration=$.datepicker._get(inst,"duration");var postProcess=function(){$.datepicker._datepickerShowing=true;if($.browser.msie&&parseInt($.browser.version,10)<7){$("iframe.ui-datepicker-cover").css({width:inst.dpDiv.width()+4,height:inst.dpDiv.height()+4})}};if($.effects&&$.effects[showAnim]){inst.dpDiv.show(showAnim,$.datepicker._get(inst,"showOptions"),duration,postProcess)}else{inst.dpDiv[showAnim](duration,postProcess)}if(duration==""){postProcess()}if(inst.input[0].type!="hidden"){inst.input[0].focus()}$.datepicker._curInst=inst}},_updateDatepicker:function(inst){var dims={width:inst.dpDiv.width()+4,height:inst.dpDiv.height()+4};inst.dpDiv.empty().append(this._generateHTML(inst)).find("iframe.ui-datepicker-cover").css({width:dims.width,height:dims.height});var numMonths=this._getNumberOfMonths(inst);inst.dpDiv[(numMonths[0]!=1||numMonths[1]!=1?"add":"remove")+"Class"]("ui-datepicker-multi");inst.dpDiv[(this._get(inst,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl");if(inst.input&&inst.input[0].type!="hidden"){$(inst.input[0]).focus()}},_checkOffset:function(inst,offset,isFixed){var pos=inst.input?this._findPos(inst.input[0]):null;var browserWidth=window.innerWidth||document.documentElement.clientWidth;var browserHeight=window.innerHeight||document.documentElement.clientHeight;var scrollX=document.documentElement.scrollLeft||document.body.scrollLeft;var scrollY=document.documentElement.scrollTop||document.body.scrollTop;if(this._get(inst,"isRTL")||(offset.left+inst.dpDiv.width()-scrollX)>browserWidth){offset.left=Math.max((isFixed?0:scrollX),pos[0]+(inst.input?inst.input.width():0)-(isFixed?scrollX:0)-inst.dpDiv.width()-(isFixed&&$.browser.opera?document.documentElement.scrollLeft:0))}else{offset.left-=(isFixed?scrollX:0)}if((offset.top+inst.dpDiv.height()-scrollY)>browserHeight){offset.top=Math.max((isFixed?0:scrollY),pos[1]-(isFixed?scrollY:0)-(this._inDialog?0:inst.dpDiv.height())-(isFixed&&$.browser.opera?document.documentElement.scrollTop:0))}else{offset.top-=(isFixed?scrollY:0)}return offset},_findPos:function(obj){while(obj&&(obj.type=="hidden"||obj.nodeType!=1)){obj=obj.nextSibling}var position=$(obj).offset();return[position.left,position.top]},_hideDatepicker:function(input,duration){var inst=this._curInst;if(!inst||(input&&inst!=$.data(input,PROP_NAME))){return}var rangeSelect=this._get(inst,"rangeSelect");if(rangeSelect&&inst.stayOpen){this._selectDate("#"+inst.id,this._formatDate(inst,inst.currentDay,inst.currentMonth,inst.currentYear))}inst.stayOpen=false;if(this._datepickerShowing){duration=(duration!=null?duration:this._get(inst,"duration"));var showAnim=this._get(inst,"showAnim");var postProcess=function(){$.datepicker._tidyDialog(inst)};if(duration!=""&&$.effects&&$.effects[showAnim]){inst.dpDiv.hide(showAnim,$.datepicker._get(inst,"showOptions"),duration,postProcess)}else{inst.dpDiv[(duration==""?"hide":(showAnim=="slideDown"?"slideUp":(showAnim=="fadeIn"?"fadeOut":"hide")))](duration,postProcess)}if(duration==""){this._tidyDialog(inst)}var onClose=this._get(inst,"onClose");if(onClose){onClose.apply((inst.input?inst.input[0]:null),[(inst.input?inst.input.val():""),inst])}this._datepickerShowing=false;this._lastInput=null;inst.settings.prompt=null;if(this._inDialog){this._dialogInput.css({position:"absolute",left:"0",top:"-100px"});if($.blockUI){$.unblockUI();$("body").append(this.dpDiv)}}this._inDialog=false}this._curInst=null},_tidyDialog:function(inst){inst.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker");$("."+this._promptClass,inst.dpDiv).remove()},_checkExternalClick:function(event){if(!$.datepicker._curInst){return}var $target=$(event.target);if(($target.parents("#"+$.datepicker._mainDivId).length==0)&&!$target.hasClass($.datepicker.markerClassName)&&!$target.hasClass($.datepicker._triggerClass)&&$.datepicker._datepickerShowing&&!($.datepicker._inDialog&&$.blockUI)){$.datepicker._hideDatepicker(null,"")}},
+_adjustDate:
+ function(id,offset,period){
+ var target=$(id);
+ var inst=this._getInst(target[0]);
+ this._adjustInstDate(inst,offset,period);
+ this._updateDatepicker(inst)
+},
+_gotoToday:
+function(id){
+ var target=$(id);
+ var inst=this._getInst(target[0]);
+ inst.onChangeToday=true;
+ if(this._get(inst,"gotoCurrent")&&inst.currentDay){
+ inst.selectedDay=inst.currentDay;
+ inst.drawMonth=inst.selectedMonth=inst.currentMonth;
+ inst.drawYear=inst.selectedYear=inst.currentYear
+ }else{
+ var date=new Date();
+ inst.selectedDay=date.getDate();
+ inst.drawMonth=inst.selectedMonth=date.getMonth();
+ inst.drawYear=inst.selectedYear=date.getFullYear();
+ }
+
+
+ this._notifyChange(inst);
+ this._adjustDate(target);
+
+
+}
+,
+_selectMonthYear:
+ function(id,select,period){var target=$(id);var inst=this._getInst(target[0]);inst._selectingMonthYear=false;inst["selected"+(period=="M"?"Month":"Year")]=inst["draw"+(period=="M"?"Month":"Year")]=parseInt(select.options[select.selectedIndex].value,10);this._notifyChange(inst);this._adjustDate(target)},_clickMonthYear:function(id){var target=$(id);var inst=this._getInst(target[0]);if(inst.input&&inst._selectingMonthYear&&!$.browser.msie){inst.input[0].focus()}inst._selectingMonthYear=!inst._selectingMonthYear},_changeFirstDay:function(id,day){var target=$(id);var inst=this._getInst(target[0]);inst.settings.firstDay=day;this._updateDatepicker(inst)},_selectDay:function(id,month,year,td){if($(td).hasClass(this._unselectableClass)){return}var target=$(id);var inst=this._getInst(target[0]);var rangeSelect=this._get(inst,"rangeSelect");if(rangeSelect){inst.stayOpen=!inst.stayOpen;if(inst.stayOpen){$(".ui-datepicker td",inst.dpDiv).removeClass(this._currentClass);$(td).addClass(this._currentClass)}}inst.selectedDay=inst.currentDay=$("a",td).html();inst.selectedMonth=inst.currentMonth=month;inst.selectedYear=inst.currentYear=year;if(inst.stayOpen){inst.endDay=inst.endMonth=inst.endYear=null}else{if(rangeSelect){inst.endDay=inst.currentDay;inst.endMonth=inst.currentMonth;inst.endYear=inst.currentYear}}this._selectDate(id,this._formatDate(inst,inst.currentDay,inst.currentMonth,inst.currentYear));if(inst.stayOpen){inst.rangeStart=new Date(inst.currentYear,inst.currentMonth,inst.currentDay);this._updateDatepicker(inst)}else{if(rangeSelect){inst.selectedDay=inst.currentDay=inst.rangeStart.getDate();inst.selectedMonth=inst.currentMonth=inst.rangeStart.getMonth();inst.selectedYear=inst.currentYear=inst.rangeStart.getFullYear();inst.rangeStart=null;if(inst.inline){this._updateDatepicker(inst)}}}},_clearDate:function(id){var target=$(id);var inst=this._getInst(target[0]);if(this._get(inst,"mandatory")){return}inst.stayOpen=false;inst.endDay=inst.endMonth=inst.endYear=inst.rangeStart=null;this._selectDate(target,"")},
+ _selectDate:function(id,dateStr){
+ var target=$(id);
+ var inst=this._getInst(target[0]);
+ dateStr=(dateStr!=null?dateStr:this._formatDate(inst));
+ if(this._get(inst,"rangeSelect")&&dateStr){
+ dateStr=(inst.rangeStart?this._formatDate(inst,inst.rangeStart):dateStr)+this._get(inst,"rangeSeparator")+dateStr}if(inst.input){inst.input.val(dateStr)}this._updateAlternate(inst);
+
+ var onSelect=this._get(inst,"onSelect");
+ if(onSelect){
+ onSelect.apply((inst.input?inst.input[0]:null),[dateStr,inst])
+ }else{
+ if(inst.input){
+ inst.input.trigger("change")}
+ }
+
+ if(inst.inline){
+ this._updateDatepicker(inst)}else{if(!inst.stayOpen){this._hideDatepicker(null,this._get(inst,"duration"));this._lastInput=inst.input[0];if(typeof(inst.input[0])!="object"){inst.input[0].focus()}this._lastInput=null}}},_updateAlternate:function(inst){var altField=this._get(inst,"altField");if(altField){var altFormat=this._get(inst,"altFormat");var date=this._getDate(inst);
+ dateStr=(isArray(date)?(!date[0]&&!date[1]?"":this.formatDate(altFormat,date[0],this._getFormatConfig(inst))+this._get(inst,"rangeSeparator")+this.formatDate(altFormat,date[1]||date[0],this._getFormatConfig(inst))):this.formatDate(altFormat,date,this._getFormatConfig(inst)));
+ $(altField).each(function(){$(this).val(dateStr)})}},noWeekends:function(date){var day=date.getDay();return[(day>0&&day<6),""]},iso8601Week:function(date){var checkDate=new Date(date.getFullYear(),date.getMonth(),date.getDate(),(date.getTimezoneOffset()/-60));var firstMon=new Date(checkDate.getFullYear(),1-1,4);var firstDay=firstMon.getDay()||7;firstMon.setDate(firstMon.getDate()+1-firstDay);if(firstDay<4&&checkDate<firstMon){checkDate.setDate(checkDate.getDate()-3);return $.datepicker.iso8601Week(checkDate)}else{if(checkDate>new Date(checkDate.getFullYear(),12-1,28)){firstDay=new Date(checkDate.getFullYear()+1,1-1,4).getDay()||7;if(firstDay>4&&(checkDate.getDay()||7)<firstDay-3){return 1}}}return Math.floor(((checkDate-firstMon)/86400000)/7)+1},dateStatus:function(date,inst){return $.datepicker.formatDate($.datepicker._get(inst,"dateStatus"),date,$.datepicker._getFormatConfig(inst))},parseDate:function(format,value,settings){if(format==null||value==null){throw"Invalid arguments"}value=(typeof value=="object"?value.toString():value+"");if(value==""){return null}var shortYearCutoff=(settings?settings.shortYearCutoff:null)||this._defaults.shortYearCutoff;var dayNamesShort=(settings?settings.dayNamesShort:null)||this._defaults.dayNamesShort;var dayNames=(settings?settings.dayNames:null)||this._defaults.dayNames;var monthNamesShort=(settings?settings.monthNamesShort:null)||this._defaults.monthNamesShort;var monthNames=(settings?settings.monthNames:null)||this._defaults.monthNames;var year=-1;var month=-1;var day=-1;var doy=-1;var literal=false;var lookAhead=function(match){var matches=(iFormat+1<format.length&&format.charAt(iFormat+1)==match);if(matches){iFormat++}return matches};var getNumber=function(match){lookAhead(match);var origSize=(match=="@"?14:(match=="y"?4:(match=="o"?3:2)));var size=origSize;var num=0;while(size>0&&iValue<value.length&&value.charAt(iValue)>="0"&&value.charAt(iValue)<="9"){num=num*10+parseInt(value.charAt(iValue++),10);size--}if(size==origSize){throw"Missing number at position "+iValue}return num};var getName=function(match,shortNames,longNames){var names=(lookAhead(match)?longNames:shortNames);var size=0;for(var j=0;j<names.length;j++){size=Math.max(size,names[j].length)}var name="";var iInit=iValue;while(size>0&&iValue<value.length){name+=value.charAt(iValue++);for(var i=0;i<names.length;i++){if(name==names[i]){return i+1}}size--}throw"Unknown name at position "+iInit};var checkLiteral=function(){if(value.charAt(iValue)!=format.charAt(iFormat)){throw"Unexpected literal at position "+iValue}iValue++};var iValue=0;for(var iFormat=0;iFormat<format.length;iFormat++){if(literal){if(format.charAt(iFormat)=="'"&&!lookAhead("'")){literal=false}else{checkLiteral()}}else{switch(format.charAt(iFormat)){case"d":day=getNumber("d");break;case"D":getName("D",dayNamesShort,dayNames);break;case"o":doy=getNumber("o");break;case"m":month=getNumber("m");break;case"M":month=getName("M",monthNamesShort,monthNames);break;case"y":year=getNumber("y");break;case"@":var date=new Date(getNumber("@"));year=date.getFullYear();month=date.getMonth()+1;day=date.getDate();break;case"'":if(lookAhead("'")){checkLiteral()}else{literal=true}break;default:checkLiteral()}}}if(year<100){year+=new Date().getFullYear()-new Date().getFullYear()%100+(year<=shortYearCutoff?0:-100)}if(doy>-1){month=1;day=doy;do{var dim=this._getDaysInMonth(year,month-1);if(day<=dim){break}month++;day-=dim}while(true)}var date=new Date(year,month-1,day);if(date.getFullYear()!=year||date.getMonth()+1!=month||date.getDate()!=day){throw"Invalid date"}return date},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TIMESTAMP:"@",W3C:"yy-mm-dd",formatDate:function(format,date,settings){if(!date){return""}var dayNamesShort=(settings?settings.dayNamesShort:null)||this._defaults.dayNamesShort;var dayNames=(settings?settings.dayNames:null)||this._defaults.dayNames;var monthNamesShort=(settings?settings.monthNamesShort:null)||this._defaults.monthNamesShort;var monthNames=(settings?settings.monthNames:null)||this._defaults.monthNames;var lookAhead=function(match){var matches=(iFormat+1<format.length&&format.charAt(iFormat+1)==match);if(matches){iFormat++}return matches};var formatNumber=function(match,value,len){var num=""+value;if(lookAhead(match)){while(num.length<len){num="0"+num}}return num};var formatName=function(match,value,shortNames,longNames){return(lookAhead(match)?longNames[value]:shortNames[value])};var output="";var literal=false;if(date){for(var iFormat=0;iFormat<format.length;iFormat++){if(literal){if(format.charAt(iFormat)=="'"&&!lookAhead("'")){literal=false}else{output+=format.charAt(iFormat)}}else{switch(format.charAt(iFormat)){case"d":output+=formatNumber("d",date.getDate(),2);break;case"D":output+=formatName("D",date.getDay(),dayNamesShort,dayNames);break;case"o":var doy=date.getDate();for(var m=date.getMonth()-1;m>=0;m--){doy+=this._getDaysInMonth(date.getFullYear(),m)}output+=formatNumber("o",doy,3);break;case"m":output+=formatNumber("m",date.getMonth()+1,2);break;case"M":output+=formatName("M",date.getMonth(),monthNamesShort,monthNames);break;case"y":output+=(lookAhead("y")?date.getFullYear():(date.getYear()%100<10?"0":"")+date.getYear()%100);break;case"@":output+=date.getTime();break;case"'":if(lookAhead("'")){output+="'"}else{literal=true}break;default:output+=format.charAt(iFormat)}}}}return output},_possibleChars:function(format){var chars="";var literal=false;for(var iFormat=0;iFormat<format.length;iFormat++){if(literal){if(format.charAt(iFormat)=="'"&&!lookAhead("'")){literal=false}else{chars+=format.charAt(iFormat)}}else{switch(format.charAt(iFormat)){case"d":case"m":case"y":case"@":chars+="0123456789";break;case"D":case"M":return null;case"'":if(lookAhead("'")){chars+="'"}else{literal=true}break;default:chars+=format.charAt(iFormat)}}}return chars},_get:function(inst,name){return inst.settings[name]!==undefined?inst.settings[name]:this._defaults[name]},_setDateFromField:function(inst){var dateFormat=this._get(inst,"dateFormat");var dates=inst.input?inst.input.val().split(this._get(inst,"rangeSeparator")):null;inst.endDay=inst.endMonth=inst.endYear=null;var date=defaultDate=this._getDefaultDate(inst);if(dates.length>0){var settings=this._getFormatConfig(inst);if(dates.length>1){date=this.parseDate(dateFormat,dates[1],settings)||defaultDate;inst.endDay=date.getDate();inst.endMonth=date.getMonth();inst.endYear=date.getFullYear()}try{date=this.parseDate(dateFormat,dates[0],settings)||defaultDate}catch(e){this.log(e);date=defaultDate}}inst.selectedDay=date.getDate();inst.drawMonth=inst.selectedMonth=date.getMonth();inst.drawYear=inst.selectedYear=date.getFullYear();inst.currentDay=(dates[0]?date.getDate():0);inst.currentMonth=(dates[0]?date.getMonth():0);inst.currentYear=(dates[0]?date.getFullYear():0);this._adjustInstDate(inst)},_getDefaultDate:function(inst){var date=this._determineDate(this._get(inst,"defaultDate"),new Date());var minDate=this._getMinMaxDate(inst,"min",true);var maxDate=this._getMinMaxDate(inst,"max");date=(minDate&&date<minDate?minDate:date);date=(maxDate&&date>maxDate?maxDate:date);return date},_determineDate:function(date,defaultDate){var offsetNumeric=function(offset){var date=new Date();date.setUTCDate(date.getUTCDate()+offset);return date};var offsetString=function(offset,getDaysInMonth){var date=new Date();var year=date.getFullYear();var month=date.getMonth();var day=date.getDate();var pattern=/([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g;var matches=pattern.exec(offset);while(matches){switch(matches[2]||"d"){case"d":case"D":day+=parseInt(matches[1],10);break;case"w":case"W":day+=parseInt(matches[1],10)*7;break;case"m":case"M":month+=parseInt(matches[1],10);day=Math.min(day,getDaysInMonth(year,month));break;case"y":case"Y":year+=parseInt(matches[1],10);day=Math.min(day,getDaysInMonth(year,month));break}matches=pattern.exec(offset)}return new Date(year,month,day)};date=(date==null?defaultDate:(typeof date=="string"?offsetString(date,this._getDaysInMonth):(typeof date=="number"?(isNaN(date)?defaultDate:offsetNumeric(date)):date)));return(date&&date.toString()=="Invalid Date"?defaultDate:date)},_setDate:function(inst,date,endDate){var clear=!(date);var origMonth=inst.selectedMonth;var origYear=inst.selectedYear;date=this._determineDate(date,new Date());inst.selectedDay=inst.currentDay=date.getDate();inst.drawMonth=inst.selectedMonth=inst.currentMonth=date.getMonth();inst.drawYear=inst.selectedYear=inst.currentYear=date.getFullYear();if(this._get(inst,"rangeSelect")){if(endDate){endDate=this._determineDate(endDate,null);inst.endDay=endDate.getDate();inst.endMonth=endDate.getMonth();inst.endYear=endDate.getFullYear()}else{inst.endDay=inst.currentDay;inst.endMonth=inst.currentMonth;inst.endYear=inst.currentYear}}if(origMonth!=inst.selectedMonth||origYear!=inst.selectedYear){this._notifyChange(inst)}this._adjustInstDate(inst);if(inst.input){inst.input.val(clear?"":this._formatDate(inst)+(!this._get(inst,"rangeSelect")?"":this._get(inst,"rangeSeparator")+this._formatDate(inst,inst.endDay,inst.endMonth,inst.endYear)))}},_getDate:function(inst){var startDate=(!inst.currentYear||(inst.input&&inst.input.val()=="")?null:new Date(inst.currentYear,inst.currentMonth,inst.currentDay));if(this._get(inst,"rangeSelect")){return[inst.rangeStart||startDate,(!inst.endYear?inst.rangeStart||startDate:new Date(inst.endYear,inst.endMonth,inst.endDay))]}else{return startDate}},_generateHTML:function(inst){var today=new Date();today=new Date(today.getFullYear(),today.getMonth(),today.getDate());var showStatus=this._get(inst,"showStatus");var initStatus=this._get(inst,"initStatus")||"&#xa0;";var isRTL=this._get(inst,"isRTL");var clear=(this._get(inst,"mandatory")?"":'<div class="ui-datepicker-clear"><a onclick="jQuery.datepicker._clearDate(\'#'+inst.id+"');\""+this._addStatus(showStatus,inst.id,this._get(inst,"clearStatus"),initStatus)+">"+this._get(inst,"clearText")+"</a></div>");var controls='<div class="ui-datepicker-control">'+(isRTL?"":clear)+'<div class="ui-datepicker-close"><a onclick="jQuery.datepicker._hideDatepicker();"'+this._addStatus(showStatus,inst.id,this._get(inst,"closeStatus"),initStatus)+">"+this._get(inst,"closeText")+"</a></div>"+(isRTL?clear:"")+"</div>";var prompt=this._get(inst,"prompt");var closeAtTop=this._get(inst,"closeAtTop");var hideIfNoPrevNext=this._get(inst,"hideIfNoPrevNext");var navigationAsDateFormat=this._get(inst,"navigationAsDateFormat");var showBigPrevNext=this._get(inst,"showBigPrevNext");var numMonths=this._getNumberOfMonths(inst);var showCurrentAtPos=this._get(inst,"showCurrentAtPos");var stepMonths=this._get(inst,"stepMonths");var stepBigMonths=this._get(inst,"stepBigMonths");var isMultiMonth=(numMonths[0]!=1||numMonths[1]!=1);var currentDate=(!inst.currentDay?new Date(9999,9,9):new Date(inst.currentYear,inst.currentMonth,inst.currentDay));var minDate=this._getMinMaxDate(inst,"min",true);var maxDate=this._getMinMaxDate(inst,"max");var drawMonth=inst.drawMonth-showCurrentAtPos;var drawYear=inst.drawYear;if(drawMonth<0){drawMonth+=12;drawYear--}if(maxDate){var maxDraw=new Date(maxDate.getFullYear(),maxDate.getMonth()-numMonths[1]+1,maxDate.getDate());maxDraw=(minDate&&maxDraw<minDate?minDate:maxDraw);while(new Date(drawYear,drawMonth,1)>maxDraw){drawMonth--;if(drawMonth<0){drawMonth=11;drawYear--}}}var prevText=this._get(inst,"prevText");prevText=(!navigationAsDateFormat?prevText:this.formatDate(prevText,new Date(drawYear,drawMonth-stepMonths,1),this._getFormatConfig(inst)));var prevBigText=(showBigPrevNext?this._get(inst,"prevBigText"):"");prevBigText=(!navigationAsDateFormat?prevBigText:this.formatDate(prevBigText,new Date(drawYear,drawMonth-stepBigMonths,1),this._getFormatConfig(inst)));var prev='<div class="ui-datepicker-prev">'+(this._canAdjustMonth(inst,-1,drawYear,drawMonth)?(showBigPrevNext?"<a onclick=\"jQuery.datepicker._adjustDate('#"+inst.id+"', -"+stepBigMonths+", 'M');\""+this._addStatus(showStatus,inst.id,this._get(inst,"prevBigStatus"),initStatus)+">"+prevBigText+"</a>":"")+"<a onclick=\"jQuery.datepicker._adjustDate('#"+inst.id+"', -"+stepMonths+", 'M');\""+this._addStatus(showStatus,inst.id,this._get(inst,"prevStatus"),initStatus)+">"+prevText+"</a>":(hideIfNoPrevNext?"":"<label>"+prevBigText+"</label><label>"+prevText+"</label>"))+"</div>";var nextText=this._get(inst,"nextText");nextText=(!navigationAsDateFormat?nextText:this.formatDate(nextText,new Date(drawYear,drawMonth+stepMonths,1),this._getFormatConfig(inst)));var nextBigText=(showBigPrevNext?this._get(inst,"nextBigText"):"");nextBigText=(!navigationAsDateFormat?nextBigText:this.formatDate(nextBigText,new Date(drawYear,drawMonth+stepBigMonths,1),this._getFormatConfig(inst)));var next='<div class="ui-datepicker-next">'+(this._canAdjustMonth(inst,+1,drawYear,drawMonth)?"<a onclick=\"jQuery.datepicker._adjustDate('#"+inst.id+"', +"+stepMonths+", 'M');\""+this._addStatus(showStatus,inst.id,this._get(inst,"nextStatus"),initStatus)+">"+nextText+"</a>"+(showBigPrevNext?"<a onclick=\"jQuery.datepicker._adjustDate('#"+inst.id+"', +"+stepBigMonths+", 'M');\""+this._addStatus(showStatus,inst.id,this._get(inst,"nextBigStatus"),initStatus)+">"+nextBigText+"</a>":""):(hideIfNoPrevNext?"":"<label>"+nextText+"</label><label>"+nextBigText+"</label>"))+"</div>";var currentText=this._get(inst,"currentText");var gotoDate=(this._get(inst,"gotoCurrent")&&inst.currentDay?currentDate:today);currentText=(!navigationAsDateFormat?currentText:this.formatDate(currentText,gotoDate,this._getFormatConfig(inst)));
+
+var html=(prompt?'<div class="'+
+ this._promptClass+'">'+
+ prompt+
+ "</div>":"")+
+ (closeAtTop&&!inst.inline?controls:"")+
+ '<div class="ui-datepicker-links">'+
+ (isRTL?next:prev)+
+ (this._isInRange(inst,gotoDate)?'<div class="ui-datepicker-current"><a onclick="jQuery.datepicker._gotoToday(\'#'+inst.id+"');\""+this._addStatus(showStatus,inst.id,this._get(inst,"currentStatus"),initStatus)+">"+currentText+"</a></div>":"")+(isRTL?prev:next)+"</div>";
+
+var firstDay=this._get(inst,"firstDay");var changeFirstDay=this._get(inst,"changeFirstDay");var dayNames=this._get(inst,"dayNames");var dayNamesShort=this._get(inst,"dayNamesShort");var dayNamesMin=this._get(inst,"dayNamesMin");var monthNames=this._get(inst,"monthNames");var beforeShowDay=this._get(inst,"beforeShowDay");var highlightWeek=this._get(inst,"highlightWeek");var showOtherMonths=this._get(inst,"showOtherMonths");var showWeeks=this._get(inst,"showWeeks");var calculateWeek=this._get(inst,"calculateWeek")||this.iso8601Week;var weekStatus=this._get(inst,"weekStatus");var status=(showStatus?this._get(inst,"dayStatus")||initStatus:"");var dateStatus=this._get(inst,"statusForDate")||this.dateStatus;var endDate=inst.endDay?new Date(inst.endYear,inst.endMonth,inst.endDay):currentDate;for(var row=0;row<numMonths[0];row++){for(var col=0;col<numMonths[1];col++){var selectedDate=new Date(drawYear,drawMonth,inst.selectedDay);html+='<div class="ui-datepicker-one-month'+(col==0?" ui-datepicker-new-row":"")+'">'+this._generateMonthYearHeader(inst,drawMonth,drawYear,minDate,maxDate,selectedDate,row>0||col>0,showStatus,initStatus,monthNames)+'<table class="ui-datepicker" cellpadding="0" cellspacing="0"><thead><tr class="ui-datepicker-title-row">'+(showWeeks?"<td"+this._addStatus(showStatus,inst.id,weekStatus,initStatus)+">"+this._get(inst,"weekHeader")+"</td>":"");for(var dow=0;dow<7;dow++){var day=(dow+firstDay)%7;var dayStatus=(status.indexOf("DD")>-1?status.replace(/DD/,dayNames[day]):status.replace(/D/,dayNamesShort[day]));html+="<td"+((dow+firstDay+6)%7>=5?' class="ui-datepicker-week-end-cell"':"")+">"+(!changeFirstDay?"<span":"<a onclick=\"jQuery.datepicker._changeFirstDay('#"+inst.id+"', "+day+');"')+this._addStatus(showStatus,inst.id,dayStatus,initStatus)+' title="'+dayNames[day]+'">'+dayNamesMin[day]+(changeFirstDay?"</a>":"</span>")+"</td>"}html+="</tr></thead><tbody>";var daysInMonth=this._getDaysInMonth(drawYear,drawMonth);if(drawYear==inst.selectedYear&&drawMonth==inst.selectedMonth){inst.selectedDay=Math.min(inst.selectedDay,daysInMonth)}var leadDays=(this._getFirstDayOfMonth(drawYear,drawMonth)-firstDay+7)%7;var tzDate=new Date(drawYear,drawMonth,1-leadDays);var utcDate=new Date(drawYear,drawMonth,1-leadDays);var printDate=utcDate;var numRows=(isMultiMonth?6:Math.ceil((leadDays+daysInMonth)/7));for(var dRow=0;dRow<numRows;dRow++){html+='<tr class="ui-datepicker-days-row">'+(showWeeks?'<td class="ui-datepicker-week-col"'+this._addStatus(showStatus,inst.id,weekStatus,initStatus)+">"+calculateWeek(printDate)+"</td>":"");for(var dow=0;dow<7;dow++){var daySettings=(beforeShowDay?beforeShowDay.apply((inst.input?inst.input[0]:null),[printDate]):[true,""]);var otherMonth=(printDate.getMonth()!=drawMonth);var unselectable=otherMonth||!daySettings[0]||(minDate&&printDate<minDate)||(maxDate&&printDate>maxDate);html+='<td class="ui-datepicker-days-cell'+((dow+firstDay+6)%7>=5?" ui-datepicker-week-end-cell":"")+(otherMonth?" ui-datepicker-other-month":"")+(printDate.getTime()==selectedDate.getTime()&&drawMonth==inst.selectedMonth?" ui-datepicker-days-cell-over":"")+(unselectable?" "+this._unselectableClass:"")+(otherMonth&&!showOtherMonths?"":" "+daySettings[1]+(printDate.getTime()>=currentDate.getTime()&&printDate.getTime()<=endDate.getTime()?" "+this._currentClass:"")+(printDate.getTime()==today.getTime()?" ui-datepicker-today":""))+'"'+((!otherMonth||showOtherMonths)&&daySettings[2]?' title="'+daySettings[2]+'"':"")+(unselectable?(highlightWeek?" onmouseover=\"jQuery(this).parent().addClass('ui-datepicker-week-over');\" onmouseout=\"jQuery(this).parent().removeClass('ui-datepicker-week-over');\"":""):" onmouseover=\"jQuery(this).addClass('ui-datepicker-days-cell-over')"+(highlightWeek?".parent().addClass('ui-datepicker-week-over')":"")+";"+(!showStatus||(otherMonth&&!showOtherMonths)?"":"jQuery('#ui-datepicker-status-"+inst.id+"').html('"+(dateStatus.apply((inst.input?inst.input[0]:null),[printDate,inst])||initStatus)+"');")+"\" onmouseout=\"jQuery(this).removeClass('ui-datepicker-days-cell-over')"+(highlightWeek?".parent().removeClass('ui-datepicker-week-over')":"")+";"+(!showStatus||(otherMonth&&!showOtherMonths)?"":"jQuery('#ui-datepicker-status-"+inst.id+"').html('"+initStatus+"');")+'" onclick="jQuery.datepicker._selectDay(\'#'+inst.id+"',"+drawMonth+","+drawYear+', this);"')+">"+(otherMonth?(showOtherMonths?printDate.getDate():"&#xa0;"):(unselectable?printDate.getDate():"<a>"+printDate.getDate()+"</a>"))+"</td>";tzDate.setDate(tzDate.getDate()+1);utcDate.setUTCDate(utcDate.getUTCDate()+1);printDate=(tzDate>utcDate?tzDate:utcDate)}html+="</tr>"}drawMonth++;if(drawMonth>11){drawMonth=0;drawYear++}html+="</tbody></table></div>"}}html+=(showStatus?'<div style="clear: both;"></div><div id="ui-datepicker-status-'+inst.id+'" class="ui-datepicker-status">'+initStatus+"</div>":"")+(!closeAtTop&&!inst.inline?controls:"")+'<div style="clear: both;"></div>'+($.browser.msie&&parseInt($.browser.version,10)<7&&!inst.inline?'<iframe src="javascript:false;" class="ui-datepicker-cover"></iframe>':"");return html},_generateMonthYearHeader:function(inst,drawMonth,drawYear,minDate,maxDate,selectedDate,secondary,showStatus,initStatus,monthNames){minDate=(inst.rangeStart&&minDate&&selectedDate<minDate?selectedDate:minDate);var showMonthAfterYear=this._get(inst,"showMonthAfterYear");var html='<div class="ui-datepicker-header">';var monthHtml="";if(secondary||!this._get(inst,"changeMonth")){monthHtml+=monthNames[drawMonth]+"&#xa0;"}else{var inMinYear=(minDate&&minDate.getFullYear()==drawYear);var inMaxYear=(maxDate&&maxDate.getFullYear()==drawYear);monthHtml+='<select class="ui-datepicker-new-month" onchange="jQuery.datepicker._selectMonthYear(\'#'+inst.id+"', this, 'M');\" onclick=\"jQuery.datepicker._clickMonthYear('#"+inst.id+"');\""+this._addStatus(showStatus,inst.id,this._get(inst,"monthStatus"),initStatus)+">";for(var month=0;month<12;month++){if((!inMinYear||month>=minDate.getMonth())&&(!inMaxYear||month<=maxDate.getMonth())){monthHtml+='<option value="'+month+'"'+(month==drawMonth?' selected="selected"':"")+">"+monthNames[month]+"</option>"}}monthHtml+="</select>"}if(!showMonthAfterYear){html+=monthHtml}if(secondary||!this._get(inst,"changeYear")){html+=drawYear}else{var years=this._get(inst,"yearRange").split(":");var year=0;var endYear=0;if(years.length!=2){year=drawYear-10;endYear=drawYear+10}else{if(years[0].charAt(0)=="+"||years[0].charAt(0)=="-"){year=endYear=new Date().getFullYear();year+=parseInt(years[0],10);endYear+=parseInt(years[1],10)}else{year=parseInt(years[0],10);endYear=parseInt(years[1],10)}}year=(minDate?Math.max(year,minDate.getFullYear()):year);endYear=(maxDate?Math.min(endYear,maxDate.getFullYear()):endYear);html+='<select class="ui-datepicker-new-year" onchange="jQuery.datepicker._selectMonthYear(\'#'+inst.id+"', this, 'Y');\" onclick=\"jQuery.datepicker._clickMonthYear('#"+inst.id+"');\""+this._addStatus(showStatus,inst.id,this._get(inst,"yearStatus"),initStatus)+">";for(;year<=endYear;year++){html+='<option value="'+year+'"'+(year==drawYear?' selected="selected"':"")+">"+year+"</option>"}html+="</select>"}if(showMonthAfterYear){html+=monthHtml}html+="</div>";return html},_addStatus:function(showStatus,id,text,initStatus){return(showStatus?" onmouseover=\"jQuery('#ui-datepicker-status-"+id+"').html('"+(text||initStatus)+"');\" onmouseout=\"jQuery('#ui-datepicker-status-"+id+"').html('"+initStatus+"');\"":"")},_adjustInstDate:function(inst,offset,period){var year=inst.drawYear+(period=="Y"?offset:0);var month=inst.drawMonth+(period=="M"?offset:0);var day=Math.min(inst.selectedDay,this._getDaysInMonth(year,month))+(period=="D"?offset:0);var date=new Date(year,month,day);var minDate=this._getMinMaxDate(inst,"min",true);var maxDate=this._getMinMaxDate(inst,"max");date=(minDate&&date<minDate?minDate:date);date=(maxDate&&date>maxDate?maxDate:date);inst.selectedDay=date.getDate();inst.drawMonth=inst.selectedMonth=date.getMonth();inst.drawYear=inst.selectedYear=date.getFullYear();if(period=="M"||period=="Y"){this._notifyChange(inst)}},
+_notifyChange:
+ function(inst){
+ var onChange=this._get(inst,"onChangeMonthYear");
+ if(onChange){
+ onChange.apply(
+ (inst.input?inst.input[0]:null),
+ [inst.selectedYear,inst.selectedMonth+1,inst]
+ )
+ }
+ }
+,
+_getNumberOfMonths:function(inst){var numMonths=this._get(inst,"numberOfMonths");return(numMonths==null?[1,1]:(typeof numMonths=="number"?[1,numMonths]:numMonths))},_getMinMaxDate:function(inst,minMax,checkRange){var date=this._determineDate(this._get(inst,minMax+"Date"),null);if(date){date.setHours(0);date.setMinutes(0);date.setSeconds(0);date.setMilliseconds(0)}return(!checkRange||!inst.rangeStart?date:(!date||inst.rangeStart>date?inst.rangeStart:date))},_getDaysInMonth:function(year,month){return 32-new Date(year,month,32).getDate()},_getFirstDayOfMonth:function(year,month){return new Date(year,month,1).getDay()},_canAdjustMonth:function(inst,offset,curYear,curMonth){var numMonths=this._getNumberOfMonths(inst);var date=new Date(curYear,curMonth+(offset<0?offset:numMonths[1]),1);if(offset<0){date.setDate(this._getDaysInMonth(date.getFullYear(),date.getMonth()))}return this._isInRange(inst,date)},_isInRange:function(inst,date){var newMinDate=(!inst.rangeStart?null:new Date(inst.selectedYear,inst.selectedMonth,inst.selectedDay));newMinDate=(newMinDate&&inst.rangeStart<newMinDate?inst.rangeStart:newMinDate);var minDate=newMinDate||this._getMinMaxDate(inst,"min");var maxDate=this._getMinMaxDate(inst,"max");return((!minDate||date>=minDate)&&(!maxDate||date<=maxDate))},_getFormatConfig:function(inst){var shortYearCutoff=this._get(inst,"shortYearCutoff");shortYearCutoff=(typeof shortYearCutoff!="string"?shortYearCutoff:new Date().getFullYear()%100+parseInt(shortYearCutoff,10));return{shortYearCutoff:shortYearCutoff,dayNamesShort:this._get(inst,"dayNamesShort"),dayNames:this._get(inst,"dayNames"),monthNamesShort:this._get(inst,"monthNamesShort"),monthNames:this._get(inst,"monthNames")}},_formatDate:function(inst,day,month,year){if(!day){inst.currentDay=inst.selectedDay;inst.currentMonth=inst.selectedMonth;inst.currentYear=inst.selectedYear}var date=(day?(typeof day=="object"?day:new Date(year,month,day)):new Date(inst.currentYear,inst.currentMonth,inst.currentDay));return this.formatDate(this._get(inst,"dateFormat"),date,this._getFormatConfig(inst))}});function extendRemove(target,props){$.extend(target,props);for(var name in props){if(props[name]==null||props[name]==undefined){target[name]=props[name]}}return target}function isArray(a){return(a&&(($.browser.safari&&typeof a=="object"&&a.length)||(a.constructor&&a.constructor.toString().match(/\Array\(\)/))))}$.fn.datepicker=function(options){if(!$.datepicker.initialized){$(document.body).append($.datepicker.dpDiv).mousedown($.datepicker._checkExternalClick);$.datepicker.initialized=true}var otherArgs=Array.prototype.slice.call(arguments,1);if(typeof options=="string"&&(options=="isDisabled"||options=="getDate")){return $.datepicker["_"+options+"Datepicker"].apply($.datepicker,[this[0]].concat(otherArgs))}return this.each(function(){typeof options=="string"?$.datepicker["_"+options+"Datepicker"].apply($.datepicker,[this].concat(otherArgs)):$.datepicker._attachDatepicker(this,options)})};$.datepicker=new Datepicker();$.datepicker.initialized=false;$.datepicker.uuid=new Date().getTime()})(jQuery)
diff --git a/trunk/ui.datepicker.min.js b/trunk/ui.datepicker.min.js
new file mode 100644
index 000000000..155949aad
--- /dev/null
+++ b/trunk/ui.datepicker.min.js
@@ -0,0 +1,12 @@
+/*
+ * jQuery UI Datepicker 1.7.2
+ *
+ * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
+ * and GPL (GPL-LICENSE.txt) licenses.
+ *
+ * http://docs.jquery.com/UI/Datepicker
+ *
+ * Depends:
+ * ui.core.js
+ */ (function($){$.extend($.ui,{datepicker:{version:"1.7.2"}});var PROP_NAME="datepicker";function Datepicker(){this.debug=false;this._curInst=null;this._keyEvent=false;this._disabledInputs=[];this._datepickerShowing=false;this._inDialog=false;this._mainDivId="ui-datepicker-div";this._inlineClass="ui-datepicker-inline";this._appendClass="ui-datepicker-append";this._triggerClass="ui-datepicker-trigger";this._dialogClass="ui-datepicker-dialog";this._disableClass="ui-datepicker-disabled";this._unselectableClass="ui-datepicker-unselectable";this._currentClass="ui-datepicker-current-day";this._dayOverClass="ui-datepicker-days-cell-over";this.regional=[];this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],dateFormat:"mm/dd/yy",firstDay:0,isRTL:false};this._defaults={showOn:"focus",showAnim:"show",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:false,hideIfNoPrevNext:false,navigationAsDateFormat:false,gotoCurrent:false,changeMonth:false,changeYear:false,showMonthAfterYear:false,yearRange:"-10:+10",showOtherMonths:false,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",minDate:null,maxDate:null,duration:"normal",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:true,showButtonPanel:false};$.extend(this._defaults,this.regional[""]);this.dpDiv=$('<div id="'+this._mainDivId+'" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all ui-helper-hidden-accessible"></div>')}$.extend(Datepicker.prototype,{markerClassName:"hasDatepicker",log:function(){if(this.debug){console.log.apply("",arguments)}},setDefaults:function(settings){extendRemove(this._defaults,settings||{});return this},_attachDatepicker:function(target,settings){var inlineSettings=null;for(var attrName in this._defaults){var attrValue=target.getAttribute("date:"+attrName);if(attrValue){inlineSettings=inlineSettings||{};try{inlineSettings[attrName]=eval(attrValue)}catch(err){inlineSettings[attrName]=attrValue}}}var nodeName=target.nodeName.toLowerCase();var inline=(nodeName=="div"||nodeName=="span");if(!target.id){target.id="dp"+(++this.uuid)}var inst=this._newInst($(target),inline);inst.settings=$.extend({},settings||{},inlineSettings||{});if(nodeName=="input"){this._connectDatepicker(target,inst)}else{if(inline){this._inlineDatepicker(target,inst)}}},_newInst:function(target,inline){var id=target[0].id.replace(/([:\[\]\.])/g,"\\\\$1");return{id:id,input:target,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:inline,dpDiv:(!inline?this.dpDiv:$('<div class="'+this._inlineClass+' ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>'))}},_connectDatepicker:function(target,inst){var input=$(target);inst.append=$([]);inst.trigger=$([]);if(input.hasClass(this.markerClassName)){return}var appendText=this._get(inst,"appendText");var isRTL=this._get(inst,"isRTL");if(appendText){inst.append=$('<span class="'+this._appendClass+'">'+appendText+"</span>");input[isRTL?"before":"after"](inst.append)}var showOn=this._get(inst,"showOn");if(showOn=="focus"||showOn=="both"){input.focus(this._showDatepicker)}if(showOn=="button"||showOn=="both"){var buttonText=this._get(inst,"buttonText");var buttonImage=this._get(inst,"buttonImage");inst.trigger=$(this._get(inst,"buttonImageOnly")?$("<img/>").addClass(this._triggerClass).attr({src:buttonImage,alt:buttonText,title:buttonText}):$('<button type="button"></button>').addClass(this._triggerClass).html(buttonImage==""?buttonText:$("<img/>").attr({src:buttonImage,alt:buttonText,title:buttonText})));input[isRTL?"before":"after"](inst.trigger);inst.trigger.click(function(){if($.datepicker._datepickerShowing&&$.datepicker._lastInput==target){$.datepicker._hideDatepicker()}else{$.datepicker._showDatepicker(target)}return false})}input.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).bind("setData.datepicker",function(event,key,value){inst.settings[key]=value}).bind("getData.datepicker",function(event,key){return this._get(inst,key)});$.data(target,PROP_NAME,inst)},_inlineDatepicker:function(target,inst){var divSpan=$(target);if(divSpan.hasClass(this.markerClassName)){return}divSpan.addClass(this.markerClassName).append(inst.dpDiv).bind("setData.datepicker",function(event,key,value){inst.settings[key]=value}).bind("getData.datepicker",function(event,key){return this._get(inst,key)});$.data(target,PROP_NAME,inst);this._setDate(inst,this._getDefaultDate(inst));this._updateDatepicker(inst);this._updateAlternate(inst)},_dialogDatepicker:function(input,dateText,onSelect,settings,pos){var inst=this._dialogInst;if(!inst){var id="dp"+(++this.uuid);this._dialogInput=$('<input type="text" id="'+id+'" size="1" style="position: absolute; top: -100px;"/>');this._dialogInput.keydown(this._doKeyDown);$("body").append(this._dialogInput);inst=this._dialogInst=this._newInst(this._dialogInput,false);inst.settings={};$.data(this._dialogInput[0],PROP_NAME,inst)}extendRemove(inst.settings,settings||{});this._dialogInput.val(dateText);this._pos=(pos?(pos.length?pos:[pos.pageX,pos.pageY]):null);if(!this._pos){var browserWidth=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth;var browserHeight=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight;var scrollX=document.documentElement.scrollLeft||document.body.scrollLeft;var scrollY=document.documentElement.scrollTop||document.body.scrollTop;this._pos=[(browserWidth/2)-100+scrollX,(browserHeight/2)-150+scrollY]}this._dialogInput.css("left",this._pos[0]+"px").css("top",this._pos[1]+"px");inst.settings.onSelect=onSelect;this._inDialog=true;this.dpDiv.addClass(this._dialogClass);this._showDatepicker(this._dialogInput[0]);if($.blockUI){$.blockUI(this.dpDiv)}$.data(this._dialogInput[0],PROP_NAME,inst);return this},_destroyDatepicker:function(target){var $target=$(target);var inst=$.data(target,PROP_NAME);if(!$target.hasClass(this.markerClassName)){return}var nodeName=target.nodeName.toLowerCase();$.removeData(target,PROP_NAME);if(nodeName=="input"){inst.append.remove();inst.trigger.remove();$target.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress)}else{if(nodeName=="div"||nodeName=="span"){$target.removeClass(this.markerClassName).empty()}}},_enableDatepicker:function(target){var $target=$(target);var inst=$.data(target,PROP_NAME);if(!$target.hasClass(this.markerClassName)){return}var nodeName=target.nodeName.toLowerCase();if(nodeName=="input"){target.disabled=false;inst.trigger.filter("button").each(function(){this.disabled=false}).end().filter("img").css({opacity:"1.0",cursor:""})}else{if(nodeName=="div"||nodeName=="span"){var inline=$target.children("."+this._inlineClass);inline.children().removeClass("ui-state-disabled")}}this._disabledInputs=$.map(this._disabledInputs,function(value){return(value==target?null:value)})},_disableDatepicker:function(target){var $target=$(target);var inst=$.data(target,PROP_NAME);if(!$target.hasClass(this.markerClassName)){return}var nodeName=target.nodeName.toLowerCase();if(nodeName=="input"){target.disabled=true;inst.trigger.filter("button").each(function(){this.disabled=true}).end().filter("img").css({opacity:"0.5",cursor:"default"})}else{if(nodeName=="div"||nodeName=="span"){var inline=$target.children("."+this._inlineClass);inline.children().addClass("ui-state-disabled")}}this._disabledInputs=$.map(this._disabledInputs,function(value){return(value==target?null:value)});this._disabledInputs[this._disabledInputs.length]=target},_isDisabledDatepicker:function(target){if(!target){return false}for(var i=0;i<this._disabledInputs.length;i++){if(this._disabledInputs[i]==target){return true}}return false},_getInst:function(target){try{return $.data(target,PROP_NAME)}catch(err){throw"Missing instance data for this datepicker"}},_optionDatepicker:function(target,name,value){var inst=this._getInst(target);if(arguments.length==2&&typeof name=="string"){return(name=="defaults"?$.extend({},$.datepicker._defaults):(inst?(name=="all"?$.extend({},inst.settings):this._get(inst,name)):null))}var settings=name||{};if(typeof name=="string"){settings={};settings[name]=value}if(inst){if(this._curInst==inst){this._hideDatepicker(null)}var date=this._getDateDatepicker(target);extendRemove(inst.settings,settings);this._setDateDatepicker(target,date);this._updateDatepicker(inst)}},_changeDatepicker:function(target,name,value){this._optionDatepicker(target,name,value)},_refreshDatepicker:function(target){var inst=this._getInst(target);if(inst){this._updateDatepicker(inst)}},_setDateDatepicker:function(target,date,endDate){var inst=this._getInst(target);if(inst){this._setDate(inst,date,endDate);this._updateDatepicker(inst);this._updateAlternate(inst)}},_getDateDatepicker:function(target){var inst=this._getInst(target);if(inst&&!inst.inline){this._setDateFromField(inst)}return(inst?this._getDate(inst):null)},_doKeyDown:function(event){var inst=$.datepicker._getInst(event.target);var handled=true;var isRTL=inst.dpDiv.is(".ui-datepicker-rtl");inst._keyEvent=true;if($.datepicker._datepickerShowing){switch(event.keyCode){case 9:$.datepicker._hideDatepicker(null,"");break;case 13:var sel=$("td."+$.datepicker._dayOverClass+", td."+$.datepicker._currentClass,inst.dpDiv);if(sel[0]){$.datepicker._selectDay(event.target,inst.selectedMonth,inst.selectedYear,sel[0])}else{$.datepicker._hideDatepicker(null,$.datepicker._get(inst,"duration"))}return false;break;case 27:$.datepicker._hideDatepicker(null,$.datepicker._get(inst,"duration"));break;case 33:$.datepicker._adjustDate(event.target,(event.ctrlKey?-$.datepicker._get(inst,"stepBigMonths"):-$.datepicker._get(inst,"stepMonths")),"M");break;case 34:$.datepicker._adjustDate(event.target,(event.ctrlKey?+$.datepicker._get(inst,"stepBigMonths"):+$.datepicker._get(inst,"stepMonths")),"M");break;case 35:if(event.ctrlKey||event.metaKey){$.datepicker._clearDate(event.target)}handled=event.ctrlKey||event.metaKey;break;case 36:if(event.ctrlKey||event.metaKey){$.datepicker._gotoToday(event.target)}handled=event.ctrlKey||event.metaKey;break;case 37:if(event.ctrlKey||event.metaKey){$.datepicker._adjustDate(event.target,(isRTL?+1:-1),"D")}handled=event.ctrlKey||event.metaKey;if(event.originalEvent.altKey){$.datepicker._adjustDate(event.target,(event.ctrlKey?-$.datepicker._get(inst,"stepBigMonths"):-$.datepicker._get(inst,"stepMonths")),"M")}break;case 38:if(event.ctrlKey||event.metaKey){$.datepicker._adjustDate(event.target,-7,"D")}handled=event.ctrlKey||event.metaKey;break;case 39:if(event.ctrlKey||event.metaKey){$.datepicker._adjustDate(event.target,(isRTL?-1:+1),"D")}handled=event.ctrlKey||event.metaKey;if(event.originalEvent.altKey){$.datepicker._adjustDate(event.target,(event.ctrlKey?+$.datepicker._get(inst,"stepBigMonths"):+$.datepicker._get(inst,"stepMonths")),"M")}break;case 40:if(event.ctrlKey||event.metaKey){$.datepicker._adjustDate(event.target,+7,"D")}handled=event.ctrlKey||event.metaKey;break;default:handled=false}}else{if(event.keyCode==36&&event.ctrlKey){$.datepicker._showDatepicker(this)}else{handled=false}}if(handled){event.preventDefault();event.stopPropagation()}},_doKeyPress:function(event){var inst=$.datepicker._getInst(event.target);if($.datepicker._get(inst,"constrainInput")){var chars=$.datepicker._possibleChars($.datepicker._get(inst,"dateFormat"));var chr=String.fromCharCode(event.charCode==undefined?event.keyCode:event.charCode);return event.ctrlKey||(chr<" "||!chars||chars.indexOf(chr)>-1)}},_showDatepicker:function(input){input=input.target||input;if(input.nodeName.toLowerCase()!="input"){input=$("input",input.parentNode)[0]}if($.datepicker._isDisabledDatepicker(input)||$.datepicker._lastInput==input){return}var inst=$.datepicker._getInst(input);var beforeShow=$.datepicker._get(inst,"beforeShow");extendRemove(inst.settings,(beforeShow?beforeShow.apply(input,[input,inst]):{}));$.datepicker._hideDatepicker(null,"");$.datepicker._lastInput=input;$.datepicker._setDateFromField(inst);if($.datepicker._inDialog){input.value=""}if(!$.datepicker._pos){$.datepicker._pos=$.datepicker._findPos(input);$.datepicker._pos[1]+=input.offsetHeight}var isFixed=false;$(input).parents().each(function(){isFixed|=$(this).css("position")=="fixed";return !isFixed});if(isFixed&&$.browser.opera){$.datepicker._pos[0]-=document.documentElement.scrollLeft;$.datepicker._pos[1]-=document.documentElement.scrollTop}var offset={left:$.datepicker._pos[0],top:$.datepicker._pos[1]};$.datepicker._pos=null;inst.rangeStart=null;inst.dpDiv.css({position:"absolute",display:"block",top:"-1000px"});$.datepicker._updateDatepicker(inst);offset=$.datepicker._checkOffset(inst,offset,isFixed);inst.dpDiv.css({position:($.datepicker._inDialog&&$.blockUI?"static":(isFixed?"fixed":"absolute")),display:"none",left:offset.left+"px",top:offset.top+"px"});if(!inst.inline){var showAnim=$.datepicker._get(inst,"showAnim")||"show";var duration=$.datepicker._get(inst,"duration");var postProcess=function(){$.datepicker._datepickerShowing=true;if($.browser.msie&&parseInt($.browser.version,10)<7){$("iframe.ui-datepicker-cover").css({width:inst.dpDiv.width()+4,height:inst.dpDiv.height()+4})}};if($.effects&&$.effects[showAnim]){inst.dpDiv.show(showAnim,$.datepicker._get(inst,"showOptions"),duration,postProcess)}else{inst.dpDiv[showAnim](duration,postProcess)}if(duration==""){postProcess()}if(inst.input[0].type!="hidden"){inst.input[0].focus()}$.datepicker._curInst=inst}},_updateDatepicker:function(inst){var dims={width:inst.dpDiv.width()+4,height:inst.dpDiv.height()+4};var self=this;inst.dpDiv.empty().append(this._generateHTML(inst)).find("iframe.ui-datepicker-cover").css({width:dims.width,height:dims.height}).end().find("button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a").bind("mouseout",function(){$(this).removeClass("ui-state-hover");if(this.className.indexOf("ui-datepicker-prev")!=-1){$(this).removeClass("ui-datepicker-prev-hover")}if(this.className.indexOf("ui-datepicker-next")!=-1){$(this).removeClass("ui-datepicker-next-hover")}}).bind("mouseover",function(){if(!self._isDisabledDatepicker(inst.inline?inst.dpDiv.parent()[0]:inst.input[0])){$(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover");$(this).addClass("ui-state-hover");if(this.className.indexOf("ui-datepicker-prev")!=-1){$(this).addClass("ui-datepicker-prev-hover")}if(this.className.indexOf("ui-datepicker-next")!=-1){$(this).addClass("ui-datepicker-next-hover")}}}).end().find("."+this._dayOverClass+" a").trigger("mouseover").end();var numMonths=this._getNumberOfMonths(inst);var cols=numMonths[1];var width=17;if(cols>1){inst.dpDiv.addClass("ui-datepicker-multi-"+cols).css("width",(width*cols)+"em")}else{inst.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width("")}inst.dpDiv[(numMonths[0]!=1||numMonths[1]!=1?"add":"remove")+"Class"]("ui-datepicker-multi");inst.dpDiv[(this._get(inst,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl");if(inst.input&&inst.input[0].type!="hidden"&&inst==$.datepicker._curInst){$(inst.input[0]).focus()}},_checkOffset:function(inst,offset,isFixed){var dpWidth=inst.dpDiv.outerWidth();var dpHeight=inst.dpDiv.outerHeight();var inputWidth=inst.input?inst.input.outerWidth():0;var inputHeight=inst.input?inst.input.outerHeight():0;var viewWidth=(window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth)+$(document).scrollLeft();var viewHeight=(window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight)+$(document).scrollTop();offset.left-=(this._get(inst,"isRTL")?(dpWidth-inputWidth):0);offset.left-=(isFixed&&offset.left==inst.input.offset().left)?$(document).scrollLeft():0;offset.top-=(isFixed&&offset.top==(inst.input.offset().top+inputHeight))?$(document).scrollTop():0;offset.left-=(offset.left+dpWidth>viewWidth&&viewWidth>dpWidth)?Math.abs(offset.left+dpWidth-viewWidth):0;offset.top-=(offset.top+dpHeight>viewHeight&&viewHeight>dpHeight)?Math.abs(offset.top+dpHeight+inputHeight*2-viewHeight):0;return offset},_findPos:function(obj){while(obj&&(obj.type=="hidden"||obj.nodeType!=1)){obj=obj.nextSibling}var position=$(obj).offset();return[position.left,position.top]},_hideDatepicker:function(input,duration){var inst=this._curInst;if(!inst||(input&&inst!=$.data(input,PROP_NAME))){return}if(inst.stayOpen){this._selectDate("#"+inst.id,this._formatDate(inst,inst.currentDay,inst.currentMonth,inst.currentYear))}inst.stayOpen=false;if(this._datepickerShowing){duration=(duration!=null?duration:this._get(inst,"duration"));var showAnim=this._get(inst,"showAnim");var postProcess=function(){$.datepicker._tidyDialog(inst)};if(duration!=""&&$.effects&&$.effects[showAnim]){inst.dpDiv.hide(showAnim,$.datepicker._get(inst,"showOptions"),duration,postProcess)}else{inst.dpDiv[(duration==""?"hide":(showAnim=="slideDown"?"slideUp":(showAnim=="fadeIn"?"fadeOut":"hide")))](duration,postProcess)}if(duration==""){this._tidyDialog(inst)}var onClose=this._get(inst,"onClose");if(onClose){onClose.apply((inst.input?inst.input[0]:null),[(inst.input?inst.input.val():""),inst])}this._datepickerShowing=false;this._lastInput=null;if(this._inDialog){this._dialogInput.css({position:"absolute",left:"0",top:"-100px"});if($.blockUI){$.unblockUI();$("body").append(this.dpDiv)}}this._inDialog=false}this._curInst=null},_tidyDialog:function(inst){inst.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},_checkExternalClick:function(event){if(!$.datepicker._curInst){return}var $target=$(event.target);if(($target.parents("#"+$.datepicker._mainDivId).length==0)&&!$target.hasClass($.datepicker.markerClassName)&&!$target.hasClass($.datepicker._triggerClass)&&$.datepicker._datepickerShowing&&!($.datepicker._inDialog&&$.blockUI)){$.datepicker._hideDatepicker(null,"")}},_adjustDate:function(id,offset,period){var target=$(id);var inst=this._getInst(target[0]);if(this._isDisabledDatepicker(target[0])){return}this._adjustInstDate(inst,offset+(period=="M"?this._get(inst,"showCurrentAtPos"):0),period);this._updateDatepicker(inst)},_gotoToday:function(id){var target=$(id);var inst=this._getInst(target[0]);if(this._get(inst,"gotoCurrent")&&inst.currentDay){inst.selectedDay=inst.currentDay;inst.drawMonth=inst.selectedMonth=inst.currentMonth;inst.drawYear=inst.selectedYear=inst.currentYear}else{var date=new Date();inst.selectedDay=date.getDate();inst.drawMonth=inst.selectedMonth=date.getMonth();inst.drawYear=inst.selectedYear=date.getFullYear()}this._notifyChange(inst);this._adjustDate(target)},_selectMonthYear:function(id,select,period){var target=$(id);var inst=this._getInst(target[0]);inst._selectingMonthYear=false;inst["selected"+(period=="M"?"Month":"Year")]=inst["draw"+(period=="M"?"Month":"Year")]=parseInt(select.options[select.selectedIndex].value,10);this._notifyChange(inst);this._adjustDate(target)},_clickMonthYear:function(id){var target=$(id);var inst=this._getInst(target[0]);if(inst.input&&inst._selectingMonthYear&&!$.browser.msie){inst.input[0].focus()}inst._selectingMonthYear=!inst._selectingMonthYear},_selectDay:function(id,month,year,td){var target=$(id);if($(td).hasClass(this._unselectableClass)||this._isDisabledDatepicker(target[0])){return}var inst=this._getInst(target[0]);inst.selectedDay=inst.currentDay=$("a",td).html();inst.selectedMonth=inst.currentMonth=month;inst.selectedYear=inst.currentYear=year;if(inst.stayOpen){inst.endDay=inst.endMonth=inst.endYear=null}this._selectDate(id,this._formatDate(inst,inst.currentDay,inst.currentMonth,inst.currentYear));if(inst.stayOpen){inst.rangeStart=this._daylightSavingAdjust(new Date(inst.currentYear,inst.currentMonth,inst.currentDay));this._updateDatepicker(inst)}},_clearDate:function(id){var target=$(id);var inst=this._getInst(target[0]);inst.stayOpen=false;inst.endDay=inst.endMonth=inst.endYear=inst.rangeStart=null;this._selectDate(target,"")},_selectDate:function(id,dateStr){var target=$(id);var inst=this._getInst(target[0]);dateStr=(dateStr!=null?dateStr:this._formatDate(inst));if(inst.input){inst.input.val(dateStr)}this._updateAlternate(inst);var onSelect=this._get(inst,"onSelect");if(onSelect){onSelect.apply((inst.input?inst.input[0]:null),[dateStr,inst])}else{if(inst.input){inst.input.trigger("change")}}if(inst.inline){this._updateDatepicker(inst)}else{if(!inst.stayOpen){this._hideDatepicker(null,this._get(inst,"duration"));this._lastInput=inst.input[0];if(typeof(inst.input[0])!="object"){inst.input[0].focus()}this._lastInput=null}}},_updateAlternate:function(inst){var altField=this._get(inst,"altField");if(altField){var altFormat=this._get(inst,"altFormat")||this._get(inst,"dateFormat");var date=this._getDate(inst);dateStr=this.formatDate(altFormat,date,this._getFormatConfig(inst));$(altField).each(function(){$(this).val(dateStr)})}},noWeekends:function(date){var day=date.getDay();return[(day>0&&day<6),""]},iso8601Week:function(date){var checkDate=new Date(date.getFullYear(),date.getMonth(),date.getDate());var firstMon=new Date(checkDate.getFullYear(),1-1,4);var firstDay=firstMon.getDay()||7;firstMon.setDate(firstMon.getDate()+1-firstDay);if(firstDay<4&&checkDate<firstMon){checkDate.setDate(checkDate.getDate()-3);return $.datepicker.iso8601Week(checkDate)}else{if(checkDate>new Date(checkDate.getFullYear(),12-1,28)){firstDay=new Date(checkDate.getFullYear()+1,1-1,4).getDay()||7;if(firstDay>4&&(checkDate.getDay()||7)<firstDay-3){return 1}}}return Math.floor(((checkDate-firstMon)/86400000)/7)+1},parseDate:function(format,value,settings){if(format==null||value==null){throw"Invalid arguments"}value=(typeof value=="object"?value.toString():value+"");if(value==""){return null}var shortYearCutoff=(settings?settings.shortYearCutoff:null)||this._defaults.shortYearCutoff;var dayNamesShort=(settings?settings.dayNamesShort:null)||this._defaults.dayNamesShort;var dayNames=(settings?settings.dayNames:null)||this._defaults.dayNames;var monthNamesShort=(settings?settings.monthNamesShort:null)||this._defaults.monthNamesShort;var monthNames=(settings?settings.monthNames:null)||this._defaults.monthNames;var year=-1;var month=-1;var day=-1;var doy=-1;var literal=false;var lookAhead=function(match){var matches=(iFormat+1<format.length&&format.charAt(iFormat+1)==match);if(matches){iFormat++}return matches};var getNumber=function(match){lookAhead(match);var origSize=(match=="@"?14:(match=="y"?4:(match=="o"?3:2)));var size=origSize;var num=0;while(size>0&&iValue<value.length&&value.charAt(iValue)>="0"&&value.charAt(iValue)<="9"){num=num*10+parseInt(value.charAt(iValue++),10);size--}if(size==origSize){throw"Missing number at position "+iValue}return num};var getName=function(match,shortNames,longNames){var names=(lookAhead(match)?longNames:shortNames);var size=0;for(var j=0;j<names.length;j++){size=Math.max(size,names[j].length)}var name="";var iInit=iValue;while(size>0&&iValue<value.length){name+=value.charAt(iValue++);for(var i=0;i<names.length;i++){if(name==names[i]){return i+1}}size--}throw"Unknown name at position "+iInit};var checkLiteral=function(){if(value.charAt(iValue)!=format.charAt(iFormat)){throw"Unexpected literal at position "+iValue}iValue++};var iValue=0;for(var iFormat=0;iFormat<format.length;iFormat++){if(literal){if(format.charAt(iFormat)=="'"&&!lookAhead("'")){literal=false}else{checkLiteral()}}else{switch(format.charAt(iFormat)){case"d":day=getNumber("d");break;case"D":getName("D",dayNamesShort,dayNames);break;case"o":doy=getNumber("o");break;case"m":month=getNumber("m");break;case"M":month=getName("M",monthNamesShort,monthNames);break;case"y":year=getNumber("y");break;case"@":var date=new Date(getNumber("@"));year=date.getFullYear();month=date.getMonth()+1;day=date.getDate();break;case"'":if(lookAhead("'")){checkLiteral()}else{literal=true}break;default:checkLiteral()}}}if(year==-1){year=new Date().getFullYear()}else{if(year<100){year+=new Date().getFullYear()-new Date().getFullYear()%100+(year<=shortYearCutoff?0:-100)}}if(doy>-1){month=1;day=doy;do{var dim=this._getDaysInMonth(year,month-1);if(day<=dim){break}month++;day-=dim}while(true)}var date=this._daylightSavingAdjust(new Date(year,month-1,day));if(date.getFullYear()!=year||date.getMonth()+1!=month||date.getDate()!=day){throw"Invalid date"}return date},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TIMESTAMP:"@",W3C:"yy-mm-dd",formatDate:function(format,date,settings){if(!date){return""}var dayNamesShort=(settings?settings.dayNamesShort:null)||this._defaults.dayNamesShort;var dayNames=(settings?settings.dayNames:null)||this._defaults.dayNames;var monthNamesShort=(settings?settings.monthNamesShort:null)||this._defaults.monthNamesShort;var monthNames=(settings?settings.monthNames:null)||this._defaults.monthNames;var lookAhead=function(match){var matches=(iFormat+1<format.length&&format.charAt(iFormat+1)==match);if(matches){iFormat++}return matches};var formatNumber=function(match,value,len){var num=""+value;if(lookAhead(match)){while(num.length<len){num="0"+num}}return num};var formatName=function(match,value,shortNames,longNames){return(lookAhead(match)?longNames[value]:shortNames[value])};var output="";var literal=false;if(date){for(var iFormat=0;iFormat<format.length;iFormat++){if(literal){if(format.charAt(iFormat)=="'"&&!lookAhead("'")){literal=false}else{output+=format.charAt(iFormat)}}else{switch(format.charAt(iFormat)){case"d":output+=formatNumber("d",date.getDate(),2);break;case"D":output+=formatName("D",date.getDay(),dayNamesShort,dayNames);break;case"o":var doy=date.getDate();for(var m=date.getMonth()-1;m>=0;m--){doy+=this._getDaysInMonth(date.getFullYear(),m)}output+=formatNumber("o",doy,3);break;case"m":output+=formatNumber("m",date.getMonth()+1,2);break;case"M":output+=formatName("M",date.getMonth(),monthNamesShort,monthNames);break;case"y":output+=(lookAhead("y")?date.getFullYear():(date.getYear()%100<10?"0":"")+date.getYear()%100);break;case"@":output+=date.getTime();break;case"'":if(lookAhead("'")){output+="'"}else{literal=true}break;default:output+=format.charAt(iFormat)}}}}return output},_possibleChars:function(format){var chars="";var literal=false;for(var iFormat=0;iFormat<format.length;iFormat++){if(literal){if(format.charAt(iFormat)=="'"&&!lookAhead("'")){literal=false}else{chars+=format.charAt(iFormat)}}else{switch(format.charAt(iFormat)){case"d":case"m":case"y":case"@":chars+="0123456789";break;case"D":case"M":return null;case"'":if(lookAhead("'")){chars+="'"}else{literal=true}break;default:chars+=format.charAt(iFormat)}}}return chars},_get:function(inst,name){return inst.settings[name]!==undefined?inst.settings[name]:this._defaults[name]},_setDateFromField:function(inst){var dateFormat=this._get(inst,"dateFormat");var dates=inst.input?inst.input.val():null;inst.endDay=inst.endMonth=inst.endYear=null;var date=defaultDate=this._getDefaultDate(inst);var settings=this._getFormatConfig(inst);try{date=this.parseDate(dateFormat,dates,settings)||defaultDate}catch(event){this.log(event);date=defaultDate}inst.selectedDay=date.getDate();inst.drawMonth=inst.selectedMonth=date.getMonth();inst.drawYear=inst.selectedYear=date.getFullYear();inst.currentDay=(dates?date.getDate():0);inst.currentMonth=(dates?date.getMonth():0);inst.currentYear=(dates?date.getFullYear():0);this._adjustInstDate(inst)},_getDefaultDate:function(inst){var date=this._determineDate(this._get(inst,"defaultDate"),new Date());var minDate=this._getMinMaxDate(inst,"min",true);var maxDate=this._getMinMaxDate(inst,"max");date=(minDate&&date<minDate?minDate:date);date=(maxDate&&date>maxDate?maxDate:date);return date},_determineDate:function(date,defaultDate){var offsetNumeric=function(offset){var date=new Date();date.setDate(date.getDate()+offset);return date};var offsetString=function(offset,getDaysInMonth){var date=new Date();var year=date.getFullYear();var month=date.getMonth();var day=date.getDate();var pattern=/([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g;var matches=pattern.exec(offset);while(matches){switch(matches[2]||"d"){case"d":case"D":day+=parseInt(matches[1],10);break;case"w":case"W":day+=parseInt(matches[1],10)*7;break;case"m":case"M":month+=parseInt(matches[1],10);day=Math.min(day,getDaysInMonth(year,month));break;case"y":case"Y":year+=parseInt(matches[1],10);day=Math.min(day,getDaysInMonth(year,month));break}matches=pattern.exec(offset)}return new Date(year,month,day)};date=(date==null?defaultDate:(typeof date=="string"?offsetString(date,this._getDaysInMonth):(typeof date=="number"?(isNaN(date)?defaultDate:offsetNumeric(date)):date)));date=(date&&date.toString()=="Invalid Date"?defaultDate:date);if(date){date.setHours(0);date.setMinutes(0);date.setSeconds(0);date.setMilliseconds(0)}return this._daylightSavingAdjust(date)},_daylightSavingAdjust:function(date){if(!date){return null}date.setHours(date.getHours()>12?date.getHours()+2:0);return date},_setDate:function(inst,date,endDate){var clear=!(date);var origMonth=inst.selectedMonth;var origYear=inst.selectedYear;date=this._determineDate(date,new Date());inst.selectedDay=inst.currentDay=date.getDate();inst.drawMonth=inst.selectedMonth=inst.currentMonth=date.getMonth();inst.drawYear=inst.selectedYear=inst.currentYear=date.getFullYear();if(origMonth!=inst.selectedMonth||origYear!=inst.selectedYear){this._notifyChange(inst)}this._adjustInstDate(inst);if(inst.input){inst.input.val(clear?"":this._formatDate(inst))}},_getDate:function(inst){var startDate=(!inst.currentYear||(inst.input&&inst.input.val()=="")?null:this._daylightSavingAdjust(new Date(inst.currentYear,inst.currentMonth,inst.currentDay)));return startDate},_generateHTML:function(inst){var today=new Date();today=this._daylightSavingAdjust(new Date(today.getFullYear(),today.getMonth(),today.getDate()));var isRTL=this._get(inst,"isRTL");var showButtonPanel=this._get(inst,"showButtonPanel");var hideIfNoPrevNext=this._get(inst,"hideIfNoPrevNext");var navigationAsDateFormat=this._get(inst,"navigationAsDateFormat");var numMonths=this._getNumberOfMonths(inst);var showCurrentAtPos=this._get(inst,"showCurrentAtPos");var stepMonths=this._get(inst,"stepMonths");var stepBigMonths=this._get(inst,"stepBigMonths");var isMultiMonth=(numMonths[0]!=1||numMonths[1]!=1);var currentDate=this._daylightSavingAdjust((!inst.currentDay?new Date(9999,9,9):new Date(inst.currentYear,inst.currentMonth,inst.currentDay)));var minDate=this._getMinMaxDate(inst,"min",true);var maxDate=this._getMinMaxDate(inst,"max");var drawMonth=inst.drawMonth-showCurrentAtPos;var drawYear=inst.drawYear;if(drawMonth<0){drawMonth+=12;drawYear--}if(maxDate){var maxDraw=this._daylightSavingAdjust(new Date(maxDate.getFullYear(),maxDate.getMonth()-numMonths[1]+1,maxDate.getDate()));maxDraw=(minDate&&maxDraw<minDate?minDate:maxDraw);while(this._daylightSavingAdjust(new Date(drawYear,drawMonth,1))>maxDraw){drawMonth--;if(drawMonth<0){drawMonth=11;drawYear--}}}inst.drawMonth=drawMonth;inst.drawYear=drawYear;var prevText=this._get(inst,"prevText");prevText=(!navigationAsDateFormat?prevText:this.formatDate(prevText,this._daylightSavingAdjust(new Date(drawYear,drawMonth-stepMonths,1)),this._getFormatConfig(inst)));var prev=(this._canAdjustMonth(inst,-1,drawYear,drawMonth)?'<a class="ui-datepicker-prev ui-corner-all" onclick="DP_jQuery.datepicker._adjustDate(\'#'+inst.id+"', -"+stepMonths+", 'M');\" title=\""+prevText+'"><span class="ui-icon ui-icon-circle-triangle-'+(isRTL?"e":"w")+'">'+prevText+"</span></a>":(hideIfNoPrevNext?"":'<a class="ui-datepicker-prev ui-corner-all ui-state-disabled" title="'+prevText+'"><span class="ui-icon ui-icon-circle-triangle-'+(isRTL?"e":"w")+'">'+prevText+"</span></a>"));var nextText=this._get(inst,"nextText");nextText=(!navigationAsDateFormat?nextText:this.formatDate(nextText,this._daylightSavingAdjust(new Date(drawYear,drawMonth+stepMonths,1)),this._getFormatConfig(inst)));var next=(this._canAdjustMonth(inst,+1,drawYear,drawMonth)?'<a class="ui-datepicker-next ui-corner-all" onclick="DP_jQuery.datepicker._adjustDate(\'#'+inst.id+"', +"+stepMonths+", 'M');\" title=\""+nextText+'"><span class="ui-icon ui-icon-circle-triangle-'+(isRTL?"w":"e")+'">'+nextText+"</span></a>":(hideIfNoPrevNext?"":'<a class="ui-datepicker-next ui-corner-all ui-state-disabled" title="'+nextText+'"><span class="ui-icon ui-icon-circle-triangle-'+(isRTL?"w":"e")+'">'+nextText+"</span></a>"));var currentText=this._get(inst,"currentText");var gotoDate=(this._get(inst,"gotoCurrent")&&inst.currentDay?currentDate:today);currentText=(!navigationAsDateFormat?currentText:this.formatDate(currentText,gotoDate,this._getFormatConfig(inst)));var controls=(!inst.inline?'<button type="button" class="ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all" onclick="DP_jQuery.datepicker._hideDatepicker();">'+this._get(inst,"closeText")+"</button>":"");var buttonPanel=(showButtonPanel)?'<div class="ui-datepicker-buttonpane ui-widget-content">'+(isRTL?controls:"")+(this._isInRange(inst,gotoDate)?'<button type="button" class="ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all" onclick="DP_jQuery.datepicker._gotoToday(\'#'+inst.id+"');\">"+currentText+"</button>":"")+(isRTL?"":controls)+"</div>":"";var firstDay=parseInt(this._get(inst,"firstDay"),10);firstDay=(isNaN(firstDay)?0:firstDay);var dayNames=this._get(inst,"dayNames");var dayNamesShort=this._get(inst,"dayNamesShort");var dayNamesMin=this._get(inst,"dayNamesMin");var monthNames=this._get(inst,"monthNames");var monthNamesShort=this._get(inst,"monthNamesShort");var beforeShowDay=this._get(inst,"beforeShowDay");var showOtherMonths=this._get(inst,"showOtherMonths");var calculateWeek=this._get(inst,"calculateWeek")||this.iso8601Week;var endDate=inst.endDay?this._daylightSavingAdjust(new Date(inst.endYear,inst.endMonth,inst.endDay)):currentDate;var defaultDate=this._getDefaultDate(inst);var html="";for(var row=0;row<numMonths[0];row++){var group="";for(var col=0;col<numMonths[1];col++){var selectedDate=this._daylightSavingAdjust(new Date(drawYear,drawMonth,inst.selectedDay));var cornerClass=" ui-corner-all";var calender="";if(isMultiMonth){calender+='<div class="ui-datepicker-group ui-datepicker-group-';switch(col){case 0:calender+="first";cornerClass=" ui-corner-"+(isRTL?"right":"left");break;case numMonths[1]-1:calender+="last";cornerClass=" ui-corner-"+(isRTL?"left":"right");break;default:calender+="middle";cornerClass="";break}calender+='">'}calender+='<div class="ui-datepicker-header ui-widget-header ui-helper-clearfix'+cornerClass+'">'+(/all|left/.test(cornerClass)&&row==0?(isRTL?next:prev):"")+(/all|right/.test(cornerClass)&&row==0?(isRTL?prev:next):"")+this._generateMonthYearHeader(inst,drawMonth,drawYear,minDate,maxDate,selectedDate,row>0||col>0,monthNames,monthNamesShort)+'</div><table class="ui-datepicker-calendar"><thead><tr>';var thead="";for(var dow=0;dow<7;dow++){var day=(dow+firstDay)%7;thead+="<th"+((dow+firstDay+6)%7>=5?' class="ui-datepicker-week-end"':"")+'><span title="'+dayNames[day]+'">'+dayNamesMin[day]+"</span></th>"}calender+=thead+"</tr></thead><tbody>";var daysInMonth=this._getDaysInMonth(drawYear,drawMonth);if(drawYear==inst.selectedYear&&drawMonth==inst.selectedMonth){inst.selectedDay=Math.min(inst.selectedDay,daysInMonth)}var leadDays=(this._getFirstDayOfMonth(drawYear,drawMonth)-firstDay+7)%7;var numRows=(isMultiMonth?6:Math.ceil((leadDays+daysInMonth)/7));var printDate=this._daylightSavingAdjust(new Date(drawYear,drawMonth,1-leadDays));for(var dRow=0;dRow<numRows;dRow++){calender+="<tr>";var tbody="";for(var dow=0;dow<7;dow++){var daySettings=(beforeShowDay?beforeShowDay.apply((inst.input?inst.input[0]:null),[printDate]):[true,""]);var otherMonth=(printDate.getMonth()!=drawMonth);var unselectable=otherMonth||!daySettings[0]||(minDate&&printDate<minDate)||(maxDate&&printDate>maxDate);tbody+='<td class="'+((dow+firstDay+6)%7>=5?" ui-datepicker-week-end":"")+(otherMonth?" ui-datepicker-other-month":"")+((printDate.getTime()==selectedDate.getTime()&&drawMonth==inst.selectedMonth&&inst._keyEvent)||(defaultDate.getTime()==printDate.getTime()&&defaultDate.getTime()==selectedDate.getTime())?" "+this._dayOverClass:"")+(unselectable?" "+this._unselectableClass+" ui-state-disabled":"")+(otherMonth&&!showOtherMonths?"":" "+daySettings[1]+(printDate.getTime()>=currentDate.getTime()&&printDate.getTime()<=endDate.getTime()?" "+this._currentClass:"")+(printDate.getTime()==today.getTime()?" ui-datepicker-today":""))+'"'+((!otherMonth||showOtherMonths)&&daySettings[2]?' title="'+daySettings[2]+'"':"")+(unselectable?"":" onclick=\"DP_jQuery.datepicker._selectDay('#"+inst.id+"',"+drawMonth+","+drawYear+', this);return false;"')+">"+(otherMonth?(showOtherMonths?printDate.getDate():"&#xa0;"):(unselectable?'<span class="ui-state-default">'+printDate.getDate()+"</span>":'<a class="ui-state-default'+(printDate.getTime()==today.getTime()?" ui-state-highlight":"")+(printDate.getTime()>=currentDate.getTime()&&printDate.getTime()<=endDate.getTime()?" ui-state-active":"")+'" href="#">'+printDate.getDate()+"</a>"))+"</td>";printDate.setDate(printDate.getDate()+1);printDate=this._daylightSavingAdjust(printDate)}calender+=tbody+"</tr>"}drawMonth++;if(drawMonth>11){drawMonth=0;drawYear++}calender+="</tbody></table>"+(isMultiMonth?"</div>"+((numMonths[0]>0&&col==numMonths[1]-1)?'<div class="ui-datepicker-row-break"></div>':""):"");group+=calender}html+=group}html+=buttonPanel+($.browser.msie&&parseInt($.browser.version,10)<7&&!inst.inline?'<iframe src="javascript:false;" class="ui-datepicker-cover" frameborder="0"></iframe>':"");inst._keyEvent=false;return html},_generateMonthYearHeader:function(inst,drawMonth,drawYear,minDate,maxDate,selectedDate,secondary,monthNames,monthNamesShort){minDate=(inst.rangeStart&&minDate&&selectedDate<minDate?selectedDate:minDate);var changeMonth=this._get(inst,"changeMonth");var changeYear=this._get(inst,"changeYear");var showMonthAfterYear=this._get(inst,"showMonthAfterYear");var html='<div class="ui-datepicker-title">';var monthHtml="";if(secondary||!changeMonth){monthHtml+='<span class="ui-datepicker-month">'+monthNames[drawMonth]+"</span> "}else{var inMinYear=(minDate&&minDate.getFullYear()==drawYear);var inMaxYear=(maxDate&&maxDate.getFullYear()==drawYear);monthHtml+='<select class="ui-datepicker-month" onchange="DP_jQuery.datepicker._selectMonthYear(\'#'+inst.id+"', this, 'M');\" onclick=\"DP_jQuery.datepicker._clickMonthYear('#"+inst.id+"');\">";for(var month=0;month<12;month++){if((!inMinYear||month>=minDate.getMonth())&&(!inMaxYear||month<=maxDate.getMonth())){monthHtml+='<option value="'+month+'"'+(month==drawMonth?' selected="selected"':"")+">"+monthNamesShort[month]+"</option>"}}monthHtml+="</select>"}if(!showMonthAfterYear){html+=monthHtml+((secondary||changeMonth||changeYear)&&(!(changeMonth&&changeYear))?"&#xa0;":"")}if(secondary||!changeYear){html+='<span class="ui-datepicker-year">'+drawYear+"</span>"}else{var years=this._get(inst,"yearRange").split(":");var year=0;var endYear=0;if(years.length!=2){year=drawYear-10;endYear=drawYear+10}else{if(years[0].charAt(0)=="+"||years[0].charAt(0)=="-"){year=drawYear+parseInt(years[0],10);endYear=drawYear+parseInt(years[1],10)}else{year=parseInt(years[0],10);endYear=parseInt(years[1],10)}}year=(minDate?Math.max(year,minDate.getFullYear()):year);endYear=(maxDate?Math.min(endYear,maxDate.getFullYear()):endYear);html+='<select class="ui-datepicker-year" onchange="DP_jQuery.datepicker._selectMonthYear(\'#'+inst.id+"', this, 'Y');\" onclick=\"DP_jQuery.datepicker._clickMonthYear('#"+inst.id+"');\">";for(;year<=endYear;year++){html+='<option value="'+year+'"'+(year==drawYear?' selected="selected"':"")+">"+year+"</option>"}html+="</select>"}if(showMonthAfterYear){html+=(secondary||changeMonth||changeYear?"&#xa0;":"")+monthHtml}html+="</div>";return html},_adjustInstDate:function(inst,offset,period){var year=inst.drawYear+(period=="Y"?offset:0);var month=inst.drawMonth+(period=="M"?offset:0);var day=Math.min(inst.selectedDay,this._getDaysInMonth(year,month))+(period=="D"?offset:0);var date=this._daylightSavingAdjust(new Date(year,month,day));var minDate=this._getMinMaxDate(inst,"min",true);var maxDate=this._getMinMaxDate(inst,"max");date=(minDate&&date<minDate?minDate:date);date=(maxDate&&date>maxDate?maxDate:date);inst.selectedDay=date.getDate();inst.drawMonth=inst.selectedMonth=date.getMonth();inst.drawYear=inst.selectedYear=date.getFullYear();if(period=="M"||period=="Y"){this._notifyChange(inst)}},_notifyChange:function(inst){var onChange=this._get(inst,"onChangeMonthYear");if(onChange){onChange.apply((inst.input?inst.input[0]:null),[inst.selectedYear,inst.selectedMonth+1,inst])}},_getNumberOfMonths:function(inst){var numMonths=this._get(inst,"numberOfMonths");return(numMonths==null?[1,1]:(typeof numMonths=="number"?[1,numMonths]:numMonths))},_getMinMaxDate:function(inst,minMax,checkRange){var date=this._determineDate(this._get(inst,minMax+"Date"),null);return(!checkRange||!inst.rangeStart?date:(!date||inst.rangeStart>date?inst.rangeStart:date))},_getDaysInMonth:function(year,month){return 32-new Date(year,month,32).getDate()},_getFirstDayOfMonth:function(year,month){return new Date(year,month,1).getDay()},_canAdjustMonth:function(inst,offset,curYear,curMonth){var numMonths=this._getNumberOfMonths(inst);var date=this._daylightSavingAdjust(new Date(curYear,curMonth+(offset<0?offset:numMonths[1]),1));if(offset<0){date.setDate(this._getDaysInMonth(date.getFullYear(),date.getMonth()))}return this._isInRange(inst,date)},_isInRange:function(inst,date){var newMinDate=(!inst.rangeStart?null:this._daylightSavingAdjust(new Date(inst.selectedYear,inst.selectedMonth,inst.selectedDay)));newMinDate=(newMinDate&&inst.rangeStart<newMinDate?inst.rangeStart:newMinDate);var minDate=newMinDate||this._getMinMaxDate(inst,"min");var maxDate=this._getMinMaxDate(inst,"max");return((!minDate||date>=minDate)&&(!maxDate||date<=maxDate))},_getFormatConfig:function(inst){var shortYearCutoff=this._get(inst,"shortYearCutoff");shortYearCutoff=(typeof shortYearCutoff!="string"?shortYearCutoff:new Date().getFullYear()%100+parseInt(shortYearCutoff,10));return{shortYearCutoff:shortYearCutoff,dayNamesShort:this._get(inst,"dayNamesShort"),dayNames:this._get(inst,"dayNames"),monthNamesShort:this._get(inst,"monthNamesShort"),monthNames:this._get(inst,"monthNames")}},_formatDate:function(inst,day,month,year){if(!day){inst.currentDay=inst.selectedDay;inst.currentMonth=inst.selectedMonth;inst.currentYear=inst.selectedYear}var date=(day?(typeof day=="object"?day:this._daylightSavingAdjust(new Date(year,month,day))):this._daylightSavingAdjust(new Date(inst.currentYear,inst.currentMonth,inst.currentDay)));return this.formatDate(this._get(inst,"dateFormat"),date,this._getFormatConfig(inst))}});function extendRemove(target,props){$.extend(target,props);for(var name in props){if(props[name]==null||props[name]==undefined){target[name]=props[name]}}return target}function isArray(a){return(a&&(($.browser.safari&&typeof a=="object"&&a.length)||(a.constructor&&a.constructor.toString().match(/\Array\(\)/))))}$.fn.datepicker=function(options){if(!$.datepicker.initialized){$(document).mousedown($.datepicker._checkExternalClick).find("body").append($.datepicker.dpDiv);$.datepicker.initialized=true}var otherArgs=Array.prototype.slice.call(arguments,1);if(typeof options=="string"&&(options=="isDisabled"||options=="getDate")){return $.datepicker["_"+options+"Datepicker"].apply($.datepicker,[this[0]].concat(otherArgs))}if(options=="option"&&arguments.length==2&&typeof arguments[1]=="string"){return $.datepicker["_"+options+"Datepicker"].apply($.datepicker,[this[0]].concat(otherArgs))}return this.each(function(){typeof options=="string"?$.datepicker["_"+options+"Datepicker"].apply($.datepicker,[this].concat(otherArgs)):$.datepicker._attachDatepicker(this,options)})};$.datepicker=new Datepicker();$.datepicker.initialized=false;$.datepicker.uuid=new Date().getTime();$.datepicker.version="1.7.2";window.DP_jQuery=$})(jQuery); \ No newline at end of file
diff --git a/trunk/ui.datepicker.packed.js b/trunk/ui.datepicker.packed.js
new file mode 100644
index 000000000..919cade2d
--- /dev/null
+++ b/trunk/ui.datepicker.packed.js
@@ -0,0 +1,2 @@
+eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)d[e(c)]=k[c]||e(c);k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(p($){c 2T="f";p 3Z(){b.7P=E;b.3Q=t;b.2y=[];b.3l=E;b.2S=E;b.5W="v-f-I";b.6f="v-f-1c";b.6h="v-f-3v";b.2w="v-f-4o";b.5Y="v-f-af";b.5B="v-f-3I";b.6e="v-f-4u";b.5v="v-f-49";b.4G="v-f-4O-H";b.6k=[];b.6k[""]={76:"ae",77:"ad 3s 4O h",74:"7U",75:"7U ac 7j",2M:"&#6m;ab",72:"3t 3s 7T F",2N:"&#6m;&#6m;",73:"3t 3s 7T B",2L:"aa&#6l;",71:"3t 3s 3H F",2K:"&#6l;&#6l;",70:"3t 3s 3H B",3f:"a9",6Z:"3t 3s 4O F",1n:["a8","a7","a6","a5","7S","a4","a3","a2","a1","a0","9Z","9Y"],1Z:["9X","9W","9V","9U","7S","9T","9S","9R","9Q","9P","9O","9N"],6K:"3t a 7R F",6D:"3t a 7R B",6X:"9M",4d:"9L 9K 3s B",1v:["9J","9I","9H","9G","9F","9E","9D"],1z:["9C","9B","9A","9z","9y","9x","9w"],4K:["9v","9u","9t","9s","9r","9q","9p"],4L:"9o 4g 9n 9m 2F H",3d:"7Q 4g, M d",2X:"4U/3J/3k",1B:0,Z:"7Q a h",1I:E};b.1D={3r:"2P",1V:"69",62:{},2e:t,4v:"",2W:"...",3X:"",7N:E,47:1d,5E:E,4h:E,2I:E,3g:E,5C:E,6L:1d,6H:1d,44:E,6G:"-10:+10",4f:1d,3D:E,2C:E,4e:E,4I:b.4M,1F:"+10",15:E,6Y:b.3d,R:t,T:t,1j:"9l",4c:t,4s:t,2Q:t,6C:t,4q:t,6B:1,4P:0,2r:1,2q:12,1K:E,4j:" - ",4n:"",3N:""};$.4x(b.1D,b.6k[""]);b.O=$(\'<I u="\'+b.5W+\'" 46="6a: 7t;"></I>\')}$.4x(3Z.6q,{29:"9k",5L:p(){k(b.7P){9j.5L.2k("",5d)}},9i:p(z){3x(b.1D,z||{});r b},6n:p(n,z){c 3Y=t;1l(59 6v b.1D){c 58=n.9h("h:"+59);k(58){3Y=3Y||{};5O{3Y[59]=9g(58)}5M(7x){3Y[59]=58}}}c 1a=n.1a.4t();c 1c=(1a=="I"||1a=="2H");k(!n.u){n.u="7F"+(++b.5a)}c 8=b.6i($(n),1c);8.z=$.4x({},z||{},3Y||{});k(1a=="q"){b.7O(n,8)}P{k(1c){b.7I(n,8)}}},6i:p(n,1c){c u=n[0].u.5y(/([:\\[\\]\\.])/g,"\\\\\\\\$1");r{u:u,q:n,1u:0,1m:0,1q:0,G:0,J:0,1c:1c,O:(!1c?b.O:$(\'<I 16="\'+b.6f+\'"></I>\'))}},7O:p(n,8){c q=$(n);k(q.2R(b.29)){r}c 4v=b.l(8,"4v");c 1I=b.l(8,"1I");k(4v){q[1I?"7K":"7J"](\'<2H 16="\'+b.6h+\'">\'+4v+"</2H>")}c 3r=b.l(8,"3r");k(3r=="2P"||3r=="4D"){q.2P(b.3U)}k(3r=="3W"||3r=="4D"){c 2W=b.l(8,"2W");c 3X=b.l(8,"3X");c 4o=$(b.l(8,"7N")?$("<56/>").2o(b.2w).7M({5s:3X,7L:2W,4b:2W}):$(\'<3W 4r="3W"></3W>\').2o(b.2w).V(3X==""?2W:$("<56/>").7M({5s:3X,7L:2W,4b:2W})));q[1I?"7K":"7J"](4o);4o.9f(p(){k($.f.3l&&$.f.3O==n){$.f.2s()}P{$.f.3U(n)}r E})}q.2o(b.29).6g(b.54).7C(b.6d).57("7H.f",p(3P,2V,K){8.z[2V]=K}).57("7G.f",p(3P,2V){r b.l(8,2V)});$.3n(n,2T,8)},7I:p(n,8){c 6j=$(n);k(6j.2R(b.29)){r}6j.2o(b.29).3v(8.O).57("7H.f",p(3P,2V,K){8.z[2V]=K}).57("7G.f",p(3P,2V){r b.l(8,2V)});$.3n(n,2T,8);b.5G(8,b.5K(8));b.26(8)},9e:p(8){c 1i=b.3z(8);8.O.1E(1i[1]*$(".v-f",8.O[0]).1E())},9d:p(q,7D,2Q,z,2x){c 8=b.7E;k(!8){c u="7F"+(++b.5a);b.2g=$(\'<q 4r="5l" u="\'+u+\'" 2f="1" 46="1T: 4Z; 1x: -7m;"/>\');b.2g.6g(b.54);$("2l").3v(b.2g);8=b.7E=b.6i(b.2g,E);8.z={};$.3n(b.2g[0],2T,8)}3x(8.z,z||{});b.2g.3i(7D);b.1O=(2x?(2x.1f?2x:[2x.9c,2x.9b]):t);k(!b.1O){c 52=53.7o||1e.1W.67||1e.2l.67;c 51=53.7n||1e.1W.66||1e.2l.66;c 3q=1e.1W.3T||1e.2l.3T;c 3p=1e.1W.3S||1e.2l.3S;b.1O=[(52/2)-2Z+3q,(51/2)-9a+3p]}b.2g.2a("1N",b.1O[0]+"2U").2a("1x",b.1O[1]+"2U");8.z.2Q=2Q;b.2S=1d;b.O.2o(b.5Y);b.3U(b.2g[0]);k($.4p){$.4p(b.O)}$.3n(b.2g[0],2T,8);r b},99:p(n){c $n=$(n);k(!$n.2R(b.29)){r}c 1a=n.1a.4t();$.98(n,2T);k(1a=="q"){$n.3V("."+b.6h).3R().3F().3V("."+b.2w).3R().3F().3b(b.29).4Y("2P",b.3U).4Y("6g",b.54).4Y("7C",b.6d)}P{k(1a=="I"||1a=="2H"){$n.3b(b.29).7s()}}},97:p(n){c $n=$(n);k(!$n.2R(b.29)){r}c 1a=n.1a.4t();k(1a=="q"){n.4u=E;$n.3V("3W."+b.2w).3u(p(){b.4u=E}).3F().3V("56."+b.2w).2a({7B:"1.0",7A:""})}P{k(1a=="I"||1a=="2H"){$n.7z("."+b.6e).3R()}}b.2y=$.7y(b.2y,p(K){r(K==n?t:K)})},96:p(n){c $n=$(n);k(!$n.2R(b.29)){r}c 1a=n.1a.4t();k(1a=="q"){n.4u=1d;$n.3V("3W."+b.2w).3u(p(){b.4u=1d}).3F().3V("56."+b.2w).2a({7B:"0.5",7A:"4l"})}P{k(1a=="I"||1a=="2H"){c 1c=$n.7z("."+b.6f);c L=1c.L();c 55={1N:0,1x:0};1c.5X().3u(p(){k($(b).2a("1T")=="95"){55=$(b).L();r E}});$n.94(\'<I 16="\'+b.6e+\'" 46="\'+($.2c.4C?"93-92: 91; ":"")+"1E: "+1c.1E()+"2U; 2h: "+1c.2h()+"2U; 1N: "+(L.1N-55.1N)+"2U; 1x: "+(L.1x-55.1x)+\'2U;"></I>\')}}b.2y=$.7y(b.2y,p(K){r(K==n?t:K)});b.2y[b.2y.1f]=n},7v:p(n){k(!n){r E}1l(c i=0;i<b.2y.1f;i++){k(b.2y[i]==n){r 1d}}r E},1r:p(n){5O{r $.3n(n,2T)}5M(7x){3K"7i 90 3n 1l b f"}},8Z:p(n,1k,K){c z=1k||{};k(1X 1k=="41"){z={};z[1k]=K}c 8=b.1r(n);k(8){k(b.3Q==8){b.2s(t)}3x(8.z,z);c h=x A();3x(8,{1g:t,1Q:t,24:t,19:t,1u:h.S(),1m:h.X(),1q:h.Q(),1h:h.S(),1t:h.X(),1p:h.Q(),G:h.X(),J:h.Q()});b.26(8)}},8Y:p(n){c 8=b.1r(n);k(8){b.26(8)}},8X:p(n,h,23){c 8=b.1r(n);k(8){b.5G(8,h,23);b.26(8);b.5V(8)}},8W:p(n){c 8=b.1r(n);k(8&&!8.1c){b.5P(8)}r(8?b.5F(8):t)},54:p(e){c 8=$.f.1r(e.n);c 2i=1d;k($.f.3l){4k(e.6c){C 9:$.f.2s(t,"");N;C 13:$.f.5u(e.n,8.1m,8.1q,$("1A.v-f-3E-3c-2E",8.O)[0]);r E;N;C 27:$.f.2s(t,$.f.l(8,"1j"));N;C 33:$.f.1J(e.n,(e.1s?-$.f.l(8,"2q"):-$.f.l(8,"2r")),"M");N;C 34:$.f.1J(e.n,(e.1s?+$.f.l(8,"2q"):+$.f.l(8,"2r")),"M");N;C 35:k(e.1s){$.f.5D(e.n)}2i=e.1s;N;C 36:k(e.1s){$.f.5z(e.n)}2i=e.1s;N;C 37:k(e.1s){$.f.1J(e.n,-1,"D")}2i=e.1s;N;C 38:k(e.1s){$.f.1J(e.n,-7,"D")}2i=e.1s;N;C 39:k(e.1s){$.f.1J(e.n,+1,"D")}2i=e.1s;N;C 40:k(e.1s){$.f.1J(e.n,+7,"D")}2i=e.1s;N;4l:2i=E}}P{k(e.6c==36&&e.1s){$.f.3U(b)}P{2i=E}}k(2i){e.8V();e.8U()}},6d:p(e){c 8=$.f.1r(e.n);c 2t=$.f.7e($.f.l(8,"2X"));c 6b=8T.8S(e.7w==5f?e.6c:e.7w);r e.1s||(6b<" "||!2t||2t.6W(6b)>-1)},3U:p(q){q=q.n||q;k(q.1a.4t()!="q"){q=$("q",q.8R)[0]}k($.f.7v(q)||$.f.3O==q){r}c 8=$.f.1r(q);c 4s=$.f.l(8,"4s");3x(8.z,(4s?4s.2k(q,[q,8]):{}));$.f.2s(t,"");$.f.3O=q;$.f.5P(8);k($.f.2S){q.K=""}k(!$.f.1O){$.f.1O=$.f.64(q);$.f.1O[1]+=q.8Q}c 1y=E;$(q).5X().3u(p(){1y|=$(b).2a("1T")=="7u";r!1y});k(1y&&$.2c.65){$.f.1O[0]-=1e.1W.3T;$.f.1O[1]-=1e.1W.3S}c L={1N:$.f.1O[0],1x:$.f.1O[1]};$.f.1O=t;8.1g=t;8.O.2a({1T:"4Z",6a:"8P",1x:"-8O"});$.f.26(8);8.O.1E($.f.3z(8)[1]*$(".v-f",8.O[0])[0].8N);L=$.f.7p(8,L,1y);8.O.2a({1T:($.f.2S&&$.4p?"8M":(1y?"7u":"4Z")),6a:"7t",1N:L.1N+"2U",1x:L.1x+"2U"});k(!8.1c){c 1V=$.f.l(8,"1V")||"69";c 1j=$.f.l(8,"1j");c 3m=p(){$.f.3l=1d;k($.2c.4C&&1G($.2c.6N,10)<7){$("4B.v-f-5r").2a({1E:8.O.1E()+4,2h:8.O.2h()+4})}};k($.50&&$.50[1V]){8.O.69(1V,$.f.l(8,"62"),1j,3m)}P{8.O[1V](1j,3m)}k(1j==""){3m()}k(8.q[0].4r!="63"){8.q[0].2P()}$.f.3Q=8}},26:p(8){c 68={1E:8.O.1E()+4,2h:8.O.2h()+4};8.O.7s().3v(b.78(8)).8L("4B.v-f-5r").2a({1E:68.1E,2h:68.2h});c 1i=b.3z(8);8.O[(1i[0]!=1||1i[1]!=1?"7r":"3R")+"7q"]("v-f-8K");8.O[(b.l(8,"1I")?"7r":"3R")+"7q"]("v-f-8J");k(8.q&&8.q[0].4r!="63"){$(8.q[0]).2P()}},7p:p(8,L,1y){c 2x=8.q?b.64(8.q[0]):t;c 52=53.7o||1e.1W.67;c 51=53.7n||1e.1W.66;c 3q=1e.1W.3T||1e.2l.3T;c 3p=1e.1W.3S||1e.2l.3S;k(b.l(8,"1I")||(L.1N+8.O.1E()-3q)>52){L.1N=21.2z((1y?0:3q),2x[0]+(8.q?8.q.1E():0)-(1y?3q:0)-8.O.1E()-(1y&&$.2c.65?1e.1W.3T:0))}P{L.1N-=(1y?3q:0)}k((L.1x+8.O.2h()-3p)>51){L.1x=21.2z((1y?0:3p),2x[1]-(1y?3p:0)-(b.2S?0:8.O.2h())-(1y&&$.2c.65?1e.1W.3S:0))}P{L.1x-=(1y?3p:0)}r L},64:p(3o){3h(3o&&(3o.4r=="63"||3o.8I!=1)){3o=3o.8H}c 1T=$(3o).L();r[1T.1N,1T.1x]},2s:p(q,1j){c 8=b.3Q;k(!8||(q&&8!=$.3n(q,2T))){r}c 1K=b.l(8,"1K");k(1K&&8.2v){b.4W("#"+8.u,b.2Y(8,8.1h,8.1t,8.1p))}8.2v=E;k(b.3l){1j=(1j!=t?1j:b.l(8,"1j"));c 1V=b.l(8,"1V");c 3m=p(){$.f.5Z(8)};k(1j!=""&&$.50&&$.50[1V]){8.O.61(1V,$.f.l(8,"62"),1j,3m)}P{8.O[(1j==""?"61":(1V=="8G"?"8F":(1V=="8E"?"8D":"61")))](1j,3m)}k(1j==""){b.5Z(8)}c 4q=b.l(8,"4q");k(4q){4q.2k((8.q?8.q[0]:t),[(8.q?8.q.3i():""),8])}b.3l=E;b.3O=t;8.z.3I=t;k(b.2S){b.2g.2a({1T:"4Z",1N:"0",1x:"-7m"});k($.4p){$.8C();$("2l").3v(b.O)}}b.2S=E}b.3Q=t},5Z:p(8){8.O.3b(b.5Y).4Y(".v-f");$("."+b.5B,8.O).3R()},6s:p(3P){k(!$.f.3Q){r}c $n=$(3P.n);k(($n.5X("#"+$.f.5W).1f==0)&&!$n.2R($.f.29)&&!$n.2R($.f.2w)&&$.f.3l&&!($.f.2S&&$.4p)){$.f.2s(t,"")}},1J:p(u,L,20){c n=$(u);c 8=b.1r(n[0]);b.4z(8,L,20);b.26(8)},5z:p(u){c n=$(u);c 8=b.1r(n[0]);k(b.l(8,"5C")&&8.1h){8.1u=8.1h;8.G=8.1m=8.1t;8.J=8.1q=8.1p}P{c h=x A();8.1u=h.S();8.G=8.1m=h.X();8.J=8.1q=h.Q()}b.43(8);b.1J(n)},5o:p(u,3a,20){c n=$(u);c 8=b.1r(n[0]);8.4X=E;8["45"+(20=="M"?"7l":"7k")]=8["8B"+(20=="M"?"7l":"7k")]=1G(3a.2j[3a.8A].K,10);b.43(8);b.1J(n)},5n:p(u){c n=$(u);c 8=b.1r(n[0]);k(8.q&&8.4X&&!$.2c.4C){8.q[0].2P()}8.4X=!8.4X},6V:p(u,H){c n=$(u);c 8=b.1r(n[0]);8.z.1B=H;b.26(8)},5u:p(u,F,B,1A){k($(1A).2R(b.5v)){r}c n=$(u);c 8=b.1r(n[0]);c 1K=b.l(8,"1K");k(1K){8.2v=!8.2v;k(8.2v){$(".v-f 1A",8.O).3b(b.4G);$(1A).2o(b.4G)}}8.1u=8.1h=$("a",1A).V();8.1m=8.1t=F;8.1q=8.1p=B;k(8.2v){8.1Q=8.24=8.19=t}P{k(1K){8.1Q=8.1h;8.24=8.1t;8.19=8.1p}}b.4W(u,b.2Y(8,8.1h,8.1t,8.1p));k(8.2v){8.1g=x A(8.1p,8.1t,8.1h);b.26(8)}P{k(1K){8.1u=8.1h=8.1g.S();8.1m=8.1t=8.1g.X();8.1q=8.1p=8.1g.Q();8.1g=t;k(8.1c){b.26(8)}}}},5D:p(u){c n=$(u);c 8=b.1r(n[0]);k(b.l(8,"5E")){r}8.2v=E;8.1Q=8.24=8.19=8.1g=t;b.4W(n,"")},4W:p(u,1U){c n=$(u);c 8=b.1r(n[0]);1U=(1U!=t?1U:b.2Y(8));k(b.l(8,"1K")&&1U){1U=(8.1g?b.2Y(8,8.1g):1U)+b.l(8,"4j")+1U}k(8.q){8.q.3i(1U)}b.5V(8);c 2Q=b.l(8,"2Q");k(2Q){2Q.2k((8.q?8.q[0]:t),[1U,8])}P{k(8.q){8.q.4o("7j")}}k(8.1c){b.26(8)}P{k(!8.2v){b.2s(t,b.l(8,"1j"));b.3O=8.q[0];k(1X(8.q[0])!="4w"){8.q[0].2P()}b.3O=t}}},5V:p(8){c 4n=b.l(8,"4n");k(4n){c 3N=b.l(8,"3N");c h=b.5F(8);1U=(6u(h)?(!h[0]&&!h[1]?"":b.1Y(3N,h[0],b.1P(8))+b.l(8,"4j")+b.1Y(3N,h[1]||h[0],b.1P(8))):b.1Y(3N,h,b.1P(8)));$(4n).3u(p(){$(b).3i(1U)})}},8z:p(h){c H=h.3A();r[(H>0&&H<6),""]},4M:p(h){c 25=x A(h.Q(),h.X(),h.S(),(h.8y()/-60));c 3M=x A(25.Q(),1-1,4);c 1B=3M.3A()||7;3M.4y(3M.S()+1-1B);k(1B<4&&25<3M){25.4y(25.S()-3);r $.f.4M(25)}P{k(25>x A(25.Q(),12-1,28)){1B=x A(25.Q()+1,1-1,4).3A()||7;k(1B>4&&(25.3A()||7)<1B-3){r 1}}}r 21.8x(((25-3M)/8w)/7)+1},3d:p(h,8){r $.f.1Y($.f.l(8,"3d"),h,$.f.1P(8))},5N:p(18,K,z){k(18==t||K==t){3K"5H 5d"}K=(1X K=="4w"?K.5e():K+"");k(K==""){r t}c 1F=(z?z.1F:t)||b.1D.1F;c 1z=(z?z.1z:t)||b.1D.1z;c 1v=(z?z.1v:t)||b.1D.1v;c 1Z=(z?z.1Z:t)||b.1D.1Z;c 1n=(z?z.1n:t)||b.1D.1n;c B=-1;c F=-1;c H=-1;c 3j=-1;c 1L=E;c 1M=p(1o){c 1C=(U+1<18.1f&&18.1b(U+1)==1o);k(1C){U++}r 1C};c 3L=p(1o){1M(1o);c 5U=(1o=="@"?14:(1o=="y"?4:(1o=="o"?3:2)));c 2f=5U;c 2u=0;3h(2f>0&&1S<K.1f&&K.1b(1S)>="0"&&K.1b(1S)<="9"){2u=2u*10+1G(K.1b(1S++),10);2f--}k(2f==5U){3K"7i 5i 5T 1T "+1S}r 2u};c 5S=p(1o,4S,4T){c 4m=(1M(1o)?4T:4S);c 2f=0;1l(c j=0;j<4m.1f;j++){2f=21.2z(2f,4m[j].1f)}c 1k="";c 7h=1S;3h(2f>0&&1S<K.1f){1k+=K.1b(1S++);1l(c i=0;i<4m.1f;i++){k(1k==4m[i]){r i+1}}2f--}3K"8v 1k 5T 1T "+7h};c 4V=p(){k(K.1b(1S)!=18.1b(U)){3K"8u 1L 5T 1T "+1S}1S++};c 1S=0;1l(c U=0;U<18.1f;U++){k(1L){k(18.1b(U)=="\'"&&!1M("\'")){1L=E}P{4V()}}P{4k(18.1b(U)){C"d":H=3L("d");N;C"D":5S("D",1z,1v);N;C"o":3j=3L("o");N;C"m":F=3L("m");N;C"M":F=5S("M",1Z,1n);N;C"y":B=3L("y");N;C"@":c h=x A(3L("@"));B=h.Q();F=h.X()+1;H=h.S();N;C"\'":k(1M("\'")){4V()}P{1L=1d}N;4l:4V()}}}k(B<2Z){B+=x A().Q()-x A().Q()%2Z+(B<=1F?0:-2Z)}k(3j>-1){F=1;H=3j;8t{c 5R=b.30(B,F-1);k(H<=5R){N}F++;H-=5R}3h(1d)}c h=x A(B,F-1,H);k(h.Q()!=B||h.X()+1!=F||h.S()!=H){3K"5H h"}r h},8s:"3k-4U-3J",8r:"D, 3J M 3k",8q:"3k-4U-3J",8p:"D, d M y",8o:"4g, 3J-M-y",8n:"D, d M y",8m:"D, d M 3k",8l:"D, d M 3k",8k:"D, d M y",8j:"@",8i:"3k-4U-3J",1Y:p(18,h,z){k(!h){r""}c 1z=(z?z.1z:t)||b.1D.1z;c 1v=(z?z.1v:t)||b.1D.1v;c 1Z=(z?z.1Z:t)||b.1D.1Z;c 1n=(z?z.1n:t)||b.1D.1n;c 1M=p(1o){c 1C=(U+1<18.1f&&18.1b(U+1)==1o);k(1C){U++}r 1C};c 4R=p(1o,K,7g){c 2u=""+K;k(1M(1o)){3h(2u.1f<7g){2u="0"+2u}}r 2u};c 5Q=p(1o,K,4S,4T){r(1M(1o)?4T[K]:4S[K])};c 1R="";c 1L=E;k(h){1l(c U=0;U<18.1f;U++){k(1L){k(18.1b(U)=="\'"&&!1M("\'")){1L=E}P{1R+=18.1b(U)}}P{4k(18.1b(U)){C"d":1R+=4R("d",h.S(),2);N;C"D":1R+=5Q("D",h.3A(),1z,1v);N;C"o":c 3j=h.S();1l(c m=h.X()-1;m>=0;m--){3j+=b.30(h.Q(),m)}1R+=4R("o",3j,3);N;C"m":1R+=4R("m",h.X()+1,2);N;C"M":1R+=5Q("M",h.X(),1Z,1n);N;C"y":1R+=(1M("y")?h.Q():(h.7f()%2Z<10?"0":"")+h.7f()%2Z);N;C"@":1R+=h.2b();N;C"\'":k(1M("\'")){1R+="\'"}P{1L=1d}N;4l:1R+=18.1b(U)}}}}r 1R},7e:p(18){c 2t="";c 1L=E;1l(c U=0;U<18.1f;U++){k(1L){k(18.1b(U)=="\'"&&!1M("\'")){1L=E}P{2t+=18.1b(U)}}P{4k(18.1b(U)){C"d":C"m":C"y":C"@":2t+="8h";N;C"D":C"M":r t;C"\'":k(1M("\'")){2t+="\'"}P{1L=1d}N;4l:2t+=18.1b(U)}}}r 2t},l:p(8,1k){r 8.z[1k]!==5f?8.z[1k]:b.1D[1k]},5P:p(8){c 2X=b.l(8,"2X");c 2O=8.q?8.q.3i().6F(b.l(8,"4j")):t;8.1Q=8.24=8.19=t;c h=2e=b.5K(8);k(2O.1f>0){c z=b.1P(8);k(2O.1f>1){h=b.5N(2X,2O[1],z)||2e;8.1Q=h.S();8.24=h.X();8.19=h.Q()}5O{h=b.5N(2X,2O[0],z)||2e}5M(e){b.5L(e);h=2e}}8.1u=h.S();8.G=8.1m=h.X();8.J=8.1q=h.Q();8.1h=(2O[0]?h.S():0);8.1t=(2O[0]?h.X():0);8.1p=(2O[0]?h.Q():0);b.4z(8)},5K:p(8){c h=b.42(b.l(8,"2e"),x A());c R=b.2m(8,"2n",1d);c T=b.2m(8,"2z");h=(R&&h<R?R:h);h=(T&&h>T?T:h);r h},42:p(h,2e){c 7b=p(L){c h=x A();h.6R(h.6Q()+L);r h};c 7c=p(L,5J){c h=x A();c B=h.Q();c F=h.X();c H=h.S();c 5I=/([+-]?[0-9]+)\\s*(d|D|w|W|m|M|y|Y)?/g;c 1C=5I.7d(L);3h(1C){4k(1C[2]||"d"){C"d":C"D":H+=1G(1C[1],10);N;C"w":C"W":H+=1G(1C[1],10)*7;N;C"m":C"M":F+=1G(1C[1],10);H=21.2n(H,5J(B,F));N;C"y":C"Y":B+=1G(1C[1],10);H=21.2n(H,5J(B,F));N}1C=5I.7d(L)}r x A(B,F,H)};h=(h==t?2e:(1X h=="41"?7c(h,b.30):(1X h=="5i"?(8g(h)?2e:7b(h)):h)));r(h&&h.5e()=="5H A"?2e:h)},5G:p(8,h,23){c 2B=!(h);c 7a=8.1m;c 79=8.1q;h=b.42(h,x A());8.1u=8.1h=h.S();8.G=8.1m=8.1t=h.X();8.J=8.1q=8.1p=h.Q();k(b.l(8,"1K")){k(23){23=b.42(23,t);8.1Q=23.S();8.24=23.X();8.19=23.Q()}P{8.1Q=8.1h;8.24=8.1t;8.19=8.1p}}k(7a!=8.1m||79!=8.1q){b.43(8)}b.4z(8);k(8.q){8.q.3i(2B?"":b.2Y(8)+(!b.l(8,"1K")?"":b.l(8,"4j")+b.2Y(8,8.1Q,8.24,8.19)))}},5F:p(8){c 4Q=(!8.1p||(8.q&&8.q.3i()=="")?t:x A(8.1p,8.1t,8.1h));k(b.l(8,"1K")){r[8.1g||4Q,(!8.19?8.1g||4Q:x A(8.19,8.24,8.1Q))]}P{r 4Q}},78:p(8){c 2G=x A();2G=x A(2G.Q(),2G.X(),2G.S());c 15=b.l(8,"15");c Z=b.l(8,"Z")||"&#5q;";c 1I=b.l(8,"1I");c 2B=(b.l(8,"5E")?"":\'<I 16="v-f-2B"><a 22="17.f.5D(\\\'#\'+8.u+"\');\\""+b.1H(15,8.u,b.l(8,"77"),Z)+">"+b.l(8,"76")+"</a></I>");c 5t=\'<I 16="v-f-8f">\'+(1I?"":2B)+\'<I 16="v-f-8e"><a 22="17.f.2s();"\'+b.1H(15,8.u,b.l(8,"75"),Z)+">"+b.l(8,"74")+"</a></I>"+(1I?2B:"")+"</I>";c 3I=b.l(8,"3I");c 47=b.l(8,"47");c 4h=b.l(8,"4h");c 2I=b.l(8,"2I");c 3g=b.l(8,"3g");c 1i=b.3z(8);c 4P=b.l(8,"4P");c 2r=b.l(8,"2r");c 2q=b.l(8,"2q");c 6T=(1i[0]!=1||1i[1]!=1);c 4H=(!8.1h?x A(8d,9,9):x A(8.1p,8.1t,8.1h));c R=b.2m(8,"2n",1d);c T=b.2m(8,"2z");c G=8.G-4P;c J=8.J;k(G<0){G+=12;J--}k(T){c 4i=x A(T.Q(),T.X()-1i[1]+1,T.S());4i=(R&&4i<R?R:4i);3h(x A(J,G,1)>4i){G--;k(G<0){G=11;J--}}}c 2M=b.l(8,"2M");2M=(!2I?2M:b.1Y(2M,x A(J,G-2r,1),b.1P(8)));c 2N=(3g?b.l(8,"2N"):"");2N=(!2I?2N:b.1Y(2N,x A(J,G-2q,1),b.1P(8)));c 4N=\'<I 16="v-f-4N">\'+(b.5h(8,-1,J,G)?(3g?"<a 22=\\"17.f.1J(\'#"+8.u+"\', -"+2q+", \'M\');\\""+b.1H(15,8.u,b.l(8,"73"),Z)+">"+2N+"</a>":"")+"<a 22=\\"17.f.1J(\'#"+8.u+"\', -"+2r+", \'M\');\\""+b.1H(15,8.u,b.l(8,"72"),Z)+">"+2M+"</a>":(4h?"":"<2J>"+2N+"</2J><2J>"+2M+"</2J>"))+"</I>";c 2L=b.l(8,"2L");2L=(!2I?2L:b.1Y(2L,x A(J,G+2r,1),b.1P(8)));c 2K=(3g?b.l(8,"2K"):"");2K=(!2I?2K:b.1Y(2K,x A(J,G+2q,1),b.1P(8)));c 3H=\'<I 16="v-f-3H">\'+(b.5h(8,+1,J,G)?"<a 22=\\"17.f.1J(\'#"+8.u+"\', +"+2r+", \'M\');\\""+b.1H(15,8.u,b.l(8,"71"),Z)+">"+2L+"</a>"+(3g?"<a 22=\\"17.f.1J(\'#"+8.u+"\', +"+2q+", \'M\');\\""+b.1H(15,8.u,b.l(8,"70"),Z)+">"+2K+"</a>":""):(4h?"":"<2J>"+2L+"</2J><2J>"+2K+"</2J>"))+"</I>";c 3f=b.l(8,"3f");c 5A=(b.l(8,"5C")&&8.1h?4H:2G);3f=(!2I?3f:b.1Y(3f,5A,b.1P(8)));c V=(3I?\'<I 16="\'+b.5B+\'">\'+3I+"</I>":"")+(47&&!8.1c?5t:"")+\'<I 16="v-f-8c">\'+(1I?3H:4N)+(b.5g(8,5A)?\'<I 16="v-f-4O"><a 22="17.f.5z(\\\'#\'+8.u+"\');\\""+b.1H(15,8.u,b.l(8,"6Z"),Z)+">"+3f+"</a></I>":"")+(1I?4N:3H)+"</I>";c 1B=b.l(8,"1B");c 4f=b.l(8,"4f");c 1v=b.l(8,"1v");c 1z=b.l(8,"1z");c 4K=b.l(8,"4K");c 1n=b.l(8,"1n");c 4c=b.l(8,"4c");c 3D=b.l(8,"3D");c 2C=b.l(8,"2C");c 4e=b.l(8,"4e");c 4I=b.l(8,"4I")||b.4M;c 4d=b.l(8,"4d");c 2d=(15?b.l(8,"4L")||Z:"");c 3d=b.l(8,"6Y")||b.3d;c 23=8.1Q?x A(8.19,8.24,8.1Q):4H;1l(c 3e=0;3e<1i[0];3e++){1l(c 3G=0;3G<1i[1];3G++){c 3B=x A(J,G,8.1u);V+=\'<I 16="v-f-8b-F\'+(3G==0?" v-f-x-3e":"")+\'">\'+b.6M(8,G,J,R,T,3B,3e>0||3G>0,15,Z,1n)+\'<6O 16="v-f" 8a="0" 89="0"><6U><4E 16="v-f-4b-3e">\'+(4e?"<1A"+b.1H(15,8.u,4d,Z)+">"+b.l(8,"6X")+"</1A>":"");1l(c 2p=0;2p<7;2p++){c H=(2p+1B)%7;c 4L=(2d.6W("4g")>-1?2d.5y(/4g/,1v[H]):2d.5y(/D/,1z[H]));V+="<1A"+((2p+1B+6)%7>=5?\' 16="v-f-2F-3F-3c"\':"")+">"+(!4f?"<2H":"<a 22=\\"17.f.6V(\'#"+8.u+"\', "+H+\');"\')+b.1H(15,8.u,4L,Z)+\' 4b="\'+1v[H]+\'">\'+4K[H]+(4f?"</a>":"</2H>")+"</1A>"}V+="</4E></6U><6P>";c 5x=b.30(J,G);k(J==8.1q&&G==8.1m){8.1u=21.2n(8.1u,5x)}c 4J=(b.6y(J,G)-1B+7)%7;c 48=x A(J,G,1-4J);c 3C=x A(J,G,1-4J);c 1w=3C;c 6S=(6T?6:21.88((4J+5x)/7));1l(c 5w=0;5w<6S;5w++){V+=\'<4E 16="v-f-3E-3e">\'+(4e?\'<1A 16="v-f-2F-3G"\'+b.1H(15,8.u,4d,Z)+">"+4I(1w)+"</1A>":"");1l(c 2p=0;2p<7;2p++){c 4a=(4c?4c.2k((8.q?8.q[0]:t),[1w]):[1d,""]);c 2D=(1w.X()!=G);c 49=2D||!4a[0]||(R&&1w<R)||(T&&1w>T);V+=\'<1A 16="v-f-3E-3c\'+((2p+1B+6)%7>=5?" v-f-2F-3F-3c":"")+(2D?" v-f-87-F":"")+(1w.2b()==3B.2b()&&G==8.1m?" v-f-3E-3c-2E":"")+(49?" "+b.5v:"")+(2D&&!2C?"":" "+4a[1]+(1w.2b()>=4H.2b()&&1w.2b()<=23.2b()?" "+b.4G:"")+(1w.2b()==2G.2b()?" v-f-2G":""))+\'"\'+((!2D||2C)&&4a[2]?\' 4b="\'+4a[2]+\'"\':"")+(49?(3D?" 5m=\\"17(b).4F().2o(\'v-f-2F-2E\');\\" 5k=\\"17(b).4F().3b(\'v-f-2F-2E\');\\"":""):" 5m=\\"17(b).2o(\'v-f-3E-3c-2E\')"+(3D?".4F().2o(\'v-f-2F-2E\')":"")+";"+(!15||(2D&&!2C)?"":"17(\'#v-f-2d-"+8.u+"\').V(\'"+(3d.2k((8.q?8.q[0]:t),[1w,8])||Z)+"\');")+"\\" 5k=\\"17(b).3b(\'v-f-3E-3c-2E\')"+(3D?".4F().3b(\'v-f-2F-2E\')":"")+";"+(!15||(2D&&!2C)?"":"17(\'#v-f-2d-"+8.u+"\').V(\'"+Z+"\');")+\'" 22="17.f.5u(\\\'#\'+8.u+"\',"+G+","+J+\', b);"\')+">"+(2D?(2C?1w.S():"&#5q;"):(49?1w.S():"<a>"+1w.S()+"</a>"))+"</1A>";48.4y(48.S()+1);3C.6R(3C.6Q()+1);1w=(48>3C?48:3C)}V+="</4E>"}G++;k(G>11){G=0;J++}V+="</6P></6O></I>"}}V+=(15?\'<I 46="2B: 4D;"></I><I u="v-f-2d-\'+8.u+\'" 16="v-f-2d">\'+Z+"</I>":"")+(!47&&!8.1c?5t:"")+\'<I 46="2B: 4D;"></I>\'+($.2c.4C&&1G($.2c.6N,10)<7&&!8.1c?\'<4B 5s="86:E;" 16="v-f-5r"></4B>\':"");r V},6M:p(8,G,J,R,T,3B,5p,15,Z,1n){R=(8.1g&&R&&3B<R?3B:R);c 44=b.l(8,"44");c V=\'<I 16="v-f-85">\';c 31="";k(5p||!b.l(8,"6L")){31+=1n[G]+"&#5q;"}P{c 6J=(R&&R.Q()==J);c 6I=(T&&T.Q()==J);31+=\'<3a 16="v-f-x-F" 6E="17.f.5o(\\\'#\'+8.u+"\', b, \'M\');\\" 22=\\"17.f.5n(\'#"+8.u+"\');\\""+b.1H(15,8.u,b.l(8,"6K"),Z)+">";1l(c F=0;F<12;F++){k((!6J||F>=R.X())&&(!6I||F<=T.X())){31+=\'<4A K="\'+F+\'"\'+(F==G?\' 45="45"\':"")+">"+1n[F]+"</4A>"}}31+="</3a>"}k(!44){V+=31}k(5p||!b.l(8,"6H")){V+=J}P{c 2A=b.l(8,"6G").6F(":");c B=0;c 19=0;k(2A.1f!=2){B=J-10;19=J+10}P{k(2A[0].1b(0)=="+"||2A[0].1b(0)=="-"){B=19=x A().Q();B+=1G(2A[0],10);19+=1G(2A[1],10)}P{B=1G(2A[0],10);19=1G(2A[1],10)}}B=(R?21.2z(B,R.Q()):B);19=(T?21.2n(19,T.Q()):19);V+=\'<3a 16="v-f-x-B" 6E="17.f.5o(\\\'#\'+8.u+"\', b, \'Y\');\\" 22=\\"17.f.5n(\'#"+8.u+"\');\\""+b.1H(15,8.u,b.l(8,"6D"),Z)+">";1l(;B<=19;B++){V+=\'<4A K="\'+B+\'"\'+(B==J?\' 45="45"\':"")+">"+B+"</4A>"}V+="</3a>"}k(44){V+=31}V+="</I>";r V},1H:p(15,u,5l,Z){r(15?" 5m=\\"17(\'#v-f-2d-"+u+"\').V(\'"+(5l||Z)+"\');\\" 5k=\\"17(\'#v-f-2d-"+u+"\').V(\'"+Z+"\');\\"":"")},4z:p(8,L,20){c B=8.J+(20=="Y"?L:0);c F=8.G+(20=="M"?L:0);c H=21.2n(8.1u,b.30(B,F))+(20=="D"?L:0);c h=x A(B,F,H);c R=b.2m(8,"2n",1d);c T=b.2m(8,"2z");h=(R&&h<R?R:h);h=(T&&h>T?T:h);8.1u=h.S();8.G=8.1m=h.X();8.J=8.1q=h.Q();k(20=="M"||20=="Y"){b.43(8)}},43:p(8){c 5j=b.l(8,"6C");k(5j){5j.2k((8.q?8.q[0]:t),[8.1q,8.1m+1,8])}},3z:p(8){c 1i=b.l(8,"6B");r(1i==t?[1,1]:(1X 1i=="5i"?[1,1i]:1i))},2m:p(8,6A,6z){c h=b.42(b.l(8,6A+"A"),t);k(h){h.84(0);h.83(0);h.82(0);h.81(0)}r(!6z||!8.1g?h:(!h||8.1g>h?8.1g:h))},30:p(B,F){r 32-x A(B,F,32).S()},6y:p(B,F){r x A(B,F,1).3A()},5h:p(8,L,6x,6w){c 1i=b.3z(8);c h=x A(6x,6w+(L<0?L:1i[1]),1);k(L<0){h.4y(b.30(h.Q(),h.X()))}r b.5g(8,h)},5g:p(8,h){c 3y=(!8.1g?t:x A(8.1q,8.1m,8.1u));3y=(3y&&8.1g<3y?8.1g:3y);c R=3y||b.2m(8,"2n");c T=b.2m(8,"2z");r((!R||h>=R)&&(!T||h<=T))},1P:p(8){c 1F=b.l(8,"1F");1F=(1X 1F!="41"?1F:x A().Q()%2Z+1G(1F,10));r{1F:1F,1z:b.l(8,"1z"),1v:b.l(8,"1v"),1Z:b.l(8,"1Z"),1n:b.l(8,"1n")}},2Y:p(8,H,F,B){k(!H){8.1h=8.1u;8.1t=8.1m;8.1p=8.1q}c h=(H?(1X H=="4w"?H:x A(B,F,H)):x A(8.1p,8.1t,8.1h));r b.1Y(b.l(8,"2X"),h,b.1P(8))}});p 3x(n,3w){$.4x(n,3w);1l(c 1k 6v 3w){k(3w[1k]==t||3w[1k]==5f){n[1k]=3w[1k]}}r n}p 6u(a){r(a&&(($.2c.80&&1X a=="4w"&&a.1f)||(a.6t&&a.6t.5e().1o(/\\6r\\(\\)/))))}$.7Z.f=p(2j){k(!$.f.5b){$(1e.2l).3v($.f.O).7Y($.f.6s);$.f.5b=1d}c 5c=6r.6q.7X.7W(5d,1);k(1X 2j=="41"&&(2j=="7V"||2j=="S")){r $.f["6p"+2j+"3Z"].2k($.f,[b[0]].6o(5c))}r b.3u(p(){1X 2j=="41"?$.f["6p"+2j+"3Z"].2k($.f,[b].6o(5c)):$.f.6n(b,2j)})};$.f=x 3Z();$.f.5b=E;$.f.5a=x A().2b()})(17)',62,636,'||||||||inst|||this|var|||datepicker||date|||if|_get||target||function|input|return||null|id|ui||new||settings|Date|year|case||false|month|drawMonth|day|div|drawYear|value|offset||break|dpDiv|else|getFullYear|minDate|getDate|maxDate|iFormat|html||getMonth||initStatus||||||showStatus|class|jQuery|format|endYear|nodeName|charAt|inline|true|document|length|rangeStart|currentDay|numMonths|duration|name|for|selectedMonth|monthNames|match|currentYear|selectedYear|_getInst|ctrlKey|currentMonth|selectedDay|dayNames|printDate|top|isFixed|dayNamesShort|td|firstDay|matches|_defaults|width|shortYearCutoff|parseInt|_addStatus|isRTL|_adjustDate|rangeSelect|literal|lookAhead|left|_pos|_getFormatConfig|endDay|output|iValue|position|dateStr|showAnim|documentElement|typeof|formatDate|monthNamesShort|period|Math|onclick|endDate|endMonth|checkDate|_updateDatepicker|||markerClassName|css|getTime|browser|status|defaultDate|size|_dialogInput|height|handled|options|apply|body|_getMinMaxDate|min|addClass|dow|stepBigMonths|stepMonths|_hideDatepicker|chars|num|stayOpen|_triggerClass|pos|_disabledInputs|max|years|clear|showOtherMonths|otherMonth|over|week|today|span|navigationAsDateFormat|label|nextBigText|nextText|prevText|prevBigText|dates|focus|onSelect|hasClass|_inDialog|PROP_NAME|px|key|buttonText|dateFormat|_formatDate|100|_getDaysInMonth|monthHtml|||||||||select|removeClass|cell|dateStatus|row|currentText|showBigPrevNext|while|val|doy|yy|_datepickerShowing|postProcess|data|obj|scrollY|scrollX|showOn|the|Show|each|append|props|extendRemove|newMinDate|_getNumberOfMonths|getDay|selectedDate|utcDate|highlightWeek|days|end|col|next|prompt|dd|throw|getNumber|firstMon|altFormat|_lastInput|event|_curInst|remove|scrollTop|scrollLeft|_showDatepicker|siblings|button|buttonImage|inlineSettings|Datepicker||string|_determineDate|_notifyChange|showMonthAfterYear|selected|style|closeAtTop|tzDate|unselectable|daySettings|title|beforeShowDay|weekStatus|showWeeks|changeFirstDay|DD|hideIfNoPrevNext|maxDraw|rangeSeparator|switch|default|names|altField|trigger|blockUI|onClose|type|beforeShow|toLowerCase|disabled|appendText|object|extend|setDate|_adjustInstDate|option|iframe|msie|both|tr|parent|_currentClass|currentDate|calculateWeek|leadDays|dayNamesMin|dayStatus|iso8601Week|prev|current|showCurrentAtPos|startDate|formatNumber|shortNames|longNames|mm|checkLiteral|_selectDate|_selectingMonthYear|unbind|absolute|effects|browserHeight|browserWidth|window|_doKeyDown|relOffset|img|bind|attrValue|attrName|uuid|initialized|otherArgs|arguments|toString|undefined|_isInRange|_canAdjustMonth|number|onChange|onmouseout|text|onmouseover|_clickMonthYear|_selectMonthYear|secondary|xa0|cover|src|controls|_selectDay|_unselectableClass|dRow|daysInMonth|replace|_gotoToday|gotoDate|_promptClass|gotoCurrent|_clearDate|mandatory|_getDate|_setDate|Invalid|pattern|getDaysInMonth|_getDefaultDate|log|catch|parseDate|try|_setDateFromField|formatName|dim|getName|at|origSize|_updateAlternate|_mainDivId|parents|_dialogClass|_tidyDialog||hide|showOptions|hidden|_findPos|opera|clientHeight|clientWidth|dims|show|display|chr|keyCode|_doKeyPress|_disableClass|_inlineClass|keydown|_appendClass|_newInst|divSpan|regional|x3e|x3c|_attachDatepicker|concat|_|prototype|Array|_checkExternalClick|constructor|isArray|in|curMonth|curYear|_getFirstDayOfMonth|checkRange|minMax|numberOfMonths|onChangeMonthYear|yearStatus|onchange|split|yearRange|changeYear|inMaxYear|inMinYear|monthStatus|changeMonth|_generateMonthYearHeader|version|table|tbody|getUTCDate|setUTCDate|numRows|isMultiMonth|thead|_changeFirstDay|indexOf|weekHeader|statusForDate|currentStatus|nextBigStatus|nextStatus|prevStatus|prevBigStatus|closeText|closeStatus|clearText|clearStatus|_generateHTML|origYear|origMonth|offsetNumeric|offsetString|exec|_possibleChars|getYear|len|iInit|Missing|change|Year|Month|100px|innerHeight|innerWidth|_checkOffset|Class|add|empty|none|fixed|_isDisabledDatepicker|charCode|err|map|children|cursor|opacity|keypress|dateText|_dialogInst|dp|getData|setData|_inlineDatepicker|after|before|alt|attr|buttonImageOnly|_connectDatepicker|debug|Select|different|May|previous|Close|isDisabled|call|slice|mousedown|fn|safari|setMilliseconds|setSeconds|setMinutes|setHours|header|javascript|other|ceil|cellspacing|cellpadding|one|links|9999|close|control|isNaN|0123456789|W3C|TIMESTAMP|RSS|RFC_2822|RFC_1123|RFC_1036|RFC_850|RFC_822|ISO_8601|COOKIE|ATOM|do|Unexpected|Unknown|86400000|floor|getTimezoneOffset|noWeekends|selectedIndex|draw|unblockUI|fadeOut|fadeIn|slideUp|slideDown|nextSibling|nodeType|rtl|multi|find|static|offsetWidth|1000px|block|offsetHeight|parentNode|fromCharCode|String|stopPropagation|preventDefault|_getDateDatepicker|_setDateDatepicker|_refreshDatepicker|_changeDatepicker|instance|transparent|color|background|prepend|relative|_disableDatepicker|_enableDatepicker|removeData|_destroyDatepicker|150|pageY|pageX|_dialogDatepicker|_inlineShow|click|eval|getAttribute|setDefaults|console|hasDatepicker|normal|first|as|Set|Sa|Fr|Th|We|Tu|Mo|Su|Sat|Fri|Thu|Wed|Tue|Mon|Sun|Saturday|Friday|Thursday|Wednesday|Tuesday|Monday|Sunday|of|Week|Wk|Dec|Nov|Oct|Sep|Aug|Jul|Jun|Apr|Mar|Feb|Jan|December|November|October|September|August|July|June|April|March|February|January|Today|Next|Prev|without|Erase|Clear|dialog'.split('|'),0,{}))
+
diff --git a/trunk/views/default/event_calendar/agenda_footer.php b/trunk/views/default/event_calendar/agenda_footer.php
new file mode 100644
index 000000000..8749ebe08
--- /dev/null
+++ b/trunk/views/default/event_calendar/agenda_footer.php
@@ -0,0 +1,5 @@
+<?php
+
+echo '</tbody></table></div>';
+
+?> \ No newline at end of file
diff --git a/trunk/views/default/event_calendar/agenda_header.php b/trunk/views/default/event_calendar/agenda_header.php
new file mode 100644
index 000000000..712dbed8d
--- /dev/null
+++ b/trunk/views/default/event_calendar/agenda_header.php
@@ -0,0 +1,12 @@
+<?php
+
+$header .= '<div class="event_calendar_agenda_date_section">';
+$header .= '<div class="event_calendar_agenda_date">'.$vars['date'].'</div>';
+$header .= '<table><thead><tr>';
+$header .= '<th class="agenda_header">'.elgg_echo('event_calendar:agenda:column:time').'</th>';
+$header .= '<th class="agenda_header">'.elgg_echo('event_calendar:agenda:column:session').'</th>';
+$header .= '<th class="agenda_header">'.elgg_echo('event_calendar:agenda:column:venue').'</th>';
+$header .= '</td></thead><tbody>';
+
+echo $header;
+?> \ No newline at end of file
diff --git a/trunk/views/default/event_calendar/agenda_item_view.php b/trunk/views/default/event_calendar/agenda_item_view.php
new file mode 100644
index 000000000..727b559ec
--- /dev/null
+++ b/trunk/views/default/event_calendar/agenda_item_view.php
@@ -0,0 +1,26 @@
+<?php
+$event = $vars['event'];
+$times = $vars['times'];
+$time_bit = '';
+if ($times) {
+ if (is_numeric($event->start_time)) {
+ $time_bit = event_calendar_convert_time($event->start_time);
+ }
+ if (is_numeric($event->end_time)) {
+ $time_bit .= " - ".event_calendar_convert_time($event->end_time);
+ }
+ $time_bit .= ' ';
+}
+$info = '<tr>';
+$info .= '<td class="event_calendar_agenda_time">'.$time_bit.'</td>';
+$info .= '<td class="event_calendar_agenda_title"><a href="'.$event->getUrl().'">'.$event->title.'</a></td>';
+$info .= '<td class="event_calendar_agenda_venue">'.$event->venue.'</td>';
+$info .= '</tr>';
+if (trim($event->description)) {
+ $info .= '<tr class="event_calendar_agenda_description">';
+ $info .= '<td class="event_calendar_agenda_time">&nbsp;</td>';
+ $info .= '<td colspan="2">'.$event->description.'</td></tr>';
+}
+
+echo $info;
+?> \ No newline at end of file
diff --git a/trunk/views/default/event_calendar/agenda_view.php b/trunk/views/default/event_calendar/agenda_view.php
new file mode 100644
index 000000000..bb693def0
--- /dev/null
+++ b/trunk/views/default/event_calendar/agenda_view.php
@@ -0,0 +1,34 @@
+<?php
+$nav = elgg_view('navigation/pagination',array(
+
+// 'baseurl' => $_SERVER['REQUEST_URI'],
+ 'baseurl' => $_SERVER['SCRIPT_NAME'].'/?'.$_SERVER['QUERY_STRING'],
+ 'offset' => $vars['offset'],
+ 'count' => $vars['count'],
+ 'limit' => $vars['limit'],
+
+ ));
+$event_calendar_times = get_plugin_setting('times', 'event_calendar');
+$events = $vars['events'];
+$html = '';
+$date_format = 'j M Y';
+$current_date = '';
+if ($events) {
+ foreach($events as $event) {
+ $date = date($date_format,$event->start_date);
+ if ($date != $current_date) {
+ if ($html) {
+ $html .= elgg_view('event_calendar/agenda_footer');
+ }
+ $html .= elgg_view('event_calendar/agenda_header',array('date'=>$date));
+
+ $current_date = $date;
+ }
+ $html .= elgg_view('event_calendar/agenda_item_view',array('event'=>$event,'times'=>$event_calendar_times));
+ }
+ $html .= elgg_view('event_calendar/agenda_footer');
+}
+$html = $nav.'<div class="event_calendar_agenda">'.$html.'</div>'.$nav;
+
+echo $html;
+?> \ No newline at end of file
diff --git a/trunk/views/default/event_calendar/calendar.php b/trunk/views/default/event_calendar/calendar.php
new file mode 100644
index 000000000..ebf4aa589
--- /dev/null
+++ b/trunk/views/default/event_calendar/calendar.php
@@ -0,0 +1,61 @@
+<?php
+if ($vars['mode']) {
+ $mode = $vars['mode'];
+} else {
+ $mode = 'month';
+}
+$link_bit = $vars['url'].'mod/event_calendar/show_events.php?start_date='.$vars['original_start_date'].'&group_guid='.$vars['group_guid'].'&filter='.$vars['filter'].'&mode=';
+
+$range_bit = '';
+$first_date = $vars['first_date'];
+if ($first_date) {
+ $range_bit .= 'minDate: $.datepicker.parseDate("yy-mm-dd", "'.$first_date.'"),'."\n";
+}
+$last_date = $vars['last_date'];
+if ($last_date) {
+ $range_bit .= 'maxDate: $.datepicker.parseDate("yy-mm-dd", "'.$last_date.'"),'."\n";
+}
+if ($first_date || $last_date) {
+ if (substr($first_date,0,7) == substr($last_date,0,7)) {
+ $range_bit .= "changeMonth: false,\n";
+ }
+
+ if (substr($first_date,0,4) == substr($last_date,0,4)) {
+ $range_bit .= "changeYear: false,\n";
+ }
+}
+
+$body .= elgg_view("input/datepicker_inline",
+ array(
+ 'internalname' => 'my_datepicker',
+ 'mode' => $vars['mode']?$vars['mode']:'month',
+ 'start_date' => $vars['start_date'],
+ 'end_date' => $vars['end_date'],
+ 'group_guid' => $vars['group_guid'],
+ 'range_bit' => $range_bit,
+ )
+);
+$body .= '<div id="calendarmenucontainer">';
+$body .= '<ul id="calendarmenu">';
+if ($mode == 'day') {
+ $link_class = ' class="sys_selected"';
+} else {
+ $link_class = '';
+}
+$body .= '<li'.$link_class.'><a href="'.$link_bit.'day">'.elgg_echo('event_calendar:day_label').'</a></li>';
+if ($mode == 'week') {
+ $link_class = ' class="sys_selected"';
+} else {
+ $link_class = '';
+}
+$body .= '<li'.$link_class.'><a href="'.$link_bit.'week">'.elgg_echo('event_calendar:week_label').'</a></li>';
+if ($mode == 'month') {
+ $link_class = ' class="sys_selected sys_calmenu_last"';
+} else {
+ $link_class = ' class="sys_calmenu_last"';
+}
+$body .= '<li'.$link_class.'><a href="'.$link_bit.'month">'.elgg_echo('event_calendar:month_label').'</a></li>';
+$body .= '</ul>';
+$body .= '</div>';
+echo $body;
+?> \ No newline at end of file
diff --git a/trunk/views/default/event_calendar/css.php b/trunk/views/default/event_calendar/css.php
new file mode 100644
index 000000000..359fd1e13
--- /dev/null
+++ b/trunk/views/default/event_calendar/css.php
@@ -0,0 +1,150 @@
+<?php
+//$background_colour = '#EBF1EB';
+//$highlight_colour = '#478787';
+
+$background_colour = '#F5F5F5';
+$highlight_colour = '#3874B7';
+?>
+
+/* hide Today as it is not working as expected */
+.ui-datepicker-current { visibility:hidden }
+
+div#calendarmenucontainer {
+ position: relative;
+}
+
+ul#calendarmenu {
+ list-style: none;
+ position: absolute;
+ top: 0px;
+ left: -15px;
+}
+
+ul#calendarmenu li {
+ float: left;
+ border-top: 1px solid #969696;
+ border-left: 1px solid #969696;
+ border-bottom: 1px solid #969696;
+ background-color: <?php echo $background_colour; ?>;
+}
+
+
+ul#calendarmenu li.sys_calmenu_last {
+ border-right: 1px solid #969696;
+}
+
+ul#calendarmenu li a {
+ text-decoration: none;
+ padding: 4px 12px;
+ float: left;
+}
+
+ul#calendarmenu li a:hover, ul#calendarmenu li.sys_selected a{
+ text-decoration: none;
+ padding: 4px 12px;
+ float: left;
+ color: #FFFFFF;
+ background: <?php echo $highlight_colour; ?>;
+}
+
+td.ui-datepicker-unselectable {
+ background-color: #FFFFFF !important;
+ color: #888888 !important;
+}
+
+.river_object_event_calendar_create {
+ background: url(<?php echo $vars['url']; ?>mod/event_calendar/images/river_icon_event.gif) no-repeat left -1px;
+}
+.river_object_event_calendar_update {
+ background: url(<?php echo $vars['url']; ?>mod/event_calendar/images/river_icon_event.gif) no-repeat left -1px;
+}
+#event_list {
+ width:440px;
+ margin:0;
+ float:left;
+ padding:5px 0 0 0;
+}
+#event_list .search_listing {
+ border:2px solid #cccccc;
+ margin:0 0 5px 0;
+}
+
+.events {
+ min-height: 300px;
+}
+
+div.event_calendar_agenda_date_section {
+ margin-bottom: 10px;
+}
+
+.event_calendar_agenda_date {
+ font-size: 1.3em;
+ font-weight: bold;
+ margin-bottom: 3px;
+}
+
+th.agenda_header {
+ font-weight: bold;
+}
+
+td.event_calendar_agenda_time {
+ width: 120px;
+}
+
+.event_calendar_agenda_title a {
+ font-weight: bold;
+}
+
+td.event_calendar_agenda_title {
+ width: 180px;
+}
+
+.event_calendar_agenda_venue {
+ margin-bottom: 5px;
+}
+
+.event_calendar_paged_month {
+ font-size: 1.3em;
+ font-weight: bold;
+ margin-bottom: 5px;
+ text-transform:uppercase;
+}
+
+td.event_calendar_paged_date {
+ width: 80px;
+}
+td.event_calendar_paged_time {
+ width: 60px;
+}
+td.event_calendar_paged_title {
+ width: 280px;
+}
+
+table.event_calendar_paged_table {
+ width:100%;
+ border-collapse:collapse;
+ border-bottom-width:1px;
+ border-bottom-style:solid;
+ border-bottom-color:#bfbfbf;
+ margin-bottom: 5px;
+}
+
+table.event_calendar_paged_table td {
+ border-width:1px 0 0 0;
+ border-style:solid;
+ border-color:#bfbfbf;
+}
+
+table.event_calendar_paged_table th {
+ font-family:verdana, helvetica, arial, sans-serif;
+ font-size:9pt;
+ color:#183e76;
+ background-color:#ececec;
+ font-weight:bold;
+ text-transform:none;
+ padding:3px 3px 3px 3px;
+}
+
+.event_calendar_strapline {
+ font-size: 85%;
+} \ No newline at end of file
diff --git a/trunk/views/default/event_calendar/entities/entity_list.php b/trunk/views/default/event_calendar/entities/entity_list.php
new file mode 100644
index 000000000..84c2c0b7d
--- /dev/null
+++ b/trunk/views/default/event_calendar/entities/entity_list.php
@@ -0,0 +1,66 @@
+<?php
+/**
+ * View a list of entities
+ *
+ * @package Elgg
+ * @author Curverider Ltd <info@elgg.com>
+ * @link http://elgg.com/
+ *
+ */
+
+$context = $vars['context'];
+$offset = $vars['offset'];
+$entities = $vars['entities'];
+$limit = $vars['limit'];
+$count = $vars['count'];
+$baseurl = $vars['baseurl'];
+$context = $vars['context'];
+$viewtype = $vars['viewtype'];
+$pagination = $vars['pagination'];
+$fullview = $vars['fullview'];
+
+$html = "";
+$nav = "";
+
+if (isset($vars['viewtypetoggle'])) {
+ $viewtypetoggle = $vars['viewtypetoggle'];
+} else {
+ $viewtypetoggle = true;
+}
+
+if ($context == "search" && $count > 0 && $viewtypetoggle) {
+ $nav .= elgg_view('navigation/viewtype', array(
+ 'baseurl' => $baseurl,
+ 'offset' => $offset,
+ 'count' => $count,
+ 'viewtype' => $viewtype,
+ ));
+}
+
+if ($pagination) {
+ $nav .= elgg_view('navigation/pagination',array(
+ 'baseurl' => $baseurl,
+ 'offset' => $offset,
+ 'count' => $count,
+ 'limit' => $limit,
+ ));
+}
+
+$html .= $nav;
+if ($viewtype == 'list') {
+ if (is_array($entities) && sizeof($entities) > 0) {
+ foreach($entities as $entity) {
+ $html .= elgg_view_entity($entity, $fullview);
+ }
+ }
+} else {
+ if (is_array($entities) && sizeof($entities) > 0) {
+ $html .= elgg_view('event_calendar/entities/gallery', array('entities' => $entities));
+ }
+}
+
+if ($count) {
+ $html .= $nav;
+}
+
+echo $html; \ No newline at end of file
diff --git a/trunk/views/default/event_calendar/entities/gallery.php b/trunk/views/default/event_calendar/entities/gallery.php
new file mode 100644
index 000000000..a12dfa84a
--- /dev/null
+++ b/trunk/views/default/event_calendar/entities/gallery.php
@@ -0,0 +1,44 @@
+<?php
+/**
+ * Elgg gallery view
+ *
+ * @package Elgg
+ * @subpackage Core
+ * @author Curverider Ltd
+ * @link http://elgg.org/
+ */
+
+$entities = $vars['entities'];
+if (is_array($entities) && sizeof($entities) > 0) {
+
+?>
+
+<table class="entity_gallery">
+
+<?php
+
+ $col = 0;
+ foreach($entities as $entity) {
+ if ($col == 0) {
+
+ echo "<tr>";
+
+ }
+ echo "<td class=\"entity_gallery_item\">";
+ echo elgg_view('event_calendar/entities/gallery_item',array('entity'=>$entity));
+ echo "</td>";
+ $col++;
+ if ($col > 3) {
+ echo "</tr>";
+ $col = 0;
+ }
+ }
+ if ($col > 0) echo "</tr>";
+
+?>
+
+</table>
+
+<?php
+
+} \ No newline at end of file
diff --git a/trunk/views/default/event_calendar/entities/gallery_item.php b/trunk/views/default/event_calendar/entities/gallery_item.php
new file mode 100644
index 000000000..eb67cc772
--- /dev/null
+++ b/trunk/views/default/event_calendar/entities/gallery_item.php
@@ -0,0 +1,63 @@
+<?php
+
+ /**
+ * Elgg user display (gallery)
+ *
+ * @package ElggProfile
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd <info@elgg.com>
+ * @copyright Curverider Ltd 2008-2010
+ * @link http://elgg.com/
+ *
+ * @uses $vars['entity'] The user entity
+ */
+
+$icon = elgg_view(
+ "profile/icon", array(
+ 'entity' => $vars['entity'],
+ 'size' => 'medium',
+ )
+ );
+
+$banned = $vars['entity']->isBanned();
+
+$rel = "";
+if (page_owner() == $vars['entity']->guid)
+ $rel = 'me';
+else if (check_entity_relationship(page_owner(), 'friend', $vars['entity']->guid))
+ $rel = 'friend';
+
+if (!$banned)
+ $info .= "<p><b><a href=\"" . $vars['entity']->getUrl() . "\" rel=\"$rel\">" . $vars['entity']->name . "</a></b></p>";
+else
+ $info .= "<p><b><strike>" . $vars['entity']->name . "</b></strike><br />".elgg_echo('profile:banned')."</p>";
+
+// TODO: look into a way to pass $authorised and $event_id in $vars
+$authorised = FALSE;
+$event_id = get_input('event_id', 0);
+if ($event_id) {
+ if(isadminloggedin()) {
+ $authorised = TRUE;
+ } else {
+ // load the event from the database
+ $event = get_entity($event_id);
+ $user_id = get_loggedin_userid();
+ if ($event && ($event->owner_guid == $user_id)) {
+ $authorised = TRUE;
+ }
+ }
+}
+
+if ($authorised) {
+ $link = '<p><a href="#" ';
+ $link .= 'onclick="javascript:event_calendar_personal_toggle('.$event_id.','.$vars['entity']->guid.'); return false;" ';
+ $link .= ' >';
+ $link .= '<span id="event_calendar_user_data_'.$vars['entity']->guid.'">'.elgg_echo('event_calendar:remove_from_the_calendar').'</span>';
+ $link .= '</a></p>';
+ $info .= $link;
+}
+
+// echo elgg_view_listing($icon, $info);
+echo elgg_view('search/gallery_listing',array('icon' => $icon, 'info' => $info));
+
+?> \ No newline at end of file
diff --git a/trunk/views/default/event_calendar/forms/add_to_group.php b/trunk/views/default/event_calendar/forms/add_to_group.php
new file mode 100644
index 000000000..fc77495e1
--- /dev/null
+++ b/trunk/views/default/event_calendar/forms/add_to_group.php
@@ -0,0 +1,64 @@
+<?php
+// Game plan - display two drop downs: one with a list of groups
+// without this event, one with - can add using one and remove using
+// the other
+// the user must have the authority to edit the groups
+
+$event_id = $vars['event']->guid;
+$event_container = $vars['event']->container_guid;
+
+// get the list of all groups:
+
+if (isadminloggedin()) {
+ $groups = get_entities("group","",0,"",5000);
+} else {
+ $groups = get_entities("group","",get_loggedin_userid(),"",5000);
+}
+
+// split the group list into two lists
+
+$add_options = array();
+$remove_options = array();
+$remove_group = get_entities_from_relationship("display_on_group",$event_id,FALSE,"","",0,"",5000);
+$remove_group_ids = array();
+foreach ($remove_group as $group) {
+ $remove_group_ids[] = $group->guid;
+ if ($group->guid != $event_container && $group->canEdit()) {
+ $remove_options[$group->guid] = $group->name;
+ }
+}
+
+if ($remove_group) {
+ foreach($groups as $group) {
+ if (($group->guid != $event_container) && !in_array($group->guid,$remove_group_ids)) {
+ $add_options[$group->guid] = $group->name;
+ }
+ }
+} else {
+ foreach($groups as $group) {
+ if ($group->guid != $event_container && $group->canEdit()) {
+ $add_options[$group->guid] = $group->name;
+ }
+ }
+}
+
+if ($add_options || $remove_options) {
+ echo '<div class="contentWrapper" >';
+ $event_bit = elgg_view('input/hidden', array("internalname" => "event_id","value" => $event_id));
+ if ($add_options) {
+ echo "<h4>".elgg_echo('event_calendar:add_to_group:add_group_title')."</h4>";
+ $add_pulldown = elgg_view("input/pulldown",array("internalname" => "group_id","options_values" => $add_options));
+ $submit_button = "<p>".elgg_view("input/submit",array("value"=>elgg_echo('event_calendar:add_to_group:add_group_button')))."</p>";
+ echo elgg_view ('input/form',array("body" => $event_bit.$add_pulldown.$submit_button,"action" => $vars['url']."action/event_calendar/add_to_group"));
+ }
+
+ if ($remove_options) {
+ echo "<h4>".elgg_echo('event_calendar:add_to_group:remove_group_title')."</h4>";
+ $remove_pulldown = elgg_view("input/pulldown",array("internalname" => "group_id","options_values" => $remove_options));
+ $submit_button = "<p>".elgg_view("input/submit",array("value"=>elgg_echo('event_calendar:add_to_group:remove_group_button')))."</p>";
+ echo elgg_view ('input/form',array("body" => $event_bit.$remove_pulldown.$submit_button,"action" => $vars['url']."action/event_calendar/remove_from_group"));
+ }
+ echo '</div>';
+}
+
+?> \ No newline at end of file
diff --git a/trunk/views/default/event_calendar/forms/delete_confirm.php b/trunk/views/default/event_calendar/forms/delete_confirm.php
new file mode 100644
index 000000000..37134e695
--- /dev/null
+++ b/trunk/views/default/event_calendar/forms/delete_confirm.php
@@ -0,0 +1,13 @@
+<?php
+
+$body = '<p class="description">'.sprintf(elgg_echo('event_calendar:delete_confirm_description'),$vars['title']).'</p>';
+
+$body .= '<form action="'.$vars['url'].'action/event_calendar/manage" method="post" >';
+$body .= elgg_view('input/securitytoken');
+$body .= elgg_view('input/hidden',array('internalname'=>'event_action', 'value'=>'delete_event'));
+$body .= elgg_view('input/hidden',array('internalname'=>'event_id', 'value'=>$vars['event_id']));
+$body .= elgg_view('input/submit', array('internalname'=>'submit','value'=>elgg_echo('event_calendar:submit')));
+$body .= '</form>';
+
+echo elgg_view('page_elements/contentwrapper', array('body'=>$body));
+?> \ No newline at end of file
diff --git a/trunk/views/default/event_calendar/forms/manage_event.php b/trunk/views/default/event_calendar/forms/manage_event.php
new file mode 100644
index 000000000..35b9dba71
--- /dev/null
+++ b/trunk/views/default/event_calendar/forms/manage_event.php
@@ -0,0 +1,22 @@
+<?php
+
+/**
+ * Elgg manage event view
+ *
+ * @package event_calendar
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Kevin Jardine <kevin@radagast.biz>
+ * @copyright Radagast Solutions 2008
+ * @link http://radagast.biz/
+ *
+ */
+
+extend_view('metatags','event_calendar/metatags');
+
+$body = elgg_view('event_calendar/forms/manage_event_content',$vars);
+
+$body .= elgg_view('input/submit', array('internalname'=>'submit','value'=>elgg_echo('event_calendar:submit')));
+$form = elgg_view('input/form',array('action'=>$vars['url'].'action/event_calendar/manage','body'=>$body));
+
+print elgg_view('page_elements/contentwrapper',array('body'=>$form));
+?> \ No newline at end of file
diff --git a/trunk/views/default/event_calendar/forms/manage_event_content.php b/trunk/views/default/event_calendar/forms/manage_event_content.php
new file mode 100644
index 000000000..59498e861
--- /dev/null
+++ b/trunk/views/default/event_calendar/forms/manage_event_content.php
@@ -0,0 +1,254 @@
+<?php
+$event = $vars['event'];
+$event_id = $vars['event_id'];
+$event_calendar_times = get_plugin_setting('times', 'event_calendar');
+$event_calendar_region_display = get_plugin_setting('region_display', 'event_calendar');
+$event_calendar_type_display = get_plugin_setting('type_display', 'event_calendar');
+$event_calendar_spots_display = get_plugin_setting('spots_display', 'event_calendar');
+$event_calendar_add_users = get_plugin_setting('add_users', 'event_calendar');
+$event_calendar_hide_access = get_plugin_setting('hide_access', 'event_calendar');
+$event_calendar_hide_end = get_plugin_setting('hide_end', 'event_calendar');
+$event_calendar_more_required = get_plugin_setting('more_required', 'event_calendar');
+
+if ($event_calendar_more_required == 'yes') {
+ $required_fields = array('title','venue','start_date','start_time',
+ 'brief_description','region','event_type','fees','contact','organiser',
+ 'event_tags','spots');
+} else {
+ $required_fields = array('title','venue','start_date');
+}
+$all_fields = array('title','venue','start_time','start_date','end_time','end_date',
+ 'brief_description','region','event_type','fees','contact','organiser','event_tags',
+ 'long_description','spots');
+$prefix = array();
+foreach ($all_fields as $fn) {
+ if (in_array($fn,$required_fields)) {
+ $prefix[$fn] = elgg_echo('event_calendar:required').' ';
+ } else {
+ $prefix[$fn] = elgg_echo('event_calendar:optional').' ';
+ }
+}
+
+if ($event) {
+ $title = $event->title;
+ $brief_description = $event->description;
+ $venue = $event->venue;
+ if ($event->form_data) {
+ // this is a form redisplay, so take the values as submitted
+ $start_date = $event->start_date;
+ $end_date = $event->end_date;
+ } else {
+ // the values are from the database,
+ // so convert
+ $start_date = date("l, F j, Y",$event->start_date);
+ if ($event->end_date) {
+ $end_date = date("l, F j, Y",$event->end_date);
+ } else {
+ $end_date = '';
+ }
+ }
+
+ if ($event_calendar_region_display) {
+ $region = $event->region;
+ if (!$region) {
+ $region = '-';
+ }
+ }
+
+ if ($event_calendar_spots_display) {
+ $spots = trim($event->spots);
+ }
+ if ($event_calendar_type_display) {
+ $event_type = $event->event_type;
+ if (!$event_type) {
+ $event_type = '-';
+ }
+ }
+ $fees = $event->fees;
+ $contact = $event->contact;
+ $organiser = $event->organiser;
+ $event_tags = $event->event_tags;
+ $long_description = $event->long_description;
+ $access = $event->access_id;
+ if ($event_calendar_times == 'yes') {
+ $start_time = $event->start_time;
+ $end_time = $event->end_time;
+ }
+ $event_action = 'manage_event';
+} else {
+ $event_id = 0;
+ $title = '';
+ $brief_description = '';
+ $venue = '';
+ $start_date = '';
+ $end_date = '';
+ $fees = '';
+ if ($event_calendar_spots_display) {
+ $spots = '';
+ }
+ if ($event_calendar_region_display) {
+ $region = '-';
+ }
+ if ($event_calendar_type_display) {
+ $event_type = '-';
+ }
+ $contact = '';
+ $organiser = '';
+ $event_tags = '';
+ $long_description = '';
+ $access = get_default_access();
+ if ($event_calendar_times == 'yes') {
+ $start_time = '';
+ $end_time = '';
+ }
+ $event_action = 'add_event';
+}
+$body = '';
+
+$body .= elgg_view('input/hidden',array('internalname'=>'event_action', 'value'=>$event_action));
+$body .= elgg_view('input/hidden',array('internalname'=>'event_id', 'value'=>$event_id));
+$body .= elgg_view('input/hidden',array('internalname'=>'group_guid', 'value'=>$vars['group_guid']));
+
+$body .= '<p><label>'.elgg_echo("event_calendar:title_label").'<br />';
+$body .= elgg_view("input/text",array('internalname' => 'title','value'=>$title));
+$body .= '</label></p>';
+$body .= '<p class="description">'.$prefix['title'].elgg_echo('event_calendar:title_description').'</p>';
+
+$body .= '<p><label>'.elgg_echo("event_calendar:venue_label").'<br />';
+$body .= elgg_view("input/text",array('internalname' => 'venue','value'=>$venue));
+$body .= '</label></p>';
+$body .= '<p class="description">'.$prefix['venue'].elgg_echo('event_calendar:venue_description').'</p>';
+
+if ($event_calendar_times == 'yes') {
+ $body .= '<p><label>'.elgg_echo("event_calendar:start_time_label").'</label><br />';
+ $body .= elgg_view("input/timepicker",array('internalname' => 'start_time','value'=>$start_time));
+ $body .= '</p>';
+ $body .= '<p class="description">'.$prefix['start_time'].elgg_echo('event_calendar:start_time_description').'</p>';
+}
+
+$body .= '<p><label>'.elgg_echo("event_calendar:start_date_label").'<br />';
+$body .= elgg_view("input/datepicker_popup",array('internalname' => 'start_date','value'=>$start_date));
+$body .= '</label></p>';
+$body .= '<p class="description">'.$prefix['start_date'].elgg_echo('event_calendar:start_date_description').'</p>';
+
+if ($event_calendar_hide_end != 'yes') {
+ if ($event_calendar_times == 'yes') {
+ $body .= '<p><label>'.elgg_echo("event_calendar:end_time_label").'</label><br />';
+ $body .= elgg_view("input/timepicker",array('internalname' => 'end_time','value'=>$end_time));
+ $body .= '</p>';
+ $body .= '<p class="description">'.$prefix['end_time'].elgg_echo('event_calendar:end_time_description').'</p>';
+ }
+
+ $body .= '<p><label>'.elgg_echo("event_calendar:end_date_label").'<br />';
+ $body .= elgg_view("input/datepicker_popup",array('internalname' => 'end_date','value'=>$end_date));
+ $body .= '</label></p>';
+ $body .= '<p class="description">'.$prefix['end_date'].elgg_echo('event_calendar:end_date_description').'</p>';
+}
+
+if ($event_calendar_spots_display == 'yes') {
+ $body .= '<p><label>'.elgg_echo("event_calendar:spots_label").'<br />';
+ $body .= elgg_view("input/text",array('internalname' => 'spots','value'=>$spots));
+ $body .= '</label></p>';
+ $body .= '<p class="description">'.$prefix['spots'].elgg_echo('event_calendar:spots_description').'</p>';
+}
+
+if ($event_calendar_add_users == 'yes') {
+ $body .= '<p><label>'.elgg_echo("event_calendar:add_user_label").'<br />';
+ $body .= elgg_view("input/adduser",array('internalname' => 'adduser','internalid' => 'do_adduser','width'=> 200, 'minChars'=>2));
+ $body .= '</label></p><br /><br />';
+ $body .= '<p class="description">'.elgg_echo('event_calendar:add_user_description').'</p>';
+}
+
+$body .= '<p><label>'.elgg_echo("event_calendar:brief_description_label").'<br />';
+$body .= elgg_view("input/text",array('internalname' => 'brief_description','value'=>$brief_description));
+$body .= '</label></p>';
+$body .= '<p class="description">'.$prefix['brief_description'].elgg_echo('event_calendar:brief_description_description').'</p>';
+
+if ($event_calendar_region_display == 'yes') {
+ $region_list = trim(get_plugin_setting('region_list', 'event_calendar'));
+ $region_list_handles = get_plugin_setting('region_list_handles', 'event_calendar');
+ // make sure that we are using Unix line endings
+ $region_list = str_replace("\r\n","\n",$region_list);
+ $region_list = str_replace("\r","\n",$region_list);
+ if ($region_list) {
+ $options = array();
+ $options[] = '-';
+ foreach(explode("\n",$region_list) as $region_item) {
+ $region_item = trim($region_item);
+ if ($region_list_handles == 'yes') {
+ $options[$region_item] = elgg_echo('event_calendar:region:'.$region_item);
+ } else {
+ $options[$region_item] = $region_item;
+ }
+ }
+ $body .= '<p><label>'.elgg_echo("event_calendar:region_label").'<br />';
+ $body .= elgg_view("input/pulldown",array('internalname' => 'region','value'=>$region,'options_values'=>$options));
+ $body .= '</label></p>';
+ $body .= '<p class="description">'.$prefix['region'].elgg_echo('event_calendar:region_description').'</p>';
+ }
+}
+
+if ($event_calendar_type_display == 'yes') {
+ $type_list = trim(get_plugin_setting('type_list', 'event_calendar'));
+ $type_list_handles = get_plugin_setting('type_list_handles', 'event_calendar');
+ // make sure that we are using Unix line endings
+ $type_list = str_replace("\r\n","\n",$type_list);
+ $type_list = str_replace("\r","\n",$type_list);
+ if ($type_list) {
+ $options = array();
+ $options[] = '-';
+ foreach(explode("\n",$type_list) as $type_item) {
+ $type_item = trim($type_item);
+ if ($type_list_handles == 'yes') {
+ $options[$type_item] = elgg_echo('event_calendar:type:'.$type_item);
+ } else {
+ $options[$type_item] = $type_item;
+ }
+ }
+ $body .= '<p><label>'.elgg_echo("event_calendar:type_label").'<br />';
+ $body .= elgg_view("input/pulldown",array('internalname' => 'event_type','value'=>$event_type,'options_values'=>$options));
+ $body .= '</label></p>';
+ $body .= '<p class="description">'.$prefix['event_type'].elgg_echo('event_calendar:type_description').'</p>';
+ }
+}
+
+$body .= '<p><label>'.elgg_echo("event_calendar:fees_label").'<br />';
+$body .= elgg_view("input/text",array('internalname' => 'fees','value'=>$fees));
+$body .= '</label></p>';
+$body .= '<p class="description">'.$prefix['fees'].elgg_echo('event_calendar:fees_description').'</p>';
+
+$body .= '<p><label>'.elgg_echo("event_calendar:contact_label").'<br />';
+$body .= elgg_view("input/text",array('internalname' => 'contact','value'=>$contact));
+$body .= '</label></p>';
+$body .= '<p class="description">'.$prefix['contact'].elgg_echo('event_calendar:contact_description').'</p>';
+
+$body .= '<p><label>'.elgg_echo("event_calendar:organiser_label").'<br />';
+$body .= elgg_view("input/text",array('internalname' => 'organiser','value'=>$organiser));
+$body .= '</label></p>';
+$body .= '<p class="description">'.$prefix['organiser'].elgg_echo('event_calendar:organiser_description').'</p>';
+
+$body .= '<p><label>'.elgg_echo("event_calendar:event_tags_label").'<br />';
+$body .= elgg_view("input/tags",array('internalname' => 'event_tags','value'=>$event_tags));
+$body .= '</label></p>';
+$body .= '<p class="description">'.$prefix['event_tags'].elgg_echo('event_calendar:event_tags_description').'</p>';
+
+$body .= '<p><label>'.elgg_echo("event_calendar:long_description_label").'<br />';
+$body .= elgg_view("input/longtext",array('internalname' => 'long_description','value'=>$long_description));
+$body .= '</label></p>';
+$body .= '<p class="description">'.$prefix['long_description'].elgg_echo('event_calendar:long_description_description').'</p>';
+
+if($event_calendar_hide_access == 'yes') {
+ $event_calendar_default_access = get_plugin_setting('default_access', 'event_calendar');
+ if($event_calendar_default_access) {
+ $body .= elgg_view("input/hidden",array('internalname' => 'access','value'=>$event_calendar_default_access));
+ } else {
+ $body .= elgg_view("input/hidden",array('internalname' => 'access','value'=>ACCESS_PRIVATE));
+ }
+} else {
+ $body .= '<p><label>'.elgg_echo("access").'<br />';
+ $body .= elgg_view("input/access",array('internalname' => 'access','value'=>$access));
+ $body .= '</label></p>';
+}
+
+print $body;
+?> \ No newline at end of file
diff --git a/trunk/views/default/event_calendar/groupprofile_calendar.php b/trunk/views/default/event_calendar/groupprofile_calendar.php
new file mode 100644
index 000000000..175098e0c
--- /dev/null
+++ b/trunk/views/default/event_calendar/groupprofile_calendar.php
@@ -0,0 +1,42 @@
+<?php
+
+/**
+ * Elgg event_calendar group profile content
+ *
+ * @package event_calendar
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Kevin Jardine <kevin@radagast.biz>
+ * @copyright Radagast Solutions 2008
+ * @link http://radagast.biz/
+ *
+ */
+
+$page_owner_entity = page_owner_entity();
+
+if (event_calendar_activated_for_group($page_owner_entity)) {
+ $num = 5;
+ // Get the upcoming events
+ $start_date = time(); // now
+ $end_date = $start_date + 60*60*24*365*2; // maximum is two years from now
+ $events = event_calendar_get_events_between($start_date,$end_date,false,$num,0,page_owner());
+
+ // If there are any events to view, view them
+ if (is_array($events) && sizeof($events) > 0) {
+
+ echo '<div id="group_pages_widget">';
+ echo '<h2>'.elgg_echo("event_calendar:groupprofile").'</h2>';
+ foreach($events as $event) {
+ echo elgg_view("object/event_calendar",array('entity' => $event));
+ }
+ echo '<div class="forum_latest"><a href="'.$vars['url'].'pg/event_calendar/group/'.page_owner().'">'.elgg_echo('event_calendar:view_calendar').'</a></div>';
+ echo "</div>";
+
+ } else if (get_plugin_setting('group_always_display', 'event_calendar') == 'yes') {
+ echo '<div id="group_pages_widget">';
+ echo '<h2>'.elgg_echo("event_calendar:groupprofile").'</h2>';
+ echo '<div class="forum_latest">'.elgg_echo('event_calendar:no_events_found').'</div>';
+ echo "</div>";
+ }
+}
+
+?> \ No newline at end of file
diff --git a/trunk/views/default/event_calendar/input/longtext.php b/trunk/views/default/event_calendar/input/longtext.php
new file mode 100644
index 000000000..86b0f3fc4
--- /dev/null
+++ b/trunk/views/default/event_calendar/input/longtext.php
@@ -0,0 +1,25 @@
+<?php
+
+ /**
+ * Elgg long text input
+ * Displays a long text input field
+ *
+ * @package Elgg
+ * @subpackage Core
+
+ * @author Curverider Ltd
+
+ * @link http://elgg.org/
+ *
+ * @uses $vars['value'] The current value, if any
+ * @uses $vars['js'] Any Javascript to enter into the input tag
+ * @uses $vars['internalname'] The name of the input field
+ *
+ */
+
+ $class = $vars['class'];
+ if (!$class) $class = "input-textarea";
+
+?>
+
+<textarea class="<?php echo $class; ?>" name="<?php echo $vars['internalname']; ?>" <?php if (isset($vars['internalid'])) echo "id=\"{$vars['internalid']}\""; ?> <?php if ($vars['disabled']) echo ' disabled="yes" '; ?> <?php echo $vars['js']; ?>><?php echo htmlentities($vars['value'], ENT_QUOTES, 'UTF-8'); ?></textarea> \ No newline at end of file
diff --git a/trunk/views/default/event_calendar/metatags.php b/trunk/views/default/event_calendar/metatags.php
new file mode 100644
index 000000000..8375ef118
--- /dev/null
+++ b/trunk/views/default/event_calendar/metatags.php
@@ -0,0 +1,2 @@
+<link rel="stylesheet" href="<?php echo $vars['url']; ?>mod/event_calendar/datepicker.css" type="text/css" media="screen" title="Flora (Default)">
+<script type="text/javascript" src="<?php echo $vars['url']; ?>mod/event_calendar/ui.datepicker.js"></script>
diff --git a/trunk/views/default/event_calendar/nav.php b/trunk/views/default/event_calendar/nav.php
new file mode 100644
index 000000000..ceedfd485
--- /dev/null
+++ b/trunk/views/default/event_calendar/nav.php
@@ -0,0 +1,38 @@
+<?php
+$allselect = ''; $friendsselect = ''; $mineselect = '';
+switch($vars['filter']) {
+ case 'all': $allselect = 'class="selected"';
+ break;
+ case 'friends': $friendsselect = 'class="selected"';
+ break;
+ case 'mine': $mineselect = 'class="selected"';
+ break;
+ case 'open': $openselect = 'class="selected"';
+ break;
+}
+
+$url_start = $vars['url'].'mod/event_calendar/show_events.php?group_guid='.$vars['group_guid'].'&amp;mode='.$vars['mod'].'&amp;start_date='.$vars['start_date'];
+
+?>
+<div id="elgg_horizontal_tabbed_nav">
+ <ul>
+<?php
+$event_calendar_spots_display = get_plugin_setting('spots_display', 'event_calendar');
+if ($event_calendar_spots_display == "yes") {
+?>
+ <li <?php echo $openselect; ?> ><a onclick="javascript:$('#event_list').load('<?php echo $url_start; ?>&amp;filter=open&amp;callback=true'); return false;" href="<?php echo $url_start; ?>&amp;filter=open&amp;callback=true"><?php echo elgg_echo('event_calendar:open'); ?></a></li>
+<?php
+}
+?>
+ <li <?php echo $allselect; ?> ><a onclick="javascript:$('#event_list').load('<?php echo $url_start; ?>&amp;filter=all&amp;callback=true'); return false;" href="<?php echo $url_start; ?>&amp;filter=all&amp;callback=true"><?php echo elgg_echo('all'); ?></a></li>
+ <li <?php echo $friendsselect; ?> ><a onclick="javascript:$('#event_list').load('<?php echo $url_start; ?>&amp;filter=friends&amp;callback=true'); return false;" href="<?php echo $url_start; ?>&amp;filter=friends&amp;callback=true"><?php echo elgg_echo('friends'); ?></a></li>
+ <li <?php echo $mineselect; ?> ><a onclick="javascript:$('#event_list').load('<?php echo $url_start; ?>&amp;filter=mine&amp;callback=true'); return false;" href="<?php echo $url_start; ?>&amp;filter=mine&amp;callback=true"><?php echo elgg_echo('event_calendar:mine'); ?></a></li>
+ </ul>
+</div>
+<?php
+$event_calendar_region_display = get_plugin_setting('region_display', 'event_calendar');
+if ($event_calendar_region_display == 'yes') {
+ $url_start .= '&amp;filter='.$vars['filter'];
+ echo elgg_view('event_calendar/region_select',array('url_start'=>$url_start,'region'=>$vars['region']));
+}
+?> \ No newline at end of file
diff --git a/trunk/views/default/event_calendar/paged_footer.php b/trunk/views/default/event_calendar/paged_footer.php
new file mode 100644
index 000000000..954769104
--- /dev/null
+++ b/trunk/views/default/event_calendar/paged_footer.php
@@ -0,0 +1,4 @@
+<?php
+echo '</tbody></table></div>';
+?>
+
diff --git a/trunk/views/default/event_calendar/paged_header.php b/trunk/views/default/event_calendar/paged_header.php
new file mode 100644
index 000000000..5f4b8e59c
--- /dev/null
+++ b/trunk/views/default/event_calendar/paged_header.php
@@ -0,0 +1,15 @@
+<?php
+$header .= '<div class="event_calendar_paged_header_section">';
+$header .= '<div class="event_calendar_paged_month">'.$vars['date'].'</div>';
+$header .= '<table class="event_calendar_paged_table"><thead><tr>';
+$header .= '<th class="paged_header">'.elgg_echo('event_calendar:paged:column:date').'</th>';
+$header .= '<th class="paged_header">'.elgg_echo('event_calendar:paged:column:time').'</th>';
+$header .= '<th class="paged_header">'.elgg_echo('event_calendar:paged:column:event').'</th>';
+$header .= '<th class="paged_header">'.elgg_echo('event_calendar:paged:column:venue').'</th>';
+if ($vars['personal_manage'] != 'no') {
+ $header .= '<th class="paged_header">'.elgg_echo('event_calendar:paged:column:calendar').'</th>';
+}
+$header .= '</td></thead><tbody>';
+
+echo $header;
+?> \ No newline at end of file
diff --git a/trunk/views/default/event_calendar/paged_item_view.php b/trunk/views/default/event_calendar/paged_item_view.php
new file mode 100644
index 000000000..77c8bed4e
--- /dev/null
+++ b/trunk/views/default/event_calendar/paged_item_view.php
@@ -0,0 +1,29 @@
+<?php
+$event = $vars['event'];
+$time_bit = '';
+if (is_numeric($event->start_time)) {
+ $time_bit = event_calendar_convert_time($event->start_time);
+}
+
+$date_bit = event_calendar_get_formatted_date($event->start_date);
+
+if (event_calendar_has_personal_event($event->guid,get_loggedin_userid())) {
+ $calendar_bit = 'checked = "checked"';
+} else {
+ $calendar_bit = '';
+}
+
+$calendar_bit .= ' onclick="javascript:event_calendar_personal_toggle('.$event->guid.'); return true;" ';
+
+$info = '<tr>';
+$info .= '<td class="event_calendar_paged_date">'.$date_bit.'</td>';
+$info .= '<td class="event_calendar_paged_time">'.$time_bit.'</td>';
+$info .= '<td class="event_calendar_paged_title"><a href="'.$event->getUrl().'">'.$event->title.'</a></td>';
+$info .= '<td class="event_calendar_paged_venue">'.$event->venue.'</td>';
+if ($vars['personal_manage'] != 'no') {
+ $info .= '<td class="event_calendar_paged_calendar"><input id="event_calendar_paged_checkbox_'.$event->guid.'" type="checkbox" '.$calendar_bit.' /></td>';
+}
+$info .= '</tr>';
+
+echo $info;
+?> \ No newline at end of file
diff --git a/trunk/views/default/event_calendar/paged_view.php b/trunk/views/default/event_calendar/paged_view.php
new file mode 100644
index 000000000..7c2ea2eaa
--- /dev/null
+++ b/trunk/views/default/event_calendar/paged_view.php
@@ -0,0 +1,51 @@
+<?php
+$nav = elgg_view('navigation/pagination',array(
+
+// 'baseurl' => $_SERVER['REQUEST_URI'],
+ 'baseurl' => $_SERVER['SCRIPT_NAME'].'/?'.$_SERVER['QUERY_STRING'],
+ 'offset' => $vars['offset'],
+ 'count' => $vars['count'],
+ 'limit' => $vars['limit'],
+
+ ));
+$event_calendar_times = get_plugin_setting('times', 'event_calendar');
+$event_calendar_personal_manage = get_plugin_setting('personal_manage', 'event_calendar');
+$events = $vars['events'];
+$html = '';
+$date_format = 'F Y';
+$current_month = '';
+if ($events) {
+ foreach($events as $event) {
+ $month = date($date_format,$event->start_date);
+ if ($month != $current_month) {
+ if ($html) {
+ $html .= elgg_view('event_calendar/paged_footer');
+ }
+ $html .= elgg_view('event_calendar/paged_header',array('date'=>$month,'personal_manage'=>$event_calendar_personal_manage));
+
+ $current_month = $month;
+ }
+ $html .= elgg_view('event_calendar/paged_item_view',array('event'=>$event,'times'=>$event_calendar_times,'personal_manage'=>$event_calendar_personal_manage));
+ }
+ $html .= elgg_view('event_calendar/paged_footer');
+}
+$msgs = '<div id="event_calendar_paged_messages"></div>';
+$html = $msgs.$nav.'<div class="event_calendar_paged">'.$html.'</div>'.$nav;
+
+echo $html;
+?>
+<script type="text/javascript">
+function event_calendar_personal_toggle(guid) {
+ $.get("<?php echo $vars['url'].'action/event_calendar/toggle_personal_calendar?'.event_calendar_security_fields().'&event_id='; ?>"+guid,
+ function (res) {
+ var flag = res.substring(0,3);
+ var msg = res.substring(3);
+ $('#event_calendar_paged_messages').html(msg);
+ if (flag == '@f@') {
+ // action failed so toggle checkbox
+ $("#event_calendar_paged_checkbox_"+guid).attr('checked',!$("#event_calendar_paged_checkbox_"+guid).attr('checked'));
+ }
+ }
+ );
+}
+</script> \ No newline at end of file
diff --git a/trunk/views/default/event_calendar/personal_toggle_js.php b/trunk/views/default/event_calendar/personal_toggle_js.php
new file mode 100644
index 000000000..c0611e45c
--- /dev/null
+++ b/trunk/views/default/event_calendar/personal_toggle_js.php
@@ -0,0 +1,20 @@
+<?php
+// TODO: put the rest into a JS function
+
+$elgg_ts = time();
+$elgg_token = generate_action_token($elgg_ts);
+$tokens = "&__elgg_ts=$elgg_ts&__elgg_token=$elgg_token";
+?>
+<script type="text/javascript">
+function event_calendar_personal_toggle(event_id,user_id) {
+
+ var link = "<?php echo $vars['url']; ?>action/event_calendar/toggle_personal_calendar?";
+ link += "user_id="+user_id+"&event_id="+event_id+"&other=true";
+ link += "<?php echo $tokens; ?>";
+ $.get(link,
+ function (res) {
+ $('#event_calendar_user_data_'+user_id).html(res);
+ }
+ );
+}
+</script> \ No newline at end of file
diff --git a/trunk/views/default/event_calendar/region_select.php b/trunk/views/default/event_calendar/region_select.php
new file mode 100644
index 000000000..81407b27d
--- /dev/null
+++ b/trunk/views/default/event_calendar/region_select.php
@@ -0,0 +1,23 @@
+<?php
+
+$region_list = trim(get_plugin_setting('region_list', 'event_calendar'));
+// make sure that we are using Unix line endings
+$region_list = str_replace("\r\n","\n",$region_list);
+$region_list = str_replace("\r","\n",$region_list);
+if ($region_list) {
+ $body = '';
+ $options_values = array('-' =>elgg_echo('event_calendar:all'));
+ foreach(explode("\n",$region_list) as $region_item) {
+ $region_item = trim($region_item);
+ $options_values[$region_item] = $region_item;
+ }
+ $js = "onchange=\"javascript:$('#event_list').load('".$vars['url_start']
+ ."&amp;callback=true&region='+escape($('#region').val() ));\"";
+ //$js = "onchange=\"javascript:$('#event_list').load('".$vars['url_start']."&amp;callback=true&region='+$('#region').val());\"";
+ $body .= elgg_echo('event_calendar:region_filter_by_label');
+ $body .= elgg_view("input/pulldown",array('internalid' => 'region','js'=>$js,'value'=>$vars['region'],'options_values'=>$options_values));
+ $body .= '<br />';
+}
+
+echo $body;
+?> \ No newline at end of file
diff --git a/trunk/views/default/event_calendar/review_requests.php b/trunk/views/default/event_calendar/review_requests.php
new file mode 100644
index 000000000..e1866a32b
--- /dev/null
+++ b/trunk/views/default/event_calendar/review_requests.php
@@ -0,0 +1,25 @@
+<?php
+
+foreach($vars['requests'] as $request) {
+ if ($request instanceof ElggUser) {
+ $icon = elgg_view("profile/icon", array(
+ 'entity' => $request,
+ 'size' => 'small'
+ ));
+ $info = '<a href="' . $request->getURL() . '" >'.$request->name.'</a>';
+ $info .= '<div style="margin-top: 5px;" ></div>';
+ $info .= elgg_view('output/confirmlink',
+ array(
+ 'class' => "cancel_button",
+ 'href' => $vars['url'] . 'action/event_calendar/killrequest?user_guid='.$request->guid.'&event_id=' . $vars['entity']->guid,
+ 'confirm' => elgg_echo('event_calendar:request:remove:check'),
+ 'text' => elgg_echo('delete'),
+ ));
+ $info .= '&nbsp;&nbsp;';
+ $url = elgg_add_action_tokens_to_url("{$vars['url']}action/event_calendar/addtocalendar?user_guid={$request->guid}&event_id={$vars['entity']->guid}");
+ $info .= '<a href="'.$url.'" class="add_topic_button">'.elgg_echo('accept').'</a>';
+ echo elgg_view_listing($icon,$info);
+ }
+}
+
+?>
diff --git a/trunk/views/default/event_calendar/show_events.php b/trunk/views/default/event_calendar/show_events.php
new file mode 100644
index 000000000..31771f43d
--- /dev/null
+++ b/trunk/views/default/event_calendar/show_events.php
@@ -0,0 +1,53 @@
+<?php
+/**
+ * Elgg show events view
+ *
+ * @package event_calendar
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Kevin Jardine <kevin@radagast.biz>
+ * @copyright Radagast Solutions 2008
+ * @link http://radagast.biz/
+ *
+ */
+
+$listing_format = $vars['listing_format'];
+
+if ($vars['events']) {
+ if (get_plugin_setting('agenda_view', 'event_calendar') == 'yes') {
+ $event_list = elgg_view('event_calendar/agenda_view',$vars);
+ } else {
+ if ($listing_format == 'paged') {
+ $event_list = elgg_view('event_calendar/paged_view',$vars);
+ } else {
+ $event_list = elgg_view_entity_list($vars['events'], $vars['count'], $vars['offset'], $vars['limit'], false, false);
+ }
+ }
+} else {
+ $event_list = '<p>'.elgg_echo('event_calendar:no_events_found').'</p>';
+}
+if ($listing_format == 'paged') {
+ echo $event_list;
+} else {
+ if (isloggedin()) {
+ $nav = elgg_view('event_calendar/nav',$vars);
+ } else {
+ $nav = '';
+ }
+?>
+<table width="100%">
+<tr><td>
+<div id="event_list">
+<?php
+echo $nav.'<br />'.$event_list;
+?>
+</div>
+</td>
+<td align="right">
+<?php
+echo elgg_view('event_calendar/calendar',$vars);
+?>
+</td></tr>
+</table>
+<?php
+}
+?> \ No newline at end of file
diff --git a/trunk/views/default/event_calendar/strapline.php b/trunk/views/default/event_calendar/strapline.php
new file mode 100644
index 000000000..15c7c98d9
--- /dev/null
+++ b/trunk/views/default/event_calendar/strapline.php
@@ -0,0 +1,18 @@
+<div class="contentWrapper">
+<span class="event_calendar_strapline">
+<?php
+
+ $event = $vars['entity'];
+
+ $time_updated = $event->time_created;
+ $owner_guid = $event->owner_guid;
+ $owner = get_entity($owner_guid);
+
+ echo sprintf(elgg_echo('event_calendar:strapline'),
+ friendly_time($time_updated),
+ "<a href=\"" . $owner->getURL() . "\">" . $owner->name ."</a>"
+ );
+
+?>
+</span>
+</div> \ No newline at end of file
diff --git a/trunk/views/default/icon/object/event_calendar/small.php b/trunk/views/default/icon/object/event_calendar/small.php
new file mode 100644
index 000000000..d30d14453
--- /dev/null
+++ b/trunk/views/default/icon/object/event_calendar/small.php
@@ -0,0 +1,3 @@
+<?php
+ echo $vars['url'] . "mod/event_calendar/images/event_icon.gif";
+?> \ No newline at end of file
diff --git a/trunk/views/default/input/datepicker_inline.php b/trunk/views/default/input/datepicker_inline.php
new file mode 100644
index 000000000..560074a2d
--- /dev/null
+++ b/trunk/views/default/input/datepicker_inline.php
@@ -0,0 +1,52 @@
+<?php
+
+/**
+ * JQuery data picker(inline version)
+ *
+ * @package event_calendar
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Kevin Jardine <kevin@radagast.biz>
+ * @copyright Radagast Solutions 2008
+ * @link http://radagast.biz/
+ *
+ */
+?>
+
+<script language="javascript">
+$(document).ready(function(){
+var done_loading = false;
+$("#<?php echo $vars['internalname']; ?>").datepicker({
+ onChangeMonthYear: function(year, month, inst) {
+ if(inst.onChangeToday){
+ day=inst.selectedDay;
+ }else{
+ day=1;
+ }
+ if (done_loading) {
+ // in this case the mode is forced to month
+ document.location.href = "<?php echo $vars['url'].'mod/event_calendar/show_events.php?mode=month&group_guid='.$vars['group_guid'].'&start_date='; ?>" + year+'-'+month+'-1';
+ }
+ },
+ onSelect: function(date) {
+ // jump to the new page
+ document.location.href = "<?php echo $vars['url'].'mod/event_calendar/show_events.php?mode='.$vars['mode'].'&group_guid='.$vars['group_guid'].'&start_date='; ?>" + date.substring(0,10);
+ },
+ dateFormat: "yy-mm-dd",
+ <?php echo $vars['range_bit']; ?>
+ hideIfNoPrevNext: true,
+ defaultDate: "<?php echo $vars['start_date'] .' - '.$vars['end_date']; ?>",
+ <?php if ($vars['mode'] == 'week') echo 'highlightWeek: true,'; ?>
+ rangeSelect: true
+});
+var start_date = $.datepicker.parseDate("yy-mm-dd", "<?php echo $vars['start_date']; ?>");
+var end_date = $.datepicker.parseDate("yy-mm-dd", "<?php echo $vars['end_date']; ?>");
+// not sure why this is necessary, but it seems to be
+if ("<?php echo $vars['mode'] ?>" == "month") {
+ end_date += 1;
+}
+$("#<?php echo $vars['internalname']; ?>").datepicker("setDate", start_date, end_date);
+var done_loading = true;
+});
+</script>
+<div id="<?php echo $vars['internalname']; ?>" ></div>
+<p style="clear: both;"><!-- See day-by-day example for highlighting days code --></p> \ No newline at end of file
diff --git a/trunk/views/default/input/datepicker_popup.php b/trunk/views/default/input/datepicker_popup.php
new file mode 100644
index 000000000..8e1120ce7
--- /dev/null
+++ b/trunk/views/default/input/datepicker_popup.php
@@ -0,0 +1,30 @@
+<?php
+
+/**
+ * JQuery data picker
+ *
+ * @package event_calendar
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Kevin Jardine <kevin@radagast.biz>
+ * @copyright Radagast Solutions 2008
+ * @link http://radagast.biz/
+ *
+ */
+if ($vars['dateformat']) {
+ $date_format = $vars['dateformat'];
+} else {
+ $date_format = "DD, MM d, yy";
+}
+?>
+
+<script language="javascript">
+$(document).ready(function(){
+$("#<?php echo $vars['internalname']; ?>").datepicker({
+ dateFormat: "<?php echo $date_format; ?>",
+ showOn: "both",
+ buttonImage: "<?php echo $vars['url']; ?>mod/event_calendar/images/calendar.gif",
+ buttonImageOnly: true
+})
+});
+</script>
+<input type="text" size="30" value="<?php echo $vars['value']; ?>" name="<?php echo $vars['internalname']; ?>" id="<?php echo $vars['internalname']; ?>"/> \ No newline at end of file
diff --git a/trunk/views/default/input/timepicker.php b/trunk/views/default/input/timepicker.php
new file mode 100644
index 000000000..35fa5ac98
--- /dev/null
+++ b/trunk/views/default/input/timepicker.php
@@ -0,0 +1,38 @@
+<?php
+
+$time_format = get_plugin_setting('timeformat', 'event_calendar');
+if (!$time_format) {
+ $time_format = 24;
+}
+
+$value = $vars['value'];
+if (is_numeric($value)) {
+ $hour = floor($value/60);
+ $minute = ($value -60*$hour);
+
+ // add 1 to avoid pulldown 0 bug
+ $hour++;
+ $minute++;
+} else {
+ $hour = '-';
+ $minute = '-';
+}
+
+$hours = array();
+$hours['-'] = '-';
+
+for($i=0;$i<$time_format;$i++) {
+ $hours[$i+1] = $i;
+}
+
+$minutes = array();
+$minutes['-'] = '-';
+
+for($i=0;$i<60;$i=$i+5) {
+ $minutes[$i+1] = sprintf("%02d",$i);
+}
+
+echo elgg_view('input/pulldown',array('internalname'=>$vars['internalname'].'_h','value'=>$hour,'options_values'=>$hours));
+echo elgg_view('input/pulldown',array('internalname'=>$vars['internalname'].'_m','value'=>$minute,'options_values'=>$minutes));
+
+?> \ No newline at end of file
diff --git a/trunk/views/default/object/event_calendar.php b/trunk/views/default/object/event_calendar.php
new file mode 100644
index 000000000..70560bd2d
--- /dev/null
+++ b/trunk/views/default/object/event_calendar.php
@@ -0,0 +1,66 @@
+<?php
+
+/**
+ * Elgg event_calendar object view
+ *
+ * @package event_calendar
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Kevin Jardine <kevin@radagast.biz>
+ * @copyright Radagast Solutions 2008
+ * @link http://radagast.biz/
+ *
+ */
+
+$event = $vars['entity'];
+
+
+if ($vars['full']) {
+ $body = elgg_view('event_calendar/strapline',$vars);
+ $event_items = event_calendar_get_formatted_full_items($event);
+ $body .= '<div class="contentWrapper" >';
+
+ foreach($event_items as $item) {
+ $value = $item->value;
+ if (!empty($value)) {
+
+ //This function controls the alternating class
+ $even_odd = ( 'odd' != $even_odd ) ? 'odd' : 'even';
+ $body .= "<p class=\"{$even_odd}\"><b>";
+ $body .= $item->title.':</b> ';
+ $body .= $item->value;
+
+ }
+ }
+ echo $body;
+ if ($event->long_description) {
+ echo '<p>'.$event->long_description.'</p>';
+ } else {
+ echo '<p>'.$event->description.'</p>';
+ }
+ echo '</div>';
+ if (get_plugin_setting('add_to_group_calendar', 'event_calendar') == 'yes') {
+ echo elgg_view('event_calendar/forms/add_to_group',array('event' => $event));
+ }
+} else {
+ $time_bit = event_calendar_get_formatted_time($event);
+ $icon = elgg_view(
+ "graphics/icon", array(
+ 'entity' => $vars['entity'],
+ 'size' => 'small',
+ )
+ );
+ $info .= '<p><b><a href="'.$event->getUrl().'">'.$event->title.'</a></b>';
+ $info .= '<br />'.$time_bit;
+ if ($event->description) {
+ $info .= '<br /><br />'.$event->description;
+ }
+
+ if ($event_calendar_venue_view = get_plugin_setting('venue_view', 'event_calendar') == 'yes') {
+ $info .= '<br />'.$event->venue;
+ }
+ $info .= '</p>';
+
+ echo elgg_view_listing($icon, $info);
+}
+
+?> \ No newline at end of file
diff --git a/trunk/views/default/river/object/event_calendar/create.php b/trunk/views/default/river/object/event_calendar/create.php
new file mode 100644
index 000000000..f144ca610
--- /dev/null
+++ b/trunk/views/default/river/object/event_calendar/create.php
@@ -0,0 +1,12 @@
+<?php
+
+ $performed_by = get_entity($vars['item']->subject_guid);
+ $object = get_entity($vars['item']->object_guid);
+
+ $url = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}</a>";
+ $string = sprintf(elgg_echo("event_calendar:river:created"),$url) . " ";
+ $string .= elgg_echo("event_calendar:river:create")." <a href=\"" . $object->getURL() . "\">" . $object->title . "</a>";
+
+?>
+
+<?php echo $string; ?> \ No newline at end of file
diff --git a/trunk/views/default/river/object/event_calendar/update.php b/trunk/views/default/river/object/event_calendar/update.php
new file mode 100644
index 000000000..5a5d376b1
--- /dev/null
+++ b/trunk/views/default/river/object/event_calendar/update.php
@@ -0,0 +1,12 @@
+<?php
+
+ $performed_by = get_entity($vars['item']->subject_guid);
+ $object = get_entity($vars['item']->object_guid);
+
+ $url = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}</a>";
+ $string = sprintf(elgg_echo("event_calendar:river:updated"),$url) . " ";
+ $string .= elgg_echo("event_calendar:river:the_event")." <a href=\"" . $object->getURL() . "\">" . $object->title . "</a>";
+
+?>
+
+<?php echo $string; ?> \ No newline at end of file
diff --git a/trunk/views/default/settings/event_calendar/edit.php b/trunk/views/default/settings/event_calendar/edit.php
new file mode 100644
index 000000000..429a85b26
--- /dev/null
+++ b/trunk/views/default/settings/event_calendar/edit.php
@@ -0,0 +1,363 @@
+<?php
+$yn_options = array(elgg_echo('event_calendar:settings:yes')=>'yes',
+ elgg_echo('event_calendar:settings:no')=>'no',
+);
+
+$access_options = array( ACCESS_PRIVATE => elgg_echo("PRIVATE"),
+ ACCESS_LOGGED_IN => elgg_echo("LOGGED_IN"),
+ ACCESS_PUBLIC => elgg_echo("PUBLIC"));
+
+// TODO - merge the agenda view into the list format options
+
+$listing_options = array(elgg_echo('event_calendar:settings:paged')=>'paged',
+ elgg_echo('event_calendar:settings:month')=>'month',
+);
+
+$body = '';
+
+$event_calendar_hide_access = get_plugin_setting('hide_access', 'event_calendar');
+if (!$event_calendar_hide_access) {
+ $event_calendar_hide_access = 'no';
+}
+
+$body .= elgg_echo('event_calendar:settings:hide_access:title');
+$body .= '<br />';
+$body .= elgg_view('input/radio',array('internalname'=>'params[hide_access]','value'=>$event_calendar_hide_access,'options'=>$yn_options));
+
+$body .= '<br />';
+
+$event_calendar_default_access = get_plugin_setting('default_access', 'event_calendar');
+if (!$event_calendar_default_access) {
+ $event_calendar_default_access = ACCESS_LOGGED_IN;
+}
+
+$body .= elgg_echo('event_calendar:settings:default_access:title');
+$body .= '<br />';
+$body .= elgg_view('input/pulldown',array('internalname'=>'params[default_access]','value'=>$event_calendar_default_access,'options_values'=>$access_options));
+
+$body .= '<br /><br />';
+
+$event_calendar_hide_end = get_plugin_setting('hide_end', 'event_calendar');
+if (!$event_calendar_hide_end) {
+ $event_calendar_hide_end = 'no';
+}
+
+$body .= elgg_echo('event_calendar:settings:hide_end:title');
+$body .= '<br />';
+$body .= elgg_view('input/radio',array('internalname'=>'params[hide_end]','value'=>$event_calendar_hide_end,'options'=>$yn_options));
+
+$body .= '<br />';
+
+$event_calendar_listing_format = get_plugin_setting('listing_format', 'event_calendar');
+if (!$event_calendar_listing_format) {
+ $event_calendar_listing_format = 'month';
+}
+
+$body .= elgg_echo('event_calendar:settings:listing_format:title');
+$body .= '<br />';
+$body .= elgg_view('input/radio',array('internalname'=>'params[listing_format]','value'=>$event_calendar_listing_format,'options'=>$listing_options));
+
+$body .= '<br />';
+
+$event_calendar_times = get_plugin_setting('times', 'event_calendar');
+if (!$event_calendar_times) {
+ $event_calendar_times = 'no';
+}
+
+$body .= elgg_echo('event_calendar:settings:times:title');
+$body .= '<br />';
+$body .= elgg_view('input/radio',array('internalname'=>'params[times]','value'=>$event_calendar_times,'options'=>$yn_options));
+
+$body .= '<br />';
+
+$event_calendar_autopersonal = get_plugin_setting('autopersonal', 'event_calendar');
+if (!$event_calendar_autopersonal) {
+ $event_calendar_autopersonal = 'yes';
+}
+
+$body .= elgg_echo('event_calendar:settings:autopersonal:title');
+$body .= '<br />';
+$body .= elgg_view('input/radio',array('internalname'=>'params[autopersonal]','value'=>$event_calendar_autopersonal,'options'=>$yn_options));
+
+$body .= '<br />';
+
+$event_calendar_autogroup = get_plugin_setting('autogroup', 'event_calendar');
+if (!$event_calendar_autogroup) {
+ $event_calendar_autogroup = 'no';
+}
+
+$body .= elgg_echo('event_calendar:settings:autogroup:title');
+$body .= '<br />';
+$body .= elgg_view('input/radio',array('internalname'=>'params[autogroup]','value'=>$event_calendar_autogroup,'options'=>$yn_options));
+
+$body .= '<br />';
+
+$event_calendar_add_to_group_calendar = get_plugin_setting('add_to_group_calendar', 'event_calendar');
+if (!$event_calendar_add_to_group_calendar) {
+ $event_calendar_add_to_group_calendar = 'no';
+}
+
+$body .= elgg_echo('event_calendar:settings:add_to_group_calendar:title');
+$body .= '<br />';
+$body .= elgg_view('input/radio',array('internalname'=>'params[add_to_group_calendar]','value'=>$event_calendar_add_to_group_calendar,'options'=>$yn_options));
+
+$body .= '<br />';
+
+$event_calendar_agenda_view = get_plugin_setting('agenda_view', 'event_calendar');
+if (!$event_calendar_agenda_view) {
+ $event_calendar_agenda_view = 'no';
+}
+
+$body .= elgg_echo('event_calendar:settings:agenda_view:title');
+$body .= '<br />';
+$body .= elgg_view('input/radio',array('internalname'=>'params[agenda_view]','value'=>$event_calendar_agenda_view,'options'=>$yn_options));
+
+$body .= '<br />';
+
+$event_calendar_venue_view = get_plugin_setting('venue_view', 'event_calendar');
+if (!$event_calendar_venue_view) {
+ $event_calendar_venue_view = 'no';
+}
+
+$body .= elgg_echo('event_calendar:settings:venue_view:title');
+$body .= '<br />';
+$body .= elgg_view('input/radio',array('internalname'=>'params[venue_view]','value'=>$event_calendar_venue_view,'options'=>$yn_options));
+
+$body .= '<br />';
+
+$options = array(elgg_echo('event_calendar:settings:no')=>'no',
+ elgg_echo('event_calendar:settings:site_calendar:admin')=>'admin',
+ elgg_echo('event_calendar:settings:site_calendar:loggedin')=>'loggedin',
+);
+
+$event_calendar_site_calendar = get_plugin_setting('site_calendar', 'event_calendar');
+if (!$event_calendar_site_calendar) {
+ $event_calendar_site_calendar = 'admin';
+}
+
+$body .= elgg_echo('event_calendar:settings:site_calendar:title').'<br />';
+$body .= elgg_view('input/radio',array('internalname'=>'params[site_calendar]','value'=>$event_calendar_site_calendar,'options'=>$options));
+
+$body .= '<br />';
+
+$options = array(elgg_echo('event_calendar:settings:no')=>'no',
+ elgg_echo('event_calendar:settings:group_calendar:admin')=>'admin',
+ elgg_echo('event_calendar:settings:group_calendar:members')=>'members',
+);
+
+$event_calendar_group_calendar = get_plugin_setting('group_calendar', 'event_calendar');
+if (!$event_calendar_group_calendar) {
+ $event_calendar_group_calendar = 'members';
+}
+
+$body .= elgg_echo('event_calendar:settings:group_calendar:title').'<br />';
+$body .= elgg_view('input/radio',array('internalname'=>'params[group_calendar]','value'=>$event_calendar_group_calendar,'options'=>$options));
+
+$body .= '<br />';
+
+$options = array(elgg_echo('event_calendar:settings:group_default:yes')=>'yes',
+ elgg_echo('event_calendar:settings:group_default:no')=>'no',
+);
+
+$event_calendar_group_default = get_plugin_setting('group_default', 'event_calendar');
+if (!$event_calendar_group_default) {
+ $event_calendar_group_default = 'yes';
+}
+
+$body .= elgg_echo('event_calendar:settings:group_default:title');
+$body .= '<br />';
+$body .= elgg_view('input/radio',array('internalname'=>'params[group_default]','value'=>$event_calendar_group_default,'options'=>$options));
+
+$body .= '<br />';
+
+$event_calendar_group_always_display = get_plugin_setting('group_always_display', 'event_calendar');
+if (!$event_calendar_group_always_display) {
+ $event_calendar_group_always_display = 'no';
+}
+
+$body .= elgg_echo('event_calendar:settings:group_always_display:title');
+$body .= '<br />';
+$body .= elgg_view('input/radio',array('internalname'=>'params[group_always_display]','value'=>$event_calendar_group_always_display,'options'=>$yn_options));
+
+$body .= '<br />';
+
+$options = array(elgg_echo('event_calendar:settings:group_profile_display_option:left')=>'left',
+ elgg_echo('event_calendar:settings:group_profile_display_option:right')=>'right',
+ elgg_echo('event_calendar:settings:group_profile_display_option:none')=>'none',
+);
+
+$event_calendar_group_profile_display = get_plugin_setting('group_profile_display', 'event_calendar');
+if (!$event_calendar_group_profile_display) {
+ $event_calendar_group_profile_display = 'right';
+}
+
+$body .= elgg_echo('event_calendar:settings:group_profile_display:title').'<br />';
+$body .= elgg_view('input/radio',array('internalname'=>'params[group_profile_display]','value'=>$event_calendar_group_profile_display,'options'=>$options));
+
+$body .= '<br />';
+
+$event_calendar_add_users = get_plugin_setting('add_users', 'event_calendar');
+if (!$event_calendar_add_users) {
+ $event_calendar_add_users = 'no';
+}
+
+$body .= elgg_echo('event_calendar:settings:add_users:title');
+$body .= '<br />';
+$body .= elgg_view('input/radio',array('internalname'=>'params[add_users]','value'=>$event_calendar_add_users,'options'=>$yn_options));
+
+$body .= '<br />';
+
+$event_calendar_add_users_notify = get_plugin_setting('add_users_notify', 'event_calendar');
+if (!$event_calendar_add_users_notify) {
+ $event_calendar_add_users_notify = 'no';
+}
+
+$body .= elgg_echo('event_calendar:settings:add_users_notify:title');
+$body .= '<br />';
+$body .= elgg_view('input/radio',array('internalname'=>'params[add_users_notify]','value'=>$event_calendar_add_users_notify,'options'=>$yn_options));
+
+$body .= '<br />';
+
+$event_calendar_personal_manage = get_plugin_setting('personal_manage', 'event_calendar');
+if (!$event_calendar_personal_manage) {
+ $event_calendar_personal_manage = 'yes';
+}
+
+$body .= elgg_echo('event_calendar:settings:personal_manage:title');
+$body .= '<br />';
+$body .= elgg_view('input/radio',array('internalname'=>'params[personal_manage]','value'=>$event_calendar_personal_manage,'options'=>$yn_options));
+
+$body .= '<br />';
+
+$event_calendar_spots_display = get_plugin_setting('spots_display', 'event_calendar');
+if (!$event_calendar_spots_display) {
+ $event_calendar_spots_display = 'no';
+}
+
+$body .= elgg_echo('event_calendar:settings:spots_display:title');
+$body .= '<br />';
+$body .= elgg_view('input/radio',array('internalname'=>'params[spots_display]','value'=>$event_calendar_spots_display,'options'=>$yn_options));
+
+$body .= '<br />';
+
+$event_calendar_no_collisions = get_plugin_setting('no_collisions', 'event_calendar');
+if (!$event_calendar_no_collisions) {
+ $event_calendar_no_collisions = 'no';
+}
+
+$body .= elgg_echo('event_calendar:settings:no_collisions:title');
+$body .= '<br />';
+$body .= elgg_view('input/radio',array('internalname'=>'params[no_collisions]','value'=>$event_calendar_no_collisions,'options'=>$yn_options));
+
+$body .= '<br />';
+
+$event_calendar_collision_length = get_plugin_setting('collision_length', 'event_calendar');
+if (!$event_calendar_collision_length) {
+ $event_calendar_collision_length = '3600';
+}
+
+$body .= elgg_echo('event_calendar:settings:collision_length:title');
+$body .= '<br />';
+$body .= elgg_view('input/text',array('internalname'=>'params[collision_length]','value'=>$event_calendar_collision_length));
+
+$body .= '<br /><br />';
+
+$event_calendar_region_display = get_plugin_setting('region_display', 'event_calendar');
+if (!$event_calendar_region_display) {
+ $event_calendar_region_display = 'no';
+}
+
+$body .= elgg_echo('event_calendar:settings:region_display:title');
+$body .= '<br />';
+$body .= elgg_view('input/radio',array('internalname'=>'params[region_display]','value'=>$event_calendar_region_display,'options'=>$yn_options));
+
+$body .= '<br />';
+
+$event_calendar_region_list = get_plugin_setting('region_list', 'event_calendar');
+if (!$event_calendar_region_list) {
+ $event_calendar_region_list = '';
+}
+
+$body .= elgg_echo('event_calendar:settings:region_list:title');
+$body .= '<br />';
+$body .= elgg_view('event_calendar/input/longtext',array('internalname'=>'params[region_list]','value'=>$event_calendar_region_list));
+
+$body .= '<br />';
+
+$event_calendar_region_list_handles = get_plugin_setting('region_list_handles', 'event_calendar');
+if (!$event_calendar_region_list_handles) {
+ $event_calendar_region_list_handles = 'no';
+}
+
+$body .= elgg_echo('event_calendar:settings:region_list_handles:title');
+$body .= '<br />';
+$body .= elgg_view('input/radio',array('internalname'=>'params[region_list_handles]','value'=>$event_calendar_region_list_handles,'options'=>$yn_options));
+
+$body .= '<br />';
+
+$event_calendar_type_display = get_plugin_setting('type_display', 'event_calendar');
+if (!$event_calendar_type_display) {
+ $event_calendar_type_display = 'no';
+}
+
+$body .= elgg_echo('event_calendar:settings:type_display:title');
+$body .= '<br />';
+$body .= elgg_view('input/radio',array('internalname'=>'params[type_display]','value'=>$event_calendar_type_display,'options'=>$yn_options));
+
+$body .= '<br />';
+
+$event_calendar_type_list = get_plugin_setting('type_list', 'event_calendar');
+if (!$event_calendar_type_list) {
+ $event_calendar_type_list = '';
+}
+
+$body .= elgg_echo('event_calendar:settings:type_list:title');
+$body .= '<br />';
+$body .= elgg_view('event_calendar/input/longtext',array('internalname'=>'params[type_list]','value'=>$event_calendar_type_list));
+
+$body .= '<br />';
+
+$event_calendar_type_list_handles = get_plugin_setting('type_list_handles', 'event_calendar');
+if (!$event_calendar_type_list_handles) {
+ $event_calendar_type_list_handles = 'no';
+}
+
+$body .= elgg_echo('event_calendar:settings:type_list_handles:title');
+$body .= '<br />';
+$body .= elgg_view('input/radio',array('internalname'=>'params[type_list_handles]','value'=>$event_calendar_type_list_handles,'options'=>$yn_options));
+
+$body .= '<br />';
+
+$event_calendar_first_date = get_plugin_setting('first_date', 'event_calendar');
+if (!$event_calendar_first_date) {
+ $event_calendar_first_date = '';
+}
+
+$body .= elgg_echo('event_calendar:settings:first_date:title');
+$body .= '<br />';
+$body .= elgg_view('input/text',array('internalname'=>'params[first_date]','value'=>$event_calendar_first_date));
+
+$body .= '<br /><br />';
+
+$event_calendar_last_date = get_plugin_setting('last_date', 'event_calendar');
+if (!$event_calendar_last_date) {
+ $event_calendar_last_date = '';
+}
+
+$body .= elgg_echo('event_calendar:settings:last_date:title');
+$body .= '<br />';
+$body .= elgg_view('input/text',array('internalname'=>'params[last_date]','value'=>$event_calendar_last_date));
+
+$body .= '<br /><br />';
+
+$event_calendar_more_required = get_plugin_setting('more_required', 'event_calendar');
+if (!$event_calendar_more_required) {
+ $event_calendar_more_required = 'no';
+}
+
+$body .= elgg_echo('event_calendar:settings:more_required:title');
+$body .= '<br />';
+$body .= elgg_view('input/radio',array('internalname'=>'params[more_required]','value'=>$event_calendar_more_required,'options'=>$yn_options));
+
+echo $body;
+?> \ No newline at end of file
diff --git a/trunk/views/default/widgets/event_calendar/edit.php b/trunk/views/default/widgets/event_calendar/edit.php
new file mode 100644
index 000000000..716920c8a
--- /dev/null
+++ b/trunk/views/default/widgets/event_calendar/edit.php
@@ -0,0 +1,35 @@
+<?php
+
+/**
+ * Elgg event_calendar group widget
+ *
+ * @package event_calendar
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Kevin Jardine <kevin@radagast.biz>
+ * @copyright Radagast Solutions 2008
+ * @link http://radagast.biz/
+ *
+ */
+
+if (!$vars['entity']->num_display) {
+ $num_display = 5;
+} else {
+ $num_display = $vars['entity']->num_display;
+}
+?>
+
+<p>
+ <?php echo elgg_echo("event_calendar:num_display"); ?>:
+ <select name="params[num_display]">
+ <option value="1" <?php if($num_display == 1) echo "SELECTED"; ?>>1</option>
+ <option value="2" <?php if($num_display == 2) echo "SELECTED"; ?>>2</option>
+ <option value="3" <?php if($num_display == 3) echo "SELECTED"; ?>>3</option>
+ <option value="4" <?php if($num_display == 4) echo "SELECTED"; ?>>4</option>
+ <option value="5" <?php if($num_display == 5) echo "SELECTED"; ?>>5</option>
+ <option value="6" <?php if($num_display == 6) echo "SELECTED"; ?>>6</option>
+ <option value="7" <?php if($num_display == 7) echo "SELECTED"; ?>>7</option>
+ <option value="8" <?php if($num_display == 8) echo "SELECTED"; ?>>8</option>
+ <option value="9" <?php if($num_display == 9) echo "SELECTED"; ?>>9</option>
+ <option value="10" <?php if($num_display == 10) echo "SELECTED"; ?>>10</option>
+ </select>
+</p>
diff --git a/trunk/views/default/widgets/event_calendar/view.php b/trunk/views/default/widgets/event_calendar/view.php
new file mode 100644
index 000000000..12fff6d60
--- /dev/null
+++ b/trunk/views/default/widgets/event_calendar/view.php
@@ -0,0 +1,39 @@
+<?php
+
+/**
+ * Elgg event calendar widget
+ *
+ * @package event_calendar
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Kevin Jardine <kevin@radagast.biz>
+ * @copyright Radagast Solutions 2008
+ * @link http://radagast.biz/
+ *
+ */
+
+ // Load event calendar model
+ require_once(dirname(dirname(dirname(dirname(dirname(__FILE__)))))."/models/model.php");
+
+ //the number of events to display
+ $num = (int) $vars['entity']->num_display;
+ if (!$num)
+ $num = 5;
+
+ // Get the events
+
+ $events = event_calendar_get_personal_events_for_user(page_owner(),$num);
+
+ // If there are any events to view, view them
+ if (is_array($events) && sizeof($events) > 0) {
+
+ echo "<div id=\"widget_calendar\">";
+
+ foreach($events as $event) {
+ echo elgg_view("object/event_calendar",array('entity' => $event));
+ }
+
+ echo "</div>";
+
+ }
+
+?> \ No newline at end of file
diff --git a/trunk/views/rss/event_calendar/show_events.php b/trunk/views/rss/event_calendar/show_events.php
new file mode 100644
index 000000000..0b2fe5b70
--- /dev/null
+++ b/trunk/views/rss/event_calendar/show_events.php
@@ -0,0 +1,16 @@
+<?php
+/**
+ * Elgg show events RSS view
+ *
+ * @package event_calendar
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Kevin Jardine <kevin@radagast.biz>
+ * @copyright Radagast Solutions 2009
+ * @link http://radagast.biz/
+ *
+ */
+
+if ($vars['events']) {
+ echo elgg_view_entity_list($vars['events'], $vars['count'], $vars['offset'], $vars['limit'], false, false);
+}
+?> \ No newline at end of file
diff --git a/trunk/views/rss/object/event_calendar.php b/trunk/views/rss/object/event_calendar.php
new file mode 100644
index 000000000..92f6fcc14
--- /dev/null
+++ b/trunk/views/rss/object/event_calendar.php
@@ -0,0 +1,60 @@
+<?php
+
+ /**
+ * Elgg default object view
+ *
+ * @package Elgg
+ * @subpackage Core
+
+ * @author Curverider Ltd
+
+ * @link http://elgg.org/
+ */
+
+ $title = $vars['entity']->title;
+
+ $event_items = event_calendar_get_formatted_full_items($vars['entity']);
+ $items = array();
+ foreach($event_items as $item) {
+ if (trim($item->value)) {
+ $items[] = '<b>'.$item->title.'</b>: '.$item->value;
+ }
+ }
+
+ $description = '<p>'.implode('<br />',$items).'</p>';
+
+ if ($vars['entity']->long_description) {
+ $description .= '<p>'.autop($vars['entity']->long_description).'</p>';
+ } else {
+ $description .= '<p>'.$vars['entity']->description.'</p>';
+ }
+
+?>
+
+ <item>
+ <guid isPermaLink='true'><?php echo htmlspecialchars($vars['entity']->getURL()); ?></guid>
+ <link><?php echo htmlspecialchars($vars['entity']->getURL()); ?></link>
+ <title><![CDATA[<?php echo $title; ?>]]></title>
+ <description><![CDATA[<?php echo $description; ?>]]></description>
+ <?php
+ $owner = $vars['entity']->getOwnerEntity();
+ if ($owner)
+ {
+?>
+ <dc:creator><?php echo $owner->name; ?></dc:creator>
+<?php
+ }
+ ?>
+ <?php
+ if (
+ ($vars['entity'] instanceof Locatable) &&
+ ($vars['entity']->getLongitude()) &&
+ ($vars['entity']->getLatitude())
+ ) {
+ ?>
+ <georss:point><?php echo $vars['entity']->getLatitude(); ?> <?php echo $vars['entity']->getLongitude(); ?></georss:point>
+ <?php
+ }
+ ?>
+ <?php echo elgg_view('extensions/item'); ?>
+ </item>