diff options
author | Kevin Jardine <kevinjardine@yahoo.com> | 2011-08-29 20:59:54 +0200 |
---|---|---|
committer | Kevin Jardine <kevinjardine@yahoo.com> | 2011-08-29 20:59:54 +0200 |
commit | 2557245a41579a15dd960e2033f4d5f39ff566ac (patch) | |
tree | 15891d7dcef7c4d5da3ae82eb4f6ae9ad10b2521 /views/default/input | |
parent | 52ddfd1b76cb3e5fbb2a31eb5a3c738bb0d61b54 (diff) | |
download | elgg-2557245a41579a15dd960e2033f4d5f39ff566ac.tar.gz elgg-2557245a41579a15dd960e2033f4d5f39ff566ac.tar.bz2 |
first step in rewrite for Elgg 1.8
Diffstat (limited to 'views/default/input')
-rw-r--r-- | views/default/input/datepicker_inline.php | 44 | ||||
-rw-r--r-- | views/default/input/datepicker_popup.php | 1 |
2 files changed, 36 insertions, 9 deletions
diff --git a/views/default/input/datepicker_inline.php b/views/default/input/datepicker_inline.php index 560074a2d..69520b9ef 100644 --- a/views/default/input/datepicker_inline.php +++ b/views/default/input/datepicker_inline.php @@ -6,16 +6,43 @@ * @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 + * @copyright Radagast Solutions 2008 -2011 * @link http://radagast.biz/ * */ +if ($vars['group_guid']) { + $link_bit = $vars['url']."event_calendar/group/{$vars['group_guid']}/%s/{$vars['mode']}"; +} else { + $link_bit = $vars['url']."event_calendar/list/%s/{$vars['mode']}/{$vars['filter']}"; +} + +if ($vars['mode'] == 'week') { + $selected_week = date('W',strtotime($vars['start_date']))+1; +} else { + $selected_week = ''; +} +// TODO - figure out how to move this JavaScript ?> <script language="javascript"> +var selectedWeek = "<?php echo $selected_week; ?>"; +highlightWeek = function(d) { + if (!selectedWeek) { return [true,''];} + //var date = $(this).datepicker('getDate'); + var dayOfWeek = d.getUTCDay(); + var weekNumber = $.datepicker.iso8601Week(d); + if (dayOfWeek == 6) { + weekNumber += 1; + } + + if (selectedWeek == weekNumber) { + return [true,'week-highlight']; + } + return [true,'']; +} $(document).ready(function(){ var done_loading = false; -$("#<?php echo $vars['internalname']; ?>").datepicker({ +$("#<?php echo $vars['name']; ?>").datepicker({ onChangeMonthYear: function(year, month, inst) { if(inst.onChangeToday){ day=inst.selectedDay; @@ -24,19 +51,17 @@ $("#<?php echo $vars['internalname']; ?>").datepicker({ } 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'; + document.location.href = "<?php echo $link_bit; ?>".replace('%s', 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); + document.location.href = "<?php echo $link_bit; ?>".replace('%s', 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 + beforeShowDay: highlightWeek }); 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']; ?>"); @@ -44,9 +69,10 @@ var end_date = $.datepicker.parseDate("yy-mm-dd", "<?php echo $vars['end_date']; if ("<?php echo $vars['mode'] ?>" == "month") { end_date += 1; } -$("#<?php echo $vars['internalname']; ?>").datepicker("setDate", start_date, end_date); +$("#<?php echo $vars['name']; ?>").datepicker("setDate", start_date, end_date); var done_loading = true; }); + </script> -<div id="<?php echo $vars['internalname']; ?>" ></div> +<div style="position:relative;" id="<?php echo $vars['name']; ?>" ></div> <p style="clear: both;"><!-- See day-by-day example for highlighting days code --></p>
\ No newline at end of file diff --git a/views/default/input/datepicker_popup.php b/views/default/input/datepicker_popup.php index 8e1120ce7..5ed431e71 100644 --- a/views/default/input/datepicker_popup.php +++ b/views/default/input/datepicker_popup.php @@ -10,6 +10,7 @@ * @link http://radagast.biz/ * */ + if ($vars['dateformat']) { $date_format = $vars['dateformat']; } else { |