ice_import - Version 1.7.11

Version Notes

Improvements:
- Update productst category.
- Added namespace in system config
Bugfix:
- Minor bug fixing

Download this release

Release Info

Developer IceShop
Extension ice_import
Version 1.7.11
Comparing to
See all releases


Code changes from version 1.7.5 to 1.7.11

Files changed (25) hide show
  1. app/code/community/ICEshop/Iceimport/Block/Adminhtml/Notifications.php +9 -0
  2. app/code/community/ICEshop/Iceimport/Helper/Db.php +77 -1
  3. app/code/community/ICEshop/Iceimport/Helper/System/Systemcheck.php +2 -2
  4. app/code/community/ICEshop/Iceimport/Model/Convert/Adapter/Product.php +1624 -1447
  5. app/code/community/ICEshop/Iceimport/Model/Dataflow/Convert/Parser/Csv.php +4 -4
  6. app/code/community/ICEshop/Iceimport/Model/Observer.php +199 -165
  7. app/code/community/ICEshop/Iceimport/Model/System/Config/Defaulttax.php +19 -19
  8. app/code/community/ICEshop/Iceimport/etc/adminhtml.xml +3 -3
  9. app/code/community/ICEshop/Iceimport/etc/config.xml +8 -5
  10. app/code/community/ICEshop/Iceimport/etc/system.xml +372 -362
  11. app/code/community/ICEshop/Iceimport/sql/iceimport_setup/{mysql4-install-1.7.3.php → mysql4-install-1.7.9.php} +4 -1
  12. app/code/community/ICEshop/Iceimport/sql/iceimport_setup/mysql4-upgrade-0.1.0-1.7.0.php +1 -1
  13. app/code/community/ICEshop/Iceimport/sql/iceimport_setup/mysql4-upgrade-1.4.0-1.7.0.php +1 -1
  14. app/code/community/ICEshop/Iceimport/sql/iceimport_setup/mysql4-upgrade-1.5.0-1.7.0.php +1 -1
  15. app/code/community/ICEshop/Iceimport/sql/iceimport_setup/mysql4-upgrade-1.6.0-1.7.0.php +1 -1
  16. app/code/community/ICEshop/Iceimport/sql/iceimport_setup/{mysql4-upgrade-1.7.0-1.7.5.php → mysql4-upgrade-1.6.0-1.7.5.php} +8 -7
  17. app/code/community/ICEshop/Iceimport/sql/iceimport_setup/mysql4-upgrade-1.7.5-1.7.9.php +87 -0
  18. app/code/community/ICEshop/Iceimport/sql/iceimport_setup/mysql4-upgrade-1.7.6-1.7.9.php +87 -0
  19. app/design/adminhtml/default/default/layout/ICEshop_Iceimport.xml +1 -1
  20. app/design/adminhtml/default/default/template/iceshop/iceimport/notifications.phtml +18 -8
  21. js/ICEshop/Iceimport/jquery-1.11.1.min.js +4 -0
  22. js/ICEshop/Iceimport/jquery-1.9.1.min.js +0 -4
  23. js/ICEshop/Iceimport/script.js +4 -4
  24. package.xml +11 -32
  25. skin/adminhtml/default/default/iceshop/iceimport/styles.css +1 -1
app/code/community/ICEshop/Iceimport/Block/Adminhtml/Notifications.php CHANGED
@@ -31,4 +31,13 @@ class ICEshop_Iceimport_Block_Adminhtml_Notifications extends Mage_Adminhtml_Blo
31
  {
32
  return Mage::helper("adminhtml")->getUrl("*/system_config/edit", array('section' => 'iceimport_information'));
33
  }
 
 
 
 
 
 
 
 
 
34
  }
31
  {
32
  return Mage::helper("adminhtml")->getUrl("*/system_config/edit", array('section' => 'iceimport_information'));
33
  }
34
+
35
+ /**
36
+ * Check is notification available to current user
37
+ * @return bool
38
+ */
39
+ public function isAllowed()
40
+ {
41
+ return Mage::getSingleton('admin/session')->isAllowed('system/config/iceshop_iceimport_importprod_root');
42
+ }
43
  }
app/code/community/ICEshop/Iceimport/Helper/Db.php CHANGED
@@ -280,7 +280,8 @@ END;";
280
  FROM `{$this->_prefix}iceshop_extensions_logs`
281
  WHERE `log_type` = 'error'
282
  AND (`timecol` > DATE_SUB(now(), INTERVAL 1 DAY))
283
- ORDER BY `log_id` DESC;";
 
284
  $results = $this->_reader->fetchAll($sql);
285
  foreach ($results as $row) {
286
  $result_arr[] = $row;
@@ -351,4 +352,79 @@ END;";
351
  }
352
  return false;
353
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
354
  }
280
  FROM `{$this->_prefix}iceshop_extensions_logs`
281
  WHERE `log_type` = 'error'
282
  AND (`timecol` > DATE_SUB(now(), INTERVAL 1 DAY))
283
+ ORDER BY `log_id` DESC
284
+ LIMIT {$limit};";
285
  $results = $this->_reader->fetchAll($sql);
286
  foreach ($results as $row) {
287
  $result_arr[] = $row;
352
  }
353
  return false;
354
  }
355
+
356
+
357
+ /**
358
+ * @param string $setting_key
359
+ * @param string $setting_value
360
+ * @access public
361
+ * @return bool
362
+ */
363
+ public function setConfigData($setting_key, $setting_value)
364
+ {
365
+ if (isset($setting_key) && isset($setting_value)) {
366
+ $table_name = $this->getTableName('core/config_data');
367
+ $sql = "REPLACE INTO `{$table_name}`(`path`, `value`) VALUES(:setting_key, :setting_value);";
368
+ $binds = array(
369
+ 'setting_key' => $this->_getConfigKey($setting_key),
370
+ 'setting_value' => $setting_value
371
+ );
372
+ $this->_writer->query($sql, $binds);
373
+ return true;
374
+ }
375
+ return false;
376
+ }
377
+
378
+ /**
379
+ * @param string $setting_key
380
+ * @access public
381
+ * @return bool|string
382
+ */
383
+ public function getConfigData($setting_key)
384
+ {
385
+ if (isset($setting_key)) {
386
+ $table_name = $this->getTableName('core/config_data');
387
+ $sql = "SELECT `value` FROM `{$table_name}` WHERE `path` = :setting_key;";
388
+ $binds = array(
389
+ 'setting_key' => $this->_getConfigKey($setting_key)
390
+ );
391
+ $result = $this->_reader->query($sql, $binds);
392
+ while ( $row = $result->fetch() ) {
393
+ return $row['value'];
394
+ }
395
+ }
396
+ return false;
397
+ }
398
+
399
+ /**
400
+ * @param string $setting_key
401
+ * @access private
402
+ * @return bool|string
403
+ */
404
+ private function _getConfigKey($setting_key)
405
+ {
406
+ if (isset($setting_key)) {
407
+ return 'iceimport/storage/' . $setting_key;
408
+ }
409
+ return false;
410
+ }
411
+
412
+ /**
413
+ * @param string $setting_key
414
+ * @access public
415
+ * @return bool
416
+ */
417
+ public function unsetConfigData($setting_key)
418
+ {
419
+ if (isset($setting_key)) {
420
+ $table_name = $this->getTableName('core/config_data');
421
+ $sql = "DELETE FROM `{$table_name}` WHERE `path` = :setting_key;";
422
+ $binds = array(
423
+ 'setting_key' => $this->_getConfigKey($setting_key)
424
+ );
425
+ $this->_writer->query($sql, $binds);
426
+ return true;
427
+ }
428
+ return false;
429
+ }
430
  }
app/code/community/ICEshop/Iceimport/Helper/System/Systemcheck.php CHANGED
@@ -604,14 +604,14 @@ class ICEshop_Iceimport_Helper_System_Systemcheck extends Mage_Core_Helper_Abstr
604
  }
605
 
606
  $DB_logger = Mage::helper('iceimport/db');
607
- $log_feed = $DB_logger->getLogByType('report');
608
  if (!empty($log_feed) && count($log_feed) > 0) {
609
  foreach($log_feed as $log_entry) {
610
  $problems['iceimport_log'][] = array(
611
  'label' => 'Iceimport Error',
612
  'current_value' => $log_entry['log_value']
613
  );
614
- $count++;
615
  }
616
  }
617
 
604
  }
605
 
606
  $DB_logger = Mage::helper('iceimport/db');
607
+ $log_feed = $DB_logger->getLogByType('report', false, 1);
608
  if (!empty($log_feed) && count($log_feed) > 0) {
609
  foreach($log_feed as $log_entry) {
610
  $problems['iceimport_log'][] = array(
611
  'label' => 'Iceimport Error',
612
  'current_value' => $log_entry['log_value']
613
  );
614
+ // $count++;
615
  }
616
  }
617
 
app/code/community/ICEshop/Iceimport/Model/Convert/Adapter/Product.php CHANGED
@@ -1,1447 +1,1624 @@
1
- <?php
2
-
3
- /**
4
- * Import Product with additional attributes
5
- *
6
- *
7
- */
8
- class ICEshop_Iceimport_Model_Convert_Adapter_Product extends Mage_Catalog_Model_Convert_Adapter_Product
9
- {
10
- /**
11
- * @var array
12
- */
13
- protected $_categoryCache = array();
14
-
15
- /**
16
- * @var null
17
- */
18
- protected $_connRes = null;
19
-
20
- /**
21
- * @var string
22
- */
23
- protected $_tablePrefix = '';
24
-
25
- /**
26
- * @var
27
- */
28
- protected $_refreshSettings;
29
-
30
- /**
31
- *
32
- */
33
- public function __construct()
34
- {
35
-
36
- $this->_connRes = Mage::getSingleton('core/resource')->getConnection('core_write');
37
- $tablePrefix = (array)Mage::getConfig()->getTablePrefix();
38
- if (!empty($tablePrefix)) {
39
- $this->_tablePrefix = $tablePrefix[0];
40
- }
41
-
42
- }
43
-
44
- /**
45
- * @param $storeId
46
- */
47
- private function _initRefreshSettings($storeId)
48
- {
49
- $this->_refreshSettings = new Varien_Object();
50
- $this->_refreshSettings->setData('categories', (int)Mage::getStoreConfig('importprod_root/importprod/update_categories_from_csv', $storeId));
51
- $this->_refreshSettings->setData('status', (int)Mage::getStoreConfig('importprod_root/importprod/update_status_from_csv', $storeId));
52
- $this->_refreshSettings->setData('visibility', (int)Mage::getStoreConfig('importprod_root/importprod/update_visibility_from_csv', $storeId));
53
- $this->_refreshSettings->setData('is_in_stock', (int)Mage::getStoreConfig('importprod_root/importprod/update_is_in_stock_from_csv', $storeId));
54
- $this->_refreshSettings->setData('update_hide_category', (int)Mage::getStoreConfig('importprod_root/importprod/update_hide_category', $storeId));
55
- $this->_refreshSettings->setData('url_key', (int)Mage::getStoreConfig('importprod_root/importprod/update_url_key_from_csv', $storeId));
56
- $this->_refreshSettings->setData('import_new_products', (int)Mage::getStoreConfig('importprod_root/importprod/import_new_products', $storeId));
57
- }
58
-
59
- /**
60
- * @param $key
61
- * @return mixed
62
- */
63
- private function _getRefreshSetting($key)
64
- {
65
- $key = Mage::helper('iceimport')->toCamelCase($key, true);
66
- return $this->_refreshSettings->{'get' . $key}();
67
- }
68
-
69
- /**
70
- * @param array $importData
71
- * @return bool
72
- * @throws Mage_Core_Exception
73
- */
74
- public function saveRow(array $importData)
75
- {
76
- // separate import data to eav & static
77
- $sortedProductData = $this->_mapAttributes($importData);
78
- $productData = $sortedProductData['productData'];
79
- $iceimportAttributes = $sortedProductData['iceimportAttributes'];
80
-
81
- //Init session values to count total products and determine the last call of saveRow method
82
- $session = Mage::getSingleton("core/session");
83
- $import_total = $session->getData("import_total");
84
- $counter = $session->getData("counter");
85
- $skipped_counter = $session->getData("skipped_counter");
86
-
87
- if (!isset($import_total)) {
88
- $batchId = Mage::getSingleton('core/app')->getRequest()->getPost('batch_id', 0);
89
- $batchModel = Mage::getModel('dataflow/batch')->load($batchId);
90
- $batchImportModel = $batchModel->getBatchImportModel();
91
- $importIds = $batchImportModel->getIdCollection();
92
- $import_total = count($importIds);
93
- $session->setData("import_total", (int)$import_total);
94
- }
95
- if (!isset($counter)) {
96
- $session->setData("counter", 1);
97
- $counter = $session->getData("counter");
98
- }
99
-
100
- if (!isset($skipped_counter)) {
101
- $session->setData("skipped_counter", 0);
102
- $skipped_counter = $session->getData("skipped_counter");
103
- }
104
-
105
- // mark product ice_import generic
106
- $productData['varchar']['is_iceimport'] = 1;
107
- // set website id
108
- if (empty($iceimportAttributes['websites'])) {
109
- $message = Mage::helper('catalog')->__('Skip import row, required field "%s" not defined', 'website');
110
- Mage::throwException($message);
111
- }
112
- $website = Mage::app()->getWebsite(trim($iceimportAttributes['websites']));
113
- $websiteId = $website->getId();
114
-
115
- // set store id
116
- if (empty($iceimportAttributes['store'])) {
117
- if (!is_null($this->getBatchParams('store'))) {
118
- $store = $this->getStoreById($this->getBatchParams('store'));
119
- } else {
120
- $message = Mage::helper('catalog')->__('Skip import row, required field "%s" not defined', 'store');
121
- Mage::throwException($message);
122
- }
123
- }
124
- if (empty($store)) {
125
- $store = Mage::app()->getStore(trim($iceimportAttributes['store']));
126
- }
127
- if ($store === false) {
128
- $message = Mage::helper('catalog')->__('Skip import row, store "%s" not exists', $iceimportAttributes['store']);
129
- Mage::throwException($message);
130
- }
131
- $storeId = $store->getId();
132
- //init refresh settings values
133
- $this->_initRefreshSettings($storeId);
134
-
135
- // set attribute set
136
- if (empty($iceimportAttributes['attribute_set'])) {
137
- $message = Mage::helper('catalog')->__('Skip import row, required field "%s" not defined', 'attribute_set');
138
- Mage::throwException($message);
139
- }
140
-
141
- // set sku
142
- if (empty($iceimportAttributes['sku'])) {
143
- $message = Mage::helper('catalog')->__('Skip import row, required field "%s" not defined', 'sku');
144
- Mage::throwException($message);
145
- }
146
- $sku = $iceimportAttributes['sku'];
147
-
148
- // set category, unspsc, unspsc path
149
- if (empty($iceimportAttributes['categories'])) {
150
- $message = Mage::helper('catalog')->__('Skip import row, required field "%s" not defined', 'categories');
151
- Mage::throwException($message);
152
- }
153
- if (!empty($iceimportAttributes['categories'])) {
154
- $cat_names = explode('/', $iceimportAttributes['categories']);
155
- foreach ($cat_names as $cat_name) {
156
- if (empty($cat_name)) {
157
- $message = Mage::helper('catalog')->__('Skip import row, some of categories does not have name');
158
- Mage::throwException($message);
159
- }
160
- }
161
- }
162
- $category = $iceimportAttributes['categories'];
163
- if (empty($iceimportAttributes['unspsc'])) {
164
- $message = Mage::helper('catalog')->__('Skip import. Category UNSPSC not defined in store');
165
- Mage::throwException($message);
166
- }
167
- $unspsc = $iceimportAttributes['unspsc'];
168
- if (empty($iceimportAttributes['unspsc_path'])) {
169
- $message = Mage::helper('catalog')->__('Skip import. Category UNSPSC path not defined in store');
170
- Mage::throwException($message);
171
- }
172
- if (!empty($iceimportAttributes['unspsc_path'])) {
173
- $cat_unspscs = explode('/', $iceimportAttributes['unspsc_path']);
174
- foreach ($cat_unspscs as $cat_unspsc) {
175
- if (empty($cat_unspsc)) {
176
- $message = Mage::helper('catalog')->__('Skip import row, some of categories does not have UNSPSC');
177
- Mage::throwException($message);
178
- }
179
- }
180
- }
181
- $unspscPath = $iceimportAttributes['unspsc_path'];
182
- if (!empty($cat_unspscs) && !empty($cat_names) && count($cat_names) != count($cat_unspscs)) {
183
- $message = Mage::helper('catalog')->__('Skip import row, categories names does not match categories UNSPSC');
184
- Mage::throwException($message);
185
- }
186
- // set in / out of stock
187
- $isInStock = 0;
188
- if (!empty($iceimportAttributes['is_in_stock'])) {
189
- $isInStock = $iceimportAttributes['is_in_stock'];
190
- }
191
-
192
- // set qty
193
- $qty = 0;
194
- if (!empty($iceimportAttributes['qty'])) {
195
- $qty = $iceimportAttributes['qty'];
196
- }
197
-
198
- // set price
199
- $price = 0.00;
200
- if (!empty($iceimportAttributes['price'])) {
201
- $price = $iceimportAttributes['price'];
202
- }
203
-
204
- // set status value
205
- $statusValue = (!empty($iceimportAttributes['status']) && $iceimportAttributes['status'] == 'Enabled') ? 1 : 0;
206
- $productData['int']['status'] = $statusValue;
207
-
208
- // set visibility value
209
- $visibilityValue = 1;
210
- if (!empty($iceimportAttributes['visibility'])) {
211
- switch ($iceimportAttributes['visibility']) {
212
- case 'Not Visible Individually':
213
- $visibilityValue = 1;
214
- break;
215
- case 'Catalog':
216
- $visibilityValue = 2;
217
- break;
218
- case 'Search':
219
- $visibilityValue = 3;
220
- break;
221
- case 'Catalog, Search':
222
- $visibilityValue = 4;
223
- break;
224
- }
225
- }
226
- $productData['int']['visibility'] = $visibilityValue;
227
-
228
- // set product image
229
- $productImage = '';
230
- if (!empty($iceimportAttributes['image'])) {
231
- $productImage = $iceimportAttributes['image'];
232
- }
233
-
234
- $initAttributes = '';
235
- // init general attributes query
236
- $initAttributes .= "SELECT @product_entity_type_id := `entity_type_id`
237
- FROM `{$this->_tablePrefix}eav_entity_type`
238
- WHERE entity_type_code = 'catalog_product';";
239
-
240
- $initAttributes .= "SELECT @category_entity_type_id := `entity_type_id`
241
- FROM `{$this->_tablePrefix}eav_entity_type`
242
- WHERE entity_type_code = 'catalog_category';";
243
-
244
- $initAttributes .= "SELECT @attribute_set_id := `attribute_set_id`
245
- FROM `{$this->_tablePrefix}eav_attribute_set`
246
- WHERE attribute_set_name = :attribute_set
247
- AND entity_type_id = @product_entity_type_id;";
248
-
249
- $initAttributes .= "SELECT @price_id := `attribute_id`
250
- FROM `{$this->_tablePrefix}eav_attribute`
251
- WHERE `attribute_code` = 'price'
252
- AND entity_type_id = @product_entity_type_id;";
253
-
254
- $initAttributes .= "SELECT @unspsc_id := `attribute_id`
255
- FROM `{$this->_tablePrefix}eav_attribute`
256
- WHERE `attribute_code` = 'unspsc'
257
- AND entity_type_id = @category_entity_type_id;";
258
-
259
- $initAttributes .= "SELECT @category_name_id := `attribute_id`
260
- FROM `{$this->_tablePrefix}eav_attribute`
261
- WHERE `attribute_code` = 'name'
262
- AND entity_type_id = @category_entity_type_id;";
263
-
264
- $initAttributes .= "SELECT @category_active_id := `attribute_id`
265
- FROM `{$this->_tablePrefix}eav_attribute`
266
- WHERE `attribute_code` = 'is_active'
267
- AND entity_type_id = @category_entity_type_id;";
268
-
269
- $initAttributes .= "SELECT @include_nav_bar_id := `attribute_id`
270
- FROM `{$this->_tablePrefix}eav_attribute`
271
- WHERE `attribute_code` = 'include_in_menu'
272
- AND entity_type_id = @category_entity_type_id;";
273
-
274
- $initAttributes .= "SELECT @category_is_anchor_id := `attribute_id`
275
- FROM `{$this->_tablePrefix}eav_attribute`
276
- WHERE `attribute_code` = 'is_anchor'
277
- AND entity_type_id = @category_entity_type_id;";
278
-
279
- if (!empty($iceimportAttributes['stock_name'])) {
280
- $stock_id = $this->_connRes->fetchRow("SELECT stock_id FROM `{$this->_tablePrefix}cataloginventory_stock` WHERE stock_name = :stock_name LIMIT 1", array(
281
- ':stock_name' => $iceimportAttributes['stock_name']
282
- ));
283
- if (!empty($stock_id)) {
284
- $initAttributes .= "SELECT @stock_id := `stock_id` FROM `{$this->_tablePrefix}cataloginventory_stock` WHERE stock_name = '" . $iceimportAttributes['stock_name'] . "';";
285
- } else {
286
- $message = Mage::helper('catalog')->__('Skip import row, stock name "' . $iceimportAttributes['stock_name'] . '" does not exists in the shop');
287
- Mage::throwException($message);
288
- }
289
- } else {
290
- $initAttributes .= "SELECT @stock_id := `stock_id` FROM `{$this->_tablePrefix}cataloginventory_stock` WHERE stock_name = 'Default';";
291
- }
292
- $this->_connRes->query($initAttributes, array(':attribute_set' => $iceimportAttributes['attribute_set']));
293
-
294
- // get tax class id
295
- $defaulttaxConf = (int)Mage::getStoreConfig('importprod_root/importprod/default_tax', $storeId);
296
- $productData['int']['tax_class_id'] = $defaulttaxConf;
297
-
298
- // get category id
299
- $categoriesToActiveConf = Mage::getStoreConfig('importprod_root/importprod/category_active', $storeId);
300
- $categoryIds = $this->_addCategories($category, $storeId, $unspsc, $unspscPath, $categoriesToActiveConf);
301
-
302
- // get url key
303
- $url = '';
304
- if (!empty($productData['varchar']['name'])) {
305
- $preUrl = explode(' ', strtolower($productData['varchar']['name']));
306
- $url = implode('-', $preUrl);
307
- }
308
- $productData['varchar']['url_key'] = $url;
309
-
310
- $prodIdFetch = $this->_connRes->fetchRow("SELECT entity_id FROM `{$this->_tablePrefix}catalog_product_entity` WHERE sku = :sku LIMIT 1", array(
311
- ':sku' => $sku
312
- ));
313
- $productId = $prodIdFetch['entity_id'];
314
- if (!empty($productId)) {
315
- // check import type (Import only price & qty or all product info)
316
- $stockConf = (int)Mage::getStoreConfig('importprod_root/importprod/import_stock', $storeId);
317
- $priceConf = (int)Mage::getStoreConfig('importprod_root/importprod/import_prices', $storeId);
318
-
319
- $productId = $this->_coreSave($productData, $productId, $storeId, $sku, $categoryIds);
320
- $this->_corePriceStock($websiteId, $productId, $price, $qty, $sku, $isInStock, $stockConf, $priceConf, 0);
321
- $this->_connRes->query("INSERT INTO {$this->_tablePrefix}iceshop_iceimport_imported_product_ids (product_id, product_sku) VALUES (:prod_id, :sku) ON DUPLICATE KEY UPDATE product_sku = :sku", array(':prod_id' => $productId, ':sku' => $sku));
322
- } else {
323
- if ($this->_getRefreshSetting('import_new_products') == 0) {
324
- // $session->setData("counter", (int)--$counter);
325
- $session->setData("skipped_counter", (int)++$skipped_counter);
326
- return true;
327
- }
328
- $productId = $this->_coreSave($productData, $productId, $storeId, $sku, $categoryIds);
329
- // add price & stock
330
- $this->_corePriceStock($websiteId, $productId, $price, $qty, $sku, $isInStock);
331
- $this->_connRes->query("INSERT INTO {$this->_tablePrefix}iceshop_iceimport_imported_product_ids (product_id, product_sku) VALUES (:prod_id, :sku) ON DUPLICATE KEY UPDATE product_sku = :sku", array(':prod_id' => $productId, ':sku' => $sku));
332
- }
333
-
334
- // add product image to queue
335
- if (Mage::getStoreConfig('importprod_root/importprod/import_images')) {
336
- $this->_addImageToQueue($productId, $productImage);
337
- }
338
-
339
- if ($counter < $import_total) {
340
- $session->setData("counter", (int)++$counter);
341
- }
342
-
343
- if (isset($counter) && isset($skipped_counter) && isset($import_total) && (($counter + $skipped_counter) == $import_total)) {
344
- $this->_runCategoriesSorting();
345
- $DB_logger = Mage::helper('iceimport/db');
346
- $this->deleteOldProducts($DB_logger);
347
-
348
- $session->unsetData('import_total');
349
- $session->unsetData('counter');
350
-
351
- $DB_logger->insertLogEntry('error' . md5(microtime(true)), 'New products skipped while export according to Iceimport settings: ' . $skipped_counter, 'stat');
352
- $session->unsetData('skipped_counter');
353
-
354
- $date = date('m/d/Y H:i:s');
355
- $DB_logger->insertLogEntry('iceimport_import_ended', $date);
356
- }
357
-
358
- return true;
359
- }
360
-
361
- /**
362
- * @param $arg_attribute
363
- * @param $arg_value
364
- * @return bool
365
- */
366
- public function getAttributeOptionValue($arg_attribute, $arg_value)
367
- {
368
- $attribute_model = Mage::getModel('eav/entity_attribute');
369
- $attribute_options_model = Mage::getModel('eav/entity_attribute_source_table');
370
-
371
- $attribute_code = $attribute_model->getIdByCode('catalog_product', $arg_attribute);
372
- $attribute = $attribute_model->load($attribute_code);
373
-
374
- $attribute_options_model->setAttribute($attribute);
375
- $options = $attribute_options_model->getAllOptions(false);
376
-
377
- foreach ($options as $option) {
378
- if ($option['label'] == $arg_value) {
379
- return $option['value'];
380
- }
381
- }
382
- return false;
383
- }
384
-
385
-
386
- /**
387
- * @param $arg_attribute
388
- * @param $arg_value
389
- * @return bool
390
- * @throws Exception
391
- */
392
- public function addAttributeOption($arg_attribute, $arg_value)
393
- {
394
- $attribute_model = Mage::getModel('eav/entity_attribute');
395
- $attribute_options_model = Mage::getModel('eav/entity_attribute_source_table');
396
-
397
- $attribute_code = $attribute_model->getIdByCode('catalog_product', $arg_attribute);
398
- $attribute = $attribute_model->load($attribute_code);
399
-
400
- $attribute_options_model->setAttribute($attribute);
401
- $attribute_options_model->getAllOptions(false);
402
-
403
- $value = array();
404
- $value['option'] = array($arg_value, $arg_value);
405
- $result = array('value' => $value);
406
-
407
- $attribute->setData('option', $result);
408
- $attribute->save();
409
-
410
- return $this->getAttributeOptionValue($arg_attribute, $arg_value);
411
- }
412
-
413
-
414
- /**
415
- * @param array $entityData
416
- * @param null $productId
417
- * @param int $storeId
418
- * @param $sku
419
- * @param $categoryIds
420
- * @return null
421
- */
422
- protected function _coreSave(array $entityData, $productId = null, $storeId = 0, $sku, $categoryIds)
423
- {
424
- $coreSaveSQL = '';
425
- if ($productId === null) {
426
- // add product to store
427
- $coreSaveProduct = "INSERT INTO `{$this->_tablePrefix}catalog_product_entity` (`entity_type_id`, `attribute_set_id`, `type_id`, `sku`, `created_at`)
428
- VALUES (@product_entity_type_id, @attribute_set_id, 'simple', :sku, NOW());
429
- SELECT @product_id := LAST_INSERT_ID();";
430
- $this->_connRes->query($coreSaveProduct, array(':sku' => $sku));
431
- // get product ID
432
- $prodFetch = $this->_connRes->fetchRow("SELECT @product_id AS prod_id");
433
- $productId = $prodFetch['prod_id'];
434
-
435
- } else {
436
- $productId = (int)$productId;
437
- $coreSaveSQL .= "SELECT @product_id := {$productId}; ";
438
- $producteanConf = (int)Mage::getStoreConfig('importprod_root/importprod/import_product_ean', $storeId);
439
- $productmpnConf = (int)Mage::getStoreConfig('importprod_root/importprod/import_product_mpn', $storeId);
440
- $productnameConf = (int)Mage::getStoreConfig('importprod_root/importprod/import_product_name', $storeId);
441
- $productshdescriptionConf = (int)Mage::getStoreConfig('importprod_root/importprod/import_product_short_description', $storeId);
442
- $productdescriptionConf = (int)Mage::getStoreConfig('importprod_root/importprod/import_product_description', $storeId);
443
- $productshsudescriptionConf = (int)Mage::getStoreConfig('importprod_root/importprod/import_product_short_summary_description', $storeId);
444
- $productsudescriptionConf = (int)Mage::getStoreConfig('importprod_root/importprod/import_product_summary_description', $storeId);
445
- $productbrandConf = (int)Mage::getStoreConfig('importprod_root/importprod/import_product_brand', $storeId);
446
- $deliveryetaConf = (int)Mage::getStoreConfig('importprod_root/importprod/import_delivery_eta', $storeId);
447
-
448
- foreach ($entityData as $type => $typeAttributes) {
449
- foreach ($typeAttributes as $attribute => $value) {
450
- if (
451
- (
452
- ($attribute == 'mpn' && $productmpnConf == 0) ||
453
- ($attribute == 'brand_name' && $productbrandConf == 0) ||
454
- ($attribute == 'ean' && $producteanConf == 0) ||
455
- ($attribute == 'name' && $productnameConf == 0) ||
456
- ($attribute == 'short_description' && $productshdescriptionConf == 0) ||
457
- ($attribute == 'description' && $productdescriptionConf == 0) ||
458
- ($attribute == 'short_summary_description' && $productshsudescriptionConf == 0) ||
459
- ($attribute == 'long_summary_description' && $productsudescriptionConf == 0) ||
460
- ($attribute == 'delivery_eta' && $deliveryetaConf == 0)
461
- ) || (
462
- $attribute == 'sku' ||
463
- ($attribute == 'attribute_set') ||
464
- ($attribute == 'categories' && $this->_getRefreshSetting('categories') == 0) ||
465
- ($attribute == 'unspsc') ||
466
- ($attribute == 'price') ||
467
- ($attribute == 'qty') ||
468
- ($attribute == 'status' && $this->_getRefreshSetting('status') == 0) ||
469
- ($attribute == 'visibility' && $this->_getRefreshSetting('visibility') == 0) ||
470
- ($attribute == 'store') ||
471
- ($attribute == 'websites') ||
472
- ($attribute == 'is_in_stock' && $this->_getRefreshSetting('is_in_stock') == 0) ||
473
- ($attribute == 'url_key' && $this->_getRefreshSetting('url_key') == 0) ||
474
- ($attribute == 'image') ||
475
- ($attribute == 'unspsc_path') ||
476
- ($attribute == 'stock_name')
477
- )
478
- ) {
479
- unset($entityData[$type][$attribute]);
480
- }
481
- }
482
- }
483
- }
484
-
485
- $bindArray[':store_id'] = $storeId;
486
-
487
- foreach ($entityData as $type => $typeAttributes) {
488
-
489
- if ($type != 'spec') {
490
- $tailCoreSaveSQL = '';
491
- $attributesInit = '';
492
- if ($type == 'select') {
493
- $type = 'int';
494
- $is_select = 1;
495
- } else {
496
- $is_select = 0;
497
- }
498
- if (!empty($typeAttributes)) {
499
- $tailCoreSaveSQL .= "INSERT INTO `{$this->_tablePrefix}catalog_product_entity_{$type}` (`entity_type_id`, `attribute_id`, `store_id`, `entity_id`, `value`) VALUES ";
500
- foreach ($typeAttributes as $attribute => $value) {
501
- if ($is_select == 1) {
502
- $option_id = $this->getAttributeOptionValue($attribute, $value);
503
- if (empty($option_id)) {
504
- $option_id = $this->addAttributeOption($attribute, $value);
505
- }
506
- $value = $option_id;
507
- }
508
- $attributesInit .= "SELECT @{$attribute}_id := `attribute_id`
509
- FROM `{$this->_tablePrefix}eav_attribute`
510
- WHERE `attribute_code` = '{$attribute}'
511
- AND entity_type_id = @product_entity_type_id;";
512
-
513
- $tailCoreSaveSQL .= "
514
- (@product_entity_type_id, @{$attribute}_id, 0, @product_id, :{$attribute} ),
515
- (@product_entity_type_id, @{$attribute}_id, :store_id, @product_id, :{$attribute} ), ";
516
- $bindArray[':' . $attribute] = $value;
517
-
518
- }
519
- $tailCoreSaveSQL = substr($tailCoreSaveSQL, 0, -2);
520
- $tailCoreSaveSQL .= "
521
- ON DUPLICATE KEY UPDATE
522
- `value` = VALUES (`value`);";
523
- }
524
- $coreSaveSQL .= $attributesInit . $tailCoreSaveSQL;
525
- } else {
526
- foreach ($typeAttributes as $attribute => $attributeData) {
527
- $prod_id_field = $attributeData['prod_id_field'];
528
- $table = $attributeData['table'];
529
- $field = $attributeData['field'];
530
- $value = $attributeData['value'];
531
- if (!empty($table) && !empty($field)) {
532
- $coreSaveSQL .= "UPDATE `{$this->_tablePrefix}{$table}`
533
- SET `{$field}` = :{$attribute}
534
- WHERE `{$prod_id_field}` = @product_id;";
535
- $bindArray[':' . $attribute] = $value;
536
- }
537
- }
538
- }
539
- }
540
- // categories
541
- if (($productId === null) || ($productId !== null && $this->_getRefreshSetting('categories') == 1)) {
542
- $coreSaveSQL .= "INSERT INTO `{$this->_tablePrefix}catalog_category_product` (`category_id`, `product_id`, `position`) VALUES ";
543
- $counter = 1;
544
-
545
- $mapCategoryIds = array();
546
- $mapCategoryIds[] = array_pop($categoryIds);
547
- $delCategoryIds = array_diff($categoryIds, $mapCategoryIds);
548
-
549
- foreach ($mapCategoryIds as $categoryId) {
550
- if ($counter < count($mapCategoryIds)) {
551
- $coreSaveSQL .= " (" . (int)$categoryId . ", @product_id, 1) , ";
552
- } else if ($counter == count($mapCategoryIds)) {
553
- $coreSaveSQL .= " (" . (int)$categoryId . ", @product_id, 1) ON DUPLICATE KEY UPDATE `position` = 1; ";
554
- }
555
- $counter++;
556
- }
557
- if (!empty($delCategoryIds)) {
558
- foreach ($delCategoryIds as $delCategoryId) {
559
- $delCategoryId = (int)$delCategoryId;
560
- $coreSaveSQL .= "DELETE FROM `{$this->_tablePrefix}catalog_category_product` WHERE `category_id` = {$delCategoryId} AND `product_id` = @product_id;";
561
- }
562
- }
563
- try {
564
- $this->_connRes->query($coreSaveSQL, $bindArray);
565
- } catch (Exception $e) {
566
- echo $e->getMessage();
567
- }
568
- }
569
- return $productId;
570
- }
571
-
572
- /**
573
- * @param int $website
574
- * @param bool $productId
575
- * @param float $price
576
- * @param float $qty
577
- * @param bool $sku
578
- * @param int $isInStock
579
- * @param int $stockConf
580
- * @param int $priceConf
581
- * @param int $new_product
582
- * @throws Mage_Core_Exception
583
- */
584
- protected function _corePriceStock($website = 0, $productId = false, $price = 0.00, $qty = 0.00, $sku = false, $isInStock = 0, $stockConf = 1, $priceConf = 1, $new_product = 1)
585
- {
586
-
587
- if (!$productId) {
588
- $message = Mage::helper('catalog')->__('Skip import row, product_id for product "%s" not defined ', $sku);
589
- Mage::throwException($message);
590
- }
591
- $stockSaveSQL = '';
592
- if ($stockConf == 1) {
593
- $stockSaveSQL .= "INSERT INTO `{$this->_tablePrefix}cataloginventory_stock_item` (`product_id`, `stock_id`, `qty`, `is_in_stock`)
594
- VALUES (:product_id, @stock_id, :qty,1)
595
- ON DUPLICATE KEY UPDATE
596
- `product_id` = :product_id,
597
- `stock_id` = @stock_id,
598
- `qty` = :qty";
599
-
600
- if ($new_product == 1 || $this->_getRefreshSetting('is_in_stock') == 1) {
601
- $stockSaveSQL .= ",
602
- `is_in_stock` = :is_in_stock";
603
- }
604
- $stockSaveSQL .= ";";
605
-
606
- $stockSaveSQL .= "INSERT INTO `{$this->_tablePrefix}cataloginventory_stock_status` (`product_id`, `website_id`, `stock_id`, `qty`, `stock_status`)
607
- VALUES (:product_id, :websiteId, @stock_id, :qty, 1)
608
- ON DUPLICATE KEY UPDATE
609
- `product_id` = :product_id,
610
- `website_id` = :websiteId,
611
- `stock_id` = @stock_id,
612
- `qty` = :qty";
613
- if ($new_product == 1 || $this->_getRefreshSetting('is_in_stock') == 1) {
614
- $stockSaveSQL .= ",
615
- `stock_status` = :is_in_stock";
616
- }
617
- $stockSaveSQL .= ";";
618
- } elseif ($new_product == 0) {
619
- //existent product
620
- if ($this->_getRefreshSetting('is_in_stock') == 1) {
621
- $stockSaveSQL .= "UPDATE `{$this->_tablePrefix}cataloginventory_stock_item` SET `is_in_stock` = :is_in_stock WHERE `product_id` = :product_id AND `stock_id` = @stock_id;";
622
- $stockSaveSQL .= "UPDATE `{$this->_tablePrefix}cataloginventory_stock_status` SET `stock_status` = :is_in_stock WHERE `product_id` = :product_id AND `website_id` = :websiteId AND `stock_id` = @stock_id;";
623
- $fields_values = array(
624
- ':websiteId' => $website,
625
- ':product_id' => $productId,
626
- ':is_in_stock' => $isInStock
627
- );
628
- $this->_connRes->query($stockSaveSQL, $fields_values);
629
- $stockSaveSQL = '';
630
- }
631
- }
632
-
633
- if ($priceConf == 1) {
634
- $stockSaveSQL .= "INSERT INTO `{$this->_tablePrefix}catalog_product_website` (`product_id`, `website_id`)
635
- VALUES (:product_id, :websiteId)
636
- ON DUPLICATE KEY UPDATE
637
- `product_id` = :product_id,
638
- `website_id` = :websiteId;";
639
-
640
- $stockSaveSQL .= "INSERT INTO `{$this->_tablePrefix}catalog_product_entity_decimal` (`entity_type_id`,`attribute_id`,`store_id`, `entity_id`, `value`)
641
- VALUES (@product_entity_type_id, @price_id, 0, :product_id, :price)
642
- ON DUPLICATE KEY UPDATE
643
- `entity_type_id` = @product_entity_type_id,
644
- `attribute_id` = @price_id,
645
- `store_id` = 0,
646
- `entity_id` = :product_id,
647
- `value` = :price;";
648
- }
649
- if ($priceConf == 1 || $stockConf == 1) {
650
- $fields_values = array(
651
- ':websiteId' => $website,
652
- ':product_id' => $productId,
653
- ':price' => $price,
654
- ':qty' => $qty
655
- );
656
- if ($this->_getRefreshSetting('is_in_stock') == 1) {
657
- $fields_values[':is_in_stock'] = $isInStock;
658
- }
659
- $this->_connRes->query($stockSaveSQL, $fields_values);
660
- unset($fields_values, $stockSaveSQL);
661
- }
662
- }
663
-
664
- /**
665
- * @param bool $productId
666
- * @param $productImageUrl
667
- */
668
- protected function _addImageToQueue($productId = false, $productImageUrl)
669
- {
670
- $productImageUrl = trim($productImageUrl);
671
- if ($productId && !empty($productImageUrl)) {
672
- // add image if not exists to queue
673
- $this->_connRes->query(
674
- "INSERT IGNORE INTO `{$this->_tablePrefix}iceshop_iceimport_image_queue` (`entity_id`, `image_url` )
675
- VALUES (:product_id, :image_url)",
676
- array(
677
- ':product_id' => $productId,
678
- ':image_url' => $productImageUrl
679
- )
680
- );
681
- }
682
- }
683
-
684
- /**
685
- * @return mixed
686
- */
687
- private function getImageQueue()
688
- {
689
- return $this->_connRes->fetchAll("SELECT `queue_id`, `entity_id`, `image_url`
690
- FROM `{$this->_tablePrefix}iceshop_iceimport_image_queue`
691
- WHERE `is_downloaded` = 0");
692
- }
693
-
694
- /**
695
- * @param $logFileName
696
- * @throws Exception
697
- */
698
- public function processImageQueue($logFileName)
699
- {
700
- // download & set product images
701
- $queueList = $this->getImageQueue();
702
- if (count($queueList) > 0) {
703
- $mediaDir = Mage::getBaseDir('media');
704
- foreach ($queueList as $queue) {
705
- $queueId = $queue['queue_id'];
706
- $productId = $queue['entity_id'];
707
- $imageUrl = $queue['image_url'];
708
-
709
- $preImageName = explode('/', $imageUrl);
710
- $imageName = array_pop($preImageName);
711
- if (file_exists($mediaDir . DS . $imageName)) {
712
- $imageName = rand() . '_' . time() . $imageName;
713
- }
714
-
715
- if (file_put_contents($mediaDir . DS . $imageName, file_get_contents($imageUrl))) {
716
- $product = Mage::getModel('catalog/product')->load($productId);
717
- $product->addImageToMediaGallery($mediaDir . DS . $imageName,
718
- array('image', 'small_image', 'thumbnail'),
719
- true, true
720
- );
721
- $product->save();
722
- $this->setImageAsDownloaded($queueId);
723
- echo $product->getCategory() . '<br>';
724
- unset($product);
725
- } else {
726
- Mage::log('Unable download file to ' . $productId, $logFileName);
727
- continue;
728
- }
729
- }
730
- }
731
- }
732
-
733
- /**
734
- * @param bool $queueId
735
- */
736
- private function setImageAsDownloaded($queueId = false)
737
- {
738
- if ($queueId) {
739
- $this->_connRes->query(
740
- "UPDATE `{$this->_tablePrefix}iceshop_iceimport_image_queue`
741
- SET is_downloaded = 1
742
- WHERE queue_id = :queue_id",
743
- array(':queue_id' => $queueId)
744
- );
745
- }
746
- }
747
-
748
- /**
749
- * @param $categories
750
- * @param $storeId
751
- * @param $unspsc
752
- * @param $unspscPath
753
- * @param int $categoryActive
754
- * @return array
755
- */
756
- protected function _addCategories($categories, $storeId, $unspsc, $unspscPath, $categoryActive = 1)
757
- {
758
-
759
- // check if product exists
760
- $categoryId = $this->_getCategoryIdByUnspsc($unspsc);
761
-
762
- $categoryIds = array();
763
- if (!empty($categoryId)) {
764
- // merge categories by unspsc
765
- $categoryMergedArray = $this->_categoryMapper($categories, $unspscPath);
766
- foreach ($categoryMergedArray as $category) {
767
- $categoryName = $category['name'];
768
- $categoryUnspsc = $category['unspsc'];
769
- $categoryTreeId = $this->_getCategoryIdByUnspsc($categoryUnspsc);
770
- // check category name to current store
771
- $categoryBindArray = array(
772
- ':store_id' => 0,
773
- ':category_id' => $categoryTreeId
774
- );
775
- $nameCheckerFetch = $this->_connRes->fetchRow(
776
- "SELECT value_id
777
- FROM `{$this->_tablePrefix}catalog_category_entity_varchar`
778
- WHERE store_id = :store_id
779
- AND entity_id = :category_id
780
- AND attribute_id = @category_name_id",
781
- $categoryBindArray
782
- );
783
- $nameChecker = $nameCheckerFetch['value_id'];
784
- if (!$nameChecker) {
785
- // add category name to current store
786
- $categoryBindArray[':category_name'] = $categoryName;
787
- if (!empty($categoryBindArray[':category_id'])) {
788
- $this->_connRes->query(
789
- "INSERT INTO `{$this->_tablePrefix}catalog_category_entity_varchar` (`entity_type_id`, `attribute_id`, `store_id`, `entity_id`, `value`)
790
- VALUES (@category_entity_type_id, @category_name_id, :store_id, :category_id, :category_name)",
791
- $categoryBindArray
792
- );
793
- }
794
- }
795
- }
796
- //
797
-
798
- $activeSetter = '';
799
- // get current path of category
800
- $categoryPath = $this->_connRes->fetchRow(
801
- "SELECT path
802
- FROM `{$this->_tablePrefix}catalog_category_entity`
803
- WHERE entity_id = :entity_id",
804
- array(':entity_id' => $categoryId)
805
- );
806
- $categoryPathArray = explode('/', $categoryPath['path']);
807
- if ($categoryPathArray) {
808
- $activeSetter = "INSERT INTO `{$this->_tablePrefix}catalog_category_entity_int` (`entity_type_id`, `attribute_id`, `store_id`, `entity_id`, `value`) VALUES ";
809
- }
810
-
811
- $falseCounter = 0;
812
- foreach ($categoryPathArray as $categoryId) {
813
- $category = Mage::getModel('catalog/category')->load($categoryId);
814
- $cid = $category->getId();
815
- if (!empty($cid)) {
816
- if (!empty($categoryId)) {
817
- $categoryIds[] = (int)$categoryId;
818
- $activeSetter .= "(@category_entity_type_id, @category_active_id, :store_id, " . $categoryId . ", 1),
819
- (@category_entity_type_id, @category_active_id, 0, " . $categoryId . ", 1), ";
820
- } else {
821
- $falseCounter++;
822
- }
823
- } else {
824
- $falseCounter++;
825
- }
826
- }
827
- $activeSetter = substr($activeSetter, 0, -2);
828
- $activeSetter .= "
829
- ON DUPLICATE KEY UPDATE
830
- `value` = 1
831
- ";
832
- if (1 == $categoryActive) {
833
- if ($falseCounter < count($categoryPathArray)) {
834
- $this->_connRes->query($activeSetter, array(':store_id' => $storeId));
835
- }
836
- }
837
- return $categoryIds;
838
- } else {
839
-
840
- // merge unspsc to current name in unspsc & name path's
841
- $categoryMergedArray = $this->_categoryMapper($categories, $unspscPath);
842
- // get max created parent category
843
- $categoryCreateArray = array();
844
- for ($i = count($categoryMergedArray) - 1; $i >= 0; $i--) {
845
- $category = $categoryMergedArray[$i];
846
- $checkCategoryId = $this->_getCategoryIdByUnspsc($category['unspsc']);
847
- if ($checkCategoryId != null) {
848
- $categoryId = $this->_buildCategoryTree($checkCategoryId, $storeId, $categoryCreateArray, $categoryActive);
849
- $categoryIds[] = (int)$categoryId;
850
- break;
851
- } else {
852
- $categoryCreateArray[] = $category;
853
- }
854
- }
855
- return $categoryIds;
856
- }
857
- }
858
-
859
- /**
860
- * @param $categoryPath
861
- * @param $unspscPath
862
- * @return array
863
- * @throws Mage_Core_Exception
864
- */
865
- protected function _categoryMapper($categoryPath, $unspscPath)
866
- {
867
- $nameArray = explode('/', $categoryPath);
868
- $unspscArray = explode('/', $unspscPath);
869
-
870
- if (count($nameArray) != count($unspscArray)) {
871
- $message = Mage::helper('catalog')->__('Skip import row, @categories data is invalid');
872
- Mage::throwException($message);
873
- }
874
-
875
- $categoryMergedArray = array(
876
- array(
877
- 'unspsc' => 'default_root',
878
- 'name' => 'Default category'
879
- )
880
- );
881
-
882
- for ($i = 0; $i < count($unspscArray); $i++) {
883
- $categoryMergedArray[] = array('name' => $nameArray[$i],
884
- 'unspsc' => $unspscArray[$i]);
885
- }
886
-
887
- return $categoryMergedArray;
888
- }
889
-
890
- /**
891
- * @param $unspsc
892
- * @return int|null
893
- */
894
- protected function _getCategoryIdByUnspsc($unspsc)
895
- {
896
- if ($unspsc == 'default_root') {
897
- return Mage::app()->getStore(1)->getRootCategoryId();
898
- } else {
899
- $categoryId = $this->_connRes->fetchRow(
900
- "SELECT entity_id
901
- FROM `{$this->_tablePrefix}catalog_category_entity_varchar`
902
- WHERE `value` = :unspsc
903
- AND attribute_id = @unspsc_id",
904
- array(':unspsc' => $unspsc)
905
- );
906
- return ($categoryId['entity_id']) ? $categoryId['entity_id'] : null;
907
- }
908
- }
909
-
910
- /**
911
- * @param $parentCategoryId
912
- * @param $storeId
913
- * @param $pathArray
914
- * @param int $categoryActive
915
- * @return mixed
916
- */
917
- protected function _buildCategoryTree($parentCategoryId, $storeId, $pathArray, $categoryActive = 0)
918
- {
919
- for ($i = count($pathArray) - 1; $i >= 0; $i--) {
920
- $category = $pathArray[$i];
921
- $parentCategoryId = $this->_createCategory($parentCategoryId, $category['unspsc'], $storeId, $category['name'], $categoryActive);
922
- }
923
-
924
- return $parentCategoryId;
925
- }
926
-
927
- /**
928
- * @param $parentId
929
- * @param $unspsc
930
- * @param $storeId
931
- * @param $name
932
- * @param int $categoryActive
933
- * @return mixed
934
- */
935
- protected function _createCategory($parentId, $unspsc, $storeId, $name, $categoryActive = 0)
936
- {
937
-
938
- $addCategory = "SELECT @tPath := `path`, @tLevel := `level`
939
- FROM `{$this->_tablePrefix}catalog_category_entity`
940
- WHERE `entity_id` = :parent_id;";
941
- $addCategory .= "SET @tLevel = @tLevel +1;";
942
-
943
- $addCategory .= "SET @path := CONCAT(@tPath, '/',(SELECT MAX(entity_id) FROM `{$this->_tablePrefix}catalog_category_entity`) +1 );";
944
-
945
- $addCategory .= "INSERT INTO `{$this->_tablePrefix}catalog_category_entity` (`entity_type_id`, `attribute_set_id`, `parent_id`, `created_at`, `path`, `position`, `level`, `children_count`)
946
- VALUES (@category_entity_type_id, 0, :parent_id, NOW(), @path, 1, @tLevel, 0);";
947
-
948
- $addCategory .= "SELECT @catId := LAST_INSERT_ID();";
949
-
950
- $addCategory .= "UPDATE `{$this->_tablePrefix}catalog_category_entity`
951
- SET `path` = CONCAT(@tPath, '/', @catId)
952
- WHERE entity_id = LAST_INSERT_ID();";
953
-
954
- $addCategory .= "UPDATE `{$this->_tablePrefix}catalog_category_entity`
955
- SET children_count = children_count +1
956
- WHERE entity_id = :parent_id;";
957
-
958
- $addCategory .= "INSERT IGNORE INTO `{$this->_tablePrefix}catalog_category_entity_int` (`entity_type_id`, `attribute_id`,`store_id`, `entity_id`, `value`)
959
- VALUES (@category_entity_type_id, @category_active_id, 0, @catId, :category_active),
960
- (@category_entity_type_id, @category_active_id, :store, @catId, :category_active),
961
- (@category_entity_type_id, @category_is_anchor_id, 0, @catId, 1),
962
- (@category_entity_type_id, @category_is_anchor_id, :store, @catId, 1),
963
- (@category_entity_type_id, @include_nav_bar_id, 0, @catId, 1),
964
- (@category_entity_type_id, @include_nav_bar_id, :store, @catId, 1);";
965
-
966
- $addCategory .= "INSERT IGNORE INTO `{$this->_tablePrefix}catalog_category_entity_varchar` (`entity_type_id`, `attribute_id`, `store_id`, `entity_id`, `value`)
967
- VALUES (@category_entity_type_id, @category_name_id, 0, @catId, :category_name),
968
- (@category_entity_type_id, @category_name_id, :store, @catId, :category_name),
969
- (@category_entity_type_id, @unspsc_id, 0, @catId, :unspsc_val),
970
- (@category_entity_type_id, @unspsc_id, :store, @catId, :unspsc_val);
971
- ";
972
-
973
- $this->_connRes->query($addCategory, array(
974
- ':store' => $storeId,
975
- ':parent_id' => $parentId,
976
- ':category_name' => $name,
977
- ':unspsc_val' => $unspsc,
978
- ':category_active' => (int)$categoryActive
979
- ));
980
-
981
- $categoryIdFetch = $this->_connRes->fetchRow('SELECT @catId AS category_id');
982
-
983
- return $categoryIdFetch['category_id'];
984
- }
985
-
986
- /**
987
- * @param array $importData
988
- * @return array
989
- */
990
- protected function _mapAttributes(array $importData)
991
- {
992
-
993
- // map iceimport attributes, skip some attributes
994
- $iceAttributes = array();
995
- foreach ($importData as $attribute => $value) {
996
- // map iceimport attributes
997
- if ($attribute == 'sku' ||
998
- $attribute == 'attribute_set' ||
999
- $attribute == 'categories' ||
1000
- $attribute == 'unspsc' ||
1001
- $attribute == 'price' ||
1002
- $attribute == 'qty' ||
1003
- $attribute == 'status' ||
1004
- $attribute == 'visibility' ||
1005
- $attribute == 'store' ||
1006
- $attribute == 'websites' ||
1007
- $attribute == 'is_in_stock' ||
1008
- $attribute == 'image' ||
1009
- $attribute == 'unspsc_path' ||
1010
- $attribute == 'stock_name'
1011
- ) {
1012
-
1013
- $iceAttributes[$attribute] = $value;
1014
- unset($importData[$attribute]);
1015
-
1016
- }
1017
- // skip some attributes
1018
- if ($attribute == 'type' ||
1019
- $attribute == 'supplier_product_code' ||
1020
- $attribute == 'supplier' ||
1021
- $attribute == 'leader_categories' ||
1022
- $attribute == 'leader_store' ||
1023
- $attribute == 'sprice' ||
1024
- $attribute == 'euprice' ||
1025
- $attribute == 'icecat_product_id' ||
1026
- $attribute == 'icecat_category_id' ||
1027
- $attribute == 'icecat_vendor_id' ||
1028
- $attribute == 'icecat_quality' ||
1029
- $attribute == 'icecat_url' ||
1030
- $attribute == 'icecat_thumbnail_img' ||
1031
- $attribute == 'icecat_low_res_img' ||
1032
- $attribute == 'icecat_high_res_img' ||
1033
- $attribute == 'tax1' ||
1034
- $attribute == 'tax2' ||
1035
- $attribute == 'tax3' ||
1036
- $attribute == 'tax4' ||
1037
- $attribute == 'min_quantity' ||
1038
- $attribute == 'loms' ||
1039
- $attribute == 'image_label' ||
1040
- $attribute == 'links_title' ||
1041
- $attribute == 'small_image_label' ||
1042
- $attribute == 'tax_rate' ||
1043
- $attribute == 'gallery' ||
1044
- $attribute == 'weight_type' ||
1045
- $attribute == 'sku_type' ||
1046
- $attribute == 'manage_stock' ||
1047
- $attribute == 'minimal_price' ||
1048
- $attribute == 'required_options' ||
1049
- $attribute == 'samples_title' ||
1050
- $attribute == 'shipment_type' ||
1051
- $attribute == 'url_path' ||
1052
- $attribute == 'recurring_profile' ||
1053
- $attribute == 'product_keys'
1054
- ) {
1055
-
1056
- unset($importData[$attribute]);
1057
-
1058
- }
1059
-
1060
- }
1061
-
1062
- // map default attributes
1063
- $productData = array();
1064
- foreach ($this->_getDefaultAttributesList() as $backendType => $attributesList) {
1065
- if ($backendType != 'spec') {
1066
- foreach ($attributesList as $attribute) {
1067
- if (isset($importData[$attribute]) && $importData[$attribute] != '') {
1068
- $productData[$backendType][$attribute] = $importData[$attribute];
1069
- unset($importData[$attribute]);
1070
- }
1071
- }
1072
- } else {
1073
- foreach ($attributesList as $attributeCode => $attributeSpecs) {
1074
- if (isset($importData[$attributeCode]) && $importData[$attributeCode] != false) {
1075
- $attributeSpecs['value'] = $importData[$attributeCode];
1076
- $productData[$backendType][$attributeCode] = $attributeSpecs;
1077
- unset($importData[$attributeCode]);
1078
- }
1079
- }
1080
- }
1081
- }
1082
-
1083
- if (!empty($importData)) {
1084
- foreach ($importData as $attributeCode => $value) {
1085
- $frontendTypeFetch = $this->_connRes->fetchRow(
1086
- "SELECT frontend_input FROM `{$this->_tablePrefix}eav_attribute` WHERE `attribute_code` = :code",
1087
- array(':code' => $attributeCode)
1088
- );
1089
- if ($frontendTypeFetch['frontend_input'] == 'select') {
1090
- $frontendType = $frontendTypeFetch['frontend_input'];
1091
- if ($frontendType != 'static' && !empty($frontendType) && $value != '') {
1092
- $productData[$frontendType][$attributeCode] = $value;
1093
- unset($importData[$attributeCode]);
1094
- }
1095
- }
1096
- }
1097
- }
1098
- // map custom attributes
1099
- if (!empty($importData)) {
1100
- foreach ($importData as $attributeCode => $value) {
1101
- $backendTypeFetch = $this->_connRes->fetchRow("SELECT backend_type FROM `{$this->_tablePrefix}eav_attribute` WHERE `attribute_code` = :code", array(':code' => $attributeCode));
1102
- $backendType = $backendTypeFetch['backend_type'];
1103
- if (($backendType != 'static' && !empty($backendType) && $value != '')) {
1104
- $productData[$backendType][$attributeCode] = $value;
1105
- unset($importData[$attributeCode]);
1106
- }
1107
- }
1108
- }
1109
-
1110
- $failedAttributes = array();
1111
- if (count($importData) > 0) {
1112
- $failedAttributes = array_keys($importData);
1113
- }
1114
-
1115
- return array(
1116
- 'iceimportAttributes' => $iceAttributes,
1117
- 'productData' => $productData,
1118
- 'failedAttributes' => $failedAttributes
1119
- );
1120
-
1121
- }
1122
-
1123
- /**
1124
- * @return array
1125
- */
1126
- protected function _getDefaultAttributesList()
1127
- {
1128
-
1129
- return array(
1130
- 'varchar' => array(
1131
- 'gift_message_available',
1132
- 'custom_design',
1133
- 'msrp_display_actual_price_type',
1134
- 'msrp_enabled',
1135
- 'options_container',
1136
- 'page_layout',
1137
- 'mpn',
1138
- 'name',
1139
- 'url_key',
1140
- 'meta_description',
1141
- 'meta_title'
1142
- ),
1143
- 'int' => array(
1144
- 'enable_googlecheckout',
1145
- 'is_recurring',
1146
- 'links_purchased_separately',
1147
- 'links_exist',
1148
- 'status',
1149
- 'visibility',
1150
- 'tax_class_id',
1151
- 'color',
1152
- 'price_view',
1153
- 'manufacturer'
1154
- ),
1155
- 'text' => array(
1156
- 'recurring_profile',
1157
- 'description',
1158
- 'custom_layout_update',
1159
- 'meta_keyword',
1160
- 'short_description'
1161
- ),
1162
- 'decimal' => array(
1163
- 'cost',
1164
- 'group_price',
1165
- 'weight',
1166
- 'special_price',
1167
- 'msrp'
1168
- ),
1169
- 'datetime' => array(
1170
- 'custom_design_from',
1171
- 'custom_design_to',
1172
- 'news_from_date',
1173
- 'news_to_date',
1174
- 'special_from_date',
1175
- 'special_to_date'
1176
- ),
1177
- 'spec' => array(
1178
- 'is_qty_decimal' => array(
1179
- 'prod_id_field' => 'product_id',
1180
- 'table' => 'cataloginventory_stock_item',
1181
- 'field' => 'is_qty_decimal'
1182
- ),
1183
- 'use_config_min_qty' => array(
1184
- 'prod_id_field' => 'product_id',
1185
- 'table' => 'cataloginventory_stock_item',
1186
- 'field' => 'use_config_min_qty'
1187
- ),
1188
- 'use_config_min_sale_qty' => array(
1189
- 'prod_id_field' => 'product_id',
1190
- 'table' => 'cataloginventory_stock_item',
1191
- 'field' => 'use_config_min_sale_qty'
1192
- ),
1193
- 'use_config_max_sale_qty' => array(
1194
- 'prod_id_field' => 'product_id',
1195
- 'table' => 'cataloginventory_stock_item',
1196
- 'field' => 'use_config_max_sale_qty'
1197
- ),
1198
- 'use_config_manage_stock' => array(
1199
- 'prod_id_field' => 'product_id',
1200
- 'table' => 'cataloginventory_stock_item',
1201
- 'field' => 'use_config_manage_stock'
1202
- ),
1203
- 'is_decimal_divided' => array(
1204
- 'prod_id_field' => 'product_id',
1205
- 'table' => 'cataloginventory_stock_item',
1206
- 'field' => 'is_decimal_divided'
1207
- ),
1208
- 'use_config_backorders' => array(
1209
- 'prod_id_field' => 'product_id',
1210
- 'table' => 'cataloginventory_stock_item',
1211
- 'field' => 'use_config_backorders'
1212
- ),
1213
- 'use_config_notify_stock_qty' => array(
1214
- 'prod_id_field' => 'product_id',
1215
- 'table' => 'cataloginventory_stock_item',
1216
- 'field' => 'use_config_notify_stock_qty'
1217
- ),
1218
- 'max_sale_qty' => array(
1219
- 'prod_id_field' => 'product_id',
1220
- 'table' => 'cataloginventory_stock_item',
1221
- 'field' => 'max_sale_qty'
1222
- ),
1223
- 'min_sale_qty' => array(
1224
- 'prod_id_field' => 'product_id',
1225
- 'table' => 'cataloginventory_stock_item',
1226
- 'field' => 'min_sale_qty'
1227
- ),
1228
- 'notify_stock_qty' => array(
1229
- 'prod_id_field' => 'product_id',
1230
- 'table' => 'cataloginventory_stock_item',
1231
- 'field' => 'notify_stock_qty'
1232
- ),
1233
- 'backorders' => array(
1234
- 'prod_id_field' => 'product_id',
1235
- 'table' => 'cataloginventory_stock_item',
1236
- 'field' => 'backorders'
1237
- ),
1238
- 'created_at' => array(
1239
- 'prod_id_field' => 'entity_id',
1240
- 'table' => 'catalog_product_entity',
1241
- 'field' => 'created_at'
1242
- ),
1243
- 'min_qty' => array(
1244
- 'prod_id_field' => 'product_id',
1245
- 'table' => 'cataloginventory_stock_item',
1246
- 'field' => 'min_qty'
1247
- ),
1248
- 'updated_at' => array(
1249
- 'prod_id_field' => 'entity_id',
1250
- 'table' => 'catalog_product_entity',
1251
- 'field' => 'updated_at'
1252
- )
1253
- )
1254
- );
1255
- }
1256
-
1257
- /**
1258
- * Count child categories products and set them inactive if they have no products
1259
- *
1260
- * @param $child_cat
1261
- */
1262
- public function CountChildProd($child_cat)
1263
- {
1264
- foreach ($child_cat as $cat) {
1265
- $query = "SELECT `entity_id`
1266
- FROM `{$this->_tablePrefix}catalog_category_entity`
1267
- WHERE parent_id = :cat_id";
1268
- $child_cat = $this->_connRes->fetchAll(
1269
- $query,
1270
- array(
1271
- ':cat_id' => $cat['entity_id']
1272
- )
1273
- );
1274
-
1275
- $query = "SELECT COUNT(*)
1276
- FROM `{$this->_tablePrefix}catalog_category_product`
1277
- WHERE category_id = :cat_id ";
1278
- $cat_products = $this->_connRes->fetchRow(
1279
- $query,
1280
- array(
1281
- ':cat_id' => $cat['entity_id']
1282
- )
1283
- );
1284
-
1285
- if ($cat_products['COUNT(*)'] == 0 && empty($child_cat) && $this->_getRefreshSetting('update_hide_category') == 1) {
1286
- $this->_connRes->query(
1287
- "UPDATE `{$this->_tablePrefix}catalog_category_entity_int`
1288
- SET `value` = 0
1289
- WHERE `attribute_id` = @category_active_id
1290
- AND entity_id = :cat_id",
1291
- array(
1292
- ':cat_id' => $cat['entity_id']
1293
- )
1294
- );
1295
- } else if (!empty($child_cat)) {
1296
- $this->CountChildProd($child_cat);
1297
- }
1298
- }
1299
- }
1300
-
1301
- /**
1302
- * Run categories resorting procedure
1303
- */
1304
- private function _runCategoriesSorting()
1305
- {
1306
- // Check if this is last imported product
1307
- // Do category sort and set categories without products to inactive
1308
- $catCollection = Mage::getModel('catalog/category')
1309
- ->getCollection()
1310
- ->addAttributeToSort('name', 'ASC');
1311
-
1312
- $category_sort = (int)Mage::getStoreConfig('importprod_root/importprod/category_sort');
1313
- if ($category_sort == 1) {
1314
- $position = 1;
1315
- }
1316
- foreach ($catCollection as $category) {
1317
-
1318
- if ($category_sort) {
1319
- $query = "UPDATE `{$this->_tablePrefix}catalog_category_entity` SET position = :position WHERE entity_id = :cat_id ";
1320
- $this->_connRes->query($query, array(
1321
- ':position' => $position++,
1322
- ':cat_id' => $category->getId()
1323
- ));
1324
- }
1325
-
1326
- $query = "SELECT COUNT(*) FROM `{$this->_tablePrefix}catalog_category_product` WHERE category_id = :cat_id ";
1327
- $cat_products = $this->_connRes->fetchRow($query, array(
1328
- ':cat_id' => $category->getId()
1329
- ));
1330
-
1331
- if ($cat_products['COUNT(*)'] == 0) {
1332
- $query = "SELECT `entity_id` FROM `{$this->_tablePrefix}catalog_category_entity` WHERE parent_id = :cat_id";
1333
- $child_cat = $this->_connRes->fetchAll($query, array(
1334
- ':cat_id' => $category->getId()
1335
- ));
1336
-
1337
- if (isset($child_cat) && count($child_cat) > 0) {
1338
- //Count child categories products and set them to inactive if they have no
1339
- $this->CountChildProd($child_cat);
1340
- } elseif($this->_getRefreshSetting('update_hide_category') == 1) {
1341
- $this->_connRes->query("UPDATE `{$this->_tablePrefix}catalog_category_entity_int`
1342
- SET `value` = 0 WHERE `attribute_id` = @category_active_id AND entity_id = :cat_id", array(
1343
- ':cat_id' => $category->getId()
1344
- ));
1345
- }
1346
- }
1347
- }
1348
- }
1349
-
1350
- /**
1351
- * @param object $DB_logger
1352
- * @throws Exception
1353
- */
1354
- public function deleteOldProducts($DB_logger)
1355
- {
1356
- $delete_old_products = (int)Mage::getStoreConfig('importprod_root/importprod/delete_old_products');
1357
- if ($delete_old_products) {
1358
- try {
1359
- $db_res = Mage::getSingleton('core/resource')->getConnection('core_write');
1360
- $db_res->query("SELECT @is_iceimport_id := `attribute_id`
1361
- FROM {$this->_tablePrefix}eav_attribute
1362
- WHERE attribute_code = 'is_iceimport'");
1363
-
1364
- $count_prod = $db_res->fetchRow("SELECT COUNT(*) AS count_prod
1365
- FROM {$this->_tablePrefix}catalog_product_entity AS cpe
1366
- JOIN {$this->_tablePrefix}catalog_product_entity_varchar AS cpev
1367
- ON cpe.entity_id = cpev.entity_id
1368
- AND cpev.value = 1
1369
- AND cpev.attribute_id = @is_iceimport_id");
1370
- $count_prod = $count_prod['count_prod'];
1371
-
1372
- if ($count_prod > 0) {
1373
- //iceimport products exists, amount > 0
1374
- $count_del_prod = $db_res->fetchRow("SELECT COUNT(*) AS count__del_prod
1375
- FROM {$this->_tablePrefix}catalog_product_entity AS cpe
1376
- JOIN {$this->_tablePrefix}catalog_product_entity_varchar AS cpev
1377
- ON cpe.entity_id = cpev.entity_id
1378
- AND cpev.value = 1
1379
- AND cpev.attribute_id = @is_iceimport_id
1380
- LEFT JOIN {$this->_tablePrefix}iceshop_iceimport_imported_product_ids AS iip
1381
- ON cpe.entity_id = iip.product_id
1382
- WHERE iip.product_id IS NULL");
1383
-
1384
- $count_del_prod = $count_del_prod['count_del_prod'];
1385
-
1386
- if ($count_del_prod > 0) {
1387
- //iceimport products to delete exists, amount > 0
1388
- $delete_old_products_tolerance = (int)Mage::getStoreConfig('importprod_root/importprod/delete_old_products_tolerance');
1389
-
1390
- if (round(($count_del_prod / $count_prod * 100), 0) < $delete_old_products_tolerance) {
1391
-
1392
- //iceimport products to delete franction is less than allowed tolerance, deletion approved
1393
- $DB_logger->insertLogEntry('iceimport_count_delete_product', $count_del_prod);
1394
- $db_res->query("DELETE cpe
1395
- FROM {$this->_tablePrefix}catalog_product_entity AS cpe
1396
- JOIN {$this->_tablePrefix}catalog_product_entity_varchar AS cpev
1397
- ON cpe.entity_id = cpev.entity_id
1398
- AND cpev.value = 1
1399
- AND cpev.attribute_id = @is_iceimport_id
1400
- LEFT JOIN {$this->_tablePrefix}iceshop_iceimport_imported_product_ids AS iip
1401
- ON cpe.entity_id = iip.product_id
1402
- WHERE iip.product_id IS NULL");
1403
-
1404
- $db_res->query("DELETE FROM {$this->_tablePrefix}iceshop_iceimport_imported_product_ids");
1405
- } else {
1406
- $error_message = 'Attempt to delete more old products than allowed in Iceimport configuration. Interruption of the process.';
1407
- $DB_logger->insertLogEntry('error' . md5(microtime(true)), $error_message, 'error');
1408
- $error_message2 = 'Old product percentage: ' . round(($count_del_prod / $count_prod * 100), 0) . '%';
1409
- $DB_logger->insertLogEntry('error' . md5(microtime(true)), $error_message2, 'error');
1410
- print $error_message;
1411
- exit;
1412
- }
1413
- }
1414
- }
1415
- } catch (Exception $e) {
1416
- throw new Exception($e->getMessage());
1417
- }
1418
- }
1419
- }
1420
-
1421
- /**
1422
- * @throws Exception
1423
- */
1424
- public function finish()
1425
- {
1426
- /**
1427
- * Back compatibility event
1428
- */
1429
- $DB_logger = Mage::helper('iceimport/db');
1430
- $tablePrefix = '';
1431
- $tPrefix = (array)Mage::getConfig()->getTablePrefix();
1432
- if (!empty($tPrefix)) {
1433
- $tablePrefix = $tPrefix[0];
1434
- }
1435
- $count_imported_products = $DB_logger->getRowsCount($tablePrefix . "iceshop_iceimport_imported_product_ids");
1436
- $DB_logger->insertLogEntry('iceimport_count_imported_products', $count_imported_products);
1437
-
1438
- Mage::dispatchEvent($this->_eventPrefix . '_after', array());
1439
-
1440
- $entity = new Varien_Object();
1441
- Mage::getSingleton('index/indexer')->processEntityAction(
1442
- $entity,
1443
- self::ENTITY,
1444
- Mage_Index_Model_Event::TYPE_SAVE
1445
- );
1446
- }
1447
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Import Product with additional attributes
5
+ *
6
+ *
7
+ */
8
+ class ICEshop_Iceimport_Model_Convert_Adapter_Product extends Mage_Catalog_Model_Convert_Adapter_Product
9
+ {
10
+ /**
11
+ * @var array
12
+ */
13
+ protected $_categoryCache = array();
14
+
15
+ /**
16
+ * @var null
17
+ */
18
+ protected $_connRes = null;
19
+
20
+ /**
21
+ * @var string
22
+ */
23
+ protected $_tablePrefix = '';
24
+
25
+ /**
26
+ * @var
27
+ */
28
+ protected $_refreshSettings;
29
+
30
+ /**
31
+ *
32
+ */
33
+ public function __construct()
34
+ {
35
+
36
+ $this->_connRes = Mage::getSingleton('core/resource')->getConnection('core_write');
37
+ $tablePrefix = (array)Mage::getConfig()->getTablePrefix();
38
+ if (!empty($tablePrefix)) {
39
+ $this->_tablePrefix = $tablePrefix[0];
40
+ }
41
+
42
+ }
43
+
44
+ /**
45
+ * @param $storeId
46
+ */
47
+ private function _initRefreshSettings($storeId)
48
+ {
49
+ $this->_refreshSettings = new Varien_Object();
50
+ $this->_refreshSettings->setData('categories', (int)Mage::getStoreConfig('iceshop_iceimport_importprod_root/importprod/update_categories_from_csv', $storeId));
51
+ $this->_refreshSettings->setData('status', (int)Mage::getStoreConfig('iceshop_iceimport_importprod_root/importprod/update_status_from_csv', $storeId));
52
+ $this->_refreshSettings->setData('visibility', (int)Mage::getStoreConfig('iceshop_iceimport_importprod_root/importprod/update_visibility_from_csv', $storeId));
53
+ $this->_refreshSettings->setData('is_in_stock', (int)Mage::getStoreConfig('iceshop_iceimport_importprod_root/importprod/update_is_in_stock_from_csv', $storeId));
54
+ $this->_refreshSettings->setData('update_hide_category', (int)Mage::getStoreConfig('iceshop_iceimport_importprod_root/importprod/update_hide_category', $storeId));
55
+ $this->_refreshSettings->setData('url_key', (int)Mage::getStoreConfig('iceshop_iceimport_importprod_root/importprod/update_url_key_from_csv', $storeId));
56
+ $this->_refreshSettings->setData('import_new_products', (int)Mage::getStoreConfig('iceshop_iceimport_importprod_root/importprod/import_new_products', $storeId));
57
+ }
58
+
59
+ /**
60
+ * @param $key
61
+ * @return mixed
62
+ */
63
+ private function _getRefreshSetting($key)
64
+ {
65
+ $key = Mage::helper('iceimport')->toCamelCase($key, true);
66
+ return $this->_refreshSettings->{'get' . $key}();
67
+ }
68
+
69
+ /**
70
+ * @param array $importData
71
+ * @return bool
72
+ * @throws Mage_Core_Exception
73
+ */
74
+ public function saveRow(array $importData)
75
+ {
76
+ // separate import data to eav & static
77
+ $sortedProductData = $this->_mapAttributes($importData);
78
+ $productData = $sortedProductData['productData'];
79
+ $iceimportAttributes = $sortedProductData['iceimportAttributes'];
80
+
81
+ //Init session values to count total products and determine the last call of saveRow method
82
+ $session = Mage::getSingleton("core/session");
83
+ $import_total = $session->getData("import_total");
84
+ $counter = $session->getData("counter");
85
+ $skipped_counter = $session->getData("skipped_counter");
86
+
87
+ if (!isset($import_total)) {
88
+ $batchId = Mage::getSingleton('core/app')->getRequest()->getPost('batch_id', 0);
89
+ $batchModel = Mage::getModel('dataflow/batch')->load($batchId);
90
+ $batchImportModel = $batchModel->getBatchImportModel();
91
+ $importIds = $batchImportModel->getIdCollection();
92
+ $import_total = count($importIds);
93
+ $session->setData("import_total", (int)$import_total);
94
+ }
95
+ if (!isset($counter)) {
96
+ $session->setData("counter", 1);
97
+ $counter = $session->getData("counter");
98
+ }
99
+
100
+ if (!isset($skipped_counter)) {
101
+ $session->setData("skipped_counter", 0);
102
+ $skipped_counter = $session->getData("skipped_counter");
103
+ }
104
+
105
+ // mark product ice_import generic
106
+ $productData['varchar']['is_iceimport'] = 1;
107
+ // set website id;
108
+ if (empty($iceimportAttributes['websites'])) {
109
+ $message = Mage::helper('catalog')->__('Skip import row, required field "%s" not defined', 'websites');
110
+ Mage::throwException($message);
111
+ }
112
+
113
+ $website = Mage::app()->getWebsite(trim($iceimportAttributes['websites']));
114
+ $websiteId = $website->getId();
115
+
116
+ // set store id
117
+ if (empty($iceimportAttributes['store'])) {
118
+ if (!is_null($this->getBatchParams('store'))) {
119
+ $store = $this->getStoreById($this->getBatchParams('store'));
120
+ } else {
121
+ $message = Mage::helper('catalog')->__('Skip import row, required field "%s" not defined', 'store');
122
+ Mage::throwException($message);
123
+ }
124
+ }
125
+ if (empty($store)) {
126
+ $store = Mage::app()->getStore(trim($iceimportAttributes['store']));
127
+ }
128
+ if ($store === false) {
129
+ $message = Mage::helper('catalog')->__('Skip import row, store "%s" not exists', $iceimportAttributes['store']);
130
+ Mage::throwException($message);
131
+ }
132
+ $storeId = $store->getId();
133
+ //init refresh settings values
134
+ $this->_initRefreshSettings($storeId);
135
+
136
+ // set attribute set
137
+ if (empty($iceimportAttributes['attribute_set'])) {
138
+ $message = Mage::helper('catalog')->__('Skip import row, required field "%s" not defined', 'attribute_set');
139
+ Mage::throwException($message);
140
+ }
141
+
142
+ // set sku
143
+ if (empty($iceimportAttributes['sku'])) {
144
+ $message = Mage::helper('catalog')->__('Skip import row, required field "%s" not defined', 'sku');
145
+ Mage::throwException($message);
146
+ }
147
+ $sku = $iceimportAttributes['sku'];
148
+
149
+ // set category, unspsc, unspsc path
150
+ if (empty($iceimportAttributes['categories'])) {
151
+ $message = Mage::helper('catalog')->__('Skip import row, required field "%s" not defined', 'categories');
152
+ Mage::throwException($message);
153
+ }
154
+ if (!empty($iceimportAttributes['categories'])) {
155
+ $cat_names = explode('/', $iceimportAttributes['categories']);
156
+ foreach ($cat_names as $cat_name) {
157
+ if (empty($cat_name)) {
158
+ $message = Mage::helper('catalog')->__('Skip import row, some of categories does not have name');
159
+ Mage::throwException($message);
160
+ }
161
+ }
162
+ }
163
+ $category = $iceimportAttributes['categories'];
164
+ if (empty($iceimportAttributes['unspsc'])) {
165
+ $message = Mage::helper('catalog')->__('Skip import. Category UNSPSC not defined in store');
166
+ Mage::throwException($message);
167
+ }
168
+ $unspsc = $iceimportAttributes['unspsc'];
169
+ if (empty($iceimportAttributes['unspsc_path'])) {
170
+ $message = Mage::helper('catalog')->__('Skip import. Category UNSPSC path not defined in store');
171
+ Mage::throwException($message);
172
+ }
173
+ if (!empty($iceimportAttributes['unspsc_path'])) {
174
+ $cat_unspscs = explode('/', $iceimportAttributes['unspsc_path']);
175
+ foreach ($cat_unspscs as $cat_unspsc) {
176
+ if (empty($cat_unspsc)) {
177
+ $message = Mage::helper('catalog')->__('Skip import row, some of categories does not have UNSPSC');
178
+ Mage::throwException($message);
179
+ }
180
+ }
181
+ }
182
+ $unspscPath = $iceimportAttributes['unspsc_path'];
183
+ if (!empty($cat_unspscs) && !empty($cat_names) && count($cat_names) != count($cat_unspscs)) {
184
+ $message = Mage::helper('catalog')->__('Skip import row, categories names does not match categories UNSPSC');
185
+ Mage::throwException($message);
186
+ }
187
+ // set in / out of stock
188
+ $isInStock = 0;
189
+ if (!empty($iceimportAttributes['is_in_stock'])) {
190
+ $isInStock = $iceimportAttributes['is_in_stock'];
191
+ }
192
+
193
+ // set qty
194
+ $qty = 0;
195
+ if (!empty($iceimportAttributes['qty'])) {
196
+ $qty = $iceimportAttributes['qty'];
197
+ }
198
+
199
+ // set price
200
+ $price = 0.00;
201
+ if (!empty($iceimportAttributes['price'])) {
202
+ $price = $iceimportAttributes['price'];
203
+ }
204
+
205
+ // set tax_auvibel
206
+ $tax_auvibel = 0.00;
207
+ if (!empty($iceimportAttributes['tax_auvibel'])) {
208
+ $tax_auvibel = $iceimportAttributes['tax_auvibel'];
209
+ }
210
+
211
+ // set tax_bebat
212
+ $tax_bebat = 0.00;
213
+ if (!empty($iceimportAttributes['tax_bebat'])) {
214
+ $tax_bebat = $iceimportAttributes['tax_bebat'];
215
+ }
216
+
217
+ // set tax_recupel
218
+ $tax_recupel = 0.00;
219
+ if (!empty($iceimportAttributes['tax_recupel'])) {
220
+ $tax_recupel = $iceimportAttributes['tax_recupel'];
221
+ }
222
+
223
+ // set tax_reprobel
224
+ $tax_reprobel = 0.00;
225
+ if (!empty($iceimportAttributes['tax_reprobel'])) {
226
+ $tax_reprobel = $iceimportAttributes['tax_reprobel'];
227
+ }
228
+
229
+ // set status value
230
+ $statusValue = (!empty($iceimportAttributes['status']) && $iceimportAttributes['status'] == 'Enabled') ? 1 : 0;
231
+ $productData['int']['status'] = $statusValue;
232
+
233
+ // set visibility value
234
+ $visibilityValue = 1;
235
+ if (!empty($iceimportAttributes['visibility'])) {
236
+ switch ($iceimportAttributes['visibility']) {
237
+ case 'Not Visible Individually':
238
+ $visibilityValue = 1;
239
+ break;
240
+ case 'Catalog':
241
+ $visibilityValue = 2;
242
+ break;
243
+ case 'Search':
244
+ $visibilityValue = 3;
245
+ break;
246
+ case 'Catalog, Search':
247
+ $visibilityValue = 4;
248
+ break;
249
+ }
250
+ }
251
+ $productData['int']['visibility'] = $visibilityValue;
252
+
253
+ // set product image
254
+ $productImage = '';
255
+ if (!empty($iceimportAttributes['image'])) {
256
+ $productImage = $iceimportAttributes['image'];
257
+ }
258
+
259
+ $initAttributes = '';
260
+ // init general attributes query
261
+ $initAttributes .= "SELECT @product_entity_type_id := `entity_type_id`
262
+ FROM `{$this->_tablePrefix}eav_entity_type`
263
+ WHERE entity_type_code = 'catalog_product';";
264
+
265
+ $initAttributes .= "SELECT @category_entity_type_id := `entity_type_id`
266
+ FROM `{$this->_tablePrefix}eav_entity_type`
267
+ WHERE entity_type_code = 'catalog_category';";
268
+
269
+ $initAttributes .= "SELECT @attribute_set_id := `attribute_set_id`
270
+ FROM `{$this->_tablePrefix}eav_attribute_set`
271
+ WHERE attribute_set_name = :attribute_set
272
+ AND entity_type_id = @product_entity_type_id;";
273
+
274
+ $initAttributes .= "SELECT @price_id := `attribute_id`
275
+ FROM `{$this->_tablePrefix}eav_attribute`
276
+ WHERE `attribute_code` = 'price'
277
+ AND entity_type_id = @product_entity_type_id;";
278
+
279
+ $initAttributes .= "SELECT @unspsc_id := `attribute_id`
280
+ FROM `{$this->_tablePrefix}eav_attribute`
281
+ WHERE `attribute_code` = 'unspsc'
282
+ AND entity_type_id = @category_entity_type_id;";
283
+
284
+ $initAttributes .= "SELECT @category_name_id := `attribute_id`
285
+ FROM `{$this->_tablePrefix}eav_attribute`
286
+ WHERE `attribute_code` = 'name'
287
+ AND entity_type_id = @category_entity_type_id;";
288
+
289
+ $initAttributes .= "SELECT @category_active_id := `attribute_id`
290
+ FROM `{$this->_tablePrefix}eav_attribute`
291
+ WHERE `attribute_code` = 'is_active'
292
+ AND entity_type_id = @category_entity_type_id;";
293
+
294
+ $initAttributes .= "SELECT @include_nav_bar_id := `attribute_id`
295
+ FROM `{$this->_tablePrefix}eav_attribute`
296
+ WHERE `attribute_code` = 'include_in_menu'
297
+ AND entity_type_id = @category_entity_type_id;";
298
+
299
+ $initAttributes .= "SELECT @category_is_anchor_id := `attribute_id`
300
+ FROM `{$this->_tablePrefix}eav_attribute`
301
+ WHERE `attribute_code` = 'is_anchor'
302
+ AND entity_type_id = @category_entity_type_id;";
303
+
304
+ $initAttributes .= "SELECT @tax_auvibel_id := `attribute_id`
305
+ FROM `{$this->_tablePrefix}eav_attribute`
306
+ WHERE `attribute_code` = 'tax_auvibel'
307
+ AND entity_type_id = @product_entity_type_id;";
308
+
309
+ $initAttributes .= "SELECT @tax_bebat_id := `attribute_id`
310
+ FROM `{$this->_tablePrefix}eav_attribute`
311
+ WHERE `attribute_code` = 'tax_bebat'
312
+ AND entity_type_id = @product_entity_type_id;";
313
+
314
+ $initAttributes .= "SELECT @tax_recupel_id := `attribute_id`
315
+ FROM `{$this->_tablePrefix}eav_attribute`
316
+ WHERE `attribute_code` = 'tax_recupel'
317
+ AND entity_type_id = @product_entity_type_id;";
318
+
319
+ $initAttributes .= "SELECT @tax_reprobel_id := `attribute_id`
320
+ FROM `{$this->_tablePrefix}eav_attribute`
321
+ WHERE `attribute_code` = 'tax_reprobel'
322
+ AND entity_type_id = @product_entity_type_id;";
323
+
324
+ if (!empty($iceimportAttributes['stock_name'])) {
325
+ $stock_id = $this->_connRes->fetchRow("SELECT stock_id FROM `{$this->_tablePrefix}cataloginventory_stock` WHERE stock_name = :stock_name LIMIT 1", array(
326
+ ':stock_name' => $iceimportAttributes['stock_name']
327
+ ));
328
+ if (!empty($stock_id)) {
329
+ $initAttributes .= "SELECT @stock_id := `stock_id` FROM `{$this->_tablePrefix}cataloginventory_stock` WHERE stock_name = '" . $iceimportAttributes['stock_name'] . "';";
330
+ } else {
331
+ $message = Mage::helper('catalog')->__('Skip import row, stock name "' . $iceimportAttributes['stock_name'] . '" does not exists in the shop');
332
+ Mage::throwException($message);
333
+ }
334
+ } else {
335
+ $initAttributes .= "SELECT @stock_id := `stock_id` FROM `{$this->_tablePrefix}cataloginventory_stock` WHERE stock_name = 'Default';";
336
+ }
337
+ $this->_connRes->query($initAttributes, array(':attribute_set' => $iceimportAttributes['attribute_set']));
338
+
339
+ // get tax class id
340
+ $defaulttaxConf = (int)Mage::getStoreConfig('iceshop_iceimport_importprod_root/importprod/default_tax', $storeId);
341
+ $productData['int']['tax_class_id'] = $defaulttaxConf;
342
+
343
+ // get category id
344
+ $categoriesToActiveConf = Mage::getStoreConfig('iceshop_iceimport_importprod_root/importprod/category_active', $storeId);
345
+ $categoryIds = $this->_addCategories($category, $storeId, $unspsc, $unspscPath, $categoriesToActiveConf);
346
+
347
+ // get url key
348
+ $url = '';
349
+ if (!empty($productData['varchar']['name'])) {
350
+ $preUrl = explode(' ', strtolower($productData['varchar']['name']));
351
+ $url = implode('-', $preUrl);
352
+ }
353
+ $productData['varchar']['url_key'] = $url;
354
+
355
+ $prodIdFetch = $this->_connRes->fetchRow("SELECT entity_id FROM `{$this->_tablePrefix}catalog_product_entity` WHERE sku = :sku LIMIT 1", array(
356
+ ':sku' => $sku
357
+ ));
358
+ $productId = $prodIdFetch['entity_id'];
359
+ if (!empty($productId)) {
360
+ // check import type (Import only price & qty or all product info)
361
+ $stockConf = (int)Mage::getStoreConfig('iceshop_iceimport_importprod_root/importprod/import_stock', $storeId);
362
+ $priceConf = (int)Mage::getStoreConfig('iceshop_iceimport_importprod_root/importprod/import_prices', $storeId);
363
+
364
+ $productId = $this->_coreSave($productData, $productId, $storeId, $sku, $categoryIds);
365
+ $this->_corePriceStock($websiteId, $productId, $price, $qty, $sku, $isInStock, $stockConf, $priceConf, 0);
366
+
367
+ $this->_connRes->query("INSERT INTO {$this->_tablePrefix}iceshop_iceimport_imported_product_ids (product_id, product_sku) VALUES (:prod_id, :sku) ON DUPLICATE KEY UPDATE product_sku = :sku", array(':prod_id' => $productId, ':sku' => $sku));
368
+ } else {
369
+ if ($this->_getRefreshSetting('import_new_products') == 0) {
370
+ // $session->setData("counter", (int)--$counter);
371
+ $session->setData("skipped_counter", (int)++$skipped_counter);
372
+ return true;
373
+ }
374
+ $productId = $this->_coreSave($productData, $productId, $storeId, $sku, $categoryIds);
375
+ // add price & stock
376
+ $this->_corePriceStock($websiteId, $productId, $price, $qty, $sku, $isInStock);
377
+ $this->_connRes->query("INSERT INTO {$this->_tablePrefix}iceshop_iceimport_imported_product_ids (product_id, product_sku) VALUES (:prod_id, :sku) ON DUPLICATE KEY UPDATE product_sku = :sku", array(':prod_id' => $productId, ':sku' => $sku));
378
+ }
379
+
380
+ $this->_connRes->query("DELETE FROM {$this->_tablePrefix}weee_tax WHERE entity_id = :prod_id AND attribute_id = @tax_auvibel_id", array(':prod_id' => $productId));
381
+ $this->_connRes->query("DELETE FROM {$this->_tablePrefix}weee_tax WHERE entity_id = :prod_id AND attribute_id = @tax_bebat_id", array(':prod_id' => $productId));
382
+ $this->_connRes->query("DELETE FROM {$this->_tablePrefix}weee_tax WHERE entity_id = :prod_id AND attribute_id = @tax_recupel_id", array(':prod_id' => $productId));
383
+ $this->_connRes->query("DELETE FROM {$this->_tablePrefix}weee_tax WHERE entity_id = :prod_id AND attribute_id = @tax_reprobel_id", array(':prod_id' => $productId));
384
+
385
+ $countryCode = Mage::getStoreConfig('general/country/default');
386
+ if ($tax_auvibel > 0) {
387
+ $query = "INSERT INTO {$this->_tablePrefix}weee_tax (website_id, entity_id, country, value, state, attribute_id, entity_type_id)"
388
+ ."VALUES (0, :prod_id, :country, :value, '*', @tax_auvibel_id, @product_entity_type_id)";
389
+ $this->_connRes->query($query, array(':prod_id' => $productId, ':country' => $countryCode, ':value' => $tax_auvibel));
390
+ }
391
+
392
+ if ($tax_bebat > 0) {
393
+ $query = "INSERT INTO {$this->_tablePrefix}weee_tax (website_id, entity_id, country, value, state, attribute_id, entity_type_id)"
394
+ ."VALUES (0, :prod_id, :country, :value, '*', @tax_bebat_id, @product_entity_type_id)";
395
+ $this->_connRes->query($query, array(':prod_id' => $productId, ':country' => $countryCode, ':value' => $tax_bebat));
396
+ }
397
+
398
+ if ($tax_recupel > 0) {
399
+ $query = "INSERT INTO {$this->_tablePrefix}weee_tax (website_id, entity_id, country, value, state, attribute_id, entity_type_id)"
400
+ ."VALUES (0, :prod_id, :country, :value, '*', @tax_recupel_id, @product_entity_type_id)";
401
+ $this->_connRes->query($query, array(':prod_id' => $productId, ':country' => $countryCode, ':value' => $tax_recupel));
402
+ }
403
+
404
+ if ($tax_reprobel > 0) {
405
+ $query = "INSERT INTO {$this->_tablePrefix}weee_tax (website_id, entity_id, country, value, state, attribute_id, entity_type_id)"
406
+ ."VALUES (0, :prod_id, :country, :value, '*', @tax_reprobel_id, @product_entity_type_id)";
407
+ $this->_connRes->query($query, array(':prod_id' => $productId, ':country' => $countryCode, ':value' => $tax_reprobel));
408
+ }
409
+
410
+ // add product image to queue
411
+ if (Mage::getStoreConfig('iceshop_iceimport_importprod_root/importprod/import_images')) {
412
+ $this->_addImageToQueue($productId, $productImage);
413
+ }
414
+
415
+ if ($counter < $import_total) {
416
+ $session->setData("counter", (int)++$counter);
417
+ }
418
+
419
+ if (isset($counter) && isset($skipped_counter) && isset($import_total) && (($counter + $skipped_counter) == $import_total)) {
420
+ $this->_runCategoriesSorting();
421
+ $DB_logger = Mage::helper('iceimport/db');
422
+ $this->deleteOldProducts($DB_logger);
423
+
424
+ $session->unsetData('import_total');
425
+ $session->unsetData('counter');
426
+
427
+ $DB_logger->insertLogEntry('error' . md5(microtime(true)), 'New products skipped while export according to Iceimport settings: ' . $skipped_counter, 'stat');
428
+ $session->unsetData('skipped_counter');
429
+
430
+ $date = date('m/d/Y H:i:s');
431
+ $DB_logger->insertLogEntry('iceimport_import_ended', $date);
432
+ }
433
+
434
+ return true;
435
+ }
436
+
437
+ /**
438
+ * @param $arg_attribute
439
+ * @param $arg_value
440
+ * @return bool
441
+ */
442
+ public function getAttributeOptionValue($arg_attribute, $arg_value)
443
+ {
444
+ $attribute_model = Mage::getModel('eav/entity_attribute');
445
+ $attribute_options_model = Mage::getModel('eav/entity_attribute_source_table');
446
+
447
+ $attribute_code = $attribute_model->getIdByCode('catalog_product', $arg_attribute);
448
+ $attribute = $attribute_model->load($attribute_code);
449
+
450
+ $attribute_options_model->setAttribute($attribute);
451
+ $options = $attribute_options_model->getAllOptions(false);
452
+
453
+ foreach ($options as $option) {
454
+ if ($option['label'] == $arg_value) {
455
+ return $option['value'];
456
+ }
457
+ }
458
+ return false;
459
+ }
460
+
461
+
462
+ /**
463
+ * @param $arg_attribute
464
+ * @param $arg_value
465
+ * @return bool
466
+ * @throws Exception
467
+ */
468
+ public function addAttributeOption($arg_attribute, $arg_value)
469
+ {
470
+ $attribute_model = Mage::getModel('eav/entity_attribute');
471
+ $attribute_options_model = Mage::getModel('eav/entity_attribute_source_table');
472
+
473
+ $attribute_code = $attribute_model->getIdByCode('catalog_product', $arg_attribute);
474
+ $attribute = $attribute_model->load($attribute_code);
475
+
476
+ $attribute_options_model->setAttribute($attribute);
477
+ $attribute_options_model->getAllOptions(false);
478
+
479
+ $value = array();
480
+ $value['option'] = array($arg_value, $arg_value);
481
+ $result = array('value' => $value);
482
+
483
+ $attribute->setData('option', $result);
484
+ $attribute->save();
485
+
486
+ return $this->getAttributeOptionValue($arg_attribute, $arg_value);
487
+ }
488
+
489
+
490
+ /**
491
+ * @param array $entityData
492
+ * @param null $productId
493
+ * @param int $storeId
494
+ * @param $sku
495
+ * @param $categoryIds
496
+ * @return null
497
+ */
498
+ protected function _coreSave(array $entityData, $productId = null, $storeId = 0, $sku, $categoryIds)
499
+ {
500
+ $coreSaveSQL = '';
501
+ $newProduct = false;
502
+ if ($productId === null) {
503
+ // add product to store
504
+ $coreSaveProduct = "INSERT INTO `{$this->_tablePrefix}catalog_product_entity` (`entity_type_id`, `attribute_set_id`, `type_id`, `sku`, `created_at`)
505
+ VALUES (@product_entity_type_id, @attribute_set_id, 'simple', :sku, NOW());
506
+ SELECT @product_id := LAST_INSERT_ID();";
507
+ $this->_connRes->query($coreSaveProduct, array(':sku' => $sku));
508
+ // get product ID
509
+ $prodFetch = $this->_connRes->fetchRow("SELECT @product_id AS prod_id");
510
+ $productId = $prodFetch['prod_id'];
511
+ $newProduct = TRUE;
512
+
513
+ } else {
514
+ $productId = (int)$productId;
515
+ $coreSaveSQL .= "SELECT @product_id := {$productId}; ";
516
+ $producteanConf = (int)Mage::getStoreConfig('iceshop_iceimport_importprod_root/importprod/import_product_ean', $storeId);
517
+ $productmpnConf = (int)Mage::getStoreConfig('iceshop_iceimport_importprod_root/importprod/import_product_mpn', $storeId);
518
+ $productnameConf = (int)Mage::getStoreConfig('iceshop_iceimport_importprod_root/importprod/import_product_name', $storeId);
519
+ $productshdescriptionConf = (int)Mage::getStoreConfig('iceshop_iceimport_importprod_root/importprod/import_product_short_description', $storeId);
520
+ $productdescriptionConf = (int)Mage::getStoreConfig('iceshop_iceimport_importprod_root/importprod/import_product_description', $storeId);
521
+ $productshsudescriptionConf = (int)Mage::getStoreConfig('iceshop_iceimport_importprod_root/importprod/import_product_short_summary_description', $storeId);
522
+ $productsudescriptionConf = (int)Mage::getStoreConfig('iceshop_iceimport_importprod_root/importprod/import_product_summary_description', $storeId);
523
+ $productbrandConf = (int)Mage::getStoreConfig('iceshop_iceimport_importprod_root/importprod/import_product_brand_name', $storeId);
524
+ // $productbrandConf = (int)Mage::getStoreConfig('iceshop_iceimport_importprod_root/importprod/import_product_brand', $storeId);
525
+ $deliveryetaConf = (int)Mage::getStoreConfig('iceshop_iceimport_importprod_root/importprod/import_product_delivery_eta', $storeId);
526
+ // $deliveryetaConf = (int)Mage::getStoreConfig('iceshop_iceimport_importprod_root/importprod/import_delivery_eta', $storeId);
527
+
528
+ foreach ($entityData as $type => $typeAttributes) {
529
+ foreach ($typeAttributes as $attribute => $value) {
530
+ if (
531
+ (
532
+ ($attribute == 'mpn' && $productmpnConf == 0) ||
533
+ ($attribute == 'brand_name' && $productbrandConf == 0) ||
534
+ ($attribute == 'ean' && $producteanConf == 0) ||
535
+ ($attribute == 'name' && $productnameConf == 0) ||
536
+ ($attribute == 'short_description' && $productshdescriptionConf == 0) ||
537
+ ($attribute == 'description' && $productdescriptionConf == 0) ||
538
+ ($attribute == 'short_summary_description' && $productshsudescriptionConf == 0) ||
539
+ ($attribute == 'long_summary_description' && $productsudescriptionConf == 0) ||
540
+ ($attribute == 'delivery_eta' && $deliveryetaConf == 0)
541
+ ) || (
542
+ $attribute == 'sku' ||
543
+ ($attribute == 'attribute_set') ||
544
+ ($attribute == 'categories' && $this->_getRefreshSetting('categories') == 0) ||
545
+ ($attribute == 'unspsc') ||
546
+ ($attribute == 'price') ||
547
+ ($attribute == 'qty') ||
548
+ ($attribute == 'status' && $this->_getRefreshSetting('status') == 0) ||
549
+ ($attribute == 'visibility' && $this->_getRefreshSetting('visibility') == 0) ||
550
+ ($attribute == 'store') ||
551
+ ($attribute == 'websites') ||
552
+ ($attribute == 'is_in_stock' && $this->_getRefreshSetting('is_in_stock') == 0) ||
553
+ ($attribute == 'url_key' && $this->_getRefreshSetting('url_key') == 0) ||
554
+ ($attribute == 'image') ||
555
+ ($attribute == 'unspsc_path') ||
556
+ ($attribute == 'stock_name') ||
557
+ ($attribute == 'tax_auvibel') ||
558
+ ($attribute == 'tax_bebat') ||
559
+ ($attribute == 'tax_recupel') ||
560
+ ($attribute == 'tax_reprobel')
561
+ )
562
+ ) {
563
+ unset($entityData[$type][$attribute]);
564
+ }
565
+ }
566
+ }
567
+ }
568
+
569
+ $bindArray[':store_id'] = $storeId;
570
+
571
+ foreach ($entityData as $type => $typeAttributes) {
572
+
573
+ if ($type != 'spec') {
574
+ $tailCoreSaveSQL = '';
575
+ $attributesInit = '';
576
+ if ($type == 'select') {
577
+ $type = 'int';
578
+ $is_select = 1;
579
+ } else {
580
+ $is_select = 0;
581
+ }
582
+ if (!empty($typeAttributes)) {
583
+ $tailCoreSaveSQL .= "INSERT INTO `{$this->_tablePrefix}catalog_product_entity_{$type}` (`entity_type_id`, `attribute_id`, `store_id`, `entity_id`, `value`) VALUES ";
584
+ foreach ($typeAttributes as $attribute => $value) {
585
+
586
+ if ($is_select == 1) {
587
+ $option_id = $this->getAttributeOptionValue($attribute, $value);
588
+ if (empty($option_id)) {
589
+ $option_id = $this->addAttributeOption($attribute, $value);
590
+ }
591
+ $value = $option_id;
592
+ }
593
+ $attributesInit .= "SELECT @{$attribute}_id := `attribute_id`
594
+ FROM `{$this->_tablePrefix}eav_attribute`
595
+ WHERE `attribute_code` = '{$attribute}'
596
+ AND entity_type_id = @product_entity_type_id;";
597
+
598
+ $tailCoreSaveSQL .= "
599
+ (@product_entity_type_id, @{$attribute}_id, 0, @product_id, :{$attribute} ),
600
+ (@product_entity_type_id, @{$attribute}_id, :store_id, @product_id, :{$attribute} ), ";
601
+ $bindArray[':' . $attribute] = $value;
602
+
603
+ }
604
+ $tailCoreSaveSQL = substr($tailCoreSaveSQL, 0, -2);
605
+ $tailCoreSaveSQL .= "
606
+ ON DUPLICATE KEY UPDATE
607
+ `value` = VALUES (`value`);";
608
+ }
609
+ $coreSaveSQL .= $attributesInit . $tailCoreSaveSQL;
610
+ } else {
611
+ foreach ($typeAttributes as $attribute => $attributeData) {
612
+ $prod_id_field = $attributeData['prod_id_field'];
613
+ $table = $attributeData['table'];
614
+ $field = $attributeData['field'];
615
+ $value = $attributeData['value'];
616
+ if (!empty($table) && !empty($field)) {
617
+ $coreSaveSQL .= "UPDATE `{$this->_tablePrefix}{$table}`
618
+ SET `{$field}` = :{$attribute}
619
+ WHERE `{$prod_id_field}` = @product_id;";
620
+ $bindArray[':' . $attribute] = $value;
621
+ }
622
+ }
623
+ }
624
+ }
625
+ // categories
626
+ if ($newProduct || ($productId === null) || ($productId !== null && $this->_getRefreshSetting('categories') == 1)) {
627
+ // if ($productId !== null) {
628
+ $coreSaveSQL .= "INSERT INTO `{$this->_tablePrefix}catalog_category_product` (`category_id`, `product_id`, `position`) VALUES ";
629
+ $counter = 1;
630
+
631
+ $mapCategoryIds = array();
632
+ $mapCategoryIds[] = array_pop($categoryIds);
633
+ $delCategoryIds = array_diff($categoryIds, $mapCategoryIds);
634
+
635
+ foreach ($mapCategoryIds as $categoryId) {
636
+ if ($counter < count($mapCategoryIds)) {
637
+ $coreSaveSQL .= " (" . (int)$categoryId . ", @product_id, 1) , ";
638
+ } else if ($counter == count($mapCategoryIds)) {
639
+ $coreSaveSQL .= " (" . (int)$categoryId . ", @product_id, 1) ON DUPLICATE KEY UPDATE `position` = 1; ";
640
+ }
641
+ $counter++;
642
+ }
643
+
644
+ $not_delete_category = $this->getCategoryIdEmtyUnspsc($storeId);
645
+ $noDelCategory = ' AND ';
646
+ foreach ($not_delete_category as $category_ID ){
647
+ $noDelCategory .= '`category_id` != '.$category_ID['entity_id'] . ' ';
648
+ }
649
+
650
+ if (!empty($mapCategoryIds)) {
651
+ foreach ($mapCategoryIds as $delCategoryId) {
652
+ $delCategoryId = (int)$delCategoryId;
653
+ $coreSaveSQL .= "DELETE FROM `{$this->_tablePrefix}catalog_category_product`
654
+ WHERE `category_id` != {$delCategoryId} {$noDelCategory} AND `product_id` = @product_id;";
655
+ }
656
+ }
657
+ try {
658
+ $this->_connRes->query($coreSaveSQL, $bindArray);
659
+ unset($coreSaveSQL, $bindArray);
660
+ } catch (Exception $e) {
661
+ echo $e->getMessage();
662
+ }
663
+ } else {
664
+ try {
665
+ $this->_connRes->query($coreSaveSQL, $bindArray);
666
+ unset($coreSaveSQL, $bindArray);
667
+ } catch (Exception $e) {
668
+ echo $e->getMessage();
669
+ }
670
+ }
671
+ return $productId;
672
+ }
673
+
674
+ /**
675
+ * @param int $website
676
+ * @param bool $productId
677
+ * @param float $price
678
+ * @param float $qty
679
+ * @param bool $sku
680
+ * @param int $isInStock
681
+ * @param int $stockConf
682
+ * @param int $priceConf
683
+ * @param int $new_product
684
+ * @throws Mage_Core_Exception
685
+ */
686
+ protected function _corePriceStock($website = 0, $productId = false, $price = 0.00, $qty = 0.00, $sku = false, $isInStock = 0, $stockConf = 1, $priceConf = 1, $new_product = 1)
687
+ {
688
+
689
+ if (!$productId) {
690
+ $message = Mage::helper('catalog')->__('Skip import row, product_id for product "%s" not defined ', $sku);
691
+ Mage::throwException($message);
692
+ }
693
+ $stockSaveSQL = '';
694
+ if ($stockConf == 1) {
695
+ $stockSaveSQL .= "INSERT INTO `{$this->_tablePrefix}cataloginventory_stock_item` (`product_id`, `stock_id`, `qty`, `is_in_stock`)
696
+ VALUES (:product_id, @stock_id, :qty,1)
697
+ ON DUPLICATE KEY UPDATE
698
+ `product_id` = :product_id,
699
+ `stock_id` = @stock_id,
700
+ `qty` = :qty";
701
+
702
+ if ($new_product == 1 || $this->_getRefreshSetting('is_in_stock') == 1) {
703
+ $stockSaveSQL .= ",
704
+ `is_in_stock` = :is_in_stock";
705
+ }
706
+ $stockSaveSQL .= ";";
707
+ $fields_values = array(
708
+ ':product_id' => $productId,
709
+ ':websiteId' => $website,
710
+ ':qty' => $qty
711
+ );
712
+ if ($new_product == 1 || $this->_getRefreshSetting('is_in_stock') == 1) {
713
+ $fields_values[':is_in_stock'] = $isInStock;
714
+ }
715
+ $this->_connRes->query($stockSaveSQL, $fields_values);
716
+ $stockSaveSQL = "";
717
+
718
+ $stockSaveSQL .= "INSERT INTO `{$this->_tablePrefix}cataloginventory_stock_status` (`product_id`, `website_id`, `stock_id`, `qty`, `stock_status`)
719
+ VALUES (:product_id, :websiteId, @stock_id, :qty, 1)
720
+ ON DUPLICATE KEY UPDATE
721
+ `product_id` = :product_id,
722
+ `website_id` = :websiteId,
723
+ `stock_id` = @stock_id,
724
+ `qty` = :qty";
725
+ if ($new_product == 1 || $this->_getRefreshSetting('is_in_stock') == 1) {
726
+ $stockSaveSQL .= ",
727
+ `stock_status` = :is_in_stock";
728
+ }
729
+ $stockSaveSQL .= ";";
730
+ $fields_values = array(
731
+ ':product_id' => $productId,
732
+ ':websiteId' => $website,
733
+ ':qty' => $qty
734
+ );
735
+ if ($new_product == 1 || $this->_getRefreshSetting('is_in_stock') == 1) {
736
+ $fields_values[':is_in_stock'] = $isInStock;
737
+ }
738
+ $this->_connRes->query($stockSaveSQL, $fields_values);
739
+ $stockSaveSQL = "";
740
+
741
+ } elseif ($new_product == 0) {
742
+ //existent product
743
+ if ($this->_getRefreshSetting('is_in_stock') == 1) {
744
+ $stockSaveSQL .= "UPDATE `{$this->_tablePrefix}cataloginventory_stock_item` SET `is_in_stock` = :is_in_stock WHERE `product_id` = :product_id AND `stock_id` = @stock_id;";
745
+ $stockSaveSQL .= "UPDATE `{$this->_tablePrefix}cataloginventory_stock_status` SET `stock_status` = :is_in_stock WHERE `product_id` = :product_id AND `website_id` = :websiteId AND `stock_id` = @stock_id;";
746
+ $fields_values = array(
747
+ ':websiteId' => $website,
748
+ ':product_id' => $productId,
749
+ ':is_in_stock' => $isInStock
750
+ );
751
+ $this->_connRes->query($stockSaveSQL, $fields_values);
752
+ $stockSaveSQL = '';
753
+ }
754
+ }
755
+
756
+ if ($priceConf == 1) {
757
+ $stockSaveSQL .= "INSERT INTO `{$this->_tablePrefix}catalog_product_website` (`product_id`, `website_id`)
758
+ VALUES (:product_id, :websiteId)
759
+ ON DUPLICATE KEY UPDATE
760
+ `product_id` = :product_id,
761
+ `website_id` = :websiteId;";
762
+
763
+ $fields_values = array(
764
+ ':websiteId' => $website,
765
+ ':product_id' => $productId
766
+ );
767
+ $this->_connRes->query($stockSaveSQL, $fields_values);
768
+ $stockSaveSQL = "";
769
+ $stockSaveSQL .= "INSERT INTO `{$this->_tablePrefix}catalog_product_entity_decimal` (`entity_type_id`,`attribute_id`,`store_id`, `entity_id`, `value`)
770
+ VALUES (@product_entity_type_id, @price_id, 0, :product_id, :price)
771
+ ON DUPLICATE KEY UPDATE
772
+ `entity_type_id` = @product_entity_type_id,
773
+ `attribute_id` = @price_id,
774
+ `store_id` = 0,
775
+ `entity_id` = :product_id,
776
+ `value` = :price;";
777
+ $stockSaveSQL .= "INSERT INTO `{$this->_tablePrefix}catalog_product_entity_decimal` (`entity_type_id`,`attribute_id`,`store_id`, `entity_id`, `value`)
778
+ VALUES (@product_entity_type_id, @price_id, {$website}, :product_id, :price)
779
+ ON DUPLICATE KEY UPDATE
780
+ `entity_type_id` = @product_entity_type_id,
781
+ `attribute_id` = @price_id,
782
+ `store_id` = {$website},
783
+ `entity_id` = :product_id,
784
+ `value` = :price;";
785
+ $fields_values = array(
786
+ ':product_id' => $productId,
787
+ ':price' => $price,
788
+ ':qty' => $qty
789
+ );
790
+ if ($new_product == 1 || $this->_getRefreshSetting('is_in_stock') == 1) {
791
+ $fields_values[':is_in_stock'] = $isInStock;
792
+ }
793
+ $this->_connRes->query($stockSaveSQL, $fields_values);
794
+ $stockSaveSQL = "";
795
+ }
796
+ if (($priceConf == 1 || $stockConf == 1) && !empty($stockSaveSQL)) {
797
+ $fields_values = array(
798
+ ':websiteId' => $website,
799
+ ':product_id' => $productId,
800
+ ':price' => $price,
801
+ ':qty' => $qty
802
+ );
803
+ if ($this->_getRefreshSetting('is_in_stock') == 1) {
804
+ $fields_values[':is_in_stock'] = $isInStock;
805
+ }
806
+ $this->_connRes->query($stockSaveSQL, $fields_values);
807
+ unset($stockSaveSQL);
808
+ }
809
+ unset($fields_values);
810
+ }
811
+
812
+ /**
813
+ * @param bool $productId
814
+ * @param $productImageUrl
815
+ */
816
+ protected function _addImageToQueue($productId = false, $productImageUrl)
817
+ {
818
+ $productImageUrl = trim($productImageUrl);
819
+ if ($productId && !empty($productImageUrl)) {
820
+ // add image if not exists to queue
821
+ $this->_connRes->query(
822
+ "INSERT IGNORE INTO `{$this->_tablePrefix}iceshop_iceimport_image_queue` (`entity_id`, `image_url` )
823
+ VALUES (:product_id, :image_url)",
824
+ array(
825
+ ':product_id' => $productId,
826
+ ':image_url' => $productImageUrl
827
+ )
828
+ );
829
+ }
830
+ }
831
+
832
+ /**
833
+ * @return mixed
834
+ */
835
+ private function getImageQueue()
836
+ {
837
+ return $this->_connRes->fetchAll("SELECT `queue_id`, `entity_id`, `image_url`
838
+ FROM `{$this->_tablePrefix}iceshop_iceimport_image_queue`
839
+ WHERE `is_downloaded` = 0");
840
+ }
841
+
842
+ /**
843
+ * @param $logFileName
844
+ * @throws Exception
845
+ */
846
+ public function processImageQueue($logFileName)
847
+ {
848
+ // download & set product images
849
+ $queueList = $this->getImageQueue();
850
+ if (count($queueList) > 0) {
851
+ $mediaDir = Mage::getBaseDir('media');
852
+ foreach ($queueList as $queue) {
853
+ $queueId = $queue['queue_id'];
854
+ $productId = $queue['entity_id'];
855
+ $imageUrl = $queue['image_url'];
856
+
857
+ $preImageName = explode('/', $imageUrl);
858
+ $imageName = array_pop($preImageName);
859
+ if (file_exists($mediaDir . DS . $imageName)) {
860
+ $imageName = rand() . '_' . time() . $imageName;
861
+ }
862
+
863
+ if (file_put_contents($mediaDir . DS . $imageName, file_get_contents($imageUrl))) {
864
+ $product = Mage::getModel('catalog/product')->load($productId);
865
+ $product->addImageToMediaGallery($mediaDir . DS . $imageName,
866
+ array('image', 'small_image', 'thumbnail'),
867
+ true, true
868
+ );
869
+ $product->save();
870
+ $this->setImageAsDownloaded($queueId);
871
+ echo $product->getCategory() . '<br>';
872
+ unset($product);
873
+ } else {
874
+ Mage::log('Unable download file to ' . $productId, $logFileName);
875
+ continue;
876
+ }
877
+ }
878
+ }
879
+ }
880
+
881
+ /**
882
+ * @param bool $queueId
883
+ */
884
+ private function setImageAsDownloaded($queueId = false)
885
+ {
886
+ if ($queueId) {
887
+ $this->_connRes->query(
888
+ "UPDATE `{$this->_tablePrefix}iceshop_iceimport_image_queue`
889
+ SET is_downloaded = 1
890
+ WHERE queue_id = :queue_id",
891
+ array(':queue_id' => $queueId)
892
+ );
893
+ }
894
+ }
895
+
896
+ /**
897
+ * @param $categories
898
+ * @param $storeId
899
+ * @param $unspsc
900
+ * @param $unspscPath
901
+ * @param int $categoryActive
902
+ * @return array
903
+ */
904
+ protected function _addCategories($categories, $storeId, $unspsc, $unspscPath, $categoryActive = 1)
905
+ {
906
+
907
+ // check if product exists
908
+ $categoryId = $this->_getCategoryIdByUnspsc($unspsc);
909
+
910
+ $categoryIds = array();
911
+ if (!empty($categoryId)) {
912
+ // merge categories by unspsc
913
+ $categoryMergedArray = $this->_categoryMapper($categories, $unspscPath);
914
+ foreach ($categoryMergedArray as $category) {
915
+ $categoryName = $category['name'];
916
+ $categoryUnspsc = $category['unspsc'];
917
+ $categoryTreeId = $this->_getCategoryIdByUnspsc($categoryUnspsc);
918
+ // check category name to current store
919
+ $categoryBindArray = array(
920
+ ':store_id' => 0,
921
+ ':category_id' => $categoryTreeId
922
+ );
923
+ $nameCheckerFetch = $this->_connRes->fetchRow(
924
+ "SELECT value_id
925
+ FROM `{$this->_tablePrefix}catalog_category_entity_varchar`
926
+ WHERE store_id = :store_id
927
+ AND entity_id = :category_id
928
+ AND attribute_id = @category_name_id",
929
+ $categoryBindArray
930
+ );
931
+ $nameChecker = $nameCheckerFetch['value_id'];
932
+ if (!$nameChecker) {
933
+ // add category name to current store
934
+ $categoryBindArray[':category_name'] = $categoryName;
935
+ if (!empty($categoryBindArray[':category_id'])) {
936
+ $this->_connRes->query(
937
+ "INSERT INTO `{$this->_tablePrefix}catalog_category_entity_varchar` (`entity_type_id`, `attribute_id`, `store_id`, `entity_id`, `value`)
938
+ VALUES (@category_entity_type_id, @category_name_id, :store_id, :category_id, :category_name)",
939
+ $categoryBindArray
940
+ );
941
+ }
942
+ }
943
+ }
944
+ //
945
+
946
+ $activeSetter = '';
947
+ // get current path of category
948
+ $categoryPath = $this->_connRes->fetchRow(
949
+ "SELECT path
950
+ FROM `{$this->_tablePrefix}catalog_category_entity`
951
+ WHERE entity_id = :entity_id",
952
+ array(':entity_id' => $categoryId)
953
+ );
954
+ $categoryPathArray = explode('/', $categoryPath['path']);
955
+ if ($categoryPathArray) {
956
+ $activeSetter = "INSERT INTO `{$this->_tablePrefix}catalog_category_entity_int` (`entity_type_id`, `attribute_id`, `store_id`, `entity_id`, `value`) VALUES ";
957
+ }
958
+
959
+ $falseCounter = 0;
960
+ foreach ($categoryPathArray as $categoryId) {
961
+ $category = Mage::getModel('catalog/category')->load($categoryId);
962
+ $cid = $category->getId();
963
+ if (!empty($cid)) {
964
+ if (!empty($categoryId)) {
965
+ $categoryIds[] = (int)$categoryId;
966
+ $activeSetter .= "(@category_entity_type_id, @category_active_id, :store_id, " . $categoryId . ", 1),
967
+ (@category_entity_type_id, @category_active_id, 0, " . $categoryId . ", 1), ";
968
+ } else {
969
+ $falseCounter++;
970
+ }
971
+ } else {
972
+ $falseCounter++;
973
+ }
974
+ }
975
+ $activeSetter = substr($activeSetter, 0, -2);
976
+ $activeSetter .= "
977
+ ON DUPLICATE KEY UPDATE
978
+ `value` = 1
979
+ ";
980
+ if (1 == $categoryActive) {
981
+ if ($falseCounter < count($categoryPathArray)) {
982
+ $this->_connRes->query($activeSetter, array(':store_id' => $storeId));
983
+ }
984
+ }
985
+ return $categoryIds;
986
+ } else {
987
+
988
+ // merge unspsc to current name in unspsc & name path's
989
+ $categoryMergedArray = $this->_categoryMapper($categories, $unspscPath);
990
+ // get max created parent category
991
+ $categoryCreateArray = array();
992
+ for ($i = count($categoryMergedArray) - 1; $i >= 0; $i--) {
993
+ $category = $categoryMergedArray[$i];
994
+ $checkCategoryId = $this->_getCategoryIdByUnspsc($category['unspsc']);
995
+ if ($checkCategoryId != null) {
996
+ $categoryId = $this->_buildCategoryTree($checkCategoryId, $storeId, $categoryCreateArray, $categoryActive);
997
+ $categoryIds[] = (int)$categoryId;
998
+ break;
999
+ } else {
1000
+ $categoryCreateArray[] = $category;
1001
+ }
1002
+ }
1003
+ return $categoryIds;
1004
+ }
1005
+ }
1006
+
1007
+ /**
1008
+ * @param $categoryPath
1009
+ * @param $unspscPath
1010
+ * @return array
1011
+ * @throws Mage_Core_Exception
1012
+ */
1013
+ protected function _categoryMapper($categoryPath, $unspscPath)
1014
+ {
1015
+ $nameArray = explode('/', $categoryPath);
1016
+ $unspscArray = explode('/', $unspscPath);
1017
+
1018
+ if (count($nameArray) != count($unspscArray)) {
1019
+ $message = Mage::helper('catalog')->__('Skip import row, @categories data is invalid');
1020
+ Mage::throwException($message);
1021
+ }
1022
+
1023
+ $categoryMergedArray = array(
1024
+ array(
1025
+ 'unspsc' => 'default_root',
1026
+ 'name' => 'Default category'
1027
+ )
1028
+ );
1029
+
1030
+ for ($i = 0; $i < count($unspscArray); $i++) {
1031
+ $categoryMergedArray[] = array('name' => $nameArray[$i],
1032
+ 'unspsc' => $unspscArray[$i]);
1033
+ }
1034
+
1035
+ return $categoryMergedArray;
1036
+ }
1037
+
1038
+ /**
1039
+ * @param $unspsc
1040
+ * @return int|null
1041
+ */
1042
+ protected function _getCategoryIdByUnspsc($unspsc)
1043
+ {
1044
+ if ($unspsc == 'default_root') {
1045
+ return Mage::app()->getStore(1)->getRootCategoryId();
1046
+ } else {
1047
+ $categoryId = $this->_connRes->fetchRow(
1048
+ "SELECT entity_id
1049
+ FROM `{$this->_tablePrefix}catalog_category_entity_varchar`
1050
+ WHERE `value` REGEXP '[[:<:]]".$unspsc."[[:>:]]'
1051
+ AND attribute_id = @unspsc_id"
1052
+ );
1053
+ return ($categoryId['entity_id']) ? $categoryId['entity_id'] : null;
1054
+ }
1055
+ }
1056
+
1057
+ /**
1058
+ * @param $parentCategoryId
1059
+ * @param $storeId
1060
+ * @param $pathArray
1061
+ * @param int $categoryActive
1062
+ * @return mixed
1063
+ */
1064
+ protected function _buildCategoryTree($parentCategoryId, $storeId, $pathArray, $categoryActive = 0)
1065
+ {
1066
+ for ($i = count($pathArray) - 1; $i >= 0; $i--) {
1067
+ $category = $pathArray[$i];
1068
+ $parentCategoryId = $this->_createCategory($parentCategoryId, $category['unspsc'], $storeId, $category['name'], $categoryActive);
1069
+ }
1070
+
1071
+ return $parentCategoryId;
1072
+ }
1073
+
1074
+ /**
1075
+ * @param $parentId
1076
+ * @param $unspsc
1077
+ * @param $storeId
1078
+ * @param $name
1079
+ * @param int $categoryActive
1080
+ * @return mixed
1081
+ */
1082
+ protected function _createCategory($parentId, $unspsc, $storeId, $name, $categoryActive = 0)
1083
+ {
1084
+
1085
+ $addCategory = "SELECT @tPath := `path`, @tLevel := `level`
1086
+ FROM `{$this->_tablePrefix}catalog_category_entity`
1087
+ WHERE `entity_id` = :parent_id;";
1088
+ $addCategory .= "SET @tLevel = @tLevel +1;";
1089
+
1090
+ $addCategory .= "SET @path := CONCAT(@tPath, '/',(SELECT MAX(entity_id) FROM `{$this->_tablePrefix}catalog_category_entity`) +1 );";
1091
+
1092
+ $addCategory .= "INSERT INTO `{$this->_tablePrefix}catalog_category_entity` (`entity_type_id`, `attribute_set_id`, `parent_id`, `created_at`, `path`, `position`, `level`, `children_count`)
1093
+ VALUES (@category_entity_type_id, 0, :parent_id, NOW(), @path, 1, @tLevel, 0);";
1094
+
1095
+ $addCategory .= "SELECT @catId := LAST_INSERT_ID();";
1096
+
1097
+ $addCategory .= "UPDATE `{$this->_tablePrefix}catalog_category_entity`
1098
+ SET `path` = CONCAT(@tPath, '/', @catId)
1099
+ WHERE entity_id = LAST_INSERT_ID();";
1100
+
1101
+ $addCategory .= "UPDATE `{$this->_tablePrefix}catalog_category_entity`
1102
+ SET children_count = children_count +1
1103
+ WHERE entity_id = :parent_id;";
1104
+
1105
+ $addCategory .= "INSERT IGNORE INTO `{$this->_tablePrefix}catalog_category_entity_int` (`entity_type_id`, `attribute_id`,`store_id`, `entity_id`, `value`)
1106
+ VALUES (@category_entity_type_id, @category_active_id, 0, @catId, :category_active),
1107
+ (@category_entity_type_id, @category_active_id, :store, @catId, :category_active),
1108
+ (@category_entity_type_id, @category_is_anchor_id, 0, @catId, 1),
1109
+ (@category_entity_type_id, @category_is_anchor_id, :store, @catId, 1),
1110
+ (@category_entity_type_id, @include_nav_bar_id, 0, @catId, 1),
1111
+ (@category_entity_type_id, @include_nav_bar_id, :store, @catId, 1);";
1112
+
1113
+ $addCategory .= "INSERT IGNORE INTO `{$this->_tablePrefix}catalog_category_entity_varchar` (`entity_type_id`, `attribute_id`, `store_id`, `entity_id`, `value`)
1114
+ VALUES (@category_entity_type_id, @category_name_id, 0, @catId, :category_name),
1115
+ (@category_entity_type_id, @category_name_id, :store, @catId, :category_name),
1116
+ (@category_entity_type_id, @unspsc_id, 0, @catId, :unspsc_val),
1117
+ (@category_entity_type_id, @unspsc_id, :store, @catId, :unspsc_val);
1118
+ ";
1119
+
1120
+ $this->_connRes->query($addCategory, array(
1121
+ ':store' => $storeId,
1122
+ ':parent_id' => $parentId,
1123
+ ':category_name' => $name,
1124
+ ':unspsc_val' => $unspsc,
1125
+ ':category_active' => (int)$categoryActive
1126
+ ));
1127
+
1128
+ $categoryIdFetch = $this->_connRes->fetchRow('SELECT @catId AS category_id');
1129
+
1130
+ return $categoryIdFetch['category_id'];
1131
+ }
1132
+
1133
+ /**
1134
+ * @param array $importData
1135
+ * @return array
1136
+ */
1137
+ protected function _mapAttributes(array $importData)
1138
+ {
1139
+
1140
+ // map iceimport attributes, skip some attributes
1141
+ $iceAttributes = array();
1142
+ foreach ($importData as $attribute => $value) {
1143
+ // map iceimport attributes
1144
+ if ($attribute == 'sku' ||
1145
+ $attribute == 'attribute_set' ||
1146
+ $attribute == 'categories' ||
1147
+ $attribute == 'unspsc' ||
1148
+ $attribute == 'price' ||
1149
+ $attribute == 'qty' ||
1150
+ $attribute == 'status' ||
1151
+ $attribute == 'visibility' ||
1152
+ $attribute == 'store' ||
1153
+ $attribute == 'websites' ||
1154
+ $attribute == 'is_in_stock' ||
1155
+ $attribute == 'image' ||
1156
+ $attribute == 'unspsc_path' ||
1157
+ $attribute == 'stock_name' ||
1158
+ $attribute == 'tax_auvibel' ||
1159
+ $attribute == 'tax_bebat' ||
1160
+ $attribute == 'tax_recupel' ||
1161
+ $attribute == 'tax_reprobel'
1162
+ ) {
1163
+
1164
+ $iceAttributes[$attribute] = $value;
1165
+ unset($importData[$attribute]);
1166
+
1167
+ }
1168
+ // skip some attributes
1169
+ /** if ($attribute == 'type' ||
1170
+ $attribute == 'supplier_product_code' ||
1171
+ $attribute == 'supplier' ||
1172
+ $attribute == 'leader_categories' ||
1173
+ $attribute == 'leader_store' ||
1174
+ $attribute == 'sprice' ||
1175
+ $attribute == 'euprice' ||
1176
+ $attribute == 'icecat_product_id' ||
1177
+ $attribute == 'icecat_category_id' ||
1178
+ $attribute == 'icecat_vendor_id' ||
1179
+ $attribute == 'icecat_quality' ||
1180
+ $attribute == 'icecat_url' ||
1181
+ $attribute == 'icecat_thumbnail_img' ||
1182
+ $attribute == 'icecat_low_res_img' ||
1183
+ $attribute == 'icecat_high_res_img' ||
1184
+ $attribute == 'tax1' ||
1185
+ $attribute == 'tax2' ||
1186
+ $attribute == 'tax3' ||
1187
+ $attribute == 'tax4' ||
1188
+ $attribute == 'min_quantity' ||
1189
+ $attribute == 'loms' ||
1190
+ $attribute == 'image_label' ||
1191
+ $attribute == 'links_title' ||
1192
+ $attribute == 'small_image_label' ||
1193
+ $attribute == 'tax_rate' ||
1194
+ $attribute == 'gallery' ||
1195
+ $attribute == 'weight_type' ||
1196
+ $attribute == 'sku_type' ||
1197
+ $attribute == 'manage_stock' ||
1198
+ $attribute == 'minimal_price' ||
1199
+ $attribute == 'required_options' ||
1200
+ $attribute == 'samples_title' ||
1201
+ $attribute == 'shipment_type' ||
1202
+ $attribute == 'url_path' ||
1203
+ $attribute == 'recurring_profile' ||
1204
+ $attribute == 'product_keys'
1205
+ ) {
1206
+
1207
+ unset($importData[$attribute]);
1208
+
1209
+ } */
1210
+
1211
+ }
1212
+
1213
+ // map default attributes
1214
+ $productData = array();
1215
+ foreach ($this->_getDefaultAttributesList() as $backendType => $attributesList) {
1216
+ if ($backendType != 'spec') {
1217
+ foreach ($attributesList as $attribute) {
1218
+ if (isset($importData[$attribute]) && $importData[$attribute] != '') {
1219
+ $productData[$backendType][$attribute] = $importData[$attribute];
1220
+ unset($importData[$attribute]);
1221
+ }
1222
+ }
1223
+ } else {
1224
+ foreach ($attributesList as $attributeCode => $attributeSpecs) {
1225
+ if (isset($importData[$attributeCode]) && $importData[$attributeCode] != false) {
1226
+ $attributeSpecs['value'] = $importData[$attributeCode];
1227
+ $productData[$backendType][$attributeCode] = $attributeSpecs;
1228
+ unset($importData[$attributeCode]);
1229
+ }
1230
+ }
1231
+ }
1232
+ }
1233
+
1234
+ if (!empty($importData)) {
1235
+ foreach ($importData as $attributeCode => $value) {
1236
+ $frontendTypeFetch = $this->_connRes->fetchRow(
1237
+ "SELECT frontend_input FROM `{$this->_tablePrefix}eav_attribute` WHERE `attribute_code` = :code",
1238
+ array(':code' => $attributeCode)
1239
+ );
1240
+ if ($frontendTypeFetch['frontend_input'] == 'select') {
1241
+ $frontendType = $frontendTypeFetch['frontend_input'];
1242
+ if ($frontendType != 'static' && !empty($frontendType) && $value != '') {
1243
+ $productData[$frontendType][$attributeCode] = $value;
1244
+ unset($importData[$attributeCode]);
1245
+ }
1246
+ }
1247
+ }
1248
+ }
1249
+ // map custom attributes
1250
+ if (!empty($importData)) {
1251
+ foreach ($importData as $attributeCode => $value) {
1252
+ $backendTypeFetch = $this->_connRes->fetchRow("SELECT backend_type FROM `{$this->_tablePrefix}eav_attribute` WHERE `attribute_code` = :code", array(':code' => $attributeCode));
1253
+ $backendType = $backendTypeFetch['backend_type'];
1254
+ if (($backendType != 'static') && !empty($backendType) && $value != '') {
1255
+ $productData[$backendType][$attributeCode] = $value;
1256
+ unset($importData[$attributeCode]);
1257
+ }
1258
+ }
1259
+ }
1260
+
1261
+ $failedAttributes = array();
1262
+ if (count($importData) > 0) {
1263
+ $failedAttributes = array_keys($importData);
1264
+ }
1265
+
1266
+ return array(
1267
+ 'iceimportAttributes' => $iceAttributes,
1268
+ 'productData' => $productData,
1269
+ 'failedAttributes' => $failedAttributes
1270
+ );
1271
+
1272
+ }
1273
+
1274
+ /**
1275
+ * @return array
1276
+ */
1277
+ protected function _getDefaultAttributesList()
1278
+ {
1279
+
1280
+ return array(
1281
+ 'varchar' => array(
1282
+ 'gift_message_available',
1283
+ 'custom_design',
1284
+ 'msrp_display_actual_price_type',
1285
+ 'msrp_enabled',
1286
+ 'options_container',
1287
+ 'page_layout',
1288
+ 'mpn',
1289
+ 'name',
1290
+ 'url_key',
1291
+ 'meta_description',
1292
+ 'meta_title',
1293
+ ),
1294
+ 'int' => array(
1295
+ 'enable_googlecheckout',
1296
+ 'is_recurring',
1297
+ 'links_purchased_separately',
1298
+ 'links_exist',
1299
+ 'status',
1300
+ 'visibility',
1301
+ 'tax_class_id',
1302
+ 'color',
1303
+ 'price_view',
1304
+ 'manufacturer'
1305
+ ),
1306
+ 'text' => array(
1307
+ 'recurring_profile',
1308
+ 'description',
1309
+ 'custom_layout_update',
1310
+ 'meta_keyword',
1311
+ 'short_description',
1312
+ 'total_supplier_stock'
1313
+ ),
1314
+ 'decimal' => array(
1315
+ 'cost',
1316
+ 'group_price',
1317
+ 'weight',
1318
+ 'special_price',
1319
+ 'msrp',
1320
+ 'tax_auvibel',
1321
+ 'tax_bebat',
1322
+ 'tax_recupel',
1323
+ 'tax_reprobel'
1324
+ ),
1325
+ 'datetime' => array(
1326
+ 'custom_design_from',
1327
+ 'custom_design_to',
1328
+ 'news_from_date',
1329
+ 'news_to_date',
1330
+ 'special_from_date',
1331
+ 'special_to_date'
1332
+ ),
1333
+ 'spec' => array(
1334
+ 'is_qty_decimal' => array(
1335
+ 'prod_id_field' => 'product_id',
1336
+ 'table' => 'cataloginventory_stock_item',
1337
+ 'field' => 'is_qty_decimal'
1338
+ ),
1339
+ 'use_config_min_qty' => array(
1340
+ 'prod_id_field' => 'product_id',
1341
+ 'table' => 'cataloginventory_stock_item',
1342
+ 'field' => 'use_config_min_qty'
1343
+ ),
1344
+ 'use_config_min_sale_qty' => array(
1345
+ 'prod_id_field' => 'product_id',
1346
+ 'table' => 'cataloginventory_stock_item',
1347
+ 'field' => 'use_config_min_sale_qty'
1348
+ ),
1349
+ 'use_config_max_sale_qty' => array(
1350
+ 'prod_id_field' => 'product_id',
1351
+ 'table' => 'cataloginventory_stock_item',
1352
+ 'field' => 'use_config_max_sale_qty'
1353
+ ),
1354
+ 'use_config_manage_stock' => array(
1355
+ 'prod_id_field' => 'product_id',
1356
+ 'table' => 'cataloginventory_stock_item',
1357
+ 'field' => 'use_config_manage_stock'
1358
+ ),
1359
+ 'is_decimal_divided' => array(
1360
+ 'prod_id_field' => 'product_id',
1361
+ 'table' => 'cataloginventory_stock_item',
1362
+ 'field' => 'is_decimal_divided'
1363
+ ),
1364
+ 'use_config_backorders' => array(
1365
+ 'prod_id_field' => 'product_id',
1366
+ 'table' => 'cataloginventory_stock_item',
1367
+ 'field' => 'use_config_backorders'
1368
+ ),
1369
+ 'use_config_notify_stock_qty' => array(
1370
+ 'prod_id_field' => 'product_id',
1371
+ 'table' => 'cataloginventory_stock_item',
1372
+ 'field' => 'use_config_notify_stock_qty'
1373
+ ),
1374
+ 'max_sale_qty' => array(
1375
+ 'prod_id_field' => 'product_id',
1376
+ 'table' => 'cataloginventory_stock_item',
1377
+ 'field' => 'max_sale_qty'
1378
+ ),
1379
+ 'min_sale_qty' => array(
1380
+ 'prod_id_field' => 'product_id',
1381
+ 'table' => 'cataloginventory_stock_item',
1382
+ 'field' => 'min_sale_qty'
1383
+ ),
1384
+ 'notify_stock_qty' => array(
1385
+ 'prod_id_field' => 'product_id',
1386
+ 'table' => 'cataloginventory_stock_item',
1387
+ 'field' => 'notify_stock_qty'
1388
+ ),
1389
+ 'backorders' => array(
1390
+ 'prod_id_field' => 'product_id',
1391
+ 'table' => 'cataloginventory_stock_item',
1392
+ 'field' => 'backorders'
1393
+ ),
1394
+ 'created_at' => array(
1395
+ 'prod_id_field' => 'entity_id',
1396
+ 'table' => 'catalog_product_entity',
1397
+ 'field' => 'created_at'
1398
+ ),
1399
+ 'min_qty' => array(
1400
+ 'prod_id_field' => 'product_id',
1401
+ 'table' => 'cataloginventory_stock_item',
1402
+ 'field' => 'min_qty'
1403
+ ),
1404
+ 'updated_at' => array(
1405
+ 'prod_id_field' => 'entity_id',
1406
+ 'table' => 'catalog_product_entity',
1407
+ 'field' => 'updated_at'
1408
+ )
1409
+ )
1410
+ );
1411
+ }
1412
+
1413
+ /**
1414
+ * Count child categories products and set them inactive if they have no products
1415
+ *
1416
+ * @param $child_cat
1417
+ */
1418
+ public function CountChildProd($child_cat)
1419
+ {
1420
+ foreach ($child_cat as $cat) {
1421
+ $query = "SELECT `entity_id`
1422
+ FROM `{$this->_tablePrefix}catalog_category_entity`
1423
+ WHERE parent_id = :cat_id";
1424
+ $child_cat = $this->_connRes->fetchAll(
1425
+ $query,
1426
+ array(
1427
+ ':cat_id' => $cat['entity_id']
1428
+ )
1429
+ );
1430
+
1431
+ $query = "SELECT COUNT(*)
1432
+ FROM `{$this->_tablePrefix}catalog_category_product`
1433
+ WHERE category_id = :cat_id ";
1434
+ $cat_products = $this->_connRes->fetchRow(
1435
+ $query,
1436
+ array(
1437
+ ':cat_id' => $cat['entity_id']
1438
+ )
1439
+ );
1440
+
1441
+ if ($cat_products['COUNT(*)'] == 0 && empty($child_cat) && $this->_getRefreshSetting('update_hide_category') == 1) {
1442
+ $this->_connRes->query(
1443
+ "UPDATE `{$this->_tablePrefix}catalog_category_entity_int`
1444
+ SET `value` = 0
1445
+ WHERE `attribute_id` = @category_active_id
1446
+ AND entity_id = :cat_id",
1447
+ array(
1448
+ ':cat_id' => $cat['entity_id']
1449
+ )
1450
+ );
1451
+ } else if (!empty($child_cat)) {
1452
+ $this->CountChildProd($child_cat);
1453
+ }
1454
+ }
1455
+ }
1456
+
1457
+ /**
1458
+ * Run categories resorting procedure
1459
+ */
1460
+ private function _runCategoriesSorting()
1461
+ {
1462
+ // Check if this is last imported product
1463
+ // Do category sort and set categories without products to inactive
1464
+ $catCollection = Mage::getModel('catalog/category')
1465
+ ->getCollection()
1466
+ ->addAttributeToSort('name', 'ASC');
1467
+
1468
+ $category_sort = (int)Mage::getStoreConfig('iceshop_iceimport_importprod_root/importprod/category_sort');
1469
+ if ($category_sort == 1) {
1470
+ $position = 1;
1471
+ }
1472
+ foreach ($catCollection as $category) {
1473
+
1474
+ if ($category_sort) {
1475
+ $query = "UPDATE `{$this->_tablePrefix}catalog_category_entity` SET position = :position WHERE entity_id = :cat_id ";
1476
+ $this->_connRes->query($query, array(
1477
+ ':position' => $position++,
1478
+ ':cat_id' => $category->getId()
1479
+ ));
1480
+ }
1481
+
1482
+ $query = "SELECT COUNT(*) FROM `{$this->_tablePrefix}catalog_category_product` WHERE category_id = :cat_id ";
1483
+ $cat_products = $this->_connRes->fetchRow($query, array(
1484
+ ':cat_id' => $category->getId()
1485
+ ));
1486
+
1487
+ if ($cat_products['COUNT(*)'] == 0) {
1488
+ $query = "SELECT `entity_id` FROM `{$this->_tablePrefix}catalog_category_entity` WHERE parent_id = :cat_id";
1489
+ $child_cat = $this->_connRes->fetchAll($query, array(
1490
+ ':cat_id' => $category->getId()
1491
+ ));
1492
+
1493
+ if (isset($child_cat) && count($child_cat) > 0) {
1494
+ //Count child categories products and set them to inactive if they have no
1495
+ $this->CountChildProd($child_cat);
1496
+ } elseif($this->_getRefreshSetting('update_hide_category') == 1) {
1497
+ $this->_connRes->query("UPDATE `{$this->_tablePrefix}catalog_category_entity_int`
1498
+ SET `value` = 0 WHERE `attribute_id` = @category_active_id AND entity_id = :cat_id", array(
1499
+ ':cat_id' => $category->getId()
1500
+ ));
1501
+ }
1502
+ }
1503
+ }
1504
+ }
1505
+
1506
+ /**
1507
+ * @param object $DB_logger
1508
+ * @throws Exception
1509
+ */
1510
+ public function deleteOldProducts($DB_logger)
1511
+ {
1512
+ $delete_old_products = (int)Mage::getStoreConfig('iceshop_iceimport_importprod_root/importprod/delete_old_products');
1513
+ if ($delete_old_products) {
1514
+ try {
1515
+ $db_res = Mage::getSingleton('core/resource')->getConnection('core_write');
1516
+ $db_res->query("SELECT @is_iceimport_id := `attribute_id`
1517
+ FROM {$this->_tablePrefix}eav_attribute
1518
+ WHERE attribute_code = 'is_iceimport'");
1519
+
1520
+ $count_prod = $db_res->fetchRow("SELECT COUNT(*) AS count_prod
1521
+ FROM {$this->_tablePrefix}catalog_product_entity AS cpe
1522
+ JOIN {$this->_tablePrefix}catalog_product_entity_varchar AS cpev
1523
+ ON cpe.entity_id = cpev.entity_id
1524
+ AND cpev.value = 1
1525
+ AND cpev.attribute_id = @is_iceimport_id");
1526
+ $count_prod = $count_prod['count_prod'];
1527
+
1528
+ if ($count_prod > 0) {
1529
+ //iceimport products exists, amount > 0
1530
+ $count_del_prod = $db_res->fetchRow("SELECT COUNT(*) AS count__del_prod
1531
+ FROM {$this->_tablePrefix}catalog_product_entity AS cpe
1532
+ JOIN {$this->_tablePrefix}catalog_product_entity_varchar AS cpev
1533
+ ON cpe.entity_id = cpev.entity_id
1534
+ AND cpev.value = 1
1535
+ AND cpev.attribute_id = @is_iceimport_id
1536
+ LEFT JOIN {$this->_tablePrefix}iceshop_iceimport_imported_product_ids AS iip
1537
+ ON cpe.entity_id = iip.product_id
1538
+ WHERE iip.product_id IS NULL");
1539
+
1540
+ if(!empty($count_del_prod['count_del_prod'])){
1541
+ $count_del_prod = $count_del_prod['count_del_prod'];
1542
+ } else {
1543
+ $count_del_prod = 0;
1544
+ }
1545
+
1546
+ if ($count_del_prod > 0) {
1547
+ //iceimport products to delete exists, amount > 0
1548
+ $delete_old_products_tolerance = (int)Mage::getStoreConfig('iceshop_iceimport_importprod_root/importprod/delete_old_products_tolerance');
1549
+
1550
+ if (round(($count_del_prod / $count_prod * 100), 0) < $delete_old_products_tolerance) {
1551
+
1552
+ //iceimport products to delete franction is less than allowed tolerance, deletion approved
1553
+ $DB_logger->insertLogEntry('iceimport_count_delete_product', $count_del_prod);
1554
+ $db_res->query("DELETE cpe
1555
+ FROM {$this->_tablePrefix}catalog_product_entity AS cpe
1556
+ JOIN {$this->_tablePrefix}catalog_product_entity_varchar AS cpev
1557
+ ON cpe.entity_id = cpev.entity_id
1558
+ AND cpev.value = 1
1559
+ AND cpev.attribute_id = @is_iceimport_id
1560
+ LEFT JOIN {$this->_tablePrefix}iceshop_iceimport_imported_product_ids AS iip
1561
+ ON cpe.entity_id = iip.product_id
1562
+ WHERE iip.product_id IS NULL");
1563
+
1564
+ $db_res->query("DELETE FROM {$this->_tablePrefix}iceshop_iceimport_imported_product_ids");
1565
+ } else {
1566
+ $error_message = 'Attempt to delete more old products than allowed in Iceimport configuration. Interruption of the process.';
1567
+ $DB_logger->insertLogEntry('error' . md5(microtime(true)), $error_message, 'error');
1568
+ $error_message2 = 'Old product percentage: ' . round(($count_del_prod / $count_prod * 100), 0) . '%';
1569
+ $DB_logger->insertLogEntry('error' . md5(microtime(true)), $error_message2, 'error');
1570
+ print $error_message;
1571
+ exit;
1572
+ }
1573
+ }
1574
+ }
1575
+ } catch (Exception $e) {
1576
+ throw new Exception($e->getMessage());
1577
+ }
1578
+ }
1579
+ }
1580
+
1581
+ /**
1582
+ * @throws Exception
1583
+ */
1584
+ public function finish()
1585
+ {
1586
+ /**
1587
+ * Back compatibility event
1588
+ */
1589
+ $DB_logger = Mage::helper('iceimport/db');
1590
+ $tablePrefix = '';
1591
+ $tPrefix = (array)Mage::getConfig()->getTablePrefix();
1592
+ if (!empty($tPrefix)) {
1593
+ $tablePrefix = $tPrefix[0];
1594
+ }
1595
+ $count_imported_products = $DB_logger->getRowsCount($tablePrefix . "iceshop_iceimport_imported_product_ids");
1596
+ $DB_logger->insertLogEntry('iceimport_count_imported_products', $count_imported_products);
1597
+
1598
+ Mage::dispatchEvent($this->_eventPrefix . '_after', array());
1599
+
1600
+ $entity = new Varien_Object();
1601
+ Mage::getSingleton('index/indexer')->processEntityAction(
1602
+ $entity,
1603
+ self::ENTITY,
1604
+ Mage_Index_Model_Event::TYPE_SAVE
1605
+ );
1606
+ }
1607
+
1608
+
1609
+ /**
1610
+ * Method return id categoryees where 'unspsc' empty.
1611
+ * @param intneger $store_id
1612
+ * @return array
1613
+ */
1614
+ public function getCategoryIdEmtyUnspsc($store_id=0){
1615
+
1616
+ $db_res = Mage::getSingleton('core/resource')->getConnection('core_write');
1617
+ $query = "SELECT ccev.`entity_id` FROM `{$this->_tablePrefix}catalog_category_entity_varchar` AS ccev
1618
+ LEFT JOIN `{$this->_tablePrefix}eav_attribute` AS ea
1619
+ ON ea.`attribute_id` = ccev.`attribute_id`
1620
+ WHERE ea.`attribute_code`='unspsc' AND ccev.`value` IS NULL AND ccev.`store_id`=:store_id;";
1621
+
1622
+ return $this->_connRes->fetchAll($query, array( ':store_id' => $store_id ));
1623
+ }
1624
+ }
app/code/community/ICEshop/Iceimport/Model/Dataflow/Convert/Parser/Csv.php CHANGED
@@ -22,7 +22,7 @@ class ICEshop_Iceimport_Model_Dataflow_Convert_Parser_Csv extends Mage_Dataflow_
22
  $default_attr_set_id = Mage::getModel('catalog/product')->getResource()->getEntityType()->getDefaultAttributeSetId();
23
  $attributes = Mage::getModel('catalog/product_attribute_api')->items($default_attr_set_id);
24
 
25
- $req_attributes = array('brand_name', 'ean', 'mpn', 'delivery_eta', 'is_iceimport');
26
  $not_found_attr = array();
27
  foreach ($req_attributes as $req_attribute) {
28
  foreach ($attributes as $_attribute) {
@@ -98,7 +98,7 @@ class ICEshop_Iceimport_Model_Dataflow_Convert_Parser_Csv extends Mage_Dataflow_
98
  $countRows = 0;
99
  $currentRow = 0;
100
  $maxRows = (int)Mage::getStoreConfig(
101
- 'importprod_root/importprod/iceimport_batch_size',
102
  Mage::app()
103
  ->getWebsite()
104
  ->getDefaultGroup()
@@ -126,7 +126,7 @@ class ICEshop_Iceimport_Model_Dataflow_Convert_Parser_Csv extends Mage_Dataflow_
126
  $currentRow++;
127
 
128
  }
129
- if ($currentRow < $maxRows && $currentRow != 0) {
130
  $batchImportModel = $this->getBatchImportModel()
131
  ->setBatchId($this->getBatchModel()->getId())
132
  ->setBatchData($itemData)->setStatus(1);
@@ -158,4 +158,4 @@ class ICEshop_Iceimport_Model_Dataflow_Convert_Parser_Csv extends Mage_Dataflow_
158
  return $this;
159
  }
160
 
161
- }
22
  $default_attr_set_id = Mage::getModel('catalog/product')->getResource()->getEntityType()->getDefaultAttributeSetId();
23
  $attributes = Mage::getModel('catalog/product_attribute_api')->items($default_attr_set_id);
24
 
25
+ $req_attributes = array('brand_name', 'ean', 'mpn', 'is_iceimport');
26
  $not_found_attr = array();
27
  foreach ($req_attributes as $req_attribute) {
28
  foreach ($attributes as $_attribute) {
98
  $countRows = 0;
99
  $currentRow = 0;
100
  $maxRows = (int)Mage::getStoreConfig(
101
+ 'iceshop_iceimport_importprod_root/importprod/iceimport_batch_size',
102
  Mage::app()
103
  ->getWebsite()
104
  ->getDefaultGroup()
126
  $currentRow++;
127
 
128
  }
129
+ if ($currentRow <= $maxRows && $currentRow != 0 && !empty($itemData)) {
130
  $batchImportModel = $this->getBatchImportModel()
131
  ->setBatchId($this->getBatchModel()->getId())
132
  ->setBatchData($itemData)->setStatus(1);
158
  return $this;
159
  }
160
 
161
+ }
app/code/community/ICEshop/Iceimport/Model/Observer.php CHANGED
@@ -1,165 +1,199 @@
1
- <?php
2
-
3
- class ICEshop_Iceimport_Model_Observer
4
- {
5
- /**
6
- * Our process ID.
7
- * @var int
8
- */
9
- private $process_id = 'iceshop_iceimport';
10
-
11
- /**
12
- * @var array
13
- */
14
- private $indexProcess;
15
-
16
- protected function _construct()
17
- {
18
- $this->_init('iceimport/observer');
19
- }
20
-
21
-
22
- /**
23
- * load
24
- * @access public
25
- * @throws Exception
26
- */
27
- public function load()
28
- {
29
- //init logger
30
- $DB_logger = Mage::helper('iceimport/db');
31
- $date = date('m/d/Y H:i:s');
32
- $DB_logger->insertLogEntry('iceimport_import_status_cron', 'Started');
33
- $DB_logger->insertLogEntry('iceimport_import_started', $date);
34
- $DB_logger->insertLogEntry('iceimport_import_ended', '');
35
-
36
- //init DB data
37
- $db_res = Mage::getSingleton('core/resource')->getConnection('core_write');
38
- $tablePrefix = '';
39
- $tPrefix = (array)Mage::getConfig()->getTablePrefix();
40
- if (!empty($tPrefix)) {
41
- $tablePrefix = $tPrefix[0];
42
- }
43
-
44
- //service actions
45
- ini_set('max_execution_time', 0);
46
- ini_set("memory_limit", "512M");
47
- $profileId = 3;
48
- $logFileName = 'test.log';
49
- $recordCount = 0;
50
-
51
- //checking locks
52
- $this->indexProcess = new Mage_Index_Model_Process();
53
- $this->indexProcess->setId($this->process_id);
54
- if ($this->indexProcess->isLocked()) {
55
- print 'Error! Another iceimport module cron process is running!';
56
- die();
57
- }
58
- $this->indexProcess->lockAndBlock();
59
-
60
- Mage::log("Import Started", null, $logFileName);
61
-
62
- //basic action fired
63
- $profile = Mage::getModel('dataflow/profile');
64
- $userModel = Mage::getModel('admin/user');
65
- $userModel->setUserId(0);
66
- Mage::getSingleton('admin/session')->setUser($userModel);
67
- if ($profileId) {
68
- $profile->load($profileId);
69
- if (!$profile->getId()) {
70
- Mage::getSingleton('adminhtml/session')->addError('The profile that you are trying to save no longer exists');
71
- }
72
- }
73
- $profile->run();
74
- $batchModel = Mage::getSingleton('dataflow/batch');
75
-
76
- //batch processing
77
- if ($batchModel->getId()) {
78
- if ($batchModel->getAdapter()) {
79
-
80
- $batchId = $batchModel->getId();
81
- $batchImportModel = $batchModel->getBatchImportModel();
82
- $importIds = $batchImportModel->getIdCollection();
83
-
84
- $batchModel = Mage::getModel('dataflow/batch')->load($batchId);
85
- $adapter = Mage::getModel($batchModel->getAdapter());
86
-
87
- // delete previous products id
88
- $DB_logger->insertLogEntry('iceimport_import_status_cron', 'Running');
89
- try {
90
- $db_res->query("DELETE FROM {$tablePrefix}iceshop_iceimport_imported_product_ids");
91
- } catch (Exception $e) {
92
- $DB_logger->insertLogEntry('iceimport_import_status_cron', 'Failed');
93
- throw new Exception($e->getMessage());
94
- }
95
- foreach ($importIds as $importId) {
96
-
97
- $recordCount++;
98
- try {
99
- $batchImportModel->load($importId);
100
- if (!$batchImportModel->getId()) {
101
- $errors[] = Mage::helper('dataflow')->__('Skip undefined row');
102
- continue;
103
- }
104
-
105
- $importData = $batchImportModel->getBatchData();
106
-
107
- try {
108
- $adapter->saveRow($importData);
109
- } catch (Exception $e) {
110
- $DB_logger->insertLogEntry('iceimport_import_status_cron', 'Failed');
111
- Mage::log($e->getMessage(), null, $logFileName);
112
- continue;
113
- }
114
-
115
- } catch (Exception $ex) {
116
- if (!empty($importData['sku'])) {
117
- Mage::log('Record# ' . $recordCount . ' - SKU = ' . $importData['sku'] . ' - Error - ' . $ex->getMessage(), null, $logFileName);
118
- } else {
119
- Mage::log('Record# ' . $recordCount . ' - SKU = undefined - Error - ' . $ex->getMessage(), null, $logFileName);
120
- }
121
- }
122
- }
123
-
124
- //run cleanup of old products
125
- $adapter->deleteOldProducts($DB_logger);
126
-
127
- //run image queue processing
128
- $adapter->processImageQueue($logFileName);
129
-
130
- $processes = Mage::getSingleton('index/indexer')->getProcessesCollection();
131
- $processes->walk('reindexAll');
132
-
133
- foreach ($profile->getExceptions() as $e) {
134
- Mage::log($e->getMessage(), null, $logFileName);
135
- }
136
- }
137
- }
138
- print 'Import Completed';
139
-
140
- //drop locks
141
- $this->indexProcess->unlock();
142
-
143
- //extra logging
144
- Mage::log("Import Completed", null, $logFileName);
145
- $count_imported_products = $DB_logger->getRowsCount($tablePrefix . "iceshop_iceimport_imported_product_ids");
146
- $DB_logger->insertLogEntry('iceimport_count_imported_products', $count_imported_products);
147
-
148
- // clear dataflow_batch_import table
149
- try {
150
- $db_res->query("DELETE FROM {$tablePrefix}iceshop_iceimport_imported_product_ids");
151
- $db_res->query("TRUNCATE {$tablePrefix}dataflow_batch_import");
152
- } catch (Exception $e) {
153
- $DB_logger->insertLogEntry('iceimport_import_status_cron', 'Failed');
154
- throw new Exception($e->getMessage());
155
- }
156
-
157
- //extra logging
158
- $DB_logger->insertLogEntry('iceimport_import_status_cron', 'Finished');
159
- $date = date('m/d/Y H:i:s');
160
- $DB_logger->insertLogEntry('iceimport_import_ended', $date);
161
-
162
- unset($db_res, $DB_logger, $date, $profile, $profileId, $logFileName);
163
- }
164
-
165
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class ICEshop_Iceimport_Model_Observer
4
+ {
5
+ /**
6
+ * Our process ID.
7
+ * @var int
8
+ */
9
+ private $process_id = 'iceshop_iceimport';
10
+
11
+ /**
12
+ * @var array
13
+ */
14
+ private $indexProcess;
15
+
16
+ protected function _construct()
17
+ {
18
+ $this->_init('iceimport/observer');
19
+ }
20
+
21
+
22
+ /**
23
+ * load
24
+ * @access public
25
+ * @throws Exception
26
+ */
27
+ public function load()
28
+ {
29
+ //init logger
30
+ $DB_logger = Mage::helper('iceimport/db');
31
+ $date_crone_start = date('Y-m-d H:i:s');
32
+ $date = date('m/d/Y H:i:s');
33
+ $DB_logger->insertLogEntry('iceimport_import_status_cron', 'Started');
34
+ $DB_logger->insertLogEntry('iceimport_import_started', $date);
35
+ $DB_logger->insertLogEntry('iceimport_import_ended', '');
36
+ $this->setCroneStatus('running',$date_crone_start);
37
+
38
+
39
+
40
+ //init DB data
41
+ $db_res = Mage::getSingleton('core/resource')->getConnection('core_write');
42
+ $tablePrefix = '';
43
+ $tPrefix = (array)Mage::getConfig()->getTablePrefix();
44
+ if (!empty($tPrefix)) {
45
+ $tablePrefix = $tPrefix[0];
46
+ }
47
+
48
+ //service actions
49
+ // ini_set('max_execution_time', 360 );
50
+ // ini_set("memory_limit", "512M");
51
+ ini_set('max_execution_time', 0);
52
+ ini_set("memory_limit","-1");
53
+ $profileId = 3;
54
+ $logFileName = 'test.log';
55
+ $recordCount = 0;
56
+
57
+ //checking locks
58
+ $this->indexProcess = new Mage_Index_Model_Process();
59
+ $this->indexProcess->setId($this->process_id);
60
+ if ($this->indexProcess->isLocked()) {
61
+ print 'Error! Another iceimport module cron process is running!';
62
+ die();
63
+ }
64
+ $this->indexProcess->lockAndBlock();
65
+
66
+ Mage::log("Import Started", null, $logFileName);
67
+
68
+ //basic action fired
69
+ $profile = Mage::getModel('dataflow/profile');
70
+ $userModel = Mage::getModel('admin/user');
71
+ $userModel->setUserId(0);
72
+ Mage::getSingleton('admin/session')->setUser($userModel);
73
+ if ($profileId) {
74
+ $profile->load($profileId);
75
+ if (!$profile->getId()) {
76
+ Mage::getSingleton('adminhtml/session')->addError('The profile that you are trying to save no longer exists');
77
+ }
78
+ }
79
+ $profile->run();
80
+ $batchModel = Mage::getSingleton('dataflow/batch');
81
+
82
+ //batch processing
83
+ if ($batchModel->getId()) {
84
+ if ($batchModel->getAdapter()) {
85
+
86
+ $batchId = $batchModel->getId();
87
+ $batchImportModel = $batchModel->getBatchImportModel();
88
+ $importIds = $batchImportModel->getIdCollection();
89
+
90
+ $batchModel = Mage::getModel('dataflow/batch')->load($batchId);
91
+ $adapter = Mage::getModel($batchModel->getAdapter());
92
+ $run_only_images = 0;
93
+ try {
94
+ if (method_exists($adapter, 'getAdapterSetting')) {
95
+ $run_only_images = $adapter->getAdapterSetting('iceshop_iceimport_importprod_root/importprod/images_queue_processing_only');
96
+ }
97
+ } catch(Exception $e) {}
98
+
99
+ // delete previous products id
100
+ $DB_logger->insertLogEntry('iceimport_import_status_cron', 'Running');
101
+ try {
102
+ $db_res->query("DELETE FROM {$tablePrefix}iceshop_iceimport_imported_product_ids");
103
+ } catch (Exception $e) {
104
+ $DB_logger->insertLogEntry('iceimport_import_status_cron', 'Failed');
105
+ throw new Exception($e->getMessage());
106
+ }
107
+ if ($run_only_images == 0) {
108
+ foreach ($importIds as $importId) {
109
+
110
+ $recordCount++;
111
+ try {
112
+ $batchImportModel->load($importId);
113
+ if (!$batchImportModel->getId()) {
114
+ $errors[] = Mage::helper('dataflow')->__('Skip undefined row');
115
+ continue;
116
+ }
117
+
118
+ $importData = $batchImportModel->getBatchData();
119
+ $importData['batchId'] = $batchId;
120
+
121
+ try {
122
+ $adapter->saveRow($importData);
123
+ } catch (Exception $e) {
124
+ $DB_logger->insertLogEntry('iceimport_import_status_cron', 'Failed');
125
+ Mage::log($e->getMessage(), null, $logFileName);
126
+ continue;
127
+ }
128
+
129
+ } catch (Exception $ex) {
130
+ if (!empty($importData['sku'])) {
131
+ Mage::log('Record# ' . $recordCount . ' - SKU = ' . $importData['sku'] . ' - Error - ' . $ex->getMessage(), null, $logFileName);
132
+ } else {
133
+ Mage::log('Record# ' . $recordCount . ' - SKU = undefined - Error - ' . $ex->getMessage(), null, $logFileName);
134
+ }
135
+ }
136
+ }
137
+ }
138
+
139
+ //run image queue processing
140
+ $adapter->processImageQueue($logFileName);
141
+
142
+ $processes = Mage::getSingleton('index/indexer')->getProcessesCollection();
143
+ $processes->walk('reindexAll');
144
+
145
+ foreach ($profile->getExceptions() as $e) {
146
+ Mage::log($e->getMessage(), null, $logFileName);
147
+ }
148
+ }
149
+ }
150
+ print 'Import Completed';
151
+
152
+ //drop locks
153
+ $this->indexProcess->unlock();
154
+
155
+ //extra logging
156
+ Mage::log("Import Completed", null, $logFileName);
157
+ $count_imported_products = $DB_logger->getRowsCount($tablePrefix . "iceshop_iceimport_imported_product_ids");
158
+ $DB_logger->insertLogEntry('iceimport_count_imported_products', $count_imported_products);
159
+
160
+ // clear dataflow_batch_import table
161
+ try {
162
+ $db_res->query("DELETE FROM {$tablePrefix}iceshop_iceimport_imported_product_ids");
163
+ $db_res->query("TRUNCATE {$tablePrefix}dataflow_batch_import");
164
+ } catch (Exception $e) {
165
+ $DB_logger->insertLogEntry('iceimport_import_status_cron', 'Failed');
166
+ throw new Exception($e->getMessage());
167
+ }
168
+ //extra logging
169
+ $DB_logger->insertLogEntry('iceimport_import_status_cron', 'Finished');
170
+ $date = date('m/d/Y H:i:s');
171
+ $DB_logger->insertLogEntry('iceimport_import_ended', $date);
172
+ $this->setCroneStatus('finished', $date);
173
+
174
+
175
+
176
+ unset($db_res, $DB_logger, $date, $profile, $profileId, $logFileName);
177
+ }
178
+
179
+ /**
180
+ * Change crone status in table `cron_schedule`
181
+ * @param string $status
182
+ * @param string $date_crone_start
183
+ */
184
+ public function setCroneStatus($status = 'pending',$date_crone_start){
185
+ try{
186
+ $db_res = Mage::getSingleton('core/resource')->getConnection('core_write');
187
+ $tablePrefix = '';
188
+ $tPrefix = (array)Mage::getConfig()->getTablePrefix();
189
+ if (!empty($tPrefix)) {
190
+ $tablePrefix = $tPrefix[0];
191
+ }
192
+ $db_res->query("UPDATE `{$tablePrefix}cron_schedule` SET status='$status' WHERE job_code = 'iceshop_iceimport' AND executed_at='$date_crone_start'");
193
+ } catch (Exception $e){
194
+
195
+ }
196
+ }
197
+
198
+ }
199
+
app/code/community/ICEshop/Iceimport/Model/System/Config/Defaulttax.php CHANGED
@@ -1,20 +1,20 @@
1
- <?php
2
-
3
- class ICEshop_Iceimport_Model_System_Config_Defaulttax
4
- {
5
- public function toOptionArray()
6
- {
7
- $collection = Mage::getModel('tax/class')->getCollection();
8
- $paramsArray = array();
9
- $paramsArray['0'] = 'None';
10
-
11
- foreach ($collection as $product) {
12
- $tax = $product->getData();
13
- $paramsArray[$tax['class_id']] = $tax['class_name'];
14
- }
15
-
16
- return $paramsArray;
17
- }
18
- }
19
-
20
  ?>
1
+ <?php
2
+
3
+ class ICEshop_Iceimport_Model_System_Config_Defaulttax
4
+ {
5
+ public function toOptionArray()
6
+ {
7
+ $collection = Mage::getModel('tax/class')->getCollection();
8
+ $paramsArray = array();
9
+ $paramsArray['0'] = 'None';
10
+
11
+ foreach ($collection as $product) {
12
+ $tax = $product->getData();
13
+ $paramsArray[$tax['class_id']] = $tax['class_name'];
14
+ }
15
+
16
+ return $paramsArray;
17
+ }
18
+ }
19
+
20
  ?>
app/code/community/ICEshop/Iceimport/etc/adminhtml.xml CHANGED
@@ -8,10 +8,10 @@
8
  <children>
9
  <config>
10
  <children>
11
- <importprod_root>
12
- <title>iceimport Settings</title>
13
  <sort_order>0</sort_order>
14
- </importprod_root>
15
  <iceimport_information>
16
  <title>Iceimport Information</title>
17
  <sort_order>30</sort_order>
8
  <children>
9
  <config>
10
  <children>
11
+ <iceshop_iceimport_importprod_root>
12
+ <title>Iceimport Settings</title>
13
  <sort_order>0</sort_order>
14
+ </iceshop_iceimport_importprod_root>
15
  <iceimport_information>
16
  <title>Iceimport Information</title>
17
  <sort_order>30</sort_order>
app/code/community/ICEshop/Iceimport/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <ICEshop_Iceimport>
5
- <version>1.7.5</version>
6
  </ICEshop_Iceimport>
7
  </modules>
8
  <admin>
@@ -110,14 +110,15 @@
110
  </jobs>
111
  </crontab>
112
  <default>
113
- <importprod_root>
114
  <importprod>
115
  <category_active>1</category_active>
116
  <category_sort>1</category_sort>
117
  <delete_old_products>1</delete_old_products>
118
  <import_product_ean>1</import_product_ean>
119
  <import_product_mpn>1</import_product_mpn>
120
- <import_product_brand>1</import_product_brand>
 
121
  <import_product_name>1</import_product_name>
122
  <import_product_short_description>1</import_product_short_description>
123
  <import_product_description>1</import_product_description>
@@ -125,7 +126,8 @@
125
  <import_product_summary_description>1</import_product_summary_description>
126
  <import_prices>1</import_prices>
127
  <import_stock>1</import_stock>
128
- <import_delivery_eta>1</import_delivery_eta>
 
129
  <import_images>1</import_images>
130
  <update_categories_from_csv>1</update_categories_from_csv>
131
  <update_status_from_csv>1</update_status_from_csv>
@@ -136,7 +138,8 @@
136
  <iceimport_batch_size>10</iceimport_batch_size>
137
  <import_new_products>1</import_new_products>
138
  <delete_old_products_tolerance>25</delete_old_products_tolerance>
 
139
  </importprod>
140
- </importprod_root>
141
  </default>
142
  </config>
2
  <config>
3
  <modules>
4
  <ICEshop_Iceimport>
5
+ <version>1.7.11</version>
6
  </ICEshop_Iceimport>
7
  </modules>
8
  <admin>
110
  </jobs>
111
  </crontab>
112
  <default>
113
+ <iceshop_iceimport_importprod_root>
114
  <importprod>
115
  <category_active>1</category_active>
116
  <category_sort>1</category_sort>
117
  <delete_old_products>1</delete_old_products>
118
  <import_product_ean>1</import_product_ean>
119
  <import_product_mpn>1</import_product_mpn>
120
+ <!--<import_product_brand>1</import_product_brand>-->
121
+ <import_product_brand_name>1</import_product_brand_name>
122
  <import_product_name>1</import_product_name>
123
  <import_product_short_description>1</import_product_short_description>
124
  <import_product_description>1</import_product_description>
126
  <import_product_summary_description>1</import_product_summary_description>
127
  <import_prices>1</import_prices>
128
  <import_stock>1</import_stock>
129
+ <!--<import_delivery_eta>1</import_delivery_eta>-->
130
+ <import_product_delivery_eta>1</import_product_delivery_eta>
131
  <import_images>1</import_images>
132
  <update_categories_from_csv>1</update_categories_from_csv>
133
  <update_status_from_csv>1</update_status_from_csv>
138
  <iceimport_batch_size>10</iceimport_batch_size>
139
  <import_new_products>1</import_new_products>
140
  <delete_old_products_tolerance>25</delete_old_products_tolerance>
141
+ <images_queue_processing_only>0</images_queue_processing_only>
142
  </importprod>
143
+ </iceshop_iceimport_importprod_root>
144
  </default>
145
  </config>
app/code/community/ICEshop/Iceimport/etc/system.xml CHANGED
@@ -1,362 +1,372 @@
1
- <?xml version="1.0"?>
2
- <config>
3
- <tabs>
4
- <iceshop translate="label" module="iceimport">
5
- <label>Iceshop</label>
6
- <sort_order>150</sort_order>
7
- </iceshop>
8
- </tabs>
9
- <sections>
10
- <importprod_root translate="label" module="catalog">
11
- <class>separator-top</class>
12
- <label>IceImport Settings</label>
13
- <tab>iceshop</tab>
14
- <frontend_type>text</frontend_type>
15
- <sort_order>30</sort_order>
16
- <show_in_default>1</show_in_default>
17
- <show_in_website>1</show_in_website>
18
- <show_in_store>1</show_in_store>
19
- <groups>
20
- <importprod translate="label">
21
- <label>IceImport Settings</label>
22
- <frontend_type>text</frontend_type>
23
- <sort_order>50</sort_order>
24
- <show_in_default>1</show_in_default>
25
- <show_in_website>1</show_in_website>
26
- <show_in_store>1</show_in_store>
27
- <fields>
28
- <basic_settings_heading translate="label">
29
- <label>Content Settings</label>
30
- <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
31
- <sort_order>0</sort_order>
32
- <show_in_default>1</show_in_default>
33
- <show_in_website>1</show_in_website>
34
- <show_in_store>1</show_in_store>
35
- </basic_settings_heading>
36
- <basic_settings_note translate="label">
37
- <label><![CDATA[<strong>Caution!</strong>]]></label>
38
- <comment><![CDATA[All the settings in this section are valid and used only for existing products, for new products the value is Yes and it can't be changed]]></comment>
39
- <frontend_type>label</frontend_type>
40
- <sort_order>1</sort_order>
41
- <show_in_default>1</show_in_default>
42
- <show_in_website>1</show_in_website>
43
- <show_in_store>1</show_in_store>
44
- </basic_settings_note>
45
- <import_product_ean translate="label">
46
- <label>Update EAN</label>
47
- <frontend_type>select</frontend_type>
48
- <source_model>iceimport/system_config_yesno</source_model>
49
- <sort_order>21</sort_order>
50
- <show_in_default>1</show_in_default>
51
- <show_in_website>1</show_in_website>
52
- <show_in_store>1</show_in_store>
53
- </import_product_ean>
54
- <import_product_mpn translate="label">
55
- <label>Update MPN</label>
56
- <frontend_type>select</frontend_type>
57
- <source_model>iceimport/system_config_yesno</source_model>
58
- <sort_order>22</sort_order>
59
- <show_in_default>1</show_in_default>
60
- <show_in_website>1</show_in_website>
61
- <show_in_store>1</show_in_store>
62
- </import_product_mpn>
63
- <import_product_brand translate="label">
64
- <label>Update brand</label>
65
- <frontend_type>select</frontend_type>
66
- <source_model>iceimport/system_config_yesno</source_model>
67
- <sort_order>23</sort_order>
68
- <show_in_default>1</show_in_default>
69
- <show_in_website>1</show_in_website>
70
- <show_in_store>1</show_in_store>
71
- <enabled>1</enabled>
72
- </import_product_brand>
73
- <import_product_name translate="label">
74
- <label>Update name</label>
75
- <frontend_type>select</frontend_type>
76
- <source_model>iceimport/system_config_yesno</source_model>
77
- <sort_order>24</sort_order>
78
- <show_in_default>1</show_in_default>
79
- <show_in_website>1</show_in_website>
80
- <show_in_store>1</show_in_store>
81
- </import_product_name>
82
- <import_product_short_description translate="label">
83
- <label>Update short description</label>
84
- <frontend_type>select</frontend_type>
85
- <source_model>iceimport/system_config_yesno</source_model>
86
- <sort_order>25</sort_order>
87
- <show_in_default>1</show_in_default>
88
- <show_in_website>1</show_in_website>
89
- <show_in_store>1</show_in_store>
90
- </import_product_short_description>
91
- <import_product_description translate="label">
92
- <label>Update description</label>
93
- <frontend_type>select</frontend_type>
94
- <source_model>iceimport/system_config_yesno</source_model>
95
- <sort_order>26</sort_order>
96
- <show_in_default>1</show_in_default>
97
- <show_in_website>1</show_in_website>
98
- <show_in_store>1</show_in_store>
99
- </import_product_description>
100
- <import_product_short_summary_description translate="label">
101
- <label>Update short summary description</label>
102
- <frontend_type>select</frontend_type>
103
- <source_model>iceimport/system_config_yesno</source_model>
104
- <sort_order>27</sort_order>
105
- <show_in_default>1</show_in_default>
106
- <show_in_website>1</show_in_website>
107
- <show_in_store>1</show_in_store>
108
- </import_product_short_summary_description>
109
- <import_product_summary_description translate="label">
110
- <label>Update summary description</label>
111
- <frontend_type>select</frontend_type>
112
- <source_model>iceimport/system_config_yesno</source_model>
113
- <sort_order>28</sort_order>
114
- <show_in_default>1</show_in_default>
115
- <show_in_website>1</show_in_website>
116
- <show_in_store>1</show_in_store>
117
- </import_product_summary_description>
118
- <import_prices translate="label">
119
- <label>Update prices</label>
120
- <frontend_type>select</frontend_type>
121
- <source_model>iceimport/system_config_yesno</source_model>
122
- <sort_order>29</sort_order>
123
- <show_in_default>1</show_in_default>
124
- <show_in_website>1</show_in_website>
125
- <show_in_store>1</show_in_store>
126
- </import_prices>
127
- <import_stock translate="label">
128
- <label>Update stock</label>
129
- <frontend_type>select</frontend_type>
130
- <source_model>iceimport/system_config_yesno</source_model>
131
- <sort_order>30</sort_order>
132
- <show_in_default>1</show_in_default>
133
- <show_in_website>1</show_in_website>
134
- <show_in_store>1</show_in_store>
135
- </import_stock>
136
- <import_delivery_eta translate="label">
137
- <label>Update delivery eta</label>
138
- <frontend_type>select</frontend_type>
139
- <source_model>iceimport/system_config_yesno</source_model>
140
- <sort_order>31</sort_order>
141
- <show_in_default>1</show_in_default>
142
- <show_in_website>1</show_in_website>
143
- <show_in_store>1</show_in_store>
144
- </import_delivery_eta>
145
- <update_categories_from_csv translate="label">
146
- <label><![CDATA[Update products category]]></label>
147
- <comment><![CDATA[]]></comment>
148
- <frontend_type>select</frontend_type>
149
- <source_model>iceimport/system_config_yesno</source_model>
150
- <sort_order>32</sort_order>
151
- <show_in_default>1</show_in_default>
152
- <show_in_website>1</show_in_website>
153
- <show_in_store>1</show_in_store>
154
- </update_categories_from_csv>
155
- <update_status_from_csv translate="label">
156
- <label><![CDATA[Update status]]></label>
157
- <comment><![CDATA[]]></comment>
158
- <frontend_type>select</frontend_type>
159
- <source_model>iceimport/system_config_yesno</source_model>
160
- <sort_order>33</sort_order>
161
- <show_in_default>1</show_in_default>
162
- <show_in_website>1</show_in_website>
163
- <show_in_store>1</show_in_store>
164
- </update_status_from_csv>
165
- <update_visibility_from_csv translate="label">
166
- <label><![CDATA[Update visibility]]></label>
167
- <comment><![CDATA[]]></comment>
168
- <frontend_type>select</frontend_type>
169
- <source_model>iceimport/system_config_yesno</source_model>
170
- <sort_order>34</sort_order>
171
- <show_in_default>1</show_in_default>
172
- <show_in_website>1</show_in_website>
173
- <show_in_store>1</show_in_store>
174
- </update_visibility_from_csv>
175
- <update_is_in_stock_from_csv translate="label">
176
- <label><![CDATA[Update stock availability]]></label>
177
- <comment><![CDATA[]]></comment>
178
- <frontend_type>select</frontend_type>
179
- <source_model>iceimport/system_config_yesno</source_model>
180
- <sort_order>35</sort_order>
181
- <show_in_default>1</show_in_default>
182
- <show_in_website>1</show_in_website>
183
- <show_in_store>1</show_in_store>
184
- </update_is_in_stock_from_csv>
185
- <update_url_key_from_csv translate="label">
186
- <label><![CDATA[Update URL key]]></label>
187
- <comment><![CDATA[]]></comment>
188
- <frontend_type>select</frontend_type>
189
- <source_model>iceimport/system_config_yesno</source_model>
190
- <sort_order>36</sort_order>
191
- <show_in_default>1</show_in_default>
192
- <show_in_website>1</show_in_website>
193
- <show_in_store>1</show_in_store>
194
- </update_url_key_from_csv>
195
- <import_images translate="label">
196
- <label>Import product images (via Cron)</label>
197
- <frontend_type>select</frontend_type>
198
- <source_model>iceimport/system_config_yesno</source_model>
199
- <sort_order>37</sort_order>
200
- <show_in_default>1</show_in_default>
201
- <show_in_website>1</show_in_website>
202
- <show_in_store>1</show_in_store>
203
- </import_images>
204
- <refresh_settings_heading translate="label">
205
- <label>Import Parameters</label>
206
- <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
207
- <sort_order>120</sort_order>
208
- <show_in_default>1</show_in_default>
209
- <show_in_website>1</show_in_website>
210
- <show_in_store>1</show_in_store>
211
- </refresh_settings_heading>
212
- <iceimport_batch_size translate="label">
213
- <label><![CDATA[Batch size]]></label>
214
- <comment><![CDATA[]]></comment>
215
- <frontend_type>text</frontend_type>
216
- <validate>validate-greater-than-zero</validate>
217
- <sort_order>130</sort_order>
218
- <show_in_default>1</show_in_default>
219
- <show_in_website>1</show_in_website>
220
- <show_in_store>1</show_in_store>
221
- </iceimport_batch_size>
222
- <import_new_products translate="label">
223
- <label>Import new products</label>
224
- <comment><![CDATA[Add products from import file if they aren't presented in shop's assortment.]]></comment>
225
- <frontend_type>select</frontend_type>
226
- <source_model>iceimport/system_config_yesno</source_model>
227
- <sort_order>138</sort_order>
228
- <show_in_default>1</show_in_default>
229
- <show_in_website>1</show_in_website>
230
- <show_in_store>1</show_in_store>
231
- </import_new_products>
232
- <delete_old_products translate="label">
233
- <label>Remove old products</label>
234
- <comment><![CDATA[Remove products marked as <strong>"is_iceimport"</strong> and not presented in import file.]]></comment>
235
- <frontend_type>select</frontend_type>
236
- <source_model>iceimport/system_config_yesno</source_model>
237
- <sort_order>139</sort_order>
238
- <show_in_default>1</show_in_default>
239
- <show_in_website>1</show_in_website>
240
- <show_in_store>1</show_in_store>
241
- </delete_old_products>
242
- <delete_old_products_tolerance translate="label">
243
- <label><![CDATA[Tolerance of difference (%)]]></label>
244
- <comment><![CDATA[If difference is greater than this value - remove process will be cancelled.]]></comment>
245
- <frontend_type>text</frontend_type>
246
- <validate>validate-greater-than-zero validate-percents</validate>
247
- <sort_order>140</sort_order>
248
- <show_in_default>1</show_in_default>
249
- <show_in_website>1</show_in_website>
250
- <show_in_store>1</show_in_store>
251
- <depends>
252
- <delete_old_products>1</delete_old_products>
253
- </depends>
254
- </delete_old_products_tolerance>
255
- <category_active translate="label">
256
- <label>Set to active imported categories</label>
257
- <frontend_type>select</frontend_type>
258
- <source_model>iceimport/system_config_yesno</source_model>
259
- <sort_order>141</sort_order>
260
- <show_in_default>1</show_in_default>
261
- <show_in_website>1</show_in_website>
262
- <show_in_store>1</show_in_store>
263
- </category_active>
264
- <category_sort translate="label">
265
- <label>Sort categories in ASC order</label>
266
- <frontend_type>select</frontend_type>
267
- <source_model>iceimport/system_config_yesno</source_model>
268
- <sort_order>142</sort_order>
269
- <show_in_default>1</show_in_default>
270
- <show_in_website>1</show_in_website>
271
- <show_in_store>1</show_in_store>
272
- </category_sort>
273
- <update_hide_category translate="label">
274
- <label><![CDATA[Hide empty category]]></label>
275
- <comment><![CDATA[]]></comment>
276
- <frontend_type>select</frontend_type>
277
- <source_model>iceimport/system_config_yesno</source_model>
278
- <sort_order>143</sort_order>
279
- <show_in_default>1</show_in_default>
280
- <show_in_website>1</show_in_website>
281
- <show_in_store>1</show_in_store>
282
- </update_hide_category>
283
- <default_tax translate="label">
284
- <label>Default tax for product</label>
285
- <frontend_type>select</frontend_type>
286
- <source_model>iceimport/system_config_defaulttax</source_model>
287
- <sort_order>144</sort_order>
288
- <show_in_default>1</show_in_default>
289
- <show_in_website>1</show_in_website>
290
- <show_in_store>1</show_in_store>
291
- </default_tax>
292
- </fields>
293
- </importprod>
294
- </groups>
295
- </importprod_root>
296
- <iceimport_information translate="label" module="iceimport">
297
- <label>IceImport Information</label>
298
- <tab>iceshop</tab>
299
- <sort_order>40</sort_order>
300
- <show_in_default>1</show_in_default>
301
- <show_in_website>1</show_in_website>
302
- <show_in_store>1</show_in_store>
303
- <comment><![CDATA[]]></comment>
304
- <groups>
305
- <dashboard translate="label comment">
306
- <label>Dashboard</label>
307
- <sort_order>50</sort_order>
308
- <show_in_default>1</show_in_default>
309
- <show_in_website>1</show_in_website>
310
- <show_in_store>1</show_in_store>
311
- <comment><![CDATA[<span style="color: grey;">Loading...</span>]]></comment>
312
- <fields>
313
- <check_system_hidden translate="label comment">
314
- <label></label>
315
- <comment></comment>
316
- <frontend_type>select</frontend_type>
317
- <source_model>iceimport/system_config_checksystem</source_model>
318
- <sort_order>10</sort_order>
319
- <show_in_default>1</show_in_default>
320
- <show_in_website>1</show_in_website>
321
- <show_in_store>1</show_in_store>
322
- </check_system_hidden>
323
- </fields>
324
- </dashboard>
325
- </groups>
326
- </iceimport_information>
327
- <iceshop_about translate="label" module="iceimport">
328
- <label>Iceshop</label>
329
- <tab>iceshop</tab>
330
- <class>iceshop-info-section</class>
331
- <header_css>iceshop-info-header</header_css>
332
- <frontend_type>text</frontend_type>
333
- <sort_order>100</sort_order>
334
- <show_in_default>1</show_in_default>
335
- <show_in_website>1</show_in_website>
336
- <show_in_store>1</show_in_store>
337
- <comment><![CDATA[]]></comment>
338
- <groups>
339
- <iceshop_iframe translate="label comment">
340
- <label>More about Iceshop</label>
341
- <sort_order>50</sort_order>
342
- <show_in_default>1</show_in_default>
343
- <show_in_website>1</show_in_website>
344
- <show_in_store>1</show_in_store>
345
- <comment><![CDATA[<span style="color: grey;">Loading...</span>]]></comment>
346
- <fields>
347
- <iceshop_iframe_hidden translate="label comment">
348
- <label></label>
349
- <comment></comment>
350
- <frontend_type>select</frontend_type>
351
- <source_model>iceimport/system_config_iceshoplink</source_model>
352
- <sort_order>10</sort_order>
353
- <show_in_default>1</show_in_default>
354
- <show_in_website>1</show_in_website>
355
- <show_in_store>1</show_in_store>
356
- </iceshop_iframe_hidden>
357
- </fields>
358
- </iceshop_iframe>
359
- </groups>
360
- </iceshop_about>
361
- </sections>
362
- </config>
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <tabs>
4
+ <iceshop translate="label" module="iceimport">
5
+ <label>Iceshop</label>
6
+ <sort_order>150</sort_order>
7
+ </iceshop>
8
+ </tabs>
9
+ <sections>
10
+ <iceshop_iceimport_importprod_root translate="label" module="catalog">
11
+ <class>separator-top</class>
12
+ <label>IceImport Settings</label>
13
+ <tab>iceshop</tab>
14
+ <frontend_type>text</frontend_type>
15
+ <sort_order>30</sort_order>
16
+ <show_in_default>1</show_in_default>
17
+ <show_in_website>1</show_in_website>
18
+ <show_in_store>1</show_in_store>
19
+ <groups>
20
+ <importprod translate="label">
21
+ <label>IceImport Settings</label>
22
+ <frontend_type>text</frontend_type>
23
+ <sort_order>50</sort_order>
24
+ <show_in_default>1</show_in_default>
25
+ <show_in_website>1</show_in_website>
26
+ <show_in_store>1</show_in_store>
27
+ <fields>
28
+ <basic_settings_heading translate="label">
29
+ <label>Content Settings</label>
30
+ <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
31
+ <sort_order>0</sort_order>
32
+ <show_in_default>1</show_in_default>
33
+ <show_in_website>1</show_in_website>
34
+ <show_in_store>1</show_in_store>
35
+ </basic_settings_heading>
36
+ <basic_settings_note translate="label">
37
+ <label><![CDATA[<strong>Caution!</strong>]]></label>
38
+ <comment><![CDATA[All the settings in this section are valid and used only for existing products, for new products the value is Yes and it can't be changed]]></comment>
39
+ <frontend_type>label</frontend_type>
40
+ <sort_order>1</sort_order>
41
+ <show_in_default>1</show_in_default>
42
+ <show_in_website>1</show_in_website>
43
+ <show_in_store>1</show_in_store>
44
+ </basic_settings_note>
45
+ <import_product_ean translate="label">
46
+ <label>Update EAN</label>
47
+ <frontend_type>select</frontend_type>
48
+ <source_model>iceimport/system_config_yesno</source_model>
49
+ <sort_order>21</sort_order>
50
+ <show_in_default>1</show_in_default>
51
+ <show_in_website>1</show_in_website>
52
+ <show_in_store>1</show_in_store>
53
+ </import_product_ean>
54
+ <import_product_mpn translate="label">
55
+ <label>Update MPN</label>
56
+ <frontend_type>select</frontend_type>
57
+ <source_model>iceimport/system_config_yesno</source_model>
58
+ <sort_order>22</sort_order>
59
+ <show_in_default>1</show_in_default>
60
+ <show_in_website>1</show_in_website>
61
+ <show_in_store>1</show_in_store>
62
+ </import_product_mpn>
63
+ <import_product_brand_name translate="label">
64
+ <label>Update brand</label>
65
+ <frontend_type>select</frontend_type>
66
+ <source_model>iceimport/system_config_yesno</source_model>
67
+ <sort_order>23</sort_order>
68
+ <show_in_default>1</show_in_default>
69
+ <show_in_website>1</show_in_website>
70
+ <show_in_store>1</show_in_store>
71
+ <enabled>1</enabled>
72
+ </import_product_brand_name>
73
+ <import_product_name translate="label">
74
+ <label>Update name</label>
75
+ <frontend_type>select</frontend_type>
76
+ <source_model>iceimport/system_config_yesno</source_model>
77
+ <sort_order>24</sort_order>
78
+ <show_in_default>1</show_in_default>
79
+ <show_in_website>1</show_in_website>
80
+ <show_in_store>1</show_in_store>
81
+ </import_product_name>
82
+ <import_product_short_description translate="label">
83
+ <label>Update short description</label>
84
+ <frontend_type>select</frontend_type>
85
+ <source_model>iceimport/system_config_yesno</source_model>
86
+ <sort_order>25</sort_order>
87
+ <show_in_default>1</show_in_default>
88
+ <show_in_website>1</show_in_website>
89
+ <show_in_store>1</show_in_store>
90
+ </import_product_short_description>
91
+ <import_product_description translate="label">
92
+ <label>Update description</label>
93
+ <frontend_type>select</frontend_type>
94
+ <source_model>iceimport/system_config_yesno</source_model>
95
+ <sort_order>26</sort_order>
96
+ <show_in_default>1</show_in_default>
97
+ <show_in_website>1</show_in_website>
98
+ <show_in_store>1</show_in_store>
99
+ </import_product_description>
100
+ <import_product_short_summary_description translate="label">
101
+ <label>Update short summary description</label>
102
+ <frontend_type>select</frontend_type>
103
+ <source_model>iceimport/system_config_yesno</source_model>
104
+ <sort_order>27</sort_order>
105
+ <show_in_default>1</show_in_default>
106
+ <show_in_website>1</show_in_website>
107
+ <show_in_store>1</show_in_store>
108
+ </import_product_short_summary_description>
109
+ <import_product_summary_description translate="label">
110
+ <label>Update summary description</label>
111
+ <frontend_type>select</frontend_type>
112
+ <source_model>iceimport/system_config_yesno</source_model>
113
+ <sort_order>28</sort_order>
114
+ <show_in_default>1</show_in_default>
115
+ <show_in_website>1</show_in_website>
116
+ <show_in_store>1</show_in_store>
117
+ </import_product_summary_description>
118
+ <import_prices translate="label">
119
+ <label>Update prices</label>
120
+ <frontend_type>select</frontend_type>
121
+ <source_model>iceimport/system_config_yesno</source_model>
122
+ <sort_order>29</sort_order>
123
+ <show_in_default>1</show_in_default>
124
+ <show_in_website>1</show_in_website>
125
+ <show_in_store>1</show_in_store>
126
+ </import_prices>
127
+ <import_stock translate="label">
128
+ <label>Update stock</label>
129
+ <frontend_type>select</frontend_type>
130
+ <source_model>iceimport/system_config_yesno</source_model>
131
+ <sort_order>30</sort_order>
132
+ <show_in_default>1</show_in_default>
133
+ <show_in_website>1</show_in_website>
134
+ <show_in_store>1</show_in_store>
135
+ </import_stock>
136
+ <import_product_delivery_eta translate="label">
137
+ <label>Update delivery eta</label>
138
+ <frontend_type>select</frontend_type>
139
+ <source_model>iceimport/system_config_yesno</source_model>
140
+ <sort_order>31</sort_order>
141
+ <show_in_default>1</show_in_default>
142
+ <show_in_website>1</show_in_website>
143
+ <show_in_store>1</show_in_store>
144
+ </import_product_delivery_eta>
145
+ <update_categories_from_csv translate="label">
146
+ <label><![CDATA[Update products category]]></label>
147
+ <comment><![CDATA[]]></comment>
148
+ <frontend_type>select</frontend_type>
149
+ <source_model>iceimport/system_config_yesno</source_model>
150
+ <sort_order>32</sort_order>
151
+ <show_in_default>1</show_in_default>
152
+ <show_in_website>1</show_in_website>
153
+ <show_in_store>1</show_in_store>
154
+ </update_categories_from_csv>
155
+ <update_status_from_csv translate="label">
156
+ <label><![CDATA[Update status]]></label>
157
+ <comment><![CDATA[]]></comment>
158
+ <frontend_type>select</frontend_type>
159
+ <source_model>iceimport/system_config_yesno</source_model>
160
+ <sort_order>33</sort_order>
161
+ <show_in_default>1</show_in_default>
162
+ <show_in_website>1</show_in_website>
163
+ <show_in_store>1</show_in_store>
164
+ </update_status_from_csv>
165
+ <update_visibility_from_csv translate="label">
166
+ <label><![CDATA[Update visibility]]></label>
167
+ <comment><![CDATA[]]></comment>
168
+ <frontend_type>select</frontend_type>
169
+ <source_model>iceimport/system_config_yesno</source_model>
170
+ <sort_order>34</sort_order>
171
+ <show_in_default>1</show_in_default>
172
+ <show_in_website>1</show_in_website>
173
+ <show_in_store>1</show_in_store>
174
+ </update_visibility_from_csv>
175
+ <update_is_in_stock_from_csv translate="label">
176
+ <label><![CDATA[Update stock availability]]></label>
177
+ <comment><![CDATA[]]></comment>
178
+ <frontend_type>select</frontend_type>
179
+ <source_model>iceimport/system_config_yesno</source_model>
180
+ <sort_order>35</sort_order>
181
+ <show_in_default>1</show_in_default>
182
+ <show_in_website>1</show_in_website>
183
+ <show_in_store>1</show_in_store>
184
+ </update_is_in_stock_from_csv>
185
+ <update_url_key_from_csv translate="label">
186
+ <label><![CDATA[Update URL key]]></label>
187
+ <comment><![CDATA[]]></comment>
188
+ <frontend_type>select</frontend_type>
189
+ <source_model>iceimport/system_config_yesno</source_model>
190
+ <sort_order>36</sort_order>
191
+ <show_in_default>1</show_in_default>
192
+ <show_in_website>1</show_in_website>
193
+ <show_in_store>1</show_in_store>
194
+ </update_url_key_from_csv>
195
+ <import_images translate="label">
196
+ <label>Import product images (via Cron)</label>
197
+ <frontend_type>select</frontend_type>
198
+ <source_model>iceimport/system_config_yesno</source_model>
199
+ <sort_order>37</sort_order>
200
+ <show_in_default>1</show_in_default>
201
+ <show_in_website>1</show_in_website>
202
+ <show_in_store>1</show_in_store>
203
+ </import_images>
204
+ <refresh_settings_heading translate="label">
205
+ <label>Import Parameters</label>
206
+ <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
207
+ <sort_order>120</sort_order>
208
+ <show_in_default>1</show_in_default>
209
+ <show_in_website>1</show_in_website>
210
+ <show_in_store>1</show_in_store>
211
+ </refresh_settings_heading>
212
+ <iceimport_batch_size translate="label">
213
+ <label><![CDATA[Batch size]]></label>
214
+ <comment><![CDATA[]]></comment>
215
+ <frontend_type>text</frontend_type>
216
+ <validate>validate-greater-than-zero</validate>
217
+ <sort_order>130</sort_order>
218
+ <show_in_default>1</show_in_default>
219
+ <show_in_website>1</show_in_website>
220
+ <show_in_store>1</show_in_store>
221
+ </iceimport_batch_size>
222
+ <import_new_products translate="label">
223
+ <label>Import new products</label>
224
+ <comment><![CDATA[Add products from import file if they aren't presented in shop's assortment.]]></comment>
225
+ <frontend_type>select</frontend_type>
226
+ <source_model>iceimport/system_config_yesno</source_model>
227
+ <sort_order>138</sort_order>
228
+ <show_in_default>1</show_in_default>
229
+ <show_in_website>1</show_in_website>
230
+ <show_in_store>1</show_in_store>
231
+ </import_new_products>
232
+ <delete_old_products translate="label">
233
+ <label>Remove old products</label>
234
+ <comment><![CDATA[Remove products marked as <strong>"is_iceimport"</strong> and not presented in import file.]]></comment>
235
+ <frontend_type>select</frontend_type>
236
+ <source_model>iceimport/system_config_yesno</source_model>
237
+ <sort_order>139</sort_order>
238
+ <show_in_default>1</show_in_default>
239
+ <show_in_website>1</show_in_website>
240
+ <show_in_store>1</show_in_store>
241
+ </delete_old_products>
242
+ <delete_old_products_tolerance translate="label">
243
+ <label><![CDATA[Tolerance of difference (%)]]></label>
244
+ <comment><![CDATA[If difference is greater than this value - remove process will be cancelled.]]></comment>
245
+ <frontend_type>text</frontend_type>
246
+ <validate>validate-greater-than-zero validate-percents</validate>
247
+ <sort_order>140</sort_order>
248
+ <show_in_default>1</show_in_default>
249
+ <show_in_website>1</show_in_website>
250
+ <show_in_store>1</show_in_store>
251
+ <depends>
252
+ <delete_old_products>1</delete_old_products>
253
+ </depends>
254
+ </delete_old_products_tolerance>
255
+ <category_active translate="label">
256
+ <label>Set to active imported categories</label>
257
+ <frontend_type>select</frontend_type>
258
+ <source_model>iceimport/system_config_yesno</source_model>
259
+ <sort_order>141</sort_order>
260
+ <show_in_default>1</show_in_default>
261
+ <show_in_website>1</show_in_website>
262
+ <show_in_store>1</show_in_store>
263
+ </category_active>
264
+ <category_sort translate="label">
265
+ <label>Sort categories in ASC order</label>
266
+ <frontend_type>select</frontend_type>
267
+ <source_model>iceimport/system_config_yesno</source_model>
268
+ <sort_order>142</sort_order>
269
+ <show_in_default>1</show_in_default>
270
+ <show_in_website>1</show_in_website>
271
+ <show_in_store>1</show_in_store>
272
+ </category_sort>
273
+ <update_hide_category translate="label">
274
+ <label><![CDATA[Hide empty category]]></label>
275
+ <comment><![CDATA[]]></comment>
276
+ <frontend_type>select</frontend_type>
277
+ <source_model>iceimport/system_config_yesno</source_model>
278
+ <sort_order>143</sort_order>
279
+ <show_in_default>1</show_in_default>
280
+ <show_in_website>1</show_in_website>
281
+ <show_in_store>1</show_in_store>
282
+ </update_hide_category>
283
+ <default_tax translate="label">
284
+ <label>Default tax for product</label>
285
+ <frontend_type>select</frontend_type>
286
+ <source_model>iceimport/system_config_defaulttax</source_model>
287
+ <sort_order>144</sort_order>
288
+ <show_in_default>1</show_in_default>
289
+ <show_in_website>1</show_in_website>
290
+ <show_in_store>1</show_in_store>
291
+ </default_tax>
292
+ <images_queue_processing_only translate="label">
293
+ <label><![CDATA[ImagesQueueProcessing only]]></label>
294
+ <comment><![CDATA[Run <strong>ONLY</strong> images queue processing instead of whole actions stack. Setting used <strong>ONLY</strong> while running via Cron.]]></comment>
295
+ <frontend_type>select</frontend_type>
296
+ <source_model>iceimport/system_config_yesno</source_model>
297
+ <sort_order>145</sort_order>
298
+ <show_in_default>1</show_in_default>
299
+ <show_in_website>1</show_in_website>
300
+ <show_in_store>1</show_in_store>
301
+ </images_queue_processing_only>
302
+ </fields>
303
+ </importprod>
304
+ </groups>
305
+ </iceshop_iceimport_importprod_root>
306
+ <iceimport_information translate="label" module="iceimport">
307
+ <label>IceImport Information</label>
308
+ <tab>iceshop</tab>
309
+ <sort_order>40</sort_order>
310
+ <show_in_default>1</show_in_default>
311
+ <show_in_website>1</show_in_website>
312
+ <show_in_store>1</show_in_store>
313
+ <comment><![CDATA[]]></comment>
314
+ <groups>
315
+ <dashboard translate="label comment">
316
+ <label>Dashboard</label>
317
+ <sort_order>50</sort_order>
318
+ <show_in_default>1</show_in_default>
319
+ <show_in_website>1</show_in_website>
320
+ <show_in_store>1</show_in_store>
321
+ <comment><![CDATA[<span style="color: grey;">Loading...</span>]]></comment>
322
+ <fields>
323
+ <check_system_hidden translate="label comment">
324
+ <label></label>
325
+ <comment></comment>
326
+ <frontend_type>select</frontend_type>
327
+ <source_model>iceimport/system_config_checksystem</source_model>
328
+ <sort_order>10</sort_order>
329
+ <show_in_default>1</show_in_default>
330
+ <show_in_website>1</show_in_website>
331
+ <show_in_store>1</show_in_store>
332
+ </check_system_hidden>
333
+ </fields>
334
+ </dashboard>
335
+ </groups>
336
+ </iceimport_information>
337
+ <iceshop_about translate="label" module="iceimport">
338
+ <label>Iceshop</label>
339
+ <tab>iceshop</tab>
340
+ <class>iceshop-info-section</class>
341
+ <header_css>iceshop-info-header</header_css>
342
+ <frontend_type>text</frontend_type>
343
+ <sort_order>100</sort_order>
344
+ <show_in_default>1</show_in_default>
345
+ <show_in_website>1</show_in_website>
346
+ <show_in_store>1</show_in_store>
347
+ <comment><![CDATA[]]></comment>
348
+ <groups>
349
+ <iceshop_iframe translate="label comment">
350
+ <label>More about Iceshop</label>
351
+ <sort_order>50</sort_order>
352
+ <show_in_default>1</show_in_default>
353
+ <show_in_website>1</show_in_website>
354
+ <show_in_store>1</show_in_store>
355
+ <comment><![CDATA[<span style="color: grey;">Loading...</span>]]></comment>
356
+ <fields>
357
+ <iceshop_iframe_hidden translate="label comment">
358
+ <label></label>
359
+ <comment></comment>
360
+ <frontend_type>select</frontend_type>
361
+ <source_model>iceimport/system_config_iceshoplink</source_model>
362
+ <sort_order>10</sort_order>
363
+ <show_in_default>1</show_in_default>
364
+ <show_in_website>1</show_in_website>
365
+ <show_in_store>1</show_in_store>
366
+ </iceshop_iframe_hidden>
367
+ </fields>
368
+ </iceshop_iframe>
369
+ </groups>
370
+ </iceshop_about>
371
+ </sections>
372
+ </config>
app/code/community/ICEshop/Iceimport/sql/iceimport_setup/{mysql4-install-1.7.3.php → mysql4-install-1.7.9.php} RENAMED
@@ -34,6 +34,9 @@ $installer->run("
34
 
35
  DROP TABLE IF EXISTS `{$installer->getTable('iceimport_imported_product_ids')}`;
36
  DROP TABLE IF EXISTS `{$installer->getTable('capacity_product_image_queue')}`;
 
 
 
37
 
38
 
39
  INSERT IGNORE INTO `{$installer->getTable('catalog_category_entity_varchar')}`
@@ -57,7 +60,7 @@ $installer->run("
57
  KEY `pi_idx` (`product_id`)
58
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
59
 
60
- CREATE TABLE IF NOT EXISTS {$this->getTable('iceshop_extensions_logs')} (
61
  `log_id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
62
  `log_key` VARCHAR(255) NOT NULL,
63
  `log_value` TEXT,
34
 
35
  DROP TABLE IF EXISTS `{$installer->getTable('iceimport_imported_product_ids')}`;
36
  DROP TABLE IF EXISTS `{$installer->getTable('capacity_product_image_queue')}`;
37
+ DROP TABLE IF EXISTS `{$installer->getTable('iceshop_iceimport_image_queue')}`;
38
+ DROP TABLE IF EXISTS `{$installer->getTable('iceshop_iceimport_imported_product_ids')}`;
39
+ DROP TABLE IF EXISTS `{$installer->getTable('iceshop_extensions_logs')}`;
40
 
41
 
42
  INSERT IGNORE INTO `{$installer->getTable('catalog_category_entity_varchar')}`
60
  KEY `pi_idx` (`product_id`)
61
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
62
 
63
+ CREATE TABLE IF NOT EXISTS {$installer->getTable('iceshop_extensions_logs')} (
64
  `log_id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
65
  `log_key` VARCHAR(255) NOT NULL,
66
  `log_value` TEXT,
app/code/community/ICEshop/Iceimport/sql/iceimport_setup/mysql4-upgrade-0.1.0-1.7.0.php CHANGED
@@ -59,7 +59,7 @@ $installer->run("
59
  KEY `pi_idx` (`product_id`)
60
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
61
 
62
- CREATE TABLE IF NOT EXISTS {$this->getTable('iceshop_extensions_logs')} (
63
  `log_key` VARCHAR(255) NOT NULL,
64
  `log_value` varchar(255) DEFAULT NULL,
65
  UNIQUE KEY (`log_key`)
59
  KEY `pi_idx` (`product_id`)
60
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
61
 
62
+ CREATE TABLE IF NOT EXISTS {$installer->getTable('iceshop_extensions_logs')} (
63
  `log_key` VARCHAR(255) NOT NULL,
64
  `log_value` varchar(255) DEFAULT NULL,
65
  UNIQUE KEY (`log_key`)
app/code/community/ICEshop/Iceimport/sql/iceimport_setup/mysql4-upgrade-1.4.0-1.7.0.php CHANGED
@@ -59,7 +59,7 @@ $installer->run("
59
  KEY `pi_idx` (`product_id`)
60
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
61
 
62
- CREATE TABLE IF NOT EXISTS {$this->getTable('iceshop_extensions_logs')} (
63
  `log_key` VARCHAR(255) NOT NULL,
64
  `log_value` varchar(255) DEFAULT NULL,
65
  UNIQUE KEY (`log_key`)
59
  KEY `pi_idx` (`product_id`)
60
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
61
 
62
+ CREATE TABLE IF NOT EXISTS {$installer->getTable('iceshop_extensions_logs')} (
63
  `log_key` VARCHAR(255) NOT NULL,
64
  `log_value` varchar(255) DEFAULT NULL,
65
  UNIQUE KEY (`log_key`)
app/code/community/ICEshop/Iceimport/sql/iceimport_setup/mysql4-upgrade-1.5.0-1.7.0.php CHANGED
@@ -57,7 +57,7 @@ $installer->run("
57
  KEY `pi_idx` (`product_id`)
58
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
59
 
60
- CREATE TABLE IF NOT EXISTS {$this->getTable('iceshop_extensions_logs')} (
61
  `log_key` VARCHAR(255) NOT NULL,
62
  `log_value` varchar(255) DEFAULT NULL,
63
  UNIQUE KEY (`log_key`)
57
  KEY `pi_idx` (`product_id`)
58
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
59
 
60
+ CREATE TABLE IF NOT EXISTS {$installer->getTable('iceshop_extensions_logs')} (
61
  `log_key` VARCHAR(255) NOT NULL,
62
  `log_value` varchar(255) DEFAULT NULL,
63
  UNIQUE KEY (`log_key`)
app/code/community/ICEshop/Iceimport/sql/iceimport_setup/mysql4-upgrade-1.6.0-1.7.0.php CHANGED
@@ -57,7 +57,7 @@ $installer->run("
57
  KEY `pi_idx` (`product_id`)
58
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
59
 
60
- CREATE TABLE IF NOT EXISTS {$this->getTable('iceshop_extensions_logs')} (
61
  `log_key` VARCHAR(255) NOT NULL,
62
  `log_value` varchar(255) DEFAULT NULL,
63
  UNIQUE KEY (`log_key`)
57
  KEY `pi_idx` (`product_id`)
58
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
59
 
60
+ CREATE TABLE IF NOT EXISTS {$installer->getTable('iceshop_extensions_logs')} (
61
  `log_key` VARCHAR(255) NOT NULL,
62
  `log_value` varchar(255) DEFAULT NULL,
63
  UNIQUE KEY (`log_key`)
app/code/community/ICEshop/Iceimport/sql/iceimport_setup/{mysql4-upgrade-1.7.0-1.7.5.php → mysql4-upgrade-1.6.0-1.7.5.php} RENAMED
@@ -34,6 +34,7 @@ $installer->run("
34
 
35
  DROP TABLE IF EXISTS `{$installer->getTable('iceimport_imported_product_ids')}`;
36
  DROP TABLE IF EXISTS `{$installer->getTable('capacity_product_image_queue')}`;
 
37
 
38
  INSERT IGNORE INTO `{$installer->getTable('catalog_category_entity_varchar')}`
39
  (`entity_type_id`, `attribute_id`, `entity_id`, `value`)
@@ -57,28 +58,28 @@ $installer->run("
57
  KEY `pi_idx` (`product_id`)
58
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
59
 
60
- CREATE TABLE IF NOT EXISTS {$this->getTable('iceshop_extensions_logs')} (
61
  `log_key` VARCHAR(255) NOT NULL,
62
  `log_value` varchar(255) DEFAULT NULL,
63
  UNIQUE KEY (`log_key`)
64
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Iceshop Connector logs';
65
 
66
- ALTER TABLE {$this->getTable('iceshop_extensions_logs')}
67
  ADD COLUMN `log_id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST;
68
 
69
- ALTER TABLE {$this->getTable('iceshop_extensions_logs')}
70
  ADD COLUMN `log_type` VARCHAR(10) NOT NULL DEFAULT 'info' AFTER `log_value`;
71
 
72
- ALTER TABLE {$this->getTable('iceshop_extensions_logs')}
73
  ADD KEY `IDX_LOG_TYPE`(`log_type`);
74
 
75
- ALTER TABLE {$this->getTable('iceshop_extensions_logs')}
76
  ADD COLUMN `timecol` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP AFTER `log_type`;
77
 
78
- ALTER TABLE {$this->getTable('iceshop_extensions_logs')}
79
  ADD KEY `IDX_TIMECOL`(`timecol`);
80
 
81
- ALTER TABLE {$this->getTable('iceshop_extensions_logs')}
82
  MODIFY `log_value` TEXT;
83
  ");
84
 
34
 
35
  DROP TABLE IF EXISTS `{$installer->getTable('iceimport_imported_product_ids')}`;
36
  DROP TABLE IF EXISTS `{$installer->getTable('capacity_product_image_queue')}`;
37
+ DROP TABLE IF EXISTS `{$installer->getTable('iceshop_extensions_logs')}`;
38
 
39
  INSERT IGNORE INTO `{$installer->getTable('catalog_category_entity_varchar')}`
40
  (`entity_type_id`, `attribute_id`, `entity_id`, `value`)
58
  KEY `pi_idx` (`product_id`)
59
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
60
 
61
+ CREATE TABLE IF NOT EXISTS {$installer->getTable('iceshop_extensions_logs')} (
62
  `log_key` VARCHAR(255) NOT NULL,
63
  `log_value` varchar(255) DEFAULT NULL,
64
  UNIQUE KEY (`log_key`)
65
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Iceshop Connector logs';
66
 
67
+ ALTER TABLE {$installer->getTable('iceshop_extensions_logs')}
68
  ADD COLUMN `log_id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST;
69
 
70
+ ALTER TABLE {$installer->getTable('iceshop_extensions_logs')}
71
  ADD COLUMN `log_type` VARCHAR(10) NOT NULL DEFAULT 'info' AFTER `log_value`;
72
 
73
+ ALTER TABLE {$installer->getTable('iceshop_extensions_logs')}
74
  ADD KEY `IDX_LOG_TYPE`(`log_type`);
75
 
76
+ ALTER TABLE {$installer->getTable('iceshop_extensions_logs')}
77
  ADD COLUMN `timecol` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP AFTER `log_type`;
78
 
79
+ ALTER TABLE {$installer->getTable('iceshop_extensions_logs')}
80
  ADD KEY `IDX_TIMECOL`(`timecol`);
81
 
82
+ ALTER TABLE {$installer->getTable('iceshop_extensions_logs')}
83
  MODIFY `log_value` TEXT;
84
  ");
85
 
app/code/community/ICEshop/Iceimport/sql/iceimport_setup/mysql4-upgrade-1.7.5-1.7.9.php ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ include_once 'uninstall-old-version.php';
3
+ $unistaller_old_version = new Uninstall_Capacitywebsolutions_Importproduct();
4
+ $unistaller_old_version->uninstall();
5
+ $installer = $this;
6
+ $installer->startSetup();
7
+
8
+ $entityTypeId = $installer->getEntityTypeId('catalog_category');
9
+ $attributeSetId = $installer->getDefaultAttributeSetId($entityTypeId);
10
+ $attributeGroupId = $installer->getDefaultAttributeGroupId($entityTypeId, $attributeSetId);
11
+
12
+ $installer->addAttribute('catalog_category', 'unspsc', array(
13
+ 'type' => 'varchar',
14
+ 'label' => 'unspsc',
15
+ 'input' => 'text',
16
+ 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
17
+ 'visible' => true,
18
+ 'required' => false,
19
+ 'user_defined' => false,
20
+ 'default' => 0
21
+ ));
22
+
23
+ $installer->addAttributeToGroup(
24
+ $entityTypeId,
25
+ $attributeSetId,
26
+ $attributeGroupId,
27
+ 'unspsc',
28
+ '11'
29
+ );
30
+
31
+ $attributeId = $installer->getAttributeId($entityTypeId, 'unspsc');
32
+
33
+ $installer->run("
34
+
35
+ DROP TABLE IF EXISTS `{$installer->getTable('iceimport_imported_product_ids')}`;
36
+ DROP TABLE IF EXISTS `{$installer->getTable('capacity_product_image_queue')}`;
37
+ DROP TABLE IF EXISTS `{$installer->getTable('iceshop_extensions_logs')}`;
38
+
39
+ INSERT IGNORE INTO `{$installer->getTable('catalog_category_entity_varchar')}`
40
+ (`entity_type_id`, `attribute_id`, `entity_id`, `value`)
41
+ SELECT '{$entityTypeId}', '{$attributeId}', `entity_id`, '1'
42
+ FROM `{$installer->getTable('catalog_category_entity')}`;
43
+
44
+ CREATE TABLE IF NOT EXISTS `{$installer->getTable('iceshop_iceimport_image_queue')}`
45
+ (
46
+ `queue_id` INT(10) NOT NULL AUTO_INCREMENT,
47
+ `entity_id` INT(10) UNSIGNED NOT NULL,
48
+ `image_url` VARCHAR(255) NOT NULL,
49
+ `is_downloaded` TINYINT NOT NULL DEFAULT 0,
50
+ PRIMARY KEY(`queue_id`),
51
+ UNIQUE KEY (`entity_id`, `image_url`),
52
+ CONSTRAINT `FK_CAP_PRD_IMG_QUEUE_ENTT_ID_CAT_PRD_ENTT_ENTT_ID` FOREIGN KEY (`entity_id`) REFERENCES `{$installer->getTable('catalog_product_entity')}` (`entity_id`) ON DELETE CASCADE
53
+ )ENGINE=InnoDB CHARSET=utf8 COMMENT='Table to manage product image import';
54
+
55
+ CREATE TABLE IF NOT EXISTS `{$installer->getTable('iceshop_iceimport_imported_product_ids')}` (
56
+ `product_id` int(11) NOT NULL,
57
+ `product_sku` varchar(255) DEFAULT NULL,
58
+ KEY `pi_idx` (`product_id`)
59
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
60
+
61
+ CREATE TABLE IF NOT EXISTS {$installer->getTable('iceshop_extensions_logs')} (
62
+ `log_key` VARCHAR(255) NOT NULL,
63
+ `log_value` varchar(255) DEFAULT NULL,
64
+ UNIQUE KEY (`log_key`)
65
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Iceshop Connector logs';
66
+
67
+ ALTER TABLE {$installer->getTable('iceshop_extensions_logs')}
68
+ ADD COLUMN `log_id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST;
69
+
70
+ ALTER TABLE {$installer->getTable('iceshop_extensions_logs')}
71
+ ADD COLUMN `log_type` VARCHAR(10) NOT NULL DEFAULT 'info' AFTER `log_value`;
72
+
73
+ ALTER TABLE {$installer->getTable('iceshop_extensions_logs')}
74
+ ADD KEY `IDX_LOG_TYPE`(`log_type`);
75
+
76
+ ALTER TABLE {$installer->getTable('iceshop_extensions_logs')}
77
+ ADD COLUMN `timecol` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP AFTER `log_type`;
78
+
79
+ ALTER TABLE {$installer->getTable('iceshop_extensions_logs')}
80
+ ADD KEY `IDX_TIMECOL`(`timecol`);
81
+
82
+ ALTER TABLE {$installer->getTable('iceshop_extensions_logs')}
83
+ MODIFY `log_value` TEXT;
84
+ ");
85
+
86
+ $installer->endSetup();
87
+
app/code/community/ICEshop/Iceimport/sql/iceimport_setup/mysql4-upgrade-1.7.6-1.7.9.php ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ include_once 'uninstall-old-version.php';
3
+ $unistaller_old_version = new Uninstall_Capacitywebsolutions_Importproduct();
4
+ $unistaller_old_version->uninstall();
5
+ $installer = $this;
6
+ $installer->startSetup();
7
+
8
+ $entityTypeId = $installer->getEntityTypeId('catalog_category');
9
+ $attributeSetId = $installer->getDefaultAttributeSetId($entityTypeId);
10
+ $attributeGroupId = $installer->getDefaultAttributeGroupId($entityTypeId, $attributeSetId);
11
+
12
+ $installer->addAttribute('catalog_category', 'unspsc', array(
13
+ 'type' => 'varchar',
14
+ 'label' => 'unspsc',
15
+ 'input' => 'text',
16
+ 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
17
+ 'visible' => true,
18
+ 'required' => false,
19
+ 'user_defined' => false,
20
+ 'default' => 0
21
+ ));
22
+
23
+ $installer->addAttributeToGroup(
24
+ $entityTypeId,
25
+ $attributeSetId,
26
+ $attributeGroupId,
27
+ 'unspsc',
28
+ '11'
29
+ );
30
+
31
+ $attributeId = $installer->getAttributeId($entityTypeId, 'unspsc');
32
+
33
+ $installer->run("
34
+
35
+ DROP TABLE IF EXISTS `{$installer->getTable('iceimport_imported_product_ids')}`;
36
+ DROP TABLE IF EXISTS `{$installer->getTable('capacity_product_image_queue')}`;
37
+ DROP TABLE IF EXISTS `{$installer->getTable('iceshop_extensions_logs')}`;
38
+
39
+ INSERT IGNORE INTO `{$installer->getTable('catalog_category_entity_varchar')}`
40
+ (`entity_type_id`, `attribute_id`, `entity_id`, `value`)
41
+ SELECT '{$entityTypeId}', '{$attributeId}', `entity_id`, '1'
42
+ FROM `{$installer->getTable('catalog_category_entity')}`;
43
+
44
+ CREATE TABLE IF NOT EXISTS `{$installer->getTable('iceshop_iceimport_image_queue')}`
45
+ (
46
+ `queue_id` INT(10) NOT NULL AUTO_INCREMENT,
47
+ `entity_id` INT(10) UNSIGNED NOT NULL,
48
+ `image_url` VARCHAR(255) NOT NULL,
49
+ `is_downloaded` TINYINT NOT NULL DEFAULT 0,
50
+ PRIMARY KEY(`queue_id`),
51
+ UNIQUE KEY (`entity_id`, `image_url`),
52
+ CONSTRAINT `FK_CAP_PRD_IMG_QUEUE_ENTT_ID_CAT_PRD_ENTT_ENTT_ID` FOREIGN KEY (`entity_id`) REFERENCES `{$installer->getTable('catalog_product_entity')}` (`entity_id`) ON DELETE CASCADE
53
+ )ENGINE=InnoDB CHARSET=utf8 COMMENT='Table to manage product image import';
54
+
55
+ CREATE TABLE IF NOT EXISTS `{$installer->getTable('iceshop_iceimport_imported_product_ids')}` (
56
+ `product_id` int(11) NOT NULL,
57
+ `product_sku` varchar(255) DEFAULT NULL,
58
+ KEY `pi_idx` (`product_id`)
59
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
60
+
61
+ CREATE TABLE IF NOT EXISTS {$installer->getTable('iceshop_extensions_logs')} (
62
+ `log_key` VARCHAR(255) NOT NULL,
63
+ `log_value` varchar(255) DEFAULT NULL,
64
+ UNIQUE KEY (`log_key`)
65
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Iceshop Connector logs';
66
+
67
+ ALTER TABLE {$installer->getTable('iceshop_extensions_logs')}
68
+ ADD COLUMN `log_id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST;
69
+
70
+ ALTER TABLE {$installer->getTable('iceshop_extensions_logs')}
71
+ ADD COLUMN `log_type` VARCHAR(10) NOT NULL DEFAULT 'info' AFTER `log_value`;
72
+
73
+ ALTER TABLE {$installer->getTable('iceshop_extensions_logs')}
74
+ ADD KEY `IDX_LOG_TYPE`(`log_type`);
75
+
76
+ ALTER TABLE {$installer->getTable('iceshop_extensions_logs')}
77
+ ADD COLUMN `timecol` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP AFTER `log_type`;
78
+
79
+ ALTER TABLE {$installer->getTable('iceshop_extensions_logs')}
80
+ ADD KEY `IDX_TIMECOL`(`timecol`);
81
+
82
+ ALTER TABLE {$installer->getTable('iceshop_extensions_logs')}
83
+ MODIFY `log_value` TEXT;
84
+ ");
85
+
86
+ $installer->endSetup();
87
+
app/design/adminhtml/default/default/layout/ICEshop_Iceimport.xml CHANGED
@@ -3,7 +3,7 @@
3
  <adminhtml_system_config_edit>
4
  <reference name="head">
5
  <action method="addCss"><stylesheet>iceshop/iceimport/styles.css</stylesheet></action>
6
- <action method="addJs"><script>ICEshop/Iceimport/jquery-1.9.1.min.js</script></action>
7
  <action method="addJs"><script>ICEshop/Iceimport/script.js</script></action>
8
  </reference>
9
  </adminhtml_system_config_edit>
3
  <adminhtml_system_config_edit>
4
  <reference name="head">
5
  <action method="addCss"><stylesheet>iceshop/iceimport/styles.css</stylesheet></action>
6
+ <action method="addJs"><script>ICEshop/Iceimport/jquery-1.11.1.min.js</script></action>
7
  <action method="addJs"><script>ICEshop/Iceimport/script.js</script></action>
8
  </reference>
9
  </adminhtml_system_config_edit>
app/design/adminhtml/default/default/template/iceshop/iceimport/notifications.phtml CHANGED
@@ -1,10 +1,20 @@
1
- <?php $_problems = $this->getIceimportProblemsDigest()?>
2
- <?php if(!empty($_problems) && is_array($_problems) && count($_problems) > 0):?>
3
- <div class="notification-global" id="iceimport-warning">
 
 
 
 
 
 
 
 
4
  <span class="f-right">
5
- <a href="<?php print $this->getManageUrl(); ?>" title="<?php echo $this->helper('iceimport')->__('Open in new window'); ?>"><?php echo $this->helper('iceimport')->__('Go to system check section'); ?></a>
 
6
  </span>
7
- <strong class="label"><?php echo $this->helper('iceimport')->__('Warning'); ?></strong>
8
- <?php echo $this->helper('iceimport')->__("The Iceimport extensions doesn't work properly, please go to configuration page and check the problems."); ?>
9
- </div>
10
- <?php endif;?>
 
1
+ <?php $_problems = $this->getIceimportProblemsDigest() ?>
2
+ <?php
3
+ $is_allowed = false;
4
+ try {
5
+ $is_allowed = $this->isAllowed();
6
+ } catch ( Exception $e ) {
7
+ }
8
+ ?>
9
+ <?php if ( $is_allowed == true ) : ?>
10
+ <?php if ( ! empty( $_problems ) && is_array( $_problems ) && count( $_problems ) > 0 ): ?>
11
+ <div class="notification-global" id="iceimport-warning">
12
  <span class="f-right">
13
+ <a href="<?php print $this->getManageUrl(); ?>"
14
+ title="<?php echo $this->helper( 'iceimport' )->__( 'Open in new window' ); ?>"><?php echo $this->helper( 'iceimport' )->__( 'Go to system check section' ); ?></a>
15
  </span>
16
+ <strong class="label"><?php echo $this->helper( 'iceimport' )->__( 'Warning' ); ?></strong>
17
+ <?php echo $this->helper( 'iceimport' )->__( "The Iceimport extensions doesn't work properly, please go to configuration page and check the problems." ); ?>
18
+ </div>
19
+ <?php endif; ?>
20
+ <?php endif; ?>
js/ICEshop/Iceimport/jquery-1.11.1.min.js ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ /*! jQuery v1.11.1 | (c) 2005, 2014 jQuery Foundation, Inc. | jquery.org/license */
2
+ !function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k={},l="1.11.1",m=function(a,b){return new m.fn.init(a,b)},n=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,o=/^-ms-/,p=/-([\da-z])/gi,q=function(a,b){return b.toUpperCase()};m.fn=m.prototype={jquery:l,constructor:m,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=m.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return m.each(this,a,b)},map:function(a){return this.pushStack(m.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},m.extend=m.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||m.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(e=arguments[h]))for(d in e)a=g[d],c=e[d],g!==c&&(j&&c&&(m.isPlainObject(c)||(b=m.isArray(c)))?(b?(b=!1,f=a&&m.isArray(a)?a:[]):f=a&&m.isPlainObject(a)?a:{},g[d]=m.extend(j,f,c)):void 0!==c&&(g[d]=c));return g},m.extend({expando:"jQuery"+(l+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===m.type(a)},isArray:Array.isArray||function(a){return"array"===m.type(a)},isWindow:function(a){return null!=a&&a==a.window},isNumeric:function(a){return!m.isArray(a)&&a-parseFloat(a)>=0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},isPlainObject:function(a){var b;if(!a||"object"!==m.type(a)||a.nodeType||m.isWindow(a))return!1;try{if(a.constructor&&!j.call(a,"constructor")&&!j.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}if(k.ownLast)for(b in a)return j.call(a,b);for(b in a);return void 0===b||j.call(a,b)},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?h[i.call(a)]||"object":typeof a},globalEval:function(b){b&&m.trim(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(o,"ms-").replace(p,q)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=r(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(n,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(r(Object(a))?m.merge(c,"string"==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){var d;if(b){if(g)return g.call(b,a,c);for(d=b.length,c=c?0>c?Math.max(0,d+c):c:0;d>c;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,b){var c=+b.length,d=0,e=a.length;while(c>d)a[e++]=b[d++];if(c!==c)while(void 0!==b[d])a[e++]=b[d++];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,f=0,g=a.length,h=r(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return"string"==typeof b&&(f=a[b],b=a,a=f),m.isFunction(a)?(c=d.call(arguments,2),e=function(){return a.apply(b||this,c.concat(d.call(arguments)))},e.guid=a.guid=a.guid||m.guid++,e):void 0},now:function(){return+new Date},support:k}),m.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){h["[object "+b+"]"]=b.toLowerCase()});function r(a){var b=a.length,c=m.type(a);return"function"===c||m.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var s=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+-new Date,v=a.document,w=0,x=0,y=gb(),z=gb(),A=gb(),B=function(a,b){return a===b&&(l=!0),0},C="undefined",D=1<<31,E={}.hasOwnProperty,F=[],G=F.pop,H=F.push,I=F.push,J=F.slice,K=F.indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(this[b]===a)return b;return-1},L="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",M="[\\x20\\t\\r\\n\\f]",N="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",O=N.replace("w","w#"),P="\\["+M+"*("+N+")(?:"+M+"*([*^$|!~]?=)"+M+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+O+"))|)"+M+"*\\]",Q=":("+N+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+P+")*)|.*)\\)|)",R=new RegExp("^"+M+"+|((?:^|[^\\\\])(?:\\\\.)*)"+M+"+$","g"),S=new RegExp("^"+M+"*,"+M+"*"),T=new RegExp("^"+M+"*([>+~]|"+M+")"+M+"*"),U=new RegExp("="+M+"*([^\\]'\"]*?)"+M+"*\\]","g"),V=new RegExp(Q),W=new RegExp("^"+O+"$"),X={ID:new RegExp("^#("+N+")"),CLASS:new RegExp("^\\.("+N+")"),TAG:new RegExp("^("+N.replace("w","w*")+")"),ATTR:new RegExp("^"+P),PSEUDO:new RegExp("^"+Q),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+L+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Y=/^(?:input|select|textarea|button)$/i,Z=/^h\d$/i,$=/^[^{]+\{\s*\[native \w/,_=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ab=/[+~]/,bb=/'|\\/g,cb=new RegExp("\\\\([\\da-f]{1,6}"+M+"?|("+M+")|.)","ig"),db=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)};try{I.apply(F=J.call(v.childNodes),v.childNodes),F[v.childNodes.length].nodeType}catch(eb){I={apply:F.length?function(a,b){H.apply(a,J.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function fb(a,b,d,e){var f,h,j,k,l,o,r,s,w,x;if((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,d=d||[],!a||"string"!=typeof a)return d;if(1!==(k=b.nodeType)&&9!==k)return[];if(p&&!e){if(f=_.exec(a))if(j=f[1]){if(9===k){if(h=b.getElementById(j),!h||!h.parentNode)return d;if(h.id===j)return d.push(h),d}else if(b.ownerDocument&&(h=b.ownerDocument.getElementById(j))&&t(b,h)&&h.id===j)return d.push(h),d}else{if(f[2])return I.apply(d,b.getElementsByTagName(a)),d;if((j=f[3])&&c.getElementsByClassName&&b.getElementsByClassName)return I.apply(d,b.getElementsByClassName(j)),d}if(c.qsa&&(!q||!q.test(a))){if(s=r=u,w=b,x=9===k&&a,1===k&&"object"!==b.nodeName.toLowerCase()){o=g(a),(r=b.getAttribute("id"))?s=r.replace(bb,"\\$&"):b.setAttribute("id",s),s="[id='"+s+"'] ",l=o.length;while(l--)o[l]=s+qb(o[l]);w=ab.test(a)&&ob(b.parentNode)||b,x=o.join(",")}if(x)try{return I.apply(d,w.querySelectorAll(x)),d}catch(y){}finally{r||b.removeAttribute("id")}}}return i(a.replace(R,"$1"),b,d,e)}function gb(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function hb(a){return a[u]=!0,a}function ib(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function jb(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function kb(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||D)-(~a.sourceIndex||D);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function lb(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function mb(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function nb(a){return hb(function(b){return b=+b,hb(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function ob(a){return a&&typeof a.getElementsByTagName!==C&&a}c=fb.support={},f=fb.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=fb.setDocument=function(a){var b,e=a?a.ownerDocument||a:v,g=e.defaultView;return e!==n&&9===e.nodeType&&e.documentElement?(n=e,o=e.documentElement,p=!f(e),g&&g!==g.top&&(g.addEventListener?g.addEventListener("unload",function(){m()},!1):g.attachEvent&&g.attachEvent("onunload",function(){m()})),c.attributes=ib(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ib(function(a){return a.appendChild(e.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=$.test(e.getElementsByClassName)&&ib(function(a){return a.innerHTML="<div class='a'></div><div class='a i'></div>",a.firstChild.className="i",2===a.getElementsByClassName("i").length}),c.getById=ib(function(a){return o.appendChild(a).id=u,!e.getElementsByName||!e.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if(typeof b.getElementById!==C&&p){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){var c=typeof a.getAttributeNode!==C&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return typeof b.getElementsByTagName!==C?b.getElementsByTagName(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return typeof b.getElementsByClassName!==C&&p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=$.test(e.querySelectorAll))&&(ib(function(a){a.innerHTML="<select msallowclip=''><option selected=''></option></select>",a.querySelectorAll("[msallowclip^='']").length&&q.push("[*^$]="+M+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+M+"*(?:value|"+L+")"),a.querySelectorAll(":checked").length||q.push(":checked")}),ib(function(a){var b=e.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+M+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=$.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ib(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",Q)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=$.test(o.compareDocumentPosition),t=b||$.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===e||a.ownerDocument===v&&t(v,a)?-1:b===e||b.ownerDocument===v&&t(v,b)?1:k?K.call(k,a)-K.call(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,f=a.parentNode,g=b.parentNode,h=[a],i=[b];if(!f||!g)return a===e?-1:b===e?1:f?-1:g?1:k?K.call(k,a)-K.call(k,b):0;if(f===g)return kb(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)i.unshift(c);while(h[d]===i[d])d++;return d?kb(h[d],i[d]):h[d]===v?-1:i[d]===v?1:0},e):n},fb.matches=function(a,b){return fb(a,null,null,b)},fb.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(U,"='$1']"),!(!c.matchesSelector||!p||r&&r.test(b)||q&&q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return fb(b,n,null,[a]).length>0},fb.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},fb.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&E.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},fb.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},fb.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=fb.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=fb.selectors={cacheLength:50,createPseudo:hb,match:X,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(cb,db),a[3]=(a[3]||a[4]||a[5]||"").replace(cb,db),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||fb.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&fb.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return X.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&V.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(cb,db).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+M+")"+a+"("+M+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||typeof a.getAttribute!==C&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=fb.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){k=q[u]||(q[u]={}),j=k[a]||[],n=j[0]===w&&j[1],m=j[0]===w&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[w,n,m];break}}else if(s&&(j=(b[u]||(b[u]={}))[a])&&j[0]===w)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(s&&((l[u]||(l[u]={}))[a]=[w,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||fb.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?hb(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=K.call(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:hb(function(a){var b=[],c=[],d=h(a.replace(R,"$1"));return d[u]?hb(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),!c.pop()}}),has:hb(function(a){return function(b){return fb(a,b).length>0}}),contains:hb(function(a){return function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:hb(function(a){return W.test(a||"")||fb.error("unsupported lang: "+a),a=a.replace(cb,db).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return Z.test(a.nodeName)},input:function(a){return Y.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:nb(function(){return[0]}),last:nb(function(a,b){return[b-1]}),eq:nb(function(a,b,c){return[0>c?c+b:c]}),even:nb(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:nb(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:nb(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:nb(function(a,b,c){for(var d=0>c?c+b:c;++d<b;)a.push(d);return a})}},d.pseudos.nth=d.pseudos.eq;for(b in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})d.pseudos[b]=lb(b);for(b in{submit:!0,reset:!0})d.pseudos[b]=mb(b);function pb(){}pb.prototype=d.filters=d.pseudos,d.setFilters=new pb,g=fb.tokenize=function(a,b){var c,e,f,g,h,i,j,k=z[a+" "];if(k)return b?0:k.slice(0);h=a,i=[],j=d.preFilter;while(h){(!c||(e=S.exec(h)))&&(e&&(h=h.slice(e[0].length)||h),i.push(f=[])),c=!1,(e=T.exec(h))&&(c=e.shift(),f.push({value:c,type:e[0].replace(R," ")}),h=h.slice(c.length));for(g in d.filter)!(e=X[g].exec(h))||j[g]&&!(e=j[g](e))||(c=e.shift(),f.push({value:c,type:g,matches:e}),h=h.slice(c.length));if(!c)break}return b?h.length:h?fb.error(a):z(a,i).slice(0)};function qb(a){for(var b=0,c=a.length,d="";c>b;b++)d+=a[b].value;return d}function rb(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(i=b[u]||(b[u]={}),(h=i[d])&&h[0]===w&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function sb(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function tb(a,b,c){for(var d=0,e=b.length;e>d;d++)fb(a,b[d],c);return c}function ub(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function vb(a,b,c,d,e,f){return d&&!d[u]&&(d=vb(d)),e&&!e[u]&&(e=vb(e,f)),hb(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||tb(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:ub(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=ub(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?K.call(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=ub(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):I.apply(g,r)})}function wb(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=rb(function(a){return a===b},h,!0),l=rb(function(a){return K.call(b,a)>-1},h,!0),m=[function(a,c,d){return!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d))}];f>i;i++)if(c=d.relative[a[i].type])m=[rb(sb(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return vb(i>1&&sb(m),i>1&&qb(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(R,"$1"),c,e>i&&wb(a.slice(i,e)),f>e&&wb(a=a.slice(e)),f>e&&qb(a))}m.push(c)}return sb(m)}function xb(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,m,o,p=0,q="0",r=f&&[],s=[],t=j,u=f||e&&d.find.TAG("*",k),v=w+=null==t?1:Math.random()||.1,x=u.length;for(k&&(j=g!==n&&g);q!==x&&null!=(l=u[q]);q++){if(e&&l){m=0;while(o=a[m++])if(o(l,g,h)){i.push(l);break}k&&(w=v)}c&&((l=!o&&l)&&p--,f&&r.push(l))}if(p+=q,c&&q!==p){m=0;while(o=b[m++])o(r,s,g,h);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=G.call(i));s=ub(s)}I.apply(i,s),k&&!f&&s.length>0&&p+b.length>1&&fb.uniqueSort(i)}return k&&(w=v,j=t),r};return c?hb(f):f}return h=fb.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=wb(b[c]),f[u]?d.push(f):e.push(f);f=A(a,xb(e,d)),f.selector=a}return f},i=fb.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(cb,db),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=X.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(cb,db),ab.test(j[0].type)&&ob(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&qb(j),!a)return I.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,ab.test(a)&&ob(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ib(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),ib(function(a){return a.innerHTML="<a href='#'></a>","#"===a.firstChild.getAttribute("href")})||jb("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ib(function(a){return a.innerHTML="<input/>",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||jb("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),ib(function(a){return null==a.getAttribute("disabled")})||jb(L,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),fb}(a);m.find=s,m.expr=s.selectors,m.expr[":"]=m.expr.pseudos,m.unique=s.uniqueSort,m.text=s.getText,m.isXMLDoc=s.isXML,m.contains=s.contains;var t=m.expr.match.needsContext,u=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,v=/^.[^:#\[\.,]*$/;function w(a,b,c){if(m.isFunction(b))return m.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return m.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(v.test(b))return m.filter(b,a,c);b=m.filter(b,a)}return m.grep(a,function(a){return m.inArray(a,b)>=0!==c})}m.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?m.find.matchesSelector(d,a)?[d]:[]:m.find.matches(a,m.grep(b,function(a){return 1===a.nodeType}))},m.fn.extend({find:function(a){var b,c=[],d=this,e=d.length;if("string"!=typeof a)return this.pushStack(m(a).filter(function(){for(b=0;e>b;b++)if(m.contains(d[b],this))return!0}));for(b=0;e>b;b++)m.find(a,d[b],c);return c=this.pushStack(e>1?m.unique(c):c),c.selector=this.selector?this.selector+" "+a:a,c},filter:function(a){return this.pushStack(w(this,a||[],!1))},not:function(a){return this.pushStack(w(this,a||[],!0))},is:function(a){return!!w(this,"string"==typeof a&&t.test(a)?m(a):a||[],!1).length}});var x,y=a.document,z=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,A=m.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a.charAt(0)&&">"===a.charAt(a.length-1)&&a.length>=3?[null,a,null]:z.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||x).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof m?b[0]:b,m.merge(this,m.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:y,!0)),u.test(c[1])&&m.isPlainObject(b))for(c in b)m.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}if(d=y.getElementById(c[2]),d&&d.parentNode){if(d.id!==c[2])return x.find(a);this.length=1,this[0]=d}return this.context=y,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):m.isFunction(a)?"undefined"!=typeof x.ready?x.ready(a):a(m):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),m.makeArray(a,this))};A.prototype=m.fn,x=m(y);var B=/^(?:parents|prev(?:Until|All))/,C={children:!0,contents:!0,next:!0,prev:!0};m.extend({dir:function(a,b,c){var d=[],e=a[b];while(e&&9!==e.nodeType&&(void 0===c||1!==e.nodeType||!m(e).is(c)))1===e.nodeType&&d.push(e),e=e[b];return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),m.fn.extend({has:function(a){var b,c=m(a,this),d=c.length;return this.filter(function(){for(b=0;d>b;b++)if(m.contains(this,c[b]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=t.test(a)||"string"!=typeof a?m(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&m.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?m.unique(f):f)},index:function(a){return a?"string"==typeof a?m.inArray(this[0],m(a)):m.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(m.unique(m.merge(this.get(),m(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function D(a,b){do a=a[b];while(a&&1!==a.nodeType);return a}m.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return m.dir(a,"parentNode")},parentsUntil:function(a,b,c){return m.dir(a,"parentNode",c)},next:function(a){return D(a,"nextSibling")},prev:function(a){return D(a,"previousSibling")},nextAll:function(a){return m.dir(a,"nextSibling")},prevAll:function(a){return m.dir(a,"previousSibling")},nextUntil:function(a,b,c){return m.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return m.dir(a,"previousSibling",c)},siblings:function(a){return m.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return m.sibling(a.firstChild)},contents:function(a){return m.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:m.merge([],a.childNodes)}},function(a,b){m.fn[a]=function(c,d){var e=m.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=m.filter(d,e)),this.length>1&&(C[a]||(e=m.unique(e)),B.test(a)&&(e=e.reverse())),this.pushStack(e)}});var E=/\S+/g,F={};function G(a){var b=F[a]={};return m.each(a.match(E)||[],function(a,c){b[c]=!0}),b}m.Callbacks=function(a){a="string"==typeof a?F[a]||G(a):m.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(c=a.memory&&l,d=!0,f=g||0,g=0,e=h.length,b=!0;h&&e>f;f++)if(h[f].apply(l[0],l[1])===!1&&a.stopOnFalse){c=!1;break}b=!1,h&&(i?i.length&&j(i.shift()):c?h=[]:k.disable())},k={add:function(){if(h){var d=h.length;!function f(b){m.each(b,function(b,c){var d=m.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&f(c)})}(arguments),b?e=h.length:c&&(g=d,j(c))}return this},remove:function(){return h&&m.each(arguments,function(a,c){var d;while((d=m.inArray(c,h,d))>-1)h.splice(d,1),b&&(e>=d&&e--,f>=d&&f--)}),this},has:function(a){return a?m.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h=[],e=0,this},disable:function(){return h=i=c=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,c||k.disable(),this},locked:function(){return!i},fireWith:function(a,c){return!h||d&&!i||(c=c||[],c=[a,c.slice?c.slice():c],b?i.push(c):j(c)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!d}};return k},m.extend({Deferred:function(a){var b=[["resolve","done",m.Callbacks("once memory"),"resolved"],["reject","fail",m.Callbacks("once memory"),"rejected"],["notify","progress",m.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return m.Deferred(function(c){m.each(b,function(b,f){var g=m.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&m.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?m.extend(a,d):d}},e={};return d.pipe=d.then,m.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=d.call(arguments),e=c.length,f=1!==e||a&&m.isFunction(a.promise)?e:0,g=1===f?a:m.Deferred(),h=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?d.call(arguments):e,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(e>1)for(i=new Array(e),j=new Array(e),k=new Array(e);e>b;b++)c[b]&&m.isFunction(c[b].promise)?c[b].promise().done(h(b,k,c)).fail(g.reject).progress(h(b,j,i)):--f;return f||g.resolveWith(k,c),g.promise()}});var H;m.fn.ready=function(a){return m.ready.promise().done(a),this},m.extend({isReady:!1,readyWait:1,holdReady:function(a){a?m.readyWait++:m.ready(!0)},ready:function(a){if(a===!0?!--m.readyWait:!m.isReady){if(!y.body)return setTimeout(m.ready);m.isReady=!0,a!==!0&&--m.readyWait>0||(H.resolveWith(y,[m]),m.fn.triggerHandler&&(m(y).triggerHandler("ready"),m(y).off("ready")))}}});function I(){y.addEventListener?(y.removeEventListener("DOMContentLoaded",J,!1),a.removeEventListener("load",J,!1)):(y.detachEvent("onreadystatechange",J),a.detachEvent("onload",J))}function J(){(y.addEventListener||"load"===event.type||"complete"===y.readyState)&&(I(),m.ready())}m.ready.promise=function(b){if(!H)if(H=m.Deferred(),"complete"===y.readyState)setTimeout(m.ready);else if(y.addEventListener)y.addEventListener("DOMContentLoaded",J,!1),a.addEventListener("load",J,!1);else{y.attachEvent("onreadystatechange",J),a.attachEvent("onload",J);var c=!1;try{c=null==a.frameElement&&y.documentElement}catch(d){}c&&c.doScroll&&!function e(){if(!m.isReady){try{c.doScroll("left")}catch(a){return setTimeout(e,50)}I(),m.ready()}}()}return H.promise(b)};var K="undefined",L;for(L in m(k))break;k.ownLast="0"!==L,k.inlineBlockNeedsLayout=!1,m(function(){var a,b,c,d;c=y.getElementsByTagName("body")[0],c&&c.style&&(b=y.createElement("div"),d=y.createElement("div"),d.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(d).appendChild(b),typeof b.style.zoom!==K&&(b.style.cssText="display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1",k.inlineBlockNeedsLayout=a=3===b.offsetWidth,a&&(c.style.zoom=1)),c.removeChild(d))}),function(){var a=y.createElement("div");if(null==k.deleteExpando){k.deleteExpando=!0;try{delete a.test}catch(b){k.deleteExpando=!1}}a=null}(),m.acceptData=function(a){var b=m.noData[(a.nodeName+" ").toLowerCase()],c=+a.nodeType||1;return 1!==c&&9!==c?!1:!b||b!==!0&&a.getAttribute("classid")===b};var M=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,N=/([A-Z])/g;function O(a,b,c){if(void 0===c&&1===a.nodeType){var d="data-"+b.replace(N,"-$1").toLowerCase();if(c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:M.test(c)?m.parseJSON(c):c}catch(e){}m.data(a,b,c)}else c=void 0}return c}function P(a){var b;for(b in a)if(("data"!==b||!m.isEmptyObject(a[b]))&&"toJSON"!==b)return!1;return!0}function Q(a,b,d,e){if(m.acceptData(a)){var f,g,h=m.expando,i=a.nodeType,j=i?m.cache:a,k=i?a[h]:a[h]&&h;
3
+ if(k&&j[k]&&(e||j[k].data)||void 0!==d||"string"!=typeof b)return k||(k=i?a[h]=c.pop()||m.guid++:h),j[k]||(j[k]=i?{}:{toJSON:m.noop}),("object"==typeof b||"function"==typeof b)&&(e?j[k]=m.extend(j[k],b):j[k].data=m.extend(j[k].data,b)),g=j[k],e||(g.data||(g.data={}),g=g.data),void 0!==d&&(g[m.camelCase(b)]=d),"string"==typeof b?(f=g[b],null==f&&(f=g[m.camelCase(b)])):f=g,f}}function R(a,b,c){if(m.acceptData(a)){var d,e,f=a.nodeType,g=f?m.cache:a,h=f?a[m.expando]:m.expando;if(g[h]){if(b&&(d=c?g[h]:g[h].data)){m.isArray(b)?b=b.concat(m.map(b,m.camelCase)):b in d?b=[b]:(b=m.camelCase(b),b=b in d?[b]:b.split(" ")),e=b.length;while(e--)delete d[b[e]];if(c?!P(d):!m.isEmptyObject(d))return}(c||(delete g[h].data,P(g[h])))&&(f?m.cleanData([a],!0):k.deleteExpando||g!=g.window?delete g[h]:g[h]=null)}}}m.extend({cache:{},noData:{"applet ":!0,"embed ":!0,"object ":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(a){return a=a.nodeType?m.cache[a[m.expando]]:a[m.expando],!!a&&!P(a)},data:function(a,b,c){return Q(a,b,c)},removeData:function(a,b){return R(a,b)},_data:function(a,b,c){return Q(a,b,c,!0)},_removeData:function(a,b){return R(a,b,!0)}}),m.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=m.data(f),1===f.nodeType&&!m._data(f,"parsedAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=m.camelCase(d.slice(5)),O(f,d,e[d])));m._data(f,"parsedAttrs",!0)}return e}return"object"==typeof a?this.each(function(){m.data(this,a)}):arguments.length>1?this.each(function(){m.data(this,a,b)}):f?O(f,a,m.data(f,a)):void 0},removeData:function(a){return this.each(function(){m.removeData(this,a)})}}),m.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=m._data(a,b),c&&(!d||m.isArray(c)?d=m._data(a,b,m.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=m.queue(a,b),d=c.length,e=c.shift(),f=m._queueHooks(a,b),g=function(){m.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return m._data(a,c)||m._data(a,c,{empty:m.Callbacks("once memory").add(function(){m._removeData(a,b+"queue"),m._removeData(a,c)})})}}),m.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length<c?m.queue(this[0],a):void 0===b?this:this.each(function(){var c=m.queue(this,a,b);m._queueHooks(this,a),"fx"===a&&"inprogress"!==c[0]&&m.dequeue(this,a)})},dequeue:function(a){return this.each(function(){m.dequeue(this,a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,b){var c,d=1,e=m.Deferred(),f=this,g=this.length,h=function(){--d||e.resolveWith(f,[f])};"string"!=typeof a&&(b=a,a=void 0),a=a||"fx";while(g--)c=m._data(f[g],a+"queueHooks"),c&&c.empty&&(d++,c.empty.add(h));return h(),e.promise(b)}});var S=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,T=["Top","Right","Bottom","Left"],U=function(a,b){return a=b||a,"none"===m.css(a,"display")||!m.contains(a.ownerDocument,a)},V=m.access=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===m.type(c)){e=!0;for(h in c)m.access(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,m.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(m(a),c)})),b))for(;i>h;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f},W=/^(?:checkbox|radio)$/i;!function(){var a=y.createElement("input"),b=y.createElement("div"),c=y.createDocumentFragment();if(b.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",k.leadingWhitespace=3===b.firstChild.nodeType,k.tbody=!b.getElementsByTagName("tbody").length,k.htmlSerialize=!!b.getElementsByTagName("link").length,k.html5Clone="<:nav></:nav>"!==y.createElement("nav").cloneNode(!0).outerHTML,a.type="checkbox",a.checked=!0,c.appendChild(a),k.appendChecked=a.checked,b.innerHTML="<textarea>x</textarea>",k.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue,c.appendChild(b),b.innerHTML="<input type='radio' checked='checked' name='t'/>",k.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,k.noCloneEvent=!0,b.attachEvent&&(b.attachEvent("onclick",function(){k.noCloneEvent=!1}),b.cloneNode(!0).click()),null==k.deleteExpando){k.deleteExpando=!0;try{delete b.test}catch(d){k.deleteExpando=!1}}}(),function(){var b,c,d=y.createElement("div");for(b in{submit:!0,change:!0,focusin:!0})c="on"+b,(k[b+"Bubbles"]=c in a)||(d.setAttribute(c,"t"),k[b+"Bubbles"]=d.attributes[c].expando===!1);d=null}();var X=/^(?:input|select|textarea)$/i,Y=/^key/,Z=/^(?:mouse|pointer|contextmenu)|click/,$=/^(?:focusinfocus|focusoutblur)$/,_=/^([^.]*)(?:\.(.+)|)$/;function ab(){return!0}function bb(){return!1}function cb(){try{return y.activeElement}catch(a){}}m.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,n,o,p,q,r=m._data(a);if(r){c.handler&&(i=c,c=i.handler,e=i.selector),c.guid||(c.guid=m.guid++),(g=r.events)||(g=r.events={}),(k=r.handle)||(k=r.handle=function(a){return typeof m===K||a&&m.event.triggered===a.type?void 0:m.event.dispatch.apply(k.elem,arguments)},k.elem=a),b=(b||"").match(E)||[""],h=b.length;while(h--)f=_.exec(b[h])||[],o=q=f[1],p=(f[2]||"").split(".").sort(),o&&(j=m.event.special[o]||{},o=(e?j.delegateType:j.bindType)||o,j=m.event.special[o]||{},l=m.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&m.expr.match.needsContext.test(e),namespace:p.join(".")},i),(n=g[o])||(n=g[o]=[],n.delegateCount=0,j.setup&&j.setup.call(a,d,p,k)!==!1||(a.addEventListener?a.addEventListener(o,k,!1):a.attachEvent&&a.attachEvent("on"+o,k))),j.add&&(j.add.call(a,l),l.handler.guid||(l.handler.guid=c.guid)),e?n.splice(n.delegateCount++,0,l):n.push(l),m.event.global[o]=!0);a=null}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,n,o,p,q,r=m.hasData(a)&&m._data(a);if(r&&(k=r.events)){b=(b||"").match(E)||[""],j=b.length;while(j--)if(h=_.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=m.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,n=k[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),i=f=n.length;while(f--)g=n[f],!e&&q!==g.origType||c&&c.guid!==g.guid||h&&!h.test(g.namespace)||d&&d!==g.selector&&("**"!==d||!g.selector)||(n.splice(f,1),g.selector&&n.delegateCount--,l.remove&&l.remove.call(a,g));i&&!n.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||m.removeEvent(a,o,r.handle),delete k[o])}else for(o in k)m.event.remove(a,o+b[j],c,d,!0);m.isEmptyObject(k)&&(delete r.handle,m._removeData(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,k,l,n,o=[d||y],p=j.call(b,"type")?b.type:b,q=j.call(b,"namespace")?b.namespace.split("."):[];if(h=l=d=d||y,3!==d.nodeType&&8!==d.nodeType&&!$.test(p+m.event.triggered)&&(p.indexOf(".")>=0&&(q=p.split("."),p=q.shift(),q.sort()),g=p.indexOf(":")<0&&"on"+p,b=b[m.expando]?b:new m.Event(p,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=q.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+q.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:m.makeArray(c,[b]),k=m.event.special[p]||{},e||!k.trigger||k.trigger.apply(d,c)!==!1)){if(!e&&!k.noBubble&&!m.isWindow(d)){for(i=k.delegateType||p,$.test(i+p)||(h=h.parentNode);h;h=h.parentNode)o.push(h),l=h;l===(d.ownerDocument||y)&&o.push(l.defaultView||l.parentWindow||a)}n=0;while((h=o[n++])&&!b.isPropagationStopped())b.type=n>1?i:k.bindType||p,f=(m._data(h,"events")||{})[b.type]&&m._data(h,"handle"),f&&f.apply(h,c),f=g&&h[g],f&&f.apply&&m.acceptData(h)&&(b.result=f.apply(h,c),b.result===!1&&b.preventDefault());if(b.type=p,!e&&!b.isDefaultPrevented()&&(!k._default||k._default.apply(o.pop(),c)===!1)&&m.acceptData(d)&&g&&d[p]&&!m.isWindow(d)){l=d[g],l&&(d[g]=null),m.event.triggered=p;try{d[p]()}catch(r){}m.event.triggered=void 0,l&&(d[g]=l)}return b.result}},dispatch:function(a){a=m.event.fix(a);var b,c,e,f,g,h=[],i=d.call(arguments),j=(m._data(this,"events")||{})[a.type]||[],k=m.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=m.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,g=0;while((e=f.handlers[g++])&&!a.isImmediatePropagationStopped())(!a.namespace_re||a.namespace_re.test(e.namespace))&&(a.handleObj=e,a.data=e.data,c=((m.event.special[e.origType]||{}).handle||e.handler).apply(f.elem,i),void 0!==c&&(a.result=c)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&(!a.button||"click"!==a.type))for(;i!=this;i=i.parentNode||this)if(1===i.nodeType&&(i.disabled!==!0||"click"!==a.type)){for(e=[],f=0;h>f;f++)d=b[f],c=d.selector+" ",void 0===e[c]&&(e[c]=d.needsContext?m(c,this).index(i)>=0:m.find(c,this,null,[i]).length),e[c]&&e.push(d);e.length&&g.push({elem:i,handlers:e})}return h<b.length&&g.push({elem:this,handlers:b.slice(h)}),g},fix:function(a){if(a[m.expando])return a;var b,c,d,e=a.type,f=a,g=this.fixHooks[e];g||(this.fixHooks[e]=g=Z.test(e)?this.mouseHooks:Y.test(e)?this.keyHooks:{}),d=g.props?this.props.concat(g.props):this.props,a=new m.Event(f),b=d.length;while(b--)c=d[b],a[c]=f[c];return a.target||(a.target=f.srcElement||y),3===a.target.nodeType&&(a.target=a.target.parentNode),a.metaKey=!!a.metaKey,g.filter?g.filter(a,f):a},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){return null==a.which&&(a.which=null!=b.charCode?b.charCode:b.keyCode),a}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,b){var c,d,e,f=b.button,g=b.fromElement;return null==a.pageX&&null!=b.clientX&&(d=a.target.ownerDocument||y,e=d.documentElement,c=d.body,a.pageX=b.clientX+(e&&e.scrollLeft||c&&c.scrollLeft||0)-(e&&e.clientLeft||c&&c.clientLeft||0),a.pageY=b.clientY+(e&&e.scrollTop||c&&c.scrollTop||0)-(e&&e.clientTop||c&&c.clientTop||0)),!a.relatedTarget&&g&&(a.relatedTarget=g===a.target?b.toElement:g),a.which||void 0===f||(a.which=1&f?1:2&f?3:4&f?2:0),a}},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==cb()&&this.focus)try{return this.focus(),!1}catch(a){}},delegateType:"focusin"},blur:{trigger:function(){return this===cb()&&this.blur?(this.blur(),!1):void 0},delegateType:"focusout"},click:{trigger:function(){return m.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):void 0},_default:function(a){return m.nodeName(a.target,"a")}},beforeunload:{postDispatch:function(a){void 0!==a.result&&a.originalEvent&&(a.originalEvent.returnValue=a.result)}}},simulate:function(a,b,c,d){var e=m.extend(new m.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?m.event.trigger(e,null,b):m.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},m.removeEvent=y.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){var d="on"+b;a.detachEvent&&(typeof a[d]===K&&(a[d]=null),a.detachEvent(d,c))},m.Event=function(a,b){return this instanceof m.Event?(a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||void 0===a.defaultPrevented&&a.returnValue===!1?ab:bb):this.type=a,b&&m.extend(this,b),this.timeStamp=a&&a.timeStamp||m.now(),void(this[m.expando]=!0)):new m.Event(a,b)},m.Event.prototype={isDefaultPrevented:bb,isPropagationStopped:bb,isImmediatePropagationStopped:bb,preventDefault:function(){var a=this.originalEvent;this.isDefaultPrevented=ab,a&&(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){var a=this.originalEvent;this.isPropagationStopped=ab,a&&(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){var a=this.originalEvent;this.isImmediatePropagationStopped=ab,a&&a.stopImmediatePropagation&&a.stopImmediatePropagation(),this.stopPropagation()}},m.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(a,b){m.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj;return(!e||e!==d&&!m.contains(d,e))&&(a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b),c}}}),k.submitBubbles||(m.event.special.submit={setup:function(){return m.nodeName(this,"form")?!1:void m.event.add(this,"click._submit keypress._submit",function(a){var b=a.target,c=m.nodeName(b,"input")||m.nodeName(b,"button")?b.form:void 0;c&&!m._data(c,"submitBubbles")&&(m.event.add(c,"submit._submit",function(a){a._submit_bubble=!0}),m._data(c,"submitBubbles",!0))})},postDispatch:function(a){a._submit_bubble&&(delete a._submit_bubble,this.parentNode&&!a.isTrigger&&m.event.simulate("submit",this.parentNode,a,!0))},teardown:function(){return m.nodeName(this,"form")?!1:void m.event.remove(this,"._submit")}}),k.changeBubbles||(m.event.special.change={setup:function(){return X.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(m.event.add(this,"propertychange._change",function(a){"checked"===a.originalEvent.propertyName&&(this._just_changed=!0)}),m.event.add(this,"click._change",function(a){this._just_changed&&!a.isTrigger&&(this._just_changed=!1),m.event.simulate("change",this,a,!0)})),!1):void m.event.add(this,"beforeactivate._change",function(a){var b=a.target;X.test(b.nodeName)&&!m._data(b,"changeBubbles")&&(m.event.add(b,"change._change",function(a){!this.parentNode||a.isSimulated||a.isTrigger||m.event.simulate("change",this.parentNode,a,!0)}),m._data(b,"changeBubbles",!0))})},handle:function(a){var b=a.target;return this!==b||a.isSimulated||a.isTrigger||"radio"!==b.type&&"checkbox"!==b.type?a.handleObj.handler.apply(this,arguments):void 0},teardown:function(){return m.event.remove(this,"._change"),!X.test(this.nodeName)}}),k.focusinBubbles||m.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){m.event.simulate(b,a.target,m.event.fix(a),!0)};m.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=m._data(d,b);e||d.addEventListener(a,c,!0),m._data(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=m._data(d,b)-1;e?m._data(d,b,e):(d.removeEventListener(a,c,!0),m._removeData(d,b))}}}),m.fn.extend({on:function(a,b,c,d,e){var f,g;if("object"==typeof a){"string"!=typeof b&&(c=c||b,b=void 0);for(f in a)this.on(f,b,c,a[f],e);return this}if(null==c&&null==d?(d=b,c=b=void 0):null==d&&("string"==typeof b?(d=c,c=void 0):(d=c,c=b,b=void 0)),d===!1)d=bb;else if(!d)return this;return 1===e&&(g=d,d=function(a){return m().off(a),g.apply(this,arguments)},d.guid=g.guid||(g.guid=m.guid++)),this.each(function(){m.event.add(this,a,d,c,b)})},one:function(a,b,c,d){return this.on(a,b,c,d,1)},off:function(a,b,c){var d,e;if(a&&a.preventDefault&&a.handleObj)return d=a.handleObj,m(a.delegateTarget).off(d.namespace?d.origType+"."+d.namespace:d.origType,d.selector,d.handler),this;if("object"==typeof a){for(e in a)this.off(e,b,a[e]);return this}return(b===!1||"function"==typeof b)&&(c=b,b=void 0),c===!1&&(c=bb),this.each(function(){m.event.remove(this,a,c,b)})},trigger:function(a,b){return this.each(function(){m.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];return c?m.event.trigger(a,b,c,!0):void 0}});function db(a){var b=eb.split("|"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}var eb="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",fb=/ jQuery\d+="(?:null|\d+)"/g,gb=new RegExp("<(?:"+eb+")[\\s/>]","i"),hb=/^\s+/,ib=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,jb=/<([\w:]+)/,kb=/<tbody/i,lb=/<|&#?\w+;/,mb=/<(?:script|style|link)/i,nb=/checked\s*(?:[^=]|=\s*.checked.)/i,ob=/^$|\/(?:java|ecma)script/i,pb=/^true\/(.*)/,qb=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,rb={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:k.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},sb=db(y),tb=sb.appendChild(y.createElement("div"));rb.optgroup=rb.option,rb.tbody=rb.tfoot=rb.colgroup=rb.caption=rb.thead,rb.th=rb.td;function ub(a,b){var c,d,e=0,f=typeof a.getElementsByTagName!==K?a.getElementsByTagName(b||"*"):typeof a.querySelectorAll!==K?a.querySelectorAll(b||"*"):void 0;if(!f)for(f=[],c=a.childNodes||a;null!=(d=c[e]);e++)!b||m.nodeName(d,b)?f.push(d):m.merge(f,ub(d,b));return void 0===b||b&&m.nodeName(a,b)?m.merge([a],f):f}function vb(a){W.test(a.type)&&(a.defaultChecked=a.checked)}function wb(a,b){return m.nodeName(a,"table")&&m.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function xb(a){return a.type=(null!==m.find.attr(a,"type"))+"/"+a.type,a}function yb(a){var b=pb.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function zb(a,b){for(var c,d=0;null!=(c=a[d]);d++)m._data(c,"globalEval",!b||m._data(b[d],"globalEval"))}function Ab(a,b){if(1===b.nodeType&&m.hasData(a)){var c,d,e,f=m._data(a),g=m._data(b,f),h=f.events;if(h){delete g.handle,g.events={};for(c in h)for(d=0,e=h[c].length;e>d;d++)m.event.add(b,c,h[c][d])}g.data&&(g.data=m.extend({},g.data))}}function Bb(a,b){var c,d,e;if(1===b.nodeType){if(c=b.nodeName.toLowerCase(),!k.noCloneEvent&&b[m.expando]){e=m._data(b);for(d in e.events)m.removeEvent(b,d,e.handle);b.removeAttribute(m.expando)}"script"===c&&b.text!==a.text?(xb(b).text=a.text,yb(b)):"object"===c?(b.parentNode&&(b.outerHTML=a.outerHTML),k.html5Clone&&a.innerHTML&&!m.trim(b.innerHTML)&&(b.innerHTML=a.innerHTML)):"input"===c&&W.test(a.type)?(b.defaultChecked=b.checked=a.checked,b.value!==a.value&&(b.value=a.value)):"option"===c?b.defaultSelected=b.selected=a.defaultSelected:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}}m.extend({clone:function(a,b,c){var d,e,f,g,h,i=m.contains(a.ownerDocument,a);if(k.html5Clone||m.isXMLDoc(a)||!gb.test("<"+a.nodeName+">")?f=a.cloneNode(!0):(tb.innerHTML=a.outerHTML,tb.removeChild(f=tb.firstChild)),!(k.noCloneEvent&&k.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||m.isXMLDoc(a)))for(d=ub(f),h=ub(a),g=0;null!=(e=h[g]);++g)d[g]&&Bb(e,d[g]);if(b)if(c)for(h=h||ub(a),d=d||ub(f),g=0;null!=(e=h[g]);g++)Ab(e,d[g]);else Ab(a,f);return d=ub(f,"script"),d.length>0&&zb(d,!i&&ub(a,"script")),d=h=e=null,f},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,l,n=a.length,o=db(b),p=[],q=0;n>q;q++)if(f=a[q],f||0===f)if("object"===m.type(f))m.merge(p,f.nodeType?[f]:f);else if(lb.test(f)){h=h||o.appendChild(b.createElement("div")),i=(jb.exec(f)||["",""])[1].toLowerCase(),l=rb[i]||rb._default,h.innerHTML=l[1]+f.replace(ib,"<$1></$2>")+l[2],e=l[0];while(e--)h=h.lastChild;if(!k.leadingWhitespace&&hb.test(f)&&p.push(b.createTextNode(hb.exec(f)[0])),!k.tbody){f="table"!==i||kb.test(f)?"<table>"!==l[1]||kb.test(f)?0:h:h.firstChild,e=f&&f.childNodes.length;while(e--)m.nodeName(j=f.childNodes[e],"tbody")&&!j.childNodes.length&&f.removeChild(j)}m.merge(p,h.childNodes),h.textContent="";while(h.firstChild)h.removeChild(h.firstChild);h=o.lastChild}else p.push(b.createTextNode(f));h&&o.removeChild(h),k.appendChecked||m.grep(ub(p,"input"),vb),q=0;while(f=p[q++])if((!d||-1===m.inArray(f,d))&&(g=m.contains(f.ownerDocument,f),h=ub(o.appendChild(f),"script"),g&&zb(h),c)){e=0;while(f=h[e++])ob.test(f.type||"")&&c.push(f)}return h=null,o},cleanData:function(a,b){for(var d,e,f,g,h=0,i=m.expando,j=m.cache,l=k.deleteExpando,n=m.event.special;null!=(d=a[h]);h++)if((b||m.acceptData(d))&&(f=d[i],g=f&&j[f])){if(g.events)for(e in g.events)n[e]?m.event.remove(d,e):m.removeEvent(d,e,g.handle);j[f]&&(delete j[f],l?delete d[i]:typeof d.removeAttribute!==K?d.removeAttribute(i):d[i]=null,c.push(f))}}}),m.fn.extend({text:function(a){return V(this,function(a){return void 0===a?m.text(this):this.empty().append((this[0]&&this[0].ownerDocument||y).createTextNode(a))},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=wb(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=wb(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?m.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||m.cleanData(ub(c)),c.parentNode&&(b&&m.contains(c.ownerDocument,c)&&zb(ub(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++){1===a.nodeType&&m.cleanData(ub(a,!1));while(a.firstChild)a.removeChild(a.firstChild);a.options&&m.nodeName(a,"select")&&(a.options.length=0)}return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return m.clone(this,a,b)})},html:function(a){return V(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a)return 1===b.nodeType?b.innerHTML.replace(fb,""):void 0;if(!("string"!=typeof a||mb.test(a)||!k.htmlSerialize&&gb.test(a)||!k.leadingWhitespace&&hb.test(a)||rb[(jb.exec(a)||["",""])[1].toLowerCase()])){a=a.replace(ib,"<$1></$2>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(m.cleanData(ub(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,m.cleanData(ub(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=e.apply([],a);var c,d,f,g,h,i,j=0,l=this.length,n=this,o=l-1,p=a[0],q=m.isFunction(p);if(q||l>1&&"string"==typeof p&&!k.checkClone&&nb.test(p))return this.each(function(c){var d=n.eq(c);q&&(a[0]=p.call(this,c,d.html())),d.domManip(a,b)});if(l&&(i=m.buildFragment(a,this[0].ownerDocument,!1,this),c=i.firstChild,1===i.childNodes.length&&(i=c),c)){for(g=m.map(ub(i,"script"),xb),f=g.length;l>j;j++)d=i,j!==o&&(d=m.clone(d,!0,!0),f&&m.merge(g,ub(d,"script"))),b.call(this[j],d,j);if(f)for(h=g[g.length-1].ownerDocument,m.map(g,yb),j=0;f>j;j++)d=g[j],ob.test(d.type||"")&&!m._data(d,"globalEval")&&m.contains(h,d)&&(d.src?m._evalUrl&&m._evalUrl(d.src):m.globalEval((d.text||d.textContent||d.innerHTML||"").replace(qb,"")));i=c=null}return this}}),m.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){m.fn[a]=function(a){for(var c,d=0,e=[],g=m(a),h=g.length-1;h>=d;d++)c=d===h?this:this.clone(!0),m(g[d])[b](c),f.apply(e,c.get());return this.pushStack(e)}});var Cb,Db={};function Eb(b,c){var d,e=m(c.createElement(b)).appendTo(c.body),f=a.getDefaultComputedStyle&&(d=a.getDefaultComputedStyle(e[0]))?d.display:m.css(e[0],"display");return e.detach(),f}function Fb(a){var b=y,c=Db[a];return c||(c=Eb(a,b),"none"!==c&&c||(Cb=(Cb||m("<iframe frameborder='0' width='0' height='0'/>")).appendTo(b.documentElement),b=(Cb[0].contentWindow||Cb[0].contentDocument).document,b.write(),b.close(),c=Eb(a,b),Cb.detach()),Db[a]=c),c}!function(){var a;k.shrinkWrapBlocks=function(){if(null!=a)return a;a=!1;var b,c,d;return c=y.getElementsByTagName("body")[0],c&&c.style?(b=y.createElement("div"),d=y.createElement("div"),d.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(d).appendChild(b),typeof b.style.zoom!==K&&(b.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:1px;width:1px;zoom:1",b.appendChild(y.createElement("div")).style.width="5px",a=3!==b.offsetWidth),c.removeChild(d),a):void 0}}();var Gb=/^margin/,Hb=new RegExp("^("+S+")(?!px)[a-z%]+$","i"),Ib,Jb,Kb=/^(top|right|bottom|left)$/;a.getComputedStyle?(Ib=function(a){return a.ownerDocument.defaultView.getComputedStyle(a,null)},Jb=function(a,b,c){var d,e,f,g,h=a.style;return c=c||Ib(a),g=c?c.getPropertyValue(b)||c[b]:void 0,c&&(""!==g||m.contains(a.ownerDocument,a)||(g=m.style(a,b)),Hb.test(g)&&Gb.test(b)&&(d=h.width,e=h.minWidth,f=h.maxWidth,h.minWidth=h.maxWidth=h.width=g,g=c.width,h.width=d,h.minWidth=e,h.maxWidth=f)),void 0===g?g:g+""}):y.documentElement.currentStyle&&(Ib=function(a){return a.currentStyle},Jb=function(a,b,c){var d,e,f,g,h=a.style;return c=c||Ib(a),g=c?c[b]:void 0,null==g&&h&&h[b]&&(g=h[b]),Hb.test(g)&&!Kb.test(b)&&(d=h.left,e=a.runtimeStyle,f=e&&e.left,f&&(e.left=a.currentStyle.left),h.left="fontSize"===b?"1em":g,g=h.pixelLeft+"px",h.left=d,f&&(e.left=f)),void 0===g?g:g+""||"auto"});function Lb(a,b){return{get:function(){var c=a();if(null!=c)return c?void delete this.get:(this.get=b).apply(this,arguments)}}}!function(){var b,c,d,e,f,g,h;if(b=y.createElement("div"),b.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",d=b.getElementsByTagName("a")[0],c=d&&d.style){c.cssText="float:left;opacity:.5",k.opacity="0.5"===c.opacity,k.cssFloat=!!c.cssFloat,b.style.backgroundClip="content-box",b.cloneNode(!0).style.backgroundClip="",k.clearCloneStyle="content-box"===b.style.backgroundClip,k.boxSizing=""===c.boxSizing||""===c.MozBoxSizing||""===c.WebkitBoxSizing,m.extend(k,{reliableHiddenOffsets:function(){return null==g&&i(),g},boxSizingReliable:function(){return null==f&&i(),f},pixelPosition:function(){return null==e&&i(),e},reliableMarginRight:function(){return null==h&&i(),h}});function i(){var b,c,d,i;c=y.getElementsByTagName("body")[0],c&&c.style&&(b=y.createElement("div"),d=y.createElement("div"),d.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(d).appendChild(b),b.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;display:block;margin-top:1%;top:1%;border:1px;padding:1px;width:4px;position:absolute",e=f=!1,h=!0,a.getComputedStyle&&(e="1%"!==(a.getComputedStyle(b,null)||{}).top,f="4px"===(a.getComputedStyle(b,null)||{width:"4px"}).width,i=b.appendChild(y.createElement("div")),i.style.cssText=b.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0",i.style.marginRight=i.style.width="0",b.style.width="1px",h=!parseFloat((a.getComputedStyle(i,null)||{}).marginRight)),b.innerHTML="<table><tr><td></td><td>t</td></tr></table>",i=b.getElementsByTagName("td"),i[0].style.cssText="margin:0;border:0;padding:0;display:none",g=0===i[0].offsetHeight,g&&(i[0].style.display="",i[1].style.display="none",g=0===i[0].offsetHeight),c.removeChild(d))}}}(),m.swap=function(a,b,c,d){var e,f,g={};for(f in b)g[f]=a.style[f],a.style[f]=b[f];e=c.apply(a,d||[]);for(f in b)a.style[f]=g[f];return e};var Mb=/alpha\([^)]*\)/i,Nb=/opacity\s*=\s*([^)]*)/,Ob=/^(none|table(?!-c[ea]).+)/,Pb=new RegExp("^("+S+")(.*)$","i"),Qb=new RegExp("^([+-])=("+S+")","i"),Rb={position:"absolute",visibility:"hidden",display:"block"},Sb={letterSpacing:"0",fontWeight:"400"},Tb=["Webkit","O","Moz","ms"];function Ub(a,b){if(b in a)return b;var c=b.charAt(0).toUpperCase()+b.slice(1),d=b,e=Tb.length;while(e--)if(b=Tb[e]+c,b in a)return b;return d}function Vb(a,b){for(var c,d,e,f=[],g=0,h=a.length;h>g;g++)d=a[g],d.style&&(f[g]=m._data(d,"olddisplay"),c=d.style.display,b?(f[g]||"none"!==c||(d.style.display=""),""===d.style.display&&U(d)&&(f[g]=m._data(d,"olddisplay",Fb(d.nodeName)))):(e=U(d),(c&&"none"!==c||!e)&&m._data(d,"olddisplay",e?c:m.css(d,"display"))));for(g=0;h>g;g++)d=a[g],d.style&&(b&&"none"!==d.style.display&&""!==d.style.display||(d.style.display=b?f[g]||"":"none"));return a}function Wb(a,b,c){var d=Pb.exec(b);return d?Math.max(0,d[1]-(c||0))+(d[2]||"px"):b}function Xb(a,b,c,d,e){for(var f=c===(d?"border":"content")?4:"width"===b?1:0,g=0;4>f;f+=2)"margin"===c&&(g+=m.css(a,c+T[f],!0,e)),d?("content"===c&&(g-=m.css(a,"padding"+T[f],!0,e)),"margin"!==c&&(g-=m.css(a,"border"+T[f]+"Width",!0,e))):(g+=m.css(a,"padding"+T[f],!0,e),"padding"!==c&&(g+=m.css(a,"border"+T[f]+"Width",!0,e)));return g}function Yb(a,b,c){var d=!0,e="width"===b?a.offsetWidth:a.offsetHeight,f=Ib(a),g=k.boxSizing&&"border-box"===m.css(a,"boxSizing",!1,f);if(0>=e||null==e){if(e=Jb(a,b,f),(0>e||null==e)&&(e=a.style[b]),Hb.test(e))return e;d=g&&(k.boxSizingReliable()||e===a.style[b]),e=parseFloat(e)||0}return e+Xb(a,b,c||(g?"border":"content"),d,f)+"px"}m.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=Jb(a,"opacity");return""===c?"1":c}}}},cssNumber:{columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":k.cssFloat?"cssFloat":"styleFloat"},style:function(a,b,c,d){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var e,f,g,h=m.camelCase(b),i=a.style;if(b=m.cssProps[h]||(m.cssProps[h]=Ub(i,h)),g=m.cssHooks[b]||m.cssHooks[h],void 0===c)return g&&"get"in g&&void 0!==(e=g.get(a,!1,d))?e:i[b];if(f=typeof c,"string"===f&&(e=Qb.exec(c))&&(c=(e[1]+1)*e[2]+parseFloat(m.css(a,b)),f="number"),null!=c&&c===c&&("number"!==f||m.cssNumber[h]||(c+="px"),k.clearCloneStyle||""!==c||0!==b.indexOf("background")||(i[b]="inherit"),!(g&&"set"in g&&void 0===(c=g.set(a,c,d)))))try{i[b]=c}catch(j){}}},css:function(a,b,c,d){var e,f,g,h=m.camelCase(b);return b=m.cssProps[h]||(m.cssProps[h]=Ub(a.style,h)),g=m.cssHooks[b]||m.cssHooks[h],g&&"get"in g&&(f=g.get(a,!0,c)),void 0===f&&(f=Jb(a,b,d)),"normal"===f&&b in Sb&&(f=Sb[b]),""===c||c?(e=parseFloat(f),c===!0||m.isNumeric(e)?e||0:f):f}}),m.each(["height","width"],function(a,b){m.cssHooks[b]={get:function(a,c,d){return c?Ob.test(m.css(a,"display"))&&0===a.offsetWidth?m.swap(a,Rb,function(){return Yb(a,b,d)}):Yb(a,b,d):void 0},set:function(a,c,d){var e=d&&Ib(a);return Wb(a,c,d?Xb(a,b,d,k.boxSizing&&"border-box"===m.css(a,"boxSizing",!1,e),e):0)}}}),k.opacity||(m.cssHooks.opacity={get:function(a,b){return Nb.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=m.isNumeric(b)?"alpha(opacity="+100*b+")":"",f=d&&d.filter||c.filter||"";c.zoom=1,(b>=1||""===b)&&""===m.trim(f.replace(Mb,""))&&c.removeAttribute&&(c.removeAttribute("filter"),""===b||d&&!d.filter)||(c.filter=Mb.test(f)?f.replace(Mb,e):f+" "+e)}}),m.cssHooks.marginRight=Lb(k.reliableMarginRight,function(a,b){return b?m.swap(a,{display:"inline-block"},Jb,[a,"marginRight"]):void 0}),m.each({margin:"",padding:"",border:"Width"},function(a,b){m.cssHooks[a+b]={expand:function(c){for(var d=0,e={},f="string"==typeof c?c.split(" "):[c];4>d;d++)e[a+T[d]+b]=f[d]||f[d-2]||f[0];return e}},Gb.test(a)||(m.cssHooks[a+b].set=Wb)}),m.fn.extend({css:function(a,b){return V(this,function(a,b,c){var d,e,f={},g=0;if(m.isArray(b)){for(d=Ib(a),e=b.length;e>g;g++)f[b[g]]=m.css(a,b[g],!1,d);return f}return void 0!==c?m.style(a,b,c):m.css(a,b)},a,b,arguments.length>1)},show:function(){return Vb(this,!0)},hide:function(){return Vb(this)},toggle:function(a){return"boolean"==typeof a?a?this.show():this.hide():this.each(function(){U(this)?m(this).show():m(this).hide()})}});function Zb(a,b,c,d,e){return new Zb.prototype.init(a,b,c,d,e)}m.Tween=Zb,Zb.prototype={constructor:Zb,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||"swing",this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(m.cssNumber[c]?"":"px")
4
+ },cur:function(){var a=Zb.propHooks[this.prop];return a&&a.get?a.get(this):Zb.propHooks._default.get(this)},run:function(a){var b,c=Zb.propHooks[this.prop];return this.pos=b=this.options.duration?m.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):Zb.propHooks._default.set(this),this}},Zb.prototype.init.prototype=Zb.prototype,Zb.propHooks={_default:{get:function(a){var b;return null==a.elem[a.prop]||a.elem.style&&null!=a.elem.style[a.prop]?(b=m.css(a.elem,a.prop,""),b&&"auto"!==b?b:0):a.elem[a.prop]},set:function(a){m.fx.step[a.prop]?m.fx.step[a.prop](a):a.elem.style&&(null!=a.elem.style[m.cssProps[a.prop]]||m.cssHooks[a.prop])?m.style(a.elem,a.prop,a.now+a.unit):a.elem[a.prop]=a.now}}},Zb.propHooks.scrollTop=Zb.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},m.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2}},m.fx=Zb.prototype.init,m.fx.step={};var $b,_b,ac=/^(?:toggle|show|hide)$/,bc=new RegExp("^(?:([+-])=|)("+S+")([a-z%]*)$","i"),cc=/queueHooks$/,dc=[ic],ec={"*":[function(a,b){var c=this.createTween(a,b),d=c.cur(),e=bc.exec(b),f=e&&e[3]||(m.cssNumber[a]?"":"px"),g=(m.cssNumber[a]||"px"!==f&&+d)&&bc.exec(m.css(c.elem,a)),h=1,i=20;if(g&&g[3]!==f){f=f||g[3],e=e||[],g=+d||1;do h=h||".5",g/=h,m.style(c.elem,a,g+f);while(h!==(h=c.cur()/d)&&1!==h&&--i)}return e&&(g=c.start=+g||+d||0,c.unit=f,c.end=e[1]?g+(e[1]+1)*e[2]:+e[2]),c}]};function fc(){return setTimeout(function(){$b=void 0}),$b=m.now()}function gc(a,b){var c,d={height:a},e=0;for(b=b?1:0;4>e;e+=2-b)c=T[e],d["margin"+c]=d["padding"+c]=a;return b&&(d.opacity=d.width=a),d}function hc(a,b,c){for(var d,e=(ec[b]||[]).concat(ec["*"]),f=0,g=e.length;g>f;f++)if(d=e[f].call(c,b,a))return d}function ic(a,b,c){var d,e,f,g,h,i,j,l,n=this,o={},p=a.style,q=a.nodeType&&U(a),r=m._data(a,"fxshow");c.queue||(h=m._queueHooks(a,"fx"),null==h.unqueued&&(h.unqueued=0,i=h.empty.fire,h.empty.fire=function(){h.unqueued||i()}),h.unqueued++,n.always(function(){n.always(function(){h.unqueued--,m.queue(a,"fx").length||h.empty.fire()})})),1===a.nodeType&&("height"in b||"width"in b)&&(c.overflow=[p.overflow,p.overflowX,p.overflowY],j=m.css(a,"display"),l="none"===j?m._data(a,"olddisplay")||Fb(a.nodeName):j,"inline"===l&&"none"===m.css(a,"float")&&(k.inlineBlockNeedsLayout&&"inline"!==Fb(a.nodeName)?p.zoom=1:p.display="inline-block")),c.overflow&&(p.overflow="hidden",k.shrinkWrapBlocks()||n.always(function(){p.overflow=c.overflow[0],p.overflowX=c.overflow[1],p.overflowY=c.overflow[2]}));for(d in b)if(e=b[d],ac.exec(e)){if(delete b[d],f=f||"toggle"===e,e===(q?"hide":"show")){if("show"!==e||!r||void 0===r[d])continue;q=!0}o[d]=r&&r[d]||m.style(a,d)}else j=void 0;if(m.isEmptyObject(o))"inline"===("none"===j?Fb(a.nodeName):j)&&(p.display=j);else{r?"hidden"in r&&(q=r.hidden):r=m._data(a,"fxshow",{}),f&&(r.hidden=!q),q?m(a).show():n.done(function(){m(a).hide()}),n.done(function(){var b;m._removeData(a,"fxshow");for(b in o)m.style(a,b,o[b])});for(d in o)g=hc(q?r[d]:0,d,n),d in r||(r[d]=g.start,q&&(g.end=g.start,g.start="width"===d||"height"===d?1:0))}}function jc(a,b){var c,d,e,f,g;for(c in a)if(d=m.camelCase(c),e=b[d],f=a[c],m.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=m.cssHooks[d],g&&"expand"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}function kc(a,b,c){var d,e,f=0,g=dc.length,h=m.Deferred().always(function(){delete i.elem}),i=function(){if(e)return!1;for(var b=$b||fc(),c=Math.max(0,j.startTime+j.duration-b),d=c/j.duration||0,f=1-d,g=0,i=j.tweens.length;i>g;g++)j.tweens[g].run(f);return h.notifyWith(a,[j,f,c]),1>f&&i?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:m.extend({},b),opts:m.extend(!0,{specialEasing:{}},c),originalProperties:b,originalOptions:c,startTime:$b||fc(),duration:c.duration,tweens:[],createTween:function(b,c){var d=m.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(d),d},stop:function(b){var c=0,d=b?j.tweens.length:0;if(e)return this;for(e=!0;d>c;c++)j.tweens[c].run(1);return b?h.resolveWith(a,[j,b]):h.rejectWith(a,[j,b]),this}}),k=j.props;for(jc(k,j.opts.specialEasing);g>f;f++)if(d=dc[f].call(j,a,k,j.opts))return d;return m.map(k,hc,j),m.isFunction(j.opts.start)&&j.opts.start.call(a,j),m.fx.timer(m.extend(i,{elem:a,anim:j,queue:j.opts.queue})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)}m.Animation=m.extend(kc,{tweener:function(a,b){m.isFunction(a)?(b=a,a=["*"]):a=a.split(" ");for(var c,d=0,e=a.length;e>d;d++)c=a[d],ec[c]=ec[c]||[],ec[c].unshift(b)},prefilter:function(a,b){b?dc.unshift(a):dc.push(a)}}),m.speed=function(a,b,c){var d=a&&"object"==typeof a?m.extend({},a):{complete:c||!c&&b||m.isFunction(a)&&a,duration:a,easing:c&&b||b&&!m.isFunction(b)&&b};return d.duration=m.fx.off?0:"number"==typeof d.duration?d.duration:d.duration in m.fx.speeds?m.fx.speeds[d.duration]:m.fx.speeds._default,(null==d.queue||d.queue===!0)&&(d.queue="fx"),d.old=d.complete,d.complete=function(){m.isFunction(d.old)&&d.old.call(this),d.queue&&m.dequeue(this,d.queue)},d},m.fn.extend({fadeTo:function(a,b,c,d){return this.filter(U).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=m.isEmptyObject(a),f=m.speed(b,c,d),g=function(){var b=kc(this,m.extend({},a),f);(e||m._data(this,"finish"))&&b.stop(!0)};return g.finish=g,e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,b,c){var d=function(a){var b=a.stop;delete a.stop,b(c)};return"string"!=typeof a&&(c=b,b=a,a=void 0),b&&a!==!1&&this.queue(a||"fx",[]),this.each(function(){var b=!0,e=null!=a&&a+"queueHooks",f=m.timers,g=m._data(this);if(e)g[e]&&g[e].stop&&d(g[e]);else for(e in g)g[e]&&g[e].stop&&cc.test(e)&&d(g[e]);for(e=f.length;e--;)f[e].elem!==this||null!=a&&f[e].queue!==a||(f[e].anim.stop(c),b=!1,f.splice(e,1));(b||!c)&&m.dequeue(this,a)})},finish:function(a){return a!==!1&&(a=a||"fx"),this.each(function(){var b,c=m._data(this),d=c[a+"queue"],e=c[a+"queueHooks"],f=m.timers,g=d?d.length:0;for(c.finish=!0,m.queue(this,a,[]),e&&e.stop&&e.stop.call(this,!0),b=f.length;b--;)f[b].elem===this&&f[b].queue===a&&(f[b].anim.stop(!0),f.splice(b,1));for(b=0;g>b;b++)d[b]&&d[b].finish&&d[b].finish.call(this);delete c.finish})}}),m.each(["toggle","show","hide"],function(a,b){var c=m.fn[b];m.fn[b]=function(a,d,e){return null==a||"boolean"==typeof a?c.apply(this,arguments):this.animate(gc(b,!0),a,d,e)}}),m.each({slideDown:gc("show"),slideUp:gc("hide"),slideToggle:gc("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){m.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),m.timers=[],m.fx.tick=function(){var a,b=m.timers,c=0;for($b=m.now();c<b.length;c++)a=b[c],a()||b[c]!==a||b.splice(c--,1);b.length||m.fx.stop(),$b=void 0},m.fx.timer=function(a){m.timers.push(a),a()?m.fx.start():m.timers.pop()},m.fx.interval=13,m.fx.start=function(){_b||(_b=setInterval(m.fx.tick,m.fx.interval))},m.fx.stop=function(){clearInterval(_b),_b=null},m.fx.speeds={slow:600,fast:200,_default:400},m.fn.delay=function(a,b){return a=m.fx?m.fx.speeds[a]||a:a,b=b||"fx",this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},function(){var a,b,c,d,e;b=y.createElement("div"),b.setAttribute("className","t"),b.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",d=b.getElementsByTagName("a")[0],c=y.createElement("select"),e=c.appendChild(y.createElement("option")),a=b.getElementsByTagName("input")[0],d.style.cssText="top:1px",k.getSetAttribute="t"!==b.className,k.style=/top/.test(d.getAttribute("style")),k.hrefNormalized="/a"===d.getAttribute("href"),k.checkOn=!!a.value,k.optSelected=e.selected,k.enctype=!!y.createElement("form").enctype,c.disabled=!0,k.optDisabled=!e.disabled,a=y.createElement("input"),a.setAttribute("value",""),k.input=""===a.getAttribute("value"),a.value="t",a.setAttribute("type","radio"),k.radioValue="t"===a.value}();var lc=/\r/g;m.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=m.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,m(this).val()):a,null==e?e="":"number"==typeof e?e+="":m.isArray(e)&&(e=m.map(e,function(a){return null==a?"":a+""})),b=m.valHooks[this.type]||m.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=m.valHooks[e.type]||m.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(lc,""):null==c?"":c)}}}),m.extend({valHooks:{option:{get:function(a){var b=m.find.attr(a,"value");return null!=b?b:m.trim(m.text(a))}},select:{get:function(a){for(var b,c,d=a.options,e=a.selectedIndex,f="select-one"===a.type||0>e,g=f?null:[],h=f?e+1:d.length,i=0>e?h:f?e:0;h>i;i++)if(c=d[i],!(!c.selected&&i!==e||(k.optDisabled?c.disabled:null!==c.getAttribute("disabled"))||c.parentNode.disabled&&m.nodeName(c.parentNode,"optgroup"))){if(b=m(c).val(),f)return b;g.push(b)}return g},set:function(a,b){var c,d,e=a.options,f=m.makeArray(b),g=e.length;while(g--)if(d=e[g],m.inArray(m.valHooks.option.get(d),f)>=0)try{d.selected=c=!0}catch(h){d.scrollHeight}else d.selected=!1;return c||(a.selectedIndex=-1),e}}}}),m.each(["radio","checkbox"],function(){m.valHooks[this]={set:function(a,b){return m.isArray(b)?a.checked=m.inArray(m(a).val(),b)>=0:void 0}},k.checkOn||(m.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})});var mc,nc,oc=m.expr.attrHandle,pc=/^(?:checked|selected)$/i,qc=k.getSetAttribute,rc=k.input;m.fn.extend({attr:function(a,b){return V(this,m.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){m.removeAttr(this,a)})}}),m.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(a&&3!==f&&8!==f&&2!==f)return typeof a.getAttribute===K?m.prop(a,b,c):(1===f&&m.isXMLDoc(a)||(b=b.toLowerCase(),d=m.attrHooks[b]||(m.expr.match.bool.test(b)?nc:mc)),void 0===c?d&&"get"in d&&null!==(e=d.get(a,b))?e:(e=m.find.attr(a,b),null==e?void 0:e):null!==c?d&&"set"in d&&void 0!==(e=d.set(a,c,b))?e:(a.setAttribute(b,c+""),c):void m.removeAttr(a,b))},removeAttr:function(a,b){var c,d,e=0,f=b&&b.match(E);if(f&&1===a.nodeType)while(c=f[e++])d=m.propFix[c]||c,m.expr.match.bool.test(c)?rc&&qc||!pc.test(c)?a[d]=!1:a[m.camelCase("default-"+c)]=a[d]=!1:m.attr(a,c,""),a.removeAttribute(qc?c:d)},attrHooks:{type:{set:function(a,b){if(!k.radioValue&&"radio"===b&&m.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}}}),nc={set:function(a,b,c){return b===!1?m.removeAttr(a,c):rc&&qc||!pc.test(c)?a.setAttribute(!qc&&m.propFix[c]||c,c):a[m.camelCase("default-"+c)]=a[c]=!0,c}},m.each(m.expr.match.bool.source.match(/\w+/g),function(a,b){var c=oc[b]||m.find.attr;oc[b]=rc&&qc||!pc.test(b)?function(a,b,d){var e,f;return d||(f=oc[b],oc[b]=e,e=null!=c(a,b,d)?b.toLowerCase():null,oc[b]=f),e}:function(a,b,c){return c?void 0:a[m.camelCase("default-"+b)]?b.toLowerCase():null}}),rc&&qc||(m.attrHooks.value={set:function(a,b,c){return m.nodeName(a,"input")?void(a.defaultValue=b):mc&&mc.set(a,b,c)}}),qc||(mc={set:function(a,b,c){var d=a.getAttributeNode(c);return d||a.setAttributeNode(d=a.ownerDocument.createAttribute(c)),d.value=b+="","value"===c||b===a.getAttribute(c)?b:void 0}},oc.id=oc.name=oc.coords=function(a,b,c){var d;return c?void 0:(d=a.getAttributeNode(b))&&""!==d.value?d.value:null},m.valHooks.button={get:function(a,b){var c=a.getAttributeNode(b);return c&&c.specified?c.value:void 0},set:mc.set},m.attrHooks.contenteditable={set:function(a,b,c){mc.set(a,""===b?!1:b,c)}},m.each(["width","height"],function(a,b){m.attrHooks[b]={set:function(a,c){return""===c?(a.setAttribute(b,"auto"),c):void 0}}})),k.style||(m.attrHooks.style={get:function(a){return a.style.cssText||void 0},set:function(a,b){return a.style.cssText=b+""}});var sc=/^(?:input|select|textarea|button|object)$/i,tc=/^(?:a|area)$/i;m.fn.extend({prop:function(a,b){return V(this,m.prop,a,b,arguments.length>1)},removeProp:function(a){return a=m.propFix[a]||a,this.each(function(){try{this[a]=void 0,delete this[a]}catch(b){}})}}),m.extend({propFix:{"for":"htmlFor","class":"className"},prop:function(a,b,c){var d,e,f,g=a.nodeType;if(a&&3!==g&&8!==g&&2!==g)return f=1!==g||!m.isXMLDoc(a),f&&(b=m.propFix[b]||b,e=m.propHooks[b]),void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){var b=m.find.attr(a,"tabindex");return b?parseInt(b,10):sc.test(a.nodeName)||tc.test(a.nodeName)&&a.href?0:-1}}}}),k.hrefNormalized||m.each(["href","src"],function(a,b){m.propHooks[b]={get:function(a){return a.getAttribute(b,4)}}}),k.optSelected||(m.propHooks.selected={get:function(a){var b=a.parentNode;return b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex),null}}),m.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){m.propFix[this.toLowerCase()]=this}),k.enctype||(m.propFix.enctype="encoding");var uc=/[\t\r\n\f]/g;m.fn.extend({addClass:function(a){var b,c,d,e,f,g,h=0,i=this.length,j="string"==typeof a&&a;if(m.isFunction(a))return this.each(function(b){m(this).addClass(a.call(this,b,this.className))});if(j)for(b=(a||"").match(E)||[];i>h;h++)if(c=this[h],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(uc," "):" ")){f=0;while(e=b[f++])d.indexOf(" "+e+" ")<0&&(d+=e+" ");g=m.trim(d),c.className!==g&&(c.className=g)}return this},removeClass:function(a){var b,c,d,e,f,g,h=0,i=this.length,j=0===arguments.length||"string"==typeof a&&a;if(m.isFunction(a))return this.each(function(b){m(this).removeClass(a.call(this,b,this.className))});if(j)for(b=(a||"").match(E)||[];i>h;h++)if(c=this[h],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(uc," "):"")){f=0;while(e=b[f++])while(d.indexOf(" "+e+" ")>=0)d=d.replace(" "+e+" "," ");g=a?m.trim(d):"",c.className!==g&&(c.className=g)}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):this.each(m.isFunction(a)?function(c){m(this).toggleClass(a.call(this,c,this.className,b),b)}:function(){if("string"===c){var b,d=0,e=m(this),f=a.match(E)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else(c===K||"boolean"===c)&&(this.className&&m._data(this,"__className__",this.className),this.className=this.className||a===!1?"":m._data(this,"__className__")||"")})},hasClass:function(a){for(var b=" "+a+" ",c=0,d=this.length;d>c;c++)if(1===this[c].nodeType&&(" "+this[c].className+" ").replace(uc," ").indexOf(b)>=0)return!0;return!1}}),m.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 contextmenu".split(" "),function(a,b){m.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),m.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return 1===arguments.length?this.off(a,"**"):this.off(b,a||"**",c)}});var vc=m.now(),wc=/\?/,xc=/(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g;m.parseJSON=function(b){if(a.JSON&&a.JSON.parse)return a.JSON.parse(b+"");var c,d=null,e=m.trim(b+"");return e&&!m.trim(e.replace(xc,function(a,b,e,f){return c&&b&&(d=0),0===d?a:(c=e||b,d+=!f-!e,"")}))?Function("return "+e)():m.error("Invalid JSON: "+b)},m.parseXML=function(b){var c,d;if(!b||"string"!=typeof b)return null;try{a.DOMParser?(d=new DOMParser,c=d.parseFromString(b,"text/xml")):(c=new ActiveXObject("Microsoft.XMLDOM"),c.async="false",c.loadXML(b))}catch(e){c=void 0}return c&&c.documentElement&&!c.getElementsByTagName("parsererror").length||m.error("Invalid XML: "+b),c};var yc,zc,Ac=/#.*$/,Bc=/([?&])_=[^&]*/,Cc=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Dc=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Ec=/^(?:GET|HEAD)$/,Fc=/^\/\//,Gc=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,Hc={},Ic={},Jc="*/".concat("*");try{zc=location.href}catch(Kc){zc=y.createElement("a"),zc.href="",zc=zc.href}yc=Gc.exec(zc.toLowerCase())||[];function Lc(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(E)||[];if(m.isFunction(c))while(d=f[e++])"+"===d.charAt(0)?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function Mc(a,b,c,d){var e={},f=a===Ic;function g(h){var i;return e[h]=!0,m.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||f||e[j]?f?!(i=j):void 0:(b.dataTypes.unshift(j),g(j),!1)}),i}return g(b.dataTypes[0])||!e["*"]&&g("*")}function Nc(a,b){var c,d,e=m.ajaxSettings.flatOptions||{};for(d in b)void 0!==b[d]&&((e[d]?a:c||(c={}))[d]=b[d]);return c&&m.extend(!0,a,c),a}function Oc(a,b,c){var d,e,f,g,h=a.contents,i=a.dataTypes;while("*"===i[0])i.shift(),void 0===e&&(e=a.mimeType||b.getResponseHeader("Content-Type"));if(e)for(g in h)if(h[g]&&h[g].test(e)){i.unshift(g);break}if(i[0]in c)f=i[0];else{for(g in c){if(!i[0]||a.converters[g+" "+i[0]]){f=g;break}d||(d=g)}f=f||d}return f?(f!==i[0]&&i.unshift(f),c[f]):void 0}function Pc(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1])for(g in a.converters)j[g.toLowerCase()]=a.converters[g];f=k.shift();while(f)if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift())if("*"===f)f=i;else if("*"!==i&&i!==f){if(g=j[i+" "+f]||j["* "+f],!g)for(e in j)if(h=e.split(" "),h[1]===f&&(g=j[i+" "+h[0]]||j["* "+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}if(g!==!0)if(g&&a["throws"])b=g(b);else try{b=g(b)}catch(l){return{state:"parsererror",error:g?l:"No conversion from "+i+" to "+f}}}return{state:"success",data:b}}m.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:zc,type:"GET",isLocal:Dc.test(yc[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Jc,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":m.parseJSON,"text xml":m.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?Nc(Nc(a,m.ajaxSettings),b):Nc(m.ajaxSettings,a)},ajaxPrefilter:Lc(Hc),ajaxTransport:Lc(Ic),ajax:function(a,b){"object"==typeof a&&(b=a,a=void 0),b=b||{};var c,d,e,f,g,h,i,j,k=m.ajaxSetup({},b),l=k.context||k,n=k.context&&(l.nodeType||l.jquery)?m(l):m.event,o=m.Deferred(),p=m.Callbacks("once memory"),q=k.statusCode||{},r={},s={},t=0,u="canceled",v={readyState:0,getResponseHeader:function(a){var b;if(2===t){if(!j){j={};while(b=Cc.exec(f))j[b[1].toLowerCase()]=b[2]}b=j[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return 2===t?f:null},setRequestHeader:function(a,b){var c=a.toLowerCase();return t||(a=s[c]=s[c]||a,r[a]=b),this},overrideMimeType:function(a){return t||(k.mimeType=a),this},statusCode:function(a){var b;if(a)if(2>t)for(b in a)q[b]=[q[b],a[b]];else v.always(a[v.status]);return this},abort:function(a){var b=a||u;return i&&i.abort(b),x(0,b),this}};if(o.promise(v).complete=p.add,v.success=v.done,v.error=v.fail,k.url=((a||k.url||zc)+"").replace(Ac,"").replace(Fc,yc[1]+"//"),k.type=b.method||b.type||k.method||k.type,k.dataTypes=m.trim(k.dataType||"*").toLowerCase().match(E)||[""],null==k.crossDomain&&(c=Gc.exec(k.url.toLowerCase()),k.crossDomain=!(!c||c[1]===yc[1]&&c[2]===yc[2]&&(c[3]||("http:"===c[1]?"80":"443"))===(yc[3]||("http:"===yc[1]?"80":"443")))),k.data&&k.processData&&"string"!=typeof k.data&&(k.data=m.param(k.data,k.traditional)),Mc(Hc,k,b,v),2===t)return v;h=k.global,h&&0===m.active++&&m.event.trigger("ajaxStart"),k.type=k.type.toUpperCase(),k.hasContent=!Ec.test(k.type),e=k.url,k.hasContent||(k.data&&(e=k.url+=(wc.test(e)?"&":"?")+k.data,delete k.data),k.cache===!1&&(k.url=Bc.test(e)?e.replace(Bc,"$1_="+vc++):e+(wc.test(e)?"&":"?")+"_="+vc++)),k.ifModified&&(m.lastModified[e]&&v.setRequestHeader("If-Modified-Since",m.lastModified[e]),m.etag[e]&&v.setRequestHeader("If-None-Match",m.etag[e])),(k.data&&k.hasContent&&k.contentType!==!1||b.contentType)&&v.setRequestHeader("Content-Type",k.contentType),v.setRequestHeader("Accept",k.dataTypes[0]&&k.accepts[k.dataTypes[0]]?k.accepts[k.dataTypes[0]]+("*"!==k.dataTypes[0]?", "+Jc+"; q=0.01":""):k.accepts["*"]);for(d in k.headers)v.setRequestHeader(d,k.headers[d]);if(k.beforeSend&&(k.beforeSend.call(l,v,k)===!1||2===t))return v.abort();u="abort";for(d in{success:1,error:1,complete:1})v[d](k[d]);if(i=Mc(Ic,k,b,v)){v.readyState=1,h&&n.trigger("ajaxSend",[v,k]),k.async&&k.timeout>0&&(g=setTimeout(function(){v.abort("timeout")},k.timeout));try{t=1,i.send(r,x)}catch(w){if(!(2>t))throw w;x(-1,w)}}else x(-1,"No Transport");function x(a,b,c,d){var j,r,s,u,w,x=b;2!==t&&(t=2,g&&clearTimeout(g),i=void 0,f=d||"",v.readyState=a>0?4:0,j=a>=200&&300>a||304===a,c&&(u=Oc(k,v,c)),u=Pc(k,u,v,j),j?(k.ifModified&&(w=v.getResponseHeader("Last-Modified"),w&&(m.lastModified[e]=w),w=v.getResponseHeader("etag"),w&&(m.etag[e]=w)),204===a||"HEAD"===k.type?x="nocontent":304===a?x="notmodified":(x=u.state,r=u.data,s=u.error,j=!s)):(s=x,(a||!x)&&(x="error",0>a&&(a=0))),v.status=a,v.statusText=(b||x)+"",j?o.resolveWith(l,[r,x,v]):o.rejectWith(l,[v,x,s]),v.statusCode(q),q=void 0,h&&n.trigger(j?"ajaxSuccess":"ajaxError",[v,k,j?r:s]),p.fireWith(l,[v,x]),h&&(n.trigger("ajaxComplete",[v,k]),--m.active||m.event.trigger("ajaxStop")))}return v},getJSON:function(a,b,c){return m.get(a,b,c,"json")},getScript:function(a,b){return m.get(a,void 0,b,"script")}}),m.each(["get","post"],function(a,b){m[b]=function(a,c,d,e){return m.isFunction(c)&&(e=e||d,d=c,c=void 0),m.ajax({url:a,type:b,dataType:e,data:c,success:d})}}),m.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(a,b){m.fn[b]=function(a){return this.on(b,a)}}),m._evalUrl=function(a){return m.ajax({url:a,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})},m.fn.extend({wrapAll:function(a){if(m.isFunction(a))return this.each(function(b){m(this).wrapAll(a.call(this,b))});if(this[0]){var b=m(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&1===a.firstChild.nodeType)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){return this.each(m.isFunction(a)?function(b){m(this).wrapInner(a.call(this,b))}:function(){var b=m(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=m.isFunction(a);return this.each(function(c){m(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){m.nodeName(this,"body")||m(this).replaceWith(this.childNodes)}).end()}}),m.expr.filters.hidden=function(a){return a.offsetWidth<=0&&a.offsetHeight<=0||!k.reliableHiddenOffsets()&&"none"===(a.style&&a.style.display||m.css(a,"display"))},m.expr.filters.visible=function(a){return!m.expr.filters.hidden(a)};var Qc=/%20/g,Rc=/\[\]$/,Sc=/\r?\n/g,Tc=/^(?:submit|button|image|reset|file)$/i,Uc=/^(?:input|select|textarea|keygen)/i;function Vc(a,b,c,d){var e;if(m.isArray(b))m.each(b,function(b,e){c||Rc.test(a)?d(a,e):Vc(a+"["+("object"==typeof e?b:"")+"]",e,c,d)});else if(c||"object"!==m.type(b))d(a,b);else for(e in b)Vc(a+"["+e+"]",b[e],c,d)}m.param=function(a,b){var c,d=[],e=function(a,b){b=m.isFunction(b)?b():null==b?"":b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};if(void 0===b&&(b=m.ajaxSettings&&m.ajaxSettings.traditional),m.isArray(a)||a.jquery&&!m.isPlainObject(a))m.each(a,function(){e(this.name,this.value)});else for(c in a)Vc(c,a[c],b,e);return d.join("&").replace(Qc,"+")},m.fn.extend({serialize:function(){return m.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=m.prop(this,"elements");return a?m.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!m(this).is(":disabled")&&Uc.test(this.nodeName)&&!Tc.test(a)&&(this.checked||!W.test(a))}).map(function(a,b){var c=m(this).val();return null==c?null:m.isArray(c)?m.map(c,function(a){return{name:b.name,value:a.replace(Sc,"\r\n")}}):{name:b.name,value:c.replace(Sc,"\r\n")}}).get()}}),m.ajaxSettings.xhr=void 0!==a.ActiveXObject?function(){return!this.isLocal&&/^(get|post|head|put|delete|options)$/i.test(this.type)&&Zc()||$c()}:Zc;var Wc=0,Xc={},Yc=m.ajaxSettings.xhr();a.ActiveXObject&&m(a).on("unload",function(){for(var a in Xc)Xc[a](void 0,!0)}),k.cors=!!Yc&&"withCredentials"in Yc,Yc=k.ajax=!!Yc,Yc&&m.ajaxTransport(function(a){if(!a.crossDomain||k.cors){var b;return{send:function(c,d){var e,f=a.xhr(),g=++Wc;if(f.open(a.type,a.url,a.async,a.username,a.password),a.xhrFields)for(e in a.xhrFields)f[e]=a.xhrFields[e];a.mimeType&&f.overrideMimeType&&f.overrideMimeType(a.mimeType),a.crossDomain||c["X-Requested-With"]||(c["X-Requested-With"]="XMLHttpRequest");for(e in c)void 0!==c[e]&&f.setRequestHeader(e,c[e]+"");f.send(a.hasContent&&a.data||null),b=function(c,e){var h,i,j;if(b&&(e||4===f.readyState))if(delete Xc[g],b=void 0,f.onreadystatechange=m.noop,e)4!==f.readyState&&f.abort();else{j={},h=f.status,"string"==typeof f.responseText&&(j.text=f.responseText);try{i=f.statusText}catch(k){i=""}h||!a.isLocal||a.crossDomain?1223===h&&(h=204):h=j.text?200:404}j&&d(h,i,j,f.getAllResponseHeaders())},a.async?4===f.readyState?setTimeout(b):f.onreadystatechange=Xc[g]=b:b()},abort:function(){b&&b(void 0,!0)}}}});function Zc(){try{return new a.XMLHttpRequest}catch(b){}}function $c(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}m.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(a){return m.globalEval(a),a}}}),m.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),m.ajaxTransport("script",function(a){if(a.crossDomain){var b,c=y.head||m("head")[0]||y.documentElement;return{send:function(d,e){b=y.createElement("script"),b.async=!0,a.scriptCharset&&(b.charset=a.scriptCharset),b.src=a.url,b.onload=b.onreadystatechange=function(a,c){(c||!b.readyState||/loaded|complete/.test(b.readyState))&&(b.onload=b.onreadystatechange=null,b.parentNode&&b.parentNode.removeChild(b),b=null,c||e(200,"success"))},c.insertBefore(b,c.firstChild)},abort:function(){b&&b.onload(void 0,!0)}}}});var _c=[],ad=/(=)\?(?=&|$)|\?\?/;m.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=_c.pop()||m.expando+"_"+vc++;return this[a]=!0,a}}),m.ajaxPrefilter("json jsonp",function(b,c,d){var e,f,g,h=b.jsonp!==!1&&(ad.test(b.url)?"url":"string"==typeof b.data&&!(b.contentType||"").indexOf("application/x-www-form-urlencoded")&&ad.test(b.data)&&"data");return h||"jsonp"===b.dataTypes[0]?(e=b.jsonpCallback=m.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,h?b[h]=b[h].replace(ad,"$1"+e):b.jsonp!==!1&&(b.url+=(wc.test(b.url)?"&":"?")+b.jsonp+"="+e),b.converters["script json"]=function(){return g||m.error(e+" was not called"),g[0]},b.dataTypes[0]="json",f=a[e],a[e]=function(){g=arguments},d.always(function(){a[e]=f,b[e]&&(b.jsonpCallback=c.jsonpCallback,_c.push(e)),g&&m.isFunction(f)&&f(g[0]),g=f=void 0}),"script"):void 0}),m.parseHTML=function(a,b,c){if(!a||"string"!=typeof a)return null;"boolean"==typeof b&&(c=b,b=!1),b=b||y;var d=u.exec(a),e=!c&&[];return d?[b.createElement(d[1])]:(d=m.buildFragment([a],b,e),e&&e.length&&m(e).remove(),m.merge([],d.childNodes))};var bd=m.fn.load;m.fn.load=function(a,b,c){if("string"!=typeof a&&bd)return bd.apply(this,arguments);var d,e,f,g=this,h=a.indexOf(" ");return h>=0&&(d=m.trim(a.slice(h,a.length)),a=a.slice(0,h)),m.isFunction(b)?(c=b,b=void 0):b&&"object"==typeof b&&(f="POST"),g.length>0&&m.ajax({url:a,type:f,dataType:"html",data:b}).done(function(a){e=arguments,g.html(d?m("<div>").append(m.parseHTML(a)).find(d):a)}).complete(c&&function(a,b){g.each(c,e||[a.responseText,b,a])}),this},m.expr.filters.animated=function(a){return m.grep(m.timers,function(b){return a===b.elem}).length};var cd=a.document.documentElement;function dd(a){return m.isWindow(a)?a:9===a.nodeType?a.defaultView||a.parentWindow:!1}m.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=m.css(a,"position"),l=m(a),n={};"static"===k&&(a.style.position="relative"),h=l.offset(),f=m.css(a,"top"),i=m.css(a,"left"),j=("absolute"===k||"fixed"===k)&&m.inArray("auto",[f,i])>-1,j?(d=l.position(),g=d.top,e=d.left):(g=parseFloat(f)||0,e=parseFloat(i)||0),m.isFunction(b)&&(b=b.call(a,c,h)),null!=b.top&&(n.top=b.top-h.top+g),null!=b.left&&(n.left=b.left-h.left+e),"using"in b?b.using.call(a,n):l.css(n)}},m.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){m.offset.setOffset(this,a,b)});var b,c,d={top:0,left:0},e=this[0],f=e&&e.ownerDocument;if(f)return b=f.documentElement,m.contains(b,e)?(typeof e.getBoundingClientRect!==K&&(d=e.getBoundingClientRect()),c=dd(f),{top:d.top+(c.pageYOffset||b.scrollTop)-(b.clientTop||0),left:d.left+(c.pageXOffset||b.scrollLeft)-(b.clientLeft||0)}):d},position:function(){if(this[0]){var a,b,c={top:0,left:0},d=this[0];return"fixed"===m.css(d,"position")?b=d.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),m.nodeName(a[0],"html")||(c=a.offset()),c.top+=m.css(a[0],"borderTopWidth",!0),c.left+=m.css(a[0],"borderLeftWidth",!0)),{top:b.top-c.top-m.css(d,"marginTop",!0),left:b.left-c.left-m.css(d,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||cd;while(a&&!m.nodeName(a,"html")&&"static"===m.css(a,"position"))a=a.offsetParent;return a||cd})}}),m.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,b){var c=/Y/.test(b);m.fn[a]=function(d){return V(this,function(a,d,e){var f=dd(a);return void 0===e?f?b in f?f[b]:f.document.documentElement[d]:a[d]:void(f?f.scrollTo(c?m(f).scrollLeft():e,c?e:m(f).scrollTop()):a[d]=e)},a,d,arguments.length,null)}}),m.each(["top","left"],function(a,b){m.cssHooks[b]=Lb(k.pixelPosition,function(a,c){return c?(c=Jb(a,b),Hb.test(c)?m(a).position()[b]+"px":c):void 0})}),m.each({Height:"height",Width:"width"},function(a,b){m.each({padding:"inner"+a,content:b,"":"outer"+a},function(c,d){m.fn[d]=function(d,e){var f=arguments.length&&(c||"boolean"!=typeof d),g=c||(d===!0||e===!0?"margin":"border");return V(this,function(b,c,d){var e;return m.isWindow(b)?b.document.documentElement["client"+a]:9===b.nodeType?(e=b.documentElement,Math.max(b.body["scroll"+a],e["scroll"+a],b.body["offset"+a],e["offset"+a],e["client"+a])):void 0===d?m.css(b,c,g):m.style(b,c,d,g)},b,f?d:void 0,f,null)}})}),m.fn.size=function(){return this.length},m.fn.andSelf=m.fn.addBack,"function"==typeof define&&define.amd&&define("jquery",[],function(){return m});var ed=a.jQuery,fd=a.$;return m.noConflict=function(b){return a.$===m&&(a.$=fd),b&&a.jQuery===m&&(a.jQuery=ed),m},typeof b===K&&(a.jQuery=a.$=m),m});
js/ICEshop/Iceimport/jquery-1.9.1.min.js DELETED
@@ -1,4 +0,0 @@
1
- /*! jQuery v1.9.1 | (c) 2005, 2012 jQuery Foundation, Inc. | jquery.org/license */
2
- (function(e,t){var n,r,i=typeof t,o=e.document,a=e.location,s=e.jQuery,u=e.$,l={},c=[],p="1.9.1",f=c.concat,d=c.push,h=c.slice,g=c.indexOf,m=l.toString,y=l.hasOwnProperty,v=p.trim,b=function(e,t){return new b.fn.init(e,t,r)},x=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,w=/\S+/g,T=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,N=/^(?:(<[\w\W]+>)[^>]*|#([\w-]*))$/,C=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,k=/^[\],:{}\s]*$/,E=/(?:^|:|,)(?:\s*\[)+/g,S=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,A=/"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,j=/^-ms-/,D=/-([\da-z])/gi,L=function(e,t){return t.toUpperCase()},H=function(e){(o.addEventListener||"load"===e.type||"complete"===o.readyState)&&(q(),b.ready())},q=function(){o.addEventListener?(o.removeEventListener("DOMContentLoaded",H,!1),e.removeEventListener("load",H,!1)):(o.detachEvent("onreadystatechange",H),e.detachEvent("onload",H))};b.fn=b.prototype={jquery:p,constructor:b,init:function(e,n,r){var i,a;if(!e)return this;if("string"==typeof e){if(i="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:N.exec(e),!i||!i[1]&&n)return!n||n.jquery?(n||r).find(e):this.constructor(n).find(e);if(i[1]){if(n=n instanceof b?n[0]:n,b.merge(this,b.parseHTML(i[1],n&&n.nodeType?n.ownerDocument||n:o,!0)),C.test(i[1])&&b.isPlainObject(n))for(i in n)b.isFunction(this[i])?this[i](n[i]):this.attr(i,n[i]);return this}if(a=o.getElementById(i[2]),a&&a.parentNode){if(a.id!==i[2])return r.find(e);this.length=1,this[0]=a}return this.context=o,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):b.isFunction(e)?r.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),b.makeArray(e,this))},selector:"",length:0,size:function(){return this.length},toArray:function(){return h.call(this)},get:function(e){return null==e?this.toArray():0>e?this[this.length+e]:this[e]},pushStack:function(e){var t=b.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e,t){return b.each(this,e,t)},ready:function(e){return b.ready.promise().done(e),this},slice:function(){return this.pushStack(h.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(0>e?t:0);return this.pushStack(n>=0&&t>n?[this[n]]:[])},map:function(e){return this.pushStack(b.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:d,sort:[].sort,splice:[].splice},b.fn.init.prototype=b.fn,b.extend=b.fn.extend=function(){var e,n,r,i,o,a,s=arguments[0]||{},u=1,l=arguments.length,c=!1;for("boolean"==typeof s&&(c=s,s=arguments[1]||{},u=2),"object"==typeof s||b.isFunction(s)||(s={}),l===u&&(s=this,--u);l>u;u++)if(null!=(o=arguments[u]))for(i in o)e=s[i],r=o[i],s!==r&&(c&&r&&(b.isPlainObject(r)||(n=b.isArray(r)))?(n?(n=!1,a=e&&b.isArray(e)?e:[]):a=e&&b.isPlainObject(e)?e:{},s[i]=b.extend(c,a,r)):r!==t&&(s[i]=r));return s},b.extend({noConflict:function(t){return e.$===b&&(e.$=u),t&&e.jQuery===b&&(e.jQuery=s),b},isReady:!1,readyWait:1,holdReady:function(e){e?b.readyWait++:b.ready(!0)},ready:function(e){if(e===!0?!--b.readyWait:!b.isReady){if(!o.body)return setTimeout(b.ready);b.isReady=!0,e!==!0&&--b.readyWait>0||(n.resolveWith(o,[b]),b.fn.trigger&&b(o).trigger("ready").off("ready"))}},isFunction:function(e){return"function"===b.type(e)},isArray:Array.isArray||function(e){return"array"===b.type(e)},isWindow:function(e){return null!=e&&e==e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?l[m.call(e)]||"object":typeof e},isPlainObject:function(e){if(!e||"object"!==b.type(e)||e.nodeType||b.isWindow(e))return!1;try{if(e.constructor&&!y.call(e,"constructor")&&!y.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(n){return!1}var r;for(r in e);return r===t||y.call(e,r)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw Error(e)},parseHTML:function(e,t,n){if(!e||"string"!=typeof e)return null;"boolean"==typeof t&&(n=t,t=!1),t=t||o;var r=C.exec(e),i=!n&&[];return r?[t.createElement(r[1])]:(r=b.buildFragment([e],t,i),i&&b(i).remove(),b.merge([],r.childNodes))},parseJSON:function(n){return e.JSON&&e.JSON.parse?e.JSON.parse(n):null===n?n:"string"==typeof n&&(n=b.trim(n),n&&k.test(n.replace(S,"@").replace(A,"]").replace(E,"")))?Function("return "+n)():(b.error("Invalid JSON: "+n),t)},parseXML:function(n){var r,i;if(!n||"string"!=typeof n)return null;try{e.DOMParser?(i=new DOMParser,r=i.parseFromString(n,"text/xml")):(r=new ActiveXObject("Microsoft.XMLDOM"),r.async="false",r.loadXML(n))}catch(o){r=t}return r&&r.documentElement&&!r.getElementsByTagName("parsererror").length||b.error("Invalid XML: "+n),r},noop:function(){},globalEval:function(t){t&&b.trim(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(j,"ms-").replace(D,L)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t,n){var r,i=0,o=e.length,a=M(e);if(n){if(a){for(;o>i;i++)if(r=t.apply(e[i],n),r===!1)break}else for(i in e)if(r=t.apply(e[i],n),r===!1)break}else if(a){for(;o>i;i++)if(r=t.call(e[i],i,e[i]),r===!1)break}else for(i in e)if(r=t.call(e[i],i,e[i]),r===!1)break;return e},trim:v&&!v.call("\ufeff\u00a0")?function(e){return null==e?"":v.call(e)}:function(e){return null==e?"":(e+"").replace(T,"")},makeArray:function(e,t){var n=t||[];return null!=e&&(M(Object(e))?b.merge(n,"string"==typeof e?[e]:e):d.call(n,e)),n},inArray:function(e,t,n){var r;if(t){if(g)return g.call(t,e,n);for(r=t.length,n=n?0>n?Math.max(0,r+n):n:0;r>n;n++)if(n in t&&t[n]===e)return n}return-1},merge:function(e,n){var r=n.length,i=e.length,o=0;if("number"==typeof r)for(;r>o;o++)e[i++]=n[o];else while(n[o]!==t)e[i++]=n[o++];return e.length=i,e},grep:function(e,t,n){var r,i=[],o=0,a=e.length;for(n=!!n;a>o;o++)r=!!t(e[o],o),n!==r&&i.push(e[o]);return i},map:function(e,t,n){var r,i=0,o=e.length,a=M(e),s=[];if(a)for(;o>i;i++)r=t(e[i],i,n),null!=r&&(s[s.length]=r);else for(i in e)r=t(e[i],i,n),null!=r&&(s[s.length]=r);return f.apply([],s)},guid:1,proxy:function(e,n){var r,i,o;return"string"==typeof n&&(o=e[n],n=e,e=o),b.isFunction(e)?(r=h.call(arguments,2),i=function(){return e.apply(n||this,r.concat(h.call(arguments)))},i.guid=e.guid=e.guid||b.guid++,i):t},access:function(e,n,r,i,o,a,s){var u=0,l=e.length,c=null==r;if("object"===b.type(r)){o=!0;for(u in r)b.access(e,n,u,r[u],!0,a,s)}else if(i!==t&&(o=!0,b.isFunction(i)||(s=!0),c&&(s?(n.call(e,i),n=null):(c=n,n=function(e,t,n){return c.call(b(e),n)})),n))for(;l>u;u++)n(e[u],r,s?i:i.call(e[u],u,n(e[u],r)));return o?e:c?n.call(e):l?n(e[0],r):a},now:function(){return(new Date).getTime()}}),b.ready.promise=function(t){if(!n)if(n=b.Deferred(),"complete"===o.readyState)setTimeout(b.ready);else if(o.addEventListener)o.addEventListener("DOMContentLoaded",H,!1),e.addEventListener("load",H,!1);else{o.attachEvent("onreadystatechange",H),e.attachEvent("onload",H);var r=!1;try{r=null==e.frameElement&&o.documentElement}catch(i){}r&&r.doScroll&&function a(){if(!b.isReady){try{r.doScroll("left")}catch(e){return setTimeout(a,50)}q(),b.ready()}}()}return n.promise(t)},b.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(e,t){l["[object "+t+"]"]=t.toLowerCase()});function M(e){var t=e.length,n=b.type(e);return b.isWindow(e)?!1:1===e.nodeType&&t?!0:"array"===n||"function"!==n&&(0===t||"number"==typeof t&&t>0&&t-1 in e)}r=b(o);var _={};function F(e){var t=_[e]={};return b.each(e.match(w)||[],function(e,n){t[n]=!0}),t}b.Callbacks=function(e){e="string"==typeof e?_[e]||F(e):b.extend({},e);var n,r,i,o,a,s,u=[],l=!e.once&&[],c=function(t){for(r=e.memory&&t,i=!0,a=s||0,s=0,o=u.length,n=!0;u&&o>a;a++)if(u[a].apply(t[0],t[1])===!1&&e.stopOnFalse){r=!1;break}n=!1,u&&(l?l.length&&c(l.shift()):r?u=[]:p.disable())},p={add:function(){if(u){var t=u.length;(function i(t){b.each(t,function(t,n){var r=b.type(n);"function"===r?e.unique&&p.has(n)||u.push(n):n&&n.length&&"string"!==r&&i(n)})})(arguments),n?o=u.length:r&&(s=t,c(r))}return this},remove:function(){return u&&b.each(arguments,function(e,t){var r;while((r=b.inArray(t,u,r))>-1)u.splice(r,1),n&&(o>=r&&o--,a>=r&&a--)}),this},has:function(e){return e?b.inArray(e,u)>-1:!(!u||!u.length)},empty:function(){return u=[],this},disable:function(){return u=l=r=t,this},disabled:function(){return!u},lock:function(){return l=t,r||p.disable(),this},locked:function(){return!l},fireWith:function(e,t){return t=t||[],t=[e,t.slice?t.slice():t],!u||i&&!l||(n?l.push(t):c(t)),this},fire:function(){return p.fireWith(this,arguments),this},fired:function(){return!!i}};return p},b.extend({Deferred:function(e){var t=[["resolve","done",b.Callbacks("once memory"),"resolved"],["reject","fail",b.Callbacks("once memory"),"rejected"],["notify","progress",b.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return b.Deferred(function(n){b.each(t,function(t,o){var a=o[0],s=b.isFunction(e[t])&&e[t];i[o[1]](function(){var e=s&&s.apply(this,arguments);e&&b.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[a+"With"](this===r?n.promise():this,s?[e]:arguments)})}),e=null}).promise()},promise:function(e){return null!=e?b.extend(e,r):r}},i={};return r.pipe=r.then,b.each(t,function(e,o){var a=o[2],s=o[3];r[o[1]]=a.add,s&&a.add(function(){n=s},t[1^e][2].disable,t[2][2].lock),i[o[0]]=function(){return i[o[0]+"With"](this===i?r:this,arguments),this},i[o[0]+"With"]=a.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t=0,n=h.call(arguments),r=n.length,i=1!==r||e&&b.isFunction(e.promise)?r:0,o=1===i?e:b.Deferred(),a=function(e,t,n){return function(r){t[e]=this,n[e]=arguments.length>1?h.call(arguments):r,n===s?o.notifyWith(t,n):--i||o.resolveWith(t,n)}},s,u,l;if(r>1)for(s=Array(r),u=Array(r),l=Array(r);r>t;t++)n[t]&&b.isFunction(n[t].promise)?n[t].promise().done(a(t,l,n)).fail(o.reject).progress(a(t,u,s)):--i;return i||o.resolveWith(l,n),o.promise()}}),b.support=function(){var t,n,r,a,s,u,l,c,p,f,d=o.createElement("div");if(d.setAttribute("className","t"),d.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",n=d.getElementsByTagName("*"),r=d.getElementsByTagName("a")[0],!n||!r||!n.length)return{};s=o.createElement("select"),l=s.appendChild(o.createElement("option")),a=d.getElementsByTagName("input")[0],r.style.cssText="top:1px;float:left;opacity:.5",t={getSetAttribute:"t"!==d.className,leadingWhitespace:3===d.firstChild.nodeType,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/top/.test(r.getAttribute("style")),hrefNormalized:"/a"===r.getAttribute("href"),opacity:/^0.5/.test(r.style.opacity),cssFloat:!!r.style.cssFloat,checkOn:!!a.value,optSelected:l.selected,enctype:!!o.createElement("form").enctype,html5Clone:"<:nav></:nav>"!==o.createElement("nav").cloneNode(!0).outerHTML,boxModel:"CSS1Compat"===o.compatMode,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,boxSizingReliable:!0,pixelPosition:!1},a.checked=!0,t.noCloneChecked=a.cloneNode(!0).checked,s.disabled=!0,t.optDisabled=!l.disabled;try{delete d.test}catch(h){t.deleteExpando=!1}a=o.createElement("input"),a.setAttribute("value",""),t.input=""===a.getAttribute("value"),a.value="t",a.setAttribute("type","radio"),t.radioValue="t"===a.value,a.setAttribute("checked","t"),a.setAttribute("name","t"),u=o.createDocumentFragment(),u.appendChild(a),t.appendChecked=a.checked,t.checkClone=u.cloneNode(!0).cloneNode(!0).lastChild.checked,d.attachEvent&&(d.attachEvent("onclick",function(){t.noCloneEvent=!1}),d.cloneNode(!0).click());for(f in{submit:!0,change:!0,focusin:!0})d.setAttribute(c="on"+f,"t"),t[f+"Bubbles"]=c in e||d.attributes[c].expando===!1;return d.style.backgroundClip="content-box",d.cloneNode(!0).style.backgroundClip="",t.clearCloneStyle="content-box"===d.style.backgroundClip,b(function(){var n,r,a,s="padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",u=o.getElementsByTagName("body")[0];u&&(n=o.createElement("div"),n.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",u.appendChild(n).appendChild(d),d.innerHTML="<table><tr><td></td><td>t</td></tr></table>",a=d.getElementsByTagName("td"),a[0].style.cssText="padding:0;margin:0;border:0;display:none",p=0===a[0].offsetHeight,a[0].style.display="",a[1].style.display="none",t.reliableHiddenOffsets=p&&0===a[0].offsetHeight,d.innerHTML="",d.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",t.boxSizing=4===d.offsetWidth,t.doesNotIncludeMarginInBodyOffset=1!==u.offsetTop,e.getComputedStyle&&(t.pixelPosition="1%"!==(e.getComputedStyle(d,null)||{}).top,t.boxSizingReliable="4px"===(e.getComputedStyle(d,null)||{width:"4px"}).width,r=d.appendChild(o.createElement("div")),r.style.cssText=d.style.cssText=s,r.style.marginRight=r.style.width="0",d.style.width="1px",t.reliableMarginRight=!parseFloat((e.getComputedStyle(r,null)||{}).marginRight)),typeof d.style.zoom!==i&&(d.innerHTML="",d.style.cssText=s+"width:1px;padding:1px;display:inline;zoom:1",t.inlineBlockNeedsLayout=3===d.offsetWidth,d.style.display="block",d.innerHTML="<div></div>",d.firstChild.style.width="5px",t.shrinkWrapBlocks=3!==d.offsetWidth,t.inlineBlockNeedsLayout&&(u.style.zoom=1)),u.removeChild(n),n=d=a=r=null)}),n=s=u=l=r=a=null,t}();var O=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,B=/([A-Z])/g;function P(e,n,r,i){if(b.acceptData(e)){var o,a,s=b.expando,u="string"==typeof n,l=e.nodeType,p=l?b.cache:e,f=l?e[s]:e[s]&&s;if(f&&p[f]&&(i||p[f].data)||!u||r!==t)return f||(l?e[s]=f=c.pop()||b.guid++:f=s),p[f]||(p[f]={},l||(p[f].toJSON=b.noop)),("object"==typeof n||"function"==typeof n)&&(i?p[f]=b.extend(p[f],n):p[f].data=b.extend(p[f].data,n)),o=p[f],i||(o.data||(o.data={}),o=o.data),r!==t&&(o[b.camelCase(n)]=r),u?(a=o[n],null==a&&(a=o[b.camelCase(n)])):a=o,a}}function R(e,t,n){if(b.acceptData(e)){var r,i,o,a=e.nodeType,s=a?b.cache:e,u=a?e[b.expando]:b.expando;if(s[u]){if(t&&(o=n?s[u]:s[u].data)){b.isArray(t)?t=t.concat(b.map(t,b.camelCase)):t in o?t=[t]:(t=b.camelCase(t),t=t in o?[t]:t.split(" "));for(r=0,i=t.length;i>r;r++)delete o[t[r]];if(!(n?$:b.isEmptyObject)(o))return}(n||(delete s[u].data,$(s[u])))&&(a?b.cleanData([e],!0):b.support.deleteExpando||s!=s.window?delete s[u]:s[u]=null)}}}b.extend({cache:{},expando:"jQuery"+(p+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(e){return e=e.nodeType?b.cache[e[b.expando]]:e[b.expando],!!e&&!$(e)},data:function(e,t,n){return P(e,t,n)},removeData:function(e,t){return R(e,t)},_data:function(e,t,n){return P(e,t,n,!0)},_removeData:function(e,t){return R(e,t,!0)},acceptData:function(e){if(e.nodeType&&1!==e.nodeType&&9!==e.nodeType)return!1;var t=e.nodeName&&b.noData[e.nodeName.toLowerCase()];return!t||t!==!0&&e.getAttribute("classid")===t}}),b.fn.extend({data:function(e,n){var r,i,o=this[0],a=0,s=null;if(e===t){if(this.length&&(s=b.data(o),1===o.nodeType&&!b._data(o,"parsedAttrs"))){for(r=o.attributes;r.length>a;a++)i=r[a].name,i.indexOf("data-")||(i=b.camelCase(i.slice(5)),W(o,i,s[i]));b._data(o,"parsedAttrs",!0)}return s}return"object"==typeof e?this.each(function(){b.data(this,e)}):b.access(this,function(n){return n===t?o?W(o,e,b.data(o,e)):null:(this.each(function(){b.data(this,e,n)}),t)},null,n,arguments.length>1,null,!0)},removeData:function(e){return this.each(function(){b.removeData(this,e)})}});function W(e,n,r){if(r===t&&1===e.nodeType){var i="data-"+n.replace(B,"-$1").toLowerCase();if(r=e.getAttribute(i),"string"==typeof r){try{r="true"===r?!0:"false"===r?!1:"null"===r?null:+r+""===r?+r:O.test(r)?b.parseJSON(r):r}catch(o){}b.data(e,n,r)}else r=t}return r}function $(e){var t;for(t in e)if(("data"!==t||!b.isEmptyObject(e[t]))&&"toJSON"!==t)return!1;return!0}b.extend({queue:function(e,n,r){var i;return e?(n=(n||"fx")+"queue",i=b._data(e,n),r&&(!i||b.isArray(r)?i=b._data(e,n,b.makeArray(r)):i.push(r)),i||[]):t},dequeue:function(e,t){t=t||"fx";var n=b.queue(e,t),r=n.length,i=n.shift(),o=b._queueHooks(e,t),a=function(){b.dequeue(e,t)};"inprogress"===i&&(i=n.shift(),r--),o.cur=i,i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,a,o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return b._data(e,n)||b._data(e,n,{empty:b.Callbacks("once memory").add(function(){b._removeData(e,t+"queue"),b._removeData(e,n)})})}}),b.fn.extend({queue:function(e,n){var r=2;return"string"!=typeof e&&(n=e,e="fx",r--),r>arguments.length?b.queue(this[0],e):n===t?this:this.each(function(){var t=b.queue(this,e,n);b._queueHooks(this,e),"fx"===e&&"inprogress"!==t[0]&&b.dequeue(this,e)})},dequeue:function(e){return this.each(function(){b.dequeue(this,e)})},delay:function(e,t){return e=b.fx?b.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,n){var r=setTimeout(t,e);n.stop=function(){clearTimeout(r)}})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,n){var r,i=1,o=b.Deferred(),a=this,s=this.length,u=function(){--i||o.resolveWith(a,[a])};"string"!=typeof e&&(n=e,e=t),e=e||"fx";while(s--)r=b._data(a[s],e+"queueHooks"),r&&r.empty&&(i++,r.empty.add(u));return u(),o.promise(n)}});var I,z,X=/[\t\r\n]/g,U=/\r/g,V=/^(?:input|select|textarea|button|object)$/i,Y=/^(?:a|area)$/i,J=/^(?:checked|selected|autofocus|autoplay|async|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped)$/i,G=/^(?:checked|selected)$/i,Q=b.support.getSetAttribute,K=b.support.input;b.fn.extend({attr:function(e,t){return b.access(this,b.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){b.removeAttr(this,e)})},prop:function(e,t){return b.access(this,b.prop,e,t,arguments.length>1)},removeProp:function(e){return e=b.propFix[e]||e,this.each(function(){try{this[e]=t,delete this[e]}catch(n){}})},addClass:function(e){var t,n,r,i,o,a=0,s=this.length,u="string"==typeof e&&e;if(b.isFunction(e))return this.each(function(t){b(this).addClass(e.call(this,t,this.className))});if(u)for(t=(e||"").match(w)||[];s>a;a++)if(n=this[a],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(X," "):" ")){o=0;while(i=t[o++])0>r.indexOf(" "+i+" ")&&(r+=i+" ");n.className=b.trim(r)}return this},removeClass:function(e){var t,n,r,i,o,a=0,s=this.length,u=0===arguments.length||"string"==typeof e&&e;if(b.isFunction(e))return this.each(function(t){b(this).removeClass(e.call(this,t,this.className))});if(u)for(t=(e||"").match(w)||[];s>a;a++)if(n=this[a],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(X," "):"")){o=0;while(i=t[o++])while(r.indexOf(" "+i+" ")>=0)r=r.replace(" "+i+" "," ");n.className=e?b.trim(r):""}return this},toggleClass:function(e,t){var n=typeof e,r="boolean"==typeof t;return b.isFunction(e)?this.each(function(n){b(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if("string"===n){var o,a=0,s=b(this),u=t,l=e.match(w)||[];while(o=l[a++])u=r?u:!s.hasClass(o),s[u?"addClass":"removeClass"](o)}else(n===i||"boolean"===n)&&(this.className&&b._data(this,"__className__",this.className),this.className=this.className||e===!1?"":b._data(this,"__className__")||"")})},hasClass:function(e){var t=" "+e+" ",n=0,r=this.length;for(;r>n;n++)if(1===this[n].nodeType&&(" "+this[n].className+" ").replace(X," ").indexOf(t)>=0)return!0;return!1},val:function(e){var n,r,i,o=this[0];{if(arguments.length)return i=b.isFunction(e),this.each(function(n){var o,a=b(this);1===this.nodeType&&(o=i?e.call(this,n,a.val()):e,null==o?o="":"number"==typeof o?o+="":b.isArray(o)&&(o=b.map(o,function(e){return null==e?"":e+""})),r=b.valHooks[this.type]||b.valHooks[this.nodeName.toLowerCase()],r&&"set"in r&&r.set(this,o,"value")!==t||(this.value=o))});if(o)return r=b.valHooks[o.type]||b.valHooks[o.nodeName.toLowerCase()],r&&"get"in r&&(n=r.get(o,"value"))!==t?n:(n=o.value,"string"==typeof n?n.replace(U,""):null==n?"":n)}}}),b.extend({valHooks:{option:{get:function(e){var t=e.attributes.value;return!t||t.specified?e.value:e.text}},select:{get:function(e){var t,n,r=e.options,i=e.selectedIndex,o="select-one"===e.type||0>i,a=o?null:[],s=o?i+1:r.length,u=0>i?s:o?i:0;for(;s>u;u++)if(n=r[u],!(!n.selected&&u!==i||(b.support.optDisabled?n.disabled:null!==n.getAttribute("disabled"))||n.parentNode.disabled&&b.nodeName(n.parentNode,"optgroup"))){if(t=b(n).val(),o)return t;a.push(t)}return a},set:function(e,t){var n=b.makeArray(t);return b(e).find("option").each(function(){this.selected=b.inArray(b(this).val(),n)>=0}),n.length||(e.selectedIndex=-1),n}}},attr:function(e,n,r){var o,a,s,u=e.nodeType;if(e&&3!==u&&8!==u&&2!==u)return typeof e.getAttribute===i?b.prop(e,n,r):(a=1!==u||!b.isXMLDoc(e),a&&(n=n.toLowerCase(),o=b.attrHooks[n]||(J.test(n)?z:I)),r===t?o&&a&&"get"in o&&null!==(s=o.get(e,n))?s:(typeof e.getAttribute!==i&&(s=e.getAttribute(n)),null==s?t:s):null!==r?o&&a&&"set"in o&&(s=o.set(e,r,n))!==t?s:(e.setAttribute(n,r+""),r):(b.removeAttr(e,n),t))},removeAttr:function(e,t){var n,r,i=0,o=t&&t.match(w);if(o&&1===e.nodeType)while(n=o[i++])r=b.propFix[n]||n,J.test(n)?!Q&&G.test(n)?e[b.camelCase("default-"+n)]=e[r]=!1:e[r]=!1:b.attr(e,n,""),e.removeAttribute(Q?n:r)},attrHooks:{type:{set:function(e,t){if(!b.support.radioValue&&"radio"===t&&b.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},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(e,n,r){var i,o,a,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return a=1!==s||!b.isXMLDoc(e),a&&(n=b.propFix[n]||n,o=b.propHooks[n]),r!==t?o&&"set"in o&&(i=o.set(e,r,n))!==t?i:e[n]=r:o&&"get"in o&&null!==(i=o.get(e,n))?i:e[n]},propHooks:{tabIndex:{get:function(e){var n=e.getAttributeNode("tabindex");return n&&n.specified?parseInt(n.value,10):V.test(e.nodeName)||Y.test(e.nodeName)&&e.href?0:t}}}}),z={get:function(e,n){var r=b.prop(e,n),i="boolean"==typeof r&&e.getAttribute(n),o="boolean"==typeof r?K&&Q?null!=i:G.test(n)?e[b.camelCase("default-"+n)]:!!i:e.getAttributeNode(n);return o&&o.value!==!1?n.toLowerCase():t},set:function(e,t,n){return t===!1?b.removeAttr(e,n):K&&Q||!G.test(n)?e.setAttribute(!Q&&b.propFix[n]||n,n):e[b.camelCase("default-"+n)]=e[n]=!0,n}},K&&Q||(b.attrHooks.value={get:function(e,n){var r=e.getAttributeNode(n);return b.nodeName(e,"input")?e.defaultValue:r&&r.specified?r.value:t},set:function(e,n,r){return b.nodeName(e,"input")?(e.defaultValue=n,t):I&&I.set(e,n,r)}}),Q||(I=b.valHooks.button={get:function(e,n){var r=e.getAttributeNode(n);return r&&("id"===n||"name"===n||"coords"===n?""!==r.value:r.specified)?r.value:t},set:function(e,n,r){var i=e.getAttributeNode(r);return i||e.setAttributeNode(i=e.ownerDocument.createAttribute(r)),i.value=n+="","value"===r||n===e.getAttribute(r)?n:t}},b.attrHooks.contenteditable={get:I.get,set:function(e,t,n){I.set(e,""===t?!1:t,n)}},b.each(["width","height"],function(e,n){b.attrHooks[n]=b.extend(b.attrHooks[n],{set:function(e,r){return""===r?(e.setAttribute(n,"auto"),r):t}})})),b.support.hrefNormalized||(b.each(["href","src","width","height"],function(e,n){b.attrHooks[n]=b.extend(b.attrHooks[n],{get:function(e){var r=e.getAttribute(n,2);return null==r?t:r}})}),b.each(["href","src"],function(e,t){b.propHooks[t]={get:function(e){return e.getAttribute(t,4)}}})),b.support.style||(b.attrHooks.style={get:function(e){return e.style.cssText||t},set:function(e,t){return e.style.cssText=t+""}}),b.support.optSelected||(b.propHooks.selected=b.extend(b.propHooks.selected,{get:function(e){var t=e.parentNode;return t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex),null}})),b.support.enctype||(b.propFix.enctype="encoding"),b.support.checkOn||b.each(["radio","checkbox"],function(){b.valHooks[this]={get:function(e){return null===e.getAttribute("value")?"on":e.value}}}),b.each(["radio","checkbox"],function(){b.valHooks[this]=b.extend(b.valHooks[this],{set:function(e,n){return b.isArray(n)?e.checked=b.inArray(b(e).val(),n)>=0:t}})});var Z=/^(?:input|select|textarea)$/i,et=/^key/,tt=/^(?:mouse|contextmenu)|click/,nt=/^(?:focusinfocus|focusoutblur)$/,rt=/^([^.]*)(?:\.(.+)|)$/;function it(){return!0}function ot(){return!1}b.event={global:{},add:function(e,n,r,o,a){var s,u,l,c,p,f,d,h,g,m,y,v=b._data(e);if(v){r.handler&&(c=r,r=c.handler,a=c.selector),r.guid||(r.guid=b.guid++),(u=v.events)||(u=v.events={}),(f=v.handle)||(f=v.handle=function(e){return typeof b===i||e&&b.event.triggered===e.type?t:b.event.dispatch.apply(f.elem,arguments)},f.elem=e),n=(n||"").match(w)||[""],l=n.length;while(l--)s=rt.exec(n[l])||[],g=y=s[1],m=(s[2]||"").split(".").sort(),p=b.event.special[g]||{},g=(a?p.delegateType:p.bindType)||g,p=b.event.special[g]||{},d=b.extend({type:g,origType:y,data:o,handler:r,guid:r.guid,selector:a,needsContext:a&&b.expr.match.needsContext.test(a),namespace:m.join(".")},c),(h=u[g])||(h=u[g]=[],h.delegateCount=0,p.setup&&p.setup.call(e,o,m,f)!==!1||(e.addEventListener?e.addEventListener(g,f,!1):e.attachEvent&&e.attachEvent("on"+g,f))),p.add&&(p.add.call(e,d),d.handler.guid||(d.handler.guid=r.guid)),a?h.splice(h.delegateCount++,0,d):h.push(d),b.event.global[g]=!0;e=null}},remove:function(e,t,n,r,i){var o,a,s,u,l,c,p,f,d,h,g,m=b.hasData(e)&&b._data(e);if(m&&(c=m.events)){t=(t||"").match(w)||[""],l=t.length;while(l--)if(s=rt.exec(t[l])||[],d=g=s[1],h=(s[2]||"").split(".").sort(),d){p=b.event.special[d]||{},d=(r?p.delegateType:p.bindType)||d,f=c[d]||[],s=s[2]&&RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),u=o=f.length;while(o--)a=f[o],!i&&g!==a.origType||n&&n.guid!==a.guid||s&&!s.test(a.namespace)||r&&r!==a.selector&&("**"!==r||!a.selector)||(f.splice(o,1),a.selector&&f.delegateCount--,p.remove&&p.remove.call(e,a));u&&!f.length&&(p.teardown&&p.teardown.call(e,h,m.handle)!==!1||b.removeEvent(e,d,m.handle),delete c[d])}else for(d in c)b.event.remove(e,d+t[l],n,r,!0);b.isEmptyObject(c)&&(delete m.handle,b._removeData(e,"events"))}},trigger:function(n,r,i,a){var s,u,l,c,p,f,d,h=[i||o],g=y.call(n,"type")?n.type:n,m=y.call(n,"namespace")?n.namespace.split("."):[];if(l=f=i=i||o,3!==i.nodeType&&8!==i.nodeType&&!nt.test(g+b.event.triggered)&&(g.indexOf(".")>=0&&(m=g.split("."),g=m.shift(),m.sort()),u=0>g.indexOf(":")&&"on"+g,n=n[b.expando]?n:new b.Event(g,"object"==typeof n&&n),n.isTrigger=!0,n.namespace=m.join("."),n.namespace_re=n.namespace?RegExp("(^|\\.)"+m.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,n.result=t,n.target||(n.target=i),r=null==r?[n]:b.makeArray(r,[n]),p=b.event.special[g]||{},a||!p.trigger||p.trigger.apply(i,r)!==!1)){if(!a&&!p.noBubble&&!b.isWindow(i)){for(c=p.delegateType||g,nt.test(c+g)||(l=l.parentNode);l;l=l.parentNode)h.push(l),f=l;f===(i.ownerDocument||o)&&h.push(f.defaultView||f.parentWindow||e)}d=0;while((l=h[d++])&&!n.isPropagationStopped())n.type=d>1?c:p.bindType||g,s=(b._data(l,"events")||{})[n.type]&&b._data(l,"handle"),s&&s.apply(l,r),s=u&&l[u],s&&b.acceptData(l)&&s.apply&&s.apply(l,r)===!1&&n.preventDefault();if(n.type=g,!(a||n.isDefaultPrevented()||p._default&&p._default.apply(i.ownerDocument,r)!==!1||"click"===g&&b.nodeName(i,"a")||!b.acceptData(i)||!u||!i[g]||b.isWindow(i))){f=i[u],f&&(i[u]=null),b.event.triggered=g;try{i[g]()}catch(v){}b.event.triggered=t,f&&(i[u]=f)}return n.result}},dispatch:function(e){e=b.event.fix(e);var n,r,i,o,a,s=[],u=h.call(arguments),l=(b._data(this,"events")||{})[e.type]||[],c=b.event.special[e.type]||{};if(u[0]=e,e.delegateTarget=this,!c.preDispatch||c.preDispatch.call(this,e)!==!1){s=b.event.handlers.call(this,e,l),n=0;while((o=s[n++])&&!e.isPropagationStopped()){e.currentTarget=o.elem,a=0;while((i=o.handlers[a++])&&!e.isImmediatePropagationStopped())(!e.namespace_re||e.namespace_re.test(i.namespace))&&(e.handleObj=i,e.data=i.data,r=((b.event.special[i.origType]||{}).handle||i.handler).apply(o.elem,u),r!==t&&(e.result=r)===!1&&(e.preventDefault(),e.stopPropagation()))}return c.postDispatch&&c.postDispatch.call(this,e),e.result}},handlers:function(e,n){var r,i,o,a,s=[],u=n.delegateCount,l=e.target;if(u&&l.nodeType&&(!e.button||"click"!==e.type))for(;l!=this;l=l.parentNode||this)if(1===l.nodeType&&(l.disabled!==!0||"click"!==e.type)){for(o=[],a=0;u>a;a++)i=n[a],r=i.selector+" ",o[r]===t&&(o[r]=i.needsContext?b(r,this).index(l)>=0:b.find(r,this,null,[l]).length),o[r]&&o.push(i);o.length&&s.push({elem:l,handlers:o})}return n.length>u&&s.push({elem:this,handlers:n.slice(u)}),s},fix:function(e){if(e[b.expando])return e;var t,n,r,i=e.type,a=e,s=this.fixHooks[i];s||(this.fixHooks[i]=s=tt.test(i)?this.mouseHooks:et.test(i)?this.keyHooks:{}),r=s.props?this.props.concat(s.props):this.props,e=new b.Event(a),t=r.length;while(t--)n=r[t],e[n]=a[n];return e.target||(e.target=a.srcElement||o),3===e.target.nodeType&&(e.target=e.target.parentNode),e.metaKey=!!e.metaKey,s.filter?s.filter(e,a):e},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return null==e.which&&(e.which=null!=t.charCode?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,n){var r,i,a,s=n.button,u=n.fromElement;return null==e.pageX&&null!=n.clientX&&(i=e.target.ownerDocument||o,a=i.documentElement,r=i.body,e.pageX=n.clientX+(a&&a.scrollLeft||r&&r.scrollLeft||0)-(a&&a.clientLeft||r&&r.clientLeft||0),e.pageY=n.clientY+(a&&a.scrollTop||r&&r.scrollTop||0)-(a&&a.clientTop||r&&r.clientTop||0)),!e.relatedTarget&&u&&(e.relatedTarget=u===e.target?n.toElement:u),e.which||s===t||(e.which=1&s?1:2&s?3:4&s?2:0),e}},special:{load:{noBubble:!0},click:{trigger:function(){return b.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):t}},focus:{trigger:function(){if(this!==o.activeElement&&this.focus)try{return this.focus(),!1}catch(e){}},delegateType:"focusin"},blur:{trigger:function(){return this===o.activeElement&&this.blur?(this.blur(),!1):t},delegateType:"focusout"},beforeunload:{postDispatch:function(e){e.result!==t&&(e.originalEvent.returnValue=e.result)}}},simulate:function(e,t,n,r){var i=b.extend(new b.Event,n,{type:e,isSimulated:!0,originalEvent:{}});r?b.event.trigger(i,null,t):b.event.dispatch.call(t,i),i.isDefaultPrevented()&&n.preventDefault()}},b.removeEvent=o.removeEventListener?function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n,!1)}:function(e,t,n){var r="on"+t;e.detachEvent&&(typeof e[r]===i&&(e[r]=null),e.detachEvent(r,n))},b.Event=function(e,n){return this instanceof b.Event?(e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.returnValue===!1||e.getPreventDefault&&e.getPreventDefault()?it:ot):this.type=e,n&&b.extend(this,n),this.timeStamp=e&&e.timeStamp||b.now(),this[b.expando]=!0,t):new b.Event(e,n)},b.Event.prototype={isDefaultPrevented:ot,isPropagationStopped:ot,isImmediatePropagationStopped:ot,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=it,e&&(e.preventDefault?e.preventDefault():e.returnValue=!1)},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=it,e&&(e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=it,this.stopPropagation()}},b.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(e,t){b.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,o=e.handleObj;
3
- return(!i||i!==r&&!b.contains(r,i))&&(e.type=o.origType,n=o.handler.apply(this,arguments),e.type=t),n}}}),b.support.submitBubbles||(b.event.special.submit={setup:function(){return b.nodeName(this,"form")?!1:(b.event.add(this,"click._submit keypress._submit",function(e){var n=e.target,r=b.nodeName(n,"input")||b.nodeName(n,"button")?n.form:t;r&&!b._data(r,"submitBubbles")&&(b.event.add(r,"submit._submit",function(e){e._submit_bubble=!0}),b._data(r,"submitBubbles",!0))}),t)},postDispatch:function(e){e._submit_bubble&&(delete e._submit_bubble,this.parentNode&&!e.isTrigger&&b.event.simulate("submit",this.parentNode,e,!0))},teardown:function(){return b.nodeName(this,"form")?!1:(b.event.remove(this,"._submit"),t)}}),b.support.changeBubbles||(b.event.special.change={setup:function(){return Z.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(b.event.add(this,"propertychange._change",function(e){"checked"===e.originalEvent.propertyName&&(this._just_changed=!0)}),b.event.add(this,"click._change",function(e){this._just_changed&&!e.isTrigger&&(this._just_changed=!1),b.event.simulate("change",this,e,!0)})),!1):(b.event.add(this,"beforeactivate._change",function(e){var t=e.target;Z.test(t.nodeName)&&!b._data(t,"changeBubbles")&&(b.event.add(t,"change._change",function(e){!this.parentNode||e.isSimulated||e.isTrigger||b.event.simulate("change",this.parentNode,e,!0)}),b._data(t,"changeBubbles",!0))}),t)},handle:function(e){var n=e.target;return this!==n||e.isSimulated||e.isTrigger||"radio"!==n.type&&"checkbox"!==n.type?e.handleObj.handler.apply(this,arguments):t},teardown:function(){return b.event.remove(this,"._change"),!Z.test(this.nodeName)}}),b.support.focusinBubbles||b.each({focus:"focusin",blur:"focusout"},function(e,t){var n=0,r=function(e){b.event.simulate(t,e.target,b.event.fix(e),!0)};b.event.special[t]={setup:function(){0===n++&&o.addEventListener(e,r,!0)},teardown:function(){0===--n&&o.removeEventListener(e,r,!0)}}}),b.fn.extend({on:function(e,n,r,i,o){var a,s;if("object"==typeof e){"string"!=typeof n&&(r=r||n,n=t);for(a in e)this.on(a,n,r,e[a],o);return this}if(null==r&&null==i?(i=n,r=n=t):null==i&&("string"==typeof n?(i=r,r=t):(i=r,r=n,n=t)),i===!1)i=ot;else if(!i)return this;return 1===o&&(s=i,i=function(e){return b().off(e),s.apply(this,arguments)},i.guid=s.guid||(s.guid=b.guid++)),this.each(function(){b.event.add(this,e,i,r,n)})},one:function(e,t,n,r){return this.on(e,t,n,r,1)},off:function(e,n,r){var i,o;if(e&&e.preventDefault&&e.handleObj)return i=e.handleObj,b(e.delegateTarget).off(i.namespace?i.origType+"."+i.namespace:i.origType,i.selector,i.handler),this;if("object"==typeof e){for(o in e)this.off(o,n,e[o]);return this}return(n===!1||"function"==typeof n)&&(r=n,n=t),r===!1&&(r=ot),this.each(function(){b.event.remove(this,e,r,n)})},bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},trigger:function(e,t){return this.each(function(){b.event.trigger(e,t,this)})},triggerHandler:function(e,n){var r=this[0];return r?b.event.trigger(e,n,r,!0):t}}),function(e,t){var n,r,i,o,a,s,u,l,c,p,f,d,h,g,m,y,v,x="sizzle"+-new Date,w=e.document,T={},N=0,C=0,k=it(),E=it(),S=it(),A=typeof t,j=1<<31,D=[],L=D.pop,H=D.push,q=D.slice,M=D.indexOf||function(e){var t=0,n=this.length;for(;n>t;t++)if(this[t]===e)return t;return-1},_="[\\x20\\t\\r\\n\\f]",F="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",O=F.replace("w","w#"),B="([*^$|!~]?=)",P="\\["+_+"*("+F+")"+_+"*(?:"+B+_+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+O+")|)|)"+_+"*\\]",R=":("+F+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+P.replace(3,8)+")*)|.*)\\)|)",W=RegExp("^"+_+"+|((?:^|[^\\\\])(?:\\\\.)*)"+_+"+$","g"),$=RegExp("^"+_+"*,"+_+"*"),I=RegExp("^"+_+"*([\\x20\\t\\r\\n\\f>+~])"+_+"*"),z=RegExp(R),X=RegExp("^"+O+"$"),U={ID:RegExp("^#("+F+")"),CLASS:RegExp("^\\.("+F+")"),NAME:RegExp("^\\[name=['\"]?("+F+")['\"]?\\]"),TAG:RegExp("^("+F.replace("w","w*")+")"),ATTR:RegExp("^"+P),PSEUDO:RegExp("^"+R),CHILD:RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+_+"*(even|odd|(([+-]|)(\\d*)n|)"+_+"*(?:([+-]|)"+_+"*(\\d+)|))"+_+"*\\)|)","i"),needsContext:RegExp("^"+_+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+_+"*((?:-\\d)?\\d*)"+_+"*\\)|)(?=[^-]|$)","i")},V=/[\x20\t\r\n\f]*[+~]/,Y=/^[^{]+\{\s*\[native code/,J=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,G=/^(?:input|select|textarea|button)$/i,Q=/^h\d$/i,K=/'|\\/g,Z=/\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,et=/\\([\da-fA-F]{1,6}[\x20\t\r\n\f]?|.)/g,tt=function(e,t){var n="0x"+t-65536;return n!==n?t:0>n?String.fromCharCode(n+65536):String.fromCharCode(55296|n>>10,56320|1023&n)};try{q.call(w.documentElement.childNodes,0)[0].nodeType}catch(nt){q=function(e){var t,n=[];while(t=this[e++])n.push(t);return n}}function rt(e){return Y.test(e+"")}function it(){var e,t=[];return e=function(n,r){return t.push(n+=" ")>i.cacheLength&&delete e[t.shift()],e[n]=r}}function ot(e){return e[x]=!0,e}function at(e){var t=p.createElement("div");try{return e(t)}catch(n){return!1}finally{t=null}}function st(e,t,n,r){var i,o,a,s,u,l,f,g,m,v;if((t?t.ownerDocument||t:w)!==p&&c(t),t=t||p,n=n||[],!e||"string"!=typeof e)return n;if(1!==(s=t.nodeType)&&9!==s)return[];if(!d&&!r){if(i=J.exec(e))if(a=i[1]){if(9===s){if(o=t.getElementById(a),!o||!o.parentNode)return n;if(o.id===a)return n.push(o),n}else if(t.ownerDocument&&(o=t.ownerDocument.getElementById(a))&&y(t,o)&&o.id===a)return n.push(o),n}else{if(i[2])return H.apply(n,q.call(t.getElementsByTagName(e),0)),n;if((a=i[3])&&T.getByClassName&&t.getElementsByClassName)return H.apply(n,q.call(t.getElementsByClassName(a),0)),n}if(T.qsa&&!h.test(e)){if(f=!0,g=x,m=t,v=9===s&&e,1===s&&"object"!==t.nodeName.toLowerCase()){l=ft(e),(f=t.getAttribute("id"))?g=f.replace(K,"\\$&"):t.setAttribute("id",g),g="[id='"+g+"'] ",u=l.length;while(u--)l[u]=g+dt(l[u]);m=V.test(e)&&t.parentNode||t,v=l.join(",")}if(v)try{return H.apply(n,q.call(m.querySelectorAll(v),0)),n}catch(b){}finally{f||t.removeAttribute("id")}}}return wt(e.replace(W,"$1"),t,n,r)}a=st.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?"HTML"!==t.nodeName:!1},c=st.setDocument=function(e){var n=e?e.ownerDocument||e:w;return n!==p&&9===n.nodeType&&n.documentElement?(p=n,f=n.documentElement,d=a(n),T.tagNameNoComments=at(function(e){return e.appendChild(n.createComment("")),!e.getElementsByTagName("*").length}),T.attributes=at(function(e){e.innerHTML="<select></select>";var t=typeof e.lastChild.getAttribute("multiple");return"boolean"!==t&&"string"!==t}),T.getByClassName=at(function(e){return e.innerHTML="<div class='hidden e'></div><div class='hidden'></div>",e.getElementsByClassName&&e.getElementsByClassName("e").length?(e.lastChild.className="e",2===e.getElementsByClassName("e").length):!1}),T.getByName=at(function(e){e.id=x+0,e.innerHTML="<a name='"+x+"'></a><div name='"+x+"'></div>",f.insertBefore(e,f.firstChild);var t=n.getElementsByName&&n.getElementsByName(x).length===2+n.getElementsByName(x+0).length;return T.getIdNotName=!n.getElementById(x),f.removeChild(e),t}),i.attrHandle=at(function(e){return e.innerHTML="<a href='#'></a>",e.firstChild&&typeof e.firstChild.getAttribute!==A&&"#"===e.firstChild.getAttribute("href")})?{}:{href:function(e){return e.getAttribute("href",2)},type:function(e){return e.getAttribute("type")}},T.getIdNotName?(i.find.ID=function(e,t){if(typeof t.getElementById!==A&&!d){var n=t.getElementById(e);return n&&n.parentNode?[n]:[]}},i.filter.ID=function(e){var t=e.replace(et,tt);return function(e){return e.getAttribute("id")===t}}):(i.find.ID=function(e,n){if(typeof n.getElementById!==A&&!d){var r=n.getElementById(e);return r?r.id===e||typeof r.getAttributeNode!==A&&r.getAttributeNode("id").value===e?[r]:t:[]}},i.filter.ID=function(e){var t=e.replace(et,tt);return function(e){var n=typeof e.getAttributeNode!==A&&e.getAttributeNode("id");return n&&n.value===t}}),i.find.TAG=T.tagNameNoComments?function(e,n){return typeof n.getElementsByTagName!==A?n.getElementsByTagName(e):t}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},i.find.NAME=T.getByName&&function(e,n){return typeof n.getElementsByName!==A?n.getElementsByName(name):t},i.find.CLASS=T.getByClassName&&function(e,n){return typeof n.getElementsByClassName===A||d?t:n.getElementsByClassName(e)},g=[],h=[":focus"],(T.qsa=rt(n.querySelectorAll))&&(at(function(e){e.innerHTML="<select><option selected=''></option></select>",e.querySelectorAll("[selected]").length||h.push("\\["+_+"*(?:checked|disabled|ismap|multiple|readonly|selected|value)"),e.querySelectorAll(":checked").length||h.push(":checked")}),at(function(e){e.innerHTML="<input type='hidden' i=''/>",e.querySelectorAll("[i^='']").length&&h.push("[*^$]="+_+"*(?:\"\"|'')"),e.querySelectorAll(":enabled").length||h.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),h.push(",.*:")})),(T.matchesSelector=rt(m=f.matchesSelector||f.mozMatchesSelector||f.webkitMatchesSelector||f.oMatchesSelector||f.msMatchesSelector))&&at(function(e){T.disconnectedMatch=m.call(e,"div"),m.call(e,"[s!='']:x"),g.push("!=",R)}),h=RegExp(h.join("|")),g=RegExp(g.join("|")),y=rt(f.contains)||f.compareDocumentPosition?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},v=f.compareDocumentPosition?function(e,t){var r;return e===t?(u=!0,0):(r=t.compareDocumentPosition&&e.compareDocumentPosition&&e.compareDocumentPosition(t))?1&r||e.parentNode&&11===e.parentNode.nodeType?e===n||y(w,e)?-1:t===n||y(w,t)?1:0:4&r?-1:1:e.compareDocumentPosition?-1:1}:function(e,t){var r,i=0,o=e.parentNode,a=t.parentNode,s=[e],l=[t];if(e===t)return u=!0,0;if(!o||!a)return e===n?-1:t===n?1:o?-1:a?1:0;if(o===a)return ut(e,t);r=e;while(r=r.parentNode)s.unshift(r);r=t;while(r=r.parentNode)l.unshift(r);while(s[i]===l[i])i++;return i?ut(s[i],l[i]):s[i]===w?-1:l[i]===w?1:0},u=!1,[0,0].sort(v),T.detectDuplicates=u,p):p},st.matches=function(e,t){return st(e,null,null,t)},st.matchesSelector=function(e,t){if((e.ownerDocument||e)!==p&&c(e),t=t.replace(Z,"='$1']"),!(!T.matchesSelector||d||g&&g.test(t)||h.test(t)))try{var n=m.call(e,t);if(n||T.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(r){}return st(t,p,null,[e]).length>0},st.contains=function(e,t){return(e.ownerDocument||e)!==p&&c(e),y(e,t)},st.attr=function(e,t){var n;return(e.ownerDocument||e)!==p&&c(e),d||(t=t.toLowerCase()),(n=i.attrHandle[t])?n(e):d||T.attributes?e.getAttribute(t):((n=e.getAttributeNode(t))||e.getAttribute(t))&&e[t]===!0?t:n&&n.specified?n.value:null},st.error=function(e){throw Error("Syntax error, unrecognized expression: "+e)},st.uniqueSort=function(e){var t,n=[],r=1,i=0;if(u=!T.detectDuplicates,e.sort(v),u){for(;t=e[r];r++)t===e[r-1]&&(i=n.push(r));while(i--)e.splice(n[i],1)}return e};function ut(e,t){var n=t&&e,r=n&&(~t.sourceIndex||j)-(~e.sourceIndex||j);if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function lt(e){return function(t){var n=t.nodeName.toLowerCase();return"input"===n&&t.type===e}}function ct(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function pt(e){return ot(function(t){return t=+t,ot(function(n,r){var i,o=e([],n.length,t),a=o.length;while(a--)n[i=o[a]]&&(n[i]=!(r[i]=n[i]))})})}o=st.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=o(e)}else if(3===i||4===i)return e.nodeValue}else for(;t=e[r];r++)n+=o(t);return n},i=st.selectors={cacheLength:50,createPseudo:ot,match:U,find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(et,tt),e[3]=(e[4]||e[5]||"").replace(et,tt),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||st.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&st.error(e[0]),e},PSEUDO:function(e){var t,n=!e[5]&&e[2];return U.CHILD.test(e[0])?null:(e[4]?e[2]=e[4]:n&&z.test(n)&&(t=ft(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){return"*"===e?function(){return!0}:(e=e.replace(et,tt).toLowerCase(),function(t){return t.nodeName&&t.nodeName.toLowerCase()===e})},CLASS:function(e){var t=k[e+" "];return t||(t=RegExp("(^|"+_+")"+e+"("+_+"|$)"))&&k(e,function(e){return t.test(e.className||typeof e.getAttribute!==A&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=st.attr(r,e);return null==i?"!="===t:t?(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&i.indexOf(n)>-1:"$="===t?n&&i.slice(-n.length)===n:"~="===t?(" "+i+" ").indexOf(n)>-1:"|="===t?i===n||i.slice(0,n.length+1)===n+"-":!1):!0}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),a="last"!==e.slice(-4),s="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,u){var l,c,p,f,d,h,g=o!==a?"nextSibling":"previousSibling",m=t.parentNode,y=s&&t.nodeName.toLowerCase(),v=!u&&!s;if(m){if(o){while(g){p=t;while(p=p[g])if(s?p.nodeName.toLowerCase()===y:1===p.nodeType)return!1;h=g="only"===e&&!h&&"nextSibling"}return!0}if(h=[a?m.firstChild:m.lastChild],a&&v){c=m[x]||(m[x]={}),l=c[e]||[],d=l[0]===N&&l[1],f=l[0]===N&&l[2],p=d&&m.childNodes[d];while(p=++d&&p&&p[g]||(f=d=0)||h.pop())if(1===p.nodeType&&++f&&p===t){c[e]=[N,d,f];break}}else if(v&&(l=(t[x]||(t[x]={}))[e])&&l[0]===N)f=l[1];else while(p=++d&&p&&p[g]||(f=d=0)||h.pop())if((s?p.nodeName.toLowerCase()===y:1===p.nodeType)&&++f&&(v&&((p[x]||(p[x]={}))[e]=[N,f]),p===t))break;return f-=i,f===r||0===f%r&&f/r>=0}}},PSEUDO:function(e,t){var n,r=i.pseudos[e]||i.setFilters[e.toLowerCase()]||st.error("unsupported pseudo: "+e);return r[x]?r(t):r.length>1?(n=[e,e,"",t],i.setFilters.hasOwnProperty(e.toLowerCase())?ot(function(e,n){var i,o=r(e,t),a=o.length;while(a--)i=M.call(e,o[a]),e[i]=!(n[i]=o[a])}):function(e){return r(e,0,n)}):r}},pseudos:{not:ot(function(e){var t=[],n=[],r=s(e.replace(W,"$1"));return r[x]?ot(function(e,t,n,i){var o,a=r(e,null,i,[]),s=e.length;while(s--)(o=a[s])&&(e[s]=!(t[s]=o))}):function(e,i,o){return t[0]=e,r(t,null,o,n),!n.pop()}}),has:ot(function(e){return function(t){return st(e,t).length>0}}),contains:ot(function(e){return function(t){return(t.textContent||t.innerText||o(t)).indexOf(e)>-1}}),lang:ot(function(e){return X.test(e||"")||st.error("unsupported lang: "+e),e=e.replace(et,tt).toLowerCase(),function(t){var n;do if(n=d?t.getAttribute("xml:lang")||t.getAttribute("lang"):t.lang)return n=n.toLowerCase(),n===e||0===n.indexOf(e+"-");while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===f},focus:function(e){return e===p.activeElement&&(!p.hasFocus||p.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeName>"@"||3===e.nodeType||4===e.nodeType)return!1;return!0},parent:function(e){return!i.pseudos.empty(e)},header:function(e){return Q.test(e.nodeName)},input:function(e){return G.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||t.toLowerCase()===e.type)},first:pt(function(){return[0]}),last:pt(function(e,t){return[t-1]}),eq:pt(function(e,t,n){return[0>n?n+t:n]}),even:pt(function(e,t){var n=0;for(;t>n;n+=2)e.push(n);return e}),odd:pt(function(e,t){var n=1;for(;t>n;n+=2)e.push(n);return e}),lt:pt(function(e,t,n){var r=0>n?n+t:n;for(;--r>=0;)e.push(r);return e}),gt:pt(function(e,t,n){var r=0>n?n+t:n;for(;t>++r;)e.push(r);return e})}};for(n in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})i.pseudos[n]=lt(n);for(n in{submit:!0,reset:!0})i.pseudos[n]=ct(n);function ft(e,t){var n,r,o,a,s,u,l,c=E[e+" "];if(c)return t?0:c.slice(0);s=e,u=[],l=i.preFilter;while(s){(!n||(r=$.exec(s)))&&(r&&(s=s.slice(r[0].length)||s),u.push(o=[])),n=!1,(r=I.exec(s))&&(n=r.shift(),o.push({value:n,type:r[0].replace(W," ")}),s=s.slice(n.length));for(a in i.filter)!(r=U[a].exec(s))||l[a]&&!(r=l[a](r))||(n=r.shift(),o.push({value:n,type:a,matches:r}),s=s.slice(n.length));if(!n)break}return t?s.length:s?st.error(e):E(e,u).slice(0)}function dt(e){var t=0,n=e.length,r="";for(;n>t;t++)r+=e[t].value;return r}function ht(e,t,n){var i=t.dir,o=n&&"parentNode"===i,a=C++;return t.first?function(t,n,r){while(t=t[i])if(1===t.nodeType||o)return e(t,n,r)}:function(t,n,s){var u,l,c,p=N+" "+a;if(s){while(t=t[i])if((1===t.nodeType||o)&&e(t,n,s))return!0}else while(t=t[i])if(1===t.nodeType||o)if(c=t[x]||(t[x]={}),(l=c[i])&&l[0]===p){if((u=l[1])===!0||u===r)return u===!0}else if(l=c[i]=[p],l[1]=e(t,n,s)||r,l[1]===!0)return!0}}function gt(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function mt(e,t,n,r,i){var o,a=[],s=0,u=e.length,l=null!=t;for(;u>s;s++)(o=e[s])&&(!n||n(o,r,i))&&(a.push(o),l&&t.push(s));return a}function yt(e,t,n,r,i,o){return r&&!r[x]&&(r=yt(r)),i&&!i[x]&&(i=yt(i,o)),ot(function(o,a,s,u){var l,c,p,f=[],d=[],h=a.length,g=o||xt(t||"*",s.nodeType?[s]:s,[]),m=!e||!o&&t?g:mt(g,f,e,s,u),y=n?i||(o?e:h||r)?[]:a:m;if(n&&n(m,y,s,u),r){l=mt(y,d),r(l,[],s,u),c=l.length;while(c--)(p=l[c])&&(y[d[c]]=!(m[d[c]]=p))}if(o){if(i||e){if(i){l=[],c=y.length;while(c--)(p=y[c])&&l.push(m[c]=p);i(null,y=[],l,u)}c=y.length;while(c--)(p=y[c])&&(l=i?M.call(o,p):f[c])>-1&&(o[l]=!(a[l]=p))}}else y=mt(y===a?y.splice(h,y.length):y),i?i(null,a,y,u):H.apply(a,y)})}function vt(e){var t,n,r,o=e.length,a=i.relative[e[0].type],s=a||i.relative[" "],u=a?1:0,c=ht(function(e){return e===t},s,!0),p=ht(function(e){return M.call(t,e)>-1},s,!0),f=[function(e,n,r){return!a&&(r||n!==l)||((t=n).nodeType?c(e,n,r):p(e,n,r))}];for(;o>u;u++)if(n=i.relative[e[u].type])f=[ht(gt(f),n)];else{if(n=i.filter[e[u].type].apply(null,e[u].matches),n[x]){for(r=++u;o>r;r++)if(i.relative[e[r].type])break;return yt(u>1&&gt(f),u>1&&dt(e.slice(0,u-1)).replace(W,"$1"),n,r>u&&vt(e.slice(u,r)),o>r&&vt(e=e.slice(r)),o>r&&dt(e))}f.push(n)}return gt(f)}function bt(e,t){var n=0,o=t.length>0,a=e.length>0,s=function(s,u,c,f,d){var h,g,m,y=[],v=0,b="0",x=s&&[],w=null!=d,T=l,C=s||a&&i.find.TAG("*",d&&u.parentNode||u),k=N+=null==T?1:Math.random()||.1;for(w&&(l=u!==p&&u,r=n);null!=(h=C[b]);b++){if(a&&h){g=0;while(m=e[g++])if(m(h,u,c)){f.push(h);break}w&&(N=k,r=++n)}o&&((h=!m&&h)&&v--,s&&x.push(h))}if(v+=b,o&&b!==v){g=0;while(m=t[g++])m(x,y,u,c);if(s){if(v>0)while(b--)x[b]||y[b]||(y[b]=L.call(f));y=mt(y)}H.apply(f,y),w&&!s&&y.length>0&&v+t.length>1&&st.uniqueSort(f)}return w&&(N=k,l=T),x};return o?ot(s):s}s=st.compile=function(e,t){var n,r=[],i=[],o=S[e+" "];if(!o){t||(t=ft(e)),n=t.length;while(n--)o=vt(t[n]),o[x]?r.push(o):i.push(o);o=S(e,bt(i,r))}return o};function xt(e,t,n){var r=0,i=t.length;for(;i>r;r++)st(e,t[r],n);return n}function wt(e,t,n,r){var o,a,u,l,c,p=ft(e);if(!r&&1===p.length){if(a=p[0]=p[0].slice(0),a.length>2&&"ID"===(u=a[0]).type&&9===t.nodeType&&!d&&i.relative[a[1].type]){if(t=i.find.ID(u.matches[0].replace(et,tt),t)[0],!t)return n;e=e.slice(a.shift().value.length)}o=U.needsContext.test(e)?0:a.length;while(o--){if(u=a[o],i.relative[l=u.type])break;if((c=i.find[l])&&(r=c(u.matches[0].replace(et,tt),V.test(a[0].type)&&t.parentNode||t))){if(a.splice(o,1),e=r.length&&dt(a),!e)return H.apply(n,q.call(r,0)),n;break}}}return s(e,p)(r,t,d,n,V.test(e)),n}i.pseudos.nth=i.pseudos.eq;function Tt(){}i.filters=Tt.prototype=i.pseudos,i.setFilters=new Tt,c(),st.attr=b.attr,b.find=st,b.expr=st.selectors,b.expr[":"]=b.expr.pseudos,b.unique=st.uniqueSort,b.text=st.getText,b.isXMLDoc=st.isXML,b.contains=st.contains}(e);var at=/Until$/,st=/^(?:parents|prev(?:Until|All))/,ut=/^.[^:#\[\.,]*$/,lt=b.expr.match.needsContext,ct={children:!0,contents:!0,next:!0,prev:!0};b.fn.extend({find:function(e){var t,n,r,i=this.length;if("string"!=typeof e)return r=this,this.pushStack(b(e).filter(function(){for(t=0;i>t;t++)if(b.contains(r[t],this))return!0}));for(n=[],t=0;i>t;t++)b.find(e,this[t],n);return n=this.pushStack(i>1?b.unique(n):n),n.selector=(this.selector?this.selector+" ":"")+e,n},has:function(e){var t,n=b(e,this),r=n.length;return this.filter(function(){for(t=0;r>t;t++)if(b.contains(this,n[t]))return!0})},not:function(e){return this.pushStack(ft(this,e,!1))},filter:function(e){return this.pushStack(ft(this,e,!0))},is:function(e){return!!e&&("string"==typeof e?lt.test(e)?b(e,this.context).index(this[0])>=0:b.filter(e,this).length>0:this.filter(e).length>0)},closest:function(e,t){var n,r=0,i=this.length,o=[],a=lt.test(e)||"string"!=typeof e?b(e,t||this.context):0;for(;i>r;r++){n=this[r];while(n&&n.ownerDocument&&n!==t&&11!==n.nodeType){if(a?a.index(n)>-1:b.find.matchesSelector(n,e)){o.push(n);break}n=n.parentNode}}return this.pushStack(o.length>1?b.unique(o):o)},index:function(e){return e?"string"==typeof e?b.inArray(this[0],b(e)):b.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){var n="string"==typeof e?b(e,t):b.makeArray(e&&e.nodeType?[e]:e),r=b.merge(this.get(),n);return this.pushStack(b.unique(r))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),b.fn.andSelf=b.fn.addBack;function pt(e,t){do e=e[t];while(e&&1!==e.nodeType);return e}b.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return b.dir(e,"parentNode")},parentsUntil:function(e,t,n){return b.dir(e,"parentNode",n)},next:function(e){return pt(e,"nextSibling")},prev:function(e){return pt(e,"previousSibling")},nextAll:function(e){return b.dir(e,"nextSibling")},prevAll:function(e){return b.dir(e,"previousSibling")},nextUntil:function(e,t,n){return b.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return b.dir(e,"previousSibling",n)},siblings:function(e){return b.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return b.sibling(e.firstChild)},contents:function(e){return b.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:b.merge([],e.childNodes)}},function(e,t){b.fn[e]=function(n,r){var i=b.map(this,t,n);return at.test(e)||(r=n),r&&"string"==typeof r&&(i=b.filter(r,i)),i=this.length>1&&!ct[e]?b.unique(i):i,this.length>1&&st.test(e)&&(i=i.reverse()),this.pushStack(i)}}),b.extend({filter:function(e,t,n){return n&&(e=":not("+e+")"),1===t.length?b.find.matchesSelector(t[0],e)?[t[0]]:[]:b.find.matches(e,t)},dir:function(e,n,r){var i=[],o=e[n];while(o&&9!==o.nodeType&&(r===t||1!==o.nodeType||!b(o).is(r)))1===o.nodeType&&i.push(o),o=o[n];return i},sibling:function(e,t){var n=[];for(;e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n}});function ft(e,t,n){if(t=t||0,b.isFunction(t))return b.grep(e,function(e,r){var i=!!t.call(e,r,e);return i===n});if(t.nodeType)return b.grep(e,function(e){return e===t===n});if("string"==typeof t){var r=b.grep(e,function(e){return 1===e.nodeType});if(ut.test(t))return b.filter(t,r,!n);t=b.filter(t,r)}return b.grep(e,function(e){return b.inArray(e,t)>=0===n})}function dt(e){var t=ht.split("|"),n=e.createDocumentFragment();if(n.createElement)while(t.length)n.createElement(t.pop());return n}var ht="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",gt=/ jQuery\d+="(?:null|\d+)"/g,mt=RegExp("<(?:"+ht+")[\\s/>]","i"),yt=/^\s+/,vt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,bt=/<([\w:]+)/,xt=/<tbody/i,wt=/<|&#?\w+;/,Tt=/<(?:script|style|link)/i,Nt=/^(?:checkbox|radio)$/i,Ct=/checked\s*(?:[^=]|=\s*.checked.)/i,kt=/^$|\/(?:java|ecma)script/i,Et=/^true\/(.*)/,St=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,At={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:b.support.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},jt=dt(o),Dt=jt.appendChild(o.createElement("div"));At.optgroup=At.option,At.tbody=At.tfoot=At.colgroup=At.caption=At.thead,At.th=At.td,b.fn.extend({text:function(e){return b.access(this,function(e){return e===t?b.text(this):this.empty().append((this[0]&&this[0].ownerDocument||o).createTextNode(e))},null,e,arguments.length)},wrapAll:function(e){if(b.isFunction(e))return this.each(function(t){b(this).wrapAll(e.call(this,t))});if(this[0]){var t=b(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstChild&&1===e.firstChild.nodeType)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return b.isFunction(e)?this.each(function(t){b(this).wrapInner(e.call(this,t))}):this.each(function(){var t=b(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=b.isFunction(e);return this.each(function(n){b(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){b.nodeName(this,"body")||b(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(e){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&this.appendChild(e)})},prepend:function(){return this.domManip(arguments,!0,function(e){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&this.insertBefore(e,this.firstChild)})},before:function(){return this.domManip(arguments,!1,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return this.domManip(arguments,!1,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},remove:function(e,t){var n,r=0;for(;null!=(n=this[r]);r++)(!e||b.filter(e,[n]).length>0)&&(t||1!==n.nodeType||b.cleanData(Ot(n)),n.parentNode&&(t&&b.contains(n.ownerDocument,n)&&Mt(Ot(n,"script")),n.parentNode.removeChild(n)));return this},empty:function(){var e,t=0;for(;null!=(e=this[t]);t++){1===e.nodeType&&b.cleanData(Ot(e,!1));while(e.firstChild)e.removeChild(e.firstChild);e.options&&b.nodeName(e,"select")&&(e.options.length=0)}return this},clone:function(e,t){return e=null==e?!1:e,t=null==t?e:t,this.map(function(){return b.clone(this,e,t)})},html:function(e){return b.access(this,function(e){var n=this[0]||{},r=0,i=this.length;if(e===t)return 1===n.nodeType?n.innerHTML.replace(gt,""):t;if(!("string"!=typeof e||Tt.test(e)||!b.support.htmlSerialize&&mt.test(e)||!b.support.leadingWhitespace&&yt.test(e)||At[(bt.exec(e)||["",""])[1].toLowerCase()])){e=e.replace(vt,"<$1></$2>");try{for(;i>r;r++)n=this[r]||{},1===n.nodeType&&(b.cleanData(Ot(n,!1)),n.innerHTML=e);n=0}catch(o){}}n&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(e){var t=b.isFunction(e);return t||"string"==typeof e||(e=b(e).not(this).detach()),this.domManip([e],!0,function(e){var t=this.nextSibling,n=this.parentNode;n&&(b(this).remove(),n.insertBefore(e,t))})},detach:function(e){return this.remove(e,!0)},domManip:function(e,n,r){e=f.apply([],e);var i,o,a,s,u,l,c=0,p=this.length,d=this,h=p-1,g=e[0],m=b.isFunction(g);if(m||!(1>=p||"string"!=typeof g||b.support.checkClone)&&Ct.test(g))return this.each(function(i){var o=d.eq(i);m&&(e[0]=g.call(this,i,n?o.html():t)),o.domManip(e,n,r)});if(p&&(l=b.buildFragment(e,this[0].ownerDocument,!1,this),i=l.firstChild,1===l.childNodes.length&&(l=i),i)){for(n=n&&b.nodeName(i,"tr"),s=b.map(Ot(l,"script"),Ht),a=s.length;p>c;c++)o=l,c!==h&&(o=b.clone(o,!0,!0),a&&b.merge(s,Ot(o,"script"))),r.call(n&&b.nodeName(this[c],"table")?Lt(this[c],"tbody"):this[c],o,c);if(a)for(u=s[s.length-1].ownerDocument,b.map(s,qt),c=0;a>c;c++)o=s[c],kt.test(o.type||"")&&!b._data(o,"globalEval")&&b.contains(u,o)&&(o.src?b.ajax({url:o.src,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0}):b.globalEval((o.text||o.textContent||o.innerHTML||"").replace(St,"")));l=i=null}return this}});function Lt(e,t){return e.getElementsByTagName(t)[0]||e.appendChild(e.ownerDocument.createElement(t))}function Ht(e){var t=e.getAttributeNode("type");return e.type=(t&&t.specified)+"/"+e.type,e}function qt(e){var t=Et.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function Mt(e,t){var n,r=0;for(;null!=(n=e[r]);r++)b._data(n,"globalEval",!t||b._data(t[r],"globalEval"))}function _t(e,t){if(1===t.nodeType&&b.hasData(e)){var n,r,i,o=b._data(e),a=b._data(t,o),s=o.events;if(s){delete a.handle,a.events={};for(n in s)for(r=0,i=s[n].length;i>r;r++)b.event.add(t,n,s[n][r])}a.data&&(a.data=b.extend({},a.data))}}function Ft(e,t){var n,r,i;if(1===t.nodeType){if(n=t.nodeName.toLowerCase(),!b.support.noCloneEvent&&t[b.expando]){i=b._data(t);for(r in i.events)b.removeEvent(t,r,i.handle);t.removeAttribute(b.expando)}"script"===n&&t.text!==e.text?(Ht(t).text=e.text,qt(t)):"object"===n?(t.parentNode&&(t.outerHTML=e.outerHTML),b.support.html5Clone&&e.innerHTML&&!b.trim(t.innerHTML)&&(t.innerHTML=e.innerHTML)):"input"===n&&Nt.test(e.type)?(t.defaultChecked=t.checked=e.checked,t.value!==e.value&&(t.value=e.value)):"option"===n?t.defaultSelected=t.selected=e.defaultSelected:("input"===n||"textarea"===n)&&(t.defaultValue=e.defaultValue)}}b.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){b.fn[e]=function(e){var n,r=0,i=[],o=b(e),a=o.length-1;for(;a>=r;r++)n=r===a?this:this.clone(!0),b(o[r])[t](n),d.apply(i,n.get());return this.pushStack(i)}});function Ot(e,n){var r,o,a=0,s=typeof e.getElementsByTagName!==i?e.getElementsByTagName(n||"*"):typeof e.querySelectorAll!==i?e.querySelectorAll(n||"*"):t;if(!s)for(s=[],r=e.childNodes||e;null!=(o=r[a]);a++)!n||b.nodeName(o,n)?s.push(o):b.merge(s,Ot(o,n));return n===t||n&&b.nodeName(e,n)?b.merge([e],s):s}function Bt(e){Nt.test(e.type)&&(e.defaultChecked=e.checked)}b.extend({clone:function(e,t,n){var r,i,o,a,s,u=b.contains(e.ownerDocument,e);if(b.support.html5Clone||b.isXMLDoc(e)||!mt.test("<"+e.nodeName+">")?o=e.cloneNode(!0):(Dt.innerHTML=e.outerHTML,Dt.removeChild(o=Dt.firstChild)),!(b.support.noCloneEvent&&b.support.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||b.isXMLDoc(e)))for(r=Ot(o),s=Ot(e),a=0;null!=(i=s[a]);++a)r[a]&&Ft(i,r[a]);if(t)if(n)for(s=s||Ot(e),r=r||Ot(o),a=0;null!=(i=s[a]);a++)_t(i,r[a]);else _t(e,o);return r=Ot(o,"script"),r.length>0&&Mt(r,!u&&Ot(e,"script")),r=s=i=null,o},buildFragment:function(e,t,n,r){var i,o,a,s,u,l,c,p=e.length,f=dt(t),d=[],h=0;for(;p>h;h++)if(o=e[h],o||0===o)if("object"===b.type(o))b.merge(d,o.nodeType?[o]:o);else if(wt.test(o)){s=s||f.appendChild(t.createElement("div")),u=(bt.exec(o)||["",""])[1].toLowerCase(),c=At[u]||At._default,s.innerHTML=c[1]+o.replace(vt,"<$1></$2>")+c[2],i=c[0];while(i--)s=s.lastChild;if(!b.support.leadingWhitespace&&yt.test(o)&&d.push(t.createTextNode(yt.exec(o)[0])),!b.support.tbody){o="table"!==u||xt.test(o)?"<table>"!==c[1]||xt.test(o)?0:s:s.firstChild,i=o&&o.childNodes.length;while(i--)b.nodeName(l=o.childNodes[i],"tbody")&&!l.childNodes.length&&o.removeChild(l)
4
- }b.merge(d,s.childNodes),s.textContent="";while(s.firstChild)s.removeChild(s.firstChild);s=f.lastChild}else d.push(t.createTextNode(o));s&&f.removeChild(s),b.support.appendChecked||b.grep(Ot(d,"input"),Bt),h=0;while(o=d[h++])if((!r||-1===b.inArray(o,r))&&(a=b.contains(o.ownerDocument,o),s=Ot(f.appendChild(o),"script"),a&&Mt(s),n)){i=0;while(o=s[i++])kt.test(o.type||"")&&n.push(o)}return s=null,f},cleanData:function(e,t){var n,r,o,a,s=0,u=b.expando,l=b.cache,p=b.support.deleteExpando,f=b.event.special;for(;null!=(n=e[s]);s++)if((t||b.acceptData(n))&&(o=n[u],a=o&&l[o])){if(a.events)for(r in a.events)f[r]?b.event.remove(n,r):b.removeEvent(n,r,a.handle);l[o]&&(delete l[o],p?delete n[u]:typeof n.removeAttribute!==i?n.removeAttribute(u):n[u]=null,c.push(o))}}});var Pt,Rt,Wt,$t=/alpha\([^)]*\)/i,It=/opacity\s*=\s*([^)]*)/,zt=/^(top|right|bottom|left)$/,Xt=/^(none|table(?!-c[ea]).+)/,Ut=/^margin/,Vt=RegExp("^("+x+")(.*)$","i"),Yt=RegExp("^("+x+")(?!px)[a-z%]+$","i"),Jt=RegExp("^([+-])=("+x+")","i"),Gt={BODY:"block"},Qt={position:"absolute",visibility:"hidden",display:"block"},Kt={letterSpacing:0,fontWeight:400},Zt=["Top","Right","Bottom","Left"],en=["Webkit","O","Moz","ms"];function tn(e,t){if(t in e)return t;var n=t.charAt(0).toUpperCase()+t.slice(1),r=t,i=en.length;while(i--)if(t=en[i]+n,t in e)return t;return r}function nn(e,t){return e=t||e,"none"===b.css(e,"display")||!b.contains(e.ownerDocument,e)}function rn(e,t){var n,r,i,o=[],a=0,s=e.length;for(;s>a;a++)r=e[a],r.style&&(o[a]=b._data(r,"olddisplay"),n=r.style.display,t?(o[a]||"none"!==n||(r.style.display=""),""===r.style.display&&nn(r)&&(o[a]=b._data(r,"olddisplay",un(r.nodeName)))):o[a]||(i=nn(r),(n&&"none"!==n||!i)&&b._data(r,"olddisplay",i?n:b.css(r,"display"))));for(a=0;s>a;a++)r=e[a],r.style&&(t&&"none"!==r.style.display&&""!==r.style.display||(r.style.display=t?o[a]||"":"none"));return e}b.fn.extend({css:function(e,n){return b.access(this,function(e,n,r){var i,o,a={},s=0;if(b.isArray(n)){for(o=Rt(e),i=n.length;i>s;s++)a[n[s]]=b.css(e,n[s],!1,o);return a}return r!==t?b.style(e,n,r):b.css(e,n)},e,n,arguments.length>1)},show:function(){return rn(this,!0)},hide:function(){return rn(this)},toggle:function(e){var t="boolean"==typeof e;return this.each(function(){(t?e:nn(this))?b(this).show():b(this).hide()})}}),b.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Wt(e,"opacity");return""===n?"1":n}}}},cssNumber:{columnCount:!0,fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":b.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,n,r,i){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var o,a,s,u=b.camelCase(n),l=e.style;if(n=b.cssProps[u]||(b.cssProps[u]=tn(l,u)),s=b.cssHooks[n]||b.cssHooks[u],r===t)return s&&"get"in s&&(o=s.get(e,!1,i))!==t?o:l[n];if(a=typeof r,"string"===a&&(o=Jt.exec(r))&&(r=(o[1]+1)*o[2]+parseFloat(b.css(e,n)),a="number"),!(null==r||"number"===a&&isNaN(r)||("number"!==a||b.cssNumber[u]||(r+="px"),b.support.clearCloneStyle||""!==r||0!==n.indexOf("background")||(l[n]="inherit"),s&&"set"in s&&(r=s.set(e,r,i))===t)))try{l[n]=r}catch(c){}}},css:function(e,n,r,i){var o,a,s,u=b.camelCase(n);return n=b.cssProps[u]||(b.cssProps[u]=tn(e.style,u)),s=b.cssHooks[n]||b.cssHooks[u],s&&"get"in s&&(a=s.get(e,!0,r)),a===t&&(a=Wt(e,n,i)),"normal"===a&&n in Kt&&(a=Kt[n]),""===r||r?(o=parseFloat(a),r===!0||b.isNumeric(o)?o||0:a):a},swap:function(e,t,n,r){var i,o,a={};for(o in t)a[o]=e.style[o],e.style[o]=t[o];i=n.apply(e,r||[]);for(o in t)e.style[o]=a[o];return i}}),e.getComputedStyle?(Rt=function(t){return e.getComputedStyle(t,null)},Wt=function(e,n,r){var i,o,a,s=r||Rt(e),u=s?s.getPropertyValue(n)||s[n]:t,l=e.style;return s&&(""!==u||b.contains(e.ownerDocument,e)||(u=b.style(e,n)),Yt.test(u)&&Ut.test(n)&&(i=l.width,o=l.minWidth,a=l.maxWidth,l.minWidth=l.maxWidth=l.width=u,u=s.width,l.width=i,l.minWidth=o,l.maxWidth=a)),u}):o.documentElement.currentStyle&&(Rt=function(e){return e.currentStyle},Wt=function(e,n,r){var i,o,a,s=r||Rt(e),u=s?s[n]:t,l=e.style;return null==u&&l&&l[n]&&(u=l[n]),Yt.test(u)&&!zt.test(n)&&(i=l.left,o=e.runtimeStyle,a=o&&o.left,a&&(o.left=e.currentStyle.left),l.left="fontSize"===n?"1em":u,u=l.pixelLeft+"px",l.left=i,a&&(o.left=a)),""===u?"auto":u});function on(e,t,n){var r=Vt.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function an(e,t,n,r,i){var o=n===(r?"border":"content")?4:"width"===t?1:0,a=0;for(;4>o;o+=2)"margin"===n&&(a+=b.css(e,n+Zt[o],!0,i)),r?("content"===n&&(a-=b.css(e,"padding"+Zt[o],!0,i)),"margin"!==n&&(a-=b.css(e,"border"+Zt[o]+"Width",!0,i))):(a+=b.css(e,"padding"+Zt[o],!0,i),"padding"!==n&&(a+=b.css(e,"border"+Zt[o]+"Width",!0,i)));return a}function sn(e,t,n){var r=!0,i="width"===t?e.offsetWidth:e.offsetHeight,o=Rt(e),a=b.support.boxSizing&&"border-box"===b.css(e,"boxSizing",!1,o);if(0>=i||null==i){if(i=Wt(e,t,o),(0>i||null==i)&&(i=e.style[t]),Yt.test(i))return i;r=a&&(b.support.boxSizingReliable||i===e.style[t]),i=parseFloat(i)||0}return i+an(e,t,n||(a?"border":"content"),r,o)+"px"}function un(e){var t=o,n=Gt[e];return n||(n=ln(e,t),"none"!==n&&n||(Pt=(Pt||b("<iframe frameborder='0' width='0' height='0'/>").css("cssText","display:block !important")).appendTo(t.documentElement),t=(Pt[0].contentWindow||Pt[0].contentDocument).document,t.write("<!doctype html><html><body>"),t.close(),n=ln(e,t),Pt.detach()),Gt[e]=n),n}function ln(e,t){var n=b(t.createElement(e)).appendTo(t.body),r=b.css(n[0],"display");return n.remove(),r}b.each(["height","width"],function(e,n){b.cssHooks[n]={get:function(e,r,i){return r?0===e.offsetWidth&&Xt.test(b.css(e,"display"))?b.swap(e,Qt,function(){return sn(e,n,i)}):sn(e,n,i):t},set:function(e,t,r){var i=r&&Rt(e);return on(e,t,r?an(e,n,r,b.support.boxSizing&&"border-box"===b.css(e,"boxSizing",!1,i),i):0)}}}),b.support.opacity||(b.cssHooks.opacity={get:function(e,t){return It.test((t&&e.currentStyle?e.currentStyle.filter:e.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":t?"1":""},set:function(e,t){var n=e.style,r=e.currentStyle,i=b.isNumeric(t)?"alpha(opacity="+100*t+")":"",o=r&&r.filter||n.filter||"";n.zoom=1,(t>=1||""===t)&&""===b.trim(o.replace($t,""))&&n.removeAttribute&&(n.removeAttribute("filter"),""===t||r&&!r.filter)||(n.filter=$t.test(o)?o.replace($t,i):o+" "+i)}}),b(function(){b.support.reliableMarginRight||(b.cssHooks.marginRight={get:function(e,n){return n?b.swap(e,{display:"inline-block"},Wt,[e,"marginRight"]):t}}),!b.support.pixelPosition&&b.fn.position&&b.each(["top","left"],function(e,n){b.cssHooks[n]={get:function(e,r){return r?(r=Wt(e,n),Yt.test(r)?b(e).position()[n]+"px":r):t}}})}),b.expr&&b.expr.filters&&(b.expr.filters.hidden=function(e){return 0>=e.offsetWidth&&0>=e.offsetHeight||!b.support.reliableHiddenOffsets&&"none"===(e.style&&e.style.display||b.css(e,"display"))},b.expr.filters.visible=function(e){return!b.expr.filters.hidden(e)}),b.each({margin:"",padding:"",border:"Width"},function(e,t){b.cssHooks[e+t]={expand:function(n){var r=0,i={},o="string"==typeof n?n.split(" "):[n];for(;4>r;r++)i[e+Zt[r]+t]=o[r]||o[r-2]||o[0];return i}},Ut.test(e)||(b.cssHooks[e+t].set=on)});var cn=/%20/g,pn=/\[\]$/,fn=/\r?\n/g,dn=/^(?:submit|button|image|reset|file)$/i,hn=/^(?:input|select|textarea|keygen)/i;b.fn.extend({serialize:function(){return b.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=b.prop(this,"elements");return e?b.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!b(this).is(":disabled")&&hn.test(this.nodeName)&&!dn.test(e)&&(this.checked||!Nt.test(e))}).map(function(e,t){var n=b(this).val();return null==n?null:b.isArray(n)?b.map(n,function(e){return{name:t.name,value:e.replace(fn,"\r\n")}}):{name:t.name,value:n.replace(fn,"\r\n")}}).get()}}),b.param=function(e,n){var r,i=[],o=function(e,t){t=b.isFunction(t)?t():null==t?"":t,i[i.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};if(n===t&&(n=b.ajaxSettings&&b.ajaxSettings.traditional),b.isArray(e)||e.jquery&&!b.isPlainObject(e))b.each(e,function(){o(this.name,this.value)});else for(r in e)gn(r,e[r],n,o);return i.join("&").replace(cn,"+")};function gn(e,t,n,r){var i;if(b.isArray(t))b.each(t,function(t,i){n||pn.test(e)?r(e,i):gn(e+"["+("object"==typeof i?t:"")+"]",i,n,r)});else if(n||"object"!==b.type(t))r(e,t);else for(i in t)gn(e+"["+i+"]",t[i],n,r)}b.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 contextmenu".split(" "),function(e,t){b.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}}),b.fn.hover=function(e,t){return this.mouseenter(e).mouseleave(t||e)};var mn,yn,vn=b.now(),bn=/\?/,xn=/#.*$/,wn=/([?&])_=[^&]*/,Tn=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Nn=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Cn=/^(?:GET|HEAD)$/,kn=/^\/\//,En=/^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,Sn=b.fn.load,An={},jn={},Dn="*/".concat("*");try{yn=a.href}catch(Ln){yn=o.createElement("a"),yn.href="",yn=yn.href}mn=En.exec(yn.toLowerCase())||[];function Hn(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var r,i=0,o=t.toLowerCase().match(w)||[];if(b.isFunction(n))while(r=o[i++])"+"===r[0]?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function qn(e,n,r,i){var o={},a=e===jn;function s(u){var l;return o[u]=!0,b.each(e[u]||[],function(e,u){var c=u(n,r,i);return"string"!=typeof c||a||o[c]?a?!(l=c):t:(n.dataTypes.unshift(c),s(c),!1)}),l}return s(n.dataTypes[0])||!o["*"]&&s("*")}function Mn(e,n){var r,i,o=b.ajaxSettings.flatOptions||{};for(i in n)n[i]!==t&&((o[i]?e:r||(r={}))[i]=n[i]);return r&&b.extend(!0,e,r),e}b.fn.load=function(e,n,r){if("string"!=typeof e&&Sn)return Sn.apply(this,arguments);var i,o,a,s=this,u=e.indexOf(" ");return u>=0&&(i=e.slice(u,e.length),e=e.slice(0,u)),b.isFunction(n)?(r=n,n=t):n&&"object"==typeof n&&(a="POST"),s.length>0&&b.ajax({url:e,type:a,dataType:"html",data:n}).done(function(e){o=arguments,s.html(i?b("<div>").append(b.parseHTML(e)).find(i):e)}).complete(r&&function(e,t){s.each(r,o||[e.responseText,t,e])}),this},b.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){b.fn[t]=function(e){return this.on(t,e)}}),b.each(["get","post"],function(e,n){b[n]=function(e,r,i,o){return b.isFunction(r)&&(o=o||i,i=r,r=t),b.ajax({url:e,type:n,dataType:o,data:r,success:i})}}),b.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:yn,type:"GET",isLocal:Nn.test(mn[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Dn,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":e.String,"text html":!0,"text json":b.parseJSON,"text xml":b.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?Mn(Mn(e,b.ajaxSettings),t):Mn(b.ajaxSettings,e)},ajaxPrefilter:Hn(An),ajaxTransport:Hn(jn),ajax:function(e,n){"object"==typeof e&&(n=e,e=t),n=n||{};var r,i,o,a,s,u,l,c,p=b.ajaxSetup({},n),f=p.context||p,d=p.context&&(f.nodeType||f.jquery)?b(f):b.event,h=b.Deferred(),g=b.Callbacks("once memory"),m=p.statusCode||{},y={},v={},x=0,T="canceled",N={readyState:0,getResponseHeader:function(e){var t;if(2===x){if(!c){c={};while(t=Tn.exec(a))c[t[1].toLowerCase()]=t[2]}t=c[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return 2===x?a:null},setRequestHeader:function(e,t){var n=e.toLowerCase();return x||(e=v[n]=v[n]||e,y[e]=t),this},overrideMimeType:function(e){return x||(p.mimeType=e),this},statusCode:function(e){var t;if(e)if(2>x)for(t in e)m[t]=[m[t],e[t]];else N.always(e[N.status]);return this},abort:function(e){var t=e||T;return l&&l.abort(t),k(0,t),this}};if(h.promise(N).complete=g.add,N.success=N.done,N.error=N.fail,p.url=((e||p.url||yn)+"").replace(xn,"").replace(kn,mn[1]+"//"),p.type=n.method||n.type||p.method||p.type,p.dataTypes=b.trim(p.dataType||"*").toLowerCase().match(w)||[""],null==p.crossDomain&&(r=En.exec(p.url.toLowerCase()),p.crossDomain=!(!r||r[1]===mn[1]&&r[2]===mn[2]&&(r[3]||("http:"===r[1]?80:443))==(mn[3]||("http:"===mn[1]?80:443)))),p.data&&p.processData&&"string"!=typeof p.data&&(p.data=b.param(p.data,p.traditional)),qn(An,p,n,N),2===x)return N;u=p.global,u&&0===b.active++&&b.event.trigger("ajaxStart"),p.type=p.type.toUpperCase(),p.hasContent=!Cn.test(p.type),o=p.url,p.hasContent||(p.data&&(o=p.url+=(bn.test(o)?"&":"?")+p.data,delete p.data),p.cache===!1&&(p.url=wn.test(o)?o.replace(wn,"$1_="+vn++):o+(bn.test(o)?"&":"?")+"_="+vn++)),p.ifModified&&(b.lastModified[o]&&N.setRequestHeader("If-Modified-Since",b.lastModified[o]),b.etag[o]&&N.setRequestHeader("If-None-Match",b.etag[o])),(p.data&&p.hasContent&&p.contentType!==!1||n.contentType)&&N.setRequestHeader("Content-Type",p.contentType),N.setRequestHeader("Accept",p.dataTypes[0]&&p.accepts[p.dataTypes[0]]?p.accepts[p.dataTypes[0]]+("*"!==p.dataTypes[0]?", "+Dn+"; q=0.01":""):p.accepts["*"]);for(i in p.headers)N.setRequestHeader(i,p.headers[i]);if(p.beforeSend&&(p.beforeSend.call(f,N,p)===!1||2===x))return N.abort();T="abort";for(i in{success:1,error:1,complete:1})N[i](p[i]);if(l=qn(jn,p,n,N)){N.readyState=1,u&&d.trigger("ajaxSend",[N,p]),p.async&&p.timeout>0&&(s=setTimeout(function(){N.abort("timeout")},p.timeout));try{x=1,l.send(y,k)}catch(C){if(!(2>x))throw C;k(-1,C)}}else k(-1,"No Transport");function k(e,n,r,i){var c,y,v,w,T,C=n;2!==x&&(x=2,s&&clearTimeout(s),l=t,a=i||"",N.readyState=e>0?4:0,r&&(w=_n(p,N,r)),e>=200&&300>e||304===e?(p.ifModified&&(T=N.getResponseHeader("Last-Modified"),T&&(b.lastModified[o]=T),T=N.getResponseHeader("etag"),T&&(b.etag[o]=T)),204===e?(c=!0,C="nocontent"):304===e?(c=!0,C="notmodified"):(c=Fn(p,w),C=c.state,y=c.data,v=c.error,c=!v)):(v=C,(e||!C)&&(C="error",0>e&&(e=0))),N.status=e,N.statusText=(n||C)+"",c?h.resolveWith(f,[y,C,N]):h.rejectWith(f,[N,C,v]),N.statusCode(m),m=t,u&&d.trigger(c?"ajaxSuccess":"ajaxError",[N,p,c?y:v]),g.fireWith(f,[N,C]),u&&(d.trigger("ajaxComplete",[N,p]),--b.active||b.event.trigger("ajaxStop")))}return N},getScript:function(e,n){return b.get(e,t,n,"script")},getJSON:function(e,t,n){return b.get(e,t,n,"json")}});function _n(e,n,r){var i,o,a,s,u=e.contents,l=e.dataTypes,c=e.responseFields;for(s in c)s in r&&(n[c[s]]=r[s]);while("*"===l[0])l.shift(),o===t&&(o=e.mimeType||n.getResponseHeader("Content-Type"));if(o)for(s in u)if(u[s]&&u[s].test(o)){l.unshift(s);break}if(l[0]in r)a=l[0];else{for(s in r){if(!l[0]||e.converters[s+" "+l[0]]){a=s;break}i||(i=s)}a=a||i}return a?(a!==l[0]&&l.unshift(a),r[a]):t}function Fn(e,t){var n,r,i,o,a={},s=0,u=e.dataTypes.slice(),l=u[0];if(e.dataFilter&&(t=e.dataFilter(t,e.dataType)),u[1])for(i in e.converters)a[i.toLowerCase()]=e.converters[i];for(;r=u[++s];)if("*"!==r){if("*"!==l&&l!==r){if(i=a[l+" "+r]||a["* "+r],!i)for(n in a)if(o=n.split(" "),o[1]===r&&(i=a[l+" "+o[0]]||a["* "+o[0]])){i===!0?i=a[n]:a[n]!==!0&&(r=o[0],u.splice(s--,0,r));break}if(i!==!0)if(i&&e["throws"])t=i(t);else try{t=i(t)}catch(c){return{state:"parsererror",error:i?c:"No conversion from "+l+" to "+r}}}l=r}return{state:"success",data:t}}b.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(e){return b.globalEval(e),e}}}),b.ajaxPrefilter("script",function(e){e.cache===t&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),b.ajaxTransport("script",function(e){if(e.crossDomain){var n,r=o.head||b("head")[0]||o.documentElement;return{send:function(t,i){n=o.createElement("script"),n.async=!0,e.scriptCharset&&(n.charset=e.scriptCharset),n.src=e.url,n.onload=n.onreadystatechange=function(e,t){(t||!n.readyState||/loaded|complete/.test(n.readyState))&&(n.onload=n.onreadystatechange=null,n.parentNode&&n.parentNode.removeChild(n),n=null,t||i(200,"success"))},r.insertBefore(n,r.firstChild)},abort:function(){n&&n.onload(t,!0)}}}});var On=[],Bn=/(=)\?(?=&|$)|\?\?/;b.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=On.pop()||b.expando+"_"+vn++;return this[e]=!0,e}}),b.ajaxPrefilter("json jsonp",function(n,r,i){var o,a,s,u=n.jsonp!==!1&&(Bn.test(n.url)?"url":"string"==typeof n.data&&!(n.contentType||"").indexOf("application/x-www-form-urlencoded")&&Bn.test(n.data)&&"data");return u||"jsonp"===n.dataTypes[0]?(o=n.jsonpCallback=b.isFunction(n.jsonpCallback)?n.jsonpCallback():n.jsonpCallback,u?n[u]=n[u].replace(Bn,"$1"+o):n.jsonp!==!1&&(n.url+=(bn.test(n.url)?"&":"?")+n.jsonp+"="+o),n.converters["script json"]=function(){return s||b.error(o+" was not called"),s[0]},n.dataTypes[0]="json",a=e[o],e[o]=function(){s=arguments},i.always(function(){e[o]=a,n[o]&&(n.jsonpCallback=r.jsonpCallback,On.push(o)),s&&b.isFunction(a)&&a(s[0]),s=a=t}),"script"):t});var Pn,Rn,Wn=0,$n=e.ActiveXObject&&function(){var e;for(e in Pn)Pn[e](t,!0)};function In(){try{return new e.XMLHttpRequest}catch(t){}}function zn(){try{return new e.ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}b.ajaxSettings.xhr=e.ActiveXObject?function(){return!this.isLocal&&In()||zn()}:In,Rn=b.ajaxSettings.xhr(),b.support.cors=!!Rn&&"withCredentials"in Rn,Rn=b.support.ajax=!!Rn,Rn&&b.ajaxTransport(function(n){if(!n.crossDomain||b.support.cors){var r;return{send:function(i,o){var a,s,u=n.xhr();if(n.username?u.open(n.type,n.url,n.async,n.username,n.password):u.open(n.type,n.url,n.async),n.xhrFields)for(s in n.xhrFields)u[s]=n.xhrFields[s];n.mimeType&&u.overrideMimeType&&u.overrideMimeType(n.mimeType),n.crossDomain||i["X-Requested-With"]||(i["X-Requested-With"]="XMLHttpRequest");try{for(s in i)u.setRequestHeader(s,i[s])}catch(l){}u.send(n.hasContent&&n.data||null),r=function(e,i){var s,l,c,p;try{if(r&&(i||4===u.readyState))if(r=t,a&&(u.onreadystatechange=b.noop,$n&&delete Pn[a]),i)4!==u.readyState&&u.abort();else{p={},s=u.status,l=u.getAllResponseHeaders(),"string"==typeof u.responseText&&(p.text=u.responseText);try{c=u.statusText}catch(f){c=""}s||!n.isLocal||n.crossDomain?1223===s&&(s=204):s=p.text?200:404}}catch(d){i||o(-1,d)}p&&o(s,c,p,l)},n.async?4===u.readyState?setTimeout(r):(a=++Wn,$n&&(Pn||(Pn={},b(e).unload($n)),Pn[a]=r),u.onreadystatechange=r):r()},abort:function(){r&&r(t,!0)}}}});var Xn,Un,Vn=/^(?:toggle|show|hide)$/,Yn=RegExp("^(?:([+-])=|)("+x+")([a-z%]*)$","i"),Jn=/queueHooks$/,Gn=[nr],Qn={"*":[function(e,t){var n,r,i=this.createTween(e,t),o=Yn.exec(t),a=i.cur(),s=+a||0,u=1,l=20;if(o){if(n=+o[2],r=o[3]||(b.cssNumber[e]?"":"px"),"px"!==r&&s){s=b.css(i.elem,e,!0)||n||1;do u=u||".5",s/=u,b.style(i.elem,e,s+r);while(u!==(u=i.cur()/a)&&1!==u&&--l)}i.unit=r,i.start=s,i.end=o[1]?s+(o[1]+1)*n:n}return i}]};function Kn(){return setTimeout(function(){Xn=t}),Xn=b.now()}function Zn(e,t){b.each(t,function(t,n){var r=(Qn[t]||[]).concat(Qn["*"]),i=0,o=r.length;for(;o>i;i++)if(r[i].call(e,t,n))return})}function er(e,t,n){var r,i,o=0,a=Gn.length,s=b.Deferred().always(function(){delete u.elem}),u=function(){if(i)return!1;var t=Xn||Kn(),n=Math.max(0,l.startTime+l.duration-t),r=n/l.duration||0,o=1-r,a=0,u=l.tweens.length;for(;u>a;a++)l.tweens[a].run(o);return s.notifyWith(e,[l,o,n]),1>o&&u?n:(s.resolveWith(e,[l]),!1)},l=s.promise({elem:e,props:b.extend({},t),opts:b.extend(!0,{specialEasing:{}},n),originalProperties:t,originalOptions:n,startTime:Xn||Kn(),duration:n.duration,tweens:[],createTween:function(t,n){var r=b.Tween(e,l.opts,t,n,l.opts.specialEasing[t]||l.opts.easing);return l.tweens.push(r),r},stop:function(t){var n=0,r=t?l.tweens.length:0;if(i)return this;for(i=!0;r>n;n++)l.tweens[n].run(1);return t?s.resolveWith(e,[l,t]):s.rejectWith(e,[l,t]),this}}),c=l.props;for(tr(c,l.opts.specialEasing);a>o;o++)if(r=Gn[o].call(l,e,c,l.opts))return r;return Zn(l,c),b.isFunction(l.opts.start)&&l.opts.start.call(e,l),b.fx.timer(b.extend(u,{elem:e,anim:l,queue:l.opts.queue})),l.progress(l.opts.progress).done(l.opts.done,l.opts.complete).fail(l.opts.fail).always(l.opts.always)}function tr(e,t){var n,r,i,o,a;for(i in e)if(r=b.camelCase(i),o=t[r],n=e[i],b.isArray(n)&&(o=n[1],n=e[i]=n[0]),i!==r&&(e[r]=n,delete e[i]),a=b.cssHooks[r],a&&"expand"in a){n=a.expand(n),delete e[r];for(i in n)i in e||(e[i]=n[i],t[i]=o)}else t[r]=o}b.Animation=b.extend(er,{tweener:function(e,t){b.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");var n,r=0,i=e.length;for(;i>r;r++)n=e[r],Qn[n]=Qn[n]||[],Qn[n].unshift(t)},prefilter:function(e,t){t?Gn.unshift(e):Gn.push(e)}});function nr(e,t,n){var r,i,o,a,s,u,l,c,p,f=this,d=e.style,h={},g=[],m=e.nodeType&&nn(e);n.queue||(c=b._queueHooks(e,"fx"),null==c.unqueued&&(c.unqueued=0,p=c.empty.fire,c.empty.fire=function(){c.unqueued||p()}),c.unqueued++,f.always(function(){f.always(function(){c.unqueued--,b.queue(e,"fx").length||c.empty.fire()})})),1===e.nodeType&&("height"in t||"width"in t)&&(n.overflow=[d.overflow,d.overflowX,d.overflowY],"inline"===b.css(e,"display")&&"none"===b.css(e,"float")&&(b.support.inlineBlockNeedsLayout&&"inline"!==un(e.nodeName)?d.zoom=1:d.display="inline-block")),n.overflow&&(d.overflow="hidden",b.support.shrinkWrapBlocks||f.always(function(){d.overflow=n.overflow[0],d.overflowX=n.overflow[1],d.overflowY=n.overflow[2]}));for(i in t)if(a=t[i],Vn.exec(a)){if(delete t[i],u=u||"toggle"===a,a===(m?"hide":"show"))continue;g.push(i)}if(o=g.length){s=b._data(e,"fxshow")||b._data(e,"fxshow",{}),"hidden"in s&&(m=s.hidden),u&&(s.hidden=!m),m?b(e).show():f.done(function(){b(e).hide()}),f.done(function(){var t;b._removeData(e,"fxshow");for(t in h)b.style(e,t,h[t])});for(i=0;o>i;i++)r=g[i],l=f.createTween(r,m?s[r]:0),h[r]=s[r]||b.style(e,r),r in s||(s[r]=l.start,m&&(l.end=l.start,l.start="width"===r||"height"===r?1:0))}}function rr(e,t,n,r,i){return new rr.prototype.init(e,t,n,r,i)}b.Tween=rr,rr.prototype={constructor:rr,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||"swing",this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(b.cssNumber[n]?"":"px")},cur:function(){var e=rr.propHooks[this.prop];return e&&e.get?e.get(this):rr.propHooks._default.get(this)},run:function(e){var t,n=rr.propHooks[this.prop];return this.pos=t=this.options.duration?b.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):rr.propHooks._default.set(this),this}},rr.prototype.init.prototype=rr.prototype,rr.propHooks={_default:{get:function(e){var t;return null==e.elem[e.prop]||e.elem.style&&null!=e.elem.style[e.prop]?(t=b.css(e.elem,e.prop,""),t&&"auto"!==t?t:0):e.elem[e.prop]},set:function(e){b.fx.step[e.prop]?b.fx.step[e.prop](e):e.elem.style&&(null!=e.elem.style[b.cssProps[e.prop]]||b.cssHooks[e.prop])?b.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},rr.propHooks.scrollTop=rr.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},b.each(["toggle","show","hide"],function(e,t){var n=b.fn[t];b.fn[t]=function(e,r,i){return null==e||"boolean"==typeof e?n.apply(this,arguments):this.animate(ir(t,!0),e,r,i)}}),b.fn.extend({fadeTo:function(e,t,n,r){return this.filter(nn).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=b.isEmptyObject(e),o=b.speed(t,n,r),a=function(){var t=er(this,b.extend({},e),o);a.finish=function(){t.stop(!0)},(i||b._data(this,"finish"))&&t.stop(!0)};return a.finish=a,i||o.queue===!1?this.each(a):this.queue(o.queue,a)},stop:function(e,n,r){var i=function(e){var t=e.stop;delete e.stop,t(r)};return"string"!=typeof e&&(r=n,n=e,e=t),n&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,n=null!=e&&e+"queueHooks",o=b.timers,a=b._data(this);if(n)a[n]&&a[n].stop&&i(a[n]);else for(n in a)a[n]&&a[n].stop&&Jn.test(n)&&i(a[n]);for(n=o.length;n--;)o[n].elem!==this||null!=e&&o[n].queue!==e||(o[n].anim.stop(r),t=!1,o.splice(n,1));(t||!r)&&b.dequeue(this,e)})},finish:function(e){return e!==!1&&(e=e||"fx"),this.each(function(){var t,n=b._data(this),r=n[e+"queue"],i=n[e+"queueHooks"],o=b.timers,a=r?r.length:0;for(n.finish=!0,b.queue(this,e,[]),i&&i.cur&&i.cur.finish&&i.cur.finish.call(this),t=o.length;t--;)o[t].elem===this&&o[t].queue===e&&(o[t].anim.stop(!0),o.splice(t,1));for(t=0;a>t;t++)r[t]&&r[t].finish&&r[t].finish.call(this);delete n.finish})}});function ir(e,t){var n,r={height:e},i=0;for(t=t?1:0;4>i;i+=2-t)n=Zt[i],r["margin"+n]=r["padding"+n]=e;return t&&(r.opacity=r.width=e),r}b.each({slideDown:ir("show"),slideUp:ir("hide"),slideToggle:ir("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){b.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),b.speed=function(e,t,n){var r=e&&"object"==typeof e?b.extend({},e):{complete:n||!n&&t||b.isFunction(e)&&e,duration:e,easing:n&&t||t&&!b.isFunction(t)&&t};return r.duration=b.fx.off?0:"number"==typeof r.duration?r.duration:r.duration in b.fx.speeds?b.fx.speeds[r.duration]:b.fx.speeds._default,(null==r.queue||r.queue===!0)&&(r.queue="fx"),r.old=r.complete,r.complete=function(){b.isFunction(r.old)&&r.old.call(this),r.queue&&b.dequeue(this,r.queue)},r},b.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},b.timers=[],b.fx=rr.prototype.init,b.fx.tick=function(){var e,n=b.timers,r=0;for(Xn=b.now();n.length>r;r++)e=n[r],e()||n[r]!==e||n.splice(r--,1);n.length||b.fx.stop(),Xn=t},b.fx.timer=function(e){e()&&b.timers.push(e)&&b.fx.start()},b.fx.interval=13,b.fx.start=function(){Un||(Un=setInterval(b.fx.tick,b.fx.interval))},b.fx.stop=function(){clearInterval(Un),Un=null},b.fx.speeds={slow:600,fast:200,_default:400},b.fx.step={},b.expr&&b.expr.filters&&(b.expr.filters.animated=function(e){return b.grep(b.timers,function(t){return e===t.elem}).length}),b.fn.offset=function(e){if(arguments.length)return e===t?this:this.each(function(t){b.offset.setOffset(this,e,t)});var n,r,o={top:0,left:0},a=this[0],s=a&&a.ownerDocument;if(s)return n=s.documentElement,b.contains(n,a)?(typeof a.getBoundingClientRect!==i&&(o=a.getBoundingClientRect()),r=or(s),{top:o.top+(r.pageYOffset||n.scrollTop)-(n.clientTop||0),left:o.left+(r.pageXOffset||n.scrollLeft)-(n.clientLeft||0)}):o},b.offset={setOffset:function(e,t,n){var r=b.css(e,"position");"static"===r&&(e.style.position="relative");var i=b(e),o=i.offset(),a=b.css(e,"top"),s=b.css(e,"left"),u=("absolute"===r||"fixed"===r)&&b.inArray("auto",[a,s])>-1,l={},c={},p,f;u?(c=i.position(),p=c.top,f=c.left):(p=parseFloat(a)||0,f=parseFloat(s)||0),b.isFunction(t)&&(t=t.call(e,n,o)),null!=t.top&&(l.top=t.top-o.top+p),null!=t.left&&(l.left=t.left-o.left+f),"using"in t?t.using.call(e,l):i.css(l)}},b.fn.extend({position:function(){if(this[0]){var e,t,n={top:0,left:0},r=this[0];return"fixed"===b.css(r,"position")?t=r.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),b.nodeName(e[0],"html")||(n=e.offset()),n.top+=b.css(e[0],"borderTopWidth",!0),n.left+=b.css(e[0],"borderLeftWidth",!0)),{top:t.top-n.top-b.css(r,"marginTop",!0),left:t.left-n.left-b.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||o.documentElement;while(e&&!b.nodeName(e,"html")&&"static"===b.css(e,"position"))e=e.offsetParent;return e||o.documentElement})}}),b.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,n){var r=/Y/.test(n);b.fn[e]=function(i){return b.access(this,function(e,i,o){var a=or(e);return o===t?a?n in a?a[n]:a.document.documentElement[i]:e[i]:(a?a.scrollTo(r?b(a).scrollLeft():o,r?o:b(a).scrollTop()):e[i]=o,t)},e,i,arguments.length,null)}});function or(e){return b.isWindow(e)?e:9===e.nodeType?e.defaultView||e.parentWindow:!1}b.each({Height:"height",Width:"width"},function(e,n){b.each({padding:"inner"+e,content:n,"":"outer"+e},function(r,i){b.fn[i]=function(i,o){var a=arguments.length&&(r||"boolean"!=typeof i),s=r||(i===!0||o===!0?"margin":"border");return b.access(this,function(n,r,i){var o;return b.isWindow(n)?n.document.documentElement["client"+e]:9===n.nodeType?(o=n.documentElement,Math.max(n.body["scroll"+e],o["scroll"+e],n.body["offset"+e],o["offset"+e],o["client"+e])):i===t?b.css(n,r,s):b.style(n,r,i,s)},n,a?i:t,a,null)}})}),e.jQuery=e.$=b,"function"==typeof define&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return b})})(window);
 
 
 
 
js/ICEshop/Iceimport/script.js CHANGED
@@ -39,7 +39,7 @@ function buildIceshopInfo()
39
  jQuery('div.entry-edit').closest('div.main-col-inner').find('div.content-header').find('table td.form-buttons').hide();
40
  jQuery('div.content-header-floating').find('table td.form-buttons').html('');
41
  }
42
- }
43
 
44
  function refreshIceimportSystemCheck(url_string) {
45
  if (typeof url_string == 'undefined') {
@@ -76,7 +76,7 @@ function refreshIceimportSystemCheck(url_string) {
76
  }
77
  );
78
  }
79
- }
80
 
81
  function toggleIceimportFieldset(element, action_type)
82
  {
@@ -109,7 +109,7 @@ function toggleIceimportFieldset(element, action_type)
109
  }
110
  }
111
  return false;
112
- }
113
 
114
  var Base64 = {
115
  // private property
@@ -244,4 +244,4 @@ var Base64 = {
244
  }
245
  return string;
246
  }
247
- }
39
  jQuery('div.entry-edit').closest('div.main-col-inner').find('div.content-header').find('table td.form-buttons').hide();
40
  jQuery('div.content-header-floating').find('table td.form-buttons').html('');
41
  }
42
+ };
43
 
44
  function refreshIceimportSystemCheck(url_string) {
45
  if (typeof url_string == 'undefined') {
76
  }
77
  );
78
  }
79
+ };
80
 
81
  function toggleIceimportFieldset(element, action_type)
82
  {
109
  }
110
  }
111
  return false;
112
+ };
113
 
114
  var Base64 = {
115
  // private property
244
  }
245
  return string;
246
  }
247
+ };
package.xml CHANGED
@@ -1,43 +1,22 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>ice_import</name>
4
- <version>1.7.5</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">OSL v.3</license>
7
  <channel>community</channel>
8
  <extends/>
9
- <summary>Import categories &amp; products</summary>
10
  <description>This extension can use to import products with categories, multiple images and custom options from CSV file.</description>
11
- <notes>Release notes&#xD;
12
- &#xD;
13
- Dashboard:&#xD;
14
- - Server setup requirements&#xD;
15
- - Statistic information&#xD;
16
- - Self problem detection&#xD;
17
- - Errors notification&#xD;
18
- &#xD;
19
- New settings with Yes/No option:&#xD;
20
- - Hide empty category&#xD;
21
- - Sort categories in ASC order&#xD;
22
- - Remove old products&#xD;
23
- - Import new products&#xD;
24
- - Update URL key&#xD;
25
- - Update stock availability&#xD;
26
- - Update visibility&#xD;
27
- - Update status&#xD;
28
- - Update products category&#xD;
29
- &#xD;
30
- New general settings:&#xD;
31
- - Batch size&#xD;
32
- - Tolerance of difference (%), If difference is greater than this value - remove process will be cancelled.&#xD;
33
- &#xD;
34
- Bugfixes:&#xD;
35
- - Categories importing&#xD;
36
- - Removing old products</notes>
37
- <authors><author><name>Iceshop</name><user>Iceshop</user><email>support@iceshop.nl</email></author></authors>
38
- <date>2014-05-22</date>
39
- <time>07:35:04</time>
40
- <contents><target name="magecommunity"><dir name="ICEshop"><dir name="Iceimport"><dir><dir name="Block"><dir name="Adminhtml"><file name="Notifications.php" hash="72fb1436a56e3da023983a1c0e97c638"/></dir></dir><dir name="Helper"><file name="Data.php" hash="fd9775a248481ddd683926452affb9ff"/><file name="Db.php" hash="82a50791a03feb3ee634c1b60f2845da"/><file name="Format.php" hash="5c56ce9db24076c52b198325fb637758"/><dir name="System"><file name="System.php" hash="ff58fc97338b95e165de85ef640147de"/><file name="Systemcheck.php" hash="76b96485beefaf17bca4f40dcdce78b3"/></dir></dir><dir name="Model"><dir name="Convert"><dir name="Adapter"><file name="Product.php" hash="8b205686944f8f2934d4de504f9f51ea"/></dir></dir><dir name="Dataflow"><dir name="Batch"><file name="Import.php" hash="52c0ed7367b2200a17a48103e953ae58"/></dir><dir name="Convert"><dir name="Parser"><file name="Csv.php" hash="c9dfbfe575d6f730911bf7da4c977c31"/></dir></dir></dir><file name="Observer.php" hash="4f1fbf6630b6ab49d89376bb0f9dbdd6"/><dir name="System"><dir name="Config"><file name="Checksystem.php" hash="260200dc8cecfa718b32fa47468282df"/><file name="Defaulttax.php" hash="2baea942efcc3880d785da9f021f04fc"/><file name="Iceshoplink.php" hash="e77e62b0c00e2569ea5fdb0fb91ff90a"/><file name="Yesno.php" hash="59e349561a36e02f44b47301fce99ef5"/></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="IceimportController.php" hash="10440af0556f950fbdf9f32c7f8bc2ef"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="ccc6e54f97814cd40e75ee93b7b242a8"/><file name="config.xml" hash="04350f0961ae19bcd06d1aaeb3bfb7a4"/><file name="system.xml" hash="9138d8496f65c89565483caa0ff7b735"/></dir><dir name="sql"><dir name="iceimport_setup"><file name="mysql4-install-1.7.3.php" hash="7d38ce5d3ff7a8e519acdd06bea107ff"/><file name="mysql4-upgrade-0.1.0-1.7.0.php" hash="9d3c6b645fd4546552eec4d65ba41275"/><file name="mysql4-upgrade-1.4.0-1.7.0.php" hash="9d3c6b645fd4546552eec4d65ba41275"/><file name="mysql4-upgrade-1.5.0-1.7.0.php" hash="8ec0593b60ff13ffdf4afdf3ca74634d"/><file name="mysql4-upgrade-1.6.0-1.7.0.php" hash="8ec0593b60ff13ffdf4afdf3ca74634d"/><file name="mysql4-upgrade-1.7.0-1.7.5.php" hash="aac071b5334697f4fac119c533582c19"/><file name="uninstall-old-version.php" hash="4269e8547005958b044946d5e2d670e9"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="ICEshop_Iceimport.xml" hash="b94f339b79303bf7e78ba89290c66ada"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="ICEshop_Iceimport.xml" hash="fee9d6f2980b94e1c79dae0088dbda0f"/></dir><dir name="template"><dir name="iceshop"><dir name="iceimport"><file name="notifications.phtml" hash="ca9e0e2082c659a684e5ab79c432e25f"/></dir></dir></dir></dir></dir></dir></target><target name="mageweb"><dir name="js"><dir name="ICEshop"><dir name="Iceimport"><file name="jquery-1.9.1.min.js" hash="fee4c9e0129fb2b8830a3c17638c44b0"/><file name="script.js" hash="fff12088d0453e7bc0d254ce81fb4793"/></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="iceshop"><dir name="iceimport"><dir><dir name="images"><file name="iceshop_logo_small_16px.png" hash="4ef632b4b89a047789307b301b9dfb6e"/></dir></dir><file name="styles.css" hash="9d9d5064de683afaff19446b908cb711"/></dir></dir></dir></dir></dir></target></contents>
41
  <compatible/>
42
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
43
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>ice_import</name>
4
+ <version>1.7.11</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">OSL v.3</license>
7
  <channel>community</channel>
8
  <extends/>
9
+ <summary>Import categories &amp; productsr</summary>
10
  <description>This extension can use to import products with categories, multiple images and custom options from CSV file.</description>
11
+ <notes>Improvements:&#xD;
12
+ - Update productst category.&#xD;
13
+ - Added namespace in system config&#xD;
14
+ Bugfix:&#xD;
15
+ - Minor bug fixing</notes>
16
+ <authors><author><name>IceShop</name><user>IceShop</user><email>support@iceshop.nl</email></author></authors>
17
+ <date>2015-04-10</date>
18
+ <time>11:40:48</time>
19
+ <contents><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="ICEshop_Iceimport.xml" hash="566089f8d3a54436ae62ebd4c5124293"/></dir><dir name="template"><dir name="iceshop"><dir name="iceimport"><file name="notifications.phtml" hash="3d9336ffcd90d11a34271d01b0b7fa9e"/></dir></dir></dir></dir></dir></dir></target><target name="mage"><dir name="js"><dir name="ICEshop"><dir name="Iceimport"><file name="jquery-1.11.1.min.js" hash="056fd2a776eae867b7e2b5ddcb754d78"/><file name="script.js" hash="dabaaf1b4924cb8a2fd4e14de93f74e6"/></dir></dir></dir><dir name="skin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="iceshop"><dir name="iceimport"><dir name="images"><file name="iceshop_logo_small_16px.png" hash="4ef632b4b89a047789307b301b9dfb6e"/></dir><file name="styles.css" hash="0136e37ac22d82753fafec8294bc8555"/></dir></dir></dir></dir></dir></dir></target><target name="magecommunity"><dir name="ICEshop"><dir name="Iceimport"><dir name="Block"><dir name="Adminhtml"><file name="Notifications.php" hash="4355538a30333b5c61cfe1550ae0129b"/></dir></dir><dir name="Helper"><file name="Data.php" hash="fd9775a248481ddd683926452affb9ff"/><file name="Db.php" hash="564941a7ee03c28f46d282681c0c7c10"/><file name="Format.php" hash="5c56ce9db24076c52b198325fb637758"/><dir name="System"><file name="System.php" hash="ff58fc97338b95e165de85ef640147de"/><file name="Systemcheck.php" hash="642ef9dca28a880ac9d6b94e7f0d414a"/></dir></dir><dir name="Model"><dir name="Convert"><dir name="Adapter"><file name="Product.php" hash="84f5a5641b313269fb311513d9986c4c"/></dir></dir><dir name="Dataflow"><dir name="Batch"><file name="Import.php" hash="52c0ed7367b2200a17a48103e953ae58"/></dir><dir name="Convert"><dir name="Parser"><file name="Csv.php" hash="d8376f5c1091b3d6185059c845af3272"/></dir></dir></dir><file name="Observer.php" hash="b6074eaa99d2371b7f28a0adfc12bcf2"/><dir name="System"><dir name="Config"><file name="Checksystem.php" hash="260200dc8cecfa718b32fa47468282df"/><file name="Defaulttax.php" hash="898bf21060622bf8dc96469eb018c463"/><file name="Iceshoplink.php" hash="e77e62b0c00e2569ea5fdb0fb91ff90a"/><file name="Yesno.php" hash="59e349561a36e02f44b47301fce99ef5"/></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="IceimportController.php" hash="10440af0556f950fbdf9f32c7f8bc2ef"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="2990ebf927b0476b7702731ad2979682"/><file name="config.xml" hash="912949d21b87ef038a0307aae8e12f92"/><file name="system.xml" hash="7d9ca6cae327ed02bebebaa54c686439"/></dir><dir name="sql"><dir name="iceimport_setup"><file name="mysql4-install-1.7.9.php" hash="e5b8e89aea9a674f0cd25718d5d62a1c"/><file name="mysql4-upgrade-0.1.0-1.7.0.php" hash="ff0682cde32b4f694bf1bed2c55a97f6"/><file name="mysql4-upgrade-1.4.0-1.7.0.php" hash="ff0682cde32b4f694bf1bed2c55a97f6"/><file name="mysql4-upgrade-1.5.0-1.7.0.php" hash="b51e20fdab764b90c6fd81551d9e368f"/><file name="mysql4-upgrade-1.6.0-1.7.0.php" hash="b51e20fdab764b90c6fd81551d9e368f"/><file name="mysql4-upgrade-1.6.0-1.7.5.php" hash="73e2587c366b1d3940d08e2a65dcc253"/><file name="mysql4-upgrade-1.7.5-1.7.9.php" hash="73e2587c366b1d3940d08e2a65dcc253"/><file name="mysql4-upgrade-1.7.6-1.7.9.php" hash="73e2587c366b1d3940d08e2a65dcc253"/><file name="uninstall-old-version.php" hash="4269e8547005958b044946d5e2d670e9"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="ICEshop_Iceimport.xml" hash="b94f339b79303bf7e78ba89290c66ada"/></dir></target></contents>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  <compatible/>
21
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
22
  </package>
skin/adminhtml/default/default/iceshop/iceimport/styles.css CHANGED
@@ -19,7 +19,7 @@
19
  #iceimport-warning .f-right a {
20
  color: #ffffff;
21
  font-weight: bold;
22
- text-decoration: none;
23
  }
24
 
25
  #iceimport-warning .f-right a:hover {
19
  #iceimport-warning .f-right a {
20
  color: #ffffff;
21
  font-weight: bold;
22
+ text-decoration: underline;
23
  }
24
 
25
  #iceimport-warning .f-right a:hover {