Contact_AddressBook
[ class tree: Contact_AddressBook ] [ index: Contact_AddressBook ] [ all elements ]

Source for file import.php

Documentation is available at import.php

  1. <?php
  2. include_once 'include/head.php';
  3. include_once 'include/header.php';
  4. include_once 'include/simulations.php';
  5. ?>
  6. <script language="javascript" type="text/javascript">
  7. function checkImportForm()
  8. {
  9.     var form = document.ImportForm;
  10.     
  11.     if (form.mode[0].checked) {
  12.         for (var i = 0; i < form.simId.length; i++) {
  13.             if (form.simId[i].checked) {
  14.                 return true;
  15.             }
  16.         }
  17.         alert('Please pick a file first');
  18.         return false;
  19.     } else {    
  20.         if (form.file.value == '') {
  21.             alert('Please pick a file to import');
  22.             return false;
  23.         }
  24.         if (form.format.value == '') {
  25.             alert('Please select the format of file first');
  26.             return false;
  27.         }
  28.     }
  29.     return true;
  30. }
  31. function hideElement(id)
  32. {
  33.     var obj = document.getElementById(id);
  34.     if (obj != null) {
  35.         obj.style.display = 'none';
  36.     }
  37. }
  38. function showElement(id)
  39. {
  40.     var obj = document.getElementById(id);
  41.     if (obj != null) {
  42.         obj.style.display = '';
  43.     }
  44. }
  45. </script>
  46. <div class="nav"><a href="index.php">Home</a></div>
  47. <h2>Options</h2>
  48. <dl>
  49. <dt><b>Here the options to import the address book:</b></dt>
  50. <dt>1. <i>defs_dir</i>, Definition directory (default is PEAR data directory)</dt>
  51. <dt>2. <i>language</i>, Address book language in code (required only if the format is the selectable fields such as WAB, default is "en" english)</dt>
  52. </dl>
  53. <h2>In Action</h2>
  54. <form name="ImportForm" method="post" action="action-import.php" enctype="multipart/form-data" target="result" onSubmit="javascript: return checkImportForm();">
  55. <b>What do you want to do?</b><br />
  56. <input name="mode" type="radio" value="sim" id="mode_sim" onClick="if (this.checked) { showElement('sim'); hideElement('own'); }" checked /><label for="mode_sim">Use simulation file</label>
  57. <input name="mode" type="radio" value="own" id="mode_own" onClick="if (this.checked) { showElement('own'); hideElement('sim'); }" /><label for="mode_own">Use my own file</label><br />
  58. <div id="sim">
  59. <b>Pick a file:</b><br />
  60. <?php
  61. foreach ($GLOBALS['_Contact_AddressBook_simulations'as $key => $value{
  62. ?>
  63. <input type="radio" name="simId" value="<?php print $key?>" id="<?php print $value['format''_' $key?>" /><label for="<?php print $value['format''_' $key?>"><?php print '<b>' $value['file''</b>, ' $value['desc']?></label><br />
  64. <?php
  65. }
  66. ?>
  67. </div>
  68. <div id="own" style="display:none;">
  69. <input type="hidden" name="MAX_FILE_SIZE" value="1048576" />
  70. <b>Pick a file:</b><br />
  71. <input name="file" type="file" size="50" />
  72. <br />
  73. <b>Select the format of file:</b><br /> 
  74. <select name="format" id="format">
  75. <option value="" selected="selected">Select ...</option>
  76. <option value="eudora">Eudora</option>
  77. <option value="csv_kmail">KMail (KDE Mailer) CSV</option>
  78. <option value="csv_mozilla">Mozilla/Thunderbird/Netscape CSV</option>
  79. <option value="csv_outlook">Microsoft Outlook CSV</option>
  80. <option value="csv_wab">Microsoft Windows Address Book (WAB)/Outlook Express CSV</option>
  81. <option value="csv_palm">Palm Pilot CSV</option>
  82. <option value="csv_yahoo">Yahoo! Mail Address Book</option>
  83. <option value="csv_gmail">Gmail Address Book</option>
  84. </select><br />
  85. </div>
  86. <input name="submit" type="submit" id="submit" value="Import" />
  87. </form>
  88. <br />
  89. <b>Result:</b>
  90. <iframe name="result" style="width:100%; height: 400px" frameborder="1"></iframe>
  91. <h2>Source</h2>
  92. <div class="code">
  93. <?php
  94. highlight_file(dirname(__FILE__'/action-import.php');
  95. ?>
  96. </div>
  97. <?php
  98. include_once 'include/footer.php';
  99. ?>

Documentation generated on Mon, 11 Mar 2019 15:40:11 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.