nextcloud/apps/calendar/templates/part.import.php

43 lines
2.2 KiB
PHP
Raw Normal View History

2012-07-01 23:36:09 +04:00
<?php
//Prerendering for iCalendar file
$file = OC_Filesystem::file_get_contents($_['path'] . '/' . $_['filename']);
if(!$file){
OCP\JSON::error(array('error'=>'404'));
}
$import = new OC_Calendar_Import($file);
$newcalendarname = strip_tags($import->createCalendarName());
$guessedcalendarname = $import->guessCalendarName();
?>
<div id="calendar_import_dialog" title="<?php echo $l->t("Import a calendar file");?>">
2012-01-14 17:22:30 +04:00
<div id="form_container">
<input type="hidden" id="filename" value="<?php echo $_['filename'];?>">
<input type="hidden" id="path" value="<?php echo $_['path'];?>">
<input type="hidden" id="progresskey" value="<?php echo rand() ?>">
2012-07-01 23:36:09 +04:00
<p style="text-align:center;"><b><?php echo $l->t('Please choose a calendar'); ?></b></p>
2012-01-13 16:57:46 +04:00
<select style="width:100%;" id="calendar" name="calendar">
2011-10-04 00:50:10 +04:00
<?php
2012-05-01 20:50:31 +04:00
$calendar_options = OC_Calendar_Calendar::allCalendars(OCP\USER::getUser());
2012-01-13 16:57:46 +04:00
$calendar_options[] = array('id'=>'newcal', 'displayname'=>$l->t('create a new calendar'));
2012-06-09 18:44:48 +04:00
for($i = 0;$i<count($calendar_options);$i++){
2012-06-11 21:47:42 +04:00
$calendar_options[$i]['displayname'] = $calendar_options[$i]['displayname'];
2012-06-09 18:44:48 +04:00
}
2012-05-07 01:00:36 +04:00
echo OCP\html_select_options($calendar_options, $calendar_options[0]['id'], array('value'=>'id', 'label'=>'displayname'));
2011-10-04 00:50:10 +04:00
?>
2012-01-13 16:57:46 +04:00
</select>
<div id="newcalform" style="display: none;">
2012-07-01 23:36:09 +04:00
<input type="text" style="width: 97%;" placeholder="<?php echo $l->t('Name of new calendar'); ?>" id="newcalendar" name="newcalendar" value="<?php echo $newcalendarname ?>">
</div>
<div id="namealreadyused" style="display: none;text-align:center;">
<span class="hint"><?php echo $l->t('A Calendar with this name already exists. If you continue anyhow, these calendars will be merged.'); ?></span>
2011-10-04 00:50:10 +04:00
</div>
2012-07-01 23:36:09 +04:00
<input type="button" value="<?php echo $l->t("Import") . ' ' . $_['filename']; ?>!" id="startimport">
2012-01-14 17:22:30 +04:00
</div>
<div id="progressbar_container" style="display: none">
2012-02-01 01:03:08 +04:00
<p style="text-align:center;"><b><?php echo $l->t('Importing calendar'); ?></b></p>
2012-01-14 17:22:30 +04:00
<div id="progressbar"></div>
<div id="import_done" style="display: none;">
<p style="text-align:center;"><b><?php echo $l->t('Calendar imported successfully'); ?></b></p>
<input type="button" value="<?php echo $l->t('Close Dialog'); ?>" id="import_done_button">
</div>
</div>
2012-01-13 16:57:46 +04:00
</div>