[ Index ]
 

Code source de Zen Cart E-Commerce Shopping Cart 1.3.7.1

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/includes/modules/pages/advanced_search/ -> jscript_main.php (source)

   1  <?php
   2  //

   3  // +----------------------------------------------------------------------+

   4  // |zen-cart Open Source E-commerce                                       |

   5  // +----------------------------------------------------------------------+

   6  // | Copyright (c) 2003 The zen-cart developers                           |

   7  // |                                                                      |   

   8  // | http://www.zen-cart.com/index.php                                    |   

   9  // |                                                                      |   

  10  // | Portions Copyright (c) 2003 osCommerce                               |

  11  // +----------------------------------------------------------------------+

  12  // | This source file is subject to version 2.0 of the GPL license,       |

  13  // | that is bundled with this package in the file LICENSE, and is        |

  14  // | available through the world-wide-web at the following url:           |

  15  // | http://www.zen-cart.com/license/2_0.txt.                             |

  16  // | If you did not receive a copy of the zen-cart license and are unable |

  17  // | to obtain it through the world-wide-web, please send a note to       |

  18  // | license@zen-cart.com so we can mail you a copy immediately.          |

  19  // +----------------------------------------------------------------------+

  20  // $Id: jscript_main.php 345 2004-09-27 19:59:38Z wilt $

  21  //

  22  ?>
  23  <script language="javascript" src="includes/general.js" type="text/javascript"></script>
  24  <script language="javascript" type="text/javascript"><!--
  25  function check_form() {
  26    var error_message = "<?php echo JS_ERROR; ?>";
  27    var error_found = false;
  28    var error_field;
  29    var keyword = document.advanced_search.keyword.value;
  30    var dfrom = document.advanced_search.dfrom.value;
  31    var dto = document.advanced_search.dto.value;
  32    var pfrom = document.advanced_search.pfrom.value;
  33    var pto = document.advanced_search.pto.value;
  34    var pfrom_float;
  35    var pto_float;
  36  
  37    if ( ((keyword == '') || (keyword.length < 1)) && ((dfrom == '') || (dfrom == '<?php echo DOB_FORMAT_STRING; ?>') || (dfrom.length < 1)) && ((dto == '') || (dto == '<?php echo DOB_FORMAT_STRING; ?>') || (dto.length < 1)) && ((pfrom == '') || (pfrom.length < 1)) && ((pto == '') || (pto.length < 1)) ) {
  38      error_message = error_message + "* <?php echo ERROR_AT_LEAST_ONE_INPUT; ?>\n";
  39      error_field = document.advanced_search.keyword;
  40      error_found = true;
  41    }
  42  
  43    if ((dfrom.length > 0) && (dfrom != '<?php echo DOB_FORMAT_STRING; ?>')) {
  44      if (!IsValidDate(dfrom, '<?php echo DOB_FORMAT_STRING; ?>')) {
  45        error_message = error_message + "* <?php echo ERROR_INVALID_FROM_DATE; ?>\n";
  46        error_field = document.advanced_search.dfrom;
  47        error_found = true;
  48      }
  49    }
  50  
  51    if ((dto.length > 0) && (dto != '<?php echo DOB_FORMAT_STRING; ?>')) {
  52      if (!IsValidDate(dto, '<?php echo DOB_FORMAT_STRING; ?>')) {
  53        error_message = error_message + "* <?php echo ERROR_INVALID_TO_DATE; ?>\n";
  54        error_field = document.advanced_search.dto;
  55        error_found = true;
  56      }
  57    }
  58  
  59    if ((dfrom.length > 0) && (dfrom != '<?php echo DOB_FORMAT_STRING; ?>') && (IsValidDate(dfrom, '<?php echo DOB_FORMAT_STRING; ?>')) && (dto.length > 0) && (dto != '<?php echo DOB_FORMAT_STRING; ?>') && (IsValidDate(dto, '<?php echo DOB_FORMAT_STRING; ?>'))) {
  60      if (!CheckDateRange(document.advanced_search.dfrom, document.advanced_search.dto)) {
  61        error_message = error_message + "* <?php echo ERROR_TO_DATE_LESS_THAN_FROM_DATE; ?>\n";
  62        error_field = document.advanced_search.dto;
  63        error_found = true;
  64      }
  65    }
  66  
  67    if (pfrom.length > 0) {
  68      pfrom_float = parseFloat(pfrom);
  69      if (isNaN(pfrom_float)) {
  70        error_message = error_message + "* <?php echo ERROR_PRICE_FROM_MUST_BE_NUM; ?>\n";
  71        error_field = document.advanced_search.pfrom;
  72        error_found = true;
  73      }
  74    } else {
  75      pfrom_float = 0;
  76    }
  77  
  78    if (pto.length > 0) {
  79      pto_float = parseFloat(pto);
  80      if (isNaN(pto_float)) {
  81        error_message = error_message + "* <?php echo ERROR_PRICE_TO_MUST_BE_NUM; ?>\n";
  82        error_field = document.advanced_search.pto;
  83        error_found = true;
  84      }
  85    } else {
  86      pto_float = 0;
  87    }
  88  
  89    if ( (pfrom.length > 0) && (pto.length > 0) ) {
  90      if ( (!isNaN(pfrom_float)) && (!isNaN(pto_float)) && (pto_float < pfrom_float) ) {
  91        error_message = error_message + "* <?php echo ERROR_PRICE_TO_LESS_THAN_PRICE_FROM; ?>\n";
  92        error_field = document.advanced_search.pto;
  93        error_found = true;
  94      }
  95    }
  96  
  97    if (error_found == true) {
  98      alert(error_message);
  99      error_field.focus();
 100      return false;
 101    } else {
 102      RemoveFormatString(document.advanced_search.dfrom, "<?php echo DOB_FORMAT_STRING; ?>");
 103      RemoveFormatString(document.advanced_search.dto, "<?php echo DOB_FORMAT_STRING; ?>");
 104      return true;
 105    }
 106  }
 107  
 108  function popupWindow(url) {
 109    window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=450,height=280,screenX=150,screenY=150,top=150,left=150')
 110  }
 111  //--></script>


Généré le : Mon Nov 26 16:45:43 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics