[ Index ]
 

Code source de WebCalendar 1.0.5

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables | Statistiques

title

Body

[fermer]

/ -> import.php (source)

   1  <?php
   2  /*
   3   * $Id: import.php,v 1.28 2005/04/22 20:23:49 jhoov Exp $
   4   *
   5   * Page Description:
   6   *    This page will present the user with forms for submitting
   7   *    a data file to import.
   8   *
   9   * Input Parameters:
  10   *    None
  11   *
  12   * Comments:
  13   *    Might be nice to allow user to set the category for all imported
  14   *    events.  So, a user could easily export events from the work
  15   *    calendar and import them into WebCalendar with a category
  16   *    "work".
  17   */
  18  include_once  'includes/init.php';
  19  
  20  print_header();
  21  
  22  // Generate the selection list for calendar user selection.
  23  // Only ask for calendar user if user is an administrator.
  24  // We may enhance this in the future to allow
  25  // - selection of more than one user
  26  // - non-admin users this functionality
  27  function print_user_list () {
  28    global $single_user, $is_admin, $nonuser_enabled, $login,
  29      $is_nonuser_admin, $is_assistant;
  30  
  31    if ( $single_user == "N" && $is_admin ) {
  32      $userlist = get_my_users ();
  33      if ($nonuser_enabled == "Y" ) {
  34        $nonusers = get_nonuser_cals ();
  35        $userlist = ( ! empty ( $nonuser_at_top ) && $nonuser_at_top == "Y") ?
  36          array_merge($nonusers, $userlist) : array_merge($userlist, $nonusers);
  37      }
  38      $num_users = 0;
  39      $size = 0;
  40      $users = "";
  41      for ( $i = 0; $i < count ( $userlist ); $i++ ) {
  42        $l = $userlist[$i]['cal_login'];
  43        $size++;
  44        $users .= "<option value=\"" . $l . "\"";
  45        if ( ! empty ( $id ) && $id > 0 ) {
  46          if ( ! empty ( $participants[$l] ) )
  47            $users .= " selected=\"selected\"";
  48        } else {
  49          if ( $l == $login && ! $is_assistant  && ! $is_nonuser_admin )
  50            $users .= " selected=\"selected\"";
  51        }
  52        $users .= ">" . $userlist[$i]['cal_fullname'] . "</option>\n";
  53      }
  54    
  55      if ( $size > 50 )
  56        $size = 15;
  57      else if ( $size > 5 )
  58        $size = 5;
  59      print "<tr><td style=\"vertical-align:top;\">\n";
  60      print "<label for=\"caluser\">" . 
  61          translate("Calendar") . "</label></td><td>\n";
  62      print "<select name=\"calUser\" id=\"caluser\" size=\"$size\">$users\n";
  63      print "</select>\n";
  64      print "</td></tr>\n";
  65    }
  66  }
  67  ?>
  68  
  69  <h2><?php etranslate("Import")?>&nbsp;<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  
  71  <?php
  72  $upload = ini_get ( "file_uploads" );
  73  $upload_enabled = ! empty ( $upload ) &&
  74    preg_match ( "/(On|1|true|yes)/i", $upload );
  75  if ( ! $upload_enabled ) {
  76    // The php.ini file does not have file_uploads enabled, so we will
  77    // not receive the uploaded import file.
  78    // Note: do not translate "php.ini file_uploads" since these
  79    // are the filename and config name.
  80    echo "<p>" . translate ( "Disabled" ) . " (php.ini file_uploads)</p>\n";
  81  } else {
  82    // file uploads enabled
  83  ?>
  84  <form action="import_handler.php" method="post" name="importform" enctype="multipart/form-data">
  85  <table style="border-width:0px;">
  86  <tr><td>
  87      <label for="importtype"><?php etranslate("Import format")?>:</label></td><td>
  88          <select name="ImportType" id="importtype">
  89              <option value="PALMDESKTOP">Palm Desktop &lt; v4.1.1</option>
  90              <option value="VCAL">vCal</option>
  91              <option value="ICAL">iCal</option>
  92          </select>
  93  </td></tr>
  94  <tr id="palm"><td>
  95      <label><?php etranslate("Exclude private records")?>:</label></td><td>
  96      <label><input type="radio" name="exc_private" value="1" checked="checked" /><?php etranslate("Yes")?></label> 
  97      <label><input type="radio" name="exc_private" value="0" /><?php etranslate("No")?></label>
  98  </td></tr>
  99  <!-- /PALM -->
 100  
 101  <tr id="ivcal"><td>
 102      <label><?php etranslate("Overwrite Prior Import")?>:</label></td<td>
 103      <label><input type="radio" name="overwrite" value="Y" checked="checked" />&nbsp;<?php etranslate("Yes");?></label> 
 104      <label><input type="radio" name="overwrite" value="N" />&nbsp;<?php etranslate("No");?></label>
 105  </td></tr>
 106  <!-- /IVCAL -->
 107  
 108  <tr class="browse"><td>
 109      <label for="fileupload">Upload file:</label></td><td>
 110      <input type="file" name="FileName" id="fileupload" size="45" maxlength="50" />
 111  </td></tr>
 112  <?php print_user_list(); ?>
 113  </table>
 114  <br /><input type="submit" value="<?php etranslate("Import")?>" />
 115  </form>
 116  <?php } print_trailer (); ?>
 117  </body>
 118  </html>


Généré le : Fri Nov 30 19:09:19 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics