/importmag/plugins/base/datasources/csv/options_panel.php

https://gitlab.com/inglobe/mgt-clemente-css · PHP · 209 lines · 193 code · 16 blank · 0 comment · 19 complexity · f1842c3c68d52fbb660a887bcfa18f75 MD5 · raw file

  1. <div class="plugin_description">
  2. This plugin enables magmi import from csv files (using Dataflow format
  3. + magmi extended columns)<br /> <b>NOT Magento 1.5 new importexport
  4. format!!</b>
  5. </div>
  6. <div>
  7. <div class="csvmode"></div>
  8. <ul class="formline">
  9. <li class="label">CSV import mode</li>
  10. <li class="value"><select name="CSV:importmode" id="CSV:importmode">
  11. <option value="local"
  12. <?php if ($this->getParam("CSV:importmode", "local")=="local") {
  13. ?>
  14. selected="selected" <?php
  15. }?>>Local</option>
  16. <option value="remote"
  17. <?php if ($this->getParam("CSV:importmode", "local")=="remote") {
  18. ?>
  19. selected="selected" <?php
  20. }?>>Remote</option>
  21. </select>
  22. </ul>
  23. <div id="localcsv"
  24. <?php if ($this->getParam("CSV:importmode", "local")=="remote") {
  25. ?>
  26. style="display: none" <?php
  27. }?>>
  28. <ul class="formline">
  29. <li class="label">CSVs base directory</li>
  30. <li class="value"><input type="text" name="CSV:basedir"
  31. id="CSV:basedir"
  32. value="<?php echo $this->getParam("CSV:basedir", "var/import")?>">
  33. <div class="fieldinfo">Relative paths are relative to magento base
  34. directory , absolute paths will be used as is</div></li>
  35. </ul>
  36. <ul class="formline">
  37. <li class="label">File to import:</li>
  38. <li class="value" id="csvds_filelist">
  39. <?php echo $this->getOptionsPanel("csvds_filelist.php")->getHtml(); ?>
  40. </li>
  41. </ul>
  42. </div>
  43. <div id="remotecsv"
  44. <?php if ($this->getParam("CSV:importmode", "local")=="local") {
  45. ?>
  46. style="display: none" <?php
  47. }?>>
  48. <ul class="formline">
  49. <li class="label">Remote CSV url</li>
  50. <li class="value"><input type="text" name="CSV:remoteurl"
  51. id="CSV:remoteurl"
  52. value="<?php echo $this->getParam("CSV:remoteurl", "")?>"
  53. style="width: 400px"><input type="checkbox"
  54. id="CSV:forcedl" name="CSV:forcedl"
  55. <?php if ($this->getParam("CSV:forcedl", false)==true) {
  56. ?>
  57. checked="checked" <?php
  58. }?>>Force Download</li>
  59. </ul>
  60. <div id="remotecookie">
  61. <ul class="formline">
  62. <li class="label">HTTP Cookie</li>
  63. <li class="value"><input type="text" name="CSV:remotecookie"
  64. id="CSV:remotecookie"
  65. value="<?php echo $this->getParam("CSV:remotecookie", "")?>"
  66. style="width: 400px"></li>
  67. </ul>
  68. </div>
  69. <input type="checkbox" id="CSV:remoteauth" name="CSV:remoteauth"
  70. <?php if ($this->getParam("CSV:remoteauth", false)==true) {
  71. ?>
  72. checked="checked" <?php
  73. }?>>authentication needed
  74. <div id="remoteauth"
  75. <?php if ($this->getParam("CSV:remoteauth", false)==false) {
  76. ?>
  77. style="display: none" <?php
  78. }?>>
  79. <div class="remoteuserpass">
  80. <ul class="formline">
  81. <li class="label">User</li>
  82. <li class="value"><input type="text" name="CSV:remoteuser"
  83. id="CSV:remoteuser"
  84. value="<?php echo $this->getParam("CSV:remoteuser", "")?>"></li>
  85. </ul>
  86. <ul class="formline">
  87. <li class="label">Password</li>
  88. <li class="value"><input type="text" name="CSV:remotepass"
  89. id="CSV:remotepass"
  90. value="<?php echo $this->getParam("CSV:remotepass", "")?>"></li>
  91. </ul>
  92. </div>
  93. </div>
  94. </div>
  95. </div>
  96. <div>
  97. <h3>CSV options</h3>
  98. <span class="">CSV separator:</span><input type="text" maxlength="3"
  99. size="3" name="CSV:separator"
  100. value="<?php echo $this->getParam("CSV:separator")?>"><span
  101. class="">CSV Enclosure:</span><input type="text" maxlength="3"
  102. size="3" name="CSV:enclosure"
  103. value='<?php echo $this->getParam("CSV:enclosure")?>'>
  104. </div>
  105. <div class="">
  106. <input type="checkbox" name="CSV:noheader"
  107. <?php if ($this->getParam("CSV:noheader", false)==true) {
  108. ?>
  109. checked="checked" <?php
  110. }?>> Headerless CSV (Use Column Mapper Plugin
  111. to set processable column names)
  112. </div>
  113. <div class="">
  114. <input type="checkbox" name="CSV:allowtrunc"
  115. <?php if ($this->getParam("CSV:allowtrunc", false)==true) {
  116. ?>
  117. checked="checked" <?php
  118. }?>> Allow truncated lines (bypasses data line
  119. structure correlation with headers)
  120. </div>
  121. <?php
  122. $hdline = $this->getParam("CSV:headerline", "");
  123. $malformed = ($hdline != "" && $hdline != 1)?>
  124. <input type="checkbox" id="malformedcb" <?php if ($malformed) {
  125. ?>
  126. checked="checked" <?php
  127. }?> />
  128. Malformed CSV (column list line not at top of file)
  129. <div id="malformed" <?php if (!$malformed) {
  130. ?> style="display: none"
  131. <?php
  132. }?>>
  133. <span class="">CSV Header at line:</span><input type="text"
  134. id="CSV:headerline" name="CSV:headerline" maxlength="7" size="7"
  135. value="<?php echo $hdline?>">
  136. </div>
  137. <script type="text/javascript">
  138. handle_auth=function()
  139. {
  140. if($('CSV:remoteauth').checked)
  141. {
  142. $('remoteauth').show();
  143. }
  144. else
  145. {
  146. $('remoteauth').hide();
  147. }
  148. }
  149. $('CSV:basedir').observe('blur',function()
  150. {
  151. new Ajax.Updater('csvds_filelist','ajax_pluginconf.php',{
  152. parameters:{file:'csvds_filelist.php',
  153. plugintype:'datasources',
  154. pluginclass:'<?php echo get_class($this->_plugin)?>',
  155. profile:'<?php echo $this->getConfig()->getProfile()?>',
  156. 'CSV:basedir':$F('CSV:basedir')}});
  157. });
  158. $('malformedcb').observe('click',function(ev){
  159. if($('malformedcb').checked)
  160. {
  161. $('malformed').show();
  162. }
  163. else
  164. {
  165. $('malformed').hide();
  166. }
  167. });
  168. $('CSV:headerline').observe('blur',function()
  169. {
  170. var wellformed=($F('CSV:headerline')=="1" || $F('CSV:headerline')=="");
  171. if(wellformed)
  172. {
  173. $('malformedcb').checked=false;
  174. $('malformed').hide();
  175. $('CSV:headerline').value="";
  176. }
  177. });
  178. $('CSV:importmode').observe('change',function()
  179. {
  180. if($F('CSV:importmode')=='local')
  181. {
  182. $('localcsv').show();
  183. $('remotecsv').hide();
  184. }
  185. else
  186. {
  187. $('localcsv').hide();
  188. $('remotecsv').show();
  189. }
  190. });
  191. $('CSV:remoteauth').observe('click',handle_auth);
  192. $('CSV:remoteurl').observe('blur',handle_auth);
  193. </script>