summaryrefslogtreecommitdiffstats
path: root/apps/calendar/templates/part.import.php
diff options
context:
space:
mode:
authorGeorg Ehrke <dev@georgswebsite.de>2012-07-01 21:36:09 +0200
committerGeorg Ehrke <dev@georgswebsite.de>2012-07-01 21:36:09 +0200
commit803f2c2517c0874ca5fd3526e8056d3d919712f2 (patch)
tree231d5d6a36c953fea3bc085b8e468301e0c002be /apps/calendar/templates/part.import.php
parent6a060ecd230f5b94b94dd08fc16845303627a1ab (diff)
downloadnextcloud-server-803f2c2517c0874ca5fd3526e8056d3d919712f2.tar.gz
nextcloud-server-803f2c2517c0874ca5fd3526e8056d3d919712f2.zip
some work on calendar import
Diffstat (limited to 'apps/calendar/templates/part.import.php')
-rw-r--r--apps/calendar/templates/part.import.php21
1 files changed, 17 insertions, 4 deletions
diff --git a/apps/calendar/templates/part.import.php b/apps/calendar/templates/part.import.php
index 70ff9612157..2a3ca9dae92 100644
--- a/apps/calendar/templates/part.import.php
+++ b/apps/calendar/templates/part.import.php
@@ -1,9 +1,19 @@
-<div id="calendar_import_dialog" title="<?php echo $l->t("Import a calendar file"); ?>">
+<?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");?>">
<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() ?>">
-<p style="text-align:center;"><b><?php echo $l->t('Please choose the calendar'); ?></b></p>
+<p style="text-align:center;"><b><?php echo $l->t('Please choose a calendar'); ?></b></p>
<select style="width:100%;" id="calendar" name="calendar">
<?php
$calendar_options = OC_Calendar_Calendar::allCalendars(OCP\USER::getUser());
@@ -15,9 +25,12 @@ echo OCP\html_select_options($calendar_options, $calendar_options[0]['id'], arra
?>
</select>
<div id="newcalform" style="display: none;">
- <input type="text" style="width: 97%;" placeholder="<?php echo $l->t('Name of new calendar'); ?>" id="newcalendar" name="newcalendar">
+ <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>
</div>
-<input type="button" value="<?php echo $l->t("Import");?>!" id="startimport">
+<input type="button" value="<?php echo $l->t("Import") . ' ' . $_['filename']; ?>!" id="startimport">
</div>
<div id="progressbar_container" style="display: none">
<p style="text-align:center;"><b><?php echo $l->t('Importing calendar'); ?></b></p>