4 * This page will present the user with forms for submitting
5 * a data file to import.
11 * Might be nice to allow user to set the category for all imported
12 * events. So, a user could easily export events from the work
13 * calendar and import them into WebCalendar with a category
16 include_once $gfplugins.'webcalendar/www/includes/init.php';
20 // Generate the selection list for calendar user selection.
21 // Only ask for calendar user if user is an administrator.
22 // We may enhance this in the future to allow
23 // - selection of more than one user
24 // - non-admin users this functionality
25 function print_user_list () {
26 global $single_user, $is_admin, $nonuser_enabled, $login,
27 $is_nonuser_admin, $is_assistant;
29 if ( $single_user == "N" && $is_admin ) {
30 $userlist = get_my_users ();
31 if ($nonuser_enabled == "Y" ) {
32 $nonusers = get_nonuser_cals ();
33 $userlist = ( ! empty ( $nonuser_at_top ) && $nonuser_at_top == "Y") ?
34 array_merge($nonusers, $userlist) : array_merge($userlist, $nonusers);
39 for ( $i = 0; $i < count ( $userlist ); $i++ ) {
40 $l = $userlist[$i]['cal_login'];
42 $users .= "<option value=\"" . $l . "\"";
43 if ( ! empty ( $id ) && $id > 0 ) {
44 if ( ! empty ( $participants[$l] ) )
45 $users .= " selected=\"selected\"";
47 if ( $l == $login && ! $is_assistant && ! $is_nonuser_admin )
48 $users .= " selected=\"selected\"";
50 $users .= ">" . $userlist[$i]['cal_fullname'] . "</option>\n";
57 print "<tr><td style=\"vertical-align:top;\">\n";
58 print "<label for=\"caluser\">" .
59 translate("Calendar") . "</label></td><td>\n";
60 print "<select name=\"calUser\" id=\"caluser\" size=\"$size\">$users\n";
67 <h2><?php etranslate("Import")?> <img src="help.gif" alt="<?php etranslate("Help")?>" class="help" onclick="window.open ( 'help_import.php', 'cal_help', 'dependent,menubar,scrollbars,height=400,width=400');" /></h2>
70 $upload = ini_get ( "file_uploads" );
71 $upload_enabled = ! empty ( $upload ) &&
72 preg_match ( "/(On|1|true|yes)/i", $upload );
73 if ( ! $upload_enabled ) {
74 // The php.ini file does not have file_uploads enabled, so we will
75 // not receive the uploaded import file.
76 // Note: do not translate "php.ini file_uploads" since these
77 // are the filename and config name.
78 echo "<p>" . translate ( "Disabled" ) . " (php.ini file_uploads)</p>\n";
80 // file uploads enabled
82 <form action="import_handler.php" method="post" name="importform" enctype="multipart/form-data">
83 <table style="border-width:0px;">
85 <label for="importtype"><?php etranslate("Import format")?>:</label></td><td>
86 <select name="ImportType" id="importtype">
87 <option value="PALMDESKTOP">Palm Desktop < v4.1.1</option>
88 <option value="VCAL">vCal</option>
89 <option value="ICAL">iCal</option>
93 <label><?php etranslate("Exclude private records")?>:</label></td><td>
94 <label><input type="radio" name="exc_private" value="1" checked="checked" /><?php etranslate("Yes")?></label>
95 <label><input type="radio" name="exc_private" value="0" /><?php etranslate("No")?></label>
100 <label><?php etranslate("Overwrite Prior Import")?>:</label></td><td>
101 <label><input type="radio" name="overwrite" value="Y" checked="checked" /> <?php etranslate("Yes");?></label>
102 <label><input type="radio" name="overwrite" value="N" /> <?php etranslate("No");?></label>
106 <tr class="browse"><td>
107 <label for="fileupload">Upload file:</label></td><td>
108 <input type="file" name="FileName" id="fileupload" size="45" maxlength="50" />
110 <?php print_user_list(); ?>
112 <br /><input type="submit" value="<?php etranslate("Import")?>" />
114 <?php } print_trailer (); ?>