diff --git a/admin-dev/ajax.php b/admin-dev/ajax.php index 95a11d3c1..abe23a12e 100644 --- a/admin-dev/ajax.php +++ b/admin-dev/ajax.php @@ -557,6 +557,11 @@ if (Tools::isSubmit('helpAccess')) if (Tools::isSubmit('getHookableList')) { + /* PrestaShop demo mode */ + if (_PS_MODE_DEMO_) + die('{"hasError" : true, "errors" : ["Live Edit : This functionnality has been disabled"]}'); + /* PrestaShop demo mode*/ + if (!strlen(Tools::getValue('hooks_list'))) die('{"hasError" : true, "errors" : ["Live Edit : no module on this page"]}'); @@ -589,6 +594,10 @@ if (Tools::isSubmit('getHookableList')) if (Tools::isSubmit('getHookableModuleList')) { + /* PrestaShop demo mode */ + if (_PS_MODE_DEMO_) + die('{"hasError" : true, "errors" : ["Live Edit : This functionnality has been disabled"]}'); + /* PrestaShop demo mode*/ include('../init.php'); $hook_name = Tools::getValue('hook'); @@ -609,6 +618,11 @@ if (Tools::isSubmit('getHookableModuleList')) if (Tools::isSubmit('saveHook')) { + /* PrestaShop demo mode */ + if (_PS_MODE_DEMO_) + die('{"hasError" : true, "errors" : ["Live Edit : This functionnality has been disabled"]}'); + /* PrestaShop demo mode*/ + $hooks_list = explode(',', Tools::getValue('hooks_list')); $id_shop = (int)Tools::getValue('id_shop'); if ($id_shop) @@ -627,10 +641,15 @@ if (Tools::isSubmit('saveHook')) $hookedModules = explode(',', Tools::getValue($hook)); $i = 1; $value = ''; + $ids = array(); foreach ($hookedModules as $module) { - $ids = explode('_', $module); - $value .= '('.(int)$ids[1].', '.$id_shop.', (SELECT id_hook FROM '._DB_PREFIX_.'hook WHERE `name` = \''.pSQL($hook).'\' LIMIT 1), '.(int)$i.'),'; + $id = explode('_', $module); + if (!in_array($id[1], $ids)) + { + $ids[] = $id[1]; + $value .= '('.(int)$id[1].', (SELECT id_hook FROM `'._DB_PREFIX_.'hook` WHERE `name` = \''.pSQL($hook).'\' LIMIT 0, 1), '.(int)$i.'),'; + } $i++; } $value = rtrim($value, ','); diff --git a/admin-dev/ajaxfilemanager/ajax_save_text.php b/admin-dev/ajaxfilemanager/ajax_save_text.php index dd547366c..cde34f1a7 100755 --- a/admin-dev/ajaxfilemanager/ajax_save_text.php +++ b/admin-dev/ajaxfilemanager/ajax_save_text.php @@ -84,8 +84,8 @@ $error = TXT_UNKNOWN_REQUEST; } echo "{"; - echo "error:'" . $error . "',\n"; - echo "path:'" . $path . "'"; + echo "error:'" . Tools::safeOutput($error) . "',\n"; + echo "path:'" . Tools::safeOutput($path) . "'"; echo "}"; -?> \ No newline at end of file +?> diff --git a/admin-dev/init.php b/admin-dev/init.php index d054fbb81..937f585f8 100644 --- a/admin-dev/init.php +++ b/admin-dev/init.php @@ -96,4 +96,4 @@ if ($context->cookie->shopContext) if (count($split) == 2 && $split[0] == 's') $shopID = (int)$split[1]; } -$context->shop = new Shop($shopID); +$context->shop = new Shop($shopID); \ No newline at end of file diff --git a/admin-dev/tabs/AdminUpgrade.php b/admin-dev/tabs/AdminUpgrade.php index 05b769ac5..f6bd55a46 100644 --- a/admin-dev/tabs/AdminUpgrade.php +++ b/admin-dev/tabs/AdminUpgrade.php @@ -433,7 +433,7 @@ class AdminUpgrade extends AdminPreferences else { $this->next = 'download'; - $this->nextDesc = $this->l('Shop desactivated. Now downloading (this can takes some times )...'); + $this->nextDesc = $this->l('Shop deactivated. Now downloading (this can takes some times )...'); } } diff --git a/classes/Address.php b/classes/Address.php index 9b2a8f974..395c407ee 100644 --- a/classes/Address.php +++ b/classes/Address.php @@ -135,7 +135,8 @@ class AddressCore extends ObjectModel /* Get and cache address country name */ if ($this->id) { - $result = Db::getInstance()->getRow('SELECT `name` FROM `'._DB_PREFIX_.'country_lang` + $result = Db::getInstance()->getRow(' + SELECT `name` FROM `'._DB_PREFIX_.'country_lang` WHERE `id_country` = '.(int)$this->id_country.' AND `id_lang` = '.($id_lang ? (int)$id_lang : Configuration::get('PS_LANG_DEFAULT'))); $this->country = $result['name']; diff --git a/classes/AdminTab.php b/classes/AdminTab.php index 23b273101..0336d8acc 100644 --- a/classes/AdminTab.php +++ b/classes/AdminTab.php @@ -483,8 +483,8 @@ abstract class AdminTabCore $this->_childValidation(); /* Checking for fields validity */ - foreach ($rules['validate'] as $field => $function) - if (($value = Tools::getValue($field)) !== false && ($field != 'passwd')) + foreach ($rules['validate'] AS $field => $function) + if (($value = Tools::getValue($field)) !== false AND !empty($value) AND ($field != 'passwd')) if (!Validate::$function($value)) $this->_errors[] = $this->l('the field').' '.call_user_func(array($className, 'displayFieldName'), $field, $className).' '.$this->l('is invalid'); diff --git a/classes/CMS.php b/classes/CMS.php index f63e7a272..a8df4d8b0 100644 --- a/classes/CMS.php +++ b/classes/CMS.php @@ -45,6 +45,11 @@ class CMSCore extends ObjectModel protected $table = 'cms'; protected $identifier = 'id_cms'; + protected $webserviceParameters = array( + 'objectNodeName' => 'content', + 'objectsNodeName' => 'content_management_system', + ); + public function getFields() { $this->validateFields(); diff --git a/classes/Category.php b/classes/Category.php index 24a6e84f8..5091c635a 100644 --- a/classes/Category.php +++ b/classes/Category.php @@ -177,7 +177,7 @@ class CategoryCore extends ObjectModel public function add($autodate = true, $nullValues = false) { $this->position = self::getLastPosition((int)$this->id_parent); - if (!isset($this->level_depth) || $this->level_depth != 0) + if (!isset($this->level_depth)) $this->level_depth = $this->calcLevelDepth(); $ret = parent::add($autodate); if (!isset($this->doNotRegenerateNTree) || !$this->doNotRegenerateNTree) diff --git a/classes/Chart.php b/classes/Chart.php index f6f3c0f01..60b2e29d6 100644 --- a/classes/Chart.php +++ b/classes/Chart.php @@ -108,7 +108,7 @@ class ChartCore $options = 'xaxis:{mode:"time",timeformat:\''.addslashes($this->format).'\',min:'.$this->from.'000,max:'.$this->to.'000}'; if ($this->granularity == 'd') foreach ($this->curves as $curve) - for ($i = $this->from; $i <= $this->to; $i += 86400) + for ($i = $this->from; $i <= $this->to; $i = strtotime('+1 day', $i)) if (!$curve->getPoint($i)) $curve->setPoint($i, 0); } diff --git a/classes/CompareProduct.php b/classes/CompareProduct.php index ba63fef51..98a323a29 100644 --- a/classes/CompareProduct.php +++ b/classes/CompareProduct.php @@ -1,6 +1,6 @@ 'isUnsignedInt', - 'id_guest' => 'isUnsignedInt', + 'id_compare' => 'isUnsignedInt', 'id_customer' => 'isUnsignedInt' ); - - protected $table = 'compare_product'; - - protected $identifier = 'id_compare_product'; - - - /** - * Get all compare products of the guest - * @param int $id_guest - * @return array - */ - public static function getGuestCompareProducts($id_guest) - { - $results = Db::getInstance()->executeS(' - SELECT DISTINCT `id_product` - FROM `'._DB_PREFIX_.'compare_product` - WHERE `id_guest` = '.(int)($id_guest)); - - $compareProducts = null; - - if ($results) - foreach($results as $result) - $compareProducts[] = $result['id_product']; - - return $compareProducts; - } - - - /** - * Add a compare product for the guest - * @param int $id_guest, int $id_product - * @return boolean - */ - public static function addGuestCompareProduct($id_guest, $id_product) - { - return Db::getInstance()->execute(' - INSERT INTO `'._DB_PREFIX_.'compare_product` (`id_product`, `id_guest`, `id_customer`, `date_add`, `date_upd`) - VALUES ('.(int)($id_product).', '.(int)($id_guest).', 0, NOW(), NOW()) - '); - } - - - /** - * Remove a compare product for the guest - * @param int $id_guest, int $id_product - * @return boolean - */ - public static function removeGuestCompareProduct($id_guest, $id_product) - { - return Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'compare_product` WHERE `id_guest` = '.(int)($id_guest).' AND `id_product` = '.(int)($id_product)); - } - - - /** - * Get the number of compare products of the guest - * @param int $id_guest - * @return int - */ - public static function getGuestNumberProducts($id_guest) - { - return (int)(Db::getInstance()->getValue(' - SELECT count(`id_compare_product`) - FROM `'._DB_PREFIX_.'compare_product` - WHERE `id_guest` = '.(int)($id_guest)));; - } - + protected $table = 'compare'; + + protected $identifier = 'id_compare'; + + /** * Get all comapare products of the customer * @param int $id_customer * @return array */ - public static function getCustomerCompareProducts($id_customer) + public static function getCompareProducts($id_compare) { $results = Db::getInstance()->executeS(' SELECT DISTINCT `id_product` - FROM `'._DB_PREFIX_.'compare_product` - WHERE `id_customer` = '.(int)($id_customer)); - + FROM `'._DB_PREFIX_.'compare` c + LEFT JOIN `'._DB_PREFIX_.'compare_product` cp ON (cp.`id_compare` = c.`id_compare`) + WHERE cp.`id_compare` = '.(int)($id_compare)); + $compareProducts = null; - + if ($results) foreach($results as $result) $compareProducts[] = $result['id_product']; - - return $compareProducts; + + return $compareProducts; } - - + + /** * Add a compare product for the customer * @param int $id_customer, int $id_product * @return boolean */ - public static function addCustomerCompareProduct($id_customer, $id_product) + public static function addCompareProduct($id_compare, $id_product) { + if (!$id_compare) + { + $id_customer = false; + if (Context::getContext()->customer) + $id_customer = Context::getContext()->customer->id; + $sql = Db::getInstance()->execute(' + INSERT INTO `'._DB_PREFIX_.'compare` (`id_compare`, `id_customer`) VALUES (NULL, "'.($id_customer ? $id_customer: '0').'")'); + if ($sql) + { + $id_compare = Db::getInstance()->getValue('SELECT MAX(`id_compare`) FROM `'._DB_PREFIX_.'compare`'); + $cookie->id_compare = $id_compare; + } + } return Db::getInstance()->execute(' - INSERT INTO `'._DB_PREFIX_.'compare_product` (`id_product`, `id_guest`, `id_customer`, `date_add`, `date_upd`) - VALUES ('.(int)($id_product).', 0, '.(int)($id_customer).', NOW(), NOW())'); + INSERT INTO `'._DB_PREFIX_.'compare_product` (`id_compare`, `id_product`, `date_add`, `date_upd`) + VALUES ('.(int)($id_compare).', '.(int)($id_product).', NOW(), NOW())'); } - - + /** * Remove a compare product for the customer - * @param int $id_customer, int $id_product + * @param int $id_compare, int $id_product * @return boolean */ - public static function removeCustomerCompareProduct($id_customer, $id_product) + public static function removeCompareProduct($id_compare, $id_product) { - return Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'compare_product` WHERE `id_customer` = '.(int)($id_customer).' AND `id_product` = '.(int)($id_product)); - } - - + return Db::getInstance()->execute(' + DELETE cp FROM `'._DB_PREFIX_.'compare_product` cp, `'._DB_PREFIX_.'compare` c + WHERE cp.`id_compare`=c.`id_compare` + AND cp.`id_product` = '.(int)$id_product.' + AND c.`id_compare` = '.(int)$id_compare); + } + /** * Get the number of compare products of the customer - * @param int $id_customer + * @param int $id_compare * @return int */ - public static function getCustomerNumberProducts($id_customer) + public static function getNumberProducts($id_compare) { return (int)(Db::getInstance()->getValue(' - SELECT count(`id_compare_product`) + SELECT count(`id_compare`) FROM `'._DB_PREFIX_.'compare_product` - WHERE `id_customer` = '.(int)($id_customer))); + WHERE `id_compare` = '.(int)($id_compare))); } - - + + /** * Clean entries which are older than the period * @param string $period @@ -191,12 +140,25 @@ class CompareProductCore extends ObjectModel $interval = '1 YEAR'; else return; - + if ($interval != null) { Db::getInstance()->execute(' - DELETE FROM `'._DB_PREFIX_.'compare_product` - WHERE date_upd < DATE_SUB(NOW(), INTERVAL '.pSQL($interval).')'); + DELETE cp, c FROM `'._DB_PREFIX_.'compare_product` cp, `'._DB_PREFIX_.'compare` c + WHERE cp.date_upd < DATE_SUB(NOW(), INTERVAL 1 WEEK) AND c.`id_compare`=cp.`id_compare`'); } } + + /** + * Get the id_compare by id_customer + * @param integer $id_customer + * @return integer $id_compare + */ + public static function getIdCompareByIdCustomer($id_customer) + { + return (int)Db::getInstance()->getValue(' + SELECT `id_compare` + FROM `'._DB_PREFIX_.'compare` + WHERE `id_customer`= '.(int)$id_customer); + } } \ No newline at end of file diff --git a/classes/Cookie.php b/classes/Cookie.php index ada4f2042..09d6fbfd6 100644 --- a/classes/Cookie.php +++ b/classes/Cookie.php @@ -220,6 +220,7 @@ class CookieCore */ public function mylogout() { + unset($this->_content['id_compare']); unset($this->_content['id_customer']); unset($this->_content['id_guest']); unset($this->_content['is_guest']); diff --git a/classes/FrontController.php b/classes/FrontController.php index 80db63d7f..df3424bf1 100755 --- a/classes/FrontController.php +++ b/classes/FrontController.php @@ -614,6 +614,8 @@ class FrontControllerCore extends Controller $this->context = Context::getContext(); $nArray = (int)(Configuration::get('PS_PRODUCTS_PER_PAGE')) != 10 ? array((int)(Configuration::get('PS_PRODUCTS_PER_PAGE')), 10, 20, 50) : array(10, 20, 50); + // Clean duplicate values + $nArray = array_unique($nArray); asort($nArray); $this->n = abs((int)(Tools::getValue('n', ((isset($this->context->cookie->nb_item_per_page) AND $this->context->cookie->nb_item_per_page >= 10) ? $this->context->cookie->nb_item_per_page : (int)(Configuration::get('PS_PRODUCTS_PER_PAGE')))))); $this->p = abs((int)(Tools::getValue('p', 1))); diff --git a/classes/Group.php b/classes/Group.php index 8af9ef41b..42ae01e15 100644 --- a/classes/Group.php +++ b/classes/Group.php @@ -112,12 +112,12 @@ class GroupCore extends ObjectModel public static function getReduction($id_customer = null) { - if (!isset(self::$cache_reduction['customer'][(int)$id_customer])) - self::$cache_reduction['customer'][(int)$id_customer] = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue(' - SELECT `reduction` - FROM `'._DB_PREFIX_.'group` - WHERE `id_group` = '.((int)$id_customer ? Customer::getDefaultGroupId((int)$id_customer) : (int)Configuration::get('PS_CUSTOMER_GROUP'))); - return self::$cache_reduction['customer'][(int)$id_customer]; + if (!isset(self::$_cacheReduction['customer'][(int)$id_customer])) + { + $id_group = $id_customer ? Customer::getDefaultGroupId((int)$id_customer) : (int)Configuration::get('PS_CUSTOMER_GROUP'); + self::$_cacheReduction['customer'][(int)$id_customer] = Group::getReductionByIdGroup($id_group); + } + return self::$_cacheReduction['customer'][(int)$id_customer]; } public static function getReductionByIdGroup($id_group) @@ -256,7 +256,7 @@ class GroupCore extends ObjectModel * @param integer authorized */ public static function addModulesRestrictions($id_group, $modules, $authorized) - { + { if (!is_array($modules) AND !empty($modules)) return false; else diff --git a/classes/GroupReduction.php b/classes/GroupReduction.php index a3c05dfca..b301b9b0d 100644 --- a/classes/GroupReduction.php +++ b/classes/GroupReduction.php @@ -170,7 +170,7 @@ class GroupReductionCore extends ObjectModel public static function setProductReduction($id_product, $id_group, $id_category, $reduction) { $row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow(' - SELECT pgr.`id_product`, pgr.`id_group`, pgr.`reduction` + SELECT pgr.`id_product`, pgr.`id_group`, pgr.`reduction` FROM `'._DB_PREFIX_.'product_group_reduction_cache` pgr WHERE pgr.`id_product` = '.(int)$id_product ); @@ -197,7 +197,7 @@ class GroupReductionCore extends ObjectModel public static function duplicateReduction($id_product_old, $id_product) { $row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow(' - SELECT pgr.`id_product`, pgr.`id_group`, pgr.`reduction` + SELECT pgr.`id_product`, pgr.`id_group`, pgr.`reduction` FROM `'._DB_PREFIX_.'product_group_reduction_cache` pgr WHERE pgr.`id_product` = '.(int)$id_product_old ); @@ -216,4 +216,4 @@ class GroupReductionCore extends ObjectModel return false; return true; } -} \ No newline at end of file +} diff --git a/classes/ObjectModel.php b/classes/ObjectModel.php index 2f6b6a86b..9380368aa 100644 --- a/classes/ObjectModel.php +++ b/classes/ObjectModel.php @@ -148,8 +148,7 @@ abstract class ObjectModelCore $this->id = (int)($id); foreach ($result AS $key => $value) if (key_exists($key, $this)) - // Todo: stripslashes() MUST BE removed in 1.4.6 and later, but is kept in 1.4.5 for a compatibility issue - $this->{$key} = stripslashes($value); + $this->{$key} = $value; if (!$id_lang AND method_exists($this, 'getTranslationsFieldsChild')) { diff --git a/classes/PDF.php b/classes/PDF.php index a3586eebd..c1970cd11 100644 --- a/classes/PDF.php +++ b/classes/PDF.php @@ -631,6 +631,22 @@ class PDFCore extends PDF_PageGroupCore $pdf->Ln(15); $pdf->ProdTab((self::$delivery ? true : '')); + + + /* Canada */ + $taxable_address = new Address((int)self::$order->{Configuration::get('PS_TAX_ADDRESS_TYPE')}); + if (!self::$delivery && strtoupper(Country::getIsoById((int)$taxable_address->id_country)) == 'CA') + { + $pdf->Ln(15); + $taxToDisplay = Db::getInstance()->ExecuteS('SELECT * FROM '._DB_PREFIX_.'order_tax WHERE id_order = '.(int)self::$order->id); + foreach ($taxToDisplay AS $t) + { + $pdf->Cell(0, 6, utf8_decode($t['tax_name']).' ('.number_format($t['tax_rate'], 2, '.', '').'%) '.self::convertSign(Tools::displayPrice($t['amount'], self::$currency, true)), 0, 0, 'R'); + $pdf->Ln(5); + } + } + /* End */ + /* Exit if delivery */ if (!self::$delivery) { @@ -1055,8 +1071,10 @@ class PDFCore extends PDF_PageGroupCore */ public function TaxTab(&$priceBreakDown) { + $taxable_address = new Address((int)self::$order->{Configuration::get('PS_TAX_ADDRESS_TYPE')}); + if (strtoupper(Country::getIsoById((int)$taxable_address->id_country)) == 'CA') + return; - $invoiceAddress = new Address(self::$order->id_address_invoice); if (Configuration::get('VATNUMBER_MANAGEMENT') AND !empty($invoiceAddress->vat_number) AND $invoiceAddress->id_country != Configuration::get('VATNUMBER_COUNTRY')) { $this->Ln(); diff --git a/classes/PaymentModule.php b/classes/PaymentModule.php index ef8c0d1b1..2e8571e81 100644 --- a/classes/PaymentModule.php +++ b/classes/PaymentModule.php @@ -34,7 +34,7 @@ abstract class PaymentModuleCore extends Module /* @var object PaymentCC */ public $pcc = null; - + public function install() { if (!parent::install()) @@ -78,14 +78,14 @@ abstract class PaymentModuleCore extends Module return false; return parent::uninstall(); } - + public function __construct() { $this->pcc = new PaymentCC(); - + parent::__construct(); } - + public function __destruct() { unset($this->pcc); @@ -101,12 +101,12 @@ abstract class PaymentModuleCore extends Module * @param string $paymentMethod Payment method (eg. 'Credit card') * @param string $message Message to attach to order */ - public function validateOrder($id_cart, $id_order_state, $amountPaid, $paymentMethod = 'Unknown', - $message = NULL, $extraVars = array(), $currency_special = NULL, $dont_touch_amount = false, + public function validateOrder($id_cart, $id_order_state, $amountPaid, $paymentMethod = 'Unknown', + $message = NULL, $extraVars = array(), $currency_special = NULL, $dont_touch_amount = false, $secure_key = false, Shop $shop = null) { $cart = new Cart((int)($id_cart)); - + if (!$shop) $shop = Context::getContext()->shop; // Does order already exists ? @@ -114,7 +114,7 @@ abstract class PaymentModuleCore extends Module { if ($secure_key !== false AND $secure_key != $cart->secure_key) die(Tools::displayError()); - + // For each package, generate an order $delivery_option_list = $cart->getDeliveryOptionList(); $package_list = $cart->getPackageList(); @@ -128,27 +128,27 @@ abstract class PaymentModuleCore extends Module $cart_delivery_option[$id_address] = $key; break; } - + $order_list = array(); $order_detail_list = array(); $reference = Order::generateReference(); $this->currentOrderReference = $reference; - + $id_currency = $currency_special ? (int)($currency_special) : (int)($cart->id_currency); $currency = new Currency($id_currency); - + $this->context->cart->order_reference = $reference; - + $orderCreationFailed = false; $cart_total_paid = (float)Tools::ps_round((float)($cart->getOrderTotal(true, Cart::BOTH)), 2); - + if ($cart->orderExists()) { $errorMessage = Tools::displayError('An order has already been placed using this cart.'); Logger::addLog($errorMessage, 4, '0000001', 'Cart', intval($cart->id)); die($errorMessage); } - + foreach ($cart_delivery_option as $id_address => $key_carriers) foreach ($delivery_option_list[$id_address][$key_carriers]['carrier_list'] as $id_carrier => $data) foreach ($data['package_list'] as $id_package) @@ -166,10 +166,10 @@ abstract class PaymentModuleCore extends Module $order->id_warehouse = $package_list[$id_address][$id_package]['id_warehouse']; $order->id_cart = (int)($cart->id); $order->reference = $reference; - + $order->id_shop = (int)($shop->getID() ? $shop->getID() : $cart->id_shop); $order->id_group_shop = (int)($shop->getID() ? $shop->getGroupID() : $cart->id_group_shop); - + $customer = new Customer((int)($order->id_customer)); $order->secure_key = ($secure_key ? pSQL($secure_key) : pSQL($customer->secure_key)); $order->payment = $paymentMethod; @@ -191,18 +191,18 @@ abstract class PaymentModuleCore extends Module $order->total_shipping = (float)$cart->getPackageShippingCost((int)$id_carrier, true, null, $product_list, $id_carrier); $order->total_shipping_tax_excl = (float)$cart->getPackageShippingCost((int)$id_carrier, false, null, $product_list, $id_carrier); $order->total_shipping_tax_incl = (float)$cart->getPackageShippingCost((int)$id_carrier, true, null, $product_list, $id_carrier); - + if (Validate::isLoadedObject($carrier)) $order->carrier_tax_rate = $carrier->getTaxesRate(new Address($cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')})); - + $order->total_wrapping = (float)abs($cart->getOrderTotal(true, Cart::ONLY_WRAPPING, $product_list, $id_carrier)); $order->total_wrapping_tax_excl = (float)abs($cart->getOrderTotal(false, Cart::ONLY_WRAPPING, $product_list, $id_carrier)); $order->total_wrapping_tax_incl = (float)abs($cart->getOrderTotal(true, Cart::ONLY_WRAPPING, $product_list, $id_carrier)); - + $order->total_paid = (float)Tools::ps_round((float)($cart->getOrderTotal(true, Cart::BOTH, $product_list, $id_carrier)), 2); $order->total_paid_tax_excl = (float)Tools::ps_round((float)($cart->getOrderTotal(false, Cart::BOTH, $product_list, $id_carrier)), 2); $order->total_paid_tax_incl = (float)Tools::ps_round((float)($cart->getOrderTotal(true, Cart::BOTH, $product_list, $id_carrier)), 2); - + $order->invoice_date = '0000-00-00 00:00:00'; $order->delivery_date = '0000-00-00 00:00:00'; // Amount paid by customer is not the right one -> Status = payment error @@ -211,12 +211,12 @@ abstract class PaymentModuleCore extends Module // We use number_format in order to compare two string if (number_format($cart_total_paid, 2) != number_format($order->total_paid_real, 2)) $id_order_state = Configuration::get('PS_OS_ERROR'); - + // Creating order $result = $order->add(); $order_list[] = $order; - + // Insert new Order detail list using cart for the current order $order_detail = new OrderDetail(null, null, $this->context); $order_detail->createList($order, $cart, $id_order_state, $product_list); @@ -249,17 +249,109 @@ abstract class PaymentModuleCore extends Module // Insert new Order detail list using cart for the current order //$orderDetail = new OrderDetail(null, null, $this->context); //$orderDetail->createList($order, $cart, $id_order_state); - + //$this->addPCC($order->id, $order->id_currency, $amountPaid); - + // Construct order detail table for the email $productsList = ''; $products = $cart->getProducts(); + + $storeAllTaxes = array(); + foreach ($products AS $key => $product) { $price = Product::getPriceStatic((int)($product['id_product']), false, ($product['id_product_attribute'] ? (int)($product['id_product_attribute']) : NULL), 6, NULL, false, true, $product['cart_quantity'], false, (int)($order->id_customer), (int)($order->id_cart), (int)($order->{Configuration::get('PS_TAX_ADDRESS_TYPE')})); $price_wt = Product::getPriceStatic((int)($product['id_product']), true, ($product['id_product_attribute'] ? (int)($product['id_product_attribute']) : NULL), 2, NULL, false, true, $product['cart_quantity'], false, (int)($order->id_customer), (int)($order->id_cart), (int)($order->{Configuration::get('PS_TAX_ADDRESS_TYPE')})); - + + /* Store tax info */ + $id_country = (int)Country::getDefaultCountryId(); + $id_state = 0; + $id_county = 0; + $rate = 0; + $id_address = $cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')}; + $address_infos = Address::getCountryAndState($id_address); + if ($address_infos['id_country']) + { + $id_country = (int)($address_infos['id_country']); + $id_state = (int)$address_infos['id_state']; + $id_county = (int)County::getIdCountyByZipCode($address_infos['id_state'], $address_infos['postcode']); + } + $allTaxes = TaxRulesGroup::getTaxes((int)Product::getIdTaxRulesGroupByIdProduct((int)$product['id_product']), $id_country, $id_state, $id_county); + $nTax = 0; + foreach ($allTaxes AS $res) + { + if (!isset($storeAllTaxes[$res->id])) + $storeAllTaxes[$res->id] = array(); + $storeAllTaxes[$res->id]['name'] = $res->name[(int)$order->id_lang]; + $storeAllTaxes[$res->id]['rate'] = $res->rate; + + if (!$nTax++) + $storeAllTaxes[$res->id]['amount'] = ($price * (1 + ($res->rate * 0.01))) - $price; + else + { + $priceTmp = $price_wt / (1 + ($res->rate * 0.01)); + $storeAllTaxes[$res->id]['amount'] = $price_wt - $priceTmp; + } + } + /* End */ + + // Add some informations for virtual products + $deadline = '0000-00-00 00:00:00'; + $download_hash = NULL; + if ($id_product_download = ProductDownload::getIdFromIdProduct((int)($product['id_product']))) + { + $productDownload = new ProductDownload((int)($id_product_download)); + $deadline = $productDownload->getDeadLine(); + $download_hash = $productDownload->getHash(); + } + + // Exclude VAT + if (Tax::excludeTaxeOption()) + { + $product['tax'] = 0; + $product['rate'] = 0; + $tax_rate = 0; + } + else + $tax_rate = Tax::getProductTaxRate((int)($product['id_product']), $cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')}); + + $ecotaxTaxRate = 0; + if (!empty($product['ecotax'])) + $ecotaxTaxRate = Tax::getProductEcotaxRate($order->{Configuration::get('PS_TAX_ADDRESS_TYPE')}); + + $product_price = (float)Product::getPriceStatic((int)($product['id_product']), false, ($product['id_product_attribute'] ? (int)($product['id_product_attribute']) : NULL), (Product::getTaxCalculationMethod((int)($order->id_customer)) == PS_TAX_EXC ? 2 : 6), NULL, false, false, $product['cart_quantity'], false, (int)($order->id_customer), (int)($order->id_cart), (int)($order->{Configuration::get('PS_TAX_ADDRESS_TYPE')}), $specificPrice, false, false); + + $group_reduction = (float)GroupReduction::getValueForProduct((int)$product['id_product'], $customer->id_default_group) * 100; + if (!$group_reduction) + $group_reduction = Group::getReduction((int)$order->id_customer); + + $quantityDiscount = SpecificPrice::getQuantityDiscount((int)$product['id_product'], Shop::getCurrentShop(), (int)$cart->id_currency, (int)$vat_address->id_country, (int)$customer->id_default_group, (int)$product['cart_quantity']); + $unitPrice = Product::getPriceStatic((int)$product['id_product'], true, ($product['id_product_attribute'] ? intval($product['id_product_attribute']) : NULL), 2, NULL, false, true, 1, false, (int)$order->id_customer, NULL, (int)$order->{Configuration::get('PS_TAX_ADDRESS_TYPE')}); + $quantityDiscountValue = $quantityDiscount ? ((Product::getTaxCalculationMethod((int)$order->id_customer) == PS_TAX_EXC ? Tools::ps_round($unitPrice, 2) : $unitPrice) - $quantityDiscount['price'] * (1 + $tax_rate / 100)) : 0.00; + $query .= '('.(int)($order->id).', + '.(int)($product['id_product']).', + '.(isset($product['id_product_attribute']) ? (int)($product['id_product_attribute']) : 'NULL').', + \''.pSQL($product['name'].((isset($product['attributes']) AND $product['attributes'] != NULL) ? ' - '.$product['attributes'] : '')).'\', + '.(int)($product['cart_quantity']).', + '.$quantityInStock.', + '.$product_price.', + '.(float)(($specificPrice AND $specificPrice['reduction_type'] == 'percentage') ? $specificPrice['reduction'] * 100 : 0.00).', + '.(float)(($specificPrice AND $specificPrice['reduction_type'] == 'amount') ? (!$specificPrice['id_currency'] ? Tools::convertPrice($specificPrice['reduction'], $order->id_currency) : $specificPrice['reduction']) : 0.00).', + '.$group_reduction.', + '.$quantityDiscountValue.', + '.(empty($product['ean13']) ? 'NULL' : '\''.pSQL($product['ean13']).'\'').', + '.(empty($product['upc']) ? 'NULL' : '\''.pSQL($product['upc']).'\'').', + '.(empty($product['reference']) ? 'NULL' : '\''.pSQL($product['reference']).'\'').', + '.(empty($product['supplier_reference']) ? 'NULL' : '\''.pSQL($product['supplier_reference']).'\'').', + '.(float)($product['id_product_attribute'] ? $product['weight_attribute'] : $product['weight']).', + \''.(empty($tax_rate) ? '' : pSQL($product['tax'])).'\', + '.(float)($tax_rate).', + '.(float)Tools::convertPrice(floatval($product['ecotax']), intval($order->id_currency)).', + '.(float)$ecotaxTaxRate.', + '.(($specificPrice AND $specificPrice['from_quantity'] > 1) ? 1 : 0).', + \''.pSQL($deadline).'\', + \''.pSQL($download_hash).'\'),'; + $customizationQuantity = 0; if (isset($customizedDatas[$product['id_product']][$product['id_product_attribute']])) { @@ -269,15 +361,15 @@ abstract class PaymentModuleCore extends Module if (isset($customization['datas'][Product::CUSTOMIZE_TEXTFIELD])) foreach ($customization['datas'][Product::CUSTOMIZE_TEXTFIELD] AS $text) $customizationText .= $text['name'].':'.' '.$text['value'].'
'; - + if (isset($customization['datas'][Product::CUSTOMIZE_FILE])) $customizationText .= sizeof($customization['datas'][Product::CUSTOMIZE_FILE]) .' '. Tools::displayError('image(s)').'
'; - + $customizationText .= '---
'; } - + $customizationText = rtrim($customizationText, '---
'); - + $customizationQuantity = (int)($product['customizationQuantityTotal']); $productsList .= ' @@ -288,7 +380,7 @@ abstract class PaymentModuleCore extends Module '.Tools::displayPrice($customizationQuantity * (Product::getTaxCalculationMethod() == PS_TAX_EXC ? $price : $price_wt), $currency, false).' '; } - + if (!$customizationQuantity OR (int)$product['cart_quantity'] > $customizationQuantity) $productsList .= ' @@ -299,11 +391,46 @@ abstract class PaymentModuleCore extends Module '.Tools::displayPrice(((int)($product['cart_quantity']) - $customizationQuantity) * (Product::getTaxCalculationMethod() == PS_TAX_EXC ? $price : $price_wt), $currency, false).' '; } // end foreach ($products) - - $cartRulesList = ''; - $result = $cart->getCartRules(); - $cartRules = ObjectModel::hydrateCollection('CartRule', $result, (int)$order->id_lang); - foreach ($cartRules as $cartRule) + + + /* Add carrier tax */ + $shippingCostTaxExcl = $cart->getOrderShippingCost((int)$order->id_carrier, false); + $allTaxes = TaxRulesGroup::getTaxes((int)Carrier::getIdTaxRulesGroupByIdCarrier((int)$order->id_carrier), $id_country, $id_state, $id_county); + $nTax = 0; + + foreach ($allTaxes AS $res) + { + if (!isset($res->id)) + continue; + + if (!isset($storeAllTaxes[$res->id])) + $storeAllTaxes[$res->id] = array(); + if (!isset($storeAllTaxes[$res->id]['amount'])) + $storeAllTaxes[$res->id]['amount'] = 0; + $storeAllTaxes[$res->id]['name'] = $res->name[(int)$order->id_lang]; + $storeAllTaxes[$res->id]['rate'] = $res->rate; + + if (!$nTax++) + $storeAllTaxes[$res->id]['amount'] += ($shippingCostTaxExcl * (1 + ($res->rate * 0.01))) - $shippingCostTaxExcl; + else + { + $priceTmp = $order->total_shipping / (1 + ($res->rate * 0.01)); + $storeAllTaxes[$res->id]['amount'] += $order->total_shipping - $priceTmp; + } + } + + /* Store taxes */ + foreach ($storeAllTaxes AS $t) + Db::getInstance()->Execute(' + INSERT INTO '._DB_PREFIX_.'order_tax (id_order, tax_name, tax_rate, amount) + VALUES ('.(int)$order->id.', \''.pSQL($t['name']).'\', \''.(float)($t['rate']).'\', '.(float)$t['amount'].')'); + + // Insert discounts from cart into order_discount table + $discounts = $cart->getDiscounts(); + $discountsList = ''; + $total_discount_value = 0; + $shrunk = false; + foreach ($discounts AS $discount) { $value = $cartRule->getContextualValue(true); // Todo : has not been tested because order processing wasn't functionnal @@ -326,19 +453,19 @@ abstract class PaymentModuleCore extends Module Mail::Send((int)$order->id_lang, 'voucher', Mail::l('New voucher regarding your order #').$order->id, $params, $customer->email, $customer->firstname.' '.$customer->lastname); } } - + $order->addCartRule($cartRule->id, $cartRule->name, $value); if ($id_order_state != Configuration::get('PS_OS_ERROR') AND $id_order_state != Configuration::get('PS_OS_CANCELED')) $cartRule->quantity = $cartRule->quantity - 1; $cartRule->update(); - + $cartRulesList .= ' '.$this->l('Voucher name:').' '.$cartRule->name.' '.($value != 0.00 ? '-' : '').Tools::displayPrice($value, $currency, false).' '; } - + // Specify order id for message $oldMessage = Message::getMessageByCartId((int)($cart->id)); if ($oldMessage) @@ -347,7 +474,7 @@ abstract class PaymentModuleCore extends Module $message->id_order = (int)$order->id; $message->update(); } - + // Hook validate order $orderStatus = new OrderState((int)$id_order_state, (int)$order->id_lang); if (Validate::isLoadedObject($orderStatus)) @@ -357,7 +484,7 @@ abstract class PaymentModuleCore extends Module if ($orderStatus->logable) ProductSale::addProductSale((int)$product['id_product'], (int)$product['cart_quantity']); } - + if (Configuration::get('PS_STOCK_MANAGEMENT') && $order_detail->getStockState()) { $history = new OrderHistory(); @@ -374,7 +501,7 @@ abstract class PaymentModuleCore extends Module $new_history->addWithemail(true, $extraVars); unset($order_detail, $pcc); - + // Order is reloaded because the status just changed $order = new Order($order->id); @@ -385,7 +512,7 @@ abstract class PaymentModuleCore extends Module $delivery = new Address((int)($order->id_address_delivery)); $delivery_state = $delivery->id_state ? new State((int)($delivery->id_state)) : false; $invoice_state = $invoice->id_state ? new State((int)($invoice->id_state)) : false; - + $data = array( '{firstname}' => $customer->firstname, '{lastname}' => $customer->lastname, @@ -434,10 +561,10 @@ abstract class PaymentModuleCore extends Module '{total_discounts}' => Tools::displayPrice($order->total_discounts, $currency, false), '{total_shipping}' => Tools::displayPrice($order->total_shipping, $currency, false), '{total_wrapping}' => Tools::displayPrice($order->total_wrapping, $currency, false)); - + if (is_array($extraVars)) $data = array_merge($data, $extraVars); - + // Join PDF invoice if ((int)(Configuration::get('PS_INVOICE')) AND Validate::isLoadedObject($orderStatus) AND $orderStatus->invoice AND $order->invoice_number) { @@ -447,7 +574,7 @@ abstract class PaymentModuleCore extends Module } else $fileAttachment = NULL; - + if (Validate::isEmail($customer->email)) Mail::Send((int)$order->id_lang, 'order_conf', Mail::l('Order confirmation', (int)$order->id_lang), $data, $customer->email, $customer->firstname.' '.$customer->lastname, NULL, NULL, $fileAttachment); } @@ -470,7 +597,7 @@ abstract class PaymentModuleCore extends Module die($errorMessage); } } - + /** * Add new PaymentCC to the order * @var int id_order diff --git a/classes/Product.php b/classes/Product.php index b901c04e4..42e854a31 100644 --- a/classes/Product.php +++ b/classes/Product.php @@ -265,6 +265,7 @@ class ProductCore extends ObjectModel protected $identifier = 'id_product'; protected $webserviceParameters = array( + 'objectMethods' => array('add' => 'addWs', 'update' => 'updateWs'), 'objectNodeNames' => 'products', 'fields' => array( 'id_manufacturer' => array('xlink_resource' => 'manufacturers'), @@ -930,13 +931,13 @@ class ProductCore extends ObjectModel * @deprecated */ public function addProductAttribute($price, $weight, $unit_impact, $ecotax, $quantity, $id_images, $reference, - $supplier_reference = null, $ean13, $default, $location = null, $upc = null) + $supplier_reference = null, $ean13, $default, $location = null, $upc = null, $minimal_quantity = 1) { Tools::displayAsDeprecated(); $id_product_attribute = $this->addAttribute( $price, $weight, $unit_impact, $ecotax, $id_images, - $reference, $ean13, $default, $location, $upc + $reference, $ean13, $default, $location, $upc, $minimal_quantity ); if (!$id_product_attribute) @@ -996,9 +997,10 @@ class ProductCore extends ObjectModel * @param string $location Location * @param string $ean13 Ean-13 barcode * @param boolean $default Is default attribute for product + * @param integer $minimal_quantity Minimal quantity to add to cart * @return mixed $id_product_attribute or false */ - public function addAttribute($price, $weight, $unit_impact, $ecotax, $id_images, $reference, $ean13, $default, $location = null, $upc = null) + public function addAttribute($price, $weight, $unit_impact, $ecotax, $id_images, $reference, $ean13, $default, $location = null, $upc = null, $minimal_quantity = 1) { if (!$this->id) return; @@ -1017,7 +1019,8 @@ class ProductCore extends ObjectModel 'location' => pSQL($location), 'ean13' => pSQL($ean13), 'upc' => pSQL($upc), - 'default_on' => (int)$default + 'default_on' => (int)$default, + 'minimal_quantity' => (int)$minimal_quantity, ), 'INSERT'); $id_product_attribute = Db::getInstance()->Insert_ID(); @@ -1042,11 +1045,11 @@ class ProductCore extends ObjectModel * @param string $supplier_reference DEPRECATED */ public function addCombinationEntity($wholesale_price, $price, $weight, $unit_impact, $ecotax, $quantity, - $id_images, $reference, $supplier_reference, $ean13, $default, $location = null, $upc = null) + $id_images, $reference, $supplier_reference, $ean13, $default, $location = null, $upc = null, $minimal_quantity = 1) { $id_product_attribute = $this->addProductAttribute( $price, $weight, $unit_impact, $ecotax, $quantity, $id_images, - $reference, $supplier_reference, $ean13, $default, $location, $upc + $reference, $supplier_reference, $ean13, $default, $location, $upc, $minimal_quantity ); $result = Db::getInstance()->execute( @@ -4106,5 +4109,19 @@ class ProductCore extends ObjectModel return Db::getInstance()->getValue($query); } -} + public function addWs($autodate = true, $nullValues = false) + { + $success = parent::add($autodate, $nullValues); + if ($success) + Search::indexation(false, $this->id); + return $success; + } + public function updateWs($nullValues = false) + { + $success = parent::update($nullValues); + if ($success) + Search::indexation(false, $this->id); + return $success; + } +} diff --git a/classes/Tab.php b/classes/Tab.php index 2521b1135..e1b526ccb 100644 --- a/classes/Tab.php +++ b/classes/Tab.php @@ -115,11 +115,13 @@ class TabCore extends ObjectModel '); if (!$profiles || empty($profiles)) return false; + /* Query definition */ // note : insert ignore should be avoided $query = 'INSERT IGNORE INTO `'._DB_PREFIX_.'access` (`id_profile`, `id_tab`, `view`, `add`, `edit`, `delete`) VALUES '; // default admin $query .= '(1, '.(int)$id_tab.', 1, 1, 1, 1),'; + foreach ($profiles as $profile) { // no cast needed for profile[id_profile], which cames from db @@ -251,7 +253,7 @@ class TabCore extends ObjectModel public static function getNewLastPosition($id_parent) { return (Db::getInstance()->getValue(' - SELECT MAX(position)+1 + SELECT IFNULL(MAX(position),0)+1 FROM `'._DB_PREFIX_.'tab` WHERE `id_parent` = '.(int)$id_parent )); diff --git a/classes/Tools.php b/classes/Tools.php index 7311aeee6..438c313a5 100644 --- a/classes/Tools.php +++ b/classes/Tools.php @@ -643,7 +643,7 @@ class ToolsCore * @param integer $id_lang Language id * @return array Meta tags */ - public static function getMetaTags($id_lang, $page_name) + public static function getMetaTags($id_lang, $page_name, $title = '') { global $maintenance; @@ -670,6 +670,8 @@ class ToolsCore /* Categories specifics meta tags */ elseif ($id_category = self::getValue('id_category')) { + if (!empty($title)) + $title = ' - '.$title; $page_number = (int)self::getValue('p'); $row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow(' SELECT `name`, `meta_title`, `meta_description`, `meta_keywords`, `description` @@ -682,10 +684,13 @@ class ToolsCore // Paginate title if (!empty($row['meta_title'])) - $row['meta_title'] = $row['meta_title'].(!empty($page_number) ? ' ('.$page_number.')' : '').' - '.Configuration::get('PS_SHOP_NAME'); + $row['meta_title'] = $title.$row['meta_title'].(!empty($page_number) ? ' ('.$page_number.')' : '').' - '.Configuration::get('PS_SHOP_NAME'); else $row['meta_title'] = $row['name'].(!empty($page_number) ? ' ('.$page_number.')' : '').' - '.Configuration::get('PS_SHOP_NAME'); + if (!empty($title)) + $row['meta_title'] = $title.(!empty($page_number) ? ' ('.$page_number.')' : '').' - '.Configuration::get('PS_SHOP_NAME'); + return self::completeMetaTags($row, $row['name']); } } @@ -1227,10 +1232,12 @@ class ToolsCore return false; } - /** - * @deprecated as of 1.5 use Media::minifyHTML() - */ + public static $a = 0; + + /** + * @deprecated as of 1.5 use Media::minifyHTML() + */ public static function minifyHTML($html_content) { Tools::displayAsDeprecated(); @@ -1276,8 +1283,21 @@ class ToolsCore */ public static function minifyHTMLpregCallback($preg_matches) { +<<<<<<< .working Tools::displayAsDeprecated(); return Media::minifyHTMLpregCallback($preg_matches); +======= + $args = array(); + preg_match_all('/[a-zA-Z0-9]+=[\"\\\'][^\"\\\']*[\"\\\']/is', $preg_matches[2], $args); + $args = $args[0]; + sort($args); + // if there is no args in the balise, we don't write a space (avoid previous : , now : <title>) + if (empty($args)) + $output = $preg_matches[1].'>'; + else + $output = $preg_matches[1].' '.implode(' ', $args).'>'; + return $output; +>>>>>>> .merge-right.r10309 } /** @@ -1285,8 +1305,25 @@ class ToolsCore */ public static function packJSinHTML($html_content) { +<<<<<<< .working Tools::displayAsDeprecated(); return Media::packJSinHTML($html_content); +======= + if (strlen($html_content) > 0) + { + $htmlContentCopy = $html_content; + $html_content = preg_replace_callback( + '/\\s*(<script\\b[^>]*?>)([\\s\\S]*?)(<\\/script>)\\s*/i' + ,array('Tools', 'packJSinHTMLpregCallback') + ,$html_content); + + // If the string is too big preg_replace return null: http://php.net/manual/en/function.preg-replace-callback.php + // In this case, we don't compress the content + if ($html_content === null) + { + error_log('Error occured in function packJSinHTML'); + return $htmlContentCopy; +>>>>>>> .merge-right.r10309 } /** @@ -1796,11 +1833,11 @@ FileETag INode MTime Size $orderByPrefix = ''; if ($prefix) { - if ($value == 'id_product' || $value == 'date_add' || $value == 'price') + if ($value == 'id_product' || $value == 'date_add' || $value == 'date_upd' || $value == 'price') $orderByPrefix = 'p.'; elseif ($value == 'name') $orderByPrefix = 'pl.'; - elseif ($value == 'manufacturer') + elseif ($value == 'manufacturer_name') $orderByPrefix = 'm.'; elseif ($value == 'position' || empty($value)) $orderByPrefix = 'cp.'; diff --git a/classes/Upgrader.php b/classes/Upgrader.php index 6b0116ba7..6d2c28c55 100644 --- a/classes/Upgrader.php +++ b/classes/Upgrader.php @@ -1,6 +1,6 @@ <?php /* -* 2007-2011 PrestaShop +* 2007-2011 PrestaShop * * NOTICE OF LICENSE * @@ -39,12 +39,14 @@ class UpgraderCore public $version_name; public $version_num; + public $version_is_modified = null; /** * @var string contains hte url where to download the file */ public $link; public $autoupgrade; public $autoupgrade_module; + public $autoupgrade_last_version; public $changelog; public $md5; @@ -65,7 +67,7 @@ class UpgraderCore /** * downloadLast download the last version of PrestaShop and save it in $dest/$filename - * + * * @param string $dest directory where to save the file * @param string $filename new filename * @return boolean @@ -94,13 +96,12 @@ class UpgraderCore /** * checkPSVersion ask to prestashop.com if there is a new version. return an array if yes, false otherwise - * + * * @return mixed */ public function checkPSVersion($force = false) { - if (empty($this->link)) - { + if (class_exists('Configuration')) $last_check = Configuration::get('PS_LAST_VERSION_CHECK'); else @@ -112,7 +113,6 @@ class UpgraderCore libxml_set_streams_context(@stream_context_create(array('http' => array('timeout' => 3)))); if ($feed = @simplexml_load_file($this->rss_version_link)) { - $this->version_name = (string)$feed->version->name; $this->version_num = (string)$feed->version->num; $this->link = (string)$feed->download->link; @@ -120,6 +120,7 @@ class UpgraderCore $this->changelog = (string)$feed->download->changelog; $this->autoupgrade = (int)$feed->autoupgrade; $this->autoupgrade_module = (int)$feed->autoupgrade_module; + $this->autoupgrade_last_version = (string)$feed->autoupgrade_last_version; $this->desc = (string)$feed->desc ; $config_last_version = array( 'name' => $this->version_name, @@ -128,6 +129,7 @@ class UpgraderCore 'md5' => $this->md5, 'autoupgrade' => $this->autoupgrade, 'autoupgrade_module' => $this->autoupgrade_module, + 'autoupgrade_last_version' => $this->autoupgrade_last_version, 'changelog' => $this->changelog, 'desc' => $this->desc ); @@ -139,8 +141,7 @@ class UpgraderCore } } else - $this->loadFromConfig(); - } + $this->loadFromConfig(); // retro-compatibility : // return array(name,link) if you don't use the last version // false otherwise @@ -155,7 +156,7 @@ class UpgraderCore /** * load the last version informations stocked in base - * + * * @return $this */ public function loadFromConfig() @@ -173,6 +174,8 @@ class UpgraderCore $this->autoupgrade = $last_version_check['autoupgrade']; if (isset($last_version_check['autoupgrade_module'])) $this->autoupgrade_module = $last_version_check['autoupgrade_module']; + if (isset($last_version_check['autoupgrade_last_version'])) + $this->autoupgrade_last_version = $last_version_check['autoupgrade_last_version']; if (isset($last_version_check['md5'])) $this->md5 = $last_version_check['md5']; if (isset($last_version_check['desc'])) @@ -184,17 +187,19 @@ class UpgraderCore } /** - * return an array of files + * return an array of files * that the md5file does not match to the original md5file (provided by $rss_md5file_link_dir ) * @return void */ public function getChangedFilesList() { - if (count($this->changed_files) == 0) + if (is_array($this->changed_files) && count($this->changed_files) == 0) { $checksum = @simplexml_load_file($this->rss_md5file_link_dir._PS_VERSION_.'.xml'); - if ($checksum === false) - return false; + if ($checksum == false) + { + $this->changed_files = false; + } else $this->browseXmlAndCompare($checksum->ps_root_dir[0]); } @@ -202,13 +207,13 @@ class UpgraderCore } /** populate $this->changed_files with $path - * in sub arrays mail, translation and core items + * in sub arrays mail, translation and core items * @param string $path filepath to add, relative to _PS_ROOT_DIR_ */ protected function addChangedFile($path) { $this->version_is_modified = true; - + if (strpos($path, 'mails/') !== false) $this->changed_files['mail'][] = $path; else if ( @@ -254,7 +259,7 @@ class UpgraderCore $fullpath = str_replace('ps_root_dir', _PS_ROOT_DIR_, $fullpath); - // replace default admin dir by current one + // replace default admin dir by current one $fullpath = str_replace(_PS_ROOT_DIR_.'/admin', _PS_ADMIN_DIR_, $fullpath); if (!file_exists($fullpath)) $this->addMissingFile($relative_path); @@ -274,6 +279,7 @@ class UpgraderCore public function isAuthenticPrestashopVersion() { + $this->getChangedFilesList(); return !$this->version_is_modified; } diff --git a/classes/Validate.php b/classes/Validate.php index ef7b5528f..a02c98e21 100644 --- a/classes/Validate.php +++ b/classes/Validate.php @@ -43,7 +43,7 @@ class ValidateCore * @param string $email e-mail address to validate * @return boolean Validity is ok or not */ - public static function isEmail($email) + public static function isEmail($email, $required = true) { return !empty($email) AND preg_match('/^[a-z0-9!#$%&\'*+\/=?^`{}|~_-]+[.a-z0-9!#$%&\'*+\/=?^`{}|~_-]*@[a-z0-9]+[._a-z0-9-]*\.[a-z0-9]+$/ui', $email); } diff --git a/classes/order/Order.php b/classes/order/Order.php index e8d6c0e3e..063836207 100644 --- a/classes/order/Order.php +++ b/classes/order/Order.php @@ -1115,7 +1115,11 @@ class OrderCore extends ObjectModel return $result; } - public function setCurrentState($id_order_state, $id_employee) + /** Set current order state + * @param int $id_order_state + * @param int $id_employee (/!\ not optional except for Webservice. + */ + public function setCurrentState($id_order_state, $id_employee = 0) { if (empty($id_order_state)) return false; diff --git a/classes/order/OrderHistory.php b/classes/order/OrderHistory.php index 5749d8268..6412fa58e 100644 --- a/classes/order/OrderHistory.php +++ b/classes/order/OrderHistory.php @@ -122,7 +122,8 @@ class OrderHistoryCore extends ObjectModel if ($newOS->invoice AND !$order->invoice_number) $order->setInvoice(); - if ($newOS->delivery AND !$order->delivery_number) + // Update delivery date even if it was already set by another state change + if ($newOS->delivery) $order->setDelivery(); Hook::postUpdateOrderStatus((int)($new_order_state), (int)($id_order)); } diff --git a/config/defines.inc.php b/config/defines.inc.php index 9f6397917..a2bfa6dd2 100755 --- a/config/defines.inc.php +++ b/config/defines.inc.php @@ -27,7 +27,6 @@ define('_PS_MODE_DEV_', true); define('_PS_MODE_DEMO_', false); -define('_PS_DEMO_MAIN_BO_ACCOUNT_', 1); $currentDir = dirname(__FILE__); diff --git a/config/smarty.config.inc.php b/config/smarty.config.inc.php index b0b3075c7..5afbc94bd 100644 --- a/config/smarty.config.inc.php +++ b/config/smarty.config.inc.php @@ -115,7 +115,7 @@ function smarty_modifier_truncate($string, $length = 80, $etc = '...', $break_wo $length -= min($length, Tools::strlen($etc)); if (!$break_words && !$middle) $string = preg_replace('/\s+?(\S+)?$/u', '', Tools::substr($string, 0, $length+1, $charset)); - return !$middle ? Tools::substr($string, 0, $length, $charset).$etc : Tools::substr($string, 0, $length/2, $charset).$etc.Tools::substr($string, -$length/2, $charset); + return !$middle ? Tools::substr($string, 0, $length, $charset).$etc : Tools::substr($string, 0, $length/2, $charset).$etc.Tools::substr($string, -$length/2, $length, $charset); } else return $string; diff --git a/controllers/front/AuthController.php b/controllers/front/AuthController.php index 656e0abce..7c03f2b63 100644 --- a/controllers/front/AuthController.php +++ b/controllers/front/AuthController.php @@ -262,6 +262,7 @@ class AuthControllerCore extends FrontController } else { + $this->context->cookie->id_compare = isset($this->context->cookie->id_compare) ? $this->context->cookie->id_compare: CompareProduct::getIdCompareByIdCustomer($customer->id); $this->context->cookie->id_customer = (int)($customer->id); $this->context->cookie->customer_lastname = $customer->lastname; $this->context->cookie->customer_firstname = $customer->firstname; @@ -278,10 +279,10 @@ class AuthControllerCore extends FrontController $this->context->cart->id_address_invoice = Address::getFirstCustomerAddressId((int)($customer->id)); $this->context->cart->update(); Hook::exec('authentication'); - + // Login information have changed, so we check if the cart rules still apply CartRule::autoRemoveFromCart(); - + if (!$this->ajax) { if ($back = Tools::getValue('back')) @@ -618,15 +619,15 @@ class AuthControllerCore extends FrontController protected function sendConfirmationMail(Customer $customer) { return Mail::Send( - $this->context->language->id, - 'account', + $this->context->language->id, + 'account', Mail::l('Welcome!'), array( - '{firstname}' => $customer->firstname, - '{lastname}' => $customer->lastname, - '{email}' => $customer->email, - '{passwd}' => Tools::getValue('passwd')), - $customer->email, + '{firstname}' => $customer->firstname, + '{lastname}' => $customer->lastname, + '{email}' => $customer->email, + '{passwd}' => Tools::getValue('passwd')), + $customer->email, $customer->firstname.' '.$customer->lastname ); } diff --git a/controllers/front/CartController.php b/controllers/front/CartController.php index f6f9d814e..4273e309a 100644 --- a/controllers/front/CartController.php +++ b/controllers/front/CartController.php @@ -112,19 +112,19 @@ class CartControllerCore extends FrontController } CartRule::autoRemoveFromCart(); } - + protected function processChangeProductAddressDelivery() { $old_id_address_delivery = (int)Tools::getValue('old_id_address_delivery'); $new_id_address_delivery = (int)Tools::getValue('new_id_address_delivery'); - + $this->context->cart->setProductAddressDelivery( $this->id_product, $this->id_product_attribute, $old_id_address_delivery, $new_id_address_delivery); } - + protected function processDuplicateProduct() { if ( @@ -249,6 +249,7 @@ class CartControllerCore extends FrontController $id_country = (isset($deliveryAddress) && $deliveryAddress->id) ? $deliveryAddress->id_country : Configuration::get('PS_COUNTRY_DEFAULT'); $result['carriers'] = Carrier::getCarriersForOrder(Country::getIdZone($id_country), $groups); //$result['checked'] = Carrier::getDefaultCarrierSelection($result['carriers'], (int)$this->cart->id_carrier); + $result['HOOK_EXTRACARRIER'] = Module::hookExec('extraCarrier', array('address' => (isset($deliveryAddress) && (int)$deliveryAddress->id) ? $deliveryAddress : null)); } $result['summary'] = $this->context->cart->getSummaryDetails(); $result['customizedDatas'] = Product::getAllCustomizedDatas($this->context->cart->id, null, true); diff --git a/controllers/front/CategoryController.php b/controllers/front/CategoryController.php index c87e421a8..11f6691af 100644 --- a/controllers/front/CategoryController.php +++ b/controllers/front/CategoryController.php @@ -83,15 +83,14 @@ class CategoryControllerCore extends FrontController public function initContent() { - if (isset($this->context->customer->id)) - $this->context->smarty->assign('compareProducts', CompareProduct::getCustomerCompareProducts($this->context->customer->id)); - else if (isset($this->context->customer->id_guest)) - $this->context->smarty->assign('compareProducts', CompareProduct::getGuestCompareProducts($this->context->customer->id_guest)); + if (isset($this->context->cookie->id_compare)) + $this->context->smarty->assign('compareProducts', CompareProduct::getCompareProducts((int)$this->context->cookie->id_compare)); + $this->assignScenes(); if ($this->category->id != 1) $this->assignProductList(); - + $this->productSort(); $this->context->smarty->assign(array( 'category' => $this->category, diff --git a/controllers/front/CompareController.php b/controllers/front/CompareController.php index 9829759f5..b63916036 100644 --- a/controllers/front/CompareController.php +++ b/controllers/front/CompareController.php @@ -43,32 +43,21 @@ class CompareControllerCore extends FrontController */ public function displayAjax() { - //Add or remove product with Ajax - if (Tools::getValue('id_product') && Tools::getValue('action')) + // Add or remove product with Ajax + if (Tools::getValue('ajax') && Tools::getValue('id_product') && Tools::getValue('action')) { if (Tools::getValue('action') == 'add') { - if (isset($this->context->customer->id)) - { - if (CompareProduct::getCustomerNumberProducts($this->context->customer->id) < Configuration::get('PS_COMPARATOR_MAX_ITEM')) - CompareProduct::addCustomerCompareProduct((int)$this->context->customer->id, (int)Tools::getValue('id_product')); - else - die('0'); - } + $id_compare = isset($this->context->cookie->id_compare) ? $this->context->cookie->id_compare: false; + if (CompareProduct::getNumberProducts($id_compare) < Configuration::get('PS_COMPARATOR_MAX_ITEM')) + CompareProduct::addCompareProduct($id_compare, (int)Tools::getValue('id_product')); else - { - if ((isset($this->context->customer->id_guest) && CompareProduct::getGuestNumberProducts($this->context->customer->id_guest) < Configuration::get('PS_COMPARATOR_MAX_ITEM'))) - CompareProduct::addGuestCompareProduct((int)$this->context->customer->id_guest, (int)Tools::getValue('id_product')); - else - die('0'); - } + die('0'); } else if (Tools::getValue('action') == 'remove') { - if (isset($this->context->customer->id)) - CompareProduct::removeCustomerCompareProduct((int)$this->context->customer->id, (int)Tools::getValue('id_product')); - else if (isset($this->context->customer->id_guest)) - CompareProduct::removeGuestCompareProduct((int)$this->context->customer->id_guest, (int)Tools::getValue('id_product')); + if (isset(self::$cookie->id_compare)) + CompareProduct::removeCompareProduct((int)$this->context->cookie->id_compare, (int)Tools::getValue('id_product')); else die('0'); } @@ -95,10 +84,8 @@ class CompareControllerCore extends FrontController if ($product_list = Tools::getValue('compare_product_list') && ($postProducts = (isset($product_list) ? rtrim($product_list, '|') : ''))) $ids = array_unique(explode('|', $postProducts)); - else if (isset($this->context->customer->id)) - $ids = CompareProduct::getCustomerCompareProducts($this->context->customer->id); - else if (isset($this->context->customer->id_guest)) - $ids = CompareProduct::getGuestCompareProducts($this->context->customer->id_guest); + else if (isset(self::$cookie->id_compare)) + $ids = CompareProduct::getCompareProducts($this->context->cookie->id_compare); else $ids = null; diff --git a/controllers/front/OrderController.php b/controllers/front/OrderController.php index f48d445b6..37b7ee071 100644 --- a/controllers/front/OrderController.php +++ b/controllers/front/OrderController.php @@ -64,18 +64,26 @@ class OrderControllerCore extends ParentOrderController if (!$this->context->customer->isLogged(true) && in_array($this->step, array(1, 2, 3))) Tools::redirect('index.php?controller=authentication&back='.urlencode('order.php&step='.$this->step)); - + if (Tools::getValue('multi-shipping') == 1) $this->context->smarty->assign('multi_shipping', true); else $this->context->smarty->assign('multi_shipping', false); - + if ($this->context->customer->id) $this->context->smarty->assign('address_list', $this->context->customer->getAddresses($this->context->language->id)); else $this->context->smarty->assign('address_list', array()); } + public function postProcess() + { + // Update carrier selected on preProccess in order to fix a bug of + // block cart when it's hooked on leftcolumn + if ($this->step == 3 && Tools::isSubmit('processCarrier')) + $this->processCarrier(); + } + /** * Assign template vars related to page content * @see FrontController::initContent() @@ -94,7 +102,7 @@ class OrderControllerCore extends ParentOrderController $this->context->smarty->assign('empty', 1); $this->setTemplate(_PS_THEME_DIR_.'shopping-cart.tpl'); break; - + case 1: $this->_assignAddress(); $this->processAddressFormat(); @@ -118,11 +126,9 @@ class OrderControllerCore extends ParentOrderController case 3: // Test that the conditions (so active) were accepted by the customer $cgv = Tools::getValue('cgv'); - if (Configuration::get('PS_CONDITIONS') && (!Validate::isBool($cgv))) + if (Configuration::get('PS_CONDITIONS') && (!Validate::isBool($cgv) || $cgv == false)) Tools::redirect('index.php?controller=order&step=2'); - if (Tools::isSubmit('processCarrier')) - $this->processCarrier(); $this->autoStep(); // Bypass payment step if total is 0 @@ -201,9 +207,9 @@ class OrderControllerCore extends ParentOrderController { if (!Tools::getValue('multi-shipping')) $this->context->cart->setNoMultishipping(); - + // Add checking for all addresses - + if (!Tools::isSubmit('id_address_delivery') || !Address::isCountryActiveById((int)Tools::getValue('id_address_delivery'))) $this->errors[] = Tools::displayError('This address is not in a valid area.'); else @@ -247,7 +253,7 @@ class OrderControllerCore extends ParentOrderController } $orderTotal = $this->context->cart->getOrderTotal(); } - + /** * Address step */ @@ -257,7 +263,7 @@ class OrderControllerCore extends ParentOrderController if (Tools::getValue('multi-shipping')) $this->context->cart->autosetProductAddress(); - + $this->context->smarty->assign('cart', $this->context->cart); if ($this->context->customer->is_guest) Tools::redirect('index.php?controller=order&step=2'); diff --git a/controllers/front/ProductController.php b/controllers/front/ProductController.php index 06f46c0cd..3416d233e 100644 --- a/controllers/front/ProductController.php +++ b/controllers/front/ProductController.php @@ -207,10 +207,13 @@ class ProductControllerCore extends FrontController protected function assignPriceAndTax() { $id_customer = (isset($this->context->customer) ? (int)$this->context->customer->id : 0); - $group_reduction = (100 - Group::getReduction($id_customer)) / 100; $id_group = (isset($this->context->customer) ? $this->context->customer->id_default_group : _PS_DEFAULT_CUSTOMER_GROUP_); $id_country = (int)$id_customer ? Customer::getCurrentCountry($id_customer) : Configuration::get('PS_COUNTRY_DEFAULT'); + $group_reduction = GroupReduction::getValueForProduct($this->product->id, $id_group); + if ($group_reduction == 0) + $group_reduction = Group::getReduction((int)$this->context->cookie->id_customer) / 100; + // Tax $tax = (float)$this->product->getTaxesRate(new Address((int)$this->context->cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')})); $this->context->smarty->assign('tax_rate', $tax); @@ -228,7 +231,7 @@ class ProductControllerCore extends FrontController $id_currency = (int)$this->context->cookie->id_currency; $id_product = (int)$this->product->id; $id_shop = $this->context->shop->getID(true); - + $quantity_discounts = SpecificPrice::getQuantityDiscounts($id_product, $id_shop, $id_currency, $id_country, $id_group, null, true); foreach($quantity_discounts as &$quantity_discount) if ($quantity_discount['id_product_attribute']) @@ -239,7 +242,7 @@ class ProductControllerCore extends FrontController $quantity_discount['attributes'] = $attribute['name'].' - '; $quantity_discount['attributes'] = rtrim($quantity_discount['attributes'], ' - '); } - + $product_price = $this->product->getPrice(Product::$_taxCalculationMethod == PS_TAX_INC, false); $address = new Address($this->context->cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')}); $this->context->smarty->assign(array( @@ -248,7 +251,7 @@ class ProductControllerCore extends FrontController 'ecotax_tax_exc' => Tools::ps_round($this->product->ecotax, 2), 'ecotaxTax_rate' => $ecotax_rate, 'productPriceWithoutEcoTax' => (float)$product_price_without_eco_tax, - 'group_reduction' => $group_reduction, + 'group_reduction' => (1 - $group_reduction),, 'no_tax' => Tax::excludeTaxeOption() || !$this->product->getTaxesRate($address), 'ecotax' => (!count($this->errors) && $this->product->ecotax > 0 ? Tools::convertPrice((float)$this->product->ecotax) : 0), 'tax_enabled' => Configuration::get('PS_TAX') @@ -295,13 +298,13 @@ class ProductControllerCore extends FrontController { $colors = array(); $groups = array(); - + // @todo (RM) should only get groups and not all declination ? $attributes_groups = $this->product->getAttributesGroups($this->context->language->id); if (is_array($attributes_groups) && $attributes_groups) { $combination_images = $this->product->getCombinationImages($this->context->language->id); - + foreach ($attributes_groups as $k => $row) { // Color management @@ -319,7 +322,7 @@ class ProductControllerCore extends FrontController 'group_type' => $row['group_type'], 'default' => -1, ); - + $groups[$row['id_attribute_group']]['attributes'][$row['id_attribute']] = $row['attribute_name']; if ($row['default_on'] && $groups[$row['id_attribute_group']]['default'] == -1) $groups[$row['id_attribute_group']]['default'] = (int)$row['id_attribute']; @@ -344,7 +347,7 @@ class ProductControllerCore extends FrontController $combinations[$row['id_product_attribute']]['unit_impact'] = $row['unit_price_impact']; $combinations[$row['id_product_attribute']]['minimal_quantity'] = $row['minimal_quantity']; $combinations[$row['id_product_attribute']]['available_date'] = $available_date; - + if (isset($combination_images[$row['id_product_attribute']][0]['id_image'])) $combinations[$row['id_product_attribute']]['id_image'] = $combination_images[$row['id_product_attribute']][0]['id_image']; else diff --git a/docs/csv_import/addresses_import.csv b/docs/csv_import/addresses_import.csv index 54bb4054d..dce9b0a27 100644 --- a/docs/csv_import/addresses_import.csv +++ b/docs/csv_import/addresses_import.csv @@ -1,4 +1,4 @@ -ID;Alias*;Active (0/1);Customer e-mail;Manufacturer;Supplier;Company;Lastname*;Firstname*;Address 1*;Address 2;Postcode* / Zipcode*;City*;Country*;State;Other;Phone;Mobile Phone;VAT number +id;Alias*;Active (0/1);Customer e-mail;Manufacturer;Supplier;Company;Lastname*;Firstname*;Address 1*;Address 2;Postcode* / Zipcode*;City*;Country*;State;Other;Phone;Mobile Phone;VAT number 1;My Adress;1;johndoe@prestashop.com;;;;Doe;John;16, Main street;2nd floor;75000;PARIS ;France;;;140138844;; 2;My work;1;johndoe@prestashop.com;;;My Company;Doe;John;535, Baker street;;13000;Marseile;France;;;235445588;; 3;My work;0;;Apple Computer, Inc;;;Jobs;Steve;1 Infinite Loop;;95014;CUPERTINO;United States;California;;(800) 275-2273;; \ No newline at end of file diff --git a/docs/csv_import/categories_import.csv b/docs/csv_import/categories_import.csv index 60239991b..812322e98 100644 --- a/docs/csv_import/categories_import.csv +++ b/docs/csv_import/categories_import.csv @@ -1,4 +1,4 @@ -ID;Active (0/1);Name*;Parent Category;Description;Meta-title;Meta-keywords;Meta-description;URL rewritten;Image URL +id;Active (0/1);Name*;Parent Category;Description;Meta-title;Meta-keywords;Meta-description;URL rewritten;Image URL 2;1;iPods;Home;Now that you can buy movies from the iTunes Store and sync them to your iPod, the whole world is your theater.;;;;music-ipods;http://youlinktotheimage.com/img1000.jpg 3;1;Accessories;Home;Wonderful accessories for your iPod;;;;accessories-ipod;http://youlinktotheimage.com/img1001.jpg 4;1;Laptops;Home;The latest Intel processor, a bigger hard drive, plenty of memory, and even more new features all fit inside just one liberating inch. The new Mac laptops have the performance, power, and connectivity of a desktop computer. Without the desk part.;Apple laptops;Apple laptops MacBook Air;Powerful and chic Apple laptops;laptops;http://youlinktotheimage.com/img1002.jpg \ No newline at end of file diff --git a/docs/csv_import/customers_import.csv b/docs/csv_import/customers_import.csv index 527f2bfce..904fe394d 100644 --- a/docs/csv_import/customers_import.csv +++ b/docs/csv_import/customers_import.csv @@ -1,3 +1,3 @@ -ID;Active (0/1);Gender ID (Mr=1, Ms=2, else 9);E-mail*;Password*;Birthday;Lastname*;Firstname*;Newletter (0/1);Opt-in (0/1) +id;Active (0/1);Gender ID (Mr=1, Ms=2, else 9);E-mail*;Password*;Birthday;Lastname*;Firstname*;Newletter (0/1);Opt-in (0/1) 1;1;1;johndoe@prestashop.com;#res152EDRF;sous quelle forme ? ;Doe;John;1;1 2;1;2;mariedoe@prestashop.com;58@ret26#;sous quelle forme ? ;Doe;Marie;0;1 \ No newline at end of file diff --git a/docs/csv_import/manufacturers_import.csv b/docs/csv_import/manufacturers_import.csv index e91c6b113..6c8ea7cd0 100644 --- a/docs/csv_import/manufacturers_import.csv +++ b/docs/csv_import/manufacturers_import.csv @@ -1,3 +1,3 @@ -ID;Active (0/1);Name*;Description;Short description;Meta-title;Meta-keywords;Meta-description +id;Active (0/1);Name*;Description;Short description;Meta-title;Meta-keywords;Meta-description 1;1;Apple Computer, Inc;;;;; 2;1;Shure Incorporated;;;;; \ No newline at end of file diff --git a/docs/csv_import/products_import.csv b/docs/csv_import/products_import.csv index 7202a63ef..b49f79225 100644 --- a/docs/csv_import/products_import.csv +++ b/docs/csv_import/products_import.csv @@ -1,3 +1,3 @@ -ID;Active (0/1);Name*;Categories (x,y,z,...);Price tax excl. Or Price tax excl;Tax rules id;Wholesale price;On sale (0/1);Discount amount;Discount percent;Discount from (yyy-mm-dd);Discount to (yyy-mm-dd);Reference #;Supplier reference #;Supplier;Manufacturer;EAN13;UPC;Ecotax;Weight;Quantity;Short description;Description;Tags (x,y,z,...);Meta-title;Meta-keywords;Meta-description;URL rewritten;Text when in-stock;Text if back-order allowed;Image URLs (x,y,z,...);Feature;Only available online +id;Active (0/1);Name*;Categories (x,y,z,...);Price tax excl. Or Price tax excl;Tax rules id;Wholesale price;On sale (0/1);Discount amount;Discount percent;Discount from (yyy-mm-dd);Discount to (yyy-mm-dd);Reference #;Supplier reference #;Supplier;Manufacturer;EAN13;UPC;Ecotax;Weight;Quantity;Short description;Description;Tags (x,y,z,...);Meta-title;Meta-keywords;Meta-description;URL rewritten;Text when in-stock;Text if back-order allowed;Image URLs (x,y,z,...);Feature;Only available online 1;1;iPod Nano;Home, iPods;49;1;;1;;;;;92458844;54778855;AppleStore;Apple Computer, Inc;;;;0.5;800;New design. New features. Now i….;Curved ahead of the curve. For those about to rock, we give you nine amazing colors. But that's only part of the story. Feel the curved, all-aluminum and glass de...;apple, ipod, nano;;;;ipod-nano;In stock;;http://youdomain.com/img.jpg, http://yourdomain.com/img1.jpg;; 2;1;iPod shuffle;Home, iPods;66.05;1;79;1;;;;;92458845;54778855;AppleStore;Apple Computer, Inc;;;;0;500;iPod shuffle, the world’s most wearabl….;;ipod, shuffle;;;;ipod-shuffle;In stock;;http://youdomain.com/img25.jpg, http://yourdomain.com/img30.jpg;; \ No newline at end of file diff --git a/docs/csv_import/suppliers_import.csv b/docs/csv_import/suppliers_import.csv index b43d7a3a7..db319c908 100644 --- a/docs/csv_import/suppliers_import.csv +++ b/docs/csv_import/suppliers_import.csv @@ -1,3 +1,3 @@ -ID;Active (0/1);Name*;Description;Short description;Meta-title;Meta-keywords;Meta-description +id;Active (0/1);Name*;Description;Short description;Meta-title;Meta-keywords;Meta-description 1;1;Applestore;;;;; 2;1;Shure Online Store;;;;; \ No newline at end of file diff --git a/images.inc.php b/images.inc.php index 6af0eada7..d7321dd3e 100644 --- a/images.inc.php +++ b/images.inc.php @@ -251,6 +251,7 @@ function imageResize($sourceFile, $destFile, $destWidth = NULL, $destHeight = NU } imagecopyresampled($destImage, $sourceImage, (int)(($destWidth - $nextWidth) / 2), (int)(($destHeight - $nextHeight) / 2), 0, 0, $nextWidth, $nextHeight, $sourceWidth, $sourceHeight); + return (returnDestImage($fileType, $destImage, $destFile)); } @@ -326,6 +327,7 @@ function returnDestImage($type, $ressource, $filename) $quality = (Configuration::get('PS_PNG_QUALITY') === false ? 7 : Configuration::get('PS_PNG_QUALITY')); $flag = imagepng($ressource, $filename, (int)$quality); break; + case 'jpg': case 'jpeg': default: $quality = (Configuration::get('PS_JPEG_QUALITY') === false ? 90 : Configuration::get('PS_JPEG_QUALITY')); diff --git a/install-dev/index.php b/install-dev/index.php index 91c748e65..623f590bb 100644 --- a/install-dev/index.php +++ b/install-dev/index.php @@ -355,9 +355,9 @@ if ($lm->getIncludeTradFilename()) <h2><?php echo lang('What do you want to do?')?></h2> <form id="formSetMethod" action="<?php $_SERVER['REQUEST_URI']; ?>" method="post"> - <p><input <?php echo (!($oldversion AND !$tooOld AND !$sameVersions AND !$installOfOldVersion)) ? 'checked="checked"' : '' ?> type="radio" value="install" name="typeInstall" id="typeInstallInstall" style="vertical-align: middle;" /> <label for="typeInstallInstall"><?php echo lang('I want to').' <b>'.lang('install').'</b> '.lang('a new online shop with PrestaShop'); ?></label></p> + <p><input <?php echo (!($oldversion AND !$tooOld AND !$sameVersions AND !$installOfOldVersion)) ? 'checked="checked"' : '' ?> type="radio" value="install" name="typeInstall" id="typeInstallInstall" style="vertical-align: middle;" /> <label for="typeInstallInstall"><?php echo lang('I want to <b>install</b> a new online shop with PrestaShop'); ?></label></p> <p style="font-style: italic;"><?php echo lang('- or -'); ?></p> - <p <?php echo ($oldversion AND !$tooOld AND !$sameVersions AND !$installOfOldVersion) ? '' : 'class="disabled"'; ?>><input <?php echo ($oldversion AND !$tooOld AND !$sameVersions AND !$installOfOldVersion) ? 'checked="checked"' : 'disabled="disabled"'; ?> type="radio" value="upgrade" name="typeInstall" id="typeInstallUpgrade" style="vertical-align: middle;" /> <label <?php echo ($oldversion === false) ? 'class="disabled"' : ''; ?> for="typeInstallUpgrade"><?php echo lang('I want to').' <b>'.lang('update').'</b> '.lang('my existing PrestaShop to a newer version'); ?> <?php echo ($oldversion === false) ? lang('(No previous version detected)') : ("(".(($tooOld) ? lang('Your current version is too old, updates are possible only from version').' '.MINIMUM_VERSION_TO_UPDATE.' '.lang('and higher') : ($installOfOldVersion ? lang('Your current version is already up-to-date') : lang('Currently installed version detected:').' <b>v'.$oldversion.'</b>')).")") ?></label></p> + <p <?php echo ($oldversion AND !$tooOld AND !$sameVersions AND !$installOfOldVersion) ? '' : 'class="disabled"'; ?>><input <?php echo ($oldversion AND !$tooOld AND !$sameVersions AND !$installOfOldVersion) ? 'checked="checked"' : 'disabled="disabled"'; ?> type="radio" value="upgrade" name="typeInstall" id="typeInstallUpgrade" style="vertical-align: middle;" /> <label <?php echo ($oldversion === false) ? 'class="disabled"' : ''; ?> for="typeInstallUpgrade"><?php echo lang('I want to <b>update</b> my existing PrestaShop to a newer version'); ?> <?php echo ($oldversion === false) ? lang('(No previous version detected)') : ("(".(($tooOld) ? lang('Your current version is too old, updates are possible only from version').' '.MINIMUM_VERSION_TO_UPDATE.' '.lang('and higher') : ($installOfOldVersion ? lang('Your current version is already up-to-date') : lang('Currently installed version detected:').' <b>v'.$oldversion.'</b>')).")") ?></label></p> </form> <h2><?php echo lang('License Agreement')?></h2> <div style="height:200px; border:1px solid #ccc; margin-bottom:8px; padding:5px; background:#fff; overflow: auto; overflow-x:hidden; overflow-y:scroll;"> @@ -1363,4 +1363,5 @@ if ($lm->getIncludeTradFilename()) <li>© 2007-<?php echo date('Y'); ?></li> </ul> </body> -</html> \ No newline at end of file +</html> + diff --git a/install-dev/langs/de.php b/install-dev/langs/de.php index f5eb6869f..b7d5a366e 100644 --- a/install-dev/langs/de.php +++ b/install-dev/langs/de.php @@ -277,12 +277,9 @@ $_LANG['Other activity...'] = 'Andere activiteit...'; $_LANG['Modules'] = 'Módulos'; $_LANG['Benefits'] = 'Vorteile'; $_LANG['Create a MySQL database using phpMyAdmin (or by asking your hosting provider)'] = ''; -$_LANG['- or -'] = ''; -$_LANG['I want to'] = ''; -$_LANG['install'] = ''; -$_LANG['a new online shop with PrestaShop'] = ''; -$_LANG['update'] = ''; -$_LANG['my existing PrestaShop to a newer version'] = ''; +$_LANG['- or -'] = '- oder -'; +$_LANG['I want to <b>install</b> a new online shop with PrestaShop'] = 'Ich möchte einen neuen PrestaShop <b>installieren</b>'; +$_LANG['I want to <b>update</b> my existing PrestaShop to a newer version'] = 'Ich möchte meinen <b>aktuellen</b> PrestaShop mit einer neueren Version aktualisieren'; $_LANG['Your current version is too old, updates are possible only from version'] = ''; $_LANG['and higher'] = ''; $_LANG['PHP settings (for assistance, ask your hosting provider):'] = ''; @@ -290,4 +287,4 @@ $_LANG['Database Configuration'] = ''; $_LANG['Database login:'] = ''; $_LANG['Database password:'] = ''; $_LANG['Please create a MySQL database and then verify your settings below. If you need assistance, please ask your hosting provider for this information.'] = ''; -$_LANG['No more information'] = ''; \ No newline at end of file +$_LANG['No more information'] = ''; diff --git a/install-dev/langs/es.php b/install-dev/langs/es.php index 81000a1e7..8587e4dd8 100644 --- a/install-dev/langs/es.php +++ b/install-dev/langs/es.php @@ -281,11 +281,8 @@ $_LANG['Modules'] = 'Módulos'; $_LANG['Benefits'] = 'Beneficios'; $_LANG['Create a MySQL database using phpMyAdmin (or by asking your hosting provider)'] = 'Crear un base de datos MySQL usando phpMyAdmin (o preguntele a su proveedor de alojamiento web)'; $_LANG['- or -'] = ' - o -'; -$_LANG['I want to'] = 'Yo quiero'; -$_LANG['install'] = 'installar'; -$_LANG['a new online shop with PrestaShop'] = 'una nueva tienda online con PrestaShop'; -$_LANG['update'] = 'actualizar'; -$_LANG['my existing PrestaShop to a newer version'] = 'mi tienda PrestaShop actual a una nueva version'; +$_LANG['I want to <b>install</b> a new online shop with PrestaShop'] = 'Yo quiero <b>installar</b> una nueva tienda online con PrestaShop'; +$_LANG['I want to <b>update</b> my existing PrestaShop to a newer version'] = 'Quiero actualizar mi actual PrestaShop, a una nueva versión más reciente'; $_LANG['Your current version is too old, updates are possible only from version'] = 'Su version actual esta antigua, actualizaciones solo estan disponibles desde la version'; $_LANG['and higher'] = 'y en adelante'; $_LANG['PHP settings (for assistance, ask your hosting provider):'] = 'PHP parámetros (para assistencia, preguntale a su proveedor de alojamiento web)'; diff --git a/install-dev/langs/fr.php b/install-dev/langs/fr.php index 7dd908c73..66e12407a 100644 --- a/install-dev/langs/fr.php +++ b/install-dev/langs/fr.php @@ -287,11 +287,8 @@ $_LANG['Modules'] = 'Modules'; $_LANG['Benefits'] = 'Avantages'; $_LANG['Create a MySQL database using phpMyAdmin (or by asking your hosting provider)'] = 'Créer une base de données MySQL en utilisant phpMyAdmin (ou en demandant à votre hébergeur)'; $_LANG['- or -'] = '- ou -'; -$_LANG['I want to'] = 'Je souhaite'; -$_LANG['install'] = 'installer'; -$_LANG['a new online shop with PrestaShop'] = 'une nouvelle boutique avec PrestaShop'; -$_LANG['update'] = 'mettre à jour'; -$_LANG['my existing PrestaShop to a newer version'] = 'ma boutique PrestaShop vers une nouvelle version'; +$_LANG['I want to <b>install</b> a new online shop with PrestaShop'] = 'Je souhaite <b>installer</b> une nouvelle boutique avec PrestaShop'; +$_LANG['I want to <b>update</b> my existing PrestaShop to a newer version'] = 'Je veux <b>mettre à jour</b> ma boutique PrestaShop vers une nouvelle version'; $_LANG['Your current version is too old, updates are possible only from version'] = 'Votre version actuelle est trop ancienne, les mises à jour sont autorisées à partir de la version'; $_LANG['and higher'] = 'et versions supérieures'; $_LANG['PHP settings (for assistance, ask your hosting provider):'] = 'Paramètres PHP (Demandez de l\'aide à votre hébergeur si nécessaire)'; diff --git a/install-dev/langs/it.php b/install-dev/langs/it.php index a19e86fb0..fc60f8e75 100644 --- a/install-dev/langs/it.php +++ b/install-dev/langs/it.php @@ -266,12 +266,9 @@ $_LANG['Other activity...'] = 'Altre attività ...'; $_LANG['Modules'] = 'Moduli'; $_LANG['Benefits'] = 'Vantaggi'; $_LANG['Create a MySQL database using phpMyAdmin (or by asking your hosting provider)'] = ''; -$_LANG['- or -'] = ''; -$_LANG['I want to'] = ''; -$_LANG['install'] = ''; -$_LANG['a new online shop with PrestaShop'] = ''; -$_LANG['update'] = ''; -$_LANG['my existing PrestaShop to a newer version'] = ''; +$_LANG['- or -'] = '- o -'; +$_LANG['I want to <b>install</b> a new online shop with PrestaShop'] = 'Voglio <b>installare</b> un nuovo shop con PrestaShop'; +$_LANG['I want to <b>update</b> my existing PrestaShop to a newer version'] = 'Voglio <b>aggiornare</b> il mio PrestaShop esistente alla nuova versione'; $_LANG['Your current version is too old, updates are possible only from version'] = ''; $_LANG['and higher'] = ''; $_LANG['PHP settings (for assistance, ask your hosting provider):'] = ''; @@ -282,4 +279,6 @@ $_LANG['Please create a MySQL database and then verify your settings below. If y $_LANG['Ok, please deactivate the following modules, I will reactivate them later:'] = ''; $_LANG['You will be able to manually reactivate them in your Back Office once the update process has succeeded.'] = ''; $_LANG['No more information'] = ''; -$_LANG['If your theme is not valid, you may experience some problems in your front-office aspect, but don\'t panic ! To solve this, you can make it compatible by correcting the validators errors or by using a theme compatible with '] = ''; \ No newline at end of file +$_LANG['If your theme is not valid, you may experience some problems in your front-office aspect, but don\'t panic ! To solve this, you can make it compatible by correcting the validators errors or by using a theme compatible with '] = ''; +$_LANG['-- Select your country --'] = '-- scegliere il paese --'; +$_LANG['-- Select your timezone --'] = '-- Scegli il fuso orario --'; \ No newline at end of file diff --git a/install-dev/model.php b/install-dev/model.php index 4bab61cf6..16c43f69d 100644 --- a/install-dev/model.php +++ b/install-dev/model.php @@ -115,3 +115,4 @@ if (isset($_GET['method'])) break; } } + diff --git a/install-dev/php/hook_blocksearch_on_header.php b/install-dev/php/hook_blocksearch_on_header.php new file mode 100644 index 000000000..8a89f44bc --- /dev/null +++ b/install-dev/php/hook_blocksearch_on_header.php @@ -0,0 +1,49 @@ +<?php +/* +* 2007-2011 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Open Software License (OSL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/osl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA <contact@prestashop.com> +* @copyright 2007-2011 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +function hook_blocksearch_on_header() +{ + if ($id_module = Db::getInstance()->getValue('SELECT `id_module` FROM `'._DB_PREFIX_.'module` WHERE `name` = \'blocksearch\'')) + { + $id_hook = Db::getInstance()->getValue(' + SELECT `id_hook` + FROM `'._DB_PREFIX_.'hook` + WHERE `name` = \'header\' + '); + + $position = Db::getInstance()->getValue(' + SELECT MAX(`position`) + FROM `'._DB_PREFIX_.'hook_module` + WHERE `id_hook` = '.(int)$id_hook.' + '); + + Db::getInstance()->Execute(' + INSERT INTO `'._DB_PREFIX_.'hook_module` (`id_module`, `id_hook`, `position`) + VALUES ('.(int)$id_module.', '.(int)$id_hook.', '.($position+1).') + '); + } +} \ No newline at end of file diff --git a/install-dev/php/update_order_canada.php b/install-dev/php/update_order_canada.php new file mode 100644 index 000000000..692accddb --- /dev/null +++ b/install-dev/php/update_order_canada.php @@ -0,0 +1,97 @@ +<?php +/* +* 2007-2011 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Open Software License (OSL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/osl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA <contact@prestashop.com> +* @copyright 2007-2011 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +function update_order_canada() + { + $sql ='SHOW TABLES LIKE \''._DB_PREFIX_.'order_tax\''; + $table = Db::getInstance()->ExecuteS($sql); + + if (!count($table)) + { + Db::getInstance()->Execute(' + CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'order_tax` ( + `id_order` int(11) NOT NULL, + `tax_name` varchar(40) NOT NULL, + `tax_rate` decimal(6,3) NOT NULL, + `amount` decimal(20,6) NOT NULL + ) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8'); + + + $address_field = Configuration::get('PS_TAX_ADDRESS_TYPE'); + $sql = 'SELECT `id_order` + FROM `'._DB_PREFIX_.'orders` o + LEFT JOIN `'._DB_PREFIX_.'address` a ON (a.`id_address` = o.`'.bqSQL($address_field).'`) + LEFT JOIN `'._DB_PREFIX_.'country` c ON (c.`id_country` = a.`id_country`) + WHERE c.`iso_code` = "CA"'; + + $id_order_list = Db::getInstance()->ExecuteS($sql); + + $values = ''; + foreach ($id_order_list as $id_order) + { + $amount = array(); + $id_order = $id_order['id_order']; + $order = new Order((int)$id_order); + if (!Validate::isLoadedObject($order)) + continue; + + $products = $order->getProducts(); + foreach ($products as $product) + { + if (!array_key_exists($product['tax_name'], $amount)) + $amount[$product['tax_name']] = array('amount' => 0, 'rate' => $product['tax_rate']); + + if ($order->getTaxCalculationMethod() == PS_TAX_EXC) + { + $total_product = $product['product_price'] * $product['product_quantity']; + $amount_tmp = Tools::ps_round($total_product * ($product['tax_rate'] / 100), 2); + $amount[$product['tax_name']]['amount'] += Tools::ps_round($total_product * ($product['tax_rate'] / 100), 2); + } + else + { + $total_product = $product['product_price'] * $product['product_quantity']; + $amount_tmp = Tools::ps_round($total_product - ($total_product / (1 + ($product['tax_rate'] / 100))), 2); + $amount[$product['tax_name']]['amount'] += Tools::ps_round($total_product - ($total_product / (1 + ($product['tax_rate'] / 100))), 2); + } + } + + foreach ($amount as $tax_name => $tax_infos) + $values .= '('.(int)$order->id.', \''.pSQL($tax_name).'\', \''.pSQL($tax_infos['rate']).'\', '.(float)$tax_infos['amount'].'),'; + unset($order); + } + + if (!empty($values)) + { + $values = rtrim($values, ","); + + Db::getInstance()->Execute(' + INSERT INTO `'._DB_PREFIX_.'order_tax` (id_order, tax_name, tax_rate, amount) + VALUES '.$values); + } + } +} + diff --git a/install-dev/sql/db.sql b/install-dev/sql/db.sql index a038bb6ba..d2d80d1ba 100644 --- a/install-dev/sql/db.sql +++ b/install-dev/sql/db.sql @@ -380,14 +380,18 @@ CREATE TABLE `PREFIX_cms_category_lang` ( KEY `category_name` (`name`) ) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; -CREATE TABLE `PREFIX_compare_product` ( - `id_compare_product` int(10) unsigned NOT NULL AUTO_INCREMENT, - `id_product` int(10) unsigned NOT NULL, - `id_guest` int(10) unsigned NOT NULL, +CREATE TABLE `PREFIX_compare` ( + `id_compare` int(10) unsigned NOT NULL auto_increment, `id_customer` int(10) unsigned NOT NULL, + PRIMARY KEY (`id_compare`) +) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; + +CREATE TABLE `PREFIX_compare_product` ( + `id_compare` int(10) unsigned NOT NULL, + `id_product` int(10) unsigned NOT NULL, `date_add` datetime NOT NULL, `date_upd` datetime NOT NULL, - PRIMARY KEY (`id_compare_product`) + PRIMARY KEY (`id_compare`,`id_product`) ) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; CREATE TABLE `PREFIX_configuration` ( @@ -1095,6 +1099,12 @@ CREATE TABLE `PREFIX_order_detail` ( KEY `id_order_id_order_detail` (`id_order`, `id_order_detail`) ) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; +CREATE TABLE IF NOT EXISTS `PREFIX_order_tax` ( + `id_order` int(11) NOT NULL, + `tax_name` varchar(40) NOT NULL, + `tax_rate` decimal(6,3) NOT NULL, + `amount` decimal(20,6) NOT NULL +) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; CREATE TABLE `PREFIX_order_cart_rule` ( `id_order_cart_rule` int(10) unsigned NOT NULL auto_increment, @@ -1544,7 +1554,7 @@ CREATE TABLE `PREFIX_specific_price` ( `id_group` INT UNSIGNED NOT NULL, `id_product_attribute` INT UNSIGNED NOT NULL, `price` DECIMAL(20, 6) NOT NULL, - `from_quantity` SMALLINT UNSIGNED NOT NULL, + `from_quantity` mediumint(8) UNSIGNED NOT NULL, `reduction` DECIMAL(20, 6) NOT NULL, `reduction_type` ENUM('amount', 'percentage') NOT NULL, `from` DATETIME NOT NULL, @@ -1668,8 +1678,8 @@ CREATE TABLE `PREFIX_store` ( `address2` varchar(128) DEFAULT NULL, `city` varchar(64) NOT NULL, `postcode` varchar(12) NOT NULL, - `latitude` decimal(10,8) DEFAULT NULL, - `longitude` decimal(10,8) DEFAULT NULL, + `latitude` decimal(11,8) DEFAULT NULL, + `longitude` decimal(11,8) DEFAULT NULL, `hours` varchar(254) DEFAULT NULL, `phone` varchar(16) DEFAULT NULL, `fax` varchar(16) DEFAULT NULL, @@ -1857,6 +1867,12 @@ PRIMARY KEY (`id_carrier`, `id_shop`), KEY `id_shop` (`id_shop`) ) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; +CREATE TABLE `PREFIX_address_format` ( + `id_country` int(10) unsigned NOT NULL, + `format` varchar(255) NOT NULL DEFAULT '', + PRIMARY KEY (`id_country`) +) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; + CREATE TABLE `PREFIX_cms_shop` ( `id_cms` INT( 11 ) UNSIGNED NOT NULL, `id_shop` INT( 11 ) UNSIGNED NOT NULL , @@ -2235,4 +2251,4 @@ CREATE TABLE `PREFIX_accounting_product_zone_shop` ( `account_number` varchar(64) NOT NULL, PRIMARY KEY (`id_accounting_product_zone_shop`), UNIQUE KEY `id_product` (`id_product`,`id_shop`,`id_zone`) -) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; +) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; \ No newline at end of file diff --git a/install-dev/sql/db_settings_extends.sql b/install-dev/sql/db_settings_extends.sql index e1bcc62f4..3afaa0ddd 100644 --- a/install-dev/sql/db_settings_extends.sql +++ b/install-dev/sql/db_settings_extends.sql @@ -72,7 +72,7 @@ INSERT INTO `PREFIX_hook_module` (`id_module`, `id_hook`, `position`) VALUES (3, (35, 33, 2),(36, 33, 3),(37, 33, 4),(39, 37, 1),(40, 32, 8),(41, 32, 9),(42, 32, 10),(43, 32, 11),(42, 14, 6),(43, 14, 7),(44, 32, 12),(45, 32, 13),(46, 32, 15), (47, 32, 14),(48, 32, 16),(49, 32, 17),(55, 32, 22),(50, 32, 18),(51, 32, 19),(51, 45, 1),(25, 25, 1),(41, 20, 2),(52, 32, 20),(53, 32, 21),(17, 9, 2),(18, 9, 3),(24, 9, 4),(9, 9, 5), (15, 9, 6),(5, 9, 7),(8, 9, 8),(10, 9, 9),(20, 9, 10),(11, 9, 11),(16, 9, 12),(22, 9, 13),(13, 9, 14),(14, 9, 15),(12, 9, 16),(7, 9, 17),(21, 9, 18),(10, 60, 1),(10, 61, 1),(10, 62, 1), -(54, 9, 19),(10,66,1); +(54, 9, 19),(10,66,1),(19,9,20); CREATE TABLE `PREFIX_pagenotfound` ( `id_pagenotfound` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, @@ -866,6 +866,85 @@ INSERT INTO `PREFIX_search_word` (`id_word`, `id_lang`, `word`) VALUES (1, 1, 'i INSERT INTO `PREFIX_access` (`id_profile`, `id_tab`, `view`, `add`, `edit`, `delete`) (SELECT 2, id_tab, 1, 1, 1, 1 FROM PREFIX_tab); INSERT INTO `PREFIX_access` (`id_profile`, `id_tab`, `view`, `add`, `edit`, `delete`) VALUES +(2, 1, 1, 1, 1, 1), +(2, 2, 1, 1, 1, 1), +(2, 3, 1, 1, 1, 1), +(2, 4, 0, 0, 0, 0), +(2, 5, 1, 1, 1, 1), +(2, 6, 0, 0, 0, 0), +(2, 7, 0, 0, 0, 0), +(2, 8, 0, 0, 0, 0), +(2, 9, 0, 0, 0, 0), +(2, 10, 0, 0, 0, 0), +(2, 11, 0, 0, 0, 0), +(2, 12, 1, 1, 1, 1), +(2, 13, 1, 1, 1, 1), +(2, 14, 0, 0, 0, 0), +(2, 15, 0, 0, 0, 0), +(2, 16, 0, 0, 0, 0), +(2, 17, 1, 1, 1, 1), +(2, 18, 0, 0, 0, 0), +(2, 19, 0, 0, 0, 0), +(2, 20, 1, 1, 1, 1), +(2, 21, 1, 1, 1, 1), +(2, 22, 0, 0, 0, 0), +(2, 23, 0, 0, 0, 0), +(2, 24, 0, 0, 0, 0), +(2, 26, 0, 0, 0, 0), +(2, 27, 0, 0, 0, 0), +(2, 28, 0, 0, 0, 0), +(2, 29, 0, 0, 0, 0), +(2, 30, 0, 0, 0, 0), +(2, 31, 0, 0, 0, 0), +(2, 32, 0, 0, 0, 0), +(2, 33, 0, 0, 0, 0), +(2, 34, 1, 1, 1, 1), +(2, 35, 0, 0, 0, 0), +(2, 36, 0, 0, 0, 0), +(2, 37, 0, 0, 0, 0), +(2, 38, 0, 0, 0, 0), +(2, 39, 0, 0, 0, 0), +(2, 40, 0, 0, 0, 0), +(2, 41, 0, 0, 0, 0), +(2, 42, 1, 1, 1, 1), +(2, 43, 0, 0, 0, 0), +(2, 44, 0, 0, 0, 0), +(2, 46, 0, 0, 0, 0), +(2, 47, 1, 1, 1, 1), +(2, 48, 0, 0, 0, 0), +(2, 49, 1, 1, 1, 1), +(2, 51, 0, 0, 0, 0), +(2, 52, 0, 0, 0, 0), +(2, 53, 0, 0, 0, 0), +(2, 54, 0, 0, 0, 0), +(2, 55, 1, 1, 1, 1), +(2, 56, 0, 0, 0, 0), +(2, 57, 0, 0, 0, 0), +(2, 58, 0, 0, 0, 0), +(2, 59, 1, 1, 1, 1), +(2, 60, 1, 1, 1, 1), +(2, 61, 0, 0, 0, 0), +(2, 62, 0, 0, 0, 0), +(2, 63, 0, 0, 0, 0), +(2, 64, 0, 0, 0, 0), +(2, 65, 0, 0, 0, 0), +(2, 66, 0, 0, 0, 0), +(2, 67, 0, 0, 0, 0), +(2, 68, 0, 0, 0, 0), +(2, 69, 0, 0, 0, 0), +(2, 70, 0, 0, 0, 0), +(2, 71, 0, 0, 0, 0), +(2, 72, 0, 0, 0, 0), +(2, 73, 1, 1, 1, 1), +(2, 80, 0, 0, 0, 0), +(2, 81, 0, 0, 0, 0), +(2, 82, 0, 0, 0, 0), +(2, 83, 0, 0, 0, 0), +(2, 84, 0, 0, 0, 0), +(2, 85, 0, 0, 0, 0), +(2, 86, 0, 0, 0, 0), +(2, 87, 0, 0, 0, 0), +(2, 88, 1, 1, 1, 1), (3, 1, 1, 1, 1, 1), (3, 2, 1, 1, 1, 1), (3, 3, 1, 1, 1, 1), @@ -945,7 +1024,6 @@ INSERT INTO `PREFIX_access` (`id_profile`, `id_tab`, `view`, `add`, `edit`, `del (3, 86, 0, 0, 0, 0), (3, 87, 0, 0, 0, 0), (3, 88, 0, 0, 0, 0), -(3, 89, 0, 0, 0, 0), (3, 90, 0, 0, 0, 0), (3, 91, 0, 0, 0, 0), (3, 92, 0, 0, 0, 0), @@ -1041,6 +1119,7 @@ INSERT INTO `PREFIX_access` (`id_profile`, `id_tab`, `view`, `add`, `edit`, `del (4, 85, 0, 0, 0, 0), (4, 86, 0, 0, 0, 0), (4, 87, 0, 0, 0, 0), +<<<<<<< .working (4, 88, 0, 0, 0, 0), (4, 89, 0, 0, 0, 0), (4, 90, 0, 0, 0, 0), @@ -1156,7 +1235,9 @@ INSERT INTO `PREFIX_access` (`id_profile`, `id_tab`, `view`, `add`, `edit`, `del (5, 103, 1, 1, 1, 1), (5, 104, 1, 1, 1, 1), (5, 105, 0, 0, 0, 0), -(5, 106, 0, 0, 0, 0); +(5, 106, 0, 0, 0, 0), +(4, 88, 1, 1, 1, 1); +>>>>>>> .merge-right.r10309 INSERT INTO `PREFIX_module_access` (`id_profile`, `id_module`, `configure`, `view`) (SELECT 2, id_module, 0, 1 FROM PREFIX_module); INSERT INTO `PREFIX_module_access` (`id_profile`, `id_module`, `configure`, `view`) (SELECT 3, id_module, 0, 1 FROM PREFIX_module); diff --git a/install-dev/sql/db_settings_lite.sql b/install-dev/sql/db_settings_lite.sql index 9069821cb..e2ee7f1db 100644 --- a/install-dev/sql/db_settings_lite.sql +++ b/install-dev/sql/db_settings_lite.sql @@ -1052,8 +1052,8 @@ INSERT INTO `PREFIX_tab_lang` (`id_lang`, `id_tab`, `name`) VALUES INSERT INTO `PREFIX_tab_lang` (`id_lang`, `id_tab`, `name`) VALUES (4, 1, 'Katalog'),(4, 2, 'Kunden'),(4, 3, 'Bestellungen'),(4, 4, 'Zahlung'), (4, 5, 'Versandkosten'),(4, 6, 'Statistik'),(4, 7, 'Module'),(4, 8, 'Voreinstellungen'),(4, 9, 'Tools'),(4, 10, 'Hersteller'),(4, 11, 'Attribute und Gruppen'), -(4, 12, 'Adressen'),(4, 13, 'Status'),(4, 14, 'Gutscheine'),(4, 15, 'Währungen'),(4, 16, 'Steuern'),(4, 17, 'Lieferanten'),(4, 18, 'Länder'), -(4, 19, 'Zonen'),(4, 20, 'Preislagen'),(4, 21, 'Gewichtsklassen'),(4, 22, 'Positionen'),(4, 23, 'Datenbank'),(4, 24, 'E-Mail'),(4, 26, 'Bild'), +(4, 12, 'Adressen'),(4, 13, 'Status'),(4, 14, 'Gutscheine'),(4, 15, 'Währungen'),(4, 16, 'Steuern'),(4, 17, 'Versanddienst'),(4, 18, 'Länder'), +(4, 19, 'Zonen'),(4, 20, 'Preisspanne'),(4, 21, 'Gewichtsklassen'),(4, 22, 'Positionen'),(4, 23, 'Datenbank'),(4, 24, 'E-Mail'),(4, 26, 'Bild'), (4, 27, 'Produkte'),(4, 28, 'Kontakte'),(4, 29, 'Mitarbeiter'),(4, 30, 'Profile'),(4, 31, 'Berechtigungen'),(4, 32, 'Sprachen'),(4, 33, 'Übersetzungen'), (4, 34, 'Zulieferer'),(4, 35, 'Tabs'),(4, 36, 'Funktionen'),(4, 37, 'Schnellzugriff'),(4, 38, 'Themen'),(4, 39, 'Kontaktinformation'),(4, 40, 'Alias'), (4, 41, 'Import'),(4, 42, 'Rechnungen'),(4, 43, 'Suche'),(4, 44, 'Lokalisierung'),(4, 46, 'Staaten'),(4, 47, 'Warenrücksendungen'),(4, 48, 'PDF'), @@ -1061,6 +1061,7 @@ INSERT INTO `PREFIX_tab_lang` (`id_lang`, `id_tab`, `name`) VALUES (4, 55, 'Lieferscheine'),(4, 56, 'SEO & URLs'),(4, 57, 'CMS'),(4, 58, 'Image Mapping'),(4, 59, 'Kundennachrichten'),(4, 60, 'Tracking'), (4, 61, 'Suchmaschinen'),(4, 62, 'Referrer'),(4, 63, 'Gruppen'),(4, 64, 'Generatoren'),(4, 65, 'Warenkörbe'),(4, 66, 'Tags'),(4, 67, 'Suche'), (4, 68, 'Anhänge'),(4, 69, 'Konfigurationsinformationen'),(4, 70, 'Leistung'),(4, 71, 'Kundenservice'),(4, 72, 'Webservice'),(4, 73, 'Lagerbewegungen'), +<<<<<<< .working (4, 80, 'Module und Themenkatalog'),(4, 81, 'Mein Konto'),(4, 82, 'Shops'),(4, 83, 'Themen'),(4, 84, 'Geotargeting'),(4, 85, 'Steuerregeln'),(4, 86, 'Log'), (4, 87,'Home'), (4, 88, 'Shops'), (4, 89, 'Group Shops'), (4, 90, 'Shop Urls'),(4, 91, 'Genders'),(4, 92, 'SQL Manager'), (4, 93, 'Products'), diff --git a/install-dev/sql/upgrade/1.4.6.0.sql b/install-dev/sql/upgrade/1.4.6.0.sql new file mode 100644 index 000000000..11a9fee16 --- /dev/null +++ b/install-dev/sql/upgrade/1.4.6.0.sql @@ -0,0 +1,25 @@ +SET NAMES 'utf8'; + +/* PHP:update_order_canada(); */; + +CREATE TABLE IF NOT EXISTS `PREFIX_compare` ( + `id_compare` int(10) unsigned NOT NULL AUTO_INCREMENT, + `id_customer` int(10) unsigned NOT NULL, + PRIMARY KEY (`id_compare`) +) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; + +ALTER TABLE `PREFIX_compare_product` DROP `id_compare_product` , DROP `id_guest` , DROP `id_customer` ; + +ALTER TABLE `PREFIX_compare_product` + ADD `id_compare` int(10) unsigned NOT NULL, + ADD PRIMARY KEY( + `id_compare`, + `id_product`); + +ALTER TABLE `PREFIX_store` CHANGE `latitude` `latitude` DECIMAL(11, 8) NULL DEFAULT NULL; +ALTER TABLE `PREFIX_store` CHANGE `longitude` `longitude` DECIMAL(11, 8) NULL DEFAULT NULL; + +ALTER TABLE `PREFIX_address_format` ADD PRIMARY KEY (`id_country`); +ALTER TABLE `PREFIX_address_format` DROP INDEX `country`; + +/* PHP:hook_blocksearch_on_header(); */; diff --git a/install-dev/xml/doUpgrade.php b/install-dev/xml/doUpgrade.php index 627d022d4..fa5a06ad8 100644 --- a/install-dev/xml/doUpgrade.php +++ b/install-dev/xml/doUpgrade.php @@ -141,6 +141,10 @@ require_once(_PS_INSTALLER_PHP_UPGRADE_DIR_.'update_feature_detachable_cache.php require_once(_PS_INSTALLER_PHP_UPGRADE_DIR_.'add_accounting_tab.php'); +require_once(_PS_INSTALLER_PHP_UPGRADE_DIR_.'hook_blocksearch_on_header.php'); + +require_once(_PS_INSTALLER_PHP_UPGRADE_DIR_.'update_order_canada.php'); + //old version detection global $oldversion, $logger; $oldversion = false; diff --git a/js/attributesBack.js b/js/attributesBack.js index ae3a8a2a9..eab86ba2d 100644 --- a/js/attributesBack.js +++ b/js/attributesBack.js @@ -39,11 +39,9 @@ virtual_product_nb_days, is_shareable) $('#attribute_quantity').html(quantity); $('#attribute_quantity').show(); $('#attr_qty_stock').show(); - if(available_date != undefined) - getE('available_date').value = available_date; - else - getE('available_date').value = '0000-00-00'; - getE('minimal_quantity').value = minimal_quantity; + + $('#attribute_minimal_quantity').val(minimal_quantity); + getE('attribute_reference').value = reference; getE('virtual_product_name_attribute').value = virtual_product_name_attribute; diff --git a/js/hookLiveEdit.js b/js/hookLiveEdit.js index b1edb04af..d9a401908 100644 --- a/js/hookLiveEdit.js +++ b/js/hookLiveEdit.js @@ -3,7 +3,6 @@ var hooks_list = new Array(); var hookable_list = new Array(); var timer; $(document).ready(function() { - $('body').css('margin-bottom', '45px'); $('#fancy').fancybox({ autoDimensions: true, @@ -23,8 +22,7 @@ $(document).ready(function() { if (href != undefined && href != '#' && href.substr(0, baseDir.length) == baseDir) { if (search.length == 0) { $(this).attr('search', hrefAdd); - } - else { + } else { $(this).attr('search', search + '&' + hrefAdd); } } @@ -37,23 +35,19 @@ $(document).ready(function() { }); return false; }); - $('#cancelMove').unbind('click').click(function() { $('#' + cancelMove + '').sortable('cancel'); return false; }); - $('#saveLiveEdit').unbind('click').click(function() { saveModulePosition(); return false; }); - $('#closeLiveEdit').unbind('click').click(function() { $("#live_edit_feedback_str").html('<div style="padding:10px;"><p style="margin-bottom:10px;">' + confirmClose + '</p><p style="height:1.6em;display:block"><a style="margin:auto;float:left" class="button" href="#" onclick="closeLiveEdit();">' + confirm + '</a><a style="margin:auto;float:right;" class="button" href="#" onclick="closeFancybox();">' + cancel + '</a></p></div>'); $("#fancy").attr('href', '#live_edit_feedback'); $("#fancy").trigger("click"); }); - $('.add_module_live_edit').unbind('click').click(function() { $("#live_edit_feedback_str").html('<div style="padding:10px"><img src="img/loadingAnimation.gif"></div>'); $("#fancy").attr('href', '#live_edit_feedback'); @@ -62,17 +56,14 @@ $(document).ready(function() { getHookableModuleList(id.substr(4, id.length)); return false; }); - $('.dndHook').each(function() { var id_hook = $(this).attr('id'); var new_target = ''; var old_target = ''; var cancel = false; - $('#' + id_hook + '').sortable({ opacity: 0.5, cursor: 'move', - connectWith: '.dndHook', receive: function(event, ui) { if (new_target == '') { @@ -83,11 +74,9 @@ $(document).ready(function() { new_target = ui.item[0].parentNode.id; }, stop: function(event, ui) { - if (cancel) { $(this).sortable('cancel'); - } - else { + } else { old_target = event.target.id; cancelMove = old_target; if (new_target == '') new_target = old_target; @@ -103,8 +92,7 @@ $(document).ready(function() { border: '1px solid #72CB67', background: '#DFFAD3' }); - } - else { + } else { ui.placeholder.css({ visibility: 'visible', border: '1px solid #EC9B9B', @@ -126,17 +114,12 @@ function getHookableList() { dataType: 'json', data: 'ajax=true&getHookableList&hooks_list=' + hooks_list + '&modules_list=' + modules_list + '&id_shop=' + get('id_shop'), success: function(jsonData) { - if (jsonData.hasError) - { + if (jsonData.hasError) { var errors = ''; - for(error in jsonData.errors) - //IE6 bug fix - if(error != 'indexOf') - errors += jsonData.errors[error] + "\n"; + for (error in jsonData.errors) //IE6 bug fix + if (error != 'indexOf') errors += jsonData.errors[error] + "\n"; alert(errors); - } - else - hookable_list = jsonData; + } else hookable_list = jsonData; }, error: function(XMLHttpRequest, textStatus, errorThrown) { $('#live_edit_feedback_str').html('<div class="live_edit_feed_back_ko"><img src="img/admin/error.png"><h3>TECHNICAL ERROR:</h3>' + loadFail + '<br><br><a style="margin:auto" class="button" href="#" onclick="closeFancybox();">' + close + '</a></div>'); @@ -145,9 +128,7 @@ function getHookableList() { } }); } - function getHookableModuleList(hook) { - $.ajax({ type: 'GET', url: baseDir + ad + '/ajax.php', @@ -155,7 +136,6 @@ function getHookableModuleList(hook) { dataType: 'json', data: 'ajax=true&getHookableModuleList&hook=' + hook + '&id_shop=' + get('id_shop'), success: function(jsonData) { - var select = '<select id="select_module">'; for (var i = 0; i < jsonData.length; i++) { select += '<option value="' + jsonData[i].id + '">' + jsonData[i].name + '</option>'; @@ -168,7 +148,6 @@ function getHookableModuleList(hook) { } }); } - function saveModulePosition() { $("#live_edit_feedback_str").html('<div style="padding:10px"><img src="img/loadingAnimation.gif"></div>'); $("#fancy").attr('href', '#live_edit_feedback'); @@ -197,17 +176,14 @@ function saveModulePosition() { } }); } - function closeFancybox() { clearTimeout(timer); $.fancybox.close(); $('#live_edit_feedback_str').html(''); } - function closeLiveEdit(){ window.location.href = window.location.protocol+'//'+window.location.host+window.location.pathname; } - function hideFeedback() { $('#live_edit_feed_back').fadeOut('slow', function() { $.fancybox.close(); @@ -221,8 +197,7 @@ function get(name) { var results = regex.exec(window.location.href); if (results == null) { return ""; - } - else { + } else { return results[1]; } } diff --git a/js/jquery/jquery.validate.creditcard2-1.0.1.js b/js/jquery/jquery.validate.creditcard2-1.0.1.js new file mode 100644 index 000000000..47e2b46d5 --- /dev/null +++ b/js/jquery/jquery.validate.creditcard2-1.0.1.js @@ -0,0 +1,95 @@ +/* +* jQuery creditcard2 extension for the jQuery Validation plugin (http://plugins.jquery.com/project/validate). +* Ported from http://www.braemoor.co.uk/software/creditcard.shtml by John Gardner, with some enhancements. +* +* Author: Jack Killpatrick +* Copyright (c) 2010 iHwy, Inc. +* +* Version 1.0.1 (1/12/2010) +* Tested with jquery 1.2.6, but will probably work with earlier versions. +* +* History: +* 1.0.0 - released 2008-11-17 +* 1.0.1 - released 2010-01-12 -> updated card prefixes based on data at: http://en.wikipedia.org/wiki/Credit_card_number and added support for LaserCard +* +* Visit http://www.ihwy.com/labs/jquery-validate-credit-card-extension.aspx for usage information +* +* Dual licensed under the MIT and GPL licenses: +* http://www.opensource.org/licenses/mit-license.php +* http://www.gnu.org/licenses/gpl.html +*/ + +function validateCC(cardNo, cardName) +{ +//jQuery.validator.addMethod("creditcard2", function(value, element, param) { + var cards = new Array(); + cards[0] = { cardName: "Visa", lengths: "13,16", prefixes: "4", checkdigit: true }; + cards[1] = { cardName: "MasterCard", lengths: "16", prefixes: "51,52,53,54,55", checkdigit: true }; + cards[2] = { cardName: "DinersClub", lengths: "14,16", prefixes: "305,36,38,54,55", checkdigit: true }; + cards[3] = { cardName: "CarteBlanche", lengths: "14", prefixes: "300,301,302,303,304,305", checkdigit: true }; + cards[4] = { cardName: "AmEx", lengths: "15", prefixes: "34,37", checkdigit: true }; + cards[5] = { cardName: "Discover", lengths: "16", prefixes: "6011,622,64,65", checkdigit: true }; + cards[6] = { cardName: "JCB", lengths: "16", prefixes: "35", checkdigit: true }; + cards[7] = { cardName: "enRoute", lengths: "15", prefixes: "2014,2149", checkdigit: true }; + cards[8] = { cardName: "Solo", lengths: "16,18,19", prefixes: "6334, 6767", checkdigit: true }; + cards[9] = { cardName: "Switch", lengths: "16,18,19", prefixes: "4903,4905,4911,4936,564182,633110,6333,6759", checkdigit: true }; + cards[10] = { cardName: "Maestro", lengths: "12,13,14,15,16,18,19", prefixes: "5018,5020,5038,6304,6759,6761", checkdigit: true }; + cards[11] = { cardName: "VisaElectron", lengths: "16", prefixes: "417500,4917,4913,4508,4844", checkdigit: true }; + cards[12] = { cardName: "LaserCard", lengths: "16,17,18,19", prefixes: "6304,6706,6771,6709", checkdigit: true }; + + var cardType = -1; + for (var i = 0; i < cards.length; i++) { + if (cardName.toLowerCase() == cards[i].cardName.toLowerCase()) { + cardType = i; + break; + } + } + if (cardType == -1) { return false; } // card type not found + + cardNo = cardNo.replace(/[\s-]/g, ""); // remove spaces and dashes + if (cardNo.length == 0) { return false; } // no length + + var cardexp = /^[0-9]{13,19}$/; + if (!cardexp.exec(cardNo)) { return false; } // has chars or wrong length + + cardNo = cardNo.replace(/\D/g, ""); // strip down to digits + + if (cards[cardType].checkdigit) { + var checksum = 0; + var mychar = ""; + var j = 1; + + var calc; + for (i = cardNo.length - 1; i >= 0; i--) { + calc = Number(cardNo.charAt(i)) * j; + if (calc > 9) { + checksum = checksum + 1; + calc = calc - 10; + } + checksum = checksum + calc; + if (j == 1) { j = 2 } else { j = 1 }; + } + + if (checksum % 10 != 0) { return false; } // not mod10 + } + + var lengthValid = false; + var prefixValid = false; + var prefix = new Array(); + var lengths = new Array(); + + prefix = cards[cardType].prefixes.split(","); + for (i = 0; i < prefix.length; i++) { + var exp = new RegExp("^" + prefix[i]); + if (exp.test(cardNo)) prefixValid = true; + } + if (!prefixValid) { return false; } // invalid prefix + + lengths = cards[cardType].lengths.split(","); + for (j = 0; j < lengths.length; j++) { + if (cardNo.length == lengths[j]) lengthValid = true; + } + if (!lengthValid) { return false; } // wrong length + + return true; +} diff --git a/localization/ca.xml b/localization/ca.xml index f1a670034..5ede757a5 100644 --- a/localization/ca.xml +++ b/localization/ca.xml @@ -51,5 +51,9 @@ <unit type="base_distance" value="ft" /> <unit type="long_distance" value="mi" /> </units> + <configurations> + <configuration name="PS_TAX_DISPLAY" value="1" /> + </configurations> + <group_default price_display_method="1" /> </localizationPack> diff --git a/modules/authorizeaim/authorizeaim.php b/modules/authorizeaim/authorizeaim.php index 116f1706f..2d9e784b3 100755 --- a/modules/authorizeaim/authorizeaim.php +++ b/modules/authorizeaim/authorizeaim.php @@ -1,6 +1,6 @@ <?php /* -* 2007-2011 PrestaShop +* 2007-2011 PrestaShop * * NOTICE OF LICENSE * @@ -27,7 +27,7 @@ if (!defined('_PS_VERSION_')) exit; - + class authorizeAIM extends PaymentModule { public function __construct() @@ -46,19 +46,19 @@ class authorizeAIM extends PaymentModule /* For 1.4.3 and less compatibility */ $updateConfig = array( - 'PS_OS_CHEQUE' => 1, - 'PS_OS_PAYMENT' => 2, - 'PS_OS_PREPARATION' => 3, - 'PS_OS_SHIPPING' => 4, - 'PS_OS_DELIVERED' => 5, + 'PS_OS_CHEQUE' => 1, + 'PS_OS_PAYMENT' => 2, + 'PS_OS_PREPARATION' => 3, + 'PS_OS_SHIPPING' => 4, + 'PS_OS_DELIVERED' => 5, 'PS_OS_CANCELED' => 6, - 'PS_OS_REFUND' => 7, - 'PS_OS_ERROR' => 8, - 'PS_OS_OUTOFSTOCK' => 9, - 'PS_OS_BANKWIRE' => 10, - 'PS_OS_PAYPAL' => 11, + 'PS_OS_REFUND' => 7, + 'PS_OS_ERROR' => 8, + 'PS_OS_OUTOFSTOCK' => 9, + 'PS_OS_BANKWIRE' => 10, + 'PS_OS_PAYPAL' => 11, 'PS_OS_WS_PAYMENT' => 12); - + foreach ($updateConfig as $u => $v) if (!Configuration::get($u) || (int)Configuration::get($u) < 1) { @@ -75,8 +75,8 @@ class authorizeAIM extends PaymentModule public function install() { - return (parent::install() AND $this->registerHook('orderConfirmation') AND - $this->registerHook('payment') AND Configuration::updateValue('AUTHORIZE_AIM_DEMO', 1)); + return (parent::install() && $this->registerHook('orderConfirmation') && $this->registerHook('payment') + AND $this->registerHook('header') && Configuration::updateValue('AUTHORIZE_AIM_DEMO', 1)); } public function uninstall() @@ -94,15 +94,15 @@ class authorizeAIM extends PaymentModule public function hookOrderConfirmation($params) { - if ($params['objOrder']->module != $this->name) + if ($params['objOrder']->module != $this->name) return; - if ($params['objOrder']->getCurrentState() != Configuration::get('PS_OS_ERROR')) + if ($params['objOrder']->getCurrentState() != Configuration::get('PS_OS_ERROR')) $this->context->smarty->assign(array('status' => 'ok', 'id_order' => intval($params['objOrder']->id))); else $this->context->smarty->assign('status', 'failed'); - return $this->display(__FILE__, 'hookorderconfirmation.tpl'); + return $this->display(__FILE__, 'hookorderconfirmation.tpl'); } public function getContent() @@ -165,7 +165,7 @@ class authorizeAIM extends PaymentModule if (Configuration::get('PS_SSL_ENABLED') || (!empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) != 'off')) { $invoiceAddress = new Address((int)$params['cart']->id_address_invoice); - + $authorizeAIMParams = array(); $authorizeAIMParams['x_login'] = Configuration::get('AUTHORIZE_AIM_LOGIN_ID'); $authorizeAIMParams['x_tran_key'] = Configuration::get('AUTHORIZE_AIM_KEY'); @@ -182,7 +182,7 @@ class authorizeAIM extends PaymentModule $authorizeAIMParams['x_zip'] = $invoiceAddress->postcode; $authorizeAIMParams['x_first_name'] = $this->context->customer->firstname; $authorizeAIMParams['x_last_name'] = $this->context->customer->lastname; - + $isFailed = Tools::getValue('aimerror'); $cards = array(); @@ -198,31 +198,35 @@ class authorizeAIM extends PaymentModule return $this->display(__FILE__, 'authorizeaim.tpl'); } } - - /** - * Set the detail of a payment - Call before the validate order init - * correctly the pcc object - * See Authorize documentation to know the associated key => value - * @param array fields - */ - public function setTransactionDetail($response) - { - // If Exist we can store the details - if (isset($this->pcc)) - { - $this->pcc->transaction_id = (string)$response[6]; - + + public function hookHeader() + { + Tools::addJS(_PS_JS_DIR_.'jquery/jquery.validate.creditcard2-1.0.1.js'); + } + + /** + * Set the detail of a payment - Call before the validate order init + * correctly the pcc object + * See Authorize documentation to know the associated key => value + * @param array fields + */ + public function setTransactionDetail($response) + { + // If Exist we can store the details + if (isset($this->pcc)) + { + $this->pcc->transaction_id = (string)$response[6]; + // 50 => Card number (XXXX0000) $this->pcc->card_number = (string)substr($response[50], -4); - + // 51 => Card Mark (Visa, Master card) $this->pcc->card_brand = (string)$response[51]; - + $this->pcc->card_expiration = (string)Tools::getValue('x_exp_date'); - + // 68 => Owner name $this->pcc->card_holder = (string)$response[68]; - } - } + } + } } -?> diff --git a/modules/authorizeaim/authorizeaim.tpl b/modules/authorizeaim/authorizeaim.tpl index 41ef2305c..47df17b28 100755 --- a/modules/authorizeaim/authorizeaim.tpl +++ b/modules/authorizeaim/authorizeaim.tpl @@ -30,22 +30,14 @@ <p style="color: red;">{l s='Error, please verify the card information' mod='authorizeaim'}</p> {/if} - <form id="aut" name="authorizeaim_form" action="{$module_dir}validation.php" method="post"> + <form id="aut" name="authorizeaim_form" id="authorizeaim_form" action="{$module_dir}validation.php" method="post"> <span style="border: 1px solid #595A5E;display: block;padding: 0.6em;text-decoration: none;margin-left: 0.7em;"> - <a id="click_authorizeaim" href="#" title="{l s='Pay with authorizeaim' mod='authorizeaim'}" style="display: block;text-decoration: none;"> - {if $cards.visa == 1} - <img src="{$module_dir}cards/visa.gif" alt="{l s='visa logo' mod='authorizeaim'}" /> - {/if} - {if $cards.mastercard == 1} - <img src="{$module_dir}cards/mastercard.gif" alt="{l s='mastercard logo' mod='authorizeaim'}" /> - {/if} - {if $cards.discover == 1} - <img src="{$module_dir}cards/discover.gif" alt="{l s='discover logo' mod='authorizeaim'}" /> - {/if} - {if $cards.ax == 1} - <img src="{$module_dir}cards/ax.gif" alt="{l s='american express logo' mod='authorizeaim'}" /> - {/if} - {l s='Secured credit card payment with Authorize.net' mod='authorizeaim'} + <a id="click_authorizeaim" href="#" title="{l s='Pay with authorizeaim' mod='authorizeaim'}" style="display: block;text-decoration: none; font-weight: bold;"> + {if $cards.visa == 1}<img src="{$module_dir}cards/visa.gif" alt="{l s='visa logo' mod='authorizeaim'}" style="vertical-align: middle;" />{/if} + {if $cards.mastercard == 1}<img src="{$module_dir}cards/mastercard.gif" alt="{l s='mastercard logo' mod='authorizeaim'}" style="vertical-align: middle;" />{/if} + {if $cards.discover == 1}<img src="{$module_dir}cards/discover.gif" alt="{l s='discover logo' mod='authorizeaim'}" style="vertical-align: middle;" />{/if} + {if $cards.ax == 1}<img src="{$module_dir}cards/ax.gif" alt="{l s='american express logo' mod='authorizeaim'}" style="vertical-align: middle;" />{/if} +   {l s='Secured credit card payment with Authorize.net' mod='authorizeaim'} </a> {if $isFailed == 0} @@ -53,16 +45,28 @@ {else} <div id="aut2"> {/if} - <br /> + <br /><br /> - <img src="{$module_dir}logoa.gif" alt="secure payment" style="float: left;margin-top:40px;"/> + <div style="width: 136px; height: 165px; float: left; padding-top:40px; padding-right: 20px; border-right: 1px solid #DDD;"> + <img src="{$module_dir}logoa.gif" alt="secure payment" /> + </div> {foreach from=$p key=k item=v} <input type="hidden" name="{$k}" value="{$v}" /> {/foreach} - <label style="margin-left: 50px;display: block;width: 85px;float: left;">{l s='Full name' mod='authorizeaim'}</label> <input type="text" name="name" size="20" maxlength="25S" /><img src="{$module_dir}secure.png" alt="" style="margin-left: 5px;" /><br /><br /> - <label style="margin-left: 50px;display: block;width: 85px;float: left;">{l s='Card number' mod='authorizeaim'}</label> <input type="text" id="ccn" name="x_card_num" size="16" maxlength="16" autocomplete="Off"/><img src="{$module_dir}secure.png" alt="" style="margin-left: 5px;" /><br /><br /> - <label style="margin-left: 50px;display: block;width: 85px;float: left;">{l s='Expiration date' mod='authorizeaim'}</label> + <label style="margin-top: 4px; margin-left: 40px;display: block;width: 90px;float: left;">{l s='Full name' mod='authorizeaim'}</label> <input type="text" name="name" id="fullname" size="30" maxlength="25S" /><img src="{$module_dir}secure.png" alt="" style="margin-left: 5px;" /><br /><br /> + + <label style="margin-top: 4px; margin-left: 40px;display: block;width: 90px;float: left;">{l s='Card Type' mod='authorizeaim'}</label> + <select id="cardType"> + {if $cards.ax == 1}<option value="AmEx">American Express</option>{/if} + {if $cards.visa == 1}<option value="Visa">Visa</option>{/if} + {if $cards.mastercard == 1}<option value="MasterCard">MasterCard</option>{/if} + {if $cards.discover == 1}<option value="Discover">Discover</option>{/if} + </select> + <img src="{$module_dir}secure.png" alt="" style="margin-left: 5px;" /><br /><br /> + + <label style="margin-top: 4px; margin-left: 40px;display: block;width: 90px;float: left;">{l s='Card number' mod='authorizeaim'}</label> <input type="text" name="x_card_num" id="cardnum" size="30" maxlength="16" autocomplete="Off" /><img src="{$module_dir}secure.png" alt="" style="margin-left: 5px;" /><br /><br /> + <label style="margin-top: 4px; margin-left: 40px;display: block;width: 90px;float: left;">{l s='Expiration date' mod='authorizeaim'}</label> <select id="x_exp_date_m" name="x_exp_date_m" style="width:60px;">{section name=date_m start=01 loop=13} <option value="{$smarty.section.date_m.index}">{$smarty.section.date_m.index}</option>{/section} </select> @@ -71,15 +75,16 @@ <option value="{$smarty.section.date_y.index}">20{$smarty.section.date_y.index}</option>{/section} </select> <img src="{$module_dir}secure.png" alt="" style="margin-left: 5px;" /><br /><br /> - <label style="margin-left: 186px;display: block;width: 85px;float: left;">{l s='CVV' mod='authorizeaim'}</label> <input type="text" name="x_card_code" size="4" maxlength="4" /><img src="{$module_dir}secure.png" alt="" style="margin-left: 5px;"/> <img src="{$module_dir}help.png" id="cvv_help" title="{l s='the 3 last digits on the back of your credit card' mod='authorizeaim'}" alt="" /><br /><br /> + <label style="margin-top: 4px; margin-left: 40px;display: block;width: 90px;float: left;">{l s='CVV' mod='authorizeaim'}</label> <input type="text" name="x_card_code" id="x_card_code" size="4" maxlength="4" /><img src="{$module_dir}secure.png" alt="" style="margin-left: 5px;"/> <img src="{$module_dir}help.png" id="cvv_help" title="{l s='the 3 last digits on the back of your credit card' mod='authorizeaim'}" alt="" /><br /><br /> <img src="{$module_dir}cvv.png" id="cvv_help_img" alt=""style="display: none;margin-left: 211px;" /> - <input type="button" id="asubmit" value="{l s='Validate order' mod='authorizeaim'}" style="margin-left: 236px;" class="button"/> + <input type="button" id="asubmit" value="{l s='Validate order' mod='authorizeaim'}" style="margin-left: 129px; padding-left: 25px; padding-right: 25px;" class="button" /> </div> </span> </form> </p> <script type="text/javascript"> - var mess_error = "{l s='Your card number is false' mod='authorizeaim' js=1}"; + var mess_error = "{l s='Please check your credit card information (Credit card type, number and expiration date)' mod='authorizeaim' js=1}"; + var mess_error2 = "{l s='Please specify your Full Name' mod='authorizeaim' js=1}"; {literal} $(document).ready(function(){ $('#x_exp_date_m').children('option').each(function() @@ -107,9 +112,14 @@ $('#cvv_help').unbind(); }); - $('#asubmit').click(function(){ - if ($('#ccn').val() < 13) + $('#asubmit').click(function() { + if ($('#fullname').val() == '') + { + alert(mess_error2); + } + else if (!validateCC($('#cardnum').val(), $('#cardType').val()) || $('#x_card_code').val() == '') + { alert(mess_error); } else @@ -118,5 +128,6 @@ } }); }); + {/literal} -</script> +</script> \ No newline at end of file diff --git a/modules/autoupgrade/AdminSelfUpgrade.php b/modules/autoupgrade/AdminSelfUpgrade.php index 8aeb8c242..c945baaee 100644 --- a/modules/autoupgrade/AdminSelfUpgrade.php +++ b/modules/autoupgrade/AdminSelfUpgrade.php @@ -49,7 +49,7 @@ if(empty($_POST['action']) OR !in_array($_POST['action'],array('upgradeDb'))) // Add Upgrader class : if > 1.4.5.0 , uses core class // otherwise, use Upgrader.php in modules. // in both cases, use override if files exists - if (!version_compare(_PS_VERSION_,'1.4.5.0','<') && file_exists(_PS_ROOT_DIR_.'/classes/Upgrader.php')) + if (!version_compare(_PS_VERSION_,'1.4.6.0','<') && file_exists(_PS_ROOT_DIR_.'/classes/Upgrader.php')) require_once(_PS_ROOT_DIR_.'/classes/Upgrader.php'); else require_once(dirname(__FILE__).'/Upgrader.php'); @@ -118,6 +118,8 @@ class AdminSelfUpgrade extends AdminSelfTab public $prodRootDir = ''; public $adminDir = ''; public $rootWritable = false; + + public $lastAutoupgradeVersion = ''; public $svnDir = 'svn'; public $destDownloadFilename = 'prestashop.zip'; public $toUpgradeFileList = 'filesToUpgrade.list'; @@ -156,7 +158,7 @@ class AdminSelfUpgrade extends AdminSelfTab * value = the next step you want instead * example : public static $skipAction = array('download' => 'upgradeFiles'); */ - public static $skipAction; + public static $skipAction = array(); public $useSvn; protected $_includeContainer = false; @@ -276,14 +278,42 @@ class AdminSelfUpgrade extends AdminSelfTab public function configOk() { - $allowed = (ConfigurationTest::test_fopen() && $this->rootWritable); - $allowed &= !Configuration::get('PS_SHOP_ENABLE'); - $allowed &= $this->upgrader->autoupgrade; - $allowed &= (Configuration::get('PS_AUTOUP_KEEP_TRAD') !== false); - + $allowed_array = $this->getCheckCurrentConfig(); + $allowed = array_product($allowed_array); return $allowed; } + public function getcheckCurrentConfig() + { + static $allowed_array; + + if(empty($allowed_array)) + { + $allowed_array = array(); + $allowed_array['fopen'] = ConfigurationTest::test_fopen(); + $allowed_array['root_writable'] = $this->rootWritable; + $allowed_array['shop_enabled'] = !Configuration::get('PS_SHOP_ENABLE'); + $allowed_array['autoupgrade_allowed'] = $this->upgrader->autoupgrade; + $module_version = '0.1'; + if ($module_version = simplexml_load_file(dirname(__FILE__).'/config.xml')) + $module_version = (string)$module_version->version; + $allowed_array['module_version_ok'] = version_compare($module_version, $this->upgrader->autoupgrade_last_version, '>='); + // if one option has been defined, all options are. + $allowed_array['module_configured'] = (Configuration::get('PS_AUTOUP_KEEP_TRAD') !== false); + } + return $allowed_array; + } + + + public function checkAutoupgradeLastVersion(){ + if ($module_version = simplexml_load_file(_PS_MODULE_DIR_.'autoupgrade'.'/config.xml')) + $module_version = (string)$module_version['version']; + else + $module_version = ''; + + return version_compare($this->upgrader->autoupgrade_last_version, $module_version, '=='); + } + /** * isUpgradeAllowed checks if all server configuration is valid for upgrade * @@ -315,7 +345,7 @@ class AdminSelfUpgrade extends AdminSelfTab $this->action = empty($_REQUEST['action'])?null:$_REQUEST['action']; $this->currentParams = empty($_REQUEST['params'])?null:$_REQUEST['params']; // test writable recursively - if(version_compare(_PS_VERSION_,'1.4.5.0','<')) + if(version_compare(_PS_VERSION_,'1.4.6.0','<') || !class_exists('ConfigurationTest', false)) { require_once('ConfigurationTest.php'); if(!class_exists('ConfigurationTest', false) AND class_exists('ConfigurationTestCore')) @@ -324,8 +354,9 @@ class AdminSelfUpgrade extends AdminSelfTab if (ConfigurationTest::test_dir($this->prodRootDir,true)) $this->rootWritable = true; - if (!in_array($this->action,array('upgradeFile', 'upgradeDb', 'upgradeComplete','rollback','restoreFiles','restoreDb'))) + if (!in_array($this->action, array('upgradeFile', 'upgradeDb', 'upgradeComplete','rollback','restoreFiles','restoreDb', 'checkFilesVersion'))) { + $this->upgrader = new Upgrader(); $this->upgrader->checkPSVersion(); $this->nextParams['install_version'] = $this->upgrader->version_num; @@ -464,8 +495,21 @@ class AdminSelfUpgrade extends AdminSelfTab } public function ajaxProcessCheckFilesVersion() { - if ($this->upgrader->isAuthenticPrestashopVersion() !== false) + $this->_loadDbRelatedClasses(); + $this->upgrader = new Upgrader(); + + $changedFileList = $this->upgrader->getChangedFilesList(); + if ($this->upgrader->isAuthenticPrestashopVersion() == true + && !is_array($changedFileList) ) { + $this->nextParams['status'] = 'error'; + $this->nextParams['msg'] = '[TECHNICAL ERROR] Unable to check files'; + $testOrigCore = false; + } + else + { + if ($this->upgrader->isAuthenticPrestashopVersion() != false) + { $this->nextParams['status'] = 'ok'; $testOrigCore = true; } @@ -475,7 +519,6 @@ class AdminSelfUpgrade extends AdminSelfTab $this->nextParams['status'] = 'warn'; } - $changedFileList = $this->upgrader->getChangedFilesList(); if (!isset($changedFileList['core'])) $changedFileList['core'] = array(); if (!isset($changedFileList['translation'])) @@ -495,6 +538,7 @@ class AdminSelfUpgrade extends AdminSelfTab } $this->nextParams['result'] = $changedFileList; } + } public function ajaxProcessUpgradeNow() { @@ -551,7 +595,7 @@ class AdminSelfUpgrade extends AdminSelfTab /** * extract last version into admin/autoupgrade/latest directory - * + * * @return void */ public function ajaxProcessUnzip(){ @@ -938,7 +982,7 @@ class AdminSelfUpgrade extends AdminSelfTab } /** - * ajaxProcessRestoreFiles restore the previously saved files, + * ajaxProcessRestoreFiles restore the previously saved files, * and delete files that weren't archived * * @return boolean true if succeed @@ -947,13 +991,13 @@ class AdminSelfUpgrade extends AdminSelfTab { $this->next = 'restoreFiles'; // @TODO : workaround max_execution_time / ajax batch unzip - // very first restoreFiles step : extract backup + // very first restoreFiles step : extract backup if (!empty($this->backupFilesFilename) AND file_exists($this->backupFilesFilename)) { // cleanup current PS tree $fromArchive = $this->_listArchivedFiles(); file_put_contents($this->autoupgradePath.DIRECTORY_SEPARATOR.$this->fromArchiveFileList, serialize($fromArchive)); - + //$this->_cleanUp($this->prodRootDir.'/'); $this->nextQuickInfo[] = $this->l('root directory cleaned.'); @@ -963,7 +1007,7 @@ class AdminSelfUpgrade extends AdminSelfTab if (self::ZipExtract($filepath, $destExtract)) { $this->next = 'restoreFiles'; - // get new file list + // get new file list $this->nextDesc = $this->l('Files restored. Removing files added by upgrade ...'); // once it's restored, do not delete the archive file. This has to be done manually // but we can empty the var, to avoid loop. @@ -977,9 +1021,9 @@ class AdminSelfUpgrade extends AdminSelfTab return false; } } - + // very second restoreFiles step : remove new files that shouldn't be there - // for that, we will make a diff between the current filelist in root dir + // for that, we will make a diff between the current filelist in root dir // and the archive file list we previously saved // files to remove : differences between complete list and archive list if (!file_exists($this->autoupgradePath.DIRECTORY_SEPARATOR.$this->toRemoveFileList)) @@ -989,7 +1033,7 @@ class AdminSelfUpgrade extends AdminSelfTab $toRemove = array_diff($this->_listFilesInDir($this->prodRootDir), $fromArchive); file_put_contents($this->autoupgradePath.DIRECTORY_SEPARATOR.$this->toRemoveFileList,serialize($toRemove)); } - + if (!isset($toRemove)) $toRemove = unserialize(file_get_contents($this->toRemoveFileList)); @@ -1007,8 +1051,8 @@ class AdminSelfUpgrade extends AdminSelfTab else { $checkFile = array_shift($toRemove); - // - if (in_array($checkFile, $toRemove) + // + if (in_array($checkFile, $toRemove) && !$this->_skipFile('', $path.$file, 'backup') && !$this->_skipFile('', $path.$file, 'upgrade') ) @@ -1461,8 +1505,7 @@ class AdminSelfUpgrade extends AdminSelfTab */ public function displayConf() { - - if (version_compare(_PS_VERSION_,'1.4.6.0','<') AND false) + if (version_compare(_PS_VERSION_,'1.4.5.0','<') AND false) $this->_errors[] = Tools::displayError('This class depends of several files modified in 1.4.5.0 version and should not be used in an older version'); parent::displayConf(); } @@ -1470,10 +1513,10 @@ class AdminSelfUpgrade extends AdminSelfTab public function ajaxPreProcess() { /* PrestaShop demo mode */ - if (_PS_MODE_DEMO_) + if (defined('_PS_MODE_DEMO_') && _PS_MODE_DEMO_) return; /* PrestaShop demo mode*/ - + if (!empty($_POST['responseType']) AND $_POST['responseType'] == 'json') header('Content-Type: application/json'); @@ -1587,7 +1630,7 @@ txtError[37] = "'.$this->l('The config/defines.inc.php file was not found. Where } /** this returns fieldset containing the configuration points you need to use autoupgrade - * @return string + * @return string */ private function getCurrentConfiguration() { @@ -1597,6 +1640,19 @@ txtError[37] = "'.$this->l('The config/defines.inc.php file was not found. Where <p>'.$this->l('All the following points must be ok in order to allow the upgrade.').'</p> <b>'.$this->l('Root directory').' : </b>'.$this->prodRootDir.'<br/><br/>'; + if ($this->checkAutoupgradeLastVersion()) + $srcModuleVersion = '../img/admin/enabled.gif'; + else + $srcModuleVersion = '../img/admin/disabled.gif'; + + if ($module_version = simplexml_load_file(dirname(__FILE__).'/config.xml')) + $module_version = (string)$module_version->version; + + $content .= '<b>'.$this->l('Module version').' : </b>' + .'<img src="'.$srcModuleVersion.'" /> ' + .sprintf($this->lastAutoupgradeVersion? + $this->l('You have the last version (%s)'):$this->l('You currently use the version %1$s of the autoupgrade module. Please install the last version (%2$s)'), $module_version, $this->upgrader->autoupgrade_last_version).'<br/><br/>'; + if ($this->rootWritable) $srcRootWritable = '../img/admin/enabled.gif'; else @@ -1645,7 +1701,7 @@ txtError[37] = "'.$this->l('The config/defines.inc.php file was not found. Where $configurationDone = '../img/admin/enabled.gif'; else $configurationDone = '../img/admin/disabled.gif'; - $content .= '<b>'.$this->l('Options chosen').' : </b>'.'<img src="'.$configurationDone.'" /> + $content .= '<b>'.$this->l('Options chosen').' : </b>'.'<img src="'.$configurationDone.'" /> <a class="button" id="scrollToOptions" href="#options">' .($testConfigDone ?$this->l('autoupgrade configuration ok').' - '.$this->l('Modify your options') @@ -1673,7 +1729,7 @@ txtError[37] = "'.$this->l('The config/defines.inc.php file was not found. Where $content .= '<script type="text/javascript"> $("#currentConfigurationToggle").click(function(e){e.preventDefault();$("#currentConfiguration").toggle()});' .($this->configOk()?'$("#currentConfiguration").hide();$("#currentConfigurationToggle").after("<img src=\"../img/admin/enabled.gif\" />");':'').'</script>'; - $content .= '<div style="float:left"> + $content .= '<div style="clear:left"> </div><div style="float:left"> <h1>'.sprintf($this->l('Your current prestashop version : %s '),_PS_VERSION_).'</h1>'; $content .= '<p>'.sprintf($this->l('Last version is %1$s (%2$s) '), $this->upgrader->version_name, $this->upgrader->version_num).'</p>'; @@ -1700,10 +1756,10 @@ txtError[37] = "'.$this->l('The config/defines.inc.php file was not found. Where { $content .= '<span class="button-autoupgrade upgradestep" >'.$this->l('Your shop is already up to date.').'</span> '; } - $content .= '<br/><br/><small>'.sprintf($this->l('last datetime check : %s '),date('Y-m-d H:i:s',Configuration::get('PS_LAST_VERSION_CHECK'))).'</span> + $content .= '<br/><br/><small>'.sprintf($this->l('last datetime check : %s '),date('Y-m-d H:i:s',Configuration::get('PS_LAST_VERSION_CHECK'))).'</span> <a class="button" href="index.php?tab=AdminSelfUpgrade&token='.Tools::getAdminToken('AdminSelfUpgrade'.(int)(Tab::getIdFromClassName(get_class($this))).(int)$cookie->id_employee).'&refreshCurrentVersion=1">'.$this->l('Please click to refresh').'</a> </small>'; - + $content .= '</div> <div id="currentlyProcessing" style="display:none;float:right"><h4>Currently processing <img id="pleaseWait" src="'.__PS_BASE_URI__.'img/loader.gif"/></h4> @@ -1747,7 +1803,7 @@ txtError[37] = "'.$this->l('The config/defines.inc.php file was not found. Where else $content .= '<p>'.$this->l('Your current configuration does not allow upgrade.').'</p>'; - $content .= '<br/><br/><small>'.sprintf($this->l('last datetime check : %s '),date('Y-m-d H:i:s',Configuration::get('PS_LAST_VERSION_CHECK'))).'</span> + $content .= '<br/><br/><small>'.sprintf($this->l('last datetime check : %s '),date('Y-m-d H:i:s',Configuration::get('PS_LAST_VERSION_CHECK'))).'</span> <a class="button" href="index.php?tab=AdminSelfUpgrade&token='.Tools::getAdminToken('AdminSelfUpgrade'.(int)(Tab::getIdFromClassName(get_class($this))).(int)$cookie->id_employee).'&refreshCurrentVersion=1">'.$this->l('Please click to refresh').'</a> </small>'; @@ -1773,14 +1829,13 @@ txtError[37] = "'.$this->l('The config/defines.inc.php file was not found. Where public function display() { /* PrestaShop demo mode */ - if (_PS_MODE_DEMO_) + if (defined('_PS_MODE_DEMO_') && _PS_MODE_DEMO_) { echo '<div class="error">'.Tools::displayError('This functionnality has been disabled.').'</div>'; return; } /* PrestaShop demo mode*/ - if(isset($_GET['refreshCurrentVersion'])) { $upgrader = new Upgrader(); @@ -1823,7 +1878,7 @@ txtError[37] = "'.$this->l('The config/defines.inc.php file was not found. Where $this->_displayForm('autoUpgradeOptions',$this->_fieldsAutoUpgrade,'<a href="" name="options" id="options">'.$this->l('Options').'</a>', '','prefs'); // @todo manual upload with a form - // We need jquery 1.6 for json + // We need jquery 1.6 for json echo '<script type="text/javascript"> jq13 = jQuery.noConflict(true); </script> @@ -2225,7 +2280,7 @@ function handleError(res) $("#cchangedList").append("<br/>"); }'; - + $js.= '$(document).ready(function(){ $.ajax({ type:"POST", @@ -2264,6 +2319,7 @@ function handleError(res) , error: function(res,textStatus,jqXHR) { + //$("#checkPrestaShopFilesVersion").html("<img src=\"../img/admin/warning.gif\" /> "+textStatus); if (textStatus == "timeout" && action == "download") { updateInfoStep("'.$this->l('Your server can\'t download the file. Please upload it first by ftp in your admin/autoupgrade directory').'"); @@ -2299,7 +2355,7 @@ function handleError(res) $zip = new ZipArchive(); if ($zip->open($fromFile) === true) { - if (@$zip->extractTo($toDir.'/') + if (@$zip->extractTo($toDir.'/') && $zip->close() ) { diff --git a/modules/autoupgrade/Upgrader.php b/modules/autoupgrade/Upgrader.php index c4c4c1327..8a7ae8330 100644 --- a/modules/autoupgrade/Upgrader.php +++ b/modules/autoupgrade/Upgrader.php @@ -39,15 +39,26 @@ class UpgraderCore public $version_name; public $version_num; + public $version_is_modified = null; /** * @var string contains hte url where to download the file */ public $link; public $autoupgrade; public $autoupgrade_module; + public $autoupgrade_last_version; public $changelog; public $md5; + public function __construct($autoload = false) + { + if ($autoload) + { + $this->loadFromConfig(); + // checkPSVersion to get need_upgrade + $this->checkPSVersion(); + } + } public function __get($var) { if ($var == 'need_upgrade') @@ -90,8 +101,7 @@ class UpgraderCore */ public function checkPSVersion($force = false) { - if (empty($this->link)) - { + if (class_exists('Configuration')) $last_check = Configuration::get('PS_LAST_VERSION_CHECK'); else @@ -103,7 +113,6 @@ class UpgraderCore libxml_set_streams_context(@stream_context_create(array('http' => array('timeout' => 3)))); if ($feed = @simplexml_load_file($this->rss_version_link)) { - $this->version_name = (string)$feed->version->name; $this->version_num = (string)$feed->version->num; $this->link = (string)$feed->download->link; @@ -111,6 +120,7 @@ class UpgraderCore $this->changelog = (string)$feed->download->changelog; $this->autoupgrade = (int)$feed->autoupgrade; $this->autoupgrade_module = (int)$feed->autoupgrade_module; + $this->autoupgrade_last_version = (string)$feed->autoupgrade_last_version; $this->desc = (string)$feed->desc ; $config_last_version = array( 'name' => $this->version_name, @@ -119,6 +129,7 @@ class UpgraderCore 'md5' => $this->md5, 'autoupgrade' => $this->autoupgrade, 'autoupgrade_module' => $this->autoupgrade_module, + 'autoupgrade_last_version' => $this->autoupgrade_last_version, 'changelog' => $this->changelog, 'desc' => $this->desc ); @@ -130,8 +141,29 @@ class UpgraderCore } } else + $this->loadFromConfig(); + // retro-compatibility : + // return array(name,link) if you don't use the last version + // false otherwise + if (version_compare(_PS_VERSION_, $this->version_num, '<')) { + $this->need_upgrade = true; + return array('name' => $this->version_name, 'link' => $this->link); + } + else + return false; + } + + /** + * load the last version informations stocked in base + * + * @return $this + */ + public function loadFromConfig() + { $last_version_check = @unserialize(Configuration::get('PS_LAST_VERSION')); + if($last_version_check) + { if (isset($last_version_check['name'])) $this->version_name = $last_version_check['name']; if (isset($last_version_check['num'])) @@ -142,6 +174,8 @@ class UpgraderCore $this->autoupgrade = $last_version_check['autoupgrade']; if (isset($last_version_check['autoupgrade_module'])) $this->autoupgrade_module = $last_version_check['autoupgrade_module']; + if (isset($last_version_check['autoupgrade_last_version'])) + $this->autoupgrade_last_version = $last_version_check['autoupgrade_last_version']; if (isset($last_version_check['md5'])) $this->md5 = $last_version_check['md5']; if (isset($last_version_check['desc'])) @@ -149,26 +183,23 @@ class UpgraderCore if (isset($last_version_check['changelog'])) $this->changelog = $last_version_check['changelog']; } + return $this; } - // retro-compatibility : - // return array(name,link) if you don't use the last version - // false otherwise - if (version_compare(_PS_VERSION_, $this->version_num, '<')) - { - $this->need_upgrade = true; - return array('name' => $this->version_name, 'link' => $this->link); - } - else - return false; - } + /** + * return an array of files + * that the md5file does not match to the original md5file (provided by $rss_md5file_link_dir ) + * @return void + */ public function getChangedFilesList() { - if (count($this->changed_files) == 0) + if (is_array($this->changed_files) && count($this->changed_files) == 0) { $checksum = @simplexml_load_file($this->rss_md5file_link_dir._PS_VERSION_.'.xml'); - if ($checksum === false) - return false; + if ($checksum == false) + { + $this->changed_files = false; + } else $this->browseXmlAndCompare($checksum->ps_root_dir[0]); } @@ -248,6 +279,7 @@ class UpgraderCore public function isAuthenticPrestashopVersion() { + $this->getChangedFilesList(); return !$this->version_is_modified; } diff --git a/modules/autoupgrade/autoupgrade.php b/modules/autoupgrade/autoupgrade.php index 0329546c4..cfe050d50 100644 --- a/modules/autoupgrade/autoupgrade.php +++ b/modules/autoupgrade/autoupgrade.php @@ -31,7 +31,10 @@ class Autoupgrade extends Module { $this->name = 'autoupgrade'; $this->tab = 'administration'; - $this->version = 0.1; + // version number x.y.z + // y+1 means a major bugfix or improvement + // z+1 means a bugfix + $this->version = '0.2.1'; if (!defined('_PS_ADMIN_DIR_')) { @@ -53,7 +56,6 @@ class Autoupgrade extends Module public function install() { - $res = true; // before adding AdminSelfUpgrade, we should remove AdminUpgrade $idTab = Tab::getIdFromClassName('AdminUpgrade'); @@ -72,7 +74,9 @@ class Autoupgrade extends Module $tab->class_name = 'AdminSelfUpgrade'; $tab->module = 'autoupgrade'; $tab->id_parent = 9; - $tab->name = array_fill(1, sizeof(Language::getLanguages(false)), 'Upgrade'); + $languages = Language::getLanguages(false); + foreach ($languages as $lang) + $tab->name[$lang['id_lang']] = 'Upgrade'; $res &= $tab->save(); } else @@ -103,12 +107,18 @@ class Autoupgrade extends Module public function uninstall() { - $idtab = Configuration::get('PS_AUTOUPDATE_MODULE_IDTAB'); - $tab = new Tab($idtab,1); + $id_tab = Configuration::get('PS_AUTOUPDATE_MODULE_IDTAB'); + if ($id_tab) + { + $tab = new Tab($id_tab,1); $res = $tab->delete(); + } + else + $res = true; + // for people in 1.4.4.0 or 1.4.4.1, we have to remove that file + // and of course delete it in the database. if (file_exists(_PS_ADMIN_DIR_.DIRECTORY_SEPARATOR.'tabs'.'AdminUpgrade.php')) { - // Should we create the correct AdminUpgrade tab (not the module) if($idOldTab = Tab::getIdFromClassName('AdminUpgrade')) { $tab = new Tab($idOldTab); diff --git a/modules/autoupgrade/config.xml b/modules/autoupgrade/config.xml index ddaa5099f..bb4fe09e7 100644 --- a/modules/autoupgrade/config.xml +++ b/modules/autoupgrade/config.xml @@ -2,7 +2,7 @@ <module> <name>autoupgrade</name> <displayName><![CDATA[Autoupgrade module]]></displayName> - <version><![CDATA[0.1]]></version> + <version><![CDATA[0.2.1]]></version> <description><![CDATA[Provides an automated method to upgrade your shop to the last PrestaShop version. Caution : custom theme are not updated.]]></description> <author><![CDATA[]]></author> <tab><![CDATA[administration]]></tab> diff --git a/modules/autoupgrade/fr.php b/modules/autoupgrade/fr.php index 8e7b106a3..6f5aecc2b 100644 --- a/modules/autoupgrade/fr.php +++ b/modules/autoupgrade/fr.php @@ -21,7 +21,7 @@ $_MODULE['<{autoupgrade}prestashop>adminselfupgrade_8d8e0207549d32c6f86424640303 $_MODULE['<{autoupgrade}prestashop>adminselfupgrade_c62f82b25de72c3b0bb07225c49fe9d0'] = '%1$s fichier(s) du coeur a été modifié (sur %2$s au total)'; $_MODULE['<{autoupgrade}prestashop>adminselfupgrade_7b2f224649ef2ad10a2d73595d67a876'] = 'Démarrage mise à niveau ...'; $_MODULE['<{autoupgrade}prestashop>adminselfupgrade_6b2d0404b7faba0e791e15a52586a149'] = 'Basculer vers svn checkout (useSvn activé)'; -$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_f0e38ac0c558a7f216ae98382b9e58f5'] = 'Site désactivé. Téléchargement en cours (peut prendre '; +$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_13b35313a987313838f0105902bb6742'] = 'Boutique désactivée. Téléchargement en cours... (ce qui peut prendre un certain temps) ...'; $_MODULE['<{autoupgrade}prestashop>adminselfupgrade_6824d57b7af37f605bd97d34defc3761'] = 'Exportation svn terminée. Suppression des fichiers exemples...'; $_MODULE['<{autoupgrade}prestashop>adminselfupgrade_f70307d8297e48a8783d41e6f3313d51'] = 'Erreur lors de l\'export SVN'; $_MODULE['<{autoupgrade}prestashop>adminselfupgrade_4eecd9c195e46c054ef7da6d9d1a738b'] = 'Extraction terminée. Suppression des fichiers exemples...'; @@ -144,7 +144,7 @@ $_MODULE['<{autoupgrade}prestashop>adminselfupgrade_af566be1636d11ecc8ddb728a155 $_MODULE['<{autoupgrade}prestashop>adminselfupgrade_ea4d3af79ad2392b7c0cca4b8ddd7028'] = 'Vous avez déjà la dernière version disponible.'; $_MODULE['<{autoupgrade}prestashop>adminselfupgrade_bafd7322c6e97d25b6299b5d6fe8920b'] = 'Non'; $_MODULE['<{autoupgrade}prestashop>adminselfupgrade_93cba07454f06a4a960172bbd6e2a435'] = 'Oui'; -$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_3d9f7f5927158b5a7dac0d65b4537265'] = 'Boutique désactivée'; +$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_69af703e1b0af65d0eb16b85e3ebd738'] = 'Boutique désactivée'; $_MODULE['<{autoupgrade}prestashop>adminselfupgrade_94af5df6182efd3591d0ccccaa04bd5c'] = 'Limite de temps PHP'; $_MODULE['<{autoupgrade}prestashop>adminselfupgrade_075ae3d2fc31640504f814f60e5ef713'] = 'désactivée'; $_MODULE['<{autoupgrade}prestashop>adminselfupgrade_783e8e29e6a8c3e22baa58a19420eb4f'] = 'secondes'; diff --git a/modules/blockcart/ajax-cart.js b/modules/blockcart/ajax-cart.js index 50301579b..91d69444c 100644 --- a/modules/blockcart/ajax-cart.js +++ b/modules/blockcart/ajax-cart.js @@ -274,7 +274,8 @@ return; var removedProductData = null; var removedProductDomId = null; //look for a product to delete... - $('#'+parentId+' #cart_block_list dl.products dt').each(function(){ + $('#'+parentId+' #cart_block_list dl.products dt').each(function() + { //retrieve idProduct and idCombination from the displayed product in the block cart var domIdProduct = $(this).attr('id'); var firstCut = domIdProduct.replace('cart_block_product_', ''); @@ -299,7 +300,6 @@ return; removedProductId = $(this).attr('id'); //return false; // Regarding that the customer can only remove products one by one, we break the loop } - }); //if there is a removed product, delete it from the displayed block cart if (removedProductId != null) @@ -324,6 +324,7 @@ return; }); }); } + }); } }); }, diff --git a/modules/blocklayered/blocklayered-no-products.tpl b/modules/blocklayered/blocklayered-no-products.tpl index 7f0de7883..44d70f1da 100644 --- a/modules/blocklayered/blocklayered-no-products.tpl +++ b/modules/blocklayered/blocklayered-no-products.tpl @@ -24,5 +24,5 @@ * International Registred Trademark & Property of PrestaShop SA *} <div id="product_list" class="clear"> - <p class="warning">{l s='There are no products.'}</p> + <p class="warning">{l s='There are no products.' mod='blocklayered'}</p> </div> diff --git a/modules/blocklayered/blocklayered.php b/modules/blocklayered/blocklayered.php index 29fa942a3..cede56862 100644 --- a/modules/blocklayered/blocklayered.php +++ b/modules/blocklayered/blocklayered.php @@ -1,6 +1,6 @@ <?php /* -* 2007-2011 PrestaShop +* 2007-2011 PrestaShop * * NOTICE OF LICENSE * @@ -20,7 +20,7 @@ * * @author PrestaShop SA <contact@prestashop.com> * @copyright 2007-2011 PrestaShop SA -* @version Release: $Revision: 9630 $ +* @version Release: $Revision$ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registred Trademark & Property of PrestaShop SA */ @@ -46,7 +46,7 @@ class BlockLayered extends Module $this->displayName = $this->l('Layered navigation block'); $this->description = $this->l('Displays a block with layered navigation filters.'); } - + public function install() { if (parent::install() && $this->registerHook('leftColumn') && $this->registerHook('header') && $this->registerHook('footer') @@ -60,20 +60,20 @@ class BlockLayered extends Module { Configuration::updateValue('PS_LAYERED_HIDE_0_VALUES', 0); Configuration::updateValue('PS_LAYERED_SHOW_QTIES', 1); - + $this->rebuildLayeredStructure(); $this->rebuildLayeredCache(); self::installPriceIndexTable(); $this->installFriendlyUrlTable(); $this->installIndexableAttributeTable(); $this->installProductAttributeTable(); - + $this->indexUrl(); $this->indexAttribute(); - + if (Db::getInstance()->getValue('SELECT COUNT(*) FROM `'._DB_PREFIX_.'product`') < 10000) // Lock price indexation if too many products self::fullPricesIndexProcess(); - + return true; } else @@ -90,35 +90,35 @@ class BlockLayered extends Module Configuration::deleteByName('PS_LAYERED_HIDE_0_VALUES'); Configuration::deleteByName('PS_LAYERED_SHOW_QTIES'); Configuration::deleteByName('PS_LAYERED_INDEXED'); - - Db::getInstance()->execute('DROP TABLE IF EXISTS '._DB_PREFIX_.'layered_price_index'); - Db::getInstance()->execute('DROP TABLE IF EXISTS '._DB_PREFIX_.'layered_friendly_url'); - Db::getInstance()->execute('DROP TABLE IF EXISTS '._DB_PREFIX_.'layered_indexable_attribute_group'); - Db::getInstance()->execute('DROP TABLE IF EXISTS '._DB_PREFIX_.'layered_indexable_feature'); - Db::getInstance()->execute('DROP TABLE IF EXISTS '._DB_PREFIX_.'layered_indexable_attribute_group_lang_value'); - Db::getInstance()->execute('DROP TABLE IF EXISTS '._DB_PREFIX_.'layered_indexable_feature_lang_value'); - Db::getInstance()->execute('DROP TABLE IF EXISTS '._DB_PREFIX_.'layered_category'); - Db::getInstance()->execute('DROP TABLE IF EXISTS '._DB_PREFIX_.'layered_filter'); - Db::getInstance()->execute('DROP TABLE IF EXISTS '._DB_PREFIX_.'layered_product_attribute'); + + Db::getInstance()->Execute('DROP TABLE IF EXISTS '._DB_PREFIX_.'layered_price_index'); + Db::getInstance()->Execute('DROP TABLE IF EXISTS '._DB_PREFIX_.'layered_friendly_url'); + Db::getInstance()->Execute('DROP TABLE IF EXISTS '._DB_PREFIX_.'layered_indexable_attribute_group'); + Db::getInstance()->Execute('DROP TABLE IF EXISTS '._DB_PREFIX_.'layered_indexable_feature'); + Db::getInstance()->Execute('DROP TABLE IF EXISTS '._DB_PREFIX_.'layered_indexable_attribute_group_lang_value'); + Db::getInstance()->Execute('DROP TABLE IF EXISTS '._DB_PREFIX_.'layered_indexable_feature_lang_value'); + Db::getInstance()->Execute('DROP TABLE IF EXISTS '._DB_PREFIX_.'layered_category'); + Db::getInstance()->Execute('DROP TABLE IF EXISTS '._DB_PREFIX_.'layered_filter'); + Db::getInstance()->Execute('DROP TABLE IF EXISTS '._DB_PREFIX_.'layered_product_attribute'); return parent::uninstall(); } - + private static function installPriceIndexTable() { - Db::getInstance()->execute('DROP TABLE IF EXISTS `'._DB_PREFIX_.'layered_price_index`'); - - Db::getInstance()->execute(' + Db::getInstance()->Execute('DROP TABLE IF EXISTS `'._DB_PREFIX_.'layered_price_index`'); + + Db::getInstance()->Execute(' CREATE TABLE `'._DB_PREFIX_.'layered_price_index` ( `id_product` INT NOT NULL, `id_currency` INT NOT NULL, `price_min` INT NOT NULL, `price_max` INT NOT NULL, PRIMARY KEY (`id_product`, `id_currency`), INDEX `id_currency` (`id_currency`), INDEX `price_min` (`price_min`), INDEX `price_max` (`price_max`)) ENGINE = '._MYSQL_ENGINE_); } - + private function installFriendlyUrlTable() { - Db::getInstance()->execute('DROP TABLE IF EXISTS `'._DB_PREFIX_.'layered_friendly_url`'); - Db::getInstance()->execute(' + Db::getInstance()->Execute('DROP TABLE IF EXISTS `'._DB_PREFIX_.'layered_friendly_url`'); + Db::getInstance()->Execute(' CREATE TABLE `'._DB_PREFIX_.'layered_friendly_url` ( `id_layered_friendly_url` INT NOT NULL AUTO_INCREMENT, `url_key` varchar(32) NOT NULL, @@ -127,66 +127,66 @@ class BlockLayered extends Module PRIMARY KEY (`id_layered_friendly_url`), INDEX `id_lang` (`id_lang`)) ENGINE = '._MYSQL_ENGINE_); - Db::getInstance()->execute('CREATE INDEX `url_key` ON `'._DB_PREFIX_.'layered_friendly_url`(url_key(5))'); + Db::getInstance()->Execute('CREATE INDEX `url_key` ON `'._DB_PREFIX_.'layered_friendly_url`(url_key(5))'); } - + private function installIndexableAttributeTable() { // Attributes Groups - Db::getInstance()->execute('DROP TABLE IF EXISTS `'._DB_PREFIX_.'layered_indexable_attribute_group`'); - Db::getInstance()->execute(' + Db::getInstance()->Execute('DROP TABLE IF EXISTS `'._DB_PREFIX_.'layered_indexable_attribute_group`'); + Db::getInstance()->Execute(' CREATE TABLE `'._DB_PREFIX_.'layered_indexable_attribute_group` ( `id_attribute_group` INT NOT NULL, `indexable` BOOL NOT NULL DEFAULT 0, PRIMARY KEY (`id_attribute_group`)) ENGINE = '._MYSQL_ENGINE_); - Db::getInstance()->execute(' + Db::getInstance()->Execute(' INSERT INTO `'._DB_PREFIX_.'layered_indexable_attribute_group` SELECT id_attribute_group, 1 FROM `'._DB_PREFIX_.'attribute_group`'); - - Db::getInstance()->execute('DROP TABLE IF EXISTS `'._DB_PREFIX_.'layered_indexable_attribute_group_lang_value`'); - Db::getInstance()->execute(' + + Db::getInstance()->Execute('DROP TABLE IF EXISTS `'._DB_PREFIX_.'layered_indexable_attribute_group_lang_value`'); + Db::getInstance()->Execute(' CREATE TABLE `'._DB_PREFIX_.'layered_indexable_attribute_group_lang_value` ( `id_attribute_group` INT NOT NULL, `id_lang` INT NOT NULL, `url_name` VARCHAR(20), `meta_title` VARCHAR(20), PRIMARY KEY (`id_attribute_group`, `id_lang`)) ENGINE = '._MYSQL_ENGINE_); - + // Attributes - Db::getInstance()->execute('DROP TABLE IF EXISTS `'._DB_PREFIX_.'layered_indexable_attribute_lang_value`'); - Db::getInstance()->execute(' + Db::getInstance()->Execute('DROP TABLE IF EXISTS `'._DB_PREFIX_.'layered_indexable_attribute_lang_value`'); + Db::getInstance()->Execute(' CREATE TABLE `'._DB_PREFIX_.'layered_indexable_attribute_lang_value` ( `id_attribute` INT NOT NULL, `id_lang` INT NOT NULL, `url_name` VARCHAR(20), `meta_title` VARCHAR(20), PRIMARY KEY (`id_attribute`, `id_lang`)) ENGINE = '._MYSQL_ENGINE_); - - + + // Features - Db::getInstance()->execute('DROP TABLE IF EXISTS `'._DB_PREFIX_.'layered_indexable_feature`'); - Db::getInstance()->execute(' + Db::getInstance()->Execute('DROP TABLE IF EXISTS `'._DB_PREFIX_.'layered_indexable_feature`'); + Db::getInstance()->Execute(' CREATE TABLE `'._DB_PREFIX_.'layered_indexable_feature` ( `id_feature` INT NOT NULL, `indexable` BOOL NOT NULL DEFAULT 0, PRIMARY KEY (`id_feature`)) ENGINE = '._MYSQL_ENGINE_); - - Db::getInstance()->execute(' + + Db::getInstance()->Execute(' INSERT INTO `'._DB_PREFIX_.'layered_indexable_feature` SELECT id_feature, 1 FROM `'._DB_PREFIX_.'feature`'); - - Db::getInstance()->execute('DROP TABLE IF EXISTS `'._DB_PREFIX_.'layered_indexable_feature_lang_value`'); - Db::getInstance()->execute(' + + Db::getInstance()->Execute('DROP TABLE IF EXISTS `'._DB_PREFIX_.'layered_indexable_feature_lang_value`'); + Db::getInstance()->Execute(' CREATE TABLE `'._DB_PREFIX_.'layered_indexable_feature_lang_value` ( `id_feature` INT NOT NULL, `id_lang` INT NOT NULL, `url_name` VARCHAR(20) NOT NULL, `meta_title` VARCHAR(20), PRIMARY KEY (`id_feature`, `id_lang`)) ENGINE = '._MYSQL_ENGINE_); - + // Features values - Db::getInstance()->execute('DROP TABLE IF EXISTS `'._DB_PREFIX_.'layered_indexable_feature_value_lang_value`'); - Db::getInstance()->execute(' + Db::getInstance()->Execute('DROP TABLE IF EXISTS `'._DB_PREFIX_.'layered_indexable_feature_value_lang_value`'); + Db::getInstance()->Execute(' CREATE TABLE `'._DB_PREFIX_.'layered_indexable_feature_value_lang_value` ( `id_feature_value` INT NOT NULL, `id_lang` INT NOT NULL, @@ -194,15 +194,15 @@ class BlockLayered extends Module `meta_title` VARCHAR(20), PRIMARY KEY (`id_feature_value`, `id_lang`)) ENGINE = '._MYSQL_ENGINE_); } - + /** - * + * * create table product attribute */ public function installProductAttributeTable() { - Db::getInstance()->execute('DROP TABLE IF EXISTS `'._DB_PREFIX_.'layered_product_attribute`'); - Db::getInstance()->execute(' + Db::getInstance()->Execute('DROP TABLE IF EXISTS `'._DB_PREFIX_.'layered_product_attribute`'); + Db::getInstance()->Execute(' CREATE TABLE `'._DB_PREFIX_.'layered_product_attribute` ( `id_attribute` int(10) unsigned NOT NULL, `id_product` int(10) unsigned NOT NULL, @@ -210,9 +210,9 @@ class BlockLayered extends Module KEY `id_attribute` (`id_attribute`) ) ENGINE= '._MYSQL_ENGINE_); } - + /** - * + * * Generate data product attribute */ public function indexAttribute($id_product = null) @@ -221,16 +221,16 @@ class BlockLayered extends Module Db::getInstance()->execute('TRUNCATE '._DB_PREFIX_.'layered_product_attribute'); else Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'layered_product_attribute WHERE id_product = '.(int)$id_product); - - Db::getInstance()->execute('INSERT INTO `'._DB_PREFIX_.'layered_product_attribute` (`id_attribute`, `id_product`, `id_attribute_group`) - SELECT pac.id_attribute, pa.id_product, ag.id_attribute_group - FROM '._DB_PREFIX_.'product_attribute pa - INNER JOIN '._DB_PREFIX_.'product_attribute_combination pac ON pac.id_product_attribute = pa.id_product_attribute - INNER JOIN '._DB_PREFIX_.'attribute a ON (a.id_attribute = pac.id_attribute) + + Db::getInstance()->Execute('INSERT INTO `'._DB_PREFIX_.'layered_product_attribute` (`id_attribute`, `id_product`, `id_attribute_group`) + SELECT pac.id_attribute, pa.id_product, ag.id_attribute_group + FROM '._DB_PREFIX_.'product_attribute pa + INNER JOIN '._DB_PREFIX_.'product_attribute_combination pac ON pac.id_product_attribute = pa.id_product_attribute + INNER JOIN '._DB_PREFIX_.'attribute a ON (a.id_attribute = pac.id_attribute) INNER JOIN '._DB_PREFIX_.'attribute_group ag ON ag.id_attribute_group = a.id_attribute_group '.(is_null($id_product) ? '' : 'AND pa.id_product = '.(int)$id_product).' GROUP BY a.id_attribute, pa.id_product'); - + return 1; } /* @@ -240,9 +240,9 @@ class BlockLayered extends Module { if ($truncate) Db::getInstance()->execute('TRUNCATE '._DB_PREFIX_.'layered_friendly_url'); - + $attributeValuesByLang = array(); - $filters = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('SELECT lc.*, id_lang, name, link_rewrite, cl.id_category + $filters = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('SELECT lc.*, id_lang, name, link_rewrite, cl.id_category FROM '._DB_PREFIX_.'layered_category lc INNER JOIN '._DB_PREFIX_.'category_lang cl ON (cl.id_category = lc.id_category AND lc.id_category <> 1 ) GROUP BY type, id_value, id_lang'); @@ -253,7 +253,7 @@ class BlockLayered extends Module switch ($filter['type']) { case 'id_attribute_group': - $attributes = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(' + $attributes = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS(' SELECT agl.public_name name, a.id_attribute_group id_name, al.name value, a.id_attribute id_value, al.id_lang, liagl.url_name name_url_name, lial.url_name value_url_name FROM '._DB_PREFIX_.'attribute_group ag @@ -282,9 +282,9 @@ class BlockLayered extends Module 'type' => $filter['type']); } break; - + case 'id_feature': - $features = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(' + $features = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS(' SELECT fl.name name, fl.id_feature id_name, fvl.id_feature_value id_value, fvl.value value, fl.id_lang, fl.id_lang, lifl.url_name name_url_name, lifvl.url_name value_url_name FROM '._DB_PREFIX_.'feature_lang fl @@ -312,9 +312,9 @@ class BlockLayered extends Module 'type' => $filter['type']); } break; - + case 'category': - $categories = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(' + $categories = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS(' SELECT cl.name, cl.id_lang, c.id_category FROM '._DB_PREFIX_.'category c INNER JOIN '._DB_PREFIX_.'category_lang cl ON (c.id_category = cl.id_category) @@ -330,13 +330,13 @@ class BlockLayered extends Module 'category_name' => $filter['link_rewrite'], 'type' => $filter['type']); } break; - + case 'manufacturer': - $manufacturers = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(' + $manufacturers = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS(' SELECT m.name as name,l.id_lang as id_lang, id_manufacturer FROM '._DB_PREFIX_.'manufacturer m , '._DB_PREFIX_.'lang l WHERE l.id_lang = '.(int)$filter['id_lang'].' '); - + foreach ($manufacturers as $manufacturer) { if (!isset($attributeValuesByLang[$manufacturer['id_lang']])) @@ -348,7 +348,7 @@ class BlockLayered extends Module 'category_name' => $filter['link_rewrite'], 'type' => $filter['type']); } break; - + case 'quantity': $avaibility_list = array( $this->translateWord('Not available', (int)$filter['id_lang']), @@ -359,7 +359,7 @@ class BlockLayered extends Module 'id_name' => null, 'value' => $quantity, 'id_value' => $key, 'id_id_value' => 0, 'category_name' => $filter['link_rewrite'], 'type' => $filter['type']); break; - + case 'condition': $condition_list = array( 'new' => $this->translateWord('New', (int)$filter['id_lang']), @@ -372,37 +372,37 @@ class BlockLayered extends Module 'category_name' => $filter['link_rewrite'], 'type' => $filter['type']); break; } - + // Foreach langs foreach ($attributeValuesByLang as $id_lang => $attributeValues) { // Foreach attributes generate a couple "/<attribute_name>_<atttribute_value>". For example: color_blue foreach ($attributeValues as $attribute) - foreach ($attribute as $param) - { - $selectedFilters = array(); - $link = '/'.str_replace('-', '_', Tools::link_rewrite($param['name'])).'-'.str_replace('-', '_', Tools::link_rewrite($param['value'])); - $selectedFilters[$param['type']] = array(); - if (!isset($param['id_id_value'])) - $param['id_id_value'] = $param['id_value']; - $selectedFilters[$param['type']][$param['id_id_value']] = $param['id_value']; - $urlKey = md5($link); - $idLayeredFriendlyUrl = Db::getInstance()->getValue('SELECT id_layered_friendly_url - FROM `'._DB_PREFIX_.'layered_friendly_url` WHERE `id_lang` = '.$id_lang.' AND `url_key` = \''.$urlKey.'\''); - if ($idLayeredFriendlyUrl == false) + foreach ($attribute as $param) { - Db::getInstance()->AutoExecute(_DB_PREFIX_.'layered_friendly_url', array('url_key' => $urlKey, 'data' => serialize($selectedFilters), 'id_lang' => $id_lang), 'INSERT'); - $idLayeredFriendlyUrl = Db::getInstance()->Insert_ID(); + $selectedFilters = array(); + $link = '/'.str_replace('-', '_', Tools::link_rewrite($param['name'])).'-'.str_replace('-', '_', Tools::link_rewrite($param['value'])); + $selectedFilters[$param['type']] = array(); + if (!isset($param['id_id_value'])) + $param['id_id_value'] = $param['id_value']; + $selectedFilters[$param['type']][$param['id_id_value']] = $param['id_value']; + $urlKey = md5($link); + $idLayeredFriendlyUrl = Db::getInstance()->getValue('SELECT id_layered_friendly_url + FROM `'._DB_PREFIX_.'layered_friendly_url` WHERE `id_lang` = '.$id_lang.' AND `url_key` = \''.$urlKey.'\''); + if ($idLayeredFriendlyUrl == false) + { + Db::getInstance()->AutoExecute(_DB_PREFIX_.'layered_friendly_url', array('url_key' => $urlKey, 'data' => serialize($selectedFilters), 'id_lang' => $id_lang), 'INSERT'); + $idLayeredFriendlyUrl = Db::getInstance()->Insert_ID(); + } } - } } if ($ajax) return '{"result": 1}'; else return 1; } - - public function translateWord($string, $id_lang ) + + public function translateWord($string, $id_lang ) { static $_MODULES = array(); global $_MODULE; @@ -423,7 +423,7 @@ class BlockLayered extends Module $_MODULES[$id_lang] = array_change_key_case($_MODULES[$id_lang]); $currentKey = '<{'.strtolower( $this->name).'}'.strtolower(_THEME_NAME_).'>'.strtolower($this->name).'_'.md5($string); $defaultKey = '<{'.strtolower( $this->name).'}prestashop>'.strtolower($this->name).'_'.md5($string); - + if (isset($_MODULES[$id_lang][$currentKey])) $ret = stripslashes($_MODULES[$id_lang][$currentKey]); else if (isset($_MODULES[$id_lang][Tools::strtolower($currentKey)])) @@ -437,7 +437,7 @@ class BlockLayered extends Module return str_replace('"', '"', $ret); } - + public function hookProductListAssign($params) { global $smarty; @@ -453,18 +453,18 @@ class BlockLayered extends Module if (is_array($filterBlock['title_values'])) foreach ($filterBlock['title_values'] as $key => $val) $title .= ' – '.$key.' '.implode('/', $val); - + $smarty->assign('categoryNameComplement', $title); $this->getProducts($selectedFilters, $params['catProducts'], $params['nbProducts'], $p, $n, $pages_nb, $start, $stop, $range); // Need a nofollow on the pagination links? $smarty->assign('no_follow', $filterBlock['nofollow']); } - + public function hookAfterSaveProduct($params) { if (!$params['id_product']) return; - + self::indexProductPrices((int)$params['id_product']); $this->indexAttribute((int)$params['id_product']); } @@ -473,16 +473,16 @@ class BlockLayered extends Module { if (!$params['id_feature'] || Tools::getValue('layered_indexable') === false) return; - - Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'layered_indexable_feature WHERE id_feature = '.(int)$params['id_feature']); - Db::getInstance()->execute('INSERT INTO '._DB_PREFIX_.'layered_indexable_feature VALUES ('.(int)$params['id_feature'].', '.(int)Tools::getValue('layered_indexable').')'); - - Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'layered_indexable_feature_lang_value WHERE id_feature = '.(int)$params['id_feature']); // don't care about the id_lang + + Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.'layered_indexable_feature WHERE id_feature = '.(int)$params['id_feature']); + Db::getInstance()->Execute('INSERT INTO '._DB_PREFIX_.'layered_indexable_feature VALUES ('.(int)$params['id_feature'].', '.(int)Tools::getValue('layered_indexable').')'); + + Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.'layered_indexable_feature_lang_value WHERE id_feature = '.(int)$params['id_feature']); // don't care about the id_lang foreach (Language::getLanguages(false) as $language) { // Data are validated by method "hookPostProcessFeature" $id_lang = (int)$language['id_lang']; - Db::getInstance()->execute('INSERT INTO '._DB_PREFIX_.'layered_indexable_feature_lang_value + Db::getInstance()->Execute('INSERT INTO '._DB_PREFIX_.'layered_indexable_feature_lang_value VALUES ('.(int)$params['id_feature'].', '.$id_lang.', \''.pSQL(Tools::link_rewrite(Tools::getValue('url_name_'.$id_lang))).'\', \''.pSQL(Tools::safeOutput(Tools::getValue('meta_title_'.$id_lang), true)).'\')'); } @@ -492,37 +492,37 @@ class BlockLayered extends Module { if (!$params['id_feature_value']) return; - - Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'layered_indexable_feature_value_lang_value WHERE id_feature_value = '.(int)$params['id_feature_value']); // don't care about the id_lang + + Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.'layered_indexable_feature_value_lang_value WHERE id_feature_value = '.(int)$params['id_feature_value']); // don't care about the id_lang foreach (Language::getLanguages(false) as $language) { // Data are validated by method "hookPostProcessFeatureValue" $id_lang = (int)$language['id_lang']; - Db::getInstance()->execute('INSERT INTO '._DB_PREFIX_.'layered_indexable_feature_value_lang_value + Db::getInstance()->Execute('INSERT INTO '._DB_PREFIX_.'layered_indexable_feature_value_lang_value VALUES ('.(int)$params['id_feature_value'].', '.$id_lang.', \''.pSQL(Tools::link_rewrite(Tools::getValue('url_name_'.$id_lang))).'\', \''.pSQL(Tools::safeOutput(Tools::getValue('meta_title_'.$id_lang), true)).'\')'); } } - + public function hookAfterDeleteFeatureValue($params) { if (!$params['id_feature_value']) return; - Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'layered_indexable_feature_value_lang_value WHERE id_feature_value = '.(int)$params['id_feature_value']); + Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.'layered_indexable_feature_value_lang_value WHERE id_feature_value = '.(int)$params['id_feature_value']); } - + public function hookPostProcessFeatureValue($params) { $this->hookPostProcessAttributeGroup($params); } - + public function hookFeatureValueForm($params) { $languages = Language::getLanguages(false); $default_form_language = (int)(Configuration::get('PS_LANG_DEFAULT')); $langValue = array(); - - $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS( + + $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS( 'SELECT url_name, meta_title, id_lang FROM '._DB_PREFIX_.'layered_indexable_feature_value_lang_value WHERE id_feature_value = '.(int)$params['id_feature_value']); if ($result) @@ -559,42 +559,42 @@ class BlockLayered extends Module </div>'; return $return; } - + public function hookAfterSaveAttribute($params) { if (!$params['id_attribute']) return; - - Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'layered_indexable_attribute_lang_value WHERE id_attribute = '.(int)$params['id_attribute']); // don't care about the id_lang + + Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.'layered_indexable_attribute_lang_value WHERE id_attribute = '.(int)$params['id_attribute']); // don't care about the id_lang foreach (Language::getLanguages(false) as $language) { // Data are validated by method "hookPostProcessAttribute" $id_lang = (int)$language['id_lang']; - Db::getInstance()->execute('INSERT INTO '._DB_PREFIX_.'layered_indexable_attribute_lang_value + Db::getInstance()->Execute('INSERT INTO '._DB_PREFIX_.'layered_indexable_attribute_lang_value VALUES ('.(int)$params['id_attribute'].', '.$id_lang.', \''.pSQL(Tools::link_rewrite(Tools::getValue('url_name_'.$id_lang))).'\', \''.pSQL(Tools::safeOutput(Tools::getValue('meta_title_'.$id_lang), true)).'\')'); } } - + public function hookAfterDeleteAttribute($params) { if (!$params['id_attribute']) return; - Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'layered_indexable_attribute_lang_value WHERE id_attribute = '.(int)$params['id_attribute']); + Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.'layered_indexable_attribute_lang_value WHERE id_attribute = '.(int)$params['id_attribute']); } - + public function hookPostProcessAttribute($params) { $this->hookPostProcessAttributeGroup($params); } - + public function hookAttributeForm($params) { $languages = Language::getLanguages(false); $default_form_language = (int)(Configuration::get('PS_LANG_DEFAULT')); $langValue = array(); - - $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS( + + $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS( 'SELECT url_name, meta_title, id_lang FROM '._DB_PREFIX_.'layered_indexable_attribute_lang_value WHERE id_attribute = '.(int)$params['id_attribute']); if ($result) @@ -631,7 +631,7 @@ class BlockLayered extends Module </div>'; return $return; } - + public function hookPostProcessFeature($params) { $this->hookPostProcessAttributeGroup($params); @@ -641,28 +641,28 @@ class BlockLayered extends Module { if (!$params['id_feature']) return; - Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'layered_indexable_feature WHERE id_feature = '.(int)$params['id_feature']); + Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.'layered_indexable_feature WHERE id_feature = '.(int)$params['id_feature']); } - + public function hookAfterSaveAttributeGroup($params) { if (!$params['id_attribute_group'] || Tools::getValue('layered_indexable') === false) return; + + Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.'layered_indexable_attribute_group WHERE id_attribute_group = '.(int)$params['id_attribute_group']); + Db::getInstance()->Execute('INSERT INTO '._DB_PREFIX_.'layered_indexable_attribute_group VALUES ('.(int)$params['id_attribute_group'].', '.(int)Tools::getValue('layered_indexable').')'); - Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'layered_indexable_attribute_group WHERE id_attribute_group = '.(int)$params['id_attribute_group']); - Db::getInstance()->execute('INSERT INTO '._DB_PREFIX_.'layered_indexable_attribute_group VALUES ('.(int)$params['id_attribute_group'].', '.(int)Tools::getValue('layered_indexable').')'); - - Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'layered_indexable_attribute_group_lang_value WHERE id_attribute_group = '.(int)$params['id_attribute_group']); // don't care about the id_lang + Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.'layered_indexable_attribute_group_lang_value WHERE id_attribute_group = '.(int)$params['id_attribute_group']); // don't care about the id_lang foreach (Language::getLanguages(false) as $language) { // Data are validated by method "hookPostProcessAttributeGroup" $id_lang = (int)$language['id_lang']; - Db::getInstance()->execute('INSERT INTO '._DB_PREFIX_.'layered_indexable_attribute_group_lang_value + Db::getInstance()->Execute('INSERT INTO '._DB_PREFIX_.'layered_indexable_attribute_group_lang_value VALUES ('.(int)$params['id_attribute_group'].', '.$id_lang.', \''.pSQL(Tools::link_rewrite(Tools::getValue('url_name_'.$id_lang))).'\', \''.pSQL(Tools::safeOutput(Tools::getValue('meta_title_'.$id_lang), true)).'\')'); } } - + public function hookPostProcessAttributeGroup($params) { // Limit to one call @@ -670,7 +670,7 @@ class BlockLayered extends Module if ($once) return; $once = true; - + $errors = array(); foreach (Language::getLanguages(false) as $language) { @@ -683,16 +683,16 @@ class BlockLayered extends Module } } } - + public function hookAfterDeleteAttributeGroup($params) { if (!$params['id_attribute_group']) return; - Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'layered_indexable_attribute_group WHERE id_attribute_group = '.(int)$params['id_attribute_group']); - Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'layered_indexable_attribute_group_lang_value WHERE id_attribute_group = '.(int)$params['id_attribute_group']); + Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.'layered_indexable_attribute_group WHERE id_attribute_group = '.(int)$params['id_attribute_group']); + Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.'layered_indexable_attribute_group_lang_value WHERE id_attribute_group = '.(int)$params['id_attribute_group']); } - + public function hookAttributeGroupForm($params) { $languages = Language::getLanguages(false); @@ -700,8 +700,8 @@ class BlockLayered extends Module $indexable = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('SELECT indexable FROM '._DB_PREFIX_.'layered_indexable_attribute_group WHERE id_attribute_group = '.(int)$params['id_attribute_group']); $langValue = array(); - - $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS( + + $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS( 'SELECT url_name, meta_title, id_lang FROM '._DB_PREFIX_.'layered_indexable_attribute_group_lang_value WHERE id_attribute_group = '.(int)$params['id_attribute_group']); if ($result) @@ -752,27 +752,27 @@ class BlockLayered extends Module </div>'; return $return; } - + public function hookFeatureForm($params) { $languages = Language::getLanguages(false); $default_form_language = (int)(Configuration::get('PS_LANG_DEFAULT')); $indexable = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('SELECT indexable FROM '._DB_PREFIX_.'layered_indexable_feature WHERE id_feature = '.(int)$params['id_feature']); $langValue = array(); - - $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS( + + $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS( 'SELECT url_name, meta_title, id_lang FROM '._DB_PREFIX_.'layered_indexable_feature_lang_value WHERE id_feature = '.(int)$params['id_feature']); if ($result) foreach ($result as $data) $langValue[$data['id_lang']] = array('url_name' => $data['url_name'], 'meta_title' => $data['meta_title']); - - + + if ($indexable === false) $on = true; else $on = (bool)$indexable; - + $return = '<div class="clear"></div> <label>'.$this->l('Url:').'</label> <div class="margin-form"> @@ -812,7 +812,7 @@ class BlockLayered extends Module </div>'; return $return; } - + /* * $cursor $cursor in order to restart indexing from the last state */ @@ -820,10 +820,10 @@ class BlockLayered extends Module { if ($cursor == 0 && !$smart) self::installPriceIndexTable(); - + return self::indexPrices($cursor, true, $ajax, $smart); } - + /* * $cursor $cursor in order to restart indexing from the last state */ @@ -831,7 +831,7 @@ class BlockLayered extends Module { return self::indexPrices($cursor, false, $ajax); } - + private static function indexPrices($cursor = null, $full = false, $ajax = false, $smart = false) { if ($full) @@ -841,25 +841,24 @@ class BlockLayered extends Module 'SELECT COUNT(*) FROM `'._DB_PREFIX_.'product` p LEFT JOIN `'._DB_PREFIX_.'layered_price_index` psi ON (psi.id_product = p.id_product) WHERE `active` = 1 AND psi.id_product IS NULL'); - + $maxExecutionTime = @ini_get('max_execution_time'); if ($maxExecutionTime > 5 || $maxExecutionTime <= 0) $maxExecutionTime = 5; - + $startTime = microtime(true); - + do { $cursor = (int)self::indexPricesUnbreakable((int)$cursor, $full, $smart); $timeElapsed = microtime(true) - $startTime; } while ($cursor < $nbProducts && (Tools::getMemoryLimit()) > memory_get_peak_usage() && $timeElapsed < $maxExecutionTime); - + if (($nbProducts > 0 && !$full || $cursor < $nbProducts && $full) && !$ajax) { $token = substr(Tools::encrypt('blocklayered/index'), 0, 10); - if (!Tools::file_get_contents(Tools::getCurrentUrlProtocolPrefix().Tools::getHttpHost(). - __PS_BASE_URI__.'modules/blocklayered/blocklayered-price-indexer.php?token='.$token.'&cursor='.(int)$cursor.'&full='.(int)$full)) + if (!Tools::file_get_contents(Tools::getCurrentUrlProtocolPrefix().Tools::getHttpHost().__PS_BASE_URI__.'modules/blocklayered/blocklayered-price-indexer.php?token='.$token.'&cursor='.(int)$cursor.'&full='.(int)$full)) self::indexPrices((int)$cursor, (int)$full); return $cursor; } @@ -876,17 +875,17 @@ class BlockLayered extends Module return -1; } } - + /* * $cursor $cursor in order to restart indexing from the last state */ private static function indexPricesUnbreakable($cursor, $full = false, $smart = false) { static $length = 100; // Nb of products to index - + if (is_null($cursor)) $cursor = 0; - + if ($full) $query = ' SELECT id_product @@ -900,34 +899,34 @@ class BlockLayered extends Module LEFT JOIN `'._DB_PREFIX_.'layered_price_index` psi ON (psi.id_product = p.id_product) WHERE `active` = 1 AND psi.id_product is null ORDER by id_product LIMIT 0,'.(int)$length; - - foreach (Db::getInstance()->executeS($query) as $product) + + foreach (Db::getInstance()->ExecuteS($query) as $product) self::indexProductPrices((int)$product['id_product'], ($smart && $full)); return (int)($cursor + $length); } - + public static function indexProductPrices($idProduct, $smart = true) { static $groups = null; if (is_null($groups)) { - $groups = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('SELECT id_group FROM `'._DB_PREFIX_.'group_reduction`'); + $groups = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('SELECT id_group FROM `'._DB_PREFIX_.'group_reduction`'); if (!$groups) $groups = array(); } - + static $currencyList = null; if (is_null($currencyList)) $currencyList = Currency::getCurrencies(); - + $minPrice = array(); $maxPrice = array(); - + if ($smart) Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'layered_price_index` WHERE `id_product` = '.(int)$idProduct); - + $maxTaxRate = Db::getInstance()->getValue(' SELECT max(t.rate) max_rate FROM `'._DB_PREFIX_.'product` p @@ -936,19 +935,19 @@ class BlockLayered extends Module LEFT JOIN `'._DB_PREFIX_.'tax` t ON (t.id_tax = tr.id_tax AND t.active = 1) WHERE id_product = '.(int)$idProduct.' GROUP BY id_product'); - - $productMinPrices = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(' + + $productMinPrices = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS(' SELECT id_shop, id_currency, id_country, id_group, from_quantity FROM `'._DB_PREFIX_.'specific_price` WHERE id_product = '.(int)$idProduct); - + // Get min price foreach ($currencyList as $currency) { $price = Product::priceCalculation(null, (int)$idProduct, null, null, null, null, $currency['id_currency'], null, null, false, true, false, true, true, $specificPriceOutput, true); - + if (!isset($maxPrice[$currency['id_currency']])) $maxPrice[$currency['id_currency']] = 0; if (!isset($minPrice[$currency['id_currency']])) @@ -960,7 +959,7 @@ class BlockLayered extends Module if (is_null($minPrice[$currency['id_currency']]) || $price < $minPrice[$currency['id_currency']]) $minPrice[$currency['id_currency']] = $price; } - + foreach ($productMinPrices as $specificPrice) foreach ($currencyList as $currency) { @@ -970,7 +969,7 @@ class BlockLayered extends Module null, (($specificPrice['id_country'] == 0) ? null : $specificPrice['id_country']), null, null, $currency['id_currency'], (($specificPrice['id_group'] == 0) ? null : $specificPrice['id_group']), $specificPrice['from_quantity'], false, true, false, true, true, $specificPriceOutput, true); - + if (!isset($maxPrice[$currency['id_currency']])) $maxPrice[$currency['id_currency']] = 0; if (!isset($minPrice[$currency['id_currency']])) @@ -982,13 +981,13 @@ class BlockLayered extends Module if (is_null($minPrice[$currency['id_currency']]) || $price < $minPrice[$currency['id_currency']]) $minPrice[$currency['id_currency']] = $price; } - + foreach ($groups as $group) foreach ($currencyList as $currency) { $price = Product::priceCalculation(null, (int)$idProduct, null, null, null, null, (int)$currency['id_currency'], (int)$group['id_group'], null, false, true, false, true, true, $specificPriceOutput, true); - + if (!isset($maxPrice[$currency['id_currency']])) $maxPrice[$currency['id_currency']] = 0; if (!isset($minPrice[$currency['id_currency']])) @@ -1000,13 +999,13 @@ class BlockLayered extends Module if (is_null($minPrice[$currency['id_currency']]) || $price < $minPrice[$currency['id_currency']]) $minPrice[$currency['id_currency']] = $price; } - + $values = array(); foreach ($currencyList as $currency) $values[] = '('.(int)$idProduct.', '.(int)$currency['id_currency'].', '.(int)$minPrice[$currency['id_currency']].', '.(int)($maxPrice[$currency['id_currency']] * (100 + $maxTaxRate) / 100).')'; - - Db::getInstance()->execute(' + + Db::getInstance()->Execute(' INSERT INTO `'._DB_PREFIX_.'layered_price_index` (id_product, id_currency, price_min, price_max) VALUES '.implode(',', $values).' ON DUPLICATE KEY UPDATE id_product = id_product # avoid duplicate keys'); @@ -1025,19 +1024,17 @@ class BlockLayered extends Module public function hookHeader($params) { global $smarty, $cookie; - + // No filters => module disable if ($filterBlock = $this->getFilterBlock($this->getSelectedFilters())) if ($filterBlock['nbr_filterBlocks'] == 0) return false; - + if (Tools::getValue('id_category', Tools::getValue('id_category_layered', 1)) == 1) return; - + $idLang = (int)$cookie->id_lang; $category = new Category((int)Tools::getValue('id_category')); - $categoryMetas = Tools::getMetaTags($idLang, ''); - $categoryTitle = (empty($category->meta_title[$idLang]) ? $category->name[$idLang] : $category->meta_title[$idLang]); // Generate meta title and meta description $title = ''; @@ -1045,25 +1042,28 @@ class BlockLayered extends Module foreach ($filterBlock['title_values'] as $key => $val) $title .= $key.' '.implode('/', $val).' – '; $title = rtrim($title, ' – '); - + $categoryMetas = Tools::getMetaTags($idLang, '', $title); + $categoryTitle = (empty($category->meta_title[$idLang]) ? $category->name[$idLang] : $category->meta_title[$idLang]); + if (!empty($title)) { - $smarty->assign('meta_title', ucfirst(strtolower(preg_replace('/^'.$categoryTitle.'/', $categoryTitle.' – '.$title, $categoryMetas['meta_title'])))); - $smarty->assign('meta_description', rtrim($categoryTitle.' – '.$title.' – '.$categoryMetas['meta_description'], ' – ')); + $smarty->assign('meta_title', $categoryTitle.$categoryMetas['meta_title']); + $smarty->assign('meta_description', $categoryTitle.$categoryMetas['meta_description']); } else - $smarty->assign('meta_title', ucfirst(strtolower($categoryMetas['meta_title']))); - + $smarty->assign('meta_title', $categoryMetas['meta_title']); + $metaKeyWordsComplement = substr(str_replace(' – ', ', ', strtolower($title)), 1000); if (!empty($metaKeyWordsComplement)) $smarty->assign('meta_keywords', rtrim($categoryTitle.', '.$metaKeyWordsComplement.', '.$categoryMetas['meta_keywords'], ', ')); - - $this->context->controller->addJs($this->_path.'blocklayered.js'); - $this->context->controller->addJqueryUI('ui.slider'); - $this->context->controller->addCSS($this->_path.'blocklayered.css', 'all'); + + Tools::addJS(($this->_path).'blocklayered.js'); + Tools::addJS(_PS_JS_DIR_.'jquery/jquery-ui-1.8.10.custom.min.js'); + Tools::addCSS(_PS_CSS_DIR_.'jquery-ui-1.8.10.custom.css', 'all'); + Tools::addCSS(($this->_path).'blocklayered.css', 'all'); Tools::addJS(_PS_JS_DIR_.'jquery/jquery.scrollTo-1.4.2-min.js'); } - + public function hookFooter($params) { if (basename($_SERVER['PHP_SELF']) == 'category.php') @@ -1095,7 +1095,7 @@ class BlockLayered extends Module public function hookCategoryDeletion($params) { - Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'layered_category WHERE id_category = '.(int)$params['category']->id); + Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.'layered_category WHERE id_category = '.(int)$params['category']->id); } public function getContent() @@ -1117,29 +1117,29 @@ class BlockLayered extends Module else { if (isset($_POST['id_layered_filter']) && $_POST['id_layered_filter']) - Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'layered_filter WHERE id_layered_filter = '.(int)Tools::getValue('id_layered_filter')); - + Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.'layered_filter WHERE id_layered_filter = '.(int)Tools::getValue('id_layered_filter')); + if (Tools::getValue('scope') == 1) { - Db::getInstance()->execute('TRUNCATE TABLE '._DB_PREFIX_.'layered_filter'); - $categories = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('SELECT id_category FROM '._DB_PREFIX_.'category'); + Db::getInstance()->Execute('TRUNCATE TABLE '._DB_PREFIX_.'layered_filter'); + $categories = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('SELECT id_category FROM '._DB_PREFIX_.'category'); foreach ($categories as $category) $_POST['categoryBox'][] = (int)$category['id_category']; } - + if (count($_POST['categoryBox'])) { /* Clean categoryBox before use */ if (isset($_POST['categoryBox']) && is_array($_POST['categoryBox'])) foreach ($_POST['categoryBox'] as &$categoryBoxTmp) $categoryBoxTmp = (int)$categoryBoxTmp; - - Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'layered_category WHERE id_category IN ('.implode(',', array_map('intval', $_POST['categoryBox'])).')'); - + + Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.'layered_category WHERE id_category IN ('.implode(',', array_map('intval', $_POST['categoryBox'])).')'); + $filterValues = array(); foreach ($_POST['categoryBox'] as $idc) $filterValues['categories'][] = (int)$idc; - + $sqlToInsert = 'INSERT INTO '._DB_PREFIX_.'layered_category (id_category, id_value, type, position) VALUES '; foreach ($_POST['categoryBox'] as $id_category_layered) { @@ -1167,9 +1167,9 @@ class BlockLayered extends Module $sqlToInsert .= '('.(int)$id_category_layered.','.(int)str_replace('layered_selection_feat_', '', $key).',\'id_feature\','.(int)$n.'),'; } } - - Db::getInstance()->execute(rtrim($sqlToInsert, ',')); - + + Db::getInstance()->Execute(rtrim($sqlToInsert, ',')); + $valuesToInsert = array( 'name' => pSQL(Tools::getValue('layered_tpl_name')), 'filters' => pSQL(serialize($filterValues)), @@ -1177,10 +1177,10 @@ class BlockLayered extends Module 'date_add' => date('Y-m-d H:i:s')); if (isset($_POST['id_layered_filter']) && $_POST['id_layered_filter']) $valuesToInsert['id_layered_filter'] = (int)Tools::getValue('id_layered_filter'); - + Db::getInstance()->AutoExecute(_DB_PREFIX_.'layered_filter', $valuesToInsert, 'INSERT'); - - echo '<div class="conf"> + + echo '<div class="conf"><img src="../img/admin/ok2.png" alt="" /> '.$this->l('Your filter').' "'.Tools::safeOutput(Tools::getValue('layered_tpl_name')).'" '. ((isset($_POST['id_layered_filter']) && $_POST['id_layered_filter']) ? $this->l('was updated successfully.') : $this->l('was added successfully.')).'</div>'; } @@ -1190,26 +1190,26 @@ class BlockLayered extends Module { Configuration::updateValue('PS_LAYERED_HIDE_0_VALUES', Tools::getValue('ps_layered_hide_0_values')); Configuration::updateValue('PS_LAYERED_SHOW_QTIES', Tools::getValue('ps_layered_show_qties')); - + $html .= ' <div class="conf"> - '.$this->l('Settings saved successfully').' + <img src="../img/admin/ok2.png" alt="" /> '.$this->l('Settings saved successfully').' </div>'; } else if (isset($_GET['deleteFilterTemplate'])) { $layeredValues = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue(' - SELECT filters - FROM '._DB_PREFIX_.'layered_filter + SELECT filters + FROM '._DB_PREFIX_.'layered_filter WHERE id_layered_filter = '.(int)$_GET['id_layered_filter']); - + if ($layeredValues) { - Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'layered_filter WHERE id_layered_filter = '.(int)$_GET['id_layered_filter'].' LIMIT 1'); - + Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.'layered_filter WHERE id_layered_filter = '.(int)$_GET['id_layered_filter'].' LIMIT 1'); + $html .= ' <div class="conf"> - '.$this->l('Filters template deleted, categories updated (reverted to default Filters template).').' + <img src="../img/admin/ok2.png" alt="" /> '.$this->l('Filters template deleted, categories updated (reverted to default Filters template).').' </div>'; } else @@ -1220,10 +1220,10 @@ class BlockLayered extends Module </div>'; } } - + $html .= ' <div id="ajax-message-ok" class="conf ajax-message" style="display: none"> - <span class="message"></span> + <img alt="" src="../img/admin/ok2.png"><span class="message"></span> </div> <div id="ajax-message-ko" class="error ajax-message" style="display: none"> <img src="../img/admin/error2.png" alt="" /><span class="message"></span> @@ -1241,68 +1241,67 @@ class BlockLayered extends Module $(\'#full-index\').click(); }); </script>'; - + $categoryList = array(); - foreach (Db::getInstance()->executeS('SELECT id_category FROM `'._DB_PREFIX_.'category`') as $category) + foreach (Db::getInstance()->ExecuteS('SELECT id_category FROM `'._DB_PREFIX_.'category`') as $category) if ($category['id_category'] != 1) $categoryList[] = $category['id_category']; - - $base_url = Tools::getCurrentUrlProtocolPrefix().Tools::getHttpHost().__PS_BASE_URI__; + $html .= ' <a class="bold ajaxcall-recurcive" style="width: 250px; text-align:center;display:block;border:1px solid #aaa;text-decoration:none;background-color:#fafafa;color:#123456;margin:2px;padding:2px" - href="'.$base_url.'modules/blocklayered/blocklayered-price-indexer.php'.'?token='.substr(Tools::encrypt('blocklayered/index'), 0, 10).'">'. + href="'.Tools::getCurrentUrlProtocolPrefix().Tools::getHttpHost().__PS_BASE_URI__.'modules/blocklayered/blocklayered-price-indexer.php'.'?token='.substr(Tools::encrypt('blocklayered/index'), 0, 10).'">'. $this->l('Index all missing prices').'</a> <br /> <a class="bold ajaxcall-recurcive" style="width: 250px; text-align:center;display:block;border:1px solid #aaa;text-decoration:none;background-color:#fafafa;color:#123456;margin:2px;padding:2px" id="full-index" - href="'.$base_url.'modules/blocklayered/blocklayered-price-indexer.php'.'?token='.substr(Tools::encrypt('blocklayered/index'), 0, 10).'&full=1">'. + href="'.Tools::getCurrentUrlProtocolPrefix().Tools::getHttpHost().__PS_BASE_URI__.'modules/blocklayered/blocklayered-price-indexer.php'.'?token='.substr(Tools::encrypt('blocklayered/index'), 0, 10).'&full=1">'. $this->l('Re-build entire price index').'</a> <br /> <a class="bold ajaxcall" id="attribute-indexer" style="width: 250px; text-align:center;display:block;border:1px solid #aaa;text-decoration:none;background-color:#fafafa;color:#123456;margin:2px;padding:2px" id="full-index" - href="'.$base_url.'modules/blocklayered/blocklayered-attribute-indexer.php'.'?token='.substr(Tools::encrypt('blocklayered/index'), 0, 10).'">'. + href="'.Tools::getCurrentUrlProtocolPrefix().Tools::getHttpHost().__PS_BASE_URI__.'modules/blocklayered/blocklayered-attribute-indexer.php'.'?token='.substr(Tools::encrypt('blocklayered/index'), 0, 10).'">'. $this->l('Build attribute index').'</a> <br /> <a class="bold ajaxcall" id="url-indexer" style="width: 250px; text-align:center;display:block;border:1px solid #aaa;text-decoration:none;background-color:#fafafa;color:#123456;margin:2px;padding:2px" id="full-index" - href="'.$base_url.'modules/blocklayered/blocklayered-url-indexer.php'.'?token='.substr(Tools::encrypt('blocklayered/index'), 0, 10).'&truncate=1">'. + href="'.Tools::getCurrentUrlProtocolPrefix().Tools::getHttpHost().__PS_BASE_URI__.'modules/blocklayered/blocklayered-url-indexer.php'.'?token='.substr(Tools::encrypt('blocklayered/index'), 0, 10).'&truncate=1">'. $this->l('Build url index').'</a> <br /> <br /> '.$this->l('You can set a cron job that will re-build price index using the following URL:').'<br /><b>'. - $base_url.'modules/blocklayered/blocklayered-price-indexer.php'.'?token='.substr(Tools::encrypt('blocklayered/index'), 0, 10).'&full=1</b> + Tools::getCurrentUrlProtocolPrefix().Tools::getHttpHost().__PS_BASE_URI__.'modules/blocklayered/blocklayered-price-indexer.php'.'?token='.substr(Tools::encrypt('blocklayered/index'), 0, 10).'&full=1</b> <br /> '.$this->l('You can set a cron job that will re-build url index using the following URL:').'<br /><b>'. - $base_url.'modules/blocklayered/blocklayered-url-indexer.php'.'?token='.substr(Tools::encrypt('blocklayered/index'), 0, 10).'&truncate=1</b> + Tools::getCurrentUrlProtocolPrefix().Tools::getHttpHost().__PS_BASE_URI__.'modules/blocklayered/blocklayered-url-indexer.php'.'?token='.substr(Tools::encrypt('blocklayered/index'), 0, 10).'&truncate=1</b> <br /> '.$this->l('You can set a cron job that will re-build attribute index using the following URL:').'<br /><b>'. - $base_url.'modules/blocklayered/blocklayered-attribute-indexer.php'.'?token='.substr(Tools::encrypt('blocklayered/index'), 0, 10).'</b> + Tools::getCurrentUrlProtocolPrefix().Tools::getHttpHost().__PS_BASE_URI__.'modules/blocklayered/blocklayered-attribute-indexer.php'.'?token='.substr(Tools::encrypt('blocklayered/index'), 0, 10).'</b> <br /><br /> '.$this->l('A nightly rebuild is recommended.').' <script type="text/javascript"> $(\'.ajaxcall\').click(function() { if (this.legend == undefined) this.legend = $(this).html(); - + if (this.running == undefined) this.running = false; - + if (this.running == true) return false; - + $(\'.ajax-message\').hide(); - + this.running = true; - + if (typeof(this.restartAllowed) == \'undefined\' || this.restartAllowed) { $(this).html(this.legend+\' '.addslashes($this->l('(in progress)')).'\'); $(\'#indexing-warning\').show(); } - + this.restartAllowed = false; - + $.ajax({ url: this.href+\'&ajax=1\', context: this, @@ -1325,7 +1324,7 @@ class BlockLayered extends Module $(\'#ajax-message-ko span\').html(\''.addslashes($this->l('Url indexation failed')).'\'); $(\'#ajax-message-ko\').show(); $(this).html(this.legend); - + this.running = false; } }); @@ -1335,28 +1334,28 @@ class BlockLayered extends Module $(elm).click(function() { if (this.cursor == undefined) this.cursor = 0; - + if (this.legend == undefined) this.legend = $(this).html(); - + if (this.running == undefined) this.running = false; - + if (this.running == true) return false; - + $(\'.ajax-message\').hide(); - + this.running = true; - + if (typeof(this.restartAllowed) == \'undefined\' || this.restartAllowed) { $(this).html(this.legend+\' '.addslashes($this->l('(in progress)')).'\'); $(\'#indexing-warning\').show(); } - + this.restartAllowed = false; - + $.ajax({ url: this.href+\'&ajax=1&cursor=\'+this.cursor, context: this, @@ -1385,7 +1384,7 @@ class BlockLayered extends Module $(\'#ajax-message-ko span\').html(\''.addslashes($this->l('Price indexation failed')).'\'); $(\'#ajax-message-ko\').show(); $(this).html(this.legend); - + this.cursor = 0; this.running = false; } @@ -1398,8 +1397,8 @@ class BlockLayered extends Module <br /> <fieldset class="width4"> <legend><img src="../img/admin/cog.gif" alt="" />'.$this->l('Existing filters templates').'</legend>'; - - $filtersTemplates = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('SELECT * FROM '._DB_PREFIX_.'layered_filter ORDER BY date_add DESC'); + + $filtersTemplates = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('SELECT * FROM '._DB_PREFIX_.'layered_filter ORDER BY date_add DESC'); if (count($filtersTemplates)) { $html .= '<p>'.count($filtersTemplates).' '.$this->l('filters templates are configured:').'</p> @@ -1411,12 +1410,12 @@ class BlockLayered extends Module <th>'.$this->l('Created on').'</th> <th>'.$this->l('Actions').'</th> </tr>'; - + foreach ($filtersTemplates as $filtersTemplate) { /* Clean request URI first */ $_SERVER['REQUEST_URI'] = preg_replace('/&deleteFilterTemplate=[0-9]*&id_layered_filter=[0-9]*/', '', $_SERVER['REQUEST_URI']); - + $html .= ' <tr> <td>'.(int)$filtersTemplate['id_layered_filter'].'</td> @@ -1425,20 +1424,20 @@ class BlockLayered extends Module <td>'.Tools::displayDate($filtersTemplate['date_add'], (int)$cookie->id_lang, true).'</td> <td> <a href="#" onclick="updElements('.($filtersTemplate['n_categories'] ? 0 : 1).', '.(int)$filtersTemplate['id_layered_filter'].');"> - <img src="../img/admin/edit.gif" alt="" title="'.$this->l('Edit').'" /></a> + <img src="../img/admin/edit.gif" alt="" title="'.$this->l('Edit').'" /></a> <a href="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'&deleteFilterTemplate=1&id_layered_filter='.(int)$filtersTemplate['id_layered_filter'].'" onclick="return confirm(\''.addslashes($this->l('Delete filter template #')).(int)$filtersTemplate['id_layered_filter'].$this->l('?').'\');"> <img src="../img/admin/delete.gif" alt="" title="'.$this->l('Delete').'" /></a> </td> </tr>'; } - + $html .= ' </table>'; } else $html .= $this->l('No filter template found.'); - + $html .= ' </fieldset><br /> <fieldset class="width4"> @@ -1460,13 +1459,13 @@ class BlockLayered extends Module #table-filter-templates tr th, #table-filter-templates tr td { text-align: center; } </style> <form action="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'" method="post" onsubmit="return checkForm();">'; - + $html .= ' <h2>'.$this->l('Step 1/3 - Select categories').'</h2> <p style="margin-top: 20px;">'.$this->l('Use this template for:').' - <input type="radio" id="scope_1" name="scope" value="1" style="margin-left: 15px;" onclick="$(\'#error-treeview\').hide(); $(\'#layered-step-2\').show(); updElements(1, 0);" /> + <input type="radio" id="scope_1" name="scope" value="1" style="margin-left: 15px;" onclick="$(\'#error-treeview\').hide(); $(\'#layered-step-2\').show(); updElements(1, 0);" /> <label for="scope_1" style="float: none;">'.$this->l('All categories').'</label> - <input type="radio" id="scope_2" name="scope" value="2" style="margin-left: 15px;" onclick="$(\'label a#inline\').click(); $(\'#layered-step-2\').show();" /> + <input type="radio" id="scope_2" name="scope" value="2" style="margin-left: 15px;" onclick="$(\'label a#inline\').click(); $(\'#layered-step-2\').show();" /> <label for="scope_2" style="float: none;"><a id="inline" href="#layered-categories-selection" style="text-decoration: underline;">'.$this->l('Specific').'</a> '.$this->l('categories').' (<span id="layered-cat-counter"></span> '.$this->l('selected').')</label> </p> @@ -1481,19 +1480,12 @@ class BlockLayered extends Module <li>'.$this->l('Press "Save this selection" or close the window to save').'</li> </ol>'; + $trads = array(); $selectedCat = array(); - // Translations are not automatic for the moment ;) - $trads = array( - 'Home' => $this->l('Home'), - 'selected' => $this->l('selected'), - 'Collapse All' => $this->l('Collapse All'), - 'Expand All' => $this->l('Expand All'), - 'Check All' => $this->l('Check All'), - 'Uncheck All' => $this->l('Uncheck All'), - 'search' => $this->l('Search a category') - ); + foreach (Helper::$translationsKeysForAdminCategorieTree as $key) + $trads[$key] = $this->l($key); $html .= Helper::renderAdminCategorieTree($trads, $selectedCat, 'categoryBox'); - + $html .= ' <br /> <center><input type="button" class="button" value="'.$this->l('Save this selection').'" onclick="$.fancybox.close();" /></center> @@ -1518,12 +1510,12 @@ class BlockLayered extends Module <script type="text/javascript" src="'.__PS_BASE_URI__.'js/jquery/jquery.fancybox-1.3.4.js"></script> <link type="text/css" rel="stylesheet" href="'.__PS_BASE_URI__.'css/jquery.fancybox-1.3.4.css" /> <script type="text/javascript"> - + function updLayCounters() { $(\'#num_sel_filters\').html(\'(\'+$(\'ul#selected_filters\').find(\'li\').length+\')\'); $(\'#num_avail_filters\').html(\'(\'+$(\'#layered_container_right ul\').find(\'li\').length+\')\'); - + if ($(\'ul#selected_filters\').find(\'li\').length >= 1) $(\'#layered-step-3\').show(); else @@ -1559,7 +1551,7 @@ class BlockLayered extends Module $(\'#layered-ajax-refresh\').css(\'opacity\', \'0.2\'); $(\'#layered-ajax-refresh\').html(\'<div style="margin: 0 auto; padding: 10px; text-align: center;">\' +\'<img src="../img/admin/ajax-loader-big.gif" alt="" /><br /><p style="color: white;">'.addslashes($this->l('Loading...')).'</p></div>\'); - + $.ajax( { type: \'GET\', @@ -1572,18 +1564,18 @@ class BlockLayered extends Module $(\'#layered-ajax-refresh\').css(\'background-color\', \'transparent\'); $(\'#layered-ajax-refresh\').css(\'opacity\', \'1\'); $(\'#layered-ajax-refresh\').html(result); - + $(\'#layered_container_right li input\').each(function() { if ($(\'#layered_container_left\').find(\'input[id="\'+$(this).attr(\'id\')+\'"]\').length > 0) $(this).parent().remove(); }); - + updHeight(); updLayCounters(); } }); } - + function checkForm() { if ($(\'#layered_tpl_name\').val() == \'\') @@ -1618,7 +1610,7 @@ class BlockLayered extends Module else { $(this).parent().css(\'background\', \'url("../img/jquery-ui/ui-bg_glass_100_f6f6f6_1x400.png") repeat-x scroll 50% 50% #F6F6F6\'); - $(this).effect(\'transfer\', { to: $(\'#layered_container_right ul#all_filters\') }, 300, function() { + $(this).effect(\'transfer\', { to: $(\'#layered_container_right ul#all_filters\') }, 300, function() { $(this).parent().removeClass(\'layered_left\'); $(this).parent().addClass(\'layered_right\'); $(this).parent().appendTo(\'ul#all_filters\'); @@ -1631,8 +1623,8 @@ class BlockLayered extends Module } enableSortable(); }); - - $(\'label a#inline\').fancybox({ + + $(\'label a#inline\').fancybox({ \'hideOnContentClick\': false, \'onClosed\': function() { updCatCounter(); @@ -1665,7 +1657,7 @@ class BlockLayered extends Module updCatCounter(); enableSortable(); } - + function enableSortable() { $(function() { @@ -1705,7 +1697,7 @@ class BlockLayered extends Module </fieldset><br /> <fieldset class="width2"> <legend><img src="../img/admin/cog.gif" alt="" /> '.$this->l('Configuration').'</legend> - <form action="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'" method="post"> + <form action="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'" method="post"> <table border="0" style="font-size: 11px; width: 100%; margin: 0 auto;" class="table"> <tr> <th style="text-align: center;">'.$this->l('Option').'</th> @@ -1742,7 +1734,7 @@ class BlockLayered extends Module $id_parent = (int)Tools::getValue('id_category', Tools::getValue('id_category_layered', 1)); if ($id_parent == 1) return; - + // Force attributes selection (by url '.../2-mycategory/color-blue' or by get parameter 'selected_filters') if (strpos($_SERVER['SCRIPT_FILENAME'], 'blocklayered-ajax.php') === false || Tools::getValue('selected_filters') !== false) { @@ -1750,7 +1742,7 @@ class BlockLayered extends Module $url = Tools::getValue('selected_filters'); else $url = preg_replace('/\/(?:\w*)\/(?:[0-9]+[-\w]*)([^\?]*)\??.*/', '$1', Tools::safeOutput($_SERVER['REQUEST_URI'], true)); - + $urlAttributes = explode('/', $url); array_shift($urlAttributes); $selectedFilters = array('category' => array()); @@ -1838,7 +1830,7 @@ class BlockLayered extends Module $queryFiltersWhere = ' AND p.active = 1'; $queryFiltersFrom = ''; - + $parent = new Category((int)$id_parent); if (!count($selectedFilters['category'])) $queryFiltersFrom .= ' INNER JOIN '._DB_PREFIX_.'category_product cp @@ -1874,8 +1866,8 @@ class BlockLayered extends Module case 'id_attribute_group': $subQueries = array(); - - + + foreach ($filterValues as $filterValue) { $filterValueArray = explode('_', $filterValue); @@ -1938,8 +1930,8 @@ class BlockLayered extends Module break; } } - - $idCurrency = (int)$this->context->currency->id; + + $idCurrency = Currency::getCurrent()->id; $priceFilterQueryIn = ''; // All products with price range between price filters limits $priceFilterQueryOut = ''; // All products with a price filters limit on it price range if (isset($priceFilter) && $priceFilter) @@ -1949,24 +1941,24 @@ class BlockLayered extends Module AND psi.price_max <= '.(int)$priceFilter['max'].' AND psi.`id_product` = p.`id_product` AND psi.`id_currency` = '.(int)$idCurrency; - + $priceFilterQueryOut = 'INNER JOIN `'._DB_PREFIX_.'layered_price_index` psi - ON + ON ((psi.price_min <= '.(int)$priceFilter['min'].' AND psi.price_max >= '.(int)$priceFilter['min'].') OR (psi.price_max >= '.(int)$priceFilter['max'].' AND psi.price_min <= '.(int)$priceFilter['max'].')) AND psi.`id_product` = p.`id_product` AND psi.`id_currency` = '.(int)$idCurrency; } - - $allProductsOut = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(' + + $allProductsOut = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS(' SELECT p.`id_product` id_product FROM `'._DB_PREFIX_.'product` p '.$priceFilterQueryOut.' '.$queryFiltersFrom.' WHERE 1 '.$queryFiltersWhere.' GROUP BY id_product', false); - - $allProductsIn = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(' + + $allProductsIn = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS(' SELECT p.`id_product` id_product FROM `'._DB_PREFIX_.'product` p '.$priceFilterQueryIn.' @@ -1974,7 +1966,7 @@ class BlockLayered extends Module WHERE 1 '.$queryFiltersWhere.' GROUP BY id_product', false); $productIdList = array(); - + while ($product = DB::getInstance()->nextRow($allProductsIn)) $productIdList[] = (int)$product['id_product']; @@ -1987,13 +1979,13 @@ class BlockLayered extends Module $productIdList[] = (int)$product['id_product']; } $this->nbr_products = count($productIdList); - + if ($this->nbr_products == 0) $this->products = array(); else { $n = (int)Tools::getValue('n', Configuration::get('PS_PRODUCTS_PER_PAGE')); - $this->products = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(' + $this->products = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS(' SELECT p.id_product, p.on_sale, p.out_of_stock, p.available_for_order, p.quantity, p.minimal_quantity, p.id_category_default, p.customizable, p.show_price, p.`weight`, p.ean13, pl.available_later, pl.description_short, pl.link_rewrite, pl.name, i.id_image, il.legend, m.name manufacturer_name, p.condition, p.id_manufacturer, DATEDIFF(p.`date_add`, @@ -2012,23 +2004,23 @@ class BlockLayered extends Module } return $this->products; } - + public function getFilterBlock($selectedFilters = array()) { global $cookie; static $cache = null; - + if (is_array($cache)) return $cache; - + $id_parent = (int)Tools::getValue('id_category', Tools::getValue('id_category_layered', 1)); if ($id_parent == 1) return; - + $parent = new Category((int)$id_parent); - + /* Get the filters for the current category */ - $filters = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('SELECT * FROM '._DB_PREFIX_.'layered_category WHERE id_category = '.(int)$id_parent.' + $filters = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('SELECT * FROM '._DB_PREFIX_.'layered_category WHERE id_category = '.(int)$id_parent.' GROUP BY `type`, id_value ORDER BY position ASC'); // Remove all empty selected filters foreach ($selectedFilters as $key => $value) @@ -2044,7 +2036,7 @@ class BlockLayered extends Module unset($selectedFilters[$key]); break; } - + $filterBlocks = array(); foreach ($filters as $filter) { @@ -2112,7 +2104,7 @@ class BlockLayered extends Module $sqlQuery['group'] = ' GROUP BY lpa.id_attribute ORDER BY id_attribute_group, id_attribute '; - + break; case 'id_feature': @@ -2151,6 +2143,7 @@ class BlockLayered extends Module WHERE c.id_parent = '.(int)$id_parent.' GROUP BY c.id_category ORDER BY level_depth, c.position'; } + foreach ($filters as $filterTmp) { $methodName = 'get'.ucfirst($filterTmp['type']).'FilterSubQuery'; @@ -2171,11 +2164,11 @@ class BlockLayered extends Module $sqlQuery[$key] .= $value; } } - + $products = false; if (!empty($sqlQuery['from'])) - $products = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sqlQuery['select']."\n".$sqlQuery['from']."\n".$sqlQuery['join']."\n".$sqlQuery['where']."\n".$sqlQuery['group']); - + $products = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sqlQuery['select']."\n".$sqlQuery['from']."\n".$sqlQuery['join']."\n".$sqlQuery['where']."\n".$sqlQuery['group']); + foreach ($filters as $filterTmp) { $methodName = 'filterProductsBy'.ucfirst($filterTmp['type']); @@ -2191,7 +2184,7 @@ class BlockLayered extends Module { case 'price': $priceArray = array('type_lite' => 'price', 'type' => 'price', 'id_key' => 0, 'name' => $this->l('Price'), - 'slider' => true, 'max' => '0', 'min' => null, 'values' => array ('1' => 0), 'unit' => (int)$this->context->currency->sign); + 'slider' => true, 'max' => '0', 'min' => null, 'values' => array ('1' => 0), 'unit' => Currency::getCurrent()->sign); if (isset($products) && $products) foreach ($products as $product) { @@ -2205,14 +2198,14 @@ class BlockLayered extends Module $priceArray['min'] = $product['price_min']; $priceArray['values'][0] = $product['price_min']; } - + if ($priceArray['max'] < $product['price_max']) { $priceArray['max'] = $product['price_max']; $priceArray['values'][1] = $product['price_max']; } } - + if ($priceArray['max'] != $priceArray['min'] && $priceArray['min'] != null) { if (isset($selectedFilters['price']) && isset($selectedFilters['price'][0]) @@ -2241,7 +2234,7 @@ class BlockLayered extends Module $weightArray['min'] = $product['weight']; $weightArray['values'][0] = $product['weight']; } - + if ($weightArray['max'] < $product['weight']) { $weightArray['max'] = $product['weight']; @@ -2261,7 +2254,7 @@ class BlockLayered extends Module break; case 'condition': - $conditionArray = array('new' => array('name' => $this->l('New'), 'nbr' => 0), + $conditionArray = array('new' => array('name' => $this->l('New'), 'nbr' => 0), 'used' => array('name' => $this->l('Used'), 'nbr' => 0), 'refurbished' => array('name' => $this->l('Refurbished'), 'nbr' => 0)); if (isset($products) && $products) foreach ($products as $product) @@ -2276,7 +2269,7 @@ class BlockLayered extends Module $conditionArray[$product['condition']]['nbr']++; $filterBlocks[] = array('type_lite' => 'condition', 'type' => 'condition', 'id_key' => 0, 'name' => $this->l('Condition'), 'values' => $conditionArray); break; - + case 'quantity': $quantityArray = array (0 => array('name' => $this->l('Not available'), 'nbr' => 0), 1 => array('name' => $this->l('In stock'), 'nbr' => 0)); foreach ($quantityArray as $key => $quantity) @@ -2313,7 +2306,7 @@ class BlockLayered extends Module 'type' => 'id_attribute_group', 'id_key' => (int)$attributes['id_attribute_group'], 'name' => $attributes['attribute_group_name'], 'is_color_group' => (bool)$attributes['is_color_group'], 'values' => array(), 'url_name' => $attributes['name_url_name'], 'meta_title' => $attributes['name_meta_title']); - + $attributesArray[$attributes['id_attribute_group']]['values'][$attributes['id_attribute']] = array( 'color' => $attributes['color'], 'name' => $attributes['attribute_name'], 'nbr' => (int)$attributes['nbr'], 'url_name' => $attributes['value_url_name'], 'meta_title' => $attributes['value_meta_title']); @@ -2356,15 +2349,15 @@ class BlockLayered extends Module $filterBlocks[] = array ('type_lite' => 'category', 'type' => 'category', 'id_key' => 0, 'name' => $this->l('Categories'), 'values' => $tmpArray); } break; - + } } - + // All non indexable attribute and feature $nonIndexable = array(); - + // Get all non indexable attribute groups - foreach (Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(' + foreach (Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS(' SELECT public_name FROM `'._DB_PREFIX_.'attribute_group_lang` agl LEFT JOIN `'._DB_PREFIX_.'layered_indexable_attribute_group` liag @@ -2372,9 +2365,9 @@ class BlockLayered extends Module WHERE indexable IS NULL OR indexable = 0 AND id_lang = '.(int)$cookie->id_lang) as $attribute) $nonIndexable[] = Tools::link_rewrite($attribute['public_name']); - + // Get all non indexable features - foreach (Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(' + foreach (Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS(' SELECT name FROM `'._DB_PREFIX_.'feature_lang` fl LEFT JOIN `'._DB_PREFIX_.'layered_indexable_feature` lif @@ -2385,20 +2378,19 @@ class BlockLayered extends Module //generate SEO link $paramSelected = ''; - $param_product_url = ''; $optionCheckedArray = array(); $paramGroupSelectedArray = array(); $titleValues = array(); $link = new Link(); - + $linkBase = $link->getCategoryLink($id_parent, Category::getLinkRewrite($id_parent, (int)($cookie->id_lang)), (int)($cookie->id_lang)); $filterBlockList = array(); - + //get filters checked by group foreach ($filterBlocks as $typeFilter) { $filterName = (!empty($typeFilter['url_name']) ? $typeFilter['url_name'] : $typeFilter['name']); - + $paramGroupSelected = ''; foreach ($typeFilter['values'] as $key => $value) { @@ -2407,7 +2399,7 @@ class BlockLayered extends Module $valueName = !empty($value['url_name']) ? $value['url_name'] : $value['name']; $paramGroupSelected .= '-'.str_replace('-', '_', Tools::link_rewrite($valueName)); $paramGroupSelectedArray[Tools::link_rewrite($filterName)][] = Tools::link_rewrite($valueName); - + if (!isset($titleValues[$filterName])) $titleValues[$filterName] = array(); $titleValues[$filterName][] = $valueName; @@ -2420,9 +2412,6 @@ class BlockLayered extends Module $paramSelected .= '/'.str_replace('-', '_', Tools::link_rewrite($filterName)).$paramGroupSelected; $optionCheckedArray[Tools::link_rewrite($filterName)] = $paramGroupSelected; } - // select only attribute and group attribute to display an unique product combination link - if (!empty($paramGroupSelected) && $typeFilter['type'] == 'id_attribute_group') - $param_product_url .= '/'.str_replace('-', '_', Tools::link_rewrite($filterName)).$paramGroupSelected; } $blackList = array('weight','price'); @@ -2430,14 +2419,14 @@ class BlockLayered extends Module foreach ($filterBlocks as &$typeFilter) { $filterName = (!empty($typeFilter['url_name']) ? $typeFilter['url_name'] : $typeFilter['name']); - + if (count($typeFilter) > 0 && !in_array($typeFilter['type'], $blackList)) { foreach ($typeFilter['values'] as $key => $values) { $nofollow = false; $optionCheckedCloneArray = $optionCheckedArray; - + //if not filters checked, add parameter $valueName = !empty($values['url_name']) ? $values['url_name'] : $values['name']; if (!in_array(Tools::link_rewrite($valueName), $paramGroupSelectedArray[Tools::link_rewrite($filterName)])) @@ -2454,16 +2443,14 @@ class BlockLayered extends Module else { // Remove selected parameters - $optionCheckedCloneArray[Tools::link_rewrite($filterName)] = str_replace( - '-'.str_replace('-', '_', Tools::link_rewrite($valueName)), - '', - $optionCheckedCloneArray[Tools::link_rewrite($filterName)]); + $optionCheckedCloneArray[Tools::link_rewrite($filterName)] = str_replace('-'.str_replace('-', '_', Tools::link_rewrite($valueName)), '', $optionCheckedCloneArray[Tools::link_rewrite($filterName)]); if (empty($optionCheckedCloneArray[Tools::link_rewrite($filterName)])) unset($optionCheckedCloneArray[Tools::link_rewrite($filterName)]); } $parameters = ''; foreach ($optionCheckedCloneArray as $keyGroup => $valueGroup) $parameters .= '/'.str_replace('-', '_', $keyGroup).$valueGroup; + // Check if there is an non indexable attribute or feature in the url foreach ($nonIndexable as $value) if (strpos($parameters, '/'.$value) !== false) @@ -2473,12 +2460,12 @@ class BlockLayered extends Module $typeFilter['values'][$key]['link'] = $linkBase.'&selected_filters='.$parameters; else $typeFilter['values'][$key]['link'] = $linkBase.$parameters; - + $typeFilter['values'][$key]['rel'] = ($nofollow) ? 'nofollow' : ''; } } } - + $nFilters = 0; if (isset($selectedFilters['price'])) if ($priceArray['min'] == $selectedFilters['price'][0] && $priceArray['max'] == $selectedFilters['price'][1]) @@ -2486,17 +2473,17 @@ class BlockLayered extends Module if (isset($selectedFilters['weight'])) if ($weightArray['min'] == $selectedFilters['weight'][0] && $weightArray['max'] == $selectedFilters['weight'][1]) unset($selectedFilters['weight']); - + foreach ($selectedFilters as $filters) $nFilters += count($filters); - + $cache = array('layered_show_qties' => (int)Configuration::get('PS_LAYERED_SHOW_QTIES'), 'id_category_layered' => (int)$id_parent, 'selected_filters' => $selectedFilters, 'n_filters' => (int)$nFilters, 'nbr_filterBlocks' => count($filterBlocks), 'filters' => $filterBlocks, - 'title_values' => $titleValues, 'current_friendly_url' => htmlentities($paramSelected), 'param_product_url' => htmlentities($param_product_url), 'nofollow' => !empty($paramSelected) || $nofollow); - + 'title_values' => $titleValues, 'current_friendly_url' => htmlentities($paramSelected), 'nofollow' => !empty($paramSelected) || $nofollow); + return $cache; } - + public function cleanFilterByIdValue($attributes, $id_value) { $selected_filters = array(); @@ -2509,7 +2496,7 @@ class BlockLayered extends Module } return $selected_filters; } - + public function generateFiltersBlock($selectedFilters) { global $smarty; @@ -2517,35 +2504,37 @@ class BlockLayered extends Module { if ($filterBlock['nbr_filterBlocks'] == 0) return false; - + $smarty->assign($filterBlock); - + return $this->display(__FILE__, 'blocklayered.tpl'); } else return false; } - + private static function getPriceFilterSubQuery($filterValue) { - $idCurrency = (int)Context::getContext()->currency->id; + $idCurrency = (int)Currency::getCurrent()->id; $priceFilterQuery = ''; if (isset($filterValue) && $filterValue) { + $idCurrency = Currency::getCurrent()->id; $priceFilterQuery = ' INNER JOIN `'._DB_PREFIX_.'layered_price_index` psi ON (psi.id_product = p.id_product AND psi.id_currency = '.(int)$idCurrency.' AND psi.price_min <= '.(int)$filterValue[1].' AND psi.price_max >= '.(int)$filterValue[0].') '; } else { + $idCurrency = Currency::getCurrent()->id; $priceFilterQuery = ' - INNER JOIN `'._DB_PREFIX_.'layered_price_index` psi + INNER JOIN `'._DB_PREFIX_.'layered_price_index` psi ON (psi.id_product = p.id_product AND psi.id_currency = '.(int)$idCurrency.') '; } - + return array('join' => $priceFilterQuery, 'select' => ', psi.price_min, psi.price_max'); } - + private static function filterProductsByPrice($filterValue, $productCollection) { if (empty($filterValue)) @@ -2563,16 +2552,16 @@ class BlockLayered extends Module } return $productCollection; } - + private static function getWeightFilterSubQuery($filterValue, $ignoreJoin) { if (isset($filterValue) && $filterValue) if ($filterValue[0] != 0 || $filterValue[1] != 0) return array('where' => ' AND p.`weight` BETWEEN '.(float)($filterValue[0] - 0.001).' AND '.(float)($filterValue[1] + 0.001).' '); - + return array(); } - + private static function getId_featureFilterSubQuery($filterValue, $ignoreJoin) { if (empty($filterValue)) @@ -2581,7 +2570,7 @@ class BlockLayered extends Module foreach ($filterValue as $filterVal) $queryFilters .= 'fp.`id_feature_value` = '.(int)$filterVal.' OR '; $queryFilters = rtrim($queryFilters, 'OR ').') '; - + return array('where' => $queryFilters); } private static function getId_attribute_groupFilterSubQuery($filterValue, $ignoreJoin) @@ -2593,14 +2582,14 @@ class BlockLayered extends Module FROM `'._DB_PREFIX_.'product_attribute_combination` pac LEFT JOIN `'._DB_PREFIX_.'product_attribute` pa ON (pa.`id_product_attribute` = pac.`id_product_attribute`) WHERE '; - + foreach ($filterValue as $filterVal) $queryFilters .= 'pac.`id_attribute` = '.(int)$filterVal.' OR '; $queryFilters = rtrim($queryFilters, 'OR ').') '; - + return array('where' => $queryFilters); } - + private static function getCategoryFilterSubQuery($filterValue, $ignoreJoin) { if (empty($filterValue)) @@ -2610,19 +2599,19 @@ class BlockLayered extends Module foreach ($filterValue as $id_category) $queryFiltersWhere .= 'cp.`id_category` = '.(int)$id_category.' OR '; $queryFiltersWhere = rtrim($queryFiltersWhere, 'OR ').') '; - + return array('where' => $queryFiltersWhere, 'join' => $queryFiltersJoin); } - + private static function getQuantityFilterSubQuery($filterValue, $ignoreJoin) { if (count($filterValue) == 2 || empty($filterValue)) return array(); $queryFilters = ' AND p.quantity '.(!$filterValue[0] ? '=' : '>').' 0 '; - + return array('where' => $queryFilters); } - + private static function getManufacturerFilterSubQuery($filterValue, $ignoreJoin) { if (empty($filterValue)) @@ -2637,7 +2626,7 @@ class BlockLayered extends Module else return array('where' => $queryFilters, 'select' => ', m.name', 'join' => 'LEFT JOIN `'._DB_PREFIX_.'manufacturer` m ON (m.id_manufacturer = p.id_manufacturer) '); } - + private static function getConditionFilterSubQuery($filterValue, $ignoreJoin) { if (count($filterValue) == 3 || empty($filterValue)) @@ -2646,14 +2635,14 @@ class BlockLayered extends Module foreach ($filterValue as $cond) $queryFilters .= '\''.$cond.'\','; $queryFilters = rtrim($queryFilters, ',').') '; - + return array('where' => $queryFilters); } - + public function ajaxCallBackOffice($categoryBox = array(), $id_layered_filter = null) { global $cookie; - + if (!empty($id_layered_filter)) { $layeredFilter = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('SELECT * FROM '._DB_PREFIX_.'layered_filter WHERE id_layered_filter = '.(int)$id_layered_filter); @@ -2663,13 +2652,13 @@ class BlockLayered extends Module foreach ($layeredValues['categories'] as $id_category) $categoryBox[] = (int)$id_category; } - + /* Clean categoryBox before use */ if (isset($categoryBox) && is_array($categoryBox)) foreach ($categoryBox as &$value) $value = (int)$value; - - $attributeGroups = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(' + + $attributeGroups = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS(' SELECT ag.id_attribute_group, ag.is_color_group, agl.name, COUNT(DISTINCT(a.id_attribute)) n FROM '._DB_PREFIX_.'attribute_group ag LEFT JOIN '._DB_PREFIX_.'attribute_group_lang agl ON (agl.id_attribute_group = ag.id_attribute_group) @@ -2681,22 +2670,22 @@ class BlockLayered extends Module WHERE agl.id_lang = '.(int)$cookie->id_lang. (count($categoryBox) ? ' AND cp.id_category IN ('.implode(',', $categoryBox).')' : '').' GROUP BY ag.id_attribute_group'); - - $features = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(' + + $features = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS(' SELECT fl.id_feature, fl.name, COUNT(DISTINCT(fv.id_feature_value)) n FROM '._DB_PREFIX_.'feature_lang fl LEFT JOIN '._DB_PREFIX_.'feature_value fv ON (fv.id_feature = fl.id_feature) '.(count($categoryBox) ? ' LEFT JOIN '._DB_PREFIX_.'feature_product fp ON (fp.id_feature = fv.id_feature) - LEFT JOIN '._DB_PREFIX_.'category_product cp ON (cp.id_product = fp.id_product)' : '').' + LEFT JOIN '._DB_PREFIX_.'category_product cp ON (cp.id_product = fp.id_product)' : '').' WHERE (fv.custom IS NULL OR fv.custom = 0) AND fl.id_lang = '.(int)$cookie->id_lang. (count($categoryBox) ? ' AND cp.id_category IN ('.implode(',', $categoryBox).')' : '').' GROUP BY fl.id_feature'); - + $nElements = count($attributeGroups) + count($features) + 4; if ($nElements > 20) $nElements = 20; - + $html = ' <div id="layered_container_right" style="width: 360px; float: left; margin-left: 20px; height: '.(int)(30 + $nElements * 38).'px; overflow-y: auto;"> <h3>'.$this->l('Available filters').' <span id="num_avail_filters">(0)</span></h3> @@ -2740,7 +2729,7 @@ class BlockLayered extends Module <span class="position"></span>'.$this->l('Product price filter (slider)').' </li> </ul>'; - + if (count($attributeGroups)) { $html .= '<ul>'; @@ -2772,7 +2761,7 @@ class BlockLayered extends Module $html .= ' </div>'; - + if (isset($layeredValues)) { $html .= ' @@ -2782,11 +2771,11 @@ class BlockLayered extends Module { $(\'#selected_filters li\').remove(); '; - + foreach ($layeredValues as $key => $layeredValue) if ($key != 'categories') $html .= '$(\'#'.$key.'\').click();'."\n"; - + if (isset($layeredValues['categories']) && count($layeredValues['categories'])) { foreach ($layeredValues['categories'] as $id_category) @@ -2802,11 +2791,11 @@ class BlockLayered extends Module $(\'#scope_2\').attr(\'checked\', \'\'); $(\'#scope_1\').attr(\'checked\', \'checked\'); '; - + $html .= ' $(\'#layered_tpl_name\').val(\''.addslashes($layeredFilter['name']).'\'); $(\'#id_layered_filter\').val(\''.(int)$layeredFilter['id_layered_filter'].'\')'; - + $html .= ' }); </script>'; @@ -2814,15 +2803,15 @@ class BlockLayered extends Module return $html; } - + public function ajaxCall() { global $smarty; $selectedFilters = $this->getSelectedFilters(); - + $this->getProducts($selectedFilters, $products, $nbProducts, $p, $n, $pages_nb, $start, $stop, $range); - + $smarty->assign('nb_products', $nbProducts); $smarty->assign('category', (object)array('id' => Tools::getValue('id_category_layered', 1))); $pagination_infos = array('pages_nb' => (int)($pages_nb), 'p' => (int)$p, 'n' => (int)$n, 'range' => (int)$range, 'start' => (int)$start, 'stop' => (int)$stop, @@ -2831,7 +2820,7 @@ class BlockLayered extends Module $smarty->assign('comparator_max_item', (int)(Configuration::get('PS_COMPARATOR_MAX_ITEM'))); $smarty->assign('products', $products); $smarty->assign('products_per_page', (int)Configuration::get('PS_PRODUCTS_PER_PAGE')); - + // Prevent bug with old template where category.tpl contain the title of the category and category-count.tpl do not exists if (file_exists(_PS_THEME_DIR_.'category-count.tpl')) $categoryCount = $smarty->fetch(_PS_THEME_DIR_.'category-count.tpl'); @@ -2839,34 +2828,34 @@ class BlockLayered extends Module $categoryCount = ''; if ($nbProducts == 0) - $product_list_tpl = 'blocklayered-no-products.tpl'; + $product_list = $this->display(__FILE__, 'blocklayered-no-products.tpl'); else - $product_list_tpl = _PS_THEME_DIR_.'product-list.tpl'; - + $product_list = $smarty->fetch(_PS_THEME_DIR_.'product-list.tpl'); + /* We are sending an array in jSon to the .js controller, it will update both the filters and the products zones */ return Tools::jsonEncode(array( 'filtersBlock' => $this->generateFiltersBlock($selectedFilters), - 'productList' => $smarty->fetch($product_list_tpl), + 'productList' => $product_list, 'pagination' => $smarty->fetch(_PS_THEME_DIR_.'pagination.tpl'), 'categoryCount' => $categoryCount)); } - + public function getProducts($selectedFilters, &$products, &$nbProducts, &$p, &$n, &$pages_nb, &$start, &$stop, &$range) { global $cookie; - + $products = $this->getProductByFilters($selectedFilters); $products = Product::getProductsProperties((int)$cookie->id_lang, $products); - + $nbProducts = $this->nbr_products; $range = 2; /* how many pages around page selected */ - + $n = (int)Tools::getValue('n', Configuration::get('PS_PRODUCTS_PER_PAGE')); $p = Tools::getValue('p', 1); - + if ($p < 0) $p = 0; - + if ($p > ($nbProducts / $n)) $p = ceil($nbProducts / $n); $pages_nb = ceil($nbProducts / (int)($n)); @@ -2874,7 +2863,7 @@ class BlockLayered extends Module $start = (int)($p - $range); if ($start < 1) $start = 1; - + $stop = (int)($p + $range); if ($stop > $pages_nb) $stop = (int)($pages_nb); @@ -2883,15 +2872,15 @@ class BlockLayered extends Module public function rebuildLayeredStructure() { @set_time_limit(0); - + /* Set memory limit to 128M only if current is lower */ $memory_limit = @ini_get('memory_limit'); if (substr($memory_limit, -1) != 'G' && ((substr($memory_limit, -1) == 'M' && substr($memory_limit, 0, -1) < 128) || is_numeric($memory_limit) && (intval($memory_limit) < 131072))) @ini_set('memory_limit', '128M'); /* Delete and re-create the layered categories table */ - Db::getInstance()->execute('DROP TABLE IF EXISTS '._DB_PREFIX_.'layered_category'); - Db::getInstance()->execute(' + Db::getInstance()->Execute('DROP TABLE IF EXISTS '._DB_PREFIX_.'layered_category'); + Db::getInstance()->Execute(' CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'layered_category` ( `id_layered_category` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, `id_category` INT(10) UNSIGNED NOT NULL, @@ -2901,8 +2890,8 @@ class BlockLayered extends Module PRIMARY KEY (`id_layered_category`), KEY `id_category` (`id_category`,`type`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;'); /* MyISAM + latin1 = Smaller/faster */ - - Db::getInstance()->execute(' + + Db::getInstance()->Execute(' CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'layered_filter` ( `id_layered_filter` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, `name` VARCHAR(64) NOT NULL, @@ -2910,11 +2899,11 @@ class BlockLayered extends Module `n_categories` INT(10) UNSIGNED NOT NULL, `date_add` DATETIME NOT NULL)'); } - + public function rebuildLayeredCache($productsIds = array(), $categoriesIds = array()) { @set_time_limit(0); - + /* Set memory limit to 128M only if current is lower */ $memory_limit = @ini_get('memory_limit'); if (substr($memory_limit, -1) != 'G' && ((substr($memory_limit, -1) == 'M' && substr($memory_limit, 0, -1) < 128) || is_numeric($memory_limit) && (intval($memory_limit) < 131072))) @@ -2924,7 +2913,7 @@ class BlockLayered extends Module $nCategories = array(); $doneCategories = array(); - $attributeGroups = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(' + $attributeGroups = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS(' SELECT a.id_attribute, a.id_attribute_group FROM '._DB_PREFIX_.'attribute a LEFT JOIN '._DB_PREFIX_.'product_attribute_combination pac ON (pac.id_attribute = a.id_attribute) @@ -2939,7 +2928,7 @@ class BlockLayered extends Module while ($row = $db->nextRow($attributeGroups)) $attributeGroupsById[(int)$row['id_attribute']] = (int)$row['id_attribute_group']; - $features = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(' + $features = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS(' SELECT fv.id_feature_value, fv.id_feature FROM '._DB_PREFIX_.'feature_value fv LEFT JOIN '._DB_PREFIX_.'feature_product fp ON (fp.id_feature_value = fv.id_feature_value) @@ -2953,7 +2942,7 @@ class BlockLayered extends Module while ($row = $db->nextRow($features)) $featuresById[(int)$row['id_feature_value']] = (int)$row['id_feature']; - $result = $db->executeS(' + $result = $db->ExecuteS(' SELECT p.id_product, GROUP_CONCAT(DISTINCT fv.id_feature_value) features, GROUP_CONCAT(DISTINCT cp.id_category) categories, GROUP_CONCAT(DISTINCT pac.id_attribute) attributes FROM '._DB_PREFIX_.'product p LEFT JOIN '._DB_PREFIX_.'category_product cp ON (cp.id_product = p.id_product) @@ -3034,7 +3023,7 @@ class BlockLayered extends Module } } if ($toInsert) - Db::getInstance()->execute(rtrim($queryCategory, ',')); + Db::getInstance()->Execute(rtrim($queryCategory, ',')); } } } diff --git a/modules/blocklayered/blocklayered.tpl b/modules/blocklayered/blocklayered.tpl index edec30ee5..9db5779c2 100644 --- a/modules/blocklayered/blocklayered.tpl +++ b/modules/blocklayered/blocklayered.tpl @@ -97,7 +97,7 @@ param_product_url = '#{$param_product_url}'; </li> {/foreach} {else} - <label for="{$filter.type}">{l s='Range:'}</label> <span id="layered_{$filter.type}_range"></span> + <label for="{$filter.type}">{l s='Range:' mod='blocklayered'}</label> <span id="layered_{$filter.type}_range"></span> <div style="margin: 6px 0 6px 6px; width: 93%;"> <div style="margin-top:5px;" class="layered_slider" id="layered_{$filter.type}_slider"></div> </div> diff --git a/modules/blocksearch/blocksearch.php b/modules/blocksearch/blocksearch.php index 092c9da2d..f0fa3e0fd 100644 --- a/modules/blocksearch/blocksearch.php +++ b/modules/blocksearch/blocksearch.php @@ -46,11 +46,21 @@ class BlockSearch extends Module public function install() { - if (!parent::install() || !$this->registerHook('top')) + if (!parent::install() || !$this->registerHook('top') || !$this->registerHook('header')) return false; return true; } + public function hookHeader($params) + { + if (Configuration::get('PS_SEARCH_AJAX')) + { + Tools::addCSS(_PS_CSS_DIR_.'jquery.autocomplete.css'); + Tools::addJS(_PS_JS_DIR_.'jquery/jquery.autocomplete.js'); + } + Tools::addCSS(_THEME_CSS_DIR_.'product_list.css'); + Tools::addCSS(($this->_path).'blocksearch.css', 'all'); + } public function hookLeftColumn($params) { @@ -79,15 +89,9 @@ class BlockSearch extends Module { $this->context->smarty->assign('ENT_QUOTES', ENT_QUOTES); $this->context->smarty->assign('search_ssl', Tools::usingSecureMode()); + $this->context->smarty->assign('ajaxsearch', Configuration::get('PS_SEARCH_AJAX')); + $this->context->smarty->assign('instantsearch', Configuration::get('PS_INSTANT_SEARCH')); - $ajax_search = (int)Configuration::get('PS_SEARCH_AJAX'); - $this->context->smarty->assign('ajaxsearch', $ajax_search); - - $instant_search = (int)(Configuration::get('PS_INSTANT_SEARCH')); - $this->context->smarty->assign('instantsearch', $instant_search); - if ($ajax_search) - $this->context->controller->addJqueryPlugin('autocomplete'); - $this->context->controller->addCSS(_THEME_CSS_DIR_.'product_list.css'); - $this->context->controller->addCSS(($this->_path).'blocksearch.css', 'all'); + return true; } } diff --git a/modules/blockstore/en.php b/modules/blockstore/en.php new file mode 100644 index 000000000..601358d4f --- /dev/null +++ b/modules/blockstore/en.php @@ -0,0 +1,4 @@ +<?php + +global $_MODULE; +$_MODULE = array(); diff --git a/modules/blockwishlist/managewishlist.tpl b/modules/blockwishlist/managewishlist.tpl index bb7d8c433..71bd61ebd 100644 --- a/modules/blockwishlist/managewishlist.tpl +++ b/modules/blockwishlist/managewishlist.tpl @@ -60,8 +60,10 @@ </span> <a href="javascript:;" class="clear button" onclick="WishlistProductManage('wlp_bought', 'delete', '{$id_wishlist}', '{$product.id_product}', '{$product.id_product_attribute}', $('#quantity_{$product.id_product}_{$product.id_product_attribute}').val(), $('#priority_{$product.id_product}_{$product.id_product_attribute}').val());" title="{l s='Delete' mod='blockwishlist'}">{l s='Delete' mod='blockwishlist'}</a> <a href="javascript:;" class="exclusive" onclick="WishlistProductManage('wlp_bought_{$product.id_product_attribute}', 'update', '{$id_wishlist}', '{$product.id_product}', '{$product.id_product_attribute}', $('#quantity_{$product.id_product}_{$product.id_product_attribute}').val(), $('#priority_{$product.id_product}_{$product.id_product_attribute}').val());" title="{l s='Save' mod='blockwishlist'}">{l s='Save' mod='blockwishlist'}</a> + <br /> </li> </ul> + <div class="clear"> </div> {/foreach} </div> <div class="clear"></div> diff --git a/modules/blockwishlist/view.tpl b/modules/blockwishlist/view.tpl index 81cbecc7c..769a10e4d 100644 --- a/modules/blockwishlist/view.tpl +++ b/modules/blockwishlist/view.tpl @@ -87,6 +87,7 @@ </li> </div> </ul> + <div class="clear"> </div> {/foreach} <p class="clear" /> </div> diff --git a/modules/dibs/dibs.php b/modules/dibs/dibs.php index a628cd287..5d72fcb48 100644 --- a/modules/dibs/dibs.php +++ b/modules/dibs/dibs.php @@ -35,21 +35,21 @@ class dibs extends PaymentModule * @staticvar */ public static $ID_MERCHANT; - + /** * The URL of the page to be displayed if the purchase is approved. * @var string * @staticvar */ private static $ACCEPTED_URL = ''; - + /** * The URL of the page to be displayed if the customer cancels the payment. * @var string * @staticvar */ private static $CANCELLED_URL = ''; - + /** * Set the testing mode. * @var string @@ -61,19 +61,19 @@ class dibs extends PaymentModule * @var array */ public static $MORE_SETTINGS; - + /** * @var string * @staticvar */ private static $site_url; - + /** * Only this langs array are allowed in DIBS API * @var array */ private static $accepted_lang = array('da','en','es','fi','fo','fr','it','nl','no','pl','sv'); - + /** * Formular link to DIBS subscription * @var array @@ -97,7 +97,7 @@ class dibs extends PaymentModule $this->displayName = $this->l('DIBS'); $this->description = $this->l('DIBS payment API'); - + if (self::$site_url === NULL) { if(method_exists('Tools', 'getProtocol')) @@ -105,13 +105,13 @@ class dibs extends PaymentModule else self::$site_url = Tools::htmlentitiesutf8((!is_null($use_ssl) && $use_ssl ? 'https://' : 'http://').$_SERVER['HTTP_HOST'].__PS_BASE_URI__); } - + self::$ID_MERCHANT = Configuration::get('DIBS_ID_MERCHANT'); self::$ACCEPTED_URL = Configuration::get('DIBS_ACCEPTED_URL'); self::$CANCELLED_URL = Configuration::get('DIBS_CANCELLED_URL'); self::$TESTING = (int)Configuration::get('DIBS_TESTING'); self::$MORE_SETTINGS = Configuration::get('DIBS_MORE_SETTINGS') != '' ? unserialize(Tools::htmlentitiesDecodeUTF8(Configuration::get('DIBS_MORE_SETTINGS'))) : array(); - + if (!isset(self::$MORE_SETTINGS['k1']) OR (isset(self::$MORE_SETTINGS['k1']) AND (self::$MORE_SETTINGS['k1'] === '' OR self::$MORE_SETTINGS['k2'] === '') )) $this->warning = $this->l('For security reasons, you must set key #1 and key #2 used by MD5 control of DIBS API.'); @@ -128,9 +128,9 @@ class dibs extends PaymentModule public function install() { - return (parent::install() - AND $this->registerHook('orderConfirmation') - AND $this->registerHook('payment') + return (parent::install() + AND $this->registerHook('orderConfirmation') + AND $this->registerHook('payment') AND Configuration::updateValue('DIBS_ACCEPTED_URL', self::$site_url.(substr(trim(self::$site_url), -1, 1) === '/' ? '' : '/').'order-confirmation.php') AND Configuration::updateValue('DIBS_CANCELLED_URL', self::$site_url) AND Configuration::updateValue('DIBS_TESTING', 1) @@ -153,7 +153,7 @@ class dibs extends PaymentModule return; if ($params['objOrder']->module != $this->name) return; - + if ($params['objOrder']->valid) $this->context->smarty->assign(array('status' => 'ok', 'id_order' => $params['objOrder']->id)); else @@ -173,17 +173,17 @@ class dibs extends PaymentModule self::$MORE_SETTINGS['logo_color'] = Tools::getValue('logo_color'); self::$MORE_SETTINGS['k1'] = Tools::getValue('k1'); self::$MORE_SETTINGS['k2'] = Tools::getValue('k2'); - + Configuration::updateValue('DIBS_ID_MERCHANT', self::$ID_MERCHANT); Configuration::updateValue('DIBS_ACCEPTED_URL', self::$ACCEPTED_URL); Configuration::updateValue('DIBS_CANCELLED_URL', self::$CANCELLED_URL); Configuration::updateValue('DIBS_TESTING', self::$TESTING); Configuration::updateValue('DIBS_MORE_SETTINGS', Tools::htmlentitiesUTF8(serialize(self::$MORE_SETTINGS))); - + $data_sync = ''; if(self::$ID_MERCHANT !== '' AND self::$TESTING !== 1 AND self::$MORE_SETTINGS['k1'] !== '' AND self::$MORE_SETTINGS['k2'] !== '') $data_sync = '<img src="http://www.prestashop.com/modules/dibs.png?site_id='.urlencode(self::$ID_MERCHANT).'" style="float:right" />'; - + echo '<div class="conf confirm"><img src="../img/admin/ok.gif"/>'.$this->l('Configuration updated').$data_sync.'</div>'; } } @@ -219,7 +219,7 @@ class dibs extends PaymentModule public function getContent() { $this->preProcess(); - + $flexwin_colors = array('sand', 'grey', 'blue'); $logo_colors = array('yellow', 'grey', 'blue', 'black', 'purple', 'green'); $str = '<h2>'.$this->displayName.'</h2>' @@ -282,7 +282,7 @@ class dibs extends PaymentModule public function hookPayment($params) { - if ((self::$ID_MERCHANT === false || self::$ID_MERCHANT === '' || self::$ID_MERCHANT === NULL) + if ((self::$ID_MERCHANT === false || self::$ID_MERCHANT === '' || self::$ID_MERCHANT === NULL) || (self::$ACCEPTED_URL === false || self::$ACCEPTED_URL === '' || self::$ACCEPTED_URL === NULL)) return ''; @@ -298,7 +298,7 @@ class dibs extends PaymentModule // Required $dibsParams['merchant'] = self::$ID_MERCHANT; // id merchant send from DIBS e-mail - // don't cast to int !! It has strange behaviour (really strange) + // don't cast to int !! It has strange behaviour (really strange) // for example : When calculate a total amount of 557.05, the result is 55704 after casting !! $dibsParams['amount'] = $params['cart']->getOrderTotal(true, Cart::BOTH) * 100; // The smallest unit of an amount, cent for EUR $dibsParams['accepturl'] = self::$ACCEPTED_URL.'?id_cart='.(int)($params['cart']->id).'&id_module='.(int)($this->id).'&key='.$customer->secure_key; // The URL of the page to be displayed if the purchase is approved. @@ -333,12 +333,12 @@ class dibs extends PaymentModule if(self::$TESTING === 1) $dibsParams['test'] = 'yes'; // optional - This field is used when tests are being conducted on the shop (e.g. test=yes). When this field is declared, the transaction is not dispatched to the card issuer, but is instead handled by the DIBS test module. See also Step 5 of the 10 Step Guide for more information. During your initial integration with DIBS, there is no need to insert this parameter, since all default transactions will hit the DIBS test system until DIBS has approved integration. Should the test system be used at a later date, this will be activated at DIBS (contact DIBS support for reactivating the test mode of your shop). $dibsParams['lang'] = in_array(strtolower($lang->iso_code), self::$accepted_lang) ? $lang->iso_code : ''; // optional - This parameter determines the language in which the page will be opened. The following values are accepted: da=Danish en=English es=Spanish fi=Finnish fo=Faroese fr=French it=Italian nl=Dutch no=Norwegian pl=Polish (simplified) sv=Swedish Default language is Danish. - $dibsParams['color'] = self::$MORE_SETTINGS['flexwin_color']; // optional - The basic color theme of FlexWin. There is currently a choice of "sand", "grey" and "blue". The default value is "blue". + $dibsParams['color'] = self::$MORE_SETTINGS['flexwin_color']; // optional - The basic color theme of FlexWin. There is currently a choice of "sand", "grey" and "blue". The default value is "blue". $dibsParams['cancelurl'] = self::$CANCELLED_URL; // optional - The URL of the page to be displayed if the customer cancels the payment. $dibsParams['uniqueoid'] = (int)($params['cart']->id).'_'.date('YmdHis').'_'.$params['cart']->secure_key; // optional - If this field exists, the orderid-field must be unique, i.e. there is no existing transaction with DIBS with the same order number. If such a transaction already exists, payment will be rejected with reason=7. Unless you are unable to generate unique order numbers, we strongly urge you to utilize this field.Note: Order numbers can be composed of a maximum of 50 characters (DIBS automatically removes surplus characters) and that uniqueoid is therefore unable to work as intended if order numbers consisting of more than 50 characters are used. $dibsParams['callbackurl'] = self::$site_url.'modules/'.$this->name.'/validation.php'; // optional - An optional �server-to-server� call which tells the shop�s server that payment was a success. Can be used for many purposes, the most important of these being the ability to register the order in your own system without depending on the customer�s browser hitting a specific page of the shop. See also HTTP_COOKIE. $md5_params = 'merchant='.self::$ID_MERCHANT.'&orderid='.$dibsParams['orderid'].'¤cy='.$dibsParams['currency'].'&amount='.$dibsParams['amount']; - $dibsParams['md5key'] = md5(self::$MORE_SETTINGS['k2'].md5(self::$MORE_SETTINGS['k1'].$md5_params)); // optional - This variable enables a MD5 key control of the values received by DIBS. This control confirms that the values sent to DIBS has not been tampered with during the transfer. The MD5 key is calculated as: MD5(key2 + MD5(key1 + "merchant=&orderid=&transact=")) Where key1 and key2 are shop specific keys available through the DIBS administration interface, and + is the concatenation operator. NB! MD5 key check must also be enabled through the DIBS administration interface in order to work. Further details on MD5-key control. + $dibsParams['md5key'] = md5(self::$MORE_SETTINGS['k2'].md5(self::$MORE_SETTINGS['k1'].$md5_params)); // optional - This variable enables a MD5 key control of the values received by DIBS. This control confirms that the values sent to DIBS has not been tampered with during the transfer. The MD5 key is calculated as: MD5(key2 + MD5(key1 + "merchant=&orderid=&transact=")) Where key1 and key2 are shop specific keys available through the DIBS administration interface, and + is the concatenation operator. NB! MD5 key check must also be enabled through the DIBS administration interface in order to work. Further details on MD5-key control. // @todo need more infos. $dibsParams['account'] = ''; // optional - If multiple departments utilize the company's acquirer agreement with PBS, it may prove practical to keep the transactions separate at DIBS. An "account number" may be inserted in this field, so as to separate transactions at DIBS. @@ -346,12 +346,12 @@ class dibs extends PaymentModule $dibsParams['capturenow'] = ''; // optional - If this field exists, an "instant capture" is carried out, i.e. the amount is immediately transferred from the customer's account to the shop's account. This function can only be utilized in the event that there is no actual physical delivery of any items. Contact DIBS when using this function. (Note that instant capture requires unique order numbers - also see the description of uniqueoid above). $dibsParams['ip'] = ''; // optional - DIBS retains the IP-number from which a card transaction is carried out. The IP-number is used for �fraud control�, etc. Some implementations may send the IP number of the shop to DIBS rather than that of the customer's machine. In order to provide the same services to shops which utilize such a program for their DIBS hookup, we offer the option of sending the "ip" parameter. $dibsParams['paytype'] = ''; // optional - Regarding the start-up of the DIBS FlexWin, the user can be limited to the use of just one particular payment form. This is accomplished by using the parameter "paytype". This function can be used if you wish for example to use integration method 3 for payment cards and method 1 for eDankort. Furthermore, this function can be used if you wish to control the user's selections of method of payment from your own website. You can also specify a list of payment methods that will be shown in the Flexwin. This list should be a comma separated with no spaces in between. Example: See our list of possible paytypes. - $dibsParams['maketicket'] = ''; // optional - This parameter is intended for FlexWin, and actually performs two transactions. First it performs a regular authorisation. If, and only if, it is accepted, it is followed by a ticket registration. Both a transaction and a ticket value are returned to "accepturl" if it is specified. If "callbackurl" is specified, DIBS will perform two separate calls, corresponding to performing two transactions - one call to the regular authorisation, and another to the ticket registration. Both cases return a "transact" parameter value (e.g. transact="78901234"). In calls to "callbackurl" containing "preauth", the ticket value is composed of the "transact" parameter value. "maketicket" implicitly sets the "preauth" parameter - however, you should avoid to explicitly specify any "preauth" parameter. You cannot use "uniqueoid", "capturenow" or "md5key" along with "maketicket". Currently "maketicket" does not work with 3Dsecure. + $dibsParams['maketicket'] = ''; // optional - This parameter is intended for FlexWin, and actually performs two transactions. First it performs a regular authorisation. If, and only if, it is accepted, it is followed by a ticket registration. Both a transaction and a ticket value are returned to "accepturl" if it is specified. If "callbackurl" is specified, DIBS will perform two separate calls, corresponding to performing two transactions - one call to the regular authorisation, and another to the ticket registration. Both cases return a "transact" parameter value (e.g. transact="78901234"). In calls to "callbackurl" containing "preauth", the ticket value is composed of the "transact" parameter value. "maketicket" implicitly sets the "preauth" parameter - however, you should avoid to explicitly specify any "preauth" parameter. You cannot use "uniqueoid", "capturenow" or "md5key" along with "maketicket". Currently "maketicket" does not work with 3Dsecure. $dibsParams['postype'] = ''; // optional - "postype" (one 't') is used when one wishes to register the transaction origin. For normal internet transaction it is not required to include "postype", as it is automatically set to SSL. Possible values are: ssl = internet transactions, magnetic = magnetic stripe read, and signature is available, magnosig = magnetic stripe read, and no signature is available, mail = mail order, manual = manually entered, phone = phone order, signature = card and signature available, manually entered. $dibsParams['ticketrule'] = ''; // optional - Set the value of this parameter to the same as defined by you in DIBS Admin. $dibsParams['preauth'] = ''; // optional - When preauth=true is sent as part of the request to auth.cgi the DIBS server identifies the authorisation as a ticket authorisation rather than a normal transaction. Please note that the pre-authorised transaction is NOT available among the transactions in the DIBS administration interface. When using MD5 the Authkey must be calculated from the string transact=12345678&preauth=true¤cy=123 - // @todo Since Prestashop manage vouchers, ask if necessary to use this params + // @todo Since Prestashop manage vouchers, ask if necessary to use this params $dibsParams['voucher'] = ''; // optional - If set to "yes", then the list of payment types on the first page of FlexWin will contain vouchers, too. If FlexWin is called with a paytype, which would lead directly to the payment form, the customer is given the choice of entering a voucher code first. $dibsParams['split'] = ''; // optional - "split" is used for splitting up a transaction into two or more sub-transactions. This enables part of an order to be paid for when shipped in part. It requires that the amount and currency of the part payments are known at the time of the order, and are posted to the DIBS server as: split=2&amount1=&amount2= @@ -404,9 +404,9 @@ class dibs extends PaymentModule $this->context->smarty->assign('logo_color', self::$MORE_SETTINGS['logo_color']); return $this->display(__FILE__, 'dibs.tpl'); } - + /** - * Set the detail of a payment to prepare the validate order + * Set the detail of a payment - Call after un validateOrder * See Authorize documentation to know the associated key => value * @param array fields * @return bool success state @@ -417,18 +417,17 @@ class dibs extends PaymentModule if (isset($this->pcc)) { $this->pcc->transaction_id = (string)$response['transact']; - + // 50 => Card number (XXXX0000) $this->pcc->card_number = (string)substr($response['cardnomask'], -4); - + // 51 => Card Mark (Visa, Master card) $this->pcc->card_brand = (string)$response['paytype']; - + $this->pcc->card_expiration = '0000'; - + // 68 => Owner name $this->pcc->card_holder = ''; } - } -} +} \ No newline at end of file diff --git a/modules/dibs/validation.php b/modules/dibs/validation.php index 2ddda5379..a8f3f406e 100644 --- a/modules/dibs/validation.php +++ b/modules/dibs/validation.php @@ -1,5 +1,5 @@ <?php - + include(dirname(__FILE__). '/../../config/config.inc.php'); include(dirname(__FILE__).'/dibs.php'); @@ -19,7 +19,7 @@ if (count($_POST)) $secure_cart = explode('_', $posted_values['uniqueoid']); $arr_order_id = explode('_',$posted_values['orderid']); $posted_values['orderid'] = $arr_order_id[0]; - + if ((string)$posted_values['merchant'] !== (string)dibs::$ID_MERCHANT) $errors[] = Tools::displayError('You did not use the correct merchant ID.'); @@ -42,11 +42,10 @@ if (count($_POST)) $message = nl2br(strip_tags($message)); if ($valid_order === true) { - $obj_dibs->setTransactionDetail($posted_values); - $obj_dibs->validateOrder((int)$posted_values['orderid'], Configuration::get('PS_OS_PAYMENT'), + $obj_dibs->setTransactionDetail($posted_values); + $obj_dibs->validateOrder((int)$posted_values['orderid'], Configuration::get('PS_OS_PAYMENT'), (float)((int)$posted_values['amount'] / 100), $obj_dibs->displayName, $message, array(), NULL, false, $secure_cart[2]); } else if ($valid_order === false) - $obj_dibs->validateOrder((int)$posted_values['orderid'], Configuration::get('PS_OS_ERROR'), 0, $obj_dibs->displayName, - $message, array(), NULL, false, $secure_cart[2]); -} \ No newline at end of file + $obj_dibs->validateOrder((int)$posted_values['orderid'], Configuration::get('PS_OS_ERROR'), 0, $obj_dibs->displayName, $message, array(), NULL, false, $secure_cart[2]); +} diff --git a/modules/ebay/config.xml b/modules/ebay/config.xml index d6c4bfd6e..6dc9dfc3c 100755 --- a/modules/ebay/config.xml +++ b/modules/ebay/config.xml @@ -2,7 +2,7 @@ <module> <name>ebay</name> <displayName><![CDATA[eBay]]></displayName> - <version><![CDATA[1.3.1]]></version> + <version><![CDATA[1.3.5]]></version> <description><![CDATA[Open your shop on the eBay market place !]]></description> <author><![CDATA[PrestaShop]]></author> <tab><![CDATA[market_place]]></tab> diff --git a/modules/ebay/eBayRequest.php b/modules/ebay/eBayRequest.php index 4828dd5e5..ffa9bd3ed 100755 --- a/modules/ebay/eBayRequest.php +++ b/modules/ebay/eBayRequest.php @@ -1140,7 +1140,9 @@ class eBayRequest else $reference = $skuItem; } - + $reference = trim($reference); + if (!empty($reference)) + { $id_product = Db::getInstance()->getValue(' SELECT `id_product` FROM `'._DB_PREFIX_.'product` WHERE `reference` = \''.pSQL($reference).'\''); @@ -1156,6 +1158,7 @@ class eBayRequest } } } + } $orderList[] = array( 'id_order_ref' => (string)$order->OrderID, diff --git a/modules/ebay/ebay.php b/modules/ebay/ebay.php index 154869f75..40b970606 100755 --- a/modules/ebay/ebay.php +++ b/modules/ebay/ebay.php @@ -59,7 +59,7 @@ class Ebay extends Module { $this->name = 'ebay'; $this->tab = 'market_place'; - $this->version = '1.3.1'; + $this->version = '1.3.5'; $this->author = 'PrestaShop'; parent::__construct (); $this->displayName = $this->l('eBay'); @@ -93,12 +93,17 @@ class Ebay extends Module if (!Configuration::get('EBAY_SECURITY_TOKEN')) Configuration::updateValue('EBAY_SECURITY_TOKEN', Tools::passwdGen(30)); - /* For 1.4.3 and less compatibility */ - $updateConfig = array('PS_OS_CHEQUE', 'PS_OS_PAYMENT', 'PS_OS_PREPARATION', 'PS_OS_SHIPPING', 'PS_OS_CANCELED', 'PS_OS_REFUND', 'PS_OS_ERROR', 'PS_OS_OUTOFSTOCK', 'PS_OS_BANKWIRE', 'PS_OS_PAYPAL', 'PS_OS_WS_PAYMENT'); - if (!Configuration::get('PS_OS_PAYMENT')) - foreach ($updateConfig as $u) - if (!Configuration::get($u) && defined('_'.$u.'_')) + // For 1.4.3 and less compatibility + $updateConfig = array('PS_OS_CHEQUE' => 1, 'PS_OS_PAYMENT' => 2, 'PS_OS_PREPARATION' => 3, 'PS_OS_SHIPPING' => 4, 'PS_OS_DELIVERED' => 5, 'PS_OS_CANCELED' => 6, + 'PS_OS_REFUND' => 7, 'PS_OS_ERROR' => 8, 'PS_OS_OUTOFSTOCK' => 9, 'PS_OS_BANKWIRE' => 10, 'PS_OS_PAYPAL' => 11, 'PS_OS_WS_PAYMENT' => 12); + foreach ($updateConfig as $u => $v) + if (!Configuration::get($u) || (int)Configuration::get($u) < 1) + { + if (defined('_'.$u.'_') && (int)constant('_'.$u.'_') > 0) Configuration::updateValue($u, constant('_'.$u.'_')); + else + Configuration::updateValue($u, $v); + } // Check if installed if (self::isInstalled($this->name)) @@ -326,6 +331,9 @@ class Ebay extends Module if (!Configuration::get('EBAY_PAYPAL_EMAIL')) return false; + // Fix hook update product attribute + $this->hookupdateProductAttributeEbay(); + // If no update yet if (!Configuration::get('EBAY_ORDER_LAST_UPDATE')) Configuration::updateValue('EBAY_ORDER_LAST_UPDATE', date('Y-m-d').'T'.date('H:i:s').'.000Z'); @@ -361,8 +369,6 @@ class Ebay extends Module { if (!Db::getInstance()->getValue('SELECT `id_ebay_order` FROM `'._DB_PREFIX_.'ebay_order` WHERE `id_order_ref` = \''.pSQL($order['id_order_ref']).'\'')) { - $id_customer = (int)Db::getInstance()->getValue('SELECT `id_customer` FROM `'._DB_PREFIX_.'customer` WHERE `active` = 1 AND `email` = \''.pSQL($order['email']).'\' AND `deleted` = 0'.(substr(_PS_VERSION_, 0, 3) == '1.3' ? '' : ' AND `is_guest` = 0')); - // Check for empty name $order['firstname'] = trim($order['firstname']); $order['familyname'] = trim($order['familyname']); @@ -375,6 +381,9 @@ class Ebay extends Module if (Validate::isEmail($order['email']) && !empty($order['firstname']) && !empty($order['familyname'])) { + // Getting the customer + $id_customer = (int)Db::getInstance()->getValue('SELECT `id_customer` FROM `'._DB_PREFIX_.'customer` WHERE `active` = 1 AND `email` = \''.pSQL($order['email']).'\' AND `deleted` = 0'.(substr(_PS_VERSION_, 0, 3) == '1.3' ? '' : ' AND `is_guest` = 0')); + // Add customer if he doesn't exist if ($id_customer < 1) { @@ -434,7 +443,7 @@ class Ebay extends Module $cartAdd->id_customer = $id_customer; $cartAdd->id_address_invoice = $id_address; $cartAdd->id_address_delivery = $id_address; - $cartAdd->id_carrier = 1; + $cartAdd->id_carrier = 0; $cartAdd->id_lang = $this->id_lang; $cartAdd->id_currency = Currency::getIdByIsoCode('EUR'); $cartAdd->recyclable = 0; @@ -446,7 +455,7 @@ class Ebay extends Module $cartAdd->update(); // Check number of products in the cart - if ($cartNbProducts > 0) + if ($cartNbProducts > 0 && !Db::getInstance()->getValue('SELECT `id_ebay_order` FROM `'._DB_PREFIX_.'ebay_order` WHERE `id_order_ref` = \''.pSQL($order['id_order_ref']).'\'')) { // Fix on sending e-mail Db::getInstance()->autoExecute(_DB_PREFIX_.'customer', array('email' => 'NOSEND-EBAY'), 'UPDATE', '`id_customer` = '.(int)$id_customer); @@ -466,16 +475,19 @@ class Ebay extends Module Db::getInstance()->autoExecute(_DB_PREFIX_.'customer', array('email' => pSQL($order['email'])), 'UPDATE', '`id_customer` = '.(int)$id_customer); // Update price (because of possibility of price impact) + foreach ($order['product_list'] as $product) + { + $tax_rate = Db::getInstance()->getValue('SELECT `tax_rate` FROM `'._DB_PREFIX_.'order_detail` WHERE `id_order` = '.(int)$id_order.' AND `product_id` = '.(int)$product['id_product'].' AND `product_attribute_id` = '.(int)$product['id_product_attribute']); + Db::getInstance()->autoExecute(_DB_PREFIX_.'order_detail', array('product_price' => floatval($product['price'] / (1 + ($tax_rate / 100))), 'reduction_percent' => 0), 'UPDATE', '`id_order` = '.(int)$id_order.' AND `product_id` = '.(int)$product['id_product'].' AND `product_attribute_id` = '.(int)$product['id_product_attribute']); + } $updateOrder = array( 'total_paid' => floatval($order['amount']), 'total_paid_real' => floatval($order['amount']), - 'total_products' => floatval($order['amount']), - 'total_products_wt' => floatval($order['amount']), + 'total_products' => floatval(Db::getInstance()->getValue('SELECT SUM(`product_price`) FROM `'._DB_PREFIX_.'order_detail` WHERE `id_order` = '.(int)$id_order)), + 'total_products_wt' => floatval($order['amount'] - $order['shippingServiceCost']), 'total_shipping' => floatval($order['shippingServiceCost']), ); Db::getInstance()->autoExecute(_DB_PREFIX_.'orders', $updateOrder, 'UPDATE', '`id_order` = '.(int)$id_order); - foreach ($order['product_list'] as $product) - Db::getInstance()->autoExecute(_DB_PREFIX_.'order_detail', array('product_price' => floatval($product['price']), 'tax_rate' => 0, 'reduction_percent' => 0), 'UPDATE', '`id_order` = '.(int)$id_order.' AND `product_id` = '.(int)$product['id_product'].' AND `product_attribute_id` = '.(int)$product['id_product_attribute']); // Register the ebay order ref Db::getInstance()->autoExecute(_DB_PREFIX_.'ebay_order', array('id_order_ref' => pSQL($order['id_order_ref']), 'id_order' => (int)$id_order), 'INSERT'); @@ -511,11 +523,20 @@ class Ebay extends Module // Alias public function hookupdateproduct($params) { $this->hookaddproduct($params); } - public function hookupdateProductAttribute($params) + public function hookupdateProductAttribute($params) { } + public function hookupdateProductAttributeEbay() { + if (isset($_POST['submitProductAttribute']) && isset($_POST['id_product_attribute'])) + { + $params = array(); + $params['id_product_attribute'] = (int)$_POST['id_product_attribute']; + if ($params['id_product_attribute'] > 0) + { $id_product = Db::getInstance()->getValue('SELECT `id_product` FROM `'._DB_PREFIX_.'product_attribute` WHERE `id_product_attribute` = '.(int)$params['id_product_attribute']); $params['product'] = new Product($id_product); $this->hookaddproduct($params); + } + } } public function hookdeleteproduct($params) { $this->hookaddproduct($params); } public function hookheader($params) { $this->hookbackOfficeTop($params); } @@ -1633,6 +1654,31 @@ class Ebay extends Module 'picturesLarge' => $picturesLarge, ); + // Fix hook update product + if (isset($this->context->employee) && $this->context->employee->id > 0 && isset($_POST['submitProductAttribute']) && isset($_POST['id_product_attribute']) && isset($_POST['attribute_mvt_quantity']) && isset($_POST['id_mvt_reason'])) + { + if (substr(_PS_VERSION_, 0, 3) == '1.3') + { + $id_product_attribute_fix = (int)$_POST['id_product_attribute']; + $quantity_fix = (int)$_POST['attribute_quantity']; + if ($id_product_attribute_fix > 0 && $quantity_fix > 0 && isset($datas['variations'][$product->id.'-'.$id_product_attribute_fix]['quantity'])) + $datas['variations'][$product->id.'-'.$id_product_attribute_fix]['quantity'] = (int)$quantity_fix; + } + else + { + $action = Db::getInstance()->getValue('SELECT `sign` FROM `'._DB_PREFIX_.'stock_mvt_reason` WHERE `id_stock_mvt_reason` = '.(int)$_POST['id_mvt_reason']); + $id_product_attribute_fix = (int)$_POST['id_product_attribute']; + $quantity_fix = (int)$_POST['attribute_mvt_quantity']; + if ($id_product_attribute_fix > 0 && $quantity_fix > 0 && isset($datas['variations'][$product->id.'-'.$id_product_attribute_fix]['quantity'])) + { + if ($action > 0) + $datas['variations'][$product->id.'-'.$id_product_attribute_fix]['quantity'] += (int)$quantity_fix; + if ($action < 0) + $datas['variations'][$product->id.'-'.$id_product_attribute_fix]['quantity'] -= (int)$quantity_fix; + } + } + } + // Price Update if (isset($p['noPriceUpdate'])) $datas['noPriceUpdate'] = $p['noPriceUpdate']; @@ -1646,9 +1692,14 @@ class Ebay extends Module // Load eBay Description + $features = $product->getFrontFeatures((int)($this->id_lang)); + $featuresHtml = ''; + if (isset($features)) + foreach ($features as $f) + $featuresHtml .= '<b>'.$f['name'].'</b> : '.$f['value'].'<br/>'; $datas['description'] = str_replace( - array('{DESCRIPTION_SHORT}', '{DESCRIPTION}', '{EBAY_IDENTIFIER}', '{EBAY_SHOP}', '{SLOGAN}', '{PRODUCT_NAME}'), - array($datas['description_short'], $datas['description'], Configuration::get('EBAY_IDENTIFIER'), Configuration::get('EBAY_SHOP'), '', $product->name), + array('{DESCRIPTION_SHORT}', '{DESCRIPTION}', '{FEATURES}', '{EBAY_IDENTIFIER}', '{EBAY_SHOP}', '{SLOGAN}', '{PRODUCT_NAME}'), + array($datas['description_short'], $datas['description'], $featuresHtml, Configuration::get('EBAY_IDENTIFIER'), Configuration::get('EBAY_SHOP'), '', $product->name), Configuration::get('EBAY_PRODUCT_TEMPLATE') ); diff --git a/modules/ekomi/config.xml b/modules/ekomi/config.xml index d644e95b9..20408792a 100644 --- a/modules/ekomi/config.xml +++ b/modules/ekomi/config.xml @@ -2,9 +2,9 @@ <module> <name>ekomi</name> <displayName><![CDATA[eKomi]]></displayName> - <version><![CDATA[1.1]]></version> + <version><![CDATA[1.2]]></version> <description><![CDATA[Adds an eKomi block]]></description> - <author><![CDATA[]]></author> + <author><![CDATA[PrestaShop]]></author> <tab><![CDATA[advertising_marketing]]></tab> <is_configurable>1</is_configurable> <need_instance>0</need_instance> diff --git a/modules/ekomi/ekomi.php b/modules/ekomi/ekomi.php index d410c863d..6678042d0 100755 --- a/modules/ekomi/ekomi.php +++ b/modules/ekomi/ekomi.php @@ -33,17 +33,31 @@ class Ekomi extends Module private $_html = ''; private $_postErrors = array(); + public $id_lang; + public $iso_lang; + function __construct() { $this->name = 'ekomi'; $this->tab = 'advertising_marketing'; - $this->version = 1.1; + $this->author = 'PrestaShop'; + $this->version = 1.2; $this->need_instance = 0; parent::__construct(); $this->displayName = $this->l('eKomi'); $this->description = $this->l('Adds an eKomi block'); + + if (self::isInstalled($this->name)) + { + $this->id_lang = (int)Configuration::get('PS_LANG_DEFAULT'); + $this->iso_lang = pSQL(Language::getIsoById($this->id_lang)); + + /* Check Mail Directory */ + if (!file_exists(dirname(__FILE__.'/'.$this->iso_lang.'/'))) + $this->warning .= $this->l('directory').' "'.$this->iso_lang.'" does not exist '; + } } public function install() @@ -115,6 +129,10 @@ class Ekomi extends Module if (!Configuration::get('PS_EKOMI_EMAIL')) return true; + /* Check Mail Directory */ + if (!file_exists(dirname(__FILE__.'/'.$this->iso_lang.'/'))) + return true; + /* Email generation */ $subject = '[Ekomi-Prestashop] '.Configuration::get('PS_SHOP_NAME'); $templateVars = array( @@ -125,8 +143,9 @@ class Ekomi extends Module ); /* Email sending */ - if (!Mail::Send(1, 'ekomi', $subject, $templateVars, Configuration::get('PS_EKOMI_EMAIL'), NULL, $params['customer']->email, Configuration::get('PS_SHOP_NAME'), NULL, NULL, dirname(__FILE__).'/mails/')) + if (!Mail::Send((int)$this->id_lang, 'ekomi', $subject, $templateVars, Configuration::get('PS_EKOMI_EMAIL'), NULL, $params['customer']->email, Configuration::get('PS_SHOP_NAME'), NULL, NULL, dirname(__FILE__).'/mails/')) return true; + return true; } } diff --git a/modules/ekomi/fr.php b/modules/ekomi/fr.php index 01a3fe1d0..1e1c97b59 100644 --- a/modules/ekomi/fr.php +++ b/modules/ekomi/fr.php @@ -4,6 +4,7 @@ global $_MODULE; $_MODULE = array(); $_MODULE['<{ekomi}prestashop>ekomi_c0858307dfd3d91768c79ec116820b60'] = 'eKomi'; $_MODULE['<{ekomi}prestashop>ekomi_d245187b3591f5f6f723ece2217bb637'] = 'Ajouter un bloc eKomi'; +$_MODULE['<{ekomi}prestashop>ekomi_5f8f22b8cdbaeee8cf857673a9b6ba20'] = 'répertoire'; $_MODULE['<{ekomi}prestashop>ekomi_f4d1ea475eaa85102e2b4e6d95da84bd'] = 'Confirmation'; $_MODULE['<{ekomi}prestashop>ekomi_c888438d14855d7d96a2724ee9c306bd'] = 'Configuration mise à jour'; $_MODULE['<{ekomi}prestashop>ekomi_f4f70727dc34561dfde1a3c529b6205c'] = 'Configuration'; diff --git a/modules/envoimoinscher/AdminEnvoiMoinsCher.php b/modules/envoimoinscher/AdminEnvoiMoinsCher.php index fced78888..f1327ea1d 100755 --- a/modules/envoimoinscher/AdminEnvoiMoinsCher.php +++ b/modules/envoimoinscher/AdminEnvoiMoinsCher.php @@ -112,6 +112,7 @@ class AdminEnvoiMoinsCher extends AdminTab private function displayOrders($orders) { + $emc = new Envoimoinscher(); echo '<table cellspacing="0" cellpadding="0" class="table" align="center" style="margin:10px 0px 0px 25px;"> <tr> <th><input type="checkbox" name="checkme" class="noborder" onclick="checkDelBoxes(this.form, \'ordersBox[]\', this.checked)" /></th> diff --git a/modules/fedexcarrier/config.xml b/modules/fedexcarrier/config.xml index 96a8bb917..1a7aaa65a 100755 --- a/modules/fedexcarrier/config.xml +++ b/modules/fedexcarrier/config.xml @@ -2,7 +2,7 @@ <module> <name>fedexcarrier</name> <displayName><![CDATA[Fedex Carrier]]></displayName> - <version><![CDATA[1.2.4]]></version> + <version><![CDATA[1.2.5]]></version> <description><![CDATA[Offer your customers, different delivery methods with Fedex]]></description> <author><![CDATA[PrestaShop]]></author> <tab><![CDATA[shipping_logistics]]></tab> diff --git a/modules/fedexcarrier/fedexcarrier.php b/modules/fedexcarrier/fedexcarrier.php index 49295c9f0..02bde5684 100644 --- a/modules/fedexcarrier/fedexcarrier.php +++ b/modules/fedexcarrier/fedexcarrier.php @@ -56,7 +56,7 @@ class FedexCarrier extends CarrierModule { $this->name = 'fedexcarrier'; $this->tab = 'shipping_logistics'; - $this->version = '1.2.4'; + $this->version = '1.2.5'; $this->author = 'PrestaShop'; $this->limited_countries = array('us'); @@ -349,6 +349,10 @@ class FedexCarrier extends CarrierModule $alert['webserviceTest'] = 1; if (!extension_loaded('soap')) $alert['soap'] = 1; + if (!ini_get('allow_url_fopen')) + $alert['url_fopen'] = 1; + if (!extension_loaded('openssl')) + $alert['openssl'] = 1; if (!count($alert)) @@ -360,6 +364,8 @@ class FedexCarrier extends CarrierModule $this->_html .= '<br />'.(isset($alert['deliveryServices']) ? '<img src="'._PS_IMG_.'admin/warn2.png" />' : '<img src="'._PS_IMG_.'admin/module_install.png" />').' 2) '.$this->l('Select your available delivery service'); $this->_html .= '<br />'.(isset($alert['webserviceTest']) ? '<img src="'._PS_IMG_.'admin/warn2.png" />' : '<img src="'._PS_IMG_.'admin/module_install.png" />').' 3) '.$this->l('Webservice test connection').($this->_webserviceError ? ' : '.$this->_webserviceError : ''); $this->_html .= '<br />'.(isset($alert['soap']) ? '<img src="'._PS_IMG_.'admin/warn2.png" />' : '<img src="'._PS_IMG_.'admin/module_install.png" />').' 4) '.$this->l('Soap is enabled'); + $this->_html .= '<br />'.(isset($alert['url_fopen']) ? '<img src="'._PS_IMG_.'admin/warn2.png" />' : '<img src="'._PS_IMG_.'admin/module_install.png" />').' 5) '.$this->l('Url fopen is enabled'); + $this->_html .= '<br />'.(isset($alert['openssl']) ? '<img src="'._PS_IMG_.'admin/warn2.png" />' : '<img src="'._PS_IMG_.'admin/module_install.png" />').' 6) '.$this->l('OpenSSL is enabled'); } diff --git a/modules/gsitemap/config.xml b/modules/gsitemap/config.xml index 4e9c57055..33f7a8401 100755 --- a/modules/gsitemap/config.xml +++ b/modules/gsitemap/config.xml @@ -2,7 +2,7 @@ <module> <name>gsitemap</name> <displayName><![CDATA[Google sitemap]]></displayName> - <version><![CDATA[1.7]]></version> + <version><![CDATA[1.8]]></version> <description><![CDATA[Generate your Google sitemap file]]></description> <author><![CDATA[PrestaShop]]></author> <tab><![CDATA[seo]]></tab> diff --git a/modules/gsitemap/gsitemap.php b/modules/gsitemap/gsitemap.php index 5a05d4172..48a33d4e9 100644 --- a/modules/gsitemap/gsitemap.php +++ b/modules/gsitemap/gsitemap.php @@ -156,73 +156,13 @@ XML; $xml = new SimpleXMLElement($xmlString); - if (Configuration::get('PS_REWRITING_SETTINGS') AND sizeof($langs) > 1) + if (Configuration::get('PS_REWRITING_SETTINGS') && count($langs) > 1) foreach($langs as $lang) $this->_addSitemapNode($xml, Tools::getShopDomain(true, true).__PS_BASE_URI__.$lang['iso_code'].'/', '1.00', 'daily', date('Y-m-d')); else $this->_addSitemapNode($xml, Tools::getShopDomain(true, true).__PS_BASE_URI__, '1.00', 'daily', date('Y-m-d')); - /* CMS Generator */ - if (Configuration::get('GSITEMAP_ALL_CMS') OR !Module::isInstalled('blockcms')) - $sql = 'SELECT DISTINCT '.(Configuration::get('PS_REWRITING_SETTINGS') ? 'cl.id_cms, cl.link_rewrite, cl.id_lang' : 'cl.id_cms').' - FROM '._DB_PREFIX_.'cms_lang cl - LEFT JOIN '._DB_PREFIX_.'lang l ON (cl.id_lang = l.id_lang) - LEFT JOIN '._DB_PREFIX_.'cms_shop cs ON cs.id_cms = cl.id_cms - WHERE l.`active` = 1 - AND cs.id_shop = '.$shopID.' - ORDER BY cl.id_cms, cl.id_lang ASC'; - else if (Module::isInstalled('blockcms')) - $sql = 'SELECT DISTINCT '.(Configuration::get('PS_REWRITING_SETTINGS') ? 'cl.id_cms, cl.link_rewrite, cl.id_lang' : 'cl.id_cms').' - FROM '._DB_PREFIX_.'cms_block_page b - LEFT JOIN '._DB_PREFIX_.'cms_lang cl ON (b.id_cms = cl.id_cms) - LEFT JOIN '._DB_PREFIX_.'lang l ON (cl.id_lang = l.id_lang) - LEFT JOIN '._DB_PREFIX_.'cms_shop cs ON cs.id_cms = cl.id_cms - WHERE l.`active` = 1 - AND cs.id_shop = '.$shopID.' - ORDER BY cl.id_cms, cl.id_lang ASC'; - - $cmss = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql); - foreach ($cmss AS $cms) - { - $tmpLink = Configuration::get('PS_REWRITING_SETTINGS') ? $this->context->link->getCMSLink((int)$cms['id_cms'], $cms['link_rewrite'], false, (int)$cms['id_lang']) : $this->context->link->getCMSLink((int)$cms['id_cms']); - $this->_addSitemapNode($xml, $tmpLink, '0.8', 'daily'); - } - - /* Categories Generator */ - $limits = Category::getInterval($shop->getCategory()); - if (Configuration::get('PS_REWRITING_SETTINGS')) - { - $sql = 'SELECT c.id_category, c.level_depth, link_rewrite, DATE_FORMAT(IF(date_upd,date_upd,date_add), \'%Y-%m-%d\') AS date_upd, cl.id_lang - FROM '._DB_PREFIX_.'category c - LEFT JOIN '._DB_PREFIX_.'category_lang cl ON c.id_category = cl.id_category AND cl.id_shop = '.$shopID.' - LEFT JOIN '._DB_PREFIX_.'lang l ON cl.id_lang = l.id_lang - WHERE l.`active` = 1 - AND c.`active` = 1 - AND c.id_category != 1 - AND nleft >= '.$limits['nleft'].' - AND nright <= '.$limits['nright'].' - ORDER BY cl.id_category, cl.id_lang ASC'; - $categories = Db::getInstance()->executeS($sql); - } - else - { - $sql = 'SELECT c.id_category, c.level_depth, DATE_FORMAT(IF(date_upd,date_upd,date_add), \'%Y-%m-%d\') AS date_upd - FROM '._DB_PREFIX_.'category c - WHERE nleft >= '.$limits['nleft'].' - AND nright <= '.$limits['nright'].' - ORDER BY c.id_category ASC'; - $categories = Db::getInstance()->executeS($sql); - } - - foreach($categories as $category) - { - if (($priority = 0.9 - ($category['level_depth'] / 10)) < 0.1) - $priority = 0.1; - - $tmpLink = Configuration::get('PS_REWRITING_SETTINGS') ? $this->context->link->getCategoryLink((int)$category['id_category'], $category['link_rewrite'], (int)$category['id_lang']) : $this->context->link->getCategoryLink((int)$category['id_category']); - $this->_addSitemapNode($xml, $tmpLink, $priority, 'weekly', substr($category['date_upd'], 0, 10)); - } - + /* Product Generator */ $sql = 'SELECT p.id_product, pl.link_rewrite, DATE_FORMAT(IF(date_upd,date_upd,date_add), \'%Y-%m-%d\') date_upd, pl.id_lang, cl.`link_rewrite` category, ean13, i.id_image, il.legend legend_image, ( SELECT MIN(level_depth) FROM '._DB_PREFIX_.'product p2 @@ -245,7 +185,7 @@ XML; $tmp = null; $res = null; - foreach($products AS $product) + foreach ($products as $product) { if ($tmp == $product['id_product']) $res[$tmp]['images'] []= array('id_image' => $product['id_image'], 'legend_image' => $product['legend_image']); @@ -268,18 +208,65 @@ XML; $sitemap = $this->_addSitemapNodeImage($sitemap, $product); } + /* Categories Generator */ + if (Configuration::get('PS_REWRITING_SETTINGS')) + $categories = Db::getInstance()->ExecuteS(' + SELECT c.id_category, c.level_depth, link_rewrite, DATE_FORMAT(IF(date_upd,date_upd,date_add), \'%Y-%m-%d\') AS date_upd, cl.id_lang + FROM '._DB_PREFIX_.'category c + LEFT JOIN '._DB_PREFIX_.'category_lang cl ON c.id_category = cl.id_category + LEFT JOIN '._DB_PREFIX_.'lang l ON cl.id_lang = l.id_lang + WHERE l.`active` = 1 AND c.`active` = 1 AND c.id_category != 1 + ORDER BY cl.id_category, cl.id_lang ASC'); + else + $categories = Db::getInstance()->ExecuteS( + 'SELECT c.id_category, c.level_depth, DATE_FORMAT(IF(date_upd,date_upd,date_add), \'%Y-%m-%d\') AS date_upd + FROM '._DB_PREFIX_.'category c + ORDER BY c.id_category ASC'); + + + foreach($categories as $category) + { + if (($priority = 0.9 - ($category['level_depth'] / 10)) < 0.1) + $priority = 0.1; + + $tmpLink = Configuration::get('PS_REWRITING_SETTINGS') ? $link->getCategoryLink((int)$category['id_category'], $category['link_rewrite'], (int)$category['id_lang']) : $link->getCategoryLink((int)$category['id_category']); + $this->_addSitemapNode($xml, htmlspecialchars($tmpLink), $priority, 'weekly', substr($category['date_upd'], 0, 10)); + } + + /* CMS Generator */ + if (Configuration::get('GSITEMAP_ALL_CMS') || !Module::isInstalled('blockcms')) + $sql_cms = ' + SELECT DISTINCT '.(Configuration::get('PS_REWRITING_SETTINGS') ? 'cl.id_cms, cl.link_rewrite, cl.id_lang' : 'cl.id_cms'). + ' FROM '._DB_PREFIX_.'cms_lang cl + LEFT JOIN '._DB_PREFIX_.'lang l ON (cl.id_lang = l.id_lang) + WHERE l.`active` = 1 + ORDER BY cl.id_cms, cl.id_lang ASC'; + else if (Module::isInstalled('blockcms')) + $sql_cms = ' + SELECT DISTINCT '.(Configuration::get('PS_REWRITING_SETTINGS') ? 'cl.id_cms, cl.link_rewrite, cl.id_lang' : 'cl.id_cms'). + ' FROM '._DB_PREFIX_.'cms_block_page b + LEFT JOIN '._DB_PREFIX_.'cms_lang cl ON (b.id_cms = cl.id_cms) + LEFT JOIN '._DB_PREFIX_.'lang l ON (cl.id_lang = l.id_lang) + WHERE l.`active` = 1 + ORDER BY cl.id_cms, cl.id_lang ASC'; + + $cmss = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql_cms); + foreach($cmss as $cms) + { + $tmpLink = Configuration::get('PS_REWRITING_SETTINGS') ? $link->getCMSLink((int)$cms['id_cms'], $cms['link_rewrite'], false, (int)$cms['id_lang']) : $link->getCMSLink((int)$cms['id_cms']); + $this->_addSitemapNode($xml, $tmpLink, '0.8', 'daily'); + } + /* Add classic pages (contact, best sales, new products...) */ $pages = array( - 'authentication' => true, - 'best-sales' => false, - 'contact' => true, - 'discount' => false, - 'index' => false, + 'supplier' => false, 'manufacturer' => false, 'new-products' => false, 'prices-drop' => false, - 'supplier' => false, - 'store' => false); + 'stores' => false, + 'authentication' => true, + 'best-sales' => false, + 'contact-form' => true); // Don't show suppliers and manufacturers if they are disallowed if (!Module::getInstanceByName('blockmanufacturer')->id && !Configuration::get('PS_DISPLAY_SUPPLIERS')) @@ -290,11 +277,11 @@ XML; // Generate nodes for pages if(Configuration::get('PS_REWRITING_SETTINGS')) - foreach ($pages AS $page => $ssl) + foreach ($pages as $page => $ssl) foreach($langs as $lang) $this->_addSitemapNode($xml, $this->context->link->getPageLink($page, $ssl, $lang['id_lang']), '0.5', 'monthly'); else - foreach($pages AS $page => $ssl) + foreach($pages as $page => $ssl) $this->_addSitemapNode($xml, $this->context->link->getPageLink($page, $ssl), '0.5', 'monthly'); $xmlString = $xml->asXML(); @@ -344,14 +331,14 @@ XML; private function _displaySitemap() { - if (file_exists(GSITEMAP_FILE) AND filesize(GSITEMAP_FILE)) + if (file_exists(GSITEMAP_FILE) && filesize(GSITEMAP_FILE)) { $fp = fopen(GSITEMAP_FILE, 'r'); $fstat = fstat($fp); fclose($fp); $xml = simplexml_load_file(GSITEMAP_FILE); - $nbPages = sizeof($xml->url); + $nbPages = count($xml->url); $this->_html .= '<p>'.$this->l('Your Google sitemap file is online at the following address:').'<br /> <a href="'.Tools::getShopDomain(true, true).__PS_BASE_URI__.'sitemap.xml" target="_blank"><b>'.Tools::getShopDomain(true, true).__PS_BASE_URI__.'sitemap.xml</b></a></p><br />'; @@ -380,15 +367,15 @@ XML; public function getContent() { $this->_html .= '<h2>'.$this->l('Search Engine Optimization').'</h2> - '.$this->l('See').' <a href="https://www.google.com/webmasters/tools/docs/en/about.html" style="font-weight:bold;text-decoration:underline;" target="_blank"> + '.$this->l('See').' <a href="http://www.google.com/support/webmasters/bin/answer.py?hl=en&answer=156184&from=40318&rd=1" style="font-weight:bold;text-decoration:underline;" target="_blank"> '.$this->l('this page').'</a> '.$this->l('for more information').'<br /><br />'; if (Tools::isSubmit('btnSubmit')) { $this->_postValidation(); - if (!sizeof($this->_postErrors)) + if (!count($this->_postErrors)) $this->_postProcess(); else - foreach ($this->_postErrors AS $err) + foreach ($this->_postErrors as $err) $this->_html .= '<div class="alert error">'.$err.'</div>'; } diff --git a/modules/importerosc/ajax.php b/modules/importerosc/ajax.php new file mode 100644 index 000000000..3e6c316d1 --- /dev/null +++ b/modules/importerosc/ajax.php @@ -0,0 +1,17 @@ +<?php +include_once('../../config/config.inc.php'); +include_once('../../init.php'); +include_once('../../modules/importerosc/importerosc.php'); + + +if (!Tools::getValue('ajax') || Tools::getValue('token') != sha1(_COOKIE_KEY_.'importosc')) + die('INVALID TOKEN'); + +$importOsc = new importerosc(); +$importOsc->server = Tools::getValue('server'); +$importOsc->user = Tools::getValue('user'); +$importOsc->passwd = Tools::getValue('password'); +$importOsc->database = Tools::getValue('database'); +$importOsc->prefix = Tools::getValue('prefix'); + +die($importOsc->createLevelAndCalculate()); \ No newline at end of file diff --git a/modules/importerosc/fr.php b/modules/importerosc/fr.php index d3533b994..f90b865c8 100644 --- a/modules/importerosc/fr.php +++ b/modules/importerosc/fr.php @@ -20,3 +20,8 @@ $_MODULE['<{importerosc}prestashop>importerosc_14ae0ea02f571a833786d13d9ca6a897' $_MODULE['<{importerosc}prestashop>importerosc_e307db07b3975fef922a80d07455ee5e'] = 'Base de données'; $_MODULE['<{importerosc}prestashop>importerosc_dac130bdd2c5492a8108a4145bd9f04a'] = 'Préfixe base de données'; $_MODULE['<{importerosc}prestashop>importerosc_6bdc02625540b5264cffe801c37a82dd'] = '(Le préfixe est optionnel. Si toute votre base de données commence par \"pref_\", votre préfixe est \"pref_\")'; +$_MODULE['<{importerosc}prestashop>importerosc_4685343b5e2e0f0fbee63dddafde693f'] = 'Vous essayez d\'importer des catégories et nous avons détecté que votre base de données osCommerce n\'ont pas le champs \"niveau\" dans la table catégorie. Vous devez avoir ce champs pour continuer l\'importation de catégories.'; +$_MODULE['<{importerosc}prestashop>importerosc_16f35420186575c2a1d9c0b59edf6ad3'] = 'Cliquez ici pour ajouter et de calculer le champs niveau'; +$_MODULE['<{importerosc}prestashop>importerosc_fced104d747e0855ceff3020653104ab'] = 'Le champ \"niveau\" a été créé et calculé, vous pouvez continuer'; +$_MODULE['<{importerosc}prestashop>importerosc_b405d0bebeedbdc1773a44ac36b8ffc4'] = 'Il est fortement recommandé de sauvegarder votre base de données avant de continuer. Avez-vous fait une sauvegarde?'; +$_MODULE['<{importerosc}prestashop>importerosc_9f95fc55011203d91d50a0ed512f805f'] = 'Impossible de \"ALTER TABLE\"'; diff --git a/modules/importerosc/importerosc.php b/modules/importerosc/importerosc.php index e7e6b9ae1..d7da7f636 100644 --- a/modules/importerosc/importerosc.php +++ b/modules/importerosc/importerosc.php @@ -61,10 +61,14 @@ class importerosc extends ImportModule public function displaySpecificOptions() { + $html = ''; + if (!$this->checkCategoriesLevel()) + $html .= $this->displayCategoriesLevelConf(); + $langagues = $this->executeS('SELECT * FROM `'.bqSQL($this->prefix).'languages`'); $curencies = $this->executeS('SELECT * FROM `'.bqSQL($this->prefix).'currencies`'); - $html = '<label style=\'width:220px\'>'.$this->l('Default osCommerce language : ').'</label> + $html .= '<label style=\'width:220px\'>'.$this->l('Default osCommerce language : ').'</label> <div class="margin-form"> <select name=\'defaultOscLang\'><option value=\'0\'>------</option>'; foreach($langagues AS $lang) @@ -148,9 +152,10 @@ class importerosc extends ImportModule $identifier = 'id_country'; $defaultIdLang = $this->getDefaultIdLang(); $countries = $this->executeS(' - SELECT countries_id as id_country, countries_name as name, countries_iso_code_2 as iso_code, `'.bqSQL($defaultIdLang).'Ì€ as id_lang, + SELECT countries_id as id_country, countries_name as name, countries_iso_code_2 as iso_code, '.(int)$defaultIdLang.' as id_lang, 1 as id_zone, 0 as id_currency, 1 as contains_states, 1 as need_identification_number, 1 as active, 1 as display_tax_label FROM `'.bqSQL($this->prefix).'countries` as c LIMIT '.(int)($limit).' , '.(int)$nrb_import); + return $this->autoFormat($countries, $identifier, $keyLanguage, $multiLangFields); } @@ -219,19 +224,19 @@ class importerosc extends ImportModule $multiLangFields = array('name', 'link_rewrite'); $keyLanguage = 'id_lang'; $identifier = 'id_category'; - $categories = $this->executeS(' - SELECT c.categories_id as id_category, c.parent_id as id_parent, 0 as level_depth, cd.language_id as id_lang, cd.categories_name as name , 1 as active, categories_image as images + SELECT c.categories_id as id_category, c.parent_id as id_parent, level as level_depth, cd.language_id as id_lang, cd.categories_name as name , 1 as active, categories_image as images FROM `'.bqSQL($this->prefix).'categories` c LEFT JOIN `'.bqSQL($this->prefix).'categories_description` cd ON (c.categories_id = cd.categories_id) WHERE cd.categories_name IS NOT NULL AND cd.language_id IS NOT NULL - ORDER BY c.categories_id, cd.language_id + ORDER BY c.level ASC , c.`categories_id` LIMIT '.(int)($limit).' , '.(int)$nrb_import); foreach($categories as& $cat) { $cat['link_rewrite'] = Tools::link_rewrite($cat['name']); $cat['images'] = array(Tools::getProtocol().Tools::getValue('shop_url').'/images/'.$cat['images']); } + return $this->autoFormat($categories, $identifier, $keyLanguage, $multiLangFields); } @@ -256,6 +261,7 @@ class importerosc extends ImportModule SELECT p.`products_options_values_id` as id_attribute, p.`products_options_values_name` as name, p.`language_id` as id_lang , po.`products_options_id` as id_attribute_group FROM `'.bqSQL($this->prefix).'products_options_values` p LEFT JOIN `'.bqSQL($this->prefix).'products_options_values_to_products_options` po ON (po.products_options_values_id = p.products_options_values_id) + ORDER BY p.`products_options_values_id` LIMIT '.(int)($limit).' , '.(int)$nrb_import); return $this->autoFormat($countries, $identifier, $keyLanguage, $multiLangFields); } @@ -274,6 +280,7 @@ class importerosc extends ImportModule FROM `'.bqSQL($this->prefix).'products` p LEFT JOIN `'.bqSQL($this->prefix).'products_description` pd ON (p.products_id = pd.products_id) WHERE pd.products_name IS NOT NULL AND pd.language_id IS NOT NULL + ORDER BY p.`products_id` LIMIT '.(int)($limit).' , '.(int)$nrb_import); $this->Execute('CREATE TABLE IF NOT EXISTS`products_images` ( @@ -293,8 +300,8 @@ class importerosc extends ImportModule $images[] = Tools::getProtocol().Tools::getValue('shop_url').'/images/'.$res['image']; $product['images'] = array_merge(array($product['images']), $images); $product['link_rewrite'] = Tools::link_rewrite($product['name']); - - + + $result = $this->ExecuteS('SELECT `categories_id` FROM `'.bqSQL($this->prefix).'products_to_categories` WHERE products_id = '.(int)$product['id_product']); $category_product = array('category_product' => array($product['id_category_default'] => $product['id_product'])); foreach($result as $res) @@ -462,7 +469,8 @@ class importerosc extends ImportModule public function displayConfigConnector() { - $content = '<label>'.$this->l('Server').' : </label> + $content = '<script>var type_connector = "db";</script> + <label>'.$this->l('Server').' : </label> <div class="margin-form"> <input type="text" name="server" id="server" value=""> <p>'.$this->l('(eg : mysql.mydomain.com)').'</p> @@ -488,6 +496,137 @@ class importerosc extends ImportModule return $content; } + public function checkCategoriesLevel() + { + $columns = $this->ExecuteS('SHOW COLUMNS FROM `'.bqSQL($this->prefix).'categories` '); + foreach($columns as $field) + if ($field['Field'] == 'level') + return true; + return false; +} + + public function displayCategoriesLevelConf() + { + $html = '<div class="warn" id="warn_category_level" style="width:450px;display:none"> + <img src="../img/admin/warn2.png"> + '.$this->l('You are trying to import categories and we\'ve detected, that your oscommerce database don\'t have the field "level" in the table categorie. You must have this field to continue the import of categories.'); + + $html .= '<button class="button" onclick="addAndCalculateLevel();" style="padding:10px;font-size:13px;text:align:center">'.$this->l('Click to add and calculate the filed "level" .').'</button> <span id="loading" style="display:none"><img src="../img/loader.gif"></span></div> + <div class="conf" id="conf_category_level" style="width:450px;display:none"><img src="../img/admin/ok2.png">'.$this->l('Level field\'s has been created and calculated, You can continue').'</div>'; + + $html .= ' + <script> + $(document).ready(function (){ + + function checkCategorySelected() + { + if ($(\'#id_category_on:radio\').attr(\'checked\')) + { + $(\'#warn_category_level\').show(); + $(\'#checkAndSaveConfig\').attr(\'disabled\', \'disabled\'); + $(\'#checkAndSaveConfig\').hide(); + } + else + { + $(\'#warn_category_level\').hide(); + $(\'#checkAndSaveConfig\').removeAttr(\'disabled\'); + $(\'#checkAndSaveConfig\').show(); + } + + } + checkCategorySelected(); + $(\'input[name="getCategories"]\').change( function () { + checkCategorySelected(); + }); + + }); + + function addAndCalculateLevel() + { + if (confirm(\''.$this->l('It is highly recommended to backup your database before proceeding. Did you make a backup?').'\')) + { + $(\'#loading\').show(); + $.ajax({ + type: "GET", + url: "../modules/importerosc/ajax.php", + async: false, + cache: false, + dataType : "json", + data: "ajax=true&token='.sha1(_COOKIE_KEY_.'importosc').'&server="+$(\'#server\').val()+"&user="+$(\'#user\').val()+"&password="+$(\'#password\').val()+"&database="+$(\'#database\').val()+"&prefix="+$(\'#prefix\').val() , + success: function (jsonData) + { + if (jsonData.hasError) + alert(jsonData.error); + else + { + $(\'#warn_category_level\').remove(); + $(\'#checkAndSaveConfig\').removeAttr(\'disabled\'); + $(\'#checkAndSaveConfig\').show(); + $(\'#conf_category_level\').show(); + } + }, + error: function (XMLHttpRequest, textStatus, errorThrown) + { + + } + }); + } + return false; + } + </script>'; + + return $html; + } + + public function createLevelAndCalculate() + { + if ($this->checkCategoriesLevel()) + die('{"hasError" : false}'); + + if ($this->createLevel()) + $this->calculateLevel(); + else + die('{"hasError" : true, "error" : "'.$this->l('Can not ALTER TABLE').'"}'); + } + + public function createLevel() + { + return $this->Execute('ALTER TABLE `'.bqSQL($this->prefix).'categories` ADD `level` INT NOT NULL'); + } + + public function calculateLevel() + { + $this->updateLevel($this->getSubCat(0), 1); + die('{"hasError" : false}'); + } + + public function updateLevel($ids_cat, $level = 1) + { + $this->Execute(' + UPDATE `'.bqSQL($this->prefix).'categories` + SET level = '.(int)$level.' + WHERE categories_id IN ('.implode(',', $ids_cat).')'); + foreach($ids_cat as $id) + if ($sub_cat = $this->getSubCat($id)) + $this->updateLevel($sub_cat, $level + 1); + + } + + public function getSubCat($id_parent) + { + $result = $this->ExecuteS('SELECT `categories_id` FROM `'.bqSQL($this->prefix).'categories` WHERE `parent_id`='.(int)$id_parent); + if (!is_array($result) OR empty($result)) + return false; + return $this->formatCategoriesIds($result); + } + + public function formatCategoriesIds($result) + { + $return = array(); + foreach($result as $key => $val) + $return[] = $val['categories_id']; + return $return; + } } ?> diff --git a/modules/loyalty/loyalty.php b/modules/loyalty/loyalty.php index fa0129910..5004198c9 100644 --- a/modules/loyalty/loyalty.php +++ b/modules/loyalty/loyalty.php @@ -544,7 +544,7 @@ class Loyalty extends Module $loyalty->id_customer = (int)$params['customer']->id; $loyalty->id_order = (int)$params['order']->id; $loyalty->points = LoyaltyModule::getOrderNbPoints($params['order']); - if ((int)(Configuration::get('PS_LOYALTY_NONE_AWARD')) AND (int)($loyalty->points) == 0) + if (!Configuration::get('PS_LOYALTY_NONE_AWARD') AND (int)$loyalty->points == 0) $loyalty->id_loyalty_state = LoyaltyStateModule::getNoneAwardId(); else $loyalty->id_loyalty_state = LoyaltyStateModule::getDefaultId(); @@ -569,7 +569,7 @@ class Loyalty extends Module { if (!Validate::isLoadedObject($loyalty = new LoyaltyModule(LoyaltyModule::getByOrderId($order->id)))) return false; - if ((int)(Configuration::get('PS_LOYALTY_NONE_AWARD')) AND $loyalty->id_loyalty_state == LoyaltyStateModule::getNoneAwardId()) + if ((int)Configuration::get('PS_LOYALTY_NONE_AWARD') AND $loyalty->id_loyalty_state == LoyaltyStateModule::getNoneAwardId()) return true; if ($newOrder->id == $this->loyaltyStateValidation->id_order_state) diff --git a/modules/mailjet/ajax-mailjet.gif b/modules/mailjet/ajax-mailjet.gif new file mode 100755 index 000000000..94b14599b Binary files /dev/null and b/modules/mailjet/ajax-mailjet.gif differ diff --git a/modules/mailjet/ajax.js b/modules/mailjet/ajax.js new file mode 100755 index 000000000..bf3553ac1 --- /dev/null +++ b/modules/mailjet/ajax.js @@ -0,0 +1,47 @@ +// JavaScript Document +$(document).ready(function() { + + $('#button_test_mailjet').click(function() { + $("#mailjet_test_ok").hide(); + $("#mailjet_test_ko").hide(); + $("#div_email_test").show(500); + }); + + $('#button_send_mailjet').click(function() { + var token = $(this).attr('rel'); + $("#button_test_mailjet").hide(); + $("#image_ajax_mailjet").show(); + $("#div_email_test").hide(); + $.ajax({ + type: 'GET', + url: "../modules/mailjet/ajax.php", + async: true, + cache: false, + dataType : "html", + data: 'token=' + token + '&mailjet_api_key=' + $("#mailjet_api_key").val() + '&mailjet_secret_key=' + $("#mailjet_secret_key").val() + '&email_from=' + escape($("#email_from").val()), + success: function(html) + { + $("#button_test_mailjet").show(); + $("#image_ajax_mailjet").hide(); + var retour = html.split("|"); + + if (retour[0] == "true") + { + $("#mailjet_test_ok").show(500); + } else { + $("#mailjet_activation_no").attr('checked', true); + $("#mailjet_error_message").html(retour[1]); + $("#mailjet_test_ko").show(500); + + } + }, + error: function(jqxhr, status, errorThrown) + { + $("#mailjet_activation_no").attr('checked', true); + $("#mailjet_error_message").html(errorThrown); + $("#mailjet_test_ko").show(500); + } + }); + }); + +}); diff --git a/modules/mailjet/ajax.php b/modules/mailjet/ajax.php new file mode 100755 index 000000000..5223c95fd --- /dev/null +++ b/modules/mailjet/ajax.php @@ -0,0 +1,67 @@ +<?php +/* +* Copyright (c) 2011 Mailjet SAS +* +* Permission is hereby granted, free of charge, to any person obtaining a copy +* of this software and associated documentation files (the "Software"), to deal +* in the Software without restriction, including without limitation the rights +* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +* copies of the Software, and to permit persons to whom the Software is +* furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +* THE SOFTWARE. +* +* @author Dream me up +* @copyright 2011 Mailjet SAS +* @version Release: $Revision: 1.4 $ +* @license hhttp://opensource.org/licenses/mit-license MIT License +* International Registred Trademark & Property of Mailjet SAS +*/ + +require('../../config/config.inc.php'); +require('mailjet.php'); + +if (Tools::getValue('token') == '' || Tools::getValue('token') != Configuration::get('MAILJET_TOKEN')) + die('Invalid Token'); + +$obj_mailjet = new Mailjet(); +$email_from = urldecode($_GET['email_from']); +try { + $sujet = $obj_mailjet->l('Mailjet Test E-mail'); + $message = $obj_mailjet->l('Hello').",\r\n\r\n".$obj_mailjet->l('This E-mail confirms you that Mailjet has successfully been installed on your shop.'); + $result = Mail::sendMailTest(true, "in.mailjet.com", $message, $sujet, "text/plain", $email_from, $email_from, $_GET['mailjet_api_key'], $_GET['mailjet_secret_key'], $smtpPort = 465, "tls"); + + if ($result === true) + echo "true"; + else + { + if ($result == 999) + $result = $obj_mailjet->l('The E-mail was not successfully sent'); + echo "false|".$result; + reset_config_mailjet(); + } +} catch(Exception $e) { + echo "false|".$e->getMessage(); + reset_config_mailjet(); +} + +function reset_config_mailjet() +{ + Configuration::updateValue('MAILJET_ACTIVATE', 0); + Configuration::updateValue('PS_MAIL_METHOD', 1); + Configuration::updateValue('PS_MAIL_SERVER', ""); + Configuration::updateValue('PS_MAIL_USER', ""); + Configuration::updateValue('PS_MAIL_PASSWD', ""); + Configuration::updateValue('PS_MAIL_SMTP_ENCRYPTION', ""); + Configuration::updateValue('PS_MAIL_SMTP_PORT', 25); +} + diff --git a/modules/mailjet/config.xml b/modules/mailjet/config.xml new file mode 100755 index 000000000..ff8c3a5e4 --- /dev/null +++ b/modules/mailjet/config.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<module> + <name>mailjet</name> + <displayName><![CDATA[Mailjet]]></displayName> + <version><![CDATA[1.0]]></version> + <description><![CDATA[This modules sends through Mailjet all email coming from your Prestashop installation]]></description> + <author><![CDATA[]]></author> + <tab><![CDATA[front_office_features]]></tab> + <is_configurable>1</is_configurable> + <need_instance>1</need_instance> + <limited_countries></limited_countries> +</module> \ No newline at end of file diff --git a/modules/mailjet/fr.php b/modules/mailjet/fr.php new file mode 100755 index 000000000..211e20dea --- /dev/null +++ b/modules/mailjet/fr.php @@ -0,0 +1,29 @@ +<?php + +global $_MODULE; +$_MODULE = array(); +$_MODULE['<{mailjet}prestashop>ajax_64b88c69849c8b362e7f97c6eaab574d'] = 'E-mail de test'; +$_MODULE['<{mailjet}prestashop>ajax_8b1a9953c4611296a827abf8c47804d7'] = 'Bonjour'; +$_MODULE['<{mailjet}prestashop>ajax_c38b28d6adf75b2b2936de1f2168b6e6'] = 'Cet e-mail vous confirme que Mailjet a été correctement installé sur votre boutique.'; +$_MODULE['<{mailjet}prestashop>ajax_cfc9dca01a0503813a5f9585ba6780d1'] = 'L\'e-mail n\'a pas pu être envoyé'; +$_MODULE['<{mailjet}prestashop>mailjet_c127c5641733ecedcce7c33ed849401e'] = 'Ce module vous permet d\'envoyer vos e-mail PrestaShop via Mailjet'; +$_MODULE['<{mailjet}prestashop>mailjet_9ccb2eaeed6c7e95ecaf108373619300'] = 'Ce module est activé mais la clé API ou la clé secrète ne sont pas correctement remplies.'; +$_MODULE['<{mailjet}prestashop>mailjet_64b88c69849c8b362e7f97c6eaab574d'] = 'E-mail de test'; +$_MODULE['<{mailjet}prestashop>mailjet_8b1a9953c4611296a827abf8c47804d7'] = 'Bonjour'; +$_MODULE['<{mailjet}prestashop>mailjet_c38b28d6adf75b2b2936de1f2168b6e6'] = 'Cet e-mail vous confirme que Mailjet a été correctement installé sur votre boutique.'; +$_MODULE['<{mailjet}prestashop>mailjet_cfc9dca01a0503813a5f9585ba6780d1'] = 'L\'e-mail n\'a pas pu être envoyé'; +$_MODULE['<{mailjet}prestashop>mailjet_c888438d14855d7d96a2724ee9c306bd'] = 'Configuraiton mise à jour'; +$_MODULE['<{mailjet}prestashop>mailjet_9e3f29ea93d121e237085def4ee29f74'] = 'Ce module vous permet d\'envoyer vos e-mail PrestaShop (et ceux de la plupart de vos modules) via Mailjet'; +$_MODULE['<{mailjet}prestashop>mailjet_f4f70727dc34561dfde1a3c529b6205c'] = 'Configuration'; +$_MODULE['<{mailjet}prestashop>mailjet_6ad7efc596f5720291e748ff2185733f'] = 'Clé API Mailjet'; +$_MODULE['<{mailjet}prestashop>mailjet_a02496bddaea8e6616bf285fc37973be'] = 'Clé secrète Mailjet'; +$_MODULE['<{mailjet}prestashop>mailjet_ed1d12d25d1a1ec139c84015ae766a7f'] = 'Envoyer vos e-mails via Mailjet'; +$_MODULE['<{mailjet}prestashop>mailjet_93cba07454f06a4a960172bbd6e2a435'] = 'Oui'; +$_MODULE['<{mailjet}prestashop>mailjet_bafd7322c6e97d25b6299b5d6fe8920b'] = 'Non'; +$_MODULE['<{mailjet}prestashop>mailjet_63ade95d66cda885393aab6f5f5e4e76'] = 'Authentification réussie ! Votre configuration est correcte.'; +$_MODULE['<{mailjet}prestashop>mailjet_424ab525513861737da68b0700b5cd20'] = 'Une erreur est survenue :'; +$_MODULE['<{mailjet}prestashop>mailjet_79dfc1f365ed194bb9fc0da20f1a3857'] = 'Si vous ne comprenez pas cette erreur, veuillez contacter'; +$_MODULE['<{mailjet}prestashop>mailjet_d496cec7c628e4438ee719315942e2d6'] = ' E-mail de / à :'; +$_MODULE['<{mailjet}prestashop>mailjet_94966d90747b97d1f0f206c98a8b1ac3'] = 'Envoyer'; +$_MODULE['<{mailjet}prestashop>mailjet_540caa299a719ee320cf416ffae7adca'] = 'Test de configuration'; +$_MODULE['<{mailjet}prestashop>mailjet_d4dccb8ca2dac4e53c01bd9954755332'] = 'Sauvegarder la configuration'; diff --git a/modules/mailjet/logo-mailjet.jpg b/modules/mailjet/logo-mailjet.jpg new file mode 100755 index 000000000..b28eeca95 Binary files /dev/null and b/modules/mailjet/logo-mailjet.jpg differ diff --git a/modules/mailjet/logo.gif b/modules/mailjet/logo.gif new file mode 100755 index 000000000..eae7ebf58 Binary files /dev/null and b/modules/mailjet/logo.gif differ diff --git a/modules/mailjet/mailjet.php b/modules/mailjet/mailjet.php new file mode 100755 index 000000000..8b97b2a3d --- /dev/null +++ b/modules/mailjet/mailjet.php @@ -0,0 +1,213 @@ +<?php +/* +* Copyright (c) 2011 Mailjet SAS +* +* Permission is hereby granted, free of charge, to any person obtaining a copy +* of this software and associated documentation files (the "Software"), to deal +* in the Software without restriction, including without limitation the rights +* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +* copies of the Software, and to permit persons to whom the Software is +* furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +* THE SOFTWARE. +* +* @author Dream me up +* @copyright 2011 Mailjet SAS +* @version Release: $Revision: 1.4 $ +* @license hhttp://opensource.org/licenses/mit-license MIT License +* International Registred Trademark & Property of Mailjet SAS +*/ + + +// Security +if (!defined('_PS_VERSION_')) + exit; + +class Mailjet extends Module +{ + + /* + ** Construct Method + ** + */ + + public function __construct() + { + $this->name = 'mailjet'; + $this->tab = 'front_office_features'; + $this->version = '1.0'; + $this->displayName = 'Mailjet'; + + parent::__construct(); + + $this->description = $this->l('This modules sends through Mailjet all email coming from your Prestashop installation'); + + if (Configuration::get('MAILJET_ACTIVATE') == 1 && (strlen(Configuration::get('MAILJET_API_KEY')) < 3 || strlen(Configuration::get('MAILJET_SECRET_KEY')) < 3)) + $this->warning = $this->l('The module is activated but api key or secret key are not correctly set.'); + + // Defines ajax lang variables in way to translate them + $this->l('Mailjet Test E-mail'); + $this->l('Hello'); + $this->l('This E-mail confirms you that Mailjet has successfully been installed on your shop.'); + $this->l('The E-mail was not successfully sent'); + } + + + /* + ** Install / Uninstall Methods + ** + */ + + public function install() + { + // Can't do anything else for retrocompatibility + if (md5_file(dirname(__FILE__).'/override/Message.php') != md5_file(dirname(__FILE__).'/../../tools/swift/Swift/Message.php')) + return false; + if (!@copy(dirname(__FILE__).'/override/Message-mailjet.php', dirname(__FILE__).'/../../tools/swift/Swift/Message.php')) + return false; + + // Create Token + Configuration::updateValue('MAILJET_TOKEN', md5(rand())); + + // Install module + if (!parent::install()) + return false; + + return true; + } + + public function uninstall() + { + // Can't do anything else for retrocompatibility + if (md5_file(dirname(__FILE__).'/override/Message-mailjet.php') != md5_file(dirname(__FILE__).'/../../tools/swift/Swift/Message.php')) + return false; + if (!@copy(dirname(__FILE__).'/override/Message.php', dirname(__FILE__).'/../../tools/swift/Swift/Message.php')) + return false; + + // Uninstall module + Configuration::updateValue('PS_MAIL_METHOD', 1); + Configuration::updateValue('PS_MAIL_SERVER', ""); + Configuration::updateValue('PS_MAIL_USER', ""); + Configuration::updateValue('PS_MAIL_PASSWD', ""); + Configuration::updateValue('PS_MAIL_SMTP_ENCRYPTION', ""); + Configuration::updateValue('PS_MAIL_SMTP_PORT', 25); + if (!Configuration::deleteByName('MAILJET_TOKEN') OR !Configuration::deleteByName('MAILJET_SECRET_KEY') OR !Configuration::deleteByName('MAILJET_API_KEY') OR !parent::uninstall()) + return false; + + return true; + } + + + /* + ** Form Config Methods + ** + */ + + public function getContent() + { + global $cookie; + + $lang = new Language((int)($cookie->id_lang)); + if (!in_array($lang->iso_code, array('fr', 'en', 'es'))) + $lang->iso_code = 'en'; + + $output = '<script type="text/javascript" src="'.__PS_BASE_URI__.'modules/'.$this->name.'/ajax.js"></script> + <p style="margin-bottom: 5px;"><img src="'.__PS_BASE_URI__.'modules/'.$this->name.'/logo-mailjet.jpg" alt="" /></p>'; + + if (Tools::isSubmit('submitMailjet')) + { + Configuration::updateValue('MAILJET_API_KEY', pSQL(Tools::getValue('mailjet_api_key'))); + Configuration::updateValue('MAILJET_SECRET_KEY', pSQL(Tools::getValue('mailjet_secret_key'))); + Configuration::updateValue('MAILJET_ACTIVATE', (int)(Tools::getValue('mailjet_activation'))); + + // If mailjet activation, let's configure + if ((int)Tools::getValue('mailjet_activation') == 1) + { + Configuration::updateValue('PS_MAIL_METHOD', 2); + Configuration::updateValue('PS_MAIL_SERVER', "in.mailjet.com"); + Configuration::updateValue('PS_MAIL_USER', pSQL(Configuration::get('MAILJET_API_KEY'))); + Configuration::updateValue('PS_MAIL_PASSWD', pSQL(Configuration::get('MAILJET_SECRET_KEY'))); + Configuration::updateValue('PS_MAIL_SMTP_ENCRYPTION', "tls"); + Configuration::updateValue('PS_MAIL_SMTP_PORT', 465); + } + else + { + Configuration::updateValue('PS_MAIL_METHOD', 1); + Configuration::updateValue('PS_MAIL_SERVER', ""); + Configuration::updateValue('PS_MAIL_USER', ""); + Configuration::updateValue('PS_MAIL_PASSWD', ""); + Configuration::updateValue('PS_MAIL_SMTP_ENCRYPTION', ""); + Configuration::updateValue('PS_MAIL_SMTP_PORT', 25); + } + + $output .= ' + <div class="conf confirm"> + <img src="../img/admin/ok.gif" alt="" title="" /> + '.$this->l('Settings updated').' + </div>'; + } + + $chk_yes = ""; + $chk_no = " checked=\"checked\""; + + if ((int)(Tools::getValue('mailjet_activation', Configuration::get('MAILJET_ACTIVATE'))) == 1) + { + $chk_yes = ' checked="checked"'; + $chk_no = ''; + } + + $output .= ' + <div> + <p style="margin-bottom:10px;"> + <b>'.$this->l('This module sends through Mailjet all email coming from your Prestashop installation (and most third party modules)').'.</b> + </p> + <form action="'.htmlentities($_SERVER['REQUEST_URI']).'" method="post"> + <fieldset> + <legend><img src="../img/admin/cog.gif" alt="" class="middle" />'.$this->l('Settings').'</legend> + <label>'.$this->l('Mailjet API Key:').'</label> + <div class="margin-form"> + <input type="text" name="mailjet_api_key" id="mailjet_api_key" size="30" value="'.htmlentities(Tools::getValue('mailjet_api_key', Configuration::get('MAILJET_API_KEY'))).'" /> + </div> + <hr size="1" style="margin-bottom: 20px;" noshade /> + <label>'.$this->l('Mailjet Secret Key').'</label> + <div class="margin-form"> + <input type="text" name="mailjet_secret_key" id="mailjet_secret_key" size="30" value="'.htmlentities(Tools::getValue('mailjet_secret_key', Configuration::get('MAILJET_SECRET_KEY'))).'" /> + </div> + <hr size="1" style="margin-bottom: 20px;" noshade /> + <label style="vertical-align: middle;">'.$this->l('Send Email through Mailjet:').'</label> + <div class="margin-form" style="margin-top: 5px;"> + <input type="radio" name="mailjet_activation" value="1" style="vertical-align: middle;" '.$chk_yes.' /> '.$this->l('Yes').'  + <input type="radio" name="mailjet_activation" id="mailjet_activation_no" value="0" style="vertical-align: middle;" '.$chk_no.' /> '.$this->l('No').' + </div> + <hr size="1" style="margin-bottom: 20px;" noshade /> + <div class="conf confirm" id="mailjet_test_ok" style="display:none"> + <img src="../img/admin/ok.gif" alt="" title="" /> + '.$this->l('Authentication successful ! Your configuration is correct.').' + </div> + <div class="conf error" id="mailjet_test_ko" style="display:none"> + <img src="../img/admin/forbbiden.gif" alt="" title="" /> + '.$this->l('An Error has occured : ').'<span id="mailjet_error_message"></span> + <p>'.$this->l('If you don\'t understand this error please contact').' <a href="http://fr.mailjet.com/support" target="_blank">Mailjet Support</a></p> + </div> + <div id="div_email_test" style="display:none"> + <p style="text-align:center">'.$this->l('E-mail From / to :').' <input type="text" id="email_from" value="'.htmlentities(Configuration::get('PS_SHOP_EMAIL')).'" size="40" /> <input type="button" name="sendTestMailjet" value="'.$this->l('Send').'" class="button" rel="'.htmlentities(Configuration::get('MAILJET_TOKEN')).'" id="button_send_mailjet" /></p> + <hr size="1" style="margin-bottom: 20px;" noshade /> + </div> + <center><input type="button" name="testMailjet" value="'.$this->l('Test Configuration').'" class="button" id="button_test_mailjet" /><img src="'.__PS_BASE_URI__.'modules/'.$this->name.'/ajax-mailjet.gif" id="image_ajax_mailjet" style="display:none" /> <input type="submit" name="submitMailjet" value="'.$this->l('Save settings').'" class="button" /></center> + </fieldset> + </form> + </div>'; + + return $output; + } +} + diff --git a/modules/mailjet/override/Message-mailjet.php b/modules/mailjet/override/Message-mailjet.php new file mode 100755 index 000000000..cc04474ef --- /dev/null +++ b/modules/mailjet/override/Message-mailjet.php @@ -0,0 +1,798 @@ +<?php + +/** + * Swift Mailer Message Component + * Composes MIME 1.0 messages meeting various RFC standards + * Deals with attachments, embedded images, multipart bodies, forwarded messages... + * Please read the LICENSE file + * @copyright Chris Corbyn <chris@w3style.co.uk> + * @author Chris Corbyn <chris@w3style.co.uk> + * @package Swift_Message + * @license GNU Lesser General Public License + */ + +require_once dirname(__FILE__) . "/ClassLoader.php"; +Swift_ClassLoader::load("Swift_Address"); +Swift_ClassLoader::load("Swift_Message_Mime"); +Swift_ClassLoader::load("Swift_Message_Image"); +Swift_ClassLoader::load("Swift_Message_Part"); + + +/** + * Swift Message class + * @package Swift_Message + * @author Chris Corbyn <chris@w3style.co.uk> + */ +class Swift_Message extends Swift_Message_Mime +{ + /** + * Constant from a high priority message (pretty meaningless) + */ + const PRIORITY_HIGH = 1; + /** + * Constant for a low priority message + */ + const PRIORITY_LOW = 5; + /** + * Constant for a normal priority message + */ + const PRIORITY_NORMAL = 3; + /** + * The MIME warning for client not supporting multipart content + * @var string + */ + protected $mimeWarning = null; + /** + * The version of the library (Swift) if known. + * @var string + */ + protected $libVersion = ""; + /** + * A container for references to other objects. + * This is used in some very complex logic when sub-parts get shifted around. + * @var array + */ + protected $references = array( + "parent" => array("alternative" => null, "mixed" => null, "related" => null), + "alternative" => array(), + "mixed" => array(), + "related" => array() + ); + + /** + * Ctor. + * @param string Message subject + * @param string Body + * @param string Content-type + * @param string Encoding + * @param string Charset + */ + public function __construct($subject="", $body=null, $type="text/plain", $encoding=null, $charset=null) + { + parent::__construct(); + if (function_exists("date_default_timezone_set") && function_exists("date_default_timezone_get")) + { + date_default_timezone_set(@date_default_timezone_get()); + } + $this->setReturnPath(null); + $this->setTo(""); + $this->setFrom(""); + $this->setCc(null); + $this->setBcc(null); + $this->setReplyTo(null); + $this->setSubject($subject); + $this->setDate(time()); + if (defined("Swift::VERSION")) + { + $this->libVersion = Swift::VERSION; + $this->headers->set("X-LibVersion", $this->libVersion); + } + $this->headers->set("MIME-Version", "1.0"); + $this->headers->set("X-Mailjet-Partner", "prestashop"); + $this->setContentType($type); + $this->setCharset($charset); + $this->setFlowed(true); + $this->setEncoding($encoding); + + foreach (array_keys($this->references["parent"]) as $key) + { + $this->setReference("parent", $key, $this); + } + + $this->setMimeWarning( + "This is a message in multipart MIME format. Your mail client should not be displaying this. " . + "Consider upgrading your mail client to view this message correctly." + ); + + if ($body !== null) + { + $this->setData($body); + if ($charset === null) + { + Swift_ClassLoader::load("Swift_Message_Encoder"); + if (Swift_Message_Encoder::instance()->isUTF8($body)) $this->setCharset("utf-8"); + else $this->setCharset("iso-8859-1"); + } + } + } + /** + * Sets a reference so when nodes are nested, operations can be redirected. + * This really should be refactored to use just one array rather than dynamic variables. + * @param string Key 1 + * @param string Key 2 + * @param Object Reference + */ + protected function setReference($where, $key, $ref) + { + if ($ref === $this) $this->references[$where][$key] = false; + else $this->references[$where][$key] = $ref; + } + /** + * Get a reference to an object (for complex reasons). + * @param string Key 1 + * @param string Key 2 + * @return Object + */ + protected function getReference($where, $key) + { + if (!$this->references[$where][$key]) return $this; + else return $this->references[$where][$key]; + } + /** + * Get the level in the MIME hierarchy at which this section should appear. + * @return string + */ + public function getLevel() + { + return Swift_Message_Mime::LEVEL_TOP; + } + /** + * Set the message id literally. + * Unless you know what you are doing you should be using generateId() rather than this method, + * otherwise you may break compliancy with RFC 2822. + * @param string The message ID string. + */ + public function setId($id) + { + $this->headers->set("Message-ID", $id); + } + /** + * Create a RFC 2822 compliant message id, optionally based upon $idstring. + * The message ID includes information about the current time, the server and some random characters. + * @param string An optional string the base the ID on + * @return string The generated message ID, including the <> quotes. + * @author Cristian Rodriguez <judas.iscariote@flyspray.org> + */ + public function generateId($idstring=null) + { + $midparams = array( + "utctime" => gmstrftime("%Y%m%d%H%M%S"), + "pid" => getmypid(), + "randint" => mt_rand(), + "customstr" => (preg_match("/^(?<!\\.)[a-z0-9\\.]+(?!\\.)\$/iD", $idstring) ? $idstring : "swift") , + "hostname" => (isset($_SERVER["SERVER_NAME"]) ? $_SERVER["SERVER_NAME"] : php_uname("n")), + ); + $this->setId(vsprintf("<%s.%d.%d.%s@%s>", $midparams)); + return $this->getId(); + } + /** + * Get the generated message ID for this message, including the <> quotes. + * If generated automatically, or using generateId() this method returns a RFC2822 compliant Message-ID. + * @return string + * @author Cristian Rodriguez <judas.iscariote@flyspray.org> + */ + public function getId() + { + return $this->headers->has("Message-ID") ? $this->headers->get("Message-ID") : null; + } + /** + * Set the address in the Return-Path: header + * @param string The bounce-detect address + */ + public function setReturnPath($address) + { + if ($address instanceof Swift_Address) $address = $address->build(true); + $this->headers->set("Return-Path", $address); + } + /** + * Return the address used in the Return-Path: header + * @return string + * @param boolean Return the address for SMTP command + */ + public function getReturnPath($smtp=false) + { + if ($this->headers->has("Return-Path")) + { + if (!$smtp) return $this->headers->get("Return-Path"); + else + { + $path = $this->headers->get("Return-Path"); + if (strpos($path, ">") > strpos($path, "<")) return substr($path, ($start = strpos($path, "<")), ($start + strrpos($path, ">") + 1)); + else return "<" . $path . ">"; + } + } + } + /** + * Set the address in the From: header + * @param string The address to set as From + */ + public function setFrom($from) + { + if ($from instanceof Swift_Address) $from = $from->build(); + $this->headers->set("From", $from); + } + /** + * Get the address used in the From: header + * @return string + */ + public function getFrom() + { + if ($this->headers->has("From")) return $this->headers->get("From"); + } + /** + * Set the list of recipients in the To: header + * @param mixed An array or a string + */ + public function setTo($to) + { + if ($to) + { + if (!is_array($to)) $to = array($to); + foreach ($to as $key => $value) + { + if ($value instanceof Swift_Address) $to[$key] = $value->build(); + } + } + $this->headers->set("To", $to); + } + /** + * Return the list of recipients in the To: header + * @return array + */ + public function getTo() + { + if ($this->headers->has("To")) + { + $to = $this->headers->get("To"); + if ($to == "") return array(); + else return (array) $to; + } + } + /** + * Set the list of recipients in the Reply-To: header + * @param mixed An array or a string + */ + public function setReplyTo($replyto) + { + if ($replyto) + { + if (!is_array($replyto)) $replyto = array($replyto); + foreach ($replyto as $key => $value) + { + if ($value instanceof Swift_Address) $replyto[$key] = $value->build(); + } + } + $this->headers->set("Reply-To", $replyto); + } + /** + * Return the list of recipients in the Reply-To: header + * @return array + */ + public function getReplyTo() + { + if ($this->headers->has("Reply-To")) + { + $reply_to = $this->headers->get("Reply-To"); + if ($reply_to == "") return array(); + else return (array) $reply_to; + } + } + /** + * Set the list of recipients in the Cc: header + * @param mixed An array or a string + */ + public function setCc($cc) + { + if ($cc) + { + if (!is_array($cc)) $cc = array($cc); + foreach ($cc as $key => $value) + { + if ($value instanceof Swift_Address) $cc[$key] = $value->build(); + } + } + $this->headers->set("Cc", $cc); + } + /** + * Return the list of recipients in the Cc: header + * @return array + */ + public function getCc() + { + if ($this->headers->has("Cc")) + { + $cc = $this->headers->get("Cc"); + if ($cc == "") return array(); + else return (array) $cc; + } + } + /** + * Set the list of recipients in the Bcc: header + * @param mixed An array or a string + */ + public function setBcc($bcc) + { + if ($bcc) + { + if (!is_array($bcc)) $bcc = array($bcc); + foreach ($bcc as $key => $value) + { + if ($value instanceof Swift_Address) $bcc[$key] = $value->build(); + } + } + $this->headers->set("Bcc", $bcc); + } + /** + * Return the list of recipients in the Bcc: header + * @return array + */ + public function getBcc() + { + if ($this->headers->has("Bcc")) + { + $bcc = $this->headers->get("Bcc"); + if ($bcc == "") return array(); + else return (array) $bcc; + } + } + /** + * Set the subject in the headers + * @param string The subject of the email + */ + public function setSubject($subject) + { + $this->headers->set("Subject", $subject); + } + /** + * Get the current subject used in the headers + * @return string + */ + public function getSubject() + { + return $this->headers->get("Subject"); + } + /** + * Set the date in the headers in RFC 2822 format + * @param int The time as a UNIX timestamp + */ + public function setDate($date) + { + $this->headers->set("Date", date("r", $date)); + } + /** + * Get the date as it looks in the headers + * @return string + */ + public function getDate() + { + return strtotime($this->headers->get("Date")); + } + /** + * Set the charset of the document + * @param string The charset used + */ + public function setCharset($charset) + { + $this->headers->setAttribute("Content-Type", "charset", $charset); + if (($this->getEncoding() == "7bit") && (strtolower($charset) == "utf-8" || strtolower($charset) == "utf8")) $this->setEncoding("8bit"); + } + /** + * Get the charset used in the document + * Returns null if none is set + * @return string + */ + public function getCharset() + { + if ($this->headers->hasAttribute("Content-Type", "charset")) + { + return $this->headers->getAttribute("Content-Type", "charset"); + } + else + { + return null; + } + } + /** + * Set the "format" attribute to flowed + * @param boolean On or Off + */ + public function setFlowed($flowed=true) + { + $value = null; + if ($flowed) $value = "flowed"; + $this->headers->setAttribute("Content-Type", "format", $value); + } + /** + * Check if the message format is set as flowed + * @return boolean + */ + public function isFlowed() + { + if ($this->headers->hasAttribute("Content-Type", "format") + && $this->headers->getAttribute("Content-Type", "format") == "flowed") + { + return true; + } + else return false; + } + /** + * Set the message prioirty in the mail client (don't rely on this) + * @param int The priority as a value between 1 (high) and 5 (low) + */ + public function setPriority($priority) + { + $priority = (int) $priority; + if ($priority > self::PRIORITY_LOW) $priority = self::PRIORITY_LOW; + if ($priority < self::PRIORITY_HIGH) $priority = self::PRIORITY_HIGH; + $label = array(1 => "High", 2 => "High", 3 => "Normal", 4 => "Low", 5 => "Low"); + $this->headers->set("X-Priority", $priority); + $this->headers->set("X-MSMail-Priority", $label[$priority]); + $this->headers->set("X-MimeOLE", "Produced by SwiftMailer " . $this->libVersion); + } + /** + * Request that the client send back a read-receipt (don't rely on this!) + * @param string Request address + */ + public function requestReadReceipt($request) + { + if ($request instanceof Swift_Address) $request = $request->build(); + if (!$request) + { + $this->headers->set("Disposition-Notification-To", null); + $this->headers->set("X-Confirm-Reading-To", null); + $this->headers->set("Return-Receipt-To", null); + } + else + { + $this->headers->set("Disposition-Notification-To", $request); + $this->headers->set("X-Confirm-Reading-To", $request); + $this->headers->set("Return-Receipt-To", $request); + } + } + /** + * Check if a read receipt has been requested for this message + * @return boolean + */ + public function wantsReadReceipt() + { + return $this->headers->has("Disposition-Notification-To"); + } + /** + * Get the current message priority + * Returns NULL if none set + * @return int + */ + public function getPriority() + { + if ($this->headers->has("X-Priority")) return $this->headers->get("X-Priority"); + else return null; + } + /** + * Alias for setData() + * @param mixed Body + */ + public function setBody($body) + { + $this->setData($body); + } + /** + * Alias for getData() + * @return mixed The document body + */ + public function getBody() + { + return $this->getData(); + } + /** + * Set the MIME warning message which is displayed to old clients + * @var string The full warning message (in 7bit ascii) + */ + public function setMimeWarning($text) + { + $this->mimeWarning = (string) $text; + } + /** + * Get the MIME warning which is displayed to old clients + * @return string + */ + public function getMimeWarning() + { + return $this->mimeWarning; + } + /** + * Attach a mime part or an attachment of some sort + * Any descendant of Swift_Message_Mime can be added safely (including other Swift_Message objects for mail forwarding!!) + * @param Swift_Message_Mime The document to attach + * @param string An identifier to use (one is returned otherwise) + * @return string The identifier for the part + */ + public function attach(Swift_Message_Mime $child, $id=null) + { + try { + switch ($child->getLevel()) + { + case Swift_Message_Mime::LEVEL_ALTERNATIVE: + $sign = (strtolower($child->getContentType()) == "text/plain") ? -1 : 1; + $id = $this->getReference("parent", "alternative")->addChild($child, $id, $sign); + $this->setReference("alternative", $id, $child); + break; + case Swift_Message_Mime::LEVEL_RELATED: + $id = "cid:" . $child->getContentId(); + $id = $this->getReference("parent", "related")->addChild($child, $id, 1); + $this->setReference("related", $id, $child); + break; + case Swift_Message_Mime::LEVEL_MIXED: default: + $id = $this->getReference("parent", "mixed")->addChild($child, $id, 1); + $this->setReference("mixed", $id, $child); + break; + } + $this->postAttachFixStructure(); + $this->fixContentType(); + return $id; + } catch (Swift_Message_MimeException $e) { + throw new Swift_Message_MimeException("Something went wrong whilst trying to move some MIME parts during an attach(). " . + "The MIME component threw an exception:<br />" . $e->getMessage()); + } + } + /** + * Remove a nested MIME part + * @param string The ID of the attached part + * @throws Swift_Message_MimeException If no such part exists + */ + public function detach($id) + { + try { + switch (true) + { + case array_key_exists($id, $this->references["alternative"]): + $this->getReference("parent", "alternative")->removeChild($id); + unset($this->references["alternative"][$id]); + break; + case array_key_exists($id, $this->references["related"]): + $this->getReference("parent", "related")->removeChild($id); + unset($this->references["related"][$id]); + break; + case array_key_exists($id, $this->references["mixed"]): + $this->getReference("parent", "mixed")->removeChild($id); + unset($this->references["mixed"][$id]); + break; + default: + throw new Swift_Message_MimeException("Unable to detach part identified by ID '" . $id . "' since it's not registered."); + break; + } + $this->postDetachFixStructure(); + $this->fixContentType(); + } catch (Swift_Message_MimeException $e) { + throw new Swift_Message_MimeException("Something went wrong whilst trying to move some MIME parts during a detach(). " . + "The MIME component threw an exception:<br />" . $e->getMessage()); + } + } + /** + * Sets the correct content type header by looking at what types of data we have set + */ + protected function fixContentType() + { + if (!empty($this->references["mixed"])) $this->setContentType("multipart/mixed"); + elseif (!empty($this->references["related"])) $this->setContentType("multipart/related"); + elseif (!empty($this->references["alternative"])) $this->setContentType("multipart/alternative"); + } + /** + * Move a branch of the tree, containing all it's MIME parts onto another branch + * @param string The content type on the branch itself + * @param string The content type which may exist in the branch's parent + * @param array The array containing all the nodes presently + * @param string The location of the branch now + * @param string The location of the branch after moving + * @param string The key to identify the branch by in it's new location + */ + protected function moveBranchIn($type, $nested_type, $from, $old_branch, $new_branch, $tag) + { + $new = new Swift_Message_Part(); + $new->setContentType($type); + $this->getReference("parent", $new_branch)->addChild($new, $tag, -1); + + switch ($new_branch) + { + case "related": $this->setReference("related", $tag, $new);//relatedRefs[$tag] = $new; + break; + case "mixed": $this->setReference("mixed", $tag, $new);//mixedRefs[$tag] = $new; + break; + } + + foreach ($from as $id => $ref) + { + if (!$ref) $ref = $this; + $sign = (strtolower($ref->getContentType()) == "text/plain" + || strtolower($ref->getContentType()) == $nested_type) ? -1 : 1; + switch ($new_branch) + { + case "related": $this->getReference("related", $tag)->addChild($ref, $id, $sign); + break; + case "mixed": $this->getReference("mixed", $tag)->addChild($ref, $id, $sign); + break; + } + $this->getReference("parent", $old_branch)->removeChild($id); + } + $this->setReference("parent", $old_branch, $new); //parentRefs[$old_branch] = $new; + } + /** + * Analyzes the mixing of MIME types in a mulitpart message an re-arranges if needed + * It looks complicated and long winded but the concept is pretty simple, even if putting it + * in code does me make want to cry! + */ + protected function postAttachFixStructure() + { + switch (true) + { + case (!empty($this->references["mixed"]) && !empty($this->references["related"]) && !empty($this->references["alternative"])): + if (!isset($this->references["related"]["_alternative"])) + { + $this->moveBranchIn( + "multipart/alternative", "multipart/alternative", $this->references["alternative"], "alternative", "related", "_alternative"); + } + if (!isset($this->references["mixed"]["_related"])) + { + $this->moveBranchIn( + "multipart/related", "multipart/alternative", $this->references["related"], "related", "mixed", "_related"); + } + break; + case (!empty($this->references["mixed"]) && !empty($this->references["related"])): + if (!isset($this->references["mixed"]["_related"])) + { + $this->moveBranchIn( + "multipart/related", "multipart/related", $this->references["related"], "related", "mixed", "_related"); + } + break; + case (!empty($this->references["mixed"]) && !empty($this->references["alternative"])): + if (!isset($this->references["mixed"]["_alternative"])) + { + $this->moveBranchIn( + "multipart/alternative", null, $this->references["alternative"], "alternative", "mixed", "_alternative"); + } + break; + case (!empty($this->references["related"]) && !empty($this->references["alternative"])): + if (!isset($this->references["related"]["_alternative"])) + { + $this->moveBranchIn( + "multipart/alternative", "multipart/alternative", $this->references["alternative"], "alternative", "related", "_alternative"); + } + break; + } + } + /** + * Move a branch further toward the top of the tree + * @param array The array containing MIME parts from the old branch + * @param string The name of the old branch + * @param string The name of the new branch + * @param string The key of the branch being moved + */ + protected function moveBranchOut($from, $old_branch, $new_branch, $tag) + { + foreach ($from as $id => $ref) + { + if (!$ref) $ref = $this; + $sign = (strtolower($ref->getContentType()) == "text/html" + || strtolower($ref->getContentType()) == "multipart/alternative") ? -1 : 1; + $this->getReference("parent", $new_branch)->addChild($ref, $id, $sign); + switch ($new_branch) + { + case "related": $this->getReference("related", $tag)->removeChild($id); + break; + case "mixed": $this->getReference("parent", $old_branch)->removeChild($id); + break; + } + } + $this->getReference("parent", $new_branch)->removeChild($tag); + $mixed = $this->getReference("parent", $new_branch);//parentRefs[$new_branch]; + $this->setReference("parent", $old_branch, $mixed);//parentRefs[$old_branch] = $mixed; + switch ($new_branch) + { + case "related": unset($this->references["related"][$tag]); + break; + case "mixed": unset($this->references["mixed"][$tag]); + break; + } + } + /** + * Analyzes the mixing of MIME types in a mulitpart message an re-arranges if needed + * It looks complicated and long winded but the concept is pretty simple, even if putting it + * in code does me make want to cry! + */ + protected function postDetachFixStructure() + { + switch (true) + { + case (!empty($this->references["mixed"]) && !empty($this->references["related"]) && !empty($this->references["alternative"])): + if (array_keys($this->references["related"]) == array("_alternative")) + { + $alt = $this->getReference("parent", "related")->getChild("_alternative"); + $this->getReference("parent", "mixed")->addChild($alt, "_alternative", -1); + $this->setReference("mixed", "_alternative", $alt);//mixedRefs["_alternative"] = $alt; + $this->getReference("parent", "related")->removeChild("_alternative"); + unset($this->references["related"]["_alternative"]); + $this->getReference("parent", "mixed")->removeChild("_related"); + unset($this->references["mixed"]["_related"]); + } + if (array_keys($this->references["mixed"]) == array("_related")) + { + $this->moveBranchOut($this->references["related"], "related", "mixed", "_related"); + } + break; + case (!empty($this->references["mixed"]) && !empty($this->references["related"])): + if (array_keys($this->references["mixed"]) == array("_related")) + { + $this->moveBranchOut($this->references["related"], "related", "mixed", "_related"); + } + if (isset($this->references["related"]["_alternative"])) + { + $this->detach("_alternative"); + } + break; + case (!empty($this->references["mixed"]) && !empty($this->references["alternative"])): + if (array_keys($this->references["mixed"]) == array("_alternative")) + { + $this->moveBranchOut($this->references["alternative"], "alternative", "mixed", "_alternative"); + } + break; + case (!empty($this->references["related"]) && !empty($this->references["alternative"])): + if (array_keys($this->references["related"]) == array("_alternative")) + { + $this->moveBranchOut($this->references["alternative"], "alternative", "related", "_alternative"); + } + break; + case (!empty($this->references["mixed"])): + if (isset($this->references["mixed"]["_related"])) $this->detach("_related"); + case (!empty($this->references["related"])): + if (isset($this->references["related"]["_alternative"]) || isset($this->references["mixed"]["_alternative"])) + $this->detach("_alternative"); + break; + } + } + /** + * Execute needed logic prior to compilation + */ + public function preBuild() + { + $data = $this->getData(); + if (!($enc = $this->getEncoding())) + { + $this->setEncoding("8bit"); + } + if ($this->getCharset() === null && !$this->numChildren()) + { + Swift_ClassLoader::load("Swift_Message_Encoder"); + if (is_string($data) && Swift_Message_Encoder::instance()->isUTF8($data)) + { + $this->setCharset("utf-8"); + } + elseif(is_string($data) && Swift_Message_Encoder::instance()->is7BitAscii($data)) + { + $this->setCharset("us-ascii"); + if (!$enc) $this->setEncoding("7bit"); + } + else $this->setCharset("iso-8859-1"); + } + elseif ($this->numChildren()) + { + if (!$this->getData()) + { + $this->setData($this->getMimeWarning()); + $this->setLineWrap(76); + } + + if ($this->getCharset() !== null) $this->setCharset(null); + if ($this->isFlowed()) $this->setFlowed(false); + $this->setEncoding("7bit"); + } + } +} diff --git a/modules/mailjet/override/Message.php b/modules/mailjet/override/Message.php new file mode 100755 index 000000000..8ce2a2f92 --- /dev/null +++ b/modules/mailjet/override/Message.php @@ -0,0 +1,797 @@ +<?php + +/** + * Swift Mailer Message Component + * Composes MIME 1.0 messages meeting various RFC standards + * Deals with attachments, embedded images, multipart bodies, forwarded messages... + * Please read the LICENSE file + * @copyright Chris Corbyn <chris@w3style.co.uk> + * @author Chris Corbyn <chris@w3style.co.uk> + * @package Swift_Message + * @license GNU Lesser General Public License + */ + +require_once dirname(__FILE__) . "/ClassLoader.php"; +Swift_ClassLoader::load("Swift_Address"); +Swift_ClassLoader::load("Swift_Message_Mime"); +Swift_ClassLoader::load("Swift_Message_Image"); +Swift_ClassLoader::load("Swift_Message_Part"); + + +/** + * Swift Message class + * @package Swift_Message + * @author Chris Corbyn <chris@w3style.co.uk> + */ +class Swift_Message extends Swift_Message_Mime +{ + /** + * Constant from a high priority message (pretty meaningless) + */ + const PRIORITY_HIGH = 1; + /** + * Constant for a low priority message + */ + const PRIORITY_LOW = 5; + /** + * Constant for a normal priority message + */ + const PRIORITY_NORMAL = 3; + /** + * The MIME warning for client not supporting multipart content + * @var string + */ + protected $mimeWarning = null; + /** + * The version of the library (Swift) if known. + * @var string + */ + protected $libVersion = ""; + /** + * A container for references to other objects. + * This is used in some very complex logic when sub-parts get shifted around. + * @var array + */ + protected $references = array( + "parent" => array("alternative" => null, "mixed" => null, "related" => null), + "alternative" => array(), + "mixed" => array(), + "related" => array() + ); + + /** + * Ctor. + * @param string Message subject + * @param string Body + * @param string Content-type + * @param string Encoding + * @param string Charset + */ + public function __construct($subject="", $body=null, $type="text/plain", $encoding=null, $charset=null) + { + parent::__construct(); + if (function_exists("date_default_timezone_set") && function_exists("date_default_timezone_get")) + { + date_default_timezone_set(@date_default_timezone_get()); + } + $this->setReturnPath(null); + $this->setTo(""); + $this->setFrom(""); + $this->setCc(null); + $this->setBcc(null); + $this->setReplyTo(null); + $this->setSubject($subject); + $this->setDate(time()); + if (defined("Swift::VERSION")) + { + $this->libVersion = Swift::VERSION; + $this->headers->set("X-LibVersion", $this->libVersion); + } + $this->headers->set("MIME-Version", "1.0"); + $this->setContentType($type); + $this->setCharset($charset); + $this->setFlowed(true); + $this->setEncoding($encoding); + + foreach (array_keys($this->references["parent"]) as $key) + { + $this->setReference("parent", $key, $this); + } + + $this->setMimeWarning( + "This is a message in multipart MIME format. Your mail client should not be displaying this. " . + "Consider upgrading your mail client to view this message correctly." + ); + + if ($body !== null) + { + $this->setData($body); + if ($charset === null) + { + Swift_ClassLoader::load("Swift_Message_Encoder"); + if (Swift_Message_Encoder::instance()->isUTF8($body)) $this->setCharset("utf-8"); + else $this->setCharset("iso-8859-1"); + } + } + } + /** + * Sets a reference so when nodes are nested, operations can be redirected. + * This really should be refactored to use just one array rather than dynamic variables. + * @param string Key 1 + * @param string Key 2 + * @param Object Reference + */ + protected function setReference($where, $key, $ref) + { + if ($ref === $this) $this->references[$where][$key] = false; + else $this->references[$where][$key] = $ref; + } + /** + * Get a reference to an object (for complex reasons). + * @param string Key 1 + * @param string Key 2 + * @return Object + */ + protected function getReference($where, $key) + { + if (!$this->references[$where][$key]) return $this; + else return $this->references[$where][$key]; + } + /** + * Get the level in the MIME hierarchy at which this section should appear. + * @return string + */ + public function getLevel() + { + return Swift_Message_Mime::LEVEL_TOP; + } + /** + * Set the message id literally. + * Unless you know what you are doing you should be using generateId() rather than this method, + * otherwise you may break compliancy with RFC 2822. + * @param string The message ID string. + */ + public function setId($id) + { + $this->headers->set("Message-ID", $id); + } + /** + * Create a RFC 2822 compliant message id, optionally based upon $idstring. + * The message ID includes information about the current time, the server and some random characters. + * @param string An optional string the base the ID on + * @return string The generated message ID, including the <> quotes. + * @author Cristian Rodriguez <judas.iscariote@flyspray.org> + */ + public function generateId($idstring=null) + { + $midparams = array( + "utctime" => gmstrftime("%Y%m%d%H%M%S"), + "pid" => getmypid(), + "randint" => mt_rand(), + "customstr" => (preg_match("/^(?<!\\.)[a-z0-9\\.]+(?!\\.)\$/iD", $idstring) ? $idstring : "swift") , + "hostname" => (isset($_SERVER["SERVER_NAME"]) ? $_SERVER["SERVER_NAME"] : php_uname("n")), + ); + $this->setId(vsprintf("<%s.%d.%d.%s@%s>", $midparams)); + return $this->getId(); + } + /** + * Get the generated message ID for this message, including the <> quotes. + * If generated automatically, or using generateId() this method returns a RFC2822 compliant Message-ID. + * @return string + * @author Cristian Rodriguez <judas.iscariote@flyspray.org> + */ + public function getId() + { + return $this->headers->has("Message-ID") ? $this->headers->get("Message-ID") : null; + } + /** + * Set the address in the Return-Path: header + * @param string The bounce-detect address + */ + public function setReturnPath($address) + { + if ($address instanceof Swift_Address) $address = $address->build(true); + $this->headers->set("Return-Path", $address); + } + /** + * Return the address used in the Return-Path: header + * @return string + * @param boolean Return the address for SMTP command + */ + public function getReturnPath($smtp=false) + { + if ($this->headers->has("Return-Path")) + { + if (!$smtp) return $this->headers->get("Return-Path"); + else + { + $path = $this->headers->get("Return-Path"); + if (strpos($path, ">") > strpos($path, "<")) return substr($path, ($start = strpos($path, "<")), ($start + strrpos($path, ">") + 1)); + else return "<" . $path . ">"; + } + } + } + /** + * Set the address in the From: header + * @param string The address to set as From + */ + public function setFrom($from) + { + if ($from instanceof Swift_Address) $from = $from->build(); + $this->headers->set("From", $from); + } + /** + * Get the address used in the From: header + * @return string + */ + public function getFrom() + { + if ($this->headers->has("From")) return $this->headers->get("From"); + } + /** + * Set the list of recipients in the To: header + * @param mixed An array or a string + */ + public function setTo($to) + { + if ($to) + { + if (!is_array($to)) $to = array($to); + foreach ($to as $key => $value) + { + if ($value instanceof Swift_Address) $to[$key] = $value->build(); + } + } + $this->headers->set("To", $to); + } + /** + * Return the list of recipients in the To: header + * @return array + */ + public function getTo() + { + if ($this->headers->has("To")) + { + $to = $this->headers->get("To"); + if ($to == "") return array(); + else return (array) $to; + } + } + /** + * Set the list of recipients in the Reply-To: header + * @param mixed An array or a string + */ + public function setReplyTo($replyto) + { + if ($replyto) + { + if (!is_array($replyto)) $replyto = array($replyto); + foreach ($replyto as $key => $value) + { + if ($value instanceof Swift_Address) $replyto[$key] = $value->build(); + } + } + $this->headers->set("Reply-To", $replyto); + } + /** + * Return the list of recipients in the Reply-To: header + * @return array + */ + public function getReplyTo() + { + if ($this->headers->has("Reply-To")) + { + $reply_to = $this->headers->get("Reply-To"); + if ($reply_to == "") return array(); + else return (array) $reply_to; + } + } + /** + * Set the list of recipients in the Cc: header + * @param mixed An array or a string + */ + public function setCc($cc) + { + if ($cc) + { + if (!is_array($cc)) $cc = array($cc); + foreach ($cc as $key => $value) + { + if ($value instanceof Swift_Address) $cc[$key] = $value->build(); + } + } + $this->headers->set("Cc", $cc); + } + /** + * Return the list of recipients in the Cc: header + * @return array + */ + public function getCc() + { + if ($this->headers->has("Cc")) + { + $cc = $this->headers->get("Cc"); + if ($cc == "") return array(); + else return (array) $cc; + } + } + /** + * Set the list of recipients in the Bcc: header + * @param mixed An array or a string + */ + public function setBcc($bcc) + { + if ($bcc) + { + if (!is_array($bcc)) $bcc = array($bcc); + foreach ($bcc as $key => $value) + { + if ($value instanceof Swift_Address) $bcc[$key] = $value->build(); + } + } + $this->headers->set("Bcc", $bcc); + } + /** + * Return the list of recipients in the Bcc: header + * @return array + */ + public function getBcc() + { + if ($this->headers->has("Bcc")) + { + $bcc = $this->headers->get("Bcc"); + if ($bcc == "") return array(); + else return (array) $bcc; + } + } + /** + * Set the subject in the headers + * @param string The subject of the email + */ + public function setSubject($subject) + { + $this->headers->set("Subject", $subject); + } + /** + * Get the current subject used in the headers + * @return string + */ + public function getSubject() + { + return $this->headers->get("Subject"); + } + /** + * Set the date in the headers in RFC 2822 format + * @param int The time as a UNIX timestamp + */ + public function setDate($date) + { + $this->headers->set("Date", date("r", $date)); + } + /** + * Get the date as it looks in the headers + * @return string + */ + public function getDate() + { + return strtotime($this->headers->get("Date")); + } + /** + * Set the charset of the document + * @param string The charset used + */ + public function setCharset($charset) + { + $this->headers->setAttribute("Content-Type", "charset", $charset); + if (($this->getEncoding() == "7bit") && (strtolower($charset) == "utf-8" || strtolower($charset) == "utf8")) $this->setEncoding("8bit"); + } + /** + * Get the charset used in the document + * Returns null if none is set + * @return string + */ + public function getCharset() + { + if ($this->headers->hasAttribute("Content-Type", "charset")) + { + return $this->headers->getAttribute("Content-Type", "charset"); + } + else + { + return null; + } + } + /** + * Set the "format" attribute to flowed + * @param boolean On or Off + */ + public function setFlowed($flowed=true) + { + $value = null; + if ($flowed) $value = "flowed"; + $this->headers->setAttribute("Content-Type", "format", $value); + } + /** + * Check if the message format is set as flowed + * @return boolean + */ + public function isFlowed() + { + if ($this->headers->hasAttribute("Content-Type", "format") + && $this->headers->getAttribute("Content-Type", "format") == "flowed") + { + return true; + } + else return false; + } + /** + * Set the message prioirty in the mail client (don't rely on this) + * @param int The priority as a value between 1 (high) and 5 (low) + */ + public function setPriority($priority) + { + $priority = (int) $priority; + if ($priority > self::PRIORITY_LOW) $priority = self::PRIORITY_LOW; + if ($priority < self::PRIORITY_HIGH) $priority = self::PRIORITY_HIGH; + $label = array(1 => "High", 2 => "High", 3 => "Normal", 4 => "Low", 5 => "Low"); + $this->headers->set("X-Priority", $priority); + $this->headers->set("X-MSMail-Priority", $label[$priority]); + $this->headers->set("X-MimeOLE", "Produced by SwiftMailer " . $this->libVersion); + } + /** + * Request that the client send back a read-receipt (don't rely on this!) + * @param string Request address + */ + public function requestReadReceipt($request) + { + if ($request instanceof Swift_Address) $request = $request->build(); + if (!$request) + { + $this->headers->set("Disposition-Notification-To", null); + $this->headers->set("X-Confirm-Reading-To", null); + $this->headers->set("Return-Receipt-To", null); + } + else + { + $this->headers->set("Disposition-Notification-To", $request); + $this->headers->set("X-Confirm-Reading-To", $request); + $this->headers->set("Return-Receipt-To", $request); + } + } + /** + * Check if a read receipt has been requested for this message + * @return boolean + */ + public function wantsReadReceipt() + { + return $this->headers->has("Disposition-Notification-To"); + } + /** + * Get the current message priority + * Returns NULL if none set + * @return int + */ + public function getPriority() + { + if ($this->headers->has("X-Priority")) return $this->headers->get("X-Priority"); + else return null; + } + /** + * Alias for setData() + * @param mixed Body + */ + public function setBody($body) + { + $this->setData($body); + } + /** + * Alias for getData() + * @return mixed The document body + */ + public function getBody() + { + return $this->getData(); + } + /** + * Set the MIME warning message which is displayed to old clients + * @var string The full warning message (in 7bit ascii) + */ + public function setMimeWarning($text) + { + $this->mimeWarning = (string) $text; + } + /** + * Get the MIME warning which is displayed to old clients + * @return string + */ + public function getMimeWarning() + { + return $this->mimeWarning; + } + /** + * Attach a mime part or an attachment of some sort + * Any descendant of Swift_Message_Mime can be added safely (including other Swift_Message objects for mail forwarding!!) + * @param Swift_Message_Mime The document to attach + * @param string An identifier to use (one is returned otherwise) + * @return string The identifier for the part + */ + public function attach(Swift_Message_Mime $child, $id=null) + { + try { + switch ($child->getLevel()) + { + case Swift_Message_Mime::LEVEL_ALTERNATIVE: + $sign = (strtolower($child->getContentType()) == "text/plain") ? -1 : 1; + $id = $this->getReference("parent", "alternative")->addChild($child, $id, $sign); + $this->setReference("alternative", $id, $child); + break; + case Swift_Message_Mime::LEVEL_RELATED: + $id = "cid:" . $child->getContentId(); + $id = $this->getReference("parent", "related")->addChild($child, $id, 1); + $this->setReference("related", $id, $child); + break; + case Swift_Message_Mime::LEVEL_MIXED: default: + $id = $this->getReference("parent", "mixed")->addChild($child, $id, 1); + $this->setReference("mixed", $id, $child); + break; + } + $this->postAttachFixStructure(); + $this->fixContentType(); + return $id; + } catch (Swift_Message_MimeException $e) { + throw new Swift_Message_MimeException("Something went wrong whilst trying to move some MIME parts during an attach(). " . + "The MIME component threw an exception:<br />" . $e->getMessage()); + } + } + /** + * Remove a nested MIME part + * @param string The ID of the attached part + * @throws Swift_Message_MimeException If no such part exists + */ + public function detach($id) + { + try { + switch (true) + { + case array_key_exists($id, $this->references["alternative"]): + $this->getReference("parent", "alternative")->removeChild($id); + unset($this->references["alternative"][$id]); + break; + case array_key_exists($id, $this->references["related"]): + $this->getReference("parent", "related")->removeChild($id); + unset($this->references["related"][$id]); + break; + case array_key_exists($id, $this->references["mixed"]): + $this->getReference("parent", "mixed")->removeChild($id); + unset($this->references["mixed"][$id]); + break; + default: + throw new Swift_Message_MimeException("Unable to detach part identified by ID '" . $id . "' since it's not registered."); + break; + } + $this->postDetachFixStructure(); + $this->fixContentType(); + } catch (Swift_Message_MimeException $e) { + throw new Swift_Message_MimeException("Something went wrong whilst trying to move some MIME parts during a detach(). " . + "The MIME component threw an exception:<br />" . $e->getMessage()); + } + } + /** + * Sets the correct content type header by looking at what types of data we have set + */ + protected function fixContentType() + { + if (!empty($this->references["mixed"])) $this->setContentType("multipart/mixed"); + elseif (!empty($this->references["related"])) $this->setContentType("multipart/related"); + elseif (!empty($this->references["alternative"])) $this->setContentType("multipart/alternative"); + } + /** + * Move a branch of the tree, containing all it's MIME parts onto another branch + * @param string The content type on the branch itself + * @param string The content type which may exist in the branch's parent + * @param array The array containing all the nodes presently + * @param string The location of the branch now + * @param string The location of the branch after moving + * @param string The key to identify the branch by in it's new location + */ + protected function moveBranchIn($type, $nested_type, $from, $old_branch, $new_branch, $tag) + { + $new = new Swift_Message_Part(); + $new->setContentType($type); + $this->getReference("parent", $new_branch)->addChild($new, $tag, -1); + + switch ($new_branch) + { + case "related": $this->setReference("related", $tag, $new);//relatedRefs[$tag] = $new; + break; + case "mixed": $this->setReference("mixed", $tag, $new);//mixedRefs[$tag] = $new; + break; + } + + foreach ($from as $id => $ref) + { + if (!$ref) $ref = $this; + $sign = (strtolower($ref->getContentType()) == "text/plain" + || strtolower($ref->getContentType()) == $nested_type) ? -1 : 1; + switch ($new_branch) + { + case "related": $this->getReference("related", $tag)->addChild($ref, $id, $sign); + break; + case "mixed": $this->getReference("mixed", $tag)->addChild($ref, $id, $sign); + break; + } + $this->getReference("parent", $old_branch)->removeChild($id); + } + $this->setReference("parent", $old_branch, $new); //parentRefs[$old_branch] = $new; + } + /** + * Analyzes the mixing of MIME types in a mulitpart message an re-arranges if needed + * It looks complicated and long winded but the concept is pretty simple, even if putting it + * in code does me make want to cry! + */ + protected function postAttachFixStructure() + { + switch (true) + { + case (!empty($this->references["mixed"]) && !empty($this->references["related"]) && !empty($this->references["alternative"])): + if (!isset($this->references["related"]["_alternative"])) + { + $this->moveBranchIn( + "multipart/alternative", "multipart/alternative", $this->references["alternative"], "alternative", "related", "_alternative"); + } + if (!isset($this->references["mixed"]["_related"])) + { + $this->moveBranchIn( + "multipart/related", "multipart/alternative", $this->references["related"], "related", "mixed", "_related"); + } + break; + case (!empty($this->references["mixed"]) && !empty($this->references["related"])): + if (!isset($this->references["mixed"]["_related"])) + { + $this->moveBranchIn( + "multipart/related", "multipart/related", $this->references["related"], "related", "mixed", "_related"); + } + break; + case (!empty($this->references["mixed"]) && !empty($this->references["alternative"])): + if (!isset($this->references["mixed"]["_alternative"])) + { + $this->moveBranchIn( + "multipart/alternative", null, $this->references["alternative"], "alternative", "mixed", "_alternative"); + } + break; + case (!empty($this->references["related"]) && !empty($this->references["alternative"])): + if (!isset($this->references["related"]["_alternative"])) + { + $this->moveBranchIn( + "multipart/alternative", "multipart/alternative", $this->references["alternative"], "alternative", "related", "_alternative"); + } + break; + } + } + /** + * Move a branch further toward the top of the tree + * @param array The array containing MIME parts from the old branch + * @param string The name of the old branch + * @param string The name of the new branch + * @param string The key of the branch being moved + */ + protected function moveBranchOut($from, $old_branch, $new_branch, $tag) + { + foreach ($from as $id => $ref) + { + if (!$ref) $ref = $this; + $sign = (strtolower($ref->getContentType()) == "text/html" + || strtolower($ref->getContentType()) == "multipart/alternative") ? -1 : 1; + $this->getReference("parent", $new_branch)->addChild($ref, $id, $sign); + switch ($new_branch) + { + case "related": $this->getReference("related", $tag)->removeChild($id); + break; + case "mixed": $this->getReference("parent", $old_branch)->removeChild($id); + break; + } + } + $this->getReference("parent", $new_branch)->removeChild($tag); + $mixed = $this->getReference("parent", $new_branch);//parentRefs[$new_branch]; + $this->setReference("parent", $old_branch, $mixed);//parentRefs[$old_branch] = $mixed; + switch ($new_branch) + { + case "related": unset($this->references["related"][$tag]); + break; + case "mixed": unset($this->references["mixed"][$tag]); + break; + } + } + /** + * Analyzes the mixing of MIME types in a mulitpart message an re-arranges if needed + * It looks complicated and long winded but the concept is pretty simple, even if putting it + * in code does me make want to cry! + */ + protected function postDetachFixStructure() + { + switch (true) + { + case (!empty($this->references["mixed"]) && !empty($this->references["related"]) && !empty($this->references["alternative"])): + if (array_keys($this->references["related"]) == array("_alternative")) + { + $alt = $this->getReference("parent", "related")->getChild("_alternative"); + $this->getReference("parent", "mixed")->addChild($alt, "_alternative", -1); + $this->setReference("mixed", "_alternative", $alt);//mixedRefs["_alternative"] = $alt; + $this->getReference("parent", "related")->removeChild("_alternative"); + unset($this->references["related"]["_alternative"]); + $this->getReference("parent", "mixed")->removeChild("_related"); + unset($this->references["mixed"]["_related"]); + } + if (array_keys($this->references["mixed"]) == array("_related")) + { + $this->moveBranchOut($this->references["related"], "related", "mixed", "_related"); + } + break; + case (!empty($this->references["mixed"]) && !empty($this->references["related"])): + if (array_keys($this->references["mixed"]) == array("_related")) + { + $this->moveBranchOut($this->references["related"], "related", "mixed", "_related"); + } + if (isset($this->references["related"]["_alternative"])) + { + $this->detach("_alternative"); + } + break; + case (!empty($this->references["mixed"]) && !empty($this->references["alternative"])): + if (array_keys($this->references["mixed"]) == array("_alternative")) + { + $this->moveBranchOut($this->references["alternative"], "alternative", "mixed", "_alternative"); + } + break; + case (!empty($this->references["related"]) && !empty($this->references["alternative"])): + if (array_keys($this->references["related"]) == array("_alternative")) + { + $this->moveBranchOut($this->references["alternative"], "alternative", "related", "_alternative"); + } + break; + case (!empty($this->references["mixed"])): + if (isset($this->references["mixed"]["_related"])) $this->detach("_related"); + case (!empty($this->references["related"])): + if (isset($this->references["related"]["_alternative"]) || isset($this->references["mixed"]["_alternative"])) + $this->detach("_alternative"); + break; + } + } + /** + * Execute needed logic prior to compilation + */ + public function preBuild() + { + $data = $this->getData(); + if (!($enc = $this->getEncoding())) + { + $this->setEncoding("8bit"); + } + if ($this->getCharset() === null && !$this->numChildren()) + { + Swift_ClassLoader::load("Swift_Message_Encoder"); + if (is_string($data) && Swift_Message_Encoder::instance()->isUTF8($data)) + { + $this->setCharset("utf-8"); + } + elseif(is_string($data) && Swift_Message_Encoder::instance()->is7BitAscii($data)) + { + $this->setCharset("us-ascii"); + if (!$enc) $this->setEncoding("7bit"); + } + else $this->setCharset("iso-8859-1"); + } + elseif ($this->numChildren()) + { + if (!$this->getData()) + { + $this->setData($this->getMimeWarning()); + $this->setLineWrap(76); + } + + if ($this->getCharset() !== null) $this->setCharset(null); + if ($this->isFlowed()) $this->setFlowed(false); + $this->setEncoding("7bit"); + } + } +} diff --git a/modules/mondialrelay/AdminMondialRelay.php b/modules/mondialrelay/AdminMondialRelay.php index 6a1fd509f..a5bd52f48 100755 --- a/modules/mondialrelay/AdminMondialRelay.php +++ b/modules/mondialrelay/AdminMondialRelay.php @@ -59,17 +59,23 @@ class AdminMondialRelay extends AdminTab $errorListTicket = $MRCreateTicket->checkPreValidation(); - if (count($errorListTicket)) - { - $html .= '<div class="error">'. - $this->l('Thanks to kindly correct the following errors on '). + $titleType = array( + 'error' => $this->l('Thanks to kindly correct the following errors on '). ' <a href="index.php?tab=AdminContact&token='.Tools::getAdminToken('AdminContact'. (int)Tab::getIdFromClassName('AdminContact').(int)$this->context->id_employee).'" style="color:#f00;"> '. - $this->l('the contact page').'</a>:<ul>'; - foreach($errorListTicket as $type => $error) + $this->l('the contact page').'</a>:<ul>', + 'warn' => $this->l('Please take a look to this following warning, maybe the ticket won\'t be generated')); + + foreach($errorListTicket as $errorType => $errorList) + { + if (count($errorList)) + { + $html .= '<div class="MR_'.$errorType.'">'.$titleType[$errorType]; + foreach($errorList as $type => $error) $html .= '<li>'.$type.': '.$error.'</li>'; $html .= '</ul></div>'; } + } $html .= '<p>'.$this->l('All orders which have the state').' "<b>'.$order_state->name.'</b>" '. $this->l('will be available for sticker creation'); diff --git a/modules/mondialrelay/classes/MRCreateTickets.php b/modules/mondialrelay/classes/MRCreateTickets.php index 4f18d615d..66a4553e4 100755 --- a/modules/mondialrelay/classes/MRCreateTickets.php +++ b/modules/mondialrelay/classes/MRCreateTickets.php @@ -274,7 +274,7 @@ class MRCreateTickets implements IMondialRelayWSMethod { $this->_fields['list']['Enseigne']['value'] = Configuration::get('MR_ENSEIGNE_WEBSERVICE'); $this->_fields['list']['Expe_Langage']['value'] = Configuration::get('MR_LANGUAGE'); - $this->_fields['list']['Expe_Ad1']['value'] = Configuration::get('PS_MR_SHOP_NAME'); + $this->_fields['list']['Expe_Ad1']['value'] = Configuration::get('PS_SHOP_NAME'); $this->_fields['list']['Expe_Ad3']['value'] = Configuration::get('PS_SHOP_ADDR1'); // Deleted, cause to many failed for the process // $this->_fields['list']['Expe_Ad4']['value'] = Configuration::get('PS_SHOP_ADDR2'); @@ -331,7 +331,7 @@ class MRCreateTickets implements IMondialRelayWSMethod $tmp['NDossier']['value'] = $orderDetail['id_order']; $tmp['NClient']['value'] = $orderDetail['id_customer']; $tmp['Dest_Langage']['value'] = 'FR'; //Language::getIsoById($orderDetail['id_lang']); - $tmp['Dest_Ad1']['value'] = $deliveriesAddress->lastname; + $tmp['Dest_Ad1']['value'] = $deliveriesAddress->firstname.' '.$deliveriesAddress->lastname; $tmp['Dest_Ad2']['value'] = $deliveriesAddress->address2; $tmp['Dest_Ad3']['value'] = $deliveriesAddress->address1; $tmp['Dest_Ville']['value'] = $deliveriesAddress->city; @@ -342,7 +342,6 @@ class MRCreateTickets implements IMondialRelayWSMethod $tmp['Dest_Tel2']['value'] = $deliveriesAddress->phone_mobile; $tmp['Dest_Mail']['value'] = $customer->email; $tmp['Assurance']['value'] = $orderDetail['mr_ModeAss']; - if ($orderDetail['MR_Selected_Num'] != 'LD1' && $orderDetail['MR_Selected_Num'] != 'LDS') { $tmp['LIV_Rel_Pays']['value'] = $orderDetail['MR_Selected_Pays']; @@ -511,7 +510,7 @@ class MRCreateTickets implements IMondialRelayWSMethod */ public function checkPreValidation() { - $errorList = array(); + $errorList = array('error' => array(), 'warn' => array()); if (!$this->_mondialRelay) $this->_mondialRelay = new MondialRelay(); @@ -521,7 +520,7 @@ class MRCreateTickets implements IMondialRelayWSMethod 'value' => Configuration::get('MR_LANGUAGE'), 'error' => $this->_mondialRelay->l('Please check your language configuration')), 'Expe_Ad1' => array( - 'value' => Configuration::get('PS_MR_SHOP_NAME'), + 'value' => Configuration::get('PS_SHOP_NAME'), 'error' => $this->_mondialRelay->l('Please check your shop name configuration')), 'Expe_Ad3' => array( 'value' => Configuration::get('PS_SHOP_ADDR1'), @@ -531,7 +530,8 @@ class MRCreateTickets implements IMondialRelayWSMethod 'error' => $this->_mondialRelay->l('Please check your city configuration')), 'Expe_CP' => array( 'value' => Configuration::get('PS_SHOP_CODE'), - 'error' => $this->_mondialRelay->l('Please check your zipcode configuration')), + 'error' => $this->_mondialRelay->l('Please check your zipcode configuration'), + 'warn' => $this->_mondialRelay->l('It seems the layout of your zipcode country is not configured or you didn\'t set a right zipcode')), 'Expe_Pays' => array( 'value' => ((_PS_VERSION_ >= '1.4') ? Country::getIsoById(Configuration::get('PS_SHOP_COUNTRY_ID')) : @@ -546,16 +546,22 @@ class MRCreateTickets implements IMondialRelayWSMethod foreach($list as $name => $tab) { - $tab['value'] = strtoupper($tab['value']); + // Mac server make an empty string instead of a cleaned string + // TODO : test on windows and linux server + $cleanedString = MRTools::replaceAccentedCharacters($tab['value']); + $tab['value'] = !empty($cleanedString) ? strtoupper($cleanedString) : strtoupper($tab['value']); + if ($name == 'Expe_CP') { - if (!MRTools::checkZipcodeByCountry($tab['value'], array( - 'id_country' => Configuration::get('PS_COUNTRY_DEFAULT')))) - $errorList[$name] = $tab['error']; + if (!($zipcodeError = MRTools::checkZipcodeByCountry($tab['value'], array( + 'id_country' => Configuration::get('PS_COUNTRY_DEFAULT'))))) + $errorList['error'][$name] = $tab['error']; + else if ($zipcodeError < 0) + $errorList['warn'][$name] = $tab['warn']; } else if (isset($this->_fields['list'][$name]['regexValidation']) && (!preg_match($this->_fields['list'][$name]['regexValidation'], $tab['value'], $matches))) - $errorList[$name] = $tab['error']; + $errorList['error'][$name] = $tab['error']; } return $errorList; } diff --git a/modules/mondialrelay/classes/MRTools.php b/modules/mondialrelay/classes/MRTools.php index 20dc7984d..741014f97 100755 --- a/modules/mondialrelay/classes/MRTools.php +++ b/modules/mondialrelay/classes/MRTools.php @@ -64,14 +64,14 @@ class MRTools { $id_country = $params['id_country']; - $zipcodeFormat = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue(' + $zipcodeFormat = Db::getInstance()->getValue(' SELECT `zip_code_format` FROM `'._DB_PREFIX_.'country` WHERE `id_country` = '.(int)$id_country); - // Skip the cheking format if doesn't exist + // -1 to warn user that no layout exist if (!$zipcodeFormat) - return true; + return -1; $regxMask = str_replace( array('N', 'C', 'L'), diff --git a/modules/mondialrelay/config.xml b/modules/mondialrelay/config.xml index 81aca9169..486d3efa2 100755 --- a/modules/mondialrelay/config.xml +++ b/modules/mondialrelay/config.xml @@ -2,7 +2,7 @@ <module> <name>mondialrelay</name> <displayName><![CDATA[Mondial Relay]]></displayName> - <version><![CDATA[1.7.8]]></version> + <version><![CDATA[1.7.9]]></version> <description><![CDATA[Deliver in Relay points]]></description> <author><![CDATA[]]></author> <tab><![CDATA[shipping_logistics]]></tab> diff --git a/modules/mondialrelay/docs/install.pdf b/modules/mondialrelay/docs/install.pdf new file mode 100644 index 000000000..1565f4942 Binary files /dev/null and b/modules/mondialrelay/docs/install.pdf differ diff --git a/modules/mondialrelay/fr.php b/modules/mondialrelay/fr.php index 7d059d8d0..555651d85 100755 --- a/modules/mondialrelay/fr.php +++ b/modules/mondialrelay/fr.php @@ -4,6 +4,7 @@ global $_MODULE; $_MODULE = array(); $_MODULE['<{mondialrelay}prestashop>adminmondialrelay_d1908b9b04e81c4b6112e38b608c49af'] = 'Merci de bien vouloir corriger les erreurs suivantes dans'; $_MODULE['<{mondialrelay}prestashop>adminmondialrelay_ccce63109db30895153094de05c60fa5'] = 'la page de contact'; +$_MODULE['<{mondialrelay}prestashop>adminmondialrelay_7c5fd3d93bd19d81953db3b374997961'] = 'Merci de jeter un oeil à la mise en garde suivante, peut-être que l\'étiquette ne sera pas générée'; $_MODULE['<{mondialrelay}prestashop>adminmondialrelay_de21dc13e1ea638777fbfad49f88b332'] = 'Toutes les commandes qui auront un statut'; $_MODULE['<{mondialrelay}prestashop>adminmondialrelay_a0bf3c9ac2d785f053d883b8746e91ba'] = 'seront disponibles pour la création d\'ètiquette'; $_MODULE['<{mondialrelay}prestashop>adminmondialrelay_2345e28c9b93f368968be4781ed70f5c'] = 'Changer la configuration'; @@ -46,7 +47,9 @@ $_MODULE['<{mondialrelay}prestashop>mondialrelay_c888438d14855d7d96a2724ee9c306b $_MODULE['<{mondialrelay}prestashop>mondialrelay_07213a0161f52846ab198be103b5ab43'] = 'erreurs'; $_MODULE['<{mondialrelay}prestashop>mondialrelay_cb5e100e5a9a3e7f6d1fd97512215282'] = 'erreur'; $_MODULE['<{mondialrelay}prestashop>mondialrelay_350c1cc4343826a89f08a33bb49c6d98'] = 'Configuration du Module Mondial Relay'; -$_MODULE['<{mondialrelay}prestashop>mondialrelay_192a5439bcfb850e8885cd4b5e01ced4'] = 'Essayez de désactiver le cache et de forcer la compilation smarty si vous rencontrez le moindre problème après une mise à jour du module'; +$_MODULE['<{mondialrelay}prestashop>mondialrelay_5a2355a42ba3ab265701183c914467f2'] = 'Essayez de désactiver le cache et de forcer la compilation smarty'; +$_MODULE['<{mondialrelay}prestashop>mondialrelay_3de769f9a81eed916583d5b35c58dbdd'] = 'si vous rencontrez le moindre problème après une mise à jour du module'; +$_MODULE['<{mondialrelay}prestashop>mondialrelay_8f8b21bd013b38d1e3059557c22a57e7'] = 'Consulter le manuel pour vous guider dans la configuration de Mondial Relay'; $_MODULE['<{mondialrelay}prestashop>mondialrelay_d21a9f93917604d5490ad529a7cf1ff9'] = 'Pour créer un transporteur Mondial Relay'; $_MODULE['<{mondialrelay}prestashop>mondialrelay_c6a2e6af5fff47adb3afd780b97d9b4b'] = 'Remplissez et sauvegarder vos paramètres Mondial Relay'; $_MODULE['<{mondialrelay}prestashop>mondialrelay_94fbe32464fcfa902feed9f256439833'] = 'Créez un transporteur via le formulaire ‘’ajouter un transporteur’’ ci-dessous'; @@ -114,6 +117,7 @@ $_MODULE['<{mondialrelay}prestashop>mondialrelay_ef2a1f426c2c289ed5986c7636a5d69 $_MODULE['<{mondialrelay}prestashop>mondialrelay_80a0c205cd57b22fca7f174253870300'] = 'Heures d\'ouvertures'; $_MODULE['<{mondialrelay}prestashop>mondialrelay_2b56b60f878922093facd42284848a0c'] = 'Plus de détails'; $_MODULE['<{mondialrelay}prestashop>orderdetail_81b7b4587a2a3ea7a0d6bb1df3fbba54'] = 'Livraison à'; +$_MODULE['<{mondialrelay}prestashop>orderdetail_c2d05abc7f5ebdc72b6656df35038b43'] = 'Suivre mon colis sur le site de Mondial Relay'; $_MODULE['<{mondialrelay}prestashop>mrcreatetickets_a1c3470a944b9625cfb924fd15c8bdbf'] = 'Veuillez choisir au moins une commande'; $_MODULE['<{mondialrelay}prestashop>mrcreatetickets_dc41aac14af17f1d19fca5e3b9439e74'] = 'Cette clé'; $_MODULE['<{mondialrelay}prestashop>mrcreatetickets_306b346c19017609403424203ea3d720'] = 'est vide et doit être renseignée'; @@ -129,6 +133,7 @@ $_MODULE['<{mondialrelay}prestashop>mrcreatetickets_557595c2e17c9948a9448eb763ac $_MODULE['<{mondialrelay}prestashop>mrcreatetickets_017ca6b770ad53669a4eec82894dfcd3'] = 'Merci de vérifier la configuration de votre adresse 1'; $_MODULE['<{mondialrelay}prestashop>mrcreatetickets_3f79e1fc66b4f9cca7bd68cab176020d'] = 'Merci de vérifier la configuration de votre ville'; $_MODULE['<{mondialrelay}prestashop>mrcreatetickets_404665d9b65239985d59b30b3dcb26b5'] = 'Merci de vérifier la configuration de votre code postal'; +$_MODULE['<{mondialrelay}prestashop>mrcreatetickets_74cb73eddbe6eaf556023f943fc7e1fd'] = 'Il semble que le format du code postal ne soit pas configuré ou que vous n\'avez pas défini de code postal valide'; $_MODULE['<{mondialrelay}prestashop>mrcreatetickets_0b8a30478b9572b86718989d483fd88d'] = 'Merci de vérifier la configuration de votre pays'; $_MODULE['<{mondialrelay}prestashop>mrcreatetickets_7ddf2d94bf037b7d1088c0600ea589c3'] = 'Merci de vérifier la configuration de votre téléphone'; $_MODULE['<{mondialrelay}prestashop>mrcreatetickets_9c7ce7be9a2c593b24d448edb4f804e0'] = 'Merci de vérifier la configuration de votre email'; diff --git a/modules/mondialrelay/images/help.png b/modules/mondialrelay/images/help.png new file mode 100644 index 000000000..04d4851da Binary files /dev/null and b/modules/mondialrelay/images/help.png differ diff --git a/modules/mondialrelay/jquery-1.4.4.min.js b/modules/mondialrelay/jquery-1.4.4.min.js deleted file mode 100644 index 8f3ca2e2d..000000000 --- a/modules/mondialrelay/jquery-1.4.4.min.js +++ /dev/null @@ -1,167 +0,0 @@ -/*! - * jQuery JavaScript Library v1.4.4 - * http://jquery.com/ - * - * Copyright 2010, John Resig - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * Includes Sizzle.js - * http://sizzlejs.com/ - * Copyright 2010, The Dojo Foundation - * Released under the MIT, BSD, and GPL Licenses. - * - * Date: Thu Nov 11 19:04:53 2010 -0500 - */ -(function(E,B){function ka(a,b,d){if(d===B&&a.nodeType===1){d=a.getAttribute("data-"+b);if(typeof d==="string"){try{d=d==="true"?true:d==="false"?false:d==="null"?null:!c.isNaN(d)?parseFloat(d):Ja.test(d)?c.parseJSON(d):d}catch(e){}c.data(a,b,d)}else d=B}return d}function U(){return false}function ca(){return true}function la(a,b,d){d[0].type=a;return c.event.handle.apply(b,d)}function Ka(a){var b,d,e,f,h,l,k,o,x,r,A,C=[];f=[];h=c.data(this,this.nodeType?"events":"__events__");if(typeof h==="function")h= -h.events;if(!(a.liveFired===this||!h||!h.live||a.button&&a.type==="click")){if(a.namespace)A=RegExp("(^|\\.)"+a.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)");a.liveFired=this;var J=h.live.slice(0);for(k=0;k<J.length;k++){h=J[k];h.origType.replace(X,"")===a.type?f.push(h.selector):J.splice(k--,1)}f=c(a.target).closest(f,a.currentTarget);o=0;for(x=f.length;o<x;o++){r=f[o];for(k=0;k<J.length;k++){h=J[k];if(r.selector===h.selector&&(!A||A.test(h.namespace))){l=r.elem;e=null;if(h.preType==="mouseenter"|| -h.preType==="mouseleave"){a.type=h.preType;e=c(a.relatedTarget).closest(h.selector)[0]}if(!e||e!==l)C.push({elem:l,handleObj:h,level:r.level})}}}o=0;for(x=C.length;o<x;o++){f=C[o];if(d&&f.level>d)break;a.currentTarget=f.elem;a.data=f.handleObj.data;a.handleObj=f.handleObj;A=f.handleObj.origHandler.apply(f.elem,arguments);if(A===false||a.isPropagationStopped()){d=f.level;if(A===false)b=false;if(a.isImmediatePropagationStopped())break}}return b}}function Y(a,b){return(a&&a!=="*"?a+".":"")+b.replace(La, -"`").replace(Ma,"&")}function ma(a,b,d){if(c.isFunction(b))return c.grep(a,function(f,h){return!!b.call(f,h,f)===d});else if(b.nodeType)return c.grep(a,function(f){return f===b===d});else if(typeof b==="string"){var e=c.grep(a,function(f){return f.nodeType===1});if(Na.test(b))return c.filter(b,e,!d);else b=c.filter(b,e)}return c.grep(a,function(f){return c.inArray(f,b)>=0===d})}function na(a,b){var d=0;b.each(function(){if(this.nodeName===(a[d]&&a[d].nodeName)){var e=c.data(a[d++]),f=c.data(this, -e);if(e=e&&e.events){delete f.handle;f.events={};for(var h in e)for(var l in e[h])c.event.add(this,h,e[h][l],e[h][l].data)}}})}function Oa(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}function oa(a,b,d){var e=b==="width"?a.offsetWidth:a.offsetHeight;if(d==="border")return e;c.each(b==="width"?Pa:Qa,function(){d||(e-=parseFloat(c.css(a,"padding"+this))||0);if(d==="margin")e+=parseFloat(c.css(a, -"margin"+this))||0;else e-=parseFloat(c.css(a,"border"+this+"Width"))||0});return e}function da(a,b,d,e){if(c.isArray(b)&&b.length)c.each(b,function(f,h){d||Ra.test(a)?e(a,h):da(a+"["+(typeof h==="object"||c.isArray(h)?f:"")+"]",h,d,e)});else if(!d&&b!=null&&typeof b==="object")c.isEmptyObject(b)?e(a,""):c.each(b,function(f,h){da(a+"["+f+"]",h,d,e)});else e(a,b)}function S(a,b){var d={};c.each(pa.concat.apply([],pa.slice(0,b)),function(){d[this]=a});return d}function qa(a){if(!ea[a]){var b=c("<"+ -a+">").appendTo("body"),d=b.css("display");b.remove();if(d==="none"||d==="")d="block";ea[a]=d}return ea[a]}function fa(a){return c.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:false}var t=E.document,c=function(){function a(){if(!b.isReady){try{t.documentElement.doScroll("left")}catch(j){setTimeout(a,1);return}b.ready()}}var b=function(j,s){return new b.fn.init(j,s)},d=E.jQuery,e=E.$,f,h=/^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/,l=/\S/,k=/^\s+/,o=/\s+$/,x=/\W/,r=/\d/,A=/^<(\w+)\s*\/?>(?:<\/\1>)?$/, -C=/^[\],:{}\s]*$/,J=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,w=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,I=/(?:^|:|,)(?:\s*\[)+/g,L=/(webkit)[ \/]([\w.]+)/,g=/(opera)(?:.*version)?[ \/]([\w.]+)/,i=/(msie) ([\w.]+)/,n=/(mozilla)(?:.*? rv:([\w.]+))?/,m=navigator.userAgent,p=false,q=[],u,y=Object.prototype.toString,F=Object.prototype.hasOwnProperty,M=Array.prototype.push,N=Array.prototype.slice,O=String.prototype.trim,D=Array.prototype.indexOf,R={};b.fn=b.prototype={init:function(j, -s){var v,z,H;if(!j)return this;if(j.nodeType){this.context=this[0]=j;this.length=1;return this}if(j==="body"&&!s&&t.body){this.context=t;this[0]=t.body;this.selector="body";this.length=1;return this}if(typeof j==="string")if((v=h.exec(j))&&(v[1]||!s))if(v[1]){H=s?s.ownerDocument||s:t;if(z=A.exec(j))if(b.isPlainObject(s)){j=[t.createElement(z[1])];b.fn.attr.call(j,s,true)}else j=[H.createElement(z[1])];else{z=b.buildFragment([v[1]],[H]);j=(z.cacheable?z.fragment.cloneNode(true):z.fragment).childNodes}return b.merge(this, -j)}else{if((z=t.getElementById(v[2]))&&z.parentNode){if(z.id!==v[2])return f.find(j);this.length=1;this[0]=z}this.context=t;this.selector=j;return this}else if(!s&&!x.test(j)){this.selector=j;this.context=t;j=t.getElementsByTagName(j);return b.merge(this,j)}else return!s||s.jquery?(s||f).find(j):b(s).find(j);else if(b.isFunction(j))return f.ready(j);if(j.selector!==B){this.selector=j.selector;this.context=j.context}return b.makeArray(j,this)},selector:"",jquery:"1.4.4",length:0,size:function(){return this.length}, -toArray:function(){return N.call(this,0)},get:function(j){return j==null?this.toArray():j<0?this.slice(j)[0]:this[j]},pushStack:function(j,s,v){var z=b();b.isArray(j)?M.apply(z,j):b.merge(z,j);z.prevObject=this;z.context=this.context;if(s==="find")z.selector=this.selector+(this.selector?" ":"")+v;else if(s)z.selector=this.selector+"."+s+"("+v+")";return z},each:function(j,s){return b.each(this,j,s)},ready:function(j){b.bindReady();if(b.isReady)j.call(t,b);else q&&q.push(j);return this},eq:function(j){return j=== --1?this.slice(j):this.slice(j,+j+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(N.apply(this,arguments),"slice",N.call(arguments).join(","))},map:function(j){return this.pushStack(b.map(this,function(s,v){return j.call(s,v,s)}))},end:function(){return this.prevObject||b(null)},push:M,sort:[].sort,splice:[].splice};b.fn.init.prototype=b.fn;b.extend=b.fn.extend=function(){var j,s,v,z,H,G=arguments[0]||{},K=1,Q=arguments.length,ga=false; -if(typeof G==="boolean"){ga=G;G=arguments[1]||{};K=2}if(typeof G!=="object"&&!b.isFunction(G))G={};if(Q===K){G=this;--K}for(;K<Q;K++)if((j=arguments[K])!=null)for(s in j){v=G[s];z=j[s];if(G!==z)if(ga&&z&&(b.isPlainObject(z)||(H=b.isArray(z)))){if(H){H=false;v=v&&b.isArray(v)?v:[]}else v=v&&b.isPlainObject(v)?v:{};G[s]=b.extend(ga,v,z)}else if(z!==B)G[s]=z}return G};b.extend({noConflict:function(j){E.$=e;if(j)E.jQuery=d;return b},isReady:false,readyWait:1,ready:function(j){j===true&&b.readyWait--; -if(!b.readyWait||j!==true&&!b.isReady){if(!t.body)return setTimeout(b.ready,1);b.isReady=true;if(!(j!==true&&--b.readyWait>0))if(q){var s=0,v=q;for(q=null;j=v[s++];)j.call(t,b);b.fn.trigger&&b(t).trigger("ready").unbind("ready")}}},bindReady:function(){if(!p){p=true;if(t.readyState==="complete")return setTimeout(b.ready,1);if(t.addEventListener){t.addEventListener("DOMContentLoaded",u,false);E.addEventListener("load",b.ready,false)}else if(t.attachEvent){t.attachEvent("onreadystatechange",u);E.attachEvent("onload", -b.ready);var j=false;try{j=E.frameElement==null}catch(s){}t.documentElement.doScroll&&j&&a()}}},isFunction:function(j){return b.type(j)==="function"},isArray:Array.isArray||function(j){return b.type(j)==="array"},isWindow:function(j){return j&&typeof j==="object"&&"setInterval"in j},isNaN:function(j){return j==null||!r.test(j)||isNaN(j)},type:function(j){return j==null?String(j):R[y.call(j)]||"object"},isPlainObject:function(j){if(!j||b.type(j)!=="object"||j.nodeType||b.isWindow(j))return false;if(j.constructor&& -!F.call(j,"constructor")&&!F.call(j.constructor.prototype,"isPrototypeOf"))return false;for(var s in j);return s===B||F.call(j,s)},isEmptyObject:function(j){for(var s in j)return false;return true},error:function(j){throw j;},parseJSON:function(j){if(typeof j!=="string"||!j)return null;j=b.trim(j);if(C.test(j.replace(J,"@").replace(w,"]").replace(I,"")))return E.JSON&&E.JSON.parse?E.JSON.parse(j):(new Function("return "+j))();else b.error("Invalid JSON: "+j)},noop:function(){},globalEval:function(j){if(j&& -l.test(j)){var s=t.getElementsByTagName("head")[0]||t.documentElement,v=t.createElement("script");v.type="text/javascript";if(b.support.scriptEval)v.appendChild(t.createTextNode(j));else v.text=j;s.insertBefore(v,s.firstChild);s.removeChild(v)}},nodeName:function(j,s){return j.nodeName&&j.nodeName.toUpperCase()===s.toUpperCase()},each:function(j,s,v){var z,H=0,G=j.length,K=G===B||b.isFunction(j);if(v)if(K)for(z in j){if(s.apply(j[z],v)===false)break}else for(;H<G;){if(s.apply(j[H++],v)===false)break}else if(K)for(z in j){if(s.call(j[z], -z,j[z])===false)break}else for(v=j[0];H<G&&s.call(v,H,v)!==false;v=j[++H]);return j},trim:O?function(j){return j==null?"":O.call(j)}:function(j){return j==null?"":j.toString().replace(k,"").replace(o,"")},makeArray:function(j,s){var v=s||[];if(j!=null){var z=b.type(j);j.length==null||z==="string"||z==="function"||z==="regexp"||b.isWindow(j)?M.call(v,j):b.merge(v,j)}return v},inArray:function(j,s){if(s.indexOf)return s.indexOf(j);for(var v=0,z=s.length;v<z;v++)if(s[v]===j)return v;return-1},merge:function(j, -s){var v=j.length,z=0;if(typeof s.length==="number")for(var H=s.length;z<H;z++)j[v++]=s[z];else for(;s[z]!==B;)j[v++]=s[z++];j.length=v;return j},grep:function(j,s,v){var z=[],H;v=!!v;for(var G=0,K=j.length;G<K;G++){H=!!s(j[G],G);v!==H&&z.push(j[G])}return z},map:function(j,s,v){for(var z=[],H,G=0,K=j.length;G<K;G++){H=s(j[G],G,v);if(H!=null)z[z.length]=H}return z.concat.apply([],z)},guid:1,proxy:function(j,s,v){if(arguments.length===2)if(typeof s==="string"){v=j;j=v[s];s=B}else if(s&&!b.isFunction(s)){v= -s;s=B}if(!s&&j)s=function(){return j.apply(v||this,arguments)};if(j)s.guid=j.guid=j.guid||s.guid||b.guid++;return s},access:function(j,s,v,z,H,G){var K=j.length;if(typeof s==="object"){for(var Q in s)b.access(j,Q,s[Q],z,H,v);return j}if(v!==B){z=!G&&z&&b.isFunction(v);for(Q=0;Q<K;Q++)H(j[Q],s,z?v.call(j[Q],Q,H(j[Q],s)):v,G);return j}return K?H(j[0],s):B},now:function(){return(new Date).getTime()},uaMatch:function(j){j=j.toLowerCase();j=L.exec(j)||g.exec(j)||i.exec(j)||j.indexOf("compatible")<0&&n.exec(j)|| -[];return{browser:j[1]||"",version:j[2]||"0"}},browser:{}});b.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(j,s){R["[object "+s+"]"]=s.toLowerCase()});m=b.uaMatch(m);if(m.browser){b.browser[m.browser]=true;b.browser.version=m.version}if(b.browser.webkit)b.browser.safari=true;if(D)b.inArray=function(j,s){return D.call(s,j)};if(!/\s/.test("\u00a0")){k=/^[\s\xA0]+/;o=/[\s\xA0]+$/}f=b(t);if(t.addEventListener)u=function(){t.removeEventListener("DOMContentLoaded",u, -false);b.ready()};else if(t.attachEvent)u=function(){if(t.readyState==="complete"){t.detachEvent("onreadystatechange",u);b.ready()}};return E.jQuery=E.$=b}();(function(){c.support={};var a=t.documentElement,b=t.createElement("script"),d=t.createElement("div"),e="script"+c.now();d.style.display="none";d.innerHTML=" <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";var f=d.getElementsByTagName("*"),h=d.getElementsByTagName("a")[0],l=t.createElement("select"), -k=l.appendChild(t.createElement("option"));if(!(!f||!f.length||!h)){c.support={leadingWhitespace:d.firstChild.nodeType===3,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/red/.test(h.getAttribute("style")),hrefNormalized:h.getAttribute("href")==="/a",opacity:/^0.55$/.test(h.style.opacity),cssFloat:!!h.style.cssFloat,checkOn:d.getElementsByTagName("input")[0].value==="on",optSelected:k.selected,deleteExpando:true,optDisabled:false,checkClone:false, -scriptEval:false,noCloneEvent:true,boxModel:null,inlineBlockNeedsLayout:false,shrinkWrapBlocks:false,reliableHiddenOffsets:true};l.disabled=true;c.support.optDisabled=!k.disabled;b.type="text/javascript";try{b.appendChild(t.createTextNode("window."+e+"=1;"))}catch(o){}a.insertBefore(b,a.firstChild);if(E[e]){c.support.scriptEval=true;delete E[e]}try{delete b.test}catch(x){c.support.deleteExpando=false}a.removeChild(b);if(d.attachEvent&&d.fireEvent){d.attachEvent("onclick",function r(){c.support.noCloneEvent= -false;d.detachEvent("onclick",r)});d.cloneNode(true).fireEvent("onclick")}d=t.createElement("div");d.innerHTML="<input type='radio' name='radiotest' checked='checked'/>";a=t.createDocumentFragment();a.appendChild(d.firstChild);c.support.checkClone=a.cloneNode(true).cloneNode(true).lastChild.checked;c(function(){var r=t.createElement("div");r.style.width=r.style.paddingLeft="1px";t.body.appendChild(r);c.boxModel=c.support.boxModel=r.offsetWidth===2;if("zoom"in r.style){r.style.display="inline";r.style.zoom= -1;c.support.inlineBlockNeedsLayout=r.offsetWidth===2;r.style.display="";r.innerHTML="<div style='width:4px;'></div>";c.support.shrinkWrapBlocks=r.offsetWidth!==2}r.innerHTML="<table><tr><td style='padding:0;display:none'></td><td>t</td></tr></table>";var A=r.getElementsByTagName("td");c.support.reliableHiddenOffsets=A[0].offsetHeight===0;A[0].style.display="";A[1].style.display="none";c.support.reliableHiddenOffsets=c.support.reliableHiddenOffsets&&A[0].offsetHeight===0;r.innerHTML="";t.body.removeChild(r).style.display= -"none"});a=function(r){var A=t.createElement("div");r="on"+r;var C=r in A;if(!C){A.setAttribute(r,"return;");C=typeof A[r]==="function"}return C};c.support.submitBubbles=a("submit");c.support.changeBubbles=a("change");a=b=d=f=h=null}})();var ra={},Ja=/^(?:\{.*\}|\[.*\])$/;c.extend({cache:{},uuid:0,expando:"jQuery"+c.now(),noData:{embed:true,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:true},data:function(a,b,d){if(c.acceptData(a)){a=a==E?ra:a;var e=a.nodeType,f=e?a[c.expando]:null,h= -c.cache;if(!(e&&!f&&typeof b==="string"&&d===B)){if(e)f||(a[c.expando]=f=++c.uuid);else h=a;if(typeof b==="object")if(e)h[f]=c.extend(h[f],b);else c.extend(h,b);else if(e&&!h[f])h[f]={};a=e?h[f]:h;if(d!==B)a[b]=d;return typeof b==="string"?a[b]:a}}},removeData:function(a,b){if(c.acceptData(a)){a=a==E?ra:a;var d=a.nodeType,e=d?a[c.expando]:a,f=c.cache,h=d?f[e]:e;if(b){if(h){delete h[b];d&&c.isEmptyObject(h)&&c.removeData(a)}}else if(d&&c.support.deleteExpando)delete a[c.expando];else if(a.removeAttribute)a.removeAttribute(c.expando); -else if(d)delete f[e];else for(var l in a)delete a[l]}},acceptData:function(a){if(a.nodeName){var b=c.noData[a.nodeName.toLowerCase()];if(b)return!(b===true||a.getAttribute("classid")!==b)}return true}});c.fn.extend({data:function(a,b){var d=null;if(typeof a==="undefined"){if(this.length){var e=this[0].attributes,f;d=c.data(this[0]);for(var h=0,l=e.length;h<l;h++){f=e[h].name;if(f.indexOf("data-")===0){f=f.substr(5);ka(this[0],f,d[f])}}}return d}else if(typeof a==="object")return this.each(function(){c.data(this, -a)});var k=a.split(".");k[1]=k[1]?"."+k[1]:"";if(b===B){d=this.triggerHandler("getData"+k[1]+"!",[k[0]]);if(d===B&&this.length){d=c.data(this[0],a);d=ka(this[0],a,d)}return d===B&&k[1]?this.data(k[0]):d}else return this.each(function(){var o=c(this),x=[k[0],b];o.triggerHandler("setData"+k[1]+"!",x);c.data(this,a,b);o.triggerHandler("changeData"+k[1]+"!",x)})},removeData:function(a){return this.each(function(){c.removeData(this,a)})}});c.extend({queue:function(a,b,d){if(a){b=(b||"fx")+"queue";var e= -c.data(a,b);if(!d)return e||[];if(!e||c.isArray(d))e=c.data(a,b,c.makeArray(d));else e.push(d);return e}},dequeue:function(a,b){b=b||"fx";var d=c.queue(a,b),e=d.shift();if(e==="inprogress")e=d.shift();if(e){b==="fx"&&d.unshift("inprogress");e.call(a,function(){c.dequeue(a,b)})}}});c.fn.extend({queue:function(a,b){if(typeof a!=="string"){b=a;a="fx"}if(b===B)return c.queue(this[0],a);return this.each(function(){var d=c.queue(this,a,b);a==="fx"&&d[0]!=="inprogress"&&c.dequeue(this,a)})},dequeue:function(a){return this.each(function(){c.dequeue(this, -a)})},delay:function(a,b){a=c.fx?c.fx.speeds[a]||a:a;b=b||"fx";return this.queue(b,function(){var d=this;setTimeout(function(){c.dequeue(d,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])}});var sa=/[\n\t]/g,ha=/\s+/,Sa=/\r/g,Ta=/^(?:href|src|style)$/,Ua=/^(?:button|input)$/i,Va=/^(?:button|input|object|select|textarea)$/i,Wa=/^a(?:rea)?$/i,ta=/^(?:radio|checkbox)$/i;c.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan", -colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};c.fn.extend({attr:function(a,b){return c.access(this,a,b,true,c.attr)},removeAttr:function(a){return this.each(function(){c.attr(this,a,"");this.nodeType===1&&this.removeAttribute(a)})},addClass:function(a){if(c.isFunction(a))return this.each(function(x){var r=c(this);r.addClass(a.call(this,x,r.attr("class")))});if(a&&typeof a==="string")for(var b=(a||"").split(ha),d=0,e=this.length;d<e;d++){var f=this[d];if(f.nodeType=== -1)if(f.className){for(var h=" "+f.className+" ",l=f.className,k=0,o=b.length;k<o;k++)if(h.indexOf(" "+b[k]+" ")<0)l+=" "+b[k];f.className=c.trim(l)}else f.className=a}return this},removeClass:function(a){if(c.isFunction(a))return this.each(function(o){var x=c(this);x.removeClass(a.call(this,o,x.attr("class")))});if(a&&typeof a==="string"||a===B)for(var b=(a||"").split(ha),d=0,e=this.length;d<e;d++){var f=this[d];if(f.nodeType===1&&f.className)if(a){for(var h=(" "+f.className+" ").replace(sa," "), -l=0,k=b.length;l<k;l++)h=h.replace(" "+b[l]+" "," ");f.className=c.trim(h)}else f.className=""}return this},toggleClass:function(a,b){var d=typeof a,e=typeof b==="boolean";if(c.isFunction(a))return this.each(function(f){var h=c(this);h.toggleClass(a.call(this,f,h.attr("class"),b),b)});return this.each(function(){if(d==="string")for(var f,h=0,l=c(this),k=b,o=a.split(ha);f=o[h++];){k=e?k:!l.hasClass(f);l[k?"addClass":"removeClass"](f)}else if(d==="undefined"||d==="boolean"){this.className&&c.data(this, -"__className__",this.className);this.className=this.className||a===false?"":c.data(this,"__className__")||""}})},hasClass:function(a){a=" "+a+" ";for(var b=0,d=this.length;b<d;b++)if((" "+this[b].className+" ").replace(sa," ").indexOf(a)>-1)return true;return false},val:function(a){if(!arguments.length){var b=this[0];if(b){if(c.nodeName(b,"option")){var d=b.attributes.value;return!d||d.specified?b.value:b.text}if(c.nodeName(b,"select")){var e=b.selectedIndex;d=[];var f=b.options;b=b.type==="select-one"; -if(e<0)return null;var h=b?e:0;for(e=b?e+1:f.length;h<e;h++){var l=f[h];if(l.selected&&(c.support.optDisabled?!l.disabled:l.getAttribute("disabled")===null)&&(!l.parentNode.disabled||!c.nodeName(l.parentNode,"optgroup"))){a=c(l).val();if(b)return a;d.push(a)}}return d}if(ta.test(b.type)&&!c.support.checkOn)return b.getAttribute("value")===null?"on":b.value;return(b.value||"").replace(Sa,"")}return B}var k=c.isFunction(a);return this.each(function(o){var x=c(this),r=a;if(this.nodeType===1){if(k)r= -a.call(this,o,x.val());if(r==null)r="";else if(typeof r==="number")r+="";else if(c.isArray(r))r=c.map(r,function(C){return C==null?"":C+""});if(c.isArray(r)&&ta.test(this.type))this.checked=c.inArray(x.val(),r)>=0;else if(c.nodeName(this,"select")){var A=c.makeArray(r);c("option",this).each(function(){this.selected=c.inArray(c(this).val(),A)>=0});if(!A.length)this.selectedIndex=-1}else this.value=r}})}});c.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true}, -attr:function(a,b,d,e){if(!a||a.nodeType===3||a.nodeType===8)return B;if(e&&b in c.attrFn)return c(a)[b](d);e=a.nodeType!==1||!c.isXMLDoc(a);var f=d!==B;b=e&&c.props[b]||b;var h=Ta.test(b);if((b in a||a[b]!==B)&&e&&!h){if(f){b==="type"&&Ua.test(a.nodeName)&&a.parentNode&&c.error("type property can't be changed");if(d===null)a.nodeType===1&&a.removeAttribute(b);else a[b]=d}if(c.nodeName(a,"form")&&a.getAttributeNode(b))return a.getAttributeNode(b).nodeValue;if(b==="tabIndex")return(b=a.getAttributeNode("tabIndex"))&& -b.specified?b.value:Va.test(a.nodeName)||Wa.test(a.nodeName)&&a.href?0:B;return a[b]}if(!c.support.style&&e&&b==="style"){if(f)a.style.cssText=""+d;return a.style.cssText}f&&a.setAttribute(b,""+d);if(!a.attributes[b]&&a.hasAttribute&&!a.hasAttribute(b))return B;a=!c.support.hrefNormalized&&e&&h?a.getAttribute(b,2):a.getAttribute(b);return a===null?B:a}});var X=/\.(.*)$/,ia=/^(?:textarea|input|select)$/i,La=/\./g,Ma=/ /g,Xa=/[^\w\s.|`]/g,Ya=function(a){return a.replace(Xa,"\\$&")},ua={focusin:0,focusout:0}; -c.event={add:function(a,b,d,e){if(!(a.nodeType===3||a.nodeType===8)){if(c.isWindow(a)&&a!==E&&!a.frameElement)a=E;if(d===false)d=U;else if(!d)return;var f,h;if(d.handler){f=d;d=f.handler}if(!d.guid)d.guid=c.guid++;if(h=c.data(a)){var l=a.nodeType?"events":"__events__",k=h[l],o=h.handle;if(typeof k==="function"){o=k.handle;k=k.events}else if(!k){a.nodeType||(h[l]=h=function(){});h.events=k={}}if(!o)h.handle=o=function(){return typeof c!=="undefined"&&!c.event.triggered?c.event.handle.apply(o.elem, -arguments):B};o.elem=a;b=b.split(" ");for(var x=0,r;l=b[x++];){h=f?c.extend({},f):{handler:d,data:e};if(l.indexOf(".")>-1){r=l.split(".");l=r.shift();h.namespace=r.slice(0).sort().join(".")}else{r=[];h.namespace=""}h.type=l;if(!h.guid)h.guid=d.guid;var A=k[l],C=c.event.special[l]||{};if(!A){A=k[l]=[];if(!C.setup||C.setup.call(a,e,r,o)===false)if(a.addEventListener)a.addEventListener(l,o,false);else a.attachEvent&&a.attachEvent("on"+l,o)}if(C.add){C.add.call(a,h);if(!h.handler.guid)h.handler.guid= -d.guid}A.push(h);c.event.global[l]=true}a=null}}},global:{},remove:function(a,b,d,e){if(!(a.nodeType===3||a.nodeType===8)){if(d===false)d=U;var f,h,l=0,k,o,x,r,A,C,J=a.nodeType?"events":"__events__",w=c.data(a),I=w&&w[J];if(w&&I){if(typeof I==="function"){w=I;I=I.events}if(b&&b.type){d=b.handler;b=b.type}if(!b||typeof b==="string"&&b.charAt(0)==="."){b=b||"";for(f in I)c.event.remove(a,f+b)}else{for(b=b.split(" ");f=b[l++];){r=f;k=f.indexOf(".")<0;o=[];if(!k){o=f.split(".");f=o.shift();x=RegExp("(^|\\.)"+ -c.map(o.slice(0).sort(),Ya).join("\\.(?:.*\\.)?")+"(\\.|$)")}if(A=I[f])if(d){r=c.event.special[f]||{};for(h=e||0;h<A.length;h++){C=A[h];if(d.guid===C.guid){if(k||x.test(C.namespace)){e==null&&A.splice(h--,1);r.remove&&r.remove.call(a,C)}if(e!=null)break}}if(A.length===0||e!=null&&A.length===1){if(!r.teardown||r.teardown.call(a,o)===false)c.removeEvent(a,f,w.handle);delete I[f]}}else for(h=0;h<A.length;h++){C=A[h];if(k||x.test(C.namespace)){c.event.remove(a,r,C.handler,h);A.splice(h--,1)}}}if(c.isEmptyObject(I)){if(b= -w.handle)b.elem=null;delete w.events;delete w.handle;if(typeof w==="function")c.removeData(a,J);else c.isEmptyObject(w)&&c.removeData(a)}}}}},trigger:function(a,b,d,e){var f=a.type||a;if(!e){a=typeof a==="object"?a[c.expando]?a:c.extend(c.Event(f),a):c.Event(f);if(f.indexOf("!")>=0){a.type=f=f.slice(0,-1);a.exclusive=true}if(!d){a.stopPropagation();c.event.global[f]&&c.each(c.cache,function(){this.events&&this.events[f]&&c.event.trigger(a,b,this.handle.elem)})}if(!d||d.nodeType===3||d.nodeType=== -8)return B;a.result=B;a.target=d;b=c.makeArray(b);b.unshift(a)}a.currentTarget=d;(e=d.nodeType?c.data(d,"handle"):(c.data(d,"__events__")||{}).handle)&&e.apply(d,b);e=d.parentNode||d.ownerDocument;try{if(!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()]))if(d["on"+f]&&d["on"+f].apply(d,b)===false){a.result=false;a.preventDefault()}}catch(h){}if(!a.isPropagationStopped()&&e)c.event.trigger(a,b,e,true);else if(!a.isDefaultPrevented()){var l;e=a.target;var k=f.replace(X,""),o=c.nodeName(e,"a")&&k=== -"click",x=c.event.special[k]||{};if((!x._default||x._default.call(d,a)===false)&&!o&&!(e&&e.nodeName&&c.noData[e.nodeName.toLowerCase()])){try{if(e[k]){if(l=e["on"+k])e["on"+k]=null;c.event.triggered=true;e[k]()}}catch(r){}if(l)e["on"+k]=l;c.event.triggered=false}}},handle:function(a){var b,d,e,f;d=[];var h=c.makeArray(arguments);a=h[0]=c.event.fix(a||E.event);a.currentTarget=this;b=a.type.indexOf(".")<0&&!a.exclusive;if(!b){e=a.type.split(".");a.type=e.shift();d=e.slice(0).sort();e=RegExp("(^|\\.)"+ -d.join("\\.(?:.*\\.)?")+"(\\.|$)")}a.namespace=a.namespace||d.join(".");f=c.data(this,this.nodeType?"events":"__events__");if(typeof f==="function")f=f.events;d=(f||{})[a.type];if(f&&d){d=d.slice(0);f=0;for(var l=d.length;f<l;f++){var k=d[f];if(b||e.test(k.namespace)){a.handler=k.handler;a.data=k.data;a.handleObj=k;k=k.handler.apply(this,h);if(k!==B){a.result=k;if(k===false){a.preventDefault();a.stopPropagation()}}if(a.isImmediatePropagationStopped())break}}}return a.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "), -fix:function(a){if(a[c.expando])return a;var b=a;a=c.Event(b);for(var d=this.props.length,e;d;){e=this.props[--d];a[e]=b[e]}if(!a.target)a.target=a.srcElement||t;if(a.target.nodeType===3)a.target=a.target.parentNode;if(!a.relatedTarget&&a.fromElement)a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement;if(a.pageX==null&&a.clientX!=null){b=t.documentElement;d=t.body;a.pageX=a.clientX+(b&&b.scrollLeft||d&&d.scrollLeft||0)-(b&&b.clientLeft||d&&d.clientLeft||0);a.pageY=a.clientY+(b&&b.scrollTop|| -d&&d.scrollTop||0)-(b&&b.clientTop||d&&d.clientTop||0)}if(a.which==null&&(a.charCode!=null||a.keyCode!=null))a.which=a.charCode!=null?a.charCode:a.keyCode;if(!a.metaKey&&a.ctrlKey)a.metaKey=a.ctrlKey;if(!a.which&&a.button!==B)a.which=a.button&1?1:a.button&2?3:a.button&4?2:0;return a},guid:1E8,proxy:c.proxy,special:{ready:{setup:c.bindReady,teardown:c.noop},live:{add:function(a){c.event.add(this,Y(a.origType,a.selector),c.extend({},a,{handler:Ka,guid:a.handler.guid}))},remove:function(a){c.event.remove(this, -Y(a.origType,a.selector),a)}},beforeunload:{setup:function(a,b,d){if(c.isWindow(this))this.onbeforeunload=d},teardown:function(a,b){if(this.onbeforeunload===b)this.onbeforeunload=null}}}};c.removeEvent=t.removeEventListener?function(a,b,d){a.removeEventListener&&a.removeEventListener(b,d,false)}:function(a,b,d){a.detachEvent&&a.detachEvent("on"+b,d)};c.Event=function(a){if(!this.preventDefault)return new c.Event(a);if(a&&a.type){this.originalEvent=a;this.type=a.type}else this.type=a;this.timeStamp= -c.now();this[c.expando]=true};c.Event.prototype={preventDefault:function(){this.isDefaultPrevented=ca;var a=this.originalEvent;if(a)if(a.preventDefault)a.preventDefault();else a.returnValue=false},stopPropagation:function(){this.isPropagationStopped=ca;var a=this.originalEvent;if(a){a.stopPropagation&&a.stopPropagation();a.cancelBubble=true}},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=ca;this.stopPropagation()},isDefaultPrevented:U,isPropagationStopped:U,isImmediatePropagationStopped:U}; -var va=function(a){var b=a.relatedTarget;try{for(;b&&b!==this;)b=b.parentNode;if(b!==this){a.type=a.data;c.event.handle.apply(this,arguments)}}catch(d){}},wa=function(a){a.type=a.data;c.event.handle.apply(this,arguments)};c.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){c.event.special[a]={setup:function(d){c.event.add(this,b,d&&d.selector?wa:va,a)},teardown:function(d){c.event.remove(this,b,d&&d.selector?wa:va)}}});if(!c.support.submitBubbles)c.event.special.submit={setup:function(){if(this.nodeName.toLowerCase()!== -"form"){c.event.add(this,"click.specialSubmit",function(a){var b=a.target,d=b.type;if((d==="submit"||d==="image")&&c(b).closest("form").length){a.liveFired=B;return la("submit",this,arguments)}});c.event.add(this,"keypress.specialSubmit",function(a){var b=a.target,d=b.type;if((d==="text"||d==="password")&&c(b).closest("form").length&&a.keyCode===13){a.liveFired=B;return la("submit",this,arguments)}})}else return false},teardown:function(){c.event.remove(this,".specialSubmit")}};if(!c.support.changeBubbles){var V, -xa=function(a){var b=a.type,d=a.value;if(b==="radio"||b==="checkbox")d=a.checked;else if(b==="select-multiple")d=a.selectedIndex>-1?c.map(a.options,function(e){return e.selected}).join("-"):"";else if(a.nodeName.toLowerCase()==="select")d=a.selectedIndex;return d},Z=function(a,b){var d=a.target,e,f;if(!(!ia.test(d.nodeName)||d.readOnly)){e=c.data(d,"_change_data");f=xa(d);if(a.type!=="focusout"||d.type!=="radio")c.data(d,"_change_data",f);if(!(e===B||f===e))if(e!=null||f){a.type="change";a.liveFired= -B;return c.event.trigger(a,b,d)}}};c.event.special.change={filters:{focusout:Z,beforedeactivate:Z,click:function(a){var b=a.target,d=b.type;if(d==="radio"||d==="checkbox"||b.nodeName.toLowerCase()==="select")return Z.call(this,a)},keydown:function(a){var b=a.target,d=b.type;if(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(d==="checkbox"||d==="radio")||d==="select-multiple")return Z.call(this,a)},beforeactivate:function(a){a=a.target;c.data(a,"_change_data",xa(a))}},setup:function(){if(this.type=== -"file")return false;for(var a in V)c.event.add(this,a+".specialChange",V[a]);return ia.test(this.nodeName)},teardown:function(){c.event.remove(this,".specialChange");return ia.test(this.nodeName)}};V=c.event.special.change.filters;V.focus=V.beforeactivate}t.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(e){e=c.event.fix(e);e.type=b;return c.event.trigger(e,null,e.target)}c.event.special[b]={setup:function(){ua[b]++===0&&t.addEventListener(a,d,true)},teardown:function(){--ua[b]=== -0&&t.removeEventListener(a,d,true)}}});c.each(["bind","one"],function(a,b){c.fn[b]=function(d,e,f){if(typeof d==="object"){for(var h in d)this[b](h,e,d[h],f);return this}if(c.isFunction(e)||e===false){f=e;e=B}var l=b==="one"?c.proxy(f,function(o){c(this).unbind(o,l);return f.apply(this,arguments)}):f;if(d==="unload"&&b!=="one")this.one(d,e,f);else{h=0;for(var k=this.length;h<k;h++)c.event.add(this[h],d,l,e)}return this}});c.fn.extend({unbind:function(a,b){if(typeof a==="object"&&!a.preventDefault)for(var d in a)this.unbind(d, -a[d]);else{d=0;for(var e=this.length;d<e;d++)c.event.remove(this[d],a,b)}return this},delegate:function(a,b,d,e){return this.live(b,d,e,a)},undelegate:function(a,b,d){return arguments.length===0?this.unbind("live"):this.die(b,null,d,a)},trigger:function(a,b){return this.each(function(){c.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0]){var d=c.Event(a);d.preventDefault();d.stopPropagation();c.event.trigger(d,b,this[0]);return d.result}},toggle:function(a){for(var b=arguments,d= -1;d<b.length;)c.proxy(a,b[d++]);return this.click(c.proxy(a,function(e){var f=(c.data(this,"lastToggle"+a.guid)||0)%d;c.data(this,"lastToggle"+a.guid,f+1);e.preventDefault();return b[f].apply(this,arguments)||false}))},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}});var ya={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};c.each(["live","die"],function(a,b){c.fn[b]=function(d,e,f,h){var l,k=0,o,x,r=h||this.selector;h=h?this:c(this.context);if(typeof d=== -"object"&&!d.preventDefault){for(l in d)h[b](l,e,d[l],r);return this}if(c.isFunction(e)){f=e;e=B}for(d=(d||"").split(" ");(l=d[k++])!=null;){o=X.exec(l);x="";if(o){x=o[0];l=l.replace(X,"")}if(l==="hover")d.push("mouseenter"+x,"mouseleave"+x);else{o=l;if(l==="focus"||l==="blur"){d.push(ya[l]+x);l+=x}else l=(ya[l]||l)+x;if(b==="live"){x=0;for(var A=h.length;x<A;x++)c.event.add(h[x],"live."+Y(l,r),{data:e,selector:r,handler:f,origType:l,origHandler:f,preType:o})}else h.unbind("live."+Y(l,r),f)}}return this}}); -c.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error".split(" "),function(a,b){c.fn[b]=function(d,e){if(e==null){e=d;d=null}return arguments.length>0?this.bind(b,d,e):this.trigger(b)};if(c.attrFn)c.attrFn[b]=true});E.attachEvent&&!E.addEventListener&&c(E).bind("unload",function(){for(var a in c.cache)if(c.cache[a].handle)try{c.event.remove(c.cache[a].handle.elem)}catch(b){}}); -(function(){function a(g,i,n,m,p,q){p=0;for(var u=m.length;p<u;p++){var y=m[p];if(y){var F=false;for(y=y[g];y;){if(y.sizcache===n){F=m[y.sizset];break}if(y.nodeType===1&&!q){y.sizcache=n;y.sizset=p}if(y.nodeName.toLowerCase()===i){F=y;break}y=y[g]}m[p]=F}}}function b(g,i,n,m,p,q){p=0;for(var u=m.length;p<u;p++){var y=m[p];if(y){var F=false;for(y=y[g];y;){if(y.sizcache===n){F=m[y.sizset];break}if(y.nodeType===1){if(!q){y.sizcache=n;y.sizset=p}if(typeof i!=="string"){if(y===i){F=true;break}}else if(k.filter(i, -[y]).length>0){F=y;break}}y=y[g]}m[p]=F}}}var d=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,e=0,f=Object.prototype.toString,h=false,l=true;[0,0].sort(function(){l=false;return 0});var k=function(g,i,n,m){n=n||[];var p=i=i||t;if(i.nodeType!==1&&i.nodeType!==9)return[];if(!g||typeof g!=="string")return n;var q,u,y,F,M,N=true,O=k.isXML(i),D=[],R=g;do{d.exec("");if(q=d.exec(R)){R=q[3];D.push(q[1]);if(q[2]){F=q[3]; -break}}}while(q);if(D.length>1&&x.exec(g))if(D.length===2&&o.relative[D[0]])u=L(D[0]+D[1],i);else for(u=o.relative[D[0]]?[i]:k(D.shift(),i);D.length;){g=D.shift();if(o.relative[g])g+=D.shift();u=L(g,u)}else{if(!m&&D.length>1&&i.nodeType===9&&!O&&o.match.ID.test(D[0])&&!o.match.ID.test(D[D.length-1])){q=k.find(D.shift(),i,O);i=q.expr?k.filter(q.expr,q.set)[0]:q.set[0]}if(i){q=m?{expr:D.pop(),set:C(m)}:k.find(D.pop(),D.length===1&&(D[0]==="~"||D[0]==="+")&&i.parentNode?i.parentNode:i,O);u=q.expr?k.filter(q.expr, -q.set):q.set;if(D.length>0)y=C(u);else N=false;for(;D.length;){q=M=D.pop();if(o.relative[M])q=D.pop();else M="";if(q==null)q=i;o.relative[M](y,q,O)}}else y=[]}y||(y=u);y||k.error(M||g);if(f.call(y)==="[object Array]")if(N)if(i&&i.nodeType===1)for(g=0;y[g]!=null;g++){if(y[g]&&(y[g]===true||y[g].nodeType===1&&k.contains(i,y[g])))n.push(u[g])}else for(g=0;y[g]!=null;g++)y[g]&&y[g].nodeType===1&&n.push(u[g]);else n.push.apply(n,y);else C(y,n);if(F){k(F,p,n,m);k.uniqueSort(n)}return n};k.uniqueSort=function(g){if(w){h= -l;g.sort(w);if(h)for(var i=1;i<g.length;i++)g[i]===g[i-1]&&g.splice(i--,1)}return g};k.matches=function(g,i){return k(g,null,null,i)};k.matchesSelector=function(g,i){return k(i,null,null,[g]).length>0};k.find=function(g,i,n){var m;if(!g)return[];for(var p=0,q=o.order.length;p<q;p++){var u,y=o.order[p];if(u=o.leftMatch[y].exec(g)){var F=u[1];u.splice(1,1);if(F.substr(F.length-1)!=="\\"){u[1]=(u[1]||"").replace(/\\/g,"");m=o.find[y](u,i,n);if(m!=null){g=g.replace(o.match[y],"");break}}}}m||(m=i.getElementsByTagName("*")); -return{set:m,expr:g}};k.filter=function(g,i,n,m){for(var p,q,u=g,y=[],F=i,M=i&&i[0]&&k.isXML(i[0]);g&&i.length;){for(var N in o.filter)if((p=o.leftMatch[N].exec(g))!=null&&p[2]){var O,D,R=o.filter[N];D=p[1];q=false;p.splice(1,1);if(D.substr(D.length-1)!=="\\"){if(F===y)y=[];if(o.preFilter[N])if(p=o.preFilter[N](p,F,n,y,m,M)){if(p===true)continue}else q=O=true;if(p)for(var j=0;(D=F[j])!=null;j++)if(D){O=R(D,p,j,F);var s=m^!!O;if(n&&O!=null)if(s)q=true;else F[j]=false;else if(s){y.push(D);q=true}}if(O!== -B){n||(F=y);g=g.replace(o.match[N],"");if(!q)return[];break}}}if(g===u)if(q==null)k.error(g);else break;u=g}return F};k.error=function(g){throw"Syntax error, unrecognized expression: "+g;};var o=k.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+\-]*)\))?/, -POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(g){return g.getAttribute("href")}},relative:{"+":function(g,i){var n=typeof i==="string",m=n&&!/\W/.test(i);n=n&&!m;if(m)i=i.toLowerCase();m=0;for(var p=g.length,q;m<p;m++)if(q=g[m]){for(;(q=q.previousSibling)&&q.nodeType!==1;);g[m]=n||q&&q.nodeName.toLowerCase()=== -i?q||false:q===i}n&&k.filter(i,g,true)},">":function(g,i){var n,m=typeof i==="string",p=0,q=g.length;if(m&&!/\W/.test(i))for(i=i.toLowerCase();p<q;p++){if(n=g[p]){n=n.parentNode;g[p]=n.nodeName.toLowerCase()===i?n:false}}else{for(;p<q;p++)if(n=g[p])g[p]=m?n.parentNode:n.parentNode===i;m&&k.filter(i,g,true)}},"":function(g,i,n){var m,p=e++,q=b;if(typeof i==="string"&&!/\W/.test(i)){m=i=i.toLowerCase();q=a}q("parentNode",i,p,g,m,n)},"~":function(g,i,n){var m,p=e++,q=b;if(typeof i==="string"&&!/\W/.test(i)){m= -i=i.toLowerCase();q=a}q("previousSibling",i,p,g,m,n)}},find:{ID:function(g,i,n){if(typeof i.getElementById!=="undefined"&&!n)return(g=i.getElementById(g[1]))&&g.parentNode?[g]:[]},NAME:function(g,i){if(typeof i.getElementsByName!=="undefined"){for(var n=[],m=i.getElementsByName(g[1]),p=0,q=m.length;p<q;p++)m[p].getAttribute("name")===g[1]&&n.push(m[p]);return n.length===0?null:n}},TAG:function(g,i){return i.getElementsByTagName(g[1])}},preFilter:{CLASS:function(g,i,n,m,p,q){g=" "+g[1].replace(/\\/g, -"")+" ";if(q)return g;q=0;for(var u;(u=i[q])!=null;q++)if(u)if(p^(u.className&&(" "+u.className+" ").replace(/[\t\n]/g," ").indexOf(g)>=0))n||m.push(u);else if(n)i[q]=false;return false},ID:function(g){return g[1].replace(/\\/g,"")},TAG:function(g){return g[1].toLowerCase()},CHILD:function(g){if(g[1]==="nth"){var i=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(g[2]==="even"&&"2n"||g[2]==="odd"&&"2n+1"||!/\D/.test(g[2])&&"0n+"+g[2]||g[2]);g[2]=i[1]+(i[2]||1)-0;g[3]=i[3]-0}g[0]=e++;return g},ATTR:function(g,i,n, -m,p,q){i=g[1].replace(/\\/g,"");if(!q&&o.attrMap[i])g[1]=o.attrMap[i];if(g[2]==="~=")g[4]=" "+g[4]+" ";return g},PSEUDO:function(g,i,n,m,p){if(g[1]==="not")if((d.exec(g[3])||"").length>1||/^\w/.test(g[3]))g[3]=k(g[3],null,null,i);else{g=k.filter(g[3],i,n,true^p);n||m.push.apply(m,g);return false}else if(o.match.POS.test(g[0])||o.match.CHILD.test(g[0]))return true;return g},POS:function(g){g.unshift(true);return g}},filters:{enabled:function(g){return g.disabled===false&&g.type!=="hidden"},disabled:function(g){return g.disabled=== -true},checked:function(g){return g.checked===true},selected:function(g){return g.selected===true},parent:function(g){return!!g.firstChild},empty:function(g){return!g.firstChild},has:function(g,i,n){return!!k(n[3],g).length},header:function(g){return/h\d/i.test(g.nodeName)},text:function(g){return"text"===g.type},radio:function(g){return"radio"===g.type},checkbox:function(g){return"checkbox"===g.type},file:function(g){return"file"===g.type},password:function(g){return"password"===g.type},submit:function(g){return"submit"=== -g.type},image:function(g){return"image"===g.type},reset:function(g){return"reset"===g.type},button:function(g){return"button"===g.type||g.nodeName.toLowerCase()==="button"},input:function(g){return/input|select|textarea|button/i.test(g.nodeName)}},setFilters:{first:function(g,i){return i===0},last:function(g,i,n,m){return i===m.length-1},even:function(g,i){return i%2===0},odd:function(g,i){return i%2===1},lt:function(g,i,n){return i<n[3]-0},gt:function(g,i,n){return i>n[3]-0},nth:function(g,i,n){return n[3]- -0===i},eq:function(g,i,n){return n[3]-0===i}},filter:{PSEUDO:function(g,i,n,m){var p=i[1],q=o.filters[p];if(q)return q(g,n,i,m);else if(p==="contains")return(g.textContent||g.innerText||k.getText([g])||"").indexOf(i[3])>=0;else if(p==="not"){i=i[3];n=0;for(m=i.length;n<m;n++)if(i[n]===g)return false;return true}else k.error("Syntax error, unrecognized expression: "+p)},CHILD:function(g,i){var n=i[1],m=g;switch(n){case "only":case "first":for(;m=m.previousSibling;)if(m.nodeType===1)return false;if(n=== -"first")return true;m=g;case "last":for(;m=m.nextSibling;)if(m.nodeType===1)return false;return true;case "nth":n=i[2];var p=i[3];if(n===1&&p===0)return true;var q=i[0],u=g.parentNode;if(u&&(u.sizcache!==q||!g.nodeIndex)){var y=0;for(m=u.firstChild;m;m=m.nextSibling)if(m.nodeType===1)m.nodeIndex=++y;u.sizcache=q}m=g.nodeIndex-p;return n===0?m===0:m%n===0&&m/n>=0}},ID:function(g,i){return g.nodeType===1&&g.getAttribute("id")===i},TAG:function(g,i){return i==="*"&&g.nodeType===1||g.nodeName.toLowerCase()=== -i},CLASS:function(g,i){return(" "+(g.className||g.getAttribute("class"))+" ").indexOf(i)>-1},ATTR:function(g,i){var n=i[1];n=o.attrHandle[n]?o.attrHandle[n](g):g[n]!=null?g[n]:g.getAttribute(n);var m=n+"",p=i[2],q=i[4];return n==null?p==="!=":p==="="?m===q:p==="*="?m.indexOf(q)>=0:p==="~="?(" "+m+" ").indexOf(q)>=0:!q?m&&n!==false:p==="!="?m!==q:p==="^="?m.indexOf(q)===0:p==="$="?m.substr(m.length-q.length)===q:p==="|="?m===q||m.substr(0,q.length+1)===q+"-":false},POS:function(g,i,n,m){var p=o.setFilters[i[2]]; -if(p)return p(g,n,i,m)}}},x=o.match.POS,r=function(g,i){return"\\"+(i-0+1)},A;for(A in o.match){o.match[A]=RegExp(o.match[A].source+/(?![^\[]*\])(?![^\(]*\))/.source);o.leftMatch[A]=RegExp(/(^(?:.|\r|\n)*?)/.source+o.match[A].source.replace(/\\(\d+)/g,r))}var C=function(g,i){g=Array.prototype.slice.call(g,0);if(i){i.push.apply(i,g);return i}return g};try{Array.prototype.slice.call(t.documentElement.childNodes,0)}catch(J){C=function(g,i){var n=0,m=i||[];if(f.call(g)==="[object Array]")Array.prototype.push.apply(m, -g);else if(typeof g.length==="number")for(var p=g.length;n<p;n++)m.push(g[n]);else for(;g[n];n++)m.push(g[n]);return m}}var w,I;if(t.documentElement.compareDocumentPosition)w=function(g,i){if(g===i){h=true;return 0}if(!g.compareDocumentPosition||!i.compareDocumentPosition)return g.compareDocumentPosition?-1:1;return g.compareDocumentPosition(i)&4?-1:1};else{w=function(g,i){var n,m,p=[],q=[];n=g.parentNode;m=i.parentNode;var u=n;if(g===i){h=true;return 0}else if(n===m)return I(g,i);else if(n){if(!m)return 1}else return-1; -for(;u;){p.unshift(u);u=u.parentNode}for(u=m;u;){q.unshift(u);u=u.parentNode}n=p.length;m=q.length;for(u=0;u<n&&u<m;u++)if(p[u]!==q[u])return I(p[u],q[u]);return u===n?I(g,q[u],-1):I(p[u],i,1)};I=function(g,i,n){if(g===i)return n;for(g=g.nextSibling;g;){if(g===i)return-1;g=g.nextSibling}return 1}}k.getText=function(g){for(var i="",n,m=0;g[m];m++){n=g[m];if(n.nodeType===3||n.nodeType===4)i+=n.nodeValue;else if(n.nodeType!==8)i+=k.getText(n.childNodes)}return i};(function(){var g=t.createElement("div"), -i="script"+(new Date).getTime(),n=t.documentElement;g.innerHTML="<a name='"+i+"'/>";n.insertBefore(g,n.firstChild);if(t.getElementById(i)){o.find.ID=function(m,p,q){if(typeof p.getElementById!=="undefined"&&!q)return(p=p.getElementById(m[1]))?p.id===m[1]||typeof p.getAttributeNode!=="undefined"&&p.getAttributeNode("id").nodeValue===m[1]?[p]:B:[]};o.filter.ID=function(m,p){var q=typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id");return m.nodeType===1&&q&&q.nodeValue===p}}n.removeChild(g); -n=g=null})();(function(){var g=t.createElement("div");g.appendChild(t.createComment(""));if(g.getElementsByTagName("*").length>0)o.find.TAG=function(i,n){var m=n.getElementsByTagName(i[1]);if(i[1]==="*"){for(var p=[],q=0;m[q];q++)m[q].nodeType===1&&p.push(m[q]);m=p}return m};g.innerHTML="<a href='#'></a>";if(g.firstChild&&typeof g.firstChild.getAttribute!=="undefined"&&g.firstChild.getAttribute("href")!=="#")o.attrHandle.href=function(i){return i.getAttribute("href",2)};g=null})();t.querySelectorAll&& -function(){var g=k,i=t.createElement("div");i.innerHTML="<p class='TEST'></p>";if(!(i.querySelectorAll&&i.querySelectorAll(".TEST").length===0)){k=function(m,p,q,u){p=p||t;m=m.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!u&&!k.isXML(p))if(p.nodeType===9)try{return C(p.querySelectorAll(m),q)}catch(y){}else if(p.nodeType===1&&p.nodeName.toLowerCase()!=="object"){var F=p.getAttribute("id"),M=F||"__sizzle__";F||p.setAttribute("id",M);try{return C(p.querySelectorAll("#"+M+" "+m),q)}catch(N){}finally{F|| -p.removeAttribute("id")}}return g(m,p,q,u)};for(var n in g)k[n]=g[n];i=null}}();(function(){var g=t.documentElement,i=g.matchesSelector||g.mozMatchesSelector||g.webkitMatchesSelector||g.msMatchesSelector,n=false;try{i.call(t.documentElement,"[test!='']:sizzle")}catch(m){n=true}if(i)k.matchesSelector=function(p,q){q=q.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!k.isXML(p))try{if(n||!o.match.PSEUDO.test(q)&&!/!=/.test(q))return i.call(p,q)}catch(u){}return k(q,null,null,[p]).length>0}})();(function(){var g= -t.createElement("div");g.innerHTML="<div class='test e'></div><div class='test'></div>";if(!(!g.getElementsByClassName||g.getElementsByClassName("e").length===0)){g.lastChild.className="e";if(g.getElementsByClassName("e").length!==1){o.order.splice(1,0,"CLASS");o.find.CLASS=function(i,n,m){if(typeof n.getElementsByClassName!=="undefined"&&!m)return n.getElementsByClassName(i[1])};g=null}}})();k.contains=t.documentElement.contains?function(g,i){return g!==i&&(g.contains?g.contains(i):true)}:t.documentElement.compareDocumentPosition? -function(g,i){return!!(g.compareDocumentPosition(i)&16)}:function(){return false};k.isXML=function(g){return(g=(g?g.ownerDocument||g:0).documentElement)?g.nodeName!=="HTML":false};var L=function(g,i){for(var n,m=[],p="",q=i.nodeType?[i]:i;n=o.match.PSEUDO.exec(g);){p+=n[0];g=g.replace(o.match.PSEUDO,"")}g=o.relative[g]?g+"*":g;n=0;for(var u=q.length;n<u;n++)k(g,q[n],m);return k.filter(p,m)};c.find=k;c.expr=k.selectors;c.expr[":"]=c.expr.filters;c.unique=k.uniqueSort;c.text=k.getText;c.isXMLDoc=k.isXML; -c.contains=k.contains})();var Za=/Until$/,$a=/^(?:parents|prevUntil|prevAll)/,ab=/,/,Na=/^.[^:#\[\.,]*$/,bb=Array.prototype.slice,cb=c.expr.match.POS;c.fn.extend({find:function(a){for(var b=this.pushStack("","find",a),d=0,e=0,f=this.length;e<f;e++){d=b.length;c.find(a,this[e],b);if(e>0)for(var h=d;h<b.length;h++)for(var l=0;l<d;l++)if(b[l]===b[h]){b.splice(h--,1);break}}return b},has:function(a){var b=c(a);return this.filter(function(){for(var d=0,e=b.length;d<e;d++)if(c.contains(this,b[d]))return true})}, -not:function(a){return this.pushStack(ma(this,a,false),"not",a)},filter:function(a){return this.pushStack(ma(this,a,true),"filter",a)},is:function(a){return!!a&&c.filter(a,this).length>0},closest:function(a,b){var d=[],e,f,h=this[0];if(c.isArray(a)){var l,k={},o=1;if(h&&a.length){e=0;for(f=a.length;e<f;e++){l=a[e];k[l]||(k[l]=c.expr.match.POS.test(l)?c(l,b||this.context):l)}for(;h&&h.ownerDocument&&h!==b;){for(l in k){e=k[l];if(e.jquery?e.index(h)>-1:c(h).is(e))d.push({selector:l,elem:h,level:o})}h= -h.parentNode;o++}}return d}l=cb.test(a)?c(a,b||this.context):null;e=0;for(f=this.length;e<f;e++)for(h=this[e];h;)if(l?l.index(h)>-1:c.find.matchesSelector(h,a)){d.push(h);break}else{h=h.parentNode;if(!h||!h.ownerDocument||h===b)break}d=d.length>1?c.unique(d):d;return this.pushStack(d,"closest",a)},index:function(a){if(!a||typeof a==="string")return c.inArray(this[0],a?c(a):this.parent().children());return c.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var d=typeof a==="string"?c(a,b||this.context): -c.makeArray(a),e=c.merge(this.get(),d);return this.pushStack(!d[0]||!d[0].parentNode||d[0].parentNode.nodeType===11||!e[0]||!e[0].parentNode||e[0].parentNode.nodeType===11?e:c.unique(e))},andSelf:function(){return this.add(this.prevObject)}});c.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return c.dir(a,"parentNode")},parentsUntil:function(a,b,d){return c.dir(a,"parentNode",d)},next:function(a){return c.nth(a,2,"nextSibling")},prev:function(a){return c.nth(a, -2,"previousSibling")},nextAll:function(a){return c.dir(a,"nextSibling")},prevAll:function(a){return c.dir(a,"previousSibling")},nextUntil:function(a,b,d){return c.dir(a,"nextSibling",d)},prevUntil:function(a,b,d){return c.dir(a,"previousSibling",d)},siblings:function(a){return c.sibling(a.parentNode.firstChild,a)},children:function(a){return c.sibling(a.firstChild)},contents:function(a){return c.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:c.makeArray(a.childNodes)}},function(a, -b){c.fn[a]=function(d,e){var f=c.map(this,b,d);Za.test(a)||(e=d);if(e&&typeof e==="string")f=c.filter(e,f);f=this.length>1?c.unique(f):f;if((this.length>1||ab.test(e))&&$a.test(a))f=f.reverse();return this.pushStack(f,a,bb.call(arguments).join(","))}});c.extend({filter:function(a,b,d){if(d)a=":not("+a+")";return b.length===1?c.find.matchesSelector(b[0],a)?[b[0]]:[]:c.find.matches(a,b)},dir:function(a,b,d){var e=[];for(a=a[b];a&&a.nodeType!==9&&(d===B||a.nodeType!==1||!c(a).is(d));){a.nodeType===1&& -e.push(a);a=a[b]}return e},nth:function(a,b,d){b=b||1;for(var e=0;a;a=a[d])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){for(var d=[];a;a=a.nextSibling)a.nodeType===1&&a!==b&&d.push(a);return d}});var za=/ jQuery\d+="(?:\d+|null)"/g,$=/^\s+/,Aa=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Ba=/<([\w:]+)/,db=/<tbody/i,eb=/<|&#?\w+;/,Ca=/<(?:script|object|embed|option|style)/i,Da=/checked\s*(?:[^=]|=\s*.checked.)/i,fb=/\=([^="'>\s]+\/)>/g,P={option:[1, -"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]};P.optgroup=P.option;P.tbody=P.tfoot=P.colgroup=P.caption=P.thead;P.th=P.td;if(!c.support.htmlSerialize)P._default=[1,"div<div>","</div>"];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d= -c(this);d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==B)return this.empty().append((this[0]&&this[0].ownerDocument||t).createTextNode(a));return c.text(this)},wrapAll:function(a){if(c.isFunction(a))return this.each(function(d){c(this).wrapAll(a.call(this,d))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var d=this;d.firstChild&&d.firstChild.nodeType===1;)d=d.firstChild;return d}).append(this)}return this}, -wrapInner:function(a){if(c.isFunction(a))return this.each(function(b){c(this).wrapInner(a.call(this,b))});return this.each(function(){var b=c(this),d=b.contents();d.length?d.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){c(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){c.nodeName(this,"body")||c(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.appendChild(a)})}, -prepend:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this)});else if(arguments.length){var a=c(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b, -this.nextSibling)});else if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,c(arguments[0]).toArray());return a}},remove:function(a,b){for(var d=0,e;(e=this[d])!=null;d++)if(!a||c.filter(a,[e]).length){if(!b&&e.nodeType===1){c.cleanData(e.getElementsByTagName("*"));c.cleanData([e])}e.parentNode&&e.parentNode.removeChild(e)}return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++)for(b.nodeType===1&&c.cleanData(b.getElementsByTagName("*"));b.firstChild;)b.removeChild(b.firstChild); -return this},clone:function(a){var b=this.map(function(){if(!c.support.noCloneEvent&&!c.isXMLDoc(this)){var d=this.outerHTML,e=this.ownerDocument;if(!d){d=e.createElement("div");d.appendChild(this.cloneNode(true));d=d.innerHTML}return c.clean([d.replace(za,"").replace(fb,'="$1">').replace($,"")],e)[0]}else return this.cloneNode(true)});if(a===true){na(this,b);na(this.find("*"),b.find("*"))}return b},html:function(a){if(a===B)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(za,""):null; -else if(typeof a==="string"&&!Ca.test(a)&&(c.support.leadingWhitespace||!$.test(a))&&!P[(Ba.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Aa,"<$1></$2>");try{for(var b=0,d=this.length;b<d;b++)if(this[b].nodeType===1){c.cleanData(this[b].getElementsByTagName("*"));this[b].innerHTML=a}}catch(e){this.empty().append(a)}}else c.isFunction(a)?this.each(function(f){var h=c(this);h.html(a.call(this,f,h.html()))}):this.empty().append(a);return this},replaceWith:function(a){if(this[0]&&this[0].parentNode){if(c.isFunction(a))return this.each(function(b){var d= -c(this),e=d.html();d.replaceWith(a.call(this,b,e))});if(typeof a!=="string")a=c(a).detach();return this.each(function(){var b=this.nextSibling,d=this.parentNode;c(this).remove();b?c(b).before(a):c(d).append(a)})}else return this.pushStack(c(c.isFunction(a)?a():a),"replaceWith",a)},detach:function(a){return this.remove(a,true)},domManip:function(a,b,d){var e,f,h,l=a[0],k=[];if(!c.support.checkClone&&arguments.length===3&&typeof l==="string"&&Da.test(l))return this.each(function(){c(this).domManip(a, -b,d,true)});if(c.isFunction(l))return this.each(function(x){var r=c(this);a[0]=l.call(this,x,b?r.html():B);r.domManip(a,b,d)});if(this[0]){e=l&&l.parentNode;e=c.support.parentNode&&e&&e.nodeType===11&&e.childNodes.length===this.length?{fragment:e}:c.buildFragment(a,this,k);h=e.fragment;if(f=h.childNodes.length===1?h=h.firstChild:h.firstChild){b=b&&c.nodeName(f,"tr");f=0;for(var o=this.length;f<o;f++)d.call(b?c.nodeName(this[f],"table")?this[f].getElementsByTagName("tbody")[0]||this[f].appendChild(this[f].ownerDocument.createElement("tbody")): -this[f]:this[f],f>0||e.cacheable||this.length>1?h.cloneNode(true):h)}k.length&&c.each(k,Oa)}return this}});c.buildFragment=function(a,b,d){var e,f,h;b=b&&b[0]?b[0].ownerDocument||b[0]:t;if(a.length===1&&typeof a[0]==="string"&&a[0].length<512&&b===t&&!Ca.test(a[0])&&(c.support.checkClone||!Da.test(a[0]))){f=true;if(h=c.fragments[a[0]])if(h!==1)e=h}if(!e){e=b.createDocumentFragment();c.clean(a,b,e,d)}if(f)c.fragments[a[0]]=h?e:1;return{fragment:e,cacheable:f}};c.fragments={};c.each({appendTo:"append", -prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){c.fn[a]=function(d){var e=[];d=c(d);var f=this.length===1&&this[0].parentNode;if(f&&f.nodeType===11&&f.childNodes.length===1&&d.length===1){d[b](this[0]);return this}else{f=0;for(var h=d.length;f<h;f++){var l=(f>0?this.clone(true):this).get();c(d[f])[b](l);e=e.concat(l)}return this.pushStack(e,a,d.selector)}}});c.extend({clean:function(a,b,d,e){b=b||t;if(typeof b.createElement==="undefined")b=b.ownerDocument|| -b[0]&&b[0].ownerDocument||t;for(var f=[],h=0,l;(l=a[h])!=null;h++){if(typeof l==="number")l+="";if(l){if(typeof l==="string"&&!eb.test(l))l=b.createTextNode(l);else if(typeof l==="string"){l=l.replace(Aa,"<$1></$2>");var k=(Ba.exec(l)||["",""])[1].toLowerCase(),o=P[k]||P._default,x=o[0],r=b.createElement("div");for(r.innerHTML=o[1]+l+o[2];x--;)r=r.lastChild;if(!c.support.tbody){x=db.test(l);k=k==="table"&&!x?r.firstChild&&r.firstChild.childNodes:o[1]==="<table>"&&!x?r.childNodes:[];for(o=k.length- -1;o>=0;--o)c.nodeName(k[o],"tbody")&&!k[o].childNodes.length&&k[o].parentNode.removeChild(k[o])}!c.support.leadingWhitespace&&$.test(l)&&r.insertBefore(b.createTextNode($.exec(l)[0]),r.firstChild);l=r.childNodes}if(l.nodeType)f.push(l);else f=c.merge(f,l)}}if(d)for(h=0;f[h];h++)if(e&&c.nodeName(f[h],"script")&&(!f[h].type||f[h].type.toLowerCase()==="text/javascript"))e.push(f[h].parentNode?f[h].parentNode.removeChild(f[h]):f[h]);else{f[h].nodeType===1&&f.splice.apply(f,[h+1,0].concat(c.makeArray(f[h].getElementsByTagName("script")))); -d.appendChild(f[h])}return f},cleanData:function(a){for(var b,d,e=c.cache,f=c.event.special,h=c.support.deleteExpando,l=0,k;(k=a[l])!=null;l++)if(!(k.nodeName&&c.noData[k.nodeName.toLowerCase()]))if(d=k[c.expando]){if((b=e[d])&&b.events)for(var o in b.events)f[o]?c.event.remove(k,o):c.removeEvent(k,o,b.handle);if(h)delete k[c.expando];else k.removeAttribute&&k.removeAttribute(c.expando);delete e[d]}}});var Ea=/alpha\([^)]*\)/i,gb=/opacity=([^)]*)/,hb=/-([a-z])/ig,ib=/([A-Z])/g,Fa=/^-?\d+(?:px)?$/i, -jb=/^-?\d/,kb={position:"absolute",visibility:"hidden",display:"block"},Pa=["Left","Right"],Qa=["Top","Bottom"],W,Ga,aa,lb=function(a,b){return b.toUpperCase()};c.fn.css=function(a,b){if(arguments.length===2&&b===B)return this;return c.access(this,a,b,true,function(d,e,f){return f!==B?c.style(d,e,f):c.css(d,e)})};c.extend({cssHooks:{opacity:{get:function(a,b){if(b){var d=W(a,"opacity","opacity");return d===""?"1":d}else return a.style.opacity}}},cssNumber:{zIndex:true,fontWeight:true,opacity:true, -zoom:true,lineHeight:true},cssProps:{"float":c.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,b,d,e){if(!(!a||a.nodeType===3||a.nodeType===8||!a.style)){var f,h=c.camelCase(b),l=a.style,k=c.cssHooks[h];b=c.cssProps[h]||h;if(d!==B){if(!(typeof d==="number"&&isNaN(d)||d==null)){if(typeof d==="number"&&!c.cssNumber[h])d+="px";if(!k||!("set"in k)||(d=k.set(a,d))!==B)try{l[b]=d}catch(o){}}}else{if(k&&"get"in k&&(f=k.get(a,false,e))!==B)return f;return l[b]}}},css:function(a,b,d){var e,f=c.camelCase(b), -h=c.cssHooks[f];b=c.cssProps[f]||f;if(h&&"get"in h&&(e=h.get(a,true,d))!==B)return e;else if(W)return W(a,b,f)},swap:function(a,b,d){var e={},f;for(f in b){e[f]=a.style[f];a.style[f]=b[f]}d.call(a);for(f in b)a.style[f]=e[f]},camelCase:function(a){return a.replace(hb,lb)}});c.curCSS=c.css;c.each(["height","width"],function(a,b){c.cssHooks[b]={get:function(d,e,f){var h;if(e){if(d.offsetWidth!==0)h=oa(d,b,f);else c.swap(d,kb,function(){h=oa(d,b,f)});if(h<=0){h=W(d,b,b);if(h==="0px"&&aa)h=aa(d,b,b); -if(h!=null)return h===""||h==="auto"?"0px":h}if(h<0||h==null){h=d.style[b];return h===""||h==="auto"?"0px":h}return typeof h==="string"?h:h+"px"}},set:function(d,e){if(Fa.test(e)){e=parseFloat(e);if(e>=0)return e+"px"}else return e}}});if(!c.support.opacity)c.cssHooks.opacity={get:function(a,b){return gb.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var d=a.style;d.zoom=1;var e=c.isNaN(b)?"":"alpha(opacity="+b*100+")",f= -d.filter||"";d.filter=Ea.test(f)?f.replace(Ea,e):d.filter+" "+e}};if(t.defaultView&&t.defaultView.getComputedStyle)Ga=function(a,b,d){var e;d=d.replace(ib,"-$1").toLowerCase();if(!(b=a.ownerDocument.defaultView))return B;if(b=b.getComputedStyle(a,null)){e=b.getPropertyValue(d);if(e===""&&!c.contains(a.ownerDocument.documentElement,a))e=c.style(a,d)}return e};if(t.documentElement.currentStyle)aa=function(a,b){var d,e,f=a.currentStyle&&a.currentStyle[b],h=a.style;if(!Fa.test(f)&&jb.test(f)){d=h.left; -e=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;h.left=b==="fontSize"?"1em":f||0;f=h.pixelLeft+"px";h.left=d;a.runtimeStyle.left=e}return f===""?"auto":f};W=Ga||aa;if(c.expr&&c.expr.filters){c.expr.filters.hidden=function(a){var b=a.offsetHeight;return a.offsetWidth===0&&b===0||!c.support.reliableHiddenOffsets&&(a.style.display||c.css(a,"display"))==="none"};c.expr.filters.visible=function(a){return!c.expr.filters.hidden(a)}}var mb=c.now(),nb=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, -ob=/^(?:select|textarea)/i,pb=/^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,qb=/^(?:GET|HEAD)$/,Ra=/\[\]$/,T=/\=\?(&|$)/,ja=/\?/,rb=/([?&])_=[^&]*/,sb=/^(\w+:)?\/\/([^\/?#]+)/,tb=/%20/g,ub=/#.*$/,Ha=c.fn.load;c.fn.extend({load:function(a,b,d){if(typeof a!=="string"&&Ha)return Ha.apply(this,arguments);else if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var f=a.slice(e,a.length);a=a.slice(0,e)}e="GET";if(b)if(c.isFunction(b)){d=b;b=null}else if(typeof b=== -"object"){b=c.param(b,c.ajaxSettings.traditional);e="POST"}var h=this;c.ajax({url:a,type:e,dataType:"html",data:b,complete:function(l,k){if(k==="success"||k==="notmodified")h.html(f?c("<div>").append(l.responseText.replace(nb,"")).find(f):l.responseText);d&&h.each(d,[l.responseText,k,l])}});return this},serialize:function(){return c.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?c.makeArray(this.elements):this}).filter(function(){return this.name&& -!this.disabled&&(this.checked||ob.test(this.nodeName)||pb.test(this.type))}).map(function(a,b){var d=c(this).val();return d==null?null:c.isArray(d)?c.map(d,function(e){return{name:b.name,value:e}}):{name:b.name,value:d}}).get()}});c.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){c.fn[b]=function(d){return this.bind(b,d)}});c.extend({get:function(a,b,d,e){if(c.isFunction(b)){e=e||d;d=b;b=null}return c.ajax({type:"GET",url:a,data:b,success:d,dataType:e})}, -getScript:function(a,b){return c.get(a,null,b,"script")},getJSON:function(a,b,d){return c.get(a,b,d,"json")},post:function(a,b,d,e){if(c.isFunction(b)){e=e||d;d=b;b={}}return c.ajax({type:"POST",url:a,data:b,success:d,dataType:e})},ajaxSetup:function(a){c.extend(c.ajaxSettings,a)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return new E.XMLHttpRequest},accepts:{xml:"application/xml, text/xml",html:"text/html", -script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},ajax:function(a){var b=c.extend(true,{},c.ajaxSettings,a),d,e,f,h=b.type.toUpperCase(),l=qb.test(h);b.url=b.url.replace(ub,"");b.context=a&&a.context!=null?a.context:b;if(b.data&&b.processData&&typeof b.data!=="string")b.data=c.param(b.data,b.traditional);if(b.dataType==="jsonp"){if(h==="GET")T.test(b.url)||(b.url+=(ja.test(b.url)?"&":"?")+(b.jsonp||"callback")+"=?");else if(!b.data|| -!T.test(b.data))b.data=(b.data?b.data+"&":"")+(b.jsonp||"callback")+"=?";b.dataType="json"}if(b.dataType==="json"&&(b.data&&T.test(b.data)||T.test(b.url))){d=b.jsonpCallback||"jsonp"+mb++;if(b.data)b.data=(b.data+"").replace(T,"="+d+"$1");b.url=b.url.replace(T,"="+d+"$1");b.dataType="script";var k=E[d];E[d]=function(m){if(c.isFunction(k))k(m);else{E[d]=B;try{delete E[d]}catch(p){}}f=m;c.handleSuccess(b,w,e,f);c.handleComplete(b,w,e,f);r&&r.removeChild(A)}}if(b.dataType==="script"&&b.cache===null)b.cache= -false;if(b.cache===false&&l){var o=c.now(),x=b.url.replace(rb,"$1_="+o);b.url=x+(x===b.url?(ja.test(b.url)?"&":"?")+"_="+o:"")}if(b.data&&l)b.url+=(ja.test(b.url)?"&":"?")+b.data;b.global&&c.active++===0&&c.event.trigger("ajaxStart");o=(o=sb.exec(b.url))&&(o[1]&&o[1].toLowerCase()!==location.protocol||o[2].toLowerCase()!==location.host);if(b.dataType==="script"&&h==="GET"&&o){var r=t.getElementsByTagName("head")[0]||t.documentElement,A=t.createElement("script");if(b.scriptCharset)A.charset=b.scriptCharset; -A.src=b.url;if(!d){var C=false;A.onload=A.onreadystatechange=function(){if(!C&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){C=true;c.handleSuccess(b,w,e,f);c.handleComplete(b,w,e,f);A.onload=A.onreadystatechange=null;r&&A.parentNode&&r.removeChild(A)}}}r.insertBefore(A,r.firstChild);return B}var J=false,w=b.xhr();if(w){b.username?w.open(h,b.url,b.async,b.username,b.password):w.open(h,b.url,b.async);try{if(b.data!=null&&!l||a&&a.contentType)w.setRequestHeader("Content-Type", -b.contentType);if(b.ifModified){c.lastModified[b.url]&&w.setRequestHeader("If-Modified-Since",c.lastModified[b.url]);c.etag[b.url]&&w.setRequestHeader("If-None-Match",c.etag[b.url])}o||w.setRequestHeader("X-Requested-With","XMLHttpRequest");w.setRequestHeader("Accept",b.dataType&&b.accepts[b.dataType]?b.accepts[b.dataType]+", */*; q=0.01":b.accepts._default)}catch(I){}if(b.beforeSend&&b.beforeSend.call(b.context,w,b)===false){b.global&&c.active--===1&&c.event.trigger("ajaxStop");w.abort();return false}b.global&& -c.triggerGlobal(b,"ajaxSend",[w,b]);var L=w.onreadystatechange=function(m){if(!w||w.readyState===0||m==="abort"){J||c.handleComplete(b,w,e,f);J=true;if(w)w.onreadystatechange=c.noop}else if(!J&&w&&(w.readyState===4||m==="timeout")){J=true;w.onreadystatechange=c.noop;e=m==="timeout"?"timeout":!c.httpSuccess(w)?"error":b.ifModified&&c.httpNotModified(w,b.url)?"notmodified":"success";var p;if(e==="success")try{f=c.httpData(w,b.dataType,b)}catch(q){e="parsererror";p=q}if(e==="success"||e==="notmodified")d|| -c.handleSuccess(b,w,e,f);else c.handleError(b,w,e,p);d||c.handleComplete(b,w,e,f);m==="timeout"&&w.abort();if(b.async)w=null}};try{var g=w.abort;w.abort=function(){w&&Function.prototype.call.call(g,w);L("abort")}}catch(i){}b.async&&b.timeout>0&&setTimeout(function(){w&&!J&&L("timeout")},b.timeout);try{w.send(l||b.data==null?null:b.data)}catch(n){c.handleError(b,w,null,n);c.handleComplete(b,w,e,f)}b.async||L();return w}},param:function(a,b){var d=[],e=function(h,l){l=c.isFunction(l)?l():l;d[d.length]= -encodeURIComponent(h)+"="+encodeURIComponent(l)};if(b===B)b=c.ajaxSettings.traditional;if(c.isArray(a)||a.jquery)c.each(a,function(){e(this.name,this.value)});else for(var f in a)da(f,a[f],b,e);return d.join("&").replace(tb,"+")}});c.extend({active:0,lastModified:{},etag:{},handleError:function(a,b,d,e){a.error&&a.error.call(a.context,b,d,e);a.global&&c.triggerGlobal(a,"ajaxError",[b,a,e])},handleSuccess:function(a,b,d,e){a.success&&a.success.call(a.context,e,d,b);a.global&&c.triggerGlobal(a,"ajaxSuccess", -[b,a])},handleComplete:function(a,b,d){a.complete&&a.complete.call(a.context,b,d);a.global&&c.triggerGlobal(a,"ajaxComplete",[b,a]);a.global&&c.active--===1&&c.event.trigger("ajaxStop")},triggerGlobal:function(a,b,d){(a.context&&a.context.url==null?c(a.context):c.event).trigger(b,d)},httpSuccess:function(a){try{return!a.status&&location.protocol==="file:"||a.status>=200&&a.status<300||a.status===304||a.status===1223}catch(b){}return false},httpNotModified:function(a,b){var d=a.getResponseHeader("Last-Modified"), -e=a.getResponseHeader("Etag");if(d)c.lastModified[b]=d;if(e)c.etag[b]=e;return a.status===304},httpData:function(a,b,d){var e=a.getResponseHeader("content-type")||"",f=b==="xml"||!b&&e.indexOf("xml")>=0;a=f?a.responseXML:a.responseText;f&&a.documentElement.nodeName==="parsererror"&&c.error("parsererror");if(d&&d.dataFilter)a=d.dataFilter(a,b);if(typeof a==="string")if(b==="json"||!b&&e.indexOf("json")>=0)a=c.parseJSON(a);else if(b==="script"||!b&&e.indexOf("javascript")>=0)c.globalEval(a);return a}}); -if(E.ActiveXObject)c.ajaxSettings.xhr=function(){if(E.location.protocol!=="file:")try{return new E.XMLHttpRequest}catch(a){}try{return new E.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}};c.support.ajax=!!c.ajaxSettings.xhr();var ea={},vb=/^(?:toggle|show|hide)$/,wb=/^([+\-]=)?([\d+.\-]+)(.*)$/,ba,pa=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];c.fn.extend({show:function(a,b,d){if(a||a===0)return this.animate(S("show", -3),a,b,d);else{d=0;for(var e=this.length;d<e;d++){a=this[d];b=a.style.display;if(!c.data(a,"olddisplay")&&b==="none")b=a.style.display="";b===""&&c.css(a,"display")==="none"&&c.data(a,"olddisplay",qa(a.nodeName))}for(d=0;d<e;d++){a=this[d];b=a.style.display;if(b===""||b==="none")a.style.display=c.data(a,"olddisplay")||""}return this}},hide:function(a,b,d){if(a||a===0)return this.animate(S("hide",3),a,b,d);else{a=0;for(b=this.length;a<b;a++){d=c.css(this[a],"display");d!=="none"&&c.data(this[a],"olddisplay", -d)}for(a=0;a<b;a++)this[a].style.display="none";return this}},_toggle:c.fn.toggle,toggle:function(a,b,d){var e=typeof a==="boolean";if(c.isFunction(a)&&c.isFunction(b))this._toggle.apply(this,arguments);else a==null||e?this.each(function(){var f=e?a:c(this).is(":hidden");c(this)[f?"show":"hide"]()}):this.animate(S("toggle",3),a,b,d);return this},fadeTo:function(a,b,d,e){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,d,e)},animate:function(a,b,d,e){var f=c.speed(b, -d,e);if(c.isEmptyObject(a))return this.each(f.complete);return this[f.queue===false?"each":"queue"](function(){var h=c.extend({},f),l,k=this.nodeType===1,o=k&&c(this).is(":hidden"),x=this;for(l in a){var r=c.camelCase(l);if(l!==r){a[r]=a[l];delete a[l];l=r}if(a[l]==="hide"&&o||a[l]==="show"&&!o)return h.complete.call(this);if(k&&(l==="height"||l==="width")){h.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY];if(c.css(this,"display")==="inline"&&c.css(this,"float")==="none")if(c.support.inlineBlockNeedsLayout)if(qa(this.nodeName)=== -"inline")this.style.display="inline-block";else{this.style.display="inline";this.style.zoom=1}else this.style.display="inline-block"}if(c.isArray(a[l])){(h.specialEasing=h.specialEasing||{})[l]=a[l][1];a[l]=a[l][0]}}if(h.overflow!=null)this.style.overflow="hidden";h.curAnim=c.extend({},a);c.each(a,function(A,C){var J=new c.fx(x,h,A);if(vb.test(C))J[C==="toggle"?o?"show":"hide":C](a);else{var w=wb.exec(C),I=J.cur()||0;if(w){var L=parseFloat(w[2]),g=w[3]||"px";if(g!=="px"){c.style(x,A,(L||1)+g);I=(L|| -1)/J.cur()*I;c.style(x,A,I+g)}if(w[1])L=(w[1]==="-="?-1:1)*L+I;J.custom(I,L,g)}else J.custom(I,C,"")}});return true})},stop:function(a,b){var d=c.timers;a&&this.queue([]);this.each(function(){for(var e=d.length-1;e>=0;e--)if(d[e].elem===this){b&&d[e](true);d.splice(e,1)}});b||this.dequeue();return this}});c.each({slideDown:S("show",1),slideUp:S("hide",1),slideToggle:S("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){c.fn[a]=function(d,e,f){return this.animate(b, -d,e,f)}});c.extend({speed:function(a,b,d){var e=a&&typeof a==="object"?c.extend({},a):{complete:d||!d&&b||c.isFunction(a)&&a,duration:a,easing:d&&b||b&&!c.isFunction(b)&&b};e.duration=c.fx.off?0:typeof e.duration==="number"?e.duration:e.duration in c.fx.speeds?c.fx.speeds[e.duration]:c.fx.speeds._default;e.old=e.complete;e.complete=function(){e.queue!==false&&c(this).dequeue();c.isFunction(e.old)&&e.old.call(this)};return e},easing:{linear:function(a,b,d,e){return d+e*a},swing:function(a,b,d,e){return(-Math.cos(a* -Math.PI)/2+0.5)*e+d}},timers:[],fx:function(a,b,d){this.options=b;this.elem=a;this.prop=d;if(!b.orig)b.orig={}}});c.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this);(c.fx.step[this.prop]||c.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];var a=parseFloat(c.css(this.elem,this.prop));return a&&a>-1E4?a:0},custom:function(a,b,d){function e(l){return f.step(l)} -var f=this,h=c.fx;this.startTime=c.now();this.start=a;this.end=b;this.unit=d||this.unit||"px";this.now=this.start;this.pos=this.state=0;e.elem=this.elem;if(e()&&c.timers.push(e)&&!ba)ba=setInterval(h.tick,h.interval)},show:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());c(this.elem).show()},hide:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.hide=true; -this.custom(this.cur(),0)},step:function(a){var b=c.now(),d=true;if(a||b>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var e in this.options.curAnim)if(this.options.curAnim[e]!==true)d=false;if(d){if(this.options.overflow!=null&&!c.support.shrinkWrapBlocks){var f=this.elem,h=this.options;c.each(["","X","Y"],function(k,o){f.style["overflow"+o]=h.overflow[k]})}this.options.hide&&c(this.elem).hide();if(this.options.hide|| -this.options.show)for(var l in this.options.curAnim)c.style(this.elem,l,this.options.orig[l]);this.options.complete.call(this.elem)}return false}else{a=b-this.startTime;this.state=a/this.options.duration;b=this.options.easing||(c.easing.swing?"swing":"linear");this.pos=c.easing[this.options.specialEasing&&this.options.specialEasing[this.prop]||b](this.state,a,0,1,this.options.duration);this.now=this.start+(this.end-this.start)*this.pos;this.update()}return true}};c.extend(c.fx,{tick:function(){for(var a= -c.timers,b=0;b<a.length;b++)a[b]()||a.splice(b--,1);a.length||c.fx.stop()},interval:13,stop:function(){clearInterval(ba);ba=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){c.style(a.elem,"opacity",a.now)},_default:function(a){if(a.elem.style&&a.elem.style[a.prop]!=null)a.elem.style[a.prop]=(a.prop==="width"||a.prop==="height"?Math.max(0,a.now):a.now)+a.unit;else a.elem[a.prop]=a.now}}});if(c.expr&&c.expr.filters)c.expr.filters.animated=function(a){return c.grep(c.timers,function(b){return a=== -b.elem}).length};var xb=/^t(?:able|d|h)$/i,Ia=/^(?:body|html)$/i;c.fn.offset="getBoundingClientRect"in t.documentElement?function(a){var b=this[0],d;if(a)return this.each(function(l){c.offset.setOffset(this,a,l)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return c.offset.bodyOffset(b);try{d=b.getBoundingClientRect()}catch(e){}var f=b.ownerDocument,h=f.documentElement;if(!d||!c.contains(h,b))return d||{top:0,left:0};b=f.body;f=fa(f);return{top:d.top+(f.pageYOffset||c.support.boxModel&& -h.scrollTop||b.scrollTop)-(h.clientTop||b.clientTop||0),left:d.left+(f.pageXOffset||c.support.boxModel&&h.scrollLeft||b.scrollLeft)-(h.clientLeft||b.clientLeft||0)}}:function(a){var b=this[0];if(a)return this.each(function(x){c.offset.setOffset(this,a,x)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return c.offset.bodyOffset(b);c.offset.initialize();var d,e=b.offsetParent,f=b.ownerDocument,h=f.documentElement,l=f.body;d=(f=f.defaultView)?f.getComputedStyle(b,null):b.currentStyle; -for(var k=b.offsetTop,o=b.offsetLeft;(b=b.parentNode)&&b!==l&&b!==h;){if(c.offset.supportsFixedPosition&&d.position==="fixed")break;d=f?f.getComputedStyle(b,null):b.currentStyle;k-=b.scrollTop;o-=b.scrollLeft;if(b===e){k+=b.offsetTop;o+=b.offsetLeft;if(c.offset.doesNotAddBorder&&!(c.offset.doesAddBorderForTableAndCells&&xb.test(b.nodeName))){k+=parseFloat(d.borderTopWidth)||0;o+=parseFloat(d.borderLeftWidth)||0}e=b.offsetParent}if(c.offset.subtractsBorderForOverflowNotVisible&&d.overflow!=="visible"){k+= -parseFloat(d.borderTopWidth)||0;o+=parseFloat(d.borderLeftWidth)||0}d=d}if(d.position==="relative"||d.position==="static"){k+=l.offsetTop;o+=l.offsetLeft}if(c.offset.supportsFixedPosition&&d.position==="fixed"){k+=Math.max(h.scrollTop,l.scrollTop);o+=Math.max(h.scrollLeft,l.scrollLeft)}return{top:k,left:o}};c.offset={initialize:function(){var a=t.body,b=t.createElement("div"),d,e,f,h=parseFloat(c.css(a,"marginTop"))||0;c.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px", -height:"1px",visibility:"hidden"});b.innerHTML="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";a.insertBefore(b,a.firstChild);d=b.firstChild;e=d.firstChild;f=d.nextSibling.firstChild.firstChild;this.doesNotAddBorder=e.offsetTop!==5;this.doesAddBorderForTableAndCells= -f.offsetTop===5;e.style.position="fixed";e.style.top="20px";this.supportsFixedPosition=e.offsetTop===20||e.offsetTop===15;e.style.position=e.style.top="";d.style.overflow="hidden";d.style.position="relative";this.subtractsBorderForOverflowNotVisible=e.offsetTop===-5;this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==h;a.removeChild(b);c.offset.initialize=c.noop},bodyOffset:function(a){var b=a.offsetTop,d=a.offsetLeft;c.offset.initialize();if(c.offset.doesNotIncludeMarginInBodyOffset){b+=parseFloat(c.css(a, -"marginTop"))||0;d+=parseFloat(c.css(a,"marginLeft"))||0}return{top:b,left:d}},setOffset:function(a,b,d){var e=c.css(a,"position");if(e==="static")a.style.position="relative";var f=c(a),h=f.offset(),l=c.css(a,"top"),k=c.css(a,"left"),o=e==="absolute"&&c.inArray("auto",[l,k])>-1;e={};var x={};if(o)x=f.position();l=o?x.top:parseInt(l,10)||0;k=o?x.left:parseInt(k,10)||0;if(c.isFunction(b))b=b.call(a,d,h);if(b.top!=null)e.top=b.top-h.top+l;if(b.left!=null)e.left=b.left-h.left+k;"using"in b?b.using.call(a, -e):f.css(e)}};c.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),d=this.offset(),e=Ia.test(b[0].nodeName)?{top:0,left:0}:b.offset();d.top-=parseFloat(c.css(a,"marginTop"))||0;d.left-=parseFloat(c.css(a,"marginLeft"))||0;e.top+=parseFloat(c.css(b[0],"borderTopWidth"))||0;e.left+=parseFloat(c.css(b[0],"borderLeftWidth"))||0;return{top:d.top-e.top,left:d.left-e.left}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||t.body;a&&!Ia.test(a.nodeName)&& -c.css(a,"position")==="static";)a=a.offsetParent;return a})}});c.each(["Left","Top"],function(a,b){var d="scroll"+b;c.fn[d]=function(e){var f=this[0],h;if(!f)return null;if(e!==B)return this.each(function(){if(h=fa(this))h.scrollTo(!a?e:c(h).scrollLeft(),a?e:c(h).scrollTop());else this[d]=e});else return(h=fa(f))?"pageXOffset"in h?h[a?"pageYOffset":"pageXOffset"]:c.support.boxModel&&h.document.documentElement[d]||h.document.body[d]:f[d]}});c.each(["Height","Width"],function(a,b){var d=b.toLowerCase(); -c.fn["inner"+b]=function(){return this[0]?parseFloat(c.css(this[0],d,"padding")):null};c.fn["outer"+b]=function(e){return this[0]?parseFloat(c.css(this[0],d,e?"margin":"border")):null};c.fn[d]=function(e){var f=this[0];if(!f)return e==null?null:this;if(c.isFunction(e))return this.each(function(l){var k=c(this);k[d](e.call(this,l,k[d]()))});if(c.isWindow(f))return f.document.compatMode==="CSS1Compat"&&f.document.documentElement["client"+b]||f.document.body["client"+b];else if(f.nodeType===9)return Math.max(f.documentElement["client"+ -b],f.body["scroll"+b],f.documentElement["scroll"+b],f.body["offset"+b],f.documentElement["offset"+b]);else if(e===B){f=c.css(f,d);var h=parseFloat(f);return c.isNaN(h)?f:h}else return this.css(d,typeof e==="string"?e:e+"px")}})})(window); diff --git a/modules/mondialrelay/js/gmap.js b/modules/mondialrelay/js/gmap.js index e054ef5a2..a58b098f6 100644 --- a/modules/mondialrelay/js/gmap.js +++ b/modules/mondialrelay/js/gmap.js @@ -1336,6 +1336,14 @@ return result; } + /** + * Resize map + **/ + this.resize = function() + { + google.maps.event.trigger(this.getMap(), 'resize'); + } + /** * add markers (without address resolution) **/ diff --git a/modules/mondialrelay/js/jquery-1.6.4.min.js b/modules/mondialrelay/js/jquery-1.6.4.min.js new file mode 100644 index 000000000..3684c36b5 --- /dev/null +++ b/modules/mondialrelay/js/jquery-1.6.4.min.js @@ -0,0 +1,4 @@ +/*! jQuery v1.6.4 http://jquery.com/ | http://jquery.org/license */ +(function(a,b){function cu(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cr(a){if(!cg[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){ch||(ch=c.createElement("iframe"),ch.frameBorder=ch.width=ch.height=0),b.appendChild(ch);if(!ci||!ch.createElement)ci=(ch.contentWindow||ch.contentDocument).document,ci.write((c.compatMode==="CSS1Compat"?"<!doctype html>":"")+"<html><body>"),ci.close();d=ci.createElement(a),ci.body.appendChild(d),e=f.css(d,"display"),b.removeChild(ch)}cg[a]=e}return cg[a]}function cq(a,b){var c={};f.each(cm.concat.apply([],cm.slice(0,b)),function(){c[this]=a});return c}function cp(){cn=b}function co(){setTimeout(cp,0);return cn=f.now()}function cf(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ce(){try{return new a.XMLHttpRequest}catch(b){}}function b$(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g<i;g++){if(g===1)for(h in a.converters)typeof h=="string"&&(e[h.toLowerCase()]=a.converters[h]);l=k,k=d[g];if(k==="*")k=l;else if(l!=="*"&&l!==k){m=l+" "+k,n=e[m]||e["* "+k];if(!n){p=b;for(o in e){j=o.split(" ");if(j[0]===l||j[0]==="*"){p=e[j[1]+" "+k];if(p){o=e[o],o===!0?n=p:p===!0&&(n=o);break}}}}!n&&!p&&f.error("No conversion from "+m.replace(" "," to ")),n!==!0&&(c=n?n(c):p(o(c)))}}return c}function bZ(a,c,d){var e=a.contents,f=a.dataTypes,g=a.responseFields,h,i,j,k;for(i in g)i in d&&(c[g[i]]=d[i]);while(f[0]==="*")f.shift(),h===b&&(h=a.mimeType||c.getResponseHeader("content-type"));if(h)for(i in e)if(e[i]&&e[i].test(h)){f.unshift(i);break}if(f[0]in d)j=f[0];else{for(i in d){if(!f[0]||a.converters[i+" "+f[0]]){j=i;break}k||(k=i)}j=j||k}if(j){j!==f[0]&&f.unshift(j);return d[j]}}function bY(a,b,c,d){if(f.isArray(b))f.each(b,function(b,e){c||bA.test(a)?d(a,e):bY(a+"["+(typeof e=="object"||f.isArray(e)?b:"")+"]",e,c,d)});else if(!c&&b!=null&&typeof b=="object")for(var e in b)bY(a+"["+e+"]",b[e],c,d);else d(a,b)}function bX(a,c){var d,e,g=f.ajaxSettings.flatOptions||{};for(d in c)c[d]!==b&&((g[d]?a:e||(e={}))[d]=c[d]);e&&f.extend(!0,a,e)}function bW(a,c,d,e,f,g){f=f||c.dataTypes[0],g=g||{},g[f]=!0;var h=a[f],i=0,j=h?h.length:0,k=a===bP,l;for(;i<j&&(k||!l);i++)l=h[i](c,d,e),typeof l=="string"&&(!k||g[l]?l=b:(c.dataTypes.unshift(l),l=bW(a,c,d,e,l,g)));(k||!l)&&!g["*"]&&(l=bW(a,c,d,e,"*",g));return l}function bV(a){return function(b,c){typeof b!="string"&&(c=b,b="*");if(f.isFunction(c)){var d=b.toLowerCase().split(bL),e=0,g=d.length,h,i,j;for(;e<g;e++)h=d[e],j=/^\+/.test(h),j&&(h=h.substr(1)||"*"),i=a[h]=a[h]||[],i[j?"unshift":"push"](c)}}}function by(a,b,c){var d=b==="width"?a.offsetWidth:a.offsetHeight,e=b==="width"?bt:bu;if(d>0){c!=="border"&&f.each(e,function(){c||(d-=parseFloat(f.css(a,"padding"+this))||0),c==="margin"?d+=parseFloat(f.css(a,c+this))||0:d-=parseFloat(f.css(a,"border"+this+"Width"))||0});return d+"px"}d=bv(a,b,b);if(d<0||d==null)d=a.style[b]||0;d=parseFloat(d)||0,c&&f.each(e,function(){d+=parseFloat(f.css(a,"padding"+this))||0,c!=="padding"&&(d+=parseFloat(f.css(a,"border"+this+"Width"))||0),c==="margin"&&(d+=parseFloat(f.css(a,c+this))||0)});return d+"px"}function bl(a,b){b.src?f.ajax({url:b.src,async:!1,dataType:"script"}):f.globalEval((b.text||b.textContent||b.innerHTML||"").replace(bd,"/*$0*/")),b.parentNode&&b.parentNode.removeChild(b)}function bk(a){f.nodeName(a,"input")?bj(a):"getElementsByTagName"in a&&f.grep(a.getElementsByTagName("input"),bj)}function bj(a){if(a.type==="checkbox"||a.type==="radio")a.defaultChecked=a.checked}function bi(a){return"getElementsByTagName"in a?a.getElementsByTagName("*"):"querySelectorAll"in a?a.querySelectorAll("*"):[]}function bh(a,b){var c;if(b.nodeType===1){b.clearAttributes&&b.clearAttributes(),b.mergeAttributes&&b.mergeAttributes(a),c=b.nodeName.toLowerCase();if(c==="object")b.outerHTML=a.outerHTML;else if(c!=="input"||a.type!=="checkbox"&&a.type!=="radio"){if(c==="option")b.selected=a.defaultSelected;else if(c==="input"||c==="textarea")b.defaultValue=a.defaultValue}else a.checked&&(b.defaultChecked=b.checked=a.checked),b.value!==a.value&&(b.value=a.value);b.removeAttribute(f.expando)}}function bg(a,b){if(b.nodeType===1&&!!f.hasData(a)){var c=f.expando,d=f.data(a),e=f.data(b,d);if(d=d[c]){var g=d.events;e=e[c]=f.extend({},d);if(g){delete e.handle,e.events={};for(var h in g)for(var i=0,j=g[h].length;i<j;i++)f.event.add(b,h+(g[h][i].namespace?".":"")+g[h][i].namespace,g[h][i],g[h][i].data)}}}}function bf(a,b){return f.nodeName(a,"table")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function V(a,b,c){b=b||0;if(f.isFunction(b))return f.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return f.grep(a,function(a,d){return a===b===c});if(typeof b=="string"){var d=f.grep(a,function(a){return a.nodeType===1});if(Q.test(b))return f.filter(b,d,!c);b=f.filter(b,d)}return f.grep(a,function(a,d){return f.inArray(a,b)>=0===c})}function U(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function M(a,b){return(a&&a!=="*"?a+".":"")+b.replace(y,"`").replace(z,"&")}function L(a){var b,c,d,e,g,h,i,j,k,l,m,n,o,p=[],q=[],r=f._data(this,"events");if(!(a.liveFired===this||!r||!r.live||a.target.disabled||a.button&&a.type==="click")){a.namespace&&(n=new RegExp("(^|\\.)"+a.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)")),a.liveFired=this;var s=r.live.slice(0);for(i=0;i<s.length;i++)g=s[i],g.origType.replace(w,"")===a.type?q.push(g.selector):s.splice(i--,1);e=f(a.target).closest(q,a.currentTarget);for(j=0,k=e.length;j<k;j++){m=e[j];for(i=0;i<s.length;i++){g=s[i];if(m.selector===g.selector&&(!n||n.test(g.namespace))&&!m.elem.disabled){h=m.elem,d=null;if(g.preType==="mouseenter"||g.preType==="mouseleave")a.type=g.preType,d=f(a.relatedTarget).closest(g.selector)[0],d&&f.contains(h,d)&&(d=h);(!d||d!==h)&&p.push({elem:h,handleObj:g,level:m.level})}}}for(j=0,k=p.length;j<k;j++){e=p[j];if(c&&e.level>c)break;a.currentTarget=e.elem,a.data=e.handleObj.data,a.handleObj=e.handleObj,o=e.handleObj.origHandler.apply(e.elem,arguments);if(o===!1||a.isPropagationStopped()){c=e.level,o===!1&&(b=!1);if(a.isImmediatePropagationStopped())break}}return b}}function J(a,c,d){var e=f.extend({},d[0]);e.type=a,e.originalEvent={},e.liveFired=b,f.event.handle.call(c,e),e.isDefaultPrevented()&&d[0].preventDefault()}function D(){return!0}function C(){return!1}function m(a,c,d){var e=c+"defer",g=c+"queue",h=c+"mark",i=f.data(a,e,b,!0);i&&(d==="queue"||!f.data(a,g,b,!0))&&(d==="mark"||!f.data(a,h,b,!0))&&setTimeout(function(){!f.data(a,g,b,!0)&&!f.data(a,h,b,!0)&&(f.removeData(a,e,!0),i.resolve())},0)}function l(a){for(var b in a)if(b!=="toJSON")return!1;return!0}function k(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(j,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNaN(d)?i.test(d)?f.parseJSON(d):d:parseFloat(d)}catch(g){}f.data(a,c,d)}else d=b}return d}var c=a.document,d=a.navigator,e=a.location,f=function(){function K(){if(!e.isReady){try{c.documentElement.doScroll("left")}catch(a){setTimeout(K,1);return}e.ready()}}var e=function(a,b){return new e.fn.init(a,b,h)},f=a.jQuery,g=a.$,h,i=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/\d/,n=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,o=/^[\],:{}\s]*$/,p=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,q=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,r=/(?:^|:|,)(?:\s*\[)+/g,s=/(webkit)[ \/]([\w.]+)/,t=/(opera)(?:.*version)?[ \/]([\w.]+)/,u=/(msie) ([\w.]+)/,v=/(mozilla)(?:.*? rv:([\w.]+))?/,w=/-([a-z]|[0-9])/ig,x=/^-ms-/,y=function(a,b){return(b+"").toUpperCase()},z=d.userAgent,A,B,C,D=Object.prototype.toString,E=Object.prototype.hasOwnProperty,F=Array.prototype.push,G=Array.prototype.slice,H=String.prototype.trim,I=Array.prototype.indexOf,J={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=n.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.6.4",length:0,size:function(){return this.length},toArray:function(){return G.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?F.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),B.done(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(G.apply(this,arguments),"slice",G.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:F,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j<k;j++)if((a=arguments[j])!=null)for(c in a){d=i[c],f=a[c];if(i===f)continue;l&&f&&(e.isPlainObject(f)||(g=e.isArray(f)))?(g?(g=!1,h=d&&e.isArray(d)?d:[]):h=d&&e.isPlainObject(d)?d:{},i[c]=e.extend(l,h,f)):f!==b&&(i[c]=f)}return i},e.extend({noConflict:function(b){a.$===e&&(a.$=g),b&&a.jQuery===e&&(a.jQuery=f);return e},isReady:!1,readyWait:1,holdReady:function(a){a?e.readyWait++:e.ready(!0)},ready:function(a){if(a===!0&&!--e.readyWait||a!==!0&&!e.isReady){if(!c.body)return setTimeout(e.ready,1);e.isReady=!0;if(a!==!0&&--e.readyWait>0)return;B.resolveWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").unbind("ready")}},bindReady:function(){if(!B){B=e._Deferred();if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",C,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",C),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&K()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a&&typeof a=="object"&&"setInterval"in a},isNaN:function(a){return a==null||!m.test(a)||isNaN(a)},type:function(a){return a==null?String(a):J[D.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;try{if(a.constructor&&!E.call(a,"constructor")&&!E.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||E.call(a,d)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw a},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(o.test(b.replace(p,"@").replace(q,"]").replace(r,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(c){var d,f;try{a.DOMParser?(f=new DOMParser,d=f.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(g){d=b}(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&e.error("Invalid XML: "+c);return d},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(x,"ms-").replace(w,y)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g<h;)if(c.apply(a[g++],d)===!1)break}else if(i){for(f in a)if(c.call(a[f],f,a[f])===!1)break}else for(;g<h;)if(c.call(a[g],g,a[g++])===!1)break;return a},trim:H?function(a){return a==null?"":H.call(a)}:function(a){return a==null?"":(a+"").replace(k,"").replace(l,"")},makeArray:function(a,b){var c=b||[];if(a!=null){var d=e.type(a);a.length==null||d==="string"||d==="function"||d==="regexp"||e.isWindow(a)?F.call(c,a):e.merge(c,a)}return c},inArray:function(a,b){if(!b)return-1;if(I)return I.call(b,a);for(var c=0,d=b.length;c<d;c++)if(b[c]===a)return c;return-1},merge:function(a,c){var d=a.length,e=0;if(typeof c.length=="number")for(var f=c.length;e<f;e++)a[d++]=c[e];else while(c[e]!==b)a[d++]=c[e++];a.length=d;return a},grep:function(a,b,c){var d=[],e;c=!!c;for(var f=0,g=a.length;f<g;f++)e=!!b(a[f],f),c!==e&&d.push(a[f]);return d},map:function(a,c,d){var f,g,h=[],i=0,j=a.length,k=a instanceof e||j!==b&&typeof j=="number"&&(j>0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i<j;i++)f=c(a[i],i,d),f!=null&&(h[h.length]=f);else for(g in a)f=c(a[g],g,d),f!=null&&(h[h.length]=f);return h.concat.apply([],h)},guid:1,proxy:function(a,c){if(typeof c=="string"){var d=a[c];c=a,a=d}if(!e.isFunction(a))return b;var f=G.call(arguments,2),g=function(){return a.apply(c,f.concat(G.call(arguments)))};g.guid=a.guid=a.guid||g.guid||e.guid++;return g},access:function(a,c,d,f,g,h){var i=a.length;if(typeof c=="object"){for(var j in c)e.access(a,j,c[j],f,g,d);return a}if(d!==b){f=!h&&f&&e.isFunction(d);for(var k=0;k<i;k++)g(a[k],c,f?d.call(a[k],k,g(a[k],c)):d,h);return a}return i?g(a[0],c):b},now:function(){return(new Date).getTime()},uaMatch:function(a){a=a.toLowerCase();var b=s.exec(a)||t.exec(a)||u.exec(a)||a.indexOf("compatible")<0&&v.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},sub:function(){function a(b,c){return new a.fn.init(b,c)}e.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.sub=this.sub,a.fn.init=function(d,f){f&&f instanceof e&&!(f instanceof a)&&(f=a(f));return e.fn.init.call(this,d,f,b)},a.fn.init.prototype=a.fn;var b=a(c);return a},browser:{}}),e.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(a,b){J["[object "+b+"]"]=b.toLowerCase()}),A=e.uaMatch(z),A.browser&&(e.browser[A.browser]=!0,e.browser.version=A.version),e.browser.webkit&&(e.browser.safari=!0),j.test(" ")&&(k=/^[\s\xA0]+/,l=/[\s\xA0]+$/),h=e(c),c.addEventListener?C=function(){c.removeEventListener("DOMContentLoaded",C,!1),e.ready()}:c.attachEvent&&(C=function(){c.readyState==="complete"&&(c.detachEvent("onreadystatechange",C),e.ready())});return e}(),g="done fail isResolved isRejected promise then always pipe".split(" "),h=[].slice;f.extend({_Deferred:function(){var a=[],b,c,d,e={done:function(){if(!d){var c=arguments,g,h,i,j,k;b&&(k=b,b=0);for(g=0,h=c.length;g<h;g++)i=c[g],j=f.type(i),j==="array"?e.done.apply(e,i):j==="function"&&a.push(i);k&&e.resolveWith(k[0],k[1])}return this},resolveWith:function(e,f){if(!d&&!b&&!c){f=f||[],c=1;try{while(a[0])a.shift().apply(e,f)}finally{b=[e,f],c=0}}return this},resolve:function(){e.resolveWith(this,arguments);return this},isResolved:function(){return!!c||!!b},cancel:function(){d=1,a=[];return this}};return e},Deferred:function(a){var b=f._Deferred(),c=f._Deferred(),d;f.extend(b,{then:function(a,c){b.done(a).fail(c);return this},always:function(){return b.done.apply(b,arguments).fail.apply(this,arguments)},fail:c.done,rejectWith:c.resolveWith,reject:c.resolve,isRejected:c.isResolved,pipe:function(a,c){return f.Deferred(function(d){f.each({done:[a,"resolve"],fail:[c,"reject"]},function(a,c){var e=c[0],g=c[1],h;f.isFunction(e)?b[a](function(){h=e.apply(this,arguments),h&&f.isFunction(h.promise)?h.promise().then(d.resolve,d.reject):d[g+"With"](this===b?d:this,[h])}):b[a](d[g])})}).promise()},promise:function(a){if(a==null){if(d)return d;d=a={}}var c=g.length;while(c--)a[g[c]]=b[g[c]];return a}}),b.done(c.cancel).fail(b.cancel),delete b.cancel,a&&a.call(b,b);return b},when:function(a){function i(a){return function(c){b[a]=arguments.length>1?h.call(arguments,0):c,--e||g.resolveWith(g,h.call(b,0))}}var b=arguments,c=0,d=b.length,e=d,g=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred();if(d>1){for(;c<d;c++)b[c]&&f.isFunction(b[c].promise)?b[c].promise().then(i(c),g.reject):--e;e||g.resolveWith(g,b)}else g!==a&&g.resolveWith(g,d?[a]:[]);return g.promise()}}),f.support=function(){var a=c.createElement("div"),b=c.documentElement,d,e,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u;a.setAttribute("className","t"),a.innerHTML=" <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>",d=a.getElementsByTagName("*"),e=a.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=a.getElementsByTagName("input")[0],k={leadingWhitespace:a.firstChild.nodeType===3,tbody:!a.getElementsByTagName("tbody").length,htmlSerialize:!!a.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55$/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:a.className!=="t",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},i.checked=!0,k.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,k.optDisabled=!h.disabled;try{delete a.test}catch(v){k.deleteExpando=!1}!a.addEventListener&&a.attachEvent&&a.fireEvent&&(a.attachEvent("onclick",function(){k.noCloneEvent=!1}),a.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),k.radioValue=i.value==="t",i.setAttribute("checked","checked"),a.appendChild(i),l=c.createDocumentFragment(),l.appendChild(a.firstChild),k.checkClone=l.cloneNode(!0).cloneNode(!0).lastChild.checked,a.innerHTML="",a.style.width=a.style.paddingLeft="1px",m=c.getElementsByTagName("body")[0],o=c.createElement(m?"div":"body"),p={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"},m&&f.extend(p,{position:"absolute",left:"-1000px",top:"-1000px"});for(t in p)o.style[t]=p[t];o.appendChild(a),n=m||b,n.insertBefore(o,n.firstChild),k.appendChecked=i.checked,k.boxModel=a.offsetWidth===2,"zoom"in a.style&&(a.style.display="inline",a.style.zoom=1,k.inlineBlockNeedsLayout=a.offsetWidth===2,a.style.display="",a.innerHTML="<div style='width:4px;'></div>",k.shrinkWrapBlocks=a.offsetWidth!==2),a.innerHTML="<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>",q=a.getElementsByTagName("td"),u=q[0].offsetHeight===0,q[0].style.display="",q[1].style.display="none",k.reliableHiddenOffsets=u&&q[0].offsetHeight===0,a.innerHTML="",c.defaultView&&c.defaultView.getComputedStyle&&(j=c.createElement("div"),j.style.width="0",j.style.marginRight="0",a.appendChild(j),k.reliableMarginRight=(parseInt((c.defaultView.getComputedStyle(j,null)||{marginRight:0}).marginRight,10)||0)===0),o.innerHTML="",n.removeChild(o);if(a.attachEvent)for(t in{submit:1,change:1,focusin:1})s="on"+t,u=s in a,u||(a.setAttribute(s,"return;"),u=typeof a[s]=="function"),k[t+"Bubbles"]=u;o=l=g=h=m=j=a=i=null;return k}(),f.boxModel=f.support.boxModel;var i=/^(?:\{.*\}|\[.*\])$/,j=/([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!l(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g,h,i=f.expando,j=typeof c=="string",k=a.nodeType,l=k?f.cache:a,m=k?a[f.expando]:a[f.expando]&&f.expando;if((!m||e&&m&&l[m]&&!l[m][i])&&j&&d===b)return;m||(k?a[f.expando]=m=++f.uuid:m=f.expando),l[m]||(l[m]={},k||(l[m].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?l[m][i]=f.extend(l[m][i],c):l[m]=f.extend(l[m],c);g=l[m],e&&(g[i]||(g[i]={}),g=g[i]),d!==b&&(g[f.camelCase(c)]=d);if(c==="events"&&!g[c])return g[i]&&g[i].events;j?(h=g[c],h==null&&(h=g[f.camelCase(c)])):h=g;return h}},removeData:function(a,b,c){if(!!f.acceptData(a)){var d,e=f.expando,g=a.nodeType,h=g?f.cache:a,i=g?a[f.expando]:f.expando;if(!h[i])return;if(b){d=c?h[i][e]:h[i];if(d){d[b]||(b=f.camelCase(b)),delete d[b];if(!l(d))return}}if(c){delete h[i][e];if(!l(h[i]))return}var j=h[i][e];f.support.deleteExpando||!h.setInterval?delete h[i]:h[i]=null,j?(h[i]={},g||(h[i].toJSON=f.noop),h[i][e]=j):g&&(f.support.deleteExpando?delete a[f.expando]:a.removeAttribute?a.removeAttribute(f.expando):a[f.expando]=null)}},_data:function(a,b,c){return f.data(a,b,c,!0)},acceptData:function(a){if(a.nodeName){var b=f.noData[a.nodeName.toLowerCase()];if(b)return b!==!0&&a.getAttribute("classid")===b}return!0}}),f.fn.extend({data:function(a,c){var d=null;if(typeof a=="undefined"){if(this.length){d=f.data(this[0]);if(this[0].nodeType===1){var e=this[0].attributes,g;for(var h=0,i=e.length;h<i;h++)g=e[h].name,g.indexOf("data-")===0&&(g=f.camelCase(g.substring(5)),k(this[0],g,d[g]))}}return d}if(typeof a=="object")return this.each(function(){f.data(this,a)});var j=a.split(".");j[1]=j[1]?"."+j[1]:"";if(c===b){d=this.triggerHandler("getData"+j[1]+"!",[j[0]]),d===b&&this.length&&(d=f.data(this[0],a),d=k(this[0],a,d));return d===b&&j[1]?this.data(j[0]):d}return this.each(function(){var b=f(this),d=[j[0],c];b.triggerHandler("setData"+j[1]+"!",d),f.data(this,a,c),b.triggerHandler("changeData"+j[1]+"!",d)})},removeData:function(a){return this.each(function(){f.removeData(this,a)})}}),f.extend({_mark:function(a,c){a&&(c=(c||"fx")+"mark",f.data(a,c,(f.data(a,c,b,!0)||0)+1,!0))},_unmark:function(a,c,d){a!==!0&&(d=c,c=a,a=!1);if(c){d=d||"fx";var e=d+"mark",g=a?0:(f.data(c,e,b,!0)||1)-1;g?f.data(c,e,g,!0):(f.removeData(c,e,!0),m(c,d,"mark"))}},queue:function(a,c,d){if(a){c=(c||"fx")+"queue";var e=f.data(a,c,b,!0);d&&(!e||f.isArray(d)?e=f.data(a,c,f.makeArray(d),!0):e.push(d));return e||[]}},dequeue:function(a,b){b=b||"fx";var c=f.queue(a,b),d=c.shift(),e;d==="inprogress"&&(d=c.shift()),d&&(b==="fx"&&c.unshift("inprogress"),d.call(a,function(){f.dequeue(a,b)})),c.length||(f.removeData(a,b+"queue",!0),m(a,b,"queue"))}}),f.fn.extend({queue:function(a,c){typeof a!="string"&&(c=a,a="fx");if(c===b)return f.queue(this[0],a);return this.each(function(){var b=f.queue(this,a,c);a==="fx"&&b[0]!=="inprogress"&&f.dequeue(this,a)})},dequeue:function(a){return this.each(function(){f.dequeue(this,a)})},delay:function(a,b){a=f.fx?f.fx.speeds[a]||a:a,b=b||"fx";return this.queue(b,function(){var c=this;setTimeout(function(){f.dequeue(c,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,c){function m(){--h||d.resolveWith(e,[e])}typeof a!="string"&&(c=a,a=b),a=a||"fx";var d=f.Deferred(),e=this,g=e.length,h=1,i=a+"defer",j=a+"queue",k=a+"mark",l;while(g--)if(l=f.data(e[g],i,b,!0)||(f.data(e[g],j,b,!0)||f.data(e[g],k,b,!0))&&f.data(e[g],i,f._Deferred(),!0))h++,l.done(m);m();return d.promise()}});var n=/[\n\t\r]/g,o=/\s+/,p=/\r/g,q=/^(?:button|input)$/i,r=/^(?:button|input|object|select|textarea)$/i,s=/^a(?:rea)?$/i,t=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,u,v;f.fn.extend({attr:function(a,b){return f.access(this,a,b,!0,f.attr)},removeAttr:function(a){return this.each(function(){f.removeAttr(this,a)})},prop:function(a,b){return f.access(this,a,b,!0,f.prop)},removeProp:function(a){a=f.propFix[a]||a;return this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){var b,c,d,e,g,h,i;if(f.isFunction(a))return this.each(function(b){f(this).addClass(a.call(this,b,this.className))});if(a&&typeof a=="string"){b=a.split(o);for(c=0,d=this.length;c<d;c++){e=this[c];if(e.nodeType===1)if(!e.className&&b.length===1)e.className=a;else{g=" "+e.className+" ";for(h=0,i=b.length;h<i;h++)~g.indexOf(" "+b[h]+" ")||(g+=b[h]+" ");e.className=f.trim(g)}}}return this},removeClass:function(a){var c,d,e,g,h,i,j;if(f.isFunction(a))return this.each(function(b){f(this).removeClass(a.call(this,b,this.className))});if(a&&typeof a=="string"||a===b){c=(a||"").split(o);for(d=0,e=this.length;d<e;d++){g=this[d];if(g.nodeType===1&&g.className)if(a){h=(" "+g.className+" ").replace(n," ");for(i=0,j=c.length;i<j;i++)h=h.replace(" "+c[i]+" "," ");g.className=f.trim(h)}else g.className=""}}return this},toggleClass:function(a,b){var c=typeof a,d=typeof b=="boolean";if(f.isFunction(a))return this.each(function(c){f(this).toggleClass(a.call(this,c,this.className,b),b)});return this.each(function(){if(c==="string"){var e,g=0,h=f(this),i=b,j=a.split(o);while(e=j[g++])i=d?i:!h.hasClass(e),h[i?"addClass":"removeClass"](e)}else if(c==="undefined"||c==="boolean")this.className&&f._data(this,"__className__",this.className),this.className=this.className||a===!1?"":f._data(this,"__className__")||""})},hasClass:function(a){var b=" "+a+" ";for(var c=0,d=this.length;c<d;c++)if(this[c].nodeType===1&&(" "+this[c].className+" ").replace(n," ").indexOf(b)>-1)return!0;return!1},val:function(a){var c,d,e=this[0];if(!arguments.length){if(e){c=f.valHooks[e.nodeName.toLowerCase()]||f.valHooks[e.type];if(c&&"get"in c&&(d=c.get(e,"value"))!==b)return d;d=e.value;return typeof d=="string"?d.replace(p,""):d==null?"":d}return b}var g=f.isFunction(a);return this.each(function(d){var e=f(this),h;if(this.nodeType===1){g?h=a.call(this,d,e.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.nodeName.toLowerCase()]||f.valHooks[this.type];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c=a.selectedIndex,d=[],e=a.options,g=a.type==="select-one";if(c<0)return null;for(var h=g?c:0,i=g?c+1:e.length;h<i;h++){var j=e[h];if(j.selected&&(f.support.optDisabled?!j.disabled:j.getAttribute("disabled")===null)&&(!j.parentNode.disabled||!f.nodeName(j.parentNode,"optgroup"))){b=f(j).val();if(g)return b;d.push(b)}}if(g&&!d.length&&e.length)return f(e[c]).val();return d},set:function(a,b){var c=f.makeArray(b);f(a).find("option").each(function(){this.selected=f.inArray(f(this).val(),c)>=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attrFix:{tabindex:"tabIndex"},attr:function(a,c,d,e){var g=a.nodeType;if(!a||g===3||g===8||g===2)return b;if(e&&c in f.attrFn)return f(a)[c](d);if(!("getAttribute"in a))return f.prop(a,c,d);var h,i,j=g!==1||!f.isXMLDoc(a);j&&(c=f.attrFix[c]||c,i=f.attrHooks[c],i||(t.test(c)?i=v:u&&(i=u)));if(d!==b){if(d===null){f.removeAttr(a,c);return b}if(i&&"set"in i&&j&&(h=i.set(a,d,c))!==b)return h;a.setAttribute(c,""+d);return d}if(i&&"get"in i&&j&&(h=i.get(a,c))!==null)return h;h=a.getAttribute(c);return h===null?b:h},removeAttr:function(a,b){var c;a.nodeType===1&&(b=f.attrFix[b]||b,f.attr(a,b,""),a.removeAttribute(b),t.test(b)&&(c=f.propFix[b]||b)in a&&(a[c]=!1))},attrHooks:{type:{set:function(a,b){if(q.test(a.nodeName)&&a.parentNode)f.error("type property can't be changed");else if(!f.support.radioValue&&b==="radio"&&f.nodeName(a,"input")){var c=a.value;a.setAttribute("type",b),c&&(a.value=c);return b}}},value:{get:function(a,b){if(u&&f.nodeName(a,"button"))return u.get(a,b);return b in a?a.value:null},set:function(a,b,c){if(u&&f.nodeName(a,"button"))return u.set(a,b,c);a.value=b}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(a,c,d){var e=a.nodeType;if(!a||e===3||e===8||e===2)return b;var g,h,i=e!==1||!f.isXMLDoc(a);i&&(c=f.propFix[c]||c,h=f.propHooks[c]);return d!==b?h&&"set"in h&&(g=h.set(a,d,c))!==b?g:a[c]=d:h&&"get"in h&&(g=h.get(a,c))!==null?g:a[c]},propHooks:{tabIndex:{get:function(a){var c=a.getAttributeNode("tabindex");return c&&c.specified?parseInt(c.value,10):r.test(a.nodeName)||s.test(a.nodeName)&&a.href?0:b}}}}),f.attrHooks.tabIndex=f.propHooks.tabIndex,v={get:function(a,c){var d;return f.prop(a,c)===!0||(d=a.getAttributeNode(c))&&d.nodeValue!==!1?c.toLowerCase():b},set:function(a,b,c){var d;b===!1?f.removeAttr(a,c):(d=f.propFix[c]||c,d in a&&(a[d]=!0),a.setAttribute(c,c.toLowerCase()));return c}},f.support.getSetAttribute||(u=f.valHooks.button={get:function(a,c){var d;d=a.getAttributeNode(c);return d&&d.nodeValue!==""?d.nodeValue:b},set:function(a,b,d){var e=a.getAttributeNode(d);e||(e=c.createAttribute(d),a.setAttributeNode(e));return e.nodeValue=b+""}},f.each(["width","height"],function(a,b){f.attrHooks[b]=f.extend(f.attrHooks[b],{set:function(a,c){if(c===""){a.setAttribute(b,"auto");return c}}})})),f.support.hrefNormalized||f.each(["href","src","width","height"],function(a,c){f.attrHooks[c]=f.extend(f.attrHooks[c],{get:function(a){var d=a.getAttribute(c,2);return d===null?b:d}})}),f.support.style||(f.attrHooks.style={get:function(a){return a.style.cssText.toLowerCase()||b},set:function(a,b){return a.style.cssText=""+b}}),f.support.optSelected||(f.propHooks.selected=f.extend(f.propHooks.selected,{get:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex);return null}})),f.support.checkOn||f.each(["radio","checkbox"],function(){f.valHooks[this]={get:function(a){return a.getAttribute("value")===null?"on":a.value}}}),f.each(["radio","checkbox"],function(){f.valHooks[this]=f.extend(f.valHooks[this],{set:function(a,b){if(f.isArray(b))return a.checked=f.inArray(f(a).val(),b)>=0}})});var w=/\.(.*)$/,x=/^(?:textarea|input|select)$/i,y=/\./g,z=/ /g,A=/[^\w\s.|`]/g,B=function(a){return a.replace(A,"\\$&")};f.event={add:function(a,c,d,e){if(a.nodeType!==3&&a.nodeType!==8){if(d===!1)d=C;else if(!d)return;var g,h;d.handler&&(g=d,d=g.handler),d.guid||(d.guid=f.guid++);var i=f._data(a);if(!i)return;var j=i.events,k=i.handle;j||(i.events=j={}),k||(i.handle=k=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.handle.apply(k.elem,arguments):b}),k.elem=a,c=c.split(" ");var l,m=0,n;while(l=c[m++]){h=g?f.extend({},g):{handler:d,data:e},l.indexOf(".")>-1?(n=l.split("."),l=n.shift(),h.namespace=n.slice(0).sort().join(".")):(n=[],h.namespace=""),h.type=l,h.guid||(h.guid=d.guid);var o=j[l],p=f.event.special[l]||{};if(!o){o=j[l]=[];if(!p.setup||p.setup.call(a,e,n,k)===!1)a.addEventListener?a.addEventListener(l,k,!1):a.attachEvent&&a.attachEvent("on"+l,k)}p.add&&(p.add.call(a,h),h.handler.guid||(h.handler.guid=d.guid)),o.push(h),f.event.global[l]=!0}a=null}},global:{},remove:function(a,c,d,e){if(a.nodeType!==3&&a.nodeType!==8){d===!1&&(d=C);var g,h,i,j,k=0,l,m,n,o,p,q,r,s=f.hasData(a)&&f._data(a),t=s&&s.events;if(!s||!t)return;c&&c.type&&(d=c.handler,c=c.type);if(!c||typeof c=="string"&&c.charAt(0)==="."){c=c||"";for(h in t)f.event.remove(a,h+c);return}c=c.split(" ");while(h=c[k++]){r=h,q=null,l=h.indexOf(".")<0,m=[],l||(m=h.split("."),h=m.shift(),n=new RegExp("(^|\\.)"+f.map(m.slice(0).sort(),B).join("\\.(?:.*\\.)?")+"(\\.|$)")),p=t[h];if(!p)continue;if(!d){for(j=0;j<p.length;j++){q=p[j];if(l||n.test(q.namespace))f.event.remove(a,r,q.handler,j),p.splice(j--,1)}continue}o=f.event.special[h]||{};for(j=e||0;j<p.length;j++){q=p[j];if(d.guid===q.guid){if(l||n.test(q.namespace))e==null&&p.splice(j--,1),o.remove&&o.remove.call(a,q);if(e!=null)break}}if(p.length===0||e!=null&&p.length===1)(!o.teardown||o.teardown.call(a,m)===!1)&&f.removeEvent(a,h,s.handle),g=null,delete +t[h]}if(f.isEmptyObject(t)){var u=s.handle;u&&(u.elem=null),delete s.events,delete s.handle,f.isEmptyObject(s)&&f.removeData(a,b,!0)}}},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(c,d,e,g){var h=c.type||c,i=[],j;h.indexOf("!")>=0&&(h=h.slice(0,-1),j=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if(!!e&&!f.event.customEvent[h]||!!f.event.global[h]){c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.exclusive=j,c.namespace=i.join("."),c.namespace_re=new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)");if(g||!e)c.preventDefault(),c.stopPropagation();if(!e){f.each(f.cache,function(){var a=f.expando,b=this[a];b&&b.events&&b.events[h]&&f.event.trigger(c,d,b.handle.elem)});return}if(e.nodeType===3||e.nodeType===8)return;c.result=b,c.target=e,d=d!=null?f.makeArray(d):[],d.unshift(c);var k=e,l=h.indexOf(":")<0?"on"+h:"";do{var m=f._data(k,"handle");c.currentTarget=k,m&&m.apply(k,d),l&&f.acceptData(k)&&k[l]&&k[l].apply(k,d)===!1&&(c.result=!1,c.preventDefault()),k=k.parentNode||k.ownerDocument||k===c.target.ownerDocument&&a}while(k&&!c.isPropagationStopped());if(!c.isDefaultPrevented()){var n,o=f.event.special[h]||{};if((!o._default||o._default.call(e.ownerDocument,c)===!1)&&(h!=="click"||!f.nodeName(e,"a"))&&f.acceptData(e)){try{l&&e[h]&&(n=e[l],n&&(e[l]=null),f.event.triggered=h,e[h]())}catch(p){}n&&(e[l]=n),f.event.triggered=b}}return c.result}},handle:function(c){c=f.event.fix(c||a.event);var d=((f._data(this,"events")||{})[c.type]||[]).slice(0),e=!c.exclusive&&!c.namespace,g=Array.prototype.slice.call(arguments,0);g[0]=c,c.currentTarget=this;for(var h=0,i=d.length;h<i;h++){var j=d[h];if(e||c.namespace_re.test(j.namespace)){c.handler=j.handler,c.data=j.data,c.handleObj=j;var k=j.handler.apply(this,g);k!==b&&(c.result=k,k===!1&&(c.preventDefault(),c.stopPropagation()));if(c.isImmediatePropagationStopped())break}}return c.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(a){if(a[f.expando])return a;var d=a;a=f.Event(d);for(var e=this.props.length,g;e;)g=this.props[--e],a[g]=d[g];a.target||(a.target=a.srcElement||c),a.target.nodeType===3&&(a.target=a.target.parentNode),!a.relatedTarget&&a.fromElement&&(a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement);if(a.pageX==null&&a.clientX!=null){var h=a.target.ownerDocument||c,i=h.documentElement,j=h.body;a.pageX=a.clientX+(i&&i.scrollLeft||j&&j.scrollLeft||0)-(i&&i.clientLeft||j&&j.clientLeft||0),a.pageY=a.clientY+(i&&i.scrollTop||j&&j.scrollTop||0)-(i&&i.clientTop||j&&j.clientTop||0)}a.which==null&&(a.charCode!=null||a.keyCode!=null)&&(a.which=a.charCode!=null?a.charCode:a.keyCode),!a.metaKey&&a.ctrlKey&&(a.metaKey=a.ctrlKey),!a.which&&a.button!==b&&(a.which=a.button&1?1:a.button&2?3:a.button&4?2:0);return a},guid:1e8,proxy:f.proxy,special:{ready:{setup:f.bindReady,teardown:f.noop},live:{add:function(a){f.event.add(this,M(a.origType,a.selector),f.extend({},a,{handler:L,guid:a.handler.guid}))},remove:function(a){f.event.remove(this,M(a.origType,a.selector),a)}},beforeunload:{setup:function(a,b,c){f.isWindow(this)&&(this.onbeforeunload=c)},teardown:function(a,b){this.onbeforeunload===b&&(this.onbeforeunload=null)}}}},f.removeEvent=c.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){a.detachEvent&&a.detachEvent("on"+b,c)},f.Event=function(a,b){if(!this.preventDefault)return new f.Event(a,b);a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||a.returnValue===!1||a.getPreventDefault&&a.getPreventDefault()?D:C):this.type=a,b&&f.extend(this,b),this.timeStamp=f.now(),this[f.expando]=!0},f.Event.prototype={preventDefault:function(){this.isDefaultPrevented=D;var a=this.originalEvent;!a||(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){this.isPropagationStopped=D;var a=this.originalEvent;!a||(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=D,this.stopPropagation()},isDefaultPrevented:C,isPropagationStopped:C,isImmediatePropagationStopped:C};var E=function(a){var b=a.relatedTarget,c=!1,d=a.type;a.type=a.data,b!==this&&(b&&(c=f.contains(this,b)),c||(f.event.handle.apply(this,arguments),a.type=d))},F=function(a){a.type=a.data,f.event.handle.apply(this,arguments)};f.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){f.event.special[a]={setup:function(c){f.event.add(this,b,c&&c.selector?F:E,a)},teardown:function(a){f.event.remove(this,b,a&&a.selector?F:E)}}}),f.support.submitBubbles||(f.event.special.submit={setup:function(a,b){if(!f.nodeName(this,"form"))f.event.add(this,"click.specialSubmit",function(a){var b=a.target,c=f.nodeName(b,"input")||f.nodeName(b,"button")?b.type:"";(c==="submit"||c==="image")&&f(b).closest("form").length&&J("submit",this,arguments)}),f.event.add(this,"keypress.specialSubmit",function(a){var b=a.target,c=f.nodeName(b,"input")||f.nodeName(b,"button")?b.type:"";(c==="text"||c==="password")&&f(b).closest("form").length&&a.keyCode===13&&J("submit",this,arguments)});else return!1},teardown:function(a){f.event.remove(this,".specialSubmit")}});if(!f.support.changeBubbles){var G,H=function(a){var b=f.nodeName(a,"input")?a.type:"",c=a.value;b==="radio"||b==="checkbox"?c=a.checked:b==="select-multiple"?c=a.selectedIndex>-1?f.map(a.options,function(a){return a.selected}).join("-"):"":f.nodeName(a,"select")&&(c=a.selectedIndex);return c},I=function(c){var d=c.target,e,g;if(!!x.test(d.nodeName)&&!d.readOnly){e=f._data(d,"_change_data"),g=H(d),(c.type!=="focusout"||d.type!=="radio")&&f._data(d,"_change_data",g);if(e===b||g===e)return;if(e!=null||g)c.type="change",c.liveFired=b,f.event.trigger(c,arguments[1],d)}};f.event.special.change={filters:{focusout:I,beforedeactivate:I,click:function(a){var b=a.target,c=f.nodeName(b,"input")?b.type:"";(c==="radio"||c==="checkbox"||f.nodeName(b,"select"))&&I.call(this,a)},keydown:function(a){var b=a.target,c=f.nodeName(b,"input")?b.type:"";(a.keyCode===13&&!f.nodeName(b,"textarea")||a.keyCode===32&&(c==="checkbox"||c==="radio")||c==="select-multiple")&&I.call(this,a)},beforeactivate:function(a){var b=a.target;f._data(b,"_change_data",H(b))}},setup:function(a,b){if(this.type==="file")return!1;for(var c in G)f.event.add(this,c+".specialChange",G[c]);return x.test(this.nodeName)},teardown:function(a){f.event.remove(this,".specialChange");return x.test(this.nodeName)}},G=f.event.special.change.filters,G.focus=G.beforeactivate}f.support.focusinBubbles||f.each({focus:"focusin",blur:"focusout"},function(a,b){function e(a){var c=f.event.fix(a);c.type=b,c.originalEvent={},f.event.trigger(c,null,c.target),c.isDefaultPrevented()&&a.preventDefault()}var d=0;f.event.special[b]={setup:function(){d++===0&&c.addEventListener(a,e,!0)},teardown:function(){--d===0&&c.removeEventListener(a,e,!0)}}}),f.each(["bind","one"],function(a,c){f.fn[c]=function(a,d,e){var g;if(typeof a=="object"){for(var h in a)this[c](h,d,a[h],e);return this}if(arguments.length===2||d===!1)e=d,d=b;c==="one"?(g=function(a){f(this).unbind(a,g);return e.apply(this,arguments)},g.guid=e.guid||f.guid++):g=e;if(a==="unload"&&c!=="one")this.one(a,d,e);else for(var i=0,j=this.length;i<j;i++)f.event.add(this[i],a,g,d);return this}}),f.fn.extend({unbind:function(a,b){if(typeof a=="object"&&!a.preventDefault)for(var c in a)this.unbind(c,a[c]);else for(var d=0,e=this.length;d<e;d++)f.event.remove(this[d],a,b);return this},delegate:function(a,b,c,d){return this.live(b,c,d,a)},undelegate:function(a,b,c){return arguments.length===0?this.unbind("live"):this.die(b,null,c,a)},trigger:function(a,b){return this.each(function(){f.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0])return f.event.trigger(a,b,this[0],!0)},toggle:function(a){var b=arguments,c=a.guid||f.guid++,d=0,e=function(c){var e=(f.data(this,"lastToggle"+a.guid)||0)%d;f.data(this,"lastToggle"+a.guid,e+1),c.preventDefault();return b[e].apply(this,arguments)||!1};e.guid=c;while(d<b.length)b[d++].guid=c;return this.click(e)},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}});var K={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};f.each(["live","die"],function(a,c){f.fn[c]=function(a,d,e,g){var h,i=0,j,k,l,m=g||this.selector,n=g?this:f(this.context);if(typeof a=="object"&&!a.preventDefault){for(var o in a)n[c](o,d,a[o],m);return this}if(c==="die"&&!a&&g&&g.charAt(0)==="."){n.unbind(g);return this}if(d===!1||f.isFunction(d))e=d||C,d=b;a=(a||"").split(" ");while((h=a[i++])!=null){j=w.exec(h),k="",j&&(k=j[0],h=h.replace(w,""));if(h==="hover"){a.push("mouseenter"+k,"mouseleave"+k);continue}l=h,K[h]?(a.push(K[h]+k),h=h+k):h=(K[h]||h)+k;if(c==="live")for(var p=0,q=n.length;p<q;p++)f.event.add(n[p],"live."+M(h,m),{data:d,selector:m,handler:e,origType:h,origHandler:e,preType:l});else n.unbind("live."+M(h,m),e)}return this}}),f.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error".split(" "),function(a,b){f.fn[b]=function(a,c){c==null&&(c=a,a=null);return arguments.length>0?this.bind(b,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0)}),function(){function u(a,b,c,d,e,f){for(var g=0,h=d.length;g<h;g++){var i=d[g];if(i){var j=!1;i=i[a];while(i){if(i.sizcache===c){j=d[i.sizset];break}if(i.nodeType===1){f||(i.sizcache=c,i.sizset=g);if(typeof b!="string"){if(i===b){j=!0;break}}else if(k.filter(b,[i]).length>0){j=i;break}}i=i[a]}d[g]=j}}}function t(a,b,c,d,e,f){for(var g=0,h=d.length;g<h;g++){var i=d[g];if(i){var j=!1;i=i[a];while(i){if(i.sizcache===c){j=d[i.sizset];break}i.nodeType===1&&!f&&(i.sizcache=c,i.sizset=g);if(i.nodeName.toLowerCase()===b){j=i;break}i=i[a]}d[g]=j}}}var a=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d=0,e=Object.prototype.toString,g=!1,h=!0,i=/\\/g,j=/\W/;[0,0].sort(function(){h=!1;return 0});var k=function(b,d,f,g){f=f||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return f;var i,j,n,o,q,r,s,t,u=!0,w=k.isXML(d),x=[],y=b;do{a.exec(""),i=a.exec(y);if(i){y=i[3],x.push(i[1]);if(i[2]){o=i[3];break}}}while(i);if(x.length>1&&m.exec(b))if(x.length===2&&l.relative[x[0]])j=v(x[0]+x[1],d);else{j=l.relative[x[0]]?[d]:k(x.shift(),d);while(x.length)b=x.shift(),l.relative[b]&&(b+=x.shift()),j=v(b,j)}else{!g&&x.length>1&&d.nodeType===9&&!w&&l.match.ID.test(x[0])&&!l.match.ID.test(x[x.length-1])&&(q=k.find(x.shift(),d,w),d=q.expr?k.filter(q.expr,q.set)[0]:q.set[0]);if(d){q=g?{expr:x.pop(),set:p(g)}:k.find(x.pop(),x.length===1&&(x[0]==="~"||x[0]==="+")&&d.parentNode?d.parentNode:d,w),j=q.expr?k.filter(q.expr,q.set):q.set,x.length>0?n=p(j):u=!1;while(x.length)r=x.pop(),s=r,l.relative[r]?s=x.pop():r="",s==null&&(s=d),l.relative[r](n,s,w)}else n=x=[]}n||(n=j),n||k.error(r||b);if(e.call(n)==="[object Array]")if(!u)f.push.apply(f,n);else if(d&&d.nodeType===1)for(t=0;n[t]!=null;t++)n[t]&&(n[t]===!0||n[t].nodeType===1&&k.contains(d,n[t]))&&f.push(j[t]);else for(t=0;n[t]!=null;t++)n[t]&&n[t].nodeType===1&&f.push(j[t]);else p(n,f);o&&(k(o,h,f,g),k.uniqueSort(f));return f};k.uniqueSort=function(a){if(r){g=h,a.sort(r);if(g)for(var b=1;b<a.length;b++)a[b]===a[b-1]&&a.splice(b--,1)}return a},k.matches=function(a,b){return k(a,null,null,b)},k.matchesSelector=function(a,b){return k(b,null,null,[a]).length>0},k.find=function(a,b,c){var d;if(!a)return[];for(var e=0,f=l.order.length;e<f;e++){var g,h=l.order[e];if(g=l.leftMatch[h].exec(a)){var j=g[1];g.splice(1,1);if(j.substr(j.length-1)!=="\\"){g[1]=(g[1]||"").replace(i,""),d=l.find[h](g,b,c);if(d!=null){a=a.replace(l.match[h],"");break}}}}d||(d=typeof b.getElementsByTagName!="undefined"?b.getElementsByTagName("*"):[]);return{set:d,expr:a}},k.filter=function(a,c,d,e){var f,g,h=a,i=[],j=c,m=c&&c[0]&&k.isXML(c[0]);while(a&&c.length){for(var n in l.filter)if((f=l.leftMatch[n].exec(a))!=null&&f[2]){var o,p,q=l.filter[n],r=f[1];g=!1,f.splice(1,1);if(r.substr(r.length-1)==="\\")continue;j===i&&(i=[]);if(l.preFilter[n]){f=l.preFilter[n](f,j,d,i,e,m);if(!f)g=o=!0;else if(f===!0)continue}if(f)for(var s=0;(p=j[s])!=null;s++)if(p){o=q(p,f,s,j);var t=e^!!o;d&&o!=null?t?g=!0:j[s]=!1:t&&(i.push(p),g=!0)}if(o!==b){d||(j=i),a=a.replace(l.match[n],"");if(!g)return[];break}}if(a===h)if(g==null)k.error(a);else break;h=a}return j},k.error=function(a){throw"Syntax error, unrecognized expression: "+a};var l=k.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(a){return a.getAttribute("href")},type:function(a){return a.getAttribute("type")}},relative:{"+":function(a,b){var c=typeof b=="string",d=c&&!j.test(b),e=c&&!d;d&&(b=b.toLowerCase());for(var f=0,g=a.length,h;f<g;f++)if(h=a[f]){while((h=h.previousSibling)&&h.nodeType!==1);a[f]=e||h&&h.nodeName.toLowerCase()===b?h||!1:h===b}e&&k.filter(b,a,!0)},">":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!j.test(b)){b=b.toLowerCase();for(;e<f;e++){c=a[e];if(c){var g=c.parentNode;a[e]=g.nodeName.toLowerCase()===b?g:!1}}}else{for(;e<f;e++)c=a[e],c&&(a[e]=d?c.parentNode:c.parentNode===b);d&&k.filter(b,a,!0)}},"":function(a,b,c){var e,f=d++,g=u;typeof b=="string"&&!j.test(b)&&(b=b.toLowerCase(),e=b,g=t),g("parentNode",b,f,a,e,c)},"~":function(a,b,c){var e,f=d++,g=u;typeof b=="string"&&!j.test(b)&&(b=b.toLowerCase(),e=b,g=t),g("previousSibling",b,f,a,e,c)}},find:{ID:function(a,b,c){if(typeof b.getElementById!="undefined"&&!c){var d=b.getElementById(a[1]);return d&&d.parentNode?[d]:[]}},NAME:function(a,b){if(typeof b.getElementsByName!="undefined"){var c=[],d=b.getElementsByName(a[1]);for(var e=0,f=d.length;e<f;e++)d[e].getAttribute("name")===a[1]&&c.push(d[e]);return c.length===0?null:c}},TAG:function(a,b){if(typeof b.getElementsByTagName!="undefined")return b.getElementsByTagName(a[1])}},preFilter:{CLASS:function(a,b,c,d,e,f){a=" "+a[1].replace(i,"")+" ";if(f)return a;for(var g=0,h;(h=b[g])!=null;g++)h&&(e^(h.className&&(" "+h.className+" ").replace(/[\t\n\r]/g," ").indexOf(a)>=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(i,"")},TAG:function(a,b){return a[1].replace(i,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||k.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&k.error(a[0]);a[0]=d++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(i,"");!f&&l.attrMap[g]&&(a[1]=l.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(i,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=k(b[3],null,null,c);else{var g=k.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(l.match.POS.test(b[0])||l.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!k(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return b<c[3]-0},gt:function(a,b,c){return b>c[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=l.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||k.getText([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h<i;h++)if(g[h]===a)return!1;return!0}k.error(e)},CHILD:function(a,b){var c=b[1],d=a;switch(c){case"only":case"first":while(d=d.previousSibling)if(d.nodeType===1)return!1;if(c==="first")return!0;d=a;case"last":while(d=d.nextSibling)if(d.nodeType===1)return!1;return!0;case"nth":var e=b[2],f=b[3];if(e===1&&f===0)return!0;var g=b[0],h=a.parentNode;if(h&&(h.sizcache!==g||!a.nodeIndex)){var i=0;for(d=h.firstChild;d;d=d.nextSibling)d.nodeType===1&&(d.nodeIndex=++i);h.sizcache=g}var j=a.nodeIndex-f;return e===0?j===0:j%e===0&&j/e>=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=l.attrHandle[c]?l.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=l.setFilters[e];if(f)return f(a,c,b,d)}}},m=l.match.POS,n=function(a,b){return"\\"+(b-0+1)};for(var o in l.match)l.match[o]=new RegExp(l.match[o].source+/(?![^\[]*\])(?![^\(]*\))/.source),l.leftMatch[o]=new RegExp(/(^(?:.|\r|\n)*?)/.source+l.match[o].source.replace(/\\(\d+)/g,n));var p=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(q){p=function(a,b){var c=0,d=b||[];if(e.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var f=a.length;c<f;c++)d.push(a[c]);else for(;a[c];c++)d.push(a[c]);return d}}var r,s;c.documentElement.compareDocumentPosition?r=function(a,b){if(a===b){g=!0;return 0}if(!a.compareDocumentPosition||!b.compareDocumentPosition)return a.compareDocumentPosition?-1:1;return a.compareDocumentPosition(b)&4?-1:1}:(r=function(a,b){if(a===b){g=!0;return 0}if(a.sourceIndex&&b.sourceIndex)return a.sourceIndex-b.sourceIndex;var c,d,e=[],f=[],h=a.parentNode,i=b.parentNode,j=h;if(h===i)return s(a,b);if(!h)return-1;if(!i)return 1;while(j)e.unshift(j),j=j.parentNode;j=i;while(j)f.unshift(j),j=j.parentNode;c=e.length,d=f.length;for(var k=0;k<c&&k<d;k++)if(e[k]!==f[k])return s(e[k],f[k]);return k===c?s(a,f[k],-1):s(e[k],b,1)},s=function(a,b,c){if(a===b)return c;var d=a.nextSibling;while(d){if(d===b)return-1;d=d.nextSibling}return 1}),k.getText=function(a){var b="",c;for(var d=0;a[d];d++)c=a[d],c.nodeType===3||c.nodeType===4?b+=c.nodeValue:c.nodeType!==8&&(b+=k.getText(c.childNodes));return b},function(){var a=c.createElement("div"),d="script"+(new Date).getTime(),e=c.documentElement;a.innerHTML="<a name='"+d+"'/>",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(l.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},l.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(l.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="<a href='#'></a>",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(l.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=k,b=c.createElement("div"),d="__sizzle__";b.innerHTML="<p class='TEST'></p>";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){k=function(b,e,f,g){e=e||c;if(!g&&!k.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return p(e.getElementsByTagName(b),f);if(h[2]&&l.find.CLASS&&e.getElementsByClassName)return p(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return p([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return p([],f);if(i.id===h[3])return p([i],f)}try{return p(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var m=e,n=e.getAttribute("id"),o=n||d,q=e.parentNode,r=/^\s*[+~]/.test(b);n?o=o.replace(/'/g,"\\$&"):e.setAttribute("id",o),r&&q&&(e=e.parentNode);try{if(!r||q)return p(e.querySelectorAll("[id='"+o+"'] "+b),f)}catch(s){}finally{n||m.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)k[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}k.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!k.isXML(a))try{if(e||!l.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return k(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="<div class='test e'></div><div class='test'></div>";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;l.order.splice(1,0,"CLASS"),l.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?k.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?k.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:k.contains=function(){return!1},k.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var v=function(a,b){var c,d=[],e="",f=b.nodeType?[b]:b;while(c=l.match.PSEUDO.exec(a))e+=c[0],a=a.replace(l.match.PSEUDO,"");a=l.relative[a]?a+"*":a;for(var g=0,h=f.length;g<h;g++)k(a,f[g],d);return k.filter(e,d)};f.find=k,f.expr=k.selectors,f.expr[":"]=f.expr.filters,f.unique=k.uniqueSort,f.text=k.getText,f.isXMLDoc=k.isXML,f.contains=k.contains}();var N=/Until$/,O=/^(?:parents|prevUntil|prevAll)/,P=/,/,Q=/^.[^:#\[\.,]*$/,R=Array.prototype.slice,S=f.expr.match.POS,T={children:!0,contents:!0,next:!0,prev:!0};f.fn.extend({find:function(a){var b=this,c,d;if(typeof a!="string")return f(a).filter(function(){for(c=0,d=b.length;c<d;c++)if(f.contains(b[c],this))return!0});var e=this.pushStack("","find",a),g,h,i;for(c=0,d=this.length;c<d;c++){g=e.length,f.find(a,this[c],e);if(c>0)for(h=g;h<e.length;h++)for(i=0;i<g;i++)if(e[i]===e[h]){e.splice(h--,1);break}}return e},has:function(a){var b=f(a);return this.filter(function(){for(var a=0,c=b.length;a<c;a++)if(f.contains(this,b[a]))return!0})},not:function(a){return this.pushStack(V(this,a,!1),"not",a)},filter:function(a){return this.pushStack(V(this,a,!0),"filter",a)},is:function(a){return!!a&&(typeof a=="string"?f.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h,i,j={},k=1;if(g&&a.length){for(d=0,e=a.length;d<e;d++)i=a[d],j[i]||(j[i]=S.test(i)?f(i,b||this.context):i);while(g&&g.ownerDocument&&g!==b){for(i in j)h=j[i],(h.jquery?h.index(g)>-1:f(g).is(h))&&c.push({selector:i,elem:g,level:k});g=g.parentNode,k++}}return c}var l=S.test(a)||typeof a!="string"?f(a,b||this.context):0;for(d=0,e=this.length;d<e;d++){g=this[d];while(g){if(l?l.index(g)>-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a)return this[0]&&this[0].parentNode?this.prevAll().length:-1;if(typeof a=="string")return f.inArray(this[0],f(a));return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(U(c[0])||U(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling(a.parentNode.firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c),g=R.call(arguments);N.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!T[a]?f.unique(e):e,(this.length>1||P.test(d))&&O.test(a)&&(e=e.reverse());return this.pushStack(e,a,g.join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var W=/ jQuery\d+="(?:\d+|null)"/g,X=/^\s+/,Y=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Z=/<([\w:]+)/,$=/<tbody/i,_=/<|&#?\w+;/,ba=/<(?:script|object|embed|option|style)/i,bb=/checked\s*(?:[^=]|=\s*.checked.)/i,bc=/\/(java|ecma)script/i,bd=/^\s*<!(?:\[CDATA\[|\-\-)/,be={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]};be.optgroup=be.option,be.tbody=be.tfoot=be.colgroup=be.caption=be.thead,be.th=be.td,f.support.htmlSerialize||(be._default=[1,"div<div>","</div>"]),f.fn.extend({text:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.text(a.call(this,b,c.text()))});if(typeof a!="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return f.text(this)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){f(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f(arguments[0]).toArray());return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(W,""):null;if(typeof a=="string"&&!ba.test(a)&&(f.support.leadingWhitespace||!X.test(a))&&!be[(Z.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Y,"<$1></$2>");try{for(var c=0,d=this.length;c<d;c++)this[c].nodeType===1&&(f.cleanData(this[c].getElementsByTagName("*")),this[c].innerHTML=a)}catch(e){this.empty().append(a)}}else f.isFunction(a)?this.each(function(b){var c=f(this);c.html(a.call(this,b,c.html()))}):this.empty().append(a);return this},replaceWith:function(a){if(this[0]&&this[0].parentNode){if(f.isFunction(a))return this.each(function(b){var c=f(this),d=c.html();c.replaceWith(a.call(this,b,d))});typeof a!="string"&&(a=f(a).detach());return this.each(function(){var b=this.nextSibling,c=this.parentNode;f(this).remove(),b?f(b).before(a):f(c).append(a)})}return this.length?this.pushStack(f(f.isFunction(a)?a():a),"replaceWith",a):this},detach:function(a){return this.remove(a,!0)},domManip:function(a,c,d){var e,g,h,i,j=a[0],k=[];if(!f.support.checkClone&&arguments.length===3&&typeof j=="string"&&bb.test(j))return this.each(function(){f(this).domManip(a,c,d,!0)});if(f.isFunction(j))return this.each(function(e){var g=f(this);a[0]=j.call(this,e,c?g.html():b),g.domManip(a,c,d)});if(this[0]){i=j&&j.parentNode,f.support.parentNode&&i&&i.nodeType===11&&i.childNodes.length===this.length?e={fragment:i}:e=f.buildFragment(a,this,k),h=e.fragment,h.childNodes.length===1?g=h=h.firstChild:g=h.firstChild;if(g){c=c&&f.nodeName(g,"tr");for(var l=0,m=this.length,n=m-1;l<m;l++)d.call(c?bf(this[l],g):this[l],e.cacheable||m>1&&l<n?f.clone(h,!0,!0):h)}k.length&&f.each(k,bl)}return this}}),f.buildFragment=function(a,b,d){var e,g,h,i;b&&b[0]&&(i=b[0].ownerDocument||b[0]),i.createDocumentFragment||(i=c),a.length===1&&typeof a[0]=="string"&&a[0].length<512&&i===c&&a[0].charAt(0)==="<"&&!ba.test(a[0])&&(f.support.checkClone||!bb.test(a[0]))&&(g=!0,h=f.fragments[a[0]],h&&h!==1&&(e=h)),e||(e=i.createDocumentFragment(),f.clean +(a,i,e,d)),g&&(f.fragments[a[0]]=h?e:1);return{fragment:e,cacheable:g}},f.fragments={},f.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){f.fn[a]=function(c){var d=[],e=f(c),g=this.length===1&&this[0].parentNode;if(g&&g.nodeType===11&&g.childNodes.length===1&&e.length===1){e[b](this[0]);return this}for(var h=0,i=e.length;h<i;h++){var j=(h>0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d=a.cloneNode(!0),e,g,h;if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bh(a,d),e=bi(a),g=bi(d);for(h=0;e[h];++h)g[h]&&bh(e[h],g[h])}if(b){bg(a,d);if(c){e=bi(a),g=bi(d);for(h=0;e[h];++h)bg(e[h],g[h])}}e=g=null;return d},clean:function(a,b,d,e){var g;b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var h=[],i;for(var j=0,k;(k=a[j])!=null;j++){typeof k=="number"&&(k+="");if(!k)continue;if(typeof k=="string")if(!_.test(k))k=b.createTextNode(k);else{k=k.replace(Y,"<$1></$2>");var l=(Z.exec(k)||["",""])[1].toLowerCase(),m=be[l]||be._default,n=m[0],o=b.createElement("div");o.innerHTML=m[1]+k+m[2];while(n--)o=o.lastChild;if(!f.support.tbody){var p=$.test(k),q=l==="table"&&!p?o.firstChild&&o.firstChild.childNodes:m[1]==="<table>"&&!p?o.childNodes:[];for(i=q.length-1;i>=0;--i)f.nodeName(q[i],"tbody")&&!q[i].childNodes.length&&q[i].parentNode.removeChild(q[i])}!f.support.leadingWhitespace&&X.test(k)&&o.insertBefore(b.createTextNode(X.exec(k)[0]),o.firstChild),k=o.childNodes}var r;if(!f.support.appendChecked)if(k[0]&&typeof (r=k.length)=="number")for(i=0;i<r;i++)bk(k[i]);else bk(k);k.nodeType?h.push(k):h=f.merge(h,k)}if(d){g=function(a){return!a.type||bc.test(a.type)};for(j=0;h[j];j++)if(e&&f.nodeName(h[j],"script")&&(!h[j].type||h[j].type.toLowerCase()==="text/javascript"))e.push(h[j].parentNode?h[j].parentNode.removeChild(h[j]):h[j]);else{if(h[j].nodeType===1){var s=f.grep(h[j].getElementsByTagName("script"),g);h.splice.apply(h,[j+1,0].concat(s))}d.appendChild(h[j])}}return h},cleanData:function(a){var b,c,d=f.cache,e=f.expando,g=f.event.special,h=f.support.deleteExpando;for(var i=0,j;(j=a[i])!=null;i++){if(j.nodeName&&f.noData[j.nodeName.toLowerCase()])continue;c=j[f.expando];if(c){b=d[c]&&d[c][e];if(b&&b.events){for(var k in b.events)g[k]?f.event.remove(j,k):f.removeEvent(j,k,b.handle);b.handle&&(b.handle.elem=null)}h?delete j[f.expando]:j.removeAttribute&&j.removeAttribute(f.expando),delete d[c]}}}});var bm=/alpha\([^)]*\)/i,bn=/opacity=([^)]*)/,bo=/([A-Z]|^ms)/g,bp=/^-?\d+(?:px)?$/i,bq=/^-?\d/,br=/^([\-+])=([\-+.\de]+)/,bs={position:"absolute",visibility:"hidden",display:"block"},bt=["Left","Right"],bu=["Top","Bottom"],bv,bw,bx;f.fn.css=function(a,c){if(arguments.length===2&&c===b)return this;return f.access(this,a,c,!0,function(a,c,d){return d!==b?f.style(a,c,d):f.css(a,c)})},f.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=bv(a,"opacity","opacity");return c===""?"1":c}return a.style.opacity}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":f.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,d,e){if(!!a&&a.nodeType!==3&&a.nodeType!==8&&!!a.style){var g,h,i=f.camelCase(c),j=a.style,k=f.cssHooks[i];c=f.cssProps[i]||i;if(d===b){if(k&&"get"in k&&(g=k.get(a,!1,e))!==b)return g;return j[c]}h=typeof d,h==="string"&&(g=br.exec(d))&&(d=+(g[1]+1)*+g[2]+parseFloat(f.css(a,c)),h="number");if(d==null||h==="number"&&isNaN(d))return;h==="number"&&!f.cssNumber[i]&&(d+="px");if(!k||!("set"in k)||(d=k.set(a,d))!==b)try{j[c]=d}catch(l){}}},css:function(a,c,d){var e,g;c=f.camelCase(c),g=f.cssHooks[c],c=f.cssProps[c]||c,c==="cssFloat"&&(c="float");if(g&&"get"in g&&(e=g.get(a,!0,d))!==b)return e;if(bv)return bv(a,c)},swap:function(a,b,c){var d={};for(var e in b)d[e]=a.style[e],a.style[e]=b[e];c.call(a);for(e in b)a.style[e]=d[e]}}),f.curCSS=f.css,f.each(["height","width"],function(a,b){f.cssHooks[b]={get:function(a,c,d){var e;if(c){if(a.offsetWidth!==0)return by(a,b,d);f.swap(a,bs,function(){e=by(a,b,d)});return e}},set:function(a,b){if(!bp.test(b))return b;b=parseFloat(b);if(b>=0)return b+"px"}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return bn.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=f.isNaN(b)?"":"alpha(opacity="+b*100+")",g=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&f.trim(g.replace(bm,""))===""){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bm.test(g)?g.replace(bm,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){var c;f.swap(a,{display:"inline-block"},function(){b?c=bv(a,"margin-right","marginRight"):c=a.style.marginRight});return c}})}),c.defaultView&&c.defaultView.getComputedStyle&&(bw=function(a,c){var d,e,g;c=c.replace(bo,"-$1").toLowerCase();if(!(e=a.ownerDocument.defaultView))return b;if(g=e.getComputedStyle(a,null))d=g.getPropertyValue(c),d===""&&!f.contains(a.ownerDocument.documentElement,a)&&(d=f.style(a,c));return d}),c.documentElement.currentStyle&&(bx=function(a,b){var c,d=a.currentStyle&&a.currentStyle[b],e=a.runtimeStyle&&a.runtimeStyle[b],f=a.style;!bp.test(d)&&bq.test(d)&&(c=f.left,e&&(a.runtimeStyle.left=a.currentStyle.left),f.left=b==="fontSize"?"1em":d||0,d=f.pixelLeft+"px",f.left=c,e&&(a.runtimeStyle.left=e));return d===""?"auto":d}),bv=bw||bx,f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)});var bz=/%20/g,bA=/\[\]$/,bB=/\r?\n/g,bC=/#.*$/,bD=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bE=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bF=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,bG=/^(?:GET|HEAD)$/,bH=/^\/\//,bI=/\?/,bJ=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,bK=/^(?:select|textarea)/i,bL=/\s+/,bM=/([?&])_=[^&]*/,bN=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bO=f.fn.load,bP={},bQ={},bR,bS,bT=["*/"]+["*"];try{bR=e.href}catch(bU){bR=c.createElement("a"),bR.href="",bR=bR.href}bS=bN.exec(bR.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bO)return bO.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("<div>").append(c.replace(bJ,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bK.test(this.nodeName)||bE.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bB,"\r\n")}}):{name:b.name,value:c.replace(bB,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.bind(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?bX(a,f.ajaxSettings):(b=a,a=f.ajaxSettings),bX(a,b);return a},ajaxSettings:{url:bR,isLocal:bF.test(bS[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":bT},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:bV(bP),ajaxTransport:bV(bQ),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a>0?4:0;var o,r,u,w=c,x=l?bZ(d,v,l):b,y,z;if(a>=200&&a<300||a===304){if(d.ifModified){if(y=v.getResponseHeader("Last-Modified"))f.lastModified[k]=y;if(z=v.getResponseHeader("Etag"))f.etag[k]=z}if(a===304)w="notmodified",o=!0;else try{r=b$(d,x),w="success",o=!0}catch(A){w="parsererror",u=A}}else{u=w;if(!w||a)w="error",a<0&&(a=0)}v.status=a,v.statusText=""+(c||w),o?h.resolveWith(e,[r,w,v]):h.rejectWith(e,[v,w,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.resolveWith(e,[v,w]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f._Deferred(),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bD.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.done,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bC,"").replace(bH,bS[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bL),d.crossDomain==null&&(r=bN.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bS[1]&&r[2]==bS[2]&&(r[3]||(r[1]==="http:"?80:443))==(bS[3]||(bS[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),bW(bP,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bG.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bI.test(d.url)?"&":"?")+d.data,delete d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bM,"$1_="+x);d.url=y+(y===d.url?(bI.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", "+bT+"; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=bW(bQ,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){s<2?w(-1,z):f.error(z)}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)bY(g,a[g],c,e);return d.join("&").replace(bz,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var b_=f.now(),ca=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+b_++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=b.contentType==="application/x-www-form-urlencoded"&&typeof b.data=="string";if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(ca.test(b.url)||e&&ca.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(ca,l),b.url===j&&(e&&(k=k.replace(ca,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var cb=a.ActiveXObject?function(){for(var a in cd)cd[a](0,1)}:!1,cc=0,cd;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ce()||cf()}:ce,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,cb&&delete cd[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n),m.text=h.responseText;try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cc,cb&&(cd||(cd={},f(a).unload(cb)),cd[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var cg={},ch,ci,cj=/^(?:toggle|show|hide)$/,ck=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,cl,cm=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],cn;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(cq("show",3),a,b,c);for(var g=0,h=this.length;g<h;g++)d=this[g],d.style&&(e=d.style.display,!f._data(d,"olddisplay")&&e==="none"&&(e=d.style.display=""),e===""&&f.css(d,"display")==="none"&&f._data(d,"olddisplay",cr(d.nodeName)));for(g=0;g<h;g++){d=this[g];if(d.style){e=d.style.display;if(e===""||e==="none")d.style.display=f._data(d,"olddisplay")||""}}return this},hide:function(a,b,c){if(a||a===0)return this.animate(cq("hide",3),a,b,c);for(var d=0,e=this.length;d<e;d++)if(this[d].style){var g=f.css(this[d],"display");g!=="none"&&!f._data(this[d],"olddisplay")&&f._data(this[d],"olddisplay",g)}for(d=0;d<e;d++)this[d].style&&(this[d].style.display="none");return this},_toggle:f.fn.toggle,toggle:function(a,b,c){var d=typeof a=="boolean";f.isFunction(a)&&f.isFunction(b)?this._toggle.apply(this,arguments):a==null||d?this.each(function(){var b=d?a:f(this).is(":hidden");f(this)[b?"show":"hide"]()}):this.animate(cq("toggle",3),a,b,c);return this},fadeTo:function(a,b,c,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=f.speed(b,c,d);if(f.isEmptyObject(a))return this.each(e.complete,[!1]);a=f.extend({},a);return this[e.queue===!1?"each":"queue"](function(){e.queue===!1&&f._mark(this);var b=f.extend({},e),c=this.nodeType===1,d=c&&f(this).is(":hidden"),g,h,i,j,k,l,m,n,o;b.animatedProperties={};for(i in a){g=f.camelCase(i),i!==g&&(a[g]=a[i],delete a[i]),h=a[g],f.isArray(h)?(b.animatedProperties[g]=h[1],h=a[g]=h[0]):b.animatedProperties[g]=b.specialEasing&&b.specialEasing[g]||b.easing||"swing";if(h==="hide"&&d||h==="show"&&!d)return b.complete.call(this);c&&(g==="height"||g==="width")&&(b.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY],f.css(this,"display")==="inline"&&f.css(this,"float")==="none"&&(f.support.inlineBlockNeedsLayout?(j=cr(this.nodeName),j==="inline"?this.style.display="inline-block":(this.style.display="inline",this.style.zoom=1)):this.style.display="inline-block"))}b.overflow!=null&&(this.style.overflow="hidden");for(i in a)k=new f.fx(this,b,i),h=a[i],cj.test(h)?k[h==="toggle"?d?"show":"hide":h]():(l=ck.exec(h),m=k.cur(),l?(n=parseFloat(l[2]),o=l[3]||(f.cssNumber[i]?"":"px"),o!=="px"&&(f.style(this,i,(n||1)+o),m=(n||1)/k.cur()*m,f.style(this,i,m+o)),l[1]&&(n=(l[1]==="-="?-1:1)*n+m),k.custom(m,n,o)):k.custom(m,h,""));return!0})},stop:function(a,b){a&&this.queue([]),this.each(function(){var a=f.timers,c=a.length;b||f._unmark(!0,this);while(c--)a[c].elem===this&&(b&&a[c](!0),a.splice(c,1))}),b||this.dequeue();return this}}),f.each({slideDown:cq("show",1),slideUp:cq("hide",1),slideToggle:cq("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){f.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),f.extend({speed:function(a,b,c){var d=a&&typeof a=="object"?f.extend({},a):{complete:c||!c&&b||f.isFunction(a)&&a,duration:a,easing:c&&b||b&&!f.isFunction(b)&&b};d.duration=f.fx.off?0:typeof d.duration=="number"?d.duration:d.duration in f.fx.speeds?f.fx.speeds[d.duration]:f.fx.speeds._default,d.old=d.complete,d.complete=function(a){f.isFunction(d.old)&&d.old.call(this),d.queue!==!1?f.dequeue(this):a!==!1&&f._unmark(this)};return d},easing:{linear:function(a,b,c,d){return c+d*a},swing:function(a,b,c,d){return(-Math.cos(a*Math.PI)/2+.5)*d+c}},timers:[],fx:function(a,b,c){this.options=b,this.elem=a,this.prop=c,b.orig=b.orig||{}}}),f.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this),(f.fx.step[this.prop]||f.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];var a,b=f.css(this.elem,this.prop);return isNaN(a=parseFloat(b))?!b||b==="auto"?0:b:a},custom:function(a,b,c){function g(a){return d.step(a)}var d=this,e=f.fx;this.startTime=cn||co(),this.start=a,this.end=b,this.unit=c||this.unit||(f.cssNumber[this.prop]?"":"px"),this.now=this.start,this.pos=this.state=0,g.elem=this.elem,g()&&f.timers.push(g)&&!cl&&(cl=setInterval(e.tick,e.interval))},show:function(){this.options.orig[this.prop]=f.style(this.elem,this.prop),this.options.show=!0,this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur()),f(this.elem).show()},hide:function(){this.options.orig[this.prop]=f.style(this.elem,this.prop),this.options.hide=!0,this.custom(this.cur(),0)},step:function(a){var b=cn||co(),c=!0,d=this.elem,e=this.options,g,h;if(a||b>=e.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),e.animatedProperties[this.prop]=!0;for(g in e.animatedProperties)e.animatedProperties[g]!==!0&&(c=!1);if(c){e.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){d.style["overflow"+b]=e.overflow[a]}),e.hide&&f(d).hide();if(e.hide||e.show)for(var i in e.animatedProperties)f.style(d,i,e.orig[i]);e.complete.call(d)}return!1}e.duration==Infinity?this.now=b:(h=b-this.startTime,this.state=h/e.duration,this.pos=f.easing[e.animatedProperties[this.prop]](this.state,h,0,1,e.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){for(var a=f.timers,b=0;b<a.length;++b)a[b]()||a.splice(b--,1);a.length||f.fx.stop()},interval:13,stop:function(){clearInterval(cl),cl=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){f.style(a.elem,"opacity",a.now)},_default:function(a){a.elem.style&&a.elem.style[a.prop]!=null?a.elem.style[a.prop]=(a.prop==="width"||a.prop==="height"?Math.max(0,a.now):a.now)+a.unit:a.elem[a.prop]=a.now}}}),f.expr&&f.expr.filters&&(f.expr.filters.animated=function(a){return f.grep(f.timers,function(b){return a===b.elem}).length});var cs=/^t(?:able|d|h)$/i,ct=/^(?:body|html)$/i;"getBoundingClientRect"in c.documentElement?f.fn.offset=function(a){var b=this[0],c;if(a)return this.each(function(b){f.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return f.offset.bodyOffset(b);try{c=b.getBoundingClientRect()}catch(d){}var e=b.ownerDocument,g=e.documentElement;if(!c||!f.contains(g,b))return c?{top:c.top,left:c.left}:{top:0,left:0};var h=e.body,i=cu(e),j=g.clientTop||h.clientTop||0,k=g.clientLeft||h.clientLeft||0,l=i.pageYOffset||f.support.boxModel&&g.scrollTop||h.scrollTop,m=i.pageXOffset||f.support.boxModel&&g.scrollLeft||h.scrollLeft,n=c.top+l-j,o=c.left+m-k;return{top:n,left:o}}:f.fn.offset=function(a){var b=this[0];if(a)return this.each(function(b){f.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return f.offset.bodyOffset(b);f.offset.initialize();var c,d=b.offsetParent,e=b,g=b.ownerDocument,h=g.documentElement,i=g.body,j=g.defaultView,k=j?j.getComputedStyle(b,null):b.currentStyle,l=b.offsetTop,m=b.offsetLeft;while((b=b.parentNode)&&b!==i&&b!==h){if(f.offset.supportsFixedPosition&&k.position==="fixed")break;c=j?j.getComputedStyle(b,null):b.currentStyle,l-=b.scrollTop,m-=b.scrollLeft,b===d&&(l+=b.offsetTop,m+=b.offsetLeft,f.offset.doesNotAddBorder&&(!f.offset.doesAddBorderForTableAndCells||!cs.test(b.nodeName))&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),e=d,d=b.offsetParent),f.offset.subtractsBorderForOverflowNotVisible&&c.overflow!=="visible"&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),k=c}if(k.position==="relative"||k.position==="static")l+=i.offsetTop,m+=i.offsetLeft;f.offset.supportsFixedPosition&&k.position==="fixed"&&(l+=Math.max(h.scrollTop,i.scrollTop),m+=Math.max(h.scrollLeft,i.scrollLeft));return{top:l,left:m}},f.offset={initialize:function(){var a=c.body,b=c.createElement("div"),d,e,g,h,i=parseFloat(f.css(a,"marginTop"))||0,j="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";f.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"}),b.innerHTML=j,a.insertBefore(b,a.firstChild),d=b.firstChild,e=d.firstChild,h=d.nextSibling.firstChild.firstChild,this.doesNotAddBorder=e.offsetTop!==5,this.doesAddBorderForTableAndCells=h.offsetTop===5,e.style.position="fixed",e.style.top="20px",this.supportsFixedPosition=e.offsetTop===20||e.offsetTop===15,e.style.position=e.style.top="",d.style.overflow="hidden",d.style.position="relative",this.subtractsBorderForOverflowNotVisible=e.offsetTop===-5,this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==i,a.removeChild(b),f.offset.initialize=f.noop},bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;f.offset.initialize(),f.offset.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(f.css(a,"marginTop"))||0,c+=parseFloat(f.css(a,"marginLeft"))||0);return{top:b,left:c}},setOffset:function(a,b,c){var d=f.css(a,"position");d==="static"&&(a.style.position="relative");var e=f(a),g=e.offset(),h=f.css(a,"top"),i=f.css(a,"left"),j=(d==="absolute"||d==="fixed")&&f.inArray("auto",[h,i])>-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=ct.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!ct.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each(["Left","Top"],function(a,c){var d="scroll"+c;f.fn[d]=function(c){var e,g;if(c===b){e=this[0];if(!e)return null;g=cu(e);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:f.support.boxModel&&g.document.documentElement[d]||g.document.body[d]:e[d]}return this.each(function(){g=cu(this),g?g.scrollTo(a?f(g).scrollLeft():c,a?c:f(g).scrollTop()):this[d]=c})}}),f.each(["Height","Width"],function(a,c){var d=c.toLowerCase();f.fn["inner"+c]=function(){var a=this[0];return a&&a.style?parseFloat(f.css(a,d,"padding")):null},f.fn["outer"+c]=function(a){var b=this[0];return b&&b.style?parseFloat(f.css(b,d,a?"margin":"border")):null},f.fn[d]=function(a){var e=this[0];if(!e)return a==null?null:this;if(f.isFunction(a))return this.each(function(b){var c=f(this);c[d](a.call(this,b,c[d]()))});if(f.isWindow(e)){var g=e.document.documentElement["client"+c],h=e.document.body;return e.document.compatMode==="CSS1Compat"&&g||h&&h["client"+c]||g}if(e.nodeType===9)return Math.max(e.documentElement["client"+c],e.body["scroll"+c],e.documentElement["scroll"+c],e.body["offset"+c],e.documentElement["offset"+c]);if(a===b){var i=f.css(e,d),j=parseFloat(i);return f.isNaN(j)?i:j}return this.css(d,typeof a=="string"?a:a+"px")}}),a.jQuery=a.$=f})(window); \ No newline at end of file diff --git a/modules/mondialrelay/mondialrelay.js b/modules/mondialrelay/mondialrelay.js index 0c34688af..259902c83 100755 --- a/modules/mondialrelay/mondialrelay.js +++ b/modules/mondialrelay/mondialrelay.js @@ -511,6 +511,8 @@ function PS_MRDisplayRelayPoint(json, blockContent, carrier_id) { numberDisplayed = 0; + // Disable Gmap for IE user + if (!$.browser.msie) PS_MRCreateGmap(carrier_id); blockContent.fadeOut('fast', function() { @@ -541,7 +543,13 @@ function PS_MRDisplayRelayPoint(json, blockContent, carrier_id) // Store all the object content to prevent an ajax request relayPointDataContainers[json.success[relayPoint].Num] = json.success[relayPoint]; ++numberDisplayed; + // Display popup for IE user + if (!$.browser.msie) PS_MRAddGMapMarker(carrier_id, json.success[relayPoint].Num, contentBlockid); + else + $('#' + contentBlockid).children('p').click(function() { + PS_MROpenPopupDetail(json.success[relayPoint].permaLinkDetail); + }); } } PS_MRHandleSelectedRelayPoint(); @@ -684,6 +692,9 @@ function PS_MRGmapPlaceViewOnMarker($map, marker, relayNum) callback: function() { PS_MRDisplayClickedGmapWindow(marker, relayNum, $map); + + // Make dancing markers in Firefox will use the CPU to 100 % + if (!$.browser.mozilla) (function(m) { setTimeout(function() diff --git a/modules/mondialrelay/mondialrelay.php b/modules/mondialrelay/mondialrelay.php index e5733790f..fdabd7a30 100755 --- a/modules/mondialrelay/mondialrelay.php +++ b/modules/mondialrelay/mondialrelay.php @@ -59,7 +59,7 @@ class MondialRelay extends Module { $this->name = 'mondialrelay'; $this->tab = 'shipping_logistics'; - $this->version = '1.7.8'; + $this->version = '1.7.9'; parent::__construct(); @@ -114,20 +114,20 @@ class MondialRelay extends Module { // AdminOrders id_tab $id_parent = 3; - + /*tab install */ $result = Db::getInstance()->getRow(' - SELECT position - FROM `' . _DB_PREFIX_ . 'tab` + SELECT position + FROM `' . _DB_PREFIX_ . 'tab` WHERE `id_parent` = '.(int)$id_parent.' ORDER BY `'. _DB_PREFIX_ .'tab`.`position` DESC'); $pos = (isset($result['position'])) ? $result['position'] + 1 : 0; Db::getInstance()->execute(' - INSERT INTO ' . _DB_PREFIX_ . 'tab - (id_parent, class_name, position, module) - VALUES('.(int)$id_parent.', "AdminMondialRelay", "'.(int)($pos).'", "mondialrelay")'); + INSERT INTO ' . _DB_PREFIX_ . 'tab + (id_parent, class_name, position, module) + VALUES('.(int)$id_parent.', "AdminMondialRelay", "'.(int)($pos).'", "mondialrelay")'); $id_tab = Db::getInstance()->Insert_ID(); @@ -200,7 +200,8 @@ class MondialRelay extends Module if (_PS_VERSION_ >= '1.4' && (!$this->registerHook('processCarrier') || !$this->registerHook('orderDetail') || - !$this->registerHook('orderDetailDisplayed'))) + !$this->registerHook('orderDetailDisplayed') || + !$this->registerHook('paymentTop'))) return false; return true; } @@ -316,15 +317,15 @@ class MondialRelay extends Module private function _update_v1_4() { Db::getInstance()->execute(' - UPDATE `'._DB_PREFIX_.'carrier` - SET - `shipping_external` = 0, - `need_range` = 1, - `external_module_name` = - "mondialrelay", - `shipping_method` = 1 - WHERE `id_carrier` - IN (SELECT `id_carrier` + UPDATE `'._DB_PREFIX_.'carrier` + SET + `shipping_external` = 0, + `need_range` = 1, + `external_module_name` = + "mondialrelay", + `shipping_method` = 1 + WHERE `id_carrier` + IN (SELECT `id_carrier` FROM `'._DB_PREFIX_.'mr_method`)'); } @@ -384,7 +385,7 @@ class MondialRelay extends Module $protocol = (Configuration::get('PS_SSL_ENABLED') || (!empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) != 'off')) ? 'https://' : 'http://'; - $endURL = __PS_BASE_URI__.'/modules/mondialrelay/'; + $endURL = __PS_BASE_URI__.'modules/mondialrelay/'; if (method_exists('Tools', 'getShopDomainSsl')) self::$moduleURL = $protocol.Tools::getShopDomainSsl().$endURL; @@ -402,12 +403,12 @@ class MondialRelay extends Module if ($overloadCurrent) return ' <script type="text/javascript"> - currentJquery = jQuery.noConflict(true); + currentJquery = jQuery.noConflict(true); </script> - <script type="text/javascript" src="'.self::$moduleURL.'/js/jquery-1.6.4.min.js"></script>'; + <script type="text/javascript" src="'.self::$moduleURL.'js/jquery-1.6.4.min.js"></script>'; return ' - <script type="text/javascript" src="'.self::$moduleURL.'/js/jquery-1.6.4.min.js"></script> + <script type="text/javascript" src="'.self::$moduleURL.'js/jquery-1.6.4.min.js"></script> <script type="text/javascript"> MRjQuery = jQuery.noConflict(true); </script>'; @@ -417,8 +418,8 @@ class MondialRelay extends Module { DB::getInstance()->execute(' UPDATE `'._DB_PREFIX_.'mr_selected` - SET `id_order` = '.$params['order']->id.' - WHERE `id_cart` = '.$params['cart']->id); + SET `id_order` = '.(int)$params['order']->id.' + WHERE `id_cart` = '.(int)$params['cart']->id); } public function hookBackOfficeHeader() @@ -426,16 +427,17 @@ class MondialRelay extends Module $cssFilePath = $this->_path.'style.css'; $jsFilePath= $this->_path.'mondialrelay.js'; - $ret = ''; + $ret = '<script type="text/javascript" src="'.$jsFilePath.'"></script>'; if (Tools::getValue('tab') == 'AdminMondialRelay') - $ret = ' + $ret .= self::getJqueryCompatibility(true); + + $ret .= ' <link type="text/css" rel="stylesheet" href="'.$cssFilePath.'" /> <script type="text/javascript"> var _PS_MR_MODULE_DIR_ = "'.self::$moduleURL.'"; var mrtoken = "'.self::$MRBackToken.'"; - </script> - <script type="text/javascript" src="'.$jsFilePath.'"></script>'. - self::getJqueryCompatibility(true); + </script>'; + return $ret; return $ret; } @@ -477,13 +479,14 @@ class MondialRelay extends Module if (!Validate::isUnsignedInt(Tools::getValue('id_order_state'))) $this->_postErrors[] = $this->l('Invalid order state'); } + /* else if (Tools::isSubmit('PS_MRSubmitFieldPersonalization')) { $addr1 = Tools::getValue('Expe_ad1'); if (!preg_match('#^[0-9A-Z_\-\'., /]{2,32}$#', strtoupper($addr1), $match)) $this->_postErrors[] = $this->l('The Main address submited hasn\'t a good format'); + }*/ } - } private function _postProcess() { @@ -530,12 +533,13 @@ class MondialRelay extends Module public function hookOrderDetailDisplayed($params) { $res = Db::getInstance()->getRow(' - SELECT s.`MR_Selected_LgAdr1`, s.`MR_Selected_LgAdr2`, s.`MR_Selected_LgAdr3`, s.`MR_Selected_LgAdr4`, s.`MR_Selected_CP`, s.`MR_Selected_Ville`, s.`MR_Selected_Pays`, s.`MR_Selected_Num` + SELECT s.`MR_Selected_LgAdr1`, s.`MR_Selected_LgAdr2`, s.`MR_Selected_LgAdr3`, s.`MR_Selected_LgAdr4`, s.`MR_Selected_CP`, s.`MR_Selected_Ville`, s.`MR_Selected_Pays`, s.`MR_Selected_Num`, s.`url_suivi` FROM `'._DB_PREFIX_.'mr_selected` s WHERE s.`id_cart` = '.$params['order']->id_cart); if ((!$res) OR ($res['MR_Selected_Num'] == 'LD1') OR ($res['MR_Selected_Num'] == 'LDS')) return ''; $this->context->smarty->assign('mr_addr', $res['MR_Selected_LgAdr1'].($res['MR_Selected_LgAdr1'] ? ' - ' : '').$res['MR_Selected_LgAdr2'].($res['MR_Selected_LgAdr2'] ? ' - ' : '').$res['MR_Selected_LgAdr3'].($res['MR_Selected_LgAdr3'] ? ' - ' : '').$res['MR_Selected_LgAdr4'].($res['MR_Selected_LgAdr4'] ? ' - ' : '').$res['MR_Selected_CP'].' '.$res['MR_Selected_Ville'].' - '.$res['MR_Selected_Pays']); + $smarty->assign('mr_url', $res['url_suivi']); return $this->display(__FILE__, 'orderDetail.tpl'); } @@ -548,7 +552,7 @@ class MondialRelay extends Module /* ** Update the carrier id to use the new one if changed - */ + */ public function hookupdateCarrier($params) { if ((int)($params['id_carrier']) != (int)($params['carrier']->id)) @@ -557,14 +561,14 @@ class MondialRelay extends Module INSERT INTO `'._DB_PREFIX_.'mr_method` (mr_Name, mr_Pays_list, mr_ModeCol, mr_ModeLiv, mr_ModeAss, id_carrier) ( - SELECT - mr_Name, - mr_Pays_list, - mr_ModeCol, - mr_ModeLiv, - mr_ModeAss, - "'.(int)$params['carrier']->id.'" - FROM `'._DB_PREFIX_.'mr_method` + SELECT + mr_Name, + mr_Pays_list, + mr_ModeCol, + mr_ModeLiv, + mr_ModeAss, + "'.(int)$params['carrier']->id.'" + FROM `'._DB_PREFIX_.'mr_method` WHERE id_carrier ='.(int)$params['id_carrier'].')'); } } @@ -606,9 +610,8 @@ class MondialRelay extends Module Configuration::get('MR_LANGUAGE') == '') return ''; - $address = new Address((int)($this->context->cart->id_address_delivery)); + $address = new Address($this->context->cart->id_address_delivery); $id_zone = Address::getZoneById((int)($address->id)); - //$country = new Country((int)($address->id_country)); $carriersList = self::_getCarriers(); // Check if the defined carrier are ok @@ -629,18 +632,19 @@ class MondialRelay extends Module unset($carriersList[$k]); } } - + $preSelectedRelay = $this->getRelayPointSelected($params['cart']->id); - $this->context->smarty->assign( array( + $this->context->smarty->assign(array( 'one_page_checkout' => (Configuration::get('PS_ORDER_PROCESS_TYPE') ? Configuration::get('PS_ORDER_PROCESS_TYPE') : 0), 'new_base_dir' => self::$moduleURL, 'MRToken' => self::$MRFrontToken, 'carriersextra' => $carriersList, 'preSelectedRelay' => isset($preSelectedRelay['MR_selected_num']) ? $preSelectedRelay['MR_selected_num'] : '', - 'jQueryOverload' => self::getJqueryCompatibility())); + 'jQueryOverload' => self::getJqueryCompatibility(false) + )); - return $this->display(__FILE__, 'mondialrelay.tpl'); - } + return $this->display(__FILE__, 'mondialrelay.tpl'); + } public function getContent() { @@ -666,10 +670,17 @@ class MondialRelay extends Module self::mrDelete((int)($_GET['delete_mr'])); $this->_html .= '<h2>'.$this->l('Configure Mondial Relay Rate Module').'</h2> - - <div class="MR_warn">'. - $this->l('Try to turn off the cache and put the force compilation to on if you have any problems with the module after an update').' + + <div class="MR_warn"> + <a style="color:#383838;text-decoration:underline" href="index.php?tab=AdminPerformance&token='.Tools::getAdminToken('AdminPerformance'.(int)(Tab::getIdFromClassName('AdminPerformance')).(int)($cookie->id_employee)).'"> + '.$this->l('Try to turn off the cache and put the force compilation to on').' + </a> '.$this->l('if you have any problems with the module after an update').'. </div> + <div class="MR_hint"> + '.$this->l('Have a look to the following HOW-TO to help you to configure the Mondial Relay module').' + <b><a href="'.self::$moduleURL.'/docs/install.pdf"><img width="20" src="'.self::$moduleURL.'images/pdf_icon.jpg" /></a></b> + </div> + <br /> <fieldset> <legend> <img src="../modules/mondialrelay/images/logo.gif" />'.$this->l('To create a Mondial Relay carrier'). @@ -1165,14 +1176,14 @@ class MondialRelay extends Module LEFT JOIN `'._DB_PREFIX_.'mr_selected` mrs ON (mrs.`id_cart` = o.`id_cart`) LEFT JOIN `'._DB_PREFIX_.'mr_method` mr - ON (mr.`id_carrier` = ca.`id_carrier`) + ON (mr.`id_mr_method` = mrs.`id_method`) LEFT JOIN `'._DB_PREFIX_.'customer` c ON (c.`id_customer` = o.`id_customer`) WHERE ( - SELECT moh.`id_order_state` - FROM `'._DB_PREFIX_.'order_history` moh - WHERE moh.`id_order` = o.`id_order` - ORDER BY moh.`date_add` DESC LIMIT 1) = '.(int)($id_order_state); + SELECT moh.`id_order_state` + FROM `'._DB_PREFIX_.'order_history` moh + WHERE moh.`id_order` = o.`id_order` + ORDER BY moh.`date_add` DESC LIMIT 1) = '.(int)($id_order_state); } public static function ordersSQLQuery1_3($id_order_state) @@ -1190,19 +1201,19 @@ class MondialRelay extends Module mrs.`MR_Selected_Pays` as MR_Selected_Pays, mrs.`exp_number` as exp_number, mr.`mr_ModeCol` as mr_ModeCol, mr.`mr_ModeLiv` as mr_ModeLiv, mr.`mr_ModeAss` as mr_ModeAss FROM `'._DB_PREFIX_.'orders` o - LEFT JOIN `'._DB_PREFIX_.'carrier` ca + LEFT JOIN `'._DB_PREFIX_.'carrier` ca ON (ca.`id_carrier` = o.`id_carrier` AND ca.`name` = "mondialrelay") - LEFT JOIN `'._DB_PREFIX_.'mr_selected` mrs + LEFT JOIN `'._DB_PREFIX_.'mr_selected` mrs ON (mrs.`id_cart` = o.`id_cart`) LEFT JOIN `'._DB_PREFIX_.'mr_method` mr - ON (mr.`id_carrier` = ca.`id_carrier`) + ON (mr.`id_mr_method` = mrs.`id_method`) LEFT JOIN `'._DB_PREFIX_.'customer` c ON (c.`id_customer` = o.`id_customer`) WHERE ( - SELECT moh.`id_order_state` - FROM `'._DB_PREFIX_.'order_history` moh - WHERE moh.`id_order` = o.`id_order` + SELECT moh.`id_order_state` + FROM `'._DB_PREFIX_.'order_history` moh + WHERE moh.`id_order` = o.`id_order` ORDER BY moh.`date_add` DESC LIMIT 1) = '.(int)($id_order_state); } @@ -1248,7 +1259,7 @@ class MondialRelay extends Module return $statCode[$code]; return $this->l('This error isn\'t referred : ') . $code; } - + public function getRelayPointSelected($id_cart) { return Db::getInstance()->getRow(' @@ -1256,7 +1267,7 @@ class MondialRelay extends Module FROM `'._DB_PREFIX_.'mr_selected` s WHERE s.`id_cart` = '.(int)$id_cart); } - + public function isMondialRelayCarrier($id_carrier) { return Db::getInstance()->getRow(' @@ -1264,11 +1275,11 @@ class MondialRelay extends Module FROM `'._DB_PREFIX_.'mr_method` WHERE `id_carrier` = '.(int)$id_carrier); } - + public function hookpaymentTop($params) { - if ($this->isMondialRelayCarrier($params['cart']->id_carrier) && - !$this->getRelayPointSelected($params['cart']->id)) + if ($this->isMondialRelayCarrier($params['cart']->id_carrier) && + !$this->getRelayPointSelected($params['cart']->id)) $params['cart']->id_carrier = 0; } } diff --git a/modules/mondialrelay/mondialrelay.tpl b/modules/mondialrelay/mondialrelay.tpl index 1b3a50b3c..64a374e11 100755 --- a/modules/mondialrelay/mondialrelay.tpl +++ b/modules/mondialrelay/mondialrelay.tpl @@ -1,5 +1,5 @@ {* -* 2007-2011 PrestaShop +* 2007-2011 PrestaShop * * NOTICE OF LICENSE * @@ -26,18 +26,17 @@ {$jQueryOverload} -<link href="{$new_base_dir}/style.css" rel="stylesheet" type="text/css" media="all" /> - +<link href="{$new_base_dir}/style.css" rel="stylesheet" type="text/css" media="all" /> <script type="text/javascript"> // Global JS Value var _PS_MR_MODULE_DIR_ = "{$new_base_dir}"; var mrtoken = "{$MRToken}"; - var PS_MROPC = {($one_page_checkout && (isset($opc) && $opc)) ? 1 : 0}; + var PS_MROPC = {$one_page_checkout}; var PS_MRTranslationList = new Array(); var PS_MRCarrierMethodList = new Array(); var PS_MRSelectedRelayPoint = {literal}{{/literal}'carrier_id': 0, 'relayPointNum': 0{literal}}{/literal}; var PS_MRPreSelectedRelay = '{$preSelectedRelay}'; - + PS_MRTranslationList['Select'] = "{l s='Select' mod='mondialrelay'}"; PS_MRTranslationList['Selected'] = "{l s='Selected' mod='mondialrelay'}"; PS_MRTranslationList['errorSelection'] = "{l s='Please choose a relay point' mod='mondialrelay'}"; @@ -51,9 +50,9 @@ <script type="text/javascript"> - $(document).ready(function() + $(document).ready(function() {literal}{{/literal} - // Bind id_carrierX to an ajax call + // Bind id_carrierX to an ajax call {foreach from=$carriersextra item=carrier name=myLoop} $('#id_carrier' + {$carrier.id_carrier}).click(function() {literal}{{/literal} @@ -74,4 +73,3 @@ {literal}}{/literal}) {literal}}{/literal}); </script> - diff --git a/modules/mondialrelay/orderDetail.tpl b/modules/mondialrelay/orderDetail.tpl index d533fae55..419503f27 100755 --- a/modules/mondialrelay/orderDetail.tpl +++ b/modules/mondialrelay/orderDetail.tpl @@ -23,7 +23,9 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA *} - {if $mr_addr} <p id="dateofdelivery"><b>{l s='Delivery to' mod='mondialrelay'}</b> {$mr_addr}</p> +{if $mr_url} +<a href="{$mr_url}" target="_blank">{l s='Follow my package on Mondial Relay website' mod='mondialrelay'}.</a> +{/if} {/if} diff --git a/modules/mondialrelay/style.css b/modules/mondialrelay/style.css index 934b5e7a5..1a79b689d 100755 --- a/modules/mondialrelay/style.css +++ b/modules/mondialrelay/style.css @@ -294,10 +294,6 @@ a.PS_MRSelectRelayPointButton:hover background:url(images/selectRelayPoint.png) no-repeat 0px -25px; } -.PS_MRGmapDefaultPosition -{ -} - .PS_MRGmapDefaultPosition { display:none; @@ -340,3 +336,39 @@ div#PS_MRPersonalizedFields .MR_date tr.p {background-color:#e9e9e9; height:9px;} .MR_date td.g {font-weight:bold;} .MR_date td.d {} + +/* 1.3 compatibility*/ +.MR_warn +{ + border: 1px solid #D3C200; + background-color: #FFFAC6; + color: #383838; + font-weight: 700; + margin: 0 0 10px 0; + line-height: 20px; + padding: 10px 15px; +} + +/* 1.3 compatibility*/ +.MR_error +{ + border: 1px solid #EC9B9B; + background-color: #FAE2E3; + color: #383838; + font-weight: 700; + margin: 0 0 10px 0; + line-height: 20px; + padding: 10px 15px; +} + +/* 1.3 - 1.4 compatibility*/ +.MR_hint +{ + margin-top: 4px; + margin-bottom: 2px; + border: 1px solid #268CCD; + padding: 8px 6px 8px 34px; + color: #383838; + background: #F1F9FF url(images/help.png) no-repeat 6px 5px; + border-radius: 3px; +} \ No newline at end of file diff --git a/modules/moneybookers/de.php b/modules/moneybookers/de.php index b9acf59d4..fa2ef1e4f 100644 --- a/modules/moneybookers/de.php +++ b/modules/moneybookers/de.php @@ -17,13 +17,13 @@ $_MODULE['<{moneybookers}prestashop>moneybookers_fa214007826415a21a8456e3e09f999 $_MODULE['<{moneybookers}prestashop>moneybookers_088b74050a381d98fca38d5990b097be'] = 'Sie nutzen zur Zeit die Standard-E-Mail-Adresse von Moneybookers, Sie müssen Ihre eigene E-Mail-Adresse verwenden'; $_MODULE['<{moneybookers}prestashop>moneybookers_7593ded970377fe25371c952eb944770'] = 'Kann Inhalt holen'; $_MODULE['<{moneybookers}prestashop>moneybookers_b863542eebcb27fa230b647b5dd07819'] = 'Konto-Bestätigung fehlgeschlagen, Ihre E-Mail könnte falsch sein'; -$_MODULE['<{moneybookers}prestashop>moneybookers_d70c5b5767846906e0abe68498db887b'] = 'E-Mail-Aktivierung erfolgreich, Sie können nun Ihr Kennwort bestâtigen'; +$_MODULE['<{moneybookers}prestashop>moneybookers_d70c5b5767846906e0abe68498db887b'] = 'E-Mail-Aktivierung erfolgreich, Sie können nun Ihr Geheimwort bestâtigen'; $_MODULE['<{moneybookers}prestashop>moneybookers_87ef564ed1574eda7e77b4012eef0b85'] = 'Unmöglich,den Aktivierungs-Server zu kontaktieren, bitte versuchen Sie es später'; $_MODULE['<{moneybookers}prestashop>moneybookers_7757ea03f2a0893e36c7916a2ad07ef8'] = 'Das E-Mail-Feld ist erforderlich'; -$_MODULE['<{moneybookers}prestashop>moneybookers_aa1c444c2ee2f620d5b349fedfa68ba2'] = 'Kennwortbestätigung fehlgeschlagen, max. Versuchszahl überschritten (3 pro Stunde)'; -$_MODULE['<{moneybookers}prestashop>moneybookers_cdbef58d093e0ff38e13686a669e9fee'] = 'Kennwortbestätigung fehlgeschlagen, Ihr Kennwort könnte falsch sein'; -$_MODULE['<{moneybookers}prestashop>moneybookers_cd1dfa342c3c11c17ede212e6429ca01'] = 'Kontoaktivierung erfolgreich, Kennwort ok'; -$_MODULE['<{moneybookers}prestashop>moneybookers_2e531f9ad978a2a1a88a00ae0d4dc78e'] = 'Das Kennwortfeld ist erforderlich'; +$_MODULE['<{moneybookers}prestashop>moneybookers_aa1c444c2ee2f620d5b349fedfa68ba2'] = 'Geheimwortbestätigung fehlgeschlagen, max. Versuchszahl überschritten (3 pro Stunde)'; +$_MODULE['<{moneybookers}prestashop>moneybookers_cdbef58d093e0ff38e13686a669e9fee'] = 'Geheimwortbestätigung fehlgeschlagen, Ihr Geheimwort könnte falsch sein'; +$_MODULE['<{moneybookers}prestashop>moneybookers_cd1dfa342c3c11c17ede212e6429ca01'] = 'Kontoaktivierung erfolgreich, Geheimwort ok'; +$_MODULE['<{moneybookers}prestashop>moneybookers_2e531f9ad978a2a1a88a00ae0d4dc78e'] = 'Das Geheimwortfeld ist erforderlich'; $_MODULE['<{moneybookers}prestashop>moneybookers_bcfaccebf745acfd5e75351095a5394a'] = 'Disable'; $_MODULE['<{moneybookers}prestashop>moneybookers_e4abb55720e3790fe55982fec858d213'] = 'Linke Spalte'; $_MODULE['<{moneybookers}prestashop>moneybookers_f16072c370ef52db2e329a87b5e7177a'] = 'Rechte Spalte'; @@ -62,12 +62,12 @@ $_MODULE['<{moneybookers}prestashop>moneybookers_71b5b9efebe9c2f73fad6dd1849b431 $_MODULE['<{moneybookers}prestashop>moneybookers_ece6bf0de28bb0442df6e3a1fd7657d4'] = 'Wenn Sie Hilfe benötigen, lesen Sie das Aktivierungshandbuch'; $_MODULE['<{moneybookers}prestashop>moneybookers_32e70e9f3def9ebdcdbc872b739b919f'] = 'Sie können Moneybookers paiement mit dem Test-Account testaccount2@moneybookers.com und das geheime Wort MBTest testen.'; $_MODULE['<{moneybookers}prestashop>moneybookers_f5944cfc42cfb20119407c59a97bd9d1'] = 'Vorsicht, dies ist nur ein Test-Account: Sie erhalten keine Geld, wenn Sie diesen Test-Account auf Ihrem Shop zu nutzen. So empfangen Sie Geld, müssen Sie den Login und das Passwort Ihrer persönlichen Moneybookers-Konto zu verwenden!'; -$_MODULE['<{moneybookers}prestashop>moneybookers_0b65457508cf73c9ed8c96f56b8910ce'] = 'Kennwortbestätigung'; -$_MODULE['<{moneybookers}prestashop>moneybookers_e44efbda9396a5641d730f0ac4866e52'] = 'Ihr Kennwort wurde aktiviert'; +$_MODULE['<{moneybookers}prestashop>moneybookers_0b65457508cf73c9ed8c96f56b8910ce'] = 'Geheimwortbestätigung'; +$_MODULE['<{moneybookers}prestashop>moneybookers_e44efbda9396a5641d730f0ac4866e52'] = 'Ihr Geheimwort wurde aktiviert'; $_MODULE['<{moneybookers}prestashop>moneybookers_98061690dbf6a359c5b2aeb84d0eb317'] = 'Sie müssen'; -$_MODULE['<{moneybookers}prestashop>moneybookers_7360d9333103eec04f2d91fa513a1f46'] = 'bestätigen Sie Ihr Kennwort'; -$_MODULE['<{moneybookers}prestashop>moneybookers_7986dbc3b2bf0e8f72a328c094981836'] = 'Bitte geben Sie das gleiche Kennwort ein, das Sie zum Öffnen Ihres Moneybookers Kontos benutzen:'; -$_MODULE['<{moneybookers}prestashop>moneybookers_22f2d26badcc700d11b93f57dc96d386'] = 'Mein Kennwort bestätigen'; +$_MODULE['<{moneybookers}prestashop>moneybookers_7360d9333103eec04f2d91fa513a1f46'] = 'das Geheimwort bestätigen'; +$_MODULE['<{moneybookers}prestashop>moneybookers_7986dbc3b2bf0e8f72a328c094981836'] = 'Bitte geben Sie das Geheimwort ein, welches Sie in Ihrem Moneybookerskonto unter Händlereinstellungen hinterlegt haben:'; +$_MODULE['<{moneybookers}prestashop>moneybookers_22f2d26badcc700d11b93f57dc96d386'] = 'Mein Geheimwort bestätigen'; $_MODULE['<{moneybookers}prestashop>moneybookers_cbcd58fce9759ea6e84c86ed92a3db44'] = 'Wie lautet das Geheimwort?'; $_MODULE['<{moneybookers}prestashop>moneybookers_ef3cefa901bd32ea6aa2d0f6900b7725'] = 'Das Geheimwort unterscheidet sich vom Passwort. Es ist dazu da, um die Transmission von Ihrem Server zu entschlüsseln.'; $_MODULE['<{moneybookers}prestashop>moneybookers_e1674c7b15040ce09b9615714eb3e787'] = 'Warum das Geheimwort sich vom Passwort unterscheiden soll'; diff --git a/modules/paypal/config.xml b/modules/paypal/config.xml index 4153164f5..218b28d97 100755 --- a/modules/paypal/config.xml +++ b/modules/paypal/config.xml @@ -2,7 +2,7 @@ <module> <name>paypal</name> <displayName><![CDATA[PayPal]]></displayName> - <version><![CDATA[2.8.3]]></version> + <version><![CDATA[2.8.5]]></version> <description><![CDATA[Accepts payments by credit cards (CB, Visa, MasterCard, Amex, Aurore, Cofinoga, 4 stars) with PayPal.]]></description> <author><![CDATA[]]></author> <tab><![CDATA[payments_gateways]]></tab> diff --git a/modules/paypal/confirm.tpl b/modules/paypal/confirm.tpl index a794d0f22..d330d169b 100644 --- a/modules/paypal/confirm.tpl +++ b/modules/paypal/confirm.tpl @@ -58,7 +58,7 @@ <a href="{$link->getPageLink('order', true, NULL, "step=3")}" class="button_large">{l s='Return' mod='paypal'}</a><br /><br /> <span style="color: red;">{l s='Session expired, please go back and try again' mod='paypal'}</span> {else} - <a href="{$link->getPageLink('order', true, NULL, "step=3")}" class="button_large">{l s='Other payment methods' mod='paypal'}</a> + <a href="{$link->getPageLink('order', true, NULL, "step=3")}" class="button_large">{l s='Other payment methods' mod='paypal'}</a> <input type="submit" name="submitPayment" value="{l s='I confirm my order' mod='paypal'}" class="exclusive_large" /> {/if} </p> diff --git a/modules/paypal/confirmation.tpl b/modules/paypal/confirmation.tpl index 1ba79647f..e43b4c3cb 100644 --- a/modules/paypal/confirmation.tpl +++ b/modules/paypal/confirmation.tpl @@ -1,5 +1,5 @@ {* -* 2007-2011 PrestaShop +* 2007-2011 PrestaShop * * NOTICE OF LICENSE * diff --git a/modules/paypal/error.tpl b/modules/paypal/error.tpl index 77af46812..c97004915 100644 --- a/modules/paypal/error.tpl +++ b/modules/paypal/error.tpl @@ -1,5 +1,5 @@ {* -* 2007-2011 PrestaShop +* 2007-2011 PrestaShop * * NOTICE OF LICENSE * diff --git a/modules/paypal/express/login.tpl b/modules/paypal/express/login.tpl index 85a175aef..ed0cb2401 100644 --- a/modules/paypal/express/login.tpl +++ b/modules/paypal/express/login.tpl @@ -1,5 +1,5 @@ {* -* 2007-2011 PrestaShop +* 2007-2011 PrestaShop * * NOTICE OF LICENSE * diff --git a/modules/paypal/express/paypalexpress.php b/modules/paypal/express/paypalexpress.php index eb7b2b548..3cc2fc44b 100644 --- a/modules/paypal/express/paypalexpress.php +++ b/modules/paypal/express/paypalexpress.php @@ -43,8 +43,8 @@ class PaypalExpress extends Paypal return false; // Making request - $returnURL = Tools::getShopDomainSsl(true, true).__PS_BASE_URI__.'modules/paypal/express/submit.php'; - $cancelURL = Tools::getShopDomainSsl(true, true).__PS_BASE_URI__.'order.php'; + $returnURL = PayPal::getShopDomainSsl(true, true).__PS_BASE_URI__.'modules/paypal/express/submit.php'; + $cancelURL = PayPal::getShopDomainSsl(true, true).__PS_BASE_URI__.'order.php'; $paymentAmount = (float)$cart->getOrderTotal(); $currencyCodeType = strval($currency->iso_code); $paymentType = Configuration::get('PAYPAL_CAPTURE') == 1 ? 'Authorization' : 'Sale'; diff --git a/modules/paypal/express/submit.php b/modules/paypal/express/submit.php index 1a95540c6..5d1c1b2f0 100644 --- a/modules/paypal/express/submit.php +++ b/modules/paypal/express/submit.php @@ -112,7 +112,7 @@ function displayConfirm() 'ppToken' => strval(Context::getContext()->cookie->paypal_token), 'cust_currency' => Context::getContext()->cart->id_currency, 'currencies' => $ppExpress->getCurrency((int)Context::getContext()->cart->id_currency), - 'total' => Context::getContext()->cart->getOrderTotal(true, Cart::BOTH), + 'total' => Context::getContext()->cart->getOrderTotal(true, PayPal::BOTH), 'this_path_ssl' => Tools::getShopDomainSsl(true, true).__PS_BASE_URI__.'modules/'. $ppExpress->name.'/', 'payerID' => $payerID, 'mode' => 'express/' @@ -133,7 +133,7 @@ function submitConfirm() die('No currency'); elseif (!$payerID = Tools::htmlentitiesUTF8(strval(Tools::getValue('payerID')))) die('No payer ID'); - elseif (!Context::getContext()->cart->getOrderTotal(true, Cart::BOTH)) + elseif (!Context::getContext()->cart->getOrderTotal(true, PayPal::BOTH)) die('Empty cart'); $ppExpress->makePayPalAPIValidation(Context::getContext()->cookie, Context::getContext()->cart, $currency, $payerID, 'express'); @@ -344,7 +344,8 @@ function displayAccount() displayAccount(); die('Not logged'); }*/ -if (!Context::getContext()->cart->getOrderTotal(true, Cart::BOTH)) + +if (!Context::getContext()->cart->getOrderTotal(true, PayPal::BOTH)) die('Empty cart'); // No token, we need to get one by making PayPal Authorisation diff --git a/modules/paypal/integral_evolution/redirect.php b/modules/paypal/integral_evolution/redirect.php index 0822cd454..515c74cd1 100644 --- a/modules/paypal/integral_evolution/redirect.php +++ b/modules/paypal/integral_evolution/redirect.php @@ -87,11 +87,11 @@ $smarty->assign(array( 'shipping_address' => $shippingAddress, 'shipping_country' => $shippingCountry, 'shipping_state' => $shippingState, - 'amount' => (float)($cart->getOrderTotal(true, Cart::BOTH_WITHOUT_SHIPPING)), + 'amount' => (float)($cart->getOrderTotal(true, PayPal::BOTH_WITHOUT_SHIPPING)), 'customer' => $customer, - 'total' => (float)($cart->getOrderTotal(true, Cart::BOTH)), - 'shipping' => Tools::ps_round((float)($cart->getOrderShippingCost()) + (float)($cart->getOrderTotal(true, Cart::ONLY_WRAPPING)), 2), - 'discount' => $cart->getOrderTotal(true, Cart::ONLY_DISCOUNTS), + 'total' => (float)($cart->getOrderTotal(true, PayPal::BOTH)), + 'shipping' => Tools::ps_round((float)($cart->getOrderShippingCost()) + (float)($cart->getOrderTotal(true, PayPal::ONLY_WRAPPING)), 2), + 'discount' => $cart->getOrderTotal(true, PayPal::ONLY_DISCOUNTS), 'business' => $business, 'currency_module' => $currency_module, 'cart_id' => (int)($cart->id).'_'.pSQL($cart->secure_key), @@ -99,11 +99,17 @@ $smarty->assign(array( 'paypal_id' => (int)($paypal->id), 'header' => $header, 'template' => 'Template'.Configuration::get('PAYPAL_TEMPLATE'), - 'url' => Tools::getShopDomain(true, true).__PS_BASE_URI__, + 'url' => PayPal::getShopDomain(true, true).__PS_BASE_URI__, 'paymentaction' => (Configuration::get('PAYPAL_CAPTURE') ? 'authorization' : 'sale') )); +if (substr(_PS_VERSION_, 0, 3) == '1.3') + $smarty->assign('jquery', 'jquery-1.2.6.pack.js'); +else + $smarty->assign('jquery', 'jquery-1.4.4.min.js'); + + if (is_file(_PS_THEME_DIR_.'modules/paypal/integral_evolution/redirect.tpl')) $smarty->display(_PS_THEME_DIR_.'modules/'.$paypal->name.'/integral_evolution/redirect.tpl'); else diff --git a/modules/paypal/integral_evolution/redirect.tpl b/modules/paypal/integral_evolution/redirect.tpl index 6d14c2654..8a4486572 100644 --- a/modules/paypal/integral_evolution/redirect.tpl +++ b/modules/paypal/integral_evolution/redirect.tpl @@ -26,7 +26,7 @@ <html> <head> - <script type="text/javascript" src="{$url}js/jquery/jquery-1.4.4.min.js"></script> + <script type="text/javascript" src="{$url}js/jquery/{$jquery}"></script> </head> <body> <p>{$redirect_text}<br /><a href="javascript:history.go(-1);">{$cancel_text}</a></p> diff --git a/modules/paypal/payment/paypalpayment.php b/modules/paypal/payment/paypalpayment.php index 005db96ea..e7eda7b5f 100644 --- a/modules/paypal/payment/paypalpayment.php +++ b/modules/paypal/payment/paypalpayment.php @@ -46,8 +46,8 @@ class PaypalPayment extends Paypal // Making request $vars = '?fromPayPal=1'; - $returnURL = Tools::getShopDomainSsl(true, true).__PS_BASE_URI__.'modules/paypal/payment/submit.php'.$vars; - $cancelURL = Tools::getShopDomainSsl(true, true).__PS_BASE_URI__.'order.php'; + $returnURL = PayPal::getShopDomainSsl(true, true).__PS_BASE_URI__.'modules/paypal/payment/submit.php'.$vars; + $cancelURL = PayPal::getShopDomainSsl(true, true).__PS_BASE_URI__.'order.php'; $paymentAmount = (float)($cart->getOrderTotal()); $currencyCodeType = strval($currency->iso_code); $paymentType = Configuration::get('PAYPAL_CAPTURE') == 1 ? 'Authorization' : 'Sale'; @@ -68,7 +68,7 @@ class PaypalPayment extends Paypal $country = new Country((int)$address->id_country); if ($address->id_state) $state = new State((int)$address->id_state); - $discounts = (float)($cart->getOrderTotal(true, Cart::ONLY_DISCOUNTS)); + $discounts = (float)($cart->getOrderTotal(true, PayPal::ONLY_DISCOUNTS)); if ($discounts == 0) { if ($params['cart']->id_customer) diff --git a/modules/paypal/payment/submit.php b/modules/paypal/payment/submit.php index 2236a44d8..09a75c929 100644 --- a/modules/paypal/payment/submit.php +++ b/modules/paypal/payment/submit.php @@ -1,6 +1,6 @@ <?php /* -* 2007-2011 PrestaShop +* 2007-2011 PrestaShop * * NOTICE OF LICENSE * @@ -95,7 +95,7 @@ function displayConfirm() 'logo' => $ppPayment->getLogo(), 'cust_currency' => Context::getContext()->cart->id_currency, 'currency' => $ppPayment->getCurrency((int)Context::getContext()->cart->id_currency), - 'total' => Context::getContext()->cart->getOrderTotal(true, Cart::BOTH), + 'total' => Context::getContext()->cart->getOrderTotal(true, PayPal::BOTH), 'this_path_ssl' => Tools::getShopDomainSsl(true, true).__PS_BASE_URI__.'modules/'. $ppPayment->name.'/', 'mode' => 'payment/' )); @@ -116,7 +116,7 @@ function submitConfirm() } elseif (!$id_currency = (int)(Tools::getValue('currency_payement'))) die('No currency'); - elseif (!Context::getContext()->cart->getOrderTotal(true, Cart::BOTH)) + elseif (!Context::getContext()->cart->getOrderTotal(true, PayPal::BOTH)) die('Empty cart'); $currency = new Currency((int)($id_currency)); if (!Validate::isLoadedObject($currency)) @@ -133,7 +133,7 @@ function validOrder() header('location:../../../'); exit; die('Not logged'); } - elseif (!Context::getContext()->cart->getOrderTotal(true, Cart::BOTH)) + elseif (!Context::getContext()->cart->getOrderTotal(true, PayPal::BOTH)) die('Empty cart'); if (!$token = Tools::htmlentitiesUTF8(strval(Tools::getValue('token')))) { @@ -153,7 +153,7 @@ function validOrder() if (!Context::getContext()->customer->isLogged(true)) die('Not logged'); -elseif (!Context::getContext()->cart->getOrderTotal(true, Cart::BOTH)) +elseif (!Context::getContext()->cart->getOrderTotal(true, PayPal::BOTH)) die('Empty cart'); // No submit, confirmation page diff --git a/modules/paypal/paypal.php b/modules/paypal/paypal.php index efc425f03..1dcdf168d 100644 --- a/modules/paypal/paypal.php +++ b/modules/paypal/paypal.php @@ -1,6 +1,6 @@ <?php /* -* 2007-2011 PrestaShop +* 2007-2011 PrestaShop * * NOTICE OF LICENSE * @@ -23,11 +23,11 @@ * @version Release: $Revision: 7091 $ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA -*/ +*/ if (!defined('_PS_VERSION_')) exit; - + define('_PAYPAL_INTEGRAL_', 0); define('_PAYPAL_OPTION_PLUS_', 1); define('_PAYPAL_INTEGRAL_EVOLUTION_', 2); @@ -35,13 +35,13 @@ define('_PAYPAL_INTEGRAL_EVOLUTION_', 2); class PayPal extends PaymentModule { private $_html = ''; - + public function __construct() { $this->name = 'paypal'; $this->tab = 'payments_gateways'; - $this->version = '2.8.3'; - + $this->version = '2.8.5'; + $this->currencies = true; $this->currencies_mode = 'radio'; @@ -78,7 +78,7 @@ class PayPal extends PaymentModule $this->warning .= Configuration::get('PS_PREACTIVATION_PAYPAL_WARNING'); } } - + public function install() { /* Install and register on hook */ @@ -92,14 +92,14 @@ class PayPal extends PaymentModule OR !$this->registerHook('cancelProduct') OR !$this->registerHook('adminOrder')) return false; - + if (file_exists(_PS_ROOT_DIR_.'/modules/paypalapi/paypalapi.php') AND !Configuration::get('PAYPAL_NEW')) { include_once(_PS_ROOT_DIR_.'/modules/paypalapi/paypalapi.php'); $paypalapi = new PaypalAPI(); return $this->_checkAndUpdateFromOldVersion(true); } - + /* Set database */ if (!Db::getInstance()->execute('CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'paypal_order` ( @@ -111,7 +111,7 @@ class PayPal extends PaymentModule PRIMARY KEY (`id_order`) ) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8')) return false; - + /* Set configuration */ Configuration::updateValue('PAYPAL_SANDBOX', 1); Configuration::updateValue('PAYPAL_BUSINESS', 'paypal@prestashop.com'); @@ -147,10 +147,10 @@ class PayPal extends PaymentModule copy(dirname(__FILE__).'/../../img/os/'.Configuration::get('PS_OS_PAYPAL').'.gif', dirname(__FILE__).'/../../img/os/'.(int)$orderState->id.'.gif'); Configuration::updateValue('PAYPAL_OS_AUTHORIZATION', (int)$orderState->id); } - + return true; } - + public function uninstall() { /* Delete all configurations */ @@ -165,23 +165,23 @@ class PayPal extends PaymentModule Configuration::deleteByName('PAYPAL_TEMPLATE'); Configuration::deleteByName('PAYPAL_CAPTURE'); Configuration::deleteByName('PAYPAL_DEBUG_MODE'); - + return parent::uninstall(); } - + public function getContent() { - $this->_html .= '<h2>'.$this->l('PayPal').'</h2>'; - + $this->_html .= '<h2>'.$this->l('PayPal').'</h2>'; + $this->_postProcess(); $this->_setPayPalSubscription(); if (file_exists(_PS_ROOT_DIR_.'/modules/paypalapi/paypalapi.php')) $this->_html .= '<div class="warning warn"><h3>'.$this->l('All features of Paypal API module are be include in this new module. In order to don\'t have any conflict, please don\'t use and remove PayPalAPI module.').'</h3></div>'; $this->_setConfigurationForm(); - + return $this->_html; } - + public function hookPayment($params) { if (!$this->active) @@ -208,7 +208,7 @@ class PayPal extends PaymentModule else die($this->l('No valid payment method selected')); } - + public function hookShoppingCartExtra($params) { if (!$this->active) @@ -220,7 +220,7 @@ class PayPal extends PaymentModule return $this->display(__FILE__, 'express/shopping_cart.tpl'); } } - + public function hookPaymentReturn($params) { if (!$this->active) @@ -228,7 +228,7 @@ class PayPal extends PaymentModule return $this->display(__FILE__, 'confirmation.tpl'); } - + public function hookRightColumn($params) { $this->context->smarty->assign('iso_code', Tools::strtolower($this->context->language)); @@ -240,7 +240,7 @@ class PayPal extends PaymentModule { return $this->hookRightColumn($params); } - + public function hookBackBeforePayment($params) { if (!$this->active) @@ -258,7 +258,7 @@ class PayPal extends PaymentModule Tools::redirect('modules/paypal/express/submit.php?confirm=1&token='.$token.'&payerID='.$payerID); } } - + public function hookAdminOrder($params) { if (Tools::isSubmit('paypal')) @@ -288,7 +288,7 @@ class PayPal extends PaymentModule <img src="'._PS_IMG_.'admin/ok.gif" alt="" title="" /> '.$message.' </div>'; } - + if ($this->_needValidation((int)$params['id_order']) AND $this->_isPayPalAPIAvailable()) { $this->_html .= '<br /> @@ -302,7 +302,7 @@ class PayPal extends PaymentModule $this->_postProcess(); $this->_html .= '</fieldset>'; } - + if ($this->_needCapture((int)$params['id_order']) AND $this->_isPayPalAPIAvailable()) { $this->_html .= '<br /> @@ -316,7 +316,7 @@ class PayPal extends PaymentModule $this->_postProcess(); $this->_html .= '</fieldset>'; } - + if ($this->_canRefund((int)$params['id_order']) AND $this->_isPayPalAPIAvailable()) { $this->_html .= '<br /> @@ -331,10 +331,10 @@ class PayPal extends PaymentModule $this->_postProcess(); $this->_html .= '</fieldset>'; } - + return $this->_html; } - + public function hookCancelProduct($params) { if (Tools::isSubmit('generateDiscount')) @@ -353,10 +353,10 @@ class PayPal extends PaymentModule $id_transaction = $this->_getTransactionId((int)($order->id)); if (!$id_transaction) return false; - + $products = $order->getProducts(); $amt = $products[(int)($order_detail->id)]['product_price_wt'] * (int)($_POST['cancelQuantity'][(int)($order_detail->id)]); - + $response = $this->_makeRefund($id_transaction, $order->id, (float)($amt)); $message = $this->l('Cancel products result:').'<br>'; foreach ($response AS $k => $value) @@ -381,11 +381,11 @@ class PayPal extends PaymentModule $currency = new Currency((int)($id_currency)); $iso_currency = $currency->iso_code; $token = $cookie->paypal_token; - $total = (float)($cart->getOrderTotal(true, Cart::BOTH)); + $total = (float)($cart->getOrderTotal(true, PayPal::BOTH)); $paymentType = Configuration::get('PAYPAL_CAPTURE') == 1 ? 'Authorization' : 'Sale'; $serverName = urlencode($_SERVER['SERVER_NAME']); $bn = ($type == 'express' ? 'ECS' : 'ECM'); - $notifyURL = urlencode(Tools::getShopDomainSsl(true, true).__PS_BASE_URI__.'modules/paypal/ipn.php'); + $notifyURL = urlencode(PayPal::getShopDomainSsl(true, true).__PS_BASE_URI__.'modules/paypal/ipn.php'); // Getting address if (isset($cookie->id_cart) AND $cookie->id_cart) @@ -402,7 +402,7 @@ class PayPal extends PaymentModule // Making request $request='&TOKEN='.urlencode($token).'&PAYERID='.urlencode($payerID).'&PAYMENTACTION='.$paymentType.'&AMT='.$total.'&CURRENCYCODE='.$iso_currency.'&IPADDRESS='.$serverName.'&NOTIFYURL='.$notifyURL.'&BUTTONSOURCE=PRESTASHOP_'.$bn.$requestAddress ; - $discounts = (float)$cart->getOrderTotal(true, Cart::ONLY_DISCOUNTS); + $discounts = (float)$cart->getOrderTotal(true, PayPal::ONLY_DISCOUNTS); if ($discounts == 0) { $products = $cart->getProducts(); @@ -424,7 +424,7 @@ class PayPal extends PaymentModule $products = $cart->getProducts(); $description = 0; for ($i = 0; $i < sizeof($products); $i++) - $description .= ($description == ''?'':', ').$products[$i]['cart_quantity']." x ".$products[$i]['name'].(isset($products[$i]['attributes'])?' - '.$products[$i]['attributes']:'').(isset($products[$i]['instructions'])?' - '.$products[$i]['instructions']:'') ; + $description .= ($description == ''?'':', ').$products[$i]['cart_quantity']." x ".$products[$i]['name'].(isset($products[$i]['attributes'])?' - '.$products[$i]['attributes']:'').(isset($products[$i]['instructions'])?' - '.$products[$i]['instructions']:'') ; $request .= '&ORDERDESCRIPTION='.urlencode(substr($description, 0, 120)); } @@ -446,6 +446,9 @@ class PayPal extends PaymentModule $ppExpress->displayPayPalAPIError($ppExpress->l('PayPal return error.', 'submit'), $logs); } + + + // Making log $id_transaction = $result['TRANSACTIONID']; if (Configuration::get('PAYPAL_CAPTURE')) @@ -470,20 +473,22 @@ class PayPal extends PaymentModule $id_order_state = Configuration::get('PS_OS_ERROR'); } + // Call payment validation method - $this->validateOrder($id_cart, $id_order_state, (float)($cart->getOrderTotal(true, Cart::BOTH)), $this->displayName, $message, array('transaction_id' => $id_transaction, 'payment_status' => $result['PAYMENTSTATUS'], 'pending_reason' => $result['PENDINGREASON']), $id_currency, false, $cart->secure_key); - + $this->validateOrder($id_cart, $id_order_state, (float)($cart->getOrderTotal(true, PayPal::BOTH)), $this->displayName, $message, array('transaction_id' => $id_transaction, 'payment_status' => $result['PAYMENTSTATUS'], 'pending_reason' => $result['PENDINGREASON']), $id_currency, false, $cart->secure_key); + // Clean cookie unset($cookie->paypal_token); - + // Displaying output $order = new Order((int)($this->currentOrder)); Tools::redirect('index.php?controller=order-confirmation&id_cart='.(int)($id_cart).'&id_module='.(int)($this->id).'&id_order='.(int)($this->currentOrder).'&key='.$order->secure_key); - + } - - public function validateOrder($id_cart, $id_order_state, $amountPaid, $paymentMethod = 'Unknown', $message = NULL, - $extraVars = array(), $currency_special = NULL, $dont_touch_amount = false, $secure_key = false, Shop $shop = null) + + public function validateOrder($id_cart, $id_order_state, $amountPaid, $paymentMethod = 'Unknown', + $message = NULL, $extraVars = array(), $currency_special = NULL, $dont_touch_amount = false, + $secure_key = false, Shop $shop = null) { if (!$this->active) return; @@ -493,41 +498,41 @@ class PayPal extends PaymentModule { $this->pcc->transaction_id = (isset($extraVars['transaction_id']) ? $extraVars['transaction_id'] : ''); - } + } parent::validateOrder($id_cart, $id_order_state, $amountPaid, $paymentMethod, $message, $extraVars, $currency_special, $dont_touch_amount, $secure_key); - + if (array_key_exists('transaction_id', $extraVars) AND array_key_exists('payment_status', $extraVars)) $this->_saveTransaction($id_cart, $extraVars); } - + public function getPayPalURL() { return 'www'.(Configuration::get('PAYPAL_SANDBOX') ? '.sandbox' : '').'.paypal.com'; } - + public function getPaypalIntegralEvolutionUrl() { if (Configuration::get('PAYPAL_SANDBOX')) return 'https://'.$this->getPayPalURL().'/cgi-bin/acquiringweb'; return 'https://securepayments.paypal.com/acquiringweb?cmd=_hosted-payment'; } - + public function getPaypalStandardUrl() { return 'https://'.$this->getPayPalURL().'/cgi-bin/webscr'; } - + public function getAPIURL() { return 'api-3t'.(Configuration::get('PAYPAL_SANDBOX') ? '.sandbox' : '').'.paypal.com'; } - + public function getAPIScript() { return '/nvp'; } - + public function getL($key) { $translations = array( @@ -557,7 +562,7 @@ class PayPal extends PaymentModule return $key; return $translations[$key]; } - + public function getLogo($ppExpress = false, $vertical = false) { if ($ppExpress) @@ -609,14 +614,14 @@ class PayPal extends PaymentModule return _MODULE_DIR_.$this->name.'/img/integral_evolution'.($vertical ? '_vertical' : '').'.png'; return _MODULE_DIR_.$this->name.'/img/PayPal_mark_60x38.gif'; } - + public function getCountryCode() { $address = new Address($this->context->cart->id_address_invoice); $country = new Country($address->id_country); return $country->iso_code; } - + public function displayPayPalAPIError($message, $log = false) { $send = true; @@ -648,30 +653,30 @@ class PayPal extends PaymentModule include_once(dirname(__FILE__).'/../../footer.php'); die; } - + private function _saveTransaction($id_cart, $extraVars) { $cart = new Cart((int)($id_cart)); if (Validate::isLoadedObject($cart) AND $cart->OrderExists()) { $id_order = Db::getInstance()->getValue(' - SELECT `id_order` - FROM `'._DB_PREFIX_.'orders` + SELECT `id_order` + FROM `'._DB_PREFIX_.'orders` WHERE `id_cart` = '.(int)$cart->id); - + Db::getInstance()->execute(' - INSERT INTO `'._DB_PREFIX_.'paypal_order` (`id_order`, `id_transaction`, `payment_method`, `payment_status`, `capture`) + INSERT INTO `'._DB_PREFIX_.'paypal_order` (`id_order`, `id_transaction`, `payment_method`, `payment_status`, `capture`) VALUES ('.(int)$id_order.', \''.pSQL($extraVars['transaction_id']).'\', '.(int)Configuration::get('PAYPAL_PAYMENT_METHOD').', \''.pSQL($extraVars['payment_status']).((isset($extraVars['pending_reason']) AND $extraVars['pending_reason'] == 'authorization') ? '_authorization' : '').'\', '.(int)(Configuration::get('PAYPAL_CAPTURE')).')'); } } - + private function _canRefund($id_order) { if (!(int)$id_order) return false; $paypal_order = Db::getInstance()->getRow(' - SELECT * - FROM `'._DB_PREFIX_.'paypal_order` + SELECT * + FROM `'._DB_PREFIX_.'paypal_order` WHERE `id_order` = '.(int)$id_order); if (!is_array($paypal_order) OR !sizeof($paypal_order)) return false; @@ -679,27 +684,27 @@ class PayPal extends PaymentModule return false; return true; } - + private function _needValidation($id_order) { if (!(int)$id_order) return false; $order = Db::getInstance()->getRow(' - SELECT `payment_method`, `payment_status` - FROM `'._DB_PREFIX_.'paypal_order` + SELECT `payment_method`, `payment_status` + FROM `'._DB_PREFIX_.'paypal_order` WHERE `id_order` = '.(int)$id_order); if (!$order) return false; return $order['payment_status'] == 'Pending' AND $order['payment_method'] == _PAYPAL_INTEGRAL_EVOLUTION_; } - + private function _needCapture($id_order) { if (!(int)$id_order) return false; $result = Db::getInstance()->getRow(' - SELECT `payment_method`, `payment_status`, `capture` - FROM `'._DB_PREFIX_.'paypal_order` + SELECT `payment_method`, `payment_status`, `capture` + FROM `'._DB_PREFIX_.'paypal_order` WHERE `id_order` = '.(int)($id_order).' AND `capture` = 1'); if (!isset($result['payment_method'])) return false; @@ -707,11 +712,11 @@ class PayPal extends PaymentModule return false; return true; } - + private function _setConfigurationForm() { $this->_html .= ' - <form method="post" action="'.htmlentities($_SERVER['REQUEST_URI']).'"> + <form method="post" action="'.htmlentities($_SERVER['REQUEST_URI']).'"> <script type="text/javascript"> var pos_select = '.(($tab = (int)Tools::getValue('tabs')) ? $tab : '0').'; </script> @@ -720,15 +725,15 @@ class PayPal extends PaymentModule <input type="hidden" name="tabs" id="tabs" value="0" /> <div class="tab-pane" id="tab-pane-1" style="width:100%;"> <div class="tab-page" id="step1"> - <h4 class="tab">'.$this->l('Solution').'</h2> + <h4 class="tab">'.$this->l('Solution').'</h4> '.$this->_getSolutionTabHtml().' </div> <div class="tab-page" id="step2"> - <h4 class="tab">'.$this->l('Settings').'</h2> + <h4 class="tab">'.$this->l('Settings').'</h4> '.$this->_getSettingsTabHtml().' </div> <div class="tab-page" id="step3"> - <h4 class="tab">'.$this->l('Logos and personalization').'</h2> + <h4 class="tab">'.$this->l('Logos and personalization').'</h4> '.$this->_getPersonalizationsTabHtml().' </div> </div> @@ -739,20 +744,20 @@ class PayPal extends PaymentModule </script> </form>'; } - + private function _getSolutionTabHtml() { $paymentMethod = (int)(Tools::getValue('payment_method', Configuration::get('PAYPAL_PAYMENT_METHOD'))); $paypalExpress = (int)(Tools::isSubmit('paypal_express') ? 1 : Configuration::get('PAYPAL_EXPRESS_CHECKOUT')); $paypalDebug = (int)(Tools::isSubmit('paypal_debug') ? 1 : Configuration::get('PAYPAL_DEBUG_MODE')); - + $link = 'http://altfarm.mediaplex.com/ad/ck/3484-23403-8030-88?ID=PROCPRESTA'; $lang = $this->context->language; if (strtolower($lang->iso_code) == 'es') $link = 'http://altfarm.mediaplex.com/ad/ck/3484-34334-12439-1'; else if (strtolower($lang->iso_code) == 'it') $link = 'https://www.paypal-business.it/paypalpro.asp'; - + return ' <h2>'.$this->l('Solution').'</h2> <h3>'.$this->l('Choose a solution:').'</h3> @@ -773,24 +778,24 @@ class PayPal extends PaymentModule '.$this->l('To use any PayPal solution, you need to set up API parameters in the « Settings » Tab').' </div>'; } - + private function _getSettingsTabHtml() { $lang = $this->context->language; $sandboxMode = (int)(Tools::getValue('sandbox_mode', Configuration::get('PAYPAL_SANDBOX'))); $paypalCapture = (int)(Tools::getValue('paypal_capture', Configuration::get('PAYPAL_CAPTURE'))); - + $html = ' <h2>'.$this->l('Settings').'</h2> <label>'.$this->l('Sandbox mode (tests)').':</label> <div class="margin-form" style="padding-top:2px;"> - <input type="radio" name="sandbox_mode" id="sandbox_mode_1" value="1" '.($sandboxMode ? 'checked="checked" ' : '').'/> <label for="sandbox_mode_1" class="t">'.$this->l('Active').'</label> + <input type="radio" name="sandbox_mode" id="sandbox_mode_1" value="1" '.($sandboxMode ? 'checked="checked" ' : '').'/> <label for="sandbox_mode_1" class="t">'.$this->l('Active').'</label> <input type="radio" name="sandbox_mode" id="sandbox_mode_0" value="0" style="margin-left:15px;" '.(!$sandboxMode ? 'checked="checked" ' : '').'/> <label for="sandbox_mode_0" class="t">'.$this->l('Inactive').'</label> </div> <div class="clear"></div> <label>'.$this->l('Payment type').':</label> <div class="margin-form" style="padding-top:2px;"> - <input type="radio" name="paypal_capture" id="paypal_capture_0" value="0" '.(!$paypalCapture ? 'checked="checked" ' : '').'/> <label for="paypal_capture_0" class="t">'.$this->l('Direct (sales)').'</label> + <input type="radio" name="paypal_capture" id="paypal_capture_0" value="0" '.(!$paypalCapture ? 'checked="checked" ' : '').'/> <label for="paypal_capture_0" class="t">'.$this->l('Direct (sales)').'</label> <input type="radio" name="paypal_capture" id="paypal_capture_1" value="1" style="margin-left:15px;" '.($paypalCapture ? 'checked="checked" ' : '').'/> <label for="paypal_capture_1" class="t">'.$this->l('Authorization / Manual Capture').' '.$this->l('(Payment shipping)').'</label> </div> <label>'.$this->l('PayPal account e-mail').':</label> @@ -826,12 +831,12 @@ class PayPal extends PaymentModule <p class="center"><input class="button" type="submit" name="submitPayPal" value="'.$this->l('Save settings').'" /></p>'; return $html; } - + private function _getPersonalizationsTabHtml() { $lang = $this->context->language; $template_paypal = Tools::getValue('template_paypal', Configuration::get('PAYPAL_TEMPLATE')); - + return ' <h2>'.$this->l('Logos and personalizations').'</h2> <label for="banner_url">'.$this->l('Banner image URL').':</label> @@ -841,14 +846,14 @@ class PayPal extends PaymentModule </div> <label>'.$this->l('Template chosen for PayPal Integral Evolution').':</label> <div class="margin-form" style="padding-top:2px;"> - <input type="radio" name="template_paypal" id="template_paypal_a" value="A" '.($template_paypal == 'A' ? 'checked="checked" ' : '').'/> <label for="template_paypal_a" class="t">A</label> + <input type="radio" name="template_paypal" id="template_paypal_a" value="A" '.($template_paypal == 'A' ? 'checked="checked" ' : '').'/> <label for="template_paypal_a" class="t">A</label> <input type="radio" name="template_paypal" id="template_paypal_b" value="B" style="margin-left:10px;" '.($template_paypal == 'B' ? 'checked="checked" ' : '').'/> <label for="template_paypal_b" class="t">B</label> <input type="radio" name="template_paypal" id="template_paypal_c" value="C" style="margin-left:10px;" '.($template_paypal == 'C' ? 'checked="checked" ' : '').'/> <label for="template_paypal_c" class="t">C</label> </div> '.($lang->iso_code == 'fr' ? '<p style="clear:both;"><a style="color:blue;text-decoration:underline;" href="https://cms.paypal.com/cms_content/FR/fr_FR/files/developer/Paypal_Integral_Evolution_Personnalisation.pdf" target="_blank">'.$this->l('Click here to learn how to customize these templates').'</a></p>' : '').' <p class="center"><input class="button" type="submit" name="submitPayPal" value="'.$this->l('Save settings').'" /></p>'; } - + private function _setPayPalSubscription() { $this->_html .= ' @@ -865,7 +870,7 @@ class PayPal extends PaymentModule '.$this->l('You need to configure your PayPal account before using this module.').' <div style="clear:both;"> </div>'; } - + private function _postProcess() { if (Tools::isSubmit('submitPayPal')) @@ -879,7 +884,7 @@ class PayPal extends PaymentModule $this->_errors[] = $this->l('E-mail invalid'); if (Tools::getValue('banner_url') != NULL AND !Validate::isUrl(Tools::getValue('banner_url'))) $this->_errors[] = $this->l('URL for banner is invalid'); - elseif (Tools::getValue('banner_url') != NULL AND strpos(Tools::getValue('banner_url'), 'https://') === false) + elseif (Tools::getValue('banner_url') != NULL AND strpos(Tools::getValue('banner_url'), 'https://') === false) $this->_errors[] = $this->l('URL for banner must use HTTPS protocol'); if (!in_array(Tools::getValue('template_paypal'), $template_available)) $this->_errors[] = $this->l('PayPal template invalid.'); @@ -889,7 +894,7 @@ class PayPal extends PaymentModule $this->_errors[] = $this->l('Cannot use this solution without API Credentials.'); if (Tools::isSubmit('paypal_express') AND (Tools::getValue('api_username') == NULL OR Tools::getValue('api_signature') == NULL)) $this->_errors[] = $this->l('Cannot use PayPal Express without API Credentials.'); - + if (!sizeof($this->_errors)) { Configuration::updateValue('PAYPAL_SANDBOX', (int)(Tools::getValue('sandbox_mode'))); @@ -921,7 +926,7 @@ class PayPal extends PaymentModule $this->_html = $this->displayError($error_msg); } } - + if (Tools::isSubmit('submitPayPalValidation')) { if (!($response = $this->_updatePaymentStatusOfOrder((int)(Tools::getValue('id_order')))) OR !sizeof($response)) @@ -939,7 +944,7 @@ class PayPal extends PaymentModule $this->_html .= '<p style="color:red;">'.$this->l('Error from PayPal: ').$response['L_LONGMESSAGE0'].' (#'.$response['L_ERRORCODE0'].')</p>'; } } - + if (Tools::isSubmit('submitPayPalCapture')) { if (!($response = $this->_doCapture((int)(Tools::getValue('id_order')))) OR !sizeof($response)) @@ -957,7 +962,7 @@ class PayPal extends PaymentModule $this->_html .= '<p style="color:red;">'.$this->l('Error from PayPal: ').$response['L_LONGMESSAGE0'].' (#'.$response['L_ERRORCODE0'].')</p>'; } } - + if (Tools::isSubmit('submitPayPalRefund')) { if (!($response = $this->_doTotalRefund((int)(Tools::getValue('id_order')))) OR !sizeof($response)) @@ -976,27 +981,27 @@ class PayPal extends PaymentModule } } } - + private function _getTransactionId($id_order) { if (!(int)$id_order) return false; - + return Db::getInstance()->getValue(' - SELECT `id_transaction` - FROM `'._DB_PREFIX_.'paypal_order` + SELECT `id_transaction` + FROM `'._DB_PREFIX_.'paypal_order` WHERE `id_order` = '.(int)$id_order); } - + private function _makeRefund($id_transaction, $id_order, $amt = false) { include_once(_PS_MODULE_DIR_.'paypal/api/paypallib.php'); - + if (!$this->_isPayPalAPIAvailable()) die(Tools::displayError('Fatal Error: no API Credentials are available')); if (!$id_transaction) die(Tools::displayError('Fatal Error: id_transaction is null')); - + if (!$amt) $request = '&TRANSACTIONID='.urlencode($id_transaction).'&REFUNDTYPE=Full'; else @@ -1011,7 +1016,7 @@ class PayPal extends PaymentModule $paypalLib = new PaypalLib(); return $paypalLib->makeCall($this->getAPIURL(), $this->getAPIScript(), 'RefundTransaction', $request); } - + private function _addNewPrivateMessage($id_order, $message) { if (!$id_order) @@ -1026,7 +1031,7 @@ class PayPal extends PaymentModule return $msg->add(); } - + private function _doTotalRefund($id_order) { if (!$this->_isPayPalAPIAvailable()) @@ -1073,20 +1078,20 @@ class PayPal extends PaymentModule return $response; } - + private function _doCapture($id_order) { include_once(_PS_MODULE_DIR_.'paypal/api/paypallib.php'); - + if (!$this->_isPayPalAPIAvailable()) return false; if (!$id_order) return false; - + $id_transaction = $this->_getTransactionId((int)($id_order)); if (!$id_transaction) return false; - + $order = new Order((int)($id_order)); $currency = new Currency((int)($order->id_currency)); $request = '&AUTHORIZATIONID='.urlencode($id_transaction).'&AMT='.(float)($order->total_paid).'&CURRENCYCODE='.$currency->iso_code.'&COMPLETETYPE=Complete'; @@ -1111,11 +1116,11 @@ class PayPal extends PaymentModule return $response; } - + private function _updatePaymentStatusOfOrder($id_order) { include_once(_PS_MODULE_DIR_.'paypal/api/paypallib.php'); - + if (!$this->_isPayPalAPIAvailable()) return false; if (!$id_order) @@ -1124,7 +1129,7 @@ class PayPal extends PaymentModule $id_transaction = $this->_getTransactionId((int)($id_order)); if (!$id_transaction) return false; - + $request = '&TRANSACTIONID='.urlencode($id_transaction); $paypalLib = new PaypalLib(); $response = $paypalLib->makeCall($this->getAPIURL(), $this->getAPIScript(), 'GetTransactionDetails', $request); @@ -1167,14 +1172,14 @@ class PayPal extends PaymentModule } return false; } - + private function _isPayPalAPIAvailable() { if (Configuration::get('PAYPAL_API_USER') != NULL AND Configuration::get('PAYPAL_API_PASSWORD') != NULL AND Configuration::get('PAYPAL_API_SIGNATURE') != NULL) return true; return false; } - + private function _checkAndUpdateFromOldVersion($install = false) { if (!Configuration::get('PAYPAL_NEW') AND ($this->active OR $install)) @@ -1253,12 +1258,86 @@ class PayPal extends PaymentModule } return false; } - + public function getOrder($id_transaction) { return Db::getInstance()->getValue(' - SELECT `id_order` - FROM `'._DB_PREFIX_.'paypal_order` + SELECT `id_order` + FROM `'._DB_PREFIX_.'paypal_order` WHERE `id_transaction` = \''.pSQL($id_transaction).'\''); } + + + + // Retrocompatibility to 1.3 + const ONLY_PRODUCTS = 1; + const ONLY_DISCOUNTS = 2; + const BOTH = 3; + const BOTH_WITHOUT_SHIPPING = 4; + const ONLY_SHIPPING = 5; + const ONLY_WRAPPING = 6; + const ONLY_PRODUCTS_WITHOUT_SHIPPING = 7; + + + /** + * getShopDomain returns domain name according to configuration and ignoring ssl + * + * @param boolean $http if true, return domain name with protocol + * @param boolean $entities if true, + * @return string domain + */ + public static function getShopDomain($http = false, $entities = false) + { + if (!($domain = Configuration::get('PS_SHOP_DOMAIN'))) + $domain = Tools::getHttpHost(); + if ($entities) + $domain = htmlspecialchars($domain, ENT_COMPAT, 'UTF-8'); + if ($http) + $domain = 'http://'.$domain; + return $domain; +} + + /** + * getShopDomainSsl returns domain name according to configuration and depending on ssl activation + * + * @param boolean $http if true, return domain name with protocol + * @param boolean $entities if true, + * @return string domain + */ + public static function getShopDomainSsl($http = false, $entities = false) + { + if (!($domain = Configuration::get('PS_SHOP_DOMAIN_SSL'))) + $domain = Tools::getHttpHost(); + if ($entities) + $domain = htmlspecialchars($domain, ENT_COMPAT, 'UTF-8'); + if ($http) + $domain = (Configuration::get('PS_SSL_ENABLED') ? 'https://' : 'http://').$domain; + return $domain; + } + + public static function display($file, $template, $cacheId = NULL, $compileId = NULL) + { + if (substr(_PS_VERSION_, 0, 3) != '1.3') + return parent::display($file, $template); + + global $smarty; + $previousTemplate = $smarty->currentTemplate; + $smarty->currentTemplate = substr(basename($template), 0, -4); + $smarty->assign('module_dir', __PS_BASE_URI__.'modules/'.basename($file, '.php').'/'); + if (Tools::file_exists_cache(_PS_THEME_DIR_.'modules/'.basename($file, '.php').'/'.$template)) + { + $smarty->assign('module_template_dir', _THEME_DIR_.'modules/'.basename($file, '.php').'/'); + $result = $smarty->fetch(_PS_THEME_DIR_.'modules/'.basename($file, '.php').'/'.$template); + } + elseif (Tools::file_exists_cache(dirname(__FILE__).'/'.$template)) + { + $smarty->assign('module_template_dir', __PS_BASE_URI__.'modules/'.basename($file, '.php').'/'); + $result = $smarty->fetch(dirname(__FILE__).'/'.$template); + } + else + $result = Tools::displayError('No template found'); + $smarty->currentTemplate = $previousTemplate; + return $result; + } + } diff --git a/modules/paypal/standard/redirect.php b/modules/paypal/standard/redirect.php index 4c24f12cd..f611b8bf2 100644 --- a/modules/paypal/standard/redirect.php +++ b/modules/paypal/standard/redirect.php @@ -66,18 +66,18 @@ $smarty->assign(array( 'address' => $address, 'country' => $country, 'state' => $state, - 'amount' => (float)($cart->getOrderTotal(true, Cart::BOTH_WITHOUT_SHIPPING)), + 'amount' => (float)($cart->getOrderTotal(true, PayPal::BOTH_WITHOUT_SHIPPING)), 'customer' => $customer, - 'total' => (float)($cart->getOrderTotal(true, Cart::BOTH)), - 'shipping' => Tools::ps_round((float)($cart->getOrderShippingCost()) + (float)($cart->getOrderTotal(true, Cart::ONLY_WRAPPING)), 2), - 'discount' => $cart->getOrderTotal(true, Cart::ONLY_DISCOUNTS), + 'total' => (float)($cart->getOrderTotal(true, PayPal::BOTH)), + 'shipping' => Tools::ps_round((float)($cart->getOrderShippingCost()) + (float)($cart->getOrderTotal(true, PayPal::ONLY_WRAPPING)), 2), + 'discount' => $cart->getOrderTotal(true, PayPal::ONLY_DISCOUNTS), 'business' => $business, 'currency_module' => $currency_module, 'cart_id' => (int)($cart->id).'_'.pSQL($cart->secure_key), 'products' => $cart->getProducts(), 'paypal_id' => (int)($paypal->id), 'header' => $header, - 'url' => Tools::getShopDomain(true, true).__PS_BASE_URI__ + 'url' => PayPal::getShopDomain(true, true).__PS_BASE_URI__ )); diff --git a/modules/shopimporter/shopimporter.js b/modules/shopimporter/shopimporter.js index 10275c5b7..4fc79c6f9 100644 --- a/modules/shopimporter/shopimporter.js +++ b/modules/shopimporter/shopimporter.js @@ -570,9 +570,9 @@ var shopImporter = { onAfter:function(){ $('#steps').html(''); shopImporter.save = 1; - if($('#import_module_name').attr('value') == 'importermagento') + if(type_connector == 'ws') shopImporter.checkAndSaveConfigWS(shopImporter.save); - else if ($('#import_module_name').attr('value') == 'importerosc') + else if (type_connector == 'db') shopImporter.checkAndSaveConfig(shopImporter.save); } }); @@ -789,7 +789,7 @@ $(document).ready(function(){ $('#displayOptions').unbind('click').click(function(){ $('#displayOptions').show(); - if($('#import_module_name').attr('value') == 'importermagento') + if(type_connector == 'ws') { if($('#loginws').val() == '' || $('#apikey').val() == '' || $('#url').val() == '') { @@ -805,7 +805,7 @@ $(document).ready(function(){ return false; } - else if ($('#import_module_name').attr('value') == 'importerosc') + else if (type_connector == 'db') { moduleName = $('#import_module_name').val(); server = $('#server').val(); @@ -836,7 +836,7 @@ $(document).ready(function(){ moduleName = $('#import_module_name').val(); if (validateSpecificOptions(moduleName, shopImporter.specificOptions) == true) { - if($('#import_module_name').attr('value') == 'importermagento') + if(type_connector == 'ws') { $.scrollTo($('#steps'), 300 , { onAfter:function(){ @@ -862,7 +862,7 @@ $(document).ready(function(){ return false; } }); - }else if ($('#import_module_name').attr('value') == 'importerosc') + }else if (type_connector == 'db') { $.scrollTo($('#steps'), 300 , { onAfter:function(){ diff --git a/modules/shopimporter/shopimporter.php b/modules/shopimporter/shopimporter.php index 1632d67bc..6a4de6005 100644 --- a/modules/shopimporter/shopimporter.php +++ b/modules/shopimporter/shopimporter.php @@ -413,7 +413,6 @@ class shopimporter extends ImportModule <input type="submit" class="button" name="checkAndSaveConfig" id="checkAndSaveConfig" value="'.$this->l('Next Step').'"> </div> </div> - </div> </fieldset>'; return $html; } @@ -499,7 +498,7 @@ class shopimporter extends ImportModule $json['hasError'] = true; $json['error'] = $errors; } - + if ($save || Tools::isSubmit('syncLang') || Tools::isSubmit('syncLangWS')) { //add language if not exist in prestashop @@ -551,21 +550,21 @@ class shopimporter extends ImportModule $table = $this->supportedImports[strtolower($className)]['table']; $object = new $className(); - + $rules = call_user_func(array($className, 'getValidationRules'), $className); - + if ((sizeof($rules['requiredLang']) || sizeof($rules['sizeLang']) || sizeof($rules['validateLang']) || Tools::isSubmit('syncLangWS') || Tools::isSubmit('syncCurrency'))) { $moduleName = Tools::getValue('moduleName'); if (file_exists('../../modules/'.$moduleName.'/'.$moduleName.'.php')) { - + require_once('../../modules/'.$moduleName.'/'.$moduleName.'.php'); $importModule = new $moduleName(); $defaultLanguage = new Language((int)Configuration::get('PS_LANG_DEFAULT')); - + $languages = $importModule->getLangagues(); if (Tools::isSubmit('syncLangWS')) @@ -573,10 +572,10 @@ class shopimporter extends ImportModule $defaultIdLand = $importModule->getDefaultIdLang(); $defaultLanguageImport = new Language(Language::getIdByIso($languages[$defaultIdLand]['iso_code'])); if ($defaultLanguage->iso_code != $defaultLanguageImport->iso_code) - $errors[] = $this->l('Default language doesn\'t match : ').'<br>'.Configuration::get('PS_SHOP_NAME').' : '.$defaultLanguage->name.' ≠ + $errors[] = $this->l('Default language doesn\'t match : ').'<br>'.Configuration::get('PS_SHOP_NAME').' : '.$defaultLanguage->name.' ≠ '.$importModule->displayName.' : '.$defaultLanguageImport->name.'<br>'.$this->l('Please change default language in your configuration'); } - + if (Tools::isSubmit('syncCurrency')) { $defaultIdCurrency = $importModule->getDefaultIdCurrency(); @@ -585,7 +584,7 @@ class shopimporter extends ImportModule $defaultCurrencyImport = new Currency((int)Currency::getIdByIsoCode($currencies[$defaultIdCurrency]['iso_code'])); else $defaultCurrencyImport = new Currency((int)Currency::getIdByIsoCodeNum($currencies[$defaultIdCurrency]['iso_code_num'])); - + $defaultCurrency = new Currency((int)Configuration::get('PS_CURRENCY_DEFAULT')); if ($defaultCurrency->iso_code != $defaultCurrencyImport->iso_code) $errors[] = $this->l('Default currency doesn\'t match : ').'<br>'.Configuration::get('PS_SHOP_NAME').' : '.$defaultCurrency->name.' ≠ '.$importModule->displayName.' : '.$defaultCurrencyImport->name.'<br>'.$this->l('Please change default currency in your configuration'); @@ -596,7 +595,7 @@ class shopimporter extends ImportModule else die('{"hasError" : true, "error" : ["FATAL ERROR"], "datas" : []}'); } - + foreach($fields as $key => $field) { $id = $this->supportedImports[strtolower($className)]['identifier']; @@ -616,7 +615,7 @@ class shopimporter extends ImportModule array_unshift($errors[sizeof($errors)-1], $field[$id]); } } - if (sizeof($errors) > 0) + if (sizeof($errors) > 0) { $json['hasError'] = true; $json['error'] = $errors; @@ -652,14 +651,14 @@ class shopimporter extends ImportModule if ($className == 'Category' AND (sizeof($fields) != (int)Tools::getValue('nbr_import'))) $this->updateCat(); } - if (sizeof($errors) > 0 AND is_array($errors)) + if (sizeof($errors) > 0 AND is_array($errors)) { $json['hasError'] = true; $json['error'] = $errors; } die(Tools::jsonEncode($json)); } - + private function saveObject($className, $items) { $return = array(); @@ -667,13 +666,14 @@ class shopimporter extends ImportModule //creating temporary fields for identifiers matching and password if (array_key_exists('alterTable', $this->supportedImports[strtolower($className)])) $this->alterTable(strtolower($className)); + $matchIdLang = $this->getMatchIdLang(1); foreach($items as $item) { $object = new $className; $id = $item[$this->supportedImports[strtolower($className)]['identifier']]; if (array_key_exists('foreign_key', $this->supportedImports[strtolower($className)])) $this->replaceForeignKey($item, $table); - $matchIdLang = $this->getMatchIdLang(1); + foreach($item as $key => $val) { if ($key == 'passwd') @@ -683,14 +683,16 @@ class shopimporter extends ImportModule } if (is_array($val) AND $key != 'images') { - + $tmp = array(); foreach($matchIdLang as $k => $v) - if (($k != $v) AND array_key_exists($k, $val)) { - $item[$key][$v] = $val[$k]; - unset($item[$key][$k]); + if (array_key_exists($k, $val)) + { + $tmp[$v] = $val[$k]; } - $object->$key = $item[$key]; + } + + $object->$key = $tmp; } else $object->$key = $val; @@ -863,7 +865,7 @@ class shopimporter extends ImportModule foreach($item['images'] as $key => $image) { $tmpfile = tempnam(_PS_TMP_IMG_DIR_, 'import'); - if (@copy($image, $tmpfile)) + if (@copy(str_replace(' ', '%20', $image), $tmpfile)) { $imagesTypes = ImageType::getImagesTypes($type); @@ -1089,9 +1091,10 @@ class shopimporter extends ImportModule $returnErrors[] = $this->l('the field').' <b>'.call_user_func(array($className, 'displayFieldName'), $fieldLang, $className).' ('.$language['name'].')</b> '.$this->l('is too long').' ('.$maxLength.' '.$this->l('chars max').')'; /* Checking for multilingual fields validity */ foreach ($rules['validateLang'] AS $fieldLang => $function) + { foreach ($languages AS $language) { - if (array_key_exists($fieldLang, $fields) AND ($value = $fields[$fieldLang][$language['id_lang']]) !== false AND !empty($value)) + if (array_key_exists($fieldLang, $fields) AND array_key_exists($language['id_lang'], $fields[$fieldLang]) AND ($value = $fields[$fieldLang][$language['id_lang']]) !== false AND !empty($value)) { if (!Validate::$function($value)) if ($hasErrors == 2) @@ -1107,6 +1110,7 @@ class shopimporter extends ImportModule } } } + } return $returnErrors; } @@ -1152,8 +1156,8 @@ class shopimporter extends ImportModule } else $returnErrors[] = $this->l('the field').' <b>'.call_user_func(array($className, 'displayFieldName'), $field, $className).'</b> '.$this->l('is invalid'); - - + + return $returnErrors; } public function checkAndAddLang ($languages, $add = true) @@ -1233,9 +1237,9 @@ class shopimporter extends ImportModule Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'country_lang'); Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'country'); case 'group' : - Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'customer_group'); - Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'ps_group_lang'); - Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'group'); + Db::getInstance()->Execute('TRUNCATE TABLE `'._DB_PREFIX_.'customer_group'); + Db::getInstance()->Execute('TRUNCATE TABLE `'._DB_PREFIX_.'group_lang'); + Db::getInstance()->Execute('TRUNCATE TABLE `'._DB_PREFIX_.'group'); break; case 'combination' : Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'product_attribute'); diff --git a/modules/shoppingfluxexport/config.xml b/modules/shoppingfluxexport/config.xml new file mode 100755 index 000000000..1b0724919 --- /dev/null +++ b/modules/shoppingfluxexport/config.xml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<module> + <name>shoppingfluxexport</name> + <displayName><![CDATA[Export Shopping Flux]]></displayName> + <version><![CDATA[1.4.1]]></version> + <description><![CDATA[Export du catalogue pour Shopping Flux]]></description> + <author><![CDATA[]]></author> + <tab><![CDATA[advertising_marketing]]></tab> + <confirmUninstall>Êtes-vous sur de vouloir supprimer ce module ?</confirmUninstall> + <is_configurable>1</is_configurable> + <need_instance>1</need_instance> + <limited_countries></limited_countries> +</module> \ No newline at end of file diff --git a/modules/shoppingfluxexport/flux.php b/modules/shoppingfluxexport/flux.php new file mode 100755 index 000000000..c7a021ad1 --- /dev/null +++ b/modules/shoppingfluxexport/flux.php @@ -0,0 +1,37 @@ +<?php +/* +* 2007-2011 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA <contact@prestashop.com> +* @copyright 2007-2011 PrestaShop SA +* @version Release: $Revision: 9074 $ +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +include(dirname(__FILE__).'/../../config/config.inc.php'); +include(dirname(__FILE__).'/../../init.php'); + +include(dirname(__FILE__).'/shoppingfluxexport.php'); +@ini_set('display_errors', 'off'); + +$f = new shoppingfluxexport(); +echo $f->generateFlux(); + + diff --git a/modules/shoppingfluxexport/fr.php b/modules/shoppingfluxexport/fr.php new file mode 100644 index 000000000..090cb3686 --- /dev/null +++ b/modules/shoppingfluxexport/fr.php @@ -0,0 +1,8 @@ +<?php + +global $_MODULE; +$_MODULE = array(); +$_MODULE['<{shoppingfluxexport}prestashop>shoppingfluxexport_fea9f8736d4903ba7394eae6c6c4a48b'] = 'Export Shopping Flux'; +$_MODULE['<{shoppingfluxexport}prestashop>shoppingfluxexport_532e375ed3b53b3c888a6bf214329e60'] = 'Export du catalogue pour Shopping Flux'; +$_MODULE['<{shoppingfluxexport}prestashop>shoppingfluxexport_5abb27355099ec51416a3f003fe63711'] = 'Êtes-vous sur de vouloir supprimer ce module ?'; +$_MODULE['<{shoppingfluxexport}prestashop>shoppingfluxexport_68a59c7fd2c1bf8103225a22a6088235'] = 'Adresse du fichier :'; diff --git a/modules/shoppingfluxexport/logo.gif b/modules/shoppingfluxexport/logo.gif new file mode 100755 index 000000000..9768abdf1 Binary files /dev/null and b/modules/shoppingfluxexport/logo.gif differ diff --git a/modules/shoppingfluxexport/shoppingfluxexport.php b/modules/shoppingfluxexport/shoppingfluxexport.php new file mode 100755 index 000000000..e75186ad4 --- /dev/null +++ b/modules/shoppingfluxexport/shoppingfluxexport.php @@ -0,0 +1,208 @@ +<?php +/* +* 2007-2011 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA <contact@prestashop.com> +* @copyright 2007-2011 PrestaShop SA +* @version Release: $Revision: 9074 $ +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +if (!defined('_PS_VERSION_')) + exit; + +class shoppingfluxexport extends Module +{ + + public function __construct() + { + $this->name = 'shoppingfluxexport'; + $this->tab = 'advertising_marketing'; + $this->version = '1.4.1'; + + parent::__construct(); + + $this->displayName = $this->l('Export Shopping Flux'); + $this->description = $this->l('Export du catalogue pour Shopping Flux'); + $this->confirmUninstall = $this->l('Êtes-vous sur de vouloir supprimer ce module ?'); + } + + public function install() + { + // Create Token + if (!Configuration::updateValue('SHOPPING_FLUX_TOKEN', md5(rand()))) + return false; + + // Install Module + if (!parent::install()) + return false; + + return true; + } + + public function uninstall() + { + // Delete Token + if (!Configuration::deleteByName('SHOPPING_FLUX_TOKEN')) + return false; + + // Uninstall Module + if (!parent::uninstall()) + return false; + + return true; + } + + public function getContent() + { + if (isset($_POST['generateFlux']) && $_POST['generateFlux'] != NULL) + $this->generateFlux(); + + $uri = 'http://'.$_SERVER['HTTP_HOST'].__PS_BASE_URI__.'modules/shoppingfluxexport/flux.php?token='.Configuration::get('SHOPPING_FLUX_TOKEN'); + + $this->_html = '<h2>'.$this->displayName.'</h2> + <form method="post" action="'.htmlentities($_SERVER['REQUEST_URI']).'"> + <fieldset> + <legend>'.$this->l('Export Shopping Flux').'</legend> + + <p>'.$this->l('Adresse du fichier :').' + <a href="'.$uri.'" target="_blank"> + '.$uri.'</a></p> + </fieldset> + + </form> + '; + + return $this->_html; + } + + private function clean($string) + { + + $string = str_replace("\r\n", " ", $string); + $string = str_replace("|", " ", $string); + + return $string; + } + + public function generateFlux() + { + if (Tools::getValue('token') == '' || Tools::getValue('token') != Configuration::get('SHOPPING_FLUX_TOKEN')) + die('Invalid Token'); + + $titles = array( + 0 => 'id_produit', + 1 => 'nom_produit', + 2 => 'url_produit', + 3 => 'url_image', + 4 => 'description', + 5 => 'description_courte', + 6 => 'prix', + 7 => 'prix_barre', + 8 => 'frais_de_port', + 9 => 'delaiLiv', + 10 => 'marque', + 11 => 'rayon', + 12 => 'stock', + 13 => 'qte_stock', + 14 => 'EAN', + 15 => 'poids', + 16 => 'ecotaxe', + 17 => 'TVA', + 18 => 'Reference constructeur', + 19 => 'Reference fournisseur' + ); + + echo implode("|", $titles)."\r\n"; + + //For Shipping + $configuration = Configuration::getMultiple(array('PS_TAX_ADDRESS_TYPE','PS_CARRIER_DEFAULT','PS_COUNTRY_DEFAULT', 'PS_LANG_DEFAULT', 'PS_SHIPPING_FREE_PRICE', 'PS_SHIPPING_HANDLING', 'PS_SHIPPING_METHOD', 'PS_SHIPPING_FREE_WEIGHT')); + + $products = Product::getSimpleProducts($configuration['PS_LANG_DEFAULT']); + + $defaultCountry = new Country($configuration['PS_COUNTRY_DEFAULT'], Configuration::get('PS_LANG_DEFAULT')); + $id_zone = (int)$defaultCountry->id_zone; + + $carrier = new Carrier((int)$configuration['PS_CARRIER_DEFAULT']); + $carrierTax = Tax::getCarrierTaxRate((int)$carrier->id, (int)$this->{$configuration['PS_TAX_ADDRESS_TYPE']}); + + foreach ($products as $key => $produit) + { + $product = new Product((int)($produit['id_product']), true, $configuration['PS_LANG_DEFAULT']); + + //For links + $link = new Link(); + + //For images + $cover = $product->getCover($product->id); + $ids = $product->id.'-'.$cover['id_image']; + + //For shipping + + if ($product->getPrice(true, NULL, 2, NULL, false, true, 1) >= (float)($configuration['PS_SHIPPING_FREE_PRICE']) AND (float)($configuration['PS_SHIPPING_FREE_PRICE']) > 0) + $shipping = 0; + elseif (isset($configuration['PS_SHIPPING_FREE_WEIGHT']) AND $product->weight >= (float)($configuration['PS_SHIPPING_FREE_WEIGHT']) AND (float)($configuration['PS_SHIPPING_FREE_WEIGHT']) > 0) + $shipping = 0; + else + { + if (isset($configuration['PS_SHIPPING_HANDLING']) AND $carrier->shipping_handling) + $shipping = (float)($configuration['PS_SHIPPING_HANDLING']); + + if ($carrier->getShippingMethod() == Carrier::SHIPPING_METHOD_WEIGHT) + $shipping += $carrier->getDeliveryPriceByWeight($product->weight, $id_zone); + else + $shipping += $carrier->getDeliveryPriceByPrice($product->getPrice(true, NULL, 2, NULL, false, true, 1), $id_zone); + + $shipping *= 1 + ($carrierTax / 100); + $shipping = (float)(Tools::ps_round((float)($shipping), 2)); + + } + + $data = array(); + $data[0] = $product->id; + $data[1] = $product->name; + $data[2] = $link->getProductLink($product); + $data[3] = $link->getImageLink($product->link_rewrite, $ids, 'large'); + $data[4] = $product->description; + $data[5] = $product->description_short; + $data[6] = $product->getPrice(true, NULL, 2, NULL, false, true, 1); + $data[7] = $product->getPrice(true, NULL, 2, NULL, false, false, 1); + $data[8] = $shipping; + $data[9] = $carrier->delay[2]; + $data[10] = $product->manufacturer_name; + $data[11] = $product->category; + $data[12] = ($product->quantity > 0) ? 'oui' : 'non'; + $data[13] = $product->quantity; + $data[14] = $product->ean13; + $data[15] = $product->weight; + $data[16] = $product->ecotax; + $data[17] = $product->tax_rate; + $data[18] = $product->reference; + $data[19] = $product->supplier_reference; + + foreach($data as $key => $value) + $data[$key] = $this->clean($value); + + echo implode("|", $data)."\r\n"; + + } + } +} + diff --git a/modules/statsforecast/statsforecast.php b/modules/statsforecast/statsforecast.php index 63caa2004..c5483456f 100644 --- a/modules/statsforecast/statsforecast.php +++ b/modules/statsforecast/statsforecast.php @@ -80,12 +80,9 @@ class StatsForecast extends Module $currency = $this->context->currency; $employee = $this->context->employee; - // @todo use PHP functions to get timestamp ... - $result = $db->getRow('SELECT UNIX_TIMESTAMP(\'2009-06-05 00:00:00\') as t1, UNIX_TIMESTAMP(\''.$employee->stats_date_from.' 00:00:00\') as t2'); - $from = max($result['t1'], $result['t2']); + $from = max(strtotime(_PS_CREATION_DATE_.' 00:00:00'), strtotime($employee->stats_date_from.' 00:00:00')); $to = strtotime($employee->stats_date_to.' 23:59:59'); - $result2 = $db->getRow('SELECT UNIX_TIMESTAMP(NOW()) as t1, UNIX_TIMESTAMP(\''.$employee->stats_date_to.' 23:59:59\') as t2'); - $to2 = min($result2['t1'], $result2['t2']); + $to2 = min(time(), $to); $interval = ($to - $from) / 60 / 60 / 24; $interval2 = ($to2 - $from) / 60 / 60 / 24; $prop30 = $interval / $interval2; @@ -99,18 +96,17 @@ class StatsForecast extends Module if ($this->context->cookie->stats_granularity == 42) $intervalAvg = $interval2 / 7; - // @todo : to remove - if (!defined('PS_BASE_URI')) - define('PS_BASE_URI', '/'); - $result = $db->getRow('SELECT UNIX_TIMESTAMP(\'2009-06-05\') as t1, UNIX_TIMESTAMP(\''.$employee->stats_date_from.'\') as t2'); - $from = max($result['t1'], $result['t2']); - $to = strtotime($employee->stats_date_to.''); + $dataTable = array(); + if ($cookie->stats_granularity == 10) + for ($i = $from; $i <= $to2; $i = strtotime('+1 day', $i)) + $dataTable[date('Y-m-d', $i)] = array('fix_date' => date('Y-m-d', $i), 'countOrders' => 0, 'countProducts' => 0, 'totalProducts' => 0); $dateFromGAdd = ($this->context->cookie->stats_granularity != 42 - ? 'SUBSTRING(date_add, 1, '.(int)$this->context->cookie->stats_granularity.')' + ? 'LEFT(date_add, '.(int)$this->context->cookie->stats_granularity.')' : 'IFNULL(MAKEDATE(YEAR(date_add),DAYOFYEAR(date_add)-WEEKDAY(date_add)), CONCAT(YEAR(date_add),"-01-01*"))'); + $dateFromGInvoice = ($this->context->cookie->stats_granularity != 42 - ? 'SUBSTRING(invoice_date, 1, '.(int)$this->context->cookie->stats_granularity.')' + ? 'LEFT(invoice_date, '.(int)$this->context->cookie->stats_granularity.')' : 'IFNULL(MAKEDATE(YEAR(invoice_date),DAYOFYEAR(invoice_date)-WEEKDAY(invoice_date)), CONCAT(YEAR(invoice_date),"-01-01*"))'); $sql = 'SELECT @@ -128,17 +124,8 @@ class StatsForecast extends Module ORDER BY fix_date'; $result = $db->executeS($sql, false); - $dataTable = array(); - if ($this->context->cookie->stats_granularity == 10) - { - $dateEnd = strtotime($employee->stats_date_to.' 23:59:59'); - $dateToday = time(); - for ($i = strtotime($employee->stats_date_from.' 00:00:00'); $i <= $dateEnd && $i <= $dateToday; $i += 86400) - $dataTable[$i] = array('fix_date' => date('Y-m-d', $i), 'countOrders' => 0, 'countProducts' => 0, 'totalProducts' => 0); - } - while ($row = $db->nextRow($result)) - $dataTable[strtotime($row['fix_date'])] = $row; + $dataTable[$row['fix_date']] = $row; $this->_html .= '<div> <fieldset><legend><img src="../modules/'.$this->name.'/logo.gif" /> '.$this->displayName.'</legend> diff --git a/modules/themeinstallator/themeinstallator.php b/modules/themeinstallator/themeinstallator.php index dc39db163..147ccd9cd 100644 --- a/modules/themeinstallator/themeinstallator.php +++ b/modules/themeinstallator/themeinstallator.php @@ -319,6 +319,12 @@ class ThemeInstallator extends Module */ public function getContent() { + /* PrestaShop demo mode */ + if (_PS_MODE_DEMO_) + { + return '<div class="error">'.Tools::displayError('This functionnality has been disabled.').'</div>'; + + } self::init_defines(); if (!Tools::isSubmit('cancelExport') AND $this->page == 'exportPage') return self::getContentExport(); diff --git a/modules/tntcarrier/carrier.jpg b/modules/tntcarrier/carrier.jpg new file mode 100644 index 000000000..92d5fabb3 Binary files /dev/null and b/modules/tntcarrier/carrier.jpg differ diff --git a/modules/tntcarrier/classes/OrderInfoTnt.php b/modules/tntcarrier/classes/OrderInfoTnt.php new file mode 100644 index 000000000..88af8e06a --- /dev/null +++ b/modules/tntcarrier/classes/OrderInfoTnt.php @@ -0,0 +1,68 @@ +<?php + +class OrderInfoTnt +{ + private $_idOrder; + + public function __construct($id_order) + { + $this->_idOrder = $id_order; + } + + public function getInfo() + { + $info = Db::getInstance()->ExecuteS('SELECT o.shipping_number, a.lastname, a.firstname, a.address1, a.address2, a.postcode, a.city, a.phone, c.email, c.id_customer, a.company + FROM `'._DB_PREFIX_.'orders` as o, `'._DB_PREFIX_.'address` as a, `'._DB_PREFIX_.'customer` as c + WHERE o.id_order = "'.$this->_idOrder.'" AND a.id_address = o.id_address_delivery AND c.id_customer = o.id_customer'); + if (!$info) + return false; + $weight = Db::getInstance()->ExecuteS('SELECT p.weight, o.product_quantity + FROM `'._DB_PREFIX_.'order_detail` as o, `'._DB_PREFIX_.'product` as p + WHERE o.id_order = "'.$this->_idOrder.'" AND p.id_product = o.product_id'); + $option = Db::getInstance()->ExecuteS('SELECT t.option + FROM `'._DB_PREFIX_.'tnt_carrier_option` as t , `'._DB_PREFIX_.'orders` as o + WHERE t.id_carrier = o.id_carrier AND o.id_order = "'.$this->_idOrder.'"'); + if ($option != null && strpos($option[0]['option'], "D") !== false) + $dropOff = Db::getInstance()->ExecuteS('SELECT d.code, d.name, d.address, d.zipcode, d.city + FROM `'._DB_PREFIX_.'tnt_carrier_drop_off` as d , `'._DB_PREFIX_.'orders` as o + WHERE d.id_cart = o.id_cart AND o.id_order = "'.$this->_idOrder.'"'); + $w = 0; + $tooBig = false; + foreach ($weight as $key => $val) + { + while ($val['product_quantity'] > 0) + { + if ((int)($val['weight']) > 20) + return "Un ou plusieurs articles sont supérieurs à 20 Kg<br/>Vous devez contacter votre commercial TNT"; + if ($w + $val['weight'] > 20) + { + $info[1]['weight'][] = (string)($w); + $w = $val['weight']; + } + else + $w += $val['weight']; + $val['product_quantity']--; + } + } + $info[1]['weight'][] = (string)($w); + + if (date("N") == 5) + $next_day = date("Y-m-d", mktime(0, 0, 0, date("m") , date("d")+3, date("Y"))); + elseif (date("N") == 6) + $next_day = date("Y-m-d", mktime(0, 0, 0, date("m") , date("d")+2, date("Y"))); + else + $next_day = date("Y-m-d", mktime(0, 0, 0, date("m") , date("d")+1, date("Y"))); + $newDate = Tools::getValue('dateErrorOrder'); + $info[2] = array('delivery_date' => ($newDate != '' ? $newDate : $next_day)); + if ($option) + $info[3] = array('option' => $option[0]['option']); + if (isset($dropOff)) + $info[4] = $dropOff[0]; + else + $info[4] = null; + return $info; + } + +} + +?> diff --git a/modules/tntcarrier/classes/PackageTnt.php b/modules/tntcarrier/classes/PackageTnt.php new file mode 100644 index 000000000..0b02866a5 --- /dev/null +++ b/modules/tntcarrier/classes/PackageTnt.php @@ -0,0 +1,40 @@ +<?php + +class PackageTnt +{ + private $_idOrder; + private $_order; + + public function __construct($id_order) + { + $this->_idOrder = $id_order; + $this->_order = new Order((int)($this->_idOrder)); + } + + public function setShippingNumber($number) + { + if ($this->_order->shipping_number == '') + { + $this->_order->shipping_number = $number; + $this->_order->update(); + } + $this->insertSql($number); + } + + public function getShippingNumber() + { + $tab = Db::getInstance()->ExecuteS('SELECT `shipping_number` FROM `'._DB_PREFIX_.'tnt_carrier_shipping_number` WHERE `id_order` = "'.(int)($this->_idOrder).'"'); + return ($tab); + } + + public function insertSql($number) + { + Db::getInstance()->ExecuteS('INSERT INTO `'._DB_PREFIX_.'tnt_carrier_shipping_number` (`id_order`, `shipping_number`) + VALUES ("'.(int)($this->_idOrder).'", "'.$number.'")'); + } + + public function getOrder() + { + return ($this->_order); + } +} \ No newline at end of file diff --git a/modules/tntcarrier/classes/TntWebService.php b/modules/tntcarrier/classes/TntWebService.php new file mode 100644 index 000000000..0632b6394 --- /dev/null +++ b/modules/tntcarrier/classes/TntWebService.php @@ -0,0 +1,238 @@ +<?php +class TntWebService +{ + private $_login; + private $_password; + private $_account; + private $authheader; + private $authvars; + private $header; + private $file; + + public function __construct() + { + $this->_login = Configuration::get('TNT_CARRIER_LOGIN'); + $this->_password = Configuration::get('TNT_CARRIER_PASSWORD'); + $this->_account = Configuration::get('TNT_CARRIER_NUMBER_ACCOUNT'); + + $this->_authheader = $this->genAuth(); + $this->_authvars = new SoapVar($this->_authheader, XSD_ANYXML); + $this->_header = new SoapHeader("http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd", "Security", $this->_authvars); + $this->_file = "http://www.tnt.fr/service/?wsdl"; + } + + public function genAuth() + { + return sprintf(' + <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"> + <wsse:UsernameToken> + <wsse:Username>%s</wsse:Username> + <wsse:Password>%s</wsse:Password> + </wsse:UsernameToken> + </wsse:Security>', htmlspecialchars($this->_login), htmlspecialchars($this->_password)); + } + + public function faisabilite($dateExpedition, $codePostalDepart, $communeDepart, $codePostalArrivee, $communeArrivee, $typeDestinataire) + { + $soapclient = new SoapClient($this->_file, array('trace'=>1)); + $soapclient->__setSOAPHeaders(array($this->_header)); + + $sender = array("zipCode" => $codePostalDepart, "city" => $communeDepart); + $receiver = array("zipCode" => $codePostalArrivee, "city" => $communeArrivee, "type" => $typeDestinataire); + $parameters = array("accountNumber" => $this->_account, "shippingDate" => $dateExpedition, "sender" => $sender, "receiver" => $receiver); + $services = $soapclient->feasibility(array('parameters' => $parameters)); + return ($services); + } + + public function putCityInNormeTnt($city) + { + $city = iconv("utf-8", 'ASCII//TRANSLIT', $city); + $city = mb_strtoupper($city, 'utf-8'); + $table = array('`' => '','\''=> '', '^' => '','À'=>'A', 'Á'=>'A', 'Â'=>'A', 'Ã'=>'A', 'Ä'=>'A', 'Å'=>'A', 'Æ'=>'A', 'Ç'=>'C', 'È'=>'E', 'É'=>'E', + 'Ê'=>'E', 'Ë'=>'E', 'Ì'=>'I', 'Í'=>'I', 'Î'=>'I', 'Ï'=>'I', 'Ñ'=>'N', 'Ò'=>'O', 'Ó'=>'O', 'Ô'=>'O', + 'Õ'=>'O', 'Ö'=>'O', 'Ø'=>'O', 'Ù'=>'U', 'Ú'=>'U', 'Û'=>'U', 'Ü'=>'U', 'Ý'=>'Y', 'Þ'=>'B'); + $city = strtr($city, $table); + $old = array("SAINT", "-"); + $new = array("ST", " "); + return (str_replace($old, $new, $city)); + } + + public function getPackage($info) + { + $soapclient = new SoapClient($this->_file, array('trace'=>1)); + $soapclient->__setSOAPHeaders(array($this->_header)); + + $sender = array( + 'type' => (Configuration::get('TNT_CARRIER_SHIPPING_COLLECT') ? "ENTERPRISE" : "DEPOT"), //ENTREPRISE OR DEPOT + 'typeId' => (Configuration::get('TNT_CARRIER_SHIPPING_COLLECT') ? "" : Configuration::get('TNT_CARRIER_SHIPPING_PEX')) , // code PEX if DEPOT is ON + 'name' => Configuration::get('TNT_CARRIER_SHIPPING_COMPANY'), // raison social + 'address1' => Configuration::get('TNT_CARRIER_SHIPPING_ADDRESS1'), + 'address2' => Configuration::get('TNT_CARRIER_SHIPPING_ADDRESS2'), + 'zipCode' => Configuration::get('TNT_CARRIER_SHIPPING_ZIPCODE'), + 'city' => $this->putCityInNormeTnt(Configuration::get('TNT_CARRIER_SHIPPING_CITY')), + 'contactLastName' => Configuration::get('TNT_CARRIER_SHIPPING_LASTNAME'), + 'contactFirstName' => Configuration::get('TNT_CARRIER_SHIPPING_FIRSTNAME'), + 'emailAddress' => Configuration::get('TNT_CARRIER_SHIPPING_EMAIL'), + 'phoneNumber' => Configuration::get('TNT_CARRIER_SHIPPING_PHONE'), + 'faxNumber' => '' //may be later + ); + + if ($info[4] == null) + $receiver = array( + 'type' => ($info[0]['company'] != '' ? "ENTERPRISE" : 'INDIVIDUAL'), // ENTREPRISE DEPOT DROPOFFPOINT INDIVIDUAL + 'typeId' => '', // IF DEPOT => code PEX else if DROPOFFPOINT => XETT + 'name' => ($info[0]['company'] != '' ? $info[0]['company'] : ''), + 'address1' => $info[0]['address1'], + 'address2' => $info[0]['address2'], + 'zipCode' => $info[0]['postcode'], + 'city' => $this->putCityInNormeTnt($info[0]['city']), + 'instructions' => '', + 'contactLastName' => $info[0]['lastname'], + 'contactFirstName' => $info[0]['firstname'], + 'emailAddress' => $info[0]['email'], + 'phoneNumber' => $info[0]['phone'], + 'accessCode' => '', + 'floorNumber' => '', + 'buildingId' => '', + 'sendNotification' => '' + ); + else + $receiver = array( + 'type' => 'DROPOFFPOINT', // ENTREPRISE DEPOT DROPOFFPOINT INDIVIDUAL + 'typeId' => $info[4]['code'], // IF DEPOT => code PEX else if DROPOFFPOINT => XETT + 'name' => $info[4]['name'], + 'address1' => $info[4]['address'], + 'address2' => '', + 'zipCode' => $info[4]['zipcode'], + 'city' => $info[4]['city'], + 'instructions' => '', + 'contactLastName' => $info[0]['lastname'], + 'contactFirstName' => $info[0]['firstname'], + 'emailAddress' => $info[0]['email'], + 'phoneNumber' => $info[0]['phone'], + 'accessCode' => '', + 'floorNumber' => '', + 'buildingId' => '', + 'sendNotification' => '' + ); + + foreach ($info[1]['weight'] as $k => $v) + { + $parcelRequest[$k] = array( + 'sequenceNumber' => $k + 1, // package number, there's only one at this moment + 'customerReference' => $info[0]['id_customer'], // customer ref + 'weight' => $v, + 'insuranceAmount' => '', + 'priorityGuarantee' => '', + 'comment' => '' + ); + } + + $parcelsRequest = array('parcelRequest' => $parcelRequest); + + $pickUpRequest = array( + 'media' => "EMAIL", + 'faxNumber' => "", + 'emailAddress' => Configuration::get('TNT_CARRIER_SHIPPING_EMAIL'), + 'notifySuccess' => "1", + 'service' => "", + 'lastName' => "", + 'firstName' => "", + 'phoneNumber' => Configuration::get('TNT_CARRIER_SHIPPING_PHONE'), + 'closingTime' => Configuration::get('TNT_CARRIER_SHIPPING_CLOSING'), + 'instructions' => "" + ); + + if (Configuration::get('TNT_CARRIER_SHIPPING_COLLECT') == 1) + { + $paremeters = array( + 'pickUpRequest' => $pickUpRequest, + 'shippingDate' => $info[2]['delivery_date'], + 'accountNumber' => Configuration::get('TNT_CARRIER_NUMBER_ACCOUNT'), + 'sender' => $sender, + 'receiver' => $receiver, + 'serviceCode' => $info[3]['option'], + 'quantity' => count($info[1]['weight']), //number of package; count($parcelsRequest) + 'parcelsRequest' => $parcelsRequest, + 'saturdayDelivery' => '0',//Configuration::get('TNT_CARRIER_SHIPPING_DELIVERY'), + //'paybackInfo' => $paybackInfo, + 'labelFormat' => (!Configuration::get('TNT_CARRIER_PRINT_STICKER') ? "STDA4" : Configuration::get('TNT_CARRIER_PRINT_STICKER')) + ); + } + else + { + $paremeters = array( + 'shippingDate' => $info[2]['delivery_date'], + 'accountNumber' => Configuration::get('TNT_CARRIER_NUMBER_ACCOUNT'), + 'sender' => $sender, + 'receiver' => $receiver, + 'serviceCode' => $info[3]['option'], + 'quantity' => count($info[1]['weight']), //number of package; count($parcelsRequest) + 'parcelsRequest' => $parcelsRequest, + 'saturdayDelivery' => '0',//Configuration::get('TNT_CARRIER_SHIPPING_DELIVERY'), + //'paybackInfo' => $paybackInfo, + 'labelFormat' => (!Configuration::get('TNT_CARRIER_PRINT_STICKER') ? "STDA4" : Configuration::get('TNT_CARRIER_PRINT_STICKER')) + ); + } + $package = $soapclient->expeditionCreation(array('parameters' => $paremeters)); + return $package; + } + + public function followPackage($transport) + { + $soapclient = new SoapClient($this->_file, array('trace'=>1)); + $soapclient->__setSOAPHeaders(array($this->_header)); + + $reponse = $soapclient->trackingByConsignment(array('parcelNumber' => $transport)); + + if (isset($reponse->Parcel) && $reponse->Parcel) + { + $colis = $reponse->Parcel; + $expediteur = $colis->sender; + $destinataire = $colis->receiver; + $evenements = $colis->events; + + $requestDate = new DateTime($evenements->requestDate); + $processDate = new DateTime($evenements->processDate); + $arrivalDate = new DateTime($evenements->arrivalDate); + $deliveryDepartureDate = new DateTime($evenements->deliveryDepartureDate); + $deliveryDate = new DateTime($evenements->deliveryDate); + } + + $packageParam = array( + 'number' => (isset($colis->consignmentNumber) ? $colis->consignmentNumber : ''), + 'status' => (isset($colis->shortStatus) ? $colis->shortStatus : ''), + 'account_number' => (isset($colis->accountNumber) ? $colis->accountNumber : ''), + 'service' => (isset($colis->service) ? $colis->service : ''), + 'reference' => (isset($colis->reference) ? $colis->reference : ''), + 'weight' => (isset($colis->weight) ? $colis->weight : ''), + 'expediteur_name' => (isset($expediteur->name) ? $expediteur->name : ''), + 'expediteur_addr1' => (isset($expediteur->address1) ? $expediteur->address1 : ''), + 'expediteur_addr2' => (isset($expediteur->address2) ? $expediteur->address2 : ''), + 'expediteur_zipcode' => (isset($expediteur->zipCode) ? $expediteur->zipCode : ''), + 'expediteur_city' => (isset($expediteur->city) ? $expediteur->city : ''), + 'destinataire_name' => (isset($destinataire->name) ? $destinataire->name : ''), + 'destinataire_addr1' => (isset($destinataire->address1) ? $destinataire->address1 : ''), + 'destinataire_addr2' => (isset($destinataire->address2) ? $destinataire->address2 : ''), + 'destinataire_zipcode' => (isset($destinataire->zipCode) ? $destinataire->zipCode : ''), + 'destinataire_city' => (isset($destinataire->city) ? $destinataire->city : ''), + 'request' => (isset($evenements->requestDate) ? $evenements->requestDate : ''), + 'requestDate' => (isset($requestDate) && isset($evenements->requestDate) ? $requestDate : ''), + 'process' => (isset($evenements->processDate) ? $evenements->processDate : ''), + 'process_date' => (isset($processDate) && isset($evenements->processDate) ? $processDate : ''), + 'process_center' => (isset($evenements->processCenter) ? $evenements->processCenter : ''), + 'arrival' => (isset($evenements->arrivalDepartureDate) ? $evenements->arrivalDepartureDate : ''), + 'arrival_date' => (isset($arrivalDate) ? $arrivalDate : ''), + 'arrival_center' => (isset($evenements->arrivalCenter) ? $evenements->arrivalCenter : ''), + 'delivery_departure' => (isset($evenements->deliveryDepartureDate) ? $evenements->deliveryDepartureDate : ''), + 'delivery_departure_date' => (isset($deliveryDepartureDate) ? $deliveryDepartureDate : ''), + 'delivery_departure_center' => (isset($evenements->deliveryDepartureCenter) ? $evenements->deliveryDepartureCenter : ''), + 'delivery' => (isset($evenements->deliveryDate) ? $evenements->deliveryDate : ''), + 'delivery_date' => (isset($deliveryDate) ? $deliveryDate : ''), + 'long_status' => (isset($colis->longStatus) ? $colis->longStatus : ''), + 'linkPicture' => (isset($colis->primaryPODUrl) ? $colis->primaryPODUrl : '') + ); + return $packageParam; + } +} +?> \ No newline at end of file diff --git a/modules/tntcarrier/classes/index.php b/modules/tntcarrier/classes/index.php new file mode 100644 index 000000000..477abec6f --- /dev/null +++ b/modules/tntcarrier/classes/index.php @@ -0,0 +1,36 @@ +<?php +/* +* 2007-2011 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA <contact@prestashop.com> +* @copyright 2007-2011 PrestaShop SA +* @version Release: $Revision: 6594 $ +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../../../"); +exit; diff --git a/modules/tntcarrier/classes/serviceCache.php b/modules/tntcarrier/classes/serviceCache.php new file mode 100644 index 000000000..7531b9b60 --- /dev/null +++ b/modules/tntcarrier/classes/serviceCache.php @@ -0,0 +1,58 @@ +<?php + +class serviceCache +{ + private $_dateBefore; + private $_dateNow; + private $_idCard; + private $_zipCode; + + public function __construct($id_card, $zipcode) + { + $this->_dateBefore = date("Y-m-d H:i:s", mktime(date("H"), date("i") - 15, date("s"), date("m") , date("d"), date("Y"))); + $this->_dateNow = date('Y-m-d H:i:s'); + $this->_idCard = $id_card; + $this->_zipCode = $zipcode; + } + + public function getFaisabilityAtThisTime() + { + if (Db::getInstance()->getValue('SELECT * FROM `'._DB_PREFIX_.'tnt_carrier_cache_service` WHERE `date` >= "'.$this->_dateBefore.'" AND `date` <= "'.$this->_dateNow.'" AND id_card = "'.(int)($this->_idCard).'" AND zipcode = "'.$this->_zipCode.'"')) + return true; + return false; + } + + public function deletePreviousServices() + { + Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'tnt_carrier_cache_service` WHERE `id_card` = "'.(int)($this->_idCard).'"'); + } + + public static function deleteServices($idCard) + { + Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'tnt_carrier_cache_service` WHERE `id_card` = "'.(int)($idCard).'"'); + } + + public function putInCache($service, $serviceRelais) + { + if (isset($service)) + { + if (is_array($service->Service)) + foreach ($service->Service as $k => $v) + Db::getInstance()->Execute('INSERT INTO `'._DB_PREFIX_.'tnt_carrier_cache_service` (`id_card`, `code`, `date`, `zipcode`) VALUES ("'.(int)($this->_idCard).'", "'.$v->serviceCode.'","'.$this->_dateNow.'", "'.$this->_zipCode.'")'); + else + Db::getInstance()->Execute('INSERT INTO `'._DB_PREFIX_.'tnt_carrier_cache_service` (`id_card`, `code`, `date`, `zipcode`) VALUES ("'.(int)($this->_idCard).'", "'.$service->Service->serviceCode.'","'.$this->_dateNow.'", "'.$this->_zipCode.'")'); + } + if (isset($serviceRelais)) + { + foreach ($serviceRelais as $v) + Db::getInstance()->Execute('INSERT INTO `'._DB_PREFIX_.'tnt_carrier_cache_service` (`id_card`, `code`, `date`, `zipcode`) VALUES ("'.(int)($this->_idCard).'", "'.$v->serviceCode.'","'.$this->_dateNow.'", "'.$this->_zipCode.'")'); + } + } + + public function getServices() + { + return (Db::getInstance()->ExecuteS('SELECT * FROM `'._DB_PREFIX_.'tnt_carrier_cache_service` WHERE id_card = "'.(int)($this->_idCard).'"')); + } +} + +?> \ No newline at end of file diff --git a/modules/tntcarrier/config.xml b/modules/tntcarrier/config.xml new file mode 100644 index 000000000..f0d26a86b --- /dev/null +++ b/modules/tntcarrier/config.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<module> + <name>tntcarrier</name> + <displayName><![CDATA[TNT Express]]></displayName> + <version><![CDATA[1.0]]></version> + <description><![CDATA[Offer your customers, different delivery methods with TNT]]></description> + <author><![CDATA[PrestaShop]]></author> + <tab><![CDATA[shipping_logistics]]></tab> + <is_configurable>1</is_configurable> + <need_instance>1</need_instance> + <limited_countries>fr</limited_countries> +</module> \ No newline at end of file diff --git a/modules/tntcarrier/css/index.php b/modules/tntcarrier/css/index.php new file mode 100644 index 000000000..477abec6f --- /dev/null +++ b/modules/tntcarrier/css/index.php @@ -0,0 +1,36 @@ +<?php +/* +* 2007-2011 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA <contact@prestashop.com> +* @copyright 2007-2011 PrestaShop SA +* @version Release: $Revision: 6594 $ +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../../../"); +exit; diff --git a/modules/tntcarrier/css/tntB2CRelaisColis.css b/modules/tntcarrier/css/tntB2CRelaisColis.css new file mode 100644 index 000000000..488149a6f --- /dev/null +++ b/modules/tntcarrier/css/tntB2CRelaisColis.css @@ -0,0 +1,371 @@ +.tntRCHeader { + background-color: #ffffff; + background-image: url(../img/logo_24_relaiscolis.jpg); + background-position: 10px center; + background-repeat: no-repeat; + border-color: gray; + border-style: solid; + border-width: 1px; + color: #a0a0a0; + display: bloc; + font-family: arial,helvetica,sans-serif; + font-size: 30pt; + font-style: italic; + height: 75px; + padding-right: 10px; + padding-top: 25px; + text-align: right; + width: 490px; +} + +#tntRCdetailRelaisEntete .tntRCHeader +{ + width:590px; +} + +.tntRCSubHeader { + background-color: #ffffff; + border-width: 0px; + color: #a0a0a0; + display: bloc; + font-family: arial,helvetica,sans-serif; + font-size: 16pt; + font-weight: bold; + padding-bottom: 3px; + padding-top: 3px; + width: 500px; +} + +.tntRCBody { + background-color: #ffffff; + border-color: gray; + border-style: solid; + border-width: 1px; + color: #000000; + display: bloc; + font-family: arial,helvetica,sans-serif; + font-size: 12pt; + padding-bottom: 10px; + padding-left: 10px; + padding-top: 10px; + width: 490px; +} + +.tntRCBodySearch { + background-color: #ffffff; + border-color: gray; + border-style: solid; + border-width: 1px; + color: #a0a0a0; + font-family: arial,helvetica,sans-serif; + font-size: 10pt; + font-weight: bold; + padding-left: 3px; + padding-top: 8px; + padding-bottom: 8px; + width: 497px; +} + +.tntRCError { + background-color: #ff6600; + color: #ffffff; + display: bloc; + font-family: arial,helvetica,sans-serif; + font-size: 12pt; + font-weight: bold; + width: 480px; +} + +.tntRCGray { + background-color: #a0a0a0; + border-width: 0px; + display: bloc; + font-family: arial,helvetica,sans-serif; + font-size: 10pt; + heigth: 12px; + width: 480px; +} + +.tntRCInput { + background-color: #ffffff; + font-family: arial,helvetica,sans-serif; + font-size: 10pt; + font-weight: normal; + text-align: center; + width: 50px; +} + +.tntRCWhite { + background-color: #ffffff; + border-width: 0px; + display: bloc; + font-family: arial,helvetica,sans-serif; + font-size: 14pt; + width: 500px; +} + +.tntRCrelaisColis { + font-family: arial,helvetica,sans-serif; + font-size: 10px; + color: #000000; + border-bottom-style: solid; + border-bottom-color: #a0a0a0; + border-bottom-width: 1px; + background-color: #ffffff; + padding-bottom: 3px; + vertical-align: middle; +} + +.tntRCtitreMode { + font-family: arial,helvetica,sans-serif; + font-size: 28px; + color: #a0a0a0; + font-style: italic; + background-color: #ffffff; +} + +.tntRCchoix { + font-family: arial,helvetica,sans-serif; + font-size: 14px; + color: #a0a0a0; + font-weight: bold; + background-color: #ffffff; +} +.tntRCdetailGros { + font-family: arial,helvetica,sans-serif; + font-size: 14pt; + color: #a0a0a0; + background-color: #ffffff; +} + +.tntRCnoirPetit { + font-family: arial,helvetica,sans-serif; + font-size: 12pt; + color: #000000; + background-color: #ffffff; +} + +.tntRCdetailPetit { + font-family: arial,helvetica,sans-serif; + font-size: 12pt; + color: #a0a0a0; + background-color: #ffffff; + font-weight: bold; +} + +.tntRCentree { + font-family: arial,helvetica,sans-serif; + font-size: 12pt; + color: #000000; + background-color: #ffffff; + vertical-align: middle; +} + +.tntRCgris { + font-family: arial,helvetica,sans-serif; + font-size: 10pt; + color: #ffffff; + background-color: #a0a0a0; + font-weight: bold; +} + +table.tntRCHoraire td { + border: 1px solid gray; + font-family: arial,helvetica,sans-serif; + font-size: 10pt; + vertical-align: middle; +} + +.tntRCHoraireJour{ + color: #a0a0a0; + text-align: right; + padding-right: 10px; + height: 36px; + width: 79px; + font-weight: bold; +} + +.tntRCHoraireHeure { + color: #000000; + padding-left: 10px; + width: 84px; +} + +.tntRCblanc { + font-family: arial,helvetica,sans-serif; + font-size: 12px; + color: #000000; + background-color: #ffffff; + padding-top: 4px; + padding-bottom: 3px; +} + .tntRCblancpetit { + font-family: arial,helvetica,sans-serif; + font-size: 12px; + color: #000000; + background-color: #ffffff; + padding-top: 4px; + padding-bottom: 3px; +} + .tntRCfermeture { + padding-left: 585px; +} + + .tntRCBack2Communes { + background-color: #ffffff; + color: #a0a0a0; + font-family: arial,helvetica,sans-serif; + font-style: italic; + font-size: 11pt; + font-weight: bold; + padding-top: 18px; + text-align: right; +} + + .tntRCBack2Communes a { + color: #a0a0a0; + text-decoration: none; + padding-right: 5px; +} + + .tntRCBack2Communes a img{ + border: 0; + padding-right: 5px; + vertical-align: text-bottom; +} + + .tntRCBoutonLoupe { + background-color: #ffffff; + border: 0px; + color: #000000; + font-family: arial,helvetica,sans-serif; + font-size: 12px; + padding-top: 4px; + padding-bottom: 3px; + text-decoration: none; + vertical-align: middle; +} + .jqmWindow { + background-color: #FFF; + border: 1px solid black; + color: #333; + display: none; + padding: 12px; + position: fixed; + left: 50%; + margin-left: -300px; + margin-top: -240px; + width: 500px; +} + + div.tntRCfermeture .jqmClose em{display:none;} + div.tntRCfermeture .jqmClose { + background: transparent url(../modules/tntcarrier/img/close_icon_double.png) 0 0 no-repeat; + display: block; + width: 20px; + height: 20px; +} + + div.tntRCfermeture a.jqmClose:hover{ background-position: 0 -20px; } + + .jqmOverlay { + background-color: #000; + overflow: hidden; +} + + * html .jqmWindow { + position: absolute; + top: expression((document.documentElement.scrollTop || document.body.scrollTop) + Math.round(17 * (document.documentElement.offsetHeight || document.body.clientHeight) / 100) + 'px'); +} + + img.tntRCButton { + border: 0px; + vertical-align: middle; + text-decoration: none; +} + + sup.tntRCSup { + +} + + table.horairesRC td { + width : 100%; + margin: 0px; + padding: 0px; + } + + table.horairesRCPopup { + width : 100%; + margin: 0px; + padding: 0px; + } + + table.horairesRCPopup tr.selected td { + background-color: #eeeeee; + color: #ff6600; + } + + td.horaireRCPopup { + width : 60%; + } + + td.horairesRCJourPopup { + width : 40%; + font-weight: bold; + color: #808080; + } + + td.horairesRCJour { + font-weight: bold; + color: #808080; + } + table.horairesRC tr.selected td { + background-color: #eeeeee; + color: #ff6600; + } + + div.ag { + background-image: url(/img/google/agenceTnt.png); + background-repeat: no-repeat; + padding-left:60px; + } + + div.rc { + background-image: url(/img/google/relaisColis.png); + background-repeat: no-repeat; + padding-left:50px; + } + + +#googleMapTnt .lien_reset { + color : #ff6600; + font-family: arial,helvetica,sans-serif; + font-weight: bold; + font-size : 15px; + text-decoration:none; +} + +#googleMapTnt a { + color: #f60; + outline-color: #f60 !important; + outline: none; +} + +#googleMapTnt a:hover { + text-decoration: none; +} + +#googleMapTnt .exemplePresentation { + display: inline; + margin-top: 10px; +} + + #tntB2CRelaisColis { + width: 610px; +} + +.detailRelais +{ + background: url("../img/ui-dialog/fcfdfd_40x100_textures_06_inset_hard_100.png") repeat-x scroll 0 bottom #FCFDFD; + height:400px; +} \ No newline at end of file diff --git a/modules/tntcarrier/css/ui.dialog.css b/modules/tntcarrier/css/ui.dialog.css new file mode 100644 index 000000000..3c91bfad6 --- /dev/null +++ b/modules/tntcarrier/css/ui.dialog.css @@ -0,0 +1,158 @@ +/* + * jQuery UI screen structure and presentation + * This CSS file was generated by ThemeRoller, a Filament Group Project for jQuery UI + * Author: Scott Jehl, scott@filamentgroup.com, http://www.filamentgroup.com + * Visit ThemeRoller.com +*/ + +/* + * Note: If your ThemeRoller settings have a font size set in ems, your components will scale according to their parent element's font size. + * As a rule of thumb, set your body's font size to 62.5% to make 1em = 10px. + * body {font-size: 62.5%;} +*/ + + +/*dialog*/ +#googleMapTnt .ui-dialog { + /*resets*/margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; + font-family: Lucida Grande, Lucida Sans, Arial, sans-serif; + font-size: 11px; + background: #fcfdfd url(../img/ui-dialog/fcfdfd_40x100_textures_06_inset_hard_100.png) 0 bottom repeat-x; + color: #222222; + border: 3px solid #808080; + position: relative; +} +#googleMapTnt .ui-resizable-handle { + position: absolute; + font-size: 0.1px; + z-index: 99999; +} +#googleMapTnt .ui-resizable .ui-resizable-handle { + display: block; +} +#googleMapTnt .ui-resizable-disabled .ui-resizable-handle { display: none; } /* use 'body' to make it more specific (css order) */ +#googleMapTnt .ui-resizable-autohide .ui-resizable-handle { display: none; } /* use 'body' to make it more specific (css order) */ +#googleMapTnt .ui-resizable-n { + cursor: n-resize; + height: 7px; + width: 100%; + top: -5px; + left: 0px; +} +#googleMapTnt .ui-resizable-s { + cursor: s-resize; + height: 7px; + width: 100%; + bottom: -5px; + left: 0px; +} +#googleMapTnt .ui-resizable-e { + cursor: e-resize; + width: 7px; + right: -5px; + top: 0px; + height: 100%; +} +#googleMapTnt .ui-resizable-w { + cursor: w-resize; + width: 7px; + left: -5px; + top: 0px; + height: 100%; +} +#googleMapTnt .ui-resizable-se { + cursor: se-resize; + width: 13px; + height: 13px; + right: 0px; + bottom: 0px; + background: url(../img/ui-dialog/469bdd_11x11_icon_resize_se.gif) no-repeat 0 0; +} +#googleMapTnt .ui-resizable-sw { + cursor: sw-resize; + width: 9px; + height: 9px; + left: 0px; + bottom: 0px; +} +#googleMapTnt .ui-resizable-nw { + cursor: nw-resize; + width: 9px; + height: 9px; + left: 0px; + top: 0px; +} +#googleMapTnt .ui-resizable-ne { + cursor: ne-resize; + width: 9px; + height: 9px; + right: 0px; + top: 0px; +} +#googleMapTnt .ui-dialog-titlebar { + /*resets*/margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; + padding: 5px 15px 5px 10px; + color: #2e6e9e; + border-bottom: 1px solid #c5dbec; + font-size: 10px; + font-weight: bold; + position: relative; +} +#googleMapTnt .ui-dialog-title {} +#googleMapTnt .ui-dialog-titlebar-close { + /*resets*/margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; + background: url(../img/ui-dialog/6da8d5_11x11_icon_close.gif) 0 0 no-repeat; + position: absolute; + right: 8px; + top: 7px; + width: 11px; + height: 11px; + z-index: 100; +} +#googleMapTnt .ui-dialog-titlebar-close-hover, .ui-dialog-titlebar-close:hover { + background: url(../img/ui-dialog/217bc0_11x11_icon_close.gif) 0 0 no-repeat; +} +#googleMapTnt .ui-dialog-titlebar-close:active { + background: url(../img/ui-dialog/f9bd01_11x11_icon_close.gif) 0 0 no-repeat; +} +#googleMapTnt .ui-dialog-titlebar-close span { + display: none; +} +#googleMapTnt .ui-dialog-content { + /*resets*/margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; + color: #222222; + padding: 15px 17px; +} +#googleMapTnt .ui-dialog-buttonpane { + position: absolute; + bottom: 0; + width: 100%; + text-align: left; + border-top: 1px solid #a6c9e2; + background: #fcfdfd; +} +#googleMapTnt .ui-dialog-buttonpane button { + margin: 5px 0 5px 8px; + color: #2e6e9e; + background: #dfeffc url(../img/ui-dialog/dfeffc_40x100_textures_02_glass_85.png) 0 50% repeat-x; + font-size: 1; + border: 10px solid #c5dbec; + cursor: pointer; + padding: 2px 6px 3px 6px; + line-height: 14px; +} +#googleMapTnt .ui-dialog-buttonpane button:hover { + color: #1d5987; + background: #d0e5f5 url(../img/ui-dialog/d0e5f5_40x100_textures_02_glass_75.png) 0 50% repeat-x; + border: 1px solid #79b7e7; +} +#googleMapTnt .ui-dialog-buttonpane button:active { + color: #e17009; + background: #f5f8f9 url(../img/ui-dialog/f5f8f9_40x100_textures_06_inset_hard_100.png) 0 50% repeat-x; + border: 1px solid #79b7e7; +} +/* This file skins dialog */ +#googleMapTnt .ui-dialog.ui-draggable .ui-dialog-titlebar, +#googleMapTnt .ui-dialog.ui-draggable .ui-dialog-titlebar { + cursor: move; +} diff --git a/modules/tntcarrier/css/ui.tabs.css b/modules/tntcarrier/css/ui.tabs.css new file mode 100644 index 000000000..2f1954ca4 --- /dev/null +++ b/modules/tntcarrier/css/ui.tabs.css @@ -0,0 +1,62 @@ +/*UI tabs*/ +.ui-tabs-nav { + /*resets*/margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; /*font-size: 100%;*/ list-style: none; + font-family: Lucida Grande, Lucida Sans, Arial, sans-serif; + font-size: 10px; + float: left; + position: relative; + z-index: 1; + /*border-right: 1px solid #c5dbec;*/ + bottom: -1px; +} +.ui-tabs-nav ul { + /*resets*/margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; /*font-size: 100%;*/ list-style: none; +} + +.ui-tabs-nav li { + /*resets*/margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; /*font-size: 100%;*/ list-style: none; + float: left; + border: 1px solid #c5dbec; + border-right: none; +} + +.ui-tabs-nav li a { + /*resets*/margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; /*font-size: 100%;*/ list-style: none; + float: left; + font-size: 10px; + font-weight: bold; + text-decoration: none; + padding: .2em 1em; + color: #2e6e9e; + background: #dfeffc url(../img/ui-dialog/dfeffc_40x100_textures_02_glass_85.png) 0 50% repeat-x; +} + +.ui-tabs-nav li a:hover { + background: #d0e5f5 url(../img/ui-dialog/d0e5f5_40x100_textures_02_glass_75.png) 0 50% repeat-x; + color: #1d5987; +} + +.ui-tabs-nav li.ui-tabs-selected { + border-bottom-color: #f5f8f9; +} + +.ui-tabs-nav li.ui-tabs-selected a, .ui-tabs-nav li.ui-tabs-selected a:hover { + background: #f5f8f9 url(../img/ui-dialog/f5f8f9_40x100_textures_06_inset_hard_100.png) 0 50% repeat-x; + color: #e17009; +} + +.ui-tabs-panel { + /*resets*/margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; /*font-size: 100%;*/ list-style: none; + /*font-family: Lucida Grande, Lucida Sans, Arial, sans-serif;*/ + clear:left; + border: 1px solid #c5dbec; + background: #fcfdfd url(../img/ui-dialog/fcfdfd_40x100_textures_06_inset_hard_100.png) 0 bottom repeat-x; + /*color: #222222;*/ + padding: 1em 1em; + width: 315px; + font-size: 10px; +} + +.ui-tabs-hide { + display: none;/* for accessible hiding: position: absolute; left: -99999999px*/; +} \ No newline at end of file diff --git a/modules/tntcarrier/follow.php b/modules/tntcarrier/follow.php new file mode 100644 index 000000000..a8018ca38 --- /dev/null +++ b/modules/tntcarrier/follow.php @@ -0,0 +1,27 @@ +<?php +require('../../config/config.inc.php'); +require_once(_PS_MODULE_DIR_."/tntcarrier/classes/TntWebService.php"); + +global $smarty; + +try +{ + $tntWebService = new TntWebService(); + $follow[] = $tntWebService->followPackage($_GET['code']); +} +catch( SoapFault $e ) +{ + $erreur = $e->faultstring; + echo $erreur; +} +catch( Exception $e ) +{ + $erreur = "Problem : follow failed"; +} +$config['date'] = '%d/%m/%y'; +$config['time'] = '%I:%M %p'; +$smarty->assign('erreur', $erreur); +$smarty->assign('config',$config); +$smarty->assign( 'follow', $follow ); +$smarty->display('tpl/follow.tpl' ); +?> \ No newline at end of file diff --git a/modules/tntcarrier/fr.php b/modules/tntcarrier/fr.php new file mode 100644 index 000000000..5704dbbb5 --- /dev/null +++ b/modules/tntcarrier/fr.php @@ -0,0 +1,90 @@ +<?php + +global $_MODULE; +$_MODULE = array(); +$_MODULE['<{tntcarrier}prestashop>tntcarrier_58ec6a48b4720ef0aa2adfded1ccf8a3'] = 'TNT Express'; +$_MODULE['<{tntcarrier}prestashop>tntcarrier_9b7637001f5d2bcb42efb4ab6b3e93da'] = 'Offre aux clients, différentes methodes de livraison'; +$_MODULE['<{tntcarrier}prestashop>tntcarrier_416900392875e9effb318da8648fbdcb'] = 'doit ou doivent etre configuré(s) pour utiliser le module correctement'; +$_MODULE['<{tntcarrier}prestashop>tntcarrier_632cae5cf3af08786414932a8e6f96a0'] = 'Pseudonyme TNT'; +$_MODULE['<{tntcarrier}prestashop>tntcarrier_3b4f51300711a1eb61770d1696702402'] = 'Mot de passe TNT'; +$_MODULE['<{tntcarrier}prestashop>tntcarrier_0e3b102c1a4938889716cea423a95001'] = 'Numéro de compte TNT'; +$_MODULE['<{tntcarrier}prestashop>tntcarrier_e81d9f25acf7fa457ab32527a882ed50'] = 'Transporteur TNT'; +$_MODULE['<{tntcarrier}prestashop>tntcarrier_d968787921c136e1cf9f766562aec8bc'] = 'Les paramètres suivants vous ont été fournis par TNT'; +$_MODULE['<{tntcarrier}prestashop>tntcarrier_af7c2efe81330e4c9089f2c90781282e'] = 'Si vous n\'êtes pas encore inscrit, cliquez sur'; +$_MODULE['<{tntcarrier}prestashop>tntcarrier_6c92285fa6d3e827b198d120ea3ac674'] = 'ici'; +$_MODULE['<{tntcarrier}prestashop>tntcarrier_8af703b2bf59cc9742883ae7f4cb0e5b'] = 'Paramètres du compte'; +$_MODULE['<{tntcarrier}prestashop>tntcarrier_927e079056c2709236d4167bbb96e799'] = 'Réglages d\'expédition'; +$_MODULE['<{tntcarrier}prestashop>tntcarrier_82fe86ee1a21af1c1db5c8c4c5e5a188'] = 'Paramètres du service'; +$_MODULE['<{tntcarrier}prestashop>tntcarrier_160f61d02d22b76b47b4305094bf36a6'] = 'Compte TNT'; +$_MODULE['<{tntcarrier}prestashop>tntcarrier_99dea78007133396a7b8ed70578ac6ae'] = 'Identifiant'; +$_MODULE['<{tntcarrier}prestashop>tntcarrier_dc647eb65e6711e155375218212b3964'] = 'Mot de passe'; +$_MODULE['<{tntcarrier}prestashop>tntcarrier_05e642d027a22d12780ccf91bf9d7d34'] = 'Numéro de compte'; +$_MODULE['<{tntcarrier}prestashop>tntcarrier_8005dfbbaf4c9333592f26e82ddfd0af'] = 'Remplissez le formulaire avec les données'; +$_MODULE['<{tntcarrier}prestashop>tntcarrier_ea9cf7e47ff33b2be14e6dd07cbcefc6'] = 'Expédition'; +$_MODULE['<{tntcarrier}prestashop>tntcarrier_4d8ff211a4a8a140e293736f92ac39d5'] = 'Aimeriez-vous que TNT ramasse votre colis ?'; +$_MODULE['<{tntcarrier}prestashop>tntcarrier_581bf6fa6cd6d4bf4b0bbe2cfe6e404c'] = 'Non (via un dépôt)'; +$_MODULE['<{tntcarrier}prestashop>tntcarrier_93cba07454f06a4a960172bbd6e2a435'] = 'Oui'; +$_MODULE['<{tntcarrier}prestashop>tntcarrier_f5234754269687df652c9f6f2f80cc10'] = 'Choisissez votre emplacement dépositaire'; +$_MODULE['<{tntcarrier}prestashop>tntcarrier_e7a7e191423e6a9ce3b59fd51ecbde87'] = 'Le code pex'; +$_MODULE['<{tntcarrier}prestashop>tntcarrier_e7b47c58815acf1d3afa59a84b5db7fb'] = 'Nom de l\'entreprise'; +$_MODULE['<{tntcarrier}prestashop>tntcarrier_8d3f5eff9c40ee315d452392bed5309b'] = 'Nom de famille'; +$_MODULE['<{tntcarrier}prestashop>tntcarrier_20db0bfeecd8fe60533206a2b5e9891a'] = 'Prénom'; +$_MODULE['<{tntcarrier}prestashop>tntcarrier_e9f79aa2b1f455a52497a126d9442582'] = 'Adresse ligne 1'; +$_MODULE['<{tntcarrier}prestashop>tntcarrier_3d4d4cac03e194ab20154382cd544e0f'] = 'Adresse ligne 2'; +$_MODULE['<{tntcarrier}prestashop>tntcarrier_d30f507473129e70c4b962ceccf175cf'] = 'Zip / Code Postal'; +$_MODULE['<{tntcarrier}prestashop>tntcarrier_d0585aac6bb77bb49423b2effca0e067'] = 'Votre ville'; +$_MODULE['<{tntcarrier}prestashop>tntcarrier_f775ad1fbb08939178d4df9c457601f2'] = 'Votre adresse email'; +$_MODULE['<{tntcarrier}prestashop>tntcarrier_67c19a5276428fb9e49c557b1a3526d5'] = 'Votre numéro de téléphone'; +$_MODULE['<{tntcarrier}prestashop>tntcarrier_6222760252f52bb4dc70835d238d5484'] = 'Votre heure de clôture'; +$_MODULE['<{tntcarrier}prestashop>tntcarrier_cf67059a7bd51c3543def1ee4bdc4fe1'] = 'Livraison le samedi'; +$_MODULE['<{tntcarrier}prestashop>tntcarrier_bafd7322c6e97d25b6299b5d6fe8920b'] = 'Aucun'; +$_MODULE['<{tntcarrier}prestashop>tntcarrier_dc86b23a40568ae3ece2d3008ca61442'] = 'Format de l\'étiquette pour l\'impression (Cette étiquette doit être collée sur l\'emballage)'; +$_MODULE['<{tntcarrier}prestashop>tntcarrier_2976cd63d00184e3f0a45c1337cd31f0'] = 'Impression A4'; +$_MODULE['<{tntcarrier}prestashop>tntcarrier_2f95a5450ee306f7faca792e379ccb34'] = 'sans imprimer le logo de TNT'; +$_MODULE['<{tntcarrier}prestashop>tntcarrier_44fca4829aecbdf69a2200ea0a10a8aa'] = 'avec une impression inverse'; +$_MODULE['<{tntcarrier}prestashop>tntcarrier_a67ee8b3121d0ceb601e9f0600db9692'] = 'sans imprimer le logo TNT et avec une impression inverse'; +$_MODULE['<{tntcarrier}prestashop>tntcarrier_1c85ce46031e67c95be9aa05b859f955'] = 'Nouveau service'; +$_MODULE['<{tntcarrier}prestashop>tntcarrier_b718adec73e04ce3ec720dd11a06a308'] = 'ID'; +$_MODULE['<{tntcarrier}prestashop>tntcarrier_49ee3087348e8d44e1feda1917443987'] = 'Nom'; +$_MODULE['<{tntcarrier}prestashop>tntcarrier_b5a7adde1af5c87d7fd797b6245c2a39'] = 'Description'; +$_MODULE['<{tntcarrier}prestashop>tntcarrier_ca0dbad92a874b2f69b549293387925e'] = 'Code'; +$_MODULE['<{tntcarrier}prestashop>tntcarrier_7ec0def44906b0cd2848459349eea638'] = 'Frais additionnels (€)'; +$_MODULE['<{tntcarrier}prestashop>tntcarrier_cb456215c3333db0551bd0788bc258c7'] = 'Activé'; +$_MODULE['<{tntcarrier}prestashop>tntcarrier_de95b43bceeb4b998aed4aed5cef1ae7'] = 'modifier'; +$_MODULE['<{tntcarrier}prestashop>tntcarrier_099af53f601532dbd31e0ea99ffdeb64'] = 'supprimer'; +$_MODULE['<{tntcarrier}prestashop>tntcarrier_7b9cf007806ed854cd12ab800c8a982b'] = 'Lieu'; +$_MODULE['<{tntcarrier}prestashop>tntcarrier_b06cdf3c0c75a1a58b82761f87f458e4'] = 'Etat du module transporteur TNT'; +$_MODULE['<{tntcarrier}prestashop>tntcarrier_4c7b2960da33c41e9bbea499696702ca'] = 'Le module transporteur TNT est configuré et en ligne'; +$_MODULE['<{tntcarrier}prestashop>tntcarrier_efce38300739e2fd6cef1acd9ce68a1c'] = 'Le module transporteur TNT n\'est pas encore configuré, s\'il vous plait :'; +$_MODULE['<{tntcarrier}prestashop>tntcarrier_a8341741d73ef0a3ca5e8a7facc9a738'] = 'Assurez vous d\'avoir un compte TNT'; +$_MODULE['<{tntcarrier}prestashop>tntcarrier_3dab1e2673a4acc557135ccf795d4e31'] = 'Assurez vous d\'avoir une adresse correcte d\'expedition'; +$_MODULE['<{tntcarrier}prestashop>tntcarrier_057c674e4d23b04c0cbe1bfe81a0bec1'] = 'Assurez vous que certains services sont actifs'; +$_MODULE['<{tntcarrier}prestashop>tntcarrier_9d5b24e0e3516fcef94916366fadae67'] = 'Nouvelle option Poids'; +$_MODULE['<{tntcarrier}prestashop>tntcarrier_02f6a536789c7b8399ddbd1652d85d9c'] = 'Poids Min'; +$_MODULE['<{tntcarrier}prestashop>tntcarrier_03b4258831663af9e7f48bc6bc574e6c'] = 'Poids Max'; +$_MODULE['<{tntcarrier}prestashop>tntcarrier_7dce122004969d56ae2e0245cb754d35'] = 'Modifier'; +$_MODULE['<{tntcarrier}prestashop>tntcarrier_f2a6c498fb90ee345d997f888fce3b18'] = 'Supprimer'; +$_MODULE['<{tntcarrier}prestashop>tntcarrier_0619bef93192e574f288fe2e55c3a7f7'] = 'Poids min'; +$_MODULE['<{tntcarrier}prestashop>tntcarrier_d8c74112ba3622be2e79d4d4dc24eaf4'] = 'Poids max'; +$_MODULE['<{tntcarrier}prestashop>tntcarrier_508ccf43328cac4c93d1de242d2ddffb'] = 'Frais additionnels'; +$_MODULE['<{tntcarrier}prestashop>tntcarrier_69d865b41dc0e6611be76776c4a9456d'] = 'Vous devez donner un nom au service'; +$_MODULE['<{tntcarrier}prestashop>tntcarrier_e71361626c48f42620b92cc81fd41ba2'] = 'Vous devez donner un code au service'; +$_MODULE['<{tntcarrier}prestashop>tntcarrier_d2f2575c30fa33e53905ae05bc02f281'] = 'Vous devez donner une description au service'; +$_MODULE['<{tntcarrier}prestashop>tntcarrier_4a015051e9e879952cf4215d344ec101'] = 'Service enregistré'; +$_MODULE['<{tntcarrier}prestashop>tntcarrier_74d87a5cbf64f95c490b2cf85710a4eb'] = 'Le(s) numéro(s) d\'expédition(s)'; +$_MODULE['<{tntcarrier}prestashop>tntcarrier_2fd7870126dd86cedc2be112e7e59ebc'] = 'L\'étiquette'; +$_MODULE['<{tntcarrier}prestashop>tntcarrier_d5aad80114d8aa47f31a6f5050ef6835'] = 'Expédition'; +$_MODULE['<{tntcarrier}prestashop>formerror_c3f15ecc6da0827a8da712cb43a0b596'] = 'information d\'expédition'; +$_MODULE['<{tntcarrier}prestashop>formerror_7f090bbab1cc7f9c08bf4e54d932d3c0'] = 'Modifier'; +$_MODULE['<{tntcarrier}prestashop>service_ca0dbad92a874b2f69b549293387925e'] = 'Code'; +$_MODULE['<{tntcarrier}prestashop>service_41350c4c9683f48b15d04adc3f76925b'] = '08h00 express'; +$_MODULE['<{tntcarrier}prestashop>service_4b0977efd9aa11417b7139f35ed777a0'] = '09h00 express'; +$_MODULE['<{tntcarrier}prestashop>service_9b75b9fc3e87626793da04f05b8388ac'] = '10:00 express'; +$_MODULE['<{tntcarrier}prestashop>service_5a3019af5fd97f13e43cb4d946b7c112'] = '12:00 express'; +$_MODULE['<{tntcarrier}prestashop>service_b144fa061545497bebee8c414efc99a9'] = 'Express'; +$_MODULE['<{tntcarrier}prestashop>service_7a93a32c1929f10098c9bc055dbe5555'] = 'Express (P)'; +$_MODULE['<{tntcarrier}prestashop>service_c24eb7cd3484f223c03e64f2728a61ae'] = 'Option code (facultatif)'; +$_MODULE['<{tntcarrier}prestashop>service_b5410e878f792a03b81e7803a626caaa'] = 'Colis relais'; +$_MODULE['<{tntcarrier}prestashop>service_6cefaa978ccec960693d10cefeb2c2bf'] = 'Livraison à domicile'; +$_MODULE['<{tntcarrier}prestashop>service_9582039a366d19cb0b957bd4220dd6f7'] = 'Service entreprise '; +$_MODULE['<{tntcarrier}prestashop>shippingnumber_c3f15ecc6da0827a8da712cb43a0b596'] = 'L\'information d\'expédition'; diff --git a/modules/tntcarrier/img/5-puce-choix-gris2.gif b/modules/tntcarrier/img/5-puce-choix-gris2.gif new file mode 100644 index 000000000..609487a29 Binary files /dev/null and b/modules/tntcarrier/img/5-puce-choix-gris2.gif differ diff --git a/modules/tntcarrier/img/Thumbs.db b/modules/tntcarrier/img/Thumbs.db new file mode 100644 index 000000000..0698e65d0 Binary files /dev/null and b/modules/tntcarrier/img/Thumbs.db differ diff --git a/modules/tntcarrier/img/bt-CodePostal-1.jpg b/modules/tntcarrier/img/bt-CodePostal-1.jpg new file mode 100644 index 000000000..3f3b462d4 Binary files /dev/null and b/modules/tntcarrier/img/bt-CodePostal-1.jpg differ diff --git a/modules/tntcarrier/img/bt-CodePostal-2.jpg b/modules/tntcarrier/img/bt-CodePostal-2.jpg new file mode 100644 index 000000000..395a31b95 Binary files /dev/null and b/modules/tntcarrier/img/bt-CodePostal-2.jpg differ diff --git a/modules/tntcarrier/img/bt-Continuer-1.jpg b/modules/tntcarrier/img/bt-Continuer-1.jpg new file mode 100644 index 000000000..573666983 Binary files /dev/null and b/modules/tntcarrier/img/bt-Continuer-1.jpg differ diff --git a/modules/tntcarrier/img/bt-Continuer-2.jpg b/modules/tntcarrier/img/bt-Continuer-2.jpg new file mode 100644 index 000000000..04a1f19ac Binary files /dev/null and b/modules/tntcarrier/img/bt-Continuer-2.jpg differ diff --git a/modules/tntcarrier/img/bt-OK-1.jpg b/modules/tntcarrier/img/bt-OK-1.jpg new file mode 100644 index 000000000..8a49e76b6 Binary files /dev/null and b/modules/tntcarrier/img/bt-OK-1.jpg differ diff --git a/modules/tntcarrier/img/bt-OK-2.jpg b/modules/tntcarrier/img/bt-OK-2.jpg new file mode 100644 index 000000000..7974b961b Binary files /dev/null and b/modules/tntcarrier/img/bt-OK-2.jpg differ diff --git a/modules/tntcarrier/img/bt-Retour.gif b/modules/tntcarrier/img/bt-Retour.gif new file mode 100644 index 000000000..4d8de068b Binary files /dev/null and b/modules/tntcarrier/img/bt-Retour.gif differ diff --git a/modules/tntcarrier/img/close_icon_double.png b/modules/tntcarrier/img/close_icon_double.png new file mode 100644 index 000000000..2e58b6b66 Binary files /dev/null and b/modules/tntcarrier/img/close_icon_double.png differ diff --git a/modules/tntcarrier/img/exception.gif b/modules/tntcarrier/img/exception.gif new file mode 100644 index 000000000..2938eac5b Binary files /dev/null and b/modules/tntcarrier/img/exception.gif differ diff --git a/modules/tntcarrier/img/exception2.gif b/modules/tntcarrier/img/exception2.gif new file mode 100644 index 000000000..7fa3778bf Binary files /dev/null and b/modules/tntcarrier/img/exception2.gif differ diff --git a/modules/tntcarrier/img/google/Thumbs.db b/modules/tntcarrier/img/google/Thumbs.db new file mode 100644 index 000000000..502aaa322 Binary files /dev/null and b/modules/tntcarrier/img/google/Thumbs.db differ diff --git a/modules/tntcarrier/img/google/agenceTnt.png b/modules/tntcarrier/img/google/agenceTnt.png new file mode 100644 index 000000000..05b3570a7 Binary files /dev/null and b/modules/tntcarrier/img/google/agenceTnt.png differ diff --git a/modules/tntcarrier/img/google/red-pushpin-s.png b/modules/tntcarrier/img/google/red-pushpin-s.png new file mode 100644 index 000000000..162aa0fa7 Binary files /dev/null and b/modules/tntcarrier/img/google/red-pushpin-s.png differ diff --git a/modules/tntcarrier/img/google/red-pushpin.png b/modules/tntcarrier/img/google/red-pushpin.png new file mode 100644 index 000000000..203512d5c Binary files /dev/null and b/modules/tntcarrier/img/google/red-pushpin.png differ diff --git a/modules/tntcarrier/img/google/relaisColis.png b/modules/tntcarrier/img/google/relaisColis.png new file mode 100644 index 000000000..eb52b7d62 Binary files /dev/null and b/modules/tntcarrier/img/google/relaisColis.png differ diff --git a/modules/tntcarrier/img/index.php b/modules/tntcarrier/img/index.php new file mode 100644 index 000000000..477abec6f --- /dev/null +++ b/modules/tntcarrier/img/index.php @@ -0,0 +1,36 @@ +<?php +/* +* 2007-2011 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA <contact@prestashop.com> +* @copyright 2007-2011 PrestaShop SA +* @version Release: $Revision: 6594 $ +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../../../"); +exit; diff --git a/modules/tntcarrier/img/lg_tnt.gif b/modules/tntcarrier/img/lg_tnt.gif new file mode 100644 index 000000000..c33e6e844 Binary files /dev/null and b/modules/tntcarrier/img/lg_tnt.gif differ diff --git a/modules/tntcarrier/img/livreur.gif b/modules/tntcarrier/img/livreur.gif new file mode 100644 index 000000000..2d45a42a1 Binary files /dev/null and b/modules/tntcarrier/img/livreur.gif differ diff --git a/modules/tntcarrier/img/logo-tnt-petit.jpg b/modules/tntcarrier/img/logo-tnt-petit.jpg new file mode 100644 index 000000000..b90c6dc4f Binary files /dev/null and b/modules/tntcarrier/img/logo-tnt-petit.jpg differ diff --git a/modules/tntcarrier/img/logo_24_chezmoi.jpg b/modules/tntcarrier/img/logo_24_chezmoi.jpg new file mode 100644 index 000000000..de9ec6a32 Binary files /dev/null and b/modules/tntcarrier/img/logo_24_chezmoi.jpg differ diff --git a/modules/tntcarrier/img/logo_24_relaiscolis.jpg b/modules/tntcarrier/img/logo_24_relaiscolis.jpg new file mode 100644 index 000000000..f32ea64c5 Binary files /dev/null and b/modules/tntcarrier/img/logo_24_relaiscolis.jpg differ diff --git a/modules/tntcarrier/img/logo_24h_chezmoi_RVB.gif b/modules/tntcarrier/img/logo_24h_chezmoi_RVB.gif new file mode 100644 index 000000000..aef322ce9 Binary files /dev/null and b/modules/tntcarrier/img/logo_24h_chezmoi_RVB.gif differ diff --git a/modules/tntcarrier/img/logo_24h_relaiscolis_RVB.gif b/modules/tntcarrier/img/logo_24h_relaiscolis_RVB.gif new file mode 100644 index 000000000..b50b0cf56 Binary files /dev/null and b/modules/tntcarrier/img/logo_24h_relaiscolis_RVB.gif differ diff --git a/modules/tntcarrier/img/logos_24.jpg b/modules/tntcarrier/img/logos_24.jpg new file mode 100644 index 000000000..5da054fee Binary files /dev/null and b/modules/tntcarrier/img/logos_24.jpg differ diff --git a/modules/tntcarrier/img/loupe.gif b/modules/tntcarrier/img/loupe.gif new file mode 100644 index 000000000..317184d42 Binary files /dev/null and b/modules/tntcarrier/img/loupe.gif differ diff --git a/modules/tntcarrier/img/notes.gif b/modules/tntcarrier/img/notes.gif new file mode 100644 index 000000000..3375cbf94 Binary files /dev/null and b/modules/tntcarrier/img/notes.gif differ diff --git a/modules/tntcarrier/img/picto-delai.gif b/modules/tntcarrier/img/picto-delai.gif new file mode 100644 index 000000000..3364dedcd Binary files /dev/null and b/modules/tntcarrier/img/picto-delai.gif differ diff --git a/modules/tntcarrier/img/picto_localiser.png b/modules/tntcarrier/img/picto_localiser.png new file mode 100644 index 000000000..0631c121a Binary files /dev/null and b/modules/tntcarrier/img/picto_localiser.png differ diff --git a/modules/tntcarrier/img/tnt_logo.gif b/modules/tntcarrier/img/tnt_logo.gif new file mode 100644 index 000000000..a170e265d Binary files /dev/null and b/modules/tntcarrier/img/tnt_logo.gif differ diff --git a/modules/tntcarrier/img/ui-dialog/217bc0_11x11_icon_arrows_leftright.gif b/modules/tntcarrier/img/ui-dialog/217bc0_11x11_icon_arrows_leftright.gif new file mode 100644 index 000000000..1d52948d9 Binary files /dev/null and b/modules/tntcarrier/img/ui-dialog/217bc0_11x11_icon_arrows_leftright.gif differ diff --git a/modules/tntcarrier/img/ui-dialog/217bc0_11x11_icon_arrows_updown.gif b/modules/tntcarrier/img/ui-dialog/217bc0_11x11_icon_arrows_updown.gif new file mode 100644 index 000000000..7f4437d37 Binary files /dev/null and b/modules/tntcarrier/img/ui-dialog/217bc0_11x11_icon_arrows_updown.gif differ diff --git a/modules/tntcarrier/img/ui-dialog/217bc0_11x11_icon_close.gif b/modules/tntcarrier/img/ui-dialog/217bc0_11x11_icon_close.gif new file mode 100644 index 000000000..9e4ad7d09 Binary files /dev/null and b/modules/tntcarrier/img/ui-dialog/217bc0_11x11_icon_close.gif differ diff --git a/modules/tntcarrier/img/ui-dialog/217bc0_11x11_icon_doc.gif b/modules/tntcarrier/img/ui-dialog/217bc0_11x11_icon_doc.gif new file mode 100644 index 000000000..5609c8b65 Binary files /dev/null and b/modules/tntcarrier/img/ui-dialog/217bc0_11x11_icon_doc.gif differ diff --git a/modules/tntcarrier/img/ui-dialog/217bc0_11x11_icon_folder_closed.gif b/modules/tntcarrier/img/ui-dialog/217bc0_11x11_icon_folder_closed.gif new file mode 100644 index 000000000..ff367cf4d Binary files /dev/null and b/modules/tntcarrier/img/ui-dialog/217bc0_11x11_icon_folder_closed.gif differ diff --git a/modules/tntcarrier/img/ui-dialog/217bc0_11x11_icon_folder_open.gif b/modules/tntcarrier/img/ui-dialog/217bc0_11x11_icon_folder_open.gif new file mode 100644 index 000000000..7a93891b0 Binary files /dev/null and b/modules/tntcarrier/img/ui-dialog/217bc0_11x11_icon_folder_open.gif differ diff --git a/modules/tntcarrier/img/ui-dialog/217bc0_11x11_icon_minus.gif b/modules/tntcarrier/img/ui-dialog/217bc0_11x11_icon_minus.gif new file mode 100644 index 000000000..0f1df159f Binary files /dev/null and b/modules/tntcarrier/img/ui-dialog/217bc0_11x11_icon_minus.gif differ diff --git a/modules/tntcarrier/img/ui-dialog/217bc0_11x11_icon_plus.gif b/modules/tntcarrier/img/ui-dialog/217bc0_11x11_icon_plus.gif new file mode 100644 index 000000000..6875dfb81 Binary files /dev/null and b/modules/tntcarrier/img/ui-dialog/217bc0_11x11_icon_plus.gif differ diff --git a/modules/tntcarrier/img/ui-dialog/217bc0_7x7_arrow_down.gif b/modules/tntcarrier/img/ui-dialog/217bc0_7x7_arrow_down.gif new file mode 100644 index 000000000..f3d9ef702 Binary files /dev/null and b/modules/tntcarrier/img/ui-dialog/217bc0_7x7_arrow_down.gif differ diff --git a/modules/tntcarrier/img/ui-dialog/217bc0_7x7_arrow_left.gif b/modules/tntcarrier/img/ui-dialog/217bc0_7x7_arrow_left.gif new file mode 100644 index 000000000..0d1c30b07 Binary files /dev/null and b/modules/tntcarrier/img/ui-dialog/217bc0_7x7_arrow_left.gif differ diff --git a/modules/tntcarrier/img/ui-dialog/217bc0_7x7_arrow_right.gif b/modules/tntcarrier/img/ui-dialog/217bc0_7x7_arrow_right.gif new file mode 100644 index 000000000..5f25ff41c Binary files /dev/null and b/modules/tntcarrier/img/ui-dialog/217bc0_7x7_arrow_right.gif differ diff --git a/modules/tntcarrier/img/ui-dialog/217bc0_7x7_arrow_up.gif b/modules/tntcarrier/img/ui-dialog/217bc0_7x7_arrow_up.gif new file mode 100644 index 000000000..aabad1ea4 Binary files /dev/null and b/modules/tntcarrier/img/ui-dialog/217bc0_7x7_arrow_up.gif differ diff --git a/modules/tntcarrier/img/ui-dialog/469bdd_11x11_icon_arrows_leftright.gif b/modules/tntcarrier/img/ui-dialog/469bdd_11x11_icon_arrows_leftright.gif new file mode 100644 index 000000000..8eb1a4f58 Binary files /dev/null and b/modules/tntcarrier/img/ui-dialog/469bdd_11x11_icon_arrows_leftright.gif differ diff --git a/modules/tntcarrier/img/ui-dialog/469bdd_11x11_icon_arrows_updown.gif b/modules/tntcarrier/img/ui-dialog/469bdd_11x11_icon_arrows_updown.gif new file mode 100644 index 000000000..14997c504 Binary files /dev/null and b/modules/tntcarrier/img/ui-dialog/469bdd_11x11_icon_arrows_updown.gif differ diff --git a/modules/tntcarrier/img/ui-dialog/469bdd_11x11_icon_doc.gif b/modules/tntcarrier/img/ui-dialog/469bdd_11x11_icon_doc.gif new file mode 100644 index 000000000..26a26f631 Binary files /dev/null and b/modules/tntcarrier/img/ui-dialog/469bdd_11x11_icon_doc.gif differ diff --git a/modules/tntcarrier/img/ui-dialog/469bdd_11x11_icon_minus.gif b/modules/tntcarrier/img/ui-dialog/469bdd_11x11_icon_minus.gif new file mode 100644 index 000000000..cc89f2189 Binary files /dev/null and b/modules/tntcarrier/img/ui-dialog/469bdd_11x11_icon_minus.gif differ diff --git a/modules/tntcarrier/img/ui-dialog/469bdd_11x11_icon_plus.gif b/modules/tntcarrier/img/ui-dialog/469bdd_11x11_icon_plus.gif new file mode 100644 index 000000000..b92ab3a58 Binary files /dev/null and b/modules/tntcarrier/img/ui-dialog/469bdd_11x11_icon_plus.gif differ diff --git a/modules/tntcarrier/img/ui-dialog/469bdd_11x11_icon_resize_se.gif b/modules/tntcarrier/img/ui-dialog/469bdd_11x11_icon_resize_se.gif new file mode 100644 index 000000000..240a3dd06 Binary files /dev/null and b/modules/tntcarrier/img/ui-dialog/469bdd_11x11_icon_resize_se.gif differ diff --git a/modules/tntcarrier/img/ui-dialog/469bdd_7x7_arrow_down.gif b/modules/tntcarrier/img/ui-dialog/469bdd_7x7_arrow_down.gif new file mode 100644 index 000000000..3019c30e7 Binary files /dev/null and b/modules/tntcarrier/img/ui-dialog/469bdd_7x7_arrow_down.gif differ diff --git a/modules/tntcarrier/img/ui-dialog/469bdd_7x7_arrow_left.gif b/modules/tntcarrier/img/ui-dialog/469bdd_7x7_arrow_left.gif new file mode 100644 index 000000000..363f1c676 Binary files /dev/null and b/modules/tntcarrier/img/ui-dialog/469bdd_7x7_arrow_left.gif differ diff --git a/modules/tntcarrier/img/ui-dialog/469bdd_7x7_arrow_right.gif b/modules/tntcarrier/img/ui-dialog/469bdd_7x7_arrow_right.gif new file mode 100644 index 000000000..8fcedce30 Binary files /dev/null and b/modules/tntcarrier/img/ui-dialog/469bdd_7x7_arrow_right.gif differ diff --git a/modules/tntcarrier/img/ui-dialog/469bdd_7x7_arrow_up.gif b/modules/tntcarrier/img/ui-dialog/469bdd_7x7_arrow_up.gif new file mode 100644 index 000000000..83ba7aff1 Binary files /dev/null and b/modules/tntcarrier/img/ui-dialog/469bdd_7x7_arrow_up.gif differ diff --git a/modules/tntcarrier/img/ui-dialog/6da8d5_11x11_icon_arrows_leftright.gif b/modules/tntcarrier/img/ui-dialog/6da8d5_11x11_icon_arrows_leftright.gif new file mode 100644 index 000000000..51eb183ea Binary files /dev/null and b/modules/tntcarrier/img/ui-dialog/6da8d5_11x11_icon_arrows_leftright.gif differ diff --git a/modules/tntcarrier/img/ui-dialog/6da8d5_11x11_icon_arrows_updown.gif b/modules/tntcarrier/img/ui-dialog/6da8d5_11x11_icon_arrows_updown.gif new file mode 100644 index 000000000..adc7dcfc9 Binary files /dev/null and b/modules/tntcarrier/img/ui-dialog/6da8d5_11x11_icon_arrows_updown.gif differ diff --git a/modules/tntcarrier/img/ui-dialog/6da8d5_11x11_icon_close.gif b/modules/tntcarrier/img/ui-dialog/6da8d5_11x11_icon_close.gif new file mode 100644 index 000000000..73c1d7201 Binary files /dev/null and b/modules/tntcarrier/img/ui-dialog/6da8d5_11x11_icon_close.gif differ diff --git a/modules/tntcarrier/img/ui-dialog/6da8d5_11x11_icon_doc.gif b/modules/tntcarrier/img/ui-dialog/6da8d5_11x11_icon_doc.gif new file mode 100644 index 000000000..42dc16c76 Binary files /dev/null and b/modules/tntcarrier/img/ui-dialog/6da8d5_11x11_icon_doc.gif differ diff --git a/modules/tntcarrier/img/ui-dialog/6da8d5_11x11_icon_folder_closed.gif b/modules/tntcarrier/img/ui-dialog/6da8d5_11x11_icon_folder_closed.gif new file mode 100644 index 000000000..a57741271 Binary files /dev/null and b/modules/tntcarrier/img/ui-dialog/6da8d5_11x11_icon_folder_closed.gif differ diff --git a/modules/tntcarrier/img/ui-dialog/6da8d5_11x11_icon_folder_open.gif b/modules/tntcarrier/img/ui-dialog/6da8d5_11x11_icon_folder_open.gif new file mode 100644 index 000000000..74afe4be1 Binary files /dev/null and b/modules/tntcarrier/img/ui-dialog/6da8d5_11x11_icon_folder_open.gif differ diff --git a/modules/tntcarrier/img/ui-dialog/6da8d5_11x11_icon_minus.gif b/modules/tntcarrier/img/ui-dialog/6da8d5_11x11_icon_minus.gif new file mode 100644 index 000000000..69fcad2ee Binary files /dev/null and b/modules/tntcarrier/img/ui-dialog/6da8d5_11x11_icon_minus.gif differ diff --git a/modules/tntcarrier/img/ui-dialog/6da8d5_11x11_icon_plus.gif b/modules/tntcarrier/img/ui-dialog/6da8d5_11x11_icon_plus.gif new file mode 100644 index 000000000..7193add21 Binary files /dev/null and b/modules/tntcarrier/img/ui-dialog/6da8d5_11x11_icon_plus.gif differ diff --git a/modules/tntcarrier/img/ui-dialog/6da8d5_7x7_arrow_down.gif b/modules/tntcarrier/img/ui-dialog/6da8d5_7x7_arrow_down.gif new file mode 100644 index 000000000..8bf915ebf Binary files /dev/null and b/modules/tntcarrier/img/ui-dialog/6da8d5_7x7_arrow_down.gif differ diff --git a/modules/tntcarrier/img/ui-dialog/6da8d5_7x7_arrow_left.gif b/modules/tntcarrier/img/ui-dialog/6da8d5_7x7_arrow_left.gif new file mode 100644 index 000000000..9cb0eee53 Binary files /dev/null and b/modules/tntcarrier/img/ui-dialog/6da8d5_7x7_arrow_left.gif differ diff --git a/modules/tntcarrier/img/ui-dialog/6da8d5_7x7_arrow_right.gif b/modules/tntcarrier/img/ui-dialog/6da8d5_7x7_arrow_right.gif new file mode 100644 index 000000000..5fdf8e9b9 Binary files /dev/null and b/modules/tntcarrier/img/ui-dialog/6da8d5_7x7_arrow_right.gif differ diff --git a/modules/tntcarrier/img/ui-dialog/6da8d5_7x7_arrow_up.gif b/modules/tntcarrier/img/ui-dialog/6da8d5_7x7_arrow_up.gif new file mode 100644 index 000000000..284bc54b0 Binary files /dev/null and b/modules/tntcarrier/img/ui-dialog/6da8d5_7x7_arrow_up.gif differ diff --git a/modules/tntcarrier/img/ui-dialog/Thumbs.db b/modules/tntcarrier/img/ui-dialog/Thumbs.db new file mode 100644 index 000000000..f95870bdd Binary files /dev/null and b/modules/tntcarrier/img/ui-dialog/Thumbs.db differ diff --git a/modules/tntcarrier/img/ui-dialog/d0e5f5_40x100_textures_02_glass_75.png b/modules/tntcarrier/img/ui-dialog/d0e5f5_40x100_textures_02_glass_75.png new file mode 100644 index 000000000..d4eaa1d6e Binary files /dev/null and b/modules/tntcarrier/img/ui-dialog/d0e5f5_40x100_textures_02_glass_75.png differ diff --git a/modules/tntcarrier/img/ui-dialog/dfeffc_40x100_textures_02_glass_85.png b/modules/tntcarrier/img/ui-dialog/dfeffc_40x100_textures_02_glass_85.png new file mode 100644 index 000000000..17d6b368b Binary files /dev/null and b/modules/tntcarrier/img/ui-dialog/dfeffc_40x100_textures_02_glass_85.png differ diff --git a/modules/tntcarrier/img/ui-dialog/f5f8f9_40x100_textures_06_inset_hard_100.png b/modules/tntcarrier/img/ui-dialog/f5f8f9_40x100_textures_06_inset_hard_100.png new file mode 100644 index 000000000..9b24a0a5f Binary files /dev/null and b/modules/tntcarrier/img/ui-dialog/f5f8f9_40x100_textures_06_inset_hard_100.png differ diff --git a/modules/tntcarrier/img/ui-dialog/f9bd01_11x11_icon_arrows_leftright.gif b/modules/tntcarrier/img/ui-dialog/f9bd01_11x11_icon_arrows_leftright.gif new file mode 100644 index 000000000..06da38391 Binary files /dev/null and b/modules/tntcarrier/img/ui-dialog/f9bd01_11x11_icon_arrows_leftright.gif differ diff --git a/modules/tntcarrier/img/ui-dialog/f9bd01_11x11_icon_arrows_updown.gif b/modules/tntcarrier/img/ui-dialog/f9bd01_11x11_icon_arrows_updown.gif new file mode 100644 index 000000000..457012ffc Binary files /dev/null and b/modules/tntcarrier/img/ui-dialog/f9bd01_11x11_icon_arrows_updown.gif differ diff --git a/modules/tntcarrier/img/ui-dialog/f9bd01_11x11_icon_close.gif b/modules/tntcarrier/img/ui-dialog/f9bd01_11x11_icon_close.gif new file mode 100644 index 000000000..eda2b06e2 Binary files /dev/null and b/modules/tntcarrier/img/ui-dialog/f9bd01_11x11_icon_close.gif differ diff --git a/modules/tntcarrier/img/ui-dialog/f9bd01_11x11_icon_doc.gif b/modules/tntcarrier/img/ui-dialog/f9bd01_11x11_icon_doc.gif new file mode 100644 index 000000000..5b182927c Binary files /dev/null and b/modules/tntcarrier/img/ui-dialog/f9bd01_11x11_icon_doc.gif differ diff --git a/modules/tntcarrier/img/ui-dialog/f9bd01_11x11_icon_folder_closed.gif b/modules/tntcarrier/img/ui-dialog/f9bd01_11x11_icon_folder_closed.gif new file mode 100644 index 000000000..e5228409a Binary files /dev/null and b/modules/tntcarrier/img/ui-dialog/f9bd01_11x11_icon_folder_closed.gif differ diff --git a/modules/tntcarrier/img/ui-dialog/f9bd01_11x11_icon_folder_open.gif b/modules/tntcarrier/img/ui-dialog/f9bd01_11x11_icon_folder_open.gif new file mode 100644 index 000000000..802424348 Binary files /dev/null and b/modules/tntcarrier/img/ui-dialog/f9bd01_11x11_icon_folder_open.gif differ diff --git a/modules/tntcarrier/img/ui-dialog/f9bd01_11x11_icon_minus.gif b/modules/tntcarrier/img/ui-dialog/f9bd01_11x11_icon_minus.gif new file mode 100644 index 000000000..08cbbbb02 Binary files /dev/null and b/modules/tntcarrier/img/ui-dialog/f9bd01_11x11_icon_minus.gif differ diff --git a/modules/tntcarrier/img/ui-dialog/f9bd01_11x11_icon_plus.gif b/modules/tntcarrier/img/ui-dialog/f9bd01_11x11_icon_plus.gif new file mode 100644 index 000000000..95ed13c5b Binary files /dev/null and b/modules/tntcarrier/img/ui-dialog/f9bd01_11x11_icon_plus.gif differ diff --git a/modules/tntcarrier/img/ui-dialog/f9bd01_7x7_arrow_down.gif b/modules/tntcarrier/img/ui-dialog/f9bd01_7x7_arrow_down.gif new file mode 100644 index 000000000..77146b690 Binary files /dev/null and b/modules/tntcarrier/img/ui-dialog/f9bd01_7x7_arrow_down.gif differ diff --git a/modules/tntcarrier/img/ui-dialog/f9bd01_7x7_arrow_left.gif b/modules/tntcarrier/img/ui-dialog/f9bd01_7x7_arrow_left.gif new file mode 100644 index 000000000..6e44126ea Binary files /dev/null and b/modules/tntcarrier/img/ui-dialog/f9bd01_7x7_arrow_left.gif differ diff --git a/modules/tntcarrier/img/ui-dialog/f9bd01_7x7_arrow_right.gif b/modules/tntcarrier/img/ui-dialog/f9bd01_7x7_arrow_right.gif new file mode 100644 index 000000000..8b9bfe44e Binary files /dev/null and b/modules/tntcarrier/img/ui-dialog/f9bd01_7x7_arrow_right.gif differ diff --git a/modules/tntcarrier/img/ui-dialog/f9bd01_7x7_arrow_up.gif b/modules/tntcarrier/img/ui-dialog/f9bd01_7x7_arrow_up.gif new file mode 100644 index 000000000..988dad9bb Binary files /dev/null and b/modules/tntcarrier/img/ui-dialog/f9bd01_7x7_arrow_up.gif differ diff --git a/modules/tntcarrier/img/ui-dialog/fcfdfd_40x100_textures_06_inset_hard_100.png b/modules/tntcarrier/img/ui-dialog/fcfdfd_40x100_textures_06_inset_hard_100.png new file mode 100644 index 000000000..305c0bc49 Binary files /dev/null and b/modules/tntcarrier/img/ui-dialog/fcfdfd_40x100_textures_06_inset_hard_100.png differ diff --git a/modules/tntcarrier/index.php b/modules/tntcarrier/index.php new file mode 100644 index 000000000..b559f9855 --- /dev/null +++ b/modules/tntcarrier/index.php @@ -0,0 +1,36 @@ +<?php +/* +* 2007-2011 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Open Software License (OSL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/osl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA <contact@prestashop.com> +* @copyright 2007-2011 PrestaShop SA +* @version Release: $Revision: 7233 $ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; \ No newline at end of file diff --git a/modules/tntcarrier/js/index.php b/modules/tntcarrier/js/index.php new file mode 100644 index 000000000..477abec6f --- /dev/null +++ b/modules/tntcarrier/js/index.php @@ -0,0 +1,36 @@ +<?php +/* +* 2007-2011 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA <contact@prestashop.com> +* @copyright 2007-2011 PrestaShop SA +* @version Release: $Revision: 6594 $ +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../../../"); +exit; diff --git a/modules/tntcarrier/js/jquery-ui.js b/modules/tntcarrier/js/jquery-ui.js new file mode 100644 index 000000000..08b44d366 --- /dev/null +++ b/modules/tntcarrier/js/jquery-ui.js @@ -0,0 +1,286 @@ +/* + * jQuery UI 1.6 + * + * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI + */ +(function(C){var I=C.fn.remove,D=C.browser.mozilla&&(parseFloat(C.browser.version)<1.9);C.ui={version:"1.6",plugin:{add:function(K,L,N){var M=C.ui[K].prototype;for(var J in N){M.plugins[J]=M.plugins[J]||[];M.plugins[J].push([L,N[J]])}},call:function(J,L,K){var N=J.plugins[L];if(!N){return }for(var M=0;M<N.length;M++){if(J.options[N[M][0]]){N[M][1].apply(J.element,K)}}}},contains:function(L,K){var J=C.browser.safari&&C.browser.version<522;if(L.contains&&!J){return L.contains(K)}if(L.compareDocumentPosition){return !!(L.compareDocumentPosition(K)&16)}while(K=K.parentNode){if(K==L){return true}}return false},cssCache:{},css:function(J){if(C.ui.cssCache[J]){return C.ui.cssCache[J]}var K=C('<div class="ui-gen">').addClass(J).css({position:"absolute",top:"-5000px",left:"-5000px",display:"block"}).appendTo("body");C.ui.cssCache[J]=!!((!(/auto|default/).test(K.css("cursor"))||(/^[1-9]/).test(K.css("height"))||(/^[1-9]/).test(K.css("width"))||!(/none/).test(K.css("backgroundImage"))||!(/transparent|rgba\(0, 0, 0, 0\)/).test(K.css("backgroundColor"))));try{C("body").get(0).removeChild(K.get(0))}catch(L){}return C.ui.cssCache[J]},hasScroll:function(M,K){if(C(M).css("overflow")=="hidden"){return false}var J=(K&&K=="left")?"scrollLeft":"scrollTop",L=false;if(M[J]>0){return true}M[J]=1;L=(M[J]>0);M[J]=0;return L},isOverAxis:function(K,J,L){return(K>J)&&(K<(J+L))},isOver:function(O,K,N,M,J,L){return C.ui.isOverAxis(O,N,J)&&C.ui.isOverAxis(K,M,L)},keyCode:{BACKSPACE:8,CAPS_LOCK:20,COMMA:188,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38}};if(D){var F=C.attr,E=C.fn.removeAttr,H="http://www.w3.org/2005/07/aaa",A=/^aria-/,B=/^wairole:/;C.attr=function(K,J,L){var M=L!==undefined;return(J=="role"?(M?F.call(this,K,J,"wairole:"+L):(F.apply(this,arguments)||"").replace(B,"")):(A.test(J)?(M?K.setAttributeNS(H,J.replace(A,"aaa:"),L):F.call(this,K,J.replace(A,"aaa:"))):F.apply(this,arguments)))};C.fn.removeAttr=function(J){return(A.test(J)?this.each(function(){this.removeAttributeNS(H,J.replace(A,""))}):E.call(this,J))}}C.fn.extend({remove:function(){C("*",this).add(this).each(function(){C(this).triggerHandler("remove")});return I.apply(this,arguments)},enableSelection:function(){return this.attr("unselectable","off").css("MozUserSelect","").unbind("selectstart.ui")},disableSelection:function(){return this.attr("unselectable","on").css("MozUserSelect","none").bind("selectstart.ui",function(){return false})},scrollParent:function(){var J;if((C.browser.msie&&(/(static|relative)/).test(this.css("position")))||(/absolute/).test(this.css("position"))){J=this.parents().filter(function(){return(/(relative|absolute|fixed)/).test(C.curCSS(this,"position",1))&&(/(auto|scroll)/).test(C.curCSS(this,"overflow",1)+C.curCSS(this,"overflow-y",1)+C.curCSS(this,"overflow-x",1))}).eq(0)}else{J=this.parents().filter(function(){return(/(auto|scroll)/).test(C.curCSS(this,"overflow",1)+C.curCSS(this,"overflow-y",1)+C.curCSS(this,"overflow-x",1))}).eq(0)}return(/fixed/).test(this.css("position"))||!J.length?C(document):J}});C.extend(C.expr[":"],{data:function(K,L,J){return C.data(K,J[3])},tabbable:function(L,M,K){var N=L.nodeName.toLowerCase();function J(O){return !(C(O).is(":hidden")||C(O).parents(":hidden").length)}return(L.tabIndex>=0&&(("a"==N&&L.href)||(/input|select|textarea|button/.test(N)&&"hidden"!=L.type&&!L.disabled))&&J(L))}});function G(M,N,O,L){function K(Q){var P=C[M][N][Q]||[];return(typeof P=="string"?P.split(/,?\s+/):P)}var J=K("getter");if(L.length==1&&typeof L[0]=="string"){J=J.concat(K("getterSetter"))}return(C.inArray(O,J)!=-1)}C.widget=function(K,J){var L=K.split(".")[0];K=K.split(".")[1];C.fn[K]=function(P){var N=(typeof P=="string"),O=Array.prototype.slice.call(arguments,1);if(N&&P.substring(0,1)=="_"){return this}if(N&&G(L,K,P,O)){var M=C.data(this[0],K);return(M?M[P].apply(M,O):undefined)}return this.each(function(){var Q=C.data(this,K);(!Q&&!N&&C.data(this,K,new C[L][K](this,P)));(Q&&N&&C.isFunction(Q[P])&&Q[P].apply(Q,O))})};C[L]=C[L]||{};C[L][K]=function(O,N){var M=this;this.widgetName=K;this.widgetEventPrefix=C[L][K].eventPrefix||K;this.widgetBaseClass=L+"-"+K;this.options=C.extend({},C.widget.defaults,C[L][K].defaults,C.metadata&&C.metadata.get(O)[K],N);this.element=C(O).bind("setData."+K,function(Q,P,R){return M._setData(P,R)}).bind("getData."+K,function(Q,P){return M._getData(P)}).bind("remove",function(){return M.destroy()});this._init()};C[L][K].prototype=C.extend({},C.widget.prototype,J);C[L][K].getterSetter="option"};C.widget.prototype={_init:function(){},destroy:function(){this.element.removeData(this.widgetName)},option:function(L,M){var K=L,J=this;if(typeof L=="string"){if(M===undefined){return this._getData(L)}K={};K[L]=M}C.each(K,function(N,O){J._setData(N,O)})},_getData:function(J){return this.options[J]},_setData:function(J,K){this.options[J]=K;if(J=="disabled"){this.element[K?"addClass":"removeClass"](this.widgetBaseClass+"-disabled")}},enable:function(){this._setData("disabled",false)},disable:function(){this._setData("disabled",true)},_trigger:function(K,L,M){var J=(K==this.widgetEventPrefix?K:this.widgetEventPrefix+K);L=L||C.event.fix({type:J,target:this.element[0]});return this.element.triggerHandler(J,[L,M],this.options[K])}};C.widget.defaults={disabled:false};C.ui.mouse={_mouseInit:function(){var J=this;this.element.bind("mousedown."+this.widgetName,function(K){return J._mouseDown(K)}).bind("click."+this.widgetName,function(K){if(J._preventClickEvent){J._preventClickEvent=false;return false}});if(C.browser.msie){this._mouseUnselectable=this.element.attr("unselectable");this.element.attr("unselectable","on")}this.started=false},_mouseDestroy:function(){this.element.unbind("."+this.widgetName);(C.browser.msie&&this.element.attr("unselectable",this._mouseUnselectable))},_mouseDown:function(L){(this._mouseStarted&&this._mouseUp(L));this._mouseDownEvent=L;var K=this,M=(L.which==1),J=(typeof this.options.cancel=="string"?C(L.target).parents().add(L.target).filter(this.options.cancel).length:false);if(!M||J||!this._mouseCapture(L)){return true}this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){K.mouseDelayMet=true},this.options.delay)}if(this._mouseDistanceMet(L)&&this._mouseDelayMet(L)){this._mouseStarted=(this._mouseStart(L)!==false);if(!this._mouseStarted){L.preventDefault();return true}}this._mouseMoveDelegate=function(N){return K._mouseMove(N)};this._mouseUpDelegate=function(N){return K._mouseUp(N)};C(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);if(!C.browser.safari){L.preventDefault()}return true},_mouseMove:function(J){if(C.browser.msie&&!J.button){return this._mouseUp(J)}if(this._mouseStarted){this._mouseDrag(J);return J.preventDefault()}if(this._mouseDistanceMet(J)&&this._mouseDelayMet(J)){this._mouseStarted=(this._mouseStart(this._mouseDownEvent,J)!==false);(this._mouseStarted?this._mouseDrag(J):this._mouseUp(J))}return !this._mouseStarted},_mouseUp:function(J){C(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;this._preventClickEvent=true;this._mouseStop(J)}return false},_mouseDistanceMet:function(J){return(Math.max(Math.abs(this._mouseDownEvent.pageX-J.pageX),Math.abs(this._mouseDownEvent.pageY-J.pageY))>=this.options.distance)},_mouseDelayMet:function(J){return this.mouseDelayMet},_mouseStart:function(J){},_mouseDrag:function(J){},_mouseStop:function(J){},_mouseCapture:function(J){return true}};C.ui.mouse.defaults={cancel:null,distance:1,delay:0}})(jQuery);/* + * jQuery UI Draggable 1.6 + * + * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Draggables + * + * Depends: + * ui.core.js + */ +(function(A){A.widget("ui.draggable",A.extend({},A.ui.mouse,{_init:function(){if(this.options.helper=="original"&&!(/^(?:r|a|f)/).test(this.element.css("position"))){this.element[0].style.position="relative"}(this.options.cssNamespace&&this.element.addClass(this.options.cssNamespace+"-draggable"));(this.options.disabled&&this.element.addClass("ui-draggable-disabled"));this._mouseInit()},destroy:function(){if(!this.element.data("draggable")){return }this.element.removeData("draggable").unbind(".draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled");this._mouseDestroy()},_mouseCapture:function(B){var C=this.options;if(this.helper||C.disabled||A(B.target).is(".ui-resizable-handle")){return false}this.handle=this._getHandle(B);if(!this.handle){return false}return true},_mouseStart:function(B){var C=this.options;this.helper=this._createHelper(B);this._cacheHelperProportions();if(A.ui.ddmanager){A.ui.ddmanager.current=this}this._cacheMargins();this.cssPosition=this.helper.css("position");this.scrollParent=this.helper.scrollParent();this.offset=this.element.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};A.extend(this.offset,{click:{left:B.pageX-this.offset.left,top:B.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});if(C.cursorAt){this._adjustOffsetFromHelper(C.cursorAt)}this.originalPosition=this._generatePosition(B);if(C.containment){this._setContainment()}this._propagate("start",B);this._cacheHelperProportions();if(A.ui.ddmanager&&!C.dropBehaviour){A.ui.ddmanager.prepareOffsets(this,B)}this.helper.addClass("ui-draggable-dragging");this._mouseDrag(B,true);return true},_mouseDrag:function(B,C){this.position=this._generatePosition(B);this.positionAbs=this._convertPositionTo("absolute");if(!C){this.position=this._propagate("drag",B)||this.position}if(!this.options.axis||this.options.axis!="y"){this.helper[0].style.left=this.position.left+"px"}if(!this.options.axis||this.options.axis!="x"){this.helper[0].style.top=this.position.top+"px"}if(A.ui.ddmanager){A.ui.ddmanager.drag(this,B)}return false},_mouseStop:function(C){var D=false;if(A.ui.ddmanager&&!this.options.dropBehaviour){var D=A.ui.ddmanager.drop(this,C)}if((this.options.revert=="invalid"&&!D)||(this.options.revert=="valid"&&D)||this.options.revert===true||(A.isFunction(this.options.revert)&&this.options.revert.call(this.element,D))){var B=this;A(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){B._propagate("stop",C);B._clear()})}else{this._propagate("stop",C);this._clear()}return false},_getHandle:function(B){var C=!this.options.handle||!A(this.options.handle,this.element).length?true:false;A(this.options.handle,this.element).find("*").andSelf().each(function(){if(this==B.target){C=true}});return C},_createHelper:function(C){var D=this.options;var B=A.isFunction(D.helper)?A(D.helper.apply(this.element[0],[C])):(D.helper=="clone"?this.element.clone():this.element);if(!B.parents("body").length){B.appendTo((D.appendTo=="parent"?this.element[0].parentNode:D.appendTo))}if(B[0]!=this.element[0]&&!(/(fixed|absolute)/).test(B.css("position"))){B.css("position","absolute")}return B},_adjustOffsetFromHelper:function(B){if(B.left!=undefined){this.offset.click.left=B.left+this.margins.left}if(B.right!=undefined){this.offset.click.left=this.helperProportions.width-B.right+this.margins.left}if(B.top!=undefined){this.offset.click.top=B.top+this.margins.top}if(B.bottom!=undefined){this.offset.click.top=this.helperProportions.height-B.bottom+this.margins.top}},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var B=this.offsetParent.offset();if((this.offsetParent[0]==document.body&&A.browser.mozilla)||(this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&A.browser.msie)){B={top:0,left:0}}return{top:B.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:B.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var B=this.element.position();return{top:B.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:B.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}else{return{top:0,left:0}}},_cacheMargins:function(){this.margins={left:(parseInt(this.element.css("marginLeft"),10)||0),top:(parseInt(this.element.css("marginTop"),10)||0)}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var E=this.options;if(E.containment=="parent"){E.containment=this.helper[0].parentNode}if(E.containment=="document"||E.containment=="window"){this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,A(E.containment=="document"?document:window).width()-this.offset.relative.left-this.offset.parent.left-this.helperProportions.width-this.margins.left-(parseInt(this.element.css("marginRight"),10)||0),(A(E.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.offset.relative.top-this.offset.parent.top-this.helperProportions.height-this.margins.top-(parseInt(this.element.css("marginBottom"),10)||0)]}if(!(/^(document|window|parent)$/).test(E.containment)){var C=A(E.containment)[0];var D=A(E.containment).offset();var B=(A(C).css("overflow")!="hidden");this.containment=[D.left+(parseInt(A(C).css("borderLeftWidth"),10)||0)-this.offset.relative.left-this.offset.parent.left-this.margins.left,D.top+(parseInt(A(C).css("borderTopWidth"),10)||0)-this.offset.relative.top-this.offset.parent.top-this.margins.top,D.left+(B?Math.max(C.scrollWidth,C.offsetWidth):C.offsetWidth)-(parseInt(A(C).css("borderLeftWidth"),10)||0)-this.offset.relative.left-this.offset.parent.left-this.helperProportions.width-this.margins.left,D.top+(B?Math.max(C.scrollHeight,C.offsetHeight):C.offsetHeight)-(parseInt(A(C).css("borderTopWidth"),10)||0)-this.offset.relative.top-this.offset.parent.top-this.helperProportions.height-this.margins.top]}},_convertPositionTo:function(D,F){if(!F){F=this.position}var C=D=="absolute"?1:-1;var B=this[(this.cssPosition=="absolute"?"offset":"scroll")+"Parent"],E=(/(html|body)/i).test(B[0].tagName);return{top:(F.top+this.offset.relative.top*C+this.offset.parent.top*C+(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():(E?0:B.scrollTop()))*C+this.margins.top*C),left:(F.left+this.offset.relative.left*C+this.offset.parent.left*C+(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():(E?0:B.scrollLeft()))*C+this.margins.left*C)}},_generatePosition:function(D){var G=this.options,C=this[(this.cssPosition=="absolute"?"offset":"scroll")+"Parent"],H=(/(html|body)/i).test(C[0].tagName);var B={top:(D.pageY-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():(H?0:C.scrollTop()))),left:(D.pageX-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():H?0:C.scrollLeft()))};if(!this.originalPosition){return B}if(this.containment){if(B.left<this.containment[0]){B.left=this.containment[0]}if(B.top<this.containment[1]){B.top=this.containment[1]}if(B.left>this.containment[2]){B.left=this.containment[2]}if(B.top>this.containment[3]){B.top=this.containment[3]}}if(G.grid){var F=this.originalPosition.top+Math.round((B.top-this.originalPosition.top)/G.grid[1])*G.grid[1];B.top=this.containment?(!(F<this.containment[1]||F>this.containment[3])?F:(!(F<this.containment[1])?F-G.grid[1]:F+G.grid[1])):F;var E=this.originalPosition.left+Math.round((B.left-this.originalPosition.left)/G.grid[0])*G.grid[0];B.left=this.containment?(!(E<this.containment[0]||E>this.containment[2])?E:(!(E<this.containment[0])?E-G.grid[0]:E+G.grid[0])):E}return B},_clear:function(){this.helper.removeClass("ui-draggable-dragging");if(this.helper[0]!=this.element[0]&&!this.cancelHelperRemoval){this.helper.remove()}this.helper=null;this.cancelHelperRemoval=false},_propagate:function(C,B){A.ui.plugin.call(this,C,[B,this._uiHash()]);if(C=="drag"){this.positionAbs=this._convertPositionTo("absolute")}return this.element.triggerHandler(C=="drag"?C:"drag"+C,[B,this._uiHash()],this.options[C])},plugins:{},_uiHash:function(B){return{helper:this.helper,position:this.position,absolutePosition:this.positionAbs,options:this.options}}}));A.extend(A.ui.draggable,{version:"1.6",defaults:{appendTo:"parent",axis:false,cancel:":input",connectToSortable:false,containment:false,cssNamespace:"ui",cursor:"default",cursorAt:null,delay:0,distance:1,grid:false,handle:false,helper:"original",iframeFix:false,opacity:1,refreshPositions:false,revert:false,revertDuration:500,scope:"default",scroll:true,scrollSensitivity:20,scrollSpeed:20,snap:false,snapMode:"both",snapTolerance:20,stack:false,zIndex:null}});A.ui.plugin.add("draggable","connectToSortable",{start:function(B,D){var C=A(this).data("draggable");C.sortables=[];A(D.options.connectToSortable).each(function(){A(this+"").each(function(){if(A.data(this,"sortable")){var E=A.data(this,"sortable");C.sortables.push({instance:E,shouldRevert:E.options.revert});E._refreshItems();E._propagate("activate",B,C)}})})},stop:function(B,D){var C=A(this).data("draggable");A.each(C.sortables,function(){if(this.instance.isOver){this.instance.isOver=0;C.cancelHelperRemoval=true;this.instance.cancelHelperRemoval=false;if(this.shouldRevert){this.instance.options.revert=true}this.instance._mouseStop(B);this.instance.element.triggerHandler("sortreceive",[B,A.extend(this.instance._ui(),{sender:C.element})],this.instance.options["receive"]);this.instance.options.helper=this.instance.options._helper;if(C.options.helper=="original"){this.instance.currentItem.css({top:"auto",left:"auto"})}}else{this.instance.cancelHelperRemoval=false;this.instance._propagate("deactivate",B,C)}})},drag:function(C,F){var E=A(this).data("draggable"),B=this;var D=function(I){var N=this.offset.click.top,M=this.offset.click.left;var G=this.positionAbs.top,K=this.positionAbs.left;var J=I.height,L=I.width;var O=I.top,H=I.left;return A.ui.isOver(G+N,K+M,O,H,J,L)};A.each(E.sortables,function(G){if(D.call(E,this.instance.containerCache)){if(!this.instance.isOver){this.instance.isOver=1;this.instance.currentItem=A(B).clone().appendTo(this.instance.element).data("sortable-item",true);this.instance.options._helper=this.instance.options.helper;this.instance.options.helper=function(){return F.helper[0]};C.target=this.instance.currentItem[0];this.instance._mouseCapture(C,true);this.instance._mouseStart(C,true,true);this.instance.offset.click.top=E.offset.click.top;this.instance.offset.click.left=E.offset.click.left;this.instance.offset.parent.left-=E.offset.parent.left-this.instance.offset.parent.left;this.instance.offset.parent.top-=E.offset.parent.top-this.instance.offset.parent.top;E._propagate("toSortable",C)}if(this.instance.currentItem){this.instance._mouseDrag(C)}}else{if(this.instance.isOver){this.instance.isOver=0;this.instance.cancelHelperRemoval=true;this.instance.options.revert=false;this.instance._mouseStop(C,true);this.instance.options.helper=this.instance.options._helper;this.instance.currentItem.remove();if(this.instance.placeholder){this.instance.placeholder.remove()}E._propagate("fromSortable",C)}}})}});A.ui.plugin.add("draggable","cursor",{start:function(C,D){var B=A("body");if(B.css("cursor")){D.options._cursor=B.css("cursor")}B.css("cursor",D.options.cursor)},stop:function(B,C){if(C.options._cursor){A("body").css("cursor",C.options._cursor)}}});A.ui.plugin.add("draggable","iframeFix",{start:function(B,C){A(C.options.iframeFix===true?"iframe":C.options.iframeFix).each(function(){A('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>').css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1000}).css(A(this).offset()).appendTo("body")})},stop:function(B,C){A("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)})}});A.ui.plugin.add("draggable","opacity",{start:function(C,D){var B=A(D.helper);if(B.css("opacity")){D.options._opacity=B.css("opacity")}B.css("opacity",D.options.opacity)},stop:function(B,C){if(C.options._opacity){A(C.helper).css("opacity",C.options._opacity)}}});A.ui.plugin.add("draggable","scroll",{start:function(C,D){var E=D.options;var B=A(this).data("draggable");if(B.scrollParent[0]!=document&&B.scrollParent[0].tagName!="HTML"){B.overflowOffset=B.scrollParent.offset()}},drag:function(D,E){var F=E.options,B=false;var C=A(this).data("draggable");if(C.scrollParent[0]!=document&&C.scrollParent[0].tagName!="HTML"){if((C.overflowOffset.top+C.scrollParent[0].offsetHeight)-D.pageY<F.scrollSensitivity){C.scrollParent[0].scrollTop=B=C.scrollParent[0].scrollTop+F.scrollSpeed}else{if(D.pageY-C.overflowOffset.top<F.scrollSensitivity){C.scrollParent[0].scrollTop=B=C.scrollParent[0].scrollTop-F.scrollSpeed}}if((C.overflowOffset.left+C.scrollParent[0].offsetWidth)-D.pageX<F.scrollSensitivity){C.scrollParent[0].scrollLeft=B=C.scrollParent[0].scrollLeft+F.scrollSpeed}else{if(D.pageX-C.overflowOffset.left<F.scrollSensitivity){C.scrollParent[0].scrollLeft=B=C.scrollParent[0].scrollLeft-F.scrollSpeed}}}else{if(D.pageY-A(document).scrollTop()<F.scrollSensitivity){B=A(document).scrollTop(A(document).scrollTop()-F.scrollSpeed)}else{if(A(window).height()-(D.pageY-A(document).scrollTop())<F.scrollSensitivity){B=A(document).scrollTop(A(document).scrollTop()+F.scrollSpeed)}}if(D.pageX-A(document).scrollLeft()<F.scrollSensitivity){B=A(document).scrollLeft(A(document).scrollLeft()-F.scrollSpeed)}else{if(A(window).width()-(D.pageX-A(document).scrollLeft())<F.scrollSensitivity){B=A(document).scrollLeft(A(document).scrollLeft()+F.scrollSpeed)}}}if(B!==false&&A.ui.ddmanager&&!F.dropBehaviour){A.ui.ddmanager.prepareOffsets(C,D)}if(B!==false&&C.cssPosition=="absolute"&&C.scrollParent[0]!=document&&A.ui.contains(C.scrollParent[0],C.offsetParent[0])){C.offset.parent=C._getParentOffset()}if(B!==false&&C.cssPosition=="relative"&&!(C.scrollParent[0]!=document&&C.scrollParent[0]!=C.offsetParent[0])){C.offset.relative=C._getRelativeOffset()}}});A.ui.plugin.add("draggable","snap",{start:function(B,D){var C=A(this).data("draggable");C.snapElements=[];A(D.options.snap.constructor!=String?(D.options.snap.items||":data(draggable)"):D.options.snap).each(function(){var F=A(this);var E=F.offset();if(this!=C.element[0]){C.snapElements.push({item:this,width:F.outerWidth(),height:F.outerHeight(),top:E.top,left:E.left})}})},drag:function(M,K){var E=A(this).data("draggable");var Q=K.options.snapTolerance;var P=K.absolutePosition.left,O=P+E.helperProportions.width,D=K.absolutePosition.top,C=D+E.helperProportions.height;for(var N=E.snapElements.length-1;N>=0;N--){var L=E.snapElements[N].left,J=L+E.snapElements[N].width,I=E.snapElements[N].top,S=I+E.snapElements[N].height;if(!((L-Q<P&&P<J+Q&&I-Q<D&&D<S+Q)||(L-Q<P&&P<J+Q&&I-Q<C&&C<S+Q)||(L-Q<O&&O<J+Q&&I-Q<D&&D<S+Q)||(L-Q<O&&O<J+Q&&I-Q<C&&C<S+Q))){if(E.snapElements[N].snapping){(E.options.snap.release&&E.options.snap.release.call(E.element,M,A.extend(E._uiHash(),{snapItem:E.snapElements[N].item})))}E.snapElements[N].snapping=false;continue}if(K.options.snapMode!="inner"){var B=Math.abs(I-C)<=Q;var R=Math.abs(S-D)<=Q;var G=Math.abs(L-O)<=Q;var H=Math.abs(J-P)<=Q;if(B){K.position.top=E._convertPositionTo("relative",{top:I-E.helperProportions.height,left:0}).top}if(R){K.position.top=E._convertPositionTo("relative",{top:S,left:0}).top}if(G){K.position.left=E._convertPositionTo("relative",{top:0,left:L-E.helperProportions.width}).left}if(H){K.position.left=E._convertPositionTo("relative",{top:0,left:J}).left}}var F=(B||R||G||H);if(K.options.snapMode!="outer"){var B=Math.abs(I-D)<=Q;var R=Math.abs(S-C)<=Q;var G=Math.abs(L-P)<=Q;var H=Math.abs(J-O)<=Q;if(B){K.position.top=E._convertPositionTo("relative",{top:I,left:0}).top}if(R){K.position.top=E._convertPositionTo("relative",{top:S-E.helperProportions.height,left:0}).top}if(G){K.position.left=E._convertPositionTo("relative",{top:0,left:L}).left}if(H){K.position.left=E._convertPositionTo("relative",{top:0,left:J-E.helperProportions.width}).left}}if(!E.snapElements[N].snapping&&(B||R||G||H||F)){(E.options.snap.snap&&E.options.snap.snap.call(E.element,M,A.extend(E._uiHash(),{snapItem:E.snapElements[N].item})))}E.snapElements[N].snapping=(B||R||G||H||F)}}});A.ui.plugin.add("draggable","stack",{start:function(B,C){var D=A.makeArray(A(C.options.stack.group)).sort(function(F,E){return(parseInt(A(F).css("zIndex"),10)||C.options.stack.min)-(parseInt(A(E).css("zIndex"),10)||C.options.stack.min)});A(D).each(function(E){this.style.zIndex=C.options.stack.min+E});this[0].style.zIndex=C.options.stack.min+D.length}});A.ui.plugin.add("draggable","zIndex",{start:function(C,D){var B=A(D.helper);if(B.css("zIndex")){D.options._zIndex=B.css("zIndex")}B.css("zIndex",D.options.zIndex)},stop:function(B,C){if(C.options._zIndex){A(C.helper).css("zIndex",C.options._zIndex)}}})})(jQuery);/* + * jQuery UI Droppable 1.6 + * + * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Droppables + * + * Depends: + * ui.core.js + * ui.draggable.js + */ +(function(A){A.widget("ui.droppable",{_init:function(){var C=this.options,B=C.accept;this.isover=0;this.isout=1;this.options.accept=this.options.accept&&A.isFunction(this.options.accept)?this.options.accept:function(D){return D.is(B)};this.proportions={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight};A.ui.ddmanager.droppables[this.options.scope]=A.ui.ddmanager.droppables[this.options.scope]||[];A.ui.ddmanager.droppables[this.options.scope].push(this);(this.options.cssNamespace&&this.element.addClass(this.options.cssNamespace+"-droppable"))},destroy:function(){var B=A.ui.ddmanager.droppables[this.options.scope];for(var C=0;C<B.length;C++){if(B[C]==this){B.splice(C,1)}}this.element.removeClass("ui-droppable-disabled").removeData("droppable").unbind(".droppable")},_setData:function(B,C){if(B=="accept"){this.options.accept=C&&A.isFunction(C)?C:function(D){return D.is(accept)}}else{A.widget.prototype._setData.apply(this,arguments)}},_activate:function(C){var B=A.ui.ddmanager.current;A.ui.plugin.call(this,"activate",[C,this.ui(B)]);if(B){this.element.triggerHandler("dropactivate",[C,this.ui(B)],this.options.activate)}},_deactivate:function(C){var B=A.ui.ddmanager.current;A.ui.plugin.call(this,"deactivate",[C,this.ui(B)]);if(B){this.element.triggerHandler("dropdeactivate",[C,this.ui(B)],this.options.deactivate)}},_over:function(C){var B=A.ui.ddmanager.current;if(!B||(B.currentItem||B.element)[0]==this.element[0]){return }if(this.options.accept.call(this.element,(B.currentItem||B.element))){A.ui.plugin.call(this,"over",[C,this.ui(B)]);this.element.triggerHandler("dropover",[C,this.ui(B)],this.options.over)}},_out:function(C){var B=A.ui.ddmanager.current;if(!B||(B.currentItem||B.element)[0]==this.element[0]){return }if(this.options.accept.call(this.element,(B.currentItem||B.element))){A.ui.plugin.call(this,"out",[C,this.ui(B)]);this.element.triggerHandler("dropout",[C,this.ui(B)],this.options.out)}},_drop:function(C,D){var B=D||A.ui.ddmanager.current;if(!B||(B.currentItem||B.element)[0]==this.element[0]){return false}var E=false;this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function(){var F=A.data(this,"droppable");if(F.options.greedy&&A.ui.intersect(B,A.extend(F,{offset:F.element.offset()}),F.options.tolerance)){E=true;return false}});if(E){return false}if(this.options.accept.call(this.element,(B.currentItem||B.element))){A.ui.plugin.call(this,"drop",[C,this.ui(B)]);this.element.triggerHandler("drop",[C,this.ui(B)],this.options.drop);return this.element}return false},plugins:{},ui:function(B){return{draggable:(B.currentItem||B.element),helper:B.helper,position:B.position,absolutePosition:B.positionAbs,options:this.options,element:this.element}}});A.extend(A.ui.droppable,{version:"1.6",defaults:{accept:"*",activeClass:null,cssNamespace:"ui",greedy:false,hoverClass:null,scope:"default",tolerance:"intersect"}});A.ui.intersect=function(O,I,M){if(!I.offset){return false}var D=(O.positionAbs||O.position.absolute).left,C=D+O.helperProportions.width,L=(O.positionAbs||O.position.absolute).top,K=L+O.helperProportions.height;var F=I.offset.left,B=F+I.proportions.width,N=I.offset.top,J=N+I.proportions.height;switch(M){case"fit":return(F<D&&C<B&&N<L&&K<J);break;case"intersect":return(F<D+(O.helperProportions.width/2)&&C-(O.helperProportions.width/2)<B&&N<L+(O.helperProportions.height/2)&&K-(O.helperProportions.height/2)<J);break;case"pointer":var G=((O.positionAbs||O.position.absolute).left+(O.clickOffset||O.offset.click).left),H=((O.positionAbs||O.position.absolute).top+(O.clickOffset||O.offset.click).top),E=A.ui.isOver(H,G,N,F,I.proportions.height,I.proportions.width);return E;break;case"touch":return((L>=N&&L<=J)||(K>=N&&K<=J)||(L<N&&K>J))&&((D>=F&&D<=B)||(C>=F&&C<=B)||(D<F&&C>B));break;default:return false;break}};A.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(E,G){var B=A.ui.ddmanager.droppables[E.options.scope];var F=G?G.type:null;var H=(E.currentItem||E.element).find(":data(droppable)").andSelf();droppablesLoop:for(var D=0;D<B.length;D++){if(B[D].options.disabled||(E&&!B[D].options.accept.call(B[D].element,(E.currentItem||E.element)))){continue}for(var C=0;C<H.length;C++){if(H[C]==B[D].element[0]){B[D].proportions.height=0;continue droppablesLoop}}B[D].visible=B[D].element.css("display")!="none";if(!B[D].visible){continue}B[D].offset=B[D].element.offset();B[D].proportions={width:B[D].element[0].offsetWidth,height:B[D].element[0].offsetHeight};if(F=="dragstart"||F=="sortactivate"){B[D]._activate.call(B[D],G)}}},drop:function(B,C){var D=false;A.each(A.ui.ddmanager.droppables[B.options.scope],function(){if(!this.options){return }if(!this.options.disabled&&this.visible&&A.ui.intersect(B,this,this.options.tolerance)){D=this._drop.call(this,C)}if(!this.options.disabled&&this.visible&&this.options.accept.call(this.element,(B.currentItem||B.element))){this.isout=1;this.isover=0;this._deactivate.call(this,C)}});return D},drag:function(B,C){if(B.options.refreshPositions){A.ui.ddmanager.prepareOffsets(B,C)}A.each(A.ui.ddmanager.droppables[B.options.scope],function(){if(this.options.disabled||this.greedyChild||!this.visible){return }var E=A.ui.intersect(B,this,this.options.tolerance);var G=!E&&this.isover==1?"isout":(E&&this.isover==0?"isover":null);if(!G){return }var F;if(this.options.greedy){var D=this.element.parents(":data(droppable):eq(0)");if(D.length){F=A.data(D[0],"droppable");F.greedyChild=(G=="isover"?1:0)}}if(F&&G=="isover"){F["isover"]=0;F["isout"]=1;F._out.call(F,C)}this[G]=1;this[G=="isout"?"isover":"isout"]=0;this[G=="isover"?"_over":"_out"].call(this,C);if(F&&G=="isout"){F["isout"]=0;F["isover"]=1;F._over.call(F,C)}})}};A.ui.plugin.add("droppable","activeClass",{activate:function(B,C){A(this).addClass(C.options.activeClass)},deactivate:function(B,C){A(this).removeClass(C.options.activeClass)},drop:function(B,C){A(this).removeClass(C.options.activeClass)}});A.ui.plugin.add("droppable","hoverClass",{over:function(B,C){A(this).addClass(C.options.hoverClass)},out:function(B,C){A(this).removeClass(C.options.hoverClass)},drop:function(B,C){A(this).removeClass(C.options.hoverClass)}})})(jQuery);/* + * jQuery UI Resizable 1.6 + * + * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Resizables + * + * Depends: + * ui.core.js + */ +(function(B){B.widget("ui.resizable",B.extend({},B.ui.mouse,{_init:function(){var N=this,O=this.options;var R=this.element.css("position");this.originalElement=this.element;this.element.addClass("ui-resizable").css({position:/static/.test(R)?"relative":R});B.extend(O,{_aspectRatio:!!(O.aspectRatio),helper:O.helper||O.ghost||O.animate?O.helper||"ui-resizable-helper":null,knobHandles:O.knobHandles===true?"ui-resizable-knob-handle":O.knobHandles});var I="1px solid #DEDEDE";O.defaultTheme={"ui-resizable":{display:"block"},"ui-resizable-handle":{position:"absolute",background:"#F2F2F2",fontSize:"0.1px"},"ui-resizable-n":{cursor:"n-resize",height:"4px",left:"0px",right:"0px",borderTop:I},"ui-resizable-s":{cursor:"s-resize",height:"4px",left:"0px",right:"0px",borderBottom:I},"ui-resizable-e":{cursor:"e-resize",width:"4px",top:"0px",bottom:"0px",borderRight:I},"ui-resizable-w":{cursor:"w-resize",width:"4px",top:"0px",bottom:"0px",borderLeft:I},"ui-resizable-se":{cursor:"se-resize",width:"4px",height:"4px",borderRight:I,borderBottom:I},"ui-resizable-sw":{cursor:"sw-resize",width:"4px",height:"4px",borderBottom:I,borderLeft:I},"ui-resizable-ne":{cursor:"ne-resize",width:"4px",height:"4px",borderRight:I,borderTop:I},"ui-resizable-nw":{cursor:"nw-resize",width:"4px",height:"4px",borderLeft:I,borderTop:I}};O.knobTheme={"ui-resizable-handle":{background:"#F2F2F2",border:"1px solid #808080",height:"8px",width:"8px"},"ui-resizable-n":{cursor:"n-resize",top:"0px",left:"45%"},"ui-resizable-s":{cursor:"s-resize",bottom:"0px",left:"45%"},"ui-resizable-e":{cursor:"e-resize",right:"0px",top:"45%"},"ui-resizable-w":{cursor:"w-resize",left:"0px",top:"45%"},"ui-resizable-se":{cursor:"se-resize",right:"0px",bottom:"0px"},"ui-resizable-sw":{cursor:"sw-resize",left:"0px",bottom:"0px"},"ui-resizable-nw":{cursor:"nw-resize",left:"0px",top:"0px"},"ui-resizable-ne":{cursor:"ne-resize",right:"0px",top:"0px"}};O._nodeName=this.element[0].nodeName;if(O._nodeName.match(/canvas|textarea|input|select|button|img/i)){var C=this.element;if(/relative/.test(C.css("position"))&&B.browser.opera){C.css({position:"relative",top:"auto",left:"auto"})}C.wrap(B('<div class="ui-wrapper" style="overflow: hidden;"></div>').css({position:C.css("position"),width:C.outerWidth(),height:C.outerHeight(),top:C.css("top"),left:C.css("left")}));var K=this.element;this.element=this.element.parent();this.element.data("resizable",this);this.element.css({marginLeft:K.css("marginLeft"),marginTop:K.css("marginTop"),marginRight:K.css("marginRight"),marginBottom:K.css("marginBottom")});K.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0});if(B.browser.safari&&O.preventDefault){K.css("resize","none")}O.proportionallyResize=K.css({position:"static",zoom:1,display:"block"});this.element.css({margin:K.css("margin")});this._proportionallyResize()}if(!O.handles){O.handles=!B(".ui-resizable-handle",this.element).length?"e,s,se":{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"}}if(O.handles.constructor==String){O.zIndex=O.zIndex||1000;if(O.handles=="all"){O.handles="n,e,s,w,se,sw,ne,nw"}var P=O.handles.split(",");O.handles={};var H={handle:"position: absolute; display: none; overflow:hidden;",n:"top: 0pt; width:100%;",e:"right: 0pt; height:100%;",s:"bottom: 0pt; width:100%;",w:"left: 0pt; height:100%;",se:"bottom: 0pt; right: 0px;",sw:"bottom: 0pt; left: 0px;",ne:"top: 0pt; right: 0px;",nw:"top: 0pt; left: 0px;"};for(var S=0;S<P.length;S++){var T=B.trim(P[S]),M=O.defaultTheme,G="ui-resizable-"+T,D=!B.ui.css(G)&&!O.knobHandles,Q=B.ui.css("ui-resizable-knob-handle"),U=B.extend(M[G],M["ui-resizable-handle"]),E=B.extend(O.knobTheme[G],!Q?O.knobTheme["ui-resizable-handle"]:{});var L=/sw|se|ne|nw/.test(T)?{zIndex:++O.zIndex}:{};var J=(D?H[T]:""),F=B(['<div class="ui-resizable-handle ',G,'" style="',J,H.handle,'"></div>'].join("")).css(L);O.handles[T]=".ui-resizable-"+T;this.element.append(F.css(D?U:{}).css(O.knobHandles?E:{}).addClass(O.knobHandles?"ui-resizable-knob-handle":"").addClass(O.knobHandles))}if(O.knobHandles){this.element.addClass("ui-resizable-knob").css(!B.ui.css("ui-resizable-knob")?{}:{})}}this._renderAxis=function(Z){Z=Z||this.element;for(var W in O.handles){if(O.handles[W].constructor==String){O.handles[W]=B(O.handles[W],this.element).show()}if(O.transparent){O.handles[W].css({opacity:0})}if(this.element.is(".ui-wrapper")&&O._nodeName.match(/textarea|input|select|button/i)){var X=B(O.handles[W],this.element),Y=0;Y=/sw|ne|nw|se|n|s/.test(W)?X.outerHeight():X.outerWidth();var V=["padding",/ne|nw|n/.test(W)?"Top":/se|sw|s/.test(W)?"Bottom":/^e$/.test(W)?"Right":"Left"].join("");if(!O.transparent){Z.css(V,Y)}this._proportionallyResize()}if(!B(O.handles[W]).length){continue}}};this._renderAxis(this.element);O._handles=B(".ui-resizable-handle",N.element);if(O.disableSelection){O._handles.disableSelection()}O._handles.mouseover(function(){if(!O.resizing){if(this.className){var V=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)}N.axis=O.axis=V&&V[1]?V[1]:"se"}});if(O.autoHide){O._handles.hide();B(N.element).addClass("ui-resizable-autohide").hover(function(){B(this).removeClass("ui-resizable-autohide");O._handles.show()},function(){if(!O.resizing){B(this).addClass("ui-resizable-autohide");O._handles.hide()}})}this._mouseInit()},destroy:function(){var E=this.element,D=E.children(".ui-resizable").get(0);this._mouseDestroy();var C=function(F){B(F).removeClass("ui-resizable ui-resizable-disabled").removeData("resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};C(E);if(E.is(".ui-wrapper")&&D){E.parent().append(B(D).css({position:E.css("position"),width:E.outerWidth(),height:E.outerHeight(),top:E.css("top"),left:E.css("left")})).end().remove();C(D)}},_mouseCapture:function(D){if(this.options.disabled){return false}var E=false;for(var C in this.options.handles){if(B(this.options.handles[C])[0]==D.target){E=true}}if(!E){return false}return true},_mouseStart:function(D){var E=this.options,C=this.element.position(),F=this.element,I=B.browser.msie&&B.browser.version<7;E.resizing=true;E.documentScroll={top:B(document).scrollTop(),left:B(document).scrollLeft()};if(F.is(".ui-draggable")||(/absolute/).test(F.css("position"))){var K=B.browser.msie&&!E.containment&&(/absolute/).test(F.css("position"))&&!(/relative/).test(F.parent().css("position"));var L=K?this.documentScroll.top:0,H=K?this.documentScroll.left:0;F.css({position:"absolute",top:(C.top+L),left:(C.left+H)})}if(B.browser.opera&&(/relative/).test(F.css("position"))){F.css({position:"relative",top:"auto",left:"auto"})}this._renderProxy();var M=A(this.helper.css("left")),G=A(this.helper.css("top"));if(E.containment){M+=B(E.containment).scrollLeft()||0;G+=B(E.containment).scrollTop()||0}this.offset=this.helper.offset();this.position={left:M,top:G};this.size=E.helper||I?{width:F.outerWidth(),height:F.outerHeight()}:{width:F.width(),height:F.height()};this.originalSize=E.helper||I?{width:F.outerWidth(),height:F.outerHeight()}:{width:F.width(),height:F.height()};this.originalPosition={left:M,top:G};this.sizeDiff={width:F.outerWidth()-F.width(),height:F.outerHeight()-F.height()};this.originalMousePosition={left:D.pageX,top:D.pageY};E.aspectRatio=(typeof E.aspectRatio=="number")?E.aspectRatio:((this.originalSize.width/this.originalSize.height)||1);if(E.preserveCursor){var J=B(".ui-resizable-"+this.axis).css("cursor");B("body").css("cursor",J=="auto"?this.axis+"-resize":J)}this._propagate("start",D);return true},_mouseDrag:function(C){var F=this.helper,E=this.options,K={},N=this,H=this.originalMousePosition,L=this.axis;var O=(C.pageX-H.left)||0,M=(C.pageY-H.top)||0;var G=this._change[L];if(!G){return false}var J=G.apply(this,[C,O,M]),I=B.browser.msie&&B.browser.version<7,D=this.sizeDiff;if(E._aspectRatio||C.shiftKey){J=this._updateRatio(J,C)}J=this._respectSize(J,C);this._propagate("resize",C);F.css({top:this.position.top+"px",left:this.position.left+"px",width:this.size.width+"px",height:this.size.height+"px"});if(!E.helper&&E.proportionallyResize){this._proportionallyResize()}this._updateCache(J);this.element.triggerHandler("resize",[C,this.ui()],this.options["resize"]);return false},_mouseStop:function(F){this.options.resizing=false;var G=this.options,K=this;if(G.helper){var E=G.proportionallyResize,C=E&&(/textarea/i).test(E.get(0).nodeName),D=C&&B.ui.hasScroll(E.get(0),"left")?0:K.sizeDiff.height,I=C?0:K.sizeDiff.width;var L={width:(K.size.width-I),height:(K.size.height-D)},H=(parseInt(K.element.css("left"),10)+(K.position.left-K.originalPosition.left))||null,J=(parseInt(K.element.css("top"),10)+(K.position.top-K.originalPosition.top))||null;if(!G.animate){this.element.css(B.extend(L,{top:J,left:H}))}if(G.helper&&!G.animate){this._proportionallyResize()}}if(G.preserveCursor){B("body").css("cursor","auto")}this._propagate("stop",F);if(G.helper){this.helper.remove()}return false},_updateCache:function(C){var D=this.options;this.offset=this.helper.offset();if(C.left){this.position.left=C.left}if(C.top){this.position.top=C.top}if(C.height){this.size.height=C.height}if(C.width){this.size.width=C.width}},_updateRatio:function(F,E){var G=this.options,H=this.position,D=this.size,C=this.axis;if(F.height){F.width=(D.height*G.aspectRatio)}else{if(F.width){F.height=(D.width/G.aspectRatio)}}if(C=="sw"){F.left=H.left+(D.width-F.width);F.top=null}if(C=="nw"){F.top=H.top+(D.height-F.height);F.left=H.left+(D.width-F.width)}return F},_respectSize:function(J,E){var H=this.helper,G=this.options,O=G._aspectRatio||E.shiftKey,N=this.axis,Q=J.width&&G.maxWidth&&G.maxWidth<J.width,K=J.height&&G.maxHeight&&G.maxHeight<J.height,F=J.width&&G.minWidth&&G.minWidth>J.width,P=J.height&&G.minHeight&&G.minHeight>J.height;if(F){J.width=G.minWidth}if(P){J.height=G.minHeight}if(Q){J.width=G.maxWidth}if(K){J.height=G.maxHeight}var D=this.originalPosition.left+this.originalSize.width,M=this.position.top+this.size.height;var I=/sw|nw|w/.test(N),C=/nw|ne|n/.test(N);if(F&&I){J.left=D-G.minWidth}if(Q&&I){J.left=D-G.maxWidth}if(P&&C){J.top=M-G.minHeight}if(K&&C){J.top=M-G.maxHeight}var L=!J.width&&!J.height;if(L&&!J.left&&J.top){J.top=null}else{if(L&&!J.top&&J.left){J.left=null}}return J},_proportionallyResize:function(){var G=this.options;if(!G.proportionallyResize){return }var E=G.proportionallyResize,D=this.helper||this.element;if(!G.borderDif){var C=[E.css("borderTopWidth"),E.css("borderRightWidth"),E.css("borderBottomWidth"),E.css("borderLeftWidth")],F=[E.css("paddingTop"),E.css("paddingRight"),E.css("paddingBottom"),E.css("paddingLeft")];G.borderDif=B.map(C,function(H,J){var I=parseInt(H,10)||0,K=parseInt(F[J],10)||0;return I+K})}E.css({height:(D.height()-G.borderDif[0]-G.borderDif[2])+"px",width:(D.width()-G.borderDif[1]-G.borderDif[3])+"px"})},_renderProxy:function(){var D=this.element,G=this.options;this.elementOffset=D.offset();if(G.helper){this.helper=this.helper||B('<div style="overflow:hidden;"></div>');var C=B.browser.msie&&B.browser.version<7,E=(C?1:0),F=(C?2:-1);this.helper.addClass(G.helper).css({width:D.outerWidth()+F,height:D.outerHeight()+F,position:"absolute",left:this.elementOffset.left-E+"px",top:this.elementOffset.top-E+"px",zIndex:++G.zIndex});this.helper.appendTo("body");if(G.disableSelection){this.helper.disableSelection()}}else{this.helper=D}},_change:{e:function(E,D,C){return{width:this.originalSize.width+D}},w:function(F,D,C){var H=this.options,E=this.originalSize,G=this.originalPosition;return{left:G.left+D,width:E.width-D}},n:function(F,D,C){var H=this.options,E=this.originalSize,G=this.originalPosition;return{top:G.top+C,height:E.height-C}},s:function(E,D,C){return{height:this.originalSize.height+C}},se:function(E,D,C){return B.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[E,D,C]))},sw:function(E,D,C){return B.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[E,D,C]))},ne:function(E,D,C){return B.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[E,D,C]))},nw:function(E,D,C){return B.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[E,D,C]))}},_propagate:function(D,C){B.ui.plugin.call(this,D,[C,this.ui()]);if(D!="resize"){this.element.triggerHandler(["resize",D].join(""),[C,this.ui()],this.options[D])}},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,options:this.options,originalSize:this.originalSize,originalPosition:this.originalPosition}}}));B.extend(B.ui.resizable,{version:"1.6",defaults:{alsoResize:false,animate:false,animateDuration:"slow",animateEasing:"swing",aspectRatio:false,autoHide:false,cancel:":input",containment:false,disableSelection:true,distance:1,delay:0,ghost:false,grid:false,knobHandles:false,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,preserveCursor:true,preventDefault:true,proportionallyResize:false,transparent:false}});B.ui.plugin.add("resizable","alsoResize",{start:function(D,E){var G=E.options,C=B(this).data("resizable"),F=function(H){B(H).each(function(){B(this).data("resizable-alsoresize",{width:parseInt(B(this).width(),10),height:parseInt(B(this).height(),10),left:parseInt(B(this).css("left"),10),top:parseInt(B(this).css("top"),10)})})};if(typeof (G.alsoResize)=="object"&&!G.alsoResize.parentNode){if(G.alsoResize.length){G.alsoResize=G.alsoResize[0];F(G.alsoResize)}else{B.each(G.alsoResize,function(H,I){F(H)})}}else{F(G.alsoResize)}},resize:function(E,G){var H=G.options,D=B(this).data("resizable"),F=D.originalSize,J=D.originalPosition;var I={height:(D.size.height-F.height)||0,width:(D.size.width-F.width)||0,top:(D.position.top-J.top)||0,left:(D.position.left-J.left)||0},C=function(K,L){B(K).each(function(){var O=B(this).data("resizable-alsoresize"),N={},M=L&&L.length?L:["width","height","top","left"];B.each(M||["width","height","top","left"],function(P,R){var Q=(O[R]||0)+(I[R]||0);if(Q&&Q>=0){N[R]=Q||null}});B(this).css(N)})};if(typeof (H.alsoResize)=="object"&&!H.alsoResize.parentNode){B.each(H.alsoResize,function(K,L){C(K,L)})}else{C(H.alsoResize)}},stop:function(C,D){B(this).removeData("resizable-alsoresize-start")}});B.ui.plugin.add("resizable","animate",{stop:function(G,L){var H=L.options,M=B(this).data("resizable");var F=H.proportionallyResize,C=F&&(/textarea/i).test(F.get(0).nodeName),D=C&&B.ui.hasScroll(F.get(0),"left")?0:M.sizeDiff.height,J=C?0:M.sizeDiff.width;var E={width:(M.size.width-J),height:(M.size.height-D)},I=(parseInt(M.element.css("left"),10)+(M.position.left-M.originalPosition.left))||null,K=(parseInt(M.element.css("top"),10)+(M.position.top-M.originalPosition.top))||null;M.element.animate(B.extend(E,K&&I?{top:K,left:I}:{}),{duration:H.animateDuration,easing:H.animateEasing,step:function(){var N={width:parseInt(M.element.css("width"),10),height:parseInt(M.element.css("height"),10),top:parseInt(M.element.css("top"),10),left:parseInt(M.element.css("left"),10)};if(F){F.css({width:N.width,height:N.height})}M._updateCache(N);M._propagate("animate",G)}})}});B.ui.plugin.add("resizable","containment",{start:function(D,N){var H=N.options,P=B(this).data("resizable"),J=P.element;var E=H.containment,I=(E instanceof B)?E.get(0):(/parent/.test(E))?J.parent().get(0):E;if(!I){return }P.containerElement=B(I);if(/document/.test(E)||E==document){P.containerOffset={left:0,top:0};P.containerPosition={left:0,top:0};P.parentData={element:B(document),left:0,top:0,width:B(document).width(),height:B(document).height()||document.body.parentNode.scrollHeight}}else{var L=B(I),G=[];B(["Top","Right","Left","Bottom"]).each(function(R,Q){G[R]=A(L.css("padding"+Q))});P.containerOffset=L.offset();P.containerPosition=L.position();P.containerSize={height:(L.innerHeight()-G[3]),width:(L.innerWidth()-G[1])};var M=P.containerOffset,C=P.containerSize.height,K=P.containerSize.width,F=(B.ui.hasScroll(I,"left")?I.scrollWidth:K),O=(B.ui.hasScroll(I)?I.scrollHeight:C);P.parentData={element:I,left:M.left,top:M.top,width:F,height:O}}},resize:function(E,N){var G=N.options,Q=B(this).data("resizable"),D=Q.containerSize,M=Q.containerOffset,K=Q.size,L=Q.position,O=G._aspectRatio||E.shiftKey,C={top:0,left:0},F=Q.containerElement;if(F[0]!=document&&(/static/).test(F.css("position"))){C=M}if(L.left<(G.helper?M.left:0)){Q.size.width=Q.size.width+(G.helper?(Q.position.left-M.left):(Q.position.left-C.left));if(O){Q.size.height=Q.size.width/G.aspectRatio}Q.position.left=G.helper?M.left:0}if(L.top<(G.helper?M.top:0)){Q.size.height=Q.size.height+(G.helper?(Q.position.top-M.top):Q.position.top);if(O){Q.size.width=Q.size.height*G.aspectRatio}Q.position.top=G.helper?M.top:0}Q.offset.left=Q.parentData.left+Q.position.left;Q.offset.top=Q.parentData.top+Q.position.top;var J=Math.abs((G.helper?Q.offset.left-C.left:(Q.offset.left-C.left))+Q.sizeDiff.width),P=Math.abs((G.helper?Q.offset.top-C.top:(Q.offset.top-M.top))+Q.sizeDiff.height);var I=Q.containerElement.get(0)==Q.element.parent().get(0),H=/relative|absolute/.test(Q.containerElement.css("position"));if(I&&H){J-=Q.parentData.left}if(J+Q.size.width>=Q.parentData.width){Q.size.width=Q.parentData.width-J;if(O){Q.size.height=Q.size.width/G.aspectRatio}}if(P+Q.size.height>=Q.parentData.height){Q.size.height=Q.parentData.height-P;if(O){Q.size.width=Q.size.height*G.aspectRatio}}},stop:function(D,K){var E=K.options,M=B(this).data("resizable"),I=M.position,J=M.containerOffset,C=M.containerPosition,F=M.containerElement;var G=B(M.helper),N=G.offset(),L=G.outerWidth()-M.sizeDiff.width,H=G.outerHeight()-M.sizeDiff.height;if(E.helper&&!E.animate&&(/relative/).test(F.css("position"))){B(this).css({left:N.left-C.left-J.left,width:L,height:H})}if(E.helper&&!E.animate&&(/static/).test(F.css("position"))){B(this).css({left:N.left-C.left-J.left,width:L,height:H})}}});B.ui.plugin.add("resizable","ghost",{start:function(E,F){var G=F.options,C=B(this).data("resizable"),H=G.proportionallyResize,D=C.size;if(!H){C.ghost=C.element.clone()}else{C.ghost=H.clone()}C.ghost.css({opacity:0.25,display:"block",position:"relative",height:D.height,width:D.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass(typeof G.ghost=="string"?G.ghost:"");C.ghost.appendTo(C.helper)},resize:function(D,E){var F=E.options,C=B(this).data("resizable"),G=F.proportionallyResize;if(C.ghost){C.ghost.css({position:"relative",height:C.size.height,width:C.size.width})}},stop:function(D,E){var F=E.options,C=B(this).data("resizable"),G=F.proportionallyResize;if(C.ghost&&C.helper){C.helper.get(0).removeChild(C.ghost.get(0))}}});B.ui.plugin.add("resizable","grid",{resize:function(C,K){var F=K.options,M=B(this).data("resizable"),I=M.size,G=M.originalSize,H=M.originalPosition,L=M.axis,J=F._aspectRatio||C.shiftKey;F.grid=typeof F.grid=="number"?[F.grid,F.grid]:F.grid;var E=Math.round((I.width-G.width)/(F.grid[0]||1))*(F.grid[0]||1),D=Math.round((I.height-G.height)/(F.grid[1]||1))*(F.grid[1]||1);if(/^(se|s|e)$/.test(L)){M.size.width=G.width+E;M.size.height=G.height+D}else{if(/^(ne)$/.test(L)){M.size.width=G.width+E;M.size.height=G.height+D;M.position.top=H.top-D}else{if(/^(sw)$/.test(L)){M.size.width=G.width+E;M.size.height=G.height+D;M.position.left=H.left-E}else{M.size.width=G.width+E;M.size.height=G.height+D;M.position.top=H.top-D;M.position.left=H.left-E}}}}});var A=function(C){return parseInt(C,10)||0}})(jQuery);/* + * jQuery UI Selectable 1.6 + * + * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Selectables + * + * Depends: + * ui.core.js + */ +(function(A){A.widget("ui.selectable",A.extend({},A.ui.mouse,{_init:function(){var B=this;this.element.addClass("ui-selectable");this.dragged=false;var C;this.refresh=function(){C=A(B.options.filter,B.element[0]);C.each(function(){var D=A(this);var E=D.offset();A.data(this,"selectable-item",{element:this,$element:D,left:E.left,top:E.top,right:E.left+D.width(),bottom:E.top+D.height(),startselected:false,selected:D.hasClass("ui-selected"),selecting:D.hasClass("ui-selecting"),unselecting:D.hasClass("ui-unselecting")})})};this.refresh();this.selectees=C.addClass("ui-selectee");this._mouseInit();this.helper=A(document.createElement("div")).css({border:"1px dotted black"}).addClass("ui-selectable-helper")},destroy:function(){this.element.removeClass("ui-selectable ui-selectable-disabled").removeData("selectable").unbind(".selectable");this._mouseDestroy()},_mouseStart:function(E){var C=this;this.opos=[E.pageX,E.pageY];if(this.options.disabled){return }var D=this.options;this.selectees=A(D.filter,this.element[0]);this.element.triggerHandler("selectablestart",[E,{"selectable":this.element[0],"options":D}],D.start);A("body").append(this.helper);this.helper.css({"z-index":100,"position":"absolute","left":E.clientX,"top":E.clientY,"width":0,"height":0});if(D.autoRefresh){this.refresh()}this.selectees.filter(".ui-selected").each(function(){var F=A.data(this,"selectable-item");F.startselected=true;if(!E.metaKey){F.$element.removeClass("ui-selected");F.selected=false;F.$element.addClass("ui-unselecting");F.unselecting=true;C.element.triggerHandler("selectableunselecting",[E,{selectable:C.element[0],unselecting:F.element,options:D}],D.unselecting)}});var B=false;A(E.target).parents().andSelf().each(function(){if(A.data(this,"selectable-item")){B=true}});return this.options.keyboard?!B:true},_mouseDrag:function(I){var C=this;this.dragged=true;if(this.options.disabled){return }var E=this.options;var D=this.opos[0],H=this.opos[1],B=I.pageX,G=I.pageY;if(D>B){var F=B;B=D;D=F}if(H>G){var F=G;G=H;H=F}this.helper.css({left:D,top:H,width:B-D,height:G-H});this.selectees.each(function(){var J=A.data(this,"selectable-item");if(!J||J.element==C.element[0]){return }var K=false;if(E.tolerance=="touch"){K=(!(J.left>B||J.right<D||J.top>G||J.bottom<H))}else{if(E.tolerance=="fit"){K=(J.left>D&&J.right<B&&J.top>H&&J.bottom<G)}}if(K){if(J.selected){J.$element.removeClass("ui-selected");J.selected=false}if(J.unselecting){J.$element.removeClass("ui-unselecting");J.unselecting=false}if(!J.selecting){J.$element.addClass("ui-selecting");J.selecting=true;C.element.triggerHandler("selectableselecting",[I,{selectable:C.element[0],selecting:J.element,options:E}],E.selecting)}}else{if(J.selecting){if(I.metaKey&&J.startselected){J.$element.removeClass("ui-selecting");J.selecting=false;J.$element.addClass("ui-selected");J.selected=true}else{J.$element.removeClass("ui-selecting");J.selecting=false;if(J.startselected){J.$element.addClass("ui-unselecting");J.unselecting=true}C.element.triggerHandler("selectableunselecting",[I,{selectable:C.element[0],unselecting:J.element,options:E}],E.unselecting)}}if(J.selected){if(!I.metaKey&&!J.startselected){J.$element.removeClass("ui-selected");J.selected=false;J.$element.addClass("ui-unselecting");J.unselecting=true;C.element.triggerHandler("selectableunselecting",[I,{selectable:C.element[0],unselecting:J.element,options:E}],E.unselecting)}}}});return false},_mouseStop:function(D){var B=this;this.dragged=false;var C=this.options;A(".ui-unselecting",this.element[0]).each(function(){var E=A.data(this,"selectable-item");E.$element.removeClass("ui-unselecting");E.unselecting=false;E.startselected=false;B.element.triggerHandler("selectableunselected",[D,{selectable:B.element[0],unselected:E.element,options:C}],C.unselected)});A(".ui-selecting",this.element[0]).each(function(){var E=A.data(this,"selectable-item");E.$element.removeClass("ui-selecting").addClass("ui-selected");E.selecting=false;E.selected=true;E.startselected=true;B.element.triggerHandler("selectableselected",[D,{selectable:B.element[0],selected:E.element,options:C}],C.selected)});this.element.triggerHandler("selectablestop",[D,{selectable:B.element[0],options:this.options}],this.options.stop);this.helper.remove();return false}}));A.extend(A.ui.selectable,{version:"1.6",defaults:{appendTo:"body",autoRefresh:true,cancel:":input",delay:0,distance:1,filter:"*",tolerance:"touch"}})})(jQuery);/* + * jQuery UI Sortable 1.6 + * + * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Sortables + * + * Depends: + * ui.core.js + */ +(function(A){A.widget("ui.sortable",A.extend({},A.ui.mouse,{_init:function(){var B=this.options;this.containerCache={};this.element.addClass("ui-sortable");this.refresh();this.floating=this.items.length?(/left|right/).test(this.items[0].item.css("float")):false;this.offset=this.element.offset();this._mouseInit()},destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled").removeData("sortable").unbind(".sortable");this._mouseDestroy();for(var B=this.items.length-1;B>=0;B--){this.items[B].item.removeData("sortable-item")}},_mouseCapture:function(E,F){if(this.reverting){return false}if(this.options.disabled||this.options.type=="static"){return false}this._refreshItems(E);var D=null,C=this,B=A(E.target).parents().each(function(){if(A.data(this,"sortable-item")==C){D=A(this);return false}});if(A.data(E.target,"sortable-item")==C){D=A(E.target)}if(!D){return false}if(this.options.handle&&!F){var G=false;A(this.options.handle,D).find("*").andSelf().each(function(){if(this==E.target){G=true}});if(!G){return false}}this.currentItem=D;this._removeCurrentsFromItems();return true},_mouseStart:function(D,E,B){var F=this.options;this.currentContainer=this;this.refreshPositions();this.helper=this._createHelper(D);this._cacheHelperProportions();this._cacheMargins();this.scrollParent=this.helper.scrollParent();this.offset=this.currentItem.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};this.helper.css("position","absolute");this.cssPosition=this.helper.css("position");A.extend(this.offset,{click:{left:D.pageX-this.offset.left,top:D.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});if(F.cursorAt){this._adjustOffsetFromHelper(F.cursorAt)}this.originalPosition=this._generatePosition(D);this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]};if(this.helper[0]!=this.currentItem[0]){this.currentItem.hide()}this._createPlaceholder();if(F.containment){this._setContainment()}this._propagate("start",D);if(!this._preserveHelperProportions){this._cacheHelperProportions()}if(!B){for(var C=this.containers.length-1;C>=0;C--){this.containers[C]._propagate("activate",D,this)}}if(A.ui.ddmanager){A.ui.ddmanager.current=this}if(A.ui.ddmanager&&!F.dropBehaviour){A.ui.ddmanager.prepareOffsets(this,D)}this.dragging=true;this.helper.addClass("ui-sortable-helper");this._mouseDrag(D);return true},_mouseDrag:function(E){this.position=this._generatePosition(E);this.positionAbs=this._convertPositionTo("absolute");if(!this.lastPositionAbs){this.lastPositionAbs=this.positionAbs}A.ui.plugin.call(this,"sort",[E,this._ui()]);this.positionAbs=this._convertPositionTo("absolute");if(!this.options.axis||this.options.axis!="y"){this.helper[0].style.left=this.position.left+"px"}if(!this.options.axis||this.options.axis!="x"){this.helper[0].style.top=this.position.top+"px"}for(var C=this.items.length-1;C>=0;C--){var D=this.items[C],B=D.item[0],F=this._intersectsWithPointer(D);if(!F){continue}if(B!=this.currentItem[0]&&this.placeholder[F==1?"next":"prev"]()[0]!=B&&!A.ui.contains(this.placeholder[0],B)&&(this.options.type=="semi-dynamic"?!A.ui.contains(this.element[0],B):true)){this.direction=F==1?"down":"up";if(this.options.tolerance=="pointer"||this._intersectsWithSides(D)){this.options.sortIndicator.call(this,E,D)}else{break}this._propagate("change",E);break}}this._contactContainers(E);if(A.ui.ddmanager){A.ui.ddmanager.drag(this,E)}this._trigger("sort",E,this._ui());this.lastPositionAbs=this.positionAbs;return false},_mouseStop:function(C,D){if(!C){return }if(A.ui.ddmanager&&!this.options.dropBehaviour){A.ui.ddmanager.drop(this,C)}if(this.options.revert){var B=this;var E=B.placeholder.offset();B.reverting=true;A(this.helper).animate({left:E.left-this.offset.parent.left-B.margins.left+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollLeft),top:E.top-this.offset.parent.top-B.margins.top+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollTop)},parseInt(this.options.revert,10)||500,function(){B._clear(C)})}else{this._clear(C,D)}return false},cancel:function(){if(this.dragging){this._mouseUp();if(this.options.helper=="original"){this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else{this.currentItem.show()}for(var B=this.containers.length-1;B>=0;B--){this.containers[B]._propagate("deactivate",null,this);if(this.containers[B].containerCache.over){this.containers[B]._propagate("out",null,this);this.containers[B].containerCache.over=0}}}if(this.placeholder[0].parentNode){this.placeholder[0].parentNode.removeChild(this.placeholder[0])}if(this.options.helper!="original"&&this.helper&&this.helper[0].parentNode){this.helper.remove()}A.extend(this,{helper:null,dragging:false,reverting:false,_noFinalSort:null});if(this.domPosition.prev){A(this.domPosition.prev).after(this.currentItem)}else{A(this.domPosition.parent).prepend(this.currentItem)}return true},serialize:function(D){var B=this._getItemsAsjQuery(D&&D.connected);var C=[];D=D||{};A(B).each(function(){var E=(A(D.item||this).attr(D.attribute||"id")||"").match(D.expression||(/(.+)[-=_](.+)/));if(E){C.push((D.key||E[1]+"[]")+"="+(D.key&&D.expression?E[1]:E[2]))}});return C.join("&")},toArray:function(D){var B=this._getItemsAsjQuery(D&&D.connected);var C=[];D=D||{};B.each(function(){C.push(A(D.item||this).attr(D.attribute||"id")||"")});return C},_intersectsWith:function(K){var D=this.positionAbs.left,C=D+this.helperProportions.width,J=this.positionAbs.top,I=J+this.helperProportions.height;var E=K.left,B=E+K.width,L=K.top,H=L+K.height;var M=this.offset.click.top,G=this.offset.click.left;var F=(J+M)>L&&(J+M)<H&&(D+G)>E&&(D+G)<B;if(this.options.tolerance=="pointer"||this.options.forcePointerForContainers||(this.options.tolerance!="pointer"&&this.helperProportions[this.floating?"width":"height"]>K[this.floating?"width":"height"])){return F}else{return(E<D+(this.helperProportions.width/2)&&C-(this.helperProportions.width/2)<B&&L<J+(this.helperProportions.height/2)&&I-(this.helperProportions.height/2)<H)}},_intersectsWithPointer:function(D){var E=A.ui.isOverAxis(this.positionAbs.top+this.offset.click.top,D.top,D.height),C=A.ui.isOverAxis(this.positionAbs.left+this.offset.click.left,D.left,D.width),G=E&&C,B=this._getDragVerticalDirection(),F=this._getDragHorizontalDirection();if(!G){return false}return this.floating?(((F&&F=="right")||B=="down")?2:1):(B&&(B=="down"?2:1))},_intersectsWithSides:function(E){var C=A.ui.isOverAxis(this.positionAbs.top+this.offset.click.top,E.top+(E.height/2),E.height),D=A.ui.isOverAxis(this.positionAbs.left+this.offset.click.left,E.left+(E.width/2),E.width),B=this._getDragVerticalDirection(),F=this._getDragHorizontalDirection();if(this.floating&&F){return((F=="right"&&D)||(F=="left"&&!D))}else{return B&&((B=="down"&&C)||(B=="up"&&!C))}},_getDragVerticalDirection:function(){var B=this.positionAbs.top-this.lastPositionAbs.top;return B!=0&&(B>0?"down":"up")},_getDragHorizontalDirection:function(){var B=this.positionAbs.left-this.lastPositionAbs.left;return B!=0&&(B>0?"right":"left")},refresh:function(B){this._refreshItems(B);this.refreshPositions()},_getItemsAsjQuery:function(G){var C=this;var B=[];var E=[];if(this.options.connectWith&&G){for(var F=this.options.connectWith.length-1;F>=0;F--){var I=A(this.options.connectWith[F]);for(var D=I.length-1;D>=0;D--){var H=A.data(I[D],"sortable");if(H&&H!=this&&!H.options.disabled){E.push([A.isFunction(H.options.items)?H.options.items.call(H.element):A(H.options.items,H.element).not(".ui-sortable-helper"),H])}}}}E.push([A.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):A(this.options.items,this.element).not(".ui-sortable-helper"),this]);for(var F=E.length-1;F>=0;F--){E[F][0].each(function(){B.push(this)})}return A(B)},_removeCurrentsFromItems:function(){var D=this.currentItem.find(":data(sortable-item)");for(var C=0;C<this.items.length;C++){for(var B=0;B<D.length;B++){if(D[B]==this.items[C].item[0]){this.items.splice(C,1)}}}},_refreshItems:function(B){this.items=[];this.containers=[this];var H=this.items;var M=this;var F=[[A.isFunction(this.options.items)?this.options.items.call(this.element[0],B,{item:this.currentItem}):A(this.options.items,this.element),this]];if(this.options.connectWith){for(var E=this.options.connectWith.length-1;E>=0;E--){var J=A(this.options.connectWith[E]);for(var D=J.length-1;D>=0;D--){var G=A.data(J[D],"sortable");if(G&&G!=this&&!G.options.disabled){F.push([A.isFunction(G.options.items)?G.options.items.call(G.element[0],B,{item:this.currentItem}):A(G.options.items,G.element),G]);this.containers.push(G)}}}}for(var E=F.length-1;E>=0;E--){var I=F[E][1];var C=F[E][0];for(var D=0,K=C.length;D<K;D++){var L=A(C[D]);L.data("sortable-item",I);H.push({item:L,instance:I,width:0,height:0,left:0,top:0})}}},refreshPositions:function(B){if(this.offsetParent&&this.helper){this.offset.parent=this._getParentOffset()}for(var D=this.items.length-1;D>=0;D--){var E=this.items[D];if(E.instance!=this.currentContainer&&this.currentContainer&&E.item[0]!=this.currentItem[0]){continue}var C=this.options.toleranceElement?A(this.options.toleranceElement,E.item):E.item;if(!B){if(this.options.accurateIntersection){E.width=C.outerWidth();E.height=C.outerHeight()}else{E.width=C[0].offsetWidth;E.height=C[0].offsetHeight}}var F=C.offset();E.left=F.left;E.top=F.top}if(this.options.custom&&this.options.custom.refreshContainers){this.options.custom.refreshContainers.call(this)}else{for(var D=this.containers.length-1;D>=0;D--){var F=this.containers[D].element.offset();this.containers[D].containerCache.left=F.left;this.containers[D].containerCache.top=F.top;this.containers[D].containerCache.width=this.containers[D].element.outerWidth();this.containers[D].containerCache.height=this.containers[D].element.outerHeight()}}},_createPlaceholder:function(D){var B=D||this,E=B.options;if(!E.placeholder||E.placeholder.constructor==String){var C=E.placeholder;E.placeholder={element:function(){var F=A(document.createElement(B.currentItem[0].nodeName)).addClass(C||B.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper")[0];if(!C){F.style.visibility="hidden";document.body.appendChild(F);F.innerHTML=B.currentItem[0].innerHTML.replace(/name\=\"[^\"\']+\"/g,"").replace(/jQuery[0-9]+\=\"[^\"\']+\"/g,"");document.body.removeChild(F)}return F},update:function(F,G){if(C&&!E.forcePlaceholderSize){return }if(!G.height()){G.height(B.currentItem.innerHeight()-parseInt(B.currentItem.css("paddingTop")||0,10)-parseInt(B.currentItem.css("paddingBottom")||0,10))}if(!G.width()){G.width(B.currentItem.innerWidth()-parseInt(B.currentItem.css("paddingLeft")||0,10)-parseInt(B.currentItem.css("paddingRight")||0,10))}}}}B.placeholder=A(E.placeholder.element.call(B.element,B.currentItem));B.currentItem.after(B.placeholder);E.placeholder.update(B,B.placeholder)},_contactContainers:function(D){for(var C=this.containers.length-1;C>=0;C--){if(this._intersectsWith(this.containers[C].containerCache)){if(!this.containers[C].containerCache.over){if(this.currentContainer!=this.containers[C]){var H=10000;var G=null;var E=this.positionAbs[this.containers[C].floating?"left":"top"];for(var B=this.items.length-1;B>=0;B--){if(!A.ui.contains(this.containers[C].element[0],this.items[B].item[0])){continue}var F=this.items[B][this.containers[C].floating?"left":"top"];if(Math.abs(F-E)<H){H=Math.abs(F-E);G=this.items[B]}}if(!G&&!this.options.dropOnEmpty){continue}this.currentContainer=this.containers[C];G?this.options.sortIndicator.call(this,D,G,null,true):this.options.sortIndicator.call(this,D,null,this.containers[C].element,true);this._propagate("change",D);this.containers[C]._propagate("change",D,this);this.options.placeholder.update(this.currentContainer,this.placeholder)}this.containers[C]._propagate("over",D,this);this.containers[C].containerCache.over=1}}else{if(this.containers[C].containerCache.over){this.containers[C]._propagate("out",D,this);this.containers[C].containerCache.over=0}}}},_createHelper:function(C){var D=this.options;var B=A.isFunction(D.helper)?A(D.helper.apply(this.element[0],[C,this.currentItem])):(D.helper=="clone"?this.currentItem.clone():this.currentItem);if(!B.parents("body").length){A(D.appendTo!="parent"?D.appendTo:this.currentItem[0].parentNode)[0].appendChild(B[0])}if(B[0]==this.currentItem[0]){this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")}}if(B[0].style.width==""||D.forceHelperSize){B.width(this.currentItem.width())}if(B[0].style.height==""||D.forceHelperSize){B.height(this.currentItem.height())}return B},_adjustOffsetFromHelper:function(B){if(B.left!=undefined){this.offset.click.left=B.left+this.margins.left}if(B.right!=undefined){this.offset.click.left=this.helperProportions.width-B.right+this.margins.left}if(B.top!=undefined){this.offset.click.top=B.top+this.margins.top}if(B.bottom!=undefined){this.offset.click.top=this.helperProportions.height-B.bottom+this.margins.top}},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var B=this.offsetParent.offset();if((this.offsetParent[0]==document.body&&A.browser.mozilla)||(this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&A.browser.msie)){B={top:0,left:0}}return{top:B.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:B.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var B=this.currentItem.position();return{top:B.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:B.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}else{return{top:0,left:0}}},_cacheMargins:function(){this.margins={left:(parseInt(this.currentItem.css("marginLeft"),10)||0),top:(parseInt(this.currentItem.css("marginTop"),10)||0)}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var E=this.options;if(E.containment=="parent"){E.containment=this.helper[0].parentNode}if(E.containment=="document"||E.containment=="window"){this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,A(E.containment=="document"?document:window).width()-this.offset.relative.left-this.offset.parent.left-this.margins.left-(parseInt(this.currentItem.css("marginRight"),10)||0),(A(E.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.offset.relative.top-this.offset.parent.top-this.margins.top-(parseInt(this.currentItem.css("marginBottom"),10)||0)]}if(!(/^(document|window|parent)$/).test(E.containment)){var C=A(E.containment)[0];var D=A(E.containment).offset();var B=(A(C).css("overflow")!="hidden");this.containment=[D.left+(parseInt(A(C).css("borderLeftWidth"),10)||0)-this.offset.relative.left-this.offset.parent.left-this.margins.left,D.top+(parseInt(A(C).css("borderTopWidth"),10)||0)-this.offset.relative.top-this.offset.parent.top-this.margins.top,D.left+(B?Math.max(C.scrollWidth,C.offsetWidth):C.offsetWidth)-(parseInt(A(C).css("borderLeftWidth"),10)||0)-this.offset.relative.left-this.offset.parent.left-this.margins.left,D.top+(B?Math.max(C.scrollHeight,C.offsetHeight):C.offsetHeight)-(parseInt(A(C).css("borderTopWidth"),10)||0)-this.offset.relative.top-this.offset.parent.top-this.margins.top]}},_convertPositionTo:function(D,F){if(!F){F=this.position}var C=D=="absolute"?1:-1;var B=this[(this.cssPosition=="absolute"?"offset":"scroll")+"Parent"],E=(/(html|body)/i).test(B[0].tagName);return{top:(F.top+this.offset.relative.top*C+this.offset.parent.top*C+(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():(E?0:B.scrollTop()))*C+this.margins.top*C),left:(F.left+this.offset.relative.left*C+this.offset.parent.left*C+(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():(E?0:B.scrollLeft()))*C+this.margins.left*C)}},_generatePosition:function(D){var G=this.options,C=this[(this.cssPosition=="absolute"?"offset":"scroll")+"Parent"],H=(/(html|body)/i).test(C[0].tagName);var B={top:(D.pageY-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():(H?0:C.scrollTop()))),left:(D.pageX-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():(H?0:C.scrollLeft())))};if(!this.originalPosition){return B}if(this.containment){if(B.left<this.containment[0]){B.left=this.containment[0]}if(B.top<this.containment[1]){B.top=this.containment[1]}if(B.left+this.helperProportions.width>this.containment[2]){B.left=this.containment[2]-this.helperProportions.width}if(B.top+this.helperProportions.height>this.containment[3]){B.top=this.containment[3]-this.helperProportions.height}}if(G.grid){var F=this.originalPosition.top+Math.round((B.top-this.originalPosition.top)/G.grid[1])*G.grid[1];B.top=this.containment?(!(F<this.containment[1]||F>this.containment[3])?F:(!(F<this.containment[1])?F-G.grid[1]:F+G.grid[1])):F;var E=this.originalPosition.left+Math.round((B.left-this.originalPosition.left)/G.grid[0])*G.grid[0];B.left=this.containment?(!(E<this.containment[0]||E>this.containment[2])?E:(!(E<this.containment[0])?E-G.grid[0]:E+G.grid[0])):E}return B},_rearrange:function(G,F,C,E){C?C[0].appendChild(this.placeholder[0]):F.item[0].parentNode.insertBefore(this.placeholder[0],(this.direction=="down"?F.item[0]:F.item[0].nextSibling));this.counter=this.counter?++this.counter:1;var D=this,B=this.counter;window.setTimeout(function(){if(B==D.counter){D.refreshPositions(!E)}},0)},_clear:function(C,D){this.reverting=false;if(!this._noFinalSort){this.placeholder.before(this.currentItem)}this._noFinalSort=null;if(this.helper[0]==this.currentItem[0]){for(var B in this._storedCSS){if(this._storedCSS[B]=="auto"||this._storedCSS[B]=="static"){this._storedCSS[B]=""}}this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else{this.currentItem.show()}if(this.domPosition.prev!=this.currentItem.prev().not(".ui-sortable-helper")[0]||this.domPosition.parent!=this.currentItem.parent()[0]){this._propagate("update",C,null,D)}if(!A.ui.contains(this.element[0],this.currentItem[0])){this._propagate("remove",C,null,D);for(var B=this.containers.length-1;B>=0;B--){if(A.ui.contains(this.containers[B].element[0],this.currentItem[0])){this.containers[B]._propagate("update",C,this,D);this.containers[B]._propagate("receive",C,this,D)}}}for(var B=this.containers.length-1;B>=0;B--){this.containers[B]._propagate("deactivate",C,this,D);if(this.containers[B].containerCache.over){this.containers[B]._propagate("out",C,this);this.containers[B].containerCache.over=0}}this.dragging=false;if(this.cancelHelperRemoval){this._propagate("beforeStop",C,null,D);this._propagate("stop",C,null,D);return false}this._propagate("beforeStop",C,null,D);this.placeholder[0].parentNode.removeChild(this.placeholder[0]);if(this.options.helper!="original"){this.helper.remove()}this.helper=null;this._propagate("stop",C,null,D);return true},_propagate:function(F,B,C,D){A.ui.plugin.call(this,F,[B,this._ui(C)]);var E=!D?this.element.triggerHandler(F=="sort"?F:"sort"+F,[B,this._ui(C)],this.options[F]):true;if(E===false){this.cancel()}},plugins:{},_ui:function(C){var B=C||this;return{helper:B.helper,placeholder:B.placeholder||A([]),position:B.position,absolutePosition:B.positionAbs,item:B.currentItem,sender:C?C.element:null}}}));A.extend(A.ui.sortable,{getter:"serialize toArray",version:"1.6",defaults:{accurateIntersection:true,appendTo:"parent",cancel:":input",delay:0,distance:1,dropOnEmpty:true,forcePlaceholderSize:false,forceHelperSize:false,helper:"original",items:"> *",scope:"default",scroll:true,scrollSensitivity:20,scrollSpeed:20,sortIndicator:A.ui.sortable.prototype._rearrange,tolerance:"default",zIndex:1000}});A.ui.plugin.add("sortable","cursor",{start:function(D,E){var C=A("body"),B=A(this).data("sortable");if(C.css("cursor")){B.options._cursor=C.css("cursor")}C.css("cursor",B.options.cursor)},beforeStop:function(C,D){var B=A(this).data("sortable");if(B.options._cursor){A("body").css("cursor",B.options._cursor)}}});A.ui.plugin.add("sortable","opacity",{start:function(D,E){var C=E.helper,B=A(this).data("sortable");if(C.css("opacity")){B.options._opacity=C.css("opacity")}C.css("opacity",B.options.opacity)},beforeStop:function(C,D){var B=A(this).data("sortable");if(B.options._opacity){A(D.helper).css("opacity",B.options._opacity)}}});A.ui.plugin.add("sortable","scroll",{start:function(C,D){var B=A(this).data("sortable"),E=B.options;if(B.scrollParent[0]!=document&&B.scrollParent[0].tagName!="HTML"){B.overflowOffset=B.scrollParent.offset()}},sort:function(D,E){var C=A(this).data("sortable"),F=C.options,B=false;if(C.scrollParent[0]!=document&&C.scrollParent[0].tagName!="HTML"){if((C.overflowOffset.top+C.scrollParent[0].offsetHeight)-D.pageY<F.scrollSensitivity){C.scrollParent[0].scrollTop=B=C.scrollParent[0].scrollTop+F.scrollSpeed}else{if(D.pageY-C.overflowOffset.top<F.scrollSensitivity){C.scrollParent[0].scrollTop=B=C.scrollParent[0].scrollTop-F.scrollSpeed}}if((C.overflowOffset.left+C.scrollParent[0].offsetWidth)-D.pageX<F.scrollSensitivity){C.scrollParent[0].scrollLeft=B=C.scrollParent[0].scrollLeft+F.scrollSpeed}else{if(D.pageX-C.overflowOffset.left<F.scrollSensitivity){C.scrollParent[0].scrollLeft=B=C.scrollParent[0].scrollLeft-F.scrollSpeed}}}else{if(D.pageY-A(document).scrollTop()<F.scrollSensitivity){B=A(document).scrollTop(A(document).scrollTop()-F.scrollSpeed)}else{if(A(window).height()-(D.pageY-A(document).scrollTop())<F.scrollSensitivity){B=A(document).scrollTop(A(document).scrollTop()+F.scrollSpeed)}}if(D.pageX-A(document).scrollLeft()<F.scrollSensitivity){B=A(document).scrollLeft(A(document).scrollLeft()-F.scrollSpeed)}else{if(A(window).width()-(D.pageX-A(document).scrollLeft())<F.scrollSensitivity){B=A(document).scrollLeft(A(document).scrollLeft()+F.scrollSpeed)}}}if(B!==false&&A.ui.ddmanager&&!F.dropBehaviour){A.ui.ddmanager.prepareOffsets(C,D)}if(B!==false&&C.cssPosition=="absolute"&&C.scrollParent[0]!=document&&A.ui.contains(C.scrollParent[0],C.offsetParent[0])){C.offset.parent=C._getParentOffset()}if(B!==false&&C.cssPosition=="relative"&&!(C.scrollParent[0]!=document&&C.scrollParent[0]!=C.offsetParent[0])){C.offset.relative=C._getRelativeOffset()}}});A.ui.plugin.add("sortable","zIndex",{start:function(D,E){var C=E.helper,B=A(this).data("sortable");if(C.css("zIndex")){B.options._zIndex=C.css("zIndex")}C.css("zIndex",B.options.zIndex)},beforeStop:function(C,D){var B=A(this).data("sortable");if(B.options._zIndex){A(D.helper).css("zIndex",B.options._zIndex=="auto"?"":B.options._zIndex)}}})})(jQuery);/* + * jQuery UI Accordion 1.6 + * + * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Accordion + * + * Depends: + * ui.core.js + */ +(function(E){E.widget("ui.accordion",{_init:function(){var H=this.options;if(H.navigation){var K=this.element.find("a").filter(H.navigationFilter);if(K.length){if(K.filter(H.header).length){H.active=K}else{H.active=K.parent().parent().prev();K.addClass("current")}}}H.headers=this.element.find(H.header);H.active=C(H.headers,H.active);if(E.browser.msie){this.element.find("a").css("zoom","1")}if(!this.element.hasClass("ui-accordion")){this.element.addClass("ui-accordion");E('<span class="ui-accordion-left"></span>').insertBefore(H.headers);E('<span class="ui-accordion-right"></span>').appendTo(H.headers);H.headers.addClass("ui-accordion-header")}var J;if(H.fillSpace){J=this.element.parent().height();H.headers.each(function(){J-=E(this).outerHeight()});var I=0;H.headers.next().each(function(){I=Math.max(I,E(this).innerHeight()-E(this).height())}).height(J-I)}else{if(H.autoHeight){J=0;H.headers.next().each(function(){J=Math.max(J,E(this).outerHeight())}).height(J)}}this.element.attr("role","tablist");var G=this;H.headers.attr("role","tab").bind("keydown",function(L){return G._keydown(L)}).next().attr("role","tabpanel");H.headers.not(H.active||"").attr("aria-expanded","false").attr("tabIndex","-1").next().hide();if(!H.active.length){H.headers.eq(0).attr("tabIndex","0")}else{H.active.attr("aria-expanded","true").attr("tabIndex","0").parent().andSelf().addClass(H.selectedClass)}if(!E.browser.safari){H.headers.find("a").attr("tabIndex","-1")}if(H.event){this.element.bind((H.event)+".accordion",F)}},destroy:function(){this.options.headers.parent().andSelf().removeClass(this.options.selectedClass);this.options.headers.prev(".ui-accordion-left").remove();this.options.headers.children(".ui-accordion-right").remove();this.options.headers.next().css("display","");if(this.options.fillSpace||this.options.autoHeight){this.options.headers.next().css("height","")}E.removeData(this.element[0],"accordion");this.element.removeClass("ui-accordion").unbind(".accordion")},_keydown:function(J){if(this.options.disabled||J.altKey||J.ctrlKey){return }var K=E.ui.keyCode;var I=this.options.headers.length;var G=this.options.headers.index(J.target);var H=false;switch(J.keyCode){case K.RIGHT:case K.DOWN:H=this.options.headers[(G+1)%I];break;case K.LEFT:case K.UP:H=this.options.headers[(G-1+I)%I];break;case K.SPACE:case K.ENTER:return F.call(this.element[0],{target:J.target})}if(H){E(J.target).attr("tabIndex","-1");E(H).attr("tabIndex","0");H.focus();return false}return true},activate:function(G){F.call(this.element[0],{target:C(this.options.headers,G)[0]})}});function B(H,G){return function(){return H.apply(G,arguments)}}function D(I){if(!E.data(this,"accordion")){return }var G=E.data(this,"accordion");var H=G.options;H.running=I?0:--H.running;if(H.running){return }if(H.clearStyle){H.toShow.add(H.toHide).css({height:"",overflow:""})}G._trigger("change",null,H.data)}function A(G,N,K,L,O){var Q=E.data(this,"accordion").options;Q.toShow=G;Q.toHide=N;Q.data=K;var H=B(D,this);E.data(this,"accordion")._trigger("changestart",null,Q.data);Q.running=N.size()===0?G.size():N.size();if(Q.animated){var J={};if(!Q.alwaysOpen&&L){J={toShow:E([]),toHide:N,complete:H,down:O,autoHeight:Q.autoHeight}}else{J={toShow:G,toHide:N,complete:H,down:O,autoHeight:Q.autoHeight}}if(!Q.proxied){Q.proxied=Q.animated}if(!Q.proxiedDuration){Q.proxiedDuration=Q.duration}Q.animated=E.isFunction(Q.proxied)?Q.proxied(J):Q.proxied;Q.duration=E.isFunction(Q.proxiedDuration)?Q.proxiedDuration(J):Q.proxiedDuration;var P=E.ui.accordion.animations,I=Q.duration,M=Q.animated;if(!P[M]){P[M]=function(R){this.slide(R,{easing:M,duration:I||700})}}P[M](J)}else{if(!Q.alwaysOpen&&L){G.toggle()}else{N.hide();G.show()}H(true)}N.prev().attr("aria-expanded","false").attr("tabIndex","-1");G.prev().attr("aria-expanded","true").attr("tabIndex","0").focus()}function F(L){var J=E.data(this,"accordion").options;if(J.disabled){return false}if(!L.target&&!J.alwaysOpen){J.active.parent().andSelf().toggleClass(J.selectedClass);var I=J.active.next(),M={options:J,newHeader:E([]),oldHeader:J.active,newContent:E([]),oldContent:I},G=(J.active=E([]));A.call(this,G,I,M);return false}var K=E(L.target);K=E(K.parents(J.header)[0]||K);var H=K[0]==J.active[0];if(J.running||(J.alwaysOpen&&H)){return false}if(!K.is(J.header)){return }J.active.parent().andSelf().toggleClass(J.selectedClass);if(!H){K.parent().andSelf().addClass(J.selectedClass)}var G=K.next(),I=J.active.next(),M={options:J,newHeader:H&&!J.alwaysOpen?E([]):K,oldHeader:J.active,newContent:H&&!J.alwaysOpen?E([]):G,oldContent:I},N=J.headers.index(J.active[0])>J.headers.index(K[0]);J.active=H?E([]):K;A.call(this,G,I,M,H,N);return false}function C(H,G){return G?typeof G=="number"?H.filter(":eq("+G+")"):H.not(H.not(G)):G===false?E([]):H.filter(":eq(0)")}E.extend(E.ui.accordion,{version:"1.6",defaults:{autoHeight:true,alwaysOpen:true,animated:"slide",event:"click",header:"a",navigationFilter:function(){return this.href.toLowerCase()==location.href.toLowerCase()},running:0,selectedClass:"selected"},animations:{slide:function(G,J){G=E.extend({easing:"swing",duration:300},G,J);if(!G.toHide.size()){G.toShow.animate({height:"show"},G);return }var I=G.toHide.height(),L=G.toShow.height(),N=L/I,K=G.toShow.outerHeight()-G.toShow.height(),H=G.toShow.css("marginBottom"),M=G.toShow.css("overflow");tmargin=G.toShow.css("marginTop");G.toShow.css({height:0,overflow:"hidden",marginTop:0,marginBottom:-K}).show();G.toHide.filter(":hidden").each(G.complete).end().filter(":visible").animate({height:"hide"},{step:function(O){var P=(I-O)*N;if(E.browser.msie||E.browser.opera){P=Math.ceil(P)}G.toShow.height(P)},duration:G.duration,easing:G.easing,complete:function(){if(!G.autoHeight){G.toShow.css("height","auto")}G.toShow.css({marginTop:tmargin,marginBottom:H,overflow:M});G.complete()}})},bounceslide:function(G){this.slide(G,{easing:G.down?"easeOutBounce":"swing",duration:G.down?1000:200})},easeslide:function(G){this.slide(G,{easing:"easeinout",duration:700})}}})})(jQuery);/* + * jQuery UI Dialog 1.6 + * + * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Dialog + * + * Depends: + * ui.core.js + * ui.draggable.js + * ui.resizable.js + */ +(function(B){var A={dragStart:"start.draggable",drag:"drag.draggable",dragStop:"stop.draggable",maxHeight:"maxHeight.resizable",minHeight:"minHeight.resizable",maxWidth:"maxWidth.resizable",minWidth:"minWidth.resizable",resizeStart:"start.resizable",resize:"drag.resizable",resizeStop:"stop.resizable"};B.widget("ui.dialog",{_init:function(){this.originalTitle=this.element.attr("title");this.options.title=this.options.title||this.originalTitle;var M=this,N=this.options,F=this.element.removeAttr("title").addClass("ui-dialog-content").wrap("<div></div>").wrap("<div></div>"),I=(this.uiDialogContainer=F.parent()).addClass("ui-dialog-container").css({position:"relative",width:"100%",height:"100%"}),E=(this.uiDialogTitlebar=B("<div></div>")).addClass("ui-dialog-titlebar").mousedown(function(){M.moveToTop()}).prependTo(I),J=B('<a href="#"/>').addClass("ui-dialog-titlebar-close").attr("role","button").appendTo(E),G=(this.uiDialogTitlebarCloseText=B("<span/>")).text(N.closeText).appendTo(J),L=N.title||" ",D=B.ui.dialog.getTitleId(this.element),C=B("<span/>").addClass("ui-dialog-title").attr("id",D).html(L).prependTo(E),K=(this.uiDialog=I.parent()).appendTo(document.body).hide().addClass("ui-dialog").addClass(N.dialogClass).css({position:"absolute",width:N.width,height:N.height,overflow:"hidden",zIndex:N.zIndex}).attr("tabIndex",-1).css("outline",0).keydown(function(O){(N.closeOnEscape&&O.keyCode&&O.keyCode==B.ui.keyCode.ESCAPE&&M.close())}).attr({role:"dialog","aria-labelledby":D}).mouseup(function(){M.moveToTop()}),H=(this.uiDialogButtonPane=B("<div></div>")).addClass("ui-dialog-buttonpane").css({position:"absolute",bottom:0}).appendTo(K),J=B(".ui-dialog-titlebar-close",E).hover(function(){B(this).addClass("ui-dialog-titlebar-close-hover")},function(){B(this).removeClass("ui-dialog-titlebar-close-hover")}).mousedown(function(O){O.stopPropagation()}).click(function(){M.close();return false});E.find("*").add(E).disableSelection();(N.draggable&&B.fn.draggable&&this._makeDraggable());(N.resizable&&B.fn.resizable&&this._makeResizable());this._createButtons(N.buttons);this._isOpen=false;(N.bgiframe&&B.fn.bgiframe&&K.bgiframe());(N.autoOpen&&this.open())},destroy:function(){(this.overlay&&this.overlay.destroy());this.uiDialog.hide();this.element.unbind(".dialog").removeData("dialog").removeClass("ui-dialog-content").hide().appendTo("body");this.uiDialog.remove();(this.originalTitle&&this.element.attr("title",this.originalTitle))},close:function(){if(false===this._trigger("beforeclose",null,{options:this.options})){return }(this.overlay&&this.overlay.destroy());this.uiDialog.hide(this.options.hide).unbind("keypress.ui-dialog");this._trigger("close",null,{options:this.options});B.ui.dialog.overlay.resize();this._isOpen=false},isOpen:function(){return this._isOpen},moveToTop:function(F){if((this.options.modal&&!F)||(!this.options.stack&&!this.options.modal)){return this._trigger("focus",null,{options:this.options})}var E=this.options.zIndex,D=this.options;B(".ui-dialog:visible").each(function(){E=Math.max(E,parseInt(B(this).css("z-index"),10)||D.zIndex)});(this.overlay&&this.overlay.$el.css("z-index",++E));var C={scrollTop:this.element.attr("scrollTop"),scrollLeft:this.element.attr("scrollLeft")};this.uiDialog.css("z-index",++E);this.element.attr(C);this._trigger("focus",null,{options:this.options})},open:function(){if(this._isOpen){return }this.overlay=this.options.modal?new B.ui.dialog.overlay(this):null;(this.uiDialog.next().length&&this.uiDialog.appendTo("body"));this._position(this.options.position);this.uiDialog.show(this.options.show);(this.options.autoResize&&this._size());this.moveToTop(true);(this.options.modal&&this.uiDialog.bind("keypress.ui-dialog",function(E){if(E.keyCode!=B.ui.keyCode.TAB){return }var D=B(":tabbable",this),F=D.filter(":first")[0],C=D.filter(":last")[0];if(E.target==C&&!E.shiftKey){setTimeout(function(){F.focus()},1)}else{if(E.target==F&&E.shiftKey){setTimeout(function(){C.focus()},1)}}}));this.uiDialog.find(":tabbable:first").focus();this._trigger("open",null,{options:this.options});this._isOpen=true},_createButtons:function(F){var E=this,C=false,D=this.uiDialogButtonPane;D.empty().hide();B.each(F,function(){return !(C=true)});if(C){D.show();B.each(F,function(G,H){B('<button type="button"></button>').text(G).click(function(){H.apply(E.element[0],arguments)}).appendTo(D)})}},_makeDraggable:function(){var C=this,D=this.options;this.uiDialog.draggable({cancel:".ui-dialog-content",helper:D.dragHelper,handle:".ui-dialog-titlebar",start:function(){C.moveToTop();(D.dragStart&&D.dragStart.apply(C.element[0],arguments))},drag:function(){(D.drag&&D.drag.apply(C.element[0],arguments))},stop:function(){(D.dragStop&&D.dragStop.apply(C.element[0],arguments));B.ui.dialog.overlay.resize()}})},_makeResizable:function(F){F=(F===undefined?this.options.resizable:F);var C=this,E=this.options,D=typeof F=="string"?F:"n,e,s,w,se,sw,ne,nw";this.uiDialog.resizable({cancel:".ui-dialog-content",helper:E.resizeHelper,maxWidth:E.maxWidth,maxHeight:E.maxHeight,minWidth:E.minWidth,minHeight:E.minHeight,start:function(){(E.resizeStart&&E.resizeStart.apply(C.element[0],arguments))},resize:function(){(E.autoResize&&C._size.apply(C));(E.resize&&E.resize.apply(C.element[0],arguments))},handles:D,stop:function(){(E.autoResize&&C._size.apply(C));(E.resizeStop&&E.resizeStop.apply(C.element[0],arguments));B.ui.dialog.overlay.resize()}})},_position:function(H){var D=B(window),E=B(document),F=E.scrollTop(),C=E.scrollLeft(),G=F;if(B.inArray(H,["center","top","right","bottom","left"])>=0){H=[H=="right"||H=="left"?H:"center",H=="top"||H=="bottom"?H:"middle"]}if(H.constructor!=Array){H=["center","middle"]}if(H[0].constructor==Number){C+=H[0]}else{switch(H[0]){case"left":C+=0;break;case"right":C+=D.width()-this.uiDialog.outerWidth();break;default:case"center":C+=(D.width()-this.uiDialog.outerWidth())/2}}if(H[1].constructor==Number){F+=H[1]}else{switch(H[1]){case"top":F+=0;break;case"bottom":F+=(B.browser.opera?window.innerHeight:D.height())-this.uiDialog.outerHeight();break;default:case"middle":F+=((B.browser.opera?window.innerHeight:D.height())-this.uiDialog.outerHeight())/2}}F=Math.max(F,G);this.uiDialog.css({top:F,left:C})},_setData:function(D,E){(A[D]&&this.uiDialog.data(A[D],E));switch(D){case"buttons":this._createButtons(E);break;case"closeText":this.uiDialogTitlebarCloseText.text(E);break;case"draggable":(E?this._makeDraggable():this.uiDialog.draggable("destroy"));break;case"height":this.uiDialog.height(E);break;case"position":this._position(E);break;case"resizable":var C=this.uiDialog,F=this.uiDialog.is(":data(resizable)");(F&&!E&&C.resizable("destroy"));(F&&typeof E=="string"&&C.resizable("option","handles",E));(F||this._makeResizable(E));break;case"title":B(".ui-dialog-title",this.uiDialogTitlebar).html(E||" ");break;case"width":this.uiDialog.width(E);break}B.widget.prototype._setData.apply(this,arguments)},_size:function(){var D=this.uiDialogContainer,G=this.uiDialogTitlebar,E=this.element,F=(parseInt(E.css("margin-top"),10)||0)+(parseInt(E.css("margin-bottom"),10)||0),C=(parseInt(E.css("margin-left"),10)||0)+(parseInt(E.css("margin-right"),10)||0);E.height(D.height()-G.outerHeight()-F);E.width(D.width()-C)}});B.extend(B.ui.dialog,{version:"1.6",defaults:{autoOpen:true,autoResize:true,bgiframe:false,buttons:{},closeOnEscape:true,closeText:"close",draggable:true,height:200,minHeight:100,minWidth:150,modal:false,overlay:{},position:"center",resizable:true,stack:true,width:300,zIndex:1000},getter:"isOpen",uuid:0,getTitleId:function(C){return"ui-dialog-title-"+(C.attr("id")||++this.uuid)},overlay:function(C){this.$el=B.ui.dialog.overlay.create(C)}});B.extend(B.ui.dialog.overlay,{instances:[],events:B.map("focus,mousedown,mouseup,keydown,keypress,click".split(","),function(C){return C+".dialog-overlay"}).join(" "),create:function(D){if(this.instances.length===0){setTimeout(function(){B("a, :input").bind(B.ui.dialog.overlay.events,function(){var F=false;var H=B(this).parents(".ui-dialog");if(H.length){var E=B(".ui-dialog-overlay");if(E.length){var G=parseInt(E.css("z-index"),10);E.each(function(){G=Math.max(G,parseInt(B(this).css("z-index"),10))});F=parseInt(H.css("z-index"),10)>G}else{F=true}}return F})},1);B(document).bind("keydown.dialog-overlay",function(E){(D.options.closeOnEscape&&E.keyCode&&E.keyCode==B.ui.keyCode.ESCAPE&&D.close())});B(window).bind("resize.dialog-overlay",B.ui.dialog.overlay.resize)}var C=B("<div></div>").appendTo(document.body).addClass("ui-dialog-overlay").css(B.extend({borderWidth:0,margin:0,padding:0,position:"absolute",top:0,left:0,width:this.width(),height:this.height()},D.options.overlay));(D.options.bgiframe&&B.fn.bgiframe&&C.bgiframe());this.instances.push(C);return C},destroy:function(C){this.instances.splice(B.inArray(this.instances,C),1);if(this.instances.length===0){B("a, :input").add([document,window]).unbind(".dialog-overlay")}C.remove()},height:function(){if(B.browser.msie&&B.browser.version<7){var D=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight);var C=Math.max(document.documentElement.offsetHeight,document.body.offsetHeight);if(D<C){return B(window).height()+"px"}else{return D+"px"}}else{if(B.browser.opera){return Math.max(window.innerHeight,B(document).height())+"px"}else{return B(document).height()+"px"}}},width:function(){if(B.browser.msie&&B.browser.version<7){var C=Math.max(document.documentElement.scrollWidth,document.body.scrollWidth);var D=Math.max(document.documentElement.offsetWidth,document.body.offsetWidth);if(C<D){return B(window).width()+"px"}else{return C+"px"}}else{if(B.browser.opera){return Math.max(window.innerWidth,B(document).width())+"px"}else{return B(document).width()+"px"}}},resize:function(){var C=B([]);B.each(B.ui.dialog.overlay.instances,function(){C=C.add(this)});C.css({width:0,height:0}).css({width:B.ui.dialog.overlay.width(),height:B.ui.dialog.overlay.height()})}});B.extend(B.ui.dialog.overlay.prototype,{destroy:function(){B.ui.dialog.overlay.destroy(this.$el)}})})(jQuery);/* + * jQuery UI Slider 1.6 + * + * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Slider + * + * Depends: + * ui.core.js + */ +(function(A){A.fn.unwrap=A.fn.unwrap||function(B){return this.each(function(){A(this).parents(B).eq(0).after(this).remove()})};A.widget("ui.slider",{_init:function(){var B=this;this.element.addClass("ui-slider");this._initBoundaries();this.handle=A(this.options.handle,this.element);if(!this.handle.length){B.handle=B.generated=A(B.options.handles||[0]).map(function(){var D=A("<div/>").addClass("ui-slider-handle").appendTo(B.element);if(this.id){D.attr("id",this.id)}return D[0]})}var C=function(D){this.element=A(D);this.element.data("mouse",this);this.options=B.options;this.element.bind("mousedown",function(){if(B.currentHandle){this.blur(B.currentHandle)}B._focus(this,true)});this._mouseInit()};A.extend(C.prototype,A.ui.mouse,{_mouseCapture:function(){return true},_mouseStart:function(D){return B._start.call(B,D,this.element[0])},_mouseDrag:function(D){return B._drag.call(B,D,this.element[0])},_mouseStop:function(D){return B._stop.call(B,D,this.element[0])},trigger:function(D){this._mouseDown(D)}});A(this.handle).each(function(){new C(this)}).wrap('<a href="#" style="outline:none;border:none;"></a>').parent().bind("click",function(){return false}).bind("focus",function(D){B._focus(this.firstChild)}).bind("blur",function(D){B._blur(this.firstChild)}).bind("keydown",function(D){if(!B.options.noKeyboard){return B._keydown(D.keyCode,this.firstChild)}});this.element.bind("mousedown.slider",function(D){if(A(D.target).is(".ui-slider-handle")){return }B._click.apply(B,[D]);B.currentHandle.data("mouse").trigger(D);B.firstValue=B.firstValue+1});A.each(this.options.handles||[],function(D,E){B.moveTo(E.start,D,true)});if(!isNaN(this.options.startValue)){this.moveTo(this.options.startValue,0,true)}this.previousHandle=A(this.handle[0]);if(this.handle.length==2&&this.options.range){this._createRange()}},destroy:function(){this.element.removeClass("ui-slider ui-slider-disabled").removeData("slider").unbind(".slider");if(this.handle&&this.handle.length){this.handle.unwrap("a");this.handle.each(function(){var B=A(this).data("mouse");B&&B._mouseDestroy()})}this.generated&&this.generated.remove()},_start:function(B,C){var D=this.options;if(D.disabled){return false}this.actualSize={width:this.element.outerWidth(),height:this.element.outerHeight()};if(!this.currentHandle){this._focus(this.previousHandle,true)}this.offset=this.element.offset();this.handleOffset=this.currentHandle.offset();this.clickOffset={top:B.pageY-this.handleOffset.top,left:B.pageX-this.handleOffset.left};this.firstValue=this.value();this._propagate("start",B);this._drag(B,C);return true},_drag:function(C,E){var F=this.options;var B={top:C.pageY-this.offset.top-this.clickOffset.top,left:C.pageX-this.offset.left-this.clickOffset.left};if(!this.currentHandle){this._focus(this.previousHandle,true)}B.left=this._translateLimits(B.left,"x");B.top=this._translateLimits(B.top,"y");if(F.stepping.x){var D=this._convertValue(B.left,"x");D=this._round(D/F.stepping.x)*F.stepping.x;B.left=this._translateValue(D,"x")}if(F.stepping.y){var D=this._convertValue(B.top,"y");D=this._round(D/F.stepping.y)*F.stepping.y;B.top=this._translateValue(D,"y")}B.left=this._translateRange(B.left,"x");B.top=this._translateRange(B.top,"y");if(F.axis!="vertical"){this.currentHandle.css({left:B.left})}if(F.axis!="horizontal"){this.currentHandle.css({top:B.top})}this.currentHandle.data("mouse").sliderValue={x:this._round(this._convertValue(B.left,"x"))||0,y:this._round(this._convertValue(B.top,"y"))||0};if(this.rangeElement){this._updateRange()}this._propagate("slide",C);return false},_stop:function(B){this._propagate("stop",B);if(this.firstValue!=this.value()){this._propagate("change",B)}this._focus(this.currentHandle,true);return false},_round:function(B){return this.options.round?parseInt(B,10):parseFloat(B)},_setData:function(B,C){A.widget.prototype._setData.apply(this,arguments);if(/min|max|steps/.test(B)){this._initBoundaries()}if(B=="range"){C?this.handle.length==2&&this._createRange():this._removeRange()}},_initBoundaries:function(){var B=this.element[0],C=this.options;this.actualSize={width:this.element.outerWidth(),height:this.element.outerHeight()};A.extend(C,{axis:C.axis||(B.offsetWidth<B.offsetHeight?"vertical":"horizontal"),max:!isNaN(parseInt(C.max,10))?{x:parseInt(C.max,10),y:parseInt(C.max,10)}:({x:C.max&&C.max.x||100,y:C.max&&C.max.y||100}),min:!isNaN(parseInt(C.min,10))?{x:parseInt(C.min,10),y:parseInt(C.min,10)}:({x:C.min&&C.min.x||0,y:C.min&&C.min.y||0})});C.realMax={x:C.max.x-C.min.x,y:C.max.y-C.min.y};C.stepping={x:C.stepping&&C.stepping.x||parseInt(C.stepping,10)||(C.steps?C.realMax.x/(C.steps.x||parseInt(C.steps,10)||C.realMax.x):0),y:C.stepping&&C.stepping.y||parseInt(C.stepping,10)||(C.steps?C.realMax.y/(C.steps.y||parseInt(C.steps,10)||C.realMax.y):0)}},_keydown:function(F,E){if(this.options.disabled){return }var C=F;if(/(33|34|35|36|37|38|39|40)/.test(C)){var G=this.options,B,I;if(/(35|36)/.test(C)){B=(C==35)?G.max.x:G.min.x;I=(C==35)?G.max.y:G.min.y}else{var H=/(34|37|40)/.test(C)?"-=":"+=";var D=/(37|38|39|40)/.test(C)?"_oneStep":"_pageStep";B=H+this[D]("x");I=H+this[D]("y")}this.moveTo({x:B,y:I},E);return false}return true},_focus:function(B,C){this.currentHandle=A(B).addClass("ui-slider-handle-active");if(C){this.currentHandle.parent()[0].focus()}},_blur:function(B){A(B).removeClass("ui-slider-handle-active");if(this.currentHandle&&this.currentHandle[0]==B){this.previousHandle=this.currentHandle;this.currentHandle=null}},_click:function(C){var D=[C.pageX,C.pageY];var B=false;this.handle.each(function(){if(this==C.target){B=true}});if(B||this.options.disabled||!(this.currentHandle||this.previousHandle)){return }if(!this.currentHandle&&this.previousHandle){this._focus(this.previousHandle,true)}this.offset=this.element.offset();this.moveTo({y:this._convertValue(C.pageY-this.offset.top-this.currentHandle[0].offsetHeight/2,"y"),x:this._convertValue(C.pageX-this.offset.left-this.currentHandle[0].offsetWidth/2,"x")},null,!this.options.distance)},_createRange:function(){if(this.rangeElement){return }this.rangeElement=A("<div></div>").addClass("ui-slider-range").css({position:"absolute"}).appendTo(this.element);this._updateRange()},_removeRange:function(){this.rangeElement.remove();this.rangeElement=null},_updateRange:function(){var C=this.options.axis=="vertical"?"top":"left";var B=this.options.axis=="vertical"?"height":"width";this.rangeElement.css(C,(this._round(A(this.handle[0]).css(C))||0)+this._handleSize(0,this.options.axis=="vertical"?"y":"x")/2);this.rangeElement.css(B,(this._round(A(this.handle[1]).css(C))||0)-(this._round(A(this.handle[0]).css(C))||0))},_getRange:function(){return this.rangeElement?this._convertValue(this._round(this.rangeElement.css(this.options.axis=="vertical"?"height":"width")),this.options.axis=="vertical"?"y":"x"):null},_handleIndex:function(){return this.handle.index(this.currentHandle[0])},value:function(D,B){if(this.handle.length==1){this.currentHandle=this.handle}if(!B){B=this.options.axis=="vertical"?"y":"x"}var C=A(D!=undefined&&D!==null?this.handle[D]||D:this.currentHandle);if(C.data("mouse").sliderValue){return this._round(C.data("mouse").sliderValue[B])}else{return this._round(((this._round(C.css(B=="x"?"left":"top"))/(this.actualSize[B=="x"?"width":"height"]-this._handleSize(D,B)))*this.options.realMax[B])+this.options.min[B])}},_convertValue:function(C,B){return this.options.min[B]+(C/(this.actualSize[B=="x"?"width":"height"]-this._handleSize(null,B)))*this.options.realMax[B]},_translateValue:function(C,B){return((C-this.options.min[B])/this.options.realMax[B])*(this.actualSize[B=="x"?"width":"height"]-this._handleSize(null,B))},_translateRange:function(D,B){if(this.rangeElement){if(this.currentHandle[0]==this.handle[0]&&D>=this._translateValue(this.value(1),B)){D=this._translateValue(this.value(1,B)-this._oneStep(B),B)}if(this.currentHandle[0]==this.handle[1]&&D<=this._translateValue(this.value(0),B)){D=this._translateValue(this.value(0,B)+this._oneStep(B),B)}}if(this.options.handles){var C=this.options.handles[this._handleIndex()];if(D<this._translateValue(C.min,B)){D=this._translateValue(C.min,B)}else{if(D>this._translateValue(C.max,B)){D=this._translateValue(C.max,B)}}}return D},_translateLimits:function(C,B){if(C>=this.actualSize[B=="x"?"width":"height"]-this._handleSize(null,B)){C=this.actualSize[B=="x"?"width":"height"]-this._handleSize(null,B)}if(C<=0){C=0}return C},_handleSize:function(C,B){return A(C!=undefined&&C!==null?this.handle[C]:this.currentHandle)[0]["offset"+(B=="x"?"Width":"Height")]},_oneStep:function(B){return this.options.stepping[B]||1},_pageStep:function(B){return 10},moveTo:function(F,E,G){var H=this.options;this.actualSize={width:this.element.outerWidth(),height:this.element.outerHeight()};if(E==undefined&&!this.currentHandle&&this.handle.length!=1){return false}if(E==undefined&&!this.currentHandle){E=0}if(E!=undefined){this.currentHandle=this.previousHandle=A(this.handle[E]||E)}if(F.x!==undefined&&F.y!==undefined){var B=F.x,I=F.y}else{var B=F,I=F}if(B!==undefined&&B.constructor!=Number){var D=/^\-\=/.test(B),C=/^\+\=/.test(B);if(D||C){B=this.value(null,"x")+this._round(B.replace(D?"=":"+=",""))}else{B=isNaN(this._round(B))?undefined:this._round(B)}}if(I!==undefined&&I.constructor!=Number){var D=/^\-\=/.test(I),C=/^\+\=/.test(I);if(D||C){I=this.value(null,"y")+this._round(I.replace(D?"=":"+=",""))}else{I=isNaN(this._round(I))?undefined:this._round(I)}}if(H.axis!="vertical"&&B!==undefined){if(H.stepping.x){B=this._round(B/H.stepping.x)*H.stepping.x}B=this._translateValue(B,"x");B=this._translateLimits(B,"x");B=this._translateRange(B,"x");H.animate?this.currentHandle.stop().animate({left:B},(Math.abs(parseInt(this.currentHandle.css("left"),10)-B))*(!isNaN(parseInt(H.animate,10))?H.animate:5)):this.currentHandle.css({left:B})}if(H.axis!="horizontal"&&I!==undefined){if(H.stepping.y){I=this._round(I/H.stepping.y)*H.stepping.y}I=this._translateValue(I,"y");I=this._translateLimits(I,"y");I=this._translateRange(I,"y");H.animate?this.currentHandle.stop().animate({top:I},(Math.abs(parseInt(this.currentHandle.css("top"),10)-I))*(!isNaN(parseInt(H.animate,10))?H.animate:5)):this.currentHandle.css({top:I})}if(this.rangeElement){this._updateRange()}this.currentHandle.data("mouse").sliderValue={x:this._round(this._convertValue(B,"x"))||0,y:this._round(this._convertValue(I,"y"))||0};if(!G){this._propagate("start",null);this._propagate("slide",null);this._propagate("stop",null);this._propagate("change",null)}},_propagate:function(C,B){A.ui.plugin.call(this,C,[B,this.ui()]);this.element.triggerHandler(C=="slide"?C:"slide"+C,[B,this.ui()],this.options[C])},plugins:{},ui:function(B){return{options:this.options,handle:this.currentHandle,value:this.options.axis!="both"||!this.options.axis?this._round(this.value(null,this.options.axis=="vertical"?"y":"x")):{x:this._round(this.value(null,"x")),y:this._round(this.value(null,"y"))},range:this._getRange()}}});A.extend(A.ui.slider,{getter:"value",version:"1.6",defaults:{animate:false,distance:1,handle:".ui-slider-handle",round:true}})})(jQuery);/* + * jQuery UI Tabs 1.6 + * + * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Tabs + * + * Depends: + * ui.core.js + */ +(function(A){A.widget("ui.tabs",{_init:function(){this._tabify(true)},destroy:function(){var B=this.options;this.element.unbind(".tabs").removeClass(B.navClass).removeData("tabs");this.$tabs.each(function(){var C=A.data(this,"href.tabs");if(C){this.href=C}var D=A(this).unbind(".tabs");A.each(["href","load","cache"],function(E,F){D.removeData(F+".tabs")})});this.$lis.add(this.$panels).each(function(){if(A.data(this,"destroy.tabs")){A(this).remove()}else{A(this).removeClass([B.selectedClass,B.deselectableClass,B.disabledClass,B.panelClass,B.hideClass].join(" "))}});if(B.cookie){this._cookie(null,B.cookie)}},_setData:function(B,C){if((/^selected/).test(B)){this.select(C)}else{this.options[B]=C;this._tabify()}},length:function(){return this.$tabs.length},_tabId:function(B){return B.title&&B.title.replace(/\s/g,"_").replace(/[^A-Za-z0-9\-_:\.]/g,"")||this.options.idPrefix+A.data(B)},_sanitizeSelector:function(B){return B.replace(/:/g,"\\:")},_cookie:function(){var B=this.cookie||(this.cookie="ui-tabs-"+A.data(this.element[0]));return A.cookie.apply(null,[B].concat(A.makeArray(arguments)))},_tabify:function(N){this.$lis=A("li:has(a[href])",this.element);this.$tabs=this.$lis.map(function(){return A("a",this)[0]});this.$panels=A([]);var O=this,C=this.options;this.$tabs.each(function(Q,P){if(P.hash&&P.hash.replace("#","")){O.$panels=O.$panels.add(O._sanitizeSelector(P.hash))}else{if(A(P).attr("href")!="#"){A.data(P,"href.tabs",P.href);A.data(P,"load.tabs",P.href);var S=O._tabId(P);P.href="#"+S;var R=A("#"+S);if(!R.length){R=A(C.panelTemplate).attr("id",S).addClass(C.panelClass).insertAfter(O.$panels[Q-1]||O.element);R.data("destroy.tabs",true)}O.$panels=O.$panels.add(R)}else{C.disabled.push(Q+1)}}});if(N){this.element.addClass(C.navClass);this.$panels.addClass(C.panelClass);if(C.selected===undefined){if(location.hash){this.$tabs.each(function(Q,P){if(P.hash==location.hash){C.selected=Q;return false}})}else{if(C.cookie){var I=parseInt(O._cookie(),10);if(I&&O.$tabs[I]){C.selected=I}}else{if(O.$lis.filter("."+C.selectedClass).length){C.selected=O.$lis.index(O.$lis.filter("."+C.selectedClass)[0])}}}}C.selected=C.selected===null||C.selected!==undefined?C.selected:0;C.disabled=A.unique(C.disabled.concat(A.map(this.$lis.filter("."+C.disabledClass),function(Q,P){return O.$lis.index(Q)}))).sort();if(A.inArray(C.selected,C.disabled)!=-1){C.disabled.splice(A.inArray(C.selected,C.disabled),1)}this.$panels.addClass(C.hideClass);this.$lis.removeClass(C.selectedClass);if(C.selected!==null){this.$panels.eq(C.selected).removeClass(C.hideClass);var E=[C.selectedClass];if(C.deselectable){E.push(C.deselectableClass)}this.$lis.eq(C.selected).addClass(E.join(" "));var J=function(){O._trigger("show",null,O.ui(O.$tabs[C.selected],O.$panels[C.selected]))};if(A.data(this.$tabs[C.selected],"load.tabs")){this.load(C.selected,J)}else{J()}}A(window).bind("unload",function(){O.$tabs.unbind(".tabs");O.$lis=O.$tabs=O.$panels=null})}else{C.selected=this.$lis.index(this.$lis.filter("."+C.selectedClass)[0])}if(C.cookie){this._cookie(C.selected,C.cookie)}for(var G=0,M;M=this.$lis[G];G++){A(M)[A.inArray(G,C.disabled)!=-1&&!A(M).hasClass(C.selectedClass)?"addClass":"removeClass"](C.disabledClass)}if(C.cache===false){this.$tabs.removeData("cache.tabs")}var B,H;if(C.fx){if(C.fx.constructor==Array){B=C.fx[0];H=C.fx[1]}else{B=H=C.fx}}function D(P,Q){P.css({display:""});if(A.browser.msie&&Q.opacity){P[0].style.removeAttribute("filter")}}var K=H?function(P,Q){Q.animate(H,H.duration||"normal",function(){Q.removeClass(C.hideClass);D(Q,H);O._trigger("show",null,O.ui(P,Q[0]))})}:function(P,Q){Q.removeClass(C.hideClass);O._trigger("show",null,O.ui(P,Q[0]))};var L=B?function(Q,P,R){P.animate(B,B.duration||"normal",function(){P.addClass(C.hideClass);D(P,B);if(R){K(Q,R,P)}})}:function(Q,P,R){P.addClass(C.hideClass);if(R){K(Q,R)}};function F(R,T,P,S){var Q=[C.selectedClass];if(C.deselectable){Q.push(C.deselectableClass)}T.addClass(Q.join(" ")).siblings().removeClass(Q.join(" "));L(R,P,S)}this.$tabs.unbind(".tabs").bind(C.event+".tabs",function(){var S=A(this).parents("li:eq(0)"),P=O.$panels.filter(":visible"),R=A(O._sanitizeSelector(this.hash));if((S.hasClass(C.selectedClass)&&!C.deselectable)||S.hasClass(C.disabledClass)||A(this).hasClass(C.loadingClass)||O._trigger("select",null,O.ui(this,R[0]))===false){this.blur();return false}C.selected=O.$tabs.index(this);if(C.deselectable){if(S.hasClass(C.selectedClass)){O.options.selected=null;S.removeClass([C.selectedClass,C.deselectableClass].join(" "));O.$panels.stop();L(this,P);this.blur();return false}else{if(!P.length){O.$panels.stop();var Q=this;O.load(O.$tabs.index(this),function(){S.addClass([C.selectedClass,C.deselectableClass].join(" "));K(Q,R)});this.blur();return false}}}if(C.cookie){O._cookie(C.selected,C.cookie)}O.$panels.stop();if(R.length){var Q=this;O.load(O.$tabs.index(this),P.length?function(){F(Q,S,P,R)}:function(){S.addClass(C.selectedClass);K(Q,R)})}else{throw"jQuery UI Tabs: Mismatching fragment identifier."}if(A.browser.msie){this.blur()}return false});if(C.event!="click"){this.$tabs.bind("click.tabs",function(){return false})}},add:function(E,D,C){if(C==undefined){C=this.$tabs.length}var G=this.options;var I=A(G.tabTemplate.replace(/#\{href\}/g,E).replace(/#\{label\}/g,D));I.data("destroy.tabs",true);var H=E.indexOf("#")==0?E.replace("#",""):this._tabId(A("a:first-child",I)[0]);var F=A("#"+H);if(!F.length){F=A(G.panelTemplate).attr("id",H).addClass(G.hideClass).data("destroy.tabs",true)}F.addClass(G.panelClass);if(C>=this.$lis.length){I.appendTo(this.element);F.appendTo(this.element[0].parentNode)}else{I.insertBefore(this.$lis[C]);F.insertBefore(this.$panels[C])}G.disabled=A.map(G.disabled,function(K,J){return K>=C?++K:K});this._tabify();if(this.$tabs.length==1){I.addClass(G.selectedClass);F.removeClass(G.hideClass);var B=A.data(this.$tabs[0],"load.tabs");if(B){this.load(C,B)}}this._trigger("add",null,this.ui(this.$tabs[C],this.$panels[C]))},remove:function(B){var D=this.options,E=this.$lis.eq(B).remove(),C=this.$panels.eq(B).remove();if(E.hasClass(D.selectedClass)&&this.$tabs.length>1){this.select(B+(B+1<this.$tabs.length?1:-1))}D.disabled=A.map(A.grep(D.disabled,function(G,F){return G!=B}),function(G,F){return G>=B?--G:G});this._tabify();this._trigger("remove",null,this.ui(E.find("a")[0],C[0]))},enable:function(B){var C=this.options;if(A.inArray(B,C.disabled)==-1){return }var D=this.$lis.eq(B).removeClass(C.disabledClass);if(A.browser.safari){D.css("display","inline-block");setTimeout(function(){D.css("display","block")},0)}C.disabled=A.grep(C.disabled,function(F,E){return F!=B});this._trigger("enable",null,this.ui(this.$tabs[B],this.$panels[B]))},disable:function(C){var B=this,D=this.options;if(C!=D.selected){this.$lis.eq(C).addClass(D.disabledClass);D.disabled.push(C);D.disabled.sort();this._trigger("disable",null,this.ui(this.$tabs[C],this.$panels[C]))}},select:function(B){if(typeof B=="string"){B=this.$tabs.index(this.$tabs.filter("[href$="+B+"]")[0])}this.$tabs.eq(B).trigger(this.options.event+".tabs")},load:function(G,K){var L=this,D=this.options,E=this.$tabs.eq(G),J=E[0],H=K==undefined||K===false,B=E.data("load.tabs");K=K||function(){};if(!B||!H&&A.data(J,"cache.tabs")){K();return }var M=function(N){var O=A(N),P=O.find("*:last");return P.length&&P.is(":not(img)")&&P||O};var C=function(){L.$tabs.filter("."+D.loadingClass).removeClass(D.loadingClass).each(function(){if(D.spinner){M(this).parent().html(M(this).data("label.tabs"))}});L.xhr=null};if(D.spinner){var I=M(J).html();M(J).wrapInner("<em></em>").find("em").data("label.tabs",I).html(D.spinner)}var F=A.extend({},D.ajaxOptions,{url:B,success:function(P,N){A(L._sanitizeSelector(J.hash)).html(P);C();if(D.cache){A.data(J,"cache.tabs",true)}L._trigger("load",null,L.ui(L.$tabs[G],L.$panels[G]));try{D.ajaxOptions.success(P,N)}catch(O){}K()}});if(this.xhr){this.xhr.abort();C()}E.addClass(D.loadingClass);L.xhr=A.ajax(F)},url:function(C,B){this.$tabs.eq(C).removeData("cache.tabs").data("load.tabs",B)},ui:function(C,B){return{options:this.options,tab:C,panel:B,index:this.$tabs.index(C)}}});A.extend(A.ui.tabs,{version:"1.6",getter:"length",defaults:{ajaxOptions:null,cache:false,cookie:null,deselectable:false,deselectableClass:"ui-tabs-deselectable",disabled:[],disabledClass:"ui-tabs-disabled",event:"click",fx:null,hideClass:"ui-tabs-hide",idPrefix:"ui-tabs-",loadingClass:"ui-tabs-loading",navClass:"ui-tabs-nav",panelClass:"ui-tabs-panel",panelTemplate:"<div></div>",selectedClass:"ui-tabs-selected",spinner:"Loading…",tabTemplate:'<li><a href="#{href}"><span>#{label}</span></a></li>'}});A.extend(A.ui.tabs.prototype,{rotation:null,rotate:function(C,F){F=F||false;var B=this,E=this.options.selected;function G(){B.rotation=setInterval(function(){E=++E<B.$tabs.length?E:0;B.select(E)},C)}function D(H){if(!H||H.clientX){clearInterval(B.rotation)}}if(C){G();if(!F){this.$tabs.bind(this.options.event+".tabs",D)}else{this.$tabs.bind(this.options.event+".tabs",function(){D();E=B.options.selected;G()})}}else{D();this.$tabs.unbind(this.options.event+".tabs",D)}}})})(jQuery);/* + * jQuery UI Datepicker 1.6 + * + * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Datepicker + * + * Depends: + * ui.core.js + */ +(function($){$.extend($.ui,{datepicker:{version:"1.6"}});var PROP_NAME="datepicker";function Datepicker(){this.debug=false;this._curInst=null;this._keyEvent=false;this._disabledInputs=[];this._datepickerShowing=false;this._inDialog=false;this._mainDivId="ui-datepicker-div";this._inlineClass="ui-datepicker-inline";this._appendClass="ui-datepicker-append";this._triggerClass="ui-datepicker-trigger";this._dialogClass="ui-datepicker-dialog";this._promptClass="ui-datepicker-prompt";this._disableClass="ui-datepicker-disabled";this._unselectableClass="ui-datepicker-unselectable";this._currentClass="ui-datepicker-current-day";this._dayOverClass="ui-datepicker-days-cell-over";this._weekOverClass="ui-datepicker-week-over";this.regional=[];this.regional[""]={clearText:"Clear",clearStatus:"Erase the current date",closeText:"Close",closeStatus:"Close without change",prevText:"<Prev",prevStatus:"Show the previous month",prevBigText:"<<",prevBigStatus:"Show the previous year",nextText:"Next>",nextStatus:"Show the next month",nextBigText:">>",nextBigStatus:"Show the next year",currentText:"Today",currentStatus:"Show the current month",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],monthStatus:"Show a different month",yearStatus:"Show a different year",weekHeader:"Wk",weekStatus:"Week of the year",dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],dayStatus:"Set DD as first week day",dateStatus:"Select DD, M d",dateFormat:"mm/dd/yy",firstDay:0,initStatus:"Select a date",isRTL:false};this._defaults={showOn:"focus",showAnim:"show",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:false,closeAtTop:true,mandatory:false,hideIfNoPrevNext:false,navigationAsDateFormat:false,showBigPrevNext:false,gotoCurrent:false,changeMonth:true,changeYear:true,showMonthAfterYear:false,yearRange:"-10:+10",changeFirstDay:true,highlightWeek:false,showOtherMonths:false,showWeeks:false,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",showStatus:false,statusForDate:this.dateStatus,minDate:null,maxDate:null,duration:"normal",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,rangeSelect:false,rangeSeparator:" - ",altField:"",altFormat:"",constrainInput:true};$.extend(this._defaults,this.regional[""]);this.dpDiv=$('<div id="'+this._mainDivId+'" style="display: none;"></div>')}$.extend(Datepicker.prototype,{markerClassName:"hasDatepicker",log:function(){if(this.debug){console.log.apply("",arguments)}},setDefaults:function(settings){extendRemove(this._defaults,settings||{});return this},_attachDatepicker:function(target,settings){var inlineSettings=null;for(var attrName in this._defaults){var attrValue=target.getAttribute("date:"+attrName);if(attrValue){inlineSettings=inlineSettings||{};try{inlineSettings[attrName]=eval(attrValue)}catch(err){inlineSettings[attrName]=attrValue}}}var nodeName=target.nodeName.toLowerCase();var inline=(nodeName=="div"||nodeName=="span");if(!target.id){target.id="dp"+(++this.uuid)}var inst=this._newInst($(target),inline);inst.settings=$.extend({},settings||{},inlineSettings||{});if(nodeName=="input"){this._connectDatepicker(target,inst)}else{if(inline){this._inlineDatepicker(target,inst)}}},_newInst:function(target,inline){var id=target[0].id.replace(/([:\[\]\.])/g,"\\\\$1");return{id:id,input:target,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:inline,dpDiv:(!inline?this.dpDiv:$('<div class="'+this._inlineClass+'"></div>'))}},_connectDatepicker:function(target,inst){var input=$(target);if(input.hasClass(this.markerClassName)){return }var appendText=this._get(inst,"appendText");var isRTL=this._get(inst,"isRTL");if(appendText){input[isRTL?"before":"after"]('<span class="'+this._appendClass+'">'+appendText+"</span>")}var showOn=this._get(inst,"showOn");if(showOn=="focus"||showOn=="both"){input.focus(this._showDatepicker)}if(showOn=="button"||showOn=="both"){var buttonText=this._get(inst,"buttonText");var buttonImage=this._get(inst,"buttonImage");var trigger=$(this._get(inst,"buttonImageOnly")?$("<img/>").addClass(this._triggerClass).attr({src:buttonImage,alt:buttonText,title:buttonText}):$('<button type="button"></button>').addClass(this._triggerClass).html(buttonImage==""?buttonText:$("<img/>").attr({src:buttonImage,alt:buttonText,title:buttonText})));input[isRTL?"before":"after"](trigger);trigger.click(function(){if($.datepicker._datepickerShowing&&$.datepicker._lastInput==target){$.datepicker._hideDatepicker()}else{$.datepicker._showDatepicker(target)}return false})}input.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).bind("setData.datepicker",function(event,key,value){inst.settings[key]=value}).bind("getData.datepicker",function(event,key){return this._get(inst,key)});$.data(target,PROP_NAME,inst)},_inlineDatepicker:function(target,inst){var divSpan=$(target);if(divSpan.hasClass(this.markerClassName)){return }divSpan.addClass(this.markerClassName).append(inst.dpDiv).bind("setData.datepicker",function(event,key,value){inst.settings[key]=value}).bind("getData.datepicker",function(event,key){return this._get(inst,key)});$.data(target,PROP_NAME,inst);this._setDate(inst,this._getDefaultDate(inst));this._updateDatepicker(inst);this._updateAlternate(inst)},_dialogDatepicker:function(input,dateText,onSelect,settings,pos){var inst=this._dialogInst;if(!inst){var id="dp"+(++this.uuid);this._dialogInput=$('<input type="text" id="'+id+'" size="1" style="position: absolute; top: -100px;"/>');this._dialogInput.keydown(this._doKeyDown);$("body").append(this._dialogInput);inst=this._dialogInst=this._newInst(this._dialogInput,false);inst.settings={};$.data(this._dialogInput[0],PROP_NAME,inst)}extendRemove(inst.settings,settings||{});this._dialogInput.val(dateText);this._pos=(pos?(pos.length?pos:[pos.pageX,pos.pageY]):null);if(!this._pos){var browserWidth=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth;var browserHeight=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight;var scrollX=document.documentElement.scrollLeft||document.body.scrollLeft;var scrollY=document.documentElement.scrollTop||document.body.scrollTop;this._pos=[(browserWidth/2)-100+scrollX,(browserHeight/2)-150+scrollY]}this._dialogInput.css("left",this._pos[0]+"px").css("top",this._pos[1]+"px");inst.settings.onSelect=onSelect;this._inDialog=true;this.dpDiv.addClass(this._dialogClass);this._showDatepicker(this._dialogInput[0]);if($.blockUI){$.blockUI(this.dpDiv)}$.data(this._dialogInput[0],PROP_NAME,inst);return this},_destroyDatepicker:function(target){var $target=$(target);if(!$target.hasClass(this.markerClassName)){return }var nodeName=target.nodeName.toLowerCase();$.removeData(target,PROP_NAME);if(nodeName=="input"){$target.siblings("."+this._appendClass).remove().end().siblings("."+this._triggerClass).remove().end().removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress)}else{if(nodeName=="div"||nodeName=="span"){$target.removeClass(this.markerClassName).empty()}}},_enableDatepicker:function(target){var $target=$(target);if(!$target.hasClass(this.markerClassName)){return }var nodeName=target.nodeName.toLowerCase();if(nodeName=="input"){target.disabled=false;$target.siblings("button."+this._triggerClass).each(function(){this.disabled=false}).end().siblings("img."+this._triggerClass).css({opacity:"1.0",cursor:""})}else{if(nodeName=="div"||nodeName=="span"){$target.children("."+this._disableClass).remove()}}this._disabledInputs=$.map(this._disabledInputs,function(value){return(value==target?null:value)})},_disableDatepicker:function(target){var $target=$(target);if(!$target.hasClass(this.markerClassName)){return }var nodeName=target.nodeName.toLowerCase();if(nodeName=="input"){target.disabled=true;$target.siblings("button."+this._triggerClass).each(function(){this.disabled=true}).end().siblings("img."+this._triggerClass).css({opacity:"0.5",cursor:"default"})}else{if(nodeName=="div"||nodeName=="span"){var inline=$target.children("."+this._inlineClass);var offset=inline.offset();var relOffset={left:0,top:0};inline.parents().each(function(){if($(this).css("position")=="relative"){relOffset=$(this).offset();return false}});$target.prepend('<div class="'+this._disableClass+'" style="'+($.browser.msie?"background-color: transparent; ":"")+"width: "+inline.width()+"px; height: "+inline.height()+"px; left: "+(offset.left-relOffset.left)+"px; top: "+(offset.top-relOffset.top)+'px;"></div>')}}this._disabledInputs=$.map(this._disabledInputs,function(value){return(value==target?null:value)});this._disabledInputs[this._disabledInputs.length]=target},_isDisabledDatepicker:function(target){if(!target){return false}for(var i=0;i<this._disabledInputs.length;i++){if(this._disabledInputs[i]==target){return true}}return false},_getInst:function(target){try{return $.data(target,PROP_NAME)}catch(err){throw"Missing instance data for this datepicker"}},_optionDatepicker:function(target,name,value){var settings=name||{};if(typeof name=="string"){settings={};settings[name]=value}var inst=this._getInst(target);if(inst){if(this._curInst==inst){this._hideDatepicker(null)}extendRemove(inst.settings,settings);var date=new Date();extendRemove(inst,{rangeStart:null,endDay:null,endMonth:null,endYear:null,selectedDay:date.getDate(),selectedMonth:date.getMonth(),selectedYear:date.getFullYear(),currentDay:date.getDate(),currentMonth:date.getMonth(),currentYear:date.getFullYear(),drawMonth:date.getMonth(),drawYear:date.getFullYear()});this._updateDatepicker(inst)}},_changeDatepicker:function(target,name,value){this._optionDatepicker(target,name,value)},_refreshDatepicker:function(target){var inst=this._getInst(target);if(inst){this._updateDatepicker(inst)}},_setDateDatepicker:function(target,date,endDate){var inst=this._getInst(target);if(inst){this._setDate(inst,date,endDate);this._updateDatepicker(inst);this._updateAlternate(inst)}},_getDateDatepicker:function(target){var inst=this._getInst(target);if(inst&&!inst.inline){this._setDateFromField(inst)}return(inst?this._getDate(inst):null)},_doKeyDown:function(event){var inst=$.datepicker._getInst(event.target);var handled=true;inst._keyEvent=true;if($.datepicker._datepickerShowing){switch(event.keyCode){case 9:$.datepicker._hideDatepicker(null,"");break;case 13:var sel=$("td."+$.datepicker._dayOverClass+", td."+$.datepicker._currentClass,inst.dpDiv);if(sel[0]){$.datepicker._selectDay(event.target,inst.selectedMonth,inst.selectedYear,sel[0])}else{$.datepicker._hideDatepicker(null,$.datepicker._get(inst,"duration"))}return false;break;case 27:$.datepicker._hideDatepicker(null,$.datepicker._get(inst,"duration"));break;case 33:$.datepicker._adjustDate(event.target,(event.ctrlKey?-$.datepicker._get(inst,"stepBigMonths"):-$.datepicker._get(inst,"stepMonths")),"M");break;case 34:$.datepicker._adjustDate(event.target,(event.ctrlKey?+$.datepicker._get(inst,"stepBigMonths"):+$.datepicker._get(inst,"stepMonths")),"M");break;case 35:if(event.ctrlKey||event.metaKey){$.datepicker._clearDate(event.target)}handled=event.ctrlKey||event.metaKey;break;case 36:if(event.ctrlKey||event.metaKey){$.datepicker._gotoToday(event.target)}handled=event.ctrlKey||event.metaKey;break;case 37:if(event.ctrlKey||event.metaKey){$.datepicker._adjustDate(event.target,-1,"D")}handled=event.ctrlKey||event.metaKey;if(event.originalEvent.altKey){$.datepicker._adjustDate(event.target,(event.ctrlKey?-$.datepicker._get(inst,"stepBigMonths"):-$.datepicker._get(inst,"stepMonths")),"M")}break;case 38:if(event.ctrlKey||event.metaKey){$.datepicker._adjustDate(event.target,-7,"D")}handled=event.ctrlKey||event.metaKey;break;case 39:if(event.ctrlKey||event.metaKey){$.datepicker._adjustDate(event.target,+1,"D")}handled=event.ctrlKey||event.metaKey;if(event.originalEvent.altKey){$.datepicker._adjustDate(event.target,(event.ctrlKey?+$.datepicker._get(inst,"stepBigMonths"):+$.datepicker._get(inst,"stepMonths")),"M")}break;case 40:if(event.ctrlKey||event.metaKey){$.datepicker._adjustDate(event.target,+7,"D")}handled=event.ctrlKey||event.metaKey;break;default:handled=false}}else{if(event.keyCode==36&&event.ctrlKey){$.datepicker._showDatepicker(this)}else{handled=false}}if(handled){event.preventDefault();event.stopPropagation()}},_doKeyPress:function(event){var inst=$.datepicker._getInst(event.target);if($.datepicker._get(inst,"constrainInput")){var chars=$.datepicker._possibleChars($.datepicker._get(inst,"dateFormat"));var chr=String.fromCharCode(event.charCode==undefined?event.keyCode:event.charCode);return event.ctrlKey||(chr<" "||!chars||chars.indexOf(chr)>-1)}},_showDatepicker:function(input){input=input.target||input;if(input.nodeName.toLowerCase()!="input"){input=$("input",input.parentNode)[0]}if($.datepicker._isDisabledDatepicker(input)||$.datepicker._lastInput==input){return }var inst=$.datepicker._getInst(input);var beforeShow=$.datepicker._get(inst,"beforeShow");extendRemove(inst.settings,(beforeShow?beforeShow.apply(input,[input,inst]):{}));$.datepicker._hideDatepicker(null,"");$.datepicker._lastInput=input;$.datepicker._setDateFromField(inst);if($.datepicker._inDialog){input.value=""}if(!$.datepicker._pos){$.datepicker._pos=$.datepicker._findPos(input);$.datepicker._pos[1]+=input.offsetHeight}var isFixed=false;$(input).parents().each(function(){isFixed|=$(this).css("position")=="fixed";return !isFixed});if(isFixed&&$.browser.opera){$.datepicker._pos[0]-=document.documentElement.scrollLeft;$.datepicker._pos[1]-=document.documentElement.scrollTop}var offset={left:$.datepicker._pos[0],top:$.datepicker._pos[1]};$.datepicker._pos=null;inst.rangeStart=null;inst.dpDiv.css({position:"absolute",display:"block",top:"-1000px"});$.datepicker._updateDatepicker(inst);inst.dpDiv.width($.datepicker._getNumberOfMonths(inst)[1]*$(".ui-datepicker",inst.dpDiv[0])[0].offsetWidth);offset=$.datepicker._checkOffset(inst,offset,isFixed);inst.dpDiv.css({position:($.datepicker._inDialog&&$.blockUI?"static":(isFixed?"fixed":"absolute")),display:"none",left:offset.left+"px",top:offset.top+"px"});if(!inst.inline){var showAnim=$.datepicker._get(inst,"showAnim")||"show";var duration=$.datepicker._get(inst,"duration");var postProcess=function(){$.datepicker._datepickerShowing=true;};if($.effects&&$.effects[showAnim]){inst.dpDiv.show(showAnim,$.datepicker._get(inst,"showOptions"),duration,postProcess)}else{inst.dpDiv[showAnim](duration,postProcess)}if(duration==""){postProcess()}if(inst.input[0].type!="hidden"){inst.input[0].focus()}$.datepicker._curInst=inst}},_updateDatepicker:function(inst){var dims={width:inst.dpDiv.width()+4,height:inst.dpDiv.height()+4};inst.dpDiv.empty().append(this._generateHTML(inst));var numMonths=this._getNumberOfMonths(inst);inst.dpDiv[(numMonths[0]!=1||numMonths[1]!=1?"add":"remove")+"Class"]("ui-datepicker-multi");inst.dpDiv[(this._get(inst,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl");if(inst.input&&inst.input[0].type!="hidden"&&inst==$.datepicker._curInst){$(inst.input[0]).focus()}},_checkOffset:function(inst,offset,isFixed){var pos=inst.input?this._findPos(inst.input[0]):null;var browserWidth=window.innerWidth||(document.documentElement?document.documentElement.clientWidth:document.body.clientWidth);var browserHeight=window.innerHeight||(document.documentElement?document.documentElement.clientHeight:document.body.clientHeight);var scrollX=document.documentElement.scrollLeft||document.body.scrollLeft;var scrollY=document.documentElement.scrollTop||document.body.scrollTop;if(this._get(inst,"isRTL")||(offset.left+inst.dpDiv.width()-scrollX)>browserWidth){offset.left=Math.max((isFixed?0:scrollX),pos[0]+(inst.input?inst.input.width():0)-(isFixed?scrollX:0)-inst.dpDiv.width()-(isFixed&&$.browser.opera?document.documentElement.scrollLeft:0))}else{offset.left-=(isFixed?scrollX:0)}if((offset.top+inst.dpDiv.height()-scrollY)>browserHeight){offset.top=Math.max((isFixed?0:scrollY),pos[1]-(isFixed?scrollY:0)-(this._inDialog?0:inst.dpDiv.height())-(isFixed&&$.browser.opera?document.documentElement.scrollTop:0))}else{offset.top-=(isFixed?scrollY:0)}return offset},_findPos:function(obj){while(obj&&(obj.type=="hidden"||obj.nodeType!=1)){obj=obj.nextSibling}var position=$(obj).offset();return[position.left,position.top]},_hideDatepicker:function(input,duration){var inst=this._curInst;if(!inst||(input&&inst!=$.data(input,PROP_NAME))){return }var rangeSelect=this._get(inst,"rangeSelect");if(rangeSelect&&inst.stayOpen){this._selectDate("#"+inst.id,this._formatDate(inst,inst.currentDay,inst.currentMonth,inst.currentYear))}inst.stayOpen=false;if(this._datepickerShowing){duration=(duration!=null?duration:this._get(inst,"duration"));var showAnim=this._get(inst,"showAnim");var postProcess=function(){$.datepicker._tidyDialog(inst)};if(duration!=""&&$.effects&&$.effects[showAnim]){inst.dpDiv.hide(showAnim,$.datepicker._get(inst,"showOptions"),duration,postProcess)}else{inst.dpDiv[(duration==""?"hide":(showAnim=="slideDown"?"slideUp":(showAnim=="fadeIn"?"fadeOut":"hide")))](duration,postProcess)}if(duration==""){this._tidyDialog(inst)}var onClose=this._get(inst,"onClose");if(onClose){onClose.apply((inst.input?inst.input[0]:null),[(inst.input?inst.input.val():""),inst])}this._datepickerShowing=false;this._lastInput=null;inst.settings.prompt=null;if(this._inDialog){this._dialogInput.css({position:"absolute",left:"0",top:"-100px"});if($.blockUI){$.unblockUI();$("body").append(this.dpDiv)}}this._inDialog=false}this._curInst=null},_tidyDialog:function(inst){inst.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker");$("."+this._promptClass,inst.dpDiv).remove()},_checkExternalClick:function(event){if(!$.datepicker._curInst){return }var $target=$(event.target);if(($target.parents("#"+$.datepicker._mainDivId).length==0)&&!$target.hasClass($.datepicker.markerClassName)&&!$target.hasClass($.datepicker._triggerClass)&&$.datepicker._datepickerShowing&&!($.datepicker._inDialog&&$.blockUI)){$.datepicker._hideDatepicker(null,"")}},_adjustDate:function(id,offset,period){var target=$(id);var inst=this._getInst(target[0]);this._adjustInstDate(inst,offset,period);this._updateDatepicker(inst)},_gotoToday:function(id){var target=$(id);var inst=this._getInst(target[0]);if(this._get(inst,"gotoCurrent")&&inst.currentDay){inst.selectedDay=inst.currentDay;inst.drawMonth=inst.selectedMonth=inst.currentMonth;inst.drawYear=inst.selectedYear=inst.currentYear}else{var date=new Date();inst.selectedDay=date.getDate();inst.drawMonth=inst.selectedMonth=date.getMonth();inst.drawYear=inst.selectedYear=date.getFullYear()}this._notifyChange(inst);this._adjustDate(target)},_selectMonthYear:function(id,select,period){var target=$(id);var inst=this._getInst(target[0]);inst._selectingMonthYear=false;inst["selected"+(period=="M"?"Month":"Year")]=inst["draw"+(period=="M"?"Month":"Year")]=parseInt(select.options[select.selectedIndex].value,10);this._notifyChange(inst);this._adjustDate(target)},_clickMonthYear:function(id){var target=$(id);var inst=this._getInst(target[0]);if(inst.input&&inst._selectingMonthYear&&!$.browser.msie){inst.input[0].focus()}inst._selectingMonthYear=!inst._selectingMonthYear},_changeFirstDay:function(id,day){var target=$(id);var inst=this._getInst(target[0]);inst.settings.firstDay=day;this._updateDatepicker(inst)},_selectDay:function(id,month,year,td){if($(td).hasClass(this._unselectableClass)){return }var target=$(id);var inst=this._getInst(target[0]);var rangeSelect=this._get(inst,"rangeSelect");if(rangeSelect){inst.stayOpen=!inst.stayOpen;if(inst.stayOpen){$(".ui-datepicker td",inst.dpDiv).removeClass(this._currentClass);$(td).addClass(this._currentClass)}}inst.selectedDay=inst.currentDay=$("a",td).html();inst.selectedMonth=inst.currentMonth=month;inst.selectedYear=inst.currentYear=year;if(inst.stayOpen){inst.endDay=inst.endMonth=inst.endYear=null}else{if(rangeSelect){inst.endDay=inst.currentDay;inst.endMonth=inst.currentMonth;inst.endYear=inst.currentYear}}this._selectDate(id,this._formatDate(inst,inst.currentDay,inst.currentMonth,inst.currentYear));if(inst.stayOpen){inst.rangeStart=this._daylightSavingAdjust(new Date(inst.currentYear,inst.currentMonth,inst.currentDay));this._updateDatepicker(inst)}else{if(rangeSelect){inst.selectedDay=inst.currentDay=inst.rangeStart.getDate();inst.selectedMonth=inst.currentMonth=inst.rangeStart.getMonth();inst.selectedYear=inst.currentYear=inst.rangeStart.getFullYear();inst.rangeStart=null;if(inst.inline){this._updateDatepicker(inst)}}}},_clearDate:function(id){var target=$(id);var inst=this._getInst(target[0]);if(this._get(inst,"mandatory")){return }inst.stayOpen=false;inst.endDay=inst.endMonth=inst.endYear=inst.rangeStart=null;this._selectDate(target,"")},_selectDate:function(id,dateStr){var target=$(id);var inst=this._getInst(target[0]);dateStr=(dateStr!=null?dateStr:this._formatDate(inst));if(this._get(inst,"rangeSelect")&&dateStr){dateStr=(inst.rangeStart?this._formatDate(inst,inst.rangeStart):dateStr)+this._get(inst,"rangeSeparator")+dateStr}if(inst.input){inst.input.val(dateStr)}this._updateAlternate(inst);var onSelect=this._get(inst,"onSelect");if(onSelect){onSelect.apply((inst.input?inst.input[0]:null),[dateStr,inst])}else{if(inst.input){inst.input.trigger("change")}}if(inst.inline){this._updateDatepicker(inst)}else{if(!inst.stayOpen){this._hideDatepicker(null,this._get(inst,"duration"));this._lastInput=inst.input[0];if(typeof (inst.input[0])!="object"){inst.input[0].focus()}this._lastInput=null}}},_updateAlternate:function(inst){var altField=this._get(inst,"altField");if(altField){var altFormat=this._get(inst,"altFormat")||this._get(inst,"dateFormat");var date=this._getDate(inst);dateStr=(isArray(date)?(!date[0]&&!date[1]?"":this.formatDate(altFormat,date[0],this._getFormatConfig(inst))+this._get(inst,"rangeSeparator")+this.formatDate(altFormat,date[1]||date[0],this._getFormatConfig(inst))):this.formatDate(altFormat,date,this._getFormatConfig(inst)));$(altField).each(function(){$(this).val(dateStr)})}},noWeekends:function(date){var day=date.getDay();return[(day>0&&day<6),""]},iso8601Week:function(date){var checkDate=new Date(date.getFullYear(),date.getMonth(),date.getDate());var firstMon=new Date(checkDate.getFullYear(),1-1,4);var firstDay=firstMon.getDay()||7;firstMon.setDate(firstMon.getDate()+1-firstDay);if(firstDay<4&&checkDate<firstMon){checkDate.setDate(checkDate.getDate()-3);return $.datepicker.iso8601Week(checkDate)}else{if(checkDate>new Date(checkDate.getFullYear(),12-1,28)){firstDay=new Date(checkDate.getFullYear()+1,1-1,4).getDay()||7;if(firstDay>4&&(checkDate.getDay()||7)<firstDay-3){return 1}}}return Math.floor(((checkDate-firstMon)/86400000)/7)+1},dateStatus:function(date,inst){return $.datepicker.formatDate($.datepicker._get(inst,"dateStatus"),date,$.datepicker._getFormatConfig(inst))},parseDate:function(format,value,settings){if(format==null||value==null){throw"Invalid arguments"}value=(typeof value=="object"?value.toString():value+"");if(value==""){return null}var shortYearCutoff=(settings?settings.shortYearCutoff:null)||this._defaults.shortYearCutoff;var dayNamesShort=(settings?settings.dayNamesShort:null)||this._defaults.dayNamesShort;var dayNames=(settings?settings.dayNames:null)||this._defaults.dayNames;var monthNamesShort=(settings?settings.monthNamesShort:null)||this._defaults.monthNamesShort;var monthNames=(settings?settings.monthNames:null)||this._defaults.monthNames;var year=-1;var month=-1;var day=-1;var doy=-1;var literal=false;var lookAhead=function(match){var matches=(iFormat+1<format.length&&format.charAt(iFormat+1)==match);if(matches){iFormat++}return matches};var getNumber=function(match){lookAhead(match);var origSize=(match=="@"?14:(match=="y"?4:(match=="o"?3:2)));var size=origSize;var num=0;while(size>0&&iValue<value.length&&value.charAt(iValue)>="0"&&value.charAt(iValue)<="9"){num=num*10+parseInt(value.charAt(iValue++),10);size--}if(size==origSize){throw"Missing number at position "+iValue}return num};var getName=function(match,shortNames,longNames){var names=(lookAhead(match)?longNames:shortNames);var size=0;for(var j=0;j<names.length;j++){size=Math.max(size,names[j].length)}var name="";var iInit=iValue;while(size>0&&iValue<value.length){name+=value.charAt(iValue++);for(var i=0;i<names.length;i++){if(name==names[i]){return i+1}}size--}throw"Unknown name at position "+iInit};var checkLiteral=function(){if(value.charAt(iValue)!=format.charAt(iFormat)){throw"Unexpected literal at position "+iValue}iValue++};var iValue=0;for(var iFormat=0;iFormat<format.length;iFormat++){if(literal){if(format.charAt(iFormat)=="'"&&!lookAhead("'")){literal=false}else{checkLiteral()}}else{switch(format.charAt(iFormat)){case"d":day=getNumber("d");break;case"D":getName("D",dayNamesShort,dayNames);break;case"o":doy=getNumber("o");break;case"m":month=getNumber("m");break;case"M":month=getName("M",monthNamesShort,monthNames);break;case"y":year=getNumber("y");break;case"@":var date=new Date(getNumber("@"));year=date.getFullYear();month=date.getMonth()+1;day=date.getDate();break;case"'":if(lookAhead("'")){checkLiteral()}else{literal=true}break;default:checkLiteral()}}}if(year==-1){year=new Date().getFullYear()}else{if(year<100){year+=new Date().getFullYear()-new Date().getFullYear()%100+(year<=shortYearCutoff?0:-100)}}if(doy>-1){month=1;day=doy;do{var dim=this._getDaysInMonth(year,month-1);if(day<=dim){break}month++;day-=dim}while(true)}var date=this._daylightSavingAdjust(new Date(year,month-1,day));if(date.getFullYear()!=year||date.getMonth()+1!=month||date.getDate()!=day){throw"Invalid date"}return date},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TIMESTAMP:"@",W3C:"yy-mm-dd",formatDate:function(format,date,settings){if(!date){return""}var dayNamesShort=(settings?settings.dayNamesShort:null)||this._defaults.dayNamesShort;var dayNames=(settings?settings.dayNames:null)||this._defaults.dayNames;var monthNamesShort=(settings?settings.monthNamesShort:null)||this._defaults.monthNamesShort;var monthNames=(settings?settings.monthNames:null)||this._defaults.monthNames;var lookAhead=function(match){var matches=(iFormat+1<format.length&&format.charAt(iFormat+1)==match);if(matches){iFormat++}return matches};var formatNumber=function(match,value,len){var num=""+value;if(lookAhead(match)){while(num.length<len){num="0"+num}}return num};var formatName=function(match,value,shortNames,longNames){return(lookAhead(match)?longNames[value]:shortNames[value])};var output="";var literal=false;if(date){for(var iFormat=0;iFormat<format.length;iFormat++){if(literal){if(format.charAt(iFormat)=="'"&&!lookAhead("'")){literal=false}else{output+=format.charAt(iFormat)}}else{switch(format.charAt(iFormat)){case"d":output+=formatNumber("d",date.getDate(),2);break;case"D":output+=formatName("D",date.getDay(),dayNamesShort,dayNames);break;case"o":var doy=date.getDate();for(var m=date.getMonth()-1;m>=0;m--){doy+=this._getDaysInMonth(date.getFullYear(),m)}output+=formatNumber("o",doy,3);break;case"m":output+=formatNumber("m",date.getMonth()+1,2);break;case"M":output+=formatName("M",date.getMonth(),monthNamesShort,monthNames);break;case"y":output+=(lookAhead("y")?date.getFullYear():(date.getYear()%100<10?"0":"")+date.getYear()%100);break;case"@":output+=date.getTime();break;case"'":if(lookAhead("'")){output+="'"}else{literal=true}break;default:output+=format.charAt(iFormat)}}}}return output},_possibleChars:function(format){var chars="";var literal=false;for(var iFormat=0;iFormat<format.length;iFormat++){if(literal){if(format.charAt(iFormat)=="'"&&!lookAhead("'")){literal=false}else{chars+=format.charAt(iFormat)}}else{switch(format.charAt(iFormat)){case"d":case"m":case"y":case"@":chars+="0123456789";break;case"D":case"M":return null;case"'":if(lookAhead("'")){chars+="'"}else{literal=true}break;default:chars+=format.charAt(iFormat)}}}return chars},_get:function(inst,name){return inst.settings[name]!==undefined?inst.settings[name]:this._defaults[name]},_setDateFromField:function(inst){var dateFormat=this._get(inst,"dateFormat");var dates=inst.input?inst.input.val().split(this._get(inst,"rangeSeparator")):null;inst.endDay=inst.endMonth=inst.endYear=null;var date=defaultDate=this._getDefaultDate(inst);if(dates.length>0){var settings=this._getFormatConfig(inst);if(dates.length>1){date=this.parseDate(dateFormat,dates[1],settings)||defaultDate;inst.endDay=date.getDate();inst.endMonth=date.getMonth();inst.endYear=date.getFullYear()}try{date=this.parseDate(dateFormat,dates[0],settings)||defaultDate}catch(event){this.log(event);date=defaultDate}}inst.selectedDay=date.getDate();inst.drawMonth=inst.selectedMonth=date.getMonth();inst.drawYear=inst.selectedYear=date.getFullYear();inst.currentDay=(dates[0]?date.getDate():0);inst.currentMonth=(dates[0]?date.getMonth():0);inst.currentYear=(dates[0]?date.getFullYear():0);this._adjustInstDate(inst)},_getDefaultDate:function(inst){var date=this._determineDate(this._get(inst,"defaultDate"),new Date());var minDate=this._getMinMaxDate(inst,"min",true);var maxDate=this._getMinMaxDate(inst,"max");date=(minDate&&date<minDate?minDate:date);date=(maxDate&&date>maxDate?maxDate:date);return date},_determineDate:function(date,defaultDate){var offsetNumeric=function(offset){var date=new Date();date.setDate(date.getDate()+offset);return date};var offsetString=function(offset,getDaysInMonth){var date=new Date();var year=date.getFullYear();var month=date.getMonth();var day=date.getDate();var pattern=/([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g;var matches=pattern.exec(offset);while(matches){switch(matches[2]||"d"){case"d":case"D":day+=parseInt(matches[1],10);break;case"w":case"W":day+=parseInt(matches[1],10)*7;break;case"m":case"M":month+=parseInt(matches[1],10);day=Math.min(day,getDaysInMonth(year,month));break;case"y":case"Y":year+=parseInt(matches[1],10);day=Math.min(day,getDaysInMonth(year,month));break}matches=pattern.exec(offset)}return new Date(year,month,day)};date=(date==null?defaultDate:(typeof date=="string"?offsetString(date,this._getDaysInMonth):(typeof date=="number"?(isNaN(date)?defaultDate:offsetNumeric(date)):date)));date=(date&&date.toString()=="Invalid Date"?defaultDate:date);if(date){date.setHours(0);date.setMinutes(0);date.setSeconds(0);date.setMilliseconds(0)}return this._daylightSavingAdjust(date)},_daylightSavingAdjust:function(date){if(!date){return null}date.setHours(date.getHours()>12?date.getHours()+2:0);return date},_setDate:function(inst,date,endDate){var clear=!(date);var origMonth=inst.selectedMonth;var origYear=inst.selectedYear;date=this._determineDate(date,new Date());inst.selectedDay=inst.currentDay=date.getDate();inst.drawMonth=inst.selectedMonth=inst.currentMonth=date.getMonth();inst.drawYear=inst.selectedYear=inst.currentYear=date.getFullYear();if(this._get(inst,"rangeSelect")){if(endDate){endDate=this._determineDate(endDate,null);inst.endDay=endDate.getDate();inst.endMonth=endDate.getMonth();inst.endYear=endDate.getFullYear()}else{inst.endDay=inst.currentDay;inst.endMonth=inst.currentMonth;inst.endYear=inst.currentYear}}if(origMonth!=inst.selectedMonth||origYear!=inst.selectedYear){this._notifyChange(inst)}this._adjustInstDate(inst);if(inst.input){inst.input.val(clear?"":this._formatDate(inst)+(!this._get(inst,"rangeSelect")?"":this._get(inst,"rangeSeparator")+this._formatDate(inst,inst.endDay,inst.endMonth,inst.endYear)))}},_getDate:function(inst){var startDate=(!inst.currentYear||(inst.input&&inst.input.val()=="")?null:this._daylightSavingAdjust(new Date(inst.currentYear,inst.currentMonth,inst.currentDay)));if(this._get(inst,"rangeSelect")){return[inst.rangeStart||startDate,(!inst.endYear?inst.rangeStart||startDate:this._daylightSavingAdjust(new Date(inst.endYear,inst.endMonth,inst.endDay)))]}else{return startDate}},_generateHTML:function(inst){var today=new Date();today=this._daylightSavingAdjust(new Date(today.getFullYear(),today.getMonth(),today.getDate()));var showStatus=this._get(inst,"showStatus");var initStatus=this._get(inst,"initStatus")||" ";var isRTL=this._get(inst,"isRTL");var clear=(this._get(inst,"mandatory")?"":'<div class="ui-datepicker-clear"><a onclick="jQuery.datepicker._clearDate(\'#'+inst.id+"');\""+this._addStatus(showStatus,inst.id,this._get(inst,"clearStatus"),initStatus)+">"+this._get(inst,"clearText")+"</a></div>");var controls='<div class="ui-datepicker-control">'+(isRTL?"":clear)+'<div class="ui-datepicker-close"><a onclick="jQuery.datepicker._hideDatepicker();"'+this._addStatus(showStatus,inst.id,this._get(inst,"closeStatus"),initStatus)+">"+this._get(inst,"closeText")+"</a></div>"+(isRTL?clear:"")+"</div>";var prompt=this._get(inst,"prompt");var closeAtTop=this._get(inst,"closeAtTop");var hideIfNoPrevNext=this._get(inst,"hideIfNoPrevNext");var navigationAsDateFormat=this._get(inst,"navigationAsDateFormat");var showBigPrevNext=this._get(inst,"showBigPrevNext");var numMonths=this._getNumberOfMonths(inst);var showCurrentAtPos=this._get(inst,"showCurrentAtPos");var stepMonths=this._get(inst,"stepMonths");var stepBigMonths=this._get(inst,"stepBigMonths");var isMultiMonth=(numMonths[0]!=1||numMonths[1]!=1);var currentDate=this._daylightSavingAdjust((!inst.currentDay?new Date(9999,9,9):new Date(inst.currentYear,inst.currentMonth,inst.currentDay)));var minDate=this._getMinMaxDate(inst,"min",true);var maxDate=this._getMinMaxDate(inst,"max");var drawMonth=inst.drawMonth-showCurrentAtPos;var drawYear=inst.drawYear;if(drawMonth<0){drawMonth+=12;drawYear--}if(maxDate){var maxDraw=this._daylightSavingAdjust(new Date(maxDate.getFullYear(),maxDate.getMonth()-numMonths[1]+1,maxDate.getDate()));maxDraw=(minDate&&maxDraw<minDate?minDate:maxDraw);while(this._daylightSavingAdjust(new Date(drawYear,drawMonth,1))>maxDraw){drawMonth--;if(drawMonth<0){drawMonth=11;drawYear--}}}var prevText=this._get(inst,"prevText");prevText=(!navigationAsDateFormat?prevText:this.formatDate(prevText,this._daylightSavingAdjust(new Date(drawYear,drawMonth-stepMonths,1)),this._getFormatConfig(inst)));var prevBigText=(showBigPrevNext?this._get(inst,"prevBigText"):"");prevBigText=(!navigationAsDateFormat?prevBigText:this.formatDate(prevBigText,this._daylightSavingAdjust(new Date(drawYear,drawMonth-stepBigMonths,1)),this._getFormatConfig(inst)));var prev='<div class="ui-datepicker-prev">'+(this._canAdjustMonth(inst,-1,drawYear,drawMonth)?(showBigPrevNext?"<a onclick=\"jQuery.datepicker._adjustDate('#"+inst.id+"', -"+stepBigMonths+", 'M');\""+this._addStatus(showStatus,inst.id,this._get(inst,"prevBigStatus"),initStatus)+">"+prevBigText+"</a>":"")+"<a onclick=\"jQuery.datepicker._adjustDate('#"+inst.id+"', -"+stepMonths+", 'M');\""+this._addStatus(showStatus,inst.id,this._get(inst,"prevStatus"),initStatus)+">"+prevText+"</a>":(hideIfNoPrevNext?"":(showBigPrevNext?"<label>"+prevBigText+"</label>":"")+"<label>"+prevText+"</label>"))+"</div>";var nextText=this._get(inst,"nextText");nextText=(!navigationAsDateFormat?nextText:this.formatDate(nextText,this._daylightSavingAdjust(new Date(drawYear,drawMonth+stepMonths,1)),this._getFormatConfig(inst)));var nextBigText=(showBigPrevNext?this._get(inst,"nextBigText"):"");nextBigText=(!navigationAsDateFormat?nextBigText:this.formatDate(nextBigText,this._daylightSavingAdjust(new Date(drawYear,drawMonth+stepBigMonths,1)),this._getFormatConfig(inst)));var next='<div class="ui-datepicker-next">'+(this._canAdjustMonth(inst,+1,drawYear,drawMonth)?"<a onclick=\"jQuery.datepicker._adjustDate('#"+inst.id+"', +"+stepMonths+", 'M');\""+this._addStatus(showStatus,inst.id,this._get(inst,"nextStatus"),initStatus)+">"+nextText+"</a>"+(showBigPrevNext?"<a onclick=\"jQuery.datepicker._adjustDate('#"+inst.id+"', +"+stepBigMonths+", 'M');\""+this._addStatus(showStatus,inst.id,this._get(inst,"nextBigStatus"),initStatus)+">"+nextBigText+"</a>":""):(hideIfNoPrevNext?"":"<label>"+nextText+"</label>"+(showBigPrevNext?"<label>"+nextBigText+"</label>":"")))+"</div>";var currentText=this._get(inst,"currentText");var gotoDate=(this._get(inst,"gotoCurrent")&&inst.currentDay?currentDate:today);currentText=(!navigationAsDateFormat?currentText:this.formatDate(currentText,gotoDate,this._getFormatConfig(inst)));var html=(closeAtTop&&!inst.inline?controls:"")+'<div class="ui-datepicker-links">'+(isRTL?next:prev)+(this._isInRange(inst,gotoDate)?'<div class="ui-datepicker-current"><a onclick="jQuery.datepicker._gotoToday(\'#'+inst.id+"');\""+this._addStatus(showStatus,inst.id,this._get(inst,"currentStatus"),initStatus)+">"+currentText+"</a></div>":"")+(isRTL?prev:next)+"</div>"+(prompt?'<div class="'+this._promptClass+'"><span>'+prompt+"</span></div>":"");var firstDay=parseInt(this._get(inst,"firstDay"));firstDay=(isNaN(firstDay)?0:firstDay);var changeFirstDay=this._get(inst,"changeFirstDay");var dayNames=this._get(inst,"dayNames");var dayNamesShort=this._get(inst,"dayNamesShort");var dayNamesMin=this._get(inst,"dayNamesMin");var monthNames=this._get(inst,"monthNames");var beforeShowDay=this._get(inst,"beforeShowDay");var highlightWeek=this._get(inst,"highlightWeek");var showOtherMonths=this._get(inst,"showOtherMonths");var showWeeks=this._get(inst,"showWeeks");var calculateWeek=this._get(inst,"calculateWeek")||this.iso8601Week;var weekStatus=this._get(inst,"weekStatus");var status=(showStatus?this._get(inst,"dayStatus")||initStatus:"");var dateStatus=this._get(inst,"statusForDate")||this.dateStatus;var endDate=inst.endDay?this._daylightSavingAdjust(new Date(inst.endYear,inst.endMonth,inst.endDay)):currentDate;var defaultDate=this._getDefaultDate(inst);for(var row=0;row<numMonths[0];row++){for(var col=0;col<numMonths[1];col++){var selectedDate=this._daylightSavingAdjust(new Date(drawYear,drawMonth,inst.selectedDay));html+='<div class="ui-datepicker-one-month'+(col==0?" ui-datepicker-new-row":"")+'">'+this._generateMonthYearHeader(inst,drawMonth,drawYear,minDate,maxDate,selectedDate,row>0||col>0,showStatus,initStatus,monthNames)+'<table class="ui-datepicker" cellpadding="0" cellspacing="0"><thead><tr class="ui-datepicker-title-row">'+(showWeeks?"<td"+this._addStatus(showStatus,inst.id,weekStatus,initStatus)+">"+this._get(inst,"weekHeader")+"</td>":"");for(var dow=0;dow<7;dow++){var day=(dow+firstDay)%7;var dayStatus=(status.indexOf("DD")>-1?status.replace(/DD/,dayNames[day]):status.replace(/D/,dayNamesShort[day]));html+="<td"+((dow+firstDay+6)%7>=5?' class="ui-datepicker-week-end-cell"':"")+">"+(!changeFirstDay?"<span":"<a onclick=\"jQuery.datepicker._changeFirstDay('#"+inst.id+"', "+day+');"')+this._addStatus(showStatus,inst.id,dayStatus,initStatus)+' title="'+dayNames[day]+'">'+dayNamesMin[day]+(changeFirstDay?"</a>":"</span>")+"</td>"}html+="</tr></thead><tbody>";var daysInMonth=this._getDaysInMonth(drawYear,drawMonth);if(drawYear==inst.selectedYear&&drawMonth==inst.selectedMonth){inst.selectedDay=Math.min(inst.selectedDay,daysInMonth)}var leadDays=(this._getFirstDayOfMonth(drawYear,drawMonth)-firstDay+7)%7;var numRows=(isMultiMonth?6:Math.ceil((leadDays+daysInMonth)/7));var printDate=this._daylightSavingAdjust(new Date(drawYear,drawMonth,1-leadDays));for(var dRow=0;dRow<numRows;dRow++){html+='<tr class="ui-datepicker-days-row">'+(showWeeks?'<td class="ui-datepicker-week-col"'+this._addStatus(showStatus,inst.id,weekStatus,initStatus)+">"+calculateWeek(printDate)+"</td>":"");for(var dow=0;dow<7;dow++){var daySettings=(beforeShowDay?beforeShowDay.apply((inst.input?inst.input[0]:null),[printDate]):[true,""]);var otherMonth=(printDate.getMonth()!=drawMonth);var unselectable=otherMonth||!daySettings[0]||(minDate&&printDate<minDate)||(maxDate&&printDate>maxDate);html+='<td class="ui-datepicker-days-cell'+((dow+firstDay+6)%7>=5?" ui-datepicker-week-end-cell":"")+(otherMonth?" ui-datepicker-other-month":"")+((printDate.getTime()==selectedDate.getTime()&&drawMonth==inst.selectedMonth&&inst._keyEvent)||(defaultDate.getTime()==printDate.getTime()&&defaultDate.getTime()==selectedDate.getTime())?" "+$.datepicker._dayOverClass:"")+(unselectable?" "+this._unselectableClass:"")+(otherMonth&&!showOtherMonths?"":" "+daySettings[1]+(printDate.getTime()>=currentDate.getTime()&&printDate.getTime()<=endDate.getTime()?" "+this._currentClass:"")+(printDate.getTime()==today.getTime()?" ui-datepicker-today":""))+'"'+((!otherMonth||showOtherMonths)&&daySettings[2]?' title="'+daySettings[2]+'"':"")+(unselectable?(highlightWeek?" onmouseover=\"jQuery(this).parent().addClass('"+this._weekOverClass+"');\" onmouseout=\"jQuery(this).parent().removeClass('"+this._weekOverClass+"');\"":""):" onmouseover=\"jQuery(this).addClass('"+this._dayOverClass+"')"+(highlightWeek?".parent().addClass('"+this._weekOverClass+"')":"")+";"+(!showStatus||(otherMonth&&!showOtherMonths)?"":"jQuery('#ui-datepicker-status-"+inst.id+"').html('"+(dateStatus.apply((inst.input?inst.input[0]:null),[printDate,inst])||initStatus)+"');")+'" onmouseout="jQuery(this).removeClass(\''+this._dayOverClass+"')"+(highlightWeek?".parent().removeClass('"+this._weekOverClass+"')":"")+";"+(!showStatus||(otherMonth&&!showOtherMonths)?"":"jQuery('#ui-datepicker-status-"+inst.id+"').html('"+initStatus+"');")+'" onclick="jQuery.datepicker._selectDay(\'#'+inst.id+"',"+drawMonth+","+drawYear+', this);"')+">"+(otherMonth?(showOtherMonths?printDate.getDate():" "):(unselectable?printDate.getDate():"<a>"+printDate.getDate()+"</a>"))+"</td>";printDate.setDate(printDate.getDate()+1);printDate=this._daylightSavingAdjust(printDate)}html+="</tr>"}drawMonth++;if(drawMonth>11){drawMonth=0;drawYear++}html+="</tbody></table></div>"}}html+=(showStatus?'<div style="clear: both;"></div><div id="ui-datepicker-status-'+inst.id+'" class="ui-datepicker-status">'+initStatus+"</div>":"")+(!closeAtTop&&!inst.inline?controls:"")+'<div style="clear: both;"></div>'+($.browser.msie&&parseInt($.browser.version,10)<7&&!inst.inline?'<iframe src="javascript:false;" class="ui-datepicker-cover"></iframe>':"");inst._keyEvent=false;return html},_generateMonthYearHeader:function(inst,drawMonth,drawYear,minDate,maxDate,selectedDate,secondary,showStatus,initStatus,monthNames){minDate=(inst.rangeStart&&minDate&&selectedDate<minDate?selectedDate:minDate);var changeMonth=this._get(inst,"changeMonth");var changeYear=this._get(inst,"changeYear");var showMonthAfterYear=this._get(inst,"showMonthAfterYear");var html='<div class="ui-datepicker-header">';var monthHtml="";if(secondary||!changeMonth){monthHtml+=monthNames[drawMonth]}else{var inMinYear=(minDate&&minDate.getFullYear()==drawYear);var inMaxYear=(maxDate&&maxDate.getFullYear()==drawYear);monthHtml+='<select class="ui-datepicker-new-month" onchange="jQuery.datepicker._selectMonthYear(\'#'+inst.id+"', this, 'M');\" onclick=\"jQuery.datepicker._clickMonthYear('#"+inst.id+"');\""+this._addStatus(showStatus,inst.id,this._get(inst,"monthStatus"),initStatus)+">";for(var month=0;month<12;month++){if((!inMinYear||month>=minDate.getMonth())&&(!inMaxYear||month<=maxDate.getMonth())){monthHtml+='<option value="'+month+'"'+(month==drawMonth?' selected="selected"':"")+">"+monthNames[month]+"</option>"}}monthHtml+="</select>"}if(!showMonthAfterYear){html+=monthHtml+(secondary||changeMonth||changeYear?" ":"")}if(secondary||!changeYear){html+=drawYear}else{var years=this._get(inst,"yearRange").split(":");var year=0;var endYear=0;if(years.length!=2){year=drawYear-10;endYear=drawYear+10}else{if(years[0].charAt(0)=="+"||years[0].charAt(0)=="-"){year=endYear=new Date().getFullYear();year+=parseInt(years[0],10);endYear+=parseInt(years[1],10)}else{year=parseInt(years[0],10);endYear=parseInt(years[1],10)}}year=(minDate?Math.max(year,minDate.getFullYear()):year);endYear=(maxDate?Math.min(endYear,maxDate.getFullYear()):endYear);html+='<select class="ui-datepicker-new-year" onchange="jQuery.datepicker._selectMonthYear(\'#'+inst.id+"', this, 'Y');\" onclick=\"jQuery.datepicker._clickMonthYear('#"+inst.id+"');\""+this._addStatus(showStatus,inst.id,this._get(inst,"yearStatus"),initStatus)+">";for(;year<=endYear;year++){html+='<option value="'+year+'"'+(year==drawYear?' selected="selected"':"")+">"+year+"</option>"}html+="</select>"}if(showMonthAfterYear){html+=(secondary||changeMonth||changeYear?" ":"")+monthHtml}html+="</div>";return html},_addStatus:function(showStatus,id,text,initStatus){return(showStatus?" onmouseover=\"jQuery('#ui-datepicker-status-"+id+"').html('"+(text||initStatus)+"');\" onmouseout=\"jQuery('#ui-datepicker-status-"+id+"').html('"+initStatus+"');\"":"")},_adjustInstDate:function(inst,offset,period){var year=inst.drawYear+(period=="Y"?offset:0);var month=inst.drawMonth+(period=="M"?offset:0);var day=Math.min(inst.selectedDay,this._getDaysInMonth(year,month))+(period=="D"?offset:0);var date=this._daylightSavingAdjust(new Date(year,month,day));var minDate=this._getMinMaxDate(inst,"min",true);var maxDate=this._getMinMaxDate(inst,"max");date=(minDate&&date<minDate?minDate:date);date=(maxDate&&date>maxDate?maxDate:date);inst.selectedDay=date.getDate();inst.drawMonth=inst.selectedMonth=date.getMonth();inst.drawYear=inst.selectedYear=date.getFullYear();if(period=="M"||period=="Y"){this._notifyChange(inst)}},_notifyChange:function(inst){var onChange=this._get(inst,"onChangeMonthYear");if(onChange){onChange.apply((inst.input?inst.input[0]:null),[inst.selectedYear,inst.selectedMonth+1,inst])}},_getNumberOfMonths:function(inst){var numMonths=this._get(inst,"numberOfMonths");return(numMonths==null?[1,1]:(typeof numMonths=="number"?[1,numMonths]:numMonths))},_getMinMaxDate:function(inst,minMax,checkRange){var date=this._determineDate(this._get(inst,minMax+"Date"),null);return(!checkRange||!inst.rangeStart?date:(!date||inst.rangeStart>date?inst.rangeStart:date))},_getDaysInMonth:function(year,month){return 32-new Date(year,month,32).getDate()},_getFirstDayOfMonth:function(year,month){return new Date(year,month,1).getDay()},_canAdjustMonth:function(inst,offset,curYear,curMonth){var numMonths=this._getNumberOfMonths(inst);var date=this._daylightSavingAdjust(new Date(curYear,curMonth+(offset<0?offset:numMonths[1]),1));if(offset<0){date.setDate(this._getDaysInMonth(date.getFullYear(),date.getMonth()))}return this._isInRange(inst,date)},_isInRange:function(inst,date){var newMinDate=(!inst.rangeStart?null:this._daylightSavingAdjust(new Date(inst.selectedYear,inst.selectedMonth,inst.selectedDay)));newMinDate=(newMinDate&&inst.rangeStart<newMinDate?inst.rangeStart:newMinDate);var minDate=newMinDate||this._getMinMaxDate(inst,"min");var maxDate=this._getMinMaxDate(inst,"max");return((!minDate||date>=minDate)&&(!maxDate||date<=maxDate))},_getFormatConfig:function(inst){var shortYearCutoff=this._get(inst,"shortYearCutoff");shortYearCutoff=(typeof shortYearCutoff!="string"?shortYearCutoff:new Date().getFullYear()%100+parseInt(shortYearCutoff,10));return{shortYearCutoff:shortYearCutoff,dayNamesShort:this._get(inst,"dayNamesShort"),dayNames:this._get(inst,"dayNames"),monthNamesShort:this._get(inst,"monthNamesShort"),monthNames:this._get(inst,"monthNames")}},_formatDate:function(inst,day,month,year){if(!day){inst.currentDay=inst.selectedDay;inst.currentMonth=inst.selectedMonth;inst.currentYear=inst.selectedYear}var date=(day?(typeof day=="object"?day:this._daylightSavingAdjust(new Date(year,month,day))):this._daylightSavingAdjust(new Date(inst.currentYear,inst.currentMonth,inst.currentDay)));return this.formatDate(this._get(inst,"dateFormat"),date,this._getFormatConfig(inst))}});function extendRemove(target,props){$.extend(target,props);for(var name in props){if(props[name]==null||props[name]==undefined){target[name]=props[name]}}return target}function isArray(a){return(a&&(($.browser.safari&&typeof a=="object"&&a.length)||(a.constructor&&a.constructor.toString().match(/\Array\(\)/))))}$.fn.datepicker=function(options){if(!$.datepicker.initialized){$(document.body).append($.datepicker.dpDiv).mousedown($.datepicker._checkExternalClick);$.datepicker.initialized=true}var otherArgs=Array.prototype.slice.call(arguments,1);if(typeof options=="string"&&(options=="isDisabled"||options=="getDate")){return $.datepicker["_"+options+"Datepicker"].apply($.datepicker,[this[0]].concat(otherArgs))}return this.each(function(){typeof options=="string"?$.datepicker["_"+options+"Datepicker"].apply($.datepicker,[this].concat(otherArgs)):$.datepicker._attachDatepicker(this,options)})};$.datepicker=new Datepicker();$.datepicker.initialized=false;$.datepicker.uuid=new Date().getTime();$.datepicker.version="1.6"})(jQuery);/* + * jQuery UI Effects 1.6 + * + * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Effects/ + */ +(function(C){C.effects=C.effects||{};C.extend(C.effects,{version:"1.6",save:function(F,G){for(var E=0;E<G.length;E++){if(G[E]!==null){C.data(F[0],"ec.storage."+G[E],F[0].style[G[E]])}}},restore:function(F,G){for(var E=0;E<G.length;E++){if(G[E]!==null){F.css(G[E],C.data(F[0],"ec.storage."+G[E]))}}},setMode:function(E,F){if(F=="toggle"){F=E.is(":hidden")?"show":"hide"}return F},getBaseline:function(F,G){var H,E;switch(F[0]){case"top":H=0;break;case"middle":H=0.5;break;case"bottom":H=1;break;default:H=F[0]/G.height}switch(F[1]){case"left":E=0;break;case"center":E=0.5;break;case"right":E=1;break;default:E=F[1]/G.width}return{x:E,y:H}},createWrapper:function(F){if(F.parent().attr("id")=="fxWrapper"){return F}var E={width:F.outerWidth({margin:true}),height:F.outerHeight({margin:true}),"float":F.css("float")};F.wrap('<div id="fxWrapper" style="font-size:100%;background:transparent;border:none;margin:0;padding:0"></div>');var I=F.parent();if(F.css("position")=="static"){I.css({position:"relative"});F.css({position:"relative"})}else{var H=F.css("top");if(isNaN(parseInt(H))){H="auto"}var G=F.css("left");if(isNaN(parseInt(G))){G="auto"}I.css({position:F.css("position"),top:H,left:G,zIndex:F.css("z-index")}).show();F.css({position:"relative",top:0,left:0})}I.css(E);return I},removeWrapper:function(E){if(E.parent().attr("id")=="fxWrapper"){return E.parent().replaceWith(E)}return E},setTransition:function(F,G,E,H){H=H||{};C.each(G,function(J,I){unit=F.cssUnit(I);if(unit[0]>0){H[I]=unit[0]*E+unit[1]}});return H},animateClass:function(G,H,J,I){var E=(typeof J=="function"?J:(I?I:null));var F=(typeof J=="object"?J:null);return this.each(function(){var O={};var M=C(this);var N=M.attr("style")||"";if(typeof N=="object"){N=N["cssText"]}if(G.toggle){M.hasClass(G.toggle)?G.remove=G.toggle:G.add=G.toggle}var K=C.extend({},(document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle));if(G.add){M.addClass(G.add)}if(G.remove){M.removeClass(G.remove)}var L=C.extend({},(document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle));if(G.add){M.removeClass(G.add)}if(G.remove){M.addClass(G.remove)}for(var P in L){if(typeof L[P]!="function"&&L[P]&&P.indexOf("Moz")==-1&&P.indexOf("length")==-1&&L[P]!=K[P]&&(P.match(/color/i)||(!P.match(/color/i)&&!isNaN(parseInt(L[P],10))))&&(K.position!="static"||(K.position=="static"&&!P.match(/left|top|bottom|right/)))){O[P]=L[P]}}M.animate(O,H,F,function(){if(typeof C(this).attr("style")=="object"){C(this).attr("style")["cssText"]="";C(this).attr("style")["cssText"]=N}else{C(this).attr("style",N)}if(G.add){C(this).addClass(G.add)}if(G.remove){C(this).removeClass(G.remove)}if(E){E.apply(this,arguments)}})})}});C.fn.extend({_show:C.fn.show,_hide:C.fn.hide,__toggle:C.fn.toggle,_addClass:C.fn.addClass,_removeClass:C.fn.removeClass,_toggleClass:C.fn.toggleClass,effect:function(E,G,F,H){return C.effects[E]?C.effects[E].call(this,{method:E,options:G||{},duration:F,callback:H}):null},show:function(){if(!arguments[0]||(arguments[0].constructor==Number||/(slow|normal|fast)/.test(arguments[0]))){return this._show.apply(this,arguments)}else{var E=arguments[1]||{};E["mode"]="show";return this.effect.apply(this,[arguments[0],E,arguments[2]||E.duration,arguments[3]||E.callback])}},hide:function(){if(!arguments[0]||(arguments[0].constructor==Number||/(slow|normal|fast)/.test(arguments[0]))){return this._hide.apply(this,arguments)}else{var E=arguments[1]||{};E["mode"]="hide";return this.effect.apply(this,[arguments[0],E,arguments[2]||E.duration,arguments[3]||E.callback])}},toggle:function(){if(!arguments[0]||(arguments[0].constructor==Number||/(slow|normal|fast)/.test(arguments[0]))||(arguments[0].constructor==Function)){return this.__toggle.apply(this,arguments)}else{var E=arguments[1]||{};E["mode"]="toggle";return this.effect.apply(this,[arguments[0],E,arguments[2]||E.duration,arguments[3]||E.callback])}},addClass:function(F,E,H,G){return E?C.effects.animateClass.apply(this,[{add:F},E,H,G]):this._addClass(F)},removeClass:function(F,E,H,G){return E?C.effects.animateClass.apply(this,[{remove:F},E,H,G]):this._removeClass(F)},toggleClass:function(F,E,H,G){return E?C.effects.animateClass.apply(this,[{toggle:F},E,H,G]):this._toggleClass(F)},morph:function(E,G,F,I,H){return C.effects.animateClass.apply(this,[{add:G,remove:E},F,I,H])},switchClass:function(){return this.morph.apply(this,arguments)},cssUnit:function(E){var F=this.css(E),G=[];C.each(["em","px","%","pt"],function(H,I){if(F.indexOf(I)>0){G=[parseFloat(F),I]}});return G}});C.each(["backgroundColor","borderBottomColor","borderLeftColor","borderRightColor","borderTopColor","color","outlineColor"],function(F,E){C.fx.step[E]=function(G){if(G.state==0){G.start=D(G.elem,E);G.end=B(G.end)}G.elem.style[E]="rgb("+[Math.max(Math.min(parseInt((G.pos*(G.end[0]-G.start[0]))+G.start[0]),255),0),Math.max(Math.min(parseInt((G.pos*(G.end[1]-G.start[1]))+G.start[1]),255),0),Math.max(Math.min(parseInt((G.pos*(G.end[2]-G.start[2]))+G.start[2]),255),0)].join(",")+")"}});function B(F){var E;if(F&&F.constructor==Array&&F.length==3){return F}if(E=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(F)){return[parseInt(E[1]),parseInt(E[2]),parseInt(E[3])]}if(E=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(F)){return[parseFloat(E[1])*2.55,parseFloat(E[2])*2.55,parseFloat(E[3])*2.55]}if(E=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(F)){return[parseInt(E[1],16),parseInt(E[2],16),parseInt(E[3],16)]}if(E=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(F)){return[parseInt(E[1]+E[1],16),parseInt(E[2]+E[2],16),parseInt(E[3]+E[3],16)]}if(E=/rgba\(0, 0, 0, 0\)/.exec(F)){return A["transparent"]}return A[C.trim(F).toLowerCase()]}function D(G,E){var F;do{F=C.curCSS(G,E);if(F!=""&&F!="transparent"||C.nodeName(G,"body")){break}E="backgroundColor"}while(G=G.parentNode);return B(F)}var A={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0],transparent:[255,255,255]};C.easing.jswing=C.easing.swing;C.extend(C.easing,{def:"easeOutQuad",swing:function(F,G,E,I,H){return C.easing[C.easing.def](F,G,E,I,H)},easeInQuad:function(F,G,E,I,H){return I*(G/=H)*G+E},easeOutQuad:function(F,G,E,I,H){return -I*(G/=H)*(G-2)+E},easeInOutQuad:function(F,G,E,I,H){if((G/=H/2)<1){return I/2*G*G+E}return -I/2*((--G)*(G-2)-1)+E},easeInCubic:function(F,G,E,I,H){return I*(G/=H)*G*G+E},easeOutCubic:function(F,G,E,I,H){return I*((G=G/H-1)*G*G+1)+E},easeInOutCubic:function(F,G,E,I,H){if((G/=H/2)<1){return I/2*G*G*G+E}return I/2*((G-=2)*G*G+2)+E},easeInQuart:function(F,G,E,I,H){return I*(G/=H)*G*G*G+E},easeOutQuart:function(F,G,E,I,H){return -I*((G=G/H-1)*G*G*G-1)+E},easeInOutQuart:function(F,G,E,I,H){if((G/=H/2)<1){return I/2*G*G*G*G+E}return -I/2*((G-=2)*G*G*G-2)+E},easeInQuint:function(F,G,E,I,H){return I*(G/=H)*G*G*G*G+E},easeOutQuint:function(F,G,E,I,H){return I*((G=G/H-1)*G*G*G*G+1)+E},easeInOutQuint:function(F,G,E,I,H){if((G/=H/2)<1){return I/2*G*G*G*G*G+E}return I/2*((G-=2)*G*G*G*G+2)+E},easeInSine:function(F,G,E,I,H){return -I*Math.cos(G/H*(Math.PI/2))+I+E},easeOutSine:function(F,G,E,I,H){return I*Math.sin(G/H*(Math.PI/2))+E},easeInOutSine:function(F,G,E,I,H){return -I/2*(Math.cos(Math.PI*G/H)-1)+E},easeInExpo:function(F,G,E,I,H){return(G==0)?E:I*Math.pow(2,10*(G/H-1))+E},easeOutExpo:function(F,G,E,I,H){return(G==H)?E+I:I*(-Math.pow(2,-10*G/H)+1)+E},easeInOutExpo:function(F,G,E,I,H){if(G==0){return E}if(G==H){return E+I}if((G/=H/2)<1){return I/2*Math.pow(2,10*(G-1))+E}return I/2*(-Math.pow(2,-10*--G)+2)+E},easeInCirc:function(F,G,E,I,H){return -I*(Math.sqrt(1-(G/=H)*G)-1)+E},easeOutCirc:function(F,G,E,I,H){return I*Math.sqrt(1-(G=G/H-1)*G)+E},easeInOutCirc:function(F,G,E,I,H){if((G/=H/2)<1){return -I/2*(Math.sqrt(1-G*G)-1)+E}return I/2*(Math.sqrt(1-(G-=2)*G)+1)+E},easeInElastic:function(F,H,E,L,K){var I=1.70158;var J=0;var G=L;if(H==0){return E}if((H/=K)==1){return E+L}if(!J){J=K*0.3}if(G<Math.abs(L)){G=L;var I=J/4}else{var I=J/(2*Math.PI)*Math.asin(L/G)}return -(G*Math.pow(2,10*(H-=1))*Math.sin((H*K-I)*(2*Math.PI)/J))+E},easeOutElastic:function(F,H,E,L,K){var I=1.70158;var J=0;var G=L;if(H==0){return E}if((H/=K)==1){return E+L}if(!J){J=K*0.3}if(G<Math.abs(L)){G=L;var I=J/4}else{var I=J/(2*Math.PI)*Math.asin(L/G)}return G*Math.pow(2,-10*H)*Math.sin((H*K-I)*(2*Math.PI)/J)+L+E},easeInOutElastic:function(F,H,E,L,K){var I=1.70158;var J=0;var G=L;if(H==0){return E}if((H/=K/2)==2){return E+L}if(!J){J=K*(0.3*1.5)}if(G<Math.abs(L)){G=L;var I=J/4}else{var I=J/(2*Math.PI)*Math.asin(L/G)}if(H<1){return -0.5*(G*Math.pow(2,10*(H-=1))*Math.sin((H*K-I)*(2*Math.PI)/J))+E}return G*Math.pow(2,-10*(H-=1))*Math.sin((H*K-I)*(2*Math.PI)/J)*0.5+L+E},easeInBack:function(F,G,E,J,I,H){if(H==undefined){H=1.70158}return J*(G/=I)*G*((H+1)*G-H)+E},easeOutBack:function(F,G,E,J,I,H){if(H==undefined){H=1.70158}return J*((G=G/I-1)*G*((H+1)*G+H)+1)+E},easeInOutBack:function(F,G,E,J,I,H){if(H==undefined){H=1.70158}if((G/=I/2)<1){return J/2*(G*G*(((H*=(1.525))+1)*G-H))+E}return J/2*((G-=2)*G*(((H*=(1.525))+1)*G+H)+2)+E},easeInBounce:function(F,G,E,I,H){return I-C.easing.easeOutBounce(F,H-G,0,I,H)+E},easeOutBounce:function(F,G,E,I,H){if((G/=H)<(1/2.75)){return I*(7.5625*G*G)+E}else{if(G<(2/2.75)){return I*(7.5625*(G-=(1.5/2.75))*G+0.75)+E}else{if(G<(2.5/2.75)){return I*(7.5625*(G-=(2.25/2.75))*G+0.9375)+E}else{return I*(7.5625*(G-=(2.625/2.75))*G+0.984375)+E}}}},easeInOutBounce:function(F,G,E,I,H){if(G<H/2){return C.easing.easeInBounce(F,G*2,0,I,H)*0.5+E}return C.easing.easeOutBounce(F,G*2-H,0,I,H)*0.5+I*0.5+E}})})(jQuery);/* + * jQuery UI Effects Blind 1.6 + * + * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Effects/Blind + * + * Depends: + * effects.core.js + */ +(function(A){A.effects.blind=function(B){return this.queue(function(){var D=A(this),C=["position","top","left"];var H=A.effects.setMode(D,B.options.mode||"hide");var G=B.options.direction||"vertical";A.effects.save(D,C);D.show();var J=A.effects.createWrapper(D).css({overflow:"hidden"});var E=(G=="vertical")?"height":"width";var I=(G=="vertical")?J.height():J.width();if(H=="show"){J.css(E,0)}var F={};F[E]=H=="show"?I:0;J.animate(F,B.duration,B.options.easing,function(){if(H=="hide"){D.hide()}A.effects.restore(D,C);A.effects.removeWrapper(D);if(B.callback){B.callback.apply(D[0],arguments)}D.dequeue()})})}})(jQuery);/* + * jQuery UI Effects Bounce 1.6 + * + * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Effects/Bounce + * + * Depends: + * effects.core.js + */ +(function(A){A.effects.bounce=function(B){return this.queue(function(){var E=A(this),K=["position","top","left"];var J=A.effects.setMode(E,B.options.mode||"effect");var M=B.options.direction||"up";var C=B.options.distance||20;var D=B.options.times||5;var G=B.duration||250;if(/show|hide/.test(J)){K.push("opacity")}A.effects.save(E,K);E.show();A.effects.createWrapper(E);var F=(M=="up"||M=="down")?"top":"left";var O=(M=="up"||M=="left")?"pos":"neg";var C=B.options.distance||(F=="top"?E.outerHeight({margin:true})/3:E.outerWidth({margin:true})/3);if(J=="show"){E.css("opacity",0).css(F,O=="pos"?-C:C)}if(J=="hide"){C=C/(D*2)}if(J!="hide"){D--}if(J=="show"){var H={opacity:1};H[F]=(O=="pos"?"+=":"-=")+C;E.animate(H,G/2,B.options.easing);C=C/2;D--}for(var I=0;I<D;I++){var N={},L={};N[F]=(O=="pos"?"-=":"+=")+C;L[F]=(O=="pos"?"+=":"-=")+C;E.animate(N,G/2,B.options.easing).animate(L,G/2,B.options.easing);C=(J=="hide")?C*2:C/2}if(J=="hide"){var H={opacity:0};H[F]=(O=="pos"?"-=":"+=")+C;E.animate(H,G/2,B.options.easing,function(){E.hide();A.effects.restore(E,K);A.effects.removeWrapper(E);if(B.callback){B.callback.apply(this,arguments)}})}else{var N={},L={};N[F]=(O=="pos"?"-=":"+=")+C;L[F]=(O=="pos"?"+=":"-=")+C;E.animate(N,G/2,B.options.easing).animate(L,G/2,B.options.easing,function(){A.effects.restore(E,K);A.effects.removeWrapper(E);if(B.callback){B.callback.apply(this,arguments)}})}E.queue("fx",function(){E.dequeue()});E.dequeue()})}})(jQuery);/* + * jQuery UI Effects Clip 1.6 + * + * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Effects/Clip + * + * Depends: + * effects.core.js + */ +(function(A){A.effects.clip=function(B){return this.queue(function(){var F=A(this),J=["position","top","left","height","width"];var I=A.effects.setMode(F,B.options.mode||"hide");var K=B.options.direction||"vertical";A.effects.save(F,J);F.show();var C=A.effects.createWrapper(F).css({overflow:"hidden"});var E=F[0].tagName=="IMG"?C:F;var G={size:(K=="vertical")?"height":"width",position:(K=="vertical")?"top":"left"};var D=(K=="vertical")?E.height():E.width();if(I=="show"){E.css(G.size,0);E.css(G.position,D/2)}var H={};H[G.size]=I=="show"?D:0;H[G.position]=I=="show"?0:D/2;E.animate(H,{queue:false,duration:B.duration,easing:B.options.easing,complete:function(){if(I=="hide"){F.hide()}A.effects.restore(F,J);A.effects.removeWrapper(F);if(B.callback){B.callback.apply(F[0],arguments)}F.dequeue()}})})}})(jQuery);/* + * jQuery UI Effects Drop 1.6 + * + * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Effects/Drop + * + * Depends: + * effects.core.js + */ +(function(A){A.effects.drop=function(B){return this.queue(function(){var E=A(this),D=["position","top","left","opacity"];var I=A.effects.setMode(E,B.options.mode||"hide");var H=B.options.direction||"left";A.effects.save(E,D);E.show();A.effects.createWrapper(E);var F=(H=="up"||H=="down")?"top":"left";var C=(H=="up"||H=="left")?"pos":"neg";var J=B.options.distance||(F=="top"?E.outerHeight({margin:true})/2:E.outerWidth({margin:true})/2);if(I=="show"){E.css("opacity",0).css(F,C=="pos"?-J:J)}var G={opacity:I=="show"?1:0};G[F]=(I=="show"?(C=="pos"?"+=":"-="):(C=="pos"?"-=":"+="))+J;E.animate(G,{queue:false,duration:B.duration,easing:B.options.easing,complete:function(){if(I=="hide"){E.hide()}A.effects.restore(E,D);A.effects.removeWrapper(E);if(B.callback){B.callback.apply(this,arguments)}E.dequeue()}})})}})(jQuery);/* + * jQuery UI Effects Explode 1.6 + * + * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Effects/Explode + * + * Depends: + * effects.core.js + */ +(function(A){A.effects.explode=function(B){return this.queue(function(){var I=B.options.pieces?Math.round(Math.sqrt(B.options.pieces)):3;var E=B.options.pieces?Math.round(Math.sqrt(B.options.pieces)):3;B.options.mode=B.options.mode=="toggle"?(A(this).is(":visible")?"hide":"show"):B.options.mode;var H=A(this).show().css("visibility","hidden");var J=H.offset();J.top-=parseInt(H.css("marginTop"))||0;J.left-=parseInt(H.css("marginLeft"))||0;var G=H.outerWidth(true);var C=H.outerHeight(true);for(var F=0;F<I;F++){for(var D=0;D<E;D++){H.clone().appendTo("body").wrap("<div></div>").css({position:"absolute",visibility:"visible",left:-D*(G/E),top:-F*(C/I)}).parent().addClass("effects-explode").css({position:"absolute",overflow:"hidden",width:G/E,height:C/I,left:J.left+D*(G/E)+(B.options.mode=="show"?(D-Math.floor(E/2))*(G/E):0),top:J.top+F*(C/I)+(B.options.mode=="show"?(F-Math.floor(I/2))*(C/I):0),opacity:B.options.mode=="show"?0:1}).animate({left:J.left+D*(G/E)+(B.options.mode=="show"?0:(D-Math.floor(E/2))*(G/E)),top:J.top+F*(C/I)+(B.options.mode=="show"?0:(F-Math.floor(I/2))*(C/I)),opacity:B.options.mode=="show"?1:0},B.duration||500)}}setTimeout(function(){B.options.mode=="show"?H.css({visibility:"visible"}):H.css({visibility:"visible"}).hide();if(B.callback){B.callback.apply(H[0])}H.dequeue();A(".effects-explode").remove()},B.duration||500)})}})(jQuery);/* + * jQuery UI Effects Fold 1.6 + * + * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Effects/Fold + * + * Depends: + * effects.core.js + */ +(function(A){A.effects.fold=function(B){return this.queue(function(){var E=A(this),J=["position","top","left"];var G=A.effects.setMode(E,B.options.mode||"hide");var N=B.options.size||15;var M=!(!B.options.horizFirst);A.effects.save(E,J);E.show();var D=A.effects.createWrapper(E).css({overflow:"hidden"});var H=((G=="show")!=M);var F=H?["width","height"]:["height","width"];var C=H?[D.width(),D.height()]:[D.height(),D.width()];var I=/([0-9]+)%/.exec(N);if(I){N=parseInt(I[1])/100*C[G=="hide"?0:1]}if(G=="show"){D.css(M?{height:0,width:N}:{height:N,width:0})}var L={},K={};L[F[0]]=G=="show"?C[0]:N;K[F[1]]=G=="show"?C[1]:0;D.animate(L,B.duration/2,B.options.easing).animate(K,B.duration/2,B.options.easing,function(){if(G=="hide"){E.hide()}A.effects.restore(E,J);A.effects.removeWrapper(E);if(B.callback){B.callback.apply(E[0],arguments)}E.dequeue()})})}})(jQuery);/* + * jQuery UI Effects Highlight 1.6 + * + * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Effects/Highlight + * + * Depends: + * effects.core.js + */ +(function(A){A.effects.highlight=function(B){return this.queue(function(){var E=A(this),D=["backgroundImage","backgroundColor","opacity"];var H=A.effects.setMode(E,B.options.mode||"show");var C=B.options.color||"#ffff99";var G=E.css("backgroundColor");A.effects.save(E,D);E.show();E.css({backgroundImage:"none",backgroundColor:C});var F={backgroundColor:G};if(H=="hide"){F["opacity"]=0}E.animate(F,{queue:false,duration:B.duration,easing:B.options.easing,complete:function(){if(H=="hide"){E.hide()}A.effects.restore(E,D);if(H=="show"&&A.browser.msie){this.style.removeAttribute("filter")}if(B.callback){B.callback.apply(this,arguments)}E.dequeue()}})})}})(jQuery);/* + * jQuery UI Effects Pulsate 1.6 + * + * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Effects/Pulsate + * + * Depends: + * effects.core.js + */ +(function(A){A.effects.pulsate=function(B){return this.queue(function(){var D=A(this);var F=A.effects.setMode(D,B.options.mode||"show");var E=B.options.times||5;if(F=="hide"){E--}if(D.is(":hidden")){D.css("opacity",0);D.show();D.animate({opacity:1},B.duration/2,B.options.easing);E=E-2}for(var C=0;C<E;C++){D.animate({opacity:0},B.duration/2,B.options.easing).animate({opacity:1},B.duration/2,B.options.easing)}if(F=="hide"){D.animate({opacity:0},B.duration/2,B.options.easing,function(){D.hide();if(B.callback){B.callback.apply(this,arguments)}})}else{D.animate({opacity:0},B.duration/2,B.options.easing).animate({opacity:1},B.duration/2,B.options.easing,function(){if(B.callback){B.callback.apply(this,arguments)}})}D.queue("fx",function(){D.dequeue()});D.dequeue()})}})(jQuery);/* + * jQuery UI Effects Scale 1.6 + * + * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Effects/Scale + * + * Depends: + * effects.core.js + */ +(function(A){A.effects.puff=function(B){return this.queue(function(){var F=A(this);var C=A.extend(true,{},B.options);var H=A.effects.setMode(F,B.options.mode||"hide");var G=parseInt(B.options.percent)||150;C.fade=true;var E={height:F.height(),width:F.width()};var D=G/100;F.from=(H=="hide")?E:{height:E.height*D,width:E.width*D};C.from=F.from;C.percent=(H=="hide")?G:100;C.mode=H;F.effect("scale",C,B.duration,B.callback);F.dequeue()})};A.effects.scale=function(B){return this.queue(function(){var G=A(this);var D=A.extend(true,{},B.options);var J=A.effects.setMode(G,B.options.mode||"effect");var H=parseInt(B.options.percent)||(parseInt(B.options.percent)==0?0:(J=="hide"?0:100));var I=B.options.direction||"both";var C=B.options.origin;if(J!="effect"){D.origin=C||["middle","center"];D.restore=true}var F={height:G.height(),width:G.width()};G.from=B.options.from||(J=="show"?{height:0,width:0}:F);var E={y:I!="horizontal"?(H/100):1,x:I!="vertical"?(H/100):1};G.to={height:F.height*E.y,width:F.width*E.x};if(B.options.fade){if(J=="show"){G.from.opacity=0;G.to.opacity=1}if(J=="hide"){G.from.opacity=1;G.to.opacity=0}}D.from=G.from;D.to=G.to;D.mode=J;G.effect("size",D,B.duration,B.callback);G.dequeue()})};A.effects.size=function(B){return this.queue(function(){var C=A(this),N=["position","top","left","width","height","overflow","opacity"];var M=["position","top","left","overflow","opacity"];var J=["width","height","overflow"];var P=["fontSize"];var K=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"];var F=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"];var G=A.effects.setMode(C,B.options.mode||"effect");var I=B.options.restore||false;var E=B.options.scale||"both";var O=B.options.origin;var D={height:C.height(),width:C.width()};C.from=B.options.from||D;C.to=B.options.to||D;if(O){var H=A.effects.getBaseline(O,D);C.from.top=(D.height-C.from.height)*H.y;C.from.left=(D.width-C.from.width)*H.x;C.to.top=(D.height-C.to.height)*H.y;C.to.left=(D.width-C.to.width)*H.x}var L={from:{y:C.from.height/D.height,x:C.from.width/D.width},to:{y:C.to.height/D.height,x:C.to.width/D.width}};if(E=="box"||E=="both"){if(L.from.y!=L.to.y){N=N.concat(K);C.from=A.effects.setTransition(C,K,L.from.y,C.from);C.to=A.effects.setTransition(C,K,L.to.y,C.to)}if(L.from.x!=L.to.x){N=N.concat(F);C.from=A.effects.setTransition(C,F,L.from.x,C.from);C.to=A.effects.setTransition(C,F,L.to.x,C.to)}}if(E=="content"||E=="both"){if(L.from.y!=L.to.y){N=N.concat(P);C.from=A.effects.setTransition(C,P,L.from.y,C.from);C.to=A.effects.setTransition(C,P,L.to.y,C.to)}}A.effects.save(C,I?N:M);C.show();A.effects.createWrapper(C);C.css("overflow","hidden").css(C.from);if(E=="content"||E=="both"){K=K.concat(["marginTop","marginBottom"]).concat(P);F=F.concat(["marginLeft","marginRight"]);J=N.concat(K).concat(F);C.find("*[width]").each(function(){child=A(this);if(I){A.effects.save(child,J)}var Q={height:child.height(),width:child.width()};child.from={height:Q.height*L.from.y,width:Q.width*L.from.x};child.to={height:Q.height*L.to.y,width:Q.width*L.to.x};if(L.from.y!=L.to.y){child.from=A.effects.setTransition(child,K,L.from.y,child.from);child.to=A.effects.setTransition(child,K,L.to.y,child.to)}if(L.from.x!=L.to.x){child.from=A.effects.setTransition(child,F,L.from.x,child.from);child.to=A.effects.setTransition(child,F,L.to.x,child.to)}child.css(child.from);child.animate(child.to,B.duration,B.options.easing,function(){if(I){A.effects.restore(child,J)}})})}C.animate(C.to,{queue:false,duration:B.duration,easing:B.options.easing,complete:function(){if(G=="hide"){C.hide()}A.effects.restore(C,I?N:M);A.effects.removeWrapper(C);if(B.callback){B.callback.apply(this,arguments)}C.dequeue()}})})}})(jQuery);/* + * jQuery UI Effects Shake 1.6 + * + * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Effects/Shake + * + * Depends: + * effects.core.js + */ +(function(A){A.effects.shake=function(B){return this.queue(function(){var E=A(this),K=["position","top","left"];var J=A.effects.setMode(E,B.options.mode||"effect");var M=B.options.direction||"left";var C=B.options.distance||20;var D=B.options.times||3;var G=B.duration||B.options.duration||140;A.effects.save(E,K);E.show();A.effects.createWrapper(E);var F=(M=="up"||M=="down")?"top":"left";var O=(M=="up"||M=="left")?"pos":"neg";var H={},N={},L={};H[F]=(O=="pos"?"-=":"+=")+C;N[F]=(O=="pos"?"+=":"-=")+C*2;L[F]=(O=="pos"?"-=":"+=")+C*2;E.animate(H,G,B.options.easing);for(var I=1;I<D;I++){E.animate(N,G,B.options.easing).animate(L,G,B.options.easing)}E.animate(N,G,B.options.easing).animate(H,G/2,B.options.easing,function(){A.effects.restore(E,K);A.effects.removeWrapper(E);if(B.callback){B.callback.apply(this,arguments)}});E.queue("fx",function(){E.dequeue()});E.dequeue()})}})(jQuery);/* + * jQuery UI Effects Slide 1.6 + * + * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Effects/Slide + * + * Depends: + * effects.core.js + */ +(function(A){A.effects.slide=function(B){return this.queue(function(){var E=A(this),D=["position","top","left"];var I=A.effects.setMode(E,B.options.mode||"show");var H=B.options.direction||"left";A.effects.save(E,D);E.show();A.effects.createWrapper(E).css({overflow:"hidden"});var F=(H=="up"||H=="down")?"top":"left";var C=(H=="up"||H=="left")?"pos":"neg";var J=B.options.distance||(F=="top"?E.outerHeight({margin:true}):E.outerWidth({margin:true}));if(I=="show"){E.css(F,C=="pos"?-J:J)}var G={};G[F]=(I=="show"?(C=="pos"?"+=":"-="):(C=="pos"?"-=":"+="))+J;E.animate(G,{queue:false,duration:B.duration,easing:B.options.easing,complete:function(){if(I=="hide"){E.hide()}A.effects.restore(E,D);A.effects.removeWrapper(E);if(B.callback){B.callback.apply(this,arguments)}E.dequeue()}})})}})(jQuery);/* + * jQuery UI Effects Transfer 1.6 + * + * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Effects/Transfer + * + * Depends: + * effects.core.js + */ +(function(A){A.effects.transfer=function(B){return this.queue(function(){var E=A(this);var G=A.effects.setMode(E,B.options.mode||"effect");var F=A(B.options.to);var C=E.offset();var D=A('<div class="ui-effects-transfer"></div>').appendTo(document.body);if(B.options.className){D.addClass(B.options.className)}D.addClass(B.options.className);D.css({top:C.top,left:C.left,height:E.outerHeight()-parseInt(D.css("borderTopWidth"))-parseInt(D.css("borderBottomWidth")),width:E.outerWidth()-parseInt(D.css("borderLeftWidth"))-parseInt(D.css("borderRightWidth")),position:"absolute"});C=F.offset();animation={top:C.top,left:C.left,height:F.outerHeight()-parseInt(D.css("borderTopWidth"))-parseInt(D.css("borderBottomWidth")),width:F.outerWidth()-parseInt(D.css("borderLeftWidth"))-parseInt(D.css("borderRightWidth"))};D.animate(animation,B.duration,B.options.easing,function(){D.remove();if(B.callback){B.callback.apply(E[0],arguments)}E.dequeue()})})}})(jQuery); \ No newline at end of file diff --git a/modules/tntcarrier/js/jquery.js b/modules/tntcarrier/js/jquery.js new file mode 100644 index 000000000..72f32c906 --- /dev/null +++ b/modules/tntcarrier/js/jquery.js @@ -0,0 +1,32 @@ +/* + * jQuery 1.2.6 - New Wave Javascript + * + * Copyright (c) 2008 John Resig (jquery.com) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * $Date: 2008-05-24 14:22:17 -0400 (Sat, 24 May 2008) $ + * $Rev: 5685 $ + */ +(function(){var _jQuery=window.jQuery,_$=window.$;var jQuery=window.jQuery=window.$=function(selector,context){return new jQuery.fn.init(selector,context);};var quickExpr=/^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/,isSimple=/^.[^:#\[\.]*$/,undefined;jQuery.fn=jQuery.prototype={init:function(selector,context){selector=selector||document;if(selector.nodeType){this[0]=selector;this.length=1;return this;}if(typeof selector=="string"){var match=quickExpr.exec(selector);if(match&&(match[1]||!context)){if(match[1])selector=jQuery.clean([match[1]],context);else{var elem=document.getElementById(match[3]);if(elem){if(elem.id!=match[3])return jQuery().find(selector);return jQuery(elem);}selector=[];}}else +return jQuery(context).find(selector);}else if(jQuery.isFunction(selector))return jQuery(document)[jQuery.fn.ready?"ready":"load"](selector);return this.setArray(jQuery.makeArray(selector));},jquery:"1.2.6",size:function(){return this.length;},length:0,get:function(num){return num==undefined?jQuery.makeArray(this):this[num];},pushStack:function(elems){var ret=jQuery(elems);ret.prevObject=this;return ret;},setArray:function(elems){this.length=0;Array.prototype.push.apply(this,elems);return this;},each:function(callback,args){return jQuery.each(this,callback,args);},index:function(elem){var ret=-1;return jQuery.inArray(elem&&elem.jquery?elem[0]:elem,this);},attr:function(name,value,type){var options=name;if(name.constructor==String)if(value===undefined)return this[0]&&jQuery[type||"attr"](this[0],name);else{options={};options[name]=value;}return this.each(function(i){for(name in options)jQuery.attr(type?this.style:this,name,jQuery.prop(this,options[name],type,i,name));});},css:function(key,value){if((key=='width'||key=='height')&&parseFloat(value)<0)value=undefined;return this.attr(key,value,"curCSS");},text:function(text){if(typeof text!="object"&&text!=null)return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(text));var ret="";jQuery.each(text||this,function(){jQuery.each(this.childNodes,function(){if(this.nodeType!=8)ret+=this.nodeType!=1?this.nodeValue:jQuery.fn.text([this]);});});return ret;},wrapAll:function(html){if(this[0])jQuery(html,this[0].ownerDocument).clone().insertBefore(this[0]).map(function(){var elem=this;while(elem.firstChild)elem=elem.firstChild;return elem;}).append(this);return this;},wrapInner:function(html){return this.each(function(){jQuery(this).contents().wrapAll(html);});},wrap:function(html){return this.each(function(){jQuery(this).wrapAll(html);});},append:function(){return this.domManip(arguments,true,false,function(elem){if(this.nodeType==1)this.appendChild(elem);});},prepend:function(){return this.domManip(arguments,true,true,function(elem){if(this.nodeType==1)this.insertBefore(elem,this.firstChild);});},before:function(){return this.domManip(arguments,false,false,function(elem){this.parentNode.insertBefore(elem,this);});},after:function(){return this.domManip(arguments,false,true,function(elem){this.parentNode.insertBefore(elem,this.nextSibling);});},end:function(){return this.prevObject||jQuery([]);},find:function(selector){var elems=jQuery.map(this,function(elem){return jQuery.find(selector,elem);});return this.pushStack(/[^+>] [^+>]/.test(selector)||selector.indexOf("..")>-1?jQuery.unique(elems):elems);},clone:function(events){var ret=this.map(function(){if(jQuery.browser.msie&&!jQuery.isXMLDoc(this)){var clone=this.cloneNode(true),container=document.createElement("div");container.appendChild(clone);return jQuery.clean([container.innerHTML])[0];}else +return this.cloneNode(true);});var clone=ret.find("*").andSelf().each(function(){if(this[expando]!=undefined)this[expando]=null;});if(events===true)this.find("*").andSelf().each(function(i){if(this.nodeType==3)return;var events=jQuery.data(this,"events");for(var type in events)for(var handler in events[type])jQuery.event.add(clone[i],type,events[type][handler],events[type][handler].data);});return ret;},filter:function(selector){return this.pushStack(jQuery.isFunction(selector)&&jQuery.grep(this,function(elem,i){return selector.call(elem,i);})||jQuery.multiFilter(selector,this));},not:function(selector){if(selector.constructor==String)if(isSimple.test(selector))return this.pushStack(jQuery.multiFilter(selector,this,true));else +selector=jQuery.multiFilter(selector,this);var isArrayLike=selector.length&&selector[selector.length-1]!==undefined&&!selector.nodeType;return this.filter(function(){return isArrayLike?jQuery.inArray(this,selector)<0:this!=selector;});},add:function(selector){return this.pushStack(jQuery.unique(jQuery.merge(this.get(),typeof selector=='string'?jQuery(selector):jQuery.makeArray(selector))));},is:function(selector){return!!selector&&jQuery.multiFilter(selector,this).length>0;},hasClass:function(selector){return this.is("."+selector);},val:function(value){if(value==undefined){if(this.length){var elem=this[0];if(jQuery.nodeName(elem,"select")){var index=elem.selectedIndex,values=[],options=elem.options,one=elem.type=="select-one";if(index<0)return null;for(var i=one?index:0,max=one?index+1:options.length;i<max;i++){var option=options[i];if(option.selected){value=jQuery.browser.msie&&!option.attributes.value.specified?option.text:option.value;if(one)return value;values.push(value);}}return values;}else +return(this[0].value||"").replace(/\r/g,"");}return undefined;}if(value.constructor==Number)value+='';return this.each(function(){if(this.nodeType!=1)return;if(value.constructor==Array&&/radio|checkbox/.test(this.type))this.checked=(jQuery.inArray(this.value,value)>=0||jQuery.inArray(this.name,value)>=0);else if(jQuery.nodeName(this,"select")){var values=jQuery.makeArray(value);jQuery("option",this).each(function(){this.selected=(jQuery.inArray(this.value,values)>=0||jQuery.inArray(this.text,values)>=0);});if(!values.length)this.selectedIndex=-1;}else +this.value=value;});},html:function(value){return value==undefined?(this[0]?this[0].innerHTML:null):this.empty().append(value);},replaceWith:function(value){return this.after(value).remove();},eq:function(i){return this.slice(i,i+1);},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments));},map:function(callback){return this.pushStack(jQuery.map(this,function(elem,i){return callback.call(elem,i,elem);}));},andSelf:function(){return this.add(this.prevObject);},data:function(key,value){var parts=key.split(".");parts[1]=parts[1]?"."+parts[1]:"";if(value===undefined){var data=this.triggerHandler("getData"+parts[1]+"!",[parts[0]]);if(data===undefined&&this.length)data=jQuery.data(this[0],key);return data===undefined&&parts[1]?this.data(parts[0]):data;}else +return this.trigger("setData"+parts[1]+"!",[parts[0],value]).each(function(){jQuery.data(this,key,value);});},removeData:function(key){return this.each(function(){jQuery.removeData(this,key);});},domManip:function(args,table,reverse,callback){var clone=this.length>1,elems;return this.each(function(){if(!elems){elems=jQuery.clean(args,this.ownerDocument);if(reverse)elems.reverse();}var obj=this;if(table&&jQuery.nodeName(this,"table")&&jQuery.nodeName(elems[0],"tr"))obj=this.getElementsByTagName("tbody")[0]||this.appendChild(this.ownerDocument.createElement("tbody"));var scripts=jQuery([]);jQuery.each(elems,function(){var elem=clone?jQuery(this).clone(true)[0]:this;if(jQuery.nodeName(elem,"script"))scripts=scripts.add(elem);else{if(elem.nodeType==1)scripts=scripts.add(jQuery("script",elem).remove());callback.call(obj,elem);}});scripts.each(evalScript);});}};jQuery.fn.init.prototype=jQuery.fn;function evalScript(i,elem){if(elem.src)jQuery.ajax({url:elem.src,async:false,dataType:"script"});else +jQuery.globalEval(elem.text||elem.textContent||elem.innerHTML||"");if(elem.parentNode)elem.parentNode.removeChild(elem);}function now(){return+new Date;}jQuery.extend=jQuery.fn.extend=function(){var target=arguments[0]||{},i=1,length=arguments.length,deep=false,options;if(target.constructor==Boolean){deep=target;target=arguments[1]||{};i=2;}if(typeof target!="object"&&typeof target!="function")target={};if(length==i){target=this;--i;}for(;i<length;i++)if((options=arguments[i])!=null)for(var name in options){var src=target[name],copy=options[name];if(target===copy)continue;if(deep&©&&typeof copy=="object"&&!copy.nodeType)target[name]=jQuery.extend(deep,src||(copy.length!=null?[]:{}),copy);else if(copy!==undefined)target[name]=copy;}return target;};var expando="jQuery"+now(),uuid=0,windowData={},exclude=/z-?index|font-?weight|opacity|zoom|line-?height/i,defaultView=document.defaultView||{};jQuery.extend({noConflict:function(deep){window.$=_$;if(deep)window.jQuery=_jQuery;return jQuery;},isFunction:function(fn){return!!fn&&typeof fn!="string"&&!fn.nodeName&&fn.constructor!=Array&&/^[\s[]?function/.test(fn+"");},isXMLDoc:function(elem){return elem.documentElement&&!elem.body||elem.tagName&&elem.ownerDocument&&!elem.ownerDocument.body;},globalEval:function(data){data=jQuery.trim(data);if(data){var head=document.getElementsByTagName("head")[0]||document.documentElement,script=document.createElement("script");script.type="text/javascript";if(jQuery.browser.msie)script.text=data;else +script.appendChild(document.createTextNode(data));head.insertBefore(script,head.firstChild);head.removeChild(script);}},nodeName:function(elem,name){return elem.nodeName&&elem.nodeName.toUpperCase()==name.toUpperCase();},cache:{},data:function(elem,name,data){elem=elem==window?windowData:elem;var id=elem[expando];if(!id)id=elem[expando]=++uuid;if(name&&!jQuery.cache[id])jQuery.cache[id]={};if(data!==undefined)jQuery.cache[id][name]=data;return name?jQuery.cache[id][name]:id;},removeData:function(elem,name){elem=elem==window?windowData:elem;var id=elem[expando];if(name){if(jQuery.cache[id]){delete jQuery.cache[id][name];name="";for(name in jQuery.cache[id])break;if(!name)jQuery.removeData(elem);}}else{try{delete elem[expando];}catch(e){if(elem.removeAttribute)elem.removeAttribute(expando);}delete jQuery.cache[id];}},each:function(object,callback,args){var name,i=0,length=object.length;if(args){if(length==undefined){for(name in object)if(callback.apply(object[name],args)===false)break;}else +for(;i<length;)if(callback.apply(object[i++],args)===false)break;}else{if(length==undefined){for(name in object)if(callback.call(object[name],name,object[name])===false)break;}else +for(var value=object[0];i<length&&callback.call(value,i,value)!==false;value=object[++i]){}}return object;},prop:function(elem,value,type,i,name){if(jQuery.isFunction(value))value=value.call(elem,i);return value&&value.constructor==Number&&type=="curCSS"&&!exclude.test(name)?value+"px":value;},className:{add:function(elem,classNames){jQuery.each((classNames||"").split(/\s+/),function(i,className){if(elem.nodeType==1&&!jQuery.className.has(elem.className,className))elem.className+=(elem.className?" ":"")+className;});},remove:function(elem,classNames){if(elem.nodeType==1)elem.className=classNames!=undefined?jQuery.grep(elem.className.split(/\s+/),function(className){return!jQuery.className.has(classNames,className);}).join(" "):"";},has:function(elem,className){return jQuery.inArray(className,(elem.className||elem).toString().split(/\s+/))>-1;}},swap:function(elem,options,callback){var old={};for(var name in options){old[name]=elem.style[name];elem.style[name]=options[name];}callback.call(elem);for(var name in options)elem.style[name]=old[name];},css:function(elem,name,force){if(name=="width"||name=="height"){var val,props={position:"absolute",visibility:"hidden",display:"block"},which=name=="width"?["Left","Right"]:["Top","Bottom"];function getWH(){val=name=="width"?elem.offsetWidth:elem.offsetHeight;var padding=0,border=0;jQuery.each(which,function(){padding+=parseFloat(jQuery.curCSS(elem,"padding"+this,true))||0;border+=parseFloat(jQuery.curCSS(elem,"border"+this+"Width",true))||0;});val-=Math.round(padding+border);}if(jQuery(elem).is(":visible"))getWH();else +jQuery.swap(elem,props,getWH);return Math.max(0,val);}return jQuery.curCSS(elem,name,force);},curCSS:function(elem,name,force){var ret,style=elem.style;function color(elem){if(!jQuery.browser.safari)return false;var ret=defaultView.getComputedStyle(elem,null);return!ret||ret.getPropertyValue("color")=="";}if(name=="opacity"&&jQuery.browser.msie){ret=jQuery.attr(style,"opacity");return ret==""?"1":ret;}if(jQuery.browser.opera&&name=="display"){var save=style.outline;style.outline="0 solid black";style.outline=save;}if(name.match(/float/i))name=styleFloat;if(!force&&style&&style[name])ret=style[name];else if(defaultView.getComputedStyle){if(name.match(/float/i))name="float";name=name.replace(/([A-Z])/g,"-$1").toLowerCase();var computedStyle=defaultView.getComputedStyle(elem,null);if(computedStyle&&!color(elem))ret=computedStyle.getPropertyValue(name);else{var swap=[],stack=[],a=elem,i=0;for(;a&&color(a);a=a.parentNode)stack.unshift(a);for(;i<stack.length;i++)if(color(stack[i])){swap[i]=stack[i].style.display;stack[i].style.display="block";}ret=name=="display"&&swap[stack.length-1]!=null?"none":(computedStyle&&computedStyle.getPropertyValue(name))||"";for(i=0;i<swap.length;i++)if(swap[i]!=null)stack[i].style.display=swap[i];}if(name=="opacity"&&ret=="")ret="1";}else if(elem.currentStyle){var camelCase=name.replace(/\-(\w)/g,function(all,letter){return letter.toUpperCase();});ret=elem.currentStyle[name]||elem.currentStyle[camelCase];if(!/^\d+(px)?$/i.test(ret)&&/^\d/.test(ret)){var left=style.left,rsLeft=elem.runtimeStyle.left;elem.runtimeStyle.left=elem.currentStyle.left;style.left=ret||0;ret=style.pixelLeft+"px";style.left=left;elem.runtimeStyle.left=rsLeft;}}return ret;},clean:function(elems,context){var ret=[];context=context||document;if(typeof context.createElement=='undefined')context=context.ownerDocument||context[0]&&context[0].ownerDocument||document;jQuery.each(elems,function(i,elem){if(!elem)return;if(elem.constructor==Number)elem+='';if(typeof elem=="string"){elem=elem.replace(/(<(\w+)[^>]*?)\/>/g,function(all,front,tag){return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?all:front+"></"+tag+">";});var tags=jQuery.trim(elem).toLowerCase(),div=context.createElement("div");var wrap=!tags.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!tags.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||tags.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!tags.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!tags.indexOf("<td")||!tags.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!tags.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||jQuery.browser.msie&&[1,"div<div>","</div>"]||[0,"",""];div.innerHTML=wrap[1]+elem+wrap[2];while(wrap[0]--)div=div.lastChild;if(jQuery.browser.msie){var tbody=!tags.indexOf("<table")&&tags.indexOf("<tbody")<0?div.firstChild&&div.firstChild.childNodes:wrap[1]=="<table>"&&tags.indexOf("<tbody")<0?div.childNodes:[];for(var j=tbody.length-1;j>=0;--j)if(jQuery.nodeName(tbody[j],"tbody")&&!tbody[j].childNodes.length)tbody[j].parentNode.removeChild(tbody[j]);if(/^\s/.test(elem))div.insertBefore(context.createTextNode(elem.match(/^\s*/)[0]),div.firstChild);}elem=jQuery.makeArray(div.childNodes);}if(elem.length===0&&(!jQuery.nodeName(elem,"form")&&!jQuery.nodeName(elem,"select")))return;if(elem[0]==undefined||jQuery.nodeName(elem,"form")||elem.options)ret.push(elem);else +ret=jQuery.merge(ret,elem);});return ret;},attr:function(elem,name,value){if(!elem||elem.nodeType==3||elem.nodeType==8)return undefined;var notxml=!jQuery.isXMLDoc(elem),set=value!==undefined,msie=jQuery.browser.msie;name=notxml&&jQuery.props[name]||name;if(elem.tagName){var special=/href|src|style/.test(name);if(name=="selected"&&jQuery.browser.safari)elem.parentNode.selectedIndex;if(name in elem&¬xml&&!special){if(set){if(name=="type"&&jQuery.nodeName(elem,"input")&&elem.parentNode)throw"type property can't be changed";elem[name]=value;}if(jQuery.nodeName(elem,"form")&&elem.getAttributeNode(name))return elem.getAttributeNode(name).nodeValue;return elem[name];}if(msie&¬xml&&name=="style")return jQuery.attr(elem.style,"cssText",value);if(set)elem.setAttribute(name,""+value);var attr=msie&¬xml&&special?elem.getAttribute(name,2):elem.getAttribute(name);return attr===null?undefined:attr;}if(msie&&name=="opacity"){if(set){elem.zoom=1;elem.filter=(elem.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(value)+''=="NaN"?"":"alpha(opacity="+value*100+")");}return elem.filter&&elem.filter.indexOf("opacity=")>=0?(parseFloat(elem.filter.match(/opacity=([^)]*)/)[1])/100)+'':"";}name=name.replace(/-([a-z])/ig,function(all,letter){return letter.toUpperCase();});if(set)elem[name]=value;return elem[name];},trim:function(text){return(text||"").replace(/^\s+|\s+$/g,"");},makeArray:function(array){var ret=[];if(array!=null){var i=array.length;if(i==null||array.split||array.setInterval||array.call)ret[0]=array;else +while(i)ret[--i]=array[i];}return ret;},inArray:function(elem,array){for(var i=0,length=array.length;i<length;i++)if(array[i]===elem)return i;return-1;},merge:function(first,second){var i=0,elem,pos=first.length;if(jQuery.browser.msie){while(elem=second[i++])if(elem.nodeType!=8)first[pos++]=elem;}else +while(elem=second[i++])first[pos++]=elem;return first;},unique:function(array){var ret=[],done={};try{for(var i=0,length=array.length;i<length;i++){var id=jQuery.data(array[i]);if(!done[id]){done[id]=true;ret.push(array[i]);}}}catch(e){ret=array;}return ret;},grep:function(elems,callback,inv){var ret=[];for(var i=0,length=elems.length;i<length;i++)if(!inv!=!callback(elems[i],i))ret.push(elems[i]);return ret;},map:function(elems,callback){var ret=[];for(var i=0,length=elems.length;i<length;i++){var value=callback(elems[i],i);if(value!=null)ret[ret.length]=value;}return ret.concat.apply([],ret);}});var userAgent=navigator.userAgent.toLowerCase();jQuery.browser={version:(userAgent.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[])[1],safari:/webkit/.test(userAgent),opera:/opera/.test(userAgent),msie:/msie/.test(userAgent)&&!/opera/.test(userAgent),mozilla:/mozilla/.test(userAgent)&&!/(compatible|webkit)/.test(userAgent)};var styleFloat=jQuery.browser.msie?"styleFloat":"cssFloat";jQuery.extend({boxModel:!jQuery.browser.msie||document.compatMode=="CSS1Compat",props:{"for":"htmlFor","class":"className","float":styleFloat,cssFloat:styleFloat,styleFloat:styleFloat,readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing"}});jQuery.each({parent:function(elem){return elem.parentNode;},parents:function(elem){return jQuery.dir(elem,"parentNode");},next:function(elem){return jQuery.nth(elem,2,"nextSibling");},prev:function(elem){return jQuery.nth(elem,2,"previousSibling");},nextAll:function(elem){return jQuery.dir(elem,"nextSibling");},prevAll:function(elem){return jQuery.dir(elem,"previousSibling");},siblings:function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem);},children:function(elem){return jQuery.sibling(elem.firstChild);},contents:function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes);}},function(name,fn){jQuery.fn[name]=function(selector){var ret=jQuery.map(this,fn);if(selector&&typeof selector=="string")ret=jQuery.multiFilter(selector,ret);return this.pushStack(jQuery.unique(ret));};});jQuery.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(name,original){jQuery.fn[name]=function(){var args=arguments;return this.each(function(){for(var i=0,length=args.length;i<length;i++)jQuery(args[i])[original](this);});};});jQuery.each({removeAttr:function(name){jQuery.attr(this,name,"");if(this.nodeType==1)this.removeAttribute(name);},addClass:function(classNames){jQuery.className.add(this,classNames);},removeClass:function(classNames){jQuery.className.remove(this,classNames);},toggleClass:function(classNames){jQuery.className[jQuery.className.has(this,classNames)?"remove":"add"](this,classNames);},remove:function(selector){if(!selector||jQuery.filter(selector,[this]).r.length){jQuery("*",this).add(this).each(function(){jQuery.event.remove(this);jQuery.removeData(this);});if(this.parentNode)this.parentNode.removeChild(this);}},empty:function(){jQuery(">*",this).remove();while(this.firstChild)this.removeChild(this.firstChild);}},function(name,fn){jQuery.fn[name]=function(){return this.each(fn,arguments);};});jQuery.each(["Height","Width"],function(i,name){var type=name.toLowerCase();jQuery.fn[type]=function(size){return this[0]==window?jQuery.browser.opera&&document.body["client"+name]||jQuery.browser.safari&&window["inner"+name]||document.compatMode=="CSS1Compat"&&document.documentElement["client"+name]||document.body["client"+name]:this[0]==document?Math.max(Math.max(document.body["scroll"+name],document.documentElement["scroll"+name]),Math.max(document.body["offset"+name],document.documentElement["offset"+name])):size==undefined?(this.length?jQuery.css(this[0],type):null):this.css(type,size.constructor==String?size:size+"px");};});function num(elem,prop){return elem[0]&&parseInt(jQuery.curCSS(elem[0],prop,true),10)||0;}var chars=jQuery.browser.safari&&parseInt(jQuery.browser.version)<417?"(?:[\\w*_-]|\\\\.)":"(?:[\\w\u0128-\uFFFF*_-]|\\\\.)",quickChild=new RegExp("^>\\s*("+chars+"+)"),quickID=new RegExp("^("+chars+"+)(#)("+chars+"+)"),quickClass=new RegExp("^([#.]?)("+chars+"*)");jQuery.extend({expr:{"":function(a,i,m){return m[2]=="*"||jQuery.nodeName(a,m[2]);},"#":function(a,i,m){return a.getAttribute("id")==m[2];},":":{lt:function(a,i,m){return i<m[3]-0;},gt:function(a,i,m){return i>m[3]-0;},nth:function(a,i,m){return m[3]-0==i;},eq:function(a,i,m){return m[3]-0==i;},first:function(a,i){return i==0;},last:function(a,i,m,r){return i==r.length-1;},even:function(a,i){return i%2==0;},odd:function(a,i){return i%2;},"first-child":function(a){return a.parentNode.getElementsByTagName("*")[0]==a;},"last-child":function(a){return jQuery.nth(a.parentNode.lastChild,1,"previousSibling")==a;},"only-child":function(a){return!jQuery.nth(a.parentNode.lastChild,2,"previousSibling");},parent:function(a){return a.firstChild;},empty:function(a){return!a.firstChild;},contains:function(a,i,m){return(a.textContent||a.innerText||jQuery(a).text()||"").indexOf(m[3])>=0;},visible:function(a){return"hidden"!=a.type&&jQuery.css(a,"display")!="none"&&jQuery.css(a,"visibility")!="hidden";},hidden:function(a){return"hidden"==a.type||jQuery.css(a,"display")=="none"||jQuery.css(a,"visibility")=="hidden";},enabled:function(a){return!a.disabled;},disabled:function(a){return a.disabled;},checked:function(a){return a.checked;},selected:function(a){return a.selected||jQuery.attr(a,"selected");},text:function(a){return"text"==a.type;},radio:function(a){return"radio"==a.type;},checkbox:function(a){return"checkbox"==a.type;},file:function(a){return"file"==a.type;},password:function(a){return"password"==a.type;},submit:function(a){return"submit"==a.type;},image:function(a){return"image"==a.type;},reset:function(a){return"reset"==a.type;},button:function(a){return"button"==a.type||jQuery.nodeName(a,"button");},input:function(a){return/input|select|textarea|button/i.test(a.nodeName);},has:function(a,i,m){return jQuery.find(m[3],a).length;},header:function(a){return/h\d/i.test(a.nodeName);},animated:function(a){return jQuery.grep(jQuery.timers,function(fn){return a==fn.elem;}).length;}}},parse:[/^(\[) *@?([\w-]+) *([!*$^~=]*) *('?"?)(.*?)\4 *\]/,/^(:)([\w-]+)\("?'?(.*?(\(.*?\))?[^(]*?)"?'?\)/,new RegExp("^([:.#]*)("+chars+"+)")],multiFilter:function(expr,elems,not){var old,cur=[];while(expr&&expr!=old){old=expr;var f=jQuery.filter(expr,elems,not);expr=f.t.replace(/^\s*,\s*/,"");cur=not?elems=f.r:jQuery.merge(cur,f.r);}return cur;},find:function(t,context){if(typeof t!="string")return[t];if(context&&context.nodeType!=1&&context.nodeType!=9)return[];context=context||document;var ret=[context],done=[],last,nodeName;while(t&&last!=t){var r=[];last=t;t=jQuery.trim(t);var foundToken=false,re=quickChild,m=re.exec(t);if(m){nodeName=m[1].toUpperCase();for(var i=0;ret[i];i++)for(var c=ret[i].firstChild;c;c=c.nextSibling)if(c.nodeType==1&&(nodeName=="*"||c.nodeName.toUpperCase()==nodeName))r.push(c);ret=r;t=t.replace(re,"");if(t.indexOf(" ")==0)continue;foundToken=true;}else{re=/^([>+~])\s*(\w*)/i;if((m=re.exec(t))!=null){r=[];var merge={};nodeName=m[2].toUpperCase();m=m[1];for(var j=0,rl=ret.length;j<rl;j++){var n=m=="~"||m=="+"?ret[j].nextSibling:ret[j].firstChild;for(;n;n=n.nextSibling)if(n.nodeType==1){var id=jQuery.data(n);if(m=="~"&&merge[id])break;if(!nodeName||n.nodeName.toUpperCase()==nodeName){if(m=="~")merge[id]=true;r.push(n);}if(m=="+")break;}}ret=r;t=jQuery.trim(t.replace(re,""));foundToken=true;}}if(t&&!foundToken){if(!t.indexOf(",")){if(context==ret[0])ret.shift();done=jQuery.merge(done,ret);r=ret=[context];t=" "+t.substr(1,t.length);}else{var re2=quickID;var m=re2.exec(t);if(m){m=[0,m[2],m[3],m[1]];}else{re2=quickClass;m=re2.exec(t);}m[2]=m[2].replace(/\\/g,"");var elem=ret[ret.length-1];if(m[1]=="#"&&elem&&elem.getElementById&&!jQuery.isXMLDoc(elem)){var oid=elem.getElementById(m[2]);if((jQuery.browser.msie||jQuery.browser.opera)&&oid&&typeof oid.id=="string"&&oid.id!=m[2])oid=jQuery('[@id="'+m[2]+'"]',elem)[0];ret=r=oid&&(!m[3]||jQuery.nodeName(oid,m[3]))?[oid]:[];}else{for(var i=0;ret[i];i++){var tag=m[1]=="#"&&m[3]?m[3]:m[1]!=""||m[0]==""?"*":m[2];if(tag=="*"&&ret[i].nodeName.toLowerCase()=="object")tag="param";r=jQuery.merge(r,ret[i].getElementsByTagName(tag));}if(m[1]==".")r=jQuery.classFilter(r,m[2]);if(m[1]=="#"){var tmp=[];for(var i=0;r[i];i++)if(r[i].getAttribute("id")==m[2]){tmp=[r[i]];break;}r=tmp;}ret=r;}t=t.replace(re2,"");}}if(t){var val=jQuery.filter(t,r);ret=r=val.r;t=jQuery.trim(val.t);}}if(t)ret=[];if(ret&&context==ret[0])ret.shift();done=jQuery.merge(done,ret);return done;},classFilter:function(r,m,not){m=" "+m+" ";var tmp=[];for(var i=0;r[i];i++){var pass=(" "+r[i].className+" ").indexOf(m)>=0;if(!not&&pass||not&&!pass)tmp.push(r[i]);}return tmp;},filter:function(t,r,not){var last;while(t&&t!=last){last=t;var p=jQuery.parse,m;for(var i=0;p[i];i++){m=p[i].exec(t);if(m){t=t.substring(m[0].length);m[2]=m[2].replace(/\\/g,"");break;}}if(!m)break;if(m[1]==":"&&m[2]=="not")r=isSimple.test(m[3])?jQuery.filter(m[3],r,true).r:jQuery(r).not(m[3]);else if(m[1]==".")r=jQuery.classFilter(r,m[2],not);else if(m[1]=="["){var tmp=[],type=m[3];for(var i=0,rl=r.length;i<rl;i++){var a=r[i],z=a[jQuery.props[m[2]]||m[2]];if(z==null||/href|src|selected/.test(m[2]))z=jQuery.attr(a,m[2])||'';if((type==""&&!!z||type=="="&&z==m[5]||type=="!="&&z!=m[5]||type=="^="&&z&&!z.indexOf(m[5])||type=="$="&&z.substr(z.length-m[5].length)==m[5]||(type=="*="||type=="~=")&&z.indexOf(m[5])>=0)^not)tmp.push(a);}r=tmp;}else if(m[1]==":"&&m[2]=="nth-child"){var merge={},tmp=[],test=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(m[3]=="even"&&"2n"||m[3]=="odd"&&"2n+1"||!/\D/.test(m[3])&&"0n+"+m[3]||m[3]),first=(test[1]+(test[2]||1))-0,last=test[3]-0;for(var i=0,rl=r.length;i<rl;i++){var node=r[i],parentNode=node.parentNode,id=jQuery.data(parentNode);if(!merge[id]){var c=1;for(var n=parentNode.firstChild;n;n=n.nextSibling)if(n.nodeType==1)n.nodeIndex=c++;merge[id]=true;}var add=false;if(first==0){if(node.nodeIndex==last)add=true;}else if((node.nodeIndex-last)%first==0&&(node.nodeIndex-last)/first>=0)add=true;if(add^not)tmp.push(node);}r=tmp;}else{var fn=jQuery.expr[m[1]];if(typeof fn=="object")fn=fn[m[2]];if(typeof fn=="string")fn=eval("false||function(a,i){return "+fn+";}");r=jQuery.grep(r,function(elem,i){return fn(elem,i,m,r);},not);}}return{r:r,t:t};},dir:function(elem,dir){var matched=[],cur=elem[dir];while(cur&&cur!=document){if(cur.nodeType==1)matched.push(cur);cur=cur[dir];}return matched;},nth:function(cur,result,dir,elem){result=result||1;var num=0;for(;cur;cur=cur[dir])if(cur.nodeType==1&&++num==result)break;return cur;},sibling:function(n,elem){var r=[];for(;n;n=n.nextSibling){if(n.nodeType==1&&n!=elem)r.push(n);}return r;}});jQuery.event={add:function(elem,types,handler,data){if(elem.nodeType==3||elem.nodeType==8)return;if(jQuery.browser.msie&&elem.setInterval)elem=window;if(!handler.guid)handler.guid=this.guid++;if(data!=undefined){var fn=handler;handler=this.proxy(fn,function(){return fn.apply(this,arguments);});handler.data=data;}var events=jQuery.data(elem,"events")||jQuery.data(elem,"events",{}),handle=jQuery.data(elem,"handle")||jQuery.data(elem,"handle",function(){if(typeof jQuery!="undefined"&&!jQuery.event.triggered)return jQuery.event.handle.apply(arguments.callee.elem,arguments);});handle.elem=elem;jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];handler.type=parts[1];var handlers=events[type];if(!handlers){handlers=events[type]={};if(!jQuery.event.special[type]||jQuery.event.special[type].setup.call(elem)===false){if(elem.addEventListener)elem.addEventListener(type,handle,false);else if(elem.attachEvent)elem.attachEvent("on"+type,handle);}}handlers[handler.guid]=handler;jQuery.event.global[type]=true;});elem=null;},guid:1,global:{},remove:function(elem,types,handler){if(elem.nodeType==3||elem.nodeType==8)return;var events=jQuery.data(elem,"events"),ret,index;if(events){if(types==undefined||(typeof types=="string"&&types.charAt(0)=="."))for(var type in events)this.remove(elem,type+(types||""));else{if(types.type){handler=types.handler;types=types.type;}jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];if(events[type]){if(handler)delete events[type][handler.guid];else +for(handler in events[type])if(!parts[1]||events[type][handler].type==parts[1])delete events[type][handler];for(ret in events[type])break;if(!ret){if(!jQuery.event.special[type]||jQuery.event.special[type].teardown.call(elem)===false){if(elem.removeEventListener)elem.removeEventListener(type,jQuery.data(elem,"handle"),false);else if(elem.detachEvent)elem.detachEvent("on"+type,jQuery.data(elem,"handle"));}ret=null;delete events[type];}}});}for(ret in events)break;if(!ret){var handle=jQuery.data(elem,"handle");if(handle)handle.elem=null;jQuery.removeData(elem,"events");jQuery.removeData(elem,"handle");}}},trigger:function(type,data,elem,donative,extra){data=jQuery.makeArray(data);if(type.indexOf("!")>=0){type=type.slice(0,-1);var exclusive=true;}if(!elem){if(this.global[type])jQuery("*").add([window,document]).trigger(type,data);}else{if(elem.nodeType==3||elem.nodeType==8)return undefined;var val,ret,fn=jQuery.isFunction(elem[type]||null),event=!data[0]||!data[0].preventDefault;if(event){data.unshift({type:type,target:elem,preventDefault:function(){},stopPropagation:function(){},timeStamp:now()});data[0][expando]=true;}data[0].type=type;if(exclusive)data[0].exclusive=true;var handle=jQuery.data(elem,"handle");if(handle)val=handle.apply(elem,data);if((!fn||(jQuery.nodeName(elem,'a')&&type=="click"))&&elem["on"+type]&&elem["on"+type].apply(elem,data)===false)val=false;if(event)data.shift();if(extra&&jQuery.isFunction(extra)){ret=extra.apply(elem,val==null?data:data.concat(val));if(ret!==undefined)val=ret;}if(fn&&donative!==false&&val!==false&&!(jQuery.nodeName(elem,'a')&&type=="click")){this.triggered=true;try{elem[type]();}catch(e){}}this.triggered=false;}return val;},handle:function(event){var val,ret,namespace,all,handlers;event=arguments[0]=jQuery.event.fix(event||window.event);namespace=event.type.split(".");event.type=namespace[0];namespace=namespace[1];all=!namespace&&!event.exclusive;handlers=(jQuery.data(this,"events")||{})[event.type];for(var j in handlers){var handler=handlers[j];if(all||handler.type==namespace){event.handler=handler;event.data=handler.data;ret=handler.apply(this,arguments);if(val!==false)val=ret;if(ret===false){event.preventDefault();event.stopPropagation();}}}return val;},fix:function(event){if(event[expando]==true)return event;var originalEvent=event;event={originalEvent:originalEvent};var props="altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target timeStamp toElement type view wheelDelta which".split(" ");for(var i=props.length;i;i--)event[props[i]]=originalEvent[props[i]];event[expando]=true;event.preventDefault=function(){if(originalEvent.preventDefault)originalEvent.preventDefault();originalEvent.returnValue=false;};event.stopPropagation=function(){if(originalEvent.stopPropagation)originalEvent.stopPropagation();originalEvent.cancelBubble=true;};event.timeStamp=event.timeStamp||now();if(!event.target)event.target=event.srcElement||document;if(event.target.nodeType==3)event.target=event.target.parentNode;if(!event.relatedTarget&&event.fromElement)event.relatedTarget=event.fromElement==event.target?event.toElement:event.fromElement;if(event.pageX==null&&event.clientX!=null){var doc=document.documentElement,body=document.body;event.pageX=event.clientX+(doc&&doc.scrollLeft||body&&body.scrollLeft||0)-(doc.clientLeft||0);event.pageY=event.clientY+(doc&&doc.scrollTop||body&&body.scrollTop||0)-(doc.clientTop||0);}if(!event.which&&((event.charCode||event.charCode===0)?event.charCode:event.keyCode))event.which=event.charCode||event.keyCode;if(!event.metaKey&&event.ctrlKey)event.metaKey=event.ctrlKey;if(!event.which&&event.button)event.which=(event.button&1?1:(event.button&2?3:(event.button&4?2:0)));return event;},proxy:function(fn,proxy){proxy.guid=fn.guid=fn.guid||proxy.guid||this.guid++;return proxy;},special:{ready:{setup:function(){bindReady();return;},teardown:function(){return;}},mouseenter:{setup:function(){if(jQuery.browser.msie)return false;jQuery(this).bind("mouseover",jQuery.event.special.mouseenter.handler);return true;},teardown:function(){if(jQuery.browser.msie)return false;jQuery(this).unbind("mouseover",jQuery.event.special.mouseenter.handler);return true;},handler:function(event){if(withinElement(event,this))return true;event.type="mouseenter";return jQuery.event.handle.apply(this,arguments);}},mouseleave:{setup:function(){if(jQuery.browser.msie)return false;jQuery(this).bind("mouseout",jQuery.event.special.mouseleave.handler);return true;},teardown:function(){if(jQuery.browser.msie)return false;jQuery(this).unbind("mouseout",jQuery.event.special.mouseleave.handler);return true;},handler:function(event){if(withinElement(event,this))return true;event.type="mouseleave";return jQuery.event.handle.apply(this,arguments);}}}};jQuery.fn.extend({bind:function(type,data,fn){return type=="unload"?this.one(type,data,fn):this.each(function(){jQuery.event.add(this,type,fn||data,fn&&data);});},one:function(type,data,fn){var one=jQuery.event.proxy(fn||data,function(event){jQuery(this).unbind(event,one);return(fn||data).apply(this,arguments);});return this.each(function(){jQuery.event.add(this,type,one,fn&&data);});},unbind:function(type,fn){return this.each(function(){jQuery.event.remove(this,type,fn);});},trigger:function(type,data,fn){return this.each(function(){jQuery.event.trigger(type,data,this,true,fn);});},triggerHandler:function(type,data,fn){return this[0]&&jQuery.event.trigger(type,data,this[0],false,fn);},toggle:function(fn){var args=arguments,i=1;while(i<args.length)jQuery.event.proxy(fn,args[i++]);return this.click(jQuery.event.proxy(fn,function(event){this.lastToggle=(this.lastToggle||0)%i;event.preventDefault();return args[this.lastToggle++].apply(this,arguments)||false;}));},hover:function(fnOver,fnOut){return this.bind('mouseenter',fnOver).bind('mouseleave',fnOut);},ready:function(fn){bindReady();if(jQuery.isReady)fn.call(document,jQuery);else +jQuery.readyList.push(function(){return fn.call(this,jQuery);});return this;}});jQuery.extend({isReady:false,readyList:[],ready:function(){if(!jQuery.isReady){jQuery.isReady=true;if(jQuery.readyList){jQuery.each(jQuery.readyList,function(){this.call(document);});jQuery.readyList=null;}jQuery(document).triggerHandler("ready");}}});var readyBound=false;function bindReady(){if(readyBound)return;readyBound=true;if(document.addEventListener&&!jQuery.browser.opera)document.addEventListener("DOMContentLoaded",jQuery.ready,false);if(jQuery.browser.msie&&window==top)(function(){if(jQuery.isReady)return;try{document.documentElement.doScroll("left");}catch(error){setTimeout(arguments.callee,0);return;}jQuery.ready();})();if(jQuery.browser.opera)document.addEventListener("DOMContentLoaded",function(){if(jQuery.isReady)return;for(var i=0;i<document.styleSheets.length;i++)if(document.styleSheets[i].disabled){setTimeout(arguments.callee,0);return;}jQuery.ready();},false);if(jQuery.browser.safari){var numStyles;(function(){if(jQuery.isReady)return;if(document.readyState!="loaded"&&document.readyState!="complete"){setTimeout(arguments.callee,0);return;}if(numStyles===undefined)numStyles=jQuery("style, link[rel=stylesheet]").length;if(document.styleSheets.length!=numStyles){setTimeout(arguments.callee,0);return;}jQuery.ready();})();}jQuery.event.add(window,"load",jQuery.ready);}jQuery.each(("blur,focus,load,resize,scroll,unload,click,dblclick,"+"mousedown,mouseup,mousemove,mouseover,mouseout,change,select,"+"submit,keydown,keypress,keyup,error").split(","),function(i,name){jQuery.fn[name]=function(fn){return fn?this.bind(name,fn):this.trigger(name);};});var withinElement=function(event,elem){var parent=event.relatedTarget;while(parent&&parent!=elem)try{parent=parent.parentNode;}catch(error){parent=elem;}return parent==elem;};jQuery(window).bind("unload",function(){jQuery("*").add(document).unbind();});jQuery.fn.extend({_load:jQuery.fn.load,load:function(url,params,callback){if(typeof url!='string')return this._load(url);var off=url.indexOf(" ");if(off>=0){var selector=url.slice(off,url.length);url=url.slice(0,off);}callback=callback||function(){};var type="GET";if(params)if(jQuery.isFunction(params)){callback=params;params=null;}else{params=jQuery.param(params);type="POST";}var self=this;jQuery.ajax({url:url,type:type,dataType:"html",data:params,complete:function(res,status){if(status=="success"||status=="notmodified")self.html(selector?jQuery("<div/>").append(res.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(selector):res.responseText);self.each(callback,[res.responseText,status,res]);}});return this;},serialize:function(){return jQuery.param(this.serializeArray());},serializeArray:function(){return this.map(function(){return jQuery.nodeName(this,"form")?jQuery.makeArray(this.elements):this;}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password/i.test(this.type));}).map(function(i,elem){var val=jQuery(this).val();return val==null?null:val.constructor==Array?jQuery.map(val,function(val,i){return{name:elem.name,value:val};}):{name:elem.name,value:val};}).get();}});jQuery.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(i,o){jQuery.fn[o]=function(f){return this.bind(o,f);};});var jsc=now();jQuery.extend({get:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data=null;}return jQuery.ajax({type:"GET",url:url,data:data,success:callback,dataType:type});},getScript:function(url,callback){return jQuery.get(url,null,callback,"script");},getJSON:function(url,data,callback){return jQuery.get(url,data,callback,"json");},post:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data={};}return jQuery.ajax({type:"POST",url:url,data:data,success:callback,dataType:type});},ajaxSetup:function(settings){jQuery.extend(jQuery.ajaxSettings,settings);},ajaxSettings:{url:location.href,global:true,type:"GET",timeout:0,contentType:"application/x-www-form-urlencoded",processData:true,async:true,data:null,username:null,password:null,accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(s){s=jQuery.extend(true,s,jQuery.extend(true,{},jQuery.ajaxSettings,s));var jsonp,jsre=/=\?(&|$)/g,status,data,type=s.type.toUpperCase();if(s.data&&s.processData&&typeof s.data!="string")s.data=jQuery.param(s.data);if(s.dataType=="jsonp"){if(type=="GET"){if(!s.url.match(jsre))s.url+=(s.url.match(/\?/)?"&":"?")+(s.jsonp||"callback")+"=?";}else if(!s.data||!s.data.match(jsre))s.data=(s.data?s.data+"&":"")+(s.jsonp||"callback")+"=?";s.dataType="json";}if(s.dataType=="json"&&(s.data&&s.data.match(jsre)||s.url.match(jsre))){jsonp="jsonp"+jsc++;if(s.data)s.data=(s.data+"").replace(jsre,"="+jsonp+"$1");s.url=s.url.replace(jsre,"="+jsonp+"$1");s.dataType="script";window[jsonp]=function(tmp){data=tmp;success();complete();window[jsonp]=undefined;try{delete window[jsonp];}catch(e){}if(head)head.removeChild(script);};}if(s.dataType=="script"&&s.cache==null)s.cache=false;if(s.cache===false&&type=="GET"){var ts=now();var ret=s.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+ts+"$2");s.url=ret+((ret==s.url)?(s.url.match(/\?/)?"&":"?")+"_="+ts:"");}if(s.data&&type=="GET"){s.url+=(s.url.match(/\?/)?"&":"?")+s.data;s.data=null;}if(s.global&&!jQuery.active++)jQuery.event.trigger("ajaxStart");var remote=/^(?:\w+:)?\/\/([^\/?#]+)/;if(s.dataType=="script"&&type=="GET"&&remote.test(s.url)&&remote.exec(s.url)[1]!=location.host){var head=document.getElementsByTagName("head")[0];var script=document.createElement("script");script.src=s.url;if(s.scriptCharset)script.charset=s.scriptCharset;if(!jsonp){var done=false;script.onload=script.onreadystatechange=function(){if(!done&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){done=true;success();complete();head.removeChild(script);}};}head.appendChild(script);return undefined;}var requestDone=false;var xhr=window.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest();if(s.username)xhr.open(type,s.url,s.async,s.username,s.password);else +xhr.open(type,s.url,s.async);try{if(s.data)xhr.setRequestHeader("Content-Type",s.contentType);if(s.ifModified)xhr.setRequestHeader("If-Modified-Since",jQuery.lastModified[s.url]||"Thu, 01 Jan 1970 00:00:00 GMT");xhr.setRequestHeader("X-Requested-With","XMLHttpRequest");xhr.setRequestHeader("Accept",s.dataType&&s.accepts[s.dataType]?s.accepts[s.dataType]+", */*":s.accepts._default);}catch(e){}if(s.beforeSend&&s.beforeSend(xhr,s)===false){s.global&&jQuery.active--;xhr.abort();return false;}if(s.global)jQuery.event.trigger("ajaxSend",[xhr,s]);var onreadystatechange=function(isTimeout){if(!requestDone&&xhr&&(xhr.readyState==4||isTimeout=="timeout")){requestDone=true;if(ival){clearInterval(ival);ival=null;}status=isTimeout=="timeout"&&"timeout"||!jQuery.httpSuccess(xhr)&&"error"||s.ifModified&&jQuery.httpNotModified(xhr,s.url)&&"notmodified"||"success";if(status=="success"){try{data=jQuery.httpData(xhr,s.dataType,s.dataFilter);}catch(e){status="parsererror";}}if(status=="success"){var modRes;try{modRes=xhr.getResponseHeader("Last-Modified");}catch(e){}if(s.ifModified&&modRes)jQuery.lastModified[s.url]=modRes;if(!jsonp)success();}else +jQuery.handleError(s,xhr,status);complete();if(s.async)xhr=null;}};if(s.async){var ival=setInterval(onreadystatechange,13);if(s.timeout>0)setTimeout(function(){if(xhr){xhr.abort();if(!requestDone)onreadystatechange("timeout");}},s.timeout);}try{xhr.send(s.data);}catch(e){jQuery.handleError(s,xhr,null,e);}if(!s.async)onreadystatechange();function success(){if(s.success)s.success(data,status);if(s.global)jQuery.event.trigger("ajaxSuccess",[xhr,s]);}function complete(){if(s.complete)s.complete(xhr,status);if(s.global)jQuery.event.trigger("ajaxComplete",[xhr,s]);if(s.global&&!--jQuery.active)jQuery.event.trigger("ajaxStop");}return xhr;},handleError:function(s,xhr,status,e){if(s.error)s.error(xhr,status,e);if(s.global)jQuery.event.trigger("ajaxError",[xhr,s,e]);},active:0,httpSuccess:function(xhr){try{return!xhr.status&&location.protocol=="file:"||(xhr.status>=200&&xhr.status<300)||xhr.status==304||xhr.status==1223||jQuery.browser.safari&&xhr.status==undefined;}catch(e){}return false;},httpNotModified:function(xhr,url){try{var xhrRes=xhr.getResponseHeader("Last-Modified");return xhr.status==304||xhrRes==jQuery.lastModified[url]||jQuery.browser.safari&&xhr.status==undefined;}catch(e){}return false;},httpData:function(xhr,type,filter){var ct=xhr.getResponseHeader("content-type"),xml=type=="xml"||!type&&ct&&ct.indexOf("xml")>=0,data=xml?xhr.responseXML:xhr.responseText;if(xml&&data.documentElement.tagName=="parsererror")throw"parsererror";if(filter)data=filter(data,type);if(type=="script")jQuery.globalEval(data);if(type=="json")data=eval("("+data+")");return data;},param:function(a){var s=[];if(a.constructor==Array||a.jquery)jQuery.each(a,function(){s.push(encodeURIComponent(this.name)+"="+encodeURIComponent(this.value));});else +for(var j in a)if(a[j]&&a[j].constructor==Array)jQuery.each(a[j],function(){s.push(encodeURIComponent(j)+"="+encodeURIComponent(this));});else +s.push(encodeURIComponent(j)+"="+encodeURIComponent(jQuery.isFunction(a[j])?a[j]():a[j]));return s.join("&").replace(/%20/g,"+");}});jQuery.fn.extend({show:function(speed,callback){return speed?this.animate({height:"show",width:"show",opacity:"show"},speed,callback):this.filter(":hidden").each(function(){this.style.display=this.oldblock||"";if(jQuery.css(this,"display")=="none"){var elem=jQuery("<"+this.tagName+" />").appendTo("body");this.style.display=elem.css("display");if(this.style.display=="none")this.style.display="block";elem.remove();}}).end();},hide:function(speed,callback){return speed?this.animate({height:"hide",width:"hide",opacity:"hide"},speed,callback):this.filter(":visible").each(function(){this.oldblock=this.oldblock||jQuery.css(this,"display");this.style.display="none";}).end();},_toggle:jQuery.fn.toggle,toggle:function(fn,fn2){return jQuery.isFunction(fn)&&jQuery.isFunction(fn2)?this._toggle.apply(this,arguments):fn?this.animate({height:"toggle",width:"toggle",opacity:"toggle"},fn,fn2):this.each(function(){jQuery(this)[jQuery(this).is(":hidden")?"show":"hide"]();});},slideDown:function(speed,callback){return this.animate({height:"show"},speed,callback);},slideUp:function(speed,callback){return this.animate({height:"hide"},speed,callback);},slideToggle:function(speed,callback){return this.animate({height:"toggle"},speed,callback);},fadeIn:function(speed,callback){return this.animate({opacity:"show"},speed,callback);},fadeOut:function(speed,callback){return this.animate({opacity:"hide"},speed,callback);},fadeTo:function(speed,to,callback){return this.animate({opacity:to},speed,callback);},animate:function(prop,speed,easing,callback){var optall=jQuery.speed(speed,easing,callback);return this[optall.queue===false?"each":"queue"](function(){if(this.nodeType!=1)return false;var opt=jQuery.extend({},optall),p,hidden=jQuery(this).is(":hidden"),self=this;for(p in prop){if(prop[p]=="hide"&&hidden||prop[p]=="show"&&!hidden)return opt.complete.call(this);if(p=="height"||p=="width"){opt.display=jQuery.css(this,"display");opt.overflow=this.style.overflow;}}if(opt.overflow!=null)this.style.overflow="hidden";opt.curAnim=jQuery.extend({},prop);jQuery.each(prop,function(name,val){var e=new jQuery.fx(self,opt,name);if(/toggle|show|hide/.test(val))e[val=="toggle"?hidden?"show":"hide":val](prop);else{var parts=val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),start=e.cur(true)||0;if(parts){var end=parseFloat(parts[2]),unit=parts[3]||"px";if(unit!="px"){self.style[name]=(end||1)+unit;start=((end||1)/e.cur(true))*start;self.style[name]=start+unit;}if(parts[1])end=((parts[1]=="-="?-1:1)*end)+start;e.custom(start,end,unit);}else +e.custom(start,val,"");}});return true;});},queue:function(type,fn){if(jQuery.isFunction(type)||(type&&type.constructor==Array)){fn=type;type="fx";}if(!type||(typeof type=="string"&&!fn))return queue(this[0],type);return this.each(function(){if(fn.constructor==Array)queue(this,type,fn);else{queue(this,type).push(fn);if(queue(this,type).length==1)fn.call(this);}});},stop:function(clearQueue,gotoEnd){var timers=jQuery.timers;if(clearQueue)this.queue([]);this.each(function(){for(var i=timers.length-1;i>=0;i--)if(timers[i].elem==this){if(gotoEnd)timers[i](true);timers.splice(i,1);}});if(!gotoEnd)this.dequeue();return this;}});var queue=function(elem,type,array){if(elem){type=type||"fx";var q=jQuery.data(elem,type+"queue");if(!q||array)q=jQuery.data(elem,type+"queue",jQuery.makeArray(array));}return q;};jQuery.fn.dequeue=function(type){type=type||"fx";return this.each(function(){var q=queue(this,type);q.shift();if(q.length)q[0].call(this);});};jQuery.extend({speed:function(speed,easing,fn){var opt=speed&&speed.constructor==Object?speed:{complete:fn||!fn&&easing||jQuery.isFunction(speed)&&speed,duration:speed,easing:fn&&easing||easing&&easing.constructor!=Function&&easing};opt.duration=(opt.duration&&opt.duration.constructor==Number?opt.duration:jQuery.fx.speeds[opt.duration])||jQuery.fx.speeds.def;opt.old=opt.complete;opt.complete=function(){if(opt.queue!==false)jQuery(this).dequeue();if(jQuery.isFunction(opt.old))opt.old.call(this);};return opt;},easing:{linear:function(p,n,firstNum,diff){return firstNum+diff*p;},swing:function(p,n,firstNum,diff){return((-Math.cos(p*Math.PI)/2)+0.5)*diff+firstNum;}},timers:[],timerId:null,fx:function(elem,options,prop){this.options=options;this.elem=elem;this.prop=prop;if(!options.orig)options.orig={};}});jQuery.fx.prototype={update:function(){if(this.options.step)this.options.step.call(this.elem,this.now,this);(jQuery.fx.step[this.prop]||jQuery.fx.step._default)(this);if(this.prop=="height"||this.prop=="width")this.elem.style.display="block";},cur:function(force){if(this.elem[this.prop]!=null&&this.elem.style[this.prop]==null)return this.elem[this.prop];var r=parseFloat(jQuery.css(this.elem,this.prop,force));return r&&r>-10000?r:parseFloat(jQuery.curCSS(this.elem,this.prop))||0;},custom:function(from,to,unit){this.startTime=now();this.start=from;this.end=to;this.unit=unit||this.unit||"px";this.now=this.start;this.pos=this.state=0;this.update();var self=this;function t(gotoEnd){return self.step(gotoEnd);}t.elem=this.elem;jQuery.timers.push(t);if(jQuery.timerId==null){jQuery.timerId=setInterval(function(){var timers=jQuery.timers;for(var i=0;i<timers.length;i++)if(!timers[i]())timers.splice(i--,1);if(!timers.length){clearInterval(jQuery.timerId);jQuery.timerId=null;}},13);}},show:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);this.options.show=true;this.custom(0,this.cur());if(this.prop=="width"||this.prop=="height")this.elem.style[this.prop]="1px";jQuery(this.elem).show();},hide:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);this.options.hide=true;this.custom(this.cur(),0);},step:function(gotoEnd){var t=now();if(gotoEnd||t>this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var done=true;for(var i in this.options.curAnim)if(this.options.curAnim[i]!==true)done=false;if(done){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(jQuery.css(this.elem,"display")=="none")this.elem.style.display="block";}if(this.options.hide)this.elem.style.display="none";if(this.options.hide||this.options.show)for(var p in this.options.curAnim)jQuery.attr(this.elem.style,p,this.options.orig[p]);}if(done)this.options.complete.call(this.elem);return false;}else{var n=t-this.startTime;this.state=n/this.options.duration;this.pos=jQuery.easing[this.options.easing||(jQuery.easing.swing?"swing":"linear")](this.state,n,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update();}return true;}};jQuery.extend(jQuery.fx,{speeds:{slow:600,fast:200,def:400},step:{scrollLeft:function(fx){fx.elem.scrollLeft=fx.now;},scrollTop:function(fx){fx.elem.scrollTop=fx.now;},opacity:function(fx){jQuery.attr(fx.elem.style,"opacity",fx.now);},_default:function(fx){fx.elem.style[fx.prop]=fx.now+fx.unit;}}});jQuery.fn.offset=function(){var left=0,top=0,elem=this[0],results;if(elem)with(jQuery.browser){var parent=elem.parentNode,offsetChild=elem,offsetParent=elem.offsetParent,doc=elem.ownerDocument,safari2=safari&&parseInt(version)<522&&!/adobeair/i.test(userAgent),css=jQuery.curCSS,fixed=css(elem,"position")=="fixed";if(elem.getBoundingClientRect){var box=elem.getBoundingClientRect();add(box.left+Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),box.top+Math.max(doc.documentElement.scrollTop,doc.body.scrollTop));add(-doc.documentElement.clientLeft,-doc.documentElement.clientTop);}else{add(elem.offsetLeft,elem.offsetTop);while(offsetParent){add(offsetParent.offsetLeft,offsetParent.offsetTop);if(mozilla&&!/^t(able|d|h)$/i.test(offsetParent.tagName)||safari&&!safari2)border(offsetParent);if(!fixed&&css(offsetParent,"position")=="fixed")fixed=true;offsetChild=/^body$/i.test(offsetParent.tagName)?offsetChild:offsetParent;offsetParent=offsetParent.offsetParent;}while(parent&&parent.tagName&&!/^body|html$/i.test(parent.tagName)){if(!/^inline|table.*$/i.test(css(parent,"display")))add(-parent.scrollLeft,-parent.scrollTop);if(mozilla&&css(parent,"overflow")!="visible")border(parent);parent=parent.parentNode;}if((safari2&&(fixed||css(offsetChild,"position")=="absolute"))||(mozilla&&css(offsetChild,"position")!="absolute"))add(-doc.body.offsetLeft,-doc.body.offsetTop);if(fixed)add(Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),Math.max(doc.documentElement.scrollTop,doc.body.scrollTop));}results={top:top,left:left};}function border(elem){add(jQuery.curCSS(elem,"borderLeftWidth",true),jQuery.curCSS(elem,"borderTopWidth",true));}function add(l,t){left+=parseInt(l,10)||0;top+=parseInt(t,10)||0;}return results;};jQuery.fn.extend({position:function(){var left=0,top=0,results;if(this[0]){var offsetParent=this.offsetParent(),offset=this.offset(),parentOffset=/^body|html$/i.test(offsetParent[0].tagName)?{top:0,left:0}:offsetParent.offset();offset.top-=num(this,'marginTop');offset.left-=num(this,'marginLeft');parentOffset.top+=num(offsetParent,'borderTopWidth');parentOffset.left+=num(offsetParent,'borderLeftWidth');results={top:offset.top-parentOffset.top,left:offset.left-parentOffset.left};}return results;},offsetParent:function(){var offsetParent=this[0].offsetParent;while(offsetParent&&(!/^body|html$/i.test(offsetParent.tagName)&&jQuery.css(offsetParent,'position')=='static'))offsetParent=offsetParent.offsetParent;return jQuery(offsetParent);}});jQuery.each(['Left','Top'],function(i,name){var method='scroll'+name;jQuery.fn[method]=function(val){if(!this[0])return;return val!=undefined?this.each(function(){this==window||this==document?window.scrollTo(!i?val:jQuery(window).scrollLeft(),i?val:jQuery(window).scrollTop()):this[method]=val;}):this[0]==window||this[0]==document?self[i?'pageYOffset':'pageXOffset']||jQuery.boxModel&&document.documentElement[method]||document.body[method]:this[0][method];};});jQuery.each(["Height","Width"],function(i,name){var tl=i?"Left":"Top",br=i?"Right":"Bottom";jQuery.fn["inner"+name]=function(){return this[name.toLowerCase()]()+num(this,"padding"+tl)+num(this,"padding"+br);};jQuery.fn["outer"+name]=function(margin){return this["inner"+name]()+num(this,"border"+tl+"Width")+num(this,"border"+br+"Width")+(margin?num(this,"margin"+tl)+num(this,"margin"+br):0);};});})(); \ No newline at end of file diff --git a/modules/tntcarrier/js/relaisColis.js b/modules/tntcarrier/js/relaisColis.js new file mode 100644 index 000000000..138b7b219 --- /dev/null +++ b/modules/tntcarrier/js/relaisColis.js @@ -0,0 +1,979 @@ +/** Javascript B2C Relais Colis - version 2.0 - 08/07/2010 **/ + +var pathToImages = "../modules/tntcarrier/img/"; +var tntDomain = "www.tnt.fr"; + +var tntRCcodePostal; +var tntRCCommune; +var tntRClisteRelais; +var tntRCJsonCommunes; + +var tntRCMsgHeaderTitle = "Mode de livraison"; +//var tntRCMsgSubHeaderTitle = "Choisissez le Relais Colis<sup class='tntRCSup'>®</sup> qui vous convient :"; +var tntRCMsgSubHeaderTitle = "Choisissez l'agence depot qui vous convient :"; +var tntRCMsgHeaderPopup = "Détail du Relais Colis<sup class='tntRCSup'>®</sup>"; +var tntRCMsgSubHeaderPopup = "Descriptif :"; +var tntRCMsgBodyLoading = "Chargement en cours..."; +var tntRCMsgBodyInput = "Département : "; +var tntRCMsgBodyBack2Communes = "Revenir à la liste des communes"; +var tntRCMsgErrCodePostal = "Veuillez saisir un code postal sur 5 chiffres"; +var tntRCMsgErrLoadCommunes = "Aucun Relais Colis® disponible"; +var tntRCMsgErrLoadRelais = "Aucun Relais Colis® disponible"; + +var tntRCsize800 = "500px"; +var tntRCsize789 = "500px"; +var tntRCsize670 = "400px"; +var tntRCsize650 = "400px"; +var tntRCsize50 = "50px"; +var tntRCsize8 = "8px"; +var tntRCsize5 = "5px"; +var tntRCsize6 = "6px"; +var tntRCsize10 = "10px"; +var tntRCsize30 = "30px"; +var tntRCsize109 = "109px"; +var tntRCsize442 = "240px"; +var tntRCsize447 = "240px"; +var tntRCsize218 = "178px"; +var tntRCsize253 = "213px"; +var tntRCsize20 = "20px"; +var tntRCsize392 = "352px"; +var tntRCsize412 = "332px"; + +function getURLParam(name) { + name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]"); + var regexS = "[\\?&]" + name + "=([^&#]*)"; + var regex = new RegExp( regexS ); + var results = regex.exec( window.location.href ); + if( results == null ) return ""; + else return results[1]; +}; + +// Chargement de la liste de relais colis après le choix de la commune parmis plusieurs +// communes correspondant au même code postal +function tntRCgetRelaisColisJSON(commune) +{ + if (!commune) { + // La commune du code postal correspond à la sélection du radio bouton tntRCchoixComm + tntRCCommune = $("input[@type=radio][@checked][@name=tntRCchoixComm]").val(); + } + else { + // Utilisation de la valeur fournie en paramètre + tntRCCommune = commune + } + + // Affichage message "chargement en cours" + tntRCsetChargementEnCours(); + + var ajaxUrl; + var ajaxData; + + ajaxUrl = "http://" + tntDomain + "/public/b2c/relaisColis/loadJson.do?cp=" + tntRCcodePostal + "&commune=" + tntRCCommune; + ajaxData = ""; + + // Chargement de la liste de relais colis + $.ajax({ + type: "GET", + url: ajaxUrl, + data: ajaxData, + dataType: "script" + }); +}; + +// Affichage d'une liste de relais colis +function tntRCafficheRelais(jData) { + + var jMessage = $('#blocCodePostal'); + + var tntRCjTable = $("<table style='border:1px solid gray;' cellpadding='0' cellspacing='0' width='" + tntRCsize800 + "'></table>"); + + // Ligne blanche de séparation + tntRCjTable.append(tntRCligneBlanche6Col()); + + // Entêtes de colonnes grise + tntRCjTable.append(tntRCenteteGrise6Col()); + + //affiche le contenu du fichier dans le conteneur dédié + jMessage.html(""); + + var i = 0; + + tntRClisteRelais = jData; + for(i = 0; i < jData.length; i++) { + + var oRelais = jData[i]; + + // Les noeuds dans le fichier XML ne sont pas forcément ordonnés pour l'affichage, on va donc d'abord récupérer leur valeur + var codeRelais = oRelais[0]; + var nomRelais = oRelais[1]; + var adresse = oRelais[4]; + var codePostal = oRelais[2]; + var commune = oRelais[3]; + var heureFermeture = oRelais[21]; + + var messages=""; + + var logo_point = ""; + if (messages != "") logo_point = "<img src='" + pathToImages + "exception.gif' alt='Informations complémentaires' width='16px' height='16px'>"; + + tntRCjTable.append( + "<tr>"+ + "<td class='tntRCblanc' width='" + tntRCsize5 + "'></td>"+ + "<td class='tntRCblanc' width='" + tntRCsize50 + "'><img src='" + pathToImages + "logo-tnt-petit.jpg'> " + logo_point + "</td>"+ + "<td class='tntRCrelaisColis' width='" + tntRCsize650 + "'>" + nomRelais + " - " + adresse + " - " + codePostal + " - " + commune + "<BR>    >> Ouvert jusqu'à " + heureFermeture + "</td>"+ + "<td class='tntRCrelaisColis' width='" + tntRCsize10 + "'> </td>"+ + "<td class='tntRCrelaisColis' valign='middle' align='center' width='" + tntRCsize109 + "'>"+ + "<a href='#' onclick='tntRCafficheDetail(" + i + ");'><img src='" + pathToImages + "loupe.gif' class='tntRCBoutonLoupe'></a>        "+ + "<input type='radio' style='vertical-align: middle;' name='tntRCchoixRelais' value='" + codeRelais + "'" + ( i==0 ? "checked" : "") + " onclick='tntRCSetSelectedInfo(" + i + ")'/>"+ + "</td>"+ + "<td class='tntRCblanc' width='" + tntRCsize6 + "'></td>"+ + "</tr><tr id='tntRcDetail"+i+"' style='display:none'></tr>"); + } + + // Mémorisation des infos du relais sélectionné par défaut (c'est le premier) + tntRCSetSelectedInfo(0, true); + + // Ajout du lien de retour sur la liste des communes si cette dernière a été mémorisée + if (tntRCJsonCommunes != null) { + tntRCjTable.append( + "<tr>"+ + "<td colspan='5' class='tntRCBack2Communes'>"+ + "<a href='#' onclick='tntRCafficheCommunes(tntRCJsonCommunes);'>"+ + "<img src='" + pathToImages + "bt-Retour.gif'>"+ + tntRCMsgBodyBack2Communes + + "</a>"+ + "</td>"+ + "<td />"+ + "</tr>"); + } + + tntRCjTable.append(tntRCligneBlanche6Col()); + jMessage.append(tntRCjTable); + + jMessage.append(tntRCchangerCodePostal()); +}; + +function tntB2CRelaisColisGetBodyMain() { + return ( + "<div class='tntRCGray'> </div>"+ + "<div id='tntBodyContentSC'>" + + "<table>"+ + "<tr>"+ + "<td>" + tntRCMsgBodyInput + "</td>"+ + "<td><input type='text' id='tntRCInputCP' class='tntRCInput' maxlength='5' size='5' value=''/></td>"+ + "<td><a href='#' onclick='tntRCgetDepot();'><img class='tntRCButton' src='" + pathToImages + "bt-OK-2.jpg' onmouseover='this.src=\"" + pathToImages + "bt-OK-1.jpg\"' onmouseout='this.src=\"" + pathToImages + "bt-OK-2.jpg\"'></a></td>" + + "</tr>"+ + "</table>" + + "</div>"+ + "<div id='tntRCLoading' style='display:none;'>" + tntRCMsgBodyLoading + "</div>"+ + "<div id='tntRCError' class='tntRCError' style='display:none;'></div>"); +} + +function tntB2CRelaisColis() { + + // Test si ID de référence existe, sinon on ne fait rien + if (!document.getElementById("tntB2CRelaisColis")) { + alert("ERREUR: Appel incorrect, objet [tntB2CRelaisColis] manquant !"); + return; + } + + tntRCCommune = ''; + + var tntRelaisColisB2C = $("#tntB2CRelaisColis"); + tntRelaisColisB2C.html( + "<div id='tntRCblocEntete'>"+ + "<div class='tntRCHeader'>"+ tntRCMsgHeaderTitle + "</div>"+ + "<div class='tntRCSubHeader'>" + tntRCMsgSubHeaderTitle + "</div>"+ + "</div>"+ + "<div id='blocCodePostal' class='tntRCBody'>"+ + tntB2CRelaisColisGetBodyMain() + + "</div>" + + "<div class='dialog_box' id='tntRCDialog'>"+ + "<div id='tntRCdetailRelaisEntete'>"+ + "<div class='tntRCHeader'>"+ tntRCMsgHeaderPopup + "</div>"+ + "<div class='tntRCSubHeader'>" + tntRCMsgSubHeaderPopup + "</div>"+ + "</div>"+ + "<div id='tntRCdetailRelaisCorps'></div>"+ + "</div>"); + + // Forçage de la propriété "top", car elle est écrasée par la gestion de jqModal + // si on la met dans la définition de la classe du div correspondant... + $('#tntRCDialog').css("top", "50%"); + + // Ajout de la popup dans la gestion jqModal + + $('#tntRCDialog').dialog({ + modal: true, + autoOpen: false, + width: 635, + height: 500, + position: ['middle','middle'], + resizable: false, + draggable: false, + show: 'blind', + close: function(event, ui) { + $("html").css({overflow: "", 'overflow-x': "", 'overflow-y': ""}); + } + }); + + // Récupérations des paramètres de l'URL + var codePostal = getURLParam("codePostal"); + var commune = getURLParam("commune"); + + if (codePostal != "") { + tntRCcodePostal = codePostal; + if (commune != "") { + // Couple code postal + commune fourni + tntRCgetRelaisColisJSON(commune); + } + else { + $('#tntRCInputCP').val(tntRCcodePostal); + tntRCgetCommunesJSON(); + } + } + + // Initialisation de Map associée + tntRCInitMap(); +}; + +function tntRCgetRelaisColis(libelleErreur) { + + // RAZ des infos sélectionnées + tntRCSetSelectedInfo(); + + tntRCCommune = ''; + + var blocCodePostal = $("#blocCodePostal"); + if(!blocCodePostal.hasClass("tntRCBody")) + blocCodePostal.addClass("tntRCBody"); + blocCodePostal.html(tntB2CRelaisColisGetBodyMain()); + $('#tntRCInputCP').val(tntRCcodePostal); + + if (libelleErreur) { + var jDivErreur = $("#tntRCError"); + jDivErreur.html(libelleErreur); + jDivErreur.show(); + } +}; + +function tntRCafficheCommunes(jData) { + + // RAZ des infos sélectionnées + tntRCSetSelectedInfo(); + + if (mapDetected) resetMap(); + + var tntRCjTable = $("<table style='border:1px solid gray;' cellpadding='0' cellspacing='0' width='" + tntRCsize800 + "'></table>"); + + // Ligne blanche de séparation + tntRCjTable.append(tntRCligneBlanche6Col()); + // Entêtes de colonnes grise + tntRCjTable.append(tntRCenteteGrise6Col()); + + var blocCodePostal = $("#blocCodePostal"); + + var i = 1; + //var jCommunes = jData.find("VILLE"); + for (var iIdx = 0; iIdx < jData.length; iIdx++) { + + var commune = jData[iIdx]; + + //var jCommune = $(this); + var nomVille = commune[1]; // IE vs FF + + tntRCjTable.append( + "<tr>"+ + "<td class='tntRCblanc' width='" + tntRCsize5 + "'></td>"+ + "<td class='tntRCblanc' width='" + tntRCsize50 + "'><img src='" + pathToImages + "logo-tnt-petit.jpg'></td>" + + "<td class='tntRCrelaisColis' width='" + tntRCsize650 + "'> " + nomVille + " (" + tntRCcodePostal + ") </td>" + + "<td class='tntRCrelaisColis' width='" + tntRCsize10 + "'> </td>"+ + "<td class='tntRCrelaisColis' align='center' width='" + tntRCsize109 + "'>"+ + "<input type='radio' name='tntRCchoixComm' value='" + nomVille + "' " + ( i ==1 ? "checked" : "") + ">"+ + "</td>"+ + "<td class='tntRCblanc' width='" + tntRCsize6 + "'></td>"+ + "</tr>"); + i = 2; + } + + tntRCjTable.append( + tntRCligneBlanche6Col() + + "<tr>"+ + "<td class='tntRCblanc' width='" + tntRCsize5 + "'></td>"+ + "<td class='tntRCblanc' colspan='2' width='" + tntRCsize670 + "'></td>"+ + "<td class='tntRCblanc' width='" + tntRCsize10 + "'></td>"+ + "<td class='tntRCblanc' align='center' width='" + tntRCsize109 + "'>"+ + "<a href='javascript:tntRCgetRelaisColisJSON();'><img class='tntRCButton' src='" + pathToImages + "bt-Continuer-2.jpg' onmouseover='this.src=\"" + pathToImages + "bt-Continuer-1.jpg\"' onmouseout='this.src=\"" + pathToImages + "bt-Continuer-2.jpg\"'></a>" + + "</td>"+ + "<td class='tntRCblanc' width='" + tntRCsize6 + "'></td>"+ + "</tr>" + + tntRCligneBlanche6Col()); + + blocCodePostal.html(tntRCjTable); + + // Bloc de saisie d'un nouveau code postal + blocCodePostal.append(tntRCchangerCodePostal()); +} + +function tntRCgetCommunesJSON() { + + $("#tntRCError").hide(); + tntRCcodePostal = $('#tntRCInputCP').val(); + + // Code postal non renseigné, on ne fait rien + if (tntRCcodePostal=="") return; + + if (mapDetected) resetMap(); + + // On ne fait rien si le code postal n'est pas un nombre de 5 chiffres + if (isNaN(parseInt(tntRCcodePostal)) || tntRCcodePostal.length != 5) { + tntRCgetRelaisColis(tntRCMsgErrCodePostal); + return; + } + + tntRCsetChargementEnCours(); + + var ajaxUrl; + var ajaxData; + + ajaxUrl = "http://" + tntDomain + "/public/b2c/relaisColis/rechercheJson.do?code=" + tntRCcodePostal; + ajaxData = ""; + + $.ajax({ + type: "GET", + url: ajaxUrl, + data: ajaxData, + dataType: "script", + error:function(msg){ + $("#blocCodePostal").html("Error !: " + msg ); + } + }); +}; + +function tntRCsetChargementEnCours() { + $("#tntRCLoading").show(); +}; + +function tntRCafficheDetail(i) { + + var tntRCdetailRelais = $("#tntRcDetail"+i); + + tntRCdetailRelais.html(""); + + var oRelais = tntRClisteRelais[i]; + + // Les noeuds dans le fichier JSON ne sont pas forcément ordonnés pour l'affichage, on va donc d'abord récupérer leur valeur + var codeRelais = oRelais[0] + var nomRelais = oRelais[1]; + var adresse = oRelais[4]; + var codePostal = oRelais[2]; + var commune = oRelais[3]; + var heureFermeture = oRelais[21]; + + var lundi_am = (oRelais[7] == "-")?"fermé":oRelais[7]; + var lundi_pm = (oRelais[8] == "-")?"fermé":oRelais[8]; + var mardi_am = (oRelais[9] == "-")?"fermé":oRelais[9]; + var mardi_pm = (oRelais[10] == "-")?"fermé":oRelais[10]; + var mercredi_am = (oRelais[11] == "-")?"fermé":oRelais[11]; + var mercredi_pm = (oRelais[12] == "-")?"fermé":oRelais[12]; + var jeudi_am = (oRelais[13] == "-")?"fermé":oRelais[13]; + var jeudi_pm = (oRelais[14] == "-")?"fermé":oRelais[14]; + var vendredi_am = (oRelais[15] == "-")?"fermé":oRelais[15]; + var vendredi_pm = (oRelais[16] == "-")?"fermé":oRelais[16]; + var samedi_am = (oRelais[17] == "-")?"fermé":oRelais[17]; + var samedi_pm = (oRelais[18] == "-")?"fermé":oRelais[18]; + var dimanche_am = (oRelais[19] == "-")?"fermé":oRelais[19]; + var dimanche_pm = (oRelais[20] == "-")?"fermé":oRelais[20]; + + var messages = ""; + for (j=0; j < oRelais[24].length; j++) { + var ligne = oRelais[24][j]; + if (ligne != "") messages = messages + ligne + "<br/>"; + } + + if (lundi_pm != "-") lundi_am = lundi_am + "<br/>" + lundi_pm; + if (mardi_pm != "-") mardi_am = mardi_am + "<br/>" + mardi_pm; + if (mercredi_pm != "-") mercredi_am = mercredi_am + "<br/>" + mercredi_pm; + if (jeudi_pm != "-") jeudi_am = jeudi_am + "<br/>" + jeudi_pm; + if (vendredi_pm != "-") vendredi_am = vendredi_am + "<br/>" + vendredi_pm; + if (samedi_pm != "-") samedi_am = samedi_am + "<br/>" + samedi_pm; + if (dimanche_pm != "-") dimanche_am = dimanche_am + "<br/>" + dimanche_pm; + + var logo_point = ""; + if (messages != "") logo_point = "<img src='" + pathToImages + "exception.gif' alt='Picto Informations'>"; + + var tntRCjTableX = $( + "<td class='detailRelais' colspan='6'><div class='ui-dialog-titlebar' style='text-align:right'>" + + "<span class='ui-dialog-title' onclick='document.getElementById(\"tntRcDetail"+i+"\").style.display=\"none\"'>X</span>" + + "</div>" + + "<input type='button' value='Choisir ce relais' onclick='callbackSelectionRelais();' />" + +"<table style='border:1px solid gray;margin:20px;' cellpadding='0' cellspacing='0' width='" + tntRCsize447 + "'>" + + "<tr>" + + "<td width='" + tntRCsize447 + "' valign='top'>" + + "<table style='border:0px;' cellpadding='0' cellspacing='0' width='" + tntRCsize447 + "'>" + + "<tr>" + + "<td>" + + "<table style='border:0px;' cellpadding='0' cellspacing='0' >" + + "<tr height='" + tntRCsize8 + "'><td colspan='4'></td></tr>" + + "<tr>" + + "<td class='tntRCdetailGros' width='" + tntRCsize5 + "'> </td>" + + "<td class='tntRCdetailGros' width='" + tntRCsize442 + "' colspan='3'>Localisation : </td>" + + "</tr>" + + "<tr height='" + tntRCsize20 + "'><td colspan='4'></td></tr>" + + "<tr>" + + "<td class='tntRCdetailGros' width='"+ tntRCsize5 + "'> </td>" + + "<td class='tntRCdetailGros' width='"+ tntRCsize30 + "'> </td>" + + "<td class='tntRCnoirPetit' colspan ='2'><b>" + nomRelais + "</b></td>" + + "</tr>" + + "<tr>" + + "<td class='tntRCdetailGros' width='"+ tntRCsize5 + "'> </td>" + + "<td class='tntRCdetailGros' width='"+ tntRCsize30 + "'> </td>" + + "<td class='tntRCnoirPetit' colspan ='2'>" + adresse + "</td>" + + "</tr>" + + "<tr>" + + "<td class='tntRCdetailGros' width='"+ tntRCsize5 + "'> </td>" + + "<td class='tntRCdetailGros' width='"+ tntRCsize30 + "'> </td>" + + "<td class='tntRCnoirPetit' colspan ='2'>" + codePostal + " " + commune + "</td>" + + "</tr>" + + "<tr height='" + tntRCsize50 + "'><td colspan='4'></td></tr>" + + "<tr>" + + "<td class='tntRCdetailGros' width='" + tntRCsize5 + "'> </td>" + + "<td class='tntRCdetailGros' width='" + tntRCsize442 + "' colspan='3'>Informations : </td>" + + "</tr>" + + "<tr height='" + tntRCsize8 + "'><td colspan='4'></td></tr>" + + "<tr>" + + "<td class='tntRCdetailGros' width='"+ tntRCsize5 + "'></td>" + + "<td class='tntRCdetailGros' width='"+ tntRCsize30 + "'> " + logo_point + "</td>" + + "<td class='tntRCdetailPetit' colspan ='2'>" + messages + "</td>" + + "</tr>" + + "</table>" + + "</td>" + + "</tr>" + + "</table>" + + "</td>" + + "<td width='" + tntRCsize253 + "' valign='top'>" + + "<table style='border:0px;' cellpadding='0' cellspacing='0' width='" + tntRCsize253 + "'>" + + "<tr>" + + "<td>" + + "<table style='border:0px;' cellpadding='0' cellspacing='0'>" + + "<tr height='" + tntRCsize8 + "'>" + + "<td colspan='4'></td>" + + "</tr>" + + "<tr>" + + "<td class='tntRCdetailGros'><img src='" + pathToImages + "picto-delai.gif' alt='Picto delai'></td>" + + "<td class='tntRCdetailGros' colspan='3'>Horaires d'ouverture : </td>" + + "</tr>" + + "<tr>" + + "<td class='tntRCdetailGros' width='"+ tntRCsize30 + "'></td>" + + "<td>" + + "<table class='tntRCHoraire' cellpadding='0' cellspacing='0' rules='all' width='" + tntRCsize218 + "'>" + + "<tr>" + + "<td class='tntRCHoraireJour'>Lundi</td>" + + "<td class='tntRCHoraireHeure'>" + lundi_am + "</td>" + + "</tr>" + + "<tr>" + + "<td class='tntRCHoraireJour'>Mardi</td>" + + "<td class='tntRCHoraireHeure'>" + mardi_am + "</td>" + + "</tr>" + + "<tr>" + + "<td class='tntRCHoraireJour'>Mercredi</td>" + + "<td class='tntRCHoraireHeure'>" + mercredi_am + "</td>" + + "</tr>" + + "<tr>" + + "<td class='tntRCHoraireJour'>Jeudi</td>" + + "<td class='tntRCHoraireHeure'>" + jeudi_am + "</td>" + + "</tr>" + + "<tr>" + + "<td class='tntRCHoraireJour'>Vendredi</td>" + + "<td class='tntRCHoraireHeure'>" + vendredi_am + "</td>" + + "</tr>" + + "<tr>" + + "<td class='tntRCHoraireJour'>Samedi</td>" + + "<td class='tntRCHoraireHeure'>" + samedi_am + "</td>" + + "</tr>" + + "<tr>" + + "<td class='tntRCHoraireJour'>Dimanche</td>" + + "<td class='tntRCHoraireHeure'>" + dimanche_am + "</td>" + + "</tr>" + + "</table>" + + "</td>" + + "<td class='tntRCdetailGros' width='"+ tntRCsize5 + "'></td>" + + "</tr>" + + "</table>" + + "</td>" + + "</tr>" + + "</table>" + + "</td>" + + "</tr>" + + "<tr height='" + tntRCsize8 + "'></tr>" + + "</table></td>"); + + tntRCdetailRelais.append(tntRCjTableX); + tntRCdetailRelais.show(); + //$('#tntRCDialog').dialog("open"); + //$('#tntRCDialog').css("width", "600px"); // Patch mauvais calcul jQueryUI + // Masquage des barres de scrolling + //$("html").css({overflow: "hidden", 'overflow-x': "hidden", 'overflow-y': "hidden"}); +}; + +function tntRCligneBlancheDetail(){ + return("<tr height='" + tntRCsize5 + "'><td colspan='8'> </td></tr>"); +}; + +function tntRCligneBlancheGauche(){ + return( + "<tr height='" + tntRCsize8 + "'>"+ + "<td class='tntRCdetailGros' width='" + tntRCsize5 + "'></td>"+ + "<td class='tntRCdetailGros' width='" + tntRCsize30 + "'></td>"+ + "<td class='tntRCdetailGros' width='" + tntRCsize20 + "'></td>"+ + "<td class='tntRCdetailGros' width='" + tntRCsize392 + "'></td>"+ + "</tr>"); +}; + +// Table vide avec 3 colonnes pour sauter une ligne +function tntRCligneBlanche3Col() { + return("<tr height='" + tntRCsize8 + "'><td class='tntRCblanc' width='" + tntRCsize5 + "'></td><td class='tntRCblanc' width='" + tntRCsize789 + "'></td><td class='tntRCblanc' width='" + tntRCsize6 + "'></td></tr>"); +}; + +// Table vide avec 6 colonnes pour sauter une ligne +function tntRCligneBlanche6Col() { + return("<tr height='" + tntRCsize8 + "'><td class='tntRCblanc' colspan='6'></td></td></tr>"); +}; + +// Table vide avec 3 colonnes et entête en gris +function tntRCligneGrise3Col() { + return("<tr><td class='tntRCblanc' width='" + tntRCsize5 + "'></td><td class='tntRCgris' width='" + tntRCsize789 + "'><br/></td><td class='tntRCblanc' width='" + tntRCsize6 + "'></td></tr>"); +}; + +// Table entête de colonnes grises +function tntRCenteteGrise6Col() { + return("<tr><td class='tntRCblanc' width='" + tntRCsize5 + "'></td><td class='tntRCgris' colspan='2' width='" + tntRCsize670 + "'> Les différents Relais Colis®</td><td class='tntRCblanc' width='" + tntRCsize10 + "'></td><td class='tntRCgris' width='" + tntRCsize109 + "'> Mon choix</td><td class='tntRCblanc' width='" + tntRCsize6 + "'></td></tr>"); +}; + +// Zone de saisie d'un code postal nouveau +function tntRCchangerCodePostal(){ + return( + "<div class='tntRCWhite'> </div>"+ + "<div class='tntRCBodySearch'>"+ + "<table>"+ + "<tr>"+ + "<td width='300px'>Vous pouvez choisir un autre code postal de livraison :</td>"+ + "<td width='55px'><input type='text' id='tntRCInputCP' class='tntRCInput' maxlength='5' size='5' value='' /></td>"+ + "<td><a href='#' onclick='tntRCgetDepot();'><img class='tntRCButton' src='" + pathToImages + "bt-OK-2.jpg' onmouseover='this.src=\"" + pathToImages + "bt-OK-1.jpg\"' onmouseout='this.src=\"" + pathToImages + "bt-OK-2.jpg\"'></a></td>" + + "</tr>"+ + "</table>"+ + "</div>"); +}; + +function tntRCSetSelectedInfo(selectedIdx, noMarkerInfo) { + + if (!selectedIdx && selectedIdx != 0) { + // RAZ des infos sélectionnées + $("#tntRCSelectedCode").val(""); + $("#tntRCSelectedNom").val(""); + $("#tntRCSelectedAdresse").val(""); + $("#tntRCSelectedCodePostal").val(""); + $("#tntRCSelectedCommune").val(""); + return + } + + var oRelais = tntRClisteRelais[selectedIdx]; + + $("#tntRCSelectedCode").val(oRelais[0]); + $("#tntRCSelectedNom").val(oRelais[1]); + $("#tntRCSelectedAdresse").val(oRelais[4]); + $("#tntRCSelectedCodePostal").val(oRelais[2]); + $("#tntRCSelectedCommune").val(oRelais[3]); + + if (mapDetected && !noMarkerInfo) { + + // Les noeuds dans le fichier XML ne sont pas forcément ordonnés pour l'affichage, on va donc d'abord récupérer leur valeur + var codeRelais = oRelais[0] + var nomRelais = oRelais[1]; + var adresse = oRelais[4]; + var codePostal = oRelais[2]; + var commune = oRelais[3]; + var heureFermeture = oRelais[21]; + + var messages = ""; + var lundi_am = (oRelais[7] == "-")?",":oRelais[7]+","; + var lundi_pm = oRelais[8]; + var mardi_am = (oRelais[9] == "-")?",":oRelais[9]+","; + var mardi_pm = oRelais[10]; + var mercredi_am = (oRelais[11] == "-")?",":oRelais[11]+","; + var mercredi_pm = oRelais[12]; + var jeudi_am = (oRelais[13] == "-")?",":oRelais[13]+","; + var jeudi_pm = oRelais[14]; + var vendredi_am = (oRelais[15] == "-")?",":oRelais[15]+","; + var vendredi_pm = oRelais[16]; + var samedi_am = (oRelais[17] == "-")?",":oRelais[17]+","; + var samedi_pm = oRelais[18]; + var dimanche_am = (oRelais[19] == "-")?",":oRelais[19]+","; + var dimanche_pm = oRelais[20]; + + if (lundi_pm != "-") lundi_am = lundi_am + lundi_pm; + if (mardi_pm != "-") mardi_am = mardi_am + mardi_pm; + if (mercredi_pm != "-") mercredi_am = mercredi_am + mercredi_pm; + if (jeudi_pm != "-") jeudi_am = jeudi_am + jeudi_pm; + if (vendredi_pm != "-") vendredi_am = vendredi_am + vendredi_pm; + if (samedi_pm != "-") samedi_am = samedi_am + samedi_pm; + if (dimanche_pm != "-") dimanche_am = dimanche_am + dimanche_pm; + + var horaires = new Array(); + horaires['lundi'] = lundi_am + ",1"; + horaires['mardi'] = mardi_am + ",2"; + horaires['mercredi'] = mercredi_am + ",3"; + horaires['jeudi'] = jeudi_am + ",4"; + horaires['vendredi'] = vendredi_am + ",5"; + horaires['samedi'] = samedi_am + ",6"; + horaires['dimanche'] = dimanche_am + ",0"; + + var messages = ""; + for (j=0; j < oRelais[24].length; j++) { + var ligne = oRelais[24][j]; + if (ligne != "") messages = messages + ligne + "<br/>"; + } + + setInfoMarker(codeRelais, nomRelais, adresse, codePostal, commune, messages, selectedIdx, horaires, relaisMarkers[selectedIdx]); + } +} + +function resetMap() { + + if (map) { + + map.getStreetView().setVisible(false); + + for (var i = 0; i < relaisMarkers.length; i++) { + relaisMarkers[i].setMap(null); + relaisMarkers[i] = null; + } + relaisMarkers = new Array(); + if (infowindow) infowindow.close(); + map.setZoom(defaultZoom); + map.setCenter(defaultCenter); + } +} + +/* + * Fonction appellée en retour de la recherche des communes par rapport à un code postal + * si plusieurs communes ont été trouvées + */ + +function listeCommunes(tabCommunes) { + tntRCJsonCommunes = null; + + // TEMP: car le contenu du div est entièrement reconstruit + $("#blocCodePostal").removeClass("tntRCBody"); + + tntRCJsonCommunes = tabCommunes; + tntRCafficheCommunes(tabCommunes); +} + +/* + * Fonction appellée en retour de la recherche des communes par rapport à un code postal + * si une seule commune a été trouvée + */ + +function listeRelais(tabRelais) { + + tntRClisteRelais = null; + + // TEMP: car le contenu du div est entièrement reconstruit + $("#blocCodePostal").removeClass("tntRCBody"); + + tntRCafficheRelais(tabRelais); + if (mapDetected) init_marker(tabRelais); +} + +/* + * Fonction appellée en retour de la recherche des communes si aucune commune trouvée + */ +function erreurListeCommunes() { + tntRCJsonCommunes = null; + tntRCgetRelaisColis(tntRCMsgErrLoadCommunes); +} + +function erreurListeRelais() { + tntRCgetRelaisColis(tntRCMsgErrLoadRelais); +} + + +/************************************************************************************************ + * Partie Google Map + ***********************************************************************************************/ + +var map; +var adresse_pointclic; +var zone_chalandise; +var zoomZoneChalandiseDefault; +var centerZoneChalandiseDefault; +var init_streetview = false; + +var contentTo = [ + '<br/><div>', + 'Itinéraire : <b>Vers ce lieu</b> - <a href="javascript:fromhere(0)">A partir de ce lieu</a><br/>', + 'Lieu de départ<br/>', + '<input type="text" id="saisie" name="saisie" value="" maxlength="500" size="30">', + '<input type="hidden" id="mode" name="mode" value="toPoint">', + '<input type="hidden" id="point_choisi" name="point_choisi" value="">', + '<input type="submit" onclick="popup_roadmap();" value="Ok">', + '<br/>Ex: 58 avenue Leclerc 69007 Lyon', + '</div>'].join(''); + +var contentFrom = [ + '<br/><div>', + 'Itinéraire : <a href="javascript:tohere(0)">Vers ce lieu</a> - <b>A partir de ce lieu</b><br/>', + 'Lieu d\'arrivée<br/>', + '<input type="text" id="saisie" name="saisie" value="" maxlength="500" size="30">', + '<input type="hidden" id="mode" name="mode" value="fromPoint">', + '<input type="hidden" id="point_choisi" name="point_choisi" value="">', + '<input type="button" onclick="popup_roadmap();" value="Ok">', + '<br/>Ex: 58 avenue Leclerc 69007 Lyon', + '</div>'].join(''); + +var infowindow; + +var relaisMarkers = []; +var iconRelais = new google.maps.MarkerImage( + "img/google/relaisColis.png", + new google.maps.Size(40, 30), + new google.maps.Point(0, 0), + new google.maps.Point(20, 30)) + +//Limites de la France +var allowedBounds = new google.maps.LatLngBounds( + new google.maps.LatLng(39.56533418570851, -7.41426946590909), + new google.maps.LatLng(52.88994181429149, 11.84176746590909)); + +var defaultCenter = new google.maps.LatLng(46.2276380, 2.2137490); // the center ??? +var defaultZoom = 5; // default zoom level +var aberration = 0.2; // this value is a good choice for france (?!) +var minMapScale = 5; +//var maxMapScale = 20; + +var mapDetected = false; +var callbackLinkMarker = ""; + +// fonction appellé après saisie du code postal de recherche +function init_marker(json) { + + zone_chalandise = new google.maps.LatLngBounds(); + + for (var i = 0; i < relaisMarkers.length; i++) { + relaisMarkers[i].setMap(null); + relaisMarkers[i] = null; + } + relaisMarkers = new Array(); + + if (infowindow) infowindow.close(); + + var markers = json; + + for (var i = 0; i < markers.length; i++) { + createMarker(markers[i], i); + } + + zoomZoneChalandiseDefault = zone_chalandise.getCenter(); + centerZoneChalandiseDefault = zone_chalandise; + + retourZoomChalandise(); +} + +function setInfoMarker(codeRelais, nomRelais, adresse, codePostal, commune, messages, indice, horaires, marker) { + + var htmlInfo = [ + "<div>", + "<div class='rc'>", + "<b>RELAIS COLIS N° ", codeRelais, "</b><br/>", + "<b>", nomRelais, "</b><br/>", + adresse, "<br/>", + codePostal, " ", commune, + "</div>", + "<div><br/>", messages, "</div>", + callbackLinkMarker, + "</div>", + "<div id='trajet'>" + contentTo + "</div>" + ].join(''); + + // Création du contenu de l'onglet horaire + var htmlHoraires = "<table class='horairesRCPopup'>"; + var jourSemaine = (new Date()).getDay(); + for (jour in horaires) { + var heures = (horaires[jour]).split(","); + if (heures[0] == '' && heures[1] == '') heures[0] = "fermé"; + htmlHoraires = htmlHoraires + "<tr" + (jourSemaine == parseInt(heures[2]) ? " class='selected'" : "") + "><td class='horairesRCJourPopup'> " + jour + "</td><td class='horaireRCPopup'>" + heures[0] + " " + heures[1] + "</td></tr>"; + } + htmlHoraires = htmlHoraires + "</table>"; + + adresse_pointclic = [adresse, "|", codePostal, " ", commune].join(''); + + var contentString = [ + '<div id="tabs" style="width:340px;">', + '<ul>', + '<li><a href="#tabInfos"><span>Infos</span></a></li>', + '<li><a href="#tabHoraires"><span>Horaires</span></a></li>', + '</ul>', + '<div id="tabInfos">', + htmlInfo, + '</div>', + '<div id="tabHoraires">', + htmlHoraires, + '</div>', + '</div>' + ].join(''); + + if (infowindow) infowindow.close(); + infowindow = new google.maps.InfoWindow({content: contentString}); + + google.maps.event.addListener(infowindow, "domready", function() { + $("#point_choisi").attr("value", adresse_pointclic); + $("#tabs").tabs(); + $("#tabs").parent().removeAttr("style"); + }); + + infowindow.open(map, marker); +} + +function createMarker(markerData, indice) { + + var marker = new google.maps.Marker({ + icon: iconRelais, + position: new google.maps.LatLng(markerData[5], markerData[6]), + map: map, + title:markerData[1] + }); + + google.maps.event.addListener(marker, "click", function() { + // Sélectionne le relais correspondant dans la liste + $("input[@type=radio][@name=tntRCchoixRelais]:eq("+ indice + ")").attr("checked", true); + tntRCSetSelectedInfo(indice); + }); + + relaisMarkers.push(marker); + zone_chalandise.extend(marker.getPosition()); +} + + +function tntRCInitMap() { + + // Si la carte n'est pas présente, fin de l'initialisation + if (!document.getElementById("map_canvas")) return; + mapDetected = true; + + // Si une fonction de callback a été définie, un lien est ajouté + // dans la popup d'info du marqueur de relais colis + if (window.callbackSelectionRelais) callbackLinkMarker = "<a onclick='callbackSelectionRelais();' href='#' style='color:#FF6600'>Choisir ce relais</a>"; + + //Ajout du lien pour retour en zoom zone de chalandise + var jMapCanvas = $("#map_canvas"); + jMapCanvas.wrap("<div></div>"); + jMapCanvas.parent().append("<a class=\"lien_reset\" href=\"#\" onclick=\"javascript:retourZoomChalandise();\" style=\"text-decoration:none;\">Retour à la vue initiale</a>"); + + var mapClass = jMapCanvas.attr("class"); + if (mapClass && mapClass != "") { + jMapCanvas.attr("class", ""); + jMapCanvas.parent().attr("class", mapClass); + } + + var myOptions = { + zoom: defaultZoom, + center: defaultCenter, + mapTypeId: google.maps.MapTypeId.ROADMAP, + navigationControl: true, + scaleControl: true, + mapTypeControl: true, + streetViewControl: true + }; + + map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); + + // If the map position is out of range, move it back + function checkBounds() { + + // Perform the check and return if OK + var currentBounds = map.getBounds(); + var cSpan = currentBounds.toSpan(); // width and height of the bounds + var offsetX = cSpan.lng() / (2+aberration); // we need a little border + var offsetY = cSpan.lat() / (2+aberration); + var C = map.getCenter(); // current center coords + var X = C.lng(); + var Y = C.lat(); + + // now check if the current rectangle in the allowed area + var checkSW = new google.maps.LatLng(C.lat()-offsetY,C.lng()-offsetX); + var checkNE = new google.maps.LatLng(C.lat()+offsetY,C.lng()+offsetX); + + if (allowedBounds.contains(checkSW) && + allowedBounds.contains(checkNE)) { + return; // nothing to do + } + + var AmaxX = allowedBounds.getNorthEast().lng(); + var AmaxY = allowedBounds.getNorthEast().lat(); + var AminX = allowedBounds.getSouthWest().lng(); + var AminY = allowedBounds.getSouthWest().lat(); + + if (X < (AminX+offsetX)) {X = AminX + offsetX;} + if (X > (AmaxX-offsetX)) {X = AmaxX - offsetX;} + if (Y < (AminY+offsetY)) {Y = AminY + offsetY;} + if (Y > (AmaxY-offsetY)) {Y = AmaxY - offsetY;} + + map.setCenter(new google.maps.LatLng(Y,X)); + return; + } + + google.maps.event.addListener(map, "drag", function() { + checkBounds(); + }); + + google.maps.event.addListener(map, "zoom_changed", function() { + if (map.getZoom() < minMapScale) { + map.setZoom(minMapScale); + } + }); + + google.maps.event.addListener(map.getStreetView(), "visible_changed", function() { + //premier accès lors du chargement de la page, il ne faut pas cacher les markers + if (init_streetview == true) { + if(map.getStreetView().getVisible() == true) { + for (var k = 0; k < relaisMarkers.length; k++) { + relaisMarkers[k].setVisible(false); + } + } + else { + for (var k = 0; k < relaisMarkers.length; k++) { + relaisMarkers[k].setVisible(true); + } + } + } + else init_streetview = true; + }); +} + +function retourZoomChalandise() { + if(zoomZoneChalandiseDefault){ + map.setCenter(zoomZoneChalandiseDefault); + map.fitBounds(centerZoneChalandiseDefault); + } +} + +function fromhere() { + switchFromTo(contentFrom); +} + +function tohere() { + switchFromTo(contentTo); +} + +function switchFromTo(htmlContent) { + var adresse_saisie = $("#saisie").val(); + $("#trajet").html(htmlContent); + $("#point_choisi").attr('value', adresse_pointclic); + $("#saisie").val(adresse_saisie); +} + +function popup_roadmap() { + if($("#saisie").val() == "") return; + window.open("http://" + tntDomain + "/public/geolocalisation/print_roadmap.do?mode="+ $("#mode").val() +"&point_choisi="+ $("#point_choisi").val() +"&saisie="+ $("#saisie").val()); +} + +$().ready(tntB2CRelaisColis); \ No newline at end of file diff --git a/modules/tntcarrier/js/shipping.js b/modules/tntcarrier/js/shipping.js new file mode 100644 index 000000000..f3b67196c --- /dev/null +++ b/modules/tntcarrier/js/shipping.js @@ -0,0 +1,78 @@ +function tntRCgetDepot() +{ + $("#tntRCError").hide(); + tntRCcodePostal = $("#tntRCInputCP").val(); + if (tntRCcodePostal=="") return; + if (isNaN(parseInt(tntRCcodePostal))) { + tntRCgetRelaisColis(tntRCMsgErrCodePostal); + return; + } + tntRCsetChargementEnCours(); + $("#tntRCLoading").load( + "../modules/tntcarrier/tntGetDepot.php?code="+tntRCcodePostal, + function(response, status, xhr) + { + if (status == "error") + $("#tntRCLoading").html(xhr.status + " " + xhr.statusText); + } + ); +} + +function depositButtonClick() +{ + $("#googleMapTnt").css("display", ""); +} + +function collectButtonClick() +{ + $("#googleMapTnt").css("display", "none"); +} + +$(document).ready(function() { + var transport1 = $("#tnt_carrier_collect_yes"); + var transport2 = $("#tnt_carrier_collect_no"); + transport1.click(function() { + $("#divPex").css("display", "none"); + $("#divClosing").css("display", ""); + }); + transport2.click(function() { + $("#divPex").css("display", ""); + $("#divClosing").css("display", "none"); + }); +}); + +function callbackSelectionRelais() +{ + var code = document.getElementById("tntRCSelectedCode").value; + var lastname = document.getElementById("tntRCSelectedNom").value; + var address = document.getElementById("tntRCSelectedAdresse").value; + var address2 = document.getElementById("tntRCSelectedAdresse2").value; + var zipcode = document.getElementById("tntRCSelectedCodePostal").value; + var city = document.getElementById("tntRCSelectedCommune").value; + + if (!code || code == "") + alert("Aucun depot selectionne"); + else + { + document.getElementById("tnt_carrier_shipping_pex").value = code; + document.getElementById("tnt_carrier_shipping_company").value = lastname; + var s = lastname.length - lastname.indexOf(" "); + + document.getElementById("tnt_carrier_shipping_last_name").value = ""; + document.getElementById("tnt_carrier_shipping_first_name").value = ""; + document.getElementById("tnt_carrier_shipping_address1").value = address; + document.getElementById("tnt_carrier_shipping_address2").value = address2; + document.getElementById("tnt_carrier_shipping_postal_code").value = zipcode; + document.getElementById("tnt_carrier_shipping_city").value = city; + } +} + +function changeValueTntRC(code, name, address1, address2, zipcode, city) +{ + document.getElementById("tntRCSelectedCode").value = code; + document.getElementById("tntRCSelectedNom").value = name; + document.getElementById("tntRCSelectedAdresse").value = address1; + document.getElementById("tntRCSelectedAdresse2").value = address2; + document.getElementById("tntRCSelectedCodePostal").value = zipcode; + document.getElementById("tntRCSelectedCommune").value = city; +} \ No newline at end of file diff --git a/modules/tntcarrier/logo.gif b/modules/tntcarrier/logo.gif new file mode 100644 index 000000000..43c0dd9cb Binary files /dev/null and b/modules/tntcarrier/logo.gif differ diff --git a/modules/tntcarrier/pdf/3012345000000006.pdf b/modules/tntcarrier/pdf/3012345000000006.pdf new file mode 100644 index 000000000..2c7731955 Binary files /dev/null and b/modules/tntcarrier/pdf/3012345000000006.pdf differ diff --git a/modules/tntcarrier/pdf/7812345000000006.pdf b/modules/tntcarrier/pdf/7812345000000006.pdf new file mode 100644 index 000000000..958ef2fff Binary files /dev/null and b/modules/tntcarrier/pdf/7812345000000006.pdf differ diff --git a/modules/tntcarrier/pdf/index.php b/modules/tntcarrier/pdf/index.php new file mode 100644 index 000000000..477abec6f --- /dev/null +++ b/modules/tntcarrier/pdf/index.php @@ -0,0 +1,36 @@ +<?php +/* +* 2007-2011 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA <contact@prestashop.com> +* @copyright 2007-2011 PrestaShop SA +* @version Release: $Revision: 6594 $ +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../../../"); +exit; diff --git a/modules/tntcarrier/relaisColis/css/tntB2CRelaisColis.css b/modules/tntcarrier/relaisColis/css/tntB2CRelaisColis.css new file mode 100644 index 000000000..59f62eee3 --- /dev/null +++ b/modules/tntcarrier/relaisColis/css/tntB2CRelaisColis.css @@ -0,0 +1,357 @@ +.tntRCHeader { + background-color: #ffffff; + background-image: url(../img/logo_24_relaiscolis.jpg); + background-position: 10px center; + background-repeat: no-repeat; + border-color: gray; + border-style: solid; + border-width: 1px; + color: #a0a0a0; + display: bloc; + font-family: arial,helvetica,sans-serif; + font-size: 30pt; + font-style: italic; + height: 75px; + padding-right: 10px; + padding-top: 25px; + text-align: right; + width: 530px; +} + +.tntRCSubHeader { + background-color: #ffffff; + border-width: 0px; + color: #a0a0a0; + display: bloc; + font-family: arial,helvetica,sans-serif; + font-size: 16pt; + font-weight: bold; + padding-bottom: 3px; + padding-top: 3px; + width: 600px; +} + +.tntRCBody { + background-color: #ffffff; + border-color: gray; + border-style: solid; + border-width: 1px; + color: #000000; + display: bloc; + font-family: arial,helvetica,sans-serif; + font-size: 12pt; + padding-bottom: 10px; + padding-left: 10px; + padding-top: 10px; + width: 530px; +} + +.tntRCBodySearch { + background-color: #ffffff; + border-color: gray; + border-style: solid; + border-width: 1px; + color: #a0a0a0; + font-family: arial,helvetica,sans-serif; + font-size: 10pt; + font-weight: bold; + padding-left: 3px; + padding-top: 8px; + padding-bottom: 8px; + width: 550px; +} + +.tntRCError { + background-color: #ff6600; + color: #ffffff; + display: bloc; + font-family: arial,helvetica,sans-serif; + font-size: 12pt; + font-weight: bold; + width: 520px; +} + +.tntRCGray { + background-color: #a0a0a0; + border-width: 0px; + display: bloc; + font-family: arial,helvetica,sans-serif; + font-size: 10pt; + heigth: 12px; + width: 520px; +} + +.tntRCInput { + background-color: #ffffff; + font-family: arial,helvetica,sans-serif; + font-size: 10pt; + font-weight: normal; + text-align: center; + width: 50px; +} + +.tntRCWhite { + background-color: #ffffff; + border-width: 0px; + display: bloc; + font-family: arial,helvetica,sans-serif; + font-size: 14pt; + width: 600px; +} + +.tntRCrelaisColis { + font-family: arial,helvetica,sans-serif; + font-size: 10px; + color: #000000; + border-bottom-style: solid; + border-bottom-color: #a0a0a0; + border-bottom-width: 1px; + background-color: #ffffff; + padding-bottom: 3px; + vertical-align: middle; +} + +.tntRCtitreMode { + font-family: arial,helvetica,sans-serif; + font-size: 28px; + color: #a0a0a0; + font-style: italic; + background-color: #ffffff; +} +.tntRCchoix { + font-family: arial,helvetica,sans-serif; + font-size: 14px; + color: #a0a0a0; + font-weight: bold; + background-color: #ffffff; +} +.tntRCdetailGros { + font-family: arial,helvetica,sans-serif; + font-size: 14pt; + color: #a0a0a0; + background-color: #ffffff; +} + +.tntRCnoirPetit { + font-family: arial,helvetica,sans-serif; + font-size: 12pt; + color: #000000; + background-color: #ffffff; +} +.tntRCdetailPetit { + font-family: arial,helvetica,sans-serif; + font-size: 12pt; + color: #a0a0a0; + background-color: #ffffff; + font-weight: bold; +} +.tntRCentree { + font-family: arial,helvetica,sans-serif; + font-size: 12pt; + color: #000000; + background-color: #ffffff; + vertical-align: middle; +} +.tntRCgris { + font-family: arial,helvetica,sans-serif; + font-size: 10pt; + color: #ffffff; + background-color: #a0a0a0; + font-weight: bold; +} + +table.tntRCHoraire td { + border: 1px solid gray; + font-family: arial,helvetica,sans-serif; + font-size: 10pt; + vertical-align: middle; +} + +.tntRCHoraireJour{ + color: #a0a0a0; + text-align: right; + padding-right: 10px; + height: 36px; + width: 79px; + font-weight: bold; +} + +.tntRCHoraireHeure { + color: #000000; + padding-left: 10px; + width: 84px; +} + +.tntRCblanc { + font-family: arial,helvetica,sans-serif; + font-size: 12px; + color: #000000; + background-color: #ffffff; + padding-top: 4px; + padding-bottom: 3px; +} +.tntRCblancpetit { + font-family: arial,helvetica,sans-serif; + font-size: 12px; + color: #000000; + background-color: #ffffff; + padding-top: 4px; + padding-bottom: 3px; +} +.tntRCfermeture { + padding-left: 585px; +} + +.tntRCBack2Communes { + background-color: #ffffff; + color: #a0a0a0; + font-family: arial,helvetica,sans-serif; + font-style: italic; + font-size: 11pt; + font-weight: bold; + padding-top: 18px; + text-align: right; +} + +.tntRCBack2Communes a { + color: #a0a0a0; + text-decoration: none; + padding-right: 5px; +} + +.tntRCBack2Communes a img{ + border: 0; + padding-right: 5px; + vertical-align: text-bottom; +} + +.tntRCBoutonLoupe { + background-color: #ffffff; + border: 0px; + color: #000000; + font-family: arial,helvetica,sans-serif; + font-size: 12px; + padding-top: 4px; + padding-bottom: 3px; + text-decoration: none; + vertical-align: middle; +} +.jqmWindow { + background-color: #FFF; + border: 1px solid black; + color: #333; + display: none; + padding: 12px; + position: fixed; + left: 50%; + margin-left: -300px; + margin-top: -240px; + width: 600px; +} + +div.tntRCfermeture .jqmClose em{display:none;} +div.tntRCfermeture .jqmClose { + background: transparent url(../img/close_icon_double.png) 0 0 no-repeat; + display: block; + width: 20px; + height: 20px; +} + +div.tntRCfermeture a.jqmClose:hover{ background-position: 0 -20px; } + +.jqmOverlay { + background-color: #000; + overflow: hidden; +} + +* html .jqmWindow { + position: absolute; + top: expression((document.documentElement.scrollTop || document.body.scrollTop) + Math.round(17 * (document.documentElement.offsetHeight || document.body.clientHeight) / 100) + 'px'); +} + +img.tntRCButton { + border: 0px; + vertical-align: middle; + text-decoration: none; +} + +sup.tntRCSup { + +} + + table.horairesRC td { + width : 100%; + margin: 0px; + padding: 0px; + } + + table.horairesRCPopup { + width : 100%; + margin: 0px; + padding: 0px; + } + + table.horairesRCPopup tr.selected td { + background-color: #eeeeee; + color: #ff6600; + } + + td.horaireRCPopup { + width : 60%; + } + + td.horairesRCJourPopup { + width : 40%; + font-weight: bold; + color: #808080; + } + + td.horairesRCJour { + font-weight: bold; + color: #808080; + } + table.horairesRC tr.selected td { + background-color: #eeeeee; + color: #ff6600; + } + + div.ag { + background-image: url(/img/google/agenceTnt.png); + background-repeat: no-repeat; + padding-left:60px; + } + + div.rc { + background-image: url(/img/google/relaisColis.png); + background-repeat: no-repeat; + padding-left:50px; + } + + +.lien_reset { + color : #ff6600; + font-family: arial,helvetica,sans-serif; + font-weight: bold; + font-size : 15px; + text-decoration:none; +} + +a { + color: #f60; + outline-color: #f60 !important; + outline: none; +} + +a:hover { + text-decoration: none; +} + +.exemplePresentation { + display: inline; + float: left; + margin-top: 10px; +} + +#tntB2CRelaisColis { + width: 550px; +} \ No newline at end of file diff --git a/modules/tntcarrier/relaisColis/css/ui.dialog.css b/modules/tntcarrier/relaisColis/css/ui.dialog.css new file mode 100644 index 000000000..a80d9be33 --- /dev/null +++ b/modules/tntcarrier/relaisColis/css/ui.dialog.css @@ -0,0 +1,158 @@ +/* + * jQuery UI screen structure and presentation + * This CSS file was generated by ThemeRoller, a Filament Group Project for jQuery UI + * Author: Scott Jehl, scott@filamentgroup.com, http://www.filamentgroup.com + * Visit ThemeRoller.com +*/ + +/* + * Note: If your ThemeRoller settings have a font size set in ems, your components will scale according to their parent element's font size. + * As a rule of thumb, set your body's font size to 62.5% to make 1em = 10px. + * body {font-size: 62.5%;} +*/ + + +/*dialog*/ +.ui-dialog { + /*resets*/margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; + font-family: Lucida Grande, Lucida Sans, Arial, sans-serif; + font-size: 11px; + background: #fcfdfd url(../img/ui-dialog/fcfdfd_40x100_textures_06_inset_hard_100.png) 0 bottom repeat-x; + color: #222222; + border: 3px solid #808080; + position: relative; +} +.ui-resizable-handle { + position: absolute; + font-size: 0.1px; + z-index: 99999; +} +.ui-resizable .ui-resizable-handle { + display: block; +} +body .ui-resizable-disabled .ui-resizable-handle { display: none; } /* use 'body' to make it more specific (css order) */ +body .ui-resizable-autohide .ui-resizable-handle { display: none; } /* use 'body' to make it more specific (css order) */ +.ui-resizable-n { + cursor: n-resize; + height: 7px; + width: 100%; + top: -5px; + left: 0px; +} +.ui-resizable-s { + cursor: s-resize; + height: 7px; + width: 100%; + bottom: -5px; + left: 0px; +} +.ui-resizable-e { + cursor: e-resize; + width: 7px; + right: -5px; + top: 0px; + height: 100%; +} +.ui-resizable-w { + cursor: w-resize; + width: 7px; + left: -5px; + top: 0px; + height: 100%; +} +.ui-resizable-se { + cursor: se-resize; + width: 13px; + height: 13px; + right: 0px; + bottom: 0px; + background: url(../img/ui-dialog/469bdd_11x11_icon_resize_se.gif) no-repeat 0 0; +} +.ui-resizable-sw { + cursor: sw-resize; + width: 9px; + height: 9px; + left: 0px; + bottom: 0px; +} +.ui-resizable-nw { + cursor: nw-resize; + width: 9px; + height: 9px; + left: 0px; + top: 0px; +} +.ui-resizable-ne { + cursor: ne-resize; + width: 9px; + height: 9px; + right: 0px; + top: 0px; +} +.ui-dialog-titlebar { + /*resets*/margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; + padding: 5px 15px 5px 10px; + color: #2e6e9e; + border-bottom: 1px solid #c5dbec; + font-size: 10px; + font-weight: bold; + position: relative; +} +.ui-dialog-title {} +.ui-dialog-titlebar-close { + /*resets*/margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; + background: url(../img/ui-dialog/6da8d5_11x11_icon_close.gif) 0 0 no-repeat; + position: absolute; + right: 8px; + top: 7px; + width: 11px; + height: 11px; + z-index: 100; +} +.ui-dialog-titlebar-close-hover, .ui-dialog-titlebar-close:hover { + background: url(../img/ui-dialog/217bc0_11x11_icon_close.gif) 0 0 no-repeat; +} +.ui-dialog-titlebar-close:active { + background: url(../img/ui-dialog/f9bd01_11x11_icon_close.gif) 0 0 no-repeat; +} +.ui-dialog-titlebar-close span { + display: none; +} +.ui-dialog-content { + /*resets*/margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; + color: #222222; + padding: 15px 17px; +} +.ui-dialog-buttonpane { + position: absolute; + bottom: 0; + width: 100%; + text-align: left; + border-top: 1px solid #a6c9e2; + background: #fcfdfd; +} +.ui-dialog-buttonpane button { + margin: 5px 0 5px 8px; + color: #2e6e9e; + background: #dfeffc url(../img/ui-dialog/dfeffc_40x100_textures_02_glass_85.png) 0 50% repeat-x; + font-size: 1; + border: 10px solid #c5dbec; + cursor: pointer; + padding: 2px 6px 3px 6px; + line-height: 14px; +} +.ui-dialog-buttonpane button:hover { + color: #1d5987; + background: #d0e5f5 url(../img/ui-dialog/d0e5f5_40x100_textures_02_glass_75.png) 0 50% repeat-x; + border: 1px solid #79b7e7; +} +.ui-dialog-buttonpane button:active { + color: #e17009; + background: #f5f8f9 url(../img/ui-dialog/f5f8f9_40x100_textures_06_inset_hard_100.png) 0 50% repeat-x; + border: 1px solid #79b7e7; +} +/* This file skins dialog */ +.ui-dialog.ui-draggable .ui-dialog-titlebar, +.ui-dialog.ui-draggable .ui-dialog-titlebar { + cursor: move; +} diff --git a/modules/tntcarrier/relaisColis/css/ui.tabs.css b/modules/tntcarrier/relaisColis/css/ui.tabs.css new file mode 100644 index 000000000..eb071d40f --- /dev/null +++ b/modules/tntcarrier/relaisColis/css/ui.tabs.css @@ -0,0 +1,55 @@ +/*UI tabs*/ +.ui-tabs-nav { + /*resets*/margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; /*font-size: 100%;*/ list-style: none; + font-family: Lucida Grande, Lucida Sans, Arial, sans-serif; + font-size: 10px; + float: left; + position: relative; + z-index: 1; + /*border-right: 1px solid #c5dbec;*/ + bottom: -1px; +} +.ui-tabs-nav ul { + /*resets*/margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; /*font-size: 100%;*/ list-style: none; +} +.ui-tabs-nav li { + /*resets*/margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; /*font-size: 100%;*/ list-style: none; + float: left; + border: 1px solid #c5dbec; + border-right: none; +} +.ui-tabs-nav li a { + /*resets*/margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; /*font-size: 100%;*/ list-style: none; + float: left; + font-size: 10px; + font-weight: bold; + text-decoration: none; + padding: .2em 1em; + color: #2e6e9e; + background: #dfeffc url(../img/ui-dialog/dfeffc_40x100_textures_02_glass_85.png) 0 50% repeat-x; +} +.ui-tabs-nav li a:hover { + background: #d0e5f5 url(../img/ui-dialog/d0e5f5_40x100_textures_02_glass_75.png) 0 50% repeat-x; + color: #1d5987; +} +.ui-tabs-nav li.ui-tabs-selected { + border-bottom-color: #f5f8f9; +} +.ui-tabs-nav li.ui-tabs-selected a, .ui-tabs-nav li.ui-tabs-selected a:hover { + background: #f5f8f9 url(../img/ui-dialog/f5f8f9_40x100_textures_06_inset_hard_100.png) 0 50% repeat-x; + color: #e17009; +} +.ui-tabs-panel { + /*resets*/margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; /*font-size: 100%;*/ list-style: none; + /*font-family: Lucida Grande, Lucida Sans, Arial, sans-serif;*/ + clear:left; + border: 1px solid #c5dbec; + background: #fcfdfd url(../img/ui-dialog/fcfdfd_40x100_textures_06_inset_hard_100.png) 0 bottom repeat-x; + /*color: #222222;*/ + padding: 1em 1em; + width: 315px; + font-size: 10px; +} +.ui-tabs-hide { + display: none;/* for accessible hiding: position: absolute; left: -99999999px*/; +} \ No newline at end of file diff --git a/modules/tntcarrier/relaisColis/img/5-puce-choix-gris2.gif b/modules/tntcarrier/relaisColis/img/5-puce-choix-gris2.gif new file mode 100644 index 000000000..609487a29 Binary files /dev/null and b/modules/tntcarrier/relaisColis/img/5-puce-choix-gris2.gif differ diff --git a/modules/tntcarrier/relaisColis/img/Thumbs.db b/modules/tntcarrier/relaisColis/img/Thumbs.db new file mode 100644 index 000000000..0698e65d0 Binary files /dev/null and b/modules/tntcarrier/relaisColis/img/Thumbs.db differ diff --git a/modules/tntcarrier/relaisColis/img/bt-CodePostal-1.jpg b/modules/tntcarrier/relaisColis/img/bt-CodePostal-1.jpg new file mode 100644 index 000000000..3f3b462d4 Binary files /dev/null and b/modules/tntcarrier/relaisColis/img/bt-CodePostal-1.jpg differ diff --git a/modules/tntcarrier/relaisColis/img/bt-CodePostal-2.jpg b/modules/tntcarrier/relaisColis/img/bt-CodePostal-2.jpg new file mode 100644 index 000000000..395a31b95 Binary files /dev/null and b/modules/tntcarrier/relaisColis/img/bt-CodePostal-2.jpg differ diff --git a/modules/tntcarrier/relaisColis/img/bt-Continuer-1.jpg b/modules/tntcarrier/relaisColis/img/bt-Continuer-1.jpg new file mode 100644 index 000000000..573666983 Binary files /dev/null and b/modules/tntcarrier/relaisColis/img/bt-Continuer-1.jpg differ diff --git a/modules/tntcarrier/relaisColis/img/bt-Continuer-2.jpg b/modules/tntcarrier/relaisColis/img/bt-Continuer-2.jpg new file mode 100644 index 000000000..04a1f19ac Binary files /dev/null and b/modules/tntcarrier/relaisColis/img/bt-Continuer-2.jpg differ diff --git a/modules/tntcarrier/relaisColis/img/bt-OK-1.jpg b/modules/tntcarrier/relaisColis/img/bt-OK-1.jpg new file mode 100644 index 000000000..8a49e76b6 Binary files /dev/null and b/modules/tntcarrier/relaisColis/img/bt-OK-1.jpg differ diff --git a/modules/tntcarrier/relaisColis/img/bt-OK-2.jpg b/modules/tntcarrier/relaisColis/img/bt-OK-2.jpg new file mode 100644 index 000000000..7974b961b Binary files /dev/null and b/modules/tntcarrier/relaisColis/img/bt-OK-2.jpg differ diff --git a/modules/tntcarrier/relaisColis/img/bt-Retour.gif b/modules/tntcarrier/relaisColis/img/bt-Retour.gif new file mode 100644 index 000000000..4d8de068b Binary files /dev/null and b/modules/tntcarrier/relaisColis/img/bt-Retour.gif differ diff --git a/modules/tntcarrier/relaisColis/img/close_icon_double.png b/modules/tntcarrier/relaisColis/img/close_icon_double.png new file mode 100644 index 000000000..2e58b6b66 Binary files /dev/null and b/modules/tntcarrier/relaisColis/img/close_icon_double.png differ diff --git a/modules/tntcarrier/relaisColis/img/exception.gif b/modules/tntcarrier/relaisColis/img/exception.gif new file mode 100644 index 000000000..2938eac5b Binary files /dev/null and b/modules/tntcarrier/relaisColis/img/exception.gif differ diff --git a/modules/tntcarrier/relaisColis/img/exception2.gif b/modules/tntcarrier/relaisColis/img/exception2.gif new file mode 100644 index 000000000..7fa3778bf Binary files /dev/null and b/modules/tntcarrier/relaisColis/img/exception2.gif differ diff --git a/modules/tntcarrier/relaisColis/img/google/Thumbs.db b/modules/tntcarrier/relaisColis/img/google/Thumbs.db new file mode 100644 index 000000000..502aaa322 Binary files /dev/null and b/modules/tntcarrier/relaisColis/img/google/Thumbs.db differ diff --git a/modules/tntcarrier/relaisColis/img/google/agenceTnt.png b/modules/tntcarrier/relaisColis/img/google/agenceTnt.png new file mode 100644 index 000000000..05b3570a7 Binary files /dev/null and b/modules/tntcarrier/relaisColis/img/google/agenceTnt.png differ diff --git a/modules/tntcarrier/relaisColis/img/google/red-pushpin-s.png b/modules/tntcarrier/relaisColis/img/google/red-pushpin-s.png new file mode 100644 index 000000000..162aa0fa7 Binary files /dev/null and b/modules/tntcarrier/relaisColis/img/google/red-pushpin-s.png differ diff --git a/modules/tntcarrier/relaisColis/img/google/red-pushpin.png b/modules/tntcarrier/relaisColis/img/google/red-pushpin.png new file mode 100644 index 000000000..203512d5c Binary files /dev/null and b/modules/tntcarrier/relaisColis/img/google/red-pushpin.png differ diff --git a/modules/tntcarrier/relaisColis/img/google/relaisColis.png b/modules/tntcarrier/relaisColis/img/google/relaisColis.png new file mode 100644 index 000000000..eb52b7d62 Binary files /dev/null and b/modules/tntcarrier/relaisColis/img/google/relaisColis.png differ diff --git a/modules/tntcarrier/relaisColis/img/lg_tnt.gif b/modules/tntcarrier/relaisColis/img/lg_tnt.gif new file mode 100644 index 000000000..c33e6e844 Binary files /dev/null and b/modules/tntcarrier/relaisColis/img/lg_tnt.gif differ diff --git a/modules/tntcarrier/relaisColis/img/livreur.gif b/modules/tntcarrier/relaisColis/img/livreur.gif new file mode 100644 index 000000000..2d45a42a1 Binary files /dev/null and b/modules/tntcarrier/relaisColis/img/livreur.gif differ diff --git a/modules/tntcarrier/relaisColis/img/logo-tnt-petit.jpg b/modules/tntcarrier/relaisColis/img/logo-tnt-petit.jpg new file mode 100644 index 000000000..b90c6dc4f Binary files /dev/null and b/modules/tntcarrier/relaisColis/img/logo-tnt-petit.jpg differ diff --git a/modules/tntcarrier/relaisColis/img/logo_24_chezmoi.jpg b/modules/tntcarrier/relaisColis/img/logo_24_chezmoi.jpg new file mode 100644 index 000000000..de9ec6a32 Binary files /dev/null and b/modules/tntcarrier/relaisColis/img/logo_24_chezmoi.jpg differ diff --git a/modules/tntcarrier/relaisColis/img/logo_24_relaiscolis.jpg b/modules/tntcarrier/relaisColis/img/logo_24_relaiscolis.jpg new file mode 100644 index 000000000..f32ea64c5 Binary files /dev/null and b/modules/tntcarrier/relaisColis/img/logo_24_relaiscolis.jpg differ diff --git a/modules/tntcarrier/relaisColis/img/logo_24h_chezmoi_RVB.gif b/modules/tntcarrier/relaisColis/img/logo_24h_chezmoi_RVB.gif new file mode 100644 index 000000000..aef322ce9 Binary files /dev/null and b/modules/tntcarrier/relaisColis/img/logo_24h_chezmoi_RVB.gif differ diff --git a/modules/tntcarrier/relaisColis/img/logo_24h_relaiscolis_RVB.gif b/modules/tntcarrier/relaisColis/img/logo_24h_relaiscolis_RVB.gif new file mode 100644 index 000000000..b50b0cf56 Binary files /dev/null and b/modules/tntcarrier/relaisColis/img/logo_24h_relaiscolis_RVB.gif differ diff --git a/modules/tntcarrier/relaisColis/img/logos_24.jpg b/modules/tntcarrier/relaisColis/img/logos_24.jpg new file mode 100644 index 000000000..5da054fee Binary files /dev/null and b/modules/tntcarrier/relaisColis/img/logos_24.jpg differ diff --git a/modules/tntcarrier/relaisColis/img/loupe.gif b/modules/tntcarrier/relaisColis/img/loupe.gif new file mode 100644 index 000000000..317184d42 Binary files /dev/null and b/modules/tntcarrier/relaisColis/img/loupe.gif differ diff --git a/modules/tntcarrier/relaisColis/img/notes.gif b/modules/tntcarrier/relaisColis/img/notes.gif new file mode 100644 index 000000000..3375cbf94 Binary files /dev/null and b/modules/tntcarrier/relaisColis/img/notes.gif differ diff --git a/modules/tntcarrier/relaisColis/img/picto-delai.gif b/modules/tntcarrier/relaisColis/img/picto-delai.gif new file mode 100644 index 000000000..3364dedcd Binary files /dev/null and b/modules/tntcarrier/relaisColis/img/picto-delai.gif differ diff --git a/modules/tntcarrier/relaisColis/img/picto_localiser.png b/modules/tntcarrier/relaisColis/img/picto_localiser.png new file mode 100644 index 000000000..0631c121a Binary files /dev/null and b/modules/tntcarrier/relaisColis/img/picto_localiser.png differ diff --git a/modules/tntcarrier/relaisColis/img/tnt_logo.gif b/modules/tntcarrier/relaisColis/img/tnt_logo.gif new file mode 100644 index 000000000..a170e265d Binary files /dev/null and b/modules/tntcarrier/relaisColis/img/tnt_logo.gif differ diff --git a/modules/tntcarrier/relaisColis/img/ui-dialog/217bc0_11x11_icon_arrows_leftright.gif b/modules/tntcarrier/relaisColis/img/ui-dialog/217bc0_11x11_icon_arrows_leftright.gif new file mode 100644 index 000000000..1d52948d9 Binary files /dev/null and b/modules/tntcarrier/relaisColis/img/ui-dialog/217bc0_11x11_icon_arrows_leftright.gif differ diff --git a/modules/tntcarrier/relaisColis/img/ui-dialog/217bc0_11x11_icon_arrows_updown.gif b/modules/tntcarrier/relaisColis/img/ui-dialog/217bc0_11x11_icon_arrows_updown.gif new file mode 100644 index 000000000..7f4437d37 Binary files /dev/null and b/modules/tntcarrier/relaisColis/img/ui-dialog/217bc0_11x11_icon_arrows_updown.gif differ diff --git a/modules/tntcarrier/relaisColis/img/ui-dialog/217bc0_11x11_icon_close.gif b/modules/tntcarrier/relaisColis/img/ui-dialog/217bc0_11x11_icon_close.gif new file mode 100644 index 000000000..9e4ad7d09 Binary files /dev/null and b/modules/tntcarrier/relaisColis/img/ui-dialog/217bc0_11x11_icon_close.gif differ diff --git a/modules/tntcarrier/relaisColis/img/ui-dialog/217bc0_11x11_icon_doc.gif b/modules/tntcarrier/relaisColis/img/ui-dialog/217bc0_11x11_icon_doc.gif new file mode 100644 index 000000000..5609c8b65 Binary files /dev/null and b/modules/tntcarrier/relaisColis/img/ui-dialog/217bc0_11x11_icon_doc.gif differ diff --git a/modules/tntcarrier/relaisColis/img/ui-dialog/217bc0_11x11_icon_folder_closed.gif b/modules/tntcarrier/relaisColis/img/ui-dialog/217bc0_11x11_icon_folder_closed.gif new file mode 100644 index 000000000..ff367cf4d Binary files /dev/null and b/modules/tntcarrier/relaisColis/img/ui-dialog/217bc0_11x11_icon_folder_closed.gif differ diff --git a/modules/tntcarrier/relaisColis/img/ui-dialog/217bc0_11x11_icon_folder_open.gif b/modules/tntcarrier/relaisColis/img/ui-dialog/217bc0_11x11_icon_folder_open.gif new file mode 100644 index 000000000..7a93891b0 Binary files /dev/null and b/modules/tntcarrier/relaisColis/img/ui-dialog/217bc0_11x11_icon_folder_open.gif differ diff --git a/modules/tntcarrier/relaisColis/img/ui-dialog/217bc0_11x11_icon_minus.gif b/modules/tntcarrier/relaisColis/img/ui-dialog/217bc0_11x11_icon_minus.gif new file mode 100644 index 000000000..0f1df159f Binary files /dev/null and b/modules/tntcarrier/relaisColis/img/ui-dialog/217bc0_11x11_icon_minus.gif differ diff --git a/modules/tntcarrier/relaisColis/img/ui-dialog/217bc0_11x11_icon_plus.gif b/modules/tntcarrier/relaisColis/img/ui-dialog/217bc0_11x11_icon_plus.gif new file mode 100644 index 000000000..6875dfb81 Binary files /dev/null and b/modules/tntcarrier/relaisColis/img/ui-dialog/217bc0_11x11_icon_plus.gif differ diff --git a/modules/tntcarrier/relaisColis/img/ui-dialog/217bc0_7x7_arrow_down.gif b/modules/tntcarrier/relaisColis/img/ui-dialog/217bc0_7x7_arrow_down.gif new file mode 100644 index 000000000..f3d9ef702 Binary files /dev/null and b/modules/tntcarrier/relaisColis/img/ui-dialog/217bc0_7x7_arrow_down.gif differ diff --git a/modules/tntcarrier/relaisColis/img/ui-dialog/217bc0_7x7_arrow_left.gif b/modules/tntcarrier/relaisColis/img/ui-dialog/217bc0_7x7_arrow_left.gif new file mode 100644 index 000000000..0d1c30b07 Binary files /dev/null and b/modules/tntcarrier/relaisColis/img/ui-dialog/217bc0_7x7_arrow_left.gif differ diff --git a/modules/tntcarrier/relaisColis/img/ui-dialog/217bc0_7x7_arrow_right.gif b/modules/tntcarrier/relaisColis/img/ui-dialog/217bc0_7x7_arrow_right.gif new file mode 100644 index 000000000..5f25ff41c Binary files /dev/null and b/modules/tntcarrier/relaisColis/img/ui-dialog/217bc0_7x7_arrow_right.gif differ diff --git a/modules/tntcarrier/relaisColis/img/ui-dialog/217bc0_7x7_arrow_up.gif b/modules/tntcarrier/relaisColis/img/ui-dialog/217bc0_7x7_arrow_up.gif new file mode 100644 index 000000000..aabad1ea4 Binary files /dev/null and b/modules/tntcarrier/relaisColis/img/ui-dialog/217bc0_7x7_arrow_up.gif differ diff --git a/modules/tntcarrier/relaisColis/img/ui-dialog/469bdd_11x11_icon_arrows_leftright.gif b/modules/tntcarrier/relaisColis/img/ui-dialog/469bdd_11x11_icon_arrows_leftright.gif new file mode 100644 index 000000000..8eb1a4f58 Binary files /dev/null and b/modules/tntcarrier/relaisColis/img/ui-dialog/469bdd_11x11_icon_arrows_leftright.gif differ diff --git a/modules/tntcarrier/relaisColis/img/ui-dialog/469bdd_11x11_icon_arrows_updown.gif b/modules/tntcarrier/relaisColis/img/ui-dialog/469bdd_11x11_icon_arrows_updown.gif new file mode 100644 index 000000000..14997c504 Binary files /dev/null and b/modules/tntcarrier/relaisColis/img/ui-dialog/469bdd_11x11_icon_arrows_updown.gif differ diff --git a/modules/tntcarrier/relaisColis/img/ui-dialog/469bdd_11x11_icon_doc.gif b/modules/tntcarrier/relaisColis/img/ui-dialog/469bdd_11x11_icon_doc.gif new file mode 100644 index 000000000..26a26f631 Binary files /dev/null and b/modules/tntcarrier/relaisColis/img/ui-dialog/469bdd_11x11_icon_doc.gif differ diff --git a/modules/tntcarrier/relaisColis/img/ui-dialog/469bdd_11x11_icon_minus.gif b/modules/tntcarrier/relaisColis/img/ui-dialog/469bdd_11x11_icon_minus.gif new file mode 100644 index 000000000..cc89f2189 Binary files /dev/null and b/modules/tntcarrier/relaisColis/img/ui-dialog/469bdd_11x11_icon_minus.gif differ diff --git a/modules/tntcarrier/relaisColis/img/ui-dialog/469bdd_11x11_icon_plus.gif b/modules/tntcarrier/relaisColis/img/ui-dialog/469bdd_11x11_icon_plus.gif new file mode 100644 index 000000000..b92ab3a58 Binary files /dev/null and b/modules/tntcarrier/relaisColis/img/ui-dialog/469bdd_11x11_icon_plus.gif differ diff --git a/modules/tntcarrier/relaisColis/img/ui-dialog/469bdd_11x11_icon_resize_se.gif b/modules/tntcarrier/relaisColis/img/ui-dialog/469bdd_11x11_icon_resize_se.gif new file mode 100644 index 000000000..240a3dd06 Binary files /dev/null and b/modules/tntcarrier/relaisColis/img/ui-dialog/469bdd_11x11_icon_resize_se.gif differ diff --git a/modules/tntcarrier/relaisColis/img/ui-dialog/469bdd_7x7_arrow_down.gif b/modules/tntcarrier/relaisColis/img/ui-dialog/469bdd_7x7_arrow_down.gif new file mode 100644 index 000000000..3019c30e7 Binary files /dev/null and b/modules/tntcarrier/relaisColis/img/ui-dialog/469bdd_7x7_arrow_down.gif differ diff --git a/modules/tntcarrier/relaisColis/img/ui-dialog/469bdd_7x7_arrow_left.gif b/modules/tntcarrier/relaisColis/img/ui-dialog/469bdd_7x7_arrow_left.gif new file mode 100644 index 000000000..363f1c676 Binary files /dev/null and b/modules/tntcarrier/relaisColis/img/ui-dialog/469bdd_7x7_arrow_left.gif differ diff --git a/modules/tntcarrier/relaisColis/img/ui-dialog/469bdd_7x7_arrow_right.gif b/modules/tntcarrier/relaisColis/img/ui-dialog/469bdd_7x7_arrow_right.gif new file mode 100644 index 000000000..8fcedce30 Binary files /dev/null and b/modules/tntcarrier/relaisColis/img/ui-dialog/469bdd_7x7_arrow_right.gif differ diff --git a/modules/tntcarrier/relaisColis/img/ui-dialog/469bdd_7x7_arrow_up.gif b/modules/tntcarrier/relaisColis/img/ui-dialog/469bdd_7x7_arrow_up.gif new file mode 100644 index 000000000..83ba7aff1 Binary files /dev/null and b/modules/tntcarrier/relaisColis/img/ui-dialog/469bdd_7x7_arrow_up.gif differ diff --git a/modules/tntcarrier/relaisColis/img/ui-dialog/6da8d5_11x11_icon_arrows_leftright.gif b/modules/tntcarrier/relaisColis/img/ui-dialog/6da8d5_11x11_icon_arrows_leftright.gif new file mode 100644 index 000000000..51eb183ea Binary files /dev/null and b/modules/tntcarrier/relaisColis/img/ui-dialog/6da8d5_11x11_icon_arrows_leftright.gif differ diff --git a/modules/tntcarrier/relaisColis/img/ui-dialog/6da8d5_11x11_icon_arrows_updown.gif b/modules/tntcarrier/relaisColis/img/ui-dialog/6da8d5_11x11_icon_arrows_updown.gif new file mode 100644 index 000000000..adc7dcfc9 Binary files /dev/null and b/modules/tntcarrier/relaisColis/img/ui-dialog/6da8d5_11x11_icon_arrows_updown.gif differ diff --git a/modules/tntcarrier/relaisColis/img/ui-dialog/6da8d5_11x11_icon_close.gif b/modules/tntcarrier/relaisColis/img/ui-dialog/6da8d5_11x11_icon_close.gif new file mode 100644 index 000000000..73c1d7201 Binary files /dev/null and b/modules/tntcarrier/relaisColis/img/ui-dialog/6da8d5_11x11_icon_close.gif differ diff --git a/modules/tntcarrier/relaisColis/img/ui-dialog/6da8d5_11x11_icon_doc.gif b/modules/tntcarrier/relaisColis/img/ui-dialog/6da8d5_11x11_icon_doc.gif new file mode 100644 index 000000000..42dc16c76 Binary files /dev/null and b/modules/tntcarrier/relaisColis/img/ui-dialog/6da8d5_11x11_icon_doc.gif differ diff --git a/modules/tntcarrier/relaisColis/img/ui-dialog/6da8d5_11x11_icon_folder_closed.gif b/modules/tntcarrier/relaisColis/img/ui-dialog/6da8d5_11x11_icon_folder_closed.gif new file mode 100644 index 000000000..a57741271 Binary files /dev/null and b/modules/tntcarrier/relaisColis/img/ui-dialog/6da8d5_11x11_icon_folder_closed.gif differ diff --git a/modules/tntcarrier/relaisColis/img/ui-dialog/6da8d5_11x11_icon_folder_open.gif b/modules/tntcarrier/relaisColis/img/ui-dialog/6da8d5_11x11_icon_folder_open.gif new file mode 100644 index 000000000..74afe4be1 Binary files /dev/null and b/modules/tntcarrier/relaisColis/img/ui-dialog/6da8d5_11x11_icon_folder_open.gif differ diff --git a/modules/tntcarrier/relaisColis/img/ui-dialog/6da8d5_11x11_icon_minus.gif b/modules/tntcarrier/relaisColis/img/ui-dialog/6da8d5_11x11_icon_minus.gif new file mode 100644 index 000000000..69fcad2ee Binary files /dev/null and b/modules/tntcarrier/relaisColis/img/ui-dialog/6da8d5_11x11_icon_minus.gif differ diff --git a/modules/tntcarrier/relaisColis/img/ui-dialog/6da8d5_11x11_icon_plus.gif b/modules/tntcarrier/relaisColis/img/ui-dialog/6da8d5_11x11_icon_plus.gif new file mode 100644 index 000000000..7193add21 Binary files /dev/null and b/modules/tntcarrier/relaisColis/img/ui-dialog/6da8d5_11x11_icon_plus.gif differ diff --git a/modules/tntcarrier/relaisColis/img/ui-dialog/6da8d5_7x7_arrow_down.gif b/modules/tntcarrier/relaisColis/img/ui-dialog/6da8d5_7x7_arrow_down.gif new file mode 100644 index 000000000..8bf915ebf Binary files /dev/null and b/modules/tntcarrier/relaisColis/img/ui-dialog/6da8d5_7x7_arrow_down.gif differ diff --git a/modules/tntcarrier/relaisColis/img/ui-dialog/6da8d5_7x7_arrow_left.gif b/modules/tntcarrier/relaisColis/img/ui-dialog/6da8d5_7x7_arrow_left.gif new file mode 100644 index 000000000..9cb0eee53 Binary files /dev/null and b/modules/tntcarrier/relaisColis/img/ui-dialog/6da8d5_7x7_arrow_left.gif differ diff --git a/modules/tntcarrier/relaisColis/img/ui-dialog/6da8d5_7x7_arrow_right.gif b/modules/tntcarrier/relaisColis/img/ui-dialog/6da8d5_7x7_arrow_right.gif new file mode 100644 index 000000000..5fdf8e9b9 Binary files /dev/null and b/modules/tntcarrier/relaisColis/img/ui-dialog/6da8d5_7x7_arrow_right.gif differ diff --git a/modules/tntcarrier/relaisColis/img/ui-dialog/6da8d5_7x7_arrow_up.gif b/modules/tntcarrier/relaisColis/img/ui-dialog/6da8d5_7x7_arrow_up.gif new file mode 100644 index 000000000..284bc54b0 Binary files /dev/null and b/modules/tntcarrier/relaisColis/img/ui-dialog/6da8d5_7x7_arrow_up.gif differ diff --git a/modules/tntcarrier/relaisColis/img/ui-dialog/Thumbs.db b/modules/tntcarrier/relaisColis/img/ui-dialog/Thumbs.db new file mode 100644 index 000000000..f95870bdd Binary files /dev/null and b/modules/tntcarrier/relaisColis/img/ui-dialog/Thumbs.db differ diff --git a/modules/tntcarrier/relaisColis/img/ui-dialog/d0e5f5_40x100_textures_02_glass_75.png b/modules/tntcarrier/relaisColis/img/ui-dialog/d0e5f5_40x100_textures_02_glass_75.png new file mode 100644 index 000000000..d4eaa1d6e Binary files /dev/null and b/modules/tntcarrier/relaisColis/img/ui-dialog/d0e5f5_40x100_textures_02_glass_75.png differ diff --git a/modules/tntcarrier/relaisColis/img/ui-dialog/dfeffc_40x100_textures_02_glass_85.png b/modules/tntcarrier/relaisColis/img/ui-dialog/dfeffc_40x100_textures_02_glass_85.png new file mode 100644 index 000000000..17d6b368b Binary files /dev/null and b/modules/tntcarrier/relaisColis/img/ui-dialog/dfeffc_40x100_textures_02_glass_85.png differ diff --git a/modules/tntcarrier/relaisColis/img/ui-dialog/f5f8f9_40x100_textures_06_inset_hard_100.png b/modules/tntcarrier/relaisColis/img/ui-dialog/f5f8f9_40x100_textures_06_inset_hard_100.png new file mode 100644 index 000000000..9b24a0a5f Binary files /dev/null and b/modules/tntcarrier/relaisColis/img/ui-dialog/f5f8f9_40x100_textures_06_inset_hard_100.png differ diff --git a/modules/tntcarrier/relaisColis/img/ui-dialog/f9bd01_11x11_icon_arrows_leftright.gif b/modules/tntcarrier/relaisColis/img/ui-dialog/f9bd01_11x11_icon_arrows_leftright.gif new file mode 100644 index 000000000..06da38391 Binary files /dev/null and b/modules/tntcarrier/relaisColis/img/ui-dialog/f9bd01_11x11_icon_arrows_leftright.gif differ diff --git a/modules/tntcarrier/relaisColis/img/ui-dialog/f9bd01_11x11_icon_arrows_updown.gif b/modules/tntcarrier/relaisColis/img/ui-dialog/f9bd01_11x11_icon_arrows_updown.gif new file mode 100644 index 000000000..457012ffc Binary files /dev/null and b/modules/tntcarrier/relaisColis/img/ui-dialog/f9bd01_11x11_icon_arrows_updown.gif differ diff --git a/modules/tntcarrier/relaisColis/img/ui-dialog/f9bd01_11x11_icon_close.gif b/modules/tntcarrier/relaisColis/img/ui-dialog/f9bd01_11x11_icon_close.gif new file mode 100644 index 000000000..eda2b06e2 Binary files /dev/null and b/modules/tntcarrier/relaisColis/img/ui-dialog/f9bd01_11x11_icon_close.gif differ diff --git a/modules/tntcarrier/relaisColis/img/ui-dialog/f9bd01_11x11_icon_doc.gif b/modules/tntcarrier/relaisColis/img/ui-dialog/f9bd01_11x11_icon_doc.gif new file mode 100644 index 000000000..5b182927c Binary files /dev/null and b/modules/tntcarrier/relaisColis/img/ui-dialog/f9bd01_11x11_icon_doc.gif differ diff --git a/modules/tntcarrier/relaisColis/img/ui-dialog/f9bd01_11x11_icon_folder_closed.gif b/modules/tntcarrier/relaisColis/img/ui-dialog/f9bd01_11x11_icon_folder_closed.gif new file mode 100644 index 000000000..e5228409a Binary files /dev/null and b/modules/tntcarrier/relaisColis/img/ui-dialog/f9bd01_11x11_icon_folder_closed.gif differ diff --git a/modules/tntcarrier/relaisColis/img/ui-dialog/f9bd01_11x11_icon_folder_open.gif b/modules/tntcarrier/relaisColis/img/ui-dialog/f9bd01_11x11_icon_folder_open.gif new file mode 100644 index 000000000..802424348 Binary files /dev/null and b/modules/tntcarrier/relaisColis/img/ui-dialog/f9bd01_11x11_icon_folder_open.gif differ diff --git a/modules/tntcarrier/relaisColis/img/ui-dialog/f9bd01_11x11_icon_minus.gif b/modules/tntcarrier/relaisColis/img/ui-dialog/f9bd01_11x11_icon_minus.gif new file mode 100644 index 000000000..08cbbbb02 Binary files /dev/null and b/modules/tntcarrier/relaisColis/img/ui-dialog/f9bd01_11x11_icon_minus.gif differ diff --git a/modules/tntcarrier/relaisColis/img/ui-dialog/f9bd01_11x11_icon_plus.gif b/modules/tntcarrier/relaisColis/img/ui-dialog/f9bd01_11x11_icon_plus.gif new file mode 100644 index 000000000..95ed13c5b Binary files /dev/null and b/modules/tntcarrier/relaisColis/img/ui-dialog/f9bd01_11x11_icon_plus.gif differ diff --git a/modules/tntcarrier/relaisColis/img/ui-dialog/f9bd01_7x7_arrow_down.gif b/modules/tntcarrier/relaisColis/img/ui-dialog/f9bd01_7x7_arrow_down.gif new file mode 100644 index 000000000..77146b690 Binary files /dev/null and b/modules/tntcarrier/relaisColis/img/ui-dialog/f9bd01_7x7_arrow_down.gif differ diff --git a/modules/tntcarrier/relaisColis/img/ui-dialog/f9bd01_7x7_arrow_left.gif b/modules/tntcarrier/relaisColis/img/ui-dialog/f9bd01_7x7_arrow_left.gif new file mode 100644 index 000000000..6e44126ea Binary files /dev/null and b/modules/tntcarrier/relaisColis/img/ui-dialog/f9bd01_7x7_arrow_left.gif differ diff --git a/modules/tntcarrier/relaisColis/img/ui-dialog/f9bd01_7x7_arrow_right.gif b/modules/tntcarrier/relaisColis/img/ui-dialog/f9bd01_7x7_arrow_right.gif new file mode 100644 index 000000000..8b9bfe44e Binary files /dev/null and b/modules/tntcarrier/relaisColis/img/ui-dialog/f9bd01_7x7_arrow_right.gif differ diff --git a/modules/tntcarrier/relaisColis/img/ui-dialog/f9bd01_7x7_arrow_up.gif b/modules/tntcarrier/relaisColis/img/ui-dialog/f9bd01_7x7_arrow_up.gif new file mode 100644 index 000000000..988dad9bb Binary files /dev/null and b/modules/tntcarrier/relaisColis/img/ui-dialog/f9bd01_7x7_arrow_up.gif differ diff --git a/modules/tntcarrier/relaisColis/img/ui-dialog/fcfdfd_40x100_textures_06_inset_hard_100.png b/modules/tntcarrier/relaisColis/img/ui-dialog/fcfdfd_40x100_textures_06_inset_hard_100.png new file mode 100644 index 000000000..305c0bc49 Binary files /dev/null and b/modules/tntcarrier/relaisColis/img/ui-dialog/fcfdfd_40x100_textures_06_inset_hard_100.png differ diff --git a/modules/tntcarrier/relaisColis/index.php b/modules/tntcarrier/relaisColis/index.php new file mode 100644 index 000000000..477abec6f --- /dev/null +++ b/modules/tntcarrier/relaisColis/index.php @@ -0,0 +1,36 @@ +<?php +/* +* 2007-2011 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA <contact@prestashop.com> +* @copyright 2007-2011 PrestaShop SA +* @version Release: $Revision: 6594 $ +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../../../"); +exit; diff --git a/modules/tntcarrier/relaisColis/js/jquery-ui.js b/modules/tntcarrier/relaisColis/js/jquery-ui.js new file mode 100644 index 000000000..08b44d366 --- /dev/null +++ b/modules/tntcarrier/relaisColis/js/jquery-ui.js @@ -0,0 +1,286 @@ +/* + * jQuery UI 1.6 + * + * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI + */ +(function(C){var I=C.fn.remove,D=C.browser.mozilla&&(parseFloat(C.browser.version)<1.9);C.ui={version:"1.6",plugin:{add:function(K,L,N){var M=C.ui[K].prototype;for(var J in N){M.plugins[J]=M.plugins[J]||[];M.plugins[J].push([L,N[J]])}},call:function(J,L,K){var N=J.plugins[L];if(!N){return }for(var M=0;M<N.length;M++){if(J.options[N[M][0]]){N[M][1].apply(J.element,K)}}}},contains:function(L,K){var J=C.browser.safari&&C.browser.version<522;if(L.contains&&!J){return L.contains(K)}if(L.compareDocumentPosition){return !!(L.compareDocumentPosition(K)&16)}while(K=K.parentNode){if(K==L){return true}}return false},cssCache:{},css:function(J){if(C.ui.cssCache[J]){return C.ui.cssCache[J]}var K=C('<div class="ui-gen">').addClass(J).css({position:"absolute",top:"-5000px",left:"-5000px",display:"block"}).appendTo("body");C.ui.cssCache[J]=!!((!(/auto|default/).test(K.css("cursor"))||(/^[1-9]/).test(K.css("height"))||(/^[1-9]/).test(K.css("width"))||!(/none/).test(K.css("backgroundImage"))||!(/transparent|rgba\(0, 0, 0, 0\)/).test(K.css("backgroundColor"))));try{C("body").get(0).removeChild(K.get(0))}catch(L){}return C.ui.cssCache[J]},hasScroll:function(M,K){if(C(M).css("overflow")=="hidden"){return false}var J=(K&&K=="left")?"scrollLeft":"scrollTop",L=false;if(M[J]>0){return true}M[J]=1;L=(M[J]>0);M[J]=0;return L},isOverAxis:function(K,J,L){return(K>J)&&(K<(J+L))},isOver:function(O,K,N,M,J,L){return C.ui.isOverAxis(O,N,J)&&C.ui.isOverAxis(K,M,L)},keyCode:{BACKSPACE:8,CAPS_LOCK:20,COMMA:188,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38}};if(D){var F=C.attr,E=C.fn.removeAttr,H="http://www.w3.org/2005/07/aaa",A=/^aria-/,B=/^wairole:/;C.attr=function(K,J,L){var M=L!==undefined;return(J=="role"?(M?F.call(this,K,J,"wairole:"+L):(F.apply(this,arguments)||"").replace(B,"")):(A.test(J)?(M?K.setAttributeNS(H,J.replace(A,"aaa:"),L):F.call(this,K,J.replace(A,"aaa:"))):F.apply(this,arguments)))};C.fn.removeAttr=function(J){return(A.test(J)?this.each(function(){this.removeAttributeNS(H,J.replace(A,""))}):E.call(this,J))}}C.fn.extend({remove:function(){C("*",this).add(this).each(function(){C(this).triggerHandler("remove")});return I.apply(this,arguments)},enableSelection:function(){return this.attr("unselectable","off").css("MozUserSelect","").unbind("selectstart.ui")},disableSelection:function(){return this.attr("unselectable","on").css("MozUserSelect","none").bind("selectstart.ui",function(){return false})},scrollParent:function(){var J;if((C.browser.msie&&(/(static|relative)/).test(this.css("position")))||(/absolute/).test(this.css("position"))){J=this.parents().filter(function(){return(/(relative|absolute|fixed)/).test(C.curCSS(this,"position",1))&&(/(auto|scroll)/).test(C.curCSS(this,"overflow",1)+C.curCSS(this,"overflow-y",1)+C.curCSS(this,"overflow-x",1))}).eq(0)}else{J=this.parents().filter(function(){return(/(auto|scroll)/).test(C.curCSS(this,"overflow",1)+C.curCSS(this,"overflow-y",1)+C.curCSS(this,"overflow-x",1))}).eq(0)}return(/fixed/).test(this.css("position"))||!J.length?C(document):J}});C.extend(C.expr[":"],{data:function(K,L,J){return C.data(K,J[3])},tabbable:function(L,M,K){var N=L.nodeName.toLowerCase();function J(O){return !(C(O).is(":hidden")||C(O).parents(":hidden").length)}return(L.tabIndex>=0&&(("a"==N&&L.href)||(/input|select|textarea|button/.test(N)&&"hidden"!=L.type&&!L.disabled))&&J(L))}});function G(M,N,O,L){function K(Q){var P=C[M][N][Q]||[];return(typeof P=="string"?P.split(/,?\s+/):P)}var J=K("getter");if(L.length==1&&typeof L[0]=="string"){J=J.concat(K("getterSetter"))}return(C.inArray(O,J)!=-1)}C.widget=function(K,J){var L=K.split(".")[0];K=K.split(".")[1];C.fn[K]=function(P){var N=(typeof P=="string"),O=Array.prototype.slice.call(arguments,1);if(N&&P.substring(0,1)=="_"){return this}if(N&&G(L,K,P,O)){var M=C.data(this[0],K);return(M?M[P].apply(M,O):undefined)}return this.each(function(){var Q=C.data(this,K);(!Q&&!N&&C.data(this,K,new C[L][K](this,P)));(Q&&N&&C.isFunction(Q[P])&&Q[P].apply(Q,O))})};C[L]=C[L]||{};C[L][K]=function(O,N){var M=this;this.widgetName=K;this.widgetEventPrefix=C[L][K].eventPrefix||K;this.widgetBaseClass=L+"-"+K;this.options=C.extend({},C.widget.defaults,C[L][K].defaults,C.metadata&&C.metadata.get(O)[K],N);this.element=C(O).bind("setData."+K,function(Q,P,R){return M._setData(P,R)}).bind("getData."+K,function(Q,P){return M._getData(P)}).bind("remove",function(){return M.destroy()});this._init()};C[L][K].prototype=C.extend({},C.widget.prototype,J);C[L][K].getterSetter="option"};C.widget.prototype={_init:function(){},destroy:function(){this.element.removeData(this.widgetName)},option:function(L,M){var K=L,J=this;if(typeof L=="string"){if(M===undefined){return this._getData(L)}K={};K[L]=M}C.each(K,function(N,O){J._setData(N,O)})},_getData:function(J){return this.options[J]},_setData:function(J,K){this.options[J]=K;if(J=="disabled"){this.element[K?"addClass":"removeClass"](this.widgetBaseClass+"-disabled")}},enable:function(){this._setData("disabled",false)},disable:function(){this._setData("disabled",true)},_trigger:function(K,L,M){var J=(K==this.widgetEventPrefix?K:this.widgetEventPrefix+K);L=L||C.event.fix({type:J,target:this.element[0]});return this.element.triggerHandler(J,[L,M],this.options[K])}};C.widget.defaults={disabled:false};C.ui.mouse={_mouseInit:function(){var J=this;this.element.bind("mousedown."+this.widgetName,function(K){return J._mouseDown(K)}).bind("click."+this.widgetName,function(K){if(J._preventClickEvent){J._preventClickEvent=false;return false}});if(C.browser.msie){this._mouseUnselectable=this.element.attr("unselectable");this.element.attr("unselectable","on")}this.started=false},_mouseDestroy:function(){this.element.unbind("."+this.widgetName);(C.browser.msie&&this.element.attr("unselectable",this._mouseUnselectable))},_mouseDown:function(L){(this._mouseStarted&&this._mouseUp(L));this._mouseDownEvent=L;var K=this,M=(L.which==1),J=(typeof this.options.cancel=="string"?C(L.target).parents().add(L.target).filter(this.options.cancel).length:false);if(!M||J||!this._mouseCapture(L)){return true}this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){K.mouseDelayMet=true},this.options.delay)}if(this._mouseDistanceMet(L)&&this._mouseDelayMet(L)){this._mouseStarted=(this._mouseStart(L)!==false);if(!this._mouseStarted){L.preventDefault();return true}}this._mouseMoveDelegate=function(N){return K._mouseMove(N)};this._mouseUpDelegate=function(N){return K._mouseUp(N)};C(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);if(!C.browser.safari){L.preventDefault()}return true},_mouseMove:function(J){if(C.browser.msie&&!J.button){return this._mouseUp(J)}if(this._mouseStarted){this._mouseDrag(J);return J.preventDefault()}if(this._mouseDistanceMet(J)&&this._mouseDelayMet(J)){this._mouseStarted=(this._mouseStart(this._mouseDownEvent,J)!==false);(this._mouseStarted?this._mouseDrag(J):this._mouseUp(J))}return !this._mouseStarted},_mouseUp:function(J){C(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;this._preventClickEvent=true;this._mouseStop(J)}return false},_mouseDistanceMet:function(J){return(Math.max(Math.abs(this._mouseDownEvent.pageX-J.pageX),Math.abs(this._mouseDownEvent.pageY-J.pageY))>=this.options.distance)},_mouseDelayMet:function(J){return this.mouseDelayMet},_mouseStart:function(J){},_mouseDrag:function(J){},_mouseStop:function(J){},_mouseCapture:function(J){return true}};C.ui.mouse.defaults={cancel:null,distance:1,delay:0}})(jQuery);/* + * jQuery UI Draggable 1.6 + * + * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Draggables + * + * Depends: + * ui.core.js + */ +(function(A){A.widget("ui.draggable",A.extend({},A.ui.mouse,{_init:function(){if(this.options.helper=="original"&&!(/^(?:r|a|f)/).test(this.element.css("position"))){this.element[0].style.position="relative"}(this.options.cssNamespace&&this.element.addClass(this.options.cssNamespace+"-draggable"));(this.options.disabled&&this.element.addClass("ui-draggable-disabled"));this._mouseInit()},destroy:function(){if(!this.element.data("draggable")){return }this.element.removeData("draggable").unbind(".draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled");this._mouseDestroy()},_mouseCapture:function(B){var C=this.options;if(this.helper||C.disabled||A(B.target).is(".ui-resizable-handle")){return false}this.handle=this._getHandle(B);if(!this.handle){return false}return true},_mouseStart:function(B){var C=this.options;this.helper=this._createHelper(B);this._cacheHelperProportions();if(A.ui.ddmanager){A.ui.ddmanager.current=this}this._cacheMargins();this.cssPosition=this.helper.css("position");this.scrollParent=this.helper.scrollParent();this.offset=this.element.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};A.extend(this.offset,{click:{left:B.pageX-this.offset.left,top:B.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});if(C.cursorAt){this._adjustOffsetFromHelper(C.cursorAt)}this.originalPosition=this._generatePosition(B);if(C.containment){this._setContainment()}this._propagate("start",B);this._cacheHelperProportions();if(A.ui.ddmanager&&!C.dropBehaviour){A.ui.ddmanager.prepareOffsets(this,B)}this.helper.addClass("ui-draggable-dragging");this._mouseDrag(B,true);return true},_mouseDrag:function(B,C){this.position=this._generatePosition(B);this.positionAbs=this._convertPositionTo("absolute");if(!C){this.position=this._propagate("drag",B)||this.position}if(!this.options.axis||this.options.axis!="y"){this.helper[0].style.left=this.position.left+"px"}if(!this.options.axis||this.options.axis!="x"){this.helper[0].style.top=this.position.top+"px"}if(A.ui.ddmanager){A.ui.ddmanager.drag(this,B)}return false},_mouseStop:function(C){var D=false;if(A.ui.ddmanager&&!this.options.dropBehaviour){var D=A.ui.ddmanager.drop(this,C)}if((this.options.revert=="invalid"&&!D)||(this.options.revert=="valid"&&D)||this.options.revert===true||(A.isFunction(this.options.revert)&&this.options.revert.call(this.element,D))){var B=this;A(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){B._propagate("stop",C);B._clear()})}else{this._propagate("stop",C);this._clear()}return false},_getHandle:function(B){var C=!this.options.handle||!A(this.options.handle,this.element).length?true:false;A(this.options.handle,this.element).find("*").andSelf().each(function(){if(this==B.target){C=true}});return C},_createHelper:function(C){var D=this.options;var B=A.isFunction(D.helper)?A(D.helper.apply(this.element[0],[C])):(D.helper=="clone"?this.element.clone():this.element);if(!B.parents("body").length){B.appendTo((D.appendTo=="parent"?this.element[0].parentNode:D.appendTo))}if(B[0]!=this.element[0]&&!(/(fixed|absolute)/).test(B.css("position"))){B.css("position","absolute")}return B},_adjustOffsetFromHelper:function(B){if(B.left!=undefined){this.offset.click.left=B.left+this.margins.left}if(B.right!=undefined){this.offset.click.left=this.helperProportions.width-B.right+this.margins.left}if(B.top!=undefined){this.offset.click.top=B.top+this.margins.top}if(B.bottom!=undefined){this.offset.click.top=this.helperProportions.height-B.bottom+this.margins.top}},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var B=this.offsetParent.offset();if((this.offsetParent[0]==document.body&&A.browser.mozilla)||(this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&A.browser.msie)){B={top:0,left:0}}return{top:B.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:B.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var B=this.element.position();return{top:B.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:B.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}else{return{top:0,left:0}}},_cacheMargins:function(){this.margins={left:(parseInt(this.element.css("marginLeft"),10)||0),top:(parseInt(this.element.css("marginTop"),10)||0)}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var E=this.options;if(E.containment=="parent"){E.containment=this.helper[0].parentNode}if(E.containment=="document"||E.containment=="window"){this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,A(E.containment=="document"?document:window).width()-this.offset.relative.left-this.offset.parent.left-this.helperProportions.width-this.margins.left-(parseInt(this.element.css("marginRight"),10)||0),(A(E.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.offset.relative.top-this.offset.parent.top-this.helperProportions.height-this.margins.top-(parseInt(this.element.css("marginBottom"),10)||0)]}if(!(/^(document|window|parent)$/).test(E.containment)){var C=A(E.containment)[0];var D=A(E.containment).offset();var B=(A(C).css("overflow")!="hidden");this.containment=[D.left+(parseInt(A(C).css("borderLeftWidth"),10)||0)-this.offset.relative.left-this.offset.parent.left-this.margins.left,D.top+(parseInt(A(C).css("borderTopWidth"),10)||0)-this.offset.relative.top-this.offset.parent.top-this.margins.top,D.left+(B?Math.max(C.scrollWidth,C.offsetWidth):C.offsetWidth)-(parseInt(A(C).css("borderLeftWidth"),10)||0)-this.offset.relative.left-this.offset.parent.left-this.helperProportions.width-this.margins.left,D.top+(B?Math.max(C.scrollHeight,C.offsetHeight):C.offsetHeight)-(parseInt(A(C).css("borderTopWidth"),10)||0)-this.offset.relative.top-this.offset.parent.top-this.helperProportions.height-this.margins.top]}},_convertPositionTo:function(D,F){if(!F){F=this.position}var C=D=="absolute"?1:-1;var B=this[(this.cssPosition=="absolute"?"offset":"scroll")+"Parent"],E=(/(html|body)/i).test(B[0].tagName);return{top:(F.top+this.offset.relative.top*C+this.offset.parent.top*C+(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():(E?0:B.scrollTop()))*C+this.margins.top*C),left:(F.left+this.offset.relative.left*C+this.offset.parent.left*C+(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():(E?0:B.scrollLeft()))*C+this.margins.left*C)}},_generatePosition:function(D){var G=this.options,C=this[(this.cssPosition=="absolute"?"offset":"scroll")+"Parent"],H=(/(html|body)/i).test(C[0].tagName);var B={top:(D.pageY-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():(H?0:C.scrollTop()))),left:(D.pageX-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():H?0:C.scrollLeft()))};if(!this.originalPosition){return B}if(this.containment){if(B.left<this.containment[0]){B.left=this.containment[0]}if(B.top<this.containment[1]){B.top=this.containment[1]}if(B.left>this.containment[2]){B.left=this.containment[2]}if(B.top>this.containment[3]){B.top=this.containment[3]}}if(G.grid){var F=this.originalPosition.top+Math.round((B.top-this.originalPosition.top)/G.grid[1])*G.grid[1];B.top=this.containment?(!(F<this.containment[1]||F>this.containment[3])?F:(!(F<this.containment[1])?F-G.grid[1]:F+G.grid[1])):F;var E=this.originalPosition.left+Math.round((B.left-this.originalPosition.left)/G.grid[0])*G.grid[0];B.left=this.containment?(!(E<this.containment[0]||E>this.containment[2])?E:(!(E<this.containment[0])?E-G.grid[0]:E+G.grid[0])):E}return B},_clear:function(){this.helper.removeClass("ui-draggable-dragging");if(this.helper[0]!=this.element[0]&&!this.cancelHelperRemoval){this.helper.remove()}this.helper=null;this.cancelHelperRemoval=false},_propagate:function(C,B){A.ui.plugin.call(this,C,[B,this._uiHash()]);if(C=="drag"){this.positionAbs=this._convertPositionTo("absolute")}return this.element.triggerHandler(C=="drag"?C:"drag"+C,[B,this._uiHash()],this.options[C])},plugins:{},_uiHash:function(B){return{helper:this.helper,position:this.position,absolutePosition:this.positionAbs,options:this.options}}}));A.extend(A.ui.draggable,{version:"1.6",defaults:{appendTo:"parent",axis:false,cancel:":input",connectToSortable:false,containment:false,cssNamespace:"ui",cursor:"default",cursorAt:null,delay:0,distance:1,grid:false,handle:false,helper:"original",iframeFix:false,opacity:1,refreshPositions:false,revert:false,revertDuration:500,scope:"default",scroll:true,scrollSensitivity:20,scrollSpeed:20,snap:false,snapMode:"both",snapTolerance:20,stack:false,zIndex:null}});A.ui.plugin.add("draggable","connectToSortable",{start:function(B,D){var C=A(this).data("draggable");C.sortables=[];A(D.options.connectToSortable).each(function(){A(this+"").each(function(){if(A.data(this,"sortable")){var E=A.data(this,"sortable");C.sortables.push({instance:E,shouldRevert:E.options.revert});E._refreshItems();E._propagate("activate",B,C)}})})},stop:function(B,D){var C=A(this).data("draggable");A.each(C.sortables,function(){if(this.instance.isOver){this.instance.isOver=0;C.cancelHelperRemoval=true;this.instance.cancelHelperRemoval=false;if(this.shouldRevert){this.instance.options.revert=true}this.instance._mouseStop(B);this.instance.element.triggerHandler("sortreceive",[B,A.extend(this.instance._ui(),{sender:C.element})],this.instance.options["receive"]);this.instance.options.helper=this.instance.options._helper;if(C.options.helper=="original"){this.instance.currentItem.css({top:"auto",left:"auto"})}}else{this.instance.cancelHelperRemoval=false;this.instance._propagate("deactivate",B,C)}})},drag:function(C,F){var E=A(this).data("draggable"),B=this;var D=function(I){var N=this.offset.click.top,M=this.offset.click.left;var G=this.positionAbs.top,K=this.positionAbs.left;var J=I.height,L=I.width;var O=I.top,H=I.left;return A.ui.isOver(G+N,K+M,O,H,J,L)};A.each(E.sortables,function(G){if(D.call(E,this.instance.containerCache)){if(!this.instance.isOver){this.instance.isOver=1;this.instance.currentItem=A(B).clone().appendTo(this.instance.element).data("sortable-item",true);this.instance.options._helper=this.instance.options.helper;this.instance.options.helper=function(){return F.helper[0]};C.target=this.instance.currentItem[0];this.instance._mouseCapture(C,true);this.instance._mouseStart(C,true,true);this.instance.offset.click.top=E.offset.click.top;this.instance.offset.click.left=E.offset.click.left;this.instance.offset.parent.left-=E.offset.parent.left-this.instance.offset.parent.left;this.instance.offset.parent.top-=E.offset.parent.top-this.instance.offset.parent.top;E._propagate("toSortable",C)}if(this.instance.currentItem){this.instance._mouseDrag(C)}}else{if(this.instance.isOver){this.instance.isOver=0;this.instance.cancelHelperRemoval=true;this.instance.options.revert=false;this.instance._mouseStop(C,true);this.instance.options.helper=this.instance.options._helper;this.instance.currentItem.remove();if(this.instance.placeholder){this.instance.placeholder.remove()}E._propagate("fromSortable",C)}}})}});A.ui.plugin.add("draggable","cursor",{start:function(C,D){var B=A("body");if(B.css("cursor")){D.options._cursor=B.css("cursor")}B.css("cursor",D.options.cursor)},stop:function(B,C){if(C.options._cursor){A("body").css("cursor",C.options._cursor)}}});A.ui.plugin.add("draggable","iframeFix",{start:function(B,C){A(C.options.iframeFix===true?"iframe":C.options.iframeFix).each(function(){A('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>').css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1000}).css(A(this).offset()).appendTo("body")})},stop:function(B,C){A("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)})}});A.ui.plugin.add("draggable","opacity",{start:function(C,D){var B=A(D.helper);if(B.css("opacity")){D.options._opacity=B.css("opacity")}B.css("opacity",D.options.opacity)},stop:function(B,C){if(C.options._opacity){A(C.helper).css("opacity",C.options._opacity)}}});A.ui.plugin.add("draggable","scroll",{start:function(C,D){var E=D.options;var B=A(this).data("draggable");if(B.scrollParent[0]!=document&&B.scrollParent[0].tagName!="HTML"){B.overflowOffset=B.scrollParent.offset()}},drag:function(D,E){var F=E.options,B=false;var C=A(this).data("draggable");if(C.scrollParent[0]!=document&&C.scrollParent[0].tagName!="HTML"){if((C.overflowOffset.top+C.scrollParent[0].offsetHeight)-D.pageY<F.scrollSensitivity){C.scrollParent[0].scrollTop=B=C.scrollParent[0].scrollTop+F.scrollSpeed}else{if(D.pageY-C.overflowOffset.top<F.scrollSensitivity){C.scrollParent[0].scrollTop=B=C.scrollParent[0].scrollTop-F.scrollSpeed}}if((C.overflowOffset.left+C.scrollParent[0].offsetWidth)-D.pageX<F.scrollSensitivity){C.scrollParent[0].scrollLeft=B=C.scrollParent[0].scrollLeft+F.scrollSpeed}else{if(D.pageX-C.overflowOffset.left<F.scrollSensitivity){C.scrollParent[0].scrollLeft=B=C.scrollParent[0].scrollLeft-F.scrollSpeed}}}else{if(D.pageY-A(document).scrollTop()<F.scrollSensitivity){B=A(document).scrollTop(A(document).scrollTop()-F.scrollSpeed)}else{if(A(window).height()-(D.pageY-A(document).scrollTop())<F.scrollSensitivity){B=A(document).scrollTop(A(document).scrollTop()+F.scrollSpeed)}}if(D.pageX-A(document).scrollLeft()<F.scrollSensitivity){B=A(document).scrollLeft(A(document).scrollLeft()-F.scrollSpeed)}else{if(A(window).width()-(D.pageX-A(document).scrollLeft())<F.scrollSensitivity){B=A(document).scrollLeft(A(document).scrollLeft()+F.scrollSpeed)}}}if(B!==false&&A.ui.ddmanager&&!F.dropBehaviour){A.ui.ddmanager.prepareOffsets(C,D)}if(B!==false&&C.cssPosition=="absolute"&&C.scrollParent[0]!=document&&A.ui.contains(C.scrollParent[0],C.offsetParent[0])){C.offset.parent=C._getParentOffset()}if(B!==false&&C.cssPosition=="relative"&&!(C.scrollParent[0]!=document&&C.scrollParent[0]!=C.offsetParent[0])){C.offset.relative=C._getRelativeOffset()}}});A.ui.plugin.add("draggable","snap",{start:function(B,D){var C=A(this).data("draggable");C.snapElements=[];A(D.options.snap.constructor!=String?(D.options.snap.items||":data(draggable)"):D.options.snap).each(function(){var F=A(this);var E=F.offset();if(this!=C.element[0]){C.snapElements.push({item:this,width:F.outerWidth(),height:F.outerHeight(),top:E.top,left:E.left})}})},drag:function(M,K){var E=A(this).data("draggable");var Q=K.options.snapTolerance;var P=K.absolutePosition.left,O=P+E.helperProportions.width,D=K.absolutePosition.top,C=D+E.helperProportions.height;for(var N=E.snapElements.length-1;N>=0;N--){var L=E.snapElements[N].left,J=L+E.snapElements[N].width,I=E.snapElements[N].top,S=I+E.snapElements[N].height;if(!((L-Q<P&&P<J+Q&&I-Q<D&&D<S+Q)||(L-Q<P&&P<J+Q&&I-Q<C&&C<S+Q)||(L-Q<O&&O<J+Q&&I-Q<D&&D<S+Q)||(L-Q<O&&O<J+Q&&I-Q<C&&C<S+Q))){if(E.snapElements[N].snapping){(E.options.snap.release&&E.options.snap.release.call(E.element,M,A.extend(E._uiHash(),{snapItem:E.snapElements[N].item})))}E.snapElements[N].snapping=false;continue}if(K.options.snapMode!="inner"){var B=Math.abs(I-C)<=Q;var R=Math.abs(S-D)<=Q;var G=Math.abs(L-O)<=Q;var H=Math.abs(J-P)<=Q;if(B){K.position.top=E._convertPositionTo("relative",{top:I-E.helperProportions.height,left:0}).top}if(R){K.position.top=E._convertPositionTo("relative",{top:S,left:0}).top}if(G){K.position.left=E._convertPositionTo("relative",{top:0,left:L-E.helperProportions.width}).left}if(H){K.position.left=E._convertPositionTo("relative",{top:0,left:J}).left}}var F=(B||R||G||H);if(K.options.snapMode!="outer"){var B=Math.abs(I-D)<=Q;var R=Math.abs(S-C)<=Q;var G=Math.abs(L-P)<=Q;var H=Math.abs(J-O)<=Q;if(B){K.position.top=E._convertPositionTo("relative",{top:I,left:0}).top}if(R){K.position.top=E._convertPositionTo("relative",{top:S-E.helperProportions.height,left:0}).top}if(G){K.position.left=E._convertPositionTo("relative",{top:0,left:L}).left}if(H){K.position.left=E._convertPositionTo("relative",{top:0,left:J-E.helperProportions.width}).left}}if(!E.snapElements[N].snapping&&(B||R||G||H||F)){(E.options.snap.snap&&E.options.snap.snap.call(E.element,M,A.extend(E._uiHash(),{snapItem:E.snapElements[N].item})))}E.snapElements[N].snapping=(B||R||G||H||F)}}});A.ui.plugin.add("draggable","stack",{start:function(B,C){var D=A.makeArray(A(C.options.stack.group)).sort(function(F,E){return(parseInt(A(F).css("zIndex"),10)||C.options.stack.min)-(parseInt(A(E).css("zIndex"),10)||C.options.stack.min)});A(D).each(function(E){this.style.zIndex=C.options.stack.min+E});this[0].style.zIndex=C.options.stack.min+D.length}});A.ui.plugin.add("draggable","zIndex",{start:function(C,D){var B=A(D.helper);if(B.css("zIndex")){D.options._zIndex=B.css("zIndex")}B.css("zIndex",D.options.zIndex)},stop:function(B,C){if(C.options._zIndex){A(C.helper).css("zIndex",C.options._zIndex)}}})})(jQuery);/* + * jQuery UI Droppable 1.6 + * + * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Droppables + * + * Depends: + * ui.core.js + * ui.draggable.js + */ +(function(A){A.widget("ui.droppable",{_init:function(){var C=this.options,B=C.accept;this.isover=0;this.isout=1;this.options.accept=this.options.accept&&A.isFunction(this.options.accept)?this.options.accept:function(D){return D.is(B)};this.proportions={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight};A.ui.ddmanager.droppables[this.options.scope]=A.ui.ddmanager.droppables[this.options.scope]||[];A.ui.ddmanager.droppables[this.options.scope].push(this);(this.options.cssNamespace&&this.element.addClass(this.options.cssNamespace+"-droppable"))},destroy:function(){var B=A.ui.ddmanager.droppables[this.options.scope];for(var C=0;C<B.length;C++){if(B[C]==this){B.splice(C,1)}}this.element.removeClass("ui-droppable-disabled").removeData("droppable").unbind(".droppable")},_setData:function(B,C){if(B=="accept"){this.options.accept=C&&A.isFunction(C)?C:function(D){return D.is(accept)}}else{A.widget.prototype._setData.apply(this,arguments)}},_activate:function(C){var B=A.ui.ddmanager.current;A.ui.plugin.call(this,"activate",[C,this.ui(B)]);if(B){this.element.triggerHandler("dropactivate",[C,this.ui(B)],this.options.activate)}},_deactivate:function(C){var B=A.ui.ddmanager.current;A.ui.plugin.call(this,"deactivate",[C,this.ui(B)]);if(B){this.element.triggerHandler("dropdeactivate",[C,this.ui(B)],this.options.deactivate)}},_over:function(C){var B=A.ui.ddmanager.current;if(!B||(B.currentItem||B.element)[0]==this.element[0]){return }if(this.options.accept.call(this.element,(B.currentItem||B.element))){A.ui.plugin.call(this,"over",[C,this.ui(B)]);this.element.triggerHandler("dropover",[C,this.ui(B)],this.options.over)}},_out:function(C){var B=A.ui.ddmanager.current;if(!B||(B.currentItem||B.element)[0]==this.element[0]){return }if(this.options.accept.call(this.element,(B.currentItem||B.element))){A.ui.plugin.call(this,"out",[C,this.ui(B)]);this.element.triggerHandler("dropout",[C,this.ui(B)],this.options.out)}},_drop:function(C,D){var B=D||A.ui.ddmanager.current;if(!B||(B.currentItem||B.element)[0]==this.element[0]){return false}var E=false;this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function(){var F=A.data(this,"droppable");if(F.options.greedy&&A.ui.intersect(B,A.extend(F,{offset:F.element.offset()}),F.options.tolerance)){E=true;return false}});if(E){return false}if(this.options.accept.call(this.element,(B.currentItem||B.element))){A.ui.plugin.call(this,"drop",[C,this.ui(B)]);this.element.triggerHandler("drop",[C,this.ui(B)],this.options.drop);return this.element}return false},plugins:{},ui:function(B){return{draggable:(B.currentItem||B.element),helper:B.helper,position:B.position,absolutePosition:B.positionAbs,options:this.options,element:this.element}}});A.extend(A.ui.droppable,{version:"1.6",defaults:{accept:"*",activeClass:null,cssNamespace:"ui",greedy:false,hoverClass:null,scope:"default",tolerance:"intersect"}});A.ui.intersect=function(O,I,M){if(!I.offset){return false}var D=(O.positionAbs||O.position.absolute).left,C=D+O.helperProportions.width,L=(O.positionAbs||O.position.absolute).top,K=L+O.helperProportions.height;var F=I.offset.left,B=F+I.proportions.width,N=I.offset.top,J=N+I.proportions.height;switch(M){case"fit":return(F<D&&C<B&&N<L&&K<J);break;case"intersect":return(F<D+(O.helperProportions.width/2)&&C-(O.helperProportions.width/2)<B&&N<L+(O.helperProportions.height/2)&&K-(O.helperProportions.height/2)<J);break;case"pointer":var G=((O.positionAbs||O.position.absolute).left+(O.clickOffset||O.offset.click).left),H=((O.positionAbs||O.position.absolute).top+(O.clickOffset||O.offset.click).top),E=A.ui.isOver(H,G,N,F,I.proportions.height,I.proportions.width);return E;break;case"touch":return((L>=N&&L<=J)||(K>=N&&K<=J)||(L<N&&K>J))&&((D>=F&&D<=B)||(C>=F&&C<=B)||(D<F&&C>B));break;default:return false;break}};A.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(E,G){var B=A.ui.ddmanager.droppables[E.options.scope];var F=G?G.type:null;var H=(E.currentItem||E.element).find(":data(droppable)").andSelf();droppablesLoop:for(var D=0;D<B.length;D++){if(B[D].options.disabled||(E&&!B[D].options.accept.call(B[D].element,(E.currentItem||E.element)))){continue}for(var C=0;C<H.length;C++){if(H[C]==B[D].element[0]){B[D].proportions.height=0;continue droppablesLoop}}B[D].visible=B[D].element.css("display")!="none";if(!B[D].visible){continue}B[D].offset=B[D].element.offset();B[D].proportions={width:B[D].element[0].offsetWidth,height:B[D].element[0].offsetHeight};if(F=="dragstart"||F=="sortactivate"){B[D]._activate.call(B[D],G)}}},drop:function(B,C){var D=false;A.each(A.ui.ddmanager.droppables[B.options.scope],function(){if(!this.options){return }if(!this.options.disabled&&this.visible&&A.ui.intersect(B,this,this.options.tolerance)){D=this._drop.call(this,C)}if(!this.options.disabled&&this.visible&&this.options.accept.call(this.element,(B.currentItem||B.element))){this.isout=1;this.isover=0;this._deactivate.call(this,C)}});return D},drag:function(B,C){if(B.options.refreshPositions){A.ui.ddmanager.prepareOffsets(B,C)}A.each(A.ui.ddmanager.droppables[B.options.scope],function(){if(this.options.disabled||this.greedyChild||!this.visible){return }var E=A.ui.intersect(B,this,this.options.tolerance);var G=!E&&this.isover==1?"isout":(E&&this.isover==0?"isover":null);if(!G){return }var F;if(this.options.greedy){var D=this.element.parents(":data(droppable):eq(0)");if(D.length){F=A.data(D[0],"droppable");F.greedyChild=(G=="isover"?1:0)}}if(F&&G=="isover"){F["isover"]=0;F["isout"]=1;F._out.call(F,C)}this[G]=1;this[G=="isout"?"isover":"isout"]=0;this[G=="isover"?"_over":"_out"].call(this,C);if(F&&G=="isout"){F["isout"]=0;F["isover"]=1;F._over.call(F,C)}})}};A.ui.plugin.add("droppable","activeClass",{activate:function(B,C){A(this).addClass(C.options.activeClass)},deactivate:function(B,C){A(this).removeClass(C.options.activeClass)},drop:function(B,C){A(this).removeClass(C.options.activeClass)}});A.ui.plugin.add("droppable","hoverClass",{over:function(B,C){A(this).addClass(C.options.hoverClass)},out:function(B,C){A(this).removeClass(C.options.hoverClass)},drop:function(B,C){A(this).removeClass(C.options.hoverClass)}})})(jQuery);/* + * jQuery UI Resizable 1.6 + * + * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Resizables + * + * Depends: + * ui.core.js + */ +(function(B){B.widget("ui.resizable",B.extend({},B.ui.mouse,{_init:function(){var N=this,O=this.options;var R=this.element.css("position");this.originalElement=this.element;this.element.addClass("ui-resizable").css({position:/static/.test(R)?"relative":R});B.extend(O,{_aspectRatio:!!(O.aspectRatio),helper:O.helper||O.ghost||O.animate?O.helper||"ui-resizable-helper":null,knobHandles:O.knobHandles===true?"ui-resizable-knob-handle":O.knobHandles});var I="1px solid #DEDEDE";O.defaultTheme={"ui-resizable":{display:"block"},"ui-resizable-handle":{position:"absolute",background:"#F2F2F2",fontSize:"0.1px"},"ui-resizable-n":{cursor:"n-resize",height:"4px",left:"0px",right:"0px",borderTop:I},"ui-resizable-s":{cursor:"s-resize",height:"4px",left:"0px",right:"0px",borderBottom:I},"ui-resizable-e":{cursor:"e-resize",width:"4px",top:"0px",bottom:"0px",borderRight:I},"ui-resizable-w":{cursor:"w-resize",width:"4px",top:"0px",bottom:"0px",borderLeft:I},"ui-resizable-se":{cursor:"se-resize",width:"4px",height:"4px",borderRight:I,borderBottom:I},"ui-resizable-sw":{cursor:"sw-resize",width:"4px",height:"4px",borderBottom:I,borderLeft:I},"ui-resizable-ne":{cursor:"ne-resize",width:"4px",height:"4px",borderRight:I,borderTop:I},"ui-resizable-nw":{cursor:"nw-resize",width:"4px",height:"4px",borderLeft:I,borderTop:I}};O.knobTheme={"ui-resizable-handle":{background:"#F2F2F2",border:"1px solid #808080",height:"8px",width:"8px"},"ui-resizable-n":{cursor:"n-resize",top:"0px",left:"45%"},"ui-resizable-s":{cursor:"s-resize",bottom:"0px",left:"45%"},"ui-resizable-e":{cursor:"e-resize",right:"0px",top:"45%"},"ui-resizable-w":{cursor:"w-resize",left:"0px",top:"45%"},"ui-resizable-se":{cursor:"se-resize",right:"0px",bottom:"0px"},"ui-resizable-sw":{cursor:"sw-resize",left:"0px",bottom:"0px"},"ui-resizable-nw":{cursor:"nw-resize",left:"0px",top:"0px"},"ui-resizable-ne":{cursor:"ne-resize",right:"0px",top:"0px"}};O._nodeName=this.element[0].nodeName;if(O._nodeName.match(/canvas|textarea|input|select|button|img/i)){var C=this.element;if(/relative/.test(C.css("position"))&&B.browser.opera){C.css({position:"relative",top:"auto",left:"auto"})}C.wrap(B('<div class="ui-wrapper" style="overflow: hidden;"></div>').css({position:C.css("position"),width:C.outerWidth(),height:C.outerHeight(),top:C.css("top"),left:C.css("left")}));var K=this.element;this.element=this.element.parent();this.element.data("resizable",this);this.element.css({marginLeft:K.css("marginLeft"),marginTop:K.css("marginTop"),marginRight:K.css("marginRight"),marginBottom:K.css("marginBottom")});K.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0});if(B.browser.safari&&O.preventDefault){K.css("resize","none")}O.proportionallyResize=K.css({position:"static",zoom:1,display:"block"});this.element.css({margin:K.css("margin")});this._proportionallyResize()}if(!O.handles){O.handles=!B(".ui-resizable-handle",this.element).length?"e,s,se":{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"}}if(O.handles.constructor==String){O.zIndex=O.zIndex||1000;if(O.handles=="all"){O.handles="n,e,s,w,se,sw,ne,nw"}var P=O.handles.split(",");O.handles={};var H={handle:"position: absolute; display: none; overflow:hidden;",n:"top: 0pt; width:100%;",e:"right: 0pt; height:100%;",s:"bottom: 0pt; width:100%;",w:"left: 0pt; height:100%;",se:"bottom: 0pt; right: 0px;",sw:"bottom: 0pt; left: 0px;",ne:"top: 0pt; right: 0px;",nw:"top: 0pt; left: 0px;"};for(var S=0;S<P.length;S++){var T=B.trim(P[S]),M=O.defaultTheme,G="ui-resizable-"+T,D=!B.ui.css(G)&&!O.knobHandles,Q=B.ui.css("ui-resizable-knob-handle"),U=B.extend(M[G],M["ui-resizable-handle"]),E=B.extend(O.knobTheme[G],!Q?O.knobTheme["ui-resizable-handle"]:{});var L=/sw|se|ne|nw/.test(T)?{zIndex:++O.zIndex}:{};var J=(D?H[T]:""),F=B(['<div class="ui-resizable-handle ',G,'" style="',J,H.handle,'"></div>'].join("")).css(L);O.handles[T]=".ui-resizable-"+T;this.element.append(F.css(D?U:{}).css(O.knobHandles?E:{}).addClass(O.knobHandles?"ui-resizable-knob-handle":"").addClass(O.knobHandles))}if(O.knobHandles){this.element.addClass("ui-resizable-knob").css(!B.ui.css("ui-resizable-knob")?{}:{})}}this._renderAxis=function(Z){Z=Z||this.element;for(var W in O.handles){if(O.handles[W].constructor==String){O.handles[W]=B(O.handles[W],this.element).show()}if(O.transparent){O.handles[W].css({opacity:0})}if(this.element.is(".ui-wrapper")&&O._nodeName.match(/textarea|input|select|button/i)){var X=B(O.handles[W],this.element),Y=0;Y=/sw|ne|nw|se|n|s/.test(W)?X.outerHeight():X.outerWidth();var V=["padding",/ne|nw|n/.test(W)?"Top":/se|sw|s/.test(W)?"Bottom":/^e$/.test(W)?"Right":"Left"].join("");if(!O.transparent){Z.css(V,Y)}this._proportionallyResize()}if(!B(O.handles[W]).length){continue}}};this._renderAxis(this.element);O._handles=B(".ui-resizable-handle",N.element);if(O.disableSelection){O._handles.disableSelection()}O._handles.mouseover(function(){if(!O.resizing){if(this.className){var V=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)}N.axis=O.axis=V&&V[1]?V[1]:"se"}});if(O.autoHide){O._handles.hide();B(N.element).addClass("ui-resizable-autohide").hover(function(){B(this).removeClass("ui-resizable-autohide");O._handles.show()},function(){if(!O.resizing){B(this).addClass("ui-resizable-autohide");O._handles.hide()}})}this._mouseInit()},destroy:function(){var E=this.element,D=E.children(".ui-resizable").get(0);this._mouseDestroy();var C=function(F){B(F).removeClass("ui-resizable ui-resizable-disabled").removeData("resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};C(E);if(E.is(".ui-wrapper")&&D){E.parent().append(B(D).css({position:E.css("position"),width:E.outerWidth(),height:E.outerHeight(),top:E.css("top"),left:E.css("left")})).end().remove();C(D)}},_mouseCapture:function(D){if(this.options.disabled){return false}var E=false;for(var C in this.options.handles){if(B(this.options.handles[C])[0]==D.target){E=true}}if(!E){return false}return true},_mouseStart:function(D){var E=this.options,C=this.element.position(),F=this.element,I=B.browser.msie&&B.browser.version<7;E.resizing=true;E.documentScroll={top:B(document).scrollTop(),left:B(document).scrollLeft()};if(F.is(".ui-draggable")||(/absolute/).test(F.css("position"))){var K=B.browser.msie&&!E.containment&&(/absolute/).test(F.css("position"))&&!(/relative/).test(F.parent().css("position"));var L=K?this.documentScroll.top:0,H=K?this.documentScroll.left:0;F.css({position:"absolute",top:(C.top+L),left:(C.left+H)})}if(B.browser.opera&&(/relative/).test(F.css("position"))){F.css({position:"relative",top:"auto",left:"auto"})}this._renderProxy();var M=A(this.helper.css("left")),G=A(this.helper.css("top"));if(E.containment){M+=B(E.containment).scrollLeft()||0;G+=B(E.containment).scrollTop()||0}this.offset=this.helper.offset();this.position={left:M,top:G};this.size=E.helper||I?{width:F.outerWidth(),height:F.outerHeight()}:{width:F.width(),height:F.height()};this.originalSize=E.helper||I?{width:F.outerWidth(),height:F.outerHeight()}:{width:F.width(),height:F.height()};this.originalPosition={left:M,top:G};this.sizeDiff={width:F.outerWidth()-F.width(),height:F.outerHeight()-F.height()};this.originalMousePosition={left:D.pageX,top:D.pageY};E.aspectRatio=(typeof E.aspectRatio=="number")?E.aspectRatio:((this.originalSize.width/this.originalSize.height)||1);if(E.preserveCursor){var J=B(".ui-resizable-"+this.axis).css("cursor");B("body").css("cursor",J=="auto"?this.axis+"-resize":J)}this._propagate("start",D);return true},_mouseDrag:function(C){var F=this.helper,E=this.options,K={},N=this,H=this.originalMousePosition,L=this.axis;var O=(C.pageX-H.left)||0,M=(C.pageY-H.top)||0;var G=this._change[L];if(!G){return false}var J=G.apply(this,[C,O,M]),I=B.browser.msie&&B.browser.version<7,D=this.sizeDiff;if(E._aspectRatio||C.shiftKey){J=this._updateRatio(J,C)}J=this._respectSize(J,C);this._propagate("resize",C);F.css({top:this.position.top+"px",left:this.position.left+"px",width:this.size.width+"px",height:this.size.height+"px"});if(!E.helper&&E.proportionallyResize){this._proportionallyResize()}this._updateCache(J);this.element.triggerHandler("resize",[C,this.ui()],this.options["resize"]);return false},_mouseStop:function(F){this.options.resizing=false;var G=this.options,K=this;if(G.helper){var E=G.proportionallyResize,C=E&&(/textarea/i).test(E.get(0).nodeName),D=C&&B.ui.hasScroll(E.get(0),"left")?0:K.sizeDiff.height,I=C?0:K.sizeDiff.width;var L={width:(K.size.width-I),height:(K.size.height-D)},H=(parseInt(K.element.css("left"),10)+(K.position.left-K.originalPosition.left))||null,J=(parseInt(K.element.css("top"),10)+(K.position.top-K.originalPosition.top))||null;if(!G.animate){this.element.css(B.extend(L,{top:J,left:H}))}if(G.helper&&!G.animate){this._proportionallyResize()}}if(G.preserveCursor){B("body").css("cursor","auto")}this._propagate("stop",F);if(G.helper){this.helper.remove()}return false},_updateCache:function(C){var D=this.options;this.offset=this.helper.offset();if(C.left){this.position.left=C.left}if(C.top){this.position.top=C.top}if(C.height){this.size.height=C.height}if(C.width){this.size.width=C.width}},_updateRatio:function(F,E){var G=this.options,H=this.position,D=this.size,C=this.axis;if(F.height){F.width=(D.height*G.aspectRatio)}else{if(F.width){F.height=(D.width/G.aspectRatio)}}if(C=="sw"){F.left=H.left+(D.width-F.width);F.top=null}if(C=="nw"){F.top=H.top+(D.height-F.height);F.left=H.left+(D.width-F.width)}return F},_respectSize:function(J,E){var H=this.helper,G=this.options,O=G._aspectRatio||E.shiftKey,N=this.axis,Q=J.width&&G.maxWidth&&G.maxWidth<J.width,K=J.height&&G.maxHeight&&G.maxHeight<J.height,F=J.width&&G.minWidth&&G.minWidth>J.width,P=J.height&&G.minHeight&&G.minHeight>J.height;if(F){J.width=G.minWidth}if(P){J.height=G.minHeight}if(Q){J.width=G.maxWidth}if(K){J.height=G.maxHeight}var D=this.originalPosition.left+this.originalSize.width,M=this.position.top+this.size.height;var I=/sw|nw|w/.test(N),C=/nw|ne|n/.test(N);if(F&&I){J.left=D-G.minWidth}if(Q&&I){J.left=D-G.maxWidth}if(P&&C){J.top=M-G.minHeight}if(K&&C){J.top=M-G.maxHeight}var L=!J.width&&!J.height;if(L&&!J.left&&J.top){J.top=null}else{if(L&&!J.top&&J.left){J.left=null}}return J},_proportionallyResize:function(){var G=this.options;if(!G.proportionallyResize){return }var E=G.proportionallyResize,D=this.helper||this.element;if(!G.borderDif){var C=[E.css("borderTopWidth"),E.css("borderRightWidth"),E.css("borderBottomWidth"),E.css("borderLeftWidth")],F=[E.css("paddingTop"),E.css("paddingRight"),E.css("paddingBottom"),E.css("paddingLeft")];G.borderDif=B.map(C,function(H,J){var I=parseInt(H,10)||0,K=parseInt(F[J],10)||0;return I+K})}E.css({height:(D.height()-G.borderDif[0]-G.borderDif[2])+"px",width:(D.width()-G.borderDif[1]-G.borderDif[3])+"px"})},_renderProxy:function(){var D=this.element,G=this.options;this.elementOffset=D.offset();if(G.helper){this.helper=this.helper||B('<div style="overflow:hidden;"></div>');var C=B.browser.msie&&B.browser.version<7,E=(C?1:0),F=(C?2:-1);this.helper.addClass(G.helper).css({width:D.outerWidth()+F,height:D.outerHeight()+F,position:"absolute",left:this.elementOffset.left-E+"px",top:this.elementOffset.top-E+"px",zIndex:++G.zIndex});this.helper.appendTo("body");if(G.disableSelection){this.helper.disableSelection()}}else{this.helper=D}},_change:{e:function(E,D,C){return{width:this.originalSize.width+D}},w:function(F,D,C){var H=this.options,E=this.originalSize,G=this.originalPosition;return{left:G.left+D,width:E.width-D}},n:function(F,D,C){var H=this.options,E=this.originalSize,G=this.originalPosition;return{top:G.top+C,height:E.height-C}},s:function(E,D,C){return{height:this.originalSize.height+C}},se:function(E,D,C){return B.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[E,D,C]))},sw:function(E,D,C){return B.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[E,D,C]))},ne:function(E,D,C){return B.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[E,D,C]))},nw:function(E,D,C){return B.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[E,D,C]))}},_propagate:function(D,C){B.ui.plugin.call(this,D,[C,this.ui()]);if(D!="resize"){this.element.triggerHandler(["resize",D].join(""),[C,this.ui()],this.options[D])}},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,options:this.options,originalSize:this.originalSize,originalPosition:this.originalPosition}}}));B.extend(B.ui.resizable,{version:"1.6",defaults:{alsoResize:false,animate:false,animateDuration:"slow",animateEasing:"swing",aspectRatio:false,autoHide:false,cancel:":input",containment:false,disableSelection:true,distance:1,delay:0,ghost:false,grid:false,knobHandles:false,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,preserveCursor:true,preventDefault:true,proportionallyResize:false,transparent:false}});B.ui.plugin.add("resizable","alsoResize",{start:function(D,E){var G=E.options,C=B(this).data("resizable"),F=function(H){B(H).each(function(){B(this).data("resizable-alsoresize",{width:parseInt(B(this).width(),10),height:parseInt(B(this).height(),10),left:parseInt(B(this).css("left"),10),top:parseInt(B(this).css("top"),10)})})};if(typeof (G.alsoResize)=="object"&&!G.alsoResize.parentNode){if(G.alsoResize.length){G.alsoResize=G.alsoResize[0];F(G.alsoResize)}else{B.each(G.alsoResize,function(H,I){F(H)})}}else{F(G.alsoResize)}},resize:function(E,G){var H=G.options,D=B(this).data("resizable"),F=D.originalSize,J=D.originalPosition;var I={height:(D.size.height-F.height)||0,width:(D.size.width-F.width)||0,top:(D.position.top-J.top)||0,left:(D.position.left-J.left)||0},C=function(K,L){B(K).each(function(){var O=B(this).data("resizable-alsoresize"),N={},M=L&&L.length?L:["width","height","top","left"];B.each(M||["width","height","top","left"],function(P,R){var Q=(O[R]||0)+(I[R]||0);if(Q&&Q>=0){N[R]=Q||null}});B(this).css(N)})};if(typeof (H.alsoResize)=="object"&&!H.alsoResize.parentNode){B.each(H.alsoResize,function(K,L){C(K,L)})}else{C(H.alsoResize)}},stop:function(C,D){B(this).removeData("resizable-alsoresize-start")}});B.ui.plugin.add("resizable","animate",{stop:function(G,L){var H=L.options,M=B(this).data("resizable");var F=H.proportionallyResize,C=F&&(/textarea/i).test(F.get(0).nodeName),D=C&&B.ui.hasScroll(F.get(0),"left")?0:M.sizeDiff.height,J=C?0:M.sizeDiff.width;var E={width:(M.size.width-J),height:(M.size.height-D)},I=(parseInt(M.element.css("left"),10)+(M.position.left-M.originalPosition.left))||null,K=(parseInt(M.element.css("top"),10)+(M.position.top-M.originalPosition.top))||null;M.element.animate(B.extend(E,K&&I?{top:K,left:I}:{}),{duration:H.animateDuration,easing:H.animateEasing,step:function(){var N={width:parseInt(M.element.css("width"),10),height:parseInt(M.element.css("height"),10),top:parseInt(M.element.css("top"),10),left:parseInt(M.element.css("left"),10)};if(F){F.css({width:N.width,height:N.height})}M._updateCache(N);M._propagate("animate",G)}})}});B.ui.plugin.add("resizable","containment",{start:function(D,N){var H=N.options,P=B(this).data("resizable"),J=P.element;var E=H.containment,I=(E instanceof B)?E.get(0):(/parent/.test(E))?J.parent().get(0):E;if(!I){return }P.containerElement=B(I);if(/document/.test(E)||E==document){P.containerOffset={left:0,top:0};P.containerPosition={left:0,top:0};P.parentData={element:B(document),left:0,top:0,width:B(document).width(),height:B(document).height()||document.body.parentNode.scrollHeight}}else{var L=B(I),G=[];B(["Top","Right","Left","Bottom"]).each(function(R,Q){G[R]=A(L.css("padding"+Q))});P.containerOffset=L.offset();P.containerPosition=L.position();P.containerSize={height:(L.innerHeight()-G[3]),width:(L.innerWidth()-G[1])};var M=P.containerOffset,C=P.containerSize.height,K=P.containerSize.width,F=(B.ui.hasScroll(I,"left")?I.scrollWidth:K),O=(B.ui.hasScroll(I)?I.scrollHeight:C);P.parentData={element:I,left:M.left,top:M.top,width:F,height:O}}},resize:function(E,N){var G=N.options,Q=B(this).data("resizable"),D=Q.containerSize,M=Q.containerOffset,K=Q.size,L=Q.position,O=G._aspectRatio||E.shiftKey,C={top:0,left:0},F=Q.containerElement;if(F[0]!=document&&(/static/).test(F.css("position"))){C=M}if(L.left<(G.helper?M.left:0)){Q.size.width=Q.size.width+(G.helper?(Q.position.left-M.left):(Q.position.left-C.left));if(O){Q.size.height=Q.size.width/G.aspectRatio}Q.position.left=G.helper?M.left:0}if(L.top<(G.helper?M.top:0)){Q.size.height=Q.size.height+(G.helper?(Q.position.top-M.top):Q.position.top);if(O){Q.size.width=Q.size.height*G.aspectRatio}Q.position.top=G.helper?M.top:0}Q.offset.left=Q.parentData.left+Q.position.left;Q.offset.top=Q.parentData.top+Q.position.top;var J=Math.abs((G.helper?Q.offset.left-C.left:(Q.offset.left-C.left))+Q.sizeDiff.width),P=Math.abs((G.helper?Q.offset.top-C.top:(Q.offset.top-M.top))+Q.sizeDiff.height);var I=Q.containerElement.get(0)==Q.element.parent().get(0),H=/relative|absolute/.test(Q.containerElement.css("position"));if(I&&H){J-=Q.parentData.left}if(J+Q.size.width>=Q.parentData.width){Q.size.width=Q.parentData.width-J;if(O){Q.size.height=Q.size.width/G.aspectRatio}}if(P+Q.size.height>=Q.parentData.height){Q.size.height=Q.parentData.height-P;if(O){Q.size.width=Q.size.height*G.aspectRatio}}},stop:function(D,K){var E=K.options,M=B(this).data("resizable"),I=M.position,J=M.containerOffset,C=M.containerPosition,F=M.containerElement;var G=B(M.helper),N=G.offset(),L=G.outerWidth()-M.sizeDiff.width,H=G.outerHeight()-M.sizeDiff.height;if(E.helper&&!E.animate&&(/relative/).test(F.css("position"))){B(this).css({left:N.left-C.left-J.left,width:L,height:H})}if(E.helper&&!E.animate&&(/static/).test(F.css("position"))){B(this).css({left:N.left-C.left-J.left,width:L,height:H})}}});B.ui.plugin.add("resizable","ghost",{start:function(E,F){var G=F.options,C=B(this).data("resizable"),H=G.proportionallyResize,D=C.size;if(!H){C.ghost=C.element.clone()}else{C.ghost=H.clone()}C.ghost.css({opacity:0.25,display:"block",position:"relative",height:D.height,width:D.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass(typeof G.ghost=="string"?G.ghost:"");C.ghost.appendTo(C.helper)},resize:function(D,E){var F=E.options,C=B(this).data("resizable"),G=F.proportionallyResize;if(C.ghost){C.ghost.css({position:"relative",height:C.size.height,width:C.size.width})}},stop:function(D,E){var F=E.options,C=B(this).data("resizable"),G=F.proportionallyResize;if(C.ghost&&C.helper){C.helper.get(0).removeChild(C.ghost.get(0))}}});B.ui.plugin.add("resizable","grid",{resize:function(C,K){var F=K.options,M=B(this).data("resizable"),I=M.size,G=M.originalSize,H=M.originalPosition,L=M.axis,J=F._aspectRatio||C.shiftKey;F.grid=typeof F.grid=="number"?[F.grid,F.grid]:F.grid;var E=Math.round((I.width-G.width)/(F.grid[0]||1))*(F.grid[0]||1),D=Math.round((I.height-G.height)/(F.grid[1]||1))*(F.grid[1]||1);if(/^(se|s|e)$/.test(L)){M.size.width=G.width+E;M.size.height=G.height+D}else{if(/^(ne)$/.test(L)){M.size.width=G.width+E;M.size.height=G.height+D;M.position.top=H.top-D}else{if(/^(sw)$/.test(L)){M.size.width=G.width+E;M.size.height=G.height+D;M.position.left=H.left-E}else{M.size.width=G.width+E;M.size.height=G.height+D;M.position.top=H.top-D;M.position.left=H.left-E}}}}});var A=function(C){return parseInt(C,10)||0}})(jQuery);/* + * jQuery UI Selectable 1.6 + * + * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Selectables + * + * Depends: + * ui.core.js + */ +(function(A){A.widget("ui.selectable",A.extend({},A.ui.mouse,{_init:function(){var B=this;this.element.addClass("ui-selectable");this.dragged=false;var C;this.refresh=function(){C=A(B.options.filter,B.element[0]);C.each(function(){var D=A(this);var E=D.offset();A.data(this,"selectable-item",{element:this,$element:D,left:E.left,top:E.top,right:E.left+D.width(),bottom:E.top+D.height(),startselected:false,selected:D.hasClass("ui-selected"),selecting:D.hasClass("ui-selecting"),unselecting:D.hasClass("ui-unselecting")})})};this.refresh();this.selectees=C.addClass("ui-selectee");this._mouseInit();this.helper=A(document.createElement("div")).css({border:"1px dotted black"}).addClass("ui-selectable-helper")},destroy:function(){this.element.removeClass("ui-selectable ui-selectable-disabled").removeData("selectable").unbind(".selectable");this._mouseDestroy()},_mouseStart:function(E){var C=this;this.opos=[E.pageX,E.pageY];if(this.options.disabled){return }var D=this.options;this.selectees=A(D.filter,this.element[0]);this.element.triggerHandler("selectablestart",[E,{"selectable":this.element[0],"options":D}],D.start);A("body").append(this.helper);this.helper.css({"z-index":100,"position":"absolute","left":E.clientX,"top":E.clientY,"width":0,"height":0});if(D.autoRefresh){this.refresh()}this.selectees.filter(".ui-selected").each(function(){var F=A.data(this,"selectable-item");F.startselected=true;if(!E.metaKey){F.$element.removeClass("ui-selected");F.selected=false;F.$element.addClass("ui-unselecting");F.unselecting=true;C.element.triggerHandler("selectableunselecting",[E,{selectable:C.element[0],unselecting:F.element,options:D}],D.unselecting)}});var B=false;A(E.target).parents().andSelf().each(function(){if(A.data(this,"selectable-item")){B=true}});return this.options.keyboard?!B:true},_mouseDrag:function(I){var C=this;this.dragged=true;if(this.options.disabled){return }var E=this.options;var D=this.opos[0],H=this.opos[1],B=I.pageX,G=I.pageY;if(D>B){var F=B;B=D;D=F}if(H>G){var F=G;G=H;H=F}this.helper.css({left:D,top:H,width:B-D,height:G-H});this.selectees.each(function(){var J=A.data(this,"selectable-item");if(!J||J.element==C.element[0]){return }var K=false;if(E.tolerance=="touch"){K=(!(J.left>B||J.right<D||J.top>G||J.bottom<H))}else{if(E.tolerance=="fit"){K=(J.left>D&&J.right<B&&J.top>H&&J.bottom<G)}}if(K){if(J.selected){J.$element.removeClass("ui-selected");J.selected=false}if(J.unselecting){J.$element.removeClass("ui-unselecting");J.unselecting=false}if(!J.selecting){J.$element.addClass("ui-selecting");J.selecting=true;C.element.triggerHandler("selectableselecting",[I,{selectable:C.element[0],selecting:J.element,options:E}],E.selecting)}}else{if(J.selecting){if(I.metaKey&&J.startselected){J.$element.removeClass("ui-selecting");J.selecting=false;J.$element.addClass("ui-selected");J.selected=true}else{J.$element.removeClass("ui-selecting");J.selecting=false;if(J.startselected){J.$element.addClass("ui-unselecting");J.unselecting=true}C.element.triggerHandler("selectableunselecting",[I,{selectable:C.element[0],unselecting:J.element,options:E}],E.unselecting)}}if(J.selected){if(!I.metaKey&&!J.startselected){J.$element.removeClass("ui-selected");J.selected=false;J.$element.addClass("ui-unselecting");J.unselecting=true;C.element.triggerHandler("selectableunselecting",[I,{selectable:C.element[0],unselecting:J.element,options:E}],E.unselecting)}}}});return false},_mouseStop:function(D){var B=this;this.dragged=false;var C=this.options;A(".ui-unselecting",this.element[0]).each(function(){var E=A.data(this,"selectable-item");E.$element.removeClass("ui-unselecting");E.unselecting=false;E.startselected=false;B.element.triggerHandler("selectableunselected",[D,{selectable:B.element[0],unselected:E.element,options:C}],C.unselected)});A(".ui-selecting",this.element[0]).each(function(){var E=A.data(this,"selectable-item");E.$element.removeClass("ui-selecting").addClass("ui-selected");E.selecting=false;E.selected=true;E.startselected=true;B.element.triggerHandler("selectableselected",[D,{selectable:B.element[0],selected:E.element,options:C}],C.selected)});this.element.triggerHandler("selectablestop",[D,{selectable:B.element[0],options:this.options}],this.options.stop);this.helper.remove();return false}}));A.extend(A.ui.selectable,{version:"1.6",defaults:{appendTo:"body",autoRefresh:true,cancel:":input",delay:0,distance:1,filter:"*",tolerance:"touch"}})})(jQuery);/* + * jQuery UI Sortable 1.6 + * + * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Sortables + * + * Depends: + * ui.core.js + */ +(function(A){A.widget("ui.sortable",A.extend({},A.ui.mouse,{_init:function(){var B=this.options;this.containerCache={};this.element.addClass("ui-sortable");this.refresh();this.floating=this.items.length?(/left|right/).test(this.items[0].item.css("float")):false;this.offset=this.element.offset();this._mouseInit()},destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled").removeData("sortable").unbind(".sortable");this._mouseDestroy();for(var B=this.items.length-1;B>=0;B--){this.items[B].item.removeData("sortable-item")}},_mouseCapture:function(E,F){if(this.reverting){return false}if(this.options.disabled||this.options.type=="static"){return false}this._refreshItems(E);var D=null,C=this,B=A(E.target).parents().each(function(){if(A.data(this,"sortable-item")==C){D=A(this);return false}});if(A.data(E.target,"sortable-item")==C){D=A(E.target)}if(!D){return false}if(this.options.handle&&!F){var G=false;A(this.options.handle,D).find("*").andSelf().each(function(){if(this==E.target){G=true}});if(!G){return false}}this.currentItem=D;this._removeCurrentsFromItems();return true},_mouseStart:function(D,E,B){var F=this.options;this.currentContainer=this;this.refreshPositions();this.helper=this._createHelper(D);this._cacheHelperProportions();this._cacheMargins();this.scrollParent=this.helper.scrollParent();this.offset=this.currentItem.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};this.helper.css("position","absolute");this.cssPosition=this.helper.css("position");A.extend(this.offset,{click:{left:D.pageX-this.offset.left,top:D.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});if(F.cursorAt){this._adjustOffsetFromHelper(F.cursorAt)}this.originalPosition=this._generatePosition(D);this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]};if(this.helper[0]!=this.currentItem[0]){this.currentItem.hide()}this._createPlaceholder();if(F.containment){this._setContainment()}this._propagate("start",D);if(!this._preserveHelperProportions){this._cacheHelperProportions()}if(!B){for(var C=this.containers.length-1;C>=0;C--){this.containers[C]._propagate("activate",D,this)}}if(A.ui.ddmanager){A.ui.ddmanager.current=this}if(A.ui.ddmanager&&!F.dropBehaviour){A.ui.ddmanager.prepareOffsets(this,D)}this.dragging=true;this.helper.addClass("ui-sortable-helper");this._mouseDrag(D);return true},_mouseDrag:function(E){this.position=this._generatePosition(E);this.positionAbs=this._convertPositionTo("absolute");if(!this.lastPositionAbs){this.lastPositionAbs=this.positionAbs}A.ui.plugin.call(this,"sort",[E,this._ui()]);this.positionAbs=this._convertPositionTo("absolute");if(!this.options.axis||this.options.axis!="y"){this.helper[0].style.left=this.position.left+"px"}if(!this.options.axis||this.options.axis!="x"){this.helper[0].style.top=this.position.top+"px"}for(var C=this.items.length-1;C>=0;C--){var D=this.items[C],B=D.item[0],F=this._intersectsWithPointer(D);if(!F){continue}if(B!=this.currentItem[0]&&this.placeholder[F==1?"next":"prev"]()[0]!=B&&!A.ui.contains(this.placeholder[0],B)&&(this.options.type=="semi-dynamic"?!A.ui.contains(this.element[0],B):true)){this.direction=F==1?"down":"up";if(this.options.tolerance=="pointer"||this._intersectsWithSides(D)){this.options.sortIndicator.call(this,E,D)}else{break}this._propagate("change",E);break}}this._contactContainers(E);if(A.ui.ddmanager){A.ui.ddmanager.drag(this,E)}this._trigger("sort",E,this._ui());this.lastPositionAbs=this.positionAbs;return false},_mouseStop:function(C,D){if(!C){return }if(A.ui.ddmanager&&!this.options.dropBehaviour){A.ui.ddmanager.drop(this,C)}if(this.options.revert){var B=this;var E=B.placeholder.offset();B.reverting=true;A(this.helper).animate({left:E.left-this.offset.parent.left-B.margins.left+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollLeft),top:E.top-this.offset.parent.top-B.margins.top+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollTop)},parseInt(this.options.revert,10)||500,function(){B._clear(C)})}else{this._clear(C,D)}return false},cancel:function(){if(this.dragging){this._mouseUp();if(this.options.helper=="original"){this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else{this.currentItem.show()}for(var B=this.containers.length-1;B>=0;B--){this.containers[B]._propagate("deactivate",null,this);if(this.containers[B].containerCache.over){this.containers[B]._propagate("out",null,this);this.containers[B].containerCache.over=0}}}if(this.placeholder[0].parentNode){this.placeholder[0].parentNode.removeChild(this.placeholder[0])}if(this.options.helper!="original"&&this.helper&&this.helper[0].parentNode){this.helper.remove()}A.extend(this,{helper:null,dragging:false,reverting:false,_noFinalSort:null});if(this.domPosition.prev){A(this.domPosition.prev).after(this.currentItem)}else{A(this.domPosition.parent).prepend(this.currentItem)}return true},serialize:function(D){var B=this._getItemsAsjQuery(D&&D.connected);var C=[];D=D||{};A(B).each(function(){var E=(A(D.item||this).attr(D.attribute||"id")||"").match(D.expression||(/(.+)[-=_](.+)/));if(E){C.push((D.key||E[1]+"[]")+"="+(D.key&&D.expression?E[1]:E[2]))}});return C.join("&")},toArray:function(D){var B=this._getItemsAsjQuery(D&&D.connected);var C=[];D=D||{};B.each(function(){C.push(A(D.item||this).attr(D.attribute||"id")||"")});return C},_intersectsWith:function(K){var D=this.positionAbs.left,C=D+this.helperProportions.width,J=this.positionAbs.top,I=J+this.helperProportions.height;var E=K.left,B=E+K.width,L=K.top,H=L+K.height;var M=this.offset.click.top,G=this.offset.click.left;var F=(J+M)>L&&(J+M)<H&&(D+G)>E&&(D+G)<B;if(this.options.tolerance=="pointer"||this.options.forcePointerForContainers||(this.options.tolerance!="pointer"&&this.helperProportions[this.floating?"width":"height"]>K[this.floating?"width":"height"])){return F}else{return(E<D+(this.helperProportions.width/2)&&C-(this.helperProportions.width/2)<B&&L<J+(this.helperProportions.height/2)&&I-(this.helperProportions.height/2)<H)}},_intersectsWithPointer:function(D){var E=A.ui.isOverAxis(this.positionAbs.top+this.offset.click.top,D.top,D.height),C=A.ui.isOverAxis(this.positionAbs.left+this.offset.click.left,D.left,D.width),G=E&&C,B=this._getDragVerticalDirection(),F=this._getDragHorizontalDirection();if(!G){return false}return this.floating?(((F&&F=="right")||B=="down")?2:1):(B&&(B=="down"?2:1))},_intersectsWithSides:function(E){var C=A.ui.isOverAxis(this.positionAbs.top+this.offset.click.top,E.top+(E.height/2),E.height),D=A.ui.isOverAxis(this.positionAbs.left+this.offset.click.left,E.left+(E.width/2),E.width),B=this._getDragVerticalDirection(),F=this._getDragHorizontalDirection();if(this.floating&&F){return((F=="right"&&D)||(F=="left"&&!D))}else{return B&&((B=="down"&&C)||(B=="up"&&!C))}},_getDragVerticalDirection:function(){var B=this.positionAbs.top-this.lastPositionAbs.top;return B!=0&&(B>0?"down":"up")},_getDragHorizontalDirection:function(){var B=this.positionAbs.left-this.lastPositionAbs.left;return B!=0&&(B>0?"right":"left")},refresh:function(B){this._refreshItems(B);this.refreshPositions()},_getItemsAsjQuery:function(G){var C=this;var B=[];var E=[];if(this.options.connectWith&&G){for(var F=this.options.connectWith.length-1;F>=0;F--){var I=A(this.options.connectWith[F]);for(var D=I.length-1;D>=0;D--){var H=A.data(I[D],"sortable");if(H&&H!=this&&!H.options.disabled){E.push([A.isFunction(H.options.items)?H.options.items.call(H.element):A(H.options.items,H.element).not(".ui-sortable-helper"),H])}}}}E.push([A.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):A(this.options.items,this.element).not(".ui-sortable-helper"),this]);for(var F=E.length-1;F>=0;F--){E[F][0].each(function(){B.push(this)})}return A(B)},_removeCurrentsFromItems:function(){var D=this.currentItem.find(":data(sortable-item)");for(var C=0;C<this.items.length;C++){for(var B=0;B<D.length;B++){if(D[B]==this.items[C].item[0]){this.items.splice(C,1)}}}},_refreshItems:function(B){this.items=[];this.containers=[this];var H=this.items;var M=this;var F=[[A.isFunction(this.options.items)?this.options.items.call(this.element[0],B,{item:this.currentItem}):A(this.options.items,this.element),this]];if(this.options.connectWith){for(var E=this.options.connectWith.length-1;E>=0;E--){var J=A(this.options.connectWith[E]);for(var D=J.length-1;D>=0;D--){var G=A.data(J[D],"sortable");if(G&&G!=this&&!G.options.disabled){F.push([A.isFunction(G.options.items)?G.options.items.call(G.element[0],B,{item:this.currentItem}):A(G.options.items,G.element),G]);this.containers.push(G)}}}}for(var E=F.length-1;E>=0;E--){var I=F[E][1];var C=F[E][0];for(var D=0,K=C.length;D<K;D++){var L=A(C[D]);L.data("sortable-item",I);H.push({item:L,instance:I,width:0,height:0,left:0,top:0})}}},refreshPositions:function(B){if(this.offsetParent&&this.helper){this.offset.parent=this._getParentOffset()}for(var D=this.items.length-1;D>=0;D--){var E=this.items[D];if(E.instance!=this.currentContainer&&this.currentContainer&&E.item[0]!=this.currentItem[0]){continue}var C=this.options.toleranceElement?A(this.options.toleranceElement,E.item):E.item;if(!B){if(this.options.accurateIntersection){E.width=C.outerWidth();E.height=C.outerHeight()}else{E.width=C[0].offsetWidth;E.height=C[0].offsetHeight}}var F=C.offset();E.left=F.left;E.top=F.top}if(this.options.custom&&this.options.custom.refreshContainers){this.options.custom.refreshContainers.call(this)}else{for(var D=this.containers.length-1;D>=0;D--){var F=this.containers[D].element.offset();this.containers[D].containerCache.left=F.left;this.containers[D].containerCache.top=F.top;this.containers[D].containerCache.width=this.containers[D].element.outerWidth();this.containers[D].containerCache.height=this.containers[D].element.outerHeight()}}},_createPlaceholder:function(D){var B=D||this,E=B.options;if(!E.placeholder||E.placeholder.constructor==String){var C=E.placeholder;E.placeholder={element:function(){var F=A(document.createElement(B.currentItem[0].nodeName)).addClass(C||B.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper")[0];if(!C){F.style.visibility="hidden";document.body.appendChild(F);F.innerHTML=B.currentItem[0].innerHTML.replace(/name\=\"[^\"\']+\"/g,"").replace(/jQuery[0-9]+\=\"[^\"\']+\"/g,"");document.body.removeChild(F)}return F},update:function(F,G){if(C&&!E.forcePlaceholderSize){return }if(!G.height()){G.height(B.currentItem.innerHeight()-parseInt(B.currentItem.css("paddingTop")||0,10)-parseInt(B.currentItem.css("paddingBottom")||0,10))}if(!G.width()){G.width(B.currentItem.innerWidth()-parseInt(B.currentItem.css("paddingLeft")||0,10)-parseInt(B.currentItem.css("paddingRight")||0,10))}}}}B.placeholder=A(E.placeholder.element.call(B.element,B.currentItem));B.currentItem.after(B.placeholder);E.placeholder.update(B,B.placeholder)},_contactContainers:function(D){for(var C=this.containers.length-1;C>=0;C--){if(this._intersectsWith(this.containers[C].containerCache)){if(!this.containers[C].containerCache.over){if(this.currentContainer!=this.containers[C]){var H=10000;var G=null;var E=this.positionAbs[this.containers[C].floating?"left":"top"];for(var B=this.items.length-1;B>=0;B--){if(!A.ui.contains(this.containers[C].element[0],this.items[B].item[0])){continue}var F=this.items[B][this.containers[C].floating?"left":"top"];if(Math.abs(F-E)<H){H=Math.abs(F-E);G=this.items[B]}}if(!G&&!this.options.dropOnEmpty){continue}this.currentContainer=this.containers[C];G?this.options.sortIndicator.call(this,D,G,null,true):this.options.sortIndicator.call(this,D,null,this.containers[C].element,true);this._propagate("change",D);this.containers[C]._propagate("change",D,this);this.options.placeholder.update(this.currentContainer,this.placeholder)}this.containers[C]._propagate("over",D,this);this.containers[C].containerCache.over=1}}else{if(this.containers[C].containerCache.over){this.containers[C]._propagate("out",D,this);this.containers[C].containerCache.over=0}}}},_createHelper:function(C){var D=this.options;var B=A.isFunction(D.helper)?A(D.helper.apply(this.element[0],[C,this.currentItem])):(D.helper=="clone"?this.currentItem.clone():this.currentItem);if(!B.parents("body").length){A(D.appendTo!="parent"?D.appendTo:this.currentItem[0].parentNode)[0].appendChild(B[0])}if(B[0]==this.currentItem[0]){this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")}}if(B[0].style.width==""||D.forceHelperSize){B.width(this.currentItem.width())}if(B[0].style.height==""||D.forceHelperSize){B.height(this.currentItem.height())}return B},_adjustOffsetFromHelper:function(B){if(B.left!=undefined){this.offset.click.left=B.left+this.margins.left}if(B.right!=undefined){this.offset.click.left=this.helperProportions.width-B.right+this.margins.left}if(B.top!=undefined){this.offset.click.top=B.top+this.margins.top}if(B.bottom!=undefined){this.offset.click.top=this.helperProportions.height-B.bottom+this.margins.top}},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var B=this.offsetParent.offset();if((this.offsetParent[0]==document.body&&A.browser.mozilla)||(this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&A.browser.msie)){B={top:0,left:0}}return{top:B.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:B.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var B=this.currentItem.position();return{top:B.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:B.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}else{return{top:0,left:0}}},_cacheMargins:function(){this.margins={left:(parseInt(this.currentItem.css("marginLeft"),10)||0),top:(parseInt(this.currentItem.css("marginTop"),10)||0)}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var E=this.options;if(E.containment=="parent"){E.containment=this.helper[0].parentNode}if(E.containment=="document"||E.containment=="window"){this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,A(E.containment=="document"?document:window).width()-this.offset.relative.left-this.offset.parent.left-this.margins.left-(parseInt(this.currentItem.css("marginRight"),10)||0),(A(E.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.offset.relative.top-this.offset.parent.top-this.margins.top-(parseInt(this.currentItem.css("marginBottom"),10)||0)]}if(!(/^(document|window|parent)$/).test(E.containment)){var C=A(E.containment)[0];var D=A(E.containment).offset();var B=(A(C).css("overflow")!="hidden");this.containment=[D.left+(parseInt(A(C).css("borderLeftWidth"),10)||0)-this.offset.relative.left-this.offset.parent.left-this.margins.left,D.top+(parseInt(A(C).css("borderTopWidth"),10)||0)-this.offset.relative.top-this.offset.parent.top-this.margins.top,D.left+(B?Math.max(C.scrollWidth,C.offsetWidth):C.offsetWidth)-(parseInt(A(C).css("borderLeftWidth"),10)||0)-this.offset.relative.left-this.offset.parent.left-this.margins.left,D.top+(B?Math.max(C.scrollHeight,C.offsetHeight):C.offsetHeight)-(parseInt(A(C).css("borderTopWidth"),10)||0)-this.offset.relative.top-this.offset.parent.top-this.margins.top]}},_convertPositionTo:function(D,F){if(!F){F=this.position}var C=D=="absolute"?1:-1;var B=this[(this.cssPosition=="absolute"?"offset":"scroll")+"Parent"],E=(/(html|body)/i).test(B[0].tagName);return{top:(F.top+this.offset.relative.top*C+this.offset.parent.top*C+(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():(E?0:B.scrollTop()))*C+this.margins.top*C),left:(F.left+this.offset.relative.left*C+this.offset.parent.left*C+(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():(E?0:B.scrollLeft()))*C+this.margins.left*C)}},_generatePosition:function(D){var G=this.options,C=this[(this.cssPosition=="absolute"?"offset":"scroll")+"Parent"],H=(/(html|body)/i).test(C[0].tagName);var B={top:(D.pageY-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():(H?0:C.scrollTop()))),left:(D.pageX-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():(H?0:C.scrollLeft())))};if(!this.originalPosition){return B}if(this.containment){if(B.left<this.containment[0]){B.left=this.containment[0]}if(B.top<this.containment[1]){B.top=this.containment[1]}if(B.left+this.helperProportions.width>this.containment[2]){B.left=this.containment[2]-this.helperProportions.width}if(B.top+this.helperProportions.height>this.containment[3]){B.top=this.containment[3]-this.helperProportions.height}}if(G.grid){var F=this.originalPosition.top+Math.round((B.top-this.originalPosition.top)/G.grid[1])*G.grid[1];B.top=this.containment?(!(F<this.containment[1]||F>this.containment[3])?F:(!(F<this.containment[1])?F-G.grid[1]:F+G.grid[1])):F;var E=this.originalPosition.left+Math.round((B.left-this.originalPosition.left)/G.grid[0])*G.grid[0];B.left=this.containment?(!(E<this.containment[0]||E>this.containment[2])?E:(!(E<this.containment[0])?E-G.grid[0]:E+G.grid[0])):E}return B},_rearrange:function(G,F,C,E){C?C[0].appendChild(this.placeholder[0]):F.item[0].parentNode.insertBefore(this.placeholder[0],(this.direction=="down"?F.item[0]:F.item[0].nextSibling));this.counter=this.counter?++this.counter:1;var D=this,B=this.counter;window.setTimeout(function(){if(B==D.counter){D.refreshPositions(!E)}},0)},_clear:function(C,D){this.reverting=false;if(!this._noFinalSort){this.placeholder.before(this.currentItem)}this._noFinalSort=null;if(this.helper[0]==this.currentItem[0]){for(var B in this._storedCSS){if(this._storedCSS[B]=="auto"||this._storedCSS[B]=="static"){this._storedCSS[B]=""}}this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else{this.currentItem.show()}if(this.domPosition.prev!=this.currentItem.prev().not(".ui-sortable-helper")[0]||this.domPosition.parent!=this.currentItem.parent()[0]){this._propagate("update",C,null,D)}if(!A.ui.contains(this.element[0],this.currentItem[0])){this._propagate("remove",C,null,D);for(var B=this.containers.length-1;B>=0;B--){if(A.ui.contains(this.containers[B].element[0],this.currentItem[0])){this.containers[B]._propagate("update",C,this,D);this.containers[B]._propagate("receive",C,this,D)}}}for(var B=this.containers.length-1;B>=0;B--){this.containers[B]._propagate("deactivate",C,this,D);if(this.containers[B].containerCache.over){this.containers[B]._propagate("out",C,this);this.containers[B].containerCache.over=0}}this.dragging=false;if(this.cancelHelperRemoval){this._propagate("beforeStop",C,null,D);this._propagate("stop",C,null,D);return false}this._propagate("beforeStop",C,null,D);this.placeholder[0].parentNode.removeChild(this.placeholder[0]);if(this.options.helper!="original"){this.helper.remove()}this.helper=null;this._propagate("stop",C,null,D);return true},_propagate:function(F,B,C,D){A.ui.plugin.call(this,F,[B,this._ui(C)]);var E=!D?this.element.triggerHandler(F=="sort"?F:"sort"+F,[B,this._ui(C)],this.options[F]):true;if(E===false){this.cancel()}},plugins:{},_ui:function(C){var B=C||this;return{helper:B.helper,placeholder:B.placeholder||A([]),position:B.position,absolutePosition:B.positionAbs,item:B.currentItem,sender:C?C.element:null}}}));A.extend(A.ui.sortable,{getter:"serialize toArray",version:"1.6",defaults:{accurateIntersection:true,appendTo:"parent",cancel:":input",delay:0,distance:1,dropOnEmpty:true,forcePlaceholderSize:false,forceHelperSize:false,helper:"original",items:"> *",scope:"default",scroll:true,scrollSensitivity:20,scrollSpeed:20,sortIndicator:A.ui.sortable.prototype._rearrange,tolerance:"default",zIndex:1000}});A.ui.plugin.add("sortable","cursor",{start:function(D,E){var C=A("body"),B=A(this).data("sortable");if(C.css("cursor")){B.options._cursor=C.css("cursor")}C.css("cursor",B.options.cursor)},beforeStop:function(C,D){var B=A(this).data("sortable");if(B.options._cursor){A("body").css("cursor",B.options._cursor)}}});A.ui.plugin.add("sortable","opacity",{start:function(D,E){var C=E.helper,B=A(this).data("sortable");if(C.css("opacity")){B.options._opacity=C.css("opacity")}C.css("opacity",B.options.opacity)},beforeStop:function(C,D){var B=A(this).data("sortable");if(B.options._opacity){A(D.helper).css("opacity",B.options._opacity)}}});A.ui.plugin.add("sortable","scroll",{start:function(C,D){var B=A(this).data("sortable"),E=B.options;if(B.scrollParent[0]!=document&&B.scrollParent[0].tagName!="HTML"){B.overflowOffset=B.scrollParent.offset()}},sort:function(D,E){var C=A(this).data("sortable"),F=C.options,B=false;if(C.scrollParent[0]!=document&&C.scrollParent[0].tagName!="HTML"){if((C.overflowOffset.top+C.scrollParent[0].offsetHeight)-D.pageY<F.scrollSensitivity){C.scrollParent[0].scrollTop=B=C.scrollParent[0].scrollTop+F.scrollSpeed}else{if(D.pageY-C.overflowOffset.top<F.scrollSensitivity){C.scrollParent[0].scrollTop=B=C.scrollParent[0].scrollTop-F.scrollSpeed}}if((C.overflowOffset.left+C.scrollParent[0].offsetWidth)-D.pageX<F.scrollSensitivity){C.scrollParent[0].scrollLeft=B=C.scrollParent[0].scrollLeft+F.scrollSpeed}else{if(D.pageX-C.overflowOffset.left<F.scrollSensitivity){C.scrollParent[0].scrollLeft=B=C.scrollParent[0].scrollLeft-F.scrollSpeed}}}else{if(D.pageY-A(document).scrollTop()<F.scrollSensitivity){B=A(document).scrollTop(A(document).scrollTop()-F.scrollSpeed)}else{if(A(window).height()-(D.pageY-A(document).scrollTop())<F.scrollSensitivity){B=A(document).scrollTop(A(document).scrollTop()+F.scrollSpeed)}}if(D.pageX-A(document).scrollLeft()<F.scrollSensitivity){B=A(document).scrollLeft(A(document).scrollLeft()-F.scrollSpeed)}else{if(A(window).width()-(D.pageX-A(document).scrollLeft())<F.scrollSensitivity){B=A(document).scrollLeft(A(document).scrollLeft()+F.scrollSpeed)}}}if(B!==false&&A.ui.ddmanager&&!F.dropBehaviour){A.ui.ddmanager.prepareOffsets(C,D)}if(B!==false&&C.cssPosition=="absolute"&&C.scrollParent[0]!=document&&A.ui.contains(C.scrollParent[0],C.offsetParent[0])){C.offset.parent=C._getParentOffset()}if(B!==false&&C.cssPosition=="relative"&&!(C.scrollParent[0]!=document&&C.scrollParent[0]!=C.offsetParent[0])){C.offset.relative=C._getRelativeOffset()}}});A.ui.plugin.add("sortable","zIndex",{start:function(D,E){var C=E.helper,B=A(this).data("sortable");if(C.css("zIndex")){B.options._zIndex=C.css("zIndex")}C.css("zIndex",B.options.zIndex)},beforeStop:function(C,D){var B=A(this).data("sortable");if(B.options._zIndex){A(D.helper).css("zIndex",B.options._zIndex=="auto"?"":B.options._zIndex)}}})})(jQuery);/* + * jQuery UI Accordion 1.6 + * + * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Accordion + * + * Depends: + * ui.core.js + */ +(function(E){E.widget("ui.accordion",{_init:function(){var H=this.options;if(H.navigation){var K=this.element.find("a").filter(H.navigationFilter);if(K.length){if(K.filter(H.header).length){H.active=K}else{H.active=K.parent().parent().prev();K.addClass("current")}}}H.headers=this.element.find(H.header);H.active=C(H.headers,H.active);if(E.browser.msie){this.element.find("a").css("zoom","1")}if(!this.element.hasClass("ui-accordion")){this.element.addClass("ui-accordion");E('<span class="ui-accordion-left"></span>').insertBefore(H.headers);E('<span class="ui-accordion-right"></span>').appendTo(H.headers);H.headers.addClass("ui-accordion-header")}var J;if(H.fillSpace){J=this.element.parent().height();H.headers.each(function(){J-=E(this).outerHeight()});var I=0;H.headers.next().each(function(){I=Math.max(I,E(this).innerHeight()-E(this).height())}).height(J-I)}else{if(H.autoHeight){J=0;H.headers.next().each(function(){J=Math.max(J,E(this).outerHeight())}).height(J)}}this.element.attr("role","tablist");var G=this;H.headers.attr("role","tab").bind("keydown",function(L){return G._keydown(L)}).next().attr("role","tabpanel");H.headers.not(H.active||"").attr("aria-expanded","false").attr("tabIndex","-1").next().hide();if(!H.active.length){H.headers.eq(0).attr("tabIndex","0")}else{H.active.attr("aria-expanded","true").attr("tabIndex","0").parent().andSelf().addClass(H.selectedClass)}if(!E.browser.safari){H.headers.find("a").attr("tabIndex","-1")}if(H.event){this.element.bind((H.event)+".accordion",F)}},destroy:function(){this.options.headers.parent().andSelf().removeClass(this.options.selectedClass);this.options.headers.prev(".ui-accordion-left").remove();this.options.headers.children(".ui-accordion-right").remove();this.options.headers.next().css("display","");if(this.options.fillSpace||this.options.autoHeight){this.options.headers.next().css("height","")}E.removeData(this.element[0],"accordion");this.element.removeClass("ui-accordion").unbind(".accordion")},_keydown:function(J){if(this.options.disabled||J.altKey||J.ctrlKey){return }var K=E.ui.keyCode;var I=this.options.headers.length;var G=this.options.headers.index(J.target);var H=false;switch(J.keyCode){case K.RIGHT:case K.DOWN:H=this.options.headers[(G+1)%I];break;case K.LEFT:case K.UP:H=this.options.headers[(G-1+I)%I];break;case K.SPACE:case K.ENTER:return F.call(this.element[0],{target:J.target})}if(H){E(J.target).attr("tabIndex","-1");E(H).attr("tabIndex","0");H.focus();return false}return true},activate:function(G){F.call(this.element[0],{target:C(this.options.headers,G)[0]})}});function B(H,G){return function(){return H.apply(G,arguments)}}function D(I){if(!E.data(this,"accordion")){return }var G=E.data(this,"accordion");var H=G.options;H.running=I?0:--H.running;if(H.running){return }if(H.clearStyle){H.toShow.add(H.toHide).css({height:"",overflow:""})}G._trigger("change",null,H.data)}function A(G,N,K,L,O){var Q=E.data(this,"accordion").options;Q.toShow=G;Q.toHide=N;Q.data=K;var H=B(D,this);E.data(this,"accordion")._trigger("changestart",null,Q.data);Q.running=N.size()===0?G.size():N.size();if(Q.animated){var J={};if(!Q.alwaysOpen&&L){J={toShow:E([]),toHide:N,complete:H,down:O,autoHeight:Q.autoHeight}}else{J={toShow:G,toHide:N,complete:H,down:O,autoHeight:Q.autoHeight}}if(!Q.proxied){Q.proxied=Q.animated}if(!Q.proxiedDuration){Q.proxiedDuration=Q.duration}Q.animated=E.isFunction(Q.proxied)?Q.proxied(J):Q.proxied;Q.duration=E.isFunction(Q.proxiedDuration)?Q.proxiedDuration(J):Q.proxiedDuration;var P=E.ui.accordion.animations,I=Q.duration,M=Q.animated;if(!P[M]){P[M]=function(R){this.slide(R,{easing:M,duration:I||700})}}P[M](J)}else{if(!Q.alwaysOpen&&L){G.toggle()}else{N.hide();G.show()}H(true)}N.prev().attr("aria-expanded","false").attr("tabIndex","-1");G.prev().attr("aria-expanded","true").attr("tabIndex","0").focus()}function F(L){var J=E.data(this,"accordion").options;if(J.disabled){return false}if(!L.target&&!J.alwaysOpen){J.active.parent().andSelf().toggleClass(J.selectedClass);var I=J.active.next(),M={options:J,newHeader:E([]),oldHeader:J.active,newContent:E([]),oldContent:I},G=(J.active=E([]));A.call(this,G,I,M);return false}var K=E(L.target);K=E(K.parents(J.header)[0]||K);var H=K[0]==J.active[0];if(J.running||(J.alwaysOpen&&H)){return false}if(!K.is(J.header)){return }J.active.parent().andSelf().toggleClass(J.selectedClass);if(!H){K.parent().andSelf().addClass(J.selectedClass)}var G=K.next(),I=J.active.next(),M={options:J,newHeader:H&&!J.alwaysOpen?E([]):K,oldHeader:J.active,newContent:H&&!J.alwaysOpen?E([]):G,oldContent:I},N=J.headers.index(J.active[0])>J.headers.index(K[0]);J.active=H?E([]):K;A.call(this,G,I,M,H,N);return false}function C(H,G){return G?typeof G=="number"?H.filter(":eq("+G+")"):H.not(H.not(G)):G===false?E([]):H.filter(":eq(0)")}E.extend(E.ui.accordion,{version:"1.6",defaults:{autoHeight:true,alwaysOpen:true,animated:"slide",event:"click",header:"a",navigationFilter:function(){return this.href.toLowerCase()==location.href.toLowerCase()},running:0,selectedClass:"selected"},animations:{slide:function(G,J){G=E.extend({easing:"swing",duration:300},G,J);if(!G.toHide.size()){G.toShow.animate({height:"show"},G);return }var I=G.toHide.height(),L=G.toShow.height(),N=L/I,K=G.toShow.outerHeight()-G.toShow.height(),H=G.toShow.css("marginBottom"),M=G.toShow.css("overflow");tmargin=G.toShow.css("marginTop");G.toShow.css({height:0,overflow:"hidden",marginTop:0,marginBottom:-K}).show();G.toHide.filter(":hidden").each(G.complete).end().filter(":visible").animate({height:"hide"},{step:function(O){var P=(I-O)*N;if(E.browser.msie||E.browser.opera){P=Math.ceil(P)}G.toShow.height(P)},duration:G.duration,easing:G.easing,complete:function(){if(!G.autoHeight){G.toShow.css("height","auto")}G.toShow.css({marginTop:tmargin,marginBottom:H,overflow:M});G.complete()}})},bounceslide:function(G){this.slide(G,{easing:G.down?"easeOutBounce":"swing",duration:G.down?1000:200})},easeslide:function(G){this.slide(G,{easing:"easeinout",duration:700})}}})})(jQuery);/* + * jQuery UI Dialog 1.6 + * + * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Dialog + * + * Depends: + * ui.core.js + * ui.draggable.js + * ui.resizable.js + */ +(function(B){var A={dragStart:"start.draggable",drag:"drag.draggable",dragStop:"stop.draggable",maxHeight:"maxHeight.resizable",minHeight:"minHeight.resizable",maxWidth:"maxWidth.resizable",minWidth:"minWidth.resizable",resizeStart:"start.resizable",resize:"drag.resizable",resizeStop:"stop.resizable"};B.widget("ui.dialog",{_init:function(){this.originalTitle=this.element.attr("title");this.options.title=this.options.title||this.originalTitle;var M=this,N=this.options,F=this.element.removeAttr("title").addClass("ui-dialog-content").wrap("<div></div>").wrap("<div></div>"),I=(this.uiDialogContainer=F.parent()).addClass("ui-dialog-container").css({position:"relative",width:"100%",height:"100%"}),E=(this.uiDialogTitlebar=B("<div></div>")).addClass("ui-dialog-titlebar").mousedown(function(){M.moveToTop()}).prependTo(I),J=B('<a href="#"/>').addClass("ui-dialog-titlebar-close").attr("role","button").appendTo(E),G=(this.uiDialogTitlebarCloseText=B("<span/>")).text(N.closeText).appendTo(J),L=N.title||" ",D=B.ui.dialog.getTitleId(this.element),C=B("<span/>").addClass("ui-dialog-title").attr("id",D).html(L).prependTo(E),K=(this.uiDialog=I.parent()).appendTo(document.body).hide().addClass("ui-dialog").addClass(N.dialogClass).css({position:"absolute",width:N.width,height:N.height,overflow:"hidden",zIndex:N.zIndex}).attr("tabIndex",-1).css("outline",0).keydown(function(O){(N.closeOnEscape&&O.keyCode&&O.keyCode==B.ui.keyCode.ESCAPE&&M.close())}).attr({role:"dialog","aria-labelledby":D}).mouseup(function(){M.moveToTop()}),H=(this.uiDialogButtonPane=B("<div></div>")).addClass("ui-dialog-buttonpane").css({position:"absolute",bottom:0}).appendTo(K),J=B(".ui-dialog-titlebar-close",E).hover(function(){B(this).addClass("ui-dialog-titlebar-close-hover")},function(){B(this).removeClass("ui-dialog-titlebar-close-hover")}).mousedown(function(O){O.stopPropagation()}).click(function(){M.close();return false});E.find("*").add(E).disableSelection();(N.draggable&&B.fn.draggable&&this._makeDraggable());(N.resizable&&B.fn.resizable&&this._makeResizable());this._createButtons(N.buttons);this._isOpen=false;(N.bgiframe&&B.fn.bgiframe&&K.bgiframe());(N.autoOpen&&this.open())},destroy:function(){(this.overlay&&this.overlay.destroy());this.uiDialog.hide();this.element.unbind(".dialog").removeData("dialog").removeClass("ui-dialog-content").hide().appendTo("body");this.uiDialog.remove();(this.originalTitle&&this.element.attr("title",this.originalTitle))},close:function(){if(false===this._trigger("beforeclose",null,{options:this.options})){return }(this.overlay&&this.overlay.destroy());this.uiDialog.hide(this.options.hide).unbind("keypress.ui-dialog");this._trigger("close",null,{options:this.options});B.ui.dialog.overlay.resize();this._isOpen=false},isOpen:function(){return this._isOpen},moveToTop:function(F){if((this.options.modal&&!F)||(!this.options.stack&&!this.options.modal)){return this._trigger("focus",null,{options:this.options})}var E=this.options.zIndex,D=this.options;B(".ui-dialog:visible").each(function(){E=Math.max(E,parseInt(B(this).css("z-index"),10)||D.zIndex)});(this.overlay&&this.overlay.$el.css("z-index",++E));var C={scrollTop:this.element.attr("scrollTop"),scrollLeft:this.element.attr("scrollLeft")};this.uiDialog.css("z-index",++E);this.element.attr(C);this._trigger("focus",null,{options:this.options})},open:function(){if(this._isOpen){return }this.overlay=this.options.modal?new B.ui.dialog.overlay(this):null;(this.uiDialog.next().length&&this.uiDialog.appendTo("body"));this._position(this.options.position);this.uiDialog.show(this.options.show);(this.options.autoResize&&this._size());this.moveToTop(true);(this.options.modal&&this.uiDialog.bind("keypress.ui-dialog",function(E){if(E.keyCode!=B.ui.keyCode.TAB){return }var D=B(":tabbable",this),F=D.filter(":first")[0],C=D.filter(":last")[0];if(E.target==C&&!E.shiftKey){setTimeout(function(){F.focus()},1)}else{if(E.target==F&&E.shiftKey){setTimeout(function(){C.focus()},1)}}}));this.uiDialog.find(":tabbable:first").focus();this._trigger("open",null,{options:this.options});this._isOpen=true},_createButtons:function(F){var E=this,C=false,D=this.uiDialogButtonPane;D.empty().hide();B.each(F,function(){return !(C=true)});if(C){D.show();B.each(F,function(G,H){B('<button type="button"></button>').text(G).click(function(){H.apply(E.element[0],arguments)}).appendTo(D)})}},_makeDraggable:function(){var C=this,D=this.options;this.uiDialog.draggable({cancel:".ui-dialog-content",helper:D.dragHelper,handle:".ui-dialog-titlebar",start:function(){C.moveToTop();(D.dragStart&&D.dragStart.apply(C.element[0],arguments))},drag:function(){(D.drag&&D.drag.apply(C.element[0],arguments))},stop:function(){(D.dragStop&&D.dragStop.apply(C.element[0],arguments));B.ui.dialog.overlay.resize()}})},_makeResizable:function(F){F=(F===undefined?this.options.resizable:F);var C=this,E=this.options,D=typeof F=="string"?F:"n,e,s,w,se,sw,ne,nw";this.uiDialog.resizable({cancel:".ui-dialog-content",helper:E.resizeHelper,maxWidth:E.maxWidth,maxHeight:E.maxHeight,minWidth:E.minWidth,minHeight:E.minHeight,start:function(){(E.resizeStart&&E.resizeStart.apply(C.element[0],arguments))},resize:function(){(E.autoResize&&C._size.apply(C));(E.resize&&E.resize.apply(C.element[0],arguments))},handles:D,stop:function(){(E.autoResize&&C._size.apply(C));(E.resizeStop&&E.resizeStop.apply(C.element[0],arguments));B.ui.dialog.overlay.resize()}})},_position:function(H){var D=B(window),E=B(document),F=E.scrollTop(),C=E.scrollLeft(),G=F;if(B.inArray(H,["center","top","right","bottom","left"])>=0){H=[H=="right"||H=="left"?H:"center",H=="top"||H=="bottom"?H:"middle"]}if(H.constructor!=Array){H=["center","middle"]}if(H[0].constructor==Number){C+=H[0]}else{switch(H[0]){case"left":C+=0;break;case"right":C+=D.width()-this.uiDialog.outerWidth();break;default:case"center":C+=(D.width()-this.uiDialog.outerWidth())/2}}if(H[1].constructor==Number){F+=H[1]}else{switch(H[1]){case"top":F+=0;break;case"bottom":F+=(B.browser.opera?window.innerHeight:D.height())-this.uiDialog.outerHeight();break;default:case"middle":F+=((B.browser.opera?window.innerHeight:D.height())-this.uiDialog.outerHeight())/2}}F=Math.max(F,G);this.uiDialog.css({top:F,left:C})},_setData:function(D,E){(A[D]&&this.uiDialog.data(A[D],E));switch(D){case"buttons":this._createButtons(E);break;case"closeText":this.uiDialogTitlebarCloseText.text(E);break;case"draggable":(E?this._makeDraggable():this.uiDialog.draggable("destroy"));break;case"height":this.uiDialog.height(E);break;case"position":this._position(E);break;case"resizable":var C=this.uiDialog,F=this.uiDialog.is(":data(resizable)");(F&&!E&&C.resizable("destroy"));(F&&typeof E=="string"&&C.resizable("option","handles",E));(F||this._makeResizable(E));break;case"title":B(".ui-dialog-title",this.uiDialogTitlebar).html(E||" ");break;case"width":this.uiDialog.width(E);break}B.widget.prototype._setData.apply(this,arguments)},_size:function(){var D=this.uiDialogContainer,G=this.uiDialogTitlebar,E=this.element,F=(parseInt(E.css("margin-top"),10)||0)+(parseInt(E.css("margin-bottom"),10)||0),C=(parseInt(E.css("margin-left"),10)||0)+(parseInt(E.css("margin-right"),10)||0);E.height(D.height()-G.outerHeight()-F);E.width(D.width()-C)}});B.extend(B.ui.dialog,{version:"1.6",defaults:{autoOpen:true,autoResize:true,bgiframe:false,buttons:{},closeOnEscape:true,closeText:"close",draggable:true,height:200,minHeight:100,minWidth:150,modal:false,overlay:{},position:"center",resizable:true,stack:true,width:300,zIndex:1000},getter:"isOpen",uuid:0,getTitleId:function(C){return"ui-dialog-title-"+(C.attr("id")||++this.uuid)},overlay:function(C){this.$el=B.ui.dialog.overlay.create(C)}});B.extend(B.ui.dialog.overlay,{instances:[],events:B.map("focus,mousedown,mouseup,keydown,keypress,click".split(","),function(C){return C+".dialog-overlay"}).join(" "),create:function(D){if(this.instances.length===0){setTimeout(function(){B("a, :input").bind(B.ui.dialog.overlay.events,function(){var F=false;var H=B(this).parents(".ui-dialog");if(H.length){var E=B(".ui-dialog-overlay");if(E.length){var G=parseInt(E.css("z-index"),10);E.each(function(){G=Math.max(G,parseInt(B(this).css("z-index"),10))});F=parseInt(H.css("z-index"),10)>G}else{F=true}}return F})},1);B(document).bind("keydown.dialog-overlay",function(E){(D.options.closeOnEscape&&E.keyCode&&E.keyCode==B.ui.keyCode.ESCAPE&&D.close())});B(window).bind("resize.dialog-overlay",B.ui.dialog.overlay.resize)}var C=B("<div></div>").appendTo(document.body).addClass("ui-dialog-overlay").css(B.extend({borderWidth:0,margin:0,padding:0,position:"absolute",top:0,left:0,width:this.width(),height:this.height()},D.options.overlay));(D.options.bgiframe&&B.fn.bgiframe&&C.bgiframe());this.instances.push(C);return C},destroy:function(C){this.instances.splice(B.inArray(this.instances,C),1);if(this.instances.length===0){B("a, :input").add([document,window]).unbind(".dialog-overlay")}C.remove()},height:function(){if(B.browser.msie&&B.browser.version<7){var D=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight);var C=Math.max(document.documentElement.offsetHeight,document.body.offsetHeight);if(D<C){return B(window).height()+"px"}else{return D+"px"}}else{if(B.browser.opera){return Math.max(window.innerHeight,B(document).height())+"px"}else{return B(document).height()+"px"}}},width:function(){if(B.browser.msie&&B.browser.version<7){var C=Math.max(document.documentElement.scrollWidth,document.body.scrollWidth);var D=Math.max(document.documentElement.offsetWidth,document.body.offsetWidth);if(C<D){return B(window).width()+"px"}else{return C+"px"}}else{if(B.browser.opera){return Math.max(window.innerWidth,B(document).width())+"px"}else{return B(document).width()+"px"}}},resize:function(){var C=B([]);B.each(B.ui.dialog.overlay.instances,function(){C=C.add(this)});C.css({width:0,height:0}).css({width:B.ui.dialog.overlay.width(),height:B.ui.dialog.overlay.height()})}});B.extend(B.ui.dialog.overlay.prototype,{destroy:function(){B.ui.dialog.overlay.destroy(this.$el)}})})(jQuery);/* + * jQuery UI Slider 1.6 + * + * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Slider + * + * Depends: + * ui.core.js + */ +(function(A){A.fn.unwrap=A.fn.unwrap||function(B){return this.each(function(){A(this).parents(B).eq(0).after(this).remove()})};A.widget("ui.slider",{_init:function(){var B=this;this.element.addClass("ui-slider");this._initBoundaries();this.handle=A(this.options.handle,this.element);if(!this.handle.length){B.handle=B.generated=A(B.options.handles||[0]).map(function(){var D=A("<div/>").addClass("ui-slider-handle").appendTo(B.element);if(this.id){D.attr("id",this.id)}return D[0]})}var C=function(D){this.element=A(D);this.element.data("mouse",this);this.options=B.options;this.element.bind("mousedown",function(){if(B.currentHandle){this.blur(B.currentHandle)}B._focus(this,true)});this._mouseInit()};A.extend(C.prototype,A.ui.mouse,{_mouseCapture:function(){return true},_mouseStart:function(D){return B._start.call(B,D,this.element[0])},_mouseDrag:function(D){return B._drag.call(B,D,this.element[0])},_mouseStop:function(D){return B._stop.call(B,D,this.element[0])},trigger:function(D){this._mouseDown(D)}});A(this.handle).each(function(){new C(this)}).wrap('<a href="#" style="outline:none;border:none;"></a>').parent().bind("click",function(){return false}).bind("focus",function(D){B._focus(this.firstChild)}).bind("blur",function(D){B._blur(this.firstChild)}).bind("keydown",function(D){if(!B.options.noKeyboard){return B._keydown(D.keyCode,this.firstChild)}});this.element.bind("mousedown.slider",function(D){if(A(D.target).is(".ui-slider-handle")){return }B._click.apply(B,[D]);B.currentHandle.data("mouse").trigger(D);B.firstValue=B.firstValue+1});A.each(this.options.handles||[],function(D,E){B.moveTo(E.start,D,true)});if(!isNaN(this.options.startValue)){this.moveTo(this.options.startValue,0,true)}this.previousHandle=A(this.handle[0]);if(this.handle.length==2&&this.options.range){this._createRange()}},destroy:function(){this.element.removeClass("ui-slider ui-slider-disabled").removeData("slider").unbind(".slider");if(this.handle&&this.handle.length){this.handle.unwrap("a");this.handle.each(function(){var B=A(this).data("mouse");B&&B._mouseDestroy()})}this.generated&&this.generated.remove()},_start:function(B,C){var D=this.options;if(D.disabled){return false}this.actualSize={width:this.element.outerWidth(),height:this.element.outerHeight()};if(!this.currentHandle){this._focus(this.previousHandle,true)}this.offset=this.element.offset();this.handleOffset=this.currentHandle.offset();this.clickOffset={top:B.pageY-this.handleOffset.top,left:B.pageX-this.handleOffset.left};this.firstValue=this.value();this._propagate("start",B);this._drag(B,C);return true},_drag:function(C,E){var F=this.options;var B={top:C.pageY-this.offset.top-this.clickOffset.top,left:C.pageX-this.offset.left-this.clickOffset.left};if(!this.currentHandle){this._focus(this.previousHandle,true)}B.left=this._translateLimits(B.left,"x");B.top=this._translateLimits(B.top,"y");if(F.stepping.x){var D=this._convertValue(B.left,"x");D=this._round(D/F.stepping.x)*F.stepping.x;B.left=this._translateValue(D,"x")}if(F.stepping.y){var D=this._convertValue(B.top,"y");D=this._round(D/F.stepping.y)*F.stepping.y;B.top=this._translateValue(D,"y")}B.left=this._translateRange(B.left,"x");B.top=this._translateRange(B.top,"y");if(F.axis!="vertical"){this.currentHandle.css({left:B.left})}if(F.axis!="horizontal"){this.currentHandle.css({top:B.top})}this.currentHandle.data("mouse").sliderValue={x:this._round(this._convertValue(B.left,"x"))||0,y:this._round(this._convertValue(B.top,"y"))||0};if(this.rangeElement){this._updateRange()}this._propagate("slide",C);return false},_stop:function(B){this._propagate("stop",B);if(this.firstValue!=this.value()){this._propagate("change",B)}this._focus(this.currentHandle,true);return false},_round:function(B){return this.options.round?parseInt(B,10):parseFloat(B)},_setData:function(B,C){A.widget.prototype._setData.apply(this,arguments);if(/min|max|steps/.test(B)){this._initBoundaries()}if(B=="range"){C?this.handle.length==2&&this._createRange():this._removeRange()}},_initBoundaries:function(){var B=this.element[0],C=this.options;this.actualSize={width:this.element.outerWidth(),height:this.element.outerHeight()};A.extend(C,{axis:C.axis||(B.offsetWidth<B.offsetHeight?"vertical":"horizontal"),max:!isNaN(parseInt(C.max,10))?{x:parseInt(C.max,10),y:parseInt(C.max,10)}:({x:C.max&&C.max.x||100,y:C.max&&C.max.y||100}),min:!isNaN(parseInt(C.min,10))?{x:parseInt(C.min,10),y:parseInt(C.min,10)}:({x:C.min&&C.min.x||0,y:C.min&&C.min.y||0})});C.realMax={x:C.max.x-C.min.x,y:C.max.y-C.min.y};C.stepping={x:C.stepping&&C.stepping.x||parseInt(C.stepping,10)||(C.steps?C.realMax.x/(C.steps.x||parseInt(C.steps,10)||C.realMax.x):0),y:C.stepping&&C.stepping.y||parseInt(C.stepping,10)||(C.steps?C.realMax.y/(C.steps.y||parseInt(C.steps,10)||C.realMax.y):0)}},_keydown:function(F,E){if(this.options.disabled){return }var C=F;if(/(33|34|35|36|37|38|39|40)/.test(C)){var G=this.options,B,I;if(/(35|36)/.test(C)){B=(C==35)?G.max.x:G.min.x;I=(C==35)?G.max.y:G.min.y}else{var H=/(34|37|40)/.test(C)?"-=":"+=";var D=/(37|38|39|40)/.test(C)?"_oneStep":"_pageStep";B=H+this[D]("x");I=H+this[D]("y")}this.moveTo({x:B,y:I},E);return false}return true},_focus:function(B,C){this.currentHandle=A(B).addClass("ui-slider-handle-active");if(C){this.currentHandle.parent()[0].focus()}},_blur:function(B){A(B).removeClass("ui-slider-handle-active");if(this.currentHandle&&this.currentHandle[0]==B){this.previousHandle=this.currentHandle;this.currentHandle=null}},_click:function(C){var D=[C.pageX,C.pageY];var B=false;this.handle.each(function(){if(this==C.target){B=true}});if(B||this.options.disabled||!(this.currentHandle||this.previousHandle)){return }if(!this.currentHandle&&this.previousHandle){this._focus(this.previousHandle,true)}this.offset=this.element.offset();this.moveTo({y:this._convertValue(C.pageY-this.offset.top-this.currentHandle[0].offsetHeight/2,"y"),x:this._convertValue(C.pageX-this.offset.left-this.currentHandle[0].offsetWidth/2,"x")},null,!this.options.distance)},_createRange:function(){if(this.rangeElement){return }this.rangeElement=A("<div></div>").addClass("ui-slider-range").css({position:"absolute"}).appendTo(this.element);this._updateRange()},_removeRange:function(){this.rangeElement.remove();this.rangeElement=null},_updateRange:function(){var C=this.options.axis=="vertical"?"top":"left";var B=this.options.axis=="vertical"?"height":"width";this.rangeElement.css(C,(this._round(A(this.handle[0]).css(C))||0)+this._handleSize(0,this.options.axis=="vertical"?"y":"x")/2);this.rangeElement.css(B,(this._round(A(this.handle[1]).css(C))||0)-(this._round(A(this.handle[0]).css(C))||0))},_getRange:function(){return this.rangeElement?this._convertValue(this._round(this.rangeElement.css(this.options.axis=="vertical"?"height":"width")),this.options.axis=="vertical"?"y":"x"):null},_handleIndex:function(){return this.handle.index(this.currentHandle[0])},value:function(D,B){if(this.handle.length==1){this.currentHandle=this.handle}if(!B){B=this.options.axis=="vertical"?"y":"x"}var C=A(D!=undefined&&D!==null?this.handle[D]||D:this.currentHandle);if(C.data("mouse").sliderValue){return this._round(C.data("mouse").sliderValue[B])}else{return this._round(((this._round(C.css(B=="x"?"left":"top"))/(this.actualSize[B=="x"?"width":"height"]-this._handleSize(D,B)))*this.options.realMax[B])+this.options.min[B])}},_convertValue:function(C,B){return this.options.min[B]+(C/(this.actualSize[B=="x"?"width":"height"]-this._handleSize(null,B)))*this.options.realMax[B]},_translateValue:function(C,B){return((C-this.options.min[B])/this.options.realMax[B])*(this.actualSize[B=="x"?"width":"height"]-this._handleSize(null,B))},_translateRange:function(D,B){if(this.rangeElement){if(this.currentHandle[0]==this.handle[0]&&D>=this._translateValue(this.value(1),B)){D=this._translateValue(this.value(1,B)-this._oneStep(B),B)}if(this.currentHandle[0]==this.handle[1]&&D<=this._translateValue(this.value(0),B)){D=this._translateValue(this.value(0,B)+this._oneStep(B),B)}}if(this.options.handles){var C=this.options.handles[this._handleIndex()];if(D<this._translateValue(C.min,B)){D=this._translateValue(C.min,B)}else{if(D>this._translateValue(C.max,B)){D=this._translateValue(C.max,B)}}}return D},_translateLimits:function(C,B){if(C>=this.actualSize[B=="x"?"width":"height"]-this._handleSize(null,B)){C=this.actualSize[B=="x"?"width":"height"]-this._handleSize(null,B)}if(C<=0){C=0}return C},_handleSize:function(C,B){return A(C!=undefined&&C!==null?this.handle[C]:this.currentHandle)[0]["offset"+(B=="x"?"Width":"Height")]},_oneStep:function(B){return this.options.stepping[B]||1},_pageStep:function(B){return 10},moveTo:function(F,E,G){var H=this.options;this.actualSize={width:this.element.outerWidth(),height:this.element.outerHeight()};if(E==undefined&&!this.currentHandle&&this.handle.length!=1){return false}if(E==undefined&&!this.currentHandle){E=0}if(E!=undefined){this.currentHandle=this.previousHandle=A(this.handle[E]||E)}if(F.x!==undefined&&F.y!==undefined){var B=F.x,I=F.y}else{var B=F,I=F}if(B!==undefined&&B.constructor!=Number){var D=/^\-\=/.test(B),C=/^\+\=/.test(B);if(D||C){B=this.value(null,"x")+this._round(B.replace(D?"=":"+=",""))}else{B=isNaN(this._round(B))?undefined:this._round(B)}}if(I!==undefined&&I.constructor!=Number){var D=/^\-\=/.test(I),C=/^\+\=/.test(I);if(D||C){I=this.value(null,"y")+this._round(I.replace(D?"=":"+=",""))}else{I=isNaN(this._round(I))?undefined:this._round(I)}}if(H.axis!="vertical"&&B!==undefined){if(H.stepping.x){B=this._round(B/H.stepping.x)*H.stepping.x}B=this._translateValue(B,"x");B=this._translateLimits(B,"x");B=this._translateRange(B,"x");H.animate?this.currentHandle.stop().animate({left:B},(Math.abs(parseInt(this.currentHandle.css("left"),10)-B))*(!isNaN(parseInt(H.animate,10))?H.animate:5)):this.currentHandle.css({left:B})}if(H.axis!="horizontal"&&I!==undefined){if(H.stepping.y){I=this._round(I/H.stepping.y)*H.stepping.y}I=this._translateValue(I,"y");I=this._translateLimits(I,"y");I=this._translateRange(I,"y");H.animate?this.currentHandle.stop().animate({top:I},(Math.abs(parseInt(this.currentHandle.css("top"),10)-I))*(!isNaN(parseInt(H.animate,10))?H.animate:5)):this.currentHandle.css({top:I})}if(this.rangeElement){this._updateRange()}this.currentHandle.data("mouse").sliderValue={x:this._round(this._convertValue(B,"x"))||0,y:this._round(this._convertValue(I,"y"))||0};if(!G){this._propagate("start",null);this._propagate("slide",null);this._propagate("stop",null);this._propagate("change",null)}},_propagate:function(C,B){A.ui.plugin.call(this,C,[B,this.ui()]);this.element.triggerHandler(C=="slide"?C:"slide"+C,[B,this.ui()],this.options[C])},plugins:{},ui:function(B){return{options:this.options,handle:this.currentHandle,value:this.options.axis!="both"||!this.options.axis?this._round(this.value(null,this.options.axis=="vertical"?"y":"x")):{x:this._round(this.value(null,"x")),y:this._round(this.value(null,"y"))},range:this._getRange()}}});A.extend(A.ui.slider,{getter:"value",version:"1.6",defaults:{animate:false,distance:1,handle:".ui-slider-handle",round:true}})})(jQuery);/* + * jQuery UI Tabs 1.6 + * + * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Tabs + * + * Depends: + * ui.core.js + */ +(function(A){A.widget("ui.tabs",{_init:function(){this._tabify(true)},destroy:function(){var B=this.options;this.element.unbind(".tabs").removeClass(B.navClass).removeData("tabs");this.$tabs.each(function(){var C=A.data(this,"href.tabs");if(C){this.href=C}var D=A(this).unbind(".tabs");A.each(["href","load","cache"],function(E,F){D.removeData(F+".tabs")})});this.$lis.add(this.$panels).each(function(){if(A.data(this,"destroy.tabs")){A(this).remove()}else{A(this).removeClass([B.selectedClass,B.deselectableClass,B.disabledClass,B.panelClass,B.hideClass].join(" "))}});if(B.cookie){this._cookie(null,B.cookie)}},_setData:function(B,C){if((/^selected/).test(B)){this.select(C)}else{this.options[B]=C;this._tabify()}},length:function(){return this.$tabs.length},_tabId:function(B){return B.title&&B.title.replace(/\s/g,"_").replace(/[^A-Za-z0-9\-_:\.]/g,"")||this.options.idPrefix+A.data(B)},_sanitizeSelector:function(B){return B.replace(/:/g,"\\:")},_cookie:function(){var B=this.cookie||(this.cookie="ui-tabs-"+A.data(this.element[0]));return A.cookie.apply(null,[B].concat(A.makeArray(arguments)))},_tabify:function(N){this.$lis=A("li:has(a[href])",this.element);this.$tabs=this.$lis.map(function(){return A("a",this)[0]});this.$panels=A([]);var O=this,C=this.options;this.$tabs.each(function(Q,P){if(P.hash&&P.hash.replace("#","")){O.$panels=O.$panels.add(O._sanitizeSelector(P.hash))}else{if(A(P).attr("href")!="#"){A.data(P,"href.tabs",P.href);A.data(P,"load.tabs",P.href);var S=O._tabId(P);P.href="#"+S;var R=A("#"+S);if(!R.length){R=A(C.panelTemplate).attr("id",S).addClass(C.panelClass).insertAfter(O.$panels[Q-1]||O.element);R.data("destroy.tabs",true)}O.$panels=O.$panels.add(R)}else{C.disabled.push(Q+1)}}});if(N){this.element.addClass(C.navClass);this.$panels.addClass(C.panelClass);if(C.selected===undefined){if(location.hash){this.$tabs.each(function(Q,P){if(P.hash==location.hash){C.selected=Q;return false}})}else{if(C.cookie){var I=parseInt(O._cookie(),10);if(I&&O.$tabs[I]){C.selected=I}}else{if(O.$lis.filter("."+C.selectedClass).length){C.selected=O.$lis.index(O.$lis.filter("."+C.selectedClass)[0])}}}}C.selected=C.selected===null||C.selected!==undefined?C.selected:0;C.disabled=A.unique(C.disabled.concat(A.map(this.$lis.filter("."+C.disabledClass),function(Q,P){return O.$lis.index(Q)}))).sort();if(A.inArray(C.selected,C.disabled)!=-1){C.disabled.splice(A.inArray(C.selected,C.disabled),1)}this.$panels.addClass(C.hideClass);this.$lis.removeClass(C.selectedClass);if(C.selected!==null){this.$panels.eq(C.selected).removeClass(C.hideClass);var E=[C.selectedClass];if(C.deselectable){E.push(C.deselectableClass)}this.$lis.eq(C.selected).addClass(E.join(" "));var J=function(){O._trigger("show",null,O.ui(O.$tabs[C.selected],O.$panels[C.selected]))};if(A.data(this.$tabs[C.selected],"load.tabs")){this.load(C.selected,J)}else{J()}}A(window).bind("unload",function(){O.$tabs.unbind(".tabs");O.$lis=O.$tabs=O.$panels=null})}else{C.selected=this.$lis.index(this.$lis.filter("."+C.selectedClass)[0])}if(C.cookie){this._cookie(C.selected,C.cookie)}for(var G=0,M;M=this.$lis[G];G++){A(M)[A.inArray(G,C.disabled)!=-1&&!A(M).hasClass(C.selectedClass)?"addClass":"removeClass"](C.disabledClass)}if(C.cache===false){this.$tabs.removeData("cache.tabs")}var B,H;if(C.fx){if(C.fx.constructor==Array){B=C.fx[0];H=C.fx[1]}else{B=H=C.fx}}function D(P,Q){P.css({display:""});if(A.browser.msie&&Q.opacity){P[0].style.removeAttribute("filter")}}var K=H?function(P,Q){Q.animate(H,H.duration||"normal",function(){Q.removeClass(C.hideClass);D(Q,H);O._trigger("show",null,O.ui(P,Q[0]))})}:function(P,Q){Q.removeClass(C.hideClass);O._trigger("show",null,O.ui(P,Q[0]))};var L=B?function(Q,P,R){P.animate(B,B.duration||"normal",function(){P.addClass(C.hideClass);D(P,B);if(R){K(Q,R,P)}})}:function(Q,P,R){P.addClass(C.hideClass);if(R){K(Q,R)}};function F(R,T,P,S){var Q=[C.selectedClass];if(C.deselectable){Q.push(C.deselectableClass)}T.addClass(Q.join(" ")).siblings().removeClass(Q.join(" "));L(R,P,S)}this.$tabs.unbind(".tabs").bind(C.event+".tabs",function(){var S=A(this).parents("li:eq(0)"),P=O.$panels.filter(":visible"),R=A(O._sanitizeSelector(this.hash));if((S.hasClass(C.selectedClass)&&!C.deselectable)||S.hasClass(C.disabledClass)||A(this).hasClass(C.loadingClass)||O._trigger("select",null,O.ui(this,R[0]))===false){this.blur();return false}C.selected=O.$tabs.index(this);if(C.deselectable){if(S.hasClass(C.selectedClass)){O.options.selected=null;S.removeClass([C.selectedClass,C.deselectableClass].join(" "));O.$panels.stop();L(this,P);this.blur();return false}else{if(!P.length){O.$panels.stop();var Q=this;O.load(O.$tabs.index(this),function(){S.addClass([C.selectedClass,C.deselectableClass].join(" "));K(Q,R)});this.blur();return false}}}if(C.cookie){O._cookie(C.selected,C.cookie)}O.$panels.stop();if(R.length){var Q=this;O.load(O.$tabs.index(this),P.length?function(){F(Q,S,P,R)}:function(){S.addClass(C.selectedClass);K(Q,R)})}else{throw"jQuery UI Tabs: Mismatching fragment identifier."}if(A.browser.msie){this.blur()}return false});if(C.event!="click"){this.$tabs.bind("click.tabs",function(){return false})}},add:function(E,D,C){if(C==undefined){C=this.$tabs.length}var G=this.options;var I=A(G.tabTemplate.replace(/#\{href\}/g,E).replace(/#\{label\}/g,D));I.data("destroy.tabs",true);var H=E.indexOf("#")==0?E.replace("#",""):this._tabId(A("a:first-child",I)[0]);var F=A("#"+H);if(!F.length){F=A(G.panelTemplate).attr("id",H).addClass(G.hideClass).data("destroy.tabs",true)}F.addClass(G.panelClass);if(C>=this.$lis.length){I.appendTo(this.element);F.appendTo(this.element[0].parentNode)}else{I.insertBefore(this.$lis[C]);F.insertBefore(this.$panels[C])}G.disabled=A.map(G.disabled,function(K,J){return K>=C?++K:K});this._tabify();if(this.$tabs.length==1){I.addClass(G.selectedClass);F.removeClass(G.hideClass);var B=A.data(this.$tabs[0],"load.tabs");if(B){this.load(C,B)}}this._trigger("add",null,this.ui(this.$tabs[C],this.$panels[C]))},remove:function(B){var D=this.options,E=this.$lis.eq(B).remove(),C=this.$panels.eq(B).remove();if(E.hasClass(D.selectedClass)&&this.$tabs.length>1){this.select(B+(B+1<this.$tabs.length?1:-1))}D.disabled=A.map(A.grep(D.disabled,function(G,F){return G!=B}),function(G,F){return G>=B?--G:G});this._tabify();this._trigger("remove",null,this.ui(E.find("a")[0],C[0]))},enable:function(B){var C=this.options;if(A.inArray(B,C.disabled)==-1){return }var D=this.$lis.eq(B).removeClass(C.disabledClass);if(A.browser.safari){D.css("display","inline-block");setTimeout(function(){D.css("display","block")},0)}C.disabled=A.grep(C.disabled,function(F,E){return F!=B});this._trigger("enable",null,this.ui(this.$tabs[B],this.$panels[B]))},disable:function(C){var B=this,D=this.options;if(C!=D.selected){this.$lis.eq(C).addClass(D.disabledClass);D.disabled.push(C);D.disabled.sort();this._trigger("disable",null,this.ui(this.$tabs[C],this.$panels[C]))}},select:function(B){if(typeof B=="string"){B=this.$tabs.index(this.$tabs.filter("[href$="+B+"]")[0])}this.$tabs.eq(B).trigger(this.options.event+".tabs")},load:function(G,K){var L=this,D=this.options,E=this.$tabs.eq(G),J=E[0],H=K==undefined||K===false,B=E.data("load.tabs");K=K||function(){};if(!B||!H&&A.data(J,"cache.tabs")){K();return }var M=function(N){var O=A(N),P=O.find("*:last");return P.length&&P.is(":not(img)")&&P||O};var C=function(){L.$tabs.filter("."+D.loadingClass).removeClass(D.loadingClass).each(function(){if(D.spinner){M(this).parent().html(M(this).data("label.tabs"))}});L.xhr=null};if(D.spinner){var I=M(J).html();M(J).wrapInner("<em></em>").find("em").data("label.tabs",I).html(D.spinner)}var F=A.extend({},D.ajaxOptions,{url:B,success:function(P,N){A(L._sanitizeSelector(J.hash)).html(P);C();if(D.cache){A.data(J,"cache.tabs",true)}L._trigger("load",null,L.ui(L.$tabs[G],L.$panels[G]));try{D.ajaxOptions.success(P,N)}catch(O){}K()}});if(this.xhr){this.xhr.abort();C()}E.addClass(D.loadingClass);L.xhr=A.ajax(F)},url:function(C,B){this.$tabs.eq(C).removeData("cache.tabs").data("load.tabs",B)},ui:function(C,B){return{options:this.options,tab:C,panel:B,index:this.$tabs.index(C)}}});A.extend(A.ui.tabs,{version:"1.6",getter:"length",defaults:{ajaxOptions:null,cache:false,cookie:null,deselectable:false,deselectableClass:"ui-tabs-deselectable",disabled:[],disabledClass:"ui-tabs-disabled",event:"click",fx:null,hideClass:"ui-tabs-hide",idPrefix:"ui-tabs-",loadingClass:"ui-tabs-loading",navClass:"ui-tabs-nav",panelClass:"ui-tabs-panel",panelTemplate:"<div></div>",selectedClass:"ui-tabs-selected",spinner:"Loading…",tabTemplate:'<li><a href="#{href}"><span>#{label}</span></a></li>'}});A.extend(A.ui.tabs.prototype,{rotation:null,rotate:function(C,F){F=F||false;var B=this,E=this.options.selected;function G(){B.rotation=setInterval(function(){E=++E<B.$tabs.length?E:0;B.select(E)},C)}function D(H){if(!H||H.clientX){clearInterval(B.rotation)}}if(C){G();if(!F){this.$tabs.bind(this.options.event+".tabs",D)}else{this.$tabs.bind(this.options.event+".tabs",function(){D();E=B.options.selected;G()})}}else{D();this.$tabs.unbind(this.options.event+".tabs",D)}}})})(jQuery);/* + * jQuery UI Datepicker 1.6 + * + * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Datepicker + * + * Depends: + * ui.core.js + */ +(function($){$.extend($.ui,{datepicker:{version:"1.6"}});var PROP_NAME="datepicker";function Datepicker(){this.debug=false;this._curInst=null;this._keyEvent=false;this._disabledInputs=[];this._datepickerShowing=false;this._inDialog=false;this._mainDivId="ui-datepicker-div";this._inlineClass="ui-datepicker-inline";this._appendClass="ui-datepicker-append";this._triggerClass="ui-datepicker-trigger";this._dialogClass="ui-datepicker-dialog";this._promptClass="ui-datepicker-prompt";this._disableClass="ui-datepicker-disabled";this._unselectableClass="ui-datepicker-unselectable";this._currentClass="ui-datepicker-current-day";this._dayOverClass="ui-datepicker-days-cell-over";this._weekOverClass="ui-datepicker-week-over";this.regional=[];this.regional[""]={clearText:"Clear",clearStatus:"Erase the current date",closeText:"Close",closeStatus:"Close without change",prevText:"<Prev",prevStatus:"Show the previous month",prevBigText:"<<",prevBigStatus:"Show the previous year",nextText:"Next>",nextStatus:"Show the next month",nextBigText:">>",nextBigStatus:"Show the next year",currentText:"Today",currentStatus:"Show the current month",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],monthStatus:"Show a different month",yearStatus:"Show a different year",weekHeader:"Wk",weekStatus:"Week of the year",dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],dayStatus:"Set DD as first week day",dateStatus:"Select DD, M d",dateFormat:"mm/dd/yy",firstDay:0,initStatus:"Select a date",isRTL:false};this._defaults={showOn:"focus",showAnim:"show",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:false,closeAtTop:true,mandatory:false,hideIfNoPrevNext:false,navigationAsDateFormat:false,showBigPrevNext:false,gotoCurrent:false,changeMonth:true,changeYear:true,showMonthAfterYear:false,yearRange:"-10:+10",changeFirstDay:true,highlightWeek:false,showOtherMonths:false,showWeeks:false,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",showStatus:false,statusForDate:this.dateStatus,minDate:null,maxDate:null,duration:"normal",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,rangeSelect:false,rangeSeparator:" - ",altField:"",altFormat:"",constrainInput:true};$.extend(this._defaults,this.regional[""]);this.dpDiv=$('<div id="'+this._mainDivId+'" style="display: none;"></div>')}$.extend(Datepicker.prototype,{markerClassName:"hasDatepicker",log:function(){if(this.debug){console.log.apply("",arguments)}},setDefaults:function(settings){extendRemove(this._defaults,settings||{});return this},_attachDatepicker:function(target,settings){var inlineSettings=null;for(var attrName in this._defaults){var attrValue=target.getAttribute("date:"+attrName);if(attrValue){inlineSettings=inlineSettings||{};try{inlineSettings[attrName]=eval(attrValue)}catch(err){inlineSettings[attrName]=attrValue}}}var nodeName=target.nodeName.toLowerCase();var inline=(nodeName=="div"||nodeName=="span");if(!target.id){target.id="dp"+(++this.uuid)}var inst=this._newInst($(target),inline);inst.settings=$.extend({},settings||{},inlineSettings||{});if(nodeName=="input"){this._connectDatepicker(target,inst)}else{if(inline){this._inlineDatepicker(target,inst)}}},_newInst:function(target,inline){var id=target[0].id.replace(/([:\[\]\.])/g,"\\\\$1");return{id:id,input:target,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:inline,dpDiv:(!inline?this.dpDiv:$('<div class="'+this._inlineClass+'"></div>'))}},_connectDatepicker:function(target,inst){var input=$(target);if(input.hasClass(this.markerClassName)){return }var appendText=this._get(inst,"appendText");var isRTL=this._get(inst,"isRTL");if(appendText){input[isRTL?"before":"after"]('<span class="'+this._appendClass+'">'+appendText+"</span>")}var showOn=this._get(inst,"showOn");if(showOn=="focus"||showOn=="both"){input.focus(this._showDatepicker)}if(showOn=="button"||showOn=="both"){var buttonText=this._get(inst,"buttonText");var buttonImage=this._get(inst,"buttonImage");var trigger=$(this._get(inst,"buttonImageOnly")?$("<img/>").addClass(this._triggerClass).attr({src:buttonImage,alt:buttonText,title:buttonText}):$('<button type="button"></button>').addClass(this._triggerClass).html(buttonImage==""?buttonText:$("<img/>").attr({src:buttonImage,alt:buttonText,title:buttonText})));input[isRTL?"before":"after"](trigger);trigger.click(function(){if($.datepicker._datepickerShowing&&$.datepicker._lastInput==target){$.datepicker._hideDatepicker()}else{$.datepicker._showDatepicker(target)}return false})}input.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).bind("setData.datepicker",function(event,key,value){inst.settings[key]=value}).bind("getData.datepicker",function(event,key){return this._get(inst,key)});$.data(target,PROP_NAME,inst)},_inlineDatepicker:function(target,inst){var divSpan=$(target);if(divSpan.hasClass(this.markerClassName)){return }divSpan.addClass(this.markerClassName).append(inst.dpDiv).bind("setData.datepicker",function(event,key,value){inst.settings[key]=value}).bind("getData.datepicker",function(event,key){return this._get(inst,key)});$.data(target,PROP_NAME,inst);this._setDate(inst,this._getDefaultDate(inst));this._updateDatepicker(inst);this._updateAlternate(inst)},_dialogDatepicker:function(input,dateText,onSelect,settings,pos){var inst=this._dialogInst;if(!inst){var id="dp"+(++this.uuid);this._dialogInput=$('<input type="text" id="'+id+'" size="1" style="position: absolute; top: -100px;"/>');this._dialogInput.keydown(this._doKeyDown);$("body").append(this._dialogInput);inst=this._dialogInst=this._newInst(this._dialogInput,false);inst.settings={};$.data(this._dialogInput[0],PROP_NAME,inst)}extendRemove(inst.settings,settings||{});this._dialogInput.val(dateText);this._pos=(pos?(pos.length?pos:[pos.pageX,pos.pageY]):null);if(!this._pos){var browserWidth=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth;var browserHeight=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight;var scrollX=document.documentElement.scrollLeft||document.body.scrollLeft;var scrollY=document.documentElement.scrollTop||document.body.scrollTop;this._pos=[(browserWidth/2)-100+scrollX,(browserHeight/2)-150+scrollY]}this._dialogInput.css("left",this._pos[0]+"px").css("top",this._pos[1]+"px");inst.settings.onSelect=onSelect;this._inDialog=true;this.dpDiv.addClass(this._dialogClass);this._showDatepicker(this._dialogInput[0]);if($.blockUI){$.blockUI(this.dpDiv)}$.data(this._dialogInput[0],PROP_NAME,inst);return this},_destroyDatepicker:function(target){var $target=$(target);if(!$target.hasClass(this.markerClassName)){return }var nodeName=target.nodeName.toLowerCase();$.removeData(target,PROP_NAME);if(nodeName=="input"){$target.siblings("."+this._appendClass).remove().end().siblings("."+this._triggerClass).remove().end().removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress)}else{if(nodeName=="div"||nodeName=="span"){$target.removeClass(this.markerClassName).empty()}}},_enableDatepicker:function(target){var $target=$(target);if(!$target.hasClass(this.markerClassName)){return }var nodeName=target.nodeName.toLowerCase();if(nodeName=="input"){target.disabled=false;$target.siblings("button."+this._triggerClass).each(function(){this.disabled=false}).end().siblings("img."+this._triggerClass).css({opacity:"1.0",cursor:""})}else{if(nodeName=="div"||nodeName=="span"){$target.children("."+this._disableClass).remove()}}this._disabledInputs=$.map(this._disabledInputs,function(value){return(value==target?null:value)})},_disableDatepicker:function(target){var $target=$(target);if(!$target.hasClass(this.markerClassName)){return }var nodeName=target.nodeName.toLowerCase();if(nodeName=="input"){target.disabled=true;$target.siblings("button."+this._triggerClass).each(function(){this.disabled=true}).end().siblings("img."+this._triggerClass).css({opacity:"0.5",cursor:"default"})}else{if(nodeName=="div"||nodeName=="span"){var inline=$target.children("."+this._inlineClass);var offset=inline.offset();var relOffset={left:0,top:0};inline.parents().each(function(){if($(this).css("position")=="relative"){relOffset=$(this).offset();return false}});$target.prepend('<div class="'+this._disableClass+'" style="'+($.browser.msie?"background-color: transparent; ":"")+"width: "+inline.width()+"px; height: "+inline.height()+"px; left: "+(offset.left-relOffset.left)+"px; top: "+(offset.top-relOffset.top)+'px;"></div>')}}this._disabledInputs=$.map(this._disabledInputs,function(value){return(value==target?null:value)});this._disabledInputs[this._disabledInputs.length]=target},_isDisabledDatepicker:function(target){if(!target){return false}for(var i=0;i<this._disabledInputs.length;i++){if(this._disabledInputs[i]==target){return true}}return false},_getInst:function(target){try{return $.data(target,PROP_NAME)}catch(err){throw"Missing instance data for this datepicker"}},_optionDatepicker:function(target,name,value){var settings=name||{};if(typeof name=="string"){settings={};settings[name]=value}var inst=this._getInst(target);if(inst){if(this._curInst==inst){this._hideDatepicker(null)}extendRemove(inst.settings,settings);var date=new Date();extendRemove(inst,{rangeStart:null,endDay:null,endMonth:null,endYear:null,selectedDay:date.getDate(),selectedMonth:date.getMonth(),selectedYear:date.getFullYear(),currentDay:date.getDate(),currentMonth:date.getMonth(),currentYear:date.getFullYear(),drawMonth:date.getMonth(),drawYear:date.getFullYear()});this._updateDatepicker(inst)}},_changeDatepicker:function(target,name,value){this._optionDatepicker(target,name,value)},_refreshDatepicker:function(target){var inst=this._getInst(target);if(inst){this._updateDatepicker(inst)}},_setDateDatepicker:function(target,date,endDate){var inst=this._getInst(target);if(inst){this._setDate(inst,date,endDate);this._updateDatepicker(inst);this._updateAlternate(inst)}},_getDateDatepicker:function(target){var inst=this._getInst(target);if(inst&&!inst.inline){this._setDateFromField(inst)}return(inst?this._getDate(inst):null)},_doKeyDown:function(event){var inst=$.datepicker._getInst(event.target);var handled=true;inst._keyEvent=true;if($.datepicker._datepickerShowing){switch(event.keyCode){case 9:$.datepicker._hideDatepicker(null,"");break;case 13:var sel=$("td."+$.datepicker._dayOverClass+", td."+$.datepicker._currentClass,inst.dpDiv);if(sel[0]){$.datepicker._selectDay(event.target,inst.selectedMonth,inst.selectedYear,sel[0])}else{$.datepicker._hideDatepicker(null,$.datepicker._get(inst,"duration"))}return false;break;case 27:$.datepicker._hideDatepicker(null,$.datepicker._get(inst,"duration"));break;case 33:$.datepicker._adjustDate(event.target,(event.ctrlKey?-$.datepicker._get(inst,"stepBigMonths"):-$.datepicker._get(inst,"stepMonths")),"M");break;case 34:$.datepicker._adjustDate(event.target,(event.ctrlKey?+$.datepicker._get(inst,"stepBigMonths"):+$.datepicker._get(inst,"stepMonths")),"M");break;case 35:if(event.ctrlKey||event.metaKey){$.datepicker._clearDate(event.target)}handled=event.ctrlKey||event.metaKey;break;case 36:if(event.ctrlKey||event.metaKey){$.datepicker._gotoToday(event.target)}handled=event.ctrlKey||event.metaKey;break;case 37:if(event.ctrlKey||event.metaKey){$.datepicker._adjustDate(event.target,-1,"D")}handled=event.ctrlKey||event.metaKey;if(event.originalEvent.altKey){$.datepicker._adjustDate(event.target,(event.ctrlKey?-$.datepicker._get(inst,"stepBigMonths"):-$.datepicker._get(inst,"stepMonths")),"M")}break;case 38:if(event.ctrlKey||event.metaKey){$.datepicker._adjustDate(event.target,-7,"D")}handled=event.ctrlKey||event.metaKey;break;case 39:if(event.ctrlKey||event.metaKey){$.datepicker._adjustDate(event.target,+1,"D")}handled=event.ctrlKey||event.metaKey;if(event.originalEvent.altKey){$.datepicker._adjustDate(event.target,(event.ctrlKey?+$.datepicker._get(inst,"stepBigMonths"):+$.datepicker._get(inst,"stepMonths")),"M")}break;case 40:if(event.ctrlKey||event.metaKey){$.datepicker._adjustDate(event.target,+7,"D")}handled=event.ctrlKey||event.metaKey;break;default:handled=false}}else{if(event.keyCode==36&&event.ctrlKey){$.datepicker._showDatepicker(this)}else{handled=false}}if(handled){event.preventDefault();event.stopPropagation()}},_doKeyPress:function(event){var inst=$.datepicker._getInst(event.target);if($.datepicker._get(inst,"constrainInput")){var chars=$.datepicker._possibleChars($.datepicker._get(inst,"dateFormat"));var chr=String.fromCharCode(event.charCode==undefined?event.keyCode:event.charCode);return event.ctrlKey||(chr<" "||!chars||chars.indexOf(chr)>-1)}},_showDatepicker:function(input){input=input.target||input;if(input.nodeName.toLowerCase()!="input"){input=$("input",input.parentNode)[0]}if($.datepicker._isDisabledDatepicker(input)||$.datepicker._lastInput==input){return }var inst=$.datepicker._getInst(input);var beforeShow=$.datepicker._get(inst,"beforeShow");extendRemove(inst.settings,(beforeShow?beforeShow.apply(input,[input,inst]):{}));$.datepicker._hideDatepicker(null,"");$.datepicker._lastInput=input;$.datepicker._setDateFromField(inst);if($.datepicker._inDialog){input.value=""}if(!$.datepicker._pos){$.datepicker._pos=$.datepicker._findPos(input);$.datepicker._pos[1]+=input.offsetHeight}var isFixed=false;$(input).parents().each(function(){isFixed|=$(this).css("position")=="fixed";return !isFixed});if(isFixed&&$.browser.opera){$.datepicker._pos[0]-=document.documentElement.scrollLeft;$.datepicker._pos[1]-=document.documentElement.scrollTop}var offset={left:$.datepicker._pos[0],top:$.datepicker._pos[1]};$.datepicker._pos=null;inst.rangeStart=null;inst.dpDiv.css({position:"absolute",display:"block",top:"-1000px"});$.datepicker._updateDatepicker(inst);inst.dpDiv.width($.datepicker._getNumberOfMonths(inst)[1]*$(".ui-datepicker",inst.dpDiv[0])[0].offsetWidth);offset=$.datepicker._checkOffset(inst,offset,isFixed);inst.dpDiv.css({position:($.datepicker._inDialog&&$.blockUI?"static":(isFixed?"fixed":"absolute")),display:"none",left:offset.left+"px",top:offset.top+"px"});if(!inst.inline){var showAnim=$.datepicker._get(inst,"showAnim")||"show";var duration=$.datepicker._get(inst,"duration");var postProcess=function(){$.datepicker._datepickerShowing=true;};if($.effects&&$.effects[showAnim]){inst.dpDiv.show(showAnim,$.datepicker._get(inst,"showOptions"),duration,postProcess)}else{inst.dpDiv[showAnim](duration,postProcess)}if(duration==""){postProcess()}if(inst.input[0].type!="hidden"){inst.input[0].focus()}$.datepicker._curInst=inst}},_updateDatepicker:function(inst){var dims={width:inst.dpDiv.width()+4,height:inst.dpDiv.height()+4};inst.dpDiv.empty().append(this._generateHTML(inst));var numMonths=this._getNumberOfMonths(inst);inst.dpDiv[(numMonths[0]!=1||numMonths[1]!=1?"add":"remove")+"Class"]("ui-datepicker-multi");inst.dpDiv[(this._get(inst,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl");if(inst.input&&inst.input[0].type!="hidden"&&inst==$.datepicker._curInst){$(inst.input[0]).focus()}},_checkOffset:function(inst,offset,isFixed){var pos=inst.input?this._findPos(inst.input[0]):null;var browserWidth=window.innerWidth||(document.documentElement?document.documentElement.clientWidth:document.body.clientWidth);var browserHeight=window.innerHeight||(document.documentElement?document.documentElement.clientHeight:document.body.clientHeight);var scrollX=document.documentElement.scrollLeft||document.body.scrollLeft;var scrollY=document.documentElement.scrollTop||document.body.scrollTop;if(this._get(inst,"isRTL")||(offset.left+inst.dpDiv.width()-scrollX)>browserWidth){offset.left=Math.max((isFixed?0:scrollX),pos[0]+(inst.input?inst.input.width():0)-(isFixed?scrollX:0)-inst.dpDiv.width()-(isFixed&&$.browser.opera?document.documentElement.scrollLeft:0))}else{offset.left-=(isFixed?scrollX:0)}if((offset.top+inst.dpDiv.height()-scrollY)>browserHeight){offset.top=Math.max((isFixed?0:scrollY),pos[1]-(isFixed?scrollY:0)-(this._inDialog?0:inst.dpDiv.height())-(isFixed&&$.browser.opera?document.documentElement.scrollTop:0))}else{offset.top-=(isFixed?scrollY:0)}return offset},_findPos:function(obj){while(obj&&(obj.type=="hidden"||obj.nodeType!=1)){obj=obj.nextSibling}var position=$(obj).offset();return[position.left,position.top]},_hideDatepicker:function(input,duration){var inst=this._curInst;if(!inst||(input&&inst!=$.data(input,PROP_NAME))){return }var rangeSelect=this._get(inst,"rangeSelect");if(rangeSelect&&inst.stayOpen){this._selectDate("#"+inst.id,this._formatDate(inst,inst.currentDay,inst.currentMonth,inst.currentYear))}inst.stayOpen=false;if(this._datepickerShowing){duration=(duration!=null?duration:this._get(inst,"duration"));var showAnim=this._get(inst,"showAnim");var postProcess=function(){$.datepicker._tidyDialog(inst)};if(duration!=""&&$.effects&&$.effects[showAnim]){inst.dpDiv.hide(showAnim,$.datepicker._get(inst,"showOptions"),duration,postProcess)}else{inst.dpDiv[(duration==""?"hide":(showAnim=="slideDown"?"slideUp":(showAnim=="fadeIn"?"fadeOut":"hide")))](duration,postProcess)}if(duration==""){this._tidyDialog(inst)}var onClose=this._get(inst,"onClose");if(onClose){onClose.apply((inst.input?inst.input[0]:null),[(inst.input?inst.input.val():""),inst])}this._datepickerShowing=false;this._lastInput=null;inst.settings.prompt=null;if(this._inDialog){this._dialogInput.css({position:"absolute",left:"0",top:"-100px"});if($.blockUI){$.unblockUI();$("body").append(this.dpDiv)}}this._inDialog=false}this._curInst=null},_tidyDialog:function(inst){inst.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker");$("."+this._promptClass,inst.dpDiv).remove()},_checkExternalClick:function(event){if(!$.datepicker._curInst){return }var $target=$(event.target);if(($target.parents("#"+$.datepicker._mainDivId).length==0)&&!$target.hasClass($.datepicker.markerClassName)&&!$target.hasClass($.datepicker._triggerClass)&&$.datepicker._datepickerShowing&&!($.datepicker._inDialog&&$.blockUI)){$.datepicker._hideDatepicker(null,"")}},_adjustDate:function(id,offset,period){var target=$(id);var inst=this._getInst(target[0]);this._adjustInstDate(inst,offset,period);this._updateDatepicker(inst)},_gotoToday:function(id){var target=$(id);var inst=this._getInst(target[0]);if(this._get(inst,"gotoCurrent")&&inst.currentDay){inst.selectedDay=inst.currentDay;inst.drawMonth=inst.selectedMonth=inst.currentMonth;inst.drawYear=inst.selectedYear=inst.currentYear}else{var date=new Date();inst.selectedDay=date.getDate();inst.drawMonth=inst.selectedMonth=date.getMonth();inst.drawYear=inst.selectedYear=date.getFullYear()}this._notifyChange(inst);this._adjustDate(target)},_selectMonthYear:function(id,select,period){var target=$(id);var inst=this._getInst(target[0]);inst._selectingMonthYear=false;inst["selected"+(period=="M"?"Month":"Year")]=inst["draw"+(period=="M"?"Month":"Year")]=parseInt(select.options[select.selectedIndex].value,10);this._notifyChange(inst);this._adjustDate(target)},_clickMonthYear:function(id){var target=$(id);var inst=this._getInst(target[0]);if(inst.input&&inst._selectingMonthYear&&!$.browser.msie){inst.input[0].focus()}inst._selectingMonthYear=!inst._selectingMonthYear},_changeFirstDay:function(id,day){var target=$(id);var inst=this._getInst(target[0]);inst.settings.firstDay=day;this._updateDatepicker(inst)},_selectDay:function(id,month,year,td){if($(td).hasClass(this._unselectableClass)){return }var target=$(id);var inst=this._getInst(target[0]);var rangeSelect=this._get(inst,"rangeSelect");if(rangeSelect){inst.stayOpen=!inst.stayOpen;if(inst.stayOpen){$(".ui-datepicker td",inst.dpDiv).removeClass(this._currentClass);$(td).addClass(this._currentClass)}}inst.selectedDay=inst.currentDay=$("a",td).html();inst.selectedMonth=inst.currentMonth=month;inst.selectedYear=inst.currentYear=year;if(inst.stayOpen){inst.endDay=inst.endMonth=inst.endYear=null}else{if(rangeSelect){inst.endDay=inst.currentDay;inst.endMonth=inst.currentMonth;inst.endYear=inst.currentYear}}this._selectDate(id,this._formatDate(inst,inst.currentDay,inst.currentMonth,inst.currentYear));if(inst.stayOpen){inst.rangeStart=this._daylightSavingAdjust(new Date(inst.currentYear,inst.currentMonth,inst.currentDay));this._updateDatepicker(inst)}else{if(rangeSelect){inst.selectedDay=inst.currentDay=inst.rangeStart.getDate();inst.selectedMonth=inst.currentMonth=inst.rangeStart.getMonth();inst.selectedYear=inst.currentYear=inst.rangeStart.getFullYear();inst.rangeStart=null;if(inst.inline){this._updateDatepicker(inst)}}}},_clearDate:function(id){var target=$(id);var inst=this._getInst(target[0]);if(this._get(inst,"mandatory")){return }inst.stayOpen=false;inst.endDay=inst.endMonth=inst.endYear=inst.rangeStart=null;this._selectDate(target,"")},_selectDate:function(id,dateStr){var target=$(id);var inst=this._getInst(target[0]);dateStr=(dateStr!=null?dateStr:this._formatDate(inst));if(this._get(inst,"rangeSelect")&&dateStr){dateStr=(inst.rangeStart?this._formatDate(inst,inst.rangeStart):dateStr)+this._get(inst,"rangeSeparator")+dateStr}if(inst.input){inst.input.val(dateStr)}this._updateAlternate(inst);var onSelect=this._get(inst,"onSelect");if(onSelect){onSelect.apply((inst.input?inst.input[0]:null),[dateStr,inst])}else{if(inst.input){inst.input.trigger("change")}}if(inst.inline){this._updateDatepicker(inst)}else{if(!inst.stayOpen){this._hideDatepicker(null,this._get(inst,"duration"));this._lastInput=inst.input[0];if(typeof (inst.input[0])!="object"){inst.input[0].focus()}this._lastInput=null}}},_updateAlternate:function(inst){var altField=this._get(inst,"altField");if(altField){var altFormat=this._get(inst,"altFormat")||this._get(inst,"dateFormat");var date=this._getDate(inst);dateStr=(isArray(date)?(!date[0]&&!date[1]?"":this.formatDate(altFormat,date[0],this._getFormatConfig(inst))+this._get(inst,"rangeSeparator")+this.formatDate(altFormat,date[1]||date[0],this._getFormatConfig(inst))):this.formatDate(altFormat,date,this._getFormatConfig(inst)));$(altField).each(function(){$(this).val(dateStr)})}},noWeekends:function(date){var day=date.getDay();return[(day>0&&day<6),""]},iso8601Week:function(date){var checkDate=new Date(date.getFullYear(),date.getMonth(),date.getDate());var firstMon=new Date(checkDate.getFullYear(),1-1,4);var firstDay=firstMon.getDay()||7;firstMon.setDate(firstMon.getDate()+1-firstDay);if(firstDay<4&&checkDate<firstMon){checkDate.setDate(checkDate.getDate()-3);return $.datepicker.iso8601Week(checkDate)}else{if(checkDate>new Date(checkDate.getFullYear(),12-1,28)){firstDay=new Date(checkDate.getFullYear()+1,1-1,4).getDay()||7;if(firstDay>4&&(checkDate.getDay()||7)<firstDay-3){return 1}}}return Math.floor(((checkDate-firstMon)/86400000)/7)+1},dateStatus:function(date,inst){return $.datepicker.formatDate($.datepicker._get(inst,"dateStatus"),date,$.datepicker._getFormatConfig(inst))},parseDate:function(format,value,settings){if(format==null||value==null){throw"Invalid arguments"}value=(typeof value=="object"?value.toString():value+"");if(value==""){return null}var shortYearCutoff=(settings?settings.shortYearCutoff:null)||this._defaults.shortYearCutoff;var dayNamesShort=(settings?settings.dayNamesShort:null)||this._defaults.dayNamesShort;var dayNames=(settings?settings.dayNames:null)||this._defaults.dayNames;var monthNamesShort=(settings?settings.monthNamesShort:null)||this._defaults.monthNamesShort;var monthNames=(settings?settings.monthNames:null)||this._defaults.monthNames;var year=-1;var month=-1;var day=-1;var doy=-1;var literal=false;var lookAhead=function(match){var matches=(iFormat+1<format.length&&format.charAt(iFormat+1)==match);if(matches){iFormat++}return matches};var getNumber=function(match){lookAhead(match);var origSize=(match=="@"?14:(match=="y"?4:(match=="o"?3:2)));var size=origSize;var num=0;while(size>0&&iValue<value.length&&value.charAt(iValue)>="0"&&value.charAt(iValue)<="9"){num=num*10+parseInt(value.charAt(iValue++),10);size--}if(size==origSize){throw"Missing number at position "+iValue}return num};var getName=function(match,shortNames,longNames){var names=(lookAhead(match)?longNames:shortNames);var size=0;for(var j=0;j<names.length;j++){size=Math.max(size,names[j].length)}var name="";var iInit=iValue;while(size>0&&iValue<value.length){name+=value.charAt(iValue++);for(var i=0;i<names.length;i++){if(name==names[i]){return i+1}}size--}throw"Unknown name at position "+iInit};var checkLiteral=function(){if(value.charAt(iValue)!=format.charAt(iFormat)){throw"Unexpected literal at position "+iValue}iValue++};var iValue=0;for(var iFormat=0;iFormat<format.length;iFormat++){if(literal){if(format.charAt(iFormat)=="'"&&!lookAhead("'")){literal=false}else{checkLiteral()}}else{switch(format.charAt(iFormat)){case"d":day=getNumber("d");break;case"D":getName("D",dayNamesShort,dayNames);break;case"o":doy=getNumber("o");break;case"m":month=getNumber("m");break;case"M":month=getName("M",monthNamesShort,monthNames);break;case"y":year=getNumber("y");break;case"@":var date=new Date(getNumber("@"));year=date.getFullYear();month=date.getMonth()+1;day=date.getDate();break;case"'":if(lookAhead("'")){checkLiteral()}else{literal=true}break;default:checkLiteral()}}}if(year==-1){year=new Date().getFullYear()}else{if(year<100){year+=new Date().getFullYear()-new Date().getFullYear()%100+(year<=shortYearCutoff?0:-100)}}if(doy>-1){month=1;day=doy;do{var dim=this._getDaysInMonth(year,month-1);if(day<=dim){break}month++;day-=dim}while(true)}var date=this._daylightSavingAdjust(new Date(year,month-1,day));if(date.getFullYear()!=year||date.getMonth()+1!=month||date.getDate()!=day){throw"Invalid date"}return date},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TIMESTAMP:"@",W3C:"yy-mm-dd",formatDate:function(format,date,settings){if(!date){return""}var dayNamesShort=(settings?settings.dayNamesShort:null)||this._defaults.dayNamesShort;var dayNames=(settings?settings.dayNames:null)||this._defaults.dayNames;var monthNamesShort=(settings?settings.monthNamesShort:null)||this._defaults.monthNamesShort;var monthNames=(settings?settings.monthNames:null)||this._defaults.monthNames;var lookAhead=function(match){var matches=(iFormat+1<format.length&&format.charAt(iFormat+1)==match);if(matches){iFormat++}return matches};var formatNumber=function(match,value,len){var num=""+value;if(lookAhead(match)){while(num.length<len){num="0"+num}}return num};var formatName=function(match,value,shortNames,longNames){return(lookAhead(match)?longNames[value]:shortNames[value])};var output="";var literal=false;if(date){for(var iFormat=0;iFormat<format.length;iFormat++){if(literal){if(format.charAt(iFormat)=="'"&&!lookAhead("'")){literal=false}else{output+=format.charAt(iFormat)}}else{switch(format.charAt(iFormat)){case"d":output+=formatNumber("d",date.getDate(),2);break;case"D":output+=formatName("D",date.getDay(),dayNamesShort,dayNames);break;case"o":var doy=date.getDate();for(var m=date.getMonth()-1;m>=0;m--){doy+=this._getDaysInMonth(date.getFullYear(),m)}output+=formatNumber("o",doy,3);break;case"m":output+=formatNumber("m",date.getMonth()+1,2);break;case"M":output+=formatName("M",date.getMonth(),monthNamesShort,monthNames);break;case"y":output+=(lookAhead("y")?date.getFullYear():(date.getYear()%100<10?"0":"")+date.getYear()%100);break;case"@":output+=date.getTime();break;case"'":if(lookAhead("'")){output+="'"}else{literal=true}break;default:output+=format.charAt(iFormat)}}}}return output},_possibleChars:function(format){var chars="";var literal=false;for(var iFormat=0;iFormat<format.length;iFormat++){if(literal){if(format.charAt(iFormat)=="'"&&!lookAhead("'")){literal=false}else{chars+=format.charAt(iFormat)}}else{switch(format.charAt(iFormat)){case"d":case"m":case"y":case"@":chars+="0123456789";break;case"D":case"M":return null;case"'":if(lookAhead("'")){chars+="'"}else{literal=true}break;default:chars+=format.charAt(iFormat)}}}return chars},_get:function(inst,name){return inst.settings[name]!==undefined?inst.settings[name]:this._defaults[name]},_setDateFromField:function(inst){var dateFormat=this._get(inst,"dateFormat");var dates=inst.input?inst.input.val().split(this._get(inst,"rangeSeparator")):null;inst.endDay=inst.endMonth=inst.endYear=null;var date=defaultDate=this._getDefaultDate(inst);if(dates.length>0){var settings=this._getFormatConfig(inst);if(dates.length>1){date=this.parseDate(dateFormat,dates[1],settings)||defaultDate;inst.endDay=date.getDate();inst.endMonth=date.getMonth();inst.endYear=date.getFullYear()}try{date=this.parseDate(dateFormat,dates[0],settings)||defaultDate}catch(event){this.log(event);date=defaultDate}}inst.selectedDay=date.getDate();inst.drawMonth=inst.selectedMonth=date.getMonth();inst.drawYear=inst.selectedYear=date.getFullYear();inst.currentDay=(dates[0]?date.getDate():0);inst.currentMonth=(dates[0]?date.getMonth():0);inst.currentYear=(dates[0]?date.getFullYear():0);this._adjustInstDate(inst)},_getDefaultDate:function(inst){var date=this._determineDate(this._get(inst,"defaultDate"),new Date());var minDate=this._getMinMaxDate(inst,"min",true);var maxDate=this._getMinMaxDate(inst,"max");date=(minDate&&date<minDate?minDate:date);date=(maxDate&&date>maxDate?maxDate:date);return date},_determineDate:function(date,defaultDate){var offsetNumeric=function(offset){var date=new Date();date.setDate(date.getDate()+offset);return date};var offsetString=function(offset,getDaysInMonth){var date=new Date();var year=date.getFullYear();var month=date.getMonth();var day=date.getDate();var pattern=/([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g;var matches=pattern.exec(offset);while(matches){switch(matches[2]||"d"){case"d":case"D":day+=parseInt(matches[1],10);break;case"w":case"W":day+=parseInt(matches[1],10)*7;break;case"m":case"M":month+=parseInt(matches[1],10);day=Math.min(day,getDaysInMonth(year,month));break;case"y":case"Y":year+=parseInt(matches[1],10);day=Math.min(day,getDaysInMonth(year,month));break}matches=pattern.exec(offset)}return new Date(year,month,day)};date=(date==null?defaultDate:(typeof date=="string"?offsetString(date,this._getDaysInMonth):(typeof date=="number"?(isNaN(date)?defaultDate:offsetNumeric(date)):date)));date=(date&&date.toString()=="Invalid Date"?defaultDate:date);if(date){date.setHours(0);date.setMinutes(0);date.setSeconds(0);date.setMilliseconds(0)}return this._daylightSavingAdjust(date)},_daylightSavingAdjust:function(date){if(!date){return null}date.setHours(date.getHours()>12?date.getHours()+2:0);return date},_setDate:function(inst,date,endDate){var clear=!(date);var origMonth=inst.selectedMonth;var origYear=inst.selectedYear;date=this._determineDate(date,new Date());inst.selectedDay=inst.currentDay=date.getDate();inst.drawMonth=inst.selectedMonth=inst.currentMonth=date.getMonth();inst.drawYear=inst.selectedYear=inst.currentYear=date.getFullYear();if(this._get(inst,"rangeSelect")){if(endDate){endDate=this._determineDate(endDate,null);inst.endDay=endDate.getDate();inst.endMonth=endDate.getMonth();inst.endYear=endDate.getFullYear()}else{inst.endDay=inst.currentDay;inst.endMonth=inst.currentMonth;inst.endYear=inst.currentYear}}if(origMonth!=inst.selectedMonth||origYear!=inst.selectedYear){this._notifyChange(inst)}this._adjustInstDate(inst);if(inst.input){inst.input.val(clear?"":this._formatDate(inst)+(!this._get(inst,"rangeSelect")?"":this._get(inst,"rangeSeparator")+this._formatDate(inst,inst.endDay,inst.endMonth,inst.endYear)))}},_getDate:function(inst){var startDate=(!inst.currentYear||(inst.input&&inst.input.val()=="")?null:this._daylightSavingAdjust(new Date(inst.currentYear,inst.currentMonth,inst.currentDay)));if(this._get(inst,"rangeSelect")){return[inst.rangeStart||startDate,(!inst.endYear?inst.rangeStart||startDate:this._daylightSavingAdjust(new Date(inst.endYear,inst.endMonth,inst.endDay)))]}else{return startDate}},_generateHTML:function(inst){var today=new Date();today=this._daylightSavingAdjust(new Date(today.getFullYear(),today.getMonth(),today.getDate()));var showStatus=this._get(inst,"showStatus");var initStatus=this._get(inst,"initStatus")||" ";var isRTL=this._get(inst,"isRTL");var clear=(this._get(inst,"mandatory")?"":'<div class="ui-datepicker-clear"><a onclick="jQuery.datepicker._clearDate(\'#'+inst.id+"');\""+this._addStatus(showStatus,inst.id,this._get(inst,"clearStatus"),initStatus)+">"+this._get(inst,"clearText")+"</a></div>");var controls='<div class="ui-datepicker-control">'+(isRTL?"":clear)+'<div class="ui-datepicker-close"><a onclick="jQuery.datepicker._hideDatepicker();"'+this._addStatus(showStatus,inst.id,this._get(inst,"closeStatus"),initStatus)+">"+this._get(inst,"closeText")+"</a></div>"+(isRTL?clear:"")+"</div>";var prompt=this._get(inst,"prompt");var closeAtTop=this._get(inst,"closeAtTop");var hideIfNoPrevNext=this._get(inst,"hideIfNoPrevNext");var navigationAsDateFormat=this._get(inst,"navigationAsDateFormat");var showBigPrevNext=this._get(inst,"showBigPrevNext");var numMonths=this._getNumberOfMonths(inst);var showCurrentAtPos=this._get(inst,"showCurrentAtPos");var stepMonths=this._get(inst,"stepMonths");var stepBigMonths=this._get(inst,"stepBigMonths");var isMultiMonth=(numMonths[0]!=1||numMonths[1]!=1);var currentDate=this._daylightSavingAdjust((!inst.currentDay?new Date(9999,9,9):new Date(inst.currentYear,inst.currentMonth,inst.currentDay)));var minDate=this._getMinMaxDate(inst,"min",true);var maxDate=this._getMinMaxDate(inst,"max");var drawMonth=inst.drawMonth-showCurrentAtPos;var drawYear=inst.drawYear;if(drawMonth<0){drawMonth+=12;drawYear--}if(maxDate){var maxDraw=this._daylightSavingAdjust(new Date(maxDate.getFullYear(),maxDate.getMonth()-numMonths[1]+1,maxDate.getDate()));maxDraw=(minDate&&maxDraw<minDate?minDate:maxDraw);while(this._daylightSavingAdjust(new Date(drawYear,drawMonth,1))>maxDraw){drawMonth--;if(drawMonth<0){drawMonth=11;drawYear--}}}var prevText=this._get(inst,"prevText");prevText=(!navigationAsDateFormat?prevText:this.formatDate(prevText,this._daylightSavingAdjust(new Date(drawYear,drawMonth-stepMonths,1)),this._getFormatConfig(inst)));var prevBigText=(showBigPrevNext?this._get(inst,"prevBigText"):"");prevBigText=(!navigationAsDateFormat?prevBigText:this.formatDate(prevBigText,this._daylightSavingAdjust(new Date(drawYear,drawMonth-stepBigMonths,1)),this._getFormatConfig(inst)));var prev='<div class="ui-datepicker-prev">'+(this._canAdjustMonth(inst,-1,drawYear,drawMonth)?(showBigPrevNext?"<a onclick=\"jQuery.datepicker._adjustDate('#"+inst.id+"', -"+stepBigMonths+", 'M');\""+this._addStatus(showStatus,inst.id,this._get(inst,"prevBigStatus"),initStatus)+">"+prevBigText+"</a>":"")+"<a onclick=\"jQuery.datepicker._adjustDate('#"+inst.id+"', -"+stepMonths+", 'M');\""+this._addStatus(showStatus,inst.id,this._get(inst,"prevStatus"),initStatus)+">"+prevText+"</a>":(hideIfNoPrevNext?"":(showBigPrevNext?"<label>"+prevBigText+"</label>":"")+"<label>"+prevText+"</label>"))+"</div>";var nextText=this._get(inst,"nextText");nextText=(!navigationAsDateFormat?nextText:this.formatDate(nextText,this._daylightSavingAdjust(new Date(drawYear,drawMonth+stepMonths,1)),this._getFormatConfig(inst)));var nextBigText=(showBigPrevNext?this._get(inst,"nextBigText"):"");nextBigText=(!navigationAsDateFormat?nextBigText:this.formatDate(nextBigText,this._daylightSavingAdjust(new Date(drawYear,drawMonth+stepBigMonths,1)),this._getFormatConfig(inst)));var next='<div class="ui-datepicker-next">'+(this._canAdjustMonth(inst,+1,drawYear,drawMonth)?"<a onclick=\"jQuery.datepicker._adjustDate('#"+inst.id+"', +"+stepMonths+", 'M');\""+this._addStatus(showStatus,inst.id,this._get(inst,"nextStatus"),initStatus)+">"+nextText+"</a>"+(showBigPrevNext?"<a onclick=\"jQuery.datepicker._adjustDate('#"+inst.id+"', +"+stepBigMonths+", 'M');\""+this._addStatus(showStatus,inst.id,this._get(inst,"nextBigStatus"),initStatus)+">"+nextBigText+"</a>":""):(hideIfNoPrevNext?"":"<label>"+nextText+"</label>"+(showBigPrevNext?"<label>"+nextBigText+"</label>":"")))+"</div>";var currentText=this._get(inst,"currentText");var gotoDate=(this._get(inst,"gotoCurrent")&&inst.currentDay?currentDate:today);currentText=(!navigationAsDateFormat?currentText:this.formatDate(currentText,gotoDate,this._getFormatConfig(inst)));var html=(closeAtTop&&!inst.inline?controls:"")+'<div class="ui-datepicker-links">'+(isRTL?next:prev)+(this._isInRange(inst,gotoDate)?'<div class="ui-datepicker-current"><a onclick="jQuery.datepicker._gotoToday(\'#'+inst.id+"');\""+this._addStatus(showStatus,inst.id,this._get(inst,"currentStatus"),initStatus)+">"+currentText+"</a></div>":"")+(isRTL?prev:next)+"</div>"+(prompt?'<div class="'+this._promptClass+'"><span>'+prompt+"</span></div>":"");var firstDay=parseInt(this._get(inst,"firstDay"));firstDay=(isNaN(firstDay)?0:firstDay);var changeFirstDay=this._get(inst,"changeFirstDay");var dayNames=this._get(inst,"dayNames");var dayNamesShort=this._get(inst,"dayNamesShort");var dayNamesMin=this._get(inst,"dayNamesMin");var monthNames=this._get(inst,"monthNames");var beforeShowDay=this._get(inst,"beforeShowDay");var highlightWeek=this._get(inst,"highlightWeek");var showOtherMonths=this._get(inst,"showOtherMonths");var showWeeks=this._get(inst,"showWeeks");var calculateWeek=this._get(inst,"calculateWeek")||this.iso8601Week;var weekStatus=this._get(inst,"weekStatus");var status=(showStatus?this._get(inst,"dayStatus")||initStatus:"");var dateStatus=this._get(inst,"statusForDate")||this.dateStatus;var endDate=inst.endDay?this._daylightSavingAdjust(new Date(inst.endYear,inst.endMonth,inst.endDay)):currentDate;var defaultDate=this._getDefaultDate(inst);for(var row=0;row<numMonths[0];row++){for(var col=0;col<numMonths[1];col++){var selectedDate=this._daylightSavingAdjust(new Date(drawYear,drawMonth,inst.selectedDay));html+='<div class="ui-datepicker-one-month'+(col==0?" ui-datepicker-new-row":"")+'">'+this._generateMonthYearHeader(inst,drawMonth,drawYear,minDate,maxDate,selectedDate,row>0||col>0,showStatus,initStatus,monthNames)+'<table class="ui-datepicker" cellpadding="0" cellspacing="0"><thead><tr class="ui-datepicker-title-row">'+(showWeeks?"<td"+this._addStatus(showStatus,inst.id,weekStatus,initStatus)+">"+this._get(inst,"weekHeader")+"</td>":"");for(var dow=0;dow<7;dow++){var day=(dow+firstDay)%7;var dayStatus=(status.indexOf("DD")>-1?status.replace(/DD/,dayNames[day]):status.replace(/D/,dayNamesShort[day]));html+="<td"+((dow+firstDay+6)%7>=5?' class="ui-datepicker-week-end-cell"':"")+">"+(!changeFirstDay?"<span":"<a onclick=\"jQuery.datepicker._changeFirstDay('#"+inst.id+"', "+day+');"')+this._addStatus(showStatus,inst.id,dayStatus,initStatus)+' title="'+dayNames[day]+'">'+dayNamesMin[day]+(changeFirstDay?"</a>":"</span>")+"</td>"}html+="</tr></thead><tbody>";var daysInMonth=this._getDaysInMonth(drawYear,drawMonth);if(drawYear==inst.selectedYear&&drawMonth==inst.selectedMonth){inst.selectedDay=Math.min(inst.selectedDay,daysInMonth)}var leadDays=(this._getFirstDayOfMonth(drawYear,drawMonth)-firstDay+7)%7;var numRows=(isMultiMonth?6:Math.ceil((leadDays+daysInMonth)/7));var printDate=this._daylightSavingAdjust(new Date(drawYear,drawMonth,1-leadDays));for(var dRow=0;dRow<numRows;dRow++){html+='<tr class="ui-datepicker-days-row">'+(showWeeks?'<td class="ui-datepicker-week-col"'+this._addStatus(showStatus,inst.id,weekStatus,initStatus)+">"+calculateWeek(printDate)+"</td>":"");for(var dow=0;dow<7;dow++){var daySettings=(beforeShowDay?beforeShowDay.apply((inst.input?inst.input[0]:null),[printDate]):[true,""]);var otherMonth=(printDate.getMonth()!=drawMonth);var unselectable=otherMonth||!daySettings[0]||(minDate&&printDate<minDate)||(maxDate&&printDate>maxDate);html+='<td class="ui-datepicker-days-cell'+((dow+firstDay+6)%7>=5?" ui-datepicker-week-end-cell":"")+(otherMonth?" ui-datepicker-other-month":"")+((printDate.getTime()==selectedDate.getTime()&&drawMonth==inst.selectedMonth&&inst._keyEvent)||(defaultDate.getTime()==printDate.getTime()&&defaultDate.getTime()==selectedDate.getTime())?" "+$.datepicker._dayOverClass:"")+(unselectable?" "+this._unselectableClass:"")+(otherMonth&&!showOtherMonths?"":" "+daySettings[1]+(printDate.getTime()>=currentDate.getTime()&&printDate.getTime()<=endDate.getTime()?" "+this._currentClass:"")+(printDate.getTime()==today.getTime()?" ui-datepicker-today":""))+'"'+((!otherMonth||showOtherMonths)&&daySettings[2]?' title="'+daySettings[2]+'"':"")+(unselectable?(highlightWeek?" onmouseover=\"jQuery(this).parent().addClass('"+this._weekOverClass+"');\" onmouseout=\"jQuery(this).parent().removeClass('"+this._weekOverClass+"');\"":""):" onmouseover=\"jQuery(this).addClass('"+this._dayOverClass+"')"+(highlightWeek?".parent().addClass('"+this._weekOverClass+"')":"")+";"+(!showStatus||(otherMonth&&!showOtherMonths)?"":"jQuery('#ui-datepicker-status-"+inst.id+"').html('"+(dateStatus.apply((inst.input?inst.input[0]:null),[printDate,inst])||initStatus)+"');")+'" onmouseout="jQuery(this).removeClass(\''+this._dayOverClass+"')"+(highlightWeek?".parent().removeClass('"+this._weekOverClass+"')":"")+";"+(!showStatus||(otherMonth&&!showOtherMonths)?"":"jQuery('#ui-datepicker-status-"+inst.id+"').html('"+initStatus+"');")+'" onclick="jQuery.datepicker._selectDay(\'#'+inst.id+"',"+drawMonth+","+drawYear+', this);"')+">"+(otherMonth?(showOtherMonths?printDate.getDate():" "):(unselectable?printDate.getDate():"<a>"+printDate.getDate()+"</a>"))+"</td>";printDate.setDate(printDate.getDate()+1);printDate=this._daylightSavingAdjust(printDate)}html+="</tr>"}drawMonth++;if(drawMonth>11){drawMonth=0;drawYear++}html+="</tbody></table></div>"}}html+=(showStatus?'<div style="clear: both;"></div><div id="ui-datepicker-status-'+inst.id+'" class="ui-datepicker-status">'+initStatus+"</div>":"")+(!closeAtTop&&!inst.inline?controls:"")+'<div style="clear: both;"></div>'+($.browser.msie&&parseInt($.browser.version,10)<7&&!inst.inline?'<iframe src="javascript:false;" class="ui-datepicker-cover"></iframe>':"");inst._keyEvent=false;return html},_generateMonthYearHeader:function(inst,drawMonth,drawYear,minDate,maxDate,selectedDate,secondary,showStatus,initStatus,monthNames){minDate=(inst.rangeStart&&minDate&&selectedDate<minDate?selectedDate:minDate);var changeMonth=this._get(inst,"changeMonth");var changeYear=this._get(inst,"changeYear");var showMonthAfterYear=this._get(inst,"showMonthAfterYear");var html='<div class="ui-datepicker-header">';var monthHtml="";if(secondary||!changeMonth){monthHtml+=monthNames[drawMonth]}else{var inMinYear=(minDate&&minDate.getFullYear()==drawYear);var inMaxYear=(maxDate&&maxDate.getFullYear()==drawYear);monthHtml+='<select class="ui-datepicker-new-month" onchange="jQuery.datepicker._selectMonthYear(\'#'+inst.id+"', this, 'M');\" onclick=\"jQuery.datepicker._clickMonthYear('#"+inst.id+"');\""+this._addStatus(showStatus,inst.id,this._get(inst,"monthStatus"),initStatus)+">";for(var month=0;month<12;month++){if((!inMinYear||month>=minDate.getMonth())&&(!inMaxYear||month<=maxDate.getMonth())){monthHtml+='<option value="'+month+'"'+(month==drawMonth?' selected="selected"':"")+">"+monthNames[month]+"</option>"}}monthHtml+="</select>"}if(!showMonthAfterYear){html+=monthHtml+(secondary||changeMonth||changeYear?" ":"")}if(secondary||!changeYear){html+=drawYear}else{var years=this._get(inst,"yearRange").split(":");var year=0;var endYear=0;if(years.length!=2){year=drawYear-10;endYear=drawYear+10}else{if(years[0].charAt(0)=="+"||years[0].charAt(0)=="-"){year=endYear=new Date().getFullYear();year+=parseInt(years[0],10);endYear+=parseInt(years[1],10)}else{year=parseInt(years[0],10);endYear=parseInt(years[1],10)}}year=(minDate?Math.max(year,minDate.getFullYear()):year);endYear=(maxDate?Math.min(endYear,maxDate.getFullYear()):endYear);html+='<select class="ui-datepicker-new-year" onchange="jQuery.datepicker._selectMonthYear(\'#'+inst.id+"', this, 'Y');\" onclick=\"jQuery.datepicker._clickMonthYear('#"+inst.id+"');\""+this._addStatus(showStatus,inst.id,this._get(inst,"yearStatus"),initStatus)+">";for(;year<=endYear;year++){html+='<option value="'+year+'"'+(year==drawYear?' selected="selected"':"")+">"+year+"</option>"}html+="</select>"}if(showMonthAfterYear){html+=(secondary||changeMonth||changeYear?" ":"")+monthHtml}html+="</div>";return html},_addStatus:function(showStatus,id,text,initStatus){return(showStatus?" onmouseover=\"jQuery('#ui-datepicker-status-"+id+"').html('"+(text||initStatus)+"');\" onmouseout=\"jQuery('#ui-datepicker-status-"+id+"').html('"+initStatus+"');\"":"")},_adjustInstDate:function(inst,offset,period){var year=inst.drawYear+(period=="Y"?offset:0);var month=inst.drawMonth+(period=="M"?offset:0);var day=Math.min(inst.selectedDay,this._getDaysInMonth(year,month))+(period=="D"?offset:0);var date=this._daylightSavingAdjust(new Date(year,month,day));var minDate=this._getMinMaxDate(inst,"min",true);var maxDate=this._getMinMaxDate(inst,"max");date=(minDate&&date<minDate?minDate:date);date=(maxDate&&date>maxDate?maxDate:date);inst.selectedDay=date.getDate();inst.drawMonth=inst.selectedMonth=date.getMonth();inst.drawYear=inst.selectedYear=date.getFullYear();if(period=="M"||period=="Y"){this._notifyChange(inst)}},_notifyChange:function(inst){var onChange=this._get(inst,"onChangeMonthYear");if(onChange){onChange.apply((inst.input?inst.input[0]:null),[inst.selectedYear,inst.selectedMonth+1,inst])}},_getNumberOfMonths:function(inst){var numMonths=this._get(inst,"numberOfMonths");return(numMonths==null?[1,1]:(typeof numMonths=="number"?[1,numMonths]:numMonths))},_getMinMaxDate:function(inst,minMax,checkRange){var date=this._determineDate(this._get(inst,minMax+"Date"),null);return(!checkRange||!inst.rangeStart?date:(!date||inst.rangeStart>date?inst.rangeStart:date))},_getDaysInMonth:function(year,month){return 32-new Date(year,month,32).getDate()},_getFirstDayOfMonth:function(year,month){return new Date(year,month,1).getDay()},_canAdjustMonth:function(inst,offset,curYear,curMonth){var numMonths=this._getNumberOfMonths(inst);var date=this._daylightSavingAdjust(new Date(curYear,curMonth+(offset<0?offset:numMonths[1]),1));if(offset<0){date.setDate(this._getDaysInMonth(date.getFullYear(),date.getMonth()))}return this._isInRange(inst,date)},_isInRange:function(inst,date){var newMinDate=(!inst.rangeStart?null:this._daylightSavingAdjust(new Date(inst.selectedYear,inst.selectedMonth,inst.selectedDay)));newMinDate=(newMinDate&&inst.rangeStart<newMinDate?inst.rangeStart:newMinDate);var minDate=newMinDate||this._getMinMaxDate(inst,"min");var maxDate=this._getMinMaxDate(inst,"max");return((!minDate||date>=minDate)&&(!maxDate||date<=maxDate))},_getFormatConfig:function(inst){var shortYearCutoff=this._get(inst,"shortYearCutoff");shortYearCutoff=(typeof shortYearCutoff!="string"?shortYearCutoff:new Date().getFullYear()%100+parseInt(shortYearCutoff,10));return{shortYearCutoff:shortYearCutoff,dayNamesShort:this._get(inst,"dayNamesShort"),dayNames:this._get(inst,"dayNames"),monthNamesShort:this._get(inst,"monthNamesShort"),monthNames:this._get(inst,"monthNames")}},_formatDate:function(inst,day,month,year){if(!day){inst.currentDay=inst.selectedDay;inst.currentMonth=inst.selectedMonth;inst.currentYear=inst.selectedYear}var date=(day?(typeof day=="object"?day:this._daylightSavingAdjust(new Date(year,month,day))):this._daylightSavingAdjust(new Date(inst.currentYear,inst.currentMonth,inst.currentDay)));return this.formatDate(this._get(inst,"dateFormat"),date,this._getFormatConfig(inst))}});function extendRemove(target,props){$.extend(target,props);for(var name in props){if(props[name]==null||props[name]==undefined){target[name]=props[name]}}return target}function isArray(a){return(a&&(($.browser.safari&&typeof a=="object"&&a.length)||(a.constructor&&a.constructor.toString().match(/\Array\(\)/))))}$.fn.datepicker=function(options){if(!$.datepicker.initialized){$(document.body).append($.datepicker.dpDiv).mousedown($.datepicker._checkExternalClick);$.datepicker.initialized=true}var otherArgs=Array.prototype.slice.call(arguments,1);if(typeof options=="string"&&(options=="isDisabled"||options=="getDate")){return $.datepicker["_"+options+"Datepicker"].apply($.datepicker,[this[0]].concat(otherArgs))}return this.each(function(){typeof options=="string"?$.datepicker["_"+options+"Datepicker"].apply($.datepicker,[this].concat(otherArgs)):$.datepicker._attachDatepicker(this,options)})};$.datepicker=new Datepicker();$.datepicker.initialized=false;$.datepicker.uuid=new Date().getTime();$.datepicker.version="1.6"})(jQuery);/* + * jQuery UI Effects 1.6 + * + * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Effects/ + */ +(function(C){C.effects=C.effects||{};C.extend(C.effects,{version:"1.6",save:function(F,G){for(var E=0;E<G.length;E++){if(G[E]!==null){C.data(F[0],"ec.storage."+G[E],F[0].style[G[E]])}}},restore:function(F,G){for(var E=0;E<G.length;E++){if(G[E]!==null){F.css(G[E],C.data(F[0],"ec.storage."+G[E]))}}},setMode:function(E,F){if(F=="toggle"){F=E.is(":hidden")?"show":"hide"}return F},getBaseline:function(F,G){var H,E;switch(F[0]){case"top":H=0;break;case"middle":H=0.5;break;case"bottom":H=1;break;default:H=F[0]/G.height}switch(F[1]){case"left":E=0;break;case"center":E=0.5;break;case"right":E=1;break;default:E=F[1]/G.width}return{x:E,y:H}},createWrapper:function(F){if(F.parent().attr("id")=="fxWrapper"){return F}var E={width:F.outerWidth({margin:true}),height:F.outerHeight({margin:true}),"float":F.css("float")};F.wrap('<div id="fxWrapper" style="font-size:100%;background:transparent;border:none;margin:0;padding:0"></div>');var I=F.parent();if(F.css("position")=="static"){I.css({position:"relative"});F.css({position:"relative"})}else{var H=F.css("top");if(isNaN(parseInt(H))){H="auto"}var G=F.css("left");if(isNaN(parseInt(G))){G="auto"}I.css({position:F.css("position"),top:H,left:G,zIndex:F.css("z-index")}).show();F.css({position:"relative",top:0,left:0})}I.css(E);return I},removeWrapper:function(E){if(E.parent().attr("id")=="fxWrapper"){return E.parent().replaceWith(E)}return E},setTransition:function(F,G,E,H){H=H||{};C.each(G,function(J,I){unit=F.cssUnit(I);if(unit[0]>0){H[I]=unit[0]*E+unit[1]}});return H},animateClass:function(G,H,J,I){var E=(typeof J=="function"?J:(I?I:null));var F=(typeof J=="object"?J:null);return this.each(function(){var O={};var M=C(this);var N=M.attr("style")||"";if(typeof N=="object"){N=N["cssText"]}if(G.toggle){M.hasClass(G.toggle)?G.remove=G.toggle:G.add=G.toggle}var K=C.extend({},(document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle));if(G.add){M.addClass(G.add)}if(G.remove){M.removeClass(G.remove)}var L=C.extend({},(document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle));if(G.add){M.removeClass(G.add)}if(G.remove){M.addClass(G.remove)}for(var P in L){if(typeof L[P]!="function"&&L[P]&&P.indexOf("Moz")==-1&&P.indexOf("length")==-1&&L[P]!=K[P]&&(P.match(/color/i)||(!P.match(/color/i)&&!isNaN(parseInt(L[P],10))))&&(K.position!="static"||(K.position=="static"&&!P.match(/left|top|bottom|right/)))){O[P]=L[P]}}M.animate(O,H,F,function(){if(typeof C(this).attr("style")=="object"){C(this).attr("style")["cssText"]="";C(this).attr("style")["cssText"]=N}else{C(this).attr("style",N)}if(G.add){C(this).addClass(G.add)}if(G.remove){C(this).removeClass(G.remove)}if(E){E.apply(this,arguments)}})})}});C.fn.extend({_show:C.fn.show,_hide:C.fn.hide,__toggle:C.fn.toggle,_addClass:C.fn.addClass,_removeClass:C.fn.removeClass,_toggleClass:C.fn.toggleClass,effect:function(E,G,F,H){return C.effects[E]?C.effects[E].call(this,{method:E,options:G||{},duration:F,callback:H}):null},show:function(){if(!arguments[0]||(arguments[0].constructor==Number||/(slow|normal|fast)/.test(arguments[0]))){return this._show.apply(this,arguments)}else{var E=arguments[1]||{};E["mode"]="show";return this.effect.apply(this,[arguments[0],E,arguments[2]||E.duration,arguments[3]||E.callback])}},hide:function(){if(!arguments[0]||(arguments[0].constructor==Number||/(slow|normal|fast)/.test(arguments[0]))){return this._hide.apply(this,arguments)}else{var E=arguments[1]||{};E["mode"]="hide";return this.effect.apply(this,[arguments[0],E,arguments[2]||E.duration,arguments[3]||E.callback])}},toggle:function(){if(!arguments[0]||(arguments[0].constructor==Number||/(slow|normal|fast)/.test(arguments[0]))||(arguments[0].constructor==Function)){return this.__toggle.apply(this,arguments)}else{var E=arguments[1]||{};E["mode"]="toggle";return this.effect.apply(this,[arguments[0],E,arguments[2]||E.duration,arguments[3]||E.callback])}},addClass:function(F,E,H,G){return E?C.effects.animateClass.apply(this,[{add:F},E,H,G]):this._addClass(F)},removeClass:function(F,E,H,G){return E?C.effects.animateClass.apply(this,[{remove:F},E,H,G]):this._removeClass(F)},toggleClass:function(F,E,H,G){return E?C.effects.animateClass.apply(this,[{toggle:F},E,H,G]):this._toggleClass(F)},morph:function(E,G,F,I,H){return C.effects.animateClass.apply(this,[{add:G,remove:E},F,I,H])},switchClass:function(){return this.morph.apply(this,arguments)},cssUnit:function(E){var F=this.css(E),G=[];C.each(["em","px","%","pt"],function(H,I){if(F.indexOf(I)>0){G=[parseFloat(F),I]}});return G}});C.each(["backgroundColor","borderBottomColor","borderLeftColor","borderRightColor","borderTopColor","color","outlineColor"],function(F,E){C.fx.step[E]=function(G){if(G.state==0){G.start=D(G.elem,E);G.end=B(G.end)}G.elem.style[E]="rgb("+[Math.max(Math.min(parseInt((G.pos*(G.end[0]-G.start[0]))+G.start[0]),255),0),Math.max(Math.min(parseInt((G.pos*(G.end[1]-G.start[1]))+G.start[1]),255),0),Math.max(Math.min(parseInt((G.pos*(G.end[2]-G.start[2]))+G.start[2]),255),0)].join(",")+")"}});function B(F){var E;if(F&&F.constructor==Array&&F.length==3){return F}if(E=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(F)){return[parseInt(E[1]),parseInt(E[2]),parseInt(E[3])]}if(E=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(F)){return[parseFloat(E[1])*2.55,parseFloat(E[2])*2.55,parseFloat(E[3])*2.55]}if(E=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(F)){return[parseInt(E[1],16),parseInt(E[2],16),parseInt(E[3],16)]}if(E=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(F)){return[parseInt(E[1]+E[1],16),parseInt(E[2]+E[2],16),parseInt(E[3]+E[3],16)]}if(E=/rgba\(0, 0, 0, 0\)/.exec(F)){return A["transparent"]}return A[C.trim(F).toLowerCase()]}function D(G,E){var F;do{F=C.curCSS(G,E);if(F!=""&&F!="transparent"||C.nodeName(G,"body")){break}E="backgroundColor"}while(G=G.parentNode);return B(F)}var A={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0],transparent:[255,255,255]};C.easing.jswing=C.easing.swing;C.extend(C.easing,{def:"easeOutQuad",swing:function(F,G,E,I,H){return C.easing[C.easing.def](F,G,E,I,H)},easeInQuad:function(F,G,E,I,H){return I*(G/=H)*G+E},easeOutQuad:function(F,G,E,I,H){return -I*(G/=H)*(G-2)+E},easeInOutQuad:function(F,G,E,I,H){if((G/=H/2)<1){return I/2*G*G+E}return -I/2*((--G)*(G-2)-1)+E},easeInCubic:function(F,G,E,I,H){return I*(G/=H)*G*G+E},easeOutCubic:function(F,G,E,I,H){return I*((G=G/H-1)*G*G+1)+E},easeInOutCubic:function(F,G,E,I,H){if((G/=H/2)<1){return I/2*G*G*G+E}return I/2*((G-=2)*G*G+2)+E},easeInQuart:function(F,G,E,I,H){return I*(G/=H)*G*G*G+E},easeOutQuart:function(F,G,E,I,H){return -I*((G=G/H-1)*G*G*G-1)+E},easeInOutQuart:function(F,G,E,I,H){if((G/=H/2)<1){return I/2*G*G*G*G+E}return -I/2*((G-=2)*G*G*G-2)+E},easeInQuint:function(F,G,E,I,H){return I*(G/=H)*G*G*G*G+E},easeOutQuint:function(F,G,E,I,H){return I*((G=G/H-1)*G*G*G*G+1)+E},easeInOutQuint:function(F,G,E,I,H){if((G/=H/2)<1){return I/2*G*G*G*G*G+E}return I/2*((G-=2)*G*G*G*G+2)+E},easeInSine:function(F,G,E,I,H){return -I*Math.cos(G/H*(Math.PI/2))+I+E},easeOutSine:function(F,G,E,I,H){return I*Math.sin(G/H*(Math.PI/2))+E},easeInOutSine:function(F,G,E,I,H){return -I/2*(Math.cos(Math.PI*G/H)-1)+E},easeInExpo:function(F,G,E,I,H){return(G==0)?E:I*Math.pow(2,10*(G/H-1))+E},easeOutExpo:function(F,G,E,I,H){return(G==H)?E+I:I*(-Math.pow(2,-10*G/H)+1)+E},easeInOutExpo:function(F,G,E,I,H){if(G==0){return E}if(G==H){return E+I}if((G/=H/2)<1){return I/2*Math.pow(2,10*(G-1))+E}return I/2*(-Math.pow(2,-10*--G)+2)+E},easeInCirc:function(F,G,E,I,H){return -I*(Math.sqrt(1-(G/=H)*G)-1)+E},easeOutCirc:function(F,G,E,I,H){return I*Math.sqrt(1-(G=G/H-1)*G)+E},easeInOutCirc:function(F,G,E,I,H){if((G/=H/2)<1){return -I/2*(Math.sqrt(1-G*G)-1)+E}return I/2*(Math.sqrt(1-(G-=2)*G)+1)+E},easeInElastic:function(F,H,E,L,K){var I=1.70158;var J=0;var G=L;if(H==0){return E}if((H/=K)==1){return E+L}if(!J){J=K*0.3}if(G<Math.abs(L)){G=L;var I=J/4}else{var I=J/(2*Math.PI)*Math.asin(L/G)}return -(G*Math.pow(2,10*(H-=1))*Math.sin((H*K-I)*(2*Math.PI)/J))+E},easeOutElastic:function(F,H,E,L,K){var I=1.70158;var J=0;var G=L;if(H==0){return E}if((H/=K)==1){return E+L}if(!J){J=K*0.3}if(G<Math.abs(L)){G=L;var I=J/4}else{var I=J/(2*Math.PI)*Math.asin(L/G)}return G*Math.pow(2,-10*H)*Math.sin((H*K-I)*(2*Math.PI)/J)+L+E},easeInOutElastic:function(F,H,E,L,K){var I=1.70158;var J=0;var G=L;if(H==0){return E}if((H/=K/2)==2){return E+L}if(!J){J=K*(0.3*1.5)}if(G<Math.abs(L)){G=L;var I=J/4}else{var I=J/(2*Math.PI)*Math.asin(L/G)}if(H<1){return -0.5*(G*Math.pow(2,10*(H-=1))*Math.sin((H*K-I)*(2*Math.PI)/J))+E}return G*Math.pow(2,-10*(H-=1))*Math.sin((H*K-I)*(2*Math.PI)/J)*0.5+L+E},easeInBack:function(F,G,E,J,I,H){if(H==undefined){H=1.70158}return J*(G/=I)*G*((H+1)*G-H)+E},easeOutBack:function(F,G,E,J,I,H){if(H==undefined){H=1.70158}return J*((G=G/I-1)*G*((H+1)*G+H)+1)+E},easeInOutBack:function(F,G,E,J,I,H){if(H==undefined){H=1.70158}if((G/=I/2)<1){return J/2*(G*G*(((H*=(1.525))+1)*G-H))+E}return J/2*((G-=2)*G*(((H*=(1.525))+1)*G+H)+2)+E},easeInBounce:function(F,G,E,I,H){return I-C.easing.easeOutBounce(F,H-G,0,I,H)+E},easeOutBounce:function(F,G,E,I,H){if((G/=H)<(1/2.75)){return I*(7.5625*G*G)+E}else{if(G<(2/2.75)){return I*(7.5625*(G-=(1.5/2.75))*G+0.75)+E}else{if(G<(2.5/2.75)){return I*(7.5625*(G-=(2.25/2.75))*G+0.9375)+E}else{return I*(7.5625*(G-=(2.625/2.75))*G+0.984375)+E}}}},easeInOutBounce:function(F,G,E,I,H){if(G<H/2){return C.easing.easeInBounce(F,G*2,0,I,H)*0.5+E}return C.easing.easeOutBounce(F,G*2-H,0,I,H)*0.5+I*0.5+E}})})(jQuery);/* + * jQuery UI Effects Blind 1.6 + * + * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Effects/Blind + * + * Depends: + * effects.core.js + */ +(function(A){A.effects.blind=function(B){return this.queue(function(){var D=A(this),C=["position","top","left"];var H=A.effects.setMode(D,B.options.mode||"hide");var G=B.options.direction||"vertical";A.effects.save(D,C);D.show();var J=A.effects.createWrapper(D).css({overflow:"hidden"});var E=(G=="vertical")?"height":"width";var I=(G=="vertical")?J.height():J.width();if(H=="show"){J.css(E,0)}var F={};F[E]=H=="show"?I:0;J.animate(F,B.duration,B.options.easing,function(){if(H=="hide"){D.hide()}A.effects.restore(D,C);A.effects.removeWrapper(D);if(B.callback){B.callback.apply(D[0],arguments)}D.dequeue()})})}})(jQuery);/* + * jQuery UI Effects Bounce 1.6 + * + * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Effects/Bounce + * + * Depends: + * effects.core.js + */ +(function(A){A.effects.bounce=function(B){return this.queue(function(){var E=A(this),K=["position","top","left"];var J=A.effects.setMode(E,B.options.mode||"effect");var M=B.options.direction||"up";var C=B.options.distance||20;var D=B.options.times||5;var G=B.duration||250;if(/show|hide/.test(J)){K.push("opacity")}A.effects.save(E,K);E.show();A.effects.createWrapper(E);var F=(M=="up"||M=="down")?"top":"left";var O=(M=="up"||M=="left")?"pos":"neg";var C=B.options.distance||(F=="top"?E.outerHeight({margin:true})/3:E.outerWidth({margin:true})/3);if(J=="show"){E.css("opacity",0).css(F,O=="pos"?-C:C)}if(J=="hide"){C=C/(D*2)}if(J!="hide"){D--}if(J=="show"){var H={opacity:1};H[F]=(O=="pos"?"+=":"-=")+C;E.animate(H,G/2,B.options.easing);C=C/2;D--}for(var I=0;I<D;I++){var N={},L={};N[F]=(O=="pos"?"-=":"+=")+C;L[F]=(O=="pos"?"+=":"-=")+C;E.animate(N,G/2,B.options.easing).animate(L,G/2,B.options.easing);C=(J=="hide")?C*2:C/2}if(J=="hide"){var H={opacity:0};H[F]=(O=="pos"?"-=":"+=")+C;E.animate(H,G/2,B.options.easing,function(){E.hide();A.effects.restore(E,K);A.effects.removeWrapper(E);if(B.callback){B.callback.apply(this,arguments)}})}else{var N={},L={};N[F]=(O=="pos"?"-=":"+=")+C;L[F]=(O=="pos"?"+=":"-=")+C;E.animate(N,G/2,B.options.easing).animate(L,G/2,B.options.easing,function(){A.effects.restore(E,K);A.effects.removeWrapper(E);if(B.callback){B.callback.apply(this,arguments)}})}E.queue("fx",function(){E.dequeue()});E.dequeue()})}})(jQuery);/* + * jQuery UI Effects Clip 1.6 + * + * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Effects/Clip + * + * Depends: + * effects.core.js + */ +(function(A){A.effects.clip=function(B){return this.queue(function(){var F=A(this),J=["position","top","left","height","width"];var I=A.effects.setMode(F,B.options.mode||"hide");var K=B.options.direction||"vertical";A.effects.save(F,J);F.show();var C=A.effects.createWrapper(F).css({overflow:"hidden"});var E=F[0].tagName=="IMG"?C:F;var G={size:(K=="vertical")?"height":"width",position:(K=="vertical")?"top":"left"};var D=(K=="vertical")?E.height():E.width();if(I=="show"){E.css(G.size,0);E.css(G.position,D/2)}var H={};H[G.size]=I=="show"?D:0;H[G.position]=I=="show"?0:D/2;E.animate(H,{queue:false,duration:B.duration,easing:B.options.easing,complete:function(){if(I=="hide"){F.hide()}A.effects.restore(F,J);A.effects.removeWrapper(F);if(B.callback){B.callback.apply(F[0],arguments)}F.dequeue()}})})}})(jQuery);/* + * jQuery UI Effects Drop 1.6 + * + * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Effects/Drop + * + * Depends: + * effects.core.js + */ +(function(A){A.effects.drop=function(B){return this.queue(function(){var E=A(this),D=["position","top","left","opacity"];var I=A.effects.setMode(E,B.options.mode||"hide");var H=B.options.direction||"left";A.effects.save(E,D);E.show();A.effects.createWrapper(E);var F=(H=="up"||H=="down")?"top":"left";var C=(H=="up"||H=="left")?"pos":"neg";var J=B.options.distance||(F=="top"?E.outerHeight({margin:true})/2:E.outerWidth({margin:true})/2);if(I=="show"){E.css("opacity",0).css(F,C=="pos"?-J:J)}var G={opacity:I=="show"?1:0};G[F]=(I=="show"?(C=="pos"?"+=":"-="):(C=="pos"?"-=":"+="))+J;E.animate(G,{queue:false,duration:B.duration,easing:B.options.easing,complete:function(){if(I=="hide"){E.hide()}A.effects.restore(E,D);A.effects.removeWrapper(E);if(B.callback){B.callback.apply(this,arguments)}E.dequeue()}})})}})(jQuery);/* + * jQuery UI Effects Explode 1.6 + * + * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Effects/Explode + * + * Depends: + * effects.core.js + */ +(function(A){A.effects.explode=function(B){return this.queue(function(){var I=B.options.pieces?Math.round(Math.sqrt(B.options.pieces)):3;var E=B.options.pieces?Math.round(Math.sqrt(B.options.pieces)):3;B.options.mode=B.options.mode=="toggle"?(A(this).is(":visible")?"hide":"show"):B.options.mode;var H=A(this).show().css("visibility","hidden");var J=H.offset();J.top-=parseInt(H.css("marginTop"))||0;J.left-=parseInt(H.css("marginLeft"))||0;var G=H.outerWidth(true);var C=H.outerHeight(true);for(var F=0;F<I;F++){for(var D=0;D<E;D++){H.clone().appendTo("body").wrap("<div></div>").css({position:"absolute",visibility:"visible",left:-D*(G/E),top:-F*(C/I)}).parent().addClass("effects-explode").css({position:"absolute",overflow:"hidden",width:G/E,height:C/I,left:J.left+D*(G/E)+(B.options.mode=="show"?(D-Math.floor(E/2))*(G/E):0),top:J.top+F*(C/I)+(B.options.mode=="show"?(F-Math.floor(I/2))*(C/I):0),opacity:B.options.mode=="show"?0:1}).animate({left:J.left+D*(G/E)+(B.options.mode=="show"?0:(D-Math.floor(E/2))*(G/E)),top:J.top+F*(C/I)+(B.options.mode=="show"?0:(F-Math.floor(I/2))*(C/I)),opacity:B.options.mode=="show"?1:0},B.duration||500)}}setTimeout(function(){B.options.mode=="show"?H.css({visibility:"visible"}):H.css({visibility:"visible"}).hide();if(B.callback){B.callback.apply(H[0])}H.dequeue();A(".effects-explode").remove()},B.duration||500)})}})(jQuery);/* + * jQuery UI Effects Fold 1.6 + * + * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Effects/Fold + * + * Depends: + * effects.core.js + */ +(function(A){A.effects.fold=function(B){return this.queue(function(){var E=A(this),J=["position","top","left"];var G=A.effects.setMode(E,B.options.mode||"hide");var N=B.options.size||15;var M=!(!B.options.horizFirst);A.effects.save(E,J);E.show();var D=A.effects.createWrapper(E).css({overflow:"hidden"});var H=((G=="show")!=M);var F=H?["width","height"]:["height","width"];var C=H?[D.width(),D.height()]:[D.height(),D.width()];var I=/([0-9]+)%/.exec(N);if(I){N=parseInt(I[1])/100*C[G=="hide"?0:1]}if(G=="show"){D.css(M?{height:0,width:N}:{height:N,width:0})}var L={},K={};L[F[0]]=G=="show"?C[0]:N;K[F[1]]=G=="show"?C[1]:0;D.animate(L,B.duration/2,B.options.easing).animate(K,B.duration/2,B.options.easing,function(){if(G=="hide"){E.hide()}A.effects.restore(E,J);A.effects.removeWrapper(E);if(B.callback){B.callback.apply(E[0],arguments)}E.dequeue()})})}})(jQuery);/* + * jQuery UI Effects Highlight 1.6 + * + * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Effects/Highlight + * + * Depends: + * effects.core.js + */ +(function(A){A.effects.highlight=function(B){return this.queue(function(){var E=A(this),D=["backgroundImage","backgroundColor","opacity"];var H=A.effects.setMode(E,B.options.mode||"show");var C=B.options.color||"#ffff99";var G=E.css("backgroundColor");A.effects.save(E,D);E.show();E.css({backgroundImage:"none",backgroundColor:C});var F={backgroundColor:G};if(H=="hide"){F["opacity"]=0}E.animate(F,{queue:false,duration:B.duration,easing:B.options.easing,complete:function(){if(H=="hide"){E.hide()}A.effects.restore(E,D);if(H=="show"&&A.browser.msie){this.style.removeAttribute("filter")}if(B.callback){B.callback.apply(this,arguments)}E.dequeue()}})})}})(jQuery);/* + * jQuery UI Effects Pulsate 1.6 + * + * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Effects/Pulsate + * + * Depends: + * effects.core.js + */ +(function(A){A.effects.pulsate=function(B){return this.queue(function(){var D=A(this);var F=A.effects.setMode(D,B.options.mode||"show");var E=B.options.times||5;if(F=="hide"){E--}if(D.is(":hidden")){D.css("opacity",0);D.show();D.animate({opacity:1},B.duration/2,B.options.easing);E=E-2}for(var C=0;C<E;C++){D.animate({opacity:0},B.duration/2,B.options.easing).animate({opacity:1},B.duration/2,B.options.easing)}if(F=="hide"){D.animate({opacity:0},B.duration/2,B.options.easing,function(){D.hide();if(B.callback){B.callback.apply(this,arguments)}})}else{D.animate({opacity:0},B.duration/2,B.options.easing).animate({opacity:1},B.duration/2,B.options.easing,function(){if(B.callback){B.callback.apply(this,arguments)}})}D.queue("fx",function(){D.dequeue()});D.dequeue()})}})(jQuery);/* + * jQuery UI Effects Scale 1.6 + * + * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Effects/Scale + * + * Depends: + * effects.core.js + */ +(function(A){A.effects.puff=function(B){return this.queue(function(){var F=A(this);var C=A.extend(true,{},B.options);var H=A.effects.setMode(F,B.options.mode||"hide");var G=parseInt(B.options.percent)||150;C.fade=true;var E={height:F.height(),width:F.width()};var D=G/100;F.from=(H=="hide")?E:{height:E.height*D,width:E.width*D};C.from=F.from;C.percent=(H=="hide")?G:100;C.mode=H;F.effect("scale",C,B.duration,B.callback);F.dequeue()})};A.effects.scale=function(B){return this.queue(function(){var G=A(this);var D=A.extend(true,{},B.options);var J=A.effects.setMode(G,B.options.mode||"effect");var H=parseInt(B.options.percent)||(parseInt(B.options.percent)==0?0:(J=="hide"?0:100));var I=B.options.direction||"both";var C=B.options.origin;if(J!="effect"){D.origin=C||["middle","center"];D.restore=true}var F={height:G.height(),width:G.width()};G.from=B.options.from||(J=="show"?{height:0,width:0}:F);var E={y:I!="horizontal"?(H/100):1,x:I!="vertical"?(H/100):1};G.to={height:F.height*E.y,width:F.width*E.x};if(B.options.fade){if(J=="show"){G.from.opacity=0;G.to.opacity=1}if(J=="hide"){G.from.opacity=1;G.to.opacity=0}}D.from=G.from;D.to=G.to;D.mode=J;G.effect("size",D,B.duration,B.callback);G.dequeue()})};A.effects.size=function(B){return this.queue(function(){var C=A(this),N=["position","top","left","width","height","overflow","opacity"];var M=["position","top","left","overflow","opacity"];var J=["width","height","overflow"];var P=["fontSize"];var K=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"];var F=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"];var G=A.effects.setMode(C,B.options.mode||"effect");var I=B.options.restore||false;var E=B.options.scale||"both";var O=B.options.origin;var D={height:C.height(),width:C.width()};C.from=B.options.from||D;C.to=B.options.to||D;if(O){var H=A.effects.getBaseline(O,D);C.from.top=(D.height-C.from.height)*H.y;C.from.left=(D.width-C.from.width)*H.x;C.to.top=(D.height-C.to.height)*H.y;C.to.left=(D.width-C.to.width)*H.x}var L={from:{y:C.from.height/D.height,x:C.from.width/D.width},to:{y:C.to.height/D.height,x:C.to.width/D.width}};if(E=="box"||E=="both"){if(L.from.y!=L.to.y){N=N.concat(K);C.from=A.effects.setTransition(C,K,L.from.y,C.from);C.to=A.effects.setTransition(C,K,L.to.y,C.to)}if(L.from.x!=L.to.x){N=N.concat(F);C.from=A.effects.setTransition(C,F,L.from.x,C.from);C.to=A.effects.setTransition(C,F,L.to.x,C.to)}}if(E=="content"||E=="both"){if(L.from.y!=L.to.y){N=N.concat(P);C.from=A.effects.setTransition(C,P,L.from.y,C.from);C.to=A.effects.setTransition(C,P,L.to.y,C.to)}}A.effects.save(C,I?N:M);C.show();A.effects.createWrapper(C);C.css("overflow","hidden").css(C.from);if(E=="content"||E=="both"){K=K.concat(["marginTop","marginBottom"]).concat(P);F=F.concat(["marginLeft","marginRight"]);J=N.concat(K).concat(F);C.find("*[width]").each(function(){child=A(this);if(I){A.effects.save(child,J)}var Q={height:child.height(),width:child.width()};child.from={height:Q.height*L.from.y,width:Q.width*L.from.x};child.to={height:Q.height*L.to.y,width:Q.width*L.to.x};if(L.from.y!=L.to.y){child.from=A.effects.setTransition(child,K,L.from.y,child.from);child.to=A.effects.setTransition(child,K,L.to.y,child.to)}if(L.from.x!=L.to.x){child.from=A.effects.setTransition(child,F,L.from.x,child.from);child.to=A.effects.setTransition(child,F,L.to.x,child.to)}child.css(child.from);child.animate(child.to,B.duration,B.options.easing,function(){if(I){A.effects.restore(child,J)}})})}C.animate(C.to,{queue:false,duration:B.duration,easing:B.options.easing,complete:function(){if(G=="hide"){C.hide()}A.effects.restore(C,I?N:M);A.effects.removeWrapper(C);if(B.callback){B.callback.apply(this,arguments)}C.dequeue()}})})}})(jQuery);/* + * jQuery UI Effects Shake 1.6 + * + * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Effects/Shake + * + * Depends: + * effects.core.js + */ +(function(A){A.effects.shake=function(B){return this.queue(function(){var E=A(this),K=["position","top","left"];var J=A.effects.setMode(E,B.options.mode||"effect");var M=B.options.direction||"left";var C=B.options.distance||20;var D=B.options.times||3;var G=B.duration||B.options.duration||140;A.effects.save(E,K);E.show();A.effects.createWrapper(E);var F=(M=="up"||M=="down")?"top":"left";var O=(M=="up"||M=="left")?"pos":"neg";var H={},N={},L={};H[F]=(O=="pos"?"-=":"+=")+C;N[F]=(O=="pos"?"+=":"-=")+C*2;L[F]=(O=="pos"?"-=":"+=")+C*2;E.animate(H,G,B.options.easing);for(var I=1;I<D;I++){E.animate(N,G,B.options.easing).animate(L,G,B.options.easing)}E.animate(N,G,B.options.easing).animate(H,G/2,B.options.easing,function(){A.effects.restore(E,K);A.effects.removeWrapper(E);if(B.callback){B.callback.apply(this,arguments)}});E.queue("fx",function(){E.dequeue()});E.dequeue()})}})(jQuery);/* + * jQuery UI Effects Slide 1.6 + * + * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Effects/Slide + * + * Depends: + * effects.core.js + */ +(function(A){A.effects.slide=function(B){return this.queue(function(){var E=A(this),D=["position","top","left"];var I=A.effects.setMode(E,B.options.mode||"show");var H=B.options.direction||"left";A.effects.save(E,D);E.show();A.effects.createWrapper(E).css({overflow:"hidden"});var F=(H=="up"||H=="down")?"top":"left";var C=(H=="up"||H=="left")?"pos":"neg";var J=B.options.distance||(F=="top"?E.outerHeight({margin:true}):E.outerWidth({margin:true}));if(I=="show"){E.css(F,C=="pos"?-J:J)}var G={};G[F]=(I=="show"?(C=="pos"?"+=":"-="):(C=="pos"?"-=":"+="))+J;E.animate(G,{queue:false,duration:B.duration,easing:B.options.easing,complete:function(){if(I=="hide"){E.hide()}A.effects.restore(E,D);A.effects.removeWrapper(E);if(B.callback){B.callback.apply(this,arguments)}E.dequeue()}})})}})(jQuery);/* + * jQuery UI Effects Transfer 1.6 + * + * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Effects/Transfer + * + * Depends: + * effects.core.js + */ +(function(A){A.effects.transfer=function(B){return this.queue(function(){var E=A(this);var G=A.effects.setMode(E,B.options.mode||"effect");var F=A(B.options.to);var C=E.offset();var D=A('<div class="ui-effects-transfer"></div>').appendTo(document.body);if(B.options.className){D.addClass(B.options.className)}D.addClass(B.options.className);D.css({top:C.top,left:C.left,height:E.outerHeight()-parseInt(D.css("borderTopWidth"))-parseInt(D.css("borderBottomWidth")),width:E.outerWidth()-parseInt(D.css("borderLeftWidth"))-parseInt(D.css("borderRightWidth")),position:"absolute"});C=F.offset();animation={top:C.top,left:C.left,height:F.outerHeight()-parseInt(D.css("borderTopWidth"))-parseInt(D.css("borderBottomWidth")),width:F.outerWidth()-parseInt(D.css("borderLeftWidth"))-parseInt(D.css("borderRightWidth"))};D.animate(animation,B.duration,B.options.easing,function(){D.remove();if(B.callback){B.callback.apply(E[0],arguments)}E.dequeue()})})}})(jQuery); \ No newline at end of file diff --git a/modules/tntcarrier/relaisColis/js/jquery.js b/modules/tntcarrier/relaisColis/js/jquery.js new file mode 100644 index 000000000..72f32c906 --- /dev/null +++ b/modules/tntcarrier/relaisColis/js/jquery.js @@ -0,0 +1,32 @@ +/* + * jQuery 1.2.6 - New Wave Javascript + * + * Copyright (c) 2008 John Resig (jquery.com) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * $Date: 2008-05-24 14:22:17 -0400 (Sat, 24 May 2008) $ + * $Rev: 5685 $ + */ +(function(){var _jQuery=window.jQuery,_$=window.$;var jQuery=window.jQuery=window.$=function(selector,context){return new jQuery.fn.init(selector,context);};var quickExpr=/^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/,isSimple=/^.[^:#\[\.]*$/,undefined;jQuery.fn=jQuery.prototype={init:function(selector,context){selector=selector||document;if(selector.nodeType){this[0]=selector;this.length=1;return this;}if(typeof selector=="string"){var match=quickExpr.exec(selector);if(match&&(match[1]||!context)){if(match[1])selector=jQuery.clean([match[1]],context);else{var elem=document.getElementById(match[3]);if(elem){if(elem.id!=match[3])return jQuery().find(selector);return jQuery(elem);}selector=[];}}else +return jQuery(context).find(selector);}else if(jQuery.isFunction(selector))return jQuery(document)[jQuery.fn.ready?"ready":"load"](selector);return this.setArray(jQuery.makeArray(selector));},jquery:"1.2.6",size:function(){return this.length;},length:0,get:function(num){return num==undefined?jQuery.makeArray(this):this[num];},pushStack:function(elems){var ret=jQuery(elems);ret.prevObject=this;return ret;},setArray:function(elems){this.length=0;Array.prototype.push.apply(this,elems);return this;},each:function(callback,args){return jQuery.each(this,callback,args);},index:function(elem){var ret=-1;return jQuery.inArray(elem&&elem.jquery?elem[0]:elem,this);},attr:function(name,value,type){var options=name;if(name.constructor==String)if(value===undefined)return this[0]&&jQuery[type||"attr"](this[0],name);else{options={};options[name]=value;}return this.each(function(i){for(name in options)jQuery.attr(type?this.style:this,name,jQuery.prop(this,options[name],type,i,name));});},css:function(key,value){if((key=='width'||key=='height')&&parseFloat(value)<0)value=undefined;return this.attr(key,value,"curCSS");},text:function(text){if(typeof text!="object"&&text!=null)return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(text));var ret="";jQuery.each(text||this,function(){jQuery.each(this.childNodes,function(){if(this.nodeType!=8)ret+=this.nodeType!=1?this.nodeValue:jQuery.fn.text([this]);});});return ret;},wrapAll:function(html){if(this[0])jQuery(html,this[0].ownerDocument).clone().insertBefore(this[0]).map(function(){var elem=this;while(elem.firstChild)elem=elem.firstChild;return elem;}).append(this);return this;},wrapInner:function(html){return this.each(function(){jQuery(this).contents().wrapAll(html);});},wrap:function(html){return this.each(function(){jQuery(this).wrapAll(html);});},append:function(){return this.domManip(arguments,true,false,function(elem){if(this.nodeType==1)this.appendChild(elem);});},prepend:function(){return this.domManip(arguments,true,true,function(elem){if(this.nodeType==1)this.insertBefore(elem,this.firstChild);});},before:function(){return this.domManip(arguments,false,false,function(elem){this.parentNode.insertBefore(elem,this);});},after:function(){return this.domManip(arguments,false,true,function(elem){this.parentNode.insertBefore(elem,this.nextSibling);});},end:function(){return this.prevObject||jQuery([]);},find:function(selector){var elems=jQuery.map(this,function(elem){return jQuery.find(selector,elem);});return this.pushStack(/[^+>] [^+>]/.test(selector)||selector.indexOf("..")>-1?jQuery.unique(elems):elems);},clone:function(events){var ret=this.map(function(){if(jQuery.browser.msie&&!jQuery.isXMLDoc(this)){var clone=this.cloneNode(true),container=document.createElement("div");container.appendChild(clone);return jQuery.clean([container.innerHTML])[0];}else +return this.cloneNode(true);});var clone=ret.find("*").andSelf().each(function(){if(this[expando]!=undefined)this[expando]=null;});if(events===true)this.find("*").andSelf().each(function(i){if(this.nodeType==3)return;var events=jQuery.data(this,"events");for(var type in events)for(var handler in events[type])jQuery.event.add(clone[i],type,events[type][handler],events[type][handler].data);});return ret;},filter:function(selector){return this.pushStack(jQuery.isFunction(selector)&&jQuery.grep(this,function(elem,i){return selector.call(elem,i);})||jQuery.multiFilter(selector,this));},not:function(selector){if(selector.constructor==String)if(isSimple.test(selector))return this.pushStack(jQuery.multiFilter(selector,this,true));else +selector=jQuery.multiFilter(selector,this);var isArrayLike=selector.length&&selector[selector.length-1]!==undefined&&!selector.nodeType;return this.filter(function(){return isArrayLike?jQuery.inArray(this,selector)<0:this!=selector;});},add:function(selector){return this.pushStack(jQuery.unique(jQuery.merge(this.get(),typeof selector=='string'?jQuery(selector):jQuery.makeArray(selector))));},is:function(selector){return!!selector&&jQuery.multiFilter(selector,this).length>0;},hasClass:function(selector){return this.is("."+selector);},val:function(value){if(value==undefined){if(this.length){var elem=this[0];if(jQuery.nodeName(elem,"select")){var index=elem.selectedIndex,values=[],options=elem.options,one=elem.type=="select-one";if(index<0)return null;for(var i=one?index:0,max=one?index+1:options.length;i<max;i++){var option=options[i];if(option.selected){value=jQuery.browser.msie&&!option.attributes.value.specified?option.text:option.value;if(one)return value;values.push(value);}}return values;}else +return(this[0].value||"").replace(/\r/g,"");}return undefined;}if(value.constructor==Number)value+='';return this.each(function(){if(this.nodeType!=1)return;if(value.constructor==Array&&/radio|checkbox/.test(this.type))this.checked=(jQuery.inArray(this.value,value)>=0||jQuery.inArray(this.name,value)>=0);else if(jQuery.nodeName(this,"select")){var values=jQuery.makeArray(value);jQuery("option",this).each(function(){this.selected=(jQuery.inArray(this.value,values)>=0||jQuery.inArray(this.text,values)>=0);});if(!values.length)this.selectedIndex=-1;}else +this.value=value;});},html:function(value){return value==undefined?(this[0]?this[0].innerHTML:null):this.empty().append(value);},replaceWith:function(value){return this.after(value).remove();},eq:function(i){return this.slice(i,i+1);},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments));},map:function(callback){return this.pushStack(jQuery.map(this,function(elem,i){return callback.call(elem,i,elem);}));},andSelf:function(){return this.add(this.prevObject);},data:function(key,value){var parts=key.split(".");parts[1]=parts[1]?"."+parts[1]:"";if(value===undefined){var data=this.triggerHandler("getData"+parts[1]+"!",[parts[0]]);if(data===undefined&&this.length)data=jQuery.data(this[0],key);return data===undefined&&parts[1]?this.data(parts[0]):data;}else +return this.trigger("setData"+parts[1]+"!",[parts[0],value]).each(function(){jQuery.data(this,key,value);});},removeData:function(key){return this.each(function(){jQuery.removeData(this,key);});},domManip:function(args,table,reverse,callback){var clone=this.length>1,elems;return this.each(function(){if(!elems){elems=jQuery.clean(args,this.ownerDocument);if(reverse)elems.reverse();}var obj=this;if(table&&jQuery.nodeName(this,"table")&&jQuery.nodeName(elems[0],"tr"))obj=this.getElementsByTagName("tbody")[0]||this.appendChild(this.ownerDocument.createElement("tbody"));var scripts=jQuery([]);jQuery.each(elems,function(){var elem=clone?jQuery(this).clone(true)[0]:this;if(jQuery.nodeName(elem,"script"))scripts=scripts.add(elem);else{if(elem.nodeType==1)scripts=scripts.add(jQuery("script",elem).remove());callback.call(obj,elem);}});scripts.each(evalScript);});}};jQuery.fn.init.prototype=jQuery.fn;function evalScript(i,elem){if(elem.src)jQuery.ajax({url:elem.src,async:false,dataType:"script"});else +jQuery.globalEval(elem.text||elem.textContent||elem.innerHTML||"");if(elem.parentNode)elem.parentNode.removeChild(elem);}function now(){return+new Date;}jQuery.extend=jQuery.fn.extend=function(){var target=arguments[0]||{},i=1,length=arguments.length,deep=false,options;if(target.constructor==Boolean){deep=target;target=arguments[1]||{};i=2;}if(typeof target!="object"&&typeof target!="function")target={};if(length==i){target=this;--i;}for(;i<length;i++)if((options=arguments[i])!=null)for(var name in options){var src=target[name],copy=options[name];if(target===copy)continue;if(deep&©&&typeof copy=="object"&&!copy.nodeType)target[name]=jQuery.extend(deep,src||(copy.length!=null?[]:{}),copy);else if(copy!==undefined)target[name]=copy;}return target;};var expando="jQuery"+now(),uuid=0,windowData={},exclude=/z-?index|font-?weight|opacity|zoom|line-?height/i,defaultView=document.defaultView||{};jQuery.extend({noConflict:function(deep){window.$=_$;if(deep)window.jQuery=_jQuery;return jQuery;},isFunction:function(fn){return!!fn&&typeof fn!="string"&&!fn.nodeName&&fn.constructor!=Array&&/^[\s[]?function/.test(fn+"");},isXMLDoc:function(elem){return elem.documentElement&&!elem.body||elem.tagName&&elem.ownerDocument&&!elem.ownerDocument.body;},globalEval:function(data){data=jQuery.trim(data);if(data){var head=document.getElementsByTagName("head")[0]||document.documentElement,script=document.createElement("script");script.type="text/javascript";if(jQuery.browser.msie)script.text=data;else +script.appendChild(document.createTextNode(data));head.insertBefore(script,head.firstChild);head.removeChild(script);}},nodeName:function(elem,name){return elem.nodeName&&elem.nodeName.toUpperCase()==name.toUpperCase();},cache:{},data:function(elem,name,data){elem=elem==window?windowData:elem;var id=elem[expando];if(!id)id=elem[expando]=++uuid;if(name&&!jQuery.cache[id])jQuery.cache[id]={};if(data!==undefined)jQuery.cache[id][name]=data;return name?jQuery.cache[id][name]:id;},removeData:function(elem,name){elem=elem==window?windowData:elem;var id=elem[expando];if(name){if(jQuery.cache[id]){delete jQuery.cache[id][name];name="";for(name in jQuery.cache[id])break;if(!name)jQuery.removeData(elem);}}else{try{delete elem[expando];}catch(e){if(elem.removeAttribute)elem.removeAttribute(expando);}delete jQuery.cache[id];}},each:function(object,callback,args){var name,i=0,length=object.length;if(args){if(length==undefined){for(name in object)if(callback.apply(object[name],args)===false)break;}else +for(;i<length;)if(callback.apply(object[i++],args)===false)break;}else{if(length==undefined){for(name in object)if(callback.call(object[name],name,object[name])===false)break;}else +for(var value=object[0];i<length&&callback.call(value,i,value)!==false;value=object[++i]){}}return object;},prop:function(elem,value,type,i,name){if(jQuery.isFunction(value))value=value.call(elem,i);return value&&value.constructor==Number&&type=="curCSS"&&!exclude.test(name)?value+"px":value;},className:{add:function(elem,classNames){jQuery.each((classNames||"").split(/\s+/),function(i,className){if(elem.nodeType==1&&!jQuery.className.has(elem.className,className))elem.className+=(elem.className?" ":"")+className;});},remove:function(elem,classNames){if(elem.nodeType==1)elem.className=classNames!=undefined?jQuery.grep(elem.className.split(/\s+/),function(className){return!jQuery.className.has(classNames,className);}).join(" "):"";},has:function(elem,className){return jQuery.inArray(className,(elem.className||elem).toString().split(/\s+/))>-1;}},swap:function(elem,options,callback){var old={};for(var name in options){old[name]=elem.style[name];elem.style[name]=options[name];}callback.call(elem);for(var name in options)elem.style[name]=old[name];},css:function(elem,name,force){if(name=="width"||name=="height"){var val,props={position:"absolute",visibility:"hidden",display:"block"},which=name=="width"?["Left","Right"]:["Top","Bottom"];function getWH(){val=name=="width"?elem.offsetWidth:elem.offsetHeight;var padding=0,border=0;jQuery.each(which,function(){padding+=parseFloat(jQuery.curCSS(elem,"padding"+this,true))||0;border+=parseFloat(jQuery.curCSS(elem,"border"+this+"Width",true))||0;});val-=Math.round(padding+border);}if(jQuery(elem).is(":visible"))getWH();else +jQuery.swap(elem,props,getWH);return Math.max(0,val);}return jQuery.curCSS(elem,name,force);},curCSS:function(elem,name,force){var ret,style=elem.style;function color(elem){if(!jQuery.browser.safari)return false;var ret=defaultView.getComputedStyle(elem,null);return!ret||ret.getPropertyValue("color")=="";}if(name=="opacity"&&jQuery.browser.msie){ret=jQuery.attr(style,"opacity");return ret==""?"1":ret;}if(jQuery.browser.opera&&name=="display"){var save=style.outline;style.outline="0 solid black";style.outline=save;}if(name.match(/float/i))name=styleFloat;if(!force&&style&&style[name])ret=style[name];else if(defaultView.getComputedStyle){if(name.match(/float/i))name="float";name=name.replace(/([A-Z])/g,"-$1").toLowerCase();var computedStyle=defaultView.getComputedStyle(elem,null);if(computedStyle&&!color(elem))ret=computedStyle.getPropertyValue(name);else{var swap=[],stack=[],a=elem,i=0;for(;a&&color(a);a=a.parentNode)stack.unshift(a);for(;i<stack.length;i++)if(color(stack[i])){swap[i]=stack[i].style.display;stack[i].style.display="block";}ret=name=="display"&&swap[stack.length-1]!=null?"none":(computedStyle&&computedStyle.getPropertyValue(name))||"";for(i=0;i<swap.length;i++)if(swap[i]!=null)stack[i].style.display=swap[i];}if(name=="opacity"&&ret=="")ret="1";}else if(elem.currentStyle){var camelCase=name.replace(/\-(\w)/g,function(all,letter){return letter.toUpperCase();});ret=elem.currentStyle[name]||elem.currentStyle[camelCase];if(!/^\d+(px)?$/i.test(ret)&&/^\d/.test(ret)){var left=style.left,rsLeft=elem.runtimeStyle.left;elem.runtimeStyle.left=elem.currentStyle.left;style.left=ret||0;ret=style.pixelLeft+"px";style.left=left;elem.runtimeStyle.left=rsLeft;}}return ret;},clean:function(elems,context){var ret=[];context=context||document;if(typeof context.createElement=='undefined')context=context.ownerDocument||context[0]&&context[0].ownerDocument||document;jQuery.each(elems,function(i,elem){if(!elem)return;if(elem.constructor==Number)elem+='';if(typeof elem=="string"){elem=elem.replace(/(<(\w+)[^>]*?)\/>/g,function(all,front,tag){return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?all:front+"></"+tag+">";});var tags=jQuery.trim(elem).toLowerCase(),div=context.createElement("div");var wrap=!tags.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!tags.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||tags.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!tags.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!tags.indexOf("<td")||!tags.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!tags.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||jQuery.browser.msie&&[1,"div<div>","</div>"]||[0,"",""];div.innerHTML=wrap[1]+elem+wrap[2];while(wrap[0]--)div=div.lastChild;if(jQuery.browser.msie){var tbody=!tags.indexOf("<table")&&tags.indexOf("<tbody")<0?div.firstChild&&div.firstChild.childNodes:wrap[1]=="<table>"&&tags.indexOf("<tbody")<0?div.childNodes:[];for(var j=tbody.length-1;j>=0;--j)if(jQuery.nodeName(tbody[j],"tbody")&&!tbody[j].childNodes.length)tbody[j].parentNode.removeChild(tbody[j]);if(/^\s/.test(elem))div.insertBefore(context.createTextNode(elem.match(/^\s*/)[0]),div.firstChild);}elem=jQuery.makeArray(div.childNodes);}if(elem.length===0&&(!jQuery.nodeName(elem,"form")&&!jQuery.nodeName(elem,"select")))return;if(elem[0]==undefined||jQuery.nodeName(elem,"form")||elem.options)ret.push(elem);else +ret=jQuery.merge(ret,elem);});return ret;},attr:function(elem,name,value){if(!elem||elem.nodeType==3||elem.nodeType==8)return undefined;var notxml=!jQuery.isXMLDoc(elem),set=value!==undefined,msie=jQuery.browser.msie;name=notxml&&jQuery.props[name]||name;if(elem.tagName){var special=/href|src|style/.test(name);if(name=="selected"&&jQuery.browser.safari)elem.parentNode.selectedIndex;if(name in elem&¬xml&&!special){if(set){if(name=="type"&&jQuery.nodeName(elem,"input")&&elem.parentNode)throw"type property can't be changed";elem[name]=value;}if(jQuery.nodeName(elem,"form")&&elem.getAttributeNode(name))return elem.getAttributeNode(name).nodeValue;return elem[name];}if(msie&¬xml&&name=="style")return jQuery.attr(elem.style,"cssText",value);if(set)elem.setAttribute(name,""+value);var attr=msie&¬xml&&special?elem.getAttribute(name,2):elem.getAttribute(name);return attr===null?undefined:attr;}if(msie&&name=="opacity"){if(set){elem.zoom=1;elem.filter=(elem.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(value)+''=="NaN"?"":"alpha(opacity="+value*100+")");}return elem.filter&&elem.filter.indexOf("opacity=")>=0?(parseFloat(elem.filter.match(/opacity=([^)]*)/)[1])/100)+'':"";}name=name.replace(/-([a-z])/ig,function(all,letter){return letter.toUpperCase();});if(set)elem[name]=value;return elem[name];},trim:function(text){return(text||"").replace(/^\s+|\s+$/g,"");},makeArray:function(array){var ret=[];if(array!=null){var i=array.length;if(i==null||array.split||array.setInterval||array.call)ret[0]=array;else +while(i)ret[--i]=array[i];}return ret;},inArray:function(elem,array){for(var i=0,length=array.length;i<length;i++)if(array[i]===elem)return i;return-1;},merge:function(first,second){var i=0,elem,pos=first.length;if(jQuery.browser.msie){while(elem=second[i++])if(elem.nodeType!=8)first[pos++]=elem;}else +while(elem=second[i++])first[pos++]=elem;return first;},unique:function(array){var ret=[],done={};try{for(var i=0,length=array.length;i<length;i++){var id=jQuery.data(array[i]);if(!done[id]){done[id]=true;ret.push(array[i]);}}}catch(e){ret=array;}return ret;},grep:function(elems,callback,inv){var ret=[];for(var i=0,length=elems.length;i<length;i++)if(!inv!=!callback(elems[i],i))ret.push(elems[i]);return ret;},map:function(elems,callback){var ret=[];for(var i=0,length=elems.length;i<length;i++){var value=callback(elems[i],i);if(value!=null)ret[ret.length]=value;}return ret.concat.apply([],ret);}});var userAgent=navigator.userAgent.toLowerCase();jQuery.browser={version:(userAgent.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[])[1],safari:/webkit/.test(userAgent),opera:/opera/.test(userAgent),msie:/msie/.test(userAgent)&&!/opera/.test(userAgent),mozilla:/mozilla/.test(userAgent)&&!/(compatible|webkit)/.test(userAgent)};var styleFloat=jQuery.browser.msie?"styleFloat":"cssFloat";jQuery.extend({boxModel:!jQuery.browser.msie||document.compatMode=="CSS1Compat",props:{"for":"htmlFor","class":"className","float":styleFloat,cssFloat:styleFloat,styleFloat:styleFloat,readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing"}});jQuery.each({parent:function(elem){return elem.parentNode;},parents:function(elem){return jQuery.dir(elem,"parentNode");},next:function(elem){return jQuery.nth(elem,2,"nextSibling");},prev:function(elem){return jQuery.nth(elem,2,"previousSibling");},nextAll:function(elem){return jQuery.dir(elem,"nextSibling");},prevAll:function(elem){return jQuery.dir(elem,"previousSibling");},siblings:function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem);},children:function(elem){return jQuery.sibling(elem.firstChild);},contents:function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes);}},function(name,fn){jQuery.fn[name]=function(selector){var ret=jQuery.map(this,fn);if(selector&&typeof selector=="string")ret=jQuery.multiFilter(selector,ret);return this.pushStack(jQuery.unique(ret));};});jQuery.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(name,original){jQuery.fn[name]=function(){var args=arguments;return this.each(function(){for(var i=0,length=args.length;i<length;i++)jQuery(args[i])[original](this);});};});jQuery.each({removeAttr:function(name){jQuery.attr(this,name,"");if(this.nodeType==1)this.removeAttribute(name);},addClass:function(classNames){jQuery.className.add(this,classNames);},removeClass:function(classNames){jQuery.className.remove(this,classNames);},toggleClass:function(classNames){jQuery.className[jQuery.className.has(this,classNames)?"remove":"add"](this,classNames);},remove:function(selector){if(!selector||jQuery.filter(selector,[this]).r.length){jQuery("*",this).add(this).each(function(){jQuery.event.remove(this);jQuery.removeData(this);});if(this.parentNode)this.parentNode.removeChild(this);}},empty:function(){jQuery(">*",this).remove();while(this.firstChild)this.removeChild(this.firstChild);}},function(name,fn){jQuery.fn[name]=function(){return this.each(fn,arguments);};});jQuery.each(["Height","Width"],function(i,name){var type=name.toLowerCase();jQuery.fn[type]=function(size){return this[0]==window?jQuery.browser.opera&&document.body["client"+name]||jQuery.browser.safari&&window["inner"+name]||document.compatMode=="CSS1Compat"&&document.documentElement["client"+name]||document.body["client"+name]:this[0]==document?Math.max(Math.max(document.body["scroll"+name],document.documentElement["scroll"+name]),Math.max(document.body["offset"+name],document.documentElement["offset"+name])):size==undefined?(this.length?jQuery.css(this[0],type):null):this.css(type,size.constructor==String?size:size+"px");};});function num(elem,prop){return elem[0]&&parseInt(jQuery.curCSS(elem[0],prop,true),10)||0;}var chars=jQuery.browser.safari&&parseInt(jQuery.browser.version)<417?"(?:[\\w*_-]|\\\\.)":"(?:[\\w\u0128-\uFFFF*_-]|\\\\.)",quickChild=new RegExp("^>\\s*("+chars+"+)"),quickID=new RegExp("^("+chars+"+)(#)("+chars+"+)"),quickClass=new RegExp("^([#.]?)("+chars+"*)");jQuery.extend({expr:{"":function(a,i,m){return m[2]=="*"||jQuery.nodeName(a,m[2]);},"#":function(a,i,m){return a.getAttribute("id")==m[2];},":":{lt:function(a,i,m){return i<m[3]-0;},gt:function(a,i,m){return i>m[3]-0;},nth:function(a,i,m){return m[3]-0==i;},eq:function(a,i,m){return m[3]-0==i;},first:function(a,i){return i==0;},last:function(a,i,m,r){return i==r.length-1;},even:function(a,i){return i%2==0;},odd:function(a,i){return i%2;},"first-child":function(a){return a.parentNode.getElementsByTagName("*")[0]==a;},"last-child":function(a){return jQuery.nth(a.parentNode.lastChild,1,"previousSibling")==a;},"only-child":function(a){return!jQuery.nth(a.parentNode.lastChild,2,"previousSibling");},parent:function(a){return a.firstChild;},empty:function(a){return!a.firstChild;},contains:function(a,i,m){return(a.textContent||a.innerText||jQuery(a).text()||"").indexOf(m[3])>=0;},visible:function(a){return"hidden"!=a.type&&jQuery.css(a,"display")!="none"&&jQuery.css(a,"visibility")!="hidden";},hidden:function(a){return"hidden"==a.type||jQuery.css(a,"display")=="none"||jQuery.css(a,"visibility")=="hidden";},enabled:function(a){return!a.disabled;},disabled:function(a){return a.disabled;},checked:function(a){return a.checked;},selected:function(a){return a.selected||jQuery.attr(a,"selected");},text:function(a){return"text"==a.type;},radio:function(a){return"radio"==a.type;},checkbox:function(a){return"checkbox"==a.type;},file:function(a){return"file"==a.type;},password:function(a){return"password"==a.type;},submit:function(a){return"submit"==a.type;},image:function(a){return"image"==a.type;},reset:function(a){return"reset"==a.type;},button:function(a){return"button"==a.type||jQuery.nodeName(a,"button");},input:function(a){return/input|select|textarea|button/i.test(a.nodeName);},has:function(a,i,m){return jQuery.find(m[3],a).length;},header:function(a){return/h\d/i.test(a.nodeName);},animated:function(a){return jQuery.grep(jQuery.timers,function(fn){return a==fn.elem;}).length;}}},parse:[/^(\[) *@?([\w-]+) *([!*$^~=]*) *('?"?)(.*?)\4 *\]/,/^(:)([\w-]+)\("?'?(.*?(\(.*?\))?[^(]*?)"?'?\)/,new RegExp("^([:.#]*)("+chars+"+)")],multiFilter:function(expr,elems,not){var old,cur=[];while(expr&&expr!=old){old=expr;var f=jQuery.filter(expr,elems,not);expr=f.t.replace(/^\s*,\s*/,"");cur=not?elems=f.r:jQuery.merge(cur,f.r);}return cur;},find:function(t,context){if(typeof t!="string")return[t];if(context&&context.nodeType!=1&&context.nodeType!=9)return[];context=context||document;var ret=[context],done=[],last,nodeName;while(t&&last!=t){var r=[];last=t;t=jQuery.trim(t);var foundToken=false,re=quickChild,m=re.exec(t);if(m){nodeName=m[1].toUpperCase();for(var i=0;ret[i];i++)for(var c=ret[i].firstChild;c;c=c.nextSibling)if(c.nodeType==1&&(nodeName=="*"||c.nodeName.toUpperCase()==nodeName))r.push(c);ret=r;t=t.replace(re,"");if(t.indexOf(" ")==0)continue;foundToken=true;}else{re=/^([>+~])\s*(\w*)/i;if((m=re.exec(t))!=null){r=[];var merge={};nodeName=m[2].toUpperCase();m=m[1];for(var j=0,rl=ret.length;j<rl;j++){var n=m=="~"||m=="+"?ret[j].nextSibling:ret[j].firstChild;for(;n;n=n.nextSibling)if(n.nodeType==1){var id=jQuery.data(n);if(m=="~"&&merge[id])break;if(!nodeName||n.nodeName.toUpperCase()==nodeName){if(m=="~")merge[id]=true;r.push(n);}if(m=="+")break;}}ret=r;t=jQuery.trim(t.replace(re,""));foundToken=true;}}if(t&&!foundToken){if(!t.indexOf(",")){if(context==ret[0])ret.shift();done=jQuery.merge(done,ret);r=ret=[context];t=" "+t.substr(1,t.length);}else{var re2=quickID;var m=re2.exec(t);if(m){m=[0,m[2],m[3],m[1]];}else{re2=quickClass;m=re2.exec(t);}m[2]=m[2].replace(/\\/g,"");var elem=ret[ret.length-1];if(m[1]=="#"&&elem&&elem.getElementById&&!jQuery.isXMLDoc(elem)){var oid=elem.getElementById(m[2]);if((jQuery.browser.msie||jQuery.browser.opera)&&oid&&typeof oid.id=="string"&&oid.id!=m[2])oid=jQuery('[@id="'+m[2]+'"]',elem)[0];ret=r=oid&&(!m[3]||jQuery.nodeName(oid,m[3]))?[oid]:[];}else{for(var i=0;ret[i];i++){var tag=m[1]=="#"&&m[3]?m[3]:m[1]!=""||m[0]==""?"*":m[2];if(tag=="*"&&ret[i].nodeName.toLowerCase()=="object")tag="param";r=jQuery.merge(r,ret[i].getElementsByTagName(tag));}if(m[1]==".")r=jQuery.classFilter(r,m[2]);if(m[1]=="#"){var tmp=[];for(var i=0;r[i];i++)if(r[i].getAttribute("id")==m[2]){tmp=[r[i]];break;}r=tmp;}ret=r;}t=t.replace(re2,"");}}if(t){var val=jQuery.filter(t,r);ret=r=val.r;t=jQuery.trim(val.t);}}if(t)ret=[];if(ret&&context==ret[0])ret.shift();done=jQuery.merge(done,ret);return done;},classFilter:function(r,m,not){m=" "+m+" ";var tmp=[];for(var i=0;r[i];i++){var pass=(" "+r[i].className+" ").indexOf(m)>=0;if(!not&&pass||not&&!pass)tmp.push(r[i]);}return tmp;},filter:function(t,r,not){var last;while(t&&t!=last){last=t;var p=jQuery.parse,m;for(var i=0;p[i];i++){m=p[i].exec(t);if(m){t=t.substring(m[0].length);m[2]=m[2].replace(/\\/g,"");break;}}if(!m)break;if(m[1]==":"&&m[2]=="not")r=isSimple.test(m[3])?jQuery.filter(m[3],r,true).r:jQuery(r).not(m[3]);else if(m[1]==".")r=jQuery.classFilter(r,m[2],not);else if(m[1]=="["){var tmp=[],type=m[3];for(var i=0,rl=r.length;i<rl;i++){var a=r[i],z=a[jQuery.props[m[2]]||m[2]];if(z==null||/href|src|selected/.test(m[2]))z=jQuery.attr(a,m[2])||'';if((type==""&&!!z||type=="="&&z==m[5]||type=="!="&&z!=m[5]||type=="^="&&z&&!z.indexOf(m[5])||type=="$="&&z.substr(z.length-m[5].length)==m[5]||(type=="*="||type=="~=")&&z.indexOf(m[5])>=0)^not)tmp.push(a);}r=tmp;}else if(m[1]==":"&&m[2]=="nth-child"){var merge={},tmp=[],test=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(m[3]=="even"&&"2n"||m[3]=="odd"&&"2n+1"||!/\D/.test(m[3])&&"0n+"+m[3]||m[3]),first=(test[1]+(test[2]||1))-0,last=test[3]-0;for(var i=0,rl=r.length;i<rl;i++){var node=r[i],parentNode=node.parentNode,id=jQuery.data(parentNode);if(!merge[id]){var c=1;for(var n=parentNode.firstChild;n;n=n.nextSibling)if(n.nodeType==1)n.nodeIndex=c++;merge[id]=true;}var add=false;if(first==0){if(node.nodeIndex==last)add=true;}else if((node.nodeIndex-last)%first==0&&(node.nodeIndex-last)/first>=0)add=true;if(add^not)tmp.push(node);}r=tmp;}else{var fn=jQuery.expr[m[1]];if(typeof fn=="object")fn=fn[m[2]];if(typeof fn=="string")fn=eval("false||function(a,i){return "+fn+";}");r=jQuery.grep(r,function(elem,i){return fn(elem,i,m,r);},not);}}return{r:r,t:t};},dir:function(elem,dir){var matched=[],cur=elem[dir];while(cur&&cur!=document){if(cur.nodeType==1)matched.push(cur);cur=cur[dir];}return matched;},nth:function(cur,result,dir,elem){result=result||1;var num=0;for(;cur;cur=cur[dir])if(cur.nodeType==1&&++num==result)break;return cur;},sibling:function(n,elem){var r=[];for(;n;n=n.nextSibling){if(n.nodeType==1&&n!=elem)r.push(n);}return r;}});jQuery.event={add:function(elem,types,handler,data){if(elem.nodeType==3||elem.nodeType==8)return;if(jQuery.browser.msie&&elem.setInterval)elem=window;if(!handler.guid)handler.guid=this.guid++;if(data!=undefined){var fn=handler;handler=this.proxy(fn,function(){return fn.apply(this,arguments);});handler.data=data;}var events=jQuery.data(elem,"events")||jQuery.data(elem,"events",{}),handle=jQuery.data(elem,"handle")||jQuery.data(elem,"handle",function(){if(typeof jQuery!="undefined"&&!jQuery.event.triggered)return jQuery.event.handle.apply(arguments.callee.elem,arguments);});handle.elem=elem;jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];handler.type=parts[1];var handlers=events[type];if(!handlers){handlers=events[type]={};if(!jQuery.event.special[type]||jQuery.event.special[type].setup.call(elem)===false){if(elem.addEventListener)elem.addEventListener(type,handle,false);else if(elem.attachEvent)elem.attachEvent("on"+type,handle);}}handlers[handler.guid]=handler;jQuery.event.global[type]=true;});elem=null;},guid:1,global:{},remove:function(elem,types,handler){if(elem.nodeType==3||elem.nodeType==8)return;var events=jQuery.data(elem,"events"),ret,index;if(events){if(types==undefined||(typeof types=="string"&&types.charAt(0)=="."))for(var type in events)this.remove(elem,type+(types||""));else{if(types.type){handler=types.handler;types=types.type;}jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];if(events[type]){if(handler)delete events[type][handler.guid];else +for(handler in events[type])if(!parts[1]||events[type][handler].type==parts[1])delete events[type][handler];for(ret in events[type])break;if(!ret){if(!jQuery.event.special[type]||jQuery.event.special[type].teardown.call(elem)===false){if(elem.removeEventListener)elem.removeEventListener(type,jQuery.data(elem,"handle"),false);else if(elem.detachEvent)elem.detachEvent("on"+type,jQuery.data(elem,"handle"));}ret=null;delete events[type];}}});}for(ret in events)break;if(!ret){var handle=jQuery.data(elem,"handle");if(handle)handle.elem=null;jQuery.removeData(elem,"events");jQuery.removeData(elem,"handle");}}},trigger:function(type,data,elem,donative,extra){data=jQuery.makeArray(data);if(type.indexOf("!")>=0){type=type.slice(0,-1);var exclusive=true;}if(!elem){if(this.global[type])jQuery("*").add([window,document]).trigger(type,data);}else{if(elem.nodeType==3||elem.nodeType==8)return undefined;var val,ret,fn=jQuery.isFunction(elem[type]||null),event=!data[0]||!data[0].preventDefault;if(event){data.unshift({type:type,target:elem,preventDefault:function(){},stopPropagation:function(){},timeStamp:now()});data[0][expando]=true;}data[0].type=type;if(exclusive)data[0].exclusive=true;var handle=jQuery.data(elem,"handle");if(handle)val=handle.apply(elem,data);if((!fn||(jQuery.nodeName(elem,'a')&&type=="click"))&&elem["on"+type]&&elem["on"+type].apply(elem,data)===false)val=false;if(event)data.shift();if(extra&&jQuery.isFunction(extra)){ret=extra.apply(elem,val==null?data:data.concat(val));if(ret!==undefined)val=ret;}if(fn&&donative!==false&&val!==false&&!(jQuery.nodeName(elem,'a')&&type=="click")){this.triggered=true;try{elem[type]();}catch(e){}}this.triggered=false;}return val;},handle:function(event){var val,ret,namespace,all,handlers;event=arguments[0]=jQuery.event.fix(event||window.event);namespace=event.type.split(".");event.type=namespace[0];namespace=namespace[1];all=!namespace&&!event.exclusive;handlers=(jQuery.data(this,"events")||{})[event.type];for(var j in handlers){var handler=handlers[j];if(all||handler.type==namespace){event.handler=handler;event.data=handler.data;ret=handler.apply(this,arguments);if(val!==false)val=ret;if(ret===false){event.preventDefault();event.stopPropagation();}}}return val;},fix:function(event){if(event[expando]==true)return event;var originalEvent=event;event={originalEvent:originalEvent};var props="altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target timeStamp toElement type view wheelDelta which".split(" ");for(var i=props.length;i;i--)event[props[i]]=originalEvent[props[i]];event[expando]=true;event.preventDefault=function(){if(originalEvent.preventDefault)originalEvent.preventDefault();originalEvent.returnValue=false;};event.stopPropagation=function(){if(originalEvent.stopPropagation)originalEvent.stopPropagation();originalEvent.cancelBubble=true;};event.timeStamp=event.timeStamp||now();if(!event.target)event.target=event.srcElement||document;if(event.target.nodeType==3)event.target=event.target.parentNode;if(!event.relatedTarget&&event.fromElement)event.relatedTarget=event.fromElement==event.target?event.toElement:event.fromElement;if(event.pageX==null&&event.clientX!=null){var doc=document.documentElement,body=document.body;event.pageX=event.clientX+(doc&&doc.scrollLeft||body&&body.scrollLeft||0)-(doc.clientLeft||0);event.pageY=event.clientY+(doc&&doc.scrollTop||body&&body.scrollTop||0)-(doc.clientTop||0);}if(!event.which&&((event.charCode||event.charCode===0)?event.charCode:event.keyCode))event.which=event.charCode||event.keyCode;if(!event.metaKey&&event.ctrlKey)event.metaKey=event.ctrlKey;if(!event.which&&event.button)event.which=(event.button&1?1:(event.button&2?3:(event.button&4?2:0)));return event;},proxy:function(fn,proxy){proxy.guid=fn.guid=fn.guid||proxy.guid||this.guid++;return proxy;},special:{ready:{setup:function(){bindReady();return;},teardown:function(){return;}},mouseenter:{setup:function(){if(jQuery.browser.msie)return false;jQuery(this).bind("mouseover",jQuery.event.special.mouseenter.handler);return true;},teardown:function(){if(jQuery.browser.msie)return false;jQuery(this).unbind("mouseover",jQuery.event.special.mouseenter.handler);return true;},handler:function(event){if(withinElement(event,this))return true;event.type="mouseenter";return jQuery.event.handle.apply(this,arguments);}},mouseleave:{setup:function(){if(jQuery.browser.msie)return false;jQuery(this).bind("mouseout",jQuery.event.special.mouseleave.handler);return true;},teardown:function(){if(jQuery.browser.msie)return false;jQuery(this).unbind("mouseout",jQuery.event.special.mouseleave.handler);return true;},handler:function(event){if(withinElement(event,this))return true;event.type="mouseleave";return jQuery.event.handle.apply(this,arguments);}}}};jQuery.fn.extend({bind:function(type,data,fn){return type=="unload"?this.one(type,data,fn):this.each(function(){jQuery.event.add(this,type,fn||data,fn&&data);});},one:function(type,data,fn){var one=jQuery.event.proxy(fn||data,function(event){jQuery(this).unbind(event,one);return(fn||data).apply(this,arguments);});return this.each(function(){jQuery.event.add(this,type,one,fn&&data);});},unbind:function(type,fn){return this.each(function(){jQuery.event.remove(this,type,fn);});},trigger:function(type,data,fn){return this.each(function(){jQuery.event.trigger(type,data,this,true,fn);});},triggerHandler:function(type,data,fn){return this[0]&&jQuery.event.trigger(type,data,this[0],false,fn);},toggle:function(fn){var args=arguments,i=1;while(i<args.length)jQuery.event.proxy(fn,args[i++]);return this.click(jQuery.event.proxy(fn,function(event){this.lastToggle=(this.lastToggle||0)%i;event.preventDefault();return args[this.lastToggle++].apply(this,arguments)||false;}));},hover:function(fnOver,fnOut){return this.bind('mouseenter',fnOver).bind('mouseleave',fnOut);},ready:function(fn){bindReady();if(jQuery.isReady)fn.call(document,jQuery);else +jQuery.readyList.push(function(){return fn.call(this,jQuery);});return this;}});jQuery.extend({isReady:false,readyList:[],ready:function(){if(!jQuery.isReady){jQuery.isReady=true;if(jQuery.readyList){jQuery.each(jQuery.readyList,function(){this.call(document);});jQuery.readyList=null;}jQuery(document).triggerHandler("ready");}}});var readyBound=false;function bindReady(){if(readyBound)return;readyBound=true;if(document.addEventListener&&!jQuery.browser.opera)document.addEventListener("DOMContentLoaded",jQuery.ready,false);if(jQuery.browser.msie&&window==top)(function(){if(jQuery.isReady)return;try{document.documentElement.doScroll("left");}catch(error){setTimeout(arguments.callee,0);return;}jQuery.ready();})();if(jQuery.browser.opera)document.addEventListener("DOMContentLoaded",function(){if(jQuery.isReady)return;for(var i=0;i<document.styleSheets.length;i++)if(document.styleSheets[i].disabled){setTimeout(arguments.callee,0);return;}jQuery.ready();},false);if(jQuery.browser.safari){var numStyles;(function(){if(jQuery.isReady)return;if(document.readyState!="loaded"&&document.readyState!="complete"){setTimeout(arguments.callee,0);return;}if(numStyles===undefined)numStyles=jQuery("style, link[rel=stylesheet]").length;if(document.styleSheets.length!=numStyles){setTimeout(arguments.callee,0);return;}jQuery.ready();})();}jQuery.event.add(window,"load",jQuery.ready);}jQuery.each(("blur,focus,load,resize,scroll,unload,click,dblclick,"+"mousedown,mouseup,mousemove,mouseover,mouseout,change,select,"+"submit,keydown,keypress,keyup,error").split(","),function(i,name){jQuery.fn[name]=function(fn){return fn?this.bind(name,fn):this.trigger(name);};});var withinElement=function(event,elem){var parent=event.relatedTarget;while(parent&&parent!=elem)try{parent=parent.parentNode;}catch(error){parent=elem;}return parent==elem;};jQuery(window).bind("unload",function(){jQuery("*").add(document).unbind();});jQuery.fn.extend({_load:jQuery.fn.load,load:function(url,params,callback){if(typeof url!='string')return this._load(url);var off=url.indexOf(" ");if(off>=0){var selector=url.slice(off,url.length);url=url.slice(0,off);}callback=callback||function(){};var type="GET";if(params)if(jQuery.isFunction(params)){callback=params;params=null;}else{params=jQuery.param(params);type="POST";}var self=this;jQuery.ajax({url:url,type:type,dataType:"html",data:params,complete:function(res,status){if(status=="success"||status=="notmodified")self.html(selector?jQuery("<div/>").append(res.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(selector):res.responseText);self.each(callback,[res.responseText,status,res]);}});return this;},serialize:function(){return jQuery.param(this.serializeArray());},serializeArray:function(){return this.map(function(){return jQuery.nodeName(this,"form")?jQuery.makeArray(this.elements):this;}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password/i.test(this.type));}).map(function(i,elem){var val=jQuery(this).val();return val==null?null:val.constructor==Array?jQuery.map(val,function(val,i){return{name:elem.name,value:val};}):{name:elem.name,value:val};}).get();}});jQuery.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(i,o){jQuery.fn[o]=function(f){return this.bind(o,f);};});var jsc=now();jQuery.extend({get:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data=null;}return jQuery.ajax({type:"GET",url:url,data:data,success:callback,dataType:type});},getScript:function(url,callback){return jQuery.get(url,null,callback,"script");},getJSON:function(url,data,callback){return jQuery.get(url,data,callback,"json");},post:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data={};}return jQuery.ajax({type:"POST",url:url,data:data,success:callback,dataType:type});},ajaxSetup:function(settings){jQuery.extend(jQuery.ajaxSettings,settings);},ajaxSettings:{url:location.href,global:true,type:"GET",timeout:0,contentType:"application/x-www-form-urlencoded",processData:true,async:true,data:null,username:null,password:null,accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(s){s=jQuery.extend(true,s,jQuery.extend(true,{},jQuery.ajaxSettings,s));var jsonp,jsre=/=\?(&|$)/g,status,data,type=s.type.toUpperCase();if(s.data&&s.processData&&typeof s.data!="string")s.data=jQuery.param(s.data);if(s.dataType=="jsonp"){if(type=="GET"){if(!s.url.match(jsre))s.url+=(s.url.match(/\?/)?"&":"?")+(s.jsonp||"callback")+"=?";}else if(!s.data||!s.data.match(jsre))s.data=(s.data?s.data+"&":"")+(s.jsonp||"callback")+"=?";s.dataType="json";}if(s.dataType=="json"&&(s.data&&s.data.match(jsre)||s.url.match(jsre))){jsonp="jsonp"+jsc++;if(s.data)s.data=(s.data+"").replace(jsre,"="+jsonp+"$1");s.url=s.url.replace(jsre,"="+jsonp+"$1");s.dataType="script";window[jsonp]=function(tmp){data=tmp;success();complete();window[jsonp]=undefined;try{delete window[jsonp];}catch(e){}if(head)head.removeChild(script);};}if(s.dataType=="script"&&s.cache==null)s.cache=false;if(s.cache===false&&type=="GET"){var ts=now();var ret=s.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+ts+"$2");s.url=ret+((ret==s.url)?(s.url.match(/\?/)?"&":"?")+"_="+ts:"");}if(s.data&&type=="GET"){s.url+=(s.url.match(/\?/)?"&":"?")+s.data;s.data=null;}if(s.global&&!jQuery.active++)jQuery.event.trigger("ajaxStart");var remote=/^(?:\w+:)?\/\/([^\/?#]+)/;if(s.dataType=="script"&&type=="GET"&&remote.test(s.url)&&remote.exec(s.url)[1]!=location.host){var head=document.getElementsByTagName("head")[0];var script=document.createElement("script");script.src=s.url;if(s.scriptCharset)script.charset=s.scriptCharset;if(!jsonp){var done=false;script.onload=script.onreadystatechange=function(){if(!done&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){done=true;success();complete();head.removeChild(script);}};}head.appendChild(script);return undefined;}var requestDone=false;var xhr=window.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest();if(s.username)xhr.open(type,s.url,s.async,s.username,s.password);else +xhr.open(type,s.url,s.async);try{if(s.data)xhr.setRequestHeader("Content-Type",s.contentType);if(s.ifModified)xhr.setRequestHeader("If-Modified-Since",jQuery.lastModified[s.url]||"Thu, 01 Jan 1970 00:00:00 GMT");xhr.setRequestHeader("X-Requested-With","XMLHttpRequest");xhr.setRequestHeader("Accept",s.dataType&&s.accepts[s.dataType]?s.accepts[s.dataType]+", */*":s.accepts._default);}catch(e){}if(s.beforeSend&&s.beforeSend(xhr,s)===false){s.global&&jQuery.active--;xhr.abort();return false;}if(s.global)jQuery.event.trigger("ajaxSend",[xhr,s]);var onreadystatechange=function(isTimeout){if(!requestDone&&xhr&&(xhr.readyState==4||isTimeout=="timeout")){requestDone=true;if(ival){clearInterval(ival);ival=null;}status=isTimeout=="timeout"&&"timeout"||!jQuery.httpSuccess(xhr)&&"error"||s.ifModified&&jQuery.httpNotModified(xhr,s.url)&&"notmodified"||"success";if(status=="success"){try{data=jQuery.httpData(xhr,s.dataType,s.dataFilter);}catch(e){status="parsererror";}}if(status=="success"){var modRes;try{modRes=xhr.getResponseHeader("Last-Modified");}catch(e){}if(s.ifModified&&modRes)jQuery.lastModified[s.url]=modRes;if(!jsonp)success();}else +jQuery.handleError(s,xhr,status);complete();if(s.async)xhr=null;}};if(s.async){var ival=setInterval(onreadystatechange,13);if(s.timeout>0)setTimeout(function(){if(xhr){xhr.abort();if(!requestDone)onreadystatechange("timeout");}},s.timeout);}try{xhr.send(s.data);}catch(e){jQuery.handleError(s,xhr,null,e);}if(!s.async)onreadystatechange();function success(){if(s.success)s.success(data,status);if(s.global)jQuery.event.trigger("ajaxSuccess",[xhr,s]);}function complete(){if(s.complete)s.complete(xhr,status);if(s.global)jQuery.event.trigger("ajaxComplete",[xhr,s]);if(s.global&&!--jQuery.active)jQuery.event.trigger("ajaxStop");}return xhr;},handleError:function(s,xhr,status,e){if(s.error)s.error(xhr,status,e);if(s.global)jQuery.event.trigger("ajaxError",[xhr,s,e]);},active:0,httpSuccess:function(xhr){try{return!xhr.status&&location.protocol=="file:"||(xhr.status>=200&&xhr.status<300)||xhr.status==304||xhr.status==1223||jQuery.browser.safari&&xhr.status==undefined;}catch(e){}return false;},httpNotModified:function(xhr,url){try{var xhrRes=xhr.getResponseHeader("Last-Modified");return xhr.status==304||xhrRes==jQuery.lastModified[url]||jQuery.browser.safari&&xhr.status==undefined;}catch(e){}return false;},httpData:function(xhr,type,filter){var ct=xhr.getResponseHeader("content-type"),xml=type=="xml"||!type&&ct&&ct.indexOf("xml")>=0,data=xml?xhr.responseXML:xhr.responseText;if(xml&&data.documentElement.tagName=="parsererror")throw"parsererror";if(filter)data=filter(data,type);if(type=="script")jQuery.globalEval(data);if(type=="json")data=eval("("+data+")");return data;},param:function(a){var s=[];if(a.constructor==Array||a.jquery)jQuery.each(a,function(){s.push(encodeURIComponent(this.name)+"="+encodeURIComponent(this.value));});else +for(var j in a)if(a[j]&&a[j].constructor==Array)jQuery.each(a[j],function(){s.push(encodeURIComponent(j)+"="+encodeURIComponent(this));});else +s.push(encodeURIComponent(j)+"="+encodeURIComponent(jQuery.isFunction(a[j])?a[j]():a[j]));return s.join("&").replace(/%20/g,"+");}});jQuery.fn.extend({show:function(speed,callback){return speed?this.animate({height:"show",width:"show",opacity:"show"},speed,callback):this.filter(":hidden").each(function(){this.style.display=this.oldblock||"";if(jQuery.css(this,"display")=="none"){var elem=jQuery("<"+this.tagName+" />").appendTo("body");this.style.display=elem.css("display");if(this.style.display=="none")this.style.display="block";elem.remove();}}).end();},hide:function(speed,callback){return speed?this.animate({height:"hide",width:"hide",opacity:"hide"},speed,callback):this.filter(":visible").each(function(){this.oldblock=this.oldblock||jQuery.css(this,"display");this.style.display="none";}).end();},_toggle:jQuery.fn.toggle,toggle:function(fn,fn2){return jQuery.isFunction(fn)&&jQuery.isFunction(fn2)?this._toggle.apply(this,arguments):fn?this.animate({height:"toggle",width:"toggle",opacity:"toggle"},fn,fn2):this.each(function(){jQuery(this)[jQuery(this).is(":hidden")?"show":"hide"]();});},slideDown:function(speed,callback){return this.animate({height:"show"},speed,callback);},slideUp:function(speed,callback){return this.animate({height:"hide"},speed,callback);},slideToggle:function(speed,callback){return this.animate({height:"toggle"},speed,callback);},fadeIn:function(speed,callback){return this.animate({opacity:"show"},speed,callback);},fadeOut:function(speed,callback){return this.animate({opacity:"hide"},speed,callback);},fadeTo:function(speed,to,callback){return this.animate({opacity:to},speed,callback);},animate:function(prop,speed,easing,callback){var optall=jQuery.speed(speed,easing,callback);return this[optall.queue===false?"each":"queue"](function(){if(this.nodeType!=1)return false;var opt=jQuery.extend({},optall),p,hidden=jQuery(this).is(":hidden"),self=this;for(p in prop){if(prop[p]=="hide"&&hidden||prop[p]=="show"&&!hidden)return opt.complete.call(this);if(p=="height"||p=="width"){opt.display=jQuery.css(this,"display");opt.overflow=this.style.overflow;}}if(opt.overflow!=null)this.style.overflow="hidden";opt.curAnim=jQuery.extend({},prop);jQuery.each(prop,function(name,val){var e=new jQuery.fx(self,opt,name);if(/toggle|show|hide/.test(val))e[val=="toggle"?hidden?"show":"hide":val](prop);else{var parts=val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),start=e.cur(true)||0;if(parts){var end=parseFloat(parts[2]),unit=parts[3]||"px";if(unit!="px"){self.style[name]=(end||1)+unit;start=((end||1)/e.cur(true))*start;self.style[name]=start+unit;}if(parts[1])end=((parts[1]=="-="?-1:1)*end)+start;e.custom(start,end,unit);}else +e.custom(start,val,"");}});return true;});},queue:function(type,fn){if(jQuery.isFunction(type)||(type&&type.constructor==Array)){fn=type;type="fx";}if(!type||(typeof type=="string"&&!fn))return queue(this[0],type);return this.each(function(){if(fn.constructor==Array)queue(this,type,fn);else{queue(this,type).push(fn);if(queue(this,type).length==1)fn.call(this);}});},stop:function(clearQueue,gotoEnd){var timers=jQuery.timers;if(clearQueue)this.queue([]);this.each(function(){for(var i=timers.length-1;i>=0;i--)if(timers[i].elem==this){if(gotoEnd)timers[i](true);timers.splice(i,1);}});if(!gotoEnd)this.dequeue();return this;}});var queue=function(elem,type,array){if(elem){type=type||"fx";var q=jQuery.data(elem,type+"queue");if(!q||array)q=jQuery.data(elem,type+"queue",jQuery.makeArray(array));}return q;};jQuery.fn.dequeue=function(type){type=type||"fx";return this.each(function(){var q=queue(this,type);q.shift();if(q.length)q[0].call(this);});};jQuery.extend({speed:function(speed,easing,fn){var opt=speed&&speed.constructor==Object?speed:{complete:fn||!fn&&easing||jQuery.isFunction(speed)&&speed,duration:speed,easing:fn&&easing||easing&&easing.constructor!=Function&&easing};opt.duration=(opt.duration&&opt.duration.constructor==Number?opt.duration:jQuery.fx.speeds[opt.duration])||jQuery.fx.speeds.def;opt.old=opt.complete;opt.complete=function(){if(opt.queue!==false)jQuery(this).dequeue();if(jQuery.isFunction(opt.old))opt.old.call(this);};return opt;},easing:{linear:function(p,n,firstNum,diff){return firstNum+diff*p;},swing:function(p,n,firstNum,diff){return((-Math.cos(p*Math.PI)/2)+0.5)*diff+firstNum;}},timers:[],timerId:null,fx:function(elem,options,prop){this.options=options;this.elem=elem;this.prop=prop;if(!options.orig)options.orig={};}});jQuery.fx.prototype={update:function(){if(this.options.step)this.options.step.call(this.elem,this.now,this);(jQuery.fx.step[this.prop]||jQuery.fx.step._default)(this);if(this.prop=="height"||this.prop=="width")this.elem.style.display="block";},cur:function(force){if(this.elem[this.prop]!=null&&this.elem.style[this.prop]==null)return this.elem[this.prop];var r=parseFloat(jQuery.css(this.elem,this.prop,force));return r&&r>-10000?r:parseFloat(jQuery.curCSS(this.elem,this.prop))||0;},custom:function(from,to,unit){this.startTime=now();this.start=from;this.end=to;this.unit=unit||this.unit||"px";this.now=this.start;this.pos=this.state=0;this.update();var self=this;function t(gotoEnd){return self.step(gotoEnd);}t.elem=this.elem;jQuery.timers.push(t);if(jQuery.timerId==null){jQuery.timerId=setInterval(function(){var timers=jQuery.timers;for(var i=0;i<timers.length;i++)if(!timers[i]())timers.splice(i--,1);if(!timers.length){clearInterval(jQuery.timerId);jQuery.timerId=null;}},13);}},show:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);this.options.show=true;this.custom(0,this.cur());if(this.prop=="width"||this.prop=="height")this.elem.style[this.prop]="1px";jQuery(this.elem).show();},hide:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);this.options.hide=true;this.custom(this.cur(),0);},step:function(gotoEnd){var t=now();if(gotoEnd||t>this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var done=true;for(var i in this.options.curAnim)if(this.options.curAnim[i]!==true)done=false;if(done){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(jQuery.css(this.elem,"display")=="none")this.elem.style.display="block";}if(this.options.hide)this.elem.style.display="none";if(this.options.hide||this.options.show)for(var p in this.options.curAnim)jQuery.attr(this.elem.style,p,this.options.orig[p]);}if(done)this.options.complete.call(this.elem);return false;}else{var n=t-this.startTime;this.state=n/this.options.duration;this.pos=jQuery.easing[this.options.easing||(jQuery.easing.swing?"swing":"linear")](this.state,n,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update();}return true;}};jQuery.extend(jQuery.fx,{speeds:{slow:600,fast:200,def:400},step:{scrollLeft:function(fx){fx.elem.scrollLeft=fx.now;},scrollTop:function(fx){fx.elem.scrollTop=fx.now;},opacity:function(fx){jQuery.attr(fx.elem.style,"opacity",fx.now);},_default:function(fx){fx.elem.style[fx.prop]=fx.now+fx.unit;}}});jQuery.fn.offset=function(){var left=0,top=0,elem=this[0],results;if(elem)with(jQuery.browser){var parent=elem.parentNode,offsetChild=elem,offsetParent=elem.offsetParent,doc=elem.ownerDocument,safari2=safari&&parseInt(version)<522&&!/adobeair/i.test(userAgent),css=jQuery.curCSS,fixed=css(elem,"position")=="fixed";if(elem.getBoundingClientRect){var box=elem.getBoundingClientRect();add(box.left+Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),box.top+Math.max(doc.documentElement.scrollTop,doc.body.scrollTop));add(-doc.documentElement.clientLeft,-doc.documentElement.clientTop);}else{add(elem.offsetLeft,elem.offsetTop);while(offsetParent){add(offsetParent.offsetLeft,offsetParent.offsetTop);if(mozilla&&!/^t(able|d|h)$/i.test(offsetParent.tagName)||safari&&!safari2)border(offsetParent);if(!fixed&&css(offsetParent,"position")=="fixed")fixed=true;offsetChild=/^body$/i.test(offsetParent.tagName)?offsetChild:offsetParent;offsetParent=offsetParent.offsetParent;}while(parent&&parent.tagName&&!/^body|html$/i.test(parent.tagName)){if(!/^inline|table.*$/i.test(css(parent,"display")))add(-parent.scrollLeft,-parent.scrollTop);if(mozilla&&css(parent,"overflow")!="visible")border(parent);parent=parent.parentNode;}if((safari2&&(fixed||css(offsetChild,"position")=="absolute"))||(mozilla&&css(offsetChild,"position")!="absolute"))add(-doc.body.offsetLeft,-doc.body.offsetTop);if(fixed)add(Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),Math.max(doc.documentElement.scrollTop,doc.body.scrollTop));}results={top:top,left:left};}function border(elem){add(jQuery.curCSS(elem,"borderLeftWidth",true),jQuery.curCSS(elem,"borderTopWidth",true));}function add(l,t){left+=parseInt(l,10)||0;top+=parseInt(t,10)||0;}return results;};jQuery.fn.extend({position:function(){var left=0,top=0,results;if(this[0]){var offsetParent=this.offsetParent(),offset=this.offset(),parentOffset=/^body|html$/i.test(offsetParent[0].tagName)?{top:0,left:0}:offsetParent.offset();offset.top-=num(this,'marginTop');offset.left-=num(this,'marginLeft');parentOffset.top+=num(offsetParent,'borderTopWidth');parentOffset.left+=num(offsetParent,'borderLeftWidth');results={top:offset.top-parentOffset.top,left:offset.left-parentOffset.left};}return results;},offsetParent:function(){var offsetParent=this[0].offsetParent;while(offsetParent&&(!/^body|html$/i.test(offsetParent.tagName)&&jQuery.css(offsetParent,'position')=='static'))offsetParent=offsetParent.offsetParent;return jQuery(offsetParent);}});jQuery.each(['Left','Top'],function(i,name){var method='scroll'+name;jQuery.fn[method]=function(val){if(!this[0])return;return val!=undefined?this.each(function(){this==window||this==document?window.scrollTo(!i?val:jQuery(window).scrollLeft(),i?val:jQuery(window).scrollTop()):this[method]=val;}):this[0]==window||this[0]==document?self[i?'pageYOffset':'pageXOffset']||jQuery.boxModel&&document.documentElement[method]||document.body[method]:this[0][method];};});jQuery.each(["Height","Width"],function(i,name){var tl=i?"Left":"Top",br=i?"Right":"Bottom";jQuery.fn["inner"+name]=function(){return this[name.toLowerCase()]()+num(this,"padding"+tl)+num(this,"padding"+br);};jQuery.fn["outer"+name]=function(margin){return this["inner"+name]()+num(this,"border"+tl+"Width")+num(this,"border"+br+"Width")+(margin?num(this,"margin"+tl)+num(this,"margin"+br):0);};});})(); \ No newline at end of file diff --git a/modules/tntcarrier/relaisColis/js/relaisColis.js b/modules/tntcarrier/relaisColis/js/relaisColis.js new file mode 100644 index 000000000..f347bfd7c --- /dev/null +++ b/modules/tntcarrier/relaisColis/js/relaisColis.js @@ -0,0 +1,984 @@ +/** Javascript B2C Relais Colis - version 2.0 - 08/07/2010 **/ + +var pathToImages = "./modules/tntcarrier/relaisColis/img/"; +var tntDomain = "www.tnt.fr"; + +var tntRCcodePostal; +var tntRCCommune; +var tntRClisteRelais; +var tntRCJsonCommunes; + +var tntRCMsgHeaderTitle = "Mode de livraison"; +var tntRCMsgSubHeaderTitle = "Choisissez le Relais Colis<sup class='tntRCSup'>®</sup> qui vous convient :"; +var tntRCMsgHeaderPopup = "Détail"; +var tntRCMsgSubHeaderPopup = "Descriptif :"; +var tntRCMsgBodyLoading = "Chargement en cours..."; +var tntRCMsgBodyInput = "Entrez le code postal : "; +var tntRCMsgBodyBack2Communes = "Revenir à la liste des communes"; +var tntRCMsgErrCodePostal = "Veuillez saisir un code postal sur 5 chiffres"; +var tntRCMsgErrLoadCommunes = "Aucun Relais Colis® disponible"; +var tntRCMsgErrLoadRelais = "Aucun Relais Colis® disponible"; + +var tntRCsize800 = "550px"; +var tntRCsize789 = "589px"; +var tntRCsize670 = "470px"; +var tntRCsize650 = "450px"; +var tntRCsize50 = "50px"; +var tntRCsize8 = "8px"; +var tntRCsize5 = "5px"; +var tntRCsize6 = "6px"; +var tntRCsize10 = "10px"; +var tntRCsize30 = "30px"; +var tntRCsize109 = "109px"; +var tntRCsize442 = "362px"; +var tntRCsize447 = "387px"; +var tntRCsize218 = "178px"; +var tntRCsize253 = "213px"; +var tntRCsize20 = "20px"; +var tntRCsize392 = "352px"; +var tntRCsize412 = "332px"; + +function getURLParam(name) { + name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]"); + var regexS = "[\\?&]" + name + "=([^&#]*)"; + var regex = new RegExp( regexS ); + var results = regex.exec( window.location.href ); + if( results == null ) return ""; + else return results[1]; +}; + +// Chargement de la liste de relais colis après le choix de la commune parmis plusieurs +// communes correspondant au même code postal +function tntRCgetRelaisColisJSON(commune) +{ + if (!commune) { + // La commune du code postal correspond à la sélection du radio bouton tntRCchoixComm + tntRCCommune = $("input[@type=radio][@checked][@name=tntRCchoixComm]").val(); + } + else { + // Utilisation de la valeur fournie en paramètre + tntRCCommune = commune + } + + // Affichage message "chargement en cours" + tntRCsetChargementEnCours(); + + var ajaxUrl; + var ajaxData; + + ajaxUrl = "http://" + tntDomain + "/public/b2c/relaisColis/loadJson.do?cp=" + tntRCcodePostal + "&commune=" + tntRCCommune; + ajaxData = ""; + + // Chargement de la liste de relais colis + $.ajax({ + type: "GET", + url: ajaxUrl, + data: ajaxData, + dataType: "script" + }); +}; + +// Affichage d'une liste de relais colis +function tntRCafficheRelais(jData) { + + var jMessage = $('#blocCodePostal'); + + var tntRCjTable = $("<table style='border:1px solid gray;' cellpadding='0' cellspacing='0' width='" + tntRCsize800 + "'></table>"); + + // Ligne blanche de séparation + tntRCjTable.append(tntRCligneBlanche6Col()); + + // Entêtes de colonnes grise + tntRCjTable.append(tntRCenteteGrise6Col()); + + //affiche le contenu du fichier dans le conteneur dédié + jMessage.html(""); + + var i = 0; + + tntRClisteRelais = jData; + for(i = 0; i < jData.length; i++) { + + var oRelais = jData[i]; + + // Les noeuds dans le fichier XML ne sont pas forcément ordonnés pour l'affichage, on va donc d'abord récupérer leur valeur + var codeRelais = oRelais[0]; + var nomRelais = oRelais[1]; + var adresse = oRelais[4]; + var codePostal = oRelais[2]; + var commune = oRelais[3]; + var heureFermeture = oRelais[21]; + + var messages=""; + + var logo_point = ""; + if (messages != "") logo_point = "<img src='" + pathToImages + "exception.gif' alt='Informations complémentaires' width='16px' height='16px'>"; + + tntRCjTable.append( + "<tr>"+ + "<td class='tntRCblanc' width='" + tntRCsize5 + "'></td>"+ + "<td class='tntRCblanc' width='" + tntRCsize50 + "'><img src='" + pathToImages + "logo-tnt-petit.jpg'> " + logo_point + "</td>"+ + "<td class='tntRCrelaisColis' width='" + tntRCsize650 + "'>" + nomRelais + " - " + adresse + " - " + codePostal + " - " + commune + "<BR>    >> Ouvert jusqu'à " + heureFermeture + "</td>"+ + "<td class='tntRCrelaisColis' width='" + tntRCsize10 + "'> </td>"+ + "<td class='tntRCrelaisColis' valign='middle' align='center' width='" + tntRCsize109 + "'>"+ + "<a href='#' onclick='tntRCafficheDetail(" + i + ");'><img src='" + pathToImages + "loupe.gif' class='tntRCBoutonLoupe'></a>        "+ + "<input type='radio' style='vertical-align: middle;' name='tntRCchoixRelais' value='" + codeRelais + "'" + ( i==0 ? "checked" : "") + " onclick='tntRCSetSelectedInfo(" + i + ")'/>"+ + "</td>"+ + "<td class='tntRCblanc' width='" + tntRCsize6 + "'></td>"+ + "</tr>"); + } + + // Mémorisation des infos du relais sélectionné par défaut (c'est le premier) + tntRCSetSelectedInfo(0, true); + + // Ajout du lien de retour sur la liste des communes si cette dernière a été mémorisée + if (tntRCJsonCommunes != null) { + tntRCjTable.append( + "<tr>"+ + "<td colspan='5' class='tntRCBack2Communes'>"+ + "<a href='#' onclick='tntRCafficheCommunes(tntRCJsonCommunes);'>"+ + "<img src='" + pathToImages + "bt-Retour.gif'>"+ + tntRCMsgBodyBack2Communes + + "</a>"+ + "</td>"+ + "<td />"+ + "</tr>"); + } + + tntRCjTable.append(tntRCligneBlanche6Col()); + jMessage.append(tntRCjTable); + + jMessage.append(tntRCchangerCodePostal()); +}; + +function tntB2CRelaisColisGetBodyMain() { + return ( + "<div class='tntRCGray'> </div>"+ + "<div id='tntBodyContentSC'>" + + "<table>"+ + "<tr>"+ + "<td>" + tntRCMsgBodyInput + "</td>"+ + "<td><input type='text' id='tntRCInputCP' class='tntRCInput' maxlength='5' size='5' value=''/></td>"+ + "<td><a href='#' onclick='tntRCgetCommunesJSON();'><img class='tntRCButton' src='" + pathToImages + "bt-OK-2.jpg' onmouseover='this.src=\"" + pathToImages + "bt-OK-1.jpg\"' onmouseout='this.src=\"" + pathToImages + "bt-OK-2.jpg\"'></a></td>" + + "</tr>"+ + "</table>" + + "</div>"+ + "<div id='tntRCLoading' style='display:none;'>" + tntRCMsgBodyLoading + "</div>"+ + "<div id='tntRCError' class='tntRCError' style='display:none;'></div>"); +} + +function tntB2CRelaisColis() { + + // Test si ID de référence existe, sinon on ne fait rien + if (!document.getElementById("tntB2CRelaisColis")) { + alert("ERREUR: Appel incorrect, objet [tntB2CRelaisColis] manquant !"); + return; + } + + tntRCCommune = ''; + + var tntRelaisColisB2C = $("#tntB2CRelaisColis"); + tntRelaisColisB2C.html( + "<div id='tntRCblocEntete'>"+ + "<div class='tntRCHeader'>"+ tntRCMsgHeaderTitle + "</div>"+ + "<div class='tntRCSubHeader'>" + tntRCMsgSubHeaderTitle + "</div>"+ + "<input type='hidden' id='tntRCSelectedCode' value=''/>"+ + "<input type='hidden' id='tntRCSelectedNom' value=''/>"+ + "<input type='hidden' id='tntRCSelectedAdresse' value=''/>"+ + "<input type='hidden' id='tntRCSelectedCodePostal' value=''/>"+ + "<input type='hidden' id='tntRCSelectedCommune' value=''/>"+ + "</div>"+ + "<div id='blocCodePostal' class='tntRCBody'>"+ + tntB2CRelaisColisGetBodyMain() + + "</div>" + + "<div class='dialog_box' id='tntRCDialog'>"+ + "<div id='tntRCdetailRelaisEntete'>"+ + "<div class='tntRCHeader'>"+ tntRCMsgHeaderPopup + "</div>"+ + "<div class='tntRCSubHeader'>" + tntRCMsgSubHeaderPopup + "</div>"+ + "</div>"+ + "<div id='tntRCdetailRelaisCorps'></div>"+ + "</div>"); + + // Forçage de la propriété "top", car elle est écrasée par la gestion de jqModal + // si on la met dans la définition de la classe du div correspondant... + $('#tntRCDialog').css("top", "50%"); + + // Ajout de la popup dans la gestion jqModal + + $('#tntRCDialog').dialog({ + modal: true, + autoOpen: false, + width: 635, + height: 500, + position: ['middle','middle'], + resizable: false, + draggable: false, + show: 'blind', + close: function(event, ui) { + $("html").css({overflow: "", 'overflow-x': "", 'overflow-y': ""}); + } + }); + + // Récupérations des paramètres de l'URL + var codePostal = getURLParam("codePostal"); + var commune = getURLParam("commune"); + + if (codePostal != "") { + tntRCcodePostal = codePostal; + if (commune != "") { + // Couple code postal + commune fourni + tntRCgetRelaisColisJSON(commune); + } + else { + $('#tntRCInputCP').val(tntRCcodePostal); + tntRCgetCommunesJSON(); + } + } + + // Initialisation de Map associée + tntRCInitMap(); +}; + +function tntRCgetRelaisColis(libelleErreur) { + + // RAZ des infos sélectionnées + tntRCSetSelectedInfo(); + + tntRCCommune = ''; + + var blocCodePostal = $("#blocCodePostal"); + if(!blocCodePostal.hasClass("tntRCBody")) + blocCodePostal.addClass("tntRCBody"); + blocCodePostal.html(tntB2CRelaisColisGetBodyMain()); + $('#tntRCInputCP').val(tntRCcodePostal); + + if (libelleErreur) { + var jDivErreur = $("#tntRCError"); + jDivErreur.html(libelleErreur); + jDivErreur.show(); + } +}; + +function tntRCafficheCommunes(jData) { + + // RAZ des infos sélectionnées + tntRCSetSelectedInfo(); + + if (mapDetected) resetMap(); + + var tntRCjTable = $("<table style='border:1px solid gray;' cellpadding='0' cellspacing='0' width='" + tntRCsize800 + "'></table>"); + + // Ligne blanche de séparation + tntRCjTable.append(tntRCligneBlanche6Col()); + // Entêtes de colonnes grise + tntRCjTable.append(tntRCenteteGrise6Col()); + + var blocCodePostal = $("#blocCodePostal"); + + var i = 1; + //var jCommunes = jData.find("VILLE"); + for (var iIdx = 0; iIdx < jData.length; iIdx++) { + + var commune = jData[iIdx]; + + //var jCommune = $(this); + var nomVille = commune[1]; // IE vs FF + + tntRCjTable.append( + "<tr>"+ + "<td class='tntRCblanc' width='" + tntRCsize5 + "'></td>"+ + "<td class='tntRCblanc' width='" + tntRCsize50 + "'><img src='" + pathToImages + "logo-tnt-petit.jpg'></td>" + + "<td class='tntRCrelaisColis' width='" + tntRCsize650 + "'> " + nomVille + " (" + tntRCcodePostal + ") </td>" + + "<td class='tntRCrelaisColis' width='" + tntRCsize10 + "'> </td>"+ + "<td class='tntRCrelaisColis' align='center' width='" + tntRCsize109 + "'>"+ + "<input type='radio' name='tntRCchoixComm' value='" + nomVille + "' " + ( i ==1 ? "checked" : "") + ">"+ + "</td>"+ + "<td class='tntRCblanc' width='" + tntRCsize6 + "'></td>"+ + "</tr>"); + i = 2; + } + + tntRCjTable.append( + tntRCligneBlanche6Col() + + "<tr>"+ + "<td class='tntRCblanc' width='" + tntRCsize5 + "'></td>"+ + "<td class='tntRCblanc' colspan='2' width='" + tntRCsize670 + "'></td>"+ + "<td class='tntRCblanc' width='" + tntRCsize10 + "'></td>"+ + "<td class='tntRCblanc' align='center' width='" + tntRCsize109 + "'>"+ + "<a href='javascript:tntRCgetRelaisColisJSON();'><img class='tntRCButton' src='" + pathToImages + "bt-Continuer-2.jpg' onmouseover='this.src=\"" + pathToImages + "bt-Continuer-1.jpg\"' onmouseout='this.src=\"" + pathToImages + "bt-Continuer-2.jpg\"'></a>" + + "</td>"+ + "<td class='tntRCblanc' width='" + tntRCsize6 + "'></td>"+ + "</tr>" + + tntRCligneBlanche6Col()); + + blocCodePostal.html(tntRCjTable); + + // Bloc de saisie d'un nouveau code postal + blocCodePostal.append(tntRCchangerCodePostal()); +} + +function tntRCgetCommunesJSON() { + + $("#tntRCError").hide(); + tntRCcodePostal = $('#tntRCInputCP').val(); + + // Code postal non renseigné, on ne fait rien + if (tntRCcodePostal=="") return; + + if (mapDetected) resetMap(); + + // On ne fait rien si le code postal n'est pas un nombre de 5 chiffres + if (isNaN(parseInt(tntRCcodePostal)) || tntRCcodePostal.length != 5) { + tntRCgetRelaisColis(tntRCMsgErrCodePostal); + return; + } + + tntRCsetChargementEnCours(); + + var ajaxUrl; + var ajaxData; + + ajaxUrl = "http://" + tntDomain + "/public/b2c/relaisColis/rechercheJson.do?code=" + tntRCcodePostal; + ajaxData = ""; + + $.ajax({ + type: "GET", + url: ajaxUrl, + data: ajaxData, + dataType: "script", + error:function(msg){ + $("#blocCodePostal").html("Error !: " + msg ); + } + }); +}; + +function tntRCsetChargementEnCours() { + $("#tntRCLoading").show(); +}; + +function tntRCafficheDetail(i) { + + var tntRCdetailRelais = $("#tntRCdetailRelaisCorps"); + + tntRCdetailRelais.html(""); + + var oRelais = tntRClisteRelais[i]; + + // Les noeuds dans le fichier JSON ne sont pas forcément ordonnés pour l'affichage, on va donc d'abord récupérer leur valeur + var codeRelais = oRelais[0] + var nomRelais = oRelais[1]; + var adresse = oRelais[4]; + var codePostal = oRelais[2]; + var commune = oRelais[3]; + var heureFermeture = oRelais[21]; + + var lundi_am = (oRelais[7] == "-")?"fermé":oRelais[7]; + var lundi_pm = (oRelais[8] == "-")?"fermé":oRelais[8]; + var mardi_am = (oRelais[9] == "-")?"fermé":oRelais[9]; + var mardi_pm = (oRelais[10] == "-")?"fermé":oRelais[10]; + var mercredi_am = (oRelais[11] == "-")?"fermé":oRelais[11]; + var mercredi_pm = (oRelais[12] == "-")?"fermé":oRelais[12]; + var jeudi_am = (oRelais[13] == "-")?"fermé":oRelais[13]; + var jeudi_pm = (oRelais[14] == "-")?"fermé":oRelais[14]; + var vendredi_am = (oRelais[15] == "-")?"fermé":oRelais[15]; + var vendredi_pm = (oRelais[16] == "-")?"fermé":oRelais[16]; + var samedi_am = (oRelais[17] == "-")?"fermé":oRelais[17]; + var samedi_pm = (oRelais[18] == "-")?"fermé":oRelais[18]; + var dimanche_am = (oRelais[19] == "-")?"fermé":oRelais[19]; + var dimanche_pm = (oRelais[20] == "-")?"fermé":oRelais[20]; + + var messages = ""; + for (j=0; j < oRelais[24].length; j++) { + var ligne = oRelais[24][j]; + if (ligne != "") messages = messages + ligne + "<br/>"; + } + + if (lundi_pm != "-") lundi_am = lundi_am + "<br/>" + lundi_pm; + if (mardi_pm != "-") mardi_am = mardi_am + "<br/>" + mardi_pm; + if (mercredi_pm != "-") mercredi_am = mercredi_am + "<br/>" + mercredi_pm; + if (jeudi_pm != "-") jeudi_am = jeudi_am + "<br/>" + jeudi_pm; + if (vendredi_pm != "-") vendredi_am = vendredi_am + "<br/>" + vendredi_pm; + if (samedi_pm != "-") samedi_am = samedi_am + "<br/>" + samedi_pm; + if (dimanche_pm != "-") dimanche_am = dimanche_am + "<br/>" + dimanche_pm; + + var logo_point = ""; + if (messages != "") logo_point = "<img src='" + pathToImages + "exception.gif' alt='Picto Informations'>"; + + var tntRCjTableX = $("<table style='border:1px solid gray;' cellpadding='0' cellspacing='0' width='" + tntRCsize447 + "'>" + + "<tr>" + + "<td width='" + tntRCsize447 + "' valign='top'>" + + "<table style='border:0px;' cellpadding='0' cellspacing='0' width='" + tntRCsize447 + "'>" + + "<tr>" + + "<td>" + + "<table style='border:0px;' cellpadding='0' cellspacing='0' >" + + "<tr height='" + tntRCsize8 + "'><td colspan='4'></td></tr>" + + "<tr>" + + "<td class='tntRCdetailGros' width='" + tntRCsize5 + "'> </td>" + + "<td class='tntRCdetailGros' width='" + tntRCsize442 + "' colspan='3'>Localisation : </td>" + + "</tr>" + + "<tr height='" + tntRCsize20 + "'><td colspan='4'></td></tr>" + + "<tr>" + + "<td class='tntRCdetailGros' width='"+ tntRCsize5 + "'> </td>" + + "<td class='tntRCdetailGros' width='"+ tntRCsize30 + "'> </td>" + + "<td class='tntRCnoirPetit' width='"+ tntRCsize412 + "' colspan ='2'><b>" + nomRelais + "</b></td>" + + "</tr>" + + "<tr>" + + "<td class='tntRCdetailGros' width='"+ tntRCsize5 + "'> </td>" + + "<td class='tntRCdetailGros' width='"+ tntRCsize30 + "'> </td>" + + "<td class='tntRCnoirPetit' width='"+ tntRCsize412 + "' colspan ='2'>" + adresse + "</td>" + + "</tr>" + + "<tr>" + + "<td class='tntRCdetailGros' width='"+ tntRCsize5 + "'> </td>" + + "<td class='tntRCdetailGros' width='"+ tntRCsize30 + "'> </td>" + + "<td class='tntRCnoirPetit' width='"+ tntRCsize412 + "' colspan ='2'>" + codePostal + " " + commune + "</td>" + + "</tr>" + + "<tr height='" + tntRCsize50 + "'><td colspan='4'></td></tr>" + + "<tr>" + + "<td class='tntRCdetailGros' width='" + tntRCsize5 + "'> </td>" + + "<td class='tntRCdetailGros' width='" + tntRCsize442 + "' colspan='3'>Informations : </td>" + + "</tr>" + + "<tr height='" + tntRCsize8 + "'><td colspan='4'></td></tr>" + + "<tr>" + + "<td class='tntRCdetailGros' width='"+ tntRCsize5 + "'></td>" + + "<td class='tntRCdetailGros' width='"+ tntRCsize30 + "'> " + logo_point + "</td>" + + "<td class='tntRCdetailPetit' width='"+ tntRCsize412 + "' colspan ='2'>" + messages + "</td>" + + "</tr>" + + "</table>" + + "</td>" + + "</tr>" + + "</table>" + + "</td>" + + "<td width='" + tntRCsize253 + "' valign='top'>" + + "<table style='border:0px;' cellpadding='0' cellspacing='0' width='" + tntRCsize253 + "'>" + + "<tr>" + + "<td>" + + "<table style='border:0px;' cellpadding='0' cellspacing='0'>" + + "<tr height='" + tntRCsize8 + "'>" + + "<td colspan='4'></td>" + + "</tr>" + + "<tr>" + + "<td class='tntRCdetailGros'><img src='" + pathToImages + "picto-delai.gif' alt='Picto delai'></td>" + + "<td class='tntRCdetailGros' colspan='3'>Horaires d'ouverture : </td>" + + "</tr>" + + "<tr>" + + "<td class='tntRCdetailGros' width='"+ tntRCsize30 + "'></td>" + + "<td>" + + "<table class='tntRCHoraire' cellpadding='0' cellspacing='0' rules='all' width='" + tntRCsize218 + "'>" + + "<tr>" + + "<td class='tntRCHoraireJour'>Lundi</td>" + + "<td class='tntRCHoraireHeure'>" + lundi_am + "</td>" + + "</tr>" + + "<tr>" + + "<td class='tntRCHoraireJour'>Mardi</td>" + + "<td class='tntRCHoraireHeure'>" + mardi_am + "</td>" + + "</tr>" + + "<tr>" + + "<td class='tntRCHoraireJour'>Mercredi</td>" + + "<td class='tntRCHoraireHeure'>" + mercredi_am + "</td>" + + "</tr>" + + "<tr>" + + "<td class='tntRCHoraireJour'>Jeudi</td>" + + "<td class='tntRCHoraireHeure'>" + jeudi_am + "</td>" + + "</tr>" + + "<tr>" + + "<td class='tntRCHoraireJour'>Vendredi</td>" + + "<td class='tntRCHoraireHeure'>" + vendredi_am + "</td>" + + "</tr>" + + "<tr>" + + "<td class='tntRCHoraireJour'>Samedi</td>" + + "<td class='tntRCHoraireHeure'>" + samedi_am + "</td>" + + "</tr>" + + "<tr>" + + "<td class='tntRCHoraireJour'>Dimanche</td>" + + "<td class='tntRCHoraireHeure'>" + dimanche_am + "</td>" + + "</tr>" + + "</table>" + + "</td>" + + "<td class='tntRCdetailGros' width='"+ tntRCsize5 + "'></td>" + + "</tr>" + + "</table>" + + "</td>" + + "</tr>" + + "</table>" + + "</td>" + + "</tr>" + + "<tr height='" + tntRCsize8 + "'></tr>" + + "</table>"); + + tntRCdetailRelais.append(tntRCjTableX); + + $('#tntRCDialog').dialog("open"); + $('#tntRCDialog').css("width", "600px"); // Patch mauvais calcul jQueryUI + // Masquage des barres de scrolling + $("html").css({overflow: "hidden", 'overflow-x': "hidden", 'overflow-y': "hidden"}); +}; + +function tntRCligneBlancheDetail(){ + return("<tr height='" + tntRCsize5 + "'><td colspan='8'> </td></tr>"); +}; + +function tntRCligneBlancheGauche(){ + return( + "<tr height='" + tntRCsize8 + "'>"+ + "<td class='tntRCdetailGros' width='" + tntRCsize5 + "'></td>"+ + "<td class='tntRCdetailGros' width='" + tntRCsize30 + "'></td>"+ + "<td class='tntRCdetailGros' width='" + tntRCsize20 + "'></td>"+ + "<td class='tntRCdetailGros' width='" + tntRCsize392 + "'></td>"+ + "</tr>"); +}; + +// Table vide avec 3 colonnes pour sauter une ligne +function tntRCligneBlanche3Col() { + return("<tr height='" + tntRCsize8 + "'><td class='tntRCblanc' width='" + tntRCsize5 + "'></td><td class='tntRCblanc' width='" + tntRCsize789 + "'></td><td class='tntRCblanc' width='" + tntRCsize6 + "'></td></tr>"); +}; + +// Table vide avec 6 colonnes pour sauter une ligne +function tntRCligneBlanche6Col() { + return("<tr height='" + tntRCsize8 + "'><td class='tntRCblanc' colspan='6'></td></td></tr>"); +}; + +// Table vide avec 3 colonnes et entête en gris +function tntRCligneGrise3Col() { + return("<tr><td class='tntRCblanc' width='" + tntRCsize5 + "'></td><td class='tntRCgris' width='" + tntRCsize789 + "'><br/></td><td class='tntRCblanc' width='" + tntRCsize6 + "'></td></tr>"); +}; + +// Table entête de colonnes grises +function tntRCenteteGrise6Col() { + return("<tr><td class='tntRCblanc' width='" + tntRCsize5 + "'></td><td class='tntRCgris' colspan='2' width='" + tntRCsize670 + "'> Les différents Relais Colis®</td><td class='tntRCblanc' width='" + tntRCsize10 + "'></td><td class='tntRCgris' width='" + tntRCsize109 + "'> Mon choix</td><td class='tntRCblanc' width='" + tntRCsize6 + "'></td></tr>"); +}; + +// Zone de saisie d'un code postal nouveau +function tntRCchangerCodePostal(){ + return( + "<div class='tntRCWhite'> </div>"+ + "<div class='tntRCBodySearch'>"+ + "<table>"+ + "<tr>"+ + "<td width='350px'>Vous pouvez choisir un autre code postal de livraison :</td>"+ + "<td width='55px'><input type='text' id='tntRCInputCP' class='tntRCInput' maxlength='5' size='5' value='' /></td>"+ + "<td><a href='#' onclick='tntRCgetCommunesJSON();'><img class='tntRCButton' src='" + pathToImages + "bt-CodePostal-2.jpg' onmouseover='this.src=\"" + pathToImages + "bt-CodePostal-1.jpg\"' onmouseout='this.src=\"" + pathToImages + "bt-CodePostal-2.jpg\"'></a></td>" + + "</tr>"+ + "</table>"+ + "</div>"); +}; + +function tntRCSetSelectedInfo(selectedIdx, noMarkerInfo) { + + if (!selectedIdx && selectedIdx != 0) { + // RAZ des infos sélectionnées + $("#tntRCSelectedCode").val(""); + $("#tntRCSelectedNom").val(""); + $("#tntRCSelectedAdresse").val(""); + $("#tntRCSelectedCodePostal").val(""); + $("#tntRCSelectedCommune").val(""); + return + } + + var oRelais = tntRClisteRelais[selectedIdx]; + + $("#tntRCSelectedCode").val(oRelais[0]); + $("#tntRCSelectedNom").val(oRelais[1]); + $("#tntRCSelectedAdresse").val(oRelais[4]); + $("#tntRCSelectedCodePostal").val(oRelais[2]); + $("#tntRCSelectedCommune").val(oRelais[3]); + var id_cart = document.getElementById("cartRelaisColis").value; + $.ajax({ + type: "POST", + url: "./modules/tntcarrier/relaisColis/postRelaisData.php", + data: "id_cart="+id_cart+"&tntRCSelectedCode="+oRelais[0]+"&tntRCSelectedNom="+oRelais[1]+"&tntRCSelectedAdresse="+oRelais[4]+"&tntRCSelectedCodePostal="+oRelais[2]+"&tntRCSelectedCommune="+oRelais[3] + }); + + if (mapDetected && !noMarkerInfo) { + + // Les noeuds dans le fichier XML ne sont pas forcément ordonnés pour l'affichage, on va donc d'abord récupérer leur valeur + var codeRelais = oRelais[0] + var nomRelais = oRelais[1]; + var adresse = oRelais[4]; + var codePostal = oRelais[2]; + var commune = oRelais[3]; + var heureFermeture = oRelais[21]; + + var messages = ""; + var lundi_am = (oRelais[7] == "-")?",":oRelais[7]+","; + var lundi_pm = oRelais[8]; + var mardi_am = (oRelais[9] == "-")?",":oRelais[9]+","; + var mardi_pm = oRelais[10]; + var mercredi_am = (oRelais[11] == "-")?",":oRelais[11]+","; + var mercredi_pm = oRelais[12]; + var jeudi_am = (oRelais[13] == "-")?",":oRelais[13]+","; + var jeudi_pm = oRelais[14]; + var vendredi_am = (oRelais[15] == "-")?",":oRelais[15]+","; + var vendredi_pm = oRelais[16]; + var samedi_am = (oRelais[17] == "-")?",":oRelais[17]+","; + var samedi_pm = oRelais[18]; + var dimanche_am = (oRelais[19] == "-")?",":oRelais[19]+","; + var dimanche_pm = oRelais[20]; + + if (lundi_pm != "-") lundi_am = lundi_am + lundi_pm; + if (mardi_pm != "-") mardi_am = mardi_am + mardi_pm; + if (mercredi_pm != "-") mercredi_am = mercredi_am + mercredi_pm; + if (jeudi_pm != "-") jeudi_am = jeudi_am + jeudi_pm; + if (vendredi_pm != "-") vendredi_am = vendredi_am + vendredi_pm; + if (samedi_pm != "-") samedi_am = samedi_am + samedi_pm; + if (dimanche_pm != "-") dimanche_am = dimanche_am + dimanche_pm; + + var horaires = new Array(); + horaires['lundi'] = lundi_am + ",1"; + horaires['mardi'] = mardi_am + ",2"; + horaires['mercredi'] = mercredi_am + ",3"; + horaires['jeudi'] = jeudi_am + ",4"; + horaires['vendredi'] = vendredi_am + ",5"; + horaires['samedi'] = samedi_am + ",6"; + horaires['dimanche'] = dimanche_am + ",0"; + + var messages = ""; + for (j=0; j < oRelais[24].length; j++) { + var ligne = oRelais[24][j]; + if (ligne != "") messages = messages + ligne + "<br/>"; + } + + setInfoMarker(codeRelais, nomRelais, adresse, codePostal, commune, messages, selectedIdx, horaires, relaisMarkers[selectedIdx]); + } +} + +function resetMap() { + + if (map) { + + map.getStreetView().setVisible(false); + + for (var i = 0; i < relaisMarkers.length; i++) { + relaisMarkers[i].setMap(null); + relaisMarkers[i] = null; + } + relaisMarkers = new Array(); + if (infowindow) infowindow.close(); + map.setZoom(defaultZoom); + map.setCenter(defaultCenter); + } +} + +/* + * Fonction appellée en retour de la recherche des communes par rapport à un code postal + * si plusieurs communes ont été trouvées + */ + +function listeCommunes(tabCommunes) { + tntRCJsonCommunes = null; + + // TEMP: car le contenu du div est entièrement reconstruit + $("#blocCodePostal").removeClass("tntRCBody"); + + tntRCJsonCommunes = tabCommunes; + tntRCafficheCommunes(tabCommunes); +} + +/* + * Fonction appellée en retour de la recherche des communes par rapport à un code postal + * si une seule commune a été trouvée + */ + +function listeRelais(tabRelais) { + + tntRClisteRelais = null; + + // TEMP: car le contenu du div est entièrement reconstruit + $("#blocCodePostal").removeClass("tntRCBody"); + + tntRCafficheRelais(tabRelais); + if (mapDetected) init_marker(tabRelais); +} + +/* + * Fonction appellée en retour de la recherche des communes si aucune commune trouvée + */ +function erreurListeCommunes() { + tntRCJsonCommunes = null; + tntRCgetRelaisColis(tntRCMsgErrLoadCommunes); +} + +function erreurListeRelais() { + tntRCgetRelaisColis(tntRCMsgErrLoadRelais); +} + + +/************************************************************************************************ + * Partie Google Map + ***********************************************************************************************/ + +var map; +var adresse_pointclic; +var zone_chalandise; +var zoomZoneChalandiseDefault; +var centerZoneChalandiseDefault; +var init_streetview = false; + +var contentTo = [ + '<br/><div>', + 'Itinéraire : <b>Vers ce lieu</b> - <a href="javascript:fromhere(0)">A partir de ce lieu</a><br/>', + 'Lieu de départ<br/>', + '<input type="text" id="saisie" name="saisie" value="" maxlength="500" size="30">', + '<input type="hidden" id="mode" name="mode" value="toPoint">', + '<input type="hidden" id="point_choisi" name="point_choisi" value="">', + '<input type="submit" onclick="popup_roadmap();" value="Ok">', + '<br/>Ex: 58 avenue Leclerc 69007 Lyon', + '</div>'].join(''); + +var contentFrom = [ + '<br/><div>', + 'Itinéraire : <a href="javascript:tohere(0)">Vers ce lieu</a> - <b>A partir de ce lieu</b><br/>', + 'Lieu d\'arrivée<br/>', + '<input type="text" id="saisie" name="saisie" value="" maxlength="500" size="30">', + '<input type="hidden" id="mode" name="mode" value="fromPoint">', + '<input type="hidden" id="point_choisi" name="point_choisi" value="">', + '<input type="button" onclick="popup_roadmap();" value="Ok">', + '<br/>Ex: 58 avenue Leclerc 69007 Lyon', + '</div>'].join(''); + +var infowindow; + +var relaisMarkers = []; +var iconRelais = new google.maps.MarkerImage( + "img/google/relaisColis.png", + new google.maps.Size(40, 30), + new google.maps.Point(0, 0), + new google.maps.Point(20, 30)) + +//Limites de la France +var allowedBounds = new google.maps.LatLngBounds( + new google.maps.LatLng(39.56533418570851, -7.41426946590909), + new google.maps.LatLng(52.88994181429149, 11.84176746590909)); + +var defaultCenter = new google.maps.LatLng(46.2276380, 2.2137490); // the center ??? +var defaultZoom = 5; // default zoom level +var aberration = 0.2; // this value is a good choice for france (?!) +var minMapScale = 5; +//var maxMapScale = 20; + +var mapDetected = false; +var callbackLinkMarker = ""; + +// fonction appellé après saisie du code postal de recherche +function init_marker(json) { + + zone_chalandise = new google.maps.LatLngBounds(); + + for (var i = 0; i < relaisMarkers.length; i++) { + relaisMarkers[i].setMap(null); + relaisMarkers[i] = null; + } + relaisMarkers = new Array(); + + if (infowindow) infowindow.close(); + + var markers = json; + + for (var i = 0; i < markers.length; i++) { + createMarker(markers[i], i); + } + + zoomZoneChalandiseDefault = zone_chalandise.getCenter(); + centerZoneChalandiseDefault = zone_chalandise; + + retourZoomChalandise(); +} + +function setInfoMarker(codeRelais, nomRelais, adresse, codePostal, commune, messages, indice, horaires, marker) { + + var htmlInfo = [ + "<div>", + "<div class='rc'>", + "<b>RELAIS COLIS N° ", codeRelais, "</b><br/>", + "<b>", nomRelais, "</b><br/>", + adresse, "<br/>", + codePostal, " ", commune, + "</div>", + "<div><br/>", messages, "</div>", + callbackLinkMarker, + "</div>", + "<div id='trajet'>" + contentTo + "</div>" + ].join(''); + + // Création du contenu de l'onglet horaire + var htmlHoraires = "<table class='horairesRCPopup'>"; + var jourSemaine = (new Date()).getDay(); + for (jour in horaires) { + var heures = (horaires[jour]).split(","); + if (heures[0] == '' && heures[1] == '') heures[0] = "fermé"; + htmlHoraires = htmlHoraires + "<tr" + (jourSemaine == parseInt(heures[2]) ? " class='selected'" : "") + "><td class='horairesRCJourPopup'> " + jour + "</td><td class='horaireRCPopup'>" + heures[0] + " " + heures[1] + "</td></tr>"; + } + htmlHoraires = htmlHoraires + "</table>"; + + adresse_pointclic = [adresse, "|", codePostal, " ", commune].join(''); + + var contentString = [ + '<div id="tabs" style="width:340px;">', + '<ul>', + '<li><a href="#tabInfos"><span>Infos</span></a></li>', + '<li><a href="#tabHoraires"><span>Horaires</span></a></li>', + '</ul>', + '<div id="tabInfos">', + htmlInfo, + '</div>', + '<div id="tabHoraires">', + htmlHoraires, + '</div>', + '</div>' + ].join(''); + + if (infowindow) infowindow.close(); + infowindow = new google.maps.InfoWindow({content: contentString}); + + google.maps.event.addListener(infowindow, "domready", function() { + $("#point_choisi").attr("value", adresse_pointclic); + $("#tabs").tabs(); + $("#tabs").parent().removeAttr("style"); + }); + + infowindow.open(map, marker); +} + +function createMarker(markerData, indice) { + + var marker = new google.maps.Marker({ + icon: iconRelais, + position: new google.maps.LatLng(markerData[5], markerData[6]), + map: map, + title:markerData[1] + }); + + google.maps.event.addListener(marker, "click", function() { + // Sélectionne le relais correspondant dans la liste + $("input[@type=radio][@name=tntRCchoixRelais]:eq("+ indice + ")").attr("checked", true); + tntRCSetSelectedInfo(indice); + }); + + relaisMarkers.push(marker); + zone_chalandise.extend(marker.getPosition()); +} + + +function tntRCInitMap() { + + // Si la carte n'est pas présente, fin de l'initialisation + if (!document.getElementById("map_canvas")) return; + mapDetected = true; + + // Si une fonction de callback a été définie, un lien est ajouté + // dans la popup d'info du marqueur de relais colis + if (window.callbackSelectionRelais) callbackLinkMarker = "<a onclick='callbackSelectionRelais();' href='#' style='color:#FF6600'>Choisir ce relais</a>"; + + //Ajout du lien pour retour en zoom zone de chalandise + var jMapCanvas = $("#map_canvas"); + jMapCanvas.wrap("<div></div>"); + jMapCanvas.parent().append("<a class=\"lien_reset\" href=\"#\" onclick=\"javascript:retourZoomChalandise();\" style=\"text-decoration:none;\">Retour à la vue initiale</a>"); + + var mapClass = jMapCanvas.attr("class"); + if (mapClass && mapClass != "") { + jMapCanvas.attr("class", ""); + jMapCanvas.parent().attr("class", mapClass); + } + + var myOptions = { + zoom: defaultZoom, + center: defaultCenter, + mapTypeId: google.maps.MapTypeId.ROADMAP, + navigationControl: true, + scaleControl: true, + mapTypeControl: true, + streetViewControl: true + }; + + map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); + + // If the map position is out of range, move it back + function checkBounds() { + + // Perform the check and return if OK + var currentBounds = map.getBounds(); + var cSpan = currentBounds.toSpan(); // width and height of the bounds + var offsetX = cSpan.lng() / (2+aberration); // we need a little border + var offsetY = cSpan.lat() / (2+aberration); + var C = map.getCenter(); // current center coords + var X = C.lng(); + var Y = C.lat(); + + // now check if the current rectangle in the allowed area + var checkSW = new google.maps.LatLng(C.lat()-offsetY,C.lng()-offsetX); + var checkNE = new google.maps.LatLng(C.lat()+offsetY,C.lng()+offsetX); + + if (allowedBounds.contains(checkSW) && + allowedBounds.contains(checkNE)) { + return; // nothing to do + } + + var AmaxX = allowedBounds.getNorthEast().lng(); + var AmaxY = allowedBounds.getNorthEast().lat(); + var AminX = allowedBounds.getSouthWest().lng(); + var AminY = allowedBounds.getSouthWest().lat(); + + if (X < (AminX+offsetX)) {X = AminX + offsetX;} + if (X > (AmaxX-offsetX)) {X = AmaxX - offsetX;} + if (Y < (AminY+offsetY)) {Y = AminY + offsetY;} + if (Y > (AmaxY-offsetY)) {Y = AmaxY - offsetY;} + + map.setCenter(new google.maps.LatLng(Y,X)); + return; + } + + google.maps.event.addListener(map, "drag", function() { + checkBounds(); + }); + + google.maps.event.addListener(map, "zoom_changed", function() { + if (map.getZoom() < minMapScale) { + map.setZoom(minMapScale); + } + }); + + google.maps.event.addListener(map.getStreetView(), "visible_changed", function() { + //premier accès lors du chargement de la page, il ne faut pas cacher les markers + if (init_streetview == true) { + if(map.getStreetView().getVisible() == true) { + for (var k = 0; k < relaisMarkers.length; k++) { + relaisMarkers[k].setVisible(false); + } + } + else { + for (var k = 0; k < relaisMarkers.length; k++) { + relaisMarkers[k].setVisible(true); + } + } + } + else init_streetview = true; + }); +} + +function retourZoomChalandise() { + if(zoomZoneChalandiseDefault){ + map.setCenter(zoomZoneChalandiseDefault); + map.fitBounds(centerZoneChalandiseDefault); + } +} + +function fromhere() { + switchFromTo(contentFrom); +} + +function tohere() { + switchFromTo(contentTo); +} + +function switchFromTo(htmlContent) { + var adresse_saisie = $("#saisie").val(); + $("#trajet").html(htmlContent); + $("#point_choisi").attr('value', adresse_pointclic); + $("#saisie").val(adresse_saisie); +} + +function popup_roadmap() { + if($("#saisie").val() == "") return; + window.open("http://" + tntDomain + "/public/geolocalisation/print_roadmap.do?mode="+ $("#mode").val() +"&point_choisi="+ $("#point_choisi").val() +"&saisie="+ $("#saisie").val()); +} + +$().ready(tntB2CRelaisColis); \ No newline at end of file diff --git a/modules/tntcarrier/relaisColis/postRelaisData.php b/modules/tntcarrier/relaisColis/postRelaisData.php new file mode 100644 index 000000000..78f677bc5 --- /dev/null +++ b/modules/tntcarrier/relaisColis/postRelaisData.php @@ -0,0 +1,22 @@ +<?php + +require('../../../config/config.inc.php'); + +$code = $_POST['tntRCSelectedCode']; +$name = $_POST['tntRCSelectedNom']; +$address = $_POST['tntRCSelectedAdresse']; +$zipcode = $_POST['tntRCSelectedCodePostal']; +$city = $_POST['tntRCSelectedCommune']; +$id_cart = $_POST['id_cart']; + +$data = Db::getInstance()->ExecuteS('SELECT * FROM `'._DB_PREFIX_.'tnt_carrier_drop_off` WHERE `id_cart` = "'.(int)($id_cart).'"'); +if (count($data) > 0) +{ + echo "ok"; + Db::getInstance()->Execute('UPDATE `'._DB_PREFIX_.'tnt_carrier_drop_off` SET `code` = "'.$code.'", `name` = "'.$name.'", + `address` = "'.$address.'", `zipcode` = "'.$zipcode.'", `city` = "'.$city.'" WHERE `id_cart` = "'.(int)($id_cart).'"'); +} +else + Db::getInstance()->ExecuteS('INSERT INTO `'._DB_PREFIX_.'tnt_carrier_drop_off` (`id_cart`, `code`, `name`, `address`, `zipcode`, `city`) + VALUES ("'.(int)($id_cart).'", "'.$code.'", "'.$name.'", "'.$address.'", "'.$zipcode.'", "'.$city.'")'); +?> \ No newline at end of file diff --git a/modules/tntcarrier/relaisColis/relaisColis.php b/modules/tntcarrier/relaisColis/relaisColis.php new file mode 100644 index 000000000..8f13504ec --- /dev/null +++ b/modules/tntcarrier/relaisColis/relaisColis.php @@ -0,0 +1,64 @@ +<?php +require('../../../config/config.inc.php'); +$relais = Db::getInstance()->getValue('SELECT c.id_carrier + FROM `'._DB_PREFIX_.'carrier` as c, `'._DB_PREFIX_.'tnt_carrier_option` as o + WHERE c.id_carrier = o.id_carrier + AND o.option LIKE "%D" + AND c.external_module_name = "tntcarrier" + AND c.deleted = "0" AND c.id_carrier = "'.(int)($_GET['id_carrier']).'"'); + if ($relais) + { +?> + <script type="text/javascript"> + $("#form").submit(function() + { + if ($("#tntRCSelectedCode").val() == '') + { + alert("Vous n'avez pas choisi de relais colis"); + return false; + } + } + ); + </script> + <script type="text/javascript" src="./modules/tntcarrier/relaisColis/js/jquery.js"></script> + <script type="text/javascript" src="./modules/tntcarrier/relaisColis/js/jquery-ui.js"></script> + <script type="text/javascript" src="./modules/tntcarrier/relaisColis/js/relaisColis.js"></script> + <link rel="stylesheet" href="./modules/tntcarrier/relaisColis/css/ui.tabs.css" type="text/css" /> + <link rel="stylesheet" href="./modules/tntcarrier/relaisColis/css/ui.dialog.css" type="text/css" /> + <link rel="stylesheet" href="./modules/tntcarrier/relaisColis/css/tntB2CRelaisColis.css" type="text/css" /> + <div id="tntB2CRelaisColis" class="exemplePresentation"> + <script type="text/javascript"> + tntB2CRelaisColis(); + </script> + </div> + <div style="text-align: justify; font-family: arial,helvetica,sans-serif; font-size: 10pt; width: 600px;"> + <div style="height: 25px;"> </div> + <div id="exempleIntegration"> + <script type="text/javascript"> + function callbackSelectionRelais() { + + // Récupération des informations + var codeRelais = $("#tntRCSelectedCode").val(); + var nom = $("#tntRCSelectedNom").val(); + var adresse = $("#tntRCSelectedAdresse").val(); + var codePostal = $("#tntRCSelectedCodePostal").val(); + var commune = $("#tntRCSelectedCommune").val(); + + if (!codeRelais || codeRelais == "") { + alert("Aucun relais n'a été sélectionné !"); + } + else { + alert("Info relais sélectionné"+ + "\nCode\t\t: " + codeRelais + + "\nNom\t\t: " + nom + + "\nAdresse\t\t: " + adresse + + "\nCode postal\t: " + codePostal + + "\nCommune\t\t: " + commune); + } + } + </script> + </div> + </div> +<?php +} +?> \ No newline at end of file diff --git a/modules/tntcarrier/relaisColis/tntRelais.php b/modules/tntcarrier/relaisColis/tntRelais.php new file mode 100644 index 000000000..19d66dcd1 --- /dev/null +++ b/modules/tntcarrier/relaisColis/tntRelais.php @@ -0,0 +1,94 @@ +<script type="text/javascript" src="./modules/tntcarrier/relaisColis/js/jquery-ui.js"></script> +<script type="text/javascript" src="./modules/tntcarrier/relaisColis/js/relaisColis.js"></script> +<script type="text/javascript"> + function tntRCgetCommunes() { + + $("#tntRCError").hide(); + tntRCcodePostal = $('#tntRCInputCP').val(); + if (tntRCcodePostal=="") return; + if (isNaN(parseInt(tntRCcodePostal)) || tntRCcodePostal.length != 5) { + tntRCgetRelaisColis(tntRCMsgErrCodePostal); + return; + } + + tntRCsetChargementEnCours(); + + var ajaxUrl; + var ajaxData; + + ajaxUrl = "http://" + tntDomain + "/public/b2c/relaisColis/rechercheJson.do?code=" + tntRCcodePostal; + ajaxData = ""; + + $.ajax({ + type: "GET", + url: ajaxUrl, + data: ajaxData, + dataType: "script", + error:function(msg){ + $("#blocCodePostal").html("Error !: " + msg ); + } + }); +}; +</script> +<link rel="stylesheet" href="./modules/tntcarrier/relaisColis/css/ui.tabs.css" type="text/css" /> +<link rel="stylesheet" href="./modules/tntcarrier/relaisColis/css/ui.dialog.css" type="text/css" /> +<link rel="stylesheet" href="./modules/tntcarrier/relaisColis/css/tntB2CRelaisColis.css" type="text/css" /> +<div id="tntB2CRelaisColis" class="exemplePresentation"> + <div id="tntRCblocEntete"> + <div class="tntRCHeader">Mode de livraison</div> + <div class="tntRCSubHeader"> + Choisissez le Relais Colis + <sup class="tntRCSup">®</sup> + qui vous convient : + </div> + <input id="tntRCSelectedCode" type="hidden" value="C2219"> + <input id="tntRCSelectedNom" type="hidden" value="MALCO COIFFURE"> + <input id="tntRCSelectedAdresse" type="hidden" value="12 RUE LAME"> + <input id="tntRCSelectedCodePostal" type="hidden" value="78100"> + <input id="tntRCSelectedCommune" type="hidden" value="ST GERMAIN EN LAYE"> + </div> + <div class="tntRCBody" id="blocCodePostal"> + <div class="tntRCGray"> </div> + <div id="tntBodyContentSC"> + <table> + <tbody> + <tr> + <td>Entrez le code postal : </td> + <td><input type="text" value="" size="5" maxlength="5" class="tntRCInput" id="tntRCInputCP"></td> + <td><a onclick="tntRCgetCommunes();" href="#"> + <img onmouseout="./modules/tntcarrier/relaisColis/img/bt-OK-2.jpg"" onmouseover="./modules/tntcarrier/relaisColis/img/bt-OK-1.jpg"" src="./modules/tntcarrier/relaisColis/img/bt-OK-2.jpg" class="tntRCButton"></a> + </td> + </tr> + </tbody> + </table> + </div> + <div style="display:none;" id="tntRCLoading">Chargement en cours...</div> + <div style="display:none;" class="tntRCError" id="tntRCError"></div> + </div> +</div> +<div style="text-align: justify; font-family: arial,helvetica,sans-serif; font-size: 10pt; width: 600px;"> + <div style="height: 25px;"> </div> + <div id="exempleIntegration"> + <script type="text/javascript"> + function callbackSelectionRelais() { + var codeRelais = $("#tntRCSelectedCode").val(); + var nom = $("#tntRCSelectedNom").val(); + var adresse = $("#tntRCSelectedAdresse").val(); + var codePostal = $("#tntRCSelectedCodePostal").val(); + var commune = $("#tntRCSelectedCommune").val(); + + if (!codeRelais || codeRelais == "") { + alert("Aucun relais n'a été sélectionné !"); + } + else { + alert("Info relais sélectionné"+ + "\nCode\t\t: " + codeRelais + + "\nNom\t\t: " + nom + + "\nAdresse\t\t: " + adresse + + "\nCode postal\t: " + codePostal + + "\nCommune\t\t: " + commune); + } + } + </script> + </div> +</div> \ No newline at end of file diff --git a/modules/tntcarrier/serviceBase.xml b/modules/tntcarrier/serviceBase.xml new file mode 100644 index 000000000..5980c8053 --- /dev/null +++ b/modules/tntcarrier/serviceBase.xml @@ -0,0 +1,92 @@ +<serviceTNT> + <service> + <name>8:00 Express</name> + <description>1-3 days before 8:00 AM</description> + <descriptionfr>1-3 jours avant 8h00</descriptionfr> + <option>N</option> + </service> + <service> + <name>9:00 Express</name> + <description>1-3 days before 9:00 AM</description> + <descriptionfr>1-3 jours avant 9h00</descriptionfr> + <option>A</option> + </service> + <service> + <name>10:00 Express</name> + <description>1-3 days before 10:00 AM</description> + <descriptionfr>1-3 jours avant 10h00</descriptionfr> + <option>T</option> + </service> + <service> + <name>12:00 Express</name> + <description>1-3 days before 12:00 AM</description> + <descriptionfr>1-3 jours avant 12h00</descriptionfr> + <option>M</option> + </service> + <service> + <name>Express</name> + <description>Express</description> + <descriptionfr>Express</descriptionfr> + <option>J</option> + </service> + <service> + <name>8:00 Express</name> + <description>1-3 days before 8:00 AM to home</description> + <descriptionfr>1-3 jours avant 8h00 domicile</descriptionfr> + <option>NZ</option> + </service> + <service> + <name>9:00 Express</name> + <description>1-3 days before 9:00 AM to home</description> + <descriptionfr>1-3 jours avant 9h00 domicile</descriptionfr> + <option>AZ</option> + </service> + <service> + <name>10:00 Express</name> + <description>1-3 days before 10:00 AM to home</description> + <descriptionfr>1-3 jours avant 10h00 domicile</descriptionfr> + <option>TZ</option> + </service> + <service> + <name>12:00 Express</name> + <description>1-3 days before 12:00 AM to home</description> + <descriptionfr>1-3 jours avant 12h00 domicile</descriptionfr> + <option>MZ</option> + </service> + <service> + <name>Express</name> + <description>Express to home</description> + <descriptionfr>Express domicile</descriptionfr> + <option>JZ</option> + </service> + <service> + <name>8:00 Express</name> + <description>1-3 days before 8:00 AM relay package</description> + <descriptionfr>1-3 jours avant 8h00 au relais colis</descriptionfr> + <option>ND</option> + </service> + <service> + <name>9:00 Express</name> + <description>1-3 days before 9:00 AM relay package</description> + <descriptionfr>1-3 jours avant 9h00 au relais colis</descriptionfr> + <option>AD</option> + </service> + <service> + <name>10:00 Express</name> + <description>1-3 days before 10:00 AM relay package</description> + <descriptionfr>1-3 jours avant 10h00 au relais colis</descriptionfr> + <option>TD</option> + </service> + <service> + <name>12:00 Express</name> + <description>1-3 days before 12:00 AM relay package</description> + <descriptionfr>1-3 jours avant 12h00 au relais colis</descriptionfr> + <option>MD</option> + </service> + <service> + <name>Express</name> + <description>Express relay package</description> + <descriptionfr>Express au relais colis</descriptionfr> + <option>JD</option> + </service> +</serviceTNT> \ No newline at end of file diff --git a/modules/tntcarrier/sql-install.php b/modules/tntcarrier/sql-install.php new file mode 100644 index 000000000..e898f7a9d --- /dev/null +++ b/modules/tntcarrier/sql-install.php @@ -0,0 +1,42 @@ +<?php + + // Init + $sql = array(); + + $sql[] = 'CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'tnt_carrier_option` ( + `id_option` int(10) NOT NULL AUTO_INCREMENT, + `option` varchar(5) DEFAULT NULL, + `id_carrier` int(10) DEFAULT NULL, + `additionnal_charges` double(6,2) DEFAULT NULL, + PRIMARY KEY (`id_option`) + ) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8;'; + + $sql[] = 'CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'tnt_carrier_cache_service` ( + `id_card` int(11) NOT NULL, + `code` varchar(5) NOT NULL, + `date` datetime NOT NULL, + `zipcode` varchar(10) DEFAULT NULL + ) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8;'; + + $sql[] = 'CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'tnt_carrier_drop_off` ( + `id_cart` int(10) NOT NULL, + `code` varchar(10) DEFAULT NULL, + `name` text DEFAULT NULL, + `address` text DEFAULT NULL, + `zipcode` varchar(10) DEFAULT NULL, + `city` text DEFAULT NULL + ) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8;'; + + $sql[] = 'CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'tnt_carrier_shipping_number` ( + `id_order` int(10) NOT NULL, + `shipping_number` varchar(32) NOT NULL + ) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8;'; + + $sql[] = 'CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'tnt_carrier_weight` ( + `id_weight` int(10) NOT NULL AUTO_INCREMENT, + `weight_min` double(6,2) DEFAULT NULL, + `weight_max` double(6,2) DEFAULT NULL, + `additionnal_charges` double(6,2) DEFAULT NULL, + PRIMARY KEY (`id_weight`) + ) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8;'; +?> diff --git a/modules/tntcarrier/sql-uninstall.php b/modules/tntcarrier/sql-uninstall.php new file mode 100644 index 000000000..c8d0cf73b --- /dev/null +++ b/modules/tntcarrier/sql-uninstall.php @@ -0,0 +1,11 @@ +<?php + + // Init + $sql = array(); + $sql[] = 'DROP TABLE IF EXISTS `'._DB_PREFIX_.'tnt_carrier_option`;'; + $sql[] = 'DROP TABLE IF EXISTS `'._DB_PREFIX_.'tnt_carrier_weight`;'; + $sql[] = 'DROP TABLE IF EXISTS `'._DB_PREFIX_.'tnt_carrier_drop_off`;'; + $sql[] = 'DROP TABLE IF EXISTS `'._DB_PREFIX_.'tnt_carrier_shipping_number`;'; + $sql[] = 'DROP TABLE IF EXISTS `'._DB_PREFIX_.'tnt_carrier_cache_service`;'; + +?> diff --git a/modules/tntcarrier/tntGetDepot.php b/modules/tntcarrier/tntGetDepot.php new file mode 100644 index 000000000..3ec254ba3 --- /dev/null +++ b/modules/tntcarrier/tntGetDepot.php @@ -0,0 +1,121 @@ +<?php +include( '../../config/config.inc.php' ); + +function genAuth($username, $password) + { + return sprintf(' + <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"> + <wsse:UsernameToken> + <wsse:Username>%s</wsse:Username> + <wsse:Password>%s</wsse:Password> + </wsse:UsernameToken> + </wsse:Security>', htmlspecialchars($username), htmlspecialchars($password)); + } + +function getDepot($soapclient, $code) +{ + $services = $soapclient->tntDepots(array('department' => $code)); + return ($services); +} + +if (!Configuration::get('TNT_CARRIER_LOGIN') || !Configuration::get('TNT_CARRIER_PASSWORD') || !Configuration::get('TNT_CARRIER_NUMBER_ACCOUNT')) + echo '<span style="color:red">No account found</span>'; +else +{ + $code = $_GET['code']; + $authheader = genAuth(Configuration::get('TNT_CARRIER_LOGIN'), Configuration::get('TNT_CARRIER_PASSWORD')); + $authvars = new SoapVar($authheader, XSD_ANYXML); + $header = new SoapHeader("http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd", "Security", $authvars); + $file = "http://www.tnt.fr/service/?wsdl"; + + try { + $soapclient = new SoapClient($file, array('trace'=>1)); + $soapclient->__setSOAPHeaders(array($header)); + $follow = getDepot($soapclient, $code); + } + catch( SoapFault $e ) { + $erreur = $e->faultstring; + echo $erreur; + } + catch( Exception $e ) { + $erreur = "Problem : follow failed"; + } + if (isset($follow)) + { + //var_dump($follow->DepotInfo); + $v = $follow->DepotInfo; + if (!is_array($follow->DepotInfo)) + echo " + <input type='hidden' id='tntRCSelectedCode' value='$v->pexCode'/> + <input type='hidden' id='tntRCSelectedNom' value='$v->name'/> + <input type='hidden' id='tntRCSelectedAdresse' value='$v->address1'/> + <input type='hidden' id='tntRCSelectedAdresse2' value='$v->address2'/> + <input type='hidden' id='tntRCSelectedCodePostal' value='$v->zipCode'/> + <input type='hidden' id='tntRCSelectedCommune' value='$v->city'/>"; + else + echo " + <input type='hidden' id='tntRCSelectedCode' /> + <input type='hidden' id='tntRCSelectedNom' /> + <input type='hidden' id='tntRCSelectedAdresse' /> + <input type='hidden' id='tntRCSelectedAdresse2' /> + <input type='hidden' id='tntRCSelectedCodePostal' /> + <input type='hidden' id='tntRCSelectedCommune' />"; + echo " + <table width='480px' cellspacing='0' cellpadding='0' style='border:1px solid gray;'> + <tbody> + <tr height='8px'> + <td class='tntRCblanc' colspan='6'></td> + </tr> + <tr> + <td class='tntRCblanc' width='5px'></td> + <td class='tntRCgris' colspan='2'> Agences TNT</td>"; + if (is_array($follow->DepotInfo)) + echo "<td class='tntRCgris'>Choix</td>"; + else + echo "<td></td>"; + echo " + <td class='tntRCblanc' width='5px'></td> + </tr>"; + if (is_array($follow->DepotInfo)) + foreach ($follow->DepotInfo as $key => $v) + { + echo" + <tr> + <td class='tntRCblanc' ></td> + <td class='tntRCblanc' ><img src='../modules/tntcarrier/img/logo-tnt-petit.jpg'></td> + <td class='tntRCrelaisColis'> $v->name $v->address1 $v->address2 <br/>$v->zipCode $v->city</td> + <td><input type='radio' name='depotTnt' value='$key' onclick='changeValueTntRC(\"$v->pexCode\", \"$v->name\", \"$v->address1\", \"$v->address2\", \"$v->zipCode\", \"$v->city\")'/></td> + <td class='tntRCblanc' ></td> + </tr> + <tr><td class='tntRCblanc'></td><td class='tntRCrelaisColis' colspan='2'>$v->message</td><td class='tntRCblanc' ></td></tr> + <tr id='tntRcDetail'> + <td class='tntRCblanc'></td> + <td></td> + <td></td> + <td></td> + <td class='tntRCblanc'></td> + </tr>"; + } + else + echo" + <tr> + <td class='tntRCblanc' ></td> + <td class='tntRCblanc' ><img src='../modules/tntcarrier/img/logo-tnt-petit.jpg'></td> + <td class='tntRCrelaisColis'> $v->name $v->address1 $v->address2 <br/>$v->zipCode $v->city</td> + <td></td> + <td class='tntRCblanc' ></td> + </tr> + <tr><td class='tntRCblanc'></td><td class='tntRCrelaisColis' colspan='2'>$v->message</td><td class='tntRCblanc' ></td></tr> + <tr id='tntRcDetail'> + <td class='tntRCblanc'></td> + <td></td> + <td></td> + <td></td> + <td class='tntRCblanc'></td> + </tr>"; + echo " + </table> + "; + } +} +?> \ No newline at end of file diff --git a/modules/tntcarrier/tntcarrier.php b/modules/tntcarrier/tntcarrier.php new file mode 100644 index 000000000..e6049085d --- /dev/null +++ b/modules/tntcarrier/tntcarrier.php @@ -0,0 +1,945 @@ +<?php +// Avoid direct access to the file +require_once(_PS_MODULE_DIR_."/tntcarrier/classes/PackageTnt.php"); +require_once(_PS_MODULE_DIR_."/tntcarrier/classes/TntWebService.php"); +require_once(_PS_MODULE_DIR_."/tntcarrier/classes/OrderInfoTnt.php"); +require_once(_PS_MODULE_DIR_."/tntcarrier/classes/serviceCache.php"); + +if (!defined('_PS_VERSION_')) + exit; + +class TntCarrier extends CarrierModule +{ + public $id_carrier; + + private $_html = ''; + private $_postErrors = array(); + private $_moduleName = 'tntcarrier'; + private $_fieldsList = array(); + + /* + ** Construct Method + ** + */ + + public function __construct() + { + $this->name = 'tntcarrier'; + $this->tab = 'shipping_logistics'; + $this->version = '1.0'; + $this->author = 'PrestaShop'; + $this->limited_countries = array('fr'); + + parent::__construct (); + + $this->displayName = $this->l('TNT Express'); + $this->description = $this->l('Offer your customers, different delivery methods with TNT'); + + if (self::isInstalled($this->name)) + { + global $cookie; + $warning = array(); + $this->loadingVar(); + $carriers = Carrier::getCarriers($cookie->id_lang, true, false, false, null, PS_CARRIERS_AND_CARRIER_MODULES_NEED_RANGE); + + foreach ($this->_fieldsList as $keyConfiguration => $name) + if (!Configuration::get($keyConfiguration) && !empty($name)) + $warning[] = '\''.$name.'\' '; + + // Saving id carrier list + $id_carrier_list = array(); + foreach($carriers as $carrier) + $id_carrier_list[] .= $carrier['id_carrier']; + + if (count($warning)) + $this->warning .= implode(' , ',$warning).$this->l('must be configured to use this module correctly.').' '; + } + } + + public function loadingVar() + { + // Loading Fields List + $this->_fieldsList = array( + 'TNT_CARRIER_LOGIN' => $this->l('TNT Login'), + 'TNT_CARRIER_PASSWORD' => $this->l('TNT Password'), + 'TNT_CARRIER_NUMBER_ACCOUNT' => $this->l('TNT Number Account'), + 'TNT_CARRIER_SHIPPING_COMPANY' => '', + 'TNT_CARRIER_SHIPPING_LASTNAME' => '', + 'TNT_CARRIER_SHIPPING_FIRSTNAME' => '', + 'TNT_CARRIER_SHIPPING_ADDRESS1' => '', + 'TNT_CARRIER_SHIPPING_ADDRESS2' => '', + 'TNT_CARRIER_SHIPPING_ZIPCODE' => '', + 'TNT_CARRIER_SHIPPING_CITY' => '', + 'TNT_CARRIER_SHIPPING_EMAIL' => '', + 'TNT_CARRIER_SHIPPING_PHONE' => '', + 'TNT_CARRIER_SHIPPING_CLOSING' => '', + 'TNT_CARRIER_SHIPPING_DELIVERY' => '', + 'TNT_CARRIER_SHIPPING_COLLECT' => '', + 'TNT_CARRIER_SHIPPING_PEX' => '', + 'TNT_CARRIER_PRINT_STICKER' => '', + 'TNT_CARRIER_CORSE_OVERCOST' => '' + ); + + $option = Db::getInstance()->ExecuteS('SELECT * FROM `'._DB_PREFIX_.'tnt_carrier_option`'); + foreach($option as $k => $v) + { + $this->_fieldsList['TNT_CARRIER_'.$v['option'].'_ID'] = (float)($v['id_carrier']); + $this->_fieldsList['TNT_CARRIER_'.$v['option'].'_OVERCOST'] = Configuration::get('TNT_CARRIER_'.$v['option'].'_OVERCOST'); + } + } + /* + ** Install / Uninstall Methods + ** + */ + + public function install() + { + // Install SQL + include(dirname(__FILE__).'/sql-install.php'); + foreach ($sql as $s) + if (!Db::getInstance()->Execute($s)) + return false; + // Install Module + if (!parent::install() OR !$this->registerHook('updateCarrier') OR !$this->registerHook('orderDetailDisplayed') OR !$this->registerHook('adminOrder') or !$this->registerHook('extraCarrier')) + return false; + if (file_exists('../modules/'.$this->_moduleName.'/serviceBase.xml')) + { + $serviceList = simplexml_load_file('../modules/'.$this->_moduleName.'/serviceBase.xml'); + if ($serviceList == false) + return false; + } + foreach($serviceList as $k => $v) + { + $carrierConfig = array( + 'name' => $v->name, + 'id_tax_rules_group' => 0, + 'active' => true, + 'deleted' => true, + 'shipping_handling' => false, + 'range_behavior' => 0, + 'delay' => array('fr' => $v->descriptionfr, 'en' => $v->description), + 'id_zone' => 1, + 'is_module' => true, + 'shipping_external' => true, + 'external_module_name' => $this->_moduleName, + 'need_range' => true + ); + $id_carrier = $this->installExternalCarrier($carrierConfig); + Configuration::updateValue('TNT_CARRIER_'.$v->option.'_ID', (int)($id_carrier)); + Db::getInstance()->ExecuteS('INSERT INTO `'._DB_PREFIX_.'tnt_carrier_option` (`option`, `id_carrier`) VALUES ("'.$v->option.'", "'.(int)$id_carrier.'")'); + } + return true; + } + + public static function installExternalCarrier($config) + { + $carrier = new Carrier(); + $carrier->name = $config['name']; + $carrier->id_tax_rules_group = $config['id_tax_rules_group']; + $carrier->id_zone = $config['id_zone']; + $carrier->active = $config['active']; + $carrier->deleted = $config['deleted']; + $carrier->delay = $config['delay']; + $carrier->shipping_handling = $config['shipping_handling']; + $carrier->range_behavior = $config['range_behavior']; + $carrier->is_module = $config['is_module']; + $carrier->shipping_external = $config['shipping_external']; + $carrier->external_module_name = $config['external_module_name']; + $carrier->need_range = $config['need_range']; + + $languages = Language::getLanguages(true); + foreach ($languages as $language) + { + if ($language['iso_code'] == 'fr') + $carrier->delay[(int)$language['id_lang']] = $config['delay'][$language['iso_code']]; + if ($language['iso_code'] == 'en') + $carrier->delay[(int)$language['id_lang']] = $config['delay'][$language['iso_code']]; + if ($language['iso_code'] == Language::getIsoById(Configuration::get('PS_LANG_DEFAULT'))) + $carrier->delay[(int)$language['id_lang']] = $config['delay'][$language['iso_code']]; + } + + if ($carrier->add()) + { + $groups = Group::getGroups(true); + foreach ($groups as $group) + Db::getInstance()->autoExecute(_DB_PREFIX_.'carrier_group', array('id_carrier' => (int)($carrier->id), 'id_group' => (int)($group['id_group'])), 'INSERT'); + + $rangePrice = new RangePrice(); + $rangePrice->id_carrier = $carrier->id; + $rangePrice->delimiter1 = '0'; + $rangePrice->delimiter2 = '10000'; + $rangePrice->add(); + + $rangeWeight = new RangeWeight(); + $rangeWeight->id_carrier = $carrier->id; + $rangeWeight->delimiter1 = '0'; + $rangeWeight->delimiter2 = '10000'; + $rangeWeight->add(); + + $zones = Zone::getZones(true); + foreach ($zones as $zone) + { + Db::getInstance()->autoExecute(_DB_PREFIX_.'carrier_zone', array('id_carrier' => (int)($carrier->id), 'id_zone' => (int)($zone['id_zone'])), 'INSERT'); + Db::getInstance()->autoExecuteWithNullValues(_DB_PREFIX_.'delivery', array('id_carrier' => (int)($carrier->id), 'id_range_price' => (int)($rangePrice->id), 'id_range_weight' => null, 'id_zone' => (int)($zone['id_zone']), 'price' => '0'), 'INSERT'); + Db::getInstance()->autoExecuteWithNullValues(_DB_PREFIX_.'delivery', array('id_carrier' => (int)($carrier->id), 'id_range_price' => null, 'id_range_weight' => (int)($rangeWeight->id), 'id_zone' => (int)($zone['id_zone']), 'price' => '0'), 'INSERT'); + } + + // Copy Logo + if (!copy(dirname(__FILE__).'/carrier.jpg', _PS_SHIP_IMG_DIR_.'/'.(int)$carrier->id.'.jpg')) + return false; + + // Return ID Carrier + return (int)($carrier->id); + } + + return false; + } + + public function uninstall() + { + // Uninstall Carriers + Db::getInstance()->autoExecute(_DB_PREFIX_.'carrier', array('deleted' => 1), 'UPDATE', '`external_module_name` = \'tntcarrier\''); + // Uninstall Config + foreach ($this->_fieldsList as $keyConfiguration => $name) + if (!Configuration::deleteByName($keyConfiguration)) + return false; + // Uninstall SQL + include(dirname(__FILE__).'/sql-uninstall.php'); + foreach ($sql as $s) + if (!Db::getInstance()->Execute($s)) + return false; + // Uninstall Module + if (!parent::uninstall() OR !$this->unregisterHook('updateCarrier')) + return false; + return true; + } + + /* + ** Form Config Methods + ** + */ + + public function getContent() + { + $this->_html .= '<h2><a href="http://www.tnt.fr/"><img src="'.$this->_path.'logo.gif" alt="' . $this->l('TNT Carrier').'" /></a></h2>'; + if (!empty($_POST) AND Tools::isSubmit('submitSave')) + { + $this->_postValidation(); + if (!sizeof($this->_postErrors)) + $this->_postProcess(); + else + foreach ($this->_postErrors AS $err) + $this->_html .= '<div class="alert error"><img src="'._PS_IMG_.'admin/forbbiden.gif" alt="nok" /> '.$err.'</div>'; + } + $this->_displayForm(); + return $this->_html; + } + + private function _displayForm() + { + global $smarty; + + $globalVar = array( + 'tab' => Tools::getValue('tab'), + 'configure' => Tools::getValue('configure'), + 'token' => Tools::getValue('token'), + 'tab_module' => Tools::getValue('tab_module'), + 'module_name' => Tools::getValue('module_name')); + + $smarty->assign('glob', $globalVar); + + $lang = array( + 'followParameters' => $this->l('The following parameters were provided to you by TNT'), 'registered' => $this->l('If you are not yet registered, click '), 'here' => $this->l('here'), + 'accountSetting' => $this->l('Account settings'), 'shippingSetting' => $this->l('Shipping Settings'), 'serviceSetting' => $this->l('Service Settings'), + 'accountTNT' => $this->l('Account TNT'), 'login' => $this->l('Login'), 'password' => $this->l('Password'), 'numberAccount' => $this->l('Number account'), + 'fillDataInTheForm' => $this->l('Fill Data in the form'), 'shipping' => $this->l('Shipping'), 'collect' => $this->l('Would you like TNT to pick up your package ?'), 'noDeposit' => $this->l('No (Deposit)'), + 'yes' => $this->l('Yes'), 'chooseYourDepositoryLocation' => $this->l('Choose your depository location'), 'pexCode' => $this->l('Pex Code'), 'companyName' => $this->l('Company Name'), + 'lastName' => $this->l('Last name'), 'firstName' => $this->l('First name'), 'address1' => $this->l('Address line 1'), 'address2' => $this->l('Address line 2'), 'zip' => $this->l('Zip / Postal Code'), 'city' => $this->l('Your City'), + 'email' => $this->l('Your Email Address'), 'phone' => $this->l('Your Phone Number'), 'closingTime' => $this->l('Your Closing Time'), 'saturdayDelivery' => $this->l('Saturday Delivery'), 'no' => $this->l('No'), + 'labelFormatPrinting' => $this->l('Label Format for printing (This Label will have to be sticked on the package)'), 'a4printing' => $this->l('A4 printing'), 'withoutPrintingLogoTNT' => $this->l('without printing the logo TNT'), 'withReversePrint' => $this->l('with a reverse print'), 'withoutPrintingLogoTNTWithReversePrint' => $this->l('without printing the logo TNT and with a reverse print'), + 'newService' => $this->l('New Service'), 'id' => $this->l('ID'), 'name' => $this->l('Name'), 'description' => $this->l('Description'), 'code' => $this->l('Code'), 'additionnalCharge' => $this->l('Additionnal charge (Euros)'), 'activated' => $this->l('Activated'), 'edit' => $this->l('edit'), 'delete' => $this->l('delete'), 'place' => $this->l('Place') + ); + + $smarty->assign('lang', $lang); + + $this->_html .= '<fieldset> + <legend>'.$this->l('TNT Carrier Module Status').'</legend>'; + + $alert = array(); + if (!Configuration::get('TNT_CARRIER_LOGIN') || !Configuration::get('TNT_CARRIER_PASSWORD') || !Configuration::get('TNT_CARRIER_NUMBER_ACCOUNT')) + $alert['account'] = 1; + if ( + !Configuration::get('TNT_CARRIER_SHIPPING_ADDRESS1') || + !Configuration::get('TNT_CARRIER_SHIPPING_ZIPCODE') || + !Configuration::get('TNT_CARRIER_SHIPPING_CITY') || + !Configuration::get('TNT_CARRIER_SHIPPING_EMAIL') || + !Configuration::get('TNT_CARRIER_SHIPPING_PHONE')) + $alert['shipping'] = 1; + if ((Db::getInstance()->getValue('SELECT * FROM `'._DB_PREFIX_.'carrier` WHERE `external_module_name` = "'.$this->_moduleName.'" AND deleted = "0"')) < 1) + $alert['service'] = 1; + if (!count($alert)) + $this->_html .= '<img src="'._PS_IMG_.'admin/module_install.png" /><strong>'.$this->l('TNT Carrier is configured and online!').'</strong>'; + else + { + $this->_html .= '<img src="'._PS_IMG_.'admin/warn2.png" /><strong>'.$this->l('TNT Carrier is not configured yet, please:').'</strong>'; + $this->_html .= '<br />'.(isset($alert['account']) ? '<img src="'._PS_IMG_.'admin/warn2.png" />' : '<img src="'._PS_IMG_.'admin/module_install.png" />').' '.$this->l('Make sure you have a tnt account.'); + $this->_html .= '<br />'.(isset($alert['shipping']) ? '<img src="'._PS_IMG_.'admin/warn2.png" />' : '<img src="'._PS_IMG_.'admin/module_install.png" />').' '.$this->l('Make sure you have a correct shipping address.'); + $this->_html .= '<br />'.(isset($alert['service']) ? '<img src="'._PS_IMG_.'admin/warn2.png" />' : '<img src="'._PS_IMG_.'admin/module_install.png" />').' '.$this->l('Make sure services are activated after a bill.'); + } + + $this->_html .= '</fieldset><div class="clear"> </div>'; + $this->_html .= $this->_displayFormConfig(); + } + + private function _displayFormConfig() + { + global $smarty; + $var = array('account' => $this->_displayFormAccount(), 'shipping' => $this->_displayFormShipping(), 'service' => $this->_displayService(), + 'country' => $this->_displayCountry('Corse'), 'info' => $this->_displayInfo('weight')); + $smarty->assign('varMain', $var); + $html = $this->display( __FILE__, 'tpl/main.tpl' ); + if (isset($_GET['id_tab'])) + $html .= '<script> + $(".menuTabButton.selected").removeClass("selected"); + $("#menuTab'.Tools::getValue('id_tab').'").addClass("selected"); + $(".tabItem.selected").removeClass("selected"); + $("#menuTab'.Tools::getValue('id_tab').'Sheet").addClass("selected"); + </script>'; + return $html; + } + + private function _displayFormAccount() + { + global $smarty; + $var = array('login' => Tools::getValue('tnt_carrier_login', Configuration::get('TNT_CARRIER_LOGIN')), 'password' => Tools::getValue('tnt_carrier_password', Configuration::get('TNT_CARRIER_PASSWORD')), + 'account' => Tools::getValue('tnt_carrier_number_account', Configuration::get('TNT_CARRIER_NUMBER_ACCOUNT'))); + $smarty->assign('varAccount', $var); + return $this->display( __FILE__, 'tpl/accountForm.tpl' ); + } + + private function _displayFormShipping() + { + global $cookie, $smarty; + + $var = array('moduleName' => $this->_moduleName, 'collect' => Configuration::get('TNT_CARRIER_SHIPPING_COLLECT'), 'pex' => Configuration::get('TNT_CARRIER_SHIPPING_PEX'), 'company' => Configuration::get('TNT_CARRIER_SHIPPING_COMPANY'), + 'lastName' => Configuration::get('TNT_CARRIER_SHIPPING_LASTNAME'), 'firstName' => Configuration::get('TNT_CARRIER_SHIPPING_FIRSTNAME'), 'address1' => Configuration::get('TNT_CARRIER_SHIPPING_ADDRESS1'), + 'address2' => Configuration::get('TNT_CARRIER_SHIPPING_ADDRESS2'), 'zipCode' => Configuration::get('TNT_CARRIER_SHIPPING_ZIPCODE'), 'city' => Configuration::get('TNT_CARRIER_SHIPPING_CITY'), 'email' => Configuration::get('TNT_CARRIER_SHIPPING_EMAIL'), + 'phone' => Configuration::get('TNT_CARRIER_SHIPPING_PHONE'), 'closing' => Configuration::get('TNT_CARRIER_SHIPPING_CLOSING'), 'delivery' => Configuration::get('TNT_CARRIER_SHIPPING_DELIVERY'), 'sticker' => Configuration::get('TNT_CARRIER_PRINT_STICKER')); + $smarty->assign('varShipping', $var); + return $this->display( __FILE__, 'tpl/shippingForm.tpl' ); + } + + private function _displayService() + { + global $smarty; + if (Tools::getValue('action') == 'del' && Tools::getValue('service') != '') + { + $id = Tools::getValue('service'); + Db::getInstance()->Execute('UPDATE `'._DB_PREFIX_.'carrier` SET `deleted` = "1" WHERE `id_carrier` = '.(int)($id).''); + $option = Db::getInstance()->ExecuteS('SELECT `option` FROM `'._DB_PREFIX_.'tnt_carrier_option` WHERE `id_carrier` = "'.(int)($id).'"'); + Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'tnt_carrier_option` WHERE `id_carrier` = '.(int)($id).''); + Configuration::deleteByName('TNT_CARRIER_'.$option[0]['option'].'_ID'); + Configuration::deleteByName('TNT_CARRIER_'.$option[0]['option'].'_OVERCOST'); + } + $irow = 0; + $serviceList = Db::getInstance()->ExecuteS('SELECT c.deleted, c.name, cl.delay, o.option + FROM `'._DB_PREFIX_.'carrier` c, `'._DB_PREFIX_.'carrier_lang` cl, `'._DB_PREFIX_.'tnt_carrier_option` o , `'._DB_PREFIX_.'lang` l + WHERE c.external_module_name = "'.$this->_moduleName.'" AND c.id_carrier = cl.id_carrier AND cl.id_lang = l.id_lang AND l.iso_code = "'.Language::getIsoById(Configuration::get('PS_LANG_DEFAULT')).'" AND o.id_carrier = c.id_carrier'); + foreach ($serviceList as $k => $v) + { + $serviceList[$k]['optionId'] = Configuration::get('TNT_CARRIER_'.$v['option'].'_ID'); + $serviceList[$k]['optionOvercost'] = Configuration::get('TNT_CARRIER_'.$v['option'].'_OVERCOST'); + } + + $var = array('serviceList' => $serviceList, + 'action' => Tools::getValue('action'), + 'section' => Tools::getValue('section'), + 'form' => $this->_displayFormService(Tools::getValue('service'))); + $smarty->assign('varService', $var); + return $this->display( __FILE__, 'tpl/service.tpl' ); + } + + private function _displayInfo($cat) + { + if (Tools::getValue('action') == 'del' && Tools::getValue($cat) != '') + { + $id = Tools::getValue($cat); + Db::getInstance()->ExecuteS('DELETE FROM `'._DB_PREFIX_.'tnt_carrier_'.$cat.'` WHERE `id_'.$cat.'` = '.(int)$id.''); + } + + $html = ' + <a href="index.php?tab='.Tools::getValue('tab').'&configure='.Tools::getValue('configure').'&token='.Tools::getValue('token').'&tab_module='.Tools::getValue('tab_module').'&module_name='.Tools::getValue('module_name').'&id_tab=3§ion='.$cat.'&action=new"> + <img src="../img/admin/add.gif" alt="add"/> '.$this->l('New weight option').'</a></br><br/> + <table class="table" cellspacing="0" cellpading="0"> + <tr> + <th>'.$this->l('ID').'</th><th>'.$this->l('Weight Min').'</th><th>'.$this->l('Weight Max').'</th><th>'.$this->l('Additionnal charge (Euros)').'</th><th></th> + </tr>'; + $List = Db::getInstance()->ExecuteS('SELECT * FROM `'._DB_PREFIX_.'tnt_carrier_'.$cat.'` ORDER BY `id_'.$cat.'`'); + $irow = 0; + foreach ($List as $v) + { + $html .= '<tr '.($irow++ % 2 ? 'class="alt_row"' : '').'> + <td>'.$v['id_'.$cat.''].'</td> + <td>'.$v[''.$cat.'_min'].'</td> + <td>'.$v[''.$cat.'_max'].'</td> + <td>'.$v['additionnal_charges'].'</td> + <td> + <a href="index.php?tab='.Tools::getValue('tab').'&configure='.Tools::getValue('configure').'&token='.Tools::getValue('token').'&tab_module='.Tools::getValue('tab_module').'&module_name='.Tools::getValue('module_name').'&id_tab=3§ion='.$cat.'&action=edit&'.$cat.'='.$v['id_'.$cat.''].'"> + <img src="../img/admin/edit.gif" alt="edit" title="'.$this->l('Edit').'"/></a> + <a href="index.php?tab='.Tools::getValue('tab').'&configure='.Tools::getValue('configure').'&token='.Tools::getValue('token').'&tab_module='.Tools::getValue('tab_module').'&module_name='.Tools::getValue('module_name').'&id_tab=3§ion='.$cat.'&action=del&'.$cat.'='.$v['id_'.$cat.''].'"> + <img src="../img/admin/delete.gif" alt="delete" title="'.$this->l('Delete').'"/></a></td> + </tr>'; + } + $html .= ' + </table><br/> + <div id="divForm'.$cat.'Service">'.((Tools::getValue('action') == 'edit' || Tools::getValue('action') == 'new') && Tools::getValue('section') == $cat ? $this->_displayFormInfo($cat, Tools::getValue($cat)) : '').'</div> + '; + + return $html; + } + + private function _displayCountry($country) + { + global $smarty; + + $var = array( + 'country' => $country, + 'overcost' => Configuration::get('TNT_CARRIER_'.strtoupper($country).'_OVERCOST'), + 'action' => Tools::getValue('action'), + 'section' => Tools::getValue('section'), + 'getCountry' => Tools::getValue('country'), + 'form' => (Tools::getValue('country') != '' ? $this->_displayFormCountry(Tools::getValue('country')) : '') + ); + $smarty->assign('varCountry', $var); + return $this->display( __FILE__, 'tpl/country.tpl' ); + } + + private function _displayFormService($id = null) + { + global $smarty; + $name = ''; + $description = ''; + $code = ''; + $charge = ''; + $display = ''; + + if ($id != null) + { + $service = Db::getInstance()->ExecuteS('SELECT c.deleted, c.name, l.delay, o.option, o.additionnal_charges + FROM `'._DB_PREFIX_.'carrier` c, `'._DB_PREFIX_.'carrier_lang` l, `'._DB_PREFIX_.'tnt_carrier_option` o + WHERE c.id_carrier = "'.(int)$id.'" AND c.id_carrier = l.id_carrier AND l.id_lang = "1" AND o.id_carrier = c.id_carrier'); + if ($service != NULL) + { + $name = $service[0]['name']; + $description = $service[0]['delay']; + $code = $service[0]['option']; + $charge = $service[0]['additionnal_charges']; + $display = $service[0]['deleted']; + } + } + $var = array('id' => $id,'name' => $name, 'description' => $description, 'code' => $code, 'charge' => $charge, 'display' => $display); + $smarty->assign('varServiceForm', $var); + return $this->display( __FILE__, 'tpl/serviceForm.tpl' ); + } + + private function _displayFormInfo($cat, $id = null) + { + $info_min = ''; + $info_max = ''; + $charge = ''; + + if ($id != null) + { + $info = Db::getInstance()->ExecuteS('SELECT * FROM `'._DB_PREFIX_.'tnt_carrier_'.$cat.'` WHERE `id_'.$cat.'` = "'.$id.'"'); + $info_min = $info[0][$cat.'_min']; + $info_max = $info[0][$cat.'_max']; + $charge = $info[0]['additionnal_charges']; + } + + $html = ' + <form action="index.php?tab='.Tools::getValue('tab').'&configure='.Tools::getValue('configure').'&token='.Tools::getValue('token').'&tab_module='.Tools::getValue('tab_module').'&module_name='.Tools::getValue('module_name').'&id_tab=3§ion='.$cat.'&action=new" method="post" class="form" id="configForm'.$cat.'"> + '.($id != null ? '<input type="hidden" name="'.$cat.'_id" value="'.$id.'"/>' : '').' + <table class="table" cellspacing="0" cellpadding="0"> + <tr> + <th>'.$this->l('Weight min').'</th><th>'.$this->l('Weight max').'</th><th>'.$this->l('Additionnal charge').'</th><th></th> + </tr> + <tr> + <td><input type="text" name="tnt_carrier_'.$cat.'_min" size="20" value="'.$info_min.'"/></td> + <td><input type="text" name="tnt_carrier_'.$cat.'_max" size="20" value="'.$info_max.'"/></td> + <td><input type="text" name="tnt_carrier_'.$cat.'_charge" size="10" value="'.$charge.'"/></td> + <td><input class="button" name="submitSave" type="submit"></td> + </tr> + </table> + </form>'; + + return $html; + } + + private function _displayFormCountry($country) + { + global $smarty; + $var = array( + 'country' => $country, + 'overcost' => Configuration::get('TNT_CARRIER_'.strtoupper($country).'_OVERCOST') + ); + $smarty->assign('varCountryForm', $var); + return $this->display( __FILE__, 'tpl/countryForm.tpl' ); + } + + private function _postValidation() + { + if (Tools::getValue('section') == 'account') + $this->_postValidationAccount(); + elseif (Tools::getValue('section') == 'shipping') + $this->_postValidationShipping(); + elseif (Tools::getValue('section') == 'service') + $this->_postValidationService(); + elseif (Tools::getValue('section') == 'weight') + $this->_postValidationInfo(Tools::getValue('section')); + elseif (Tools::getValue('section') == 'country') + $this->_postValidationCountry(); + } + + private function _postProcess() + { + + } + + private function _postValidationAccount() + { + $login = Tools::getValue('tnt_carrier_login'); + $password = Tools::getValue('tnt_carrier_password'); + $number = Tools::getValue('tnt_carrier_number_account'); + if (!$login || !$password || !$number) + $this->_postErrors[] = $this->l("All the fields are required"); + Configuration::updateValue('TNT_CARRIER_LOGIN', $login); + Configuration::updateValue('TNT_CARRIER_PASSWORD', $password); + Configuration::updateValue('TNT_CARRIER_NUMBER_ACCOUNT', $number); + } + + private function _postValidationShipping() + { + $collect = $email = Tools::getValue('tnt_carrier_shipping_collect'); + $company = Tools::getValue('tnt_carrier_shipping_company'); + $pex = Tools::getValue('tnt_carrier_shipping_pex'); + $lname = Tools::getValue('tnt_carrier_shipping_last_name'); + $fname = Tools::getValue('tnt_carrier_shipping_first_name'); + $address1 = Tools::getValue('tnt_carrier_shipping_address1'); + $address2 = Tools::getValue('tnt_carrier_shipping_address2'); + $postal_code = Tools::getValue('tnt_carrier_shipping_postal_code'); + $city = Tools::getValue('tnt_carrier_shipping_city'); + $email = Tools::getValue('tnt_carrier_shipping_email'); + $phone = Tools::getValue('tnt_carrier_shipping_phone'); + $closing = Tools::getValue('tnt_carrier_shipping_closing'); + $delivery = Tools::getValue('tnt_carrier_shipping_delivery'); + $print = Tools::getValue('tnt_carrier_print_sticker'); + + if (!$collect && $pex == '') + $this->_postErrors[] = $this->l("The pex code is missing"); + if ($collect && $company == '') + $this->_postErrors[] = $this->l("Your company name is missing"); + if ($collect && !$lname) + $this->_postErrors[] = $this->l("Your last name is missing"); + if ($collect && !$fname) + $this->_postErrors[] = $this->l("Your first name is missing"); + if (!$address1) + $this->_postErrors[] = $this->l("Your address is missing"); + if (!$postal_code) + $this->_postErrors[] = $this->l("Your zip code is missing"); + if (!$email) + $this->_postErrors[] = $this->l("Your email address is missing"); + if (!$phone) + $this->_postErrors[] = $this->l("Your phone number is missing"); + if ($collect && $closing == '') + $this->_postErrors[] = $this->l("Your closing time is missing"); + + Configuration::updateValue('TNT_CARRIER_SHIPPING_COLLECT', $collect); + Configuration::updateValue('TNT_CARRIER_SHIPPING_COMPANY', $company); + Configuration::updateValue('TNT_CARRIER_SHIPPING_LASTNAME', $lname); + Configuration::updateValue('TNT_CARRIER_SHIPPING_FIRSTNAME', $fname); + Configuration::updateValue('TNT_CARRIER_SHIPPING_ADDRESS1', $address1); + Configuration::updateValue('TNT_CARRIER_SHIPPING_ADDRESS2', $address2); + Configuration::updateValue('TNT_CARRIER_SHIPPING_ZIPCODE', $postal_code); + Configuration::updateValue('TNT_CARRIER_SHIPPING_CITY', $city); + Configuration::updateValue('TNT_CARRIER_SHIPPING_EMAIL', $email); + Configuration::updateValue('TNT_CARRIER_SHIPPING_PHONE', $phone); + Configuration::updateValue('TNT_CARRIER_SHIPPING_CLOSING', $closing); + Configuration::updateValue('TNT_CARRIER_SHIPPING_DELIVERY', $delivery); + Configuration::updateValue('TNT_CARRIER_SHIPPING_PEX', $pex); + Configuration::updateValue('TNT_CARRIER_PRINT_STICKER', $print); + } + + private function _postValidationService() + { + if (Tools::getValue('action') == 'new' && Tools::getValue('service_id') != null ) + $this->_postValidationEditService(); + elseif (Tools::getValue('action') == 'new' && Tools::getValue('service_id') == null) + $this->_postValidationNewService(); + } + + private function _postValidationInfo($cat) + { + if (Tools::getValue('action') == 'new' && Tools::getValue($cat.'_id') != null ) + $this->_postValidationEditInfo($cat); + elseif (Tools::getValue('action') == 'new' && Tools::getValue($cat.'_id') == null) + $this->_postValidationNewInfo($cat); + } + + private function _postValidationNewService() + { + $name = Tools::getValue('tnt_carrier_service_name'); + $description = Tools::getValue('tnt_carrier_service_description'); + $code = Tools::getValue('tnt_carrier_service_code'); + $charge = Tools::getValue('tnt_carrier_service_charge'); + $display = Tools::getValue('tnt_carrier_service_display'); + + if ($name == '') + $this->_postErrors[] = $this->l('You have to give a name service'); + if ($code == '') + $this->_postErrors[] = $this->l('You have to give a code service'); + if ($description == '') + $this->_postErrors[] = $this->l('You have to give a description of the service'); + if ($display == '1') + $delete = false; + else + $delete = true; + + if (!$this->_postErrors) + { + $carrierConfig = array( + 'name' => $name, + 'id_tax_rules_group' => 0, + 'active' => true, + 'deleted' => $delete, + 'shipping_handling' => false, + 'range_behavior' => 0, + 'delay' => array('fr' => $description, 'en' => $description, Language::getIsoById(Configuration::get('PS_LANG_DEFAULT')) => $description), + 'id_zone' => 1, + 'is_module' => true, + 'shipping_external' => true, + 'external_module_name' => $this->_moduleName, + 'need_range' => true + ); + $id_carrier = $this->installExternalCarrier($carrierConfig); + + Db::getInstance()->autoExecute(_DB_PREFIX_.'tnt_carrier_option', + array('id_carrier' => (int)($id_carrier), + 'option' => $code, + 'additionnal_charges' => (float)($charge)),'INSERT'); + Configuration::updateValue('TNT_CARRIER_'.$code.'_ID', (int)($id_carrier)); + Configuration::updateValue('TNT_CARRIER_'.$code.'_OVERCOST', (float)($charge)); + $this->_fieldsList['TNT_CARRIER_'.$code.'_OVERCOST'] = (float)($charge); + $this->_fieldsList['TNT_CARRIER_'.$code.'_ID'] = (float)($id_carrier); + $this->_html .= $this->displayConfirmation($this->l('Service updated')); + } + } + + private function _postValidationEditService() + { + $id = Tools::getValue('service_id'); + $name = Tools::getValue('tnt_carrier_service_name'); + $description = Tools::getValue('tnt_carrier_service_description'); + $code = Tools::getValue('tnt_carrier_service_code'); + $charge = Tools::getValue('tnt_carrier_service_charge'); + $display = Tools::getValue('tnt_carrier_service_display'); + + if ($name == '') + $this->_postErrors[] = $this->l('You have to give a name service'); + if ($code == '') + $this->_postErrors[] = $this->l('You have to give a code service'); + if ($description == '') + $this->_postErrors[] = $this->l('You have to give a description of the service'); + if ($display == '1') + $display = '0'; + else + $display = '1'; + + if (!$this->_postErrors) + { + Db::getInstance()->Execute('UPDATE `'._DB_PREFIX_.'carrier` SET `name` = "'.$name.'", `deleted` = "'.(int)($display).'" WHERE `id_carrier` = '.(int)($id).''); + Db::getInstance()->Execute('UPDATE `'._DB_PREFIX_.'carrier_lang` SET `delay` = "'.$description.'" WHERE `id_carrier` = '.(int)($id).''); + Db::getInstance()->Execute('UPDATE `'._DB_PREFIX_.'tnt_carrier_option` SET `option` = "'.$code.'" WHERE `id_carrier` = '.(int)($id).''); + Configuration::updateValue('TNT_CARRIER_'.$code.'_OVERCOST', (float)($charge)); + Configuration::updateValue('TNT_CARRIER_'.$code.'_ID', (int)($id)); + $this->_fieldsList['TNT_CARRIER_'.$code.'_OVERCOST'] = (float)($charge); + $this->_fieldsList['TNT_CARRIER_'.$code.'_ID'] = (float)($id); + $this->_html .= $this->displayConfirmation($this->l('Service updated')); + } + } + + private function _postValidationNewInfo($cat) + { + $info_min = Tools::getValue('tnt_carrier_'.$cat.'_min'); + $info_max = Tools::getValue('tnt_carrier_'.$cat.'_max'); + $charge = Tools::getValue('tnt_carrier_'.$cat.'_charge'); + Db::getInstance()->autoExecute(_DB_PREFIX_.'tnt_carrier_'.$cat.'', + array( + ''.$cat.'_min' => (float)($info_min), + ''.$cat.'_max' => (float)($info_max), + 'additionnal_charges' => (float)($charge)),'INSERT'); + $this->_html .= $this->displayConfirmation($this->l('Service updated')); + } + + private function _postValidationEditInfo($cat) + { + $id = Tools::getValue($cat.'_id'); + $info_min = Tools::getValue('tnt_carrier_'.$cat.'_min'); + $info_max = Tools::getValue('tnt_carrier_'.$cat.'_max'); + $charge = Tools::getValue('tnt_carrier_'.$cat.'_charge'); + + Db::getInstance()->Execute('UPDATE `'._DB_PREFIX_.'tnt_carrier_'.$cat.'` + SET `'.$cat.'_min` = "'.(float)($info_min).'", + `'.$cat.'_max` = "'.(float)($info_max).'", + `additionnal_charges` = "'.(float)$charge.'" + WHERE `id_'.$cat.'` = '.(int)($id).''); + + $this->_html .= $this->displayConfirmation($this->l('Service updated')); + } + + private function _postValidationCountry() + { + $country = Tools::getValue('tnt_carrier_country'); + $overcost = Tools::getValue('tnt_carrier_'.$country.'_overcost'); + + Configuration::updateValue('TNT_CARRIER_'.strtoupper($country).'_OVERCOST', $overcost); + } + + /* + ** Hook update carrier + ** + */ + public function hookextraCarrier($params) + { + global $smarty; + $id_cart = $params['cart']->id; + $smarty->assign('id_cart', $id_cart); + return $this->display( __FILE__, 'tpl/relaisColis.tpl' ); + } + + public function hookadminOrder($params) + { + global $currentIndex, $smarty; + $table = 'order'; + $token = Tools::getValue('token'); + $errorShipping = 0; + + $carrierName = Db::getInstance()->ExecuteS('SELECT c.external_module_name FROM `'._DB_PREFIX_.'carrier` as c, `'._DB_PREFIX_.'orders` as o WHERE c.id_carrier = o.id_carrier AND o.id_order = "'.(int)($params['id_order']).'"'); + if ($carrierName!= null && $carrierName[0]['external_module_name'] != $this->_moduleName) + return false; + if (!Configuration::get('TNT_CARRIER_LOGIN') || !Configuration::get('TNT_CARRIER_PASSWORD') || !Configuration::get('TNT_CARRIER_NUMBER_ACCOUNT')) + { + $var = array("error" => $this->l("You don't have a TNT account"), + 'shipping_numbers' => '', + 'sticker' => ''); + $smarty->assign('var', $var); + return $this->display( __FILE__, 'tpl/shippingNumber.tpl' ); + } + if (Configuration::get('TNT_CARRIER_SHIPPING_COLLECT')) + { + if (!Configuration::get('TNT_CARRIER_SHIPPING_COMPANY') || !Configuration::get('TNT_CARRIER_SHIPPING_ADDRESS1') || !Configuration::get('TNT_CARRIER_SHIPPING_ZIPCODE') || !Configuration::get('TNT_CARRIER_SHIPPING_CITY') || !Configuration::get('TNT_CARRIER_SHIPPING_EMAIL') + || !Configuration::get('TNT_CARRIER_SHIPPING_PHONE') || !Configuration::get('TNT_CARRIER_SHIPPING_CLOSING')) + $errorShipping = 1; + } + else + { + if (!Configuration::get('TNT_CARRIER_SHIPPING_PEX') || !Configuration::get('TNT_CARRIER_SHIPPING_ADDRESS1') || !Configuration::get('TNT_CARRIER_SHIPPING_ZIPCODE') || !Configuration::get('TNT_CARRIER_SHIPPING_CITY') || !Configuration::get('TNT_CARRIER_SHIPPING_EMAIL') + || !Configuration::get('TNT_CARRIER_SHIPPING_PHONE')) + $errorShipping = 1; + } + if ($errorShipping) + { + $var = array("error" => $this->l("You didn't give a collect address in the TNT module configuration"), + 'shipping_numbers' => '', + 'sticker' => ''); + $smarty->assign('var', $var); + return $this->display( __FILE__, 'tpl/shippingNumber.tpl' ); + } + + $orderInfoTnt = new OrderInfoTnt((int)($params['id_order'])); + $info = $orderInfoTnt->getInfo(); + if (!is_array($info) && $info != false) + { + $var = array("error" => $info, "weight" => '', + "weightHidden" => '1', "date" => '', "dateHidden" => '1', 'currentIndex' => $currentIndex, 'table' => $table, 'token' => $token); + $smarty->assign('var', $var); + return $this->display( __FILE__, 'tpl/formerror.tpl' ); + } + $dataWeight = (int)(Tools::getValue('weightErrorOrder')); + if ($dataWeight != 0) + $info[1]['weight'][0] = $dataWeight; + $pack = new PackageTnt((int)($params['id_order'])); + if ($info[0]['shipping_number'] == '' && $pack->getOrder()->hasBeenShipped()) + { + $tntWebService = new TntWebService(); + try + { + $package = $tntWebService->getPackage($info); + } + catch( SoapFault $e ) + { + if (strrpos($e->faultstring, "weight")) + $weightError = 1; + if (strrpos($e->faultstring, "shippingDate")) + $dateError = date("Y-m-d"); + $error = $this->l("Problem : ") . $e->faultstring; + $var = array("error" => $error, "weight" => (isset($weightError) ? $weightError : ''), "weightHidden" => (!isset($weightError) ? $info[1]['weight'] : ''), + "date" => (isset($dateError) ? $dateError : ''), "dateHidden" => (!isset($dateError) ? $info[2]['delivery_date'] : ''), + 'currentIndex' => $currentIndex, 'table' => $table, 'token' => $token); + $smarty->assign('var', $var); + return $this->display( __FILE__, 'tpl/formerror.tpl' ); + } + catch( Exception $e ) { + $error = $this->l("Problem : failed"); + } + if (isset($package->Expedition->parcelResponses->parcelNumber)) + $pack->setShippingNumber($package->Expedition->parcelResponses->parcelNumber); + else + foreach ($package->Expedition->parcelResponses as $k => $v) + $pack->setShippingNumber($v->parcelNumber); + file_put_contents("../modules/".$this->_moduleName.'/pdf/'.$pack->getOrder()->shipping_number.'.pdf', $package->Expedition->PDFLabels); + } + if ($pack->getShippingNumber() != '') + { + $var = array( + 'lang_shippingNumber' => $this->l('The shipping number(s)'), 'lang_sticker' => $this->l('The sticker'), 'lang_expedition' => $this->l('Expedition'), + 'error' => '', + 'shipping_numbers' => $pack->getShippingNumber(), + 'sticker' => "../modules/".$this->_moduleName.'/pdf/'.$pack->getOrder()->shipping_number.'.pdf', + 'date' => $info[2]['delivery_date'], + 'place' => Configuration::get('TNT_CARRIER_SHIPPING_ADDRESS1')." ".Configuration::get('TNT_CARRIER_SHIPPING_ADDRESS2')."<br/>".Configuration::get('TNT_CARRIER_SHIPPING_ZIPCODE')." ".$this->putCityInNormeTnt(Configuration::get('TNT_CARRIER_SHIPPING_CITY'))); + $smarty->assign('var', $var); + return $this->display( __FILE__, 'tpl/shippingNumber.tpl' ); + } + return false; + } + + public function hookorderDetailDisplayed($params) + { + global $smarty; + + $tab = $params['order']->getFields(); + $shipping_number = $tab['shipping_number']; + $id_carrier = $tab['id_carrier']; + $erreur = null; + $follow = array(); + $carrierName = Db::getInstance()->ExecuteS('SELECT external_module_name FROM `'._DB_PREFIX_.'carrier` WHERE `id_carrier` = "'.(int)($id_carrier).'"'); + if ($carrierName != null && $carrierName[0]['external_module_name'] == $this->_moduleName && $shipping_number != '') + { + $pack = new PackageTnt($params['order']->id); + $numbers = $pack->getShippingNumber(); + $smarty->assign('numbers', $numbers); + return $this->display( __FILE__, 'tpl/waitingFollow.tpl' ); + } + } + + public function hookupdateCarrier($params) + { + } + + /* + ** Front Methods + ** + ** If you set need_range at true when you created your carrier (in install method), the method called by the cart will be getOrderShippingCost + ** If not, the method called will be getOrderShippingCostExternal + ** + ** $params var contains the cart, the customer, the address + ** $shipping_cost var contains the price calculated by the range in carrier tab + ** + */ + + public function getOrderShippingCost($params, $shipping_cost) + { + if ((int)(Tools::getValue('step')) > 2) + serviceCache::deleteServices($params->id); + $product = $params->getProducts(); + $weight = 0; + $add = 0; + $id_customer = $params->id_customer; + $date_exp = $params->date_upd; + $id_adress_delivery = $params->id_address_delivery; + + foreach($product as $k => $v) + $weight += (float)($v['weight']); + + if ((int)(Tools::getValue('step')) == 2) + { + if (!Configuration::get('TNT_CARRIER_LOGIN') || !Configuration::get('TNT_CARRIER_PASSWORD') || !Configuration::get('TNT_CARRIER_NUMBER_ACCOUNT')) + return false; + if (!Configuration::get('TNT_CARRIER_SHIPPING_ADDRESS1') || !Configuration::get('TNT_CARRIER_SHIPPING_ZIPCODE') || !Configuration::get('TNT_CARRIER_SHIPPING_CITY')) + return false; + $info = Db::getInstance()->ExecuteS('SELECT postcode, city, company FROM `'._DB_PREFIX_.'address` WHERE `id_address` = "'.(int)($id_adress_delivery).'"'); + + $serviceCache = new serviceCache($params->id, $info[0]['postcode']); + if (!$serviceCache->getFaisabilityAtThisTime()) + { + $serviceCache->deletePreviousServices(); + $tntWebService = new TntWebService(); + if (date("N") == 6) + $date_exp = date("Y-m-d", mktime(0, 0, 0, date("m") , date("d")+2, date("Y"))); + elseif (date("N") == 7) + $date_exp = date("Y-m-d", mktime(0, 0, 0, date("m") , date("d")+1, date("Y"))); + try { + $service = $tntWebService->faisabilite($date_exp, Configuration::get('TNT_CARRIER_SHIPPING_ZIPCODE'), $this->putCityInNormeTnt(Configuration::get('TNT_CARRIER_SHIPPING_CITY')), + $info[0]['postcode'], $this->putCityInNormeTnt($info[0]['city']), ($info[0]['company'] != '' ? "ENTERPRISE" : 'INDIVIDUAL')); + $serviceRelais = $tntWebService->faisabilite($date_exp, Configuration::get('TNT_CARRIER_SHIPPING_ZIPCODE'), $this->putCityInNormeTnt(Configuration::get('TNT_CARRIER_SHIPPING_CITY')), + $info[0]['postcode'], $this->putCityInNormeTnt($info[0]['city']), "DROPOFFPOINT"); + } + catch( SoapFault $e ) { + $erreur = $this->l("Problem : ") . $e->faultstring; + } + catch( Exception $e ) { + $erreur = $this->l("Problem : follow failed"); + } + if (!isset($erreur)) + $serviceCache->putInCache($service, $serviceRelais); + } + $service = $serviceCache->getServices(); + if ($service != NULL) + foreach ($service as $v) + { + if (Configuration::get('TNT_CARRIER_'.$v['code'].'_ID')) + if (Configuration::get('TNT_CARRIER_'.$v['code'].'_ID') == $this->id_carrier) + $priceCarrier = Configuration::get('TNT_CARRIER_'.$v['code'].'_OVERCOST'); + } + } + if (!isset($priceCarrier)) + { + if (isset($params->id_carrier) && (int)($params->id_carrier) > 0) + { + if ($option = Db::getInstance()->ExecuteS('SELECT `option` FROM `'._DB_PREFIX_.'tnt_carrier_option` WHERE `id_carrier` = "'.(int)($params->id_carrier).'"')) + $priceCarrier = Configuration::get('TNT_CARRIER_'.$option[0]['option'].'_OVERCOST'); + } + else + $priceCarrier = 0; + } + + $weightLimit = Db::getInstance()->ExecuteS('SELECT additionnal_charges FROM `'._DB_PREFIX_.'tnt_carrier_weight` WHERE `weight_min` < "'.(float)($weight).'" AND `weight_max` > "'.(float)($weight).'"'); + $currency = Db::getInstance()->ExecuteS('SELECT conversion_rate FROM `'._DB_PREFIX_.'currency` WHERE `id_currency` = "'.(int)($params->id_currency).'"'); + if ($weightLimit != null) + $add += (float)($weightLimit[0]['additionnal_charges']); + if (substr($info[0]['postcode'], 0, 2) == "20") + $add += (float)(Configuration::get('TNT_CARRIER_CORSE_OVERCOST')); + + if (isset($priceCarrier)) + return (($priceCarrier + $add) * $currency[0]['conversion_rate']); + return false; + } + + public function getOrderShippingCostExternal($params) + { + return getOrderShippingCost($params, null); + } + + public function putCityInNormeTnt($city) + { + $city = iconv("utf-8", 'ASCII//TRANSLIT', $city); + $city = mb_strtoupper($city, 'utf-8'); + $table = array('`' => '','\''=> '', '^' => '','À'=>'A', 'Á'=>'A', 'Â'=>'A', 'Ã'=>'A', 'Ä'=>'A', 'Å'=>'A', 'Æ'=>'A', 'Ç'=>'C', 'È'=>'E', 'É'=>'E', + 'Ê'=>'E', 'Ë'=>'E', 'Ì'=>'I', 'Í'=>'I', 'Î'=>'I', 'Ï'=>'I', 'Ñ'=>'N', 'Ò'=>'O', 'Ó'=>'O', 'Ô'=>'O', + 'Õ'=>'O', 'Ö'=>'O', 'Ø'=>'O', 'Ù'=>'U', 'Ú'=>'U', 'Û'=>'U', 'Ü'=>'U', 'Ý'=>'Y', 'Þ'=>'B'); + $city = strtr($city, $table); + $old = array("SAINT", "-"); + $new = array("ST", " "); + return (str_replace($old, $new, $city)); + } +} \ No newline at end of file diff --git a/modules/tntcarrier/tpl/accountForm.tpl b/modules/tntcarrier/tpl/accountForm.tpl new file mode 100644 index 000000000..1a0818398 --- /dev/null +++ b/modules/tntcarrier/tpl/accountForm.tpl @@ -0,0 +1,14 @@ +<!--<div id="ajaxAnswer" style="float:right;text-align:center;width:50%;margin-top:100px"></div>--> +<p>{$lang.followParameters}. {$lang.registered} <a style="color:blue;text-decoration:underline" href="https://www.tnt.fr/public/utilisateurs/adminExt/new.do">{$lang.here}</a></p> + <form action="index.php?tab={$glob.tab}&configure={$glob.configure}&token={$glob.token}&tab_module={$glob.tab_module}&module_name={$glob.module_name}&id_tab=1§ion=account" method="post" class="form" id="configFormAccount"> + <fieldset style="border: 0px;"> + <h4>{$lang.accountTNT} :</h4> + <label>{$lang.login} : </label> + <div class="margin-form"><input type="text" size="20" name="tnt_carrier_login" value="{$varAccount.login}" /></div> + <label>{$lang.password} : </label> + <div class="margin-form"><input type="password" size="20" name="tnt_carrier_password" value="{$varAccount.password}" /></div> + <label>{$lang.numberAccount} : </label> + <div class="margin-form"><input type="text" size="20" name="tnt_carrier_number_account" value="{$varAccount.account}" /></div> + </fieldset> + <div class="margin-form"><input class="button" name="submitSave" type="submit"></div> +</form> \ No newline at end of file diff --git a/modules/tntcarrier/tpl/country.tpl b/modules/tntcarrier/tpl/country.tpl new file mode 100644 index 000000000..3d8a3afd4 --- /dev/null +++ b/modules/tntcarrier/tpl/country.tpl @@ -0,0 +1,17 @@ +<table class="table" cellspacing="0" cellpading="0"> + <tr> + <th>{$lang.place}</th><th>{$lang.additionnalCharge}</th><th></th> + </tr> + <tr> + <td>{$varCountry.country}</td><td>{$varCountry.overcost}</td> + <td> + <a href="index.php?tab={$glob.tab}&configure={$glob.configure}&token={$glob.token}&tab_module={$glob.tab_module}&module_name={$glob.module_name}&id_tab=3§ion=country&action=edit&country={$varCountry.country}"> + <img src="../img/admin/edit.gif" alt="edit" title="{$lang.edit}"/></a> + </td> + </tr> +</table> +</table><br/><div id="divFormCountry"> +{if ($varCountry.action == 'edit' || $varCountry.action == 'new') && $varCountry.section == 'country'} +{$varCountry.form} +{/if} +</div> \ No newline at end of file diff --git a/modules/tntcarrier/tpl/countryForm.tpl b/modules/tntcarrier/tpl/countryForm.tpl new file mode 100644 index 000000000..ab335f76c --- /dev/null +++ b/modules/tntcarrier/tpl/countryForm.tpl @@ -0,0 +1,9 @@ +<form action="index.php?tab={$glob.tab}&configure={$glob.configure}&token={$glob.token}&tab_module={$glob.tab_module}&module_name={$glob.module_name}&id_tab=3§ion=country&action=edit" method="post" class="form" id="configFormCountry"> + <table class="table" cellspacing="0" cellpadding="0"> + <tr> + <td><input type="hidden" name="tnt_carrier_country" size="20" value="{$varCountryForm.country}"/>{$varCountryForm.country}</td> + <td><input type="text" name="tnt_carrier_{$varCountryForm.country}_overcost" size="20" value="{$varCountryForm.overcost}"/></td> + <td><input class="button" name="submitSave" type="submit"></td> + </tr> + </table> +</form> \ No newline at end of file diff --git a/modules/tntcarrier/tpl/follow.tpl b/modules/tntcarrier/tpl/follow.tpl new file mode 100644 index 000000000..9d58cead7 --- /dev/null +++ b/modules/tntcarrier/tpl/follow.tpl @@ -0,0 +1,108 @@ +{* +* 2007-2011 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA <contact@prestashop.com> +* @copyright 2007-2011 PrestaShop SA +* @version Release: $Revision: 8088 $ +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*} + +<br/> +{$erreur} +{if !isset($erreur)} +{foreach from="$follow" item="f"} +<table class="std" style="text-align:left"> + <thead> + <tr> + <th class="first_item" colspan="2">{l s="Package Information"}</th> + <th class="last_item" colspan="2"></th> + </tr> + <tr class="item"> + <td class="bold">{l s="Shipping number"}</td> + <td>{$f.number}</td> + <td class="bold">{l s="Shipping status"}</td> + <td>{$f.status}</td> + </tr> + <tr class="item"> + <td class="bold">{l s="Reference"}</td> + <td>{$f.reference}</td> + <td class="bold">{l s="Service"}</td> + <td>{$f.service}</td> + <tr> + <tr class="item"> + <td class="bold">{l s="Weight"}</td> + <td>{$f.weight}</td> + <td></td> + <td></td> + </tr> + <tr class="item" style="border-top:1px solid black"> + <td class="bold">{l s="Event"}</th> + <td class="bold">{l s="Date"}</th> + <td class="bold">{l s="Hours"}</th> + <td class="bold">{l s="Name Center"}</th> + </tr> + {if $f.request} + <tr class="item"> + <td>{l s="Package on request"}</td> + <td>{$f.requestDate|date_format:$config.date}</td> + <td>{$f.requestDate|date_format:$config.time}</td> + <td></td> + </tr> + {/if} + {if $f.process} + <tr class="item"> + <td>{l s="Package on its way"}</td> + <td>{$f.process_date|date_format:$config.date}</td> + <td>{$f.process_date|date_format:$config.time}</td> + <td>{$f.process_center}</td> + <tr> + {/if} + {if $f.delivery_departure} + <tr class="item"> + <td>{l s="Deposit departure"}</td> + <td>{$f.delivery_departure_date|date_format:$config.date}</td> + <td>{$f.delivery_departure_date|date_format:$config.time}</td> + <td>{$f.delivery_departure_center}</td> + </tr> + {/if} + {if $f.delivery} + <tr class="item"> + <td>{l s="driver presentation"}</td> + <td>{$f.delivery_date|date_format:$config.date}</td> + <td>{$f.delivery_date|date_format:$config.time}</td> + <td></td> + </tr> + {/if} + <tr class="item"> + <td class="bold">deposit status</td> + <td colspan="3"> + {foreach $f.long_status as $line} + {$line}<br/> + {/foreach} + {if $f.linkPicture != ''} + <a href="{$f.linkPicture}" target="_blank">{l s="proof signature"}</a> + {/if} + </td> + </tr> + </thead> +</table> +{/foreach} +{/if} + diff --git a/modules/tntcarrier/tpl/formerror.tpl b/modules/tntcarrier/tpl/formerror.tpl new file mode 100644 index 000000000..4130429a9 --- /dev/null +++ b/modules/tntcarrier/tpl/formerror.tpl @@ -0,0 +1,42 @@ +{* +* 2007-2011 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA <contact@prestashop.com> +* @copyright 2007-2011 PrestaShop SA +* @version Release: $Revision: 8088 $ +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*} +<br/> +<fieldset style="width:400px"> + <legend><img src="../img/admin/delivery.gif" />{l s='Shipping information'}</legend> + {$var.error}<br/> + <form action="{$var.currentIndex}&view{$var.table}&token={$var.token}" method="post" style="margin-top:10px;"> + {if $var.weight} + {l s="The package weight must be between 0.1 and 30.0 kg"}<br/><br/> + {l s="Weight"} : <input type="text" name="weightErrorOrder" /><br/><br/> + {/if} + {if $var.weightHidden}<input type="hidden" value="{$var.weightHidden}" name="weightErrorOrder" />{/if} + {if $var.date} + {l s="You must change the expedition date"}<br/><br/> + {l s="Date"} : <input type="text" value="{$var.date}" name="dateErrorOrder" /><br/><br/> + {/if} + {if $var.dateHidden}<input type="hidden" value="{$var.dateHidden}" name="dateErrorOrder" />{/if} + {if !$var.dateHidden || !$var.weightHidden}<input type="submit" value="{l s='Modify'}" class="button" />{/if} +</fieldset> \ No newline at end of file diff --git a/modules/tntcarrier/tpl/index.php b/modules/tntcarrier/tpl/index.php new file mode 100644 index 000000000..477abec6f --- /dev/null +++ b/modules/tntcarrier/tpl/index.php @@ -0,0 +1,36 @@ +<?php +/* +* 2007-2011 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA <contact@prestashop.com> +* @copyright 2007-2011 PrestaShop SA +* @version Release: $Revision: 6594 $ +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../../../"); +exit; diff --git a/modules/tntcarrier/tpl/main.tpl b/modules/tntcarrier/tpl/main.tpl new file mode 100644 index 000000000..09780f1f1 --- /dev/null +++ b/modules/tntcarrier/tpl/main.tpl @@ -0,0 +1,28 @@ +<ul id="menuTab"> + <li id="menuTab1" class="menuTabButton selected">{$lang.accountSetting}</li> + <li id="menuTab2" class="menuTabButton">{$lang.shippingSetting}</li> + <li id="menuTab3" class="menuTabButton">{$lang.serviceSetting}</li> +</ul> +<div id="tabList"> + <div id="menuTab1Sheet" class="tabItem selected">{$varMain.account}</div> + <div id="menuTab2Sheet" class="tabItem"><div>{$varMain.shipping}</div></div> + <div id="menuTab3Sheet" class="tabItem">{$varMain.service}</br>{$varMain.country}<br/>{$varMain.info}</div> +</div> +<br clear="left" /> +<br /> +<style> + #menuTab { float: left; padding: 0; margin: 0; text-align: left; } + #menuTab li { text-align: left; float: left; display: inline; padding: 5px; padding-right: 10px; background: #EFEFEF; font-weight: bold; cursor: pointer; border-left: 1px solid #EFEFEF; border-right: 1px solid #EFEFEF; border-top: 1px solid #EFEFEF; } + #menuTab li.menuTabButton.selected { background: #FFF6D3; border-left: 1px solid #CCCCCC; border-right: 1px solid #CCCCCC; border-top: 1px solid #CCCCCC; } + #tabList { clear: left; } + .tabItem { display: none; } + .tabItem.selected { display: block; background: #FFFFF0; border: 1px solid #CCCCCC; padding: 10px; padding-top: 20px; } +</style> +<script type="text/javascript"> + $(".menuTabButton").click(function () { + $(".menuTabButton.selected").removeClass("selected"); + $(this).addClass("selected"); + $(".tabItem.selected").removeClass("selected"); + $("#" + this.id + "Sheet").addClass("selected"); + }); +</script> \ No newline at end of file diff --git a/modules/tntcarrier/tpl/relaisColis.tpl b/modules/tntcarrier/tpl/relaisColis.tpl new file mode 100644 index 000000000..5784c83ee --- /dev/null +++ b/modules/tntcarrier/tpl/relaisColis.tpl @@ -0,0 +1,21 @@ +<script type="text/javascript"> + function getAjaxRelais(id) + { + $("#relaisColisCarrier").load( + "./modules/tntcarrier/relaisColis/relaisColis.php?id_carrier="+id, + function(response, status, xhr) + { + if (status == "error") + $("#relaisColisCarrier").html(xhr.status + " " + xhr.statusText); + } + ); + $("#relaisColisCarrier").slideDown('slow'); + } + + $("input[name='id_carrier']").click(function() { + getAjaxRelais($("input[name='id_carrier']:checked").val()); + }); +</script> +<div id="relaisColisCarrier" style="display:none"> +</div> +<input type="hidden" id="cartRelaisColis" value="{$id_cart}" name="cartRelaisColis" /> \ No newline at end of file diff --git a/modules/tntcarrier/tpl/service.tpl b/modules/tntcarrier/tpl/service.tpl new file mode 100644 index 000000000..9179b46b0 --- /dev/null +++ b/modules/tntcarrier/tpl/service.tpl @@ -0,0 +1,47 @@ +<div style="float:right;margin-right: 100px;margin-top: 30px;"> + <table class="table" cellspacing="0" cellpading="0"> + <tr><th colspan="2">{l s='Code'}</th></tr> + <tr><td>N : </td><td>{l s='8:00 Express'}</td></tr> + <tr><td>A : </td><td>{l s='9:00 Express'}</td></tr> + <tr><td>T : </td><td>{l s='10:00 Express'}</td></tr> + <tr><td>M : </td><td>{l s='12:00 Express'}</td></tr> + <tr><td>J : </td><td>{l s='Express'}</td></tr> + <tr><td>P : </td><td>{l s='Express (P)'}</td></tr> + <tr><th colspan="2">{l s='Code Option (Optional)'}</th></tr> + <tr><td>D : </td><td>{l s='relay package'}</td></tr> + <tr><td>Z : </td><td>{l s='Home delivery'}</td></tr> + <tr><td>Ø : </td><td>{l s='Enterprise Service'}</td></tr> + </table> +</div> +<a href="index.php?tab={$glob.tab}&configure={$glob.configure}&token={$glob.token}&tab_module={$glob.tab_module}&module_name={$glob.module_name}&id_tab=3§ion=service&action=new"> +<img src="../img/admin/add.gif" alt="add"/> {$lang.newService}</a></br><br/> +<table class="table" cellspacing="0" cellpading="0"> + <tr> + <th>{$lang.id}</th><th>{$lang.name}</th><th>{$lang.description}</th><th>{$lang.code}</th><th>{$lang.additionnalCharge}</th><th>{$lang.activated}</th><th></th> + </tr> +{foreach from=$varService.serviceList key=k item=v} + <tr '.($irow++ % 2 ? 'class="alt_row"' : '').'> + <td>{$v.optionId}</td> + <td>{$v.name}</td> + <td>{$v.delay}</td> + <td>{$v.option}</td> + <td>{$v.optionOvercost}</td> + <td> + {if $v.deleted != 1} + <img src="../img/admin/enabled.gif" /> + {else} + <img src="../img/admin/disabled.gif" /> + {/if} + </td> + <td> + <a href="index.php?tab={$glob.tab}&configure={$glob.configure}&token={$glob.token}&tab_module={$glob.tab_module}&module_name={$glob.module_name}&id_tab=3§ion=service&action=edit&service={$v.optionId}"> + <img src="../img/admin/edit.gif" alt="edit" title="{$lang.edit}"/></a> + <a href="index.php?tab={$glob.tab}&configure={$glob.configure}&token={$glob.token}&tab_module={$glob.tab_module}&module_name={$glob.module_name}&id_tab=3§ion=service&action=del&service={$v.optionId}"> + <img src="../img/admin/delete.gif" alt="delete" title="{$lang.delete}"/></a></td></tr> +{/foreach} +</table><br/> +<div id="divFormService"> +{if ($varService.action == 'edit' || $varService.action == 'new') && $varService.section == 'service'} +{$varService.form} +{/if} +</div> \ No newline at end of file diff --git a/modules/tntcarrier/tpl/serviceForm.tpl b/modules/tntcarrier/tpl/serviceForm.tpl new file mode 100644 index 000000000..9d827a43f --- /dev/null +++ b/modules/tntcarrier/tpl/serviceForm.tpl @@ -0,0 +1,20 @@ +<form action="index.php?tab={$glob.tab}&configure={$glob.configure}&token={$glob.token}&tab_module={$glob.tab_module}&module_name={$glob.module_name}&id_tab=3§ion=service&action=new" method="post" class="form" id="configFormService"> + {if $varServiceForm.id != null} + <input type="hidden" name="service_id" value="{$varServiceForm.id}"/> + {/if} + <table class="table" cellspacing="0" cellpadding="0"> + <tr> + <th>{$lang.name}</th><th>{$lang.description}</th><th>{$lang.code}</th><th>{$lang.additionnalCharge}</th><th>{$lang.activated}</th><th></th> + </tr> + <tr> + <td><input type="text" name="tnt_carrier_service_name" size="20" value="{$varServiceForm.name}"/></td> + <td><input type="text" name="tnt_carrier_service_description" size="20" value="{$varServiceForm.description}"/></td> + <td><input type="text" name="tnt_carrier_service_code" size="5" value="{$varServiceForm.code}"/></td> + <td><input type="text" name="tnt_carrier_service_charge" size="10" value="{$varServiceForm.charge}"/></td> + <td><input type="radio" name="tnt_carrier_service_display" value="0" {if $varServiceForm.display == '1'} checked="checked" {/if} /> <img src="../img/admin/disabled.gif" /><br/> + <input type="radio" name="tnt_carrier_service_display" value="1" {if $varServiceForm.display == '0'} checked="checked" {/if} /> <img src="../img/admin/enabled.gif" /> + </td> + <td><input class="button" name="submitSave" type="submit"></td> + </tr> + </table> +</form> \ No newline at end of file diff --git a/modules/tntcarrier/tpl/shippingForm.tpl b/modules/tntcarrier/tpl/shippingForm.tpl new file mode 100644 index 000000000..9b5f29755 --- /dev/null +++ b/modules/tntcarrier/tpl/shippingForm.tpl @@ -0,0 +1,70 @@ +<script type="text/javascript" src="../modules/{$varShipping.moduleName}/js/jquery-ui.js"></script> +<script type="text/javascript" src="../modules/{$varShipping.moduleName}/js/relaisColis.js"></script> +<script type="text/javascript" src="../modules/{$varShipping.moduleName}/js/shipping.js"></script> +<link type="text/css" href="../modules/{$varShipping.moduleName}/css/ui.tabs.css" rel="stylesheet"> +<link type="text/css" href="../modules/{$varShipping.moduleName}/css/ui.dialog.css" rel="stylesheet"> +<link type="text/css" href="../modules/{$varShipping.moduleName}/css/tntB2CRelaisColis.css" rel="stylesheet"> +<fieldset style="border: 0px;"> + <div id="googleMapTnt" style="float:right;display:{if $varShipping.collect == '1'}none{/if}"> + <div id="tntB2CRelaisColis" class="exemplePresentation"> + <script type="text/javascript"> tntB2CRelaisColis();</script> + </div> + <div style="text-align: justify; font-family: arial,helvetica,sans-serif; font-size: 10pt;"> + <div style="height: 25px;"> </div> + <div id="exempleIntegration"> + <input style="float:right" type="button" value="{$lang.fillDataInTheForm}" onclick="callbackSelectionRelais();" /> + </div> + </div> + </div> + <form action="index.php?tab={$glob.tab}&configure={$glob.configure}&token={$glob.token}&tab_module={$glob.tab_module}&module_name={$glob.module_name}&id_tab=2§ion=shipping" method="post" class="form" id="configFormShipping"> + <h4>{$lang.shipping} :</h4> + <label>{$lang.collect} : </label> + <div class="margin-form"> + <input type="radio" id="tnt_carrier_collect_no" name="tnt_carrier_shipping_collect" value="0" {if $varShipping.collect == '0'} checked="checked" {/if} /> : {$lang.noDeposit}<br/> + <input type="radio" id="tnt_carrier_collect_yes" onclick="collectButtonClick()" name="tnt_carrier_shipping_collect" value="1" {if $varShipping.collect == '1'} checked="checked" {/if} /> : {$lang.yes} + </div> + <div id="divPex" style="display:{if $varShipping.collect == '1'}none{/if}"> + <a href="#" style="color:blue" onclick="depositButtonClick();return false;">{$lang.chooseYourDepositoryLocation}</a><br/><br/> + <label>{$lang.pexCode} : </label> + <div class="margin-form"><input type="text" size="20" id="tnt_carrier_shipping_pex" name="tnt_carrier_shipping_pex" value="{$varShipping.pex}" /></div> + </div> + <label>{$lang.companyName} : </label> + <div class="margin-form"><input type="text" size="20" id="tnt_carrier_shipping_company" name="tnt_carrier_shipping_company" value="{$varShipping.company}" /></div> + <label>{$lang.lastName} : </label> + <div class="margin-form"><input type="text" size="20" id="tnt_carrier_shipping_last_name" name="tnt_carrier_shipping_last_name" value="{$varShipping.lastName}" /></div> + <label>{$lang.firstName} : </label> + <div class="margin-form"><input type="text" size="20" id="tnt_carrier_shipping_first_name" name="tnt_carrier_shipping_first_name" value="{$varShipping.firstName}" /></div> + <label>{$lang.address1} : </label> + <div class="margin-form"><input type="text" size="20" id="tnt_carrier_shipping_address1" name="tnt_carrier_shipping_address1" value="{$varShipping.address1}" /></div> + <label>{$lang.address2} : </label> + <div class="margin-form"><input type="text" size="20" id="tnt_carrier_shipping_address2" name="tnt_carrier_shipping_address2" value="{$varShipping.address2}" /></div> + <label>{$lang.zip} : </label> + <div class="margin-form"><input type="text" size="20" id="tnt_carrier_shipping_postal_code" name="tnt_carrier_shipping_postal_code" value="{$varShipping.zipCode}" /></div> + <label>{$lang.city} : </label> + <div class="margin-form"><input type="text" size="20" id="tnt_carrier_shipping_city" name="tnt_carrier_shipping_city" value="{$varShipping.city}" /></div><br/> + <label>{$lang.email} : </label> + <div class="margin-form"><input type="text" size="20" name="tnt_carrier_shipping_email" value="{$varShipping.email}" /></div> + <label>{$lang.phone} : </label> + <div class="margin-form"><input type="text" size="20" name="tnt_carrier_shipping_phone" value="{$varShipping.phone}" /></div> + <div id="divClosing" style="display:{if $varShipping.collect == '0'}none{/if}"> + <label>{$lang.closingTime} : </label> + <div class="margin-form"><input type="text" size="20" name="tnt_carrier_shipping_closing" value="{$varShipping.closing}" /> (HH:MM)</div> + <br/> + </div> + <!--<label>{$lang.saturdayDelivery} : </label> + <div class="margin-form"> + <input type="radio" id="tnt_carrier_delivery_yes" name="tnt_carrier_shipping_delivery" value="1" '.(Configuration::get('TNT_CARRIER_SHIPPING_DELIVERY') == 1 ? 'checked="checked"' : ''} /> : {$lang.yes}<br/> + <input type="radio" id="tnt_carrier_delivery_no" name="tnt_carrier_shipping_delivery" value="0" '.(Configuration::get('TNT_CARRIER_SHIPPING_DELIVERY') == 0 ? 'checked="checked"' : ''} /> : {$lang.no} + </div>--> + <br/><br/> + <label>{$lang.labelFormatPrinting} : </label><br/><br/> + <select name="tnt_carrier_print_sticker" value="{$varShipping.sticker}" > + <option value="STDA4">{$lang.a4printing}</option> + <option value="THERMAL">THERMAL</option> + <option value="THERMAL,NO_LOGO">THERMAL {$lang.withoutPrintingLogoTNT}</option> + <option value="THERMAL,ROTATE_180">THERMAL {$lang.withReversePrint}</option> + <option value="THERMAL,NO_LOGO,ROTATE_180">THERMAL {$lang.withoutPrintingLogoTNTWithReversePrint}</option> + </select><br/><br/> + <div class="margin-form"><input class="button" name="submitSave" type="submit"></div> + </form> +</fieldset> \ No newline at end of file diff --git a/modules/tntcarrier/tpl/shippingNumber.tpl b/modules/tntcarrier/tpl/shippingNumber.tpl new file mode 100644 index 000000000..01ed53d5e --- /dev/null +++ b/modules/tntcarrier/tpl/shippingNumber.tpl @@ -0,0 +1,43 @@ +{* +* 2007-2011 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA <contact@prestashop.com> +* @copyright 2007-2011 PrestaShop SA +* @version Release: $Revision: 8088 $ +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*} +<br/> +<fieldset style="width:400px"> + <legend><img src="../img/admin/delivery.gif" />{l s='Shipping information'}</legend> + Chaque colis doit au plus faire 20 Kg.<br/> + {$var.error} + {if $var.shipping_numbers && $var.sticker} + {$var.lang_shippingNumber} : + <div style="text-align:right"> + {foreach from=$var.shipping_numbers item=v} + {if $v.shipping_number} + {$v.shipping_number}<br/> + {/if} + {/foreach} + </div> + {$var.lang_sticker} : <a style="color:blue" href="{$var.sticker}">{l s="PDF File"}</a><br/> + {$var.lang_expedition} : {$var.date}<br/>{$var.place} + {/if} +</fieldset> \ No newline at end of file diff --git a/modules/tntcarrier/tpl/waitingFollow.tpl b/modules/tntcarrier/tpl/waitingFollow.tpl new file mode 100644 index 000000000..72a30a357 --- /dev/null +++ b/modules/tntcarrier/tpl/waitingFollow.tpl @@ -0,0 +1,27 @@ +<script type="text/javascript"> + $(document).ready(function() { + var children = $('#followPackage').children(); + $('#waitingDiv').html("Chargement du suivi colis <img src='./img/loadingAnimation.gif' alt='wait'/>"); + for (var i = 0; i < children.length; i++) + { + $("#"+children[i].id).load( + "./modules/tntcarrier/follow.php?code="+children[i].id.substr(14), + function(response, status, xhr) + { + if (status == "error") + $("#followPackage").html(xhr.status + " " + xhr.statusText); + if (i == children.length) + $('#waitingDiv').html(""); + } + ); + } + /**/ + }); +</script> +<div id="followPackage" style="clear:both"> + {foreach from=$numbers item=v} + <div id="followPackage_{$v.shipping_number}"> + </div> + {/foreach} +</div> +<div id="waitingDiv"></div> \ No newline at end of file diff --git a/modules/trustedshops/config.xml b/modules/trustedshops/config.xml index 85f2b73ce..359cc6685 100755 --- a/modules/trustedshops/config.xml +++ b/modules/trustedshops/config.xml @@ -2,7 +2,7 @@ <module> <name>trustedshops</name> <displayName><![CDATA[Trusted Shops trust solutions]]></displayName> - <version><![CDATA[1.3.1]]></version> + <version><![CDATA[1.3.3]]></version> <description><![CDATA[Build confidence in your online shop with the Trusted Shops quality seal, buyer protection and customer rating.]]></description> <author><![CDATA[]]></author> <tab><![CDATA[payment_security]]></tab> diff --git a/modules/trustedshops/de.php b/modules/trustedshops/de.php index d7001bd76..79269741c 100644 --- a/modules/trustedshops/de.php +++ b/modules/trustedshops/de.php @@ -100,8 +100,8 @@ $_MODULE['<{trustedshops}prestashop>tsbuyerprotection_8dd66ca6788218bd7d2ba7fe43 $_MODULE['<{trustedshops}prestashop>tsbuyerprotection_5580bc4adbb864a67180bf2f058393f3'] = 'Geben Sie Ihre Online-Kunden ein starker Grund, mit dem Trusted Shops Käuferschutz kaufen. Diese zusätzliche Sicherheit führt zu weniger Warenkorb Verzicht'; $_MODULE['<{trustedshops}prestashop>tsbuyerprotection_710142158c105c01ef807ce959cbc451'] = 'Profitable und langfristige Kundenbeziehung'; $_MODULE['<{trustedshops}prestashop>tsbuyerprotection_f7e15d97ad927ef705de61e787883ada'] = 'Für viele Online-Shopper ist das Trusted Shops Gütesiegel mit Käuferschutz ein wirksames Zeichen der Qualität für sicheres Einkaufen im Internet. One-Time-Käufer werden zu Stammkunden.'; -$_MODULE['<{trustedshops}prestashop>tsbuyerprotection_7442a1e0ab5e2e26ca9363d226b93d13'] = 'Umwelt-Typ'; -$_MODULE['<{trustedshops}prestashop>tsbuyerprotection_8e77e16312de3f95afdf5b92b10232a2'] = 'Sie sind zur Zeit von der Betriebsart:'; +$_MODULE['<{trustedshops}prestashop>tsbuyerprotection_7442a1e0ab5e2e26ca9363d226b93d13'] = 'Trusted Shops Modus'; +$_MODULE['<{trustedshops}prestashop>tsbuyerprotection_8e77e16312de3f95afdf5b92b10232a2'] = 'Sie verwenden die Umgebung:'; $_MODULE['<{trustedshops}prestashop>tsbuyerprotection_dc62561dd8d390e274487516e869fc93'] = 'Holen Sie den Registrierungs-Link'; $_MODULE['<{trustedshops}prestashop>tsbuyerprotection_6e637d8b8b8a933612b19c881d33672d'] = 'Diese Variable wurde Ihnen per E-Mail von TrustedShops geschickt'; $_MODULE['<{trustedshops}prestashop>tsbuyerprotection_233a96df2f68dbeafaa3126edadc1ce8'] = 'Interne Identifikation von Shop-Software auf Trusted Shops'; @@ -109,10 +109,10 @@ $_MODULE['<{trustedshops}prestashop>tsbuyerprotection_261720a5c993fb1cfad560d874 $_MODULE['<{trustedshops}prestashop>tsbuyerprotection_02977dc4b8561c8d7312b1931782c36b'] = 'Etracker-Kampagne'; $_MODULE['<{trustedshops}prestashop>tsbuyerprotection_4994a8ffeba4ac3140beb89e8d41f174'] = 'Sprache'; $_MODULE['<{trustedshops}prestashop>tsbuyerprotection_2541d938b0a58946090d7abdde0d3890'] = 'senden'; -$_MODULE['<{trustedshops}prestashop>tsbuyerprotection_72ca0dcf49befb037f8d4734ee0a2a1c'] = 'Add Trusted Shops Zertifikat'; +$_MODULE['<{trustedshops}prestashop>tsbuyerprotection_72ca0dcf49befb037f8d4734ee0a2a1c'] = 'Trusted Shops Zertifikat hinzufügen'; $_MODULE['<{trustedshops}prestashop>tsbuyerprotection_48e31908bfdcda34b0f01cad9d7077af'] = 'Neues Zertifikat'; -$_MODULE['<{trustedshops}prestashop>tsbuyerprotection_75904cf055527a97739601e0f5ff7e51'] = 'Fügen Sie es'; -$_MODULE['<{trustedshops}prestashop>tsbuyerprotection_566853604b7330b3adbb9105cb15e96b'] = 'Verwalten Trusted Shops Zertifikate'; +$_MODULE['<{trustedshops}prestashop>tsbuyerprotection_75904cf055527a97739601e0f5ff7e51'] = 'Hinzufügen'; +$_MODULE['<{trustedshops}prestashop>tsbuyerprotection_566853604b7330b3adbb9105cb15e96b'] = 'Verwaltung Trusted Shops Zertifikate'; $_MODULE['<{trustedshops}prestashop>tsbuyerprotection_eb0f48a107df1a0f343d4cd513b555e6'] = 'Zertifikat'; $_MODULE['<{trustedshops}prestashop>tsbuyerprotection_46a2a41cc6e552044816a2d04634545d'] = 'Zustand'; $_MODULE['<{trustedshops}prestashop>tsbuyerprotection_a1fa27779242b4902f7ae3bdd5c6d508'] = 'Typ'; diff --git a/modules/trustedshops/lib/TSBuyerProtection.php b/modules/trustedshops/lib/TSBuyerProtection.php index 3f08198fe..be6c3005f 100644 --- a/modules/trustedshops/lib/TSBuyerProtection.php +++ b/modules/trustedshops/lib/TSBuyerProtection.php @@ -109,7 +109,7 @@ class TSBuyerProtection extends AbsTrustedShops * ) * @var array */ - private static $CERTIFICATE; + public static $CERTIFICATE; private static $DEFAULT_LANG; private static $CAT_ID; private static $ENV_API; @@ -649,8 +649,8 @@ class TSBuyerProtection extends AbsTrustedShops $sql = ' DELETE ts, p, pl FROM `'._DB_PREFIX_.TSBuyerProtection::DB_ITEMS.'` AS ts - LEFT JOIN `ps_product` AS p ON ts.`id_product` = p.`id_product` - LEFT JOIN `ps_product_lang` AS pl ON ts.`id_product` = pl.`id_product` + LEFT JOIN `'._DB_PREFIX_.'product` AS p ON ts.`id_product` = p.`id_product` + LEFT JOIN `'._DB_PREFIX_.'product_lang` AS pl ON ts.`id_product` = pl.`id_product` WHERE ts.`ts_id`="'.$ts_id.'"'; Db::getInstance()->execute($sql); @@ -1062,7 +1062,7 @@ class TSBuyerProtection extends AbsTrustedShops $out .= ' </td> <td>'; - if ($certificate['typeEnum'] === 'EXCELLENCE') { + if ($certificate['typeEnum'] === 'EXCELLENCE' || $certificate['typeEnum'] === 'CLASSIC') { $out .= '<input type="checkbox" name="certificate_delete[]" value="'.$lang.'" />'; } else { $out .= $this->l('No need'); diff --git a/modules/trustedshops/lib/TrustedShopsRating.php b/modules/trustedshops/lib/TrustedShopsRating.php index 1717eac64..90863a8e0 100644 --- a/modules/trustedshops/lib/TrustedShopsRating.php +++ b/modules/trustedshops/lib/TrustedShopsRating.php @@ -450,6 +450,8 @@ class TrustedShopsRating extends AbsTrustedShops $certificate = (array)$certificate; if (isset($certificate['tsID']) && $certificate['tsID'] !== '' && $certificate['user'] != '') $displayWidget = true; + if (isset($certificate['tsID']) && $certificate['tsID'] !== '' && $certificate['typeEnum'] === 'CLASSIC') + $displayWidget = true; } if ($displayWidget == false) return ''; diff --git a/modules/trustedshops/trustedshops.php b/modules/trustedshops/trustedshops.php index 6124ee14c..0a6957ea6 100644 --- a/modules/trustedshops/trustedshops.php +++ b/modules/trustedshops/trustedshops.php @@ -48,7 +48,7 @@ class TrustedShops extends Module { $this->name = 'trustedshops'; $this->tab = 'payment_security'; - $this->version = '1.3.1'; + $this->version = '1.3.3'; parent::__construct(); diff --git a/modules/twenga/twenga.php b/modules/twenga/twenga.php index 78a7ad276..aa974b580 100644 --- a/modules/twenga/twenga.php +++ b/modules/twenga/twenga.php @@ -720,11 +720,11 @@ class Twenga extends PaymentModule </div><!-- .margin-form --> <label>'.$this->l('Login').' <sup>*</sup> : </label> <div class="margin-form"> - <input type="text" size="38" maxlength="32" name="twenga_user_name" value="'.self::$obj_twenga->getUserName().'"/>  + <input type="text" size="38" maxlength="64" name="twenga_user_name" value="'.self::$obj_twenga->getUserName().'"/>  </div><!-- .margin-form --> <label>'.$this->l('Password').' <sup>*</sup> : </label> <div class="margin-form"> - <input type="password" size="38" maxlength="32" name="twenga_password" value="'.self::$obj_twenga->getPassword().'"/>  + <input type="password" size="38" maxlength="64" name="twenga_password" value="'.self::$obj_twenga->getPassword().'"/>  </div><!-- .margin-form --> <div class="margin-form">' .$this->l('If you forgot your login, retrieve it back here').' <a href="'.$lost_link.'" target="_blank">'.$lost_link.'</a></div>' .'<input type="submit" value="'.$this->l('Save').'" name="submitTwengaLogin" class="button"/> diff --git a/themes/prestashop/js/order-opc.js b/themes/prestashop/js/order-opc.js index 3039b694a..060cdd23d 100755 --- a/themes/prestashop/js/order-opc.js +++ b/themes/prestashop/js/order-opc.js @@ -80,7 +80,7 @@ function updateCarrierList(json) '<tr class="'+itemType+'">'+ '<td class="carrier_action radio"><input type="radio" name="id_carrier" value="'+carriers[i].id_carrier+'" id="id_carrier'+carriers[i].id_carrier+'" onclick="updateCarrierSelectionAndGift();" '+extraHtml+' /></td>'+ '<td class="carrier_name"><label for="id_carrier'+carriers[i].id_carrier+'">'+name+'</label></td>'+ - '<td class="carrier_infos">'+carriers[i].delay+'</td>'+ + '<td class="carrier_infos">'+(carriers[i].delay != null ? carriers[i].delay : '')+'</td>'+ '<td class="carrier_price">'+price; if (carriers[i].price != 0) { diff --git a/themes/prestashop/js/product.js b/themes/prestashop/js/product.js index 1a4afba45..9fde23617 100644 --- a/themes/prestashop/js/product.js +++ b/themes/prestashop/js/product.js @@ -347,8 +347,9 @@ function updateDisplay() var reduction = 0; if (selectedCombination['specific_price'].reduction_price || selectedCombination['specific_price'].reduction_percent) { - reduction = productPrice * (parseFloat(selectedCombination['specific_price'].reduction_percent) / 100) + selectedCombination['specific_price'].reduction_price; - if (selectedCombination['specific_price'].reduction_price && (displayPrice || noTaxForThisProduct)) + reduction_price = (specific_currency ? reduction_price : reduction_price * currencyRate); + reduction = productPrice * (parseFloat(reduction_percent) / 100) + reduction_price; + if (reduction_price && (displayPrice || noTaxForThisProduct)) reduction = ps_round(reduction / tax, 6); } else if (product_specific_price.reduction_price || product_specific_price.reduction_percent) diff --git a/themes/prestashop/lang/en.php b/themes/prestashop/lang/en.php index f67424616..caceb73ac 100644 --- a/themes/prestashop/lang/en.php +++ b/themes/prestashop/lang/en.php @@ -351,7 +351,7 @@ $_LANG['order-detail_4ce81305b7edb043d0a7a5c75cab17d0'] = 'There is'; $_LANG['order-detail_07213a0161f52846ab198be103b5ab43'] = 'errors'; $_LANG['order-detail_cb5e100e5a9a3e7f6d1fd97512215282'] = 'error'; $_LANG['order-detail_37c06f5486d3068a0a9604552c7e081f'] = 'Add a message:'; -$_LANG['order-detail_617096c86d35478132502be00e12e016'] = 'f you would like to add a comment about your order, please write it below.'; +$_LANG['order-detail_617096c86d35478132502be00e12e016'] = 'If you would like to add a comment about your order, please write it below.'; $_LANG['order-detail_94966d90747b97d1f0f206c98a8b1ac3'] = 'Send'; $_LANG['order-detail_a9979df9e349275e2d86f7af03e24d14'] = 'You cannot make a merchandise return with a guest account'; $_LANG['order-follow_d95cf4ab2cbf1dfb63f066b50558b07d'] = 'My account'; diff --git a/themes/prestashop/order-address.tpl b/themes/prestashop/order-address.tpl index a6ecb0793..bc38a041f 100644 --- a/themes/prestashop/order-address.tpl +++ b/themes/prestashop/order-address.tpl @@ -24,6 +24,12 @@ * International Registered Trademark & Property of PrestaShop SA *} +{if $opc} + {assign var="back_order_page" value="order-opc.php"} +{else} + {assign var="back_order_page" value="order.php"} +{/if} + {* ** Retro compatibility for PrestaShop version < 1.4.2.5 with a recent theme ** Syntax smarty for v2 @@ -40,8 +46,8 @@ {$ignoreList.6 = "date_add"} {$ignoreList.7 = "date_upd"} {$ignoreList.8 = "active"} - {$ignoreList.9 = "deleted"} - + {$ignoreList.9 = "deleted"} + {* PrestaShop 1.4.0.17 compatibility *} {if isset($addresses)} {foreach from=$addresses key=k item=address} @@ -106,11 +112,11 @@ ordered_fields_name = ordered_fields_name.concat(formatedAddressFieldsValuesList[id_address]['ordered_fields']); ordered_fields_name = ordered_fields_name.concat(['update']); - + dest_comp.html(''); li_content['title'] = adr_titles_vals[address_type]; - li_content['update'] = '<a href="{$link->getPageLink('address', true, NULL, "id_address")}'+id_address+'&back=order?step=1{if $back}&mod={$back}{/if}" title="{l s='Update'}">{l s='Update'}</a>'; + li_content['update'] = '<a href="{$link->getPageLink('address', true, NULL, "id_address")}'+id_address+'&back={$back_order_page}?step=1{if $back}&mod={$back}{/if}" title="{l s='Update'}">{l s='Update'}</a>'; appendAddressList(dest_comp, li_content, ordered_fields_name); {rdelim} @@ -163,7 +169,7 @@ {l s='Multi-shipping'} </a> </div> -<form action="{$link->getPageLink('order', true)}" method="post"> +<form action="{$link->getPageLink($back_order_page, true)}" method="post"> {else} <div id="opc_account" class="opc-main-block"> <div id="opc_account-overlay" class="opc-overlay" style="display: none;"></div> @@ -176,16 +182,16 @@ {foreach from=$addresses key=k item=address} <option value="{$address.id_address|intval}" {if $address.id_address == $cart->id_address_delivery}selected="selected"{/if}>{$address.alias|escape:'htmlall':'UTF-8'}</option> {/foreach} - + </select> </p> <p class="checkbox" {if $cart->isVirtualCart()}style="display:none;"{/if}> <input type="checkbox" name="same" id="addressesAreEquals" value="1" onclick="updateAddressesDisplay();{if $opc}updateAddressSelection();{/if}" {if $cart->id_address_invoice == $cart->id_address_delivery || $addresses|@count == 1}checked="checked"{/if} /> <label for="addressesAreEquals">{l s='Use the same address for billing.'}</label> </p> - + <p id="address_invoice_form" class="select" {if $cart->id_address_invoice == $cart->id_address_delivery}style="display: none;"{/if}> - + {if $addresses|@count > 1} <label for="id_address_invoice" class="strong">{l s='Choose a billing address:'}</label> <select name="id_address_invoice" id="id_address_invoice" class="address_select" onchange="updateAddressesDisplay();{if $opc}updateAddressSelection();{/if}"> @@ -194,11 +200,7 @@ {/section} </select> {else} - {if $back} - <a style="margin-left: 221px;" href="{$link->getPageLink('address', true, NULL, "back=order&step=1&select_address=1&mod=$back")}" title="{l s='Add'}" class="button_large">{l s='Add a new address'}</a> - {else} - <a style="margin-left: 221px;" href="{$link->getPageLink('address', true, NULL, "back=order&step=1&select_address=1")}" title="{l s='Add'}" class="button_large">{l s='Add a new address'}</a> - {/if} + <a style="margin-left: 221px;" href="{$link->getPageLink('address', true, NULL, "back={$back_order_page}?step=1&select_address=1{if $back}&mod={$back}{/if}")}" title="{l s='Add'}" class="button_large">{l s='Add a new address'}</a> {/if} </p> <div class="clear"></div> @@ -208,11 +210,7 @@ </ul> <br class="clear" /> <p class="address_add submit"> - {if $back} - <a href="{$link->getPageLink('address', true, NULL, "back=order&step=1&mod={$back}")}" title="{l s='Add'}" class="button_large">{l s='Add a new address'}</a> - {else} - <a href="{$link->getPageLink('address', true, NULL, "back=order&step=1")}" title="{l s='Add'}" class="button_large">{l s='Add a new address'}</a> - {/if} + <a href="{$link->getPageLink('address', true, NULL, "back={$back_order_page}?step=1{if $back}&mod={$back}{/if}")}" title="{l s='Add'}" class="button_large">{l s='Add a new address'}</a> </p> {if !$opc} <div id="ordermsg"> @@ -225,11 +223,7 @@ <p class="cart_navigation submit"> <input type="hidden" class="hidden" name="step" value="2" /> <input type="hidden" name="back" value="{$back}" /> - {if $back} - <a href="{$link->getPageLink('order', true, NULL, "step=0&back={$back}")}" title="{l s='Previous'}" class="button">« {l s='Previous'}</a> - {else} - <a href="{$link->getPageLink('order', true, NULL, "step=0")}" title="{l s='Previous'}" class="button">« {l s='Previous'}</a> - {/if} + <a href="{$link->getPageLink($back_order_page, true, NULL, "step=0{if $back}&back={$back}{/if}")}" title="{l s='Previous'}" class="button">« {l s='Previous'}</a> <input type="submit" name="processAddress" value="{l s='Next'} »" class="exclusive" /> </p> </form> diff --git a/themes/prestashop/product-compare.tpl b/themes/prestashop/product-compare.tpl index ac6c598c3..bc1e9fb48 100644 --- a/themes/prestashop/product-compare.tpl +++ b/themes/prestashop/product-compare.tpl @@ -31,7 +31,8 @@ var max_item = "{l s='You cannot add more than' js=1} {$comparator_max_item} {l s='product(s) in the product comparator' js=1}"; //]]> </script> - <form method="post" action="{$link->getPageLink('products-comparison', true)}" onsubmit="true"> + + <form method="get" action="{$link->getPageLink('products-comparison')}" onsubmit="true"> <p> <input type="submit" class="button" value="{l s='Compare'}" style="float:right" /> <input type="hidden" name="compare_product_list" class="compare_product_list" value="" /> diff --git a/themes/prestashop/products-comparison.tpl b/themes/prestashop/products-comparison.tpl index 8dfa8ad26..eed17bfe8 100644 --- a/themes/prestashop/products-comparison.tpl +++ b/themes/prestashop/products-comparison.tpl @@ -81,7 +81,7 @@ </span> {/if} </p> - <a class="cmp_remove" href="{$link->getPageLink('products-comparison.php', true)}" rel="ajax_id_product_{$product->id}">{l s='Remove'}</a> + <a class="cmp_remove" href="{$link->getPageLink('products-comparison.php')}" rel="ajax_id_product_{$product->id}">{l s='Remove'}</a> <a class="button" href="{$product->getLink()}" title="{l s='View'}">{l s='View'}</a> {if (!$product->hasAttributes() OR (isset($add_prod_display) AND ($add_prod_display == 1))) AND $product->minimal_quantity == 1 AND $product->customizable != 2 AND !$PS_CATALOG_MODE} {if ($product->quantity > 0 OR $product->allow_oosp)} diff --git a/tools/swift/Swift/Plugin/MailSend.php b/tools/swift/Swift/Plugin/MailSend.php index a2ab5bfe3..7f89b56ec 100644 --- a/tools/swift/Swift/Plugin/MailSend.php +++ b/tools/swift/Swift/Plugin/MailSend.php @@ -7,7 +7,7 @@ * @package Swift_Connection * @license GNU Lesser General Public License */ - +ini_set('display_errors','1'); require_once dirname(__FILE__) . "/../ClassLoader.php"; Swift_ClassLoader::load("Swift_Events_SendListener"); Swift_ClassLoader::load("Swift_Events_BeforeSendListener"); diff --git a/translations/fr/admin.php b/translations/fr/admin.php index 89fc53aaf..90b82be4b 100644 --- a/translations/fr/admin.php +++ b/translations/fr/admin.php @@ -1088,7 +1088,7 @@ $_LANGADM['AdminImages0fb0d96026cc27f8a45d6cb909289903'] = 'Vous pouvez décider $_LANGADM['AdminImages6e9b08be274aa15f116c641e4c9b8599'] = 'Vous pouvez aussi décider de déplacer vos images vers le nouveau système de stockage : dans ce cas, cliquez sur le bouton \"Déplacer les images\" ci-dessous. Merci d\'être patient, le processus peut prendre quelques minutes.'; $_LANGADM['AdminImages1bd266b7c30df50f9b77b0e0f55f2878'] = 'Après avoir déplacé toutes vos images produit, pour des performances optimales allez aux '; $_LANGADM['AdminImagese686877843ac3c9f4c45aaea265fe59c'] = 'préférences produit'; -$_LANGADM['AdminImagesfb3164a4f7305b347948b8aca17c1735'] = ' et changez \"Utiliser l\'ancien système de stockage d\'images\" à NON.'; +$_LANGADM['AdminImagese4a03c93076770dfebb5b5ec919ccfa3'] = 'et changez \"Utiliser l\'ancien système d\'image\" à NON.'; $_LANGADM['AdminImagesff17d73fa2731689640e8afa0f591b0f'] = 'Les images JPEG ont une taille de fichier petite et une qualité standard. Les images PNG ont une taille de fichier plus importante, une meilleure qualité, et gèrent la transparence. Notez que dans tous les cas les fichiers image auront l\'extension .jpg.'; $_LANGADM['AdminImagesff167676b1516b34e7f9be0fea5349d6'] = 'ATTENTION : Cette fonctionnalité peut ne pas être compatible avec votre thème ou avec certains modules. En particulier, le mode PNG n\'est pas compatible avec le module Filigrane. En cas de problème, désactivez cette fonctionnalité en sélectionnant \"Utiliser le JPEG\".'; $_LANGADM['AdminImages42ceb344b0aaf896b362b0db70b46f98'] = 'Qualité d\'image'; @@ -1125,8 +1125,6 @@ $_LANGADM['AdminImport7a1920d61156abc05a60135aefe8bc67'] = 'Défaut'; $_LANGADM['AdminImport9b93b45649ec5961b8cc84e905964683'] = 'Position de l\'image'; $_LANGADM['AdminImport9c163d2934fbdd2775356db804d451fc'] = 'Position de l\'image produit à utiliser pour cette déclinaison. Si vous remplissez ce champ, laissez le champ \"URL de l\'image\" vide.'; $_LANGADM['AdminImport427b6d816d7fdd86cabe48d8180a3cc9'] = 'URL de l\'image'; -$_LANGADM['AdminImport14913d7e9d486e77b5c8d085e3797f94'] = 'Supprimer les images existantes (0 = non, 1 = oui)'; -$_LANGADM['AdminImporte6691747add3b37b9c381b8d9476fd4c'] = 'Si vous ne spécifiez pas cette colonne et vous spécifier la colonne images, toutes les images du produit seront remplacé par celle spécifié dans le fichier d\'import'; $_LANGADM['AdminImportb718adec73e04ce3ec720dd11a06a308'] = 'Identifiant'; $_LANGADM['AdminImportfd0dcc6233b026d257763713c133cf72'] = 'Actif (0/1)'; $_LANGADM['AdminImport2688a544cd5ac33f27ab78c8d8c3acaa'] = 'Nom *'; @@ -1159,6 +1157,8 @@ $_LANGADM['AdminImporte1a5e653bc356ed6745d6814d50213eb'] = 'Afficher le prix'; $_LANGADM['AdminImport4d2589e1bcd4263cb99927b59f0f88d2'] = 'URLs des images (x,y,z...)'; $_LANGADM['AdminImportecde3e896afb64e9a48781b8363b9a03'] = 'Caractéristique(Nom:Valeur:Position)'; $_LANGADM['AdminImport93b145201f52e9210402f4281ff8c188'] = 'Position de la caractéristique'; +$_LANGADM['AdminImport14913d7e9d486e77b5c8d085e3797f94'] = 'Supprimer les images existantes (0 = non, 1 = oui)'; +$_LANGADM['AdminImporte6691747add3b37b9c381b8d9476fd4c'] = 'Si vous ne spécifiez pas cette colonne et vous spécifier la colonne images, toutes les images du produit seront remplacé par celle spécifié dans le fichier d\'import'; $_LANGADM['AdminImport21021ea0e52be8e9c599f4dff41e5be0'] = 'Caractéristique'; $_LANGADM['AdminImport71d0ceacdf562024f2d4c3a76d3b63e4'] = 'Uniquement disponible en ligne'; $_LANGADM['AdminImport9e2941b3c81256fac10392aaca4ccfde'] = 'Etat'; @@ -1517,6 +1517,7 @@ $_LANGADM['AdminModules7d4eb04d5b71acb455329b4d6e228388'] = 'Fonctionnalités Fr $_LANGADM['AdminModulescef02fed5f63407268c2c0202d1d3708'] = 'International & Localisation'; $_LANGADM['AdminModules335676135e0f03d2756262a437c95a0e'] = 'Merchandizing'; $_LANGADM['AdminModules5b985caa89b2ca61bbeee91a896c610d'] = 'Outils de Migration'; +$_LANGADM['AdminModules87d17f4624a514e81dc7c8e016a7405c'] = 'Mobile'; $_LANGADM['AdminModulese77ecbf1af4f4c210146d351f8dfbc3b'] = 'Paiement'; $_LANGADM['AdminModules2bcde8baf68a8b2a88a4a072437639e8'] = 'Sécurité des Paiements'; $_LANGADM['AdminModules87a3a6caeffcd74b07ad451f7695dda7'] = 'Prix & Promotions'; @@ -1966,9 +1967,21 @@ $_LANGADM['AdminPreferences4e7ff7ca556a7ac8329ab27834e9631b'] = 'Affiche les not $_LANGADM['AdminPreferences051fd283c29527d33402475333dfb1da'] = 'Afficher les notifications lorsque de nouveaux clients vous enverront de nouveaux messages sur votre boutique'; $_LANGADM['AdminPreferencesbcb9adf1d2347258b5c65483e34cf86f'] = 'Type de processus d\'enregistrement.'; $_LANGADM['AdminPreferencese371e5f8e710b133c839eee7d3765518'] = 'Le processus d\'enregistrement d\'un client en 2 étapes permet au client de s\'enregistrer plus rapidement, et de créer son adresse plus tard.'; +$_LANGADM['AdminPreferences1301a51cbee38f0c34369720070e5e1b'] = 'Limite de téléchargement de fichier'; +$_LANGADM['AdminPreferences656ff9c98ad48192724f8a74f5e18733'] = 'Définit la limite de téléchargement pour un produit. Cette valeur doit être inférieure ou égale à celle de votre serveur '; +$_LANGADM['AdminPreferences5870c50004d9568f8de39d09363533a7'] = 'Limite de téléchargement d\'images'; +$_LANGADM['AdminPreferences8cde7b1fa570f328143c41677032b507'] = 'Définit la limite de téléchargement pour une image. Cette valeur doit être inférieure ou égale à celle de votre serveur '; $_LANGADM['AdminPreferencesd5bc5fd307b108537039b6b6f98889d5'] = 'Fuseau horaire :'; $_LANGADM['AdminPreferencesbbd6622dbbdf4bcb166f5e3f018a2351'] = 'Cliquez ici pour utiliser le protocole HTTPS avant d\'activer le mode SSL.'; $_LANGADM['AdminPreferences0db377921f4ce762c62526131097968f'] = 'Général'; +$_LANGADM['AdminPreferences4e871525b7518538075dddfad5e292dc'] = 'Cette fonctionnalité a été désactivée.'; +$_LANGADM['AdminPreferences93cba07454f06a4a960172bbd6e2a435'] = 'Oui'; +$_LANGADM['AdminPreferencesbafd7322c6e97d25b6299b5d6fe8920b'] = 'Non'; +$_LANGADM['AdminPreferencesc6e98a4b0af7d0f66842f744d999e436'] = 'Afin d\'utiliser un nouveau thème, merci de suivre les étapes suivantes:'; +$_LANGADM['AdminPreferences432eb00cc8aace97c632fea212575b51'] = 'Importer votre thème en utilisant ce module:'; +$_LANGADM['AdminPreferences2b5bde814a5f94ea73f447cdbcfb49fd'] = 'Importeur de thème'; +$_LANGADM['AdminPreferences64915993f11c4fbd47d8a6465f44125c'] = 'Quand votre thème est importé, merci de sélectionner celui-ci sur cette page'; +$_LANGADM['AdminPreferences21034ae6d01a83e702839a72ba8a77b0'] = 'HT'; $_LANGADM['AdminPreferencesc770d8e0d1d1943ce239c64dbd6acc20'] = 'Ajouter mon adresse IP'; $_LANGADM['AdminProductsb718adec73e04ce3ec720dd11a06a308'] = 'ID'; $_LANGADM['AdminProductsc03d53b70feba4ea842510abecd6c45e'] = 'Photo'; @@ -2152,7 +2165,7 @@ $_LANGADM['AdminProducts8c1279db4db86553e4b9682f78cf500e'] = 'Date d\'expiration $_LANGADM['AdminProducts2b05e1a0e6c62dbf0018af09ed38f4e0'] = 'Format: YYYY-MM-DD'; $_LANGADM['AdminProducts65be3ad50ca00caff377d6a988c3823c'] = 'Laissez vide si vous ne souhaitez pas de date d\'expiration'; $_LANGADM['AdminProducts58fd2b2308056ad80255a322b305742b'] = 'Nombre de jours'; -$_LANGADM['AdminProducts44118d6d6ecd2f24f53ec6393a66baa1'] = 'Nombre de jours durant lesquels le fichier sera accessible par les clients'; +$_LANGADM['AdminProducts44118d6d6ecd2f24f53ec6393a66baa1'] = 'Nombre de jours durant lesquels le fichier sera accessible par les clients après leur commande'; $_LANGADM['AdminProducts282c59515d1ea09d37d4d9980bba3e58'] = 'Mettez à 0 pour un accès illimité au téléchargement'; $_LANGADM['AdminProductsb51a231babbab8586d70830dd7c96653'] = 'Partageable'; $_LANGADM['AdminProductsde6f9a99a112b7ae46777d439ada446c'] = 'Spécifiez si le fichier peut être partagé'; @@ -3037,7 +3050,7 @@ $_LANGADM['AdminUpgradef70307d8297e48a8783d41e6f3313d51'] = 'Erreur lors de l\'e $_LANGADM['AdminUpgrade4eecd9c195e46c054ef7da6d9d1a738b'] = 'Extraction terminée. Suppression des fichiers exemples...'; $_LANGADM['AdminUpgrade0929f38eaac3ca38801f08b7269574e0'] = 'Impossible d\'extraire %1$s dans %2$s ...'; $_LANGADM['AdminUpgrade6b2d0404b7faba0e791e15a52586a149'] = 'Basculer vers svn checkout (useSvn activé)'; -$_LANGADM['AdminUpgradef0e38ac0c558a7f216ae98382b9e58f5'] = 'Site désactivé. Téléchargement en cours (peut prendre '; +$_LANGADM['AdminUpgrade13b35313a987313838f0105902bb6742'] = 'Boutique désactivé. Téléchargement en cours... (ce qui peut prendre un certain temps) ...'; $_LANGADM['AdminUpgrade4f7c02592a962e40a920f32f3a24f2df'] = 'filesToUpgrade n\'est pas un tableau'; $_LANGADM['AdminUpgrade3f10faa8b44a7175ae8fc5dcb8dec5de'] = 'Tous les fichiers ont été mis à jour. Mise à jour de la base de données en cours.'; $_LANGADM['AdminUpgrade1ad932e3b85eb2907a817cd3e3e6907e'] = 'Erreur pour la mise à jour de %s'; diff --git a/translations/fr/errors.php b/translations/fr/errors.php index 2649bb7fc..ed81127a8 100644 --- a/translations/fr/errors.php +++ b/translations/fr/errors.php @@ -164,8 +164,8 @@ $_ERRORS['491c8c1d25f97843f6edfdc81d021f4d'] = 'Erreur: la configuration de votr $_ERRORS['45ebc64529137a007889ee445d64611c'] = 'Impossible de mettre à jour la position.'; $_ERRORS['5fe3a5b7465abb742a1b93a6037384fa'] = 'Erreur fatale : id_transaction est null'; $_ERRORS['d18dd4bd1531c9c45a85d757e1b4641b'] = 'Erreur fatale: les droits API ne sont pas disponibles'; -$_ERRORS['d194b022bc5a1a01657823aaccd45e9b'] = 'Erreur fatale: l\'iso code n\'est pas correcte : '; $_ERRORS['9b3261577a34cd7c48ad83d80295ff09'] = 'Erreur fatale : pas de transporteur par défaut'; +$_ERRORS['52326ecbfcdff77b4bc9dcf7f055c2eb'] = 'Erreur fatale: le code ISO n\'est pas correcte'; $_ERRORS['411ec6016c7845e0c49fb51160a12677'] = 'Erreur fatale : le répertoire contenant les modules n\'est pas présent'; $_ERRORS['847b0a793110ff20927e76269328e582'] = 'Extension invalide, le fichier doit avoir l\'extension suivante'; $_ERRORS['42e7b89a369899d8c0c4f0631bd1c921'] = 'Fichier install.sql est manquant '; @@ -303,6 +303,7 @@ $_ERRORS['8f18cd66e999d9695f53141a15b47292'] = 'valeur de la réduction est inva $_ERRORS['467366059d7d7c743a4d0971363a8d66'] = 'Limité à certaines catégories'; $_ERRORS['772911becd336c843ab09a1d4b4f66c0'] = 'Limité à certains produits'; $_ERRORS['83d41d7e6f25cd9be1e48204697fe0c9'] = 'Le lien re-écrit pour'; +$_ERRORS['b2c396eff6cd6aae23e4da0218c7cc93'] = 'La catégorie principale ne peut pas être modifiée'; $_ERRORS['087193a0e83ba92c73396e2e6082ee89'] = 'Selectionnez au moins un module à décrocher'; $_ERRORS['edeb9e20655b946e4bee4ac44a6c0a7f'] = 'Le serveur ne dispose pas des permissions pour l\'écriture'; $_ERRORS['5d7cc18ef21285f980cbada9adb9df5c'] = 'Le serveur a expiré, le filigrane n\'est peut-être pas été appliqué à toutes vos images.'; @@ -352,6 +353,7 @@ $_ERRORS['8562db06e3931e51ac8c456b56088b02'] = 'Le client n\'existe pas'; $_ERRORS['350e5d76b60ae887c90d55e2fb23fdc5'] = 'ce bon de réduction n\'est pas applicable à cette catégorie de produit'; $_ERRORS['493f8c31f1db1d87ed30ca58b5dd2df8'] = 'Ce fichier \"%s\" est manquant'; $_ERRORS['e0a602c130d12d57cd4ca2a8b9240917'] = 'Ce fichier doit être éditable :'; +$_ERRORS['4e871525b7518538075dddfad5e292dc'] = 'Cette fonctionnalité a été désactivée.'; $_ERRORS['b72591580ab2e9ecb08d1a26ac23641b'] = 'Cette clé est utilisée trop de fois (une seule autorisée)'; $_ERRORS['b60be6e4c0df15343a7cdafccb174159'] = 'Ce module ne peut être greffé sur ce hook.'; $_ERRORS['bf1af96a1c2127082822a24bca0dfa4f'] = 'Ce module est déjà installé:';