link-shared event display timezone selection implemented

This commit is contained in:
Michał 'rysiek' Woźniak 2014-02-11 02:39:01 +01:00
parent 8381f056be
commit f3cb94ddae
5 changed files with 42 additions and 3 deletions

View file

@ -173,6 +173,14 @@ button.category{margin:0 3px;}
position:relative;
top:0.5em;
}
header + .settings.timezonesettings {
float:right;
margin-top:-1.2em;
}
header + .settings.timezonesettings > .chzn-container {
position:relative;
top:0.5em;
}
/* input fields take whole width */
#event-title,

View file

@ -2,7 +2,12 @@ $(document).ready(function(){
$('#timezone').change( function(){
var post = $( '#timezone' ).serialize();
$.post( OC.filePath('calendar', 'ajax/settings', 'settimezone.php'), post, function(data){
$('#fullcalendar').fullCalendar('refetchEvents');
// if we have #fullcalendar, reload it
if ($('#fullcalendar').length > 0) {
$('#fullcalendar').fullCalendar('refetchEvents');
} else {
location.reload();
}
return;
});
return false;
@ -50,7 +55,9 @@ $(document).ready(function(){
calendarcachecheck();
});
});
calendarcachecheck();
if ($('#fullcalendar').length > 0) {
calendarcachecheck();
}
});
function calendarcachecheck(){

View file

@ -161,6 +161,7 @@ if (isset($rootLinkItem)) {
} elseif ($linkItem['item_type'] === 'event') {
OCP\Util::addStyle('calendar', 'style');
OCP\Util::addStyle('calendar', 'tooltips');
OCP\Util::addscript('calendar','settings');
OCP\App::setActiveNavigationEntry('calendar_index');
$tmpl = new OCP\Template('calendar', 'event', 'base');
$tmpl->assign('link_shared_event', $linkItem);

View file

@ -36,7 +36,7 @@ $dtend = OC_Calendar_Object::getDTEndFromVEvent($vevent);
switch($dtstart->getDateType()) {
case Sabre\VObject\Property\DateTime::UTC:
case Sabre\VObject\Property\DateTime::LOCALTZ:
$timezone = new DateTimeZone(OC_Calendar_App::$tz);
$timezone = new DateTimeZone($_['timezone']);
$newDT = $dtstart->getDateTime();
$newDT->setTimezone($timezone);
$dtstart->setDateTime($newDT);
@ -227,6 +227,8 @@ $tmpl = new OCP\Template('calendar', 'part.showevent');
$tmpl->assign('link_shared_event', $_['link_shared_event']);
$tmpl->assign('link_shared_event_url', $_['link_shared_event_url']);
$tmpl->assign('timezone', $_['timezone']);
$tmpl->assign('timezones', $_['timezones']);
$tmpl->assign('eventid', $id);
$tmpl->assign('permissions', $permissions);

View file

@ -9,6 +9,27 @@
<div id="logo-claim" style="display:none;"><?php p($theme->getLogoClaim()); ?></div>
<div><?php p($l->t('Event')) ?> &quot;<?php p($_['link_shared_event']['item_target'])?>&quot;; <?php p($l->t('download or use in your calendar application:'))?> <a class="download-link" href="<?php echo $_['link_shared_event_url']; ?>&amp;download"><?php p($l->t('Download'))?></a></div>
</header>
<div class="settings timezonesettings">
<label for="timezone" title="<?php p($l->t('Timezone settings')); ?>"><?php p($l->t('Timezone'))?></label>
<select id="timezone" name="timezone">
<?php
$continent = '';
foreach($_['timezones'] as $timezone):
$ex=explode('/', $timezone, 2);//obtain continent,city
if (!isset($ex[1])) {
$ex[1] = $ex[0];
$ex[0] = "Other";
}
if ($continent!=$ex[0]):
if ($continent!="") print_unescaped('</optgroup>');
print_unescaped('<optgroup label="'.OC_Util::sanitizeHTML($ex[0]).'">');
endif;
$city=strtr($ex[1], '_', ' ');
$continent=$ex[0];
print_unescaped('<option value="'.OC_Util::sanitizeHTML($timezone).'"'.($_['timezone'] == $timezone?' selected="selected"':'').'>'.OC_Util::sanitizeHTML($city).'</option>');
endforeach;?>
</select>
</div>
<?php } ?>
<div id="event" class="event <?php if(isset($_['link_shared_event'])): ?>link-shared<?php endif; ?>" title="<?php p($l->t("View an event"));?>">
<?php if (!isset($_['link_shared_event'])): ?>