ice_import - Version 1.7.23

Version Notes

Bug fix:

- Add noticing
- Fix user permissions
- Renaming some attributes
- Add explanations
- Add new option 'run reindex'
- Added new option to change cron scheduled time
- Added new feature settings
- Added transactions

Download this release

Release Info

Developer IceShop
Extension ice_import
Version 1.7.23
Comparing to
See all releases


Code changes from version 1.7.15 to 1.7.23

Files changed (61) hide show
  1. app/code/community/ICEshop/Iceimport/Block/Adminhtml/Dashboard.php +106 -0
  2. app/code/community/ICEshop/Iceimport/Block/Adminhtml/Images/List/Grid.php +151 -150
  3. app/code/community/ICEshop/Iceimport/Block/Adminhtml/Notifications.php +192 -45
  4. app/code/community/ICEshop/Iceimport/Block/Adminhtml/System/Config/Form/Button.php +48 -48
  5. app/code/community/ICEshop/Iceimport/Block/Adminhtml/System/Config/Form/Exportall.php +48 -48
  6. app/code/community/ICEshop/Iceimport/Block/Adminhtml/System/Config/Form/Updatebutton.php +48 -48
  7. app/code/community/ICEshop/Iceimport/Helper/Data.php +131 -131
  8. app/code/community/ICEshop/Iceimport/Helper/Db.php +429 -429
  9. app/code/community/ICEshop/Iceimport/Helper/Format.php +250 -250
  10. app/code/community/ICEshop/Iceimport/Helper/System/System.php +461 -461
  11. app/code/community/ICEshop/Iceimport/Helper/System/Systemcheck.php +847 -781
  12. app/code/community/ICEshop/Iceimport/Model/Convert/Adapter/Product.php +568 -348
  13. app/code/community/ICEshop/Iceimport/Model/Dataflow/Batch/Import.php +53 -53
  14. app/code/community/ICEshop/Iceimport/Model/Dataflow/Convert/Adapter/Io.php +35 -0
  15. app/code/community/ICEshop/Iceimport/Model/Dataflow/Convert/Parser/Csv.php +239 -193
  16. app/code/community/ICEshop/Iceimport/Model/Observer.php +475 -439
  17. app/code/community/ICEshop/Iceimport/Model/System/Config/Checksystem.php +10 -10
  18. app/code/community/ICEshop/Iceimport/Model/System/Config/Defaulttax.php +19 -19
  19. app/code/community/ICEshop/Iceimport/Model/System/Config/Explanations.php +11 -0
  20. app/code/community/ICEshop/Iceimport/Model/System/Config/Fields/Attributes.php +84 -0
  21. app/code/community/ICEshop/Iceimport/Model/System/Config/Iceshoplink.php +10 -10
  22. app/code/community/ICEshop/Iceimport/Model/System/Config/Profiles.php +19 -0
  23. app/code/community/ICEshop/Iceimport/Model/System/Config/Stock.php +22 -0
  24. app/code/community/ICEshop/Iceimport/Model/System/Config/Websites.php +19 -0
  25. app/code/community/ICEshop/Iceimport/Model/System/Config/Yesno.php +15 -15
  26. app/code/community/ICEshop/Iceimport/controllers/Adminhtml/IceimagesController.php +16 -11
  27. app/code/community/ICEshop/Iceimport/controllers/Adminhtml/IceimportController.php +1482 -1181
  28. app/code/community/ICEshop/Iceimport/controllers/Adminhtml/IceimportimagesController.php +22 -17
  29. app/code/community/ICEshop/Iceimport/controllers/Adminhtml/System/Convert/GuiController.php +90 -0
  30. app/code/community/ICEshop/Iceimport/etc/adminhtml.xml +30 -30
  31. app/code/community/ICEshop/Iceimport/etc/config.xml +149 -143
  32. app/code/community/ICEshop/Iceimport/etc/system.xml +481 -372
  33. app/code/community/ICEshop/Iceimport/sql/iceimport_setup/{mysql4-install-1.7.15.php → mysql4-install-1.7.22.php} +79 -75
  34. app/code/community/ICEshop/Iceimport/sql/iceimport_setup/mysql4-upgrade-0.1.0-1.7.0.php +0 -69
  35. app/code/community/ICEshop/Iceimport/sql/iceimport_setup/mysql4-upgrade-1.4.0-1.7.0.php +0 -69
  36. app/code/community/ICEshop/Iceimport/sql/iceimport_setup/mysql4-upgrade-1.5.0-1.7.0.php +0 -67
  37. app/code/community/ICEshop/Iceimport/sql/iceimport_setup/mysql4-upgrade-1.6.0-1.7.0.php +0 -67
  38. app/code/community/ICEshop/Iceimport/sql/iceimport_setup/mysql4-upgrade-1.6.0-1.7.5.php +0 -87
  39. app/code/community/ICEshop/Iceimport/sql/iceimport_setup/mysql4-upgrade-1.7.14-1.7.15.php +0 -75
  40. app/code/community/ICEshop/Iceimport/sql/iceimport_setup/mysql4-upgrade-1.7.15-1.7.22.php +7 -0
  41. app/code/community/ICEshop/Iceimport/sql/iceimport_setup/mysql4-upgrade-1.7.16-1.7.22.php +7 -0
  42. app/code/community/ICEshop/Iceimport/sql/iceimport_setup/mysql4-upgrade-1.7.17-1.7.22.php +7 -0
  43. app/code/community/ICEshop/Iceimport/sql/iceimport_setup/mysql4-upgrade-1.7.18-1.7.22.php +7 -0
  44. app/code/community/ICEshop/Iceimport/sql/iceimport_setup/mysql4-upgrade-1.7.19-1.7.22.php +7 -0
  45. app/code/community/ICEshop/Iceimport/sql/iceimport_setup/mysql4-upgrade-1.7.20-1.7.22.php +7 -0
  46. app/code/community/ICEshop/Iceimport/sql/iceimport_setup/mysql4-upgrade-1.7.21-1.7.22.php +7 -0
  47. app/code/community/ICEshop/Iceimport/sql/iceimport_setup/mysql4-upgrade-1.7.5-1.7.9.php +0 -87
  48. app/code/community/ICEshop/Iceimport/sql/iceimport_setup/mysql4-upgrade-1.7.6-1.7.9.php +0 -87
  49. app/code/community/ICEshop/Iceimport/sql/iceimport_setup/mysql4-upgrade-1.7.8-1.7.22.php +9 -0
  50. app/code/community/ICEshop/Iceimport/sql/iceimport_setup/mysql4-upgrade-1.7.9-1.7.13 +0 -75
  51. app/code/community/ICEshop/Iceimport/sql/iceimport_setup/uninstall-old-version.php +0 -49
  52. app/code/community/ICEshop/Iceimport/sql/iceimport_setup/upgrade_run.php +11 -0
  53. app/design/adminhtml/default/default/layout/ICEshop_Iceimport.xml +40 -17
  54. app/design/adminhtml/default/default/template/iceshop/iceimport/dashboard.phtml +64 -0
  55. app/design/adminhtml/default/default/template/iceshop/iceimport/notifications.phtml +89 -20
  56. app/etc/modules/ICEshop_Iceimport.xml +9 -9
  57. js/ICEshop/Iceimport/dashboard.js +22 -0
  58. js/ICEshop/Iceimport/jquery-1.11.1.min.js +3 -3
  59. js/ICEshop/Iceimport/script.js +276 -246
  60. package.xml +15 -10
  61. skin/adminhtml/default/default/iceshop/iceimport/styles.css +156 -123
app/code/community/ICEshop/Iceimport/Block/Adminhtml/Dashboard.php ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class ICEshop_Iceimport_Block_Adminhtml_Dashboard extends Mage_Adminhtml_Block_Template
4
+ {
5
+ /**
6
+ * Get statistics for dashboard
7
+ * @return array
8
+ */
9
+ public function getStatistics()
10
+ {
11
+ $helper = Mage::helper('iceimport');
12
+ $db = Mage::helper('iceimport/db');
13
+ $checker = Mage::helper('iceimport/system_systemcheck')->init();
14
+
15
+ $table_name = $db->getTableName('dataflow_profile_history');
16
+
17
+ //get data
18
+ $last_started_by_cron = $db->getLogEntryByKey('iceimport_import_started');
19
+ $last_finished_by_cron = $db->getLogEntryByKey('iceimport_import_ended');
20
+ $import_status_cron = $db->getLogEntryByKey('iceimport_import_status_cron');
21
+ $last_imported_products_count = $db->getLogEntryByKey('iceimport_count_imported_products');
22
+ $import_filename = $db->getLogEntryByKey('import_filename');
23
+ $productivity = $checker->getModulePerformance($last_imported_products_count, $last_started_by_cron, $last_finished_by_cron);
24
+ $currently_imported_products = $db->getRowsCount($db->_prefix . "iceshop_iceimport_imported_product_ids");
25
+ $data_flows = $db->getRowCountByField($db->getTableName('dataflow_batch_import'), 'batch_id', false, ' ORDER BY 1 DESC LIMIT 50');
26
+
27
+ $last_run = $db->readQuery("SELECT `performed_at` FROM {$table_name} WHERE `profile_id` = 3 ORDER BY `performed_at` DESC LIMIT 1");
28
+ $last_deleted_products_count = $db->getLogEntryByKey('iceimport_count_delete_product');
29
+
30
+ if (!empty($currently_imported_products) && ($import_status_cron['log_value'] == 'Running' || $import_status_cron['log_value'] == 'Failed')) {
31
+ $additional = array(
32
+ 'label' => $helper->__("Currently products imported"),
33
+ 'value' => $currently_imported_products . ' from ' . $data_flows[0]['row_count']
34
+ );
35
+ }
36
+
37
+ //packing response
38
+ $response = array(
39
+ array(
40
+ 'label' => $helper->__('Started last time at'),
41
+ 'value' => (!empty($last_started_by_cron['log_value'])) ? $last_started_by_cron['log_value'] : $helper->__("Never started till now")
42
+ ),
43
+ array(
44
+ 'label' => $helper->__('Finished last time at'),
45
+ 'value' => (!empty($last_finished_by_cron['log_value'])) ? $last_finished_by_cron['log_value'] : $helper->__("Never finished till now"),
46
+ ),
47
+ array(
48
+ 'label' => $helper->__('Import cron process status'),
49
+ 'value' => (!empty($import_status_cron['log_value'])) ? $import_status_cron['log_value'] : $helper->__("Never started till now"),
50
+ ),
51
+ array(
52
+ 'label' => $helper->__('Products imported last time'),
53
+ 'value' => (!empty($last_imported_products_count['log_value'])) ? $last_imported_products_count['log_value'] : 0,
54
+ ),
55
+ array(
56
+ 'label' => $helper->__('Import file name'),
57
+ 'value' => (!empty($import_filename['log_value'])) ? $import_filename['log_value'] : $helper->__("Never started till now"),
58
+ )
59
+ );
60
+
61
+ if (!empty($additional))
62
+ $response[] = $additional;
63
+
64
+ return $response;
65
+ }
66
+
67
+ /**
68
+ * @return string
69
+ */
70
+ public function getProfiles($profileName = null)
71
+ {
72
+ $html = '';
73
+ $database_query = Mage::getSingleton('core/resource')->getConnection('core_write');
74
+ $db = Mage::helper('iceimport/db');
75
+ $tablePrefix = '';
76
+ $tPrefix = (array)Mage::getConfig()->getTablePrefix();
77
+ if (!empty($tPrefix)) {
78
+ $tablePrefix = $tPrefix[0];
79
+ }
80
+ $profiles = $database_query->fetchAll("SELECT `profile_id`, `name` FROM `{$tablePrefix}dataflow_profile`");
81
+ if (!empty($profiles)) {
82
+ $html .= '<select id="ice_export_profiles">';
83
+ foreach ($profiles as $profile) {
84
+ if ((!empty($profileName)) && ($profileName == $profile["name"])) {
85
+ $html .= '<option value="' . $profile["profile_id"] . '" selected = "true">' . $profile["name"] . "</option>";
86
+ } else {
87
+ $html .= '<option value="' . $profile["profile_id"] . '">' . $profile["name"] . "</option>";
88
+ }
89
+ }
90
+ $html .= '</select>';
91
+ }
92
+ return $html;
93
+
94
+ }
95
+
96
+ /**
97
+ * Get index management url
98
+ *
99
+ * @return string
100
+ */
101
+ public function getManageUrl()
102
+ {
103
+ return Mage::helper("adminhtml")->getUrl("*/system_config/edit", array('section' => 'iceshop_iceimport_importprod_root'));
104
+ }
105
+
106
+ }
app/code/community/ICEshop/Iceimport/Block/Adminhtml/Images/List/Grid.php CHANGED
@@ -1,151 +1,152 @@
1
- <?php
2
-
3
- class ICEshop_Iceimport_Block_Adminhtml_Images_List_Grid extends Mage_Adminhtml_Block_Widget_Grid
4
- {
5
- public function __construct()
6
- {
7
- parent::__construct();
8
- $this->setId('iceimportGrid');
9
- $this->setUseAjax(true);
10
- // $this->setVarNameFilter('iceimport_filter');
11
- // $this->setDefaultLimit($this->getCountImagesNotImport());
12
- // $this->setPagerVisibility(false);
13
- // $this->setFilterVisibility(false);
14
- // $this->setSaveParametersInSession(true);
15
- $this->_prepareCollection;
16
- }
17
-
18
- protected function _getStore()
19
- {
20
- $storeId = (int) $this->getRequest()->getParam('store', 0);
21
- return Mage::app()->getStore($storeId);
22
- }
23
-
24
- protected function _prepareCollection()
25
- {
26
-
27
- $store = $this->_getStore();
28
- $collection = Mage::getModel('catalog/product')->getCollection();
29
- $collection->addAttributeToSort('entity_id', 'DESC');
30
-
31
- $collection->getSelect()->joinLeft( array('pt'=> 'iceshop_iceimport_image_queue'),
32
- 'e.`entity_id` = pt.`entity_id`', array('*'))->where("pt.`is_downloaded`=2")->limit(20, 10);
33
-
34
- if($this->checkExistingAttribute('catalog_product', 'sku')){
35
- $collection->addAttributeToSelect('sku');
36
- }
37
-
38
- if ($store->getId()) {
39
- $adminStore = Mage_Core_Model_App::ADMIN_STORE_ID;
40
-
41
- if($this->checkExistingAttribute('catalog_product', 'mpn')){
42
- $collection->joinAttribute(
43
- 'mpn',
44
- 'catalog_product/mpn',
45
- 'entity_id',
46
- null,
47
- 'inner',
48
- $adminStore
49
- );
50
- }
51
- $collection->joinAttribute(
52
- 'image_url',
53
- 'iceshop_iceimport_image_queue/image_url',
54
- 'entity_id',
55
- null,
56
- 'inner',
57
- $store->getId()
58
- );
59
- }
60
- else {
61
- if($this->checkExistingAttribute('catalog_product', 'mpn')){
62
- $collection->joinAttribute('mpn', 'catalog_product/mpn', 'entity_id', null, 'inner');
63
- }
64
- }
65
-
66
- $this->setCollection($collection);
67
-
68
- parent::_prepareCollection();
69
- $this->getCollection()->addWebsiteNamesToResult();
70
- return $this;
71
-
72
- }
73
-
74
- public function checkExistingAttribute($group, $attribut){
75
- $eav = Mage::getModel('eav/config');
76
- $attribute = $eav->getAttribute($group, $attribut);
77
- return $attribute->getId();
78
- }
79
-
80
-
81
- protected function _prepareColumns()
82
- {
83
- if ($this->_isExport) {
84
- $this->setDefaultLimit($this->getCountImagesNotImport());
85
- }
86
- $this->addColumn('entity_id',
87
- array(
88
- 'header'=> Mage::helper('catalog')->__('ID'),
89
- 'width' => '50px',
90
- 'type' => 'number',
91
- 'index' => 'entity_id',
92
- ));
93
- $this->addColumn('image_url',
94
- array(
95
- 'header'=> Mage::helper('catalog')->__('Url'),
96
- 'index' => 'image_url',
97
- 'filter' => FALSE
98
- ));
99
-
100
- if($this->checkExistingAttribute('catalog_product', 'sku')){
101
- $this->addColumn('sku',
102
- array(
103
- 'header'=> Mage::helper('catalog')->__('SKU'),
104
- 'width' => '80px',
105
- 'index' => 'sku',
106
- ));
107
- }
108
-
109
- if($this->checkExistingAttribute('catalog_product', 'mpn')){
110
- $this->addColumn('mpn',
111
- array(
112
- 'header'=> Mage::helper('catalog')->__('Manufacturer product number'),
113
- 'width' => '80px',
114
- 'index' => 'mpn',
115
- ));
116
- }
117
- $this->addExportType('*/iceimport/exportIceimportimagesCsv', Mage::helper('iceimport')->__('CSV'));
118
- $this->addExportType('*/iceimport/exportIceimportimagesExcel', Mage::helper('iceimport')->__('Excel XML'));
119
-
120
- return parent::_prepareColumns();
121
- }
122
-
123
- public function getGridUrl()
124
- {
125
- return $this->getUrl('*/iceimport/grid', array('_current'=>true));
126
- }
127
-
128
- public function getRowUrl($row)
129
- {
130
- return $this->getUrl('*/catalog_product/edit', array(
131
- 'store'=>$this->getRequest()->getParam('store'),
132
- 'id'=>$row->getId())
133
- );
134
- }
135
-
136
- public function getCountImagesNotImport(){
137
- try{
138
- $db_res = Mage::getSingleton('core/resource')->getConnection('core_write');
139
- $tablePrefix = '';
140
- $tPrefix = (array)Mage::getConfig()->getTablePrefix();
141
- if (!empty($tPrefix)) {
142
- $tablePrefix = $tPrefix[0];
143
- }
144
- return $return_resulr = $db_res->fetchOne("SELECT COUNT(*) FROM `{$tablePrefix}iceshop_iceimport_image_queue`
145
- WHERE `is_downloaded` = 2");
146
-
147
- } catch (Exception $e){
148
- }
149
- }
150
-
 
151
  }
1
+ <?php
2
+
3
+ class ICEshop_Iceimport_Block_Adminhtml_Images_List_Grid extends Mage_Adminhtml_Block_Widget_Grid
4
+ {
5
+ public function __construct()
6
+ {
7
+ parent::__construct();
8
+ $this->setId('iceimportGrid');
9
+ $this->setUseAjax(true);
10
+ // $this->setVarNameFilter('iceimport_filter');
11
+ // $this->setDefaultLimit($this->getCountImagesNotImport());
12
+ // $this->setPagerVisibility(false);
13
+ // $this->setFilterVisibility(false);
14
+ // $this->setSaveParametersInSession(true);
15
+ $this->_prepareCollection;
16
+ }
17
+
18
+ protected function _getStore()
19
+ {
20
+ $storeId = (int) $this->getRequest()->getParam('store', 0);
21
+ return Mage::app()->getStore($storeId);
22
+ }
23
+
24
+ protected function _prepareCollection()
25
+ {
26
+
27
+ $store = $this->_getStore();
28
+ $collection = Mage::getModel('catalog/product')->getCollection();
29
+ $collection->addAttributeToSort('entity_id', 'DESC');
30
+
31
+ $prefix = Mage::getConfig()->getTablePrefix();
32
+ $collection->getSelect()->joinLeft( array('pt'=> $prefix.'iceshop_iceimport_image_queue'),
33
+ 'e.`entity_id` = pt.`entity_id`', array('*'))->where("pt.`is_downloaded`=2")->limit(20, 10);
34
+
35
+ if($this->checkExistingAttribute('catalog_product', 'sku')){
36
+ $collection->addAttributeToSelect('sku');
37
+ }
38
+
39
+ if ($store->getId()) {
40
+ $adminStore = Mage_Core_Model_App::ADMIN_STORE_ID;
41
+
42
+ if($this->checkExistingAttribute('catalog_product', 'mpn')){
43
+ $collection->joinAttribute(
44
+ 'mpn',
45
+ 'catalog_product/mpn',
46
+ 'entity_id',
47
+ null,
48
+ 'inner',
49
+ $adminStore
50
+ );
51
+ }
52
+ $collection->joinAttribute(
53
+ 'image_url',
54
+ 'iceshop_iceimport_image_queue/image_url',
55
+ 'entity_id',
56
+ null,
57
+ 'inner',
58
+ $store->getId()
59
+ );
60
+ }
61
+ else {
62
+ if($this->checkExistingAttribute('catalog_product', 'mpn')){
63
+ $collection->joinAttribute('mpn', 'catalog_product/mpn', 'entity_id', null, 'inner');
64
+ }
65
+ }
66
+
67
+ $this->setCollection($collection);
68
+
69
+ parent::_prepareCollection();
70
+ $this->getCollection()->addWebsiteNamesToResult();
71
+ return $this;
72
+
73
+ }
74
+
75
+ public function checkExistingAttribute($group, $attribut){
76
+ $eav = Mage::getModel('eav/config');
77
+ $attribute = $eav->getAttribute($group, $attribut);
78
+ return $attribute->getId();
79
+ }
80
+
81
+
82
+ protected function _prepareColumns()
83
+ {
84
+ if ($this->_isExport) {
85
+ $this->setDefaultLimit($this->getCountImagesNotImport());
86
+ }
87
+ $this->addColumn('entity_id',
88
+ array(
89
+ 'header'=> Mage::helper('catalog')->__('ID'),
90
+ 'width' => '50px',
91
+ 'type' => 'number',
92
+ 'index' => 'entity_id',
93
+ ));
94
+ $this->addColumn('image_url',
95
+ array(
96
+ 'header'=> Mage::helper('catalog')->__('Url'),
97
+ 'index' => 'image_url',
98
+ 'filter' => FALSE
99
+ ));
100
+
101
+ if($this->checkExistingAttribute('catalog_product', 'sku')){
102
+ $this->addColumn('sku',
103
+ array(
104
+ 'header'=> Mage::helper('catalog')->__('SKU'),
105
+ 'width' => '80px',
106
+ 'index' => 'sku',
107
+ ));
108
+ }
109
+
110
+ if($this->checkExistingAttribute('catalog_product', 'mpn')){
111
+ $this->addColumn('mpn',
112
+ array(
113
+ 'header'=> Mage::helper('catalog')->__('Manufacturer product number'),
114
+ 'width' => '80px',
115
+ 'index' => 'mpn',
116
+ ));
117
+ }
118
+ $this->addExportType('*/iceimport/exportIceimportimagesCsv', Mage::helper('iceimport')->__('CSV'));
119
+ $this->addExportType('*/iceimport/exportIceimportimagesExcel', Mage::helper('iceimport')->__('Excel XML'));
120
+
121
+ return parent::_prepareColumns();
122
+ }
123
+
124
+ public function getGridUrl()
125
+ {
126
+ return $this->getUrl('*/iceimport/grid', array('_current'=>true));
127
+ }
128
+
129
+ public function getRowUrl($row)
130
+ {
131
+ return $this->getUrl('*/catalog_product/edit', array(
132
+ 'store'=>$this->getRequest()->getParam('store'),
133
+ 'id'=>$row->getId())
134
+ );
135
+ }
136
+
137
+ public function getCountImagesNotImport(){
138
+ try{
139
+ $db_res = Mage::getSingleton('core/resource')->getConnection('core_write');
140
+ $tablePrefix = '';
141
+ $tPrefix = (array)Mage::getConfig()->getTablePrefix();
142
+ if (!empty($tPrefix)) {
143
+ $tablePrefix = $tPrefix[0];
144
+ }
145
+ return $return_resulr = $db_res->fetchOne("SELECT COUNT(*) FROM `{$tablePrefix}iceshop_iceimport_image_queue`
146
+ WHERE `is_downloaded` = 2");
147
+
148
+ } catch (Exception $e){
149
+ }
150
+ }
151
+
152
  }
app/code/community/ICEshop/Iceimport/Block/Adminhtml/Notifications.php CHANGED
@@ -1,45 +1,192 @@
1
- <?php
2
-
3
- /**
4
- * Class ICEshop_Iceimport_Block_Adminhtml_Notifications
5
- */
6
- class ICEshop_Iceimport_Block_Adminhtml_Notifications extends Mage_Adminhtml_Block_Template
7
- {
8
- /**
9
- * @return array|string
10
- */
11
- public function getIceimportProblemsDigest()
12
- {
13
- $checker = Mage::helper('iceimport/system_systemcheck')->init();
14
- $problems_digest = $checker->getExtensionProblemsDigest();
15
- $response = array();
16
- if($checker->checkSetWarning()){
17
- if ($problems_digest->getCount() != 0) {
18
- $problems = $problems_digest->getProblems();
19
- foreach ($problems as $problem_name => $problem_value) {
20
- $response[] = array($problem_name => $problem_value);
21
- }
22
- }
23
- }
24
- return $response;
25
- }
26
-
27
- /**
28
- * Get index management url
29
- *
30
- * @return string
31
- */
32
- public function getManageUrl()
33
- {
34
- return Mage::helper("adminhtml")->getUrl("*/system_config/edit", array('section' => 'iceimport_information'));
35
- }
36
-
37
- /**
38
- * Check is notification available to current user
39
- * @return bool
40
- */
41
- public function isAllowed()
42
- {
43
- return Mage::getSingleton('admin/session')->isAllowed('system/config/iceshop_iceimport_importprod_root');
44
- }
45
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class ICEshop_Iceimport_Block_Adminhtml_Notifications
5
+ */
6
+ class ICEshop_Iceimport_Block_Adminhtml_Notifications extends Mage_Adminhtml_Block_Template
7
+ {
8
+ /**
9
+ * @return array|string
10
+ */
11
+ public function getIceimportProblemsDigest()
12
+ {
13
+ $checker = Mage::helper('iceimport/system_systemcheck')->init();
14
+ $problems_digest = $checker->getExtensionProblemsDigest();
15
+ $response = array();
16
+ if($checker->checkSetWarning()){
17
+ if ($problems_digest->getCount() != 0) {
18
+ $problems = $problems_digest->getProblems();
19
+ foreach ($problems as $problem_name => $problem_value) {
20
+ $response[] = array($problem_name => $problem_value);
21
+ }
22
+ }
23
+ }
24
+ return $response;
25
+ }
26
+
27
+ /**
28
+ * Get index management url
29
+ *
30
+ * @return string
31
+ */
32
+ public function getManageUrl()
33
+ {
34
+ return Mage::helper("adminhtml")->getUrl("*/system_config/edit", array('section' => 'iceimport_information'));
35
+ }
36
+
37
+ /**
38
+ * Get index management url
39
+ *
40
+ * @return string
41
+ */
42
+ public function getSettingsPage()
43
+ {
44
+ return Mage::helper("adminhtml")->getUrl("*/system_config/edit", array('section' => 'iceshop_iceimport_importprod_root'));
45
+ }
46
+
47
+ /**
48
+ * Check is notification available to current user
49
+ * @return bool
50
+ */
51
+ public function isAllowed()
52
+ {
53
+ return Mage::getSingleton('admin/session')->isAllowed('system/config/iceshop_iceimport_importprod_root');
54
+ }
55
+
56
+ /*
57
+ * Check last import date
58
+ * @return bool
59
+ */
60
+ public function checkLastFinishedImport(){
61
+
62
+ $message_1 = 'The import of your assortment via Iceimport did not start. Is something changed in the configuration? See the dashboard for more information. Please contact our support team at supportdesk@iceshop.nl';
63
+ $message_2 = 'Iceimport started but did not yet finished or failed. Is something changed with your shop? See the dashboard for more information. Please contact our support team at supportdesk@iceshop.nl';
64
+
65
+ $warningTime = 60*60*30; // 30 hours
66
+ $timezoneLocal = Mage::app()->getStore()->getConfig(Mage_Core_Model_Locale::XML_PATH_DEFAULT_TIMEZONE);
67
+ $db = Mage::helper('iceimport/db');
68
+ $last_started_timestamp = $db->getLogEntryByKey('iceimport_import_started');
69
+ $last_finished_timestamp = $db->getLogEntryByKey('iceimport_import_ended');
70
+
71
+ //get only time if this isset
72
+ $last_started_timestamp = ((isset($last_started_timestamp['log_value']))&&($last_started_timestamp['log_value'] != ''))?$last_started_timestamp['log_value']:'';
73
+ $last_finished_timestamp = ((isset($last_finished_timestamp['log_value']))&&($last_finished_timestamp['log_value'] != ''))?$last_finished_timestamp['log_value']:'';
74
+ $currentDateTime = Mage::getModel('core/date')->timestamp(time());
75
+ //case 1
76
+ if(($last_started_timestamp != '') && ($last_finished_timestamp == '')){
77
+ $start_time_ice = $this->parseCustomDate($last_started_timestamp);
78
+ if($start_time_ice){
79
+ if(($currentDateTime-$start_time_ice)>$warningTime){
80
+ return $message_1;
81
+ }
82
+ }
83
+ }
84
+ //case 2
85
+ if(($last_started_timestamp != '') && ($last_finished_timestamp != '')){
86
+ $finish_time_ice = $this->parseCustomDate($last_finished_timestamp);
87
+ if($finish_time_ice){
88
+ if(($currentDateTime-$finish_time_ice)>$warningTime){
89
+ return $message_2;
90
+ }
91
+ }
92
+ }
93
+ return false;
94
+ }
95
+
96
+ public function parseCustomDate($date){
97
+ if(($date != '') && ($date != null) && ($date != false)) {
98
+ //we first explode string to date and time and after expolde to year month date and hour minute seconds
99
+ $date = explode(' ',$date);
100
+ if(isset($date[0])){
101
+ $date['date'] = explode('/',$date[0]);
102
+ unset($date[0]);
103
+ }
104
+ if(isset($date[1])){
105
+ $date['time'] = explode(':',$date[1]);
106
+ unset($date[1]);
107
+ }
108
+ //check if all exists and in need out quantity
109
+ if((isset($date['time'])) && (isset($date['date'])) && (count($date['time']) == 3) && (count($date['date']) == 3)){
110
+ $unix_timestamp = mktime($date['time'][0],$date['time'][1], $date['time'][2],$date['date'][0], $date['date'][1], $date['date'][2]);
111
+ return $unix_timestamp;
112
+ }
113
+ return false;
114
+ }
115
+ return false;
116
+ }
117
+
118
+ /**
119
+ * Check warning flag
120
+ * @return bool
121
+ */
122
+ public function checkWarning()
123
+ {
124
+ $message = 'At last import was attempt to delete more old products than allowed in Iceimport configuration, please go to configuration page and check the parameter (Tolerance of difference (%)).';
125
+ $db = Mage::helper('iceimport/db');
126
+ $log_record = $db->getLogEntryByKey('try_delete_product_percentage_warning_flag');
127
+ if ((!empty($log_record)) && ($log_record['log_value'] == 'SHOW')) {
128
+ return $message;
129
+ }
130
+ return false;
131
+ }
132
+
133
+ /**
134
+ * Check first launch of admin panel after install/reinstall module
135
+ * @return bool|string
136
+ */
137
+ public function firstLaunch()
138
+ {
139
+ $message = 'We detected that its your first launch of admin panel after install/reinstall ICEImport module. For this reason we recommend you check settings of module (Attributes mapping etc.)';
140
+ $db = Mage::helper('iceimport/db');
141
+ $log_record = $db->getLogEntryByKey('first_start');
142
+ if ((!empty($log_record)) && ($log_record['log_value'] == 'yes')) {
143
+ $accept = Mage::app()->getRequest()->getParam('accept');
144
+ $section = Mage::app()->getRequest()->getParam('section');
145
+ if (($accept == 1) && ($section == 'iceshop_iceimport_importprod_root')) {
146
+ $db->deleteLogEntry('first_start');
147
+ return false;
148
+ } else {
149
+ return $message;
150
+ }
151
+ } else {
152
+ return false;
153
+ }
154
+ }
155
+
156
+ /**
157
+ * Get settings page with parameter accept
158
+ *
159
+ * @return string
160
+ */
161
+ public function getSettingsPageWithAccepting()
162
+ {
163
+ return Mage::helper("adminhtml")->getUrl("*/system_config/edit", array('section' => 'iceshop_iceimport_importprod_root', 'accept' => true));
164
+ }
165
+
166
+ /**
167
+ * Check of attribute mapping
168
+ * @return bool|string
169
+ */
170
+ public function checkSetMapping()
171
+ {
172
+ $message = "The Iceimport extensions doesn't work properly, please go to configuration page and check settings which not set.";
173
+
174
+ $checks = array(
175
+ 'iceshop_iceimport_importprod_root/importprod/attribute_mapping_mpn',
176
+ 'iceshop_iceimport_importprod_root/importprod/attribute_mapping_brand_name',
177
+ 'iceshop_iceimport_importprod_root/importprod/attribute_mapping_ean',
178
+ );
179
+
180
+ $resource = Mage::getSingleton('core/resource');
181
+ $tableName = $resource->getTableName('core_config_data');
182
+ $readConnection = $resource->getConnection('core_read');
183
+ foreach ($checks as $check) {
184
+ $query = 'SELECT * FROM ' . $tableName . ' WHERE path = "' . $check . '"';
185
+ $results = $readConnection->fetchAll($query);
186
+ if (empty($results)) {
187
+ return $message;
188
+ }
189
+ }
190
+ return false;
191
+ }
192
+ }
app/code/community/ICEshop/Iceimport/Block/Adminhtml/System/Config/Form/Button.php CHANGED
@@ -1,49 +1,49 @@
1
- <?php
2
- class Iceshop_Iceimport_Block_Adminhtml_System_Config_Form_Button extends Mage_Adminhtml_Block_System_Config_Form_Field
3
- {
4
- /*
5
- * Set templated
6
- */
7
- protected function _construct()
8
- {
9
- parent::_construct();
10
- }
11
-
12
- /**
13
- * Return element html
14
- *
15
- * @param Varien_Data_Form_Element_Abstract $element
16
- * @return string
17
- */
18
- protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
19
- {
20
- return $this->_toHtml();
21
- }
22
-
23
- /**
24
- * Return ajax url for button
25
- *
26
- * @return string
27
- */
28
- public function getAjaxCheckUrl()
29
- {
30
- return Mage::helper('adminhtml')->getUrl('adminhtml/iceimportimages/check/');
31
- }
32
-
33
- /**
34
- * Generate button html
35
- *
36
- * @return string
37
- */
38
- public function getButtonHtml()
39
- {
40
- $prod_button = $this->getLayout()->createBlock('adminhtml/widget_button')
41
- ->setData(array(
42
- 'id' => 'iceimport_images_button',
43
- 'label' => $this->helper('adminhtml')->__('Import images'),
44
- 'onclick' => 'javascript:import_prod_images(1,0); return false;'
45
- ));
46
- $buttons = $prod_button->toHtml();
47
- return $buttons;
48
- }
49
  }
1
+ <?php
2
+ class Iceshop_Iceimport_Block_Adminhtml_System_Config_Form_Button extends Mage_Adminhtml_Block_System_Config_Form_Field
3
+ {
4
+ /*
5
+ * Set templated
6
+ */
7
+ protected function _construct()
8
+ {
9
+ parent::_construct();
10
+ }
11
+
12
+ /**
13
+ * Return element html
14
+ *
15
+ * @param Varien_Data_Form_Element_Abstract $element
16
+ * @return string
17
+ */
18
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
19
+ {
20
+ return $this->_toHtml();
21
+ }
22
+
23
+ /**
24
+ * Return ajax url for button
25
+ *
26
+ * @return string
27
+ */
28
+ public function getAjaxCheckUrl()
29
+ {
30
+ return Mage::helper('adminhtml')->getUrl('adminhtml/iceimportimages/check/');
31
+ }
32
+
33
+ /**
34
+ * Generate button html
35
+ *
36
+ * @return string
37
+ */
38
+ public function getButtonHtml()
39
+ {
40
+ $prod_button = $this->getLayout()->createBlock('adminhtml/widget_button')
41
+ ->setData(array(
42
+ 'id' => 'iceimport_images_button',
43
+ 'label' => $this->helper('adminhtml')->__('Import images'),
44
+ 'onclick' => 'javascript:import_prod_images(1,0); return false;'
45
+ ));
46
+ $buttons = $prod_button->toHtml();
47
+ return $buttons;
48
+ }
49
  }
app/code/community/ICEshop/Iceimport/Block/Adminhtml/System/Config/Form/Exportall.php CHANGED
@@ -1,49 +1,49 @@
1
- <?php
2
- class Iceshop_Iceimport_Block_Adminhtml_System_Config_Form_Exportall extends Mage_Adminhtml_Block_System_Config_Form_Field
3
- {
4
- /*
5
- * Set templated
6
- */
7
- protected function _construct()
8
- {
9
- parent::_construct();
10
- }
11
-
12
- /**
13
- * Return element html
14
- *
15
- * @param Varien_Data_Form_Element_Abstract $element
16
- * @return string
17
- */
18
- protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
19
- {
20
- return $this->_toHtml();
21
- }
22
-
23
- /**
24
- * Return ajax url for button
25
- *
26
- * @return string
27
- */
28
- public function getAjaxCheckUrl()
29
- {
30
- return Mage::helper('adminhtml')->getUrl('adminhtml/iceimport/exportIceimportimagesCsvAll/');
31
- }
32
-
33
- /**
34
- * Generate button html
35
- *
36
- * @return string
37
- */
38
- public function getButtonHtml()
39
- {
40
- $prod_button = $this->getLayout()->createBlock('adminhtml/widget_button')
41
- ->setData(array(
42
- 'id' => 'iceimport_exportall_button',
43
- 'label' => $this->helper('adminhtml')->__('Export All to CSV'),
44
- 'onclick' => "setLocation('" . $this->getUrl('adminhtml/iceimport/exportIceimportimagesCsvAll/') . "')"
45
- ));
46
- $buttons = $prod_button->toHtml();
47
- return $buttons;
48
- }
49
  }
1
+ <?php
2
+ class Iceshop_Iceimport_Block_Adminhtml_System_Config_Form_Exportall extends Mage_Adminhtml_Block_System_Config_Form_Field
3
+ {
4
+ /*
5
+ * Set templated
6
+ */
7
+ protected function _construct()
8
+ {
9
+ parent::_construct();
10
+ }
11
+
12
+ /**
13
+ * Return element html
14
+ *
15
+ * @param Varien_Data_Form_Element_Abstract $element
16
+ * @return string
17
+ */
18
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
19
+ {
20
+ return $this->_toHtml();
21
+ }
22
+
23
+ /**
24
+ * Return ajax url for button
25
+ *
26
+ * @return string
27
+ */
28
+ public function getAjaxCheckUrl()
29
+ {
30
+ return Mage::helper('adminhtml')->getUrl('adminhtml/iceimport/exportIceimportimagesCsvAll/');
31
+ }
32
+
33
+ /**
34
+ * Generate button html
35
+ *
36
+ * @return string
37
+ */
38
+ public function getButtonHtml()
39
+ {
40
+ $prod_button = $this->getLayout()->createBlock('adminhtml/widget_button')
41
+ ->setData(array(
42
+ 'id' => 'iceimport_exportall_button',
43
+ 'label' => $this->helper('adminhtml')->__('Export All to CSV'),
44
+ 'onclick' => "setLocation('" . $this->getUrl('adminhtml/iceimport/exportIceimportimagesCsvAll/') . "')"
45
+ ));
46
+ $buttons = $prod_button->toHtml();
47
+ return $buttons;
48
+ }
49
  }
app/code/community/ICEshop/Iceimport/Block/Adminhtml/System/Config/Form/Updatebutton.php CHANGED
@@ -1,49 +1,49 @@
1
- <?php
2
- class Iceshop_Iceimport_Block_Adminhtml_System_Config_Form_Updatebutton extends Mage_Adminhtml_Block_System_Config_Form_Field
3
- {
4
- /*
5
- * Set templated
6
- */
7
- protected function _construct()
8
- {
9
- parent::_construct();
10
- }
11
-
12
- /**
13
- * Return element html
14
- *
15
- * @param Varien_Data_Form_Element_Abstract $element
16
- * @return string
17
- */
18
- protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
19
- {
20
- return $this->_toHtml();
21
- }
22
-
23
- /**
24
- * Return ajax url for button
25
- *
26
- * @return string
27
- */
28
- public function getAjaxCheckUrl()
29
- {
30
- return Mage::helper('adminhtml')->getUrl('adminhtml/iceimportimages/check/');
31
- }
32
-
33
- /**
34
- * Generate button html
35
- *
36
- * @return string
37
- */
38
- public function getButtonHtml()
39
- {
40
- $prod_button = $this->getLayout()->createBlock('adminhtml/widget_button')
41
- ->setData(array(
42
- 'id' => 'iceimport_images_button',
43
- 'label' => $this->helper('adminhtml')->__('Try again'),
44
- 'onclick' => 'javascript:import_prod_images(1,1); return false;'
45
- ));
46
- $buttons = $prod_button->toHtml();
47
- return $buttons;
48
- }
49
  }
1
+ <?php
2
+ class Iceshop_Iceimport_Block_Adminhtml_System_Config_Form_Updatebutton extends Mage_Adminhtml_Block_System_Config_Form_Field
3
+ {
4
+ /*
5
+ * Set templated
6
+ */
7
+ protected function _construct()
8
+ {
9
+ parent::_construct();
10
+ }
11
+
12
+ /**
13
+ * Return element html
14
+ *
15
+ * @param Varien_Data_Form_Element_Abstract $element
16
+ * @return string
17
+ */
18
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
19
+ {
20
+ return $this->_toHtml();
21
+ }
22
+
23
+ /**
24
+ * Return ajax url for button
25
+ *
26
+ * @return string
27
+ */
28
+ public function getAjaxCheckUrl()
29
+ {
30
+ return Mage::helper('adminhtml')->getUrl('adminhtml/iceimportimages/check/');
31
+ }
32
+
33
+ /**
34
+ * Generate button html
35
+ *
36
+ * @return string
37
+ */
38
+ public function getButtonHtml()
39
+ {
40
+ $prod_button = $this->getLayout()->createBlock('adminhtml/widget_button')
41
+ ->setData(array(
42
+ 'id' => 'iceimport_images_button',
43
+ 'label' => $this->helper('adminhtml')->__('Try again'),
44
+ 'onclick' => 'javascript:import_prod_images(1,1); return false;'
45
+ ));
46
+ $buttons = $prod_button->toHtml();
47
+ return $buttons;
48
+ }
49
  }
app/code/community/ICEshop/Iceimport/Helper/Data.php CHANGED
@@ -1,132 +1,132 @@
1
- <?php
2
-
3
- class ICEshop_Iceimport_Helper_Data extends Mage_Core_Helper_Abstract
4
- {
5
-
6
- /**
7
- * @param $extension_name
8
- * @return bool
9
- */
10
- public function isExtensionInstalled($extension_name)
11
- {
12
- if (!empty($extension_name)) {
13
- $modules = Mage::getConfig()->getNode('modules')->children();
14
- $modules = (array)$modules;
15
- if (array_key_exists($extension_name, (array)$modules)) {
16
- return true;
17
- }
18
- }
19
- return false;
20
- }
21
-
22
-
23
- /**
24
- * @param bool $json_encoded
25
- * @return array|string
26
- */
27
- public function getSystemInfo($json_encoded = false)
28
- {
29
- $results = array();
30
- try {
31
- $checker = Mage::helper('iceimport/system_systemcheck')->init();
32
- if (!empty($checker)) {
33
- $results['server'] = $checker->getSystem()->getServer()->getData();
34
- //$results['system'] = $checker->getSystem()->getMagento()->getData();
35
- //$results['php'] = $checker->getSystem()->getPhp()->getData();
36
- //$results['mysql'] = $checker->getSystem()->getMysql()->getData();
37
- //$results['requirements'] = $checker->getSystem()->getRequirements()->getData();
38
- }
39
- } catch (Exception $e) {
40
- }
41
-
42
- if ($json_encoded == true) {
43
- return json_encode($results);
44
- }
45
- return $results;
46
- }
47
-
48
- protected function _getButtonSettings($settings)
49
- {
50
- $default_settings = array(
51
- 'getBeforeHtml' => '',
52
- 'getId' => '',
53
- 'getElementName' => '',
54
- 'getTitle' => '',
55
- 'getType' => '',
56
- 'getClass' => '',
57
- 'getOnClick' => '',
58
- 'getStyle' => '',
59
- 'getValue' => '',
60
- 'getDisabled' => '',
61
- 'getLabel' => '',
62
- 'getAfterHtml' => ''
63
- );
64
- if (!empty($settings) && is_array($settings)) {
65
- foreach ($settings as $key => $setting) {
66
- $camel_key = str_replace(' ', '', ucwords(str_replace('_', ' ', $key)));
67
- $default_settings['get' . $camel_key] = $setting;
68
- }
69
- }
70
- return $default_settings;
71
- }
72
-
73
- /**
74
- * @param $settings
75
- * @return string
76
- */
77
- public function getButtonHtml($settings)
78
- {
79
- $settings = $this->_getButtonSettings($settings);
80
- $html = $settings['getBeforeHtml'] . '<button '
81
- . ($settings['getId'] ? ' id="' . $settings['getId'] . '"' : '')
82
- . ($settings['getElementName'] ? ' name="' . $settings['getElementName'] . '"' : '')
83
- . ' title="'
84
- . htmlspecialchars($settings['getTitle'] ? $settings['getTitle'] : $settings['getLabel'], ENT_QUOTES, null, false)
85
- . '"'
86
- . ' type="' . $settings['getType'] . '"'
87
- . ' class="scalable ' . $settings['getClass'] . ($settings['getDisabled'] ? ' disabled' : '') . '"'
88
- . ' onclick="' . $settings['getOnClick'] . '"'
89
- . ' style="' . $settings['getStyle'] . '"'
90
- . ($settings['getValue'] ? ' value="' . $settings['getValue'] . '"' : '')
91
- . ($settings['getDisabled'] ? ' disabled="disabled"' : '')
92
- . '><span><span><span>' . $settings['getLabel'] . '</span></span></span></button>' . $settings['getAfterHtml'];
93
-
94
- return $html;
95
- }
96
-
97
- /**
98
- * Sorts a multi-dimensional array with the given values
99
- *
100
- * Seen and modified from: http://www.firsttube.com/read/sorting-a-multi-dimensional-array-with-php/
101
- *
102
- * @param array $arr Array to sort
103
- * @param string $key Field to sort
104
- * @param string $dir Direction to sort
105
- * @return array Sorted array
106
- */
107
- public function sortMultiDimArr($arr, $key, $dir = 'ASC')
108
- {
109
- foreach ($arr as $k => $v) {
110
- $b[$k] = strtolower($v[$key]);
111
- }
112
-
113
- if ($dir == 'ASC') {
114
- asort($b);
115
- } else {
116
- arsort($b);
117
- }
118
- foreach ($b as $key => $val) {
119
- $c[] = $arr[$key];
120
- }
121
-
122
- return $c;
123
- }
124
-
125
- public function toCamelCase($str, $capitalise_first_char = false) {
126
- if($capitalise_first_char) {
127
- $str[0] = strtoupper($str[0]);
128
- }
129
- $func = create_function('$c', 'return strtoupper($c[1]);');
130
- return preg_replace_callback('/_([a-z])/', $func, $str);
131
- }
132
  }
1
+ <?php
2
+
3
+ class ICEshop_Iceimport_Helper_Data extends Mage_Core_Helper_Abstract
4
+ {
5
+
6
+ /**
7
+ * @param $extension_name
8
+ * @return bool
9
+ */
10
+ public function isExtensionInstalled($extension_name)
11
+ {
12
+ if (!empty($extension_name)) {
13
+ $modules = Mage::getConfig()->getNode('modules')->children();
14
+ $modules = (array)$modules;
15
+ if (array_key_exists($extension_name, (array)$modules)) {
16
+ return true;
17
+ }
18
+ }
19
+ return false;
20
+ }
21
+
22
+
23
+ /**
24
+ * @param bool $json_encoded
25
+ * @return array|string
26
+ */
27
+ public function getSystemInfo($json_encoded = false)
28
+ {
29
+ $results = array();
30
+ try {
31
+ $checker = Mage::helper('iceimport/system_systemcheck')->init();
32
+ if (!empty($checker)) {
33
+ $results['server'] = $checker->getSystem()->getServer()->getData();
34
+ //$results['system'] = $checker->getSystem()->getMagento()->getData();
35
+ //$results['php'] = $checker->getSystem()->getPhp()->getData();
36
+ //$results['mysql'] = $checker->getSystem()->getMysql()->getData();
37
+ //$results['requirements'] = $checker->getSystem()->getRequirements()->getData();
38
+ }
39
+ } catch (Exception $e) {
40
+ }
41
+
42
+ if ($json_encoded == true) {
43
+ return json_encode($results);
44
+ }
45
+ return $results;
46
+ }
47
+
48
+ protected function _getButtonSettings($settings)
49
+ {
50
+ $default_settings = array(
51
+ 'getBeforeHtml' => '',
52
+ 'getId' => '',
53
+ 'getElementName' => '',
54
+ 'getTitle' => '',
55
+ 'getType' => '',
56
+ 'getClass' => '',
57
+ 'getOnClick' => '',
58
+ 'getStyle' => '',
59
+ 'getValue' => '',
60
+ 'getDisabled' => '',
61
+ 'getLabel' => '',
62
+ 'getAfterHtml' => ''
63
+ );
64
+ if (!empty($settings) && is_array($settings)) {
65
+ foreach ($settings as $key => $setting) {
66
+ $camel_key = str_replace(' ', '', ucwords(str_replace('_', ' ', $key)));
67
+ $default_settings['get' . $camel_key] = $setting;
68
+ }
69
+ }
70
+ return $default_settings;
71
+ }
72
+
73
+ /**
74
+ * @param $settings
75
+ * @return string
76
+ */
77
+ public function getButtonHtml($settings)
78
+ {
79
+ $settings = $this->_getButtonSettings($settings);
80
+ $html = $settings['getBeforeHtml'] . '<button '
81
+ . ($settings['getId'] ? ' id="' . $settings['getId'] . '"' : '')
82
+ . ($settings['getElementName'] ? ' name="' . $settings['getElementName'] . '"' : '')
83
+ . ' title="'
84
+ . htmlspecialchars($settings['getTitle'] ? $settings['getTitle'] : $settings['getLabel'], ENT_QUOTES, null, false)
85
+ . '"'
86
+ . ' type="' . $settings['getType'] . '"'
87
+ . ' class="scalable ' . $settings['getClass'] . ($settings['getDisabled'] ? ' disabled' : '') . '"'
88
+ . ' onclick="' . $settings['getOnClick'] . '"'
89
+ . ' style="' . $settings['getStyle'] . '"'
90
+ . ($settings['getValue'] ? ' value="' . $settings['getValue'] . '"' : '')
91
+ . ($settings['getDisabled'] ? ' disabled="disabled"' : '')
92
+ . '><span><span><span>' . $settings['getLabel'] . '</span></span></span></button>' . $settings['getAfterHtml'];
93
+
94
+ return $html;
95
+ }
96
+
97
+ /**
98
+ * Sorts a multi-dimensional array with the given values
99
+ *
100
+ * Seen and modified from: http://www.firsttube.com/read/sorting-a-multi-dimensional-array-with-php/
101
+ *
102
+ * @param array $arr Array to sort
103
+ * @param string $key Field to sort
104
+ * @param string $dir Direction to sort
105
+ * @return array Sorted array
106
+ */
107
+ public function sortMultiDimArr($arr, $key, $dir = 'ASC')
108
+ {
109
+ foreach ($arr as $k => $v) {
110
+ $b[$k] = strtolower($v[$key]);
111
+ }
112
+
113
+ if ($dir == 'ASC') {
114
+ asort($b);
115
+ } else {
116
+ arsort($b);
117
+ }
118
+ foreach ($b as $key => $val) {
119
+ $c[] = $arr[$key];
120
+ }
121
+
122
+ return $c;
123
+ }
124
+
125
+ public function toCamelCase($str, $capitalise_first_char = false) {
126
+ if($capitalise_first_char) {
127
+ $str[0] = strtoupper($str[0]);
128
+ }
129
+ $func = create_function('$c', 'return strtoupper($c[1]);');
130
+ return preg_replace_callback('/_([a-z])/', $func, $str);
131
+ }
132
  }
app/code/community/ICEshop/Iceimport/Helper/Db.php CHANGED
@@ -1,430 +1,430 @@
1
- <?php
2
-
3
- /**
4
- * Class ICEshop_Iceimport_Helper_Db
5
- */
6
- class ICEshop_Iceimport_Helper_Db extends Mage_Core_Helper_Abstract
7
- {
8
-
9
- /**
10
- * @var object
11
- */
12
- private $_resource;
13
-
14
- /**
15
- * @var object
16
- */
17
- private $_reader;
18
-
19
- /**
20
- * @var object
21
- */
22
- private $_writer;
23
-
24
- /**
25
- * @var string
26
- */
27
- public $_prefix = '';
28
-
29
- /**
30
- * int
31
- */
32
- const LOG_ROWS_LIMIT = 500;
33
-
34
- /**
35
- * __construct
36
- */
37
- public function __construct()
38
- {
39
- try {
40
- $this->_resource = Mage::getSingleton('core/resource');
41
- $this->_writer = $this->_resource->getConnection('core_write');
42
- $this->_reader = $this->_resource->getConnection('core_read');
43
- $prefix = Mage::getConfig()->getTablePrefix();
44
- if (!empty($prefix[0])) {
45
- $this->_prefix = $prefix[0];
46
- }
47
- return true;
48
- } catch (Exception $e) {
49
- return false;
50
- }
51
- }
52
-
53
- /**
54
- * @param $table_name
55
- * @param bool|array $conditions
56
- * @return mixed
57
- */
58
- public function getRowsCount($table_name, $conditions = false)
59
- {
60
- $sql = "SELECT COUNT(*) AS `row_count` FROM `{$table_name}`";
61
- if (!empty($conditions) && is_array($conditions)) {
62
- $sql .= ' WHERE ';
63
- foreach ($conditions as $key => $condition) {
64
- if (is_array($condition)) {
65
- if ($key > 0) {
66
- $sql .= ' ' . $condition['conjunction'] . ' ';
67
- }
68
- $sql .= $condition['field'] . ' ' . $condition['comparison'] . ' ';
69
- switch ($condition['value_type']) {
70
- case 'num':
71
- $sql .= $condition['value'];
72
- break;
73
- case 'str':
74
- $sql .= '\'' . $condition['value'] . '\'';
75
- break;
76
- }
77
- } elseif (is_string($condition)) {
78
- $sql .= $condition;
79
- }
80
- }
81
-
82
- } elseif (!empty($conditions) && is_string($conditions)) {
83
- $sql .= $conditions;
84
- }
85
- $result = $this->_reader->fetchAll($sql);
86
- $result = array_shift($result);
87
- return $result['row_count'];
88
- }
89
-
90
- /**
91
- * @param $table_name
92
- * @param $field_name
93
- * @param bool|string $before_group
94
- * @param bool|string $after_group
95
- * @return mixed
96
- */
97
- public function getRowCountByField($table_name, $field_name, $before_group = false, $after_group = false)
98
- {
99
- $approved_before_group = '';
100
- if ($before_group != false && is_string($before_group)) {
101
- $approved_before_group = $before_group;
102
- }
103
- $approved_after_group = '';
104
- if ($after_group != false && is_string($after_group)) {
105
- $approved_after_group = $after_group;
106
- }
107
- // select is_default, count(is_default) from icecat_products_images group by is_default;
108
- $sql = "SELECT `{$field_name}`, COUNT(`{$field_name}`) as `row_count` FROM `{$table_name}`{$approved_before_group} GROUP BY `{$field_name}`{$approved_after_group}";
109
- $result = $this->_reader->fetchAll($sql);
110
- return $result;
111
- }
112
-
113
- /**
114
- * @param $table_name
115
- * @param $field_name
116
- * @return bool
117
- */
118
- public function checkIsFieldExists($table_name, $field_name)
119
- {
120
- if (!$this->_checkProcedureExists('FIELD_EXISTS')) {
121
- //recreate the procedure FIELD_EXISTS
122
- $this->_recreateFieldExistsProcedure();
123
- }
124
- $sql = "CALL FIELD_EXISTS(@_exists, '{$table_name}', '{$field_name}', NULL);";
125
- $this->_reader->query($sql);
126
-
127
- $sql = "SELECT @_exists;";
128
- $res = $this->_reader->fetchCol($sql);
129
- if (!array_shift($res)) {
130
- //field exists
131
- return false;
132
- }
133
- return true;
134
- }
135
-
136
- /**
137
- * @param $procedure_name
138
- * @return bool
139
- */
140
- private function _checkProcedureExists($procedure_name)
141
- {
142
- $sql = "SET @_exists = (SELECT COUNT(ROUTINE_NAME) FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_TYPE = 'PROCEDURE' AND ROUTINE_SCHEMA = database() AND ROUTINE_NAME = '{$procedure_name}')";
143
- $this->_reader->query($sql);
144
-
145
- $sql = "SELECT @_exists;";
146
- $res = $this->_reader->fetchCol($sql);
147
- $res = array_shift($res);
148
- if ($res > 0) {
149
- //field exists
150
- return true;
151
- }
152
- return false;
153
- }
154
-
155
- /**
156
- *
157
- */
158
- private function _recreateFieldExistsProcedure()
159
- {
160
- $sql = "CREATE PROCEDURE FIELD_EXISTS(
161
- OUT _exists BOOLEAN, -- return value
162
- IN tableName CHAR(255), -- name of table to look for
163
- IN columnName CHAR(255), -- name of column to look for
164
- IN dbName CHAR(255) -- optional specific db
165
- ) BEGIN
166
- -- try to lookup db if none provided
167
- SET @_dbName := IF(dbName IS NULL, database(), dbName);
168
-
169
- IF CHAR_LENGTH(@_dbName) = 0
170
- THEN -- no specific or current db to check against
171
- SELECT
172
- FALSE
173
- INTO _exists;
174
- ELSE -- we have a db to work with
175
- SELECT
176
- IF(count(*) > 0, TRUE, FALSE)
177
- INTO _exists
178
- FROM information_schema.COLUMNS c
179
- WHERE
180
- c.TABLE_SCHEMA = @_dbName
181
- AND c.TABLE_NAME = tableName
182
- AND c.COLUMN_NAME = columnName;
183
- END IF;
184
- END;";
185
- $this->_writer->query($sql);
186
- }
187
-
188
- /**
189
- * @param $sql
190
- * @return bool
191
- */
192
- public function readQuery($sql)
193
- {
194
- if (!empty($sql) && is_string($sql)) {
195
- return $this->_reader->fetchAll($sql);
196
- }
197
- return false;
198
- }
199
-
200
- /**
201
- * @param $key
202
- * @param $value
203
- * @param string $type
204
- * @return bool
205
- */
206
- public function insertLogEntry($key, $value, $type = 'info')
207
- {
208
- if ($type == 'error') {
209
- $this->rotateLog();
210
- }
211
- if (!empty($key)) {
212
- return $this->_writer->query("INSERT INTO `{$this->_prefix}iceshop_extensions_logs` (`log_key`, `log_value`, `log_type`)
213
- VALUES ('{$key}', '{$value}', '{$type}')
214
- ON DUPLICATE KEY UPDATE `log_value` = VALUES(`log_value`), `log_type` = VALUES(`log_type`)");
215
- }
216
- return false;
217
- }
218
-
219
- /**
220
- * @param string $log_type
221
- * @return bool
222
- */
223
- public function rotateLog($log_type = 'error')
224
- {
225
- $sql = "SELECT COUNT(*) AS row_amount
226
- FROM `{$this->_prefix}iceshop_extensions_logs`
227
- WHERE `log_type` = '{$log_type}';";
228
- $value = $this->_reader->fetchAll($sql);
229
- $row_amount = 0;
230
- if (array_key_exists(0, $value)) {
231
- $row_amount = $value[0]['row_amount'];
232
- }
233
- if ($row_amount > self::LOG_ROWS_LIMIT) {
234
- $rows_to_delete = $row_amount - self::LOG_ROWS_LIMIT;
235
- return $this->_writer->query("DELETE
236
- FROM `{$this->_prefix}iceshop_extensions_logs`
237
- WHERE `log_type` = '{$log_type}'
238
- ORDER BY `log_id` ASC
239
- LIMIT {$rows_to_delete}");
240
- }
241
- return false;
242
- }
243
-
244
- /**
245
- * @param $key
246
- * @return bool
247
- */
248
- public function getLogEntryByKey($key)
249
- {
250
- if (!empty($key)) {
251
- $sql = "SELECT `log_value`, `log_type`
252
- FROM `{$this->_prefix}iceshop_extensions_logs`
253
- WHERE `log_key` = '{$key}'
254
- ORDER BY `log_id` DESC
255
- LIMIT 1;";
256
- $value = $this->_reader->fetchAll($sql);
257
- if (array_key_exists(0, $value)) {
258
- return $value[0];
259
- }
260
- }
261
- return false;
262
- }
263
-
264
- /**
265
- * @param bool $type
266
- * @param string $comparison
267
- * @param int $limit
268
- * @return array|bool
269
- */
270
- public function getLogByType($type = false, $comparison = 'eq', $limit = 10)
271
- {
272
- $comparison_whitelist = array('eq', 'neq');
273
- if (!in_array($comparison, $comparison_whitelist)) {
274
- $comparison = 'eq';
275
- }
276
- if (!empty($type)) {
277
- if ($type == 'report') {
278
- $result_arr = array();
279
- $sql = "SELECT `log_value`, `timecol`
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;
288
- }
289
- return (!empty($result_arr)) ? $result_arr : false;
290
- } else {
291
- switch($comparison) {
292
- case 'eq':
293
- $result_arr = array();
294
- $sql = "SELECT `log_value`, `timecol`
295
- FROM `{$this->_prefix}iceshop_extensions_logs`
296
- WHERE `log_type` = '{$type}'
297
- ORDER BY `log_id` DESC
298
- LIMIT {$limit};";
299
- $results = $this->_reader->fetchAll($sql);
300
- foreach ($results as $row) {
301
- $result_arr[] = $row;
302
- }
303
- return (!empty($result_arr)) ? $result_arr : false;
304
- break;
305
-
306
- case 'neq':
307
- $result_arr = array();
308
- $sql = "SELECT `log_value`, `timecol`
309
- FROM `{$this->_prefix}iceshop_extensions_logs`
310
- WHERE `log_type` <> '{$type}'
311
- ORDER BY `log_id` DESC
312
- LIMIT {$limit};";
313
- $results = $this->_reader->fetchAll($sql);
314
- foreach ($results as $row) {
315
- $result_arr[] = $row;
316
- }
317
- return (!empty($result_arr)) ? $result_arr : false;
318
- break;
319
- }
320
- }
321
- } else {
322
- $sql = "SELECT `log_value`, `log_type`, `timecol`
323
- FROM `{$this->_prefix}iceshop_extensions_logs`
324
- ORDER BY `log_id` DESC
325
- LIMIT {$limit};";
326
- return $this->_reader->fetchAll($sql);
327
- }
328
- }
329
-
330
- /**
331
- * @param $key
332
- * @return bool
333
- */
334
- public function deleteLogEntry($key)
335
- {
336
- if (!empty($key)) {
337
- return $this->_writer->query("DELETE
338
- FROM `{$this->_prefix}iceshop_extensions_logs`
339
- WHERE `log_key` = '{$key}';");
340
- }
341
- return false;
342
- }
343
-
344
- /**
345
- * @param $table_name
346
- * @return bool
347
- */
348
- public function getTableName($table_name)
349
- {
350
- if (!empty($table_name) && is_string($table_name)) {
351
- return $this->_resource->getTableName($table_name);
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
  }
1
+ <?php
2
+
3
+ /**
4
+ * Class ICEshop_Iceimport_Helper_Db
5
+ */
6
+ class ICEshop_Iceimport_Helper_Db extends Mage_Core_Helper_Abstract
7
+ {
8
+
9
+ /**
10
+ * @var object
11
+ */
12
+ private $_resource;
13
+
14
+ /**
15
+ * @var object
16
+ */
17
+ private $_reader;
18
+
19
+ /**
20
+ * @var object
21
+ */
22
+ private $_writer;
23
+
24
+ /**
25
+ * @var string
26
+ */
27
+ public $_prefix = '';
28
+
29
+ /**
30
+ * int
31
+ */
32
+ const LOG_ROWS_LIMIT = 500;
33
+
34
+ /**
35
+ * __construct
36
+ */
37
+ public function __construct()
38
+ {
39
+ try {
40
+ $this->_resource = Mage::getSingleton('core/resource');
41
+ $this->_writer = $this->_resource->getConnection('core_write');
42
+ $this->_reader = $this->_resource->getConnection('core_read');
43
+ $prefix = Mage::getConfig()->getTablePrefix();
44
+ if (!empty($prefix[0])) {
45
+ $this->_prefix = $prefix[0];
46
+ }
47
+ return true;
48
+ } catch (Exception $e) {
49
+ return false;
50
+ }
51
+ }
52
+
53
+ /**
54
+ * @param $table_name
55
+ * @param bool|array $conditions
56
+ * @return mixed
57
+ */
58
+ public function getRowsCount($table_name, $conditions = false)
59
+ {
60
+ $sql = "SELECT COUNT(*) AS `row_count` FROM `{$table_name}`";
61
+ if (!empty($conditions) && is_array($conditions)) {
62
+ $sql .= ' WHERE ';
63
+ foreach ($conditions as $key => $condition) {
64
+ if (is_array($condition)) {
65
+ if ($key > 0) {
66
+ $sql .= ' ' . $condition['conjunction'] . ' ';
67
+ }
68
+ $sql .= $condition['field'] . ' ' . $condition['comparison'] . ' ';
69
+ switch ($condition['value_type']) {
70
+ case 'num':
71
+ $sql .= $condition['value'];
72
+ break;
73
+ case 'str':
74
+ $sql .= '\'' . $condition['value'] . '\'';
75
+ break;
76
+ }
77
+ } elseif (is_string($condition)) {
78
+ $sql .= $condition;
79
+ }
80
+ }
81
+
82
+ } elseif (!empty($conditions) && is_string($conditions)) {
83
+ $sql .= $conditions;
84
+ }
85
+ $result = $this->_reader->fetchAll($sql);
86
+ $result = array_shift($result);
87
+ return $result['row_count'];
88
+ }
89
+
90
+ /**
91
+ * @param $table_name
92
+ * @param $field_name
93
+ * @param bool|string $before_group
94
+ * @param bool|string $after_group
95
+ * @return mixed
96
+ */
97
+ public function getRowCountByField($table_name, $field_name, $before_group = false, $after_group = false)
98
+ {
99
+ $approved_before_group = '';
100
+ if ($before_group != false && is_string($before_group)) {
101
+ $approved_before_group = $before_group;
102
+ }
103
+ $approved_after_group = '';
104
+ if ($after_group != false && is_string($after_group)) {
105
+ $approved_after_group = $after_group;
106
+ }
107
+ // select is_default, count(is_default) from icecat_products_images group by is_default;
108
+ $sql = "SELECT `{$field_name}`, COUNT(`{$field_name}`) as `row_count` FROM `{$table_name}`{$approved_before_group} GROUP BY `{$field_name}`{$approved_after_group}";
109
+ $result = $this->_reader->fetchAll($sql);
110
+ return $result;
111
+ }
112
+
113
+ /**
114
+ * @param $table_name
115
+ * @param $field_name
116
+ * @return bool
117
+ */
118
+ public function checkIsFieldExists($table_name, $field_name)
119
+ {
120
+ if (!$this->_checkProcedureExists('FIELD_EXISTS')) {
121
+ //recreate the procedure FIELD_EXISTS
122
+ $this->_recreateFieldExistsProcedure();
123
+ }
124
+ $sql = "CALL FIELD_EXISTS(@_exists, '{$table_name}', '{$field_name}', NULL);";
125
+ $this->_reader->query($sql);
126
+
127
+ $sql = "SELECT @_exists;";
128
+ $res = $this->_reader->fetchCol($sql);
129
+ if (!array_shift($res)) {
130
+ //field exists
131
+ return false;
132
+ }
133
+ return true;
134
+ }
135
+
136
+ /**
137
+ * @param $procedure_name
138
+ * @return bool
139
+ */
140
+ private function _checkProcedureExists($procedure_name)
141
+ {
142
+ $sql = "SET @_exists = (SELECT COUNT(ROUTINE_NAME) FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_TYPE = 'PROCEDURE' AND ROUTINE_SCHEMA = database() AND ROUTINE_NAME = '{$procedure_name}')";
143
+ $this->_reader->query($sql);
144
+
145
+ $sql = "SELECT @_exists;";
146
+ $res = $this->_reader->fetchCol($sql);
147
+ $res = array_shift($res);
148
+ if ($res > 0) {
149
+ //field exists
150
+ return true;
151
+ }
152
+ return false;
153
+ }
154
+
155
+ /**
156
+ *
157
+ */
158
+ private function _recreateFieldExistsProcedure()
159
+ {
160
+ $sql = "CREATE PROCEDURE FIELD_EXISTS(
161
+ OUT _exists BOOLEAN, -- return value
162
+ IN tableName CHAR(255), -- name of table to look for
163
+ IN columnName CHAR(255), -- name of column to look for
164
+ IN dbName CHAR(255) -- optional specific db
165
+ ) BEGIN
166
+ -- try to lookup db if none provided
167
+ SET @_dbName := IF(dbName IS NULL, database(), dbName);
168
+
169
+ IF CHAR_LENGTH(@_dbName) = 0
170
+ THEN -- no specific or current db to check against
171
+ SELECT
172
+ FALSE
173
+ INTO _exists;
174
+ ELSE -- we have a db to work with
175
+ SELECT
176
+ IF(count(*) > 0, TRUE, FALSE)
177
+ INTO _exists
178
+ FROM information_schema.COLUMNS c
179
+ WHERE
180
+ c.TABLE_SCHEMA = @_dbName
181
+ AND c.TABLE_NAME = tableName
182
+ AND c.COLUMN_NAME = columnName;
183
+ END IF;
184
+ END;";
185
+ $this->_writer->query($sql);
186
+ }
187
+
188
+ /**
189
+ * @param $sql
190
+ * @return bool
191
+ */
192
+ public function readQuery($sql)
193
+ {
194
+ if (!empty($sql) && is_string($sql)) {
195
+ return $this->_reader->fetchAll($sql);
196
+ }
197
+ return false;
198
+ }
199
+
200
+ /**
201
+ * @param $key
202
+ * @param $value
203
+ * @param string $type
204
+ * @return bool
205
+ */
206
+ public function insertLogEntry($key, $value, $type = 'info')
207
+ {
208
+ if ($type == 'error') {
209
+ $this->rotateLog();
210
+ }
211
+ if (!empty($key)) {
212
+ return $this->_writer->query("INSERT INTO `{$this->_prefix}iceshop_extensions_logs` (`log_key`, `log_value`, `log_type`)
213
+ VALUES ('{$key}', '{$value}', '{$type}')
214
+ ON DUPLICATE KEY UPDATE `log_value` = VALUES(`log_value`), `log_type` = VALUES(`log_type`)");
215
+ }
216
+ return false;
217
+ }
218
+
219
+ /**
220
+ * @param string $log_type
221
+ * @return bool
222
+ */
223
+ public function rotateLog($log_type = 'error')
224
+ {
225
+ $sql = "SELECT COUNT(*) AS row_amount
226
+ FROM `{$this->_prefix}iceshop_extensions_logs`
227
+ WHERE `log_type` = '{$log_type}';";
228
+ $value = $this->_reader->fetchAll($sql);
229
+ $row_amount = 0;
230
+ if (array_key_exists(0, $value)) {
231
+ $row_amount = $value[0]['row_amount'];
232
+ }
233
+ if ($row_amount > self::LOG_ROWS_LIMIT) {
234
+ $rows_to_delete = $row_amount - self::LOG_ROWS_LIMIT;
235
+ return $this->_writer->query("DELETE
236
+ FROM `{$this->_prefix}iceshop_extensions_logs`
237
+ WHERE `log_type` = '{$log_type}'
238
+ ORDER BY `log_id` ASC
239
+ LIMIT {$rows_to_delete}");
240
+ }
241
+ return false;
242
+ }
243
+
244
+ /**
245
+ * @param $key
246
+ * @return bool
247
+ */
248
+ public function getLogEntryByKey($key)
249
+ {
250
+ if (!empty($key)) {
251
+ $sql = "SELECT `log_value`, `log_type`
252
+ FROM `{$this->_prefix}iceshop_extensions_logs`
253
+ WHERE `log_key` = '{$key}'
254
+ ORDER BY `log_id` DESC
255
+ LIMIT 1;";
256
+ $value = $this->_reader->fetchAll($sql);
257
+ if (array_key_exists(0, $value)) {
258
+ return $value[0];
259
+ }
260
+ }
261
+ return false;
262
+ }
263
+
264
+ /**
265
+ * @param bool $type
266
+ * @param string $comparison
267
+ * @param int $limit
268
+ * @return array|bool
269
+ */
270
+ public function getLogByType($type = false, $comparison = 'eq', $limit = 10)
271
+ {
272
+ $comparison_whitelist = array('eq', 'neq');
273
+ if (!in_array($comparison, $comparison_whitelist)) {
274
+ $comparison = 'eq';
275
+ }
276
+ if (!empty($type)) {
277
+ if ($type == 'report') {
278
+ $result_arr = array();
279
+ $sql = "SELECT `log_value`, `timecol`
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;
288
+ }
289
+ return (!empty($result_arr)) ? $result_arr : false;
290
+ } else {
291
+ switch($comparison) {
292
+ case 'eq':
293
+ $result_arr = array();
294
+ $sql = "SELECT `log_value`, `timecol`
295
+ FROM `{$this->_prefix}iceshop_extensions_logs`
296
+ WHERE `log_type` = '{$type}'
297
+ ORDER BY `log_id` DESC
298
+ LIMIT {$limit};";
299
+ $results = $this->_reader->fetchAll($sql);
300
+ foreach ($results as $row) {
301
+ $result_arr[] = $row;
302
+ }
303
+ return (!empty($result_arr)) ? $result_arr : false;
304
+ break;
305
+
306
+ case 'neq':
307
+ $result_arr = array();
308
+ $sql = "SELECT `log_value`, `timecol`
309
+ FROM `{$this->_prefix}iceshop_extensions_logs`
310
+ WHERE `log_type` <> '{$type}'
311
+ ORDER BY `log_id` DESC
312
+ LIMIT {$limit};";
313
+ $results = $this->_reader->fetchAll($sql);
314
+ foreach ($results as $row) {
315
+ $result_arr[] = $row;
316
+ }
317
+ return (!empty($result_arr)) ? $result_arr : false;
318
+ break;
319
+ }
320
+ }
321
+ } else {
322
+ $sql = "SELECT `log_value`, `log_type`, `timecol`
323
+ FROM `{$this->_prefix}iceshop_extensions_logs`
324
+ ORDER BY `log_id` DESC
325
+ LIMIT {$limit};";
326
+ return $this->_reader->fetchAll($sql);
327
+ }
328
+ }
329
+
330
+ /**
331
+ * @param $key
332
+ * @return bool
333
+ */
334
+ public function deleteLogEntry($key)
335
+ {
336
+ if (!empty($key)) {
337
+ return $this->_writer->query("DELETE
338
+ FROM `{$this->_prefix}iceshop_extensions_logs`
339
+ WHERE `log_key` = '{$key}';");
340
+ }
341
+ return false;
342
+ }
343
+
344
+ /**
345
+ * @param $table_name
346
+ * @return bool
347
+ */
348
+ public function getTableName($table_name)
349
+ {
350
+ if (!empty($table_name) && is_string($table_name)) {
351
+ return $this->_resource->getTableName($table_name);
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/Format.php CHANGED
@@ -1,251 +1,251 @@
1
- <?php
2
- /******************************************************************************
3
- * Copyright (c) 2010 Jevon Wright and others.
4
- * All rights reserved. This program and the accompanying materials
5
- * are made available under the terms of the Eclipse Public License v1.0
6
- * which accompanies this distribution, and is available at
7
- * http://www.eclipse.org/legal/epl-v10.html
8
- *
9
- * Contributors:
10
- * Jevon Wright - initial API and implementation
11
- ****************************************************************************/
12
-
13
- /**
14
- * Tries to convert the given HTML into a plain text format - best suited for
15
- * e-mail display, etc.
16
- *
17
- * <p>In particular, it tries to maintain the following features:
18
- * <ul>
19
- * <li>Links are maintained, with the 'href' copied over
20
- * <li>Information in the &lt;head&gt; is lost
21
- * </ul>
22
- *
23
- * @param html the input HTML
24
- * @return the HTML converted, as best as possible, to text
25
- */
26
- class ICEshop_Iceimport_Helper_Format extends Mage_Core_Helper_Abstract
27
- {
28
- /**
29
- * @param $html
30
- * @return mixed|string
31
- */
32
- public function convert_html_to_text($html)
33
- {
34
- $html = $this->fix_newlines($html);
35
-
36
- $doc = new DOMDocument();
37
- if (!$doc->loadHTML($html))
38
- return "Could not load HTML - badly formed?";
39
-
40
- $output = $this->iterate_over_node($doc);
41
-
42
- // remove leading and trailing spaces on each line
43
- $output = preg_replace("/[ \t]*\n[ \t]*/im", "\n", $output);
44
-
45
- // remove leading and trailing whitespace
46
- $output = trim($output);
47
-
48
- return $output;
49
- }
50
-
51
- /**
52
- * Unify newlines; in particular, \r\n becomes \n, and
53
- * then \r becomes \n. This means that all newlines (Unix, Windows, Mac)
54
- * all become \ns.
55
- *
56
- * @param text text with any number of \r, \r\n and \n combinations
57
- * @return the fixed text
58
- */
59
- private function fix_newlines($text)
60
- {
61
- // replace \r\n to \n
62
- $text = str_replace("\r\n", "\n", $text);
63
- // remove \rs
64
- $text = str_replace("\r", "\n", $text);
65
-
66
- return $text;
67
- }
68
-
69
- /**
70
- * @param $node
71
- * @return null|string
72
- */
73
- private function next_child_name($node)
74
- {
75
- // get the next child
76
- $nextNode = $node->nextSibling;
77
- while ($nextNode != null) {
78
- if ($nextNode instanceof DOMElement) {
79
- break;
80
- }
81
- $nextNode = $nextNode->nextSibling;
82
- }
83
- $nextName = null;
84
- if ($nextNode instanceof DOMElement && $nextNode != null) {
85
- $nextName = strtolower($nextNode->nodeName);
86
- }
87
-
88
- return $nextName;
89
- }
90
-
91
- /**
92
- * @param $node
93
- * @return null|string
94
- */
95
- private function prev_child_name($node)
96
- {
97
- // get the previous child
98
- $nextNode = $node->previousSibling;
99
- while ($nextNode != null) {
100
- if ($nextNode instanceof DOMElement) {
101
- break;
102
- }
103
- $nextNode = $nextNode->previousSibling;
104
- }
105
- $nextName = null;
106
- if ($nextNode instanceof DOMElement && $nextNode != null) {
107
- $nextName = strtolower($nextNode->nodeName);
108
- }
109
-
110
- return $nextName;
111
- }
112
-
113
- /**
114
- * @param $node
115
- * @return mixed|string
116
- */
117
- private function iterate_over_node($node)
118
- {
119
- if ($node instanceof DOMText) {
120
- return preg_replace("/\\s+/im", " ", $node->wholeText);
121
- }
122
- if ($node instanceof DOMDocumentType) {
123
- // ignore
124
- return "";
125
- }
126
-
127
- $nextName = $this->next_child_name($node);
128
- $prevName = $this->prev_child_name($node);
129
-
130
- $name = strtolower($node->nodeName);
131
-
132
- // start whitespace
133
- switch ($name) {
134
- case "hr":
135
- return "------\n";
136
-
137
- case "style":
138
- case "head":
139
- case "title":
140
- case "meta":
141
- case "script":
142
- // ignore these tags
143
- return "";
144
-
145
- case "h1":
146
- case "h2":
147
- case "h3":
148
- case "h4":
149
- case "h5":
150
- case "h6":
151
- // add two newlines
152
- $output = "\n";
153
- break;
154
-
155
- case "p":
156
- case "div":
157
- // add one line
158
- $output = "\n";
159
- break;
160
-
161
- default:
162
- // print out contents of unknown tags
163
- $output = "";
164
- break;
165
- }
166
-
167
- // debug
168
- //$output .= "[$name,$nextName]";
169
-
170
- for ($i = 0; $i < $node->childNodes->length; $i++) {
171
- $n = $node->childNodes->item($i);
172
-
173
- $text = $this->iterate_over_node($n);
174
-
175
- $output .= $text;
176
- }
177
-
178
- // end whitespace
179
- switch ($name) {
180
- case "style":
181
- case "head":
182
- case "title":
183
- case "meta":
184
- case "script":
185
- // ignore these tags
186
- return "";
187
-
188
- case "tr":
189
- case "h1":
190
- case "h2":
191
- case "h3":
192
- case "h4":
193
- case "h5":
194
- case "h6":
195
- $output .= "\n";
196
- break;
197
-
198
- case "td":
199
- $output .= "\t";
200
- break;
201
-
202
- case "p":
203
- case "br":
204
- // add one line
205
- if ($nextName != "div")
206
- $output .= "\n";
207
- break;
208
-
209
- case "div":
210
- // add one line only if the next child isn't a div
211
- if ($nextName != "div" && $nextName != null)
212
- $output .= "\n";
213
- break;
214
-
215
- case "a":
216
- // links are returned in [text](link) format
217
- $href = $node->getAttribute("href");
218
- if ($href == null) {
219
- // it doesn't link anywhere
220
- if ($node->getAttribute("name") != null) {
221
- $output = "[$output]";
222
- }
223
- } else {
224
- if ($href == $output) {
225
- // link to the same address: just use link
226
- $output;
227
- } else {
228
- // replace it
229
- $output = "[$output]($href)";
230
- }
231
- }
232
-
233
- // does the next node require additional whitespace?
234
- switch ($nextName) {
235
- case "h1":
236
- case "h2":
237
- case "h3":
238
- case "h4":
239
- case "h5":
240
- case "h6":
241
- $output .= "\n";
242
- break;
243
- }
244
-
245
- default:
246
- // do nothing
247
- }
248
-
249
- return $output;
250
- }
251
  }
1
+ <?php
2
+ /******************************************************************************
3
+ * Copyright (c) 2010 Jevon Wright and others.
4
+ * All rights reserved. This program and the accompanying materials
5
+ * are made available under the terms of the Eclipse Public License v1.0
6
+ * which accompanies this distribution, and is available at
7
+ * http://www.eclipse.org/legal/epl-v10.html
8
+ *
9
+ * Contributors:
10
+ * Jevon Wright - initial API and implementation
11
+ ****************************************************************************/
12
+
13
+ /**
14
+ * Tries to convert the given HTML into a plain text format - best suited for
15
+ * e-mail display, etc.
16
+ *
17
+ * <p>In particular, it tries to maintain the following features:
18
+ * <ul>
19
+ * <li>Links are maintained, with the 'href' copied over
20
+ * <li>Information in the &lt;head&gt; is lost
21
+ * </ul>
22
+ *
23
+ * @param html the input HTML
24
+ * @return the HTML converted, as best as possible, to text
25
+ */
26
+ class ICEshop_Iceimport_Helper_Format extends Mage_Core_Helper_Abstract
27
+ {
28
+ /**
29
+ * @param $html
30
+ * @return mixed|string
31
+ */
32
+ public function convert_html_to_text($html)
33
+ {
34
+ $html = $this->fix_newlines($html);
35
+
36
+ $doc = new DOMDocument();
37
+ if (!$doc->loadHTML($html))
38
+ return "Could not load HTML - badly formed?";
39
+
40
+ $output = $this->iterate_over_node($doc);
41
+
42
+ // remove leading and trailing spaces on each line
43
+ $output = preg_replace("/[ \t]*\n[ \t]*/im", "\n", $output);
44
+
45
+ // remove leading and trailing whitespace
46
+ $output = trim($output);
47
+
48
+ return $output;
49
+ }
50
+
51
+ /**
52
+ * Unify newlines; in particular, \r\n becomes \n, and
53
+ * then \r becomes \n. This means that all newlines (Unix, Windows, Mac)
54
+ * all become \ns.
55
+ *
56
+ * @param text text with any number of \r, \r\n and \n combinations
57
+ * @return the fixed text
58
+ */
59
+ private function fix_newlines($text)
60
+ {
61
+ // replace \r\n to \n
62
+ $text = str_replace("\r\n", "\n", $text);
63
+ // remove \rs
64
+ $text = str_replace("\r", "\n", $text);
65
+
66
+ return $text;
67
+ }
68
+
69
+ /**
70
+ * @param $node
71
+ * @return null|string
72
+ */
73
+ private function next_child_name($node)
74
+ {
75
+ // get the next child
76
+ $nextNode = $node->nextSibling;
77
+ while ($nextNode != null) {
78
+ if ($nextNode instanceof DOMElement) {
79
+ break;
80
+ }
81
+ $nextNode = $nextNode->nextSibling;
82
+ }
83
+ $nextName = null;
84
+ if ($nextNode instanceof DOMElement && $nextNode != null) {
85
+ $nextName = strtolower($nextNode->nodeName);
86
+ }
87
+
88
+ return $nextName;
89
+ }
90
+
91
+ /**
92
+ * @param $node
93
+ * @return null|string
94
+ */
95
+ private function prev_child_name($node)
96
+ {
97
+ // get the previous child
98
+ $nextNode = $node->previousSibling;
99
+ while ($nextNode != null) {
100
+ if ($nextNode instanceof DOMElement) {
101
+ break;
102
+ }
103
+ $nextNode = $nextNode->previousSibling;
104
+ }
105
+ $nextName = null;
106
+ if ($nextNode instanceof DOMElement && $nextNode != null) {
107
+ $nextName = strtolower($nextNode->nodeName);
108
+ }
109
+
110
+ return $nextName;
111
+ }
112
+
113
+ /**
114
+ * @param $node
115
+ * @return mixed|string
116
+ */
117
+ private function iterate_over_node($node)
118
+ {
119
+ if ($node instanceof DOMText) {
120
+ return preg_replace("/\\s+/im", " ", $node->wholeText);
121
+ }
122
+ if ($node instanceof DOMDocumentType) {
123
+ // ignore
124
+ return "";
125
+ }
126
+
127
+ $nextName = $this->next_child_name($node);
128
+ $prevName = $this->prev_child_name($node);
129
+
130
+ $name = strtolower($node->nodeName);
131
+
132
+ // start whitespace
133
+ switch ($name) {
134
+ case "hr":
135
+ return "------\n";
136
+
137
+ case "style":
138
+ case "head":
139
+ case "title":
140
+ case "meta":
141
+ case "script":
142
+ // ignore these tags
143
+ return "";
144
+
145
+ case "h1":
146
+ case "h2":
147
+ case "h3":
148
+ case "h4":
149
+ case "h5":
150
+ case "h6":
151
+ // add two newlines
152
+ $output = "\n";
153
+ break;
154
+
155
+ case "p":
156
+ case "div":
157
+ // add one line
158
+ $output = "\n";
159
+ break;
160
+
161
+ default:
162
+ // print out contents of unknown tags
163
+ $output = "";
164
+ break;
165
+ }
166
+
167
+ // debug
168
+ //$output .= "[$name,$nextName]";
169
+
170
+ for ($i = 0; $i < $node->childNodes->length; $i++) {
171
+ $n = $node->childNodes->item($i);
172
+
173
+ $text = $this->iterate_over_node($n);
174
+
175
+ $output .= $text;
176
+ }
177
+
178
+ // end whitespace
179
+ switch ($name) {
180
+ case "style":
181
+ case "head":
182
+ case "title":
183
+ case "meta":
184
+ case "script":
185
+ // ignore these tags
186
+ return "";
187
+
188
+ case "tr":
189
+ case "h1":
190
+ case "h2":
191
+ case "h3":
192
+ case "h4":
193
+ case "h5":
194
+ case "h6":
195
+ $output .= "\n";
196
+ break;
197
+
198
+ case "td":
199
+ $output .= "\t";
200
+ break;
201
+
202
+ case "p":
203
+ case "br":
204
+ // add one line
205
+ if ($nextName != "div")
206
+ $output .= "\n";
207
+ break;
208
+
209
+ case "div":
210
+ // add one line only if the next child isn't a div
211
+ if ($nextName != "div" && $nextName != null)
212
+ $output .= "\n";
213
+ break;
214
+
215
+ case "a":
216
+ // links are returned in [text](link) format
217
+ $href = $node->getAttribute("href");
218
+ if ($href == null) {
219
+ // it doesn't link anywhere
220
+ if ($node->getAttribute("name") != null) {
221
+ $output = "[$output]";
222
+ }
223
+ } else {
224
+ if ($href == $output) {
225
+ // link to the same address: just use link
226
+ $output;
227
+ } else {
228
+ // replace it
229
+ $output = "[$output]($href)";
230
+ }
231
+ }
232
+
233
+ // does the next node require additional whitespace?
234
+ switch ($nextName) {
235
+ case "h1":
236
+ case "h2":
237
+ case "h3":
238
+ case "h4":
239
+ case "h5":
240
+ case "h6":
241
+ $output .= "\n";
242
+ break;
243
+ }
244
+
245
+ default:
246
+ // do nothing
247
+ }
248
+
249
+ return $output;
250
+ }
251
  }
app/code/community/ICEshop/Iceimport/Helper/System/System.php CHANGED
@@ -1,461 +1,461 @@
1
- <?php
2
-
3
- /**
4
- * Class Iceshop_Iceimport_Helper_System_System
5
- */
6
- class Iceshop_Iceimport_Helper_System_System extends Mage_Core_Helper_Abstract
7
- {
8
- /**
9
- * Sorts a multi-dimensional array with the given values
10
- *
11
- * Seen and modified from: http://www.firsttube.com/read/sorting-a-multi-dimensional-array-with-php/
12
- *
13
- * @param array $arr Array to sort
14
- * @param string $key Field to sort
15
- * @param string $dir Direction to sort
16
- * @return array Sorted array
17
- */
18
- public function sortMultiDimArr($arr, $key, $dir = 'ASC')
19
- {
20
- foreach ($arr as $k => $v) {
21
- $b[$k] = strtolower($v[$key]);
22
- }
23
-
24
- if ($dir == 'ASC') {
25
- asort($b);
26
- } else {
27
- arsort($b);
28
- }
29
- foreach ($b as $key => $val) {
30
- $c[] = $arr[$key];
31
- }
32
-
33
- return $c;
34
- }
35
-
36
- /**
37
- * Activate/Deactivate a Magento module
38
- *
39
- * @param string $name
40
- * @return string
41
- */
42
- public function deactivateModule($name)
43
- {
44
- $isDeactivationPossible = true;
45
- foreach (Mage::getConfig()->getNode('modules')->children() as $moduleName => $item) {
46
- if ($moduleName == $name) {
47
- continue;
48
- }
49
- if ($item->depends) {
50
- foreach ($item->depends->children() as $depend) {
51
- if ($depend->getName() == $name) {
52
- if ((string)Mage::getConfig()->getModuleConfig($moduleName)->is('active', 'true')) {
53
- $isDeactivationPossible = false;
54
- }
55
- }
56
- }
57
- }
58
- }
59
-
60
- if ($isDeactivationPossible) {
61
- $xmlPath = Mage::getBaseDir() . DS . 'app' . DS . 'etc' . DS . 'modules' . DS . $name . '.xml';
62
- if (file_exists($xmlPath)) {
63
- $xmlObj = new Varien_Simplexml_Config($xmlPath);
64
-
65
- $currentValue = (string)$xmlObj->getNode('modules/' . $name . '/active');
66
- if ($currentValue == 'true') {
67
- $value = false;
68
- } else {
69
- $value = true;
70
- }
71
-
72
- $xmlObj->setNode(
73
- 'modules/' . $name . '/active',
74
- $value ? 'true' : 'false'
75
- );
76
-
77
- if (is_writable($xmlPath)) {
78
- $xmlData = $xmlObj->getNode()->asNiceXml();
79
- @file_put_contents($xmlPath, $xmlData);
80
- Mage::app()->getCacheInstance()->clean();
81
- if ($value) {
82
- $status = $this->__('The module "%s" has been successfully activated.', $name);
83
- } else {
84
- $status = $this->__('The module "%s" has been successfully deactivated.', $name);
85
- }
86
- } else {
87
- $status = $this->__('File %s is not writable.', $xmlPath);
88
- }
89
- } else {
90
- $status = $this->__(
91
- 'Module %s is probably not installed. File %s does not exist.',
92
- $name,
93
- $xmlPath
94
- );
95
- }
96
- } else {
97
- $status = $this->__('Module can\'t be deactivated because it is a dependency of another module which is still active.');
98
- }
99
-
100
- return $status;
101
- }
102
-
103
- /**
104
- * Retrieve a collection of all rewrites
105
- *
106
- * @return Varien_Data_Collection Collection
107
- */
108
- public function getRewriteCollection()
109
- {
110
- $collection = new Varien_Data_Collection();
111
- $rewrites = $this->_loadRewrites();
112
-
113
- foreach ($rewrites as $rewriteNodes) {
114
- foreach ($rewriteNodes as $n) {
115
- $nParent = $n->xpath('..');
116
- $module = (string)$nParent[0]->getName();
117
- $nSubParent = $nParent[0]->xpath('..');
118
- $component = (string)$nSubParent[0]->getName();
119
-
120
- if (!in_array($component, array('blocks', 'helpers', 'models'))) {
121
- continue;
122
- }
123
-
124
- $pathNodes = $n->children();
125
- foreach ($pathNodes as $pathNode) {
126
- $path = (string)$pathNode->getName();
127
- $completePath = $module . '/' . $path;
128
-
129
- $rewriteClassName = (string)$pathNode;
130
-
131
- $instance = Mage::getConfig()->getGroupedClassName(
132
- substr($component, 0, -1),
133
- $completePath
134
- );
135
-
136
- $collection->addItem(
137
- new Varien_Object(
138
- array(
139
- 'path' => $completePath,
140
- 'rewrite_class' => $rewriteClassName,
141
- 'active_class' => $instance,
142
- 'status' => ($instance == $rewriteClassName)
143
- )
144
- )
145
- );
146
- }
147
- }
148
- }
149
-
150
- return $collection;
151
- }
152
-
153
- /**
154
- * Return all rewrites
155
- *
156
- * @return array All rwrites
157
- */
158
- protected function _loadRewrites()
159
- {
160
- $fileName = 'config.xml';
161
- $modules = Mage::getConfig()->getNode('modules')->children();
162
-
163
- $return = array();
164
- foreach ($modules as $modName => $module) {
165
- if ($module->is('active')) {
166
- $configFile = Mage::getConfig()->getModuleDir('etc', $modName) . DS . $fileName;
167
- if (file_exists($configFile)) {
168
- $xml = file_get_contents($configFile);
169
- $xml = simplexml_load_string($xml);
170
-
171
- if ($xml instanceof SimpleXMLElement) {
172
- $return[$modName] = $xml->xpath('//rewrite');
173
- }
174
- }
175
- }
176
- }
177
-
178
- return $return;
179
- }
180
-
181
- /**
182
- * Retrieve a collection of all modules
183
- *
184
- * @return Varien_Data_Collection Collection
185
- */
186
- public function getModulesCollection()
187
- {
188
- $sortValue = Mage::app()->getRequest()->getParam('sort', 'name');
189
- $sortValue = strtolower($sortValue);
190
-
191
- $sortDir = Mage::app()->getRequest()->getParam('dir', 'ASC');
192
- $sortDir = strtoupper($sortDir);
193
-
194
- $modules = $this->_loadModules();
195
- $modules = $this->sortMultiDimArr($modules, $sortValue, $sortDir);
196
-
197
- $collection = new Varien_Data_Collection();
198
- foreach ($modules as $val) {
199
- $item = new Varien_Object($val);
200
- $collection->addItem($item);
201
- }
202
-
203
- return $collection;
204
- }
205
-
206
- /**
207
- * Loads the module configurations and checks for some criteria and
208
- * returns an array with the current modules in the Magento instance.
209
- *
210
- * @return array Modules
211
- */
212
- protected function _loadModules()
213
- {
214
- $modules = array();
215
- $config = Mage::getConfig();
216
- foreach ($config->getNode('modules')->children() as $item) {
217
- $active = ($item->active == 'true') ? true : false;
218
- $codePool = (string)$config->getModuleConfig($item->getName())->codePool;
219
- $path = $config->getOptions()->getCodeDir() . DS . $codePool . DS . uc_words($item->getName(), DS);
220
- $pathExists = file_exists($path);
221
- $pathExists = $pathExists ? true : false;
222
- $configExists = file_exists($path . '/etc/config.xml');
223
- $configExists = $configExists ? true : false;
224
- $version = (string)$config->getModuleConfig($item->getName())->version;
225
-
226
- $dependencies = '-';
227
- if ($item->depends) {
228
- $depends = array();
229
- foreach ($item->depends->children() as $depend) {
230
- $depends[] = $depend->getName();
231
- }
232
- if (is_array($depends) && count($depends) > 0) {
233
- asort($depends);
234
- $dependencies = implode("\n", $depends);
235
- }
236
- }
237
-
238
- $modules[$item->getName()] = array(
239
- 'name' => $item->getName(),
240
- 'active' => $active,
241
- 'code_pool' => $codePool,
242
- 'path' => $path,
243
- 'path_exists' => $pathExists,
244
- 'config_exists' => $configExists,
245
- 'version' => $version,
246
- 'dependencies' => $dependencies
247
- );
248
- }
249
-
250
- return $modules;
251
- }
252
-
253
- /**
254
- * Retrieve a collection of all events
255
- *
256
- * @return Varien_Data_Collection Collection
257
- */
258
- public function getEventsCollection()
259
- {
260
- $sortValue = Mage::app()->getRequest()->getParam('sort', 'event');
261
- $sortValue = strtolower($sortValue);
262
-
263
- $sortDir = Mage::app()->getRequest()->getParam('dir', 'ASC');
264
- $sortDir = strtoupper($sortDir);
265
-
266
- $events = $this->_loadEvents();
267
- $events = $this->sortMultiDimArr($events, $sortValue, $sortDir);
268
-
269
- $collection = new Varien_Data_Collection();
270
- foreach ($events as $item) {
271
- $values = $item['children'];
272
- if (is_array($values)) {
273
- asort($values);
274
- }
275
-
276
- $val = array(
277
- 'event' => $item['event'],
278
- 'location' => implode("\n", $values)
279
- );
280
-
281
- $item = new Varien_Object($val);
282
- $collection->addItem($item);
283
- }
284
-
285
- return $collection;
286
- }
287
-
288
- /**
289
- * Return all events
290
- *
291
- * @return array All events
292
- */
293
- protected function _loadEvents()
294
- {
295
- $fileName = 'config.xml';
296
- $modules = Mage::getConfig()->getNode('modules')->children();
297
-
298
- $events = array();
299
- foreach ($modules as $modName => $module) {
300
- if ($module->is('active')) {
301
- $configFile = Mage::getConfig()->getModuleDir('etc', $modName) . DS . $fileName;
302
- if (file_exists($configFile)) {
303
- $xml = file_get_contents($configFile);
304
- $xml = simplexml_load_string($xml);
305
-
306
- if ($xml instanceof SimpleXMLElement) {
307
- $events[$modName] = $xml->xpath('//events');
308
- }
309
- }
310
- }
311
- }
312
-
313
- $return = array();
314
- foreach ($events as $eventNodes) {
315
- foreach ($eventNodes as $n) {
316
- $pathNodes = $n->children();
317
-
318
- foreach ($pathNodes as $pathNode) {
319
- $eventName = (string)$pathNode->getName();
320
- $instance = $pathNode->xpath('observers/node()/class');
321
- $instance = (string)current($instance);
322
- $instance = Mage::getConfig()->getModelClassName($instance);
323
-
324
- if (!array_key_exists($eventName, $return)) {
325
- $return[$eventName] = array(
326
- 'event' => $eventName,
327
- 'children' => array()
328
- );
329
- }
330
- if (!in_array($instance, $return[$eventName])) {
331
- $return[$eventName]['children'][] = $instance;
332
- }
333
- }
334
- }
335
- }
336
-
337
- return $return;
338
- }
339
-
340
- /**
341
- * Checks if one or more caches are active
342
- *
343
- * @return string Cache Message
344
- */
345
- public function checkCaches()
346
- {
347
- $active = 0;
348
- $inactive = 0;
349
- foreach (Mage::app()->getCacheInstance()->getTypes() as $type) {
350
- $tmp = $type->getData();
351
- if ($tmp['status']) {
352
- $active++;
353
- } else {
354
- $inactive++;
355
- }
356
- }
357
-
358
- return $this->__(
359
- '%s caches active, %s caches inactive',
360
- $active,
361
- $inactive
362
- );
363
- }
364
-
365
- /**
366
- * Checks if all indexes are up-to-date
367
- *
368
- * @return string Indexes Message
369
- */
370
- public function checkIndizes()
371
- {
372
- $ready = 0;
373
- $processing = 0;
374
- $reindex = 0;
375
-
376
- $collection = Mage::getResourceModel('index/process_collection');
377
- foreach ($collection as $item) {
378
- $tmp = $item->getData();
379
- if ($tmp['status'] == 'pending') {
380
- $ready++;
381
- } elseif ($tmp['status'] == 'working') {
382
- $processing++;
383
- } else {
384
- $reindex++;
385
- }
386
- }
387
-
388
- return $this->__(
389
- '%s indexes are ready, %s indexes are working, %s indexes need reindex',
390
- $ready,
391
- $processing,
392
- $reindex
393
- );
394
- }
395
-
396
- /**
397
- * Returns a small system check report with some essential properties
398
- *
399
- * @return array Extension Check Result
400
- */
401
- public function checkSystem()
402
- {
403
- return $this->_extensionCheck(
404
- array(
405
- 'curl',
406
- 'dom',
407
- 'gd',
408
- 'hash',
409
- 'iconv',
410
- 'mcrypt',
411
- 'pcre',
412
- 'pdo',
413
- 'pdo_mysql',
414
- 'simplexml'
415
- )
416
- );
417
- }
418
-
419
- /**
420
- * Checks some kind of essential properties
421
- *
422
- * @param string $extensions Extensions to check
423
- * @return array Array with failed and passed checks
424
- */
425
- protected function _extensionCheck($extensions)
426
- {
427
- $fail = array();
428
- $pass = array();
429
-
430
- if (version_compare(phpversion(), '5.2.0', '<')) {
431
- $fail[] = 'You need <strong>PHP 5.2.0</strong> (or greater)';
432
- } else {
433
- $pass[] = 'You have <strong>PHP 5.2.0</strong> (or greater)';
434
- }
435
-
436
- if (!ini_get('safe_mode')) {
437
- $pass[] = 'Safe Mode is <strong>off</strong>';
438
-
439
- $con = Mage::getSingleton('core/resource')->getConnection('core_read');
440
- $version = $con->getServerVersion();
441
-
442
- if (version_compare($version, '4.1.20', '<')) {
443
- $fail[] = 'You need <strong>MySQL 4.1.20</strong> (or greater)';
444
- } else {
445
- $pass[] = 'You have <strong>MySQL 4.1.20</strong> (or greater)';
446
- }
447
- } else {
448
- $fail[] = 'Safe Mode is <strong>on</strong>';
449
- }
450
-
451
- foreach ($extensions as $extension) {
452
- if (!extension_loaded($extension)) {
453
- $fail[] = 'You are missing the <strong>' . $extension . '</strong> extension';
454
- } else {
455
- $pass[] = 'You have the <strong>' . $extension . '</strong> extension';
456
- }
457
- }
458
-
459
- return array('pass' => $pass, 'fail' => $fail);
460
- }
461
- }
1
+ <?php
2
+
3
+ /**
4
+ * Class Iceshop_Iceimport_Helper_System_System
5
+ */
6
+ class Iceshop_Iceimport_Helper_System_System extends Mage_Core_Helper_Abstract
7
+ {
8
+ /**
9
+ * Sorts a multi-dimensional array with the given values
10
+ *
11
+ * Seen and modified from: http://www.firsttube.com/read/sorting-a-multi-dimensional-array-with-php/
12
+ *
13
+ * @param array $arr Array to sort
14
+ * @param string $key Field to sort
15
+ * @param string $dir Direction to sort
16
+ * @return array Sorted array
17
+ */
18
+ public function sortMultiDimArr($arr, $key, $dir = 'ASC')
19
+ {
20
+ foreach ($arr as $k => $v) {
21
+ $b[$k] = strtolower($v[$key]);
22
+ }
23
+
24
+ if ($dir == 'ASC') {
25
+ asort($b);
26
+ } else {
27
+ arsort($b);
28
+ }
29
+ foreach ($b as $key => $val) {
30
+ $c[] = $arr[$key];
31
+ }
32
+
33
+ return $c;
34
+ }
35
+
36
+ /**
37
+ * Activate/Deactivate a Magento module
38
+ *
39
+ * @param string $name
40
+ * @return string
41
+ */
42
+ public function deactivateModule($name)
43
+ {
44
+ $isDeactivationPossible = true;
45
+ foreach (Mage::getConfig()->getNode('modules')->children() as $moduleName => $item) {
46
+ if ($moduleName == $name) {
47
+ continue;
48
+ }
49
+ if ($item->depends) {
50
+ foreach ($item->depends->children() as $depend) {
51
+ if ($depend->getName() == $name) {
52
+ if ((string)Mage::getConfig()->getModuleConfig($moduleName)->is('active', 'true')) {
53
+ $isDeactivationPossible = false;
54
+ }
55
+ }
56
+ }
57
+ }
58
+ }
59
+
60
+ if ($isDeactivationPossible) {
61
+ $xmlPath = Mage::getBaseDir() . DS . 'app' . DS . 'etc' . DS . 'modules' . DS . $name . '.xml';
62
+ if (file_exists($xmlPath)) {
63
+ $xmlObj = new Varien_Simplexml_Config($xmlPath);
64
+
65
+ $currentValue = (string)$xmlObj->getNode('modules/' . $name . '/active');
66
+ if ($currentValue == 'true') {
67
+ $value = false;
68
+ } else {
69
+ $value = true;
70
+ }
71
+
72
+ $xmlObj->setNode(
73
+ 'modules/' . $name . '/active',
74
+ $value ? 'true' : 'false'
75
+ );
76
+
77
+ if (is_writable($xmlPath)) {
78
+ $xmlData = $xmlObj->getNode()->asNiceXml();
79
+ @file_put_contents($xmlPath, $xmlData);
80
+ Mage::app()->getCacheInstance()->clean();
81
+ if ($value) {
82
+ $status = $this->__('The module "%s" has been successfully activated.', $name);
83
+ } else {
84
+ $status = $this->__('The module "%s" has been successfully deactivated.', $name);
85
+ }
86
+ } else {
87
+ $status = $this->__('File %s is not writable.', $xmlPath);
88
+ }
89
+ } else {
90
+ $status = $this->__(
91
+ 'Module %s is probably not installed. File %s does not exist.',
92
+ $name,
93
+ $xmlPath
94
+ );
95
+ }
96
+ } else {
97
+ $status = $this->__('Module can\'t be deactivated because it is a dependency of another module which is still active.');
98
+ }
99
+
100
+ return $status;
101
+ }
102
+
103
+ /**
104
+ * Retrieve a collection of all rewrites
105
+ *
106
+ * @return Varien_Data_Collection Collection
107
+ */
108
+ public function getRewriteCollection()
109
+ {
110
+ $collection = new Varien_Data_Collection();
111
+ $rewrites = $this->_loadRewrites();
112
+
113
+ foreach ($rewrites as $rewriteNodes) {
114
+ foreach ($rewriteNodes as $n) {
115
+ $nParent = $n->xpath('..');
116
+ $module = (string)$nParent[0]->getName();
117
+ $nSubParent = $nParent[0]->xpath('..');
118
+ $component = (string)$nSubParent[0]->getName();
119
+
120
+ if (!in_array($component, array('blocks', 'helpers', 'models'))) {
121
+ continue;
122
+ }
123
+
124
+ $pathNodes = $n->children();
125
+ foreach ($pathNodes as $pathNode) {
126
+ $path = (string)$pathNode->getName();
127
+ $completePath = $module . '/' . $path;
128
+
129
+ $rewriteClassName = (string)$pathNode;
130
+
131
+ $instance = Mage::getConfig()->getGroupedClassName(
132
+ substr($component, 0, -1),
133
+ $completePath
134
+ );
135
+
136
+ $collection->addItem(
137
+ new Varien_Object(
138
+ array(
139
+ 'path' => $completePath,
140
+ 'rewrite_class' => $rewriteClassName,
141
+ 'active_class' => $instance,
142
+ 'status' => ($instance == $rewriteClassName)
143
+ )
144
+ )
145
+ );
146
+ }
147
+ }
148
+ }
149
+
150
+ return $collection;
151
+ }
152
+
153
+ /**
154
+ * Return all rewrites
155
+ *
156
+ * @return array All rwrites
157
+ */
158
+ protected function _loadRewrites()
159
+ {
160
+ $fileName = 'config.xml';
161
+ $modules = Mage::getConfig()->getNode('modules')->children();
162
+
163
+ $return = array();
164
+ foreach ($modules as $modName => $module) {
165
+ if ($module->is('active')) {
166
+ $configFile = Mage::getConfig()->getModuleDir('etc', $modName) . DS . $fileName;
167
+ if (file_exists($configFile)) {
168
+ $xml = file_get_contents($configFile);
169
+ $xml = simplexml_load_string($xml);
170
+
171
+ if ($xml instanceof SimpleXMLElement) {
172
+ $return[$modName] = $xml->xpath('//rewrite');
173
+ }
174
+ }
175
+ }
176
+ }
177
+
178
+ return $return;
179
+ }
180
+
181
+ /**
182
+ * Retrieve a collection of all modules
183
+ *
184
+ * @return Varien_Data_Collection Collection
185
+ */
186
+ public function getModulesCollection()
187
+ {
188
+ $sortValue = Mage::app()->getRequest()->getParam('sort', 'name');
189
+ $sortValue = strtolower($sortValue);
190
+
191
+ $sortDir = Mage::app()->getRequest()->getParam('dir', 'ASC');
192
+ $sortDir = strtoupper($sortDir);
193
+
194
+ $modules = $this->_loadModules();
195
+ $modules = $this->sortMultiDimArr($modules, $sortValue, $sortDir);
196
+
197
+ $collection = new Varien_Data_Collection();
198
+ foreach ($modules as $val) {
199
+ $item = new Varien_Object($val);
200
+ $collection->addItem($item);
201
+ }
202
+
203
+ return $collection;
204
+ }
205
+
206
+ /**
207
+ * Loads the module configurations and checks for some criteria and
208
+ * returns an array with the current modules in the Magento instance.
209
+ *
210
+ * @return array Modules
211
+ */
212
+ protected function _loadModules()
213
+ {
214
+ $modules = array();
215
+ $config = Mage::getConfig();
216
+ foreach ($config->getNode('modules')->children() as $item) {
217
+ $active = ($item->active == 'true') ? true : false;
218
+ $codePool = (string)$config->getModuleConfig($item->getName())->codePool;
219
+ $path = $config->getOptions()->getCodeDir() . DS . $codePool . DS . uc_words($item->getName(), DS);
220
+ $pathExists = file_exists($path);
221
+ $pathExists = $pathExists ? true : false;
222
+ $configExists = file_exists($path . '/etc/config.xml');
223
+ $configExists = $configExists ? true : false;
224
+ $version = (string)$config->getModuleConfig($item->getName())->version;
225
+
226
+ $dependencies = '-';
227
+ if ($item->depends) {
228
+ $depends = array();
229
+ foreach ($item->depends->children() as $depend) {
230
+ $depends[] = $depend->getName();
231
+ }
232
+ if (is_array($depends) && count($depends) > 0) {
233
+ asort($depends);
234
+ $dependencies = implode("\n", $depends);
235
+ }
236
+ }
237
+
238
+ $modules[$item->getName()] = array(
239
+ 'name' => $item->getName(),
240
+ 'active' => $active,
241
+ 'code_pool' => $codePool,
242
+ 'path' => $path,
243
+ 'path_exists' => $pathExists,
244
+ 'config_exists' => $configExists,
245
+ 'version' => $version,
246
+ 'dependencies' => $dependencies
247
+ );
248
+ }
249
+
250
+ return $modules;
251
+ }
252
+
253
+ /**
254
+ * Retrieve a collection of all events
255
+ *
256
+ * @return Varien_Data_Collection Collection
257
+ */
258
+ public function getEventsCollection()
259
+ {
260
+ $sortValue = Mage::app()->getRequest()->getParam('sort', 'event');
261
+ $sortValue = strtolower($sortValue);
262
+
263
+ $sortDir = Mage::app()->getRequest()->getParam('dir', 'ASC');
264
+ $sortDir = strtoupper($sortDir);
265
+
266
+ $events = $this->_loadEvents();
267
+ $events = $this->sortMultiDimArr($events, $sortValue, $sortDir);
268
+
269
+ $collection = new Varien_Data_Collection();
270
+ foreach ($events as $item) {
271
+ $values = $item['children'];
272
+ if (is_array($values)) {
273
+ asort($values);
274
+ }
275
+
276
+ $val = array(
277
+ 'event' => $item['event'],
278
+ 'location' => implode("\n", $values)
279
+ );
280
+
281
+ $item = new Varien_Object($val);
282
+ $collection->addItem($item);
283
+ }
284
+
285
+ return $collection;
286
+ }
287
+
288
+ /**
289
+ * Return all events
290
+ *
291
+ * @return array All events
292
+ */
293
+ protected function _loadEvents()
294
+ {
295
+ $fileName = 'config.xml';
296
+ $modules = Mage::getConfig()->getNode('modules')->children();
297
+
298
+ $events = array();
299
+ foreach ($modules as $modName => $module) {
300
+ if ($module->is('active')) {
301
+ $configFile = Mage::getConfig()->getModuleDir('etc', $modName) . DS . $fileName;
302
+ if (file_exists($configFile)) {
303
+ $xml = file_get_contents($configFile);
304
+ $xml = simplexml_load_string($xml);
305
+
306
+ if ($xml instanceof SimpleXMLElement) {
307
+ $events[$modName] = $xml->xpath('//events');
308
+ }
309
+ }
310
+ }
311
+ }
312
+
313
+ $return = array();
314
+ foreach ($events as $eventNodes) {
315
+ foreach ($eventNodes as $n) {
316
+ $pathNodes = $n->children();
317
+
318
+ foreach ($pathNodes as $pathNode) {
319
+ $eventName = (string)$pathNode->getName();
320
+ $instance = $pathNode->xpath('observers/node()/class');
321
+ $instance = (string)current($instance);
322
+ $instance = Mage::getConfig()->getModelClassName($instance);
323
+
324
+ if (!array_key_exists($eventName, $return)) {
325
+ $return[$eventName] = array(
326
+ 'event' => $eventName,
327
+ 'children' => array()
328
+ );
329
+ }
330
+ if (!in_array($instance, $return[$eventName])) {
331
+ $return[$eventName]['children'][] = $instance;
332
+ }
333
+ }
334
+ }
335
+ }
336
+
337
+ return $return;
338
+ }
339
+
340
+ /**
341
+ * Checks if one or more caches are active
342
+ *
343
+ * @return string Cache Message
344
+ */
345
+ public function checkCaches()
346
+ {
347
+ $active = 0;
348
+ $inactive = 0;
349
+ foreach (Mage::app()->getCacheInstance()->getTypes() as $type) {
350
+ $tmp = $type->getData();
351
+ if ($tmp['status']) {
352
+ $active++;
353
+ } else {
354
+ $inactive++;
355
+ }
356
+ }
357
+
358
+ return $this->__(
359
+ '%s caches active, %s caches inactive',
360
+ $active,
361
+ $inactive
362
+ );
363
+ }
364
+
365
+ /**
366
+ * Checks if all indexes are up-to-date
367
+ *
368
+ * @return string Indexes Message
369
+ */
370
+ public function checkIndizes()
371
+ {
372
+ $ready = 0;
373
+ $processing = 0;
374
+ $reindex = 0;
375
+
376
+ $collection = Mage::getResourceModel('index/process_collection');
377
+ foreach ($collection as $item) {
378
+ $tmp = $item->getData();
379
+ if ($tmp['status'] == 'pending') {
380
+ $ready++;
381
+ } elseif ($tmp['status'] == 'working') {
382
+ $processing++;
383
+ } else {
384
+ $reindex++;
385
+ }
386
+ }
387
+
388
+ return $this->__(
389
+ '%s indexes are ready, %s indexes are working, %s indexes need reindex',
390
+ $ready,
391
+ $processing,
392
+ $reindex
393
+ );
394
+ }
395
+
396
+ /**
397
+ * Returns a small system check report with some essential properties
398
+ *
399
+ * @return array Extension Check Result
400
+ */
401
+ public function checkSystem()
402
+ {
403
+ return $this->_extensionCheck(
404
+ array(
405
+ 'curl',
406
+ 'dom',
407
+ 'gd',
408
+ 'hash',
409
+ 'iconv',
410
+ 'mcrypt',
411
+ 'pcre',
412
+ 'pdo',
413
+ 'pdo_mysql',
414
+ 'simplexml'
415
+ )
416
+ );
417
+ }
418
+
419
+ /**
420
+ * Checks some kind of essential properties
421
+ *
422
+ * @param string $extensions Extensions to check
423
+ * @return array Array with failed and passed checks
424
+ */
425
+ protected function _extensionCheck($extensions)
426
+ {
427
+ $fail = array();
428
+ $pass = array();
429
+
430
+ if (version_compare(phpversion(), '5.2.0', '<')) {
431
+ $fail[] = 'You need <strong>PHP 5.2.0</strong> (or greater)';
432
+ } else {
433
+ $pass[] = 'You have <strong>PHP 5.2.0</strong> (or greater)';
434
+ }
435
+
436
+ if (!ini_get('safe_mode')) {
437
+ $pass[] = 'Safe Mode is <strong>off</strong>';
438
+
439
+ $con = Mage::getSingleton('core/resource')->getConnection('core_read');
440
+ $version = $con->getServerVersion();
441
+
442
+ if (version_compare($version, '4.1.20', '<')) {
443
+ $fail[] = 'You need <strong>MySQL 4.1.20</strong> (or greater)';
444
+ } else {
445
+ $pass[] = 'You have <strong>MySQL 4.1.20</strong> (or greater)';
446
+ }
447
+ } else {
448
+ $fail[] = 'Safe Mode is <strong>on</strong>';
449
+ }
450
+
451
+ foreach ($extensions as $extension) {
452
+ if (!extension_loaded($extension)) {
453
+ $fail[] = 'You are missing the <strong>' . $extension . '</strong> extension';
454
+ } else {
455
+ $pass[] = 'You have the <strong>' . $extension . '</strong> extension';
456
+ }
457
+ }
458
+
459
+ return array('pass' => $pass, 'fail' => $fail);
460
+ }
461
+ }
app/code/community/ICEshop/Iceimport/Helper/System/Systemcheck.php CHANGED
@@ -1,782 +1,848 @@
1
- <?php
2
-
3
- /**
4
- * Class ICEshop_Iceimport_Helper_System_Systemcheck
5
- */
6
- class ICEshop_Iceimport_Helper_System_Systemcheck extends Mage_Core_Helper_Abstract
7
- {
8
- /**
9
- * @var Varien_Object
10
- */
11
- protected $_system;
12
-
13
- protected function _getHelper()
14
- {
15
- return Mage::helper('iceimport/system_system');
16
- }
17
-
18
- /**
19
- * @return Varien_Db_Adapter_Pdo_Mysql
20
- */
21
- protected function _getDb()
22
- {
23
- return Mage::getSingleton('core/resource')->getConnection('core_read');
24
- }
25
-
26
- /**
27
- * @return $this
28
- */
29
- public function init()
30
- {
31
- $system = new Varien_Object();
32
-
33
- /*
34
- * MAGENTO
35
- */
36
- $magento = array(
37
- 'edition' => (method_exists('Mage', 'getEdition')) ? Mage::getEdition() : '',
38
- 'version' => (method_exists('Mage', 'getVersion')) ? Mage::getVersion() : '',
39
- 'developer_mode' => (method_exists('Mage', 'getIsDeveloperMode')) ? Mage::getIsDeveloperMode() : '',
40
- 'secret_key' => (method_exists('Mage', 'getStoreConfigFlag')) ? Mage::getStoreConfigFlag('admin/security/use_form_key') : '',
41
- 'flat_catalog_category' => (method_exists('Mage', 'getStoreConfigFlag')) ? Mage::getStoreConfigFlag('catalog/frontend/flat_catalog_category') : '',
42
- 'flat_catalog_product' => (method_exists('Mage', 'getStoreConfigFlag')) ? Mage::getStoreConfigFlag('catalog/frontend/flat_catalog_product') : ''
43
- );
44
- try {
45
- $magento['cache_status'] = $this->_getHelper()->checkCaches();
46
- $magento['index_status'] = $this->_getHelper()->checkIndizes();
47
- } catch (Exception $e) {
48
- $magento['exception'][] = array(
49
- 'line' => $e->getLine(),
50
- 'file' => $e->getFile(),
51
- 'message' => $e->getMessage()
52
- );
53
- }
54
- $system->setData('magento', new Varien_Object($magento));
55
-
56
- /*
57
- * SERVER
58
- */
59
-
60
- $server = array(
61
- 'domain' => isset($_SERVER['HTTP_HOST']) ? str_replace('www.', '', $_SERVER['HTTP_HOST']) : null,
62
- 'ip' => isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : (isset($_SERVER['LOCAL_ADDR']) ? $_SERVER['LOCAL_ADDR'] : ''),
63
- 'dir' => (method_exists('Mage', 'getBaseDir')) ? Mage::getBaseDir() : '',
64
- 'info' => php_uname(),
65
-
66
- );
67
- $system->setData('server', new Varien_Object($server));
68
-
69
- /*
70
- * PHP
71
- */
72
-
73
- $php = array(
74
- 'version' => @phpversion(),
75
- 'server_api' => @php_sapi_name(),
76
- 'memory_limit' => @ini_get('memory_limit'),
77
- 'max_execution_time' => @ini_get('max_execution_time')
78
- );
79
- $system->setData('php', new Varien_Object($php));
80
-
81
- /*
82
- * MySQL
83
- */
84
-
85
- // Get MySQL Server API
86
- $connection = $this->_getDb()->getConnection();
87
- if ($connection instanceof PDO) {
88
- $mysqlServerApi = $connection->getAttribute(PDO::ATTR_CLIENT_VERSION);
89
- } else {
90
- $mysqlServerApi = 'n/a';
91
- }
92
-
93
- // Get table prefix
94
- $tablePrefix = (string)Mage::getConfig()->getTablePrefix();
95
- if (empty($tablePrefix)) {
96
- $tablePrefix = $this->__('Disabled');
97
- }
98
-
99
- // Get MySQL vars
100
- $sqlQuery = "SHOW VARIABLES;";
101
- $sqlResult = $this->_getDb()->fetchAll($sqlQuery);
102
- $mysqlVars = array();
103
- foreach ($sqlResult as $mysqlVar) {
104
- $mysqlVars[$mysqlVar['Variable_name']] = $mysqlVar['Value'];
105
- }
106
-
107
- $mysql = array(
108
- 'version' => $this->_getDb()->getServerVersion(),
109
- 'server_api' => $mysqlServerApi,
110
- 'database_name' => (string)Mage::getConfig()->getNode('global/resources/default_setup/connection/dbname'),
111
- 'database_tables' => count($this->_getDb()->listTables()),
112
- 'table_prefix' => $tablePrefix,
113
- 'connection_timeout' => $mysqlVars['connect_timeout'] . ' sec.',
114
- 'wait_timeout' => $mysqlVars['wait_timeout'] . ' sec.',
115
- 'max_allowed_packet' => array(
116
- 'current_value' => $mysqlVars['max_allowed_packet'] . ' bytes',
117
- 'recommended_value' => '>= ' . (1 * 1024 * 1024),
118
- 'result' => ($mysqlVars['max_allowed_packet'] >= (1 * 1024 * 1024)),
119
- 'label' => 'Max Allowed Packet',
120
- 'advice' => array(
121
- 'label' => $this->__('The maximum size of one packet or any generated/intermediate string.'),
122
- 'link' => 'https://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html#sysvar_max_allowed_packet'
123
- )
124
- ),
125
- 'thread_stack' => array(
126
- 'current_value' => $mysqlVars['thread_stack'] . ' bytes',
127
- 'recommended_value' => '>= ' . (192 * 1024),
128
- 'result' => ($mysqlVars['thread_stack'] >= (192 * 1024)),
129
- 'label' => 'Thread Stack',
130
- 'advice' => array(
131
- 'label' => $this->__('The stack size for each thread.'),
132
- 'link' => 'https://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html#sysvar_thread_stack'
133
- )
134
- )
135
- );
136
- $system->setData('mysql', new Varien_Object($mysql));
137
- $system->setData('mysql_vars', new Varien_Object($mysqlVars));
138
-
139
- /*
140
- * System Requirements
141
- */
142
-
143
- if (version_compare($php['version'], '5.3.0', '>=')) {
144
- $safeMode['current_value'] = 'Deprecated';
145
- $safeMode['result'] = false;
146
- } else {
147
- $safeMode['result'] = (@ini_get('safe_mode')) ? true : false;
148
- $safeMode['current_value'] = $this->renderBooleanField($safeMode['result']);
149
- }
150
- $memoryLimit = $php['memory_limit'];
151
- $memoryLimit = substr($memoryLimit, 0, strlen($memoryLimit) - 1);
152
- $phpCurl = @extension_loaded('curl');
153
- $phpDom = @extension_loaded('dom');
154
- $phpGd = @extension_loaded('gd');
155
- $phpHash = @extension_loaded('hash');
156
- $phpIconv = @extension_loaded('iconv');
157
- $phpMcrypt = @extension_loaded('mcrypt');
158
- $phpPcre = @extension_loaded('pcre');
159
- $phpPdo = @extension_loaded('pdo');
160
- $phpPdoMysql = @extension_loaded('pdo_mysql');
161
- $phpSimplexml = @extension_loaded('simplexml');
162
-
163
- $requirements = array(
164
- 'php_version' => array(
165
- 'label' => 'PHP Version',
166
- 'recommended_value' => '>= 5.3.0',
167
- 'current_value' => $php['version'],
168
- 'result' => version_compare($php['version'], '5.3.0', '>='),
169
- 'advice' => array(
170
- 'label' => $this->__('PHP version at least 5.3.0 required, recommended to use latest stable release.'),
171
- 'link' => 'http://php.net/downloads.php'
172
- )
173
- ),
174
- 'mysql_version' => array(
175
- 'label' => 'MySQL Version',
176
- 'recommended_value' => '>= 4.1.20',
177
- 'current_value' => $mysql['version'],
178
- 'result' => version_compare($mysql['version'], '4.1.20', '>='),
179
- 'advice' => array(
180
- 'label' => $this->__('MySQL version at least 4.1.20 required, recommended to use latest stable release.'),
181
- 'link' => 'http://dev.mysql.com/downloads/mysql/'
182
- )
183
- ),
184
- 'safe_mode' => array(
185
- 'label' => 'Safe Mode',
186
- 'recommended_value' => $this->renderBooleanField(false),
187
- 'current_value' => $safeMode['current_value'],
188
- 'result' => !$safeMode['result'],
189
- 'advice' => array(
190
- 'label' => $this->__('The PHP safe mode is an attempt to solve the shared-server security problem. Deprecated since PHP 5.3.0'),
191
- 'link' => 'http://www.php.net/manual/en/features.safe-mode.php'
192
- )
193
- ),
194
- 'memory_limit' => array(
195
- 'label' => 'Memory Limit',
196
- 'recommended_value' => '>= 512M',
197
- 'current_value' => $php['memory_limit'],
198
- 'result' => ($memoryLimit >= 512),
199
- 'advice' => array(
200
- 'label' => $this->__('Maximum amount of memory in bytes that a script is allowed to allocate.'),
201
- 'link' => 'http://ua2.php.net/manual/en/ini.core.php#ini.memory-limit'
202
- )
203
- ),
204
- 'max_execution_time' => array(
205
- 'label' => 'Max. Execution Time',
206
- 'recommended_value' => '>= 360 sec.',
207
- 'current_value' => $php['max_execution_time'],
208
- 'result' => ($php['max_execution_time'] >= 360),
209
- 'advice' => array(
210
- 'label' => $this->__('This sets the maximum time in seconds a script is allowed to run before it is terminated by the parser.'),
211
- 'link' => 'http://ua2.php.net/manual/en/info.configuration.php#ini.max-execution-time'
212
- )
213
- ),
214
- 'curl' => array(
215
- 'label' => 'curl',
216
- 'recommended_value' => $this->renderBooleanField(true),
217
- 'current_value' => $this->renderBooleanField($phpCurl),
218
- 'result' => $phpCurl,
219
- 'advice' => array(
220
- 'label' => $this->__('CURL is a library that allows to connect and communicate via a variety of different protocols such as HTTP, HTTPS, FTP, Telnet etc.'),
221
- 'link' => 'http://www.tomjepson.co.uk/enabling-curl-in-php-php-ini-wamp-xamp-ubuntu/'
222
- )
223
- ),
224
- 'dom' => array(
225
- 'label' => 'dom',
226
- 'recommended_value' => $this->renderBooleanField(true),
227
- 'current_value' => $this->renderBooleanField($phpDom),
228
- 'result' => $phpDom,
229
- 'advice' => array(
230
- 'label' => $this->__('The DOM extension allows to operate on XML documents through the DOM API with PHP 5.'),
231
- 'link' => 'http://www.php.net/manual/en/dom.setup.php'
232
- )
233
- ),
234
- 'gd' => array(
235
- 'label' => 'gd',
236
- 'recommended_value' => $this->renderBooleanField(true),
237
- 'current_value' => $this->renderBooleanField($phpGd),
238
- 'result' => $phpGd,
239
- 'advice' => array(
240
- 'label' => $this->__('GD is a library which supports a variety of formats, below is a list of formats supported by GD and notes to their availability including read/write support.'),
241
- 'link' => 'http://www.php.net/manual/en/image.installation.php'
242
- )
243
- ),
244
- 'hash' => array(
245
- 'label' => 'hash',
246
- 'recommended_value' => $this->renderBooleanField(true),
247
- 'current_value' => $this->renderBooleanField($phpHash),
248
- 'result' => $phpHash,
249
- 'advice' => array(
250
- 'label' => $this->__('Hash is a library which allows direct or incremental processing of arbitrary length messages using a variety of hashing algorithms.'),
251
- 'link' => 'http://www.php.net/manual/en/hash.setup.php'
252
- )
253
- ),
254
- 'iconv' => array(
255
- 'label' => 'iconv',
256
- 'recommended_value' => $this->renderBooleanField(true),
257
- 'current_value' => $this->renderBooleanField($phpIconv),
258
- 'result' => $phpIconv,
259
- 'advice' => array(
260
- 'label' => $this->__('Iconv is a module which contains an interface to iconv character set conversion facility.'),
261
- 'link' => 'http://ua1.php.net/manual/en/iconv.installation.php'
262
- )
263
- ),
264
- 'mcrypt' => array(
265
- 'label' => 'mcrypt',
266
- 'recommended_value' => $this->renderBooleanField(true),
267
- 'current_value' => $this->renderBooleanField($phpMcrypt),
268
- 'result' => $phpMcrypt,
269
- 'advice' => array(
270
- 'label' => $this->__('Mcrypt library supports a wide variety of block algorithms such as DES, TripleDES, Blowfish (default), 3-WAY, SAFER-SK64, SAFER-SK128, TWOFISH, TEA, RC2 and GOST in CBC, OFB, CFB and ECB cipher modes.'),
271
- 'link' => 'http://www.php.net/manual/en/mcrypt.installation.php'
272
- )
273
- ),
274
- 'pcre' => array(
275
- 'label' => 'pcre',
276
- 'recommended_value' => $this->renderBooleanField(true),
277
- 'current_value' => $this->renderBooleanField($phpPcre),
278
- 'result' => $phpPcre,
279
- 'advice' => array(
280
- 'label' => $this->__('The PCRE library is a set of functions that implement regular expression pattern matching using the same syntax and semantics as Perl 5, with just a few differences.'),
281
- 'link' => 'http://www.php.net/manual/en/pcre.installation.php'
282
- )
283
- ),
284
- 'pdo' => array(
285
- 'label' => 'pdo',
286
- 'recommended_value' => $this->renderBooleanField(true),
287
- 'current_value' => $this->renderBooleanField($phpPdo),
288
- 'result' => $phpPdo,
289
- 'advice' => array(
290
- 'label' => $this->__('The PHP Data Objects (PDO) extension defines a lightweight, consistent interface for accessing databases in PHP.'),
291
- 'link' => 'http://www.php.net/manual/en/pdo.installation.php'
292
- )
293
- ),
294
- 'pdo_mysql' => array(
295
- 'label' => 'pdo_mysql',
296
- 'recommended_value' => $this->renderBooleanField(true),
297
- 'current_value' => $this->renderBooleanField($phpPdoMysql),
298
- 'result' => $phpPdoMysql,
299
- 'advice' => array(
300
- 'label' => $this->__('PDO_MYSQL is a driver that implements the PHP Data Objects (PDO) interface to enable access from PHP to MySQL 3.x, 4.x and 5.x databases.'),
301
- 'link' => 'http://ua1.php.net/pdo_mysql#ref.pdo-mysql.installation'
302
- )
303
- ),
304
- 'simplexml' => array(
305
- 'label' => 'simplexml',
306
- 'recommended_value' => $this->renderBooleanField(true),
307
- 'current_value' => $this->renderBooleanField($phpSimplexml),
308
- 'result' => $phpSimplexml,
309
- 'advice' => array(
310
- 'label' => $this->__('The SimpleXML extension provides a very simple and easily usable toolset to convert XML to an object that can be processed with normal property selectors and array iterators.'),
311
- 'link' => 'http://www.php.net/manual/en/simplexml.installation.php'
312
- )
313
- )
314
- );
315
- $system->setData('requirements', new Varien_Object($requirements));
316
-
317
- $magento_api = array();
318
- $magento_api['charset'] = Mage::getStoreConfig("api/config/charset");
319
- $magento_api_session_timeout = Mage::getStoreConfig('api/config/session_timeout');
320
- $magento_api['session_timeout'] = array(
321
- 'result' => ($magento_api_session_timeout >= 3600),
322
- 'current_value' => $magento_api_session_timeout,
323
- 'label' => 'Client Session Timeout (sec.)',
324
- 'recommended_value' => '>= 3600',
325
- 'advice' => array(
326
- 'label' => $this->__('This sets the maximum time in seconds a script is allowed to use Magento Core API using one session ID.'),
327
- 'link' => 'http://www.magentocommerce.com/boards/viewthread/19445/'
328
- )
329
- );
330
- $magento_api['compliance_wsi'] = Mage::getStoreConfig(Mage_Api_Helper_Data::XML_PATH_API_WSI);;
331
- $magento_api['wsdl_cache_enabled'] = Mage::getStoreConfig('api/config/wsdl_cache_enabled');
332
- $system->setData('magento_api', new Varien_Object($magento_api));
333
-
334
- $this->_system = $system;
335
-
336
- return $this;
337
- }
338
-
339
- /**
340
- * @return Varien_Object
341
- */
342
- public function getSystem()
343
- {
344
- return $this->_system;
345
- }
346
-
347
- /**
348
- * @param boolean $value
349
- * @return string
350
- */
351
- public function renderBooleanField($value)
352
- {
353
- if ($value) {
354
- return $this->__('Enabled');
355
- }
356
- return $this->__('Disabled');
357
- }
358
-
359
- /**
360
- * @param $result
361
- * @return string
362
- */
363
- public function renderRequirementValue($result)
364
- {
365
- if ($result) {
366
- return 'requirement-passed';
367
- }
368
- return 'requirement-failed';
369
- }
370
-
371
- /**
372
- * @param $result
373
- * @return string
374
- */
375
- public function renderStatusField($value)
376
- {
377
- if ($value) {
378
- return $this->__('Ok');
379
- }
380
- return $this->__('Error');
381
- }
382
-
383
- public function renderAdvice($value)
384
- {
385
- if (!empty($value) && !empty($value['advice'])) {
386
- return '<a ' . (!empty($value['advice']['link']) ? 'href="' . $value['advice']['link'] . '" target="_blank"' : 'href="#"') . '" class="iceimport-advice" title="' . $value['advice']['label'] . '"></a>';
387
- }
388
- return '';
389
- }
390
-
391
- /**
392
- * Retrieve a collection of all modules
393
- *
394
- * @return Varien_Data_Collection Collection
395
- */
396
- public function getModulesCollection($exact = false)
397
- {
398
- $sortValue = Mage::app()->getRequest()->getParam('sort', 'name');
399
- $sortValue = strtolower($sortValue);
400
-
401
- $sortDir = Mage::app()->getRequest()->getParam('dir', 'ASC');
402
- $sortDir = strtoupper($sortDir);
403
-
404
- $modules = $this->_loadModules($exact);
405
- $modules = Mage::helper('iceimport')->sortMultiDimArr($modules, $sortValue, $sortDir);
406
-
407
- $collection = new Varien_Data_Collection();
408
- foreach ($modules as $key => $val) {
409
- $item = new Varien_Object($val);
410
- $collection->addItem($item);
411
- }
412
-
413
- return $collection;
414
- }
415
-
416
- /**
417
- * Loads the module configurations and checks for some criteria and
418
- * returns an array with the current modules in the Magento instance.
419
- *
420
- * @return array Modules
421
- */
422
- protected function _loadModules($exact = false)
423
- {
424
- $modules = array();
425
- $config = Mage::getConfig();
426
- foreach ($config->getNode('modules')->children() as $moduleName => $item) {
427
- if (!empty($exact) && strlen($exact) != 0) {
428
- if (strpos(strtolower($moduleName), strtolower($exact)) === false) {
429
- continue;
430
- }
431
- }
432
- $active = ($item->active == 'true') ? true : false;
433
- $codePool = (string)$config->getModuleConfig($item->getName())->codePool;
434
- $path = $config->getOptions()->getCodeDir() . DS . $codePool . DS . uc_words($item->getName(), DS);
435
- $pathExists = file_exists($path);
436
- $pathExists = $pathExists ? true : false;
437
- $configExists = file_exists($path . '/etc/config.xml');
438
- $configExists = $configExists ? true : false;
439
- $version = (string)$config->getModuleConfig($item->getName())->version;
440
- $dependencies = '-';
441
- if ($item->depends) {
442
- $depends = array();
443
- foreach ($item->depends->children() as $depend) {
444
- $depends[] = $depend->getName();
445
- }
446
- if (is_array($depends) && count($depends) > 0) {
447
- asort($depends);
448
- $dependencies = implode("\n", $depends);
449
- }
450
- }
451
-
452
- $modules[$item->getName()] = array(
453
- 'name' => $item->getName(),
454
- 'active' => $active,
455
- 'code_pool' => $codePool,
456
- 'path' => $path,
457
- 'path_exists' => $pathExists,
458
- 'config_exists' => $configExists,
459
- 'version' => $version,
460
- 'dependencies' => $dependencies
461
- );
462
- }
463
-
464
- return $modules;
465
- }
466
-
467
-
468
- /**
469
- * Retrieve a collection of all rewrites
470
- *
471
- * @return Varien_Data_Collection Collection
472
- */
473
- public function getRewriteCollection($exact = false)
474
- {
475
- $collection = new Varien_Data_Collection();
476
- $rewrites = $this->_loadRewrites();
477
-
478
- foreach ($rewrites as $rewriteNodes) {
479
- foreach ($rewriteNodes as $n) {
480
- $nParent = $n->xpath('..');
481
- $module = (string)$nParent[0]->getName();
482
- $nSubParent = $nParent[0]->xpath('..');
483
- $component = (string)$nSubParent[0]->getName();
484
-
485
- if (!in_array($component, array('blocks', 'helpers', 'models'))) {
486
- continue;
487
- }
488
-
489
- $pathNodes = $n->children();
490
- foreach ($pathNodes as $pathNode) {
491
- $path = (string)$pathNode->getName();
492
- $completePath = $module . '/' . $path;
493
- $rewriteClassName = (string)$pathNode;
494
-
495
- if (!empty($exact) && strlen($exact) != 0) {
496
- if ((strpos(strtolower($completePath), strtolower($exact)) === false)
497
- && (strpos(strtolower($rewriteClassName), strtolower($exact)) === false)
498
- ) {
499
- continue;
500
- }
501
- }
502
-
503
- $instance = Mage::getConfig()->getGroupedClassName(
504
- substr($component, 0, -1),
505
- $completePath
506
- );
507
-
508
- $collection->addItem(
509
- new Varien_Object(
510
- array(
511
- 'path' => $completePath,
512
- 'rewrite_class' => $rewriteClassName,
513
- 'active_class' => $instance,
514
- 'status' => ($instance == $rewriteClassName)
515
- )
516
- )
517
- );
518
- }
519
- }
520
- }
521
-
522
- return $collection;
523
- }
524
-
525
- /**
526
- * Return all rewrites
527
- *
528
- * @return array All rwrites
529
- */
530
- protected function _loadRewrites()
531
- {
532
- $fileName = 'config.xml';
533
- $modules = Mage::getConfig()->getNode('modules')->children();
534
-
535
- $return = array();
536
- foreach ($modules as $modName => $module) {
537
- if ($module->is('active')) {
538
- $configFile = Mage::getConfig()->getModuleDir('etc', $modName) . DS . $fileName;
539
- if (file_exists($configFile)) {
540
- $xml = file_get_contents($configFile);
541
- $xml = simplexml_load_string($xml);
542
-
543
- if ($xml instanceof SimpleXMLElement) {
544
- $return[$modName] = $xml->xpath('//rewrite');
545
- }
546
- }
547
- }
548
- }
549
-
550
- return $return;
551
- }
552
-
553
- /**
554
- * @return Varien_Object
555
- */
556
- public function getExtensionProblemsDigest()
557
- {
558
- $DB_logger = Mage::helper('iceimport/db');
559
- $skip_data = $DB_logger->getLogEntryByKey('iceimport_skip_problems_digest');
560
- $skip_data_empty = FALSE;
561
- if(!empty($skip_data['log_value'])){
562
- $skip_data_empty = true;
563
- $skip_data = (array)json_decode($skip_data['log_value']);
564
- }
565
-
566
- $problems = array();
567
- $count = 0;
568
- //extension problems
569
- $check_module = $this->getModulesCollection('ICEshop_Iceimport');
570
- $check_module = $check_module->getLastItem()->getData();
571
-
572
- if ($check_module['path_exists'] == 0) {
573
- $path_exist_flag = true;
574
- if($skip_data_empty && !empty($skip_data['extension'])){
575
- foreach ($skip_data['extension'] as $key=>$value){
576
- if($value=='path_exists'){
577
- $path_exist_flag =false;
578
- }
579
- }
580
- }
581
- if($path_exist_flag){
582
- $problems['extension']['path_exists'] = $check_module['path_exists'];
583
- $count++;
584
- }
585
- }
586
- if ($check_module['config_exists'] == 0) {
587
- $path_exist_flag = true;
588
- if($skip_data_empty && !empty($skip_data['extension'])){
589
- foreach ($skip_data['extension'] as $key=>$value){
590
- if($value=='config_exists'){
591
- $path_exist_flag =false;
592
- }
593
- }
594
- }
595
- if($path_exist_flag){
596
- $problems['extension']['config_exists'] = $check_module['config_exists'];
597
- $count++;
598
- }
599
- }
600
-
601
- //extension rewrites problems
602
- $check_rewrites = $this->getRewriteCollection('ICEshop_Iceimport');
603
- foreach ($check_rewrites as $rewrite) {
604
- if (!$rewrite['status']) {
605
- $problems['rewrite'][] = $rewrite;
606
- $count++;
607
- }
608
- }
609
-
610
- if($skip_data_empty && !empty($skip_data['rewrite'])){
611
- foreach ($skip_data['rewrite'] as $key=>$value){
612
- if(!empty($problems['rewrite'][$value])){
613
- unset($problems['rewrite'][$value]);
614
- $count--;
615
- }
616
- }
617
- }
618
-
619
- //system requirements (for magento/extension)
620
- $requirements = $this->getSystem()->getRequirements()->getData();
621
- foreach ($requirements as $requirement) {
622
- if (!$requirement['result']) {
623
- $requirement_flag = true;
624
- if($skip_data_empty && !empty($skip_data['requirement'])){
625
- foreach ($skip_data['requirement'] as $key=>$value){
626
- if($value==$requirement['label']){
627
- $requirement_flag =false;
628
- }
629
- }
630
- }
631
- if($requirement_flag){
632
- $problems['requirement'][] = $requirement;
633
- $count++;
634
- }
635
- }
636
- }
637
-
638
- //magento API problems
639
- $magento_api_session_timeout = $this->getSystem()->getMagentoApi()->getSessionTimeout();
640
- if (!$magento_api_session_timeout['result']) {
641
- $api_skip_flag = true;
642
- if($skip_data_empty && !empty($skip_data['api'])){
643
- foreach ($skip_data['api'] as $key=>$value){
644
- if($value=='timeout'){
645
- $api_skip_flag =false;
646
- }
647
- }
648
- }
649
- if($api_skip_flag){
650
- $problems['api']['timeout'] = $magento_api_session_timeout;
651
- $count++;
652
- }
653
- }
654
-
655
- $mysql = $this->getSystem()->getMysql()->getData();
656
- foreach ($mysql as $mysql_param_name => $mysql_param_value) {
657
- if (is_array($mysql_param_value) && !$mysql_param_value['result']) {
658
- $mysql_skip_flag = true;
659
- if($skip_data_empty && !empty($skip_data['mysql'])){
660
- foreach ($skip_data['mysql'] as $key=>$value){
661
- if($value==$mysql_param_name){
662
- $mysql_skip_flag =false;
663
- }
664
- }
665
- }
666
- if($mysql_skip_flag){
667
- $problems['mysql'][$mysql_param_name] = $mysql_param_value;
668
- $count++;
669
- }
670
- }
671
- }
672
-
673
- $log_feed = $DB_logger->getLogByType('report', false, 10);
674
- if (!empty($log_feed) && count($log_feed) > 0) {
675
- foreach($log_feed as $log_entry) {
676
- $problems['iceimport_log'][] = array(
677
- 'label' => 'Iceimport Error',
678
- 'current_value' => $log_entry['log_value']
679
- );
680
- $count++;
681
- }
682
- }
683
-
684
- if($skip_data_empty && !empty($skip_data['iceimport_log'])){
685
- foreach ($skip_data['iceimport_log'] as $key=>$value){
686
- if(!empty($problems['iceimport_log'][$value])){
687
- unset($problems['iceimport_log'][$value]);
688
- $count--;
689
- }
690
- }
691
- }
692
-
693
- $try_delete_product = $DB_logger->getLogEntryByKey('error_try_delete_product');
694
- $delete_product_percentage = $DB_logger->getLogEntryByKey('error_try_delete_product_percentage');
695
- if(!empty($delete_product_percentage) && !empty($try_delete_product)) {
696
- $iceimport_delete_product_skip_flag = true;
697
- if($skip_data_empty && !empty($skip_data['iceimport_delete_product'])){
698
- foreach ($skip_data['iceimport_delete_product'] as $key=>$value){
699
- if($value=='delete_product'){
700
- $iceimport_delete_product_skip_flag =false;
701
- }
702
- }
703
- }
704
- if($iceimport_delete_product_skip_flag){
705
- $problems['iceimport_delete_product']['delete_product'] = array(
706
- 'label' => 'There is a problem during last import',
707
- 'current_value' => $try_delete_product['log_value'].$delete_product_percentage['log_value']
708
- );
709
- $count++;
710
- }
711
- }
712
-
713
- $problems_digest = new Varien_Object();
714
- $problems_digest->setData('problems', $problems);
715
- $problems_digest->setData('count', $count);
716
- return $problems_digest;
717
- }
718
-
719
- /**
720
- * Set warning message for extension
721
- *
722
- * @param String $massage
723
- */
724
- public function setWarningIceimport($massage){
725
- Mage::getSingleton('adminhtml/session')->addNotice('Warning!'.$massage);
726
- }
727
-
728
- /**
729
- * Check skip wrning iceimport
730
- * @return boolean
731
- */
732
- public function checkSetWarning(){
733
- $DB_logger = Mage::helper('iceimport/db');
734
- $skip_data = $DB_logger->getLogEntryByKey('iceimport_skip_problems_digest');
735
- if(empty($skip_data['log_value'])){
736
- return true;
737
- } else {
738
- return false;
739
- }
740
- }
741
-
742
-
743
- /**
744
- * Method return import images statistics
745
- * @return string
746
- */
747
- public function getImagesStatistics(){
748
- try{
749
- $db_res = Mage::getSingleton('core/resource')->getConnection('core_write');
750
- $tablePrefix = '';
751
- $tPrefix = (array)Mage::getConfig()->getTablePrefix();
752
- if (!empty($tPrefix)) {
753
- $tablePrefix = $tPrefix[0];
754
- }
755
- $statistic_check = array();
756
- $statistic_check['total_entries']['type'] = 'total_entries';
757
- $statistic_check['total_entries']['label'] = 'Total Images Entries:';
758
- $count_value = $db_res->fetchRow("SELECT COUNT(*) FROM `{$tablePrefix}iceshop_iceimport_image_queue`");
759
- $total_entries = $count_value['COUNT(*)'];
760
- $statistic_check['total_entries']['value'] = $total_entries;
761
-
762
- $statistic_check['total_download']['type'] = 'total_download';
763
- $statistic_check['total_download']['label'] = 'Total Images Downloaded:';
764
- $count_value = $db_res->fetchRow("SELECT COUNT(*) FROM `{$tablePrefix}iceshop_iceimport_image_queue` WHERE `is_downloaded` = 1");
765
- $statistic_check['total_download']['value'] = $count_value['COUNT(*)'] . " ( " . round($count_value['COUNT(*)'] * 100 / $total_entries, 2) . "% )";
766
-
767
- $statistic_check['total_waiting_download']['type'] = 'total_waiting_download';
768
- $statistic_check['total_waiting_download']['label'] = 'Images Waiting Download:';
769
- $count_value = $db_res->fetchRow("SELECT COUNT(*) FROM `{$tablePrefix}iceshop_iceimport_image_queue` WHERE `is_downloaded` = 0");
770
- $statistic_check['total_waiting_download']['value'] = $count_value['COUNT(*)'] . " ( " . round($count_value['COUNT(*)'] * 100 / $total_entries, 2) . "% )";
771
-
772
- $statistic_check['total_error_download']['type'] = 'total_error_download';
773
- $statistic_check['total_error_download']['label'] = 'Images Download Error:';
774
- $count_value = $db_res->fetchRow("SELECT COUNT(*) FROM `{$tablePrefix}iceshop_iceimport_image_queue` WHERE `is_downloaded` = 2");
775
- $statistic_check['total_error_download']['value'] = $count_value['COUNT(*)'] . " ( " . round($count_value['COUNT(*)'] * 100 / $total_entries, 2) . "% )";
776
-
777
- return $statistic_check;
778
- } catch (Exception $e){
779
- }
780
- }
781
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
782
  }
1
+ <?php
2
+
3
+ /**
4
+ * Class ICEshop_Iceimport_Helper_System_Systemcheck
5
+ */
6
+ class ICEshop_Iceimport_Helper_System_Systemcheck extends Mage_Core_Helper_Abstract
7
+ {
8
+ /**
9
+ * @var Varien_Object
10
+ */
11
+ protected $_system;
12
+
13
+ protected function _getHelper()
14
+ {
15
+ return Mage::helper('iceimport/system_system');
16
+ }
17
+
18
+ /**
19
+ * @return Varien_Db_Adapter_Pdo_Mysql
20
+ */
21
+ protected function _getDb()
22
+ {
23
+ return Mage::getSingleton('core/resource')->getConnection('core_read');
24
+ }
25
+
26
+ /**
27
+ * @return $this
28
+ */
29
+ public function init()
30
+ {
31
+ $system = new Varien_Object();
32
+
33
+ /*
34
+ * MAGENTO
35
+ */
36
+ $magento = array(
37
+ 'edition' => (method_exists('Mage', 'getEdition')) ? Mage::getEdition() : '',
38
+ 'version' => (method_exists('Mage', 'getVersion')) ? Mage::getVersion() : '',
39
+ 'developer_mode' => (method_exists('Mage', 'getIsDeveloperMode')) ? Mage::getIsDeveloperMode() : '',
40
+ 'secret_key' => (method_exists('Mage', 'getStoreConfigFlag')) ? Mage::getStoreConfigFlag('admin/security/use_form_key') : '',
41
+ 'flat_catalog_category' => (method_exists('Mage', 'getStoreConfigFlag')) ? Mage::getStoreConfigFlag('catalog/frontend/flat_catalog_category') : '',
42
+ 'flat_catalog_product' => (method_exists('Mage', 'getStoreConfigFlag')) ? Mage::getStoreConfigFlag('catalog/frontend/flat_catalog_product') : ''
43
+ );
44
+ try {
45
+ $magento['cache_status'] = $this->_getHelper()->checkCaches();
46
+ $magento['index_status'] = $this->_getHelper()->checkIndizes();
47
+ } catch (Exception $e) {
48
+ $magento['exception'][] = array(
49
+ 'line' => $e->getLine(),
50
+ 'file' => $e->getFile(),
51
+ 'message' => $e->getMessage()
52
+ );
53
+ }
54
+ $system->setData('magento', new Varien_Object($magento));
55
+
56
+ /*
57
+ * SERVER
58
+ */
59
+
60
+ $server = array(
61
+ 'domain' => isset($_SERVER['HTTP_HOST']) ? str_replace('www.', '', $_SERVER['HTTP_HOST']) : null,
62
+ 'ip' => isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : (isset($_SERVER['LOCAL_ADDR']) ? $_SERVER['LOCAL_ADDR'] : ''),
63
+ 'dir' => (method_exists('Mage', 'getBaseDir')) ? Mage::getBaseDir() : '',
64
+ 'info' => php_uname(),
65
+
66
+ );
67
+ $system->setData('server', new Varien_Object($server));
68
+
69
+ /*
70
+ * PHP
71
+ */
72
+
73
+ $php = array(
74
+ 'version' => @phpversion(),
75
+ 'server_api' => @php_sapi_name(),
76
+ 'memory_limit' => @ini_get('memory_limit'),
77
+ 'max_execution_time' => @ini_get('max_execution_time')
78
+ );
79
+ $system->setData('php', new Varien_Object($php));
80
+
81
+ /*
82
+ * MySQL
83
+ */
84
+
85
+ // Get MySQL Server API
86
+ $connection = $this->_getDb()->getConnection();
87
+ if ($connection instanceof PDO) {
88
+ $mysqlServerApi = $connection->getAttribute(PDO::ATTR_CLIENT_VERSION);
89
+ } else {
90
+ $mysqlServerApi = 'n/a';
91
+ }
92
+
93
+ // Get table prefix
94
+ $tablePrefix = (string)Mage::getConfig()->getTablePrefix();
95
+ if (empty($tablePrefix)) {
96
+ $tablePrefix = $this->__('Disabled');
97
+ }
98
+
99
+ // Get MySQL vars
100
+ $sqlQuery = "SHOW VARIABLES;";
101
+ $sqlResult = $this->_getDb()->fetchAll($sqlQuery);
102
+ $mysqlVars = array();
103
+ foreach ($sqlResult as $mysqlVar) {
104
+ $mysqlVars[$mysqlVar['Variable_name']] = $mysqlVar['Value'];
105
+ }
106
+
107
+ $mysql = array(
108
+ 'version' => $this->_getDb()->getServerVersion(),
109
+ 'server_api' => $mysqlServerApi,
110
+ 'database_name' => (string)Mage::getConfig()->getNode('global/resources/default_setup/connection/dbname'),
111
+ 'database_tables' => count($this->_getDb()->listTables()),
112
+ 'table_prefix' => $tablePrefix,
113
+ 'connection_timeout' => $mysqlVars['connect_timeout'] . ' sec.',
114
+ 'wait_timeout' => $mysqlVars['wait_timeout'] . ' sec.',
115
+ 'max_allowed_packet' => array(
116
+ 'current_value' => $mysqlVars['max_allowed_packet'] . ' bytes',
117
+ 'recommended_value' => '>= ' . (1 * 1024 * 1024),
118
+ 'result' => ($mysqlVars['max_allowed_packet'] >= (1 * 1024 * 1024)),
119
+ 'label' => 'Max Allowed Packet',
120
+ 'advice' => array(
121
+ 'label' => $this->__('The maximum size of one packet or any generated/intermediate string.'),
122
+ 'link' => 'https://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html#sysvar_max_allowed_packet'
123
+ )
124
+ ),
125
+ 'thread_stack' => array(
126
+ 'current_value' => $mysqlVars['thread_stack'] . ' bytes',
127
+ 'recommended_value' => '>= ' . (192 * 1024),
128
+ 'result' => ($mysqlVars['thread_stack'] >= (192 * 1024)),
129
+ 'label' => 'Thread Stack',
130
+ 'advice' => array(
131
+ 'label' => $this->__('The stack size for each thread.'),
132
+ 'link' => 'https://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html#sysvar_thread_stack'
133
+ )
134
+ )
135
+ );
136
+ $system->setData('mysql', new Varien_Object($mysql));
137
+ $system->setData('mysql_vars', new Varien_Object($mysqlVars));
138
+
139
+ /*
140
+ * System Requirements
141
+ */
142
+
143
+ if (version_compare($php['version'], '5.3.0', '>=')) {
144
+ $safeMode['current_value'] = 'Deprecated';
145
+ $safeMode['result'] = false;
146
+ } else {
147
+ $safeMode['result'] = (@ini_get('safe_mode')) ? true : false;
148
+ $safeMode['current_value'] = $this->renderBooleanField($safeMode['result']);
149
+ }
150
+ $memoryLimit = $php['memory_limit'];
151
+ $memoryLimit = substr($memoryLimit, 0, strlen($memoryLimit) - 1);
152
+ $phpCurl = @extension_loaded('curl');
153
+ $phpDom = @extension_loaded('dom');
154
+ $phpGd = @extension_loaded('gd');
155
+ $phpHash = @extension_loaded('hash');
156
+ $phpIconv = @extension_loaded('iconv');
157
+ $phpMcrypt = @extension_loaded('mcrypt');
158
+ $phpPcre = @extension_loaded('pcre');
159
+ $phpPdo = @extension_loaded('pdo');
160
+ $phpPdoMysql = @extension_loaded('pdo_mysql');
161
+ $phpSimplexml = @extension_loaded('simplexml');
162
+
163
+ $requirements = array(
164
+ 'php_version' => array(
165
+ 'label' => 'PHP Version',
166
+ 'recommended_value' => '>= 5.3.0',
167
+ 'current_value' => $php['version'],
168
+ 'result' => version_compare($php['version'], '5.3.0', '>='),
169
+ 'advice' => array(
170
+ 'label' => $this->__('PHP version at least 5.3.0 required, recommended to use latest stable release.'),
171
+ 'link' => 'http://php.net/downloads.php'
172
+ )
173
+ ),
174
+ 'mysql_version' => array(
175
+ 'label' => 'MySQL Version',
176
+ 'recommended_value' => '>= 4.1.20',
177
+ 'current_value' => $mysql['version'],
178
+ 'result' => version_compare($mysql['version'], '4.1.20', '>='),
179
+ 'advice' => array(
180
+ 'label' => $this->__('MySQL version at least 4.1.20 required, recommended to use latest stable release.'),
181
+ 'link' => 'http://dev.mysql.com/downloads/mysql/'
182
+ )
183
+ ),
184
+ 'safe_mode' => array(
185
+ 'label' => 'Safe Mode',
186
+ 'recommended_value' => $this->renderBooleanField(false),
187
+ 'current_value' => $safeMode['current_value'],
188
+ 'result' => !$safeMode['result'],
189
+ 'advice' => array(
190
+ 'label' => $this->__('The PHP safe mode is an attempt to solve the shared-server security problem. Deprecated since PHP 5.3.0'),
191
+ 'link' => 'http://www.php.net/manual/en/features.safe-mode.php'
192
+ )
193
+ ),
194
+ 'memory_limit' => array(
195
+ 'label' => 'Memory Limit',
196
+ 'recommended_value' => '>= 512M',
197
+ 'current_value' => $php['memory_limit'],
198
+ 'result' => ($this->checkMemoryLimit($php['memory_limit'], (int)512)),
199
+ 'advice' => array(
200
+ 'label' => $this->__('Maximum amount of memory in bytes that a script is allowed to allocate.'),
201
+ 'link' => 'http://ua2.php.net/manual/en/ini.core.php#ini.memory-limit'
202
+ )
203
+ ),
204
+ 'max_execution_time' => array(
205
+ 'label' => 'Max. Execution Time',
206
+ 'recommended_value' => '>= 360 sec.',
207
+ 'current_value' => $php['max_execution_time'],
208
+ 'result' => ($php['max_execution_time'] >= 360),
209
+ 'advice' => array(
210
+ 'label' => $this->__('This sets the maximum time in seconds a script is allowed to run before it is terminated by the parser.'),
211
+ 'link' => 'http://ua2.php.net/manual/en/info.configuration.php#ini.max-execution-time'
212
+ )
213
+ ),
214
+ 'curl' => array(
215
+ 'label' => 'curl',
216
+ 'recommended_value' => $this->renderBooleanField(true),
217
+ 'current_value' => $this->renderBooleanField($phpCurl),
218
+ 'result' => $phpCurl,
219
+ 'advice' => array(
220
+ 'label' => $this->__('CURL is a library that allows to connect and communicate via a variety of different protocols such as HTTP, HTTPS, FTP, Telnet etc.'),
221
+ 'link' => 'http://www.tomjepson.co.uk/enabling-curl-in-php-php-ini-wamp-xamp-ubuntu/'
222
+ )
223
+ ),
224
+ 'dom' => array(
225
+ 'label' => 'dom',
226
+ 'recommended_value' => $this->renderBooleanField(true),
227
+ 'current_value' => $this->renderBooleanField($phpDom),
228
+ 'result' => $phpDom,
229
+ 'advice' => array(
230
+ 'label' => $this->__('The DOM extension allows to operate on XML documents through the DOM API with PHP 5.'),
231
+ 'link' => 'http://www.php.net/manual/en/dom.setup.php'
232
+ )
233
+ ),
234
+ 'gd' => array(
235
+ 'label' => 'gd',
236
+ 'recommended_value' => $this->renderBooleanField(true),
237
+ 'current_value' => $this->renderBooleanField($phpGd),
238
+ 'result' => $phpGd,
239
+ 'advice' => array(
240
+ 'label' => $this->__('GD is a library which supports a variety of formats, below is a list of formats supported by GD and notes to their availability including read/write support.'),
241
+ 'link' => 'http://www.php.net/manual/en/image.installation.php'
242
+ )
243
+ ),
244
+ 'hash' => array(
245
+ 'label' => 'hash',
246
+ 'recommended_value' => $this->renderBooleanField(true),
247
+ 'current_value' => $this->renderBooleanField($phpHash),
248
+ 'result' => $phpHash,
249
+ 'advice' => array(
250
+ 'label' => $this->__('Hash is a library which allows direct or incremental processing of arbitrary length messages using a variety of hashing algorithms.'),
251
+ 'link' => 'http://www.php.net/manual/en/hash.setup.php'
252
+ )
253
+ ),
254
+ 'iconv' => array(
255
+ 'label' => 'iconv',
256
+ 'recommended_value' => $this->renderBooleanField(true),
257
+ 'current_value' => $this->renderBooleanField($phpIconv),
258
+ 'result' => $phpIconv,
259
+ 'advice' => array(
260
+ 'label' => $this->__('Iconv is a module which contains an interface to iconv character set conversion facility.'),
261
+ 'link' => 'http://ua1.php.net/manual/en/iconv.installation.php'
262
+ )
263
+ ),
264
+ 'mcrypt' => array(
265
+ 'label' => 'mcrypt',
266
+ 'recommended_value' => $this->renderBooleanField(true),
267
+ 'current_value' => $this->renderBooleanField($phpMcrypt),
268
+ 'result' => $phpMcrypt,
269
+ 'advice' => array(
270
+ 'label' => $this->__('Mcrypt library supports a wide variety of block algorithms such as DES, TripleDES, Blowfish (default), 3-WAY, SAFER-SK64, SAFER-SK128, TWOFISH, TEA, RC2 and GOST in CBC, OFB, CFB and ECB cipher modes.'),
271
+ 'link' => 'http://www.php.net/manual/en/mcrypt.installation.php'
272
+ )
273
+ ),
274
+ 'pcre' => array(
275
+ 'label' => 'pcre',
276
+ 'recommended_value' => $this->renderBooleanField(true),
277
+ 'current_value' => $this->renderBooleanField($phpPcre),
278
+ 'result' => $phpPcre,
279
+ 'advice' => array(
280
+ 'label' => $this->__('The PCRE library is a set of functions that implement regular expression pattern matching using the same syntax and semantics as Perl 5, with just a few differences.'),
281
+ 'link' => 'http://www.php.net/manual/en/pcre.installation.php'
282
+ )
283
+ ),
284
+ 'pdo' => array(
285
+ 'label' => 'pdo',
286
+ 'recommended_value' => $this->renderBooleanField(true),
287
+ 'current_value' => $this->renderBooleanField($phpPdo),
288
+ 'result' => $phpPdo,
289
+ 'advice' => array(
290
+ 'label' => $this->__('The PHP Data Objects (PDO) extension defines a lightweight, consistent interface for accessing databases in PHP.'),
291
+ 'link' => 'http://www.php.net/manual/en/pdo.installation.php'
292
+ )
293
+ ),
294
+ 'pdo_mysql' => array(
295
+ 'label' => 'pdo_mysql',
296
+ 'recommended_value' => $this->renderBooleanField(true),
297
+ 'current_value' => $this->renderBooleanField($phpPdoMysql),
298
+ 'result' => $phpPdoMysql,
299
+ 'advice' => array(
300
+ 'label' => $this->__('PDO_MYSQL is a driver that implements the PHP Data Objects (PDO) interface to enable access from PHP to MySQL 3.x, 4.x and 5.x databases.'),
301
+ 'link' => 'http://ua1.php.net/pdo_mysql#ref.pdo-mysql.installation'
302
+ )
303
+ ),
304
+ 'simplexml' => array(
305
+ 'label' => 'simplexml',
306
+ 'recommended_value' => $this->renderBooleanField(true),
307
+ 'current_value' => $this->renderBooleanField($phpSimplexml),
308
+ 'result' => $phpSimplexml,
309
+ 'advice' => array(
310
+ 'label' => $this->__('The SimpleXML extension provides a very simple and easily usable toolset to convert XML to an object that can be processed with normal property selectors and array iterators.'),
311
+ 'link' => 'http://www.php.net/manual/en/simplexml.installation.php'
312
+ )
313
+ )
314
+ );
315
+ $system->setData('requirements', new Varien_Object($requirements));
316
+
317
+ $magento_api = array();
318
+ $magento_api['charset'] = Mage::getStoreConfig("api/config/charset");
319
+ $magento_api_session_timeout = Mage::getStoreConfig('api/config/session_timeout');
320
+ $magento_api['session_timeout'] = array(
321
+ 'result' => ($magento_api_session_timeout >= 3600),
322
+ 'current_value' => $magento_api_session_timeout,
323
+ 'label' => 'Client Session Timeout (sec.)',
324
+ 'recommended_value' => '>= 3600',
325
+ 'advice' => array(
326
+ 'label' => $this->__('This sets the maximum time in seconds a script is allowed to use Magento Core API using one session ID.'),
327
+ 'link' => 'http://www.magentocommerce.com/boards/viewthread/19445/'
328
+ )
329
+ );
330
+ $magento_api['compliance_wsi'] = Mage::getStoreConfig(Mage_Api_Helper_Data::XML_PATH_API_WSI);;
331
+ $magento_api['wsdl_cache_enabled'] = Mage::getStoreConfig('api/config/wsdl_cache_enabled');
332
+ $system->setData('magento_api', new Varien_Object($magento_api));
333
+
334
+ $this->_system = $system;
335
+
336
+ return $this;
337
+ }
338
+
339
+ /**
340
+ * @return Varien_Object
341
+ */
342
+ public function getSystem()
343
+ {
344
+ return $this->_system;
345
+ }
346
+
347
+ /**
348
+ * @param boolean $value
349
+ * @return string
350
+ */
351
+ public function renderBooleanField($value)
352
+ {
353
+ if ($value) {
354
+ return $this->__('Enabled');
355
+ }
356
+ return $this->__('Disabled');
357
+ }
358
+
359
+ /**
360
+ * @param $result
361
+ * @return string
362
+ */
363
+ public function renderRequirementValue($result)
364
+ {
365
+ if ($result) {
366
+ return 'requirement-passed';
367
+ }
368
+ return 'requirement-failed';
369
+ }
370
+
371
+ /**
372
+ * @param $result
373
+ * @return string
374
+ */
375
+ public function renderStatusField($value)
376
+ {
377
+ if ($value) {
378
+ return $this->__('Ok');
379
+ }
380
+ return $this->__('Error');
381
+ }
382
+
383
+ public function renderAdvice($value)
384
+ {
385
+ if (!empty($value) && !empty($value['advice'])) {
386
+ return '<a ' . (!empty($value['advice']['link']) ? 'href="' . $value['advice']['link'] . '" target="_blank"' : 'href="#"') . '" class="iceimport-advice" title="' . $value['advice']['label'] . '"></a>';
387
+ }
388
+ return '';
389
+ }
390
+
391
+ /**
392
+ * Retrieve a collection of all modules
393
+ *
394
+ * @return Varien_Data_Collection Collection
395
+ */
396
+ public function getModulesCollection($exact = false)
397
+ {
398
+ $sortValue = Mage::app()->getRequest()->getParam('sort', 'name');
399
+ $sortValue = strtolower($sortValue);
400
+
401
+ $sortDir = Mage::app()->getRequest()->getParam('dir', 'ASC');
402
+ $sortDir = strtoupper($sortDir);
403
+
404
+ $modules = $this->_loadModules($exact);
405
+ $modules = Mage::helper('iceimport')->sortMultiDimArr($modules, $sortValue, $sortDir);
406
+
407
+ $collection = new Varien_Data_Collection();
408
+ foreach ($modules as $key => $val) {
409
+ $item = new Varien_Object($val);
410
+ $collection->addItem($item);
411
+ }
412
+
413
+ return $collection;
414
+ }
415
+
416
+ /**
417
+ * Loads the module configurations and checks for some criteria and
418
+ * returns an array with the current modules in the Magento instance.
419
+ *
420
+ * @return array Modules
421
+ */
422
+ protected function _loadModules($exact = false)
423
+ {
424
+ $modules = array();
425
+ $config = Mage::getConfig();
426
+ foreach ($config->getNode('modules')->children() as $moduleName => $item) {
427
+ if (!empty($exact) && strlen($exact) != 0) {
428
+ if (strpos(strtolower($moduleName), strtolower($exact)) === false) {
429
+ continue;
430
+ }
431
+ }
432
+ $active = ($item->active == 'true') ? true : false;
433
+ $codePool = (string)$config->getModuleConfig($item->getName())->codePool;
434
+ $path = $config->getOptions()->getCodeDir() . DS . $codePool . DS . uc_words($item->getName(), DS);
435
+ $pathExists = file_exists($path);
436
+ $pathExists = $pathExists ? true : false;
437
+ $configExists = file_exists($path . '/etc/config.xml');
438
+ $configExists = $configExists ? true : false;
439
+ $version = (string)$config->getModuleConfig($item->getName())->version;
440
+ $dependencies = '-';
441
+ if ($item->depends) {
442
+ $depends = array();
443
+ foreach ($item->depends->children() as $depend) {
444
+ $depends[] = $depend->getName();
445
+ }
446
+ if (is_array($depends) && count($depends) > 0) {
447
+ asort($depends);
448
+ $dependencies = implode("\n", $depends);
449
+ }
450
+ }
451
+
452
+ $modules[$item->getName()] = array(
453
+ 'name' => $item->getName(),
454
+ 'active' => $active,
455
+ 'code_pool' => $codePool,
456
+ 'path' => $path,
457
+ 'path_exists' => $pathExists,
458
+ 'config_exists' => $configExists,
459
+ 'version' => $version,
460
+ 'dependencies' => $dependencies
461
+ );
462
+ }
463
+
464
+ return $modules;
465
+ }
466
+
467
+
468
+ /**
469
+ * Retrieve a collection of all rewrites
470
+ *
471
+ * @return Varien_Data_Collection Collection
472
+ */
473
+ public function getRewriteCollection($exact = false)
474
+ {
475
+ $collection = new Varien_Data_Collection();
476
+ $rewrites = $this->_loadRewrites();
477
+
478
+ foreach ($rewrites as $rewriteNodes) {
479
+ foreach ($rewriteNodes as $n) {
480
+ $nParent = $n->xpath('..');
481
+ $module = (string)$nParent[0]->getName();
482
+ $nSubParent = $nParent[0]->xpath('..');
483
+ $component = (string)$nSubParent[0]->getName();
484
+
485
+ if (!in_array($component, array('blocks', 'helpers', 'models'))) {
486
+ continue;
487
+ }
488
+
489
+ $pathNodes = $n->children();
490
+ foreach ($pathNodes as $pathNode) {
491
+ $path = (string)$pathNode->getName();
492
+ $completePath = $module . '/' . $path;
493
+ $rewriteClassName = (string)$pathNode;
494
+
495
+ if (!empty($exact) && strlen($exact) != 0) {
496
+ if ((strpos(strtolower($completePath), strtolower($exact)) === false)
497
+ && (strpos(strtolower($rewriteClassName), strtolower($exact)) === false)
498
+ ) {
499
+ continue;
500
+ }
501
+ }
502
+
503
+ $instance = Mage::getConfig()->getGroupedClassName(
504
+ substr($component, 0, -1),
505
+ $completePath
506
+ );
507
+
508
+ $collection->addItem(
509
+ new Varien_Object(
510
+ array(
511
+ 'path' => $completePath,
512
+ 'rewrite_class' => $rewriteClassName,
513
+ 'active_class' => $instance,
514
+ 'status' => ($instance == $rewriteClassName)
515
+ )
516
+ )
517
+ );
518
+ }
519
+ }
520
+ }
521
+
522
+ return $collection;
523
+ }
524
+
525
+ /**
526
+ * Return all rewrites
527
+ *
528
+ * @return array All rwrites
529
+ */
530
+ protected function _loadRewrites()
531
+ {
532
+ $fileName = 'config.xml';
533
+ $modules = Mage::getConfig()->getNode('modules')->children();
534
+
535
+ $return = array();
536
+ foreach ($modules as $modName => $module) {
537
+ if ($module->is('active')) {
538
+ $configFile = Mage::getConfig()->getModuleDir('etc', $modName) . DS . $fileName;
539
+ if (file_exists($configFile)) {
540
+ $xml = file_get_contents($configFile);
541
+ $xml = simplexml_load_string($xml);
542
+
543
+ if ($xml instanceof SimpleXMLElement) {
544
+ $return[$modName] = $xml->xpath('//rewrite');
545
+ }
546
+ }
547
+ }
548
+ }
549
+
550
+ return $return;
551
+ }
552
+
553
+ /**
554
+ * @return Varien_Object
555
+ */
556
+ public function getExtensionProblemsDigest()
557
+ {
558
+ $DB_logger = Mage::helper('iceimport/db');
559
+ $skip_data = $DB_logger->getLogEntryByKey('iceimport_skip_problems_digest');
560
+ $skip_data_empty = FALSE;
561
+ if(!empty($skip_data['log_value'])){
562
+ $skip_data_empty = true;
563
+ $skip_data = (array)json_decode($skip_data['log_value']);
564
+ }
565
+
566
+ $problems = array();
567
+ $count = 0;
568
+ //extension problems
569
+ $check_module = $this->getModulesCollection('ICEshop_Iceimport');
570
+ $check_module = $check_module->getLastItem()->getData();
571
+
572
+ if ($check_module['path_exists'] == 0) {
573
+ $path_exist_flag = true;
574
+ if($skip_data_empty && !empty($skip_data['extension'])){
575
+ foreach ($skip_data['extension'] as $key=>$value){
576
+ if($value=='path_exists'){
577
+ $path_exist_flag =false;
578
+ }
579
+ }
580
+ }
581
+ if($path_exist_flag){
582
+ $problems['extension']['path_exists'] = $check_module['path_exists'];
583
+ $count++;
584
+ }
585
+ }
586
+ if ($check_module['config_exists'] == 0) {
587
+ $path_exist_flag = true;
588
+ if($skip_data_empty && !empty($skip_data['extension'])){
589
+ foreach ($skip_data['extension'] as $key=>$value){
590
+ if($value=='config_exists'){
591
+ $path_exist_flag =false;
592
+ }
593
+ }
594
+ }
595
+ if($path_exist_flag){
596
+ $problems['extension']['config_exists'] = $check_module['config_exists'];
597
+ $count++;
598
+ }
599
+ }
600
+
601
+ //extension rewrites problems
602
+ $check_rewrites = $this->getRewriteCollection('ICEshop_Iceimport');
603
+ foreach ($check_rewrites as $rewrite) {
604
+ if (!$rewrite['status']) {
605
+ $problems['rewrite'][] = $rewrite;
606
+ $count++;
607
+ }
608
+ }
609
+
610
+ if($skip_data_empty && !empty($skip_data['rewrite'])){
611
+ foreach ($skip_data['rewrite'] as $key=>$value){
612
+ if(!empty($problems['rewrite'][$value])){
613
+ unset($problems['rewrite'][$value]);
614
+ $count--;
615
+ }
616
+ }
617
+ }
618
+
619
+ //system requirements (for magento/extension)
620
+ $requirements = $this->getSystem()->getRequirements()->getData();
621
+ foreach ($requirements as $requirement) {
622
+ if (!$requirement['result']) {
623
+ $requirement_flag = true;
624
+ if($skip_data_empty && !empty($skip_data['requirement'])){
625
+ foreach ($skip_data['requirement'] as $key=>$value){
626
+ if($value==$requirement['label']){
627
+ $requirement_flag =false;
628
+ }
629
+ }
630
+ }
631
+ if($requirement_flag){
632
+ $problems['requirement'][] = $requirement;
633
+ $count++;
634
+ }
635
+ }
636
+ }
637
+
638
+ //magento API problems
639
+ $magento_api_session_timeout = $this->getSystem()->getMagentoApi()->getSessionTimeout();
640
+ if (!$magento_api_session_timeout['result']) {
641
+ $api_skip_flag = true;
642
+ if($skip_data_empty && !empty($skip_data['api'])){
643
+ foreach ($skip_data['api'] as $key=>$value){
644
+ if($value=='timeout'){
645
+ $api_skip_flag =false;
646
+ }
647
+ }
648
+ }
649
+ if($api_skip_flag){
650
+ $problems['api']['timeout'] = $magento_api_session_timeout;
651
+ $count++;
652
+ }
653
+ }
654
+
655
+ $mysql = $this->getSystem()->getMysql()->getData();
656
+ foreach ($mysql as $mysql_param_name => $mysql_param_value) {
657
+ if (is_array($mysql_param_value) && !$mysql_param_value['result']) {
658
+ $mysql_skip_flag = true;
659
+ if($skip_data_empty && !empty($skip_data['mysql'])){
660
+ foreach ($skip_data['mysql'] as $key=>$value){
661
+ if($value==$mysql_param_name){
662
+ $mysql_skip_flag =false;
663
+ }
664
+ }
665
+ }
666
+ if($mysql_skip_flag){
667
+ $problems['mysql'][$mysql_param_name] = $mysql_param_value;
668
+ $count++;
669
+ }
670
+ }
671
+ }
672
+
673
+ $log_feed = $DB_logger->getLogByType('report', false, 10);
674
+ if (!empty($log_feed) && count($log_feed) > 0) {
675
+ foreach($log_feed as $log_entry) {
676
+ $problems['iceimport_log'][] = array(
677
+ 'label' => 'Iceimport Error',
678
+ 'current_value' => $log_entry['log_value']
679
+ );
680
+ $count++;
681
+ }
682
+ }
683
+
684
+ if($skip_data_empty && !empty($skip_data['iceimport_log'])){
685
+ foreach ($skip_data['iceimport_log'] as $key=>$value){
686
+ if(!empty($problems['iceimport_log'][$value])){
687
+ unset($problems['iceimport_log'][$value]);
688
+ $count--;
689
+ }
690
+ }
691
+ }
692
+
693
+ $try_delete_product = $DB_logger->getLogEntryByKey('error_try_delete_product');
694
+ $delete_product_percentage = $DB_logger->getLogEntryByKey('error_try_delete_product_percentage');
695
+ if(!empty($delete_product_percentage) && !empty($try_delete_product)) {
696
+ $iceimport_delete_product_skip_flag = true;
697
+ if($skip_data_empty && !empty($skip_data['iceimport_delete_product'])){
698
+ foreach ($skip_data['iceimport_delete_product'] as $key=>$value){
699
+ if($value=='delete_product'){
700
+ $iceimport_delete_product_skip_flag =false;
701
+ }
702
+ }
703
+ }
704
+ if($iceimport_delete_product_skip_flag){
705
+ $problems['iceimport_delete_product']['delete_product'] = array(
706
+ 'label' => 'There is a problem during last import',
707
+ 'current_value' => $try_delete_product['log_value'].$delete_product_percentage['log_value']
708
+ );
709
+ $count++;
710
+ }
711
+ }
712
+
713
+ if ($count == 0) {
714
+ $block = Mage::app()->getLayout()->createBlock('iceimport/adminhtml_notifications')->checkLastFinishedImport();
715
+ if ($block != false) {
716
+ $problems['custom_problems']['problem']['content'] = $block;
717
+ $problems['custom_problems']['problem']['explanation'] = "See additional information in Iceimport Statistics. Check working of magento cron. Otherwise contact with support team at supportdesk@iceshop.nl";
718
+ $count++;
719
+ }
720
+ }
721
+
722
+ $problems_digest = new Varien_Object();
723
+ $problems_digest->setData('problems', $problems);
724
+ $problems_digest->setData('count', $count);
725
+ return $problems_digest;
726
+ }
727
+
728
+ /**
729
+ * Set warning message for extension
730
+ *
731
+ * @param String $massage
732
+ */
733
+ public function setWarningIceimport($massage){
734
+ Mage::getSingleton('adminhtml/session')->addNotice('Warning!'.$massage);
735
+ }
736
+
737
+ /**
738
+ * Check skip wrning iceimport
739
+ * @return boolean
740
+ */
741
+ public function checkSetWarning(){
742
+ $DB_logger = Mage::helper('iceimport/db');
743
+ $skip_data = $DB_logger->getLogEntryByKey('iceimport_skip_problems_digest');
744
+ if(empty($skip_data['log_value'])){
745
+ return true;
746
+ } else {
747
+ return false;
748
+ }
749
+ }
750
+
751
+
752
+ /**
753
+ * Method return import images statistics
754
+ * @return string
755
+ */
756
+ public function getImagesStatistics(){
757
+ try{
758
+ $db_res = Mage::getSingleton('core/resource')->getConnection('core_write');
759
+ $tablePrefix = '';
760
+ $tPrefix = (array)Mage::getConfig()->getTablePrefix();
761
+ if (!empty($tPrefix)) {
762
+ $tablePrefix = $tPrefix[0];
763
+ }
764
+ $statistic_check = array();
765
+ $statistic_check['total_entries']['type'] = 'total_entries';
766
+ $statistic_check['total_entries']['label'] = 'Total Images Entries:';
767
+ $count_value = $db_res->fetchRow("SELECT COUNT(*) FROM `{$tablePrefix}iceshop_iceimport_image_queue`");
768
+ $total_entries = $count_value['COUNT(*)'];
769
+ $statistic_check['total_entries']['value'] = $total_entries;
770
+
771
+ $statistic_check['total_download']['type'] = 'total_download';
772
+ $statistic_check['total_download']['label'] = 'Total Images Downloaded:';
773
+ $count_value = $db_res->fetchRow("SELECT COUNT(*) FROM `{$tablePrefix}iceshop_iceimport_image_queue` WHERE `is_downloaded` = 1");
774
+ $statistic_check['total_download']['value'] = $count_value['COUNT(*)'] . " ( " . round($count_value['COUNT(*)'] * 100 / $total_entries, 2) . "% )";
775
+
776
+ $statistic_check['total_waiting_download']['type'] = 'total_waiting_download';
777
+ $statistic_check['total_waiting_download']['label'] = 'Images Waiting Download:';
778
+ $count_value = $db_res->fetchRow("SELECT COUNT(*) FROM `{$tablePrefix}iceshop_iceimport_image_queue` WHERE `is_downloaded` = 0");
779
+ $statistic_check['total_waiting_download']['value'] = $count_value['COUNT(*)'] . " ( " . round($count_value['COUNT(*)'] * 100 / $total_entries, 2) . "% )";
780
+
781
+ $statistic_check['total_error_download']['type'] = 'total_error_download';
782
+ $statistic_check['total_error_download']['label'] = 'Images Download Error:';
783
+ $count_value = $db_res->fetchRow("SELECT COUNT(*) FROM `{$tablePrefix}iceshop_iceimport_image_queue` WHERE `is_downloaded` = 2");
784
+ $statistic_check['total_error_download']['value'] = $count_value['COUNT(*)'] . " ( " . round($count_value['COUNT(*)'] * 100 / $total_entries, 2) . "% )";
785
+
786
+ return $statistic_check;
787
+ } catch (Exception $e){
788
+ }
789
+ }
790
+
791
+ /**
792
+ * Calculate and compare needed value of memory limit
793
+ * @param string $memoryLimit
794
+ * @param integer $compare
795
+ * @return boolean
796
+ */
797
+ protected function checkMemoryLimit($memoryLimit, $compare){
798
+ $ml = false;
799
+ if(strripos($memoryLimit, 'G')){
800
+ $ml = ((int)$memoryLimit)*1024;
801
+ } else {
802
+ $ml = (int)$memoryLimit;
803
+ }
804
+ if($ml){
805
+ if($ml>=$compare)
806
+ return true;
807
+ else
808
+ return false;
809
+ }
810
+ return false;
811
+ }
812
+
813
+ /**
814
+ * Calculate time of import one product
815
+ * @param $count
816
+ * @param $start
817
+ * @param $end
818
+ */
819
+ public function getModulePerformance($count, $start, $end)
820
+ {
821
+ $helper = Mage::helper('iceimport');
822
+ $delta_time = 0;
823
+ if ((!empty($count['log_value'])) && (!empty($start['log_value'])) && (!empty($end['log_value']))) {
824
+ $start_unix = strtotime($start['log_value']);
825
+ $end_unix = strtotime($end['log_value']);
826
+ if ($end_unix > $start_unix) {
827
+ $delta_time = $end_unix - $start_unix;
828
+ } else {
829
+ $return = $helper->__('Not finished yet');
830
+ }
831
+ if ($delta_time != 0) {
832
+ $tmp = $count['log_value'];
833
+ $performance = ($delta_time) / $tmp;
834
+ $per_minute = round($performance / 60, 0);
835
+ if ($per_minute == 0) {
836
+ $return = round($performance, 2) . $helper->__(' sec. ');
837
+ } else {
838
+ $return = round($performance / 60, 2) . $helper->__(' min. ');;
839
+ }
840
+ }
841
+ } else {
842
+ $return = $helper->__('Can`t calculate now');
843
+ }
844
+
845
+ return $return;
846
+ }
847
+
848
  }
app/code/community/ICEshop/Iceimport/Model/Convert/Adapter/Product.php CHANGED
@@ -21,6 +21,7 @@ class ICEshop_Iceimport_Model_Convert_Adapter_Product extends Mage_Catalog_Model
21
  * @var string
22
  */
23
  protected $_tablePrefix = '';
 
24
 
25
  /**
26
  * @var
@@ -28,7 +29,14 @@ class ICEshop_Iceimport_Model_Convert_Adapter_Product extends Mage_Catalog_Model
28
  protected $_refreshSettings;
29
 
30
  /**
 
31
  *
 
 
 
 
 
 
32
  */
33
  public function __construct()
34
  {
@@ -44,6 +52,7 @@ class ICEshop_Iceimport_Model_Convert_Adapter_Product extends Mage_Catalog_Model
44
  /**
45
  * @param $storeId
46
  */
 
47
  private function _initRefreshSettings($storeId)
48
  {
49
  $this->_refreshSettings = new Varien_Object();
@@ -71,387 +80,448 @@ class ICEshop_Iceimport_Model_Convert_Adapter_Product extends Mage_Catalog_Model
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
-
155
- if (!empty($iceimportAttributes['categories'])) {
156
- if (!empty($iceimportAttributes['categories'])) {
157
- $cat_names = explode('/', $iceimportAttributes['categories']);
158
- foreach ($cat_names as $cat_name) {
159
- if (empty($cat_name)) {
160
- $message = Mage::helper('catalog')->__('Skip import row, some of categories does not have name');
161
- Mage::throwException($message);
162
- }
163
- }
164
- }
165
- }
166
- if (!empty($iceimportAttributes['categories'])) {
167
- $category = $iceimportAttributes['categories'];
168
- if (empty($iceimportAttributes['unspsc'])) {
169
- $message = Mage::helper('catalog')->__('Skip import. Category UNSPSC not defined in store');
170
- Mage::throwException($message);
171
- }
172
- $unspsc = $iceimportAttributes['unspsc'];
173
- if (empty($iceimportAttributes['unspsc_path'])) {
174
- $message = Mage::helper('catalog')->__('Skip import. Category UNSPSC path not defined in store');
175
- Mage::throwException($message);
176
- }
177
- if (!empty($iceimportAttributes['unspsc_path'])) {
178
- $cat_unspscs = explode('/', $iceimportAttributes['unspsc_path']);
179
- foreach ($cat_unspscs as $cat_unspsc) {
180
- if (empty($cat_unspsc)) {
181
- $message = Mage::helper('catalog')->__('Skip import row, some of categories does not have UNSPSC');
182
- Mage::throwException($message);
183
- }
184
- }
185
- }
186
- $unspscPath = $iceimportAttributes['unspsc_path'];
187
- if (!empty($cat_unspscs) && !empty($cat_names) && count($cat_names) != count($cat_unspscs)) {
188
- $message = Mage::helper('catalog')->__('Skip import row, categories names does not match categories UNSPSC');
189
- Mage::throwException($message);
190
- }
191
- }
192
 
193
- // set in / out of stock
194
- $isInStock = 0;
195
- if (!empty($iceimportAttributes['is_in_stock'])) {
196
- $isInStock = $iceimportAttributes['is_in_stock'];
197
- }
198
 
199
- // set qty
200
- $qty = 0;
201
- if (!empty($iceimportAttributes['qty'])) {
202
- $qty = $iceimportAttributes['qty'];
203
- }
204
 
205
- // set price
206
- $price = 0.00;
207
- if (!empty($iceimportAttributes['price'])) {
208
- $price = $iceimportAttributes['price'];
209
- }
 
 
 
210
 
211
- // set tax_auvibel
212
- $tax_auvibel = 0.00;
213
- if (!empty($iceimportAttributes['tax_auvibel'])) {
214
- $tax_auvibel = $iceimportAttributes['tax_auvibel'];
215
- }
216
 
217
- // set tax_bebat
218
- $tax_bebat = 0.00;
219
- if (!empty($iceimportAttributes['tax_bebat'])) {
220
- $tax_bebat = $iceimportAttributes['tax_bebat'];
221
- }
 
 
 
 
 
 
 
 
 
 
222
 
223
- // set tax_recupel
224
- $tax_recupel = 0.00;
225
- if (!empty($iceimportAttributes['tax_recupel'])) {
226
- $tax_recupel = $iceimportAttributes['tax_recupel'];
227
- }
228
 
229
- // set tax_reprobel
230
- $tax_reprobel = 0.00;
231
- if (!empty($iceimportAttributes['tax_reprobel'])) {
232
- $tax_reprobel = $iceimportAttributes['tax_reprobel'];
233
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
234
 
235
- // set status value
236
- $statusValue = (!empty($iceimportAttributes['status']) && $iceimportAttributes['status'] == 'Enabled') ? 1 : 2;
237
- $productData['int']['status'] = $statusValue;
 
 
 
238
 
239
- // set visibility value
240
- $visibilityValue = 1;
241
- if (!empty($iceimportAttributes['visibility'])) {
242
- switch ($iceimportAttributes['visibility']) {
243
- case 'Not Visible Individually':
244
- $visibilityValue = 1;
245
- break;
246
- case 'Catalog':
247
- $visibilityValue = 2;
248
- break;
249
- case 'Search':
250
- $visibilityValue = 3;
251
- break;
252
- case 'Catalog, Search':
253
- $visibilityValue = 4;
254
- break;
255
  }
256
- }
257
- $productData['int']['visibility'] = $visibilityValue;
258
 
259
- // set product image
260
- $productImage = '';
261
- if (!empty($iceimportAttributes['image'])) {
262
- $productImage = $iceimportAttributes['image'];
263
- }
264
 
265
- $initAttributes = '';
266
- // init general attributes query
267
- $initAttributes .= "SELECT @product_entity_type_id := `entity_type_id`
268
- FROM `{$this->_tablePrefix}eav_entity_type`
269
- WHERE entity_type_code = 'catalog_product';";
270
 
271
- if (!empty($iceimportAttributes['categories'])) {
272
- $initAttributes .= "SELECT @category_entity_type_id := `entity_type_id`
273
- FROM `{$this->_tablePrefix}eav_entity_type`
274
- WHERE entity_type_code = 'catalog_category';";
275
- }
276
 
277
- $initAttributes .= "SELECT @attribute_set_id := `attribute_set_id`
278
- FROM `{$this->_tablePrefix}eav_attribute_set`
279
- WHERE attribute_set_name = :attribute_set
280
- AND entity_type_id = @product_entity_type_id;";
 
281
 
282
- $initAttributes .= "SELECT @price_id := `attribute_id`
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
283
  FROM `{$this->_tablePrefix}eav_attribute`
284
  WHERE `attribute_code` = 'price'
285
  AND entity_type_id = @product_entity_type_id;";
286
 
287
- if (!empty($iceimportAttributes['categories'])) {
288
- $initAttributes .= "SELECT @unspsc_id := `attribute_id`
289
- FROM `{$this->_tablePrefix}eav_attribute`
290
- WHERE `attribute_code` = 'unspsc'
291
- AND entity_type_id = @category_entity_type_id;";
292
-
293
- $initAttributes .= "SELECT @category_name_id := `attribute_id`
294
- FROM `{$this->_tablePrefix}eav_attribute`
295
- WHERE `attribute_code` = 'name'
296
- AND entity_type_id = @category_entity_type_id;";
297
-
298
- $initAttributes .= "SELECT @category_active_id := `attribute_id`
299
- FROM `{$this->_tablePrefix}eav_attribute`
300
- WHERE `attribute_code` = 'is_active'
301
- AND entity_type_id = @category_entity_type_id;";
302
-
303
- $initAttributes .= "SELECT @include_nav_bar_id := `attribute_id`
304
- FROM `{$this->_tablePrefix}eav_attribute`
305
- WHERE `attribute_code` = 'include_in_menu'
306
- AND entity_type_id = @category_entity_type_id;";
307
-
308
- $initAttributes .= "SELECT @category_is_anchor_id := `attribute_id`
309
- FROM `{$this->_tablePrefix}eav_attribute`
310
- WHERE `attribute_code` = 'is_anchor'
311
- AND entity_type_id = @category_entity_type_id;";
312
- }
313
 
314
- $initAttributes .= "SELECT @tax_auvibel_id := `attribute_id`
315
- FROM `{$this->_tablePrefix}eav_attribute`
316
- WHERE `attribute_code` = 'tax_auvibel'
317
- AND entity_type_id = @product_entity_type_id;";
318
-
319
- $initAttributes .= "SELECT @tax_bebat_id := `attribute_id`
320
- FROM `{$this->_tablePrefix}eav_attribute`
321
- WHERE `attribute_code` = 'tax_bebat'
322
- AND entity_type_id = @product_entity_type_id;";
323
-
324
- $initAttributes .= "SELECT @tax_recupel_id := `attribute_id`
325
- FROM `{$this->_tablePrefix}eav_attribute`
326
- WHERE `attribute_code` = 'tax_recupel'
327
- AND entity_type_id = @product_entity_type_id;";
328
-
329
- $initAttributes .= "SELECT @tax_reprobel_id := `attribute_id`
330
- FROM `{$this->_tablePrefix}eav_attribute`
331
- WHERE `attribute_code` = 'tax_reprobel'
332
- AND entity_type_id = @product_entity_type_id;";
333
-
334
- if (!empty($iceimportAttributes['stock_name'])) {
335
- $stock_id = $this->_connRes->fetchRow("SELECT stock_id FROM `{$this->_tablePrefix}cataloginventory_stock` WHERE stock_name = :stock_name LIMIT 1", array(
336
- ':stock_name' => $iceimportAttributes['stock_name']
337
- ));
338
- if (!empty($stock_id)) {
339
- $initAttributes .= "SELECT @stock_id := `stock_id` FROM `{$this->_tablePrefix}cataloginventory_stock` WHERE stock_name = '" . $iceimportAttributes['stock_name'] . "';";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
340
  } else {
341
- $message = Mage::helper('catalog')->__('Skip import row, stock name "' . $iceimportAttributes['stock_name'] . '" does not exists in the shop');
342
- Mage::throwException($message);
343
  }
344
- } else {
345
- $initAttributes .= "SELECT @stock_id := `stock_id` FROM `{$this->_tablePrefix}cataloginventory_stock` WHERE stock_name = 'Default';";
346
- }
347
- $this->_connRes->query($initAttributes, array(':attribute_set' => $iceimportAttributes['attribute_set']));
348
 
349
- // get tax class id
350
- $defaulttaxConf = (int)Mage::getStoreConfig('iceshop_iceimport_importprod_root/importprod/default_tax', $storeId);
351
- $productData['int']['tax_class_id'] = $defaulttaxConf;
352
 
353
- if (!empty($iceimportAttributes['categories'])) {
354
- // get category id
355
- $categoriesToActiveConf = Mage::getStoreConfig('iceshop_iceimport_importprod_root/importprod/category_active', $storeId);
356
- $categoryIds = $this->_addCategories($category, $storeId, $unspsc, $unspscPath, $categoriesToActiveConf);
357
- }
358
 
359
- // get url key
360
- $url = '';
361
- if (!empty($productData['varchar']['name'])) {
362
- $preUrl = explode(' ', strtolower($productData['varchar']['name']));
363
- $url = implode('-', $preUrl);
364
- }
365
- $productData['varchar']['url_key'] = $url;
366
 
367
- $prodIdFetch = $this->_connRes->fetchRow("SELECT entity_id FROM `{$this->_tablePrefix}catalog_product_entity` WHERE sku = :sku LIMIT 1", array(
368
- ':sku' => $sku
369
- ));
370
- $productId = $prodIdFetch['entity_id'];
371
- if (!empty($productId)) {
372
- // check import type (Import only price & qty or all product info)
373
- $stockConf = (int)Mage::getStoreConfig('iceshop_iceimport_importprod_root/importprod/import_stock', $storeId);
374
- $priceConf = (int)Mage::getStoreConfig('iceshop_iceimport_importprod_root/importprod/import_prices', $storeId);
375
 
376
- if (!empty($iceimportAttributes['categories'])) {
377
- $productId = $this->_coreSave($productData, $productId, $storeId, $sku, $categoryIds);
378
- } else {
379
- $productId = $this->_coreSave($productData, $productId, $storeId, $sku);
380
- }
381
 
382
- $this->_corePriceStock($websiteId, $productId, $price, $qty, $sku, $isInStock, $stockConf, $priceConf, 0);
 
383
 
384
- $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));
385
- } else {
386
- if ($this->_getRefreshSetting('import_new_products') == 0) {
387
- $session->setData("skipped_counter", (int)++$skipped_counter);
388
- return true;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
389
  }
390
 
391
- if (!empty($iceimportAttributes['categories'])) {
392
- $productId = $this->_coreSave($productData, $productId, $storeId, $sku, $categoryIds);
393
- } else {
394
- $productId = $this->_coreSave($productData, $productId, $storeId, $sku);
395
- }
396
 
397
- // add price & stock
398
- $this->_corePriceStock($websiteId, $productId, $price, $qty, $sku, $isInStock);
399
- $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));
400
- }
 
 
401
 
402
- $this->_connRes->query("DELETE FROM {$this->_tablePrefix}weee_tax WHERE entity_id = :prod_id AND attribute_id = @tax_auvibel_id", array(':prod_id' => $productId));
403
- $this->_connRes->query("DELETE FROM {$this->_tablePrefix}weee_tax WHERE entity_id = :prod_id AND attribute_id = @tax_bebat_id", array(':prod_id' => $productId));
404
- $this->_connRes->query("DELETE FROM {$this->_tablePrefix}weee_tax WHERE entity_id = :prod_id AND attribute_id = @tax_recupel_id", array(':prod_id' => $productId));
405
- $this->_connRes->query("DELETE FROM {$this->_tablePrefix}weee_tax WHERE entity_id = :prod_id AND attribute_id = @tax_reprobel_id", array(':prod_id' => $productId));
 
406
 
407
- $countryCode = Mage::getStoreConfig('general/country/default');
408
- if ($tax_auvibel > 0) {
409
- $query = "INSERT INTO {$this->_tablePrefix}weee_tax (website_id, entity_id, country, value, state, attribute_id, entity_type_id)"
410
- ."VALUES (0, :prod_id, :country, :value, '*', @tax_auvibel_id, @product_entity_type_id)";
411
- $this->_connRes->query($query, array(':prod_id' => $productId, ':country' => $countryCode, ':value' => $tax_auvibel));
412
- }
413
 
414
- if ($tax_bebat > 0) {
415
- $query = "INSERT INTO {$this->_tablePrefix}weee_tax (website_id, entity_id, country, value, state, attribute_id, entity_type_id)"
416
- ."VALUES (0, :prod_id, :country, :value, '*', @tax_bebat_id, @product_entity_type_id)";
417
- $this->_connRes->query($query, array(':prod_id' => $productId, ':country' => $countryCode, ':value' => $tax_bebat));
418
- }
419
 
420
- if ($tax_recupel > 0) {
421
- $query = "INSERT INTO {$this->_tablePrefix}weee_tax (website_id, entity_id, country, value, state, attribute_id, entity_type_id)"
422
- ."VALUES (0, :prod_id, :country, :value, '*', @tax_recupel_id, @product_entity_type_id)";
423
- $this->_connRes->query($query, array(':prod_id' => $productId, ':country' => $countryCode, ':value' => $tax_recupel));
424
- }
425
 
426
- if ($tax_reprobel > 0) {
427
- $query = "INSERT INTO {$this->_tablePrefix}weee_tax (website_id, entity_id, country, value, state, attribute_id, entity_type_id)"
428
- ."VALUES (0, :prod_id, :country, :value, '*', @tax_reprobel_id, @product_entity_type_id)";
429
- $this->_connRes->query($query, array(':prod_id' => $productId, ':country' => $countryCode, ':value' => $tax_reprobel));
430
- }
431
 
432
- // add product image to queue
433
- if (Mage::getStoreConfig('iceshop_iceimport_importprod_root/importprod/import_images')) {
434
- $this->_addImageToQueue($productId, $productImage);
435
- }
436
 
 
437
 
438
- $counter_sum = $counter + $skipped_counter;
439
 
440
- if (isset($counter) && isset($skipped_counter) && isset($import_total) && $counter_sum == $import_total) {
441
 
442
- $this->_runCategoriesSorting();
443
- $DB_logger = Mage::helper('iceimport/db');
444
- $this->deleteOldProducts($DB_logger);
445
 
446
- $DB_logger->insertLogEntry('error' . md5(microtime(true)), 'New products skipped while export according to Iceimport settings: ' . $skipped_counter, 'stat');
 
 
 
 
 
447
 
448
- $date = date('m/d/Y H:i:s');
449
- $DB_logger->insertLogEntry('iceimport_import_ended', $date);
450
- }
451
- if ($counter < $import_total) {
452
- $session->setData("counter", (int)++$counter);
453
- }
454
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
455
  return true;
456
  }
457
 
@@ -518,14 +588,18 @@ if (!empty($iceimportAttributes['categories'])) {
518
  */
519
  protected function _coreSave(array $entityData, $productId = null, $storeId = 0, $sku, $categoryIds =NULL)
520
  {
 
 
 
521
  $coreSaveSQL = '';
522
  $newProduct = false;
523
  if ($productId === null) {
524
  // add product to store
525
- $coreSaveProduct = "INSERT INTO `{$this->_tablePrefix}catalog_product_entity` (`entity_type_id`, `attribute_set_id`, `type_id`, `sku`, `created_at`)
526
- VALUES (@product_entity_type_id, @attribute_set_id, 'simple', :sku, NOW());
527
  SELECT @product_id := LAST_INSERT_ID();";
528
- $this->_connRes->query($coreSaveProduct, array(':sku' => $sku));
 
529
  $prodFetch = $this->_connRes->fetchRow("SELECT @product_id AS prod_id");
530
  $productId = $prodFetch['prod_id'];
531
  $newProduct = TRUE;
@@ -538,24 +612,24 @@ if (!empty($iceimportAttributes['categories'])) {
538
  $productnameConf = (int)Mage::getStoreConfig('iceshop_iceimport_importprod_root/importprod/import_product_name', $storeId);
539
  $productshdescriptionConf = (int)Mage::getStoreConfig('iceshop_iceimport_importprod_root/importprod/import_product_short_description', $storeId);
540
  $productdescriptionConf = (int)Mage::getStoreConfig('iceshop_iceimport_importprod_root/importprod/import_product_description', $storeId);
541
- $productshsudescriptionConf = (int)Mage::getStoreConfig('iceshop_iceimport_importprod_root/importprod/import_product_short_summary_description', $storeId);
542
- $productsudescriptionConf = (int)Mage::getStoreConfig('iceshop_iceimport_importprod_root/importprod/import_product_summary_description', $storeId);
543
  $productbrandConf = (int)Mage::getStoreConfig('iceshop_iceimport_importprod_root/importprod/import_product_brand_name', $storeId);
544
  $deliveryetaConf = (int)Mage::getStoreConfig('iceshop_iceimport_importprod_root/importprod/import_product_delivery_eta', $storeId);
 
 
 
 
545
 
546
  foreach ($entityData as $type => $typeAttributes) {
547
  foreach ($typeAttributes as $attribute => $value) {
548
  if (
549
  (
550
- ($attribute == 'mpn' && $productmpnConf == 0) ||
551
- ($attribute == 'brand_name' && $productbrandConf == 0) ||
552
- ($attribute == 'ean' && $producteanConf == 0) ||
553
  ($attribute == 'name' && $productnameConf == 0) ||
554
  ($attribute == 'short_description' && $productshdescriptionConf == 0) ||
555
  ($attribute == 'description' && $productdescriptionConf == 0) ||
556
- ($attribute == 'short_summary_description' && $productshsudescriptionConf == 0) ||
557
- ($attribute == 'long_summary_description' && $productsudescriptionConf == 0) ||
558
- ($attribute == 'delivery_eta' && $deliveryetaConf == 0)
559
  ) || (
560
  $attribute == 'sku' ||
561
  ($attribute == 'attribute_set') ||
@@ -582,6 +656,9 @@ if (!empty($iceimportAttributes['categories'])) {
582
  }
583
  }
584
  }
 
 
 
585
  }
586
 
587
  $bindArray[':store_id'] = $storeId;
@@ -667,22 +744,22 @@ if (!empty($iceimportAttributes['categories'])) {
667
  $noDelCategory = '';
668
  if(!empty($not_delete_category)){
669
  foreach ($not_delete_category as $category_ID ){
670
- $noDelCategory .= ''.$category_ID['entity_id'] . ',';
671
  }
672
  }
673
  if(!empty($noDelCategory)){
674
- $noDelCategory = substr($noDelCategory, 0, -1);
675
  }
676
 
677
  if (!empty($mapCategoryIds)) {
678
  foreach ($mapCategoryIds as $delCategoryId) {
679
  $delCategoryId = (int)$delCategoryId;
680
  $coreSaveSQL .= "DELETE FROM `{$this->_tablePrefix}catalog_category_product`";
681
- if(!empty($noDelCategory)){
682
  $coreSaveSQL .= "WHERE `category_id` NOT IN({$noDelCategory},{$delCategoryId}) AND `product_id` = @product_id;";
683
- } else {
684
  $coreSaveSQL .= "WHERE `category_id`!={$delCategoryId} AND `product_id` = @product_id;";
685
- }
686
  }
687
  }
688
  try {
@@ -708,13 +785,13 @@ if (!empty($iceimportAttributes['categories'])) {
708
  * @return boolean
709
  */
710
  protected function _checkAttributeExist($attributeCode){
711
- $query = "SELECT `attribute_id` FROM `{$this->_tablePrefix}eav_attribute` WHERE attribute_code='{$attributeCode}';";
712
- $attributeCheck = $this->_connRes->fetchRow($query);
713
- $attributeId = $attributeCheck['attribute_id'];
714
- if(empty($attributeId)){
715
  return false;
716
- }
717
- return true;
718
  }
719
 
720
  /**
@@ -852,7 +929,7 @@ if (!empty($iceimportAttributes['categories'])) {
852
  $this->_connRes->query($stockSaveSQL, $fields_values);
853
  unset($stockSaveSQL);
854
  }
855
- unset($fields_values);
856
  }
857
 
858
  /**
@@ -914,7 +991,6 @@ if (!empty($iceimportAttributes['categories'])) {
914
  );
915
  $product->save();
916
  $this->setImageAsDownloaded($queueId);
917
- echo $product->getCategory() . '<br>';
918
  unset($product);
919
  } else {
920
  $this->setImageAsDownloadedError($queueId);
@@ -975,6 +1051,7 @@ if (!empty($iceimportAttributes['categories'])) {
975
  // merge categories by unspsc
976
  $categoryMergedArray = $this->_categoryMapper($categories, $unspscPath);
977
  foreach ($categoryMergedArray as $category) {
 
978
  $categoryName = $category['name'];
979
  $categoryUnspsc = $category['unspsc'];
980
  $categoryTreeId = $this->_getCategoryIdByUnspsc($categoryUnspsc,$storeId);
@@ -993,6 +1070,7 @@ if (!empty($iceimportAttributes['categories'])) {
993
  );
994
  $nameChecker = $nameCheckerFetch['value_id'];
995
  if (!$nameChecker) {
 
996
  // add category name to current store
997
  $categoryBindArray[':category_name'] = $categoryName;
998
  if (!empty($categoryBindArray[':category_id'])) {
@@ -1107,6 +1185,8 @@ if (!empty($iceimportAttributes['categories'])) {
1107
  if ($unspsc == 'default_root') {
1108
  return Mage::app()->getStore($storeId)->getRootCategoryId();
1109
  } else {
 
 
1110
  $categoryId = $this->_connRes->fetchRow(
1111
  "SELECT entity_id
1112
  FROM `{$this->_tablePrefix}catalog_category_entity_varchar`
@@ -1204,6 +1284,7 @@ if (!empty($iceimportAttributes['categories'])) {
1204
  $iceAttributes = array();
1205
  foreach ($importData as $attribute => $value) {
1206
  // map iceimport attributes
 
1207
  if ($attribute == 'sku' ||
1208
  $attribute == 'attribute_set' ||
1209
  $attribute == 'categories' ||
@@ -1291,6 +1372,7 @@ if (!empty($iceimportAttributes['categories'])) {
1291
 
1292
  }
1293
 
 
1294
  /**
1295
  * @return array
1296
  */
@@ -1497,10 +1579,12 @@ if (!empty($iceimportAttributes['categories'])) {
1497
  }
1498
 
1499
  $query = "SELECT COUNT(*) FROM `{$this->_tablePrefix}catalog_category_product` WHERE category_id = :cat_id ";
 
1500
  $cat_products = $this->_connRes->fetchRow($query, array(
1501
  ':cat_id' => $category->getId()
1502
  ));
1503
 
 
1504
  if ($cat_products['COUNT(*)'] == 0) {
1505
  $query = "SELECT `entity_id` FROM `{$this->_tablePrefix}catalog_category_entity` WHERE parent_id = :cat_id";
1506
  $child_cat = $this->_connRes->fetchAll($query, array(
@@ -1511,10 +1595,68 @@ if (!empty($iceimportAttributes['categories'])) {
1511
  //Count child categories products and set them to inactive if they have no
1512
  $this->CountChildProd($child_cat);
1513
  } elseif($this->_getRefreshSetting('update_hide_category') == 1) {
 
1514
  $this->_connRes->query("UPDATE `{$this->_tablePrefix}catalog_category_entity_int`
1515
  SET `value` = 0 WHERE `attribute_id` = @category_active_id AND entity_id = :cat_id", array(
1516
  ':cat_id' => $category->getId()
1517
  ));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1518
  }
1519
  }
1520
  }
@@ -1535,7 +1677,8 @@ if (!empty($iceimportAttributes['categories'])) {
1535
  FROM {$this->_tablePrefix}eav_attribute
1536
  WHERE attribute_code = 'is_iceimport'");
1537
 
1538
- $count_prod = $db_res->fetchRow("SELECT COUNT(*) AS count_prod
 
1539
  FROM {$this->_tablePrefix}catalog_product_entity AS cpe
1540
  JOIN {$this->_tablePrefix}catalog_product_entity_varchar AS cpev
1541
  ON cpe.entity_id = cpev.entity_id
@@ -1546,7 +1689,8 @@ if (!empty($iceimportAttributes['categories'])) {
1546
 
1547
  if ($count_prod > 0) {
1548
  //iceimport products exists, amount > 0
1549
- $count_del_prod = $db_res->fetchRow("SELECT COUNT(*) AS count__del_prod
 
1550
  FROM {$this->_tablePrefix}catalog_product_entity AS cpe
1551
  JOIN {$this->_tablePrefix}catalog_product_entity_varchar AS cpev
1552
  ON cpe.entity_id = cpev.entity_id
@@ -1562,7 +1706,7 @@ if (!empty($iceimportAttributes['categories'])) {
1562
  $count_del_prod = 0;
1563
  }
1564
 
1565
- $delete_old_products_tolerance = (int)Mage::getStoreConfig('iceshop_iceimport_importprod_root/importprod/delete_old_products_tolerance');
1566
 
1567
  if ($count_del_prod > 0) {
1568
  //iceimport products to delete exists, amount > 0
@@ -1586,10 +1730,11 @@ if (!empty($iceimportAttributes['categories'])) {
1586
  } else {
1587
  $error_message = 'Attempt to delete more old products than allowed in Iceimport configuration. Interruption of the process.';
1588
  $DB_logger->insertLogEntry('error_try_delete_product', $error_message);
1589
- // $DB_logger->insertLogEntry('error' . md5(microtime(true)), $error_message, 'error');
1590
  $error_message2 = 'Old product percentage: ' . round(($count_del_prod / $count_prod * 100), 2) . '%';
1591
  $DB_logger->insertLogEntry('error_try_delete_product_percentage', $error_message2);
1592
- // $DB_logger->insertLogEntry('error' . md5(microtime(true)), $error_message2, 'error');
 
 
1593
  print $error_message;
1594
  print $error_message2;
1595
  exit;
@@ -1610,6 +1755,7 @@ if (!empty($iceimportAttributes['categories'])) {
1610
  /**
1611
  * Back compatibility event
1612
  */
 
1613
  $DB_logger = Mage::helper('iceimport/db');
1614
  $tablePrefix = '';
1615
  $tPrefix = (array)Mage::getConfig()->getTablePrefix();
@@ -1621,12 +1767,15 @@ if (!empty($iceimportAttributes['categories'])) {
1621
 
1622
  Mage::dispatchEvent($this->_eventPrefix . '_after', array());
1623
 
1624
- $entity = new Varien_Object();
1625
- Mage::getSingleton('index/indexer')->processEntityAction(
1626
- $entity,
1627
- self::ENTITY,
1628
- Mage_Index_Model_Event::TYPE_SAVE
1629
- );
 
 
 
1630
  }
1631
 
1632
 
@@ -1643,6 +1792,77 @@ if (!empty($iceimportAttributes['categories'])) {
1643
  ON ea.`attribute_id` = ccev.`attribute_id`
1644
  WHERE ea.`attribute_code`='unspsc' AND (ccev.`store_id` = 0 OR ccev.`store_id`=:store_id) AND ccev.`value` IS NULL;";
1645
 
1646
- return $this->_connRes->fetchAll($query, array( ':store_id' => $store_id ));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1647
  }
1648
  }
 
 
21
  * @var string
22
  */
23
  protected $_tablePrefix = '';
24
+ protected $_counter = 0;
25
 
26
  /**
27
  * @var
29
  protected $_refreshSettings;
30
 
31
  /**
32
+ * Import process ID
33
  *
34
+ * @var int
35
+ */
36
+ protected $process_id = 'iceshop_iceimport';
37
+
38
+ /**
39
+ * Init class
40
  */
41
  public function __construct()
42
  {
52
  /**
53
  * @param $storeId
54
  */
55
+
56
  private function _initRefreshSettings($storeId)
57
  {
58
  $this->_refreshSettings = new Varien_Object();
80
  * @return bool
81
  * @throws Mage_Core_Exception
82
  */
83
+ public function saveRow(array $importData, $manually = false)
84
  {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
85
 
86
+ $DB_helper = Mage::helper('iceimport/db');
 
 
 
87
 
88
+ $DB_logger = Mage::helper('iceimport/db');
89
+
90
+ $transactions_enabled = (int)Mage::getStoreConfig('iceshop_iceimport_importprod_root/importprod/transactions_enabled');
 
 
 
 
91
 
92
+ if (empty($importData[0]['batchId'])) {
93
+ $batchId = Mage::getSingleton('core/app')->getRequest()->getPost('batch_id', 0);
94
+ } else {
95
+ $batchId = (int)$importData[0]['batchId'];
96
+ }
97
 
98
  // set store id
99
+
100
+ if (empty($importData[0]['store'])) {
101
  if (!is_null($this->getBatchParams('store'))) {
102
  $store = $this->getStoreById($this->getBatchParams('store'));
103
  } else {
104
+ $message = Mage::helper('catalog')->__('Skip import, required field "%s" not defined', 'store');
105
  Mage::throwException($message);
106
  }
107
  }
108
+
109
+ if (empty($importData[0]['attribute_set'])) {
110
+ $message = Mage::helper('catalog')->__('Skip import, required field "%s" not defined', 'attribute_set');
111
+ Mage::throwException($message);
112
+ }
113
+
114
  if (empty($store)) {
115
+ $store = Mage::app()->getStore(trim($importData[0]['store']));
116
  }
117
+
118
  if ($store === false) {
119
+ $message = Mage::helper('catalog')->__('Skip import, store "%s" not exists', $importData[0]['store']);
120
  Mage::throwException($message);
121
  }
122
+
123
  $storeId = $store->getId();
124
+
125
+ $stock_name = Mage::getStoreConfig('iceshop_iceimport_importprod_root/importprod/stock_inventory');
126
+
127
+ $defaulttaxConf = (int)Mage::getStoreConfig('iceshop_iceimport_importprod_root/importprod/default_tax', $storeId);
128
+
129
+ $stockConf = (int)Mage::getStoreConfig('iceshop_iceimport_importprod_root/importprod/import_stock', $storeId);
130
+ $priceConf = (int)Mage::getStoreConfig('iceshop_iceimport_importprod_root/importprod/import_prices', $storeId);
131
+
132
+ $categoriesToActiveConf = Mage::getStoreConfig('iceshop_iceimport_importprod_root/importprod/category_active', $storeId);
133
+
134
+ $batch_size = (int)Mage::getStoreConfig('iceshop_iceimport_importprod_root/importprod/iceimport_batch_size', $storeId);
135
+
136
+ $addImages = Mage::getStoreConfig('iceshop_iceimport_importprod_root/importprod/import_images');
137
+
138
  //init refresh settings values
139
  $this->_initRefreshSettings($storeId);
140
 
141
+ if ($transactions_enabled != 0 && !$manually) {
142
+ $this->_connRes->beginTransaction();
 
 
143
  }
144
 
145
+ foreach($importData as $key => $importDatum) {
 
 
 
 
 
146
 
147
+ $sortedProductData = $this->_mapAttributes($importDatum);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
148
 
149
+ $productData = $sortedProductData['productData'];
150
+ $iceimportAttributes = $sortedProductData['iceimportAttributes'];
 
 
 
151
 
 
 
 
 
 
152
 
153
+ $DB_helper->deleteLogEntry('try_delete_product_percentage_warning_flag');
154
+ if ($batchId != $DB_helper->getConfigData($this->process_id . '_flag')) {
155
+ //set flag, first iteration
156
+ $DB_helper->unsetConfigData("import_total");
157
+ $DB_helper->unsetConfigData("counter");
158
+ $DB_helper->unsetConfigData("skipped_counter");
159
+ $DB_helper->setConfigData($this->process_id . '_flag', $batchId);
160
+ }
161
 
162
+ $import_total = $DB_helper->getConfigData("import_total");
163
+ $counter = $DB_helper->getConfigData("counter");
164
+ $skipped_counter = $DB_helper->getConfigData("skipped_counter");
 
 
165
 
166
+ if (empty($import_total)) {
167
+ $batchModel = Mage::getModel('dataflow/batch')->load($batchId);
168
+ $batchImportModel = $batchModel->getBatchImportModel();
169
+ $importIds = $batchImportModel->getIdCollection();
170
+ $import_total = count($importIds);
171
+ $DB_helper->setConfigData("import_total", (int)$import_total);
172
+ }
173
+ if (empty($counter)) {
174
+ $DB_helper->setConfigData("counter", 1);
175
+ $counter = $DB_helper->getConfigData("counter");
176
+ }
177
+ if (empty($skipped_counter)) {
178
+ $DB_helper->setConfigData("skipped_counter", 0);
179
+ $skipped_counter = $DB_helper->getConfigData("skipped_counter");
180
+ }
181
 
182
+ // mark product ice_import generic
183
+ $productData['varchar']['is_iceimport'] = 1;
 
 
 
184
 
185
+ // set sku
186
+ if (empty($iceimportAttributes['sku'])) {
187
+ $message = Mage::helper('catalog')->__('Skip import row, required field "%s" not defined', 'sku');
188
+ Mage::throwException($message);
189
+ }
190
+ $sku = $iceimportAttributes['sku'];
191
+
192
+ if (!empty($iceimportAttributes['categories'])) {
193
+ if (!empty($iceimportAttributes['categories'])) {
194
+ $cat_names = explode('/', $iceimportAttributes['categories']);
195
+ foreach ($cat_names as $cat_name) {
196
+ if (empty($cat_name)) {
197
+ $message = Mage::helper('catalog')->__('Skip import row, some of categories does not have name');
198
+ Mage::throwException($message);
199
+ }
200
+ }
201
+ }
202
+ }
203
+ if (!empty($iceimportAttributes['categories'])) {
204
+ $category = $iceimportAttributes['categories'];
205
+ if (empty($iceimportAttributes['unspsc'])) {
206
+ $message = Mage::helper('catalog')->__('Skip import. Category UNSPSC not defined in store');
207
+ Mage::throwException($message);
208
+ }
209
+ $unspsc = $iceimportAttributes['unspsc'];
210
+ $unspsc = preg_replace("/[^a-zA-Z0-9]/", "", $unspsc);
211
+ if (empty($iceimportAttributes['unspsc_path'])) {
212
+ $message = Mage::helper('catalog')->__('Skip import. Category UNSPSC path not defined in store');
213
+ Mage::throwException($message);
214
+ }
215
+ if (!empty($iceimportAttributes['unspsc_path'])) {
216
+ $cat_unspscs = explode('/', $iceimportAttributes['unspsc_path']);
217
+ foreach ($cat_unspscs as $cat_unspsc) {
218
+ if (empty($cat_unspsc)) {
219
+ $message = Mage::helper('catalog')->__('Skip import row, some of categories does not have UNSPSC');
220
+ Mage::throwException($message);
221
+ }
222
+ }
223
+ }
224
+ $unspscPath = $iceimportAttributes['unspsc_path'];
225
+ $unspscPath = preg_replace("/[^a-zA-Z0-9\/]/", "", $unspscPath);
226
+ if (!empty($cat_unspscs) && !empty($cat_names) && count($cat_names) != count($cat_unspscs)) {
227
+ $message = Mage::helper('catalog')->__('Skip import row, categories names does not match categories UNSPSC');
228
+ Mage::throwException($message);
229
+ }
230
+ }
231
 
232
+ // set website id;
233
+ $websites = Mage::getStoreConfig('iceshop_iceimport_importprod_root/importprod/websites');
234
+ if (empty($websites)) {
235
+ $message = Mage::helper('catalog')->__('Skip import row, required field "%s" not defined', 'websites');
236
+ Mage::throwException($message);
237
+ }
238
 
239
+ $website = Mage::app()->getWebsite(trim($websites));
240
+ $websiteId = $website->getId();
241
+
242
+ // set in / out of stock
243
+ $isInStock = 0;
244
+ if (!empty($iceimportAttributes['is_in_stock'])) {
245
+ $isInStock = $iceimportAttributes['is_in_stock'];
 
 
 
 
 
 
 
 
 
246
  }
 
 
247
 
248
+ // set qty
249
+ $qty = 0;
250
+ if (!empty($iceimportAttributes['qty'])) {
251
+ $qty = $iceimportAttributes['qty'];
252
+ }
253
 
254
+ // set price
255
+ $price = 0.00;
256
+ if (!empty($iceimportAttributes['price'])) {
257
+ $price = $iceimportAttributes['price'];
258
+ }
259
 
260
+ // set tax_auvibel
261
+ $tax_auvibel = 0.00;
262
+ if (!empty($iceimportAttributes['tax_auvibel'])) {
263
+ $tax_auvibel = $iceimportAttributes['tax_auvibel'];
264
+ }
265
 
266
+ // set tax_bebat
267
+ $tax_bebat = 0.00;
268
+ if (!empty($iceimportAttributes['tax_bebat'])) {
269
+ $tax_bebat = $iceimportAttributes['tax_bebat'];
270
+ }
271
 
272
+ // set tax_recupel
273
+ $tax_recupel = 0.00;
274
+ if (!empty($iceimportAttributes['tax_recupel'])) {
275
+ $tax_recupel = $iceimportAttributes['tax_recupel'];
276
+ }
277
+
278
+ // set tax_reprobel
279
+ $tax_reprobel = 0.00;
280
+ if (!empty($iceimportAttributes['tax_reprobel'])) {
281
+ $tax_reprobel = $iceimportAttributes['tax_reprobel'];
282
+ }
283
+
284
+ // set status value
285
+ $statusValue = (!empty($iceimportAttributes['status']) && $iceimportAttributes['status'] == 'Enabled') ? 1 : 2;
286
+ $productData['int']['status'] = $statusValue;
287
+
288
+ // set visibility value
289
+ $visibilityValue = 1;
290
+ if (!empty($iceimportAttributes['visibility'])) {
291
+ switch ($iceimportAttributes['visibility']) {
292
+ case 'Not Visible Individually':
293
+ $visibilityValue = 1;
294
+ break;
295
+ case 'Catalog':
296
+ $visibilityValue = 2;
297
+ break;
298
+ case 'Search':
299
+ $visibilityValue = 3;
300
+ break;
301
+ case 'Catalog, Search':
302
+ $visibilityValue = 4;
303
+ break;
304
+ }
305
+ }
306
+ $productData['int']['visibility'] = $visibilityValue;
307
+
308
+ // set product image
309
+ $productImage = '';
310
+ if (!empty($iceimportAttributes['image'])) {
311
+ $productImage = $iceimportAttributes['image'];
312
+ }
313
+
314
+ $initAttributes = '';
315
+ // init general attributes query
316
+ $initAttributes .= "SELECT @product_entity_type_id := `entity_type_id`
317
+ FROM `{$this->_tablePrefix}eav_entity_type`
318
+ WHERE entity_type_code = 'catalog_product';";
319
+
320
+ $initAttributes .= "SELECT @price_id := `attribute_id`
321
  FROM `{$this->_tablePrefix}eav_attribute`
322
  WHERE `attribute_code` = 'price'
323
  AND entity_type_id = @product_entity_type_id;";
324
 
325
+ $initAttributes .= "SELECT @attribute_set_id := `attribute_set_id`
326
+ FROM `{$this->_tablePrefix}eav_attribute_set`
327
+ WHERE attribute_set_name = :attribute_set
328
+ AND entity_type_id = @product_entity_type_id;";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
329
 
330
+ if (!empty($iceimportAttributes['categories'])) {
331
+ $initAttributes .= "SELECT @category_entity_type_id := `entity_type_id`
332
+ FROM `{$this->_tablePrefix}eav_entity_type`
333
+ WHERE entity_type_code = 'catalog_category';";
334
+ }
335
+
336
+ if (!empty($iceimportAttributes['categories'])) {
337
+ $initAttributes .= "SELECT @unspsc_id := `attribute_id`
338
+ FROM `{$this->_tablePrefix}eav_attribute`
339
+ WHERE `attribute_code` = 'unspsc'
340
+ AND entity_type_id = @category_entity_type_id;";
341
+
342
+ $initAttributes .= "SELECT @category_name_id := `attribute_id`
343
+ FROM `{$this->_tablePrefix}eav_attribute`
344
+ WHERE `attribute_code` = 'name'
345
+ AND entity_type_id = @category_entity_type_id;";
346
+
347
+ $initAttributes .= "SELECT @category_active_id := `attribute_id`
348
+ FROM `{$this->_tablePrefix}eav_attribute`
349
+ WHERE `attribute_code` = 'is_active'
350
+ AND entity_type_id = @category_entity_type_id;";
351
+
352
+ $initAttributes .= "SELECT @include_nav_bar_id := `attribute_id`
353
+ FROM `{$this->_tablePrefix}eav_attribute`
354
+ WHERE `attribute_code` = 'include_in_menu'
355
+ AND entity_type_id = @category_entity_type_id;";
356
+
357
+ $initAttributes .= "SELECT @category_is_anchor_id := `attribute_id`
358
+ FROM `{$this->_tablePrefix}eav_attribute`
359
+ WHERE `attribute_code` = 'is_anchor'
360
+ AND entity_type_id = @category_entity_type_id;";
361
+ }
362
+
363
+ $initAttributes .= "SELECT @tax_auvibel_id := `attribute_id`
364
+ FROM `{$this->_tablePrefix}eav_attribute`
365
+ WHERE `attribute_code` = 'tax_auvibel'
366
+ AND entity_type_id = @product_entity_type_id;";
367
+
368
+ $initAttributes .= "SELECT @tax_bebat_id := `attribute_id`
369
+ FROM `{$this->_tablePrefix}eav_attribute`
370
+ WHERE `attribute_code` = 'tax_bebat'
371
+ AND entity_type_id = @product_entity_type_id;";
372
+
373
+ $initAttributes .= "SELECT @tax_recupel_id := `attribute_id`
374
+ FROM `{$this->_tablePrefix}eav_attribute`
375
+ WHERE `attribute_code` = 'tax_recupel'
376
+ AND entity_type_id = @product_entity_type_id;";
377
+
378
+ $initAttributes .= "SELECT @tax_reprobel_id := `attribute_id`
379
+ FROM `{$this->_tablePrefix}eav_attribute`
380
+ WHERE `attribute_code` = 'tax_reprobel'
381
+ AND entity_type_id = @product_entity_type_id;";
382
+
383
+ if (!empty($stock_name)) {
384
+ $stock_id = $this->_connRes->fetchRow("SELECT stock_id FROM `{$this->_tablePrefix}cataloginventory_stock` WHERE stock_name = :stock_name LIMIT 1", array(
385
+ ':stock_name' => $stock_name
386
+ ));
387
+ if (!empty($stock_id)) {
388
+ $initAttributes .= "SELECT @stock_id := `stock_id` FROM `{$this->_tablePrefix}cataloginventory_stock` WHERE stock_name = '" . $stock_name . "';";
389
+ } else {
390
+ $message = Mage::helper('catalog')->__('Skip import row, stock name "' . $stock_name . '" does not exists in the shop');
391
+ Mage::throwException($message);
392
+ }
393
  } else {
394
+ $initAttributes .= "SELECT @stock_id := `stock_id` FROM `{$this->_tablePrefix}cataloginventory_stock` WHERE stock_name = 'Default';";
 
395
  }
396
+ $this->_connRes->query($initAttributes, array(':attribute_set' => $iceimportAttributes['attribute_set']));
 
 
 
397
 
398
+ // get tax class id
 
 
399
 
400
+ $productData['int']['tax_class_id'] = $defaulttaxConf;
 
 
 
 
401
 
402
+ if (!empty($iceimportAttributes['categories'])) {
403
+ // get category id
404
+ $categoryIds = $this->_addCategories($category, $storeId, $unspsc, $unspscPath, $categoriesToActiveConf);
405
+ }
 
 
 
406
 
407
+ // get url key
408
+ $url = '';
409
+ if (!empty($productData['varchar']['name'])) {
410
+ $preUrl = explode(' ', strtolower($productData['varchar']['name']));
411
+ $url = implode('-', $preUrl);
412
+ }
413
+ $productData['varchar']['url_key'] = $url;
 
414
 
415
+ $prodIdFetch = $this->_connRes->fetchRow("SELECT entity_id FROM `{$this->_tablePrefix}catalog_product_entity` WHERE sku = :sku LIMIT 1", array(
416
+ ':sku' => $sku
417
+ ));
418
+ $productId = $prodIdFetch['entity_id'];
 
419
 
420
+ if (!empty($productId)) {
421
+ // check import type (Import only price & qty or all product info)
422
 
423
+ if (!empty($iceimportAttributes['categories'])) {
424
+ $productId = $this->_coreSave($productData, $productId, $storeId, $sku, $categoryIds);
425
+ } else {
426
+ $productId = $this->_coreSave($productData, $productId, $storeId, $sku);
427
+ }
428
+
429
+ $this->_corePriceStock($websiteId, $productId, $price, $qty, $sku, $isInStock, $stockConf, $priceConf, 0);
430
+
431
+ $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));
432
+ } else {
433
+ if ($this->_getRefreshSetting('import_new_products') == 0) {
434
+ $DB_helper->setConfigData("skipped_counter", (int)++$skipped_counter);
435
+ return true;
436
+ }
437
+
438
+ if (!empty($iceimportAttributes['categories'])) {
439
+ $productId = $this->_coreSave($productData, $productId, $storeId, $sku, $categoryIds);
440
+ } else {
441
+ $productId = $this->_coreSave($productData, $productId, $storeId, $sku);
442
+ }
443
+ // add price & stock
444
+ if ($productId) {
445
+ $this->_corePriceStock($websiteId, $productId, $price, $qty, $sku, $isInStock);
446
+ $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));
447
+ }
448
  }
449
 
450
+ $this->_connRes->query("DELETE FROM {$this->_tablePrefix}weee_tax WHERE entity_id = :prod_id AND attribute_id = @tax_auvibel_id", array(':prod_id' => $productId));
451
+ $this->_connRes->query("DELETE FROM {$this->_tablePrefix}weee_tax WHERE entity_id = :prod_id AND attribute_id = @tax_bebat_id", array(':prod_id' => $productId));
452
+ $this->_connRes->query("DELETE FROM {$this->_tablePrefix}weee_tax WHERE entity_id = :prod_id AND attribute_id = @tax_recupel_id", array(':prod_id' => $productId));
453
+ $this->_connRes->query("DELETE FROM {$this->_tablePrefix}weee_tax WHERE entity_id = :prod_id AND attribute_id = @tax_reprobel_id", array(':prod_id' => $productId));
 
454
 
455
+ $countryCode = Mage::getStoreConfig('general/country/default');
456
+ if ($tax_auvibel > 0) {
457
+ $query = "INSERT INTO {$this->_tablePrefix}weee_tax (website_id, entity_id, country, value, state, attribute_id, entity_type_id)"
458
+ . "VALUES (0, :prod_id, :country, :value, '*', @tax_auvibel_id, @product_entity_type_id)";
459
+ $this->_connRes->query($query, [':prod_id' => $productId, ':country' => $countryCode, ':value' => $tax_auvibel]);
460
+ }
461
 
462
+ if ($tax_bebat > 0) {
463
+ $query = "INSERT INTO {$this->_tablePrefix}weee_tax (website_id, entity_id, country, value, state, attribute_id, entity_type_id)"
464
+ . "VALUES (0, :prod_id, :country, :value, '*', @tax_bebat_id, @product_entity_type_id)";
465
+ $this->_connRes->query($query, [':prod_id' => $productId, ':country' => $countryCode, ':value' => $tax_bebat]);
466
+ }
467
 
468
+ if ($tax_recupel > 0) {
469
+ $query = "INSERT INTO {$this->_tablePrefix}weee_tax (website_id, entity_id, country, value, state, attribute_id, entity_type_id)"
470
+ . "VALUES (0, :prod_id, :country, :value, '*', @tax_recupel_id, @product_entity_type_id)";
471
+ $this->_connRes->query($query, [':prod_id' => $productId, ':country' => $countryCode, ':value' => $tax_recupel]);
472
+ }
 
473
 
474
+ if ($tax_reprobel > 0) {
475
+ $query = "INSERT INTO {$this->_tablePrefix}weee_tax (website_id, entity_id, country, value, state, attribute_id, entity_type_id)"
476
+ . "VALUES (0, :prod_id, :country, :value, '*', @tax_reprobel_id, @product_entity_type_id)";
477
+ $this->_connRes->query($query, [':prod_id' => $productId, ':country' => $countryCode, ':value' => $tax_reprobel]);
478
+ }
479
 
480
+ // add product image to queue
481
+ if ($addImages) {
482
+ $this->_addImageToQueue($productId, $productImage);
483
+ }
 
484
 
 
 
 
 
 
485
 
486
+ $counter_sum = $counter + $skipped_counter;
 
 
 
487
 
488
+ if (isset($counter) && isset($skipped_counter) && isset($import_total) && $counter_sum == $import_total) {
489
 
490
+ $this->_runCategoriesSorting();
491
 
492
+ $this->deleteOldProducts($DB_logger);
493
 
494
+ $DB_logger->insertLogEntry('error' . md5(microtime(true)), 'New products skipped while export according to Iceimport settings: ' . $skipped_counter, 'stat');
 
 
495
 
496
+ $date = date('m/d/Y H:i:s');
497
+ $DB_logger->insertLogEntry('iceimport_import_ended', $date);
498
+ }
499
+ if ($counter < $import_total) {
500
+ $DB_helper->setConfigData("counter", (int)++$counter);
501
+ }
502
 
503
+ if ($transactions_enabled != 0 && !$manually) {
504
+ $this->_counter++;
 
 
 
 
505
 
506
+ if ($this->_counter % $batch_size == 0) {
507
+ try {
508
+ $this->_connRes->commit();
509
+ } catch (Exception $e) {
510
+ $this->_connRes->rollBack();
511
+ throw $e;
512
+ }
513
+ $this->_connRes->beginTransaction();
514
+ }
515
+ if ($this->_counter == count($importData)) {
516
+ try {
517
+ $this->_connRes->commit();
518
+ } catch (Exception $e) {
519
+ $this->_connRes->rollBack();
520
+ throw $e;
521
+ }
522
+ }
523
+ }
524
+ }
525
  return true;
526
  }
527
 
588
  */
589
  protected function _coreSave(array $entityData, $productId = null, $storeId = 0, $sku, $categoryIds =NULL)
590
  {
591
+
592
+ $currentDate = Mage::app()->getLocale()->date(null, null, null, false)->toString(Varien_Date::DATETIME_INTERNAL_FORMAT);
593
+
594
  $coreSaveSQL = '';
595
  $newProduct = false;
596
  if ($productId === null) {
597
  // add product to store
598
+ $coreSaveProduct = "INSERT INTO `{$this->_tablePrefix}catalog_product_entity` (`entity_type_id`, `attribute_set_id`, `type_id`, `sku`, `created_at`, `updated_at`)
599
+ VALUES (@product_entity_type_id, @attribute_set_id, 'simple', :sku, :current_date, :current_date);
600
  SELECT @product_id := LAST_INSERT_ID();";
601
+
602
+ $this->_connRes->query($coreSaveProduct, array(':sku' => $sku, ':current_date' => $currentDate));
603
  $prodFetch = $this->_connRes->fetchRow("SELECT @product_id AS prod_id");
604
  $productId = $prodFetch['prod_id'];
605
  $newProduct = TRUE;
612
  $productnameConf = (int)Mage::getStoreConfig('iceshop_iceimport_importprod_root/importprod/import_product_name', $storeId);
613
  $productshdescriptionConf = (int)Mage::getStoreConfig('iceshop_iceimport_importprod_root/importprod/import_product_short_description', $storeId);
614
  $productdescriptionConf = (int)Mage::getStoreConfig('iceshop_iceimport_importprod_root/importprod/import_product_description', $storeId);
 
 
615
  $productbrandConf = (int)Mage::getStoreConfig('iceshop_iceimport_importprod_root/importprod/import_product_brand_name', $storeId);
616
  $deliveryetaConf = (int)Mage::getStoreConfig('iceshop_iceimport_importprod_root/importprod/import_product_delivery_eta', $storeId);
617
+ $attribute_mapping_mpn = Mage::getStoreConfig('iceshop_iceimport_importprod_root/importprod/attribute_mapping_mpn');
618
+ $attribute_mapping_brand_name = Mage::getStoreConfig('iceshop_iceimport_importprod_root/importprod/attribute_mapping_brand_name');
619
+ $attribute_mapping_ean = Mage::getStoreConfig('iceshop_iceimport_importprod_root/importprod/attribute_mapping_ean');
620
+ $attribute_mapping_delivery_eta = Mage::getStoreConfig('iceshop_iceimport_importprod_root/importprod/attribute_mapping_delivery_eta');
621
 
622
  foreach ($entityData as $type => $typeAttributes) {
623
  foreach ($typeAttributes as $attribute => $value) {
624
  if (
625
  (
626
+ ($attribute == $attribute_mapping_mpn && $productmpnConf == 0) ||
627
+ ($attribute == $attribute_mapping_brand_name && $productbrandConf == 0) ||
628
+ ($attribute == $attribute_mapping_ean && $producteanConf == 0) ||
629
  ($attribute == 'name' && $productnameConf == 0) ||
630
  ($attribute == 'short_description' && $productshdescriptionConf == 0) ||
631
  ($attribute == 'description' && $productdescriptionConf == 0) ||
632
+ ($attribute == $attribute_mapping_delivery_eta && $deliveryetaConf == 0)
 
 
633
  ) || (
634
  $attribute == 'sku' ||
635
  ($attribute == 'attribute_set') ||
656
  }
657
  }
658
  }
659
+
660
+ $updateDate = "UPDATE `{$this->_tablePrefix}catalog_product_entity` SET `updated_at` = :current_date where entity_id = {$productId}";
661
+ $this->_connRes->query($updateDate, array(':current_date' => $currentDate));
662
  }
663
 
664
  $bindArray[':store_id'] = $storeId;
744
  $noDelCategory = '';
745
  if(!empty($not_delete_category)){
746
  foreach ($not_delete_category as $category_ID ){
747
+ $noDelCategory .= ''.$category_ID['entity_id'] . ',';
748
  }
749
  }
750
  if(!empty($noDelCategory)){
751
+ $noDelCategory = substr($noDelCategory, 0, -1);
752
  }
753
 
754
  if (!empty($mapCategoryIds)) {
755
  foreach ($mapCategoryIds as $delCategoryId) {
756
  $delCategoryId = (int)$delCategoryId;
757
  $coreSaveSQL .= "DELETE FROM `{$this->_tablePrefix}catalog_category_product`";
758
+ if(!empty($noDelCategory)){
759
  $coreSaveSQL .= "WHERE `category_id` NOT IN({$noDelCategory},{$delCategoryId}) AND `product_id` = @product_id;";
760
+ } else {
761
  $coreSaveSQL .= "WHERE `category_id`!={$delCategoryId} AND `product_id` = @product_id;";
762
+ }
763
  }
764
  }
765
  try {
785
  * @return boolean
786
  */
787
  protected function _checkAttributeExist($attributeCode){
788
+ $query = "SELECT `attribute_id` FROM `{$this->_tablePrefix}eav_attribute` WHERE attribute_code='{$attributeCode}';";
789
+ $attributeCheck = $this->_connRes->fetchRow($query);
790
+ $attributeId = $attributeCheck['attribute_id'];
791
+ if(empty($attributeId)){
792
  return false;
793
+ }
794
+ return true;
795
  }
796
 
797
  /**
929
  $this->_connRes->query($stockSaveSQL, $fields_values);
930
  unset($stockSaveSQL);
931
  }
932
+ unset($fields_values);
933
  }
934
 
935
  /**
991
  );
992
  $product->save();
993
  $this->setImageAsDownloaded($queueId);
 
994
  unset($product);
995
  } else {
996
  $this->setImageAsDownloadedError($queueId);
1051
  // merge categories by unspsc
1052
  $categoryMergedArray = $this->_categoryMapper($categories, $unspscPath);
1053
  foreach ($categoryMergedArray as $category) {
1054
+
1055
  $categoryName = $category['name'];
1056
  $categoryUnspsc = $category['unspsc'];
1057
  $categoryTreeId = $this->_getCategoryIdByUnspsc($categoryUnspsc,$storeId);
1070
  );
1071
  $nameChecker = $nameCheckerFetch['value_id'];
1072
  if (!$nameChecker) {
1073
+
1074
  // add category name to current store
1075
  $categoryBindArray[':category_name'] = $categoryName;
1076
  if (!empty($categoryBindArray[':category_id'])) {
1185
  if ($unspsc == 'default_root') {
1186
  return Mage::app()->getStore($storeId)->getRootCategoryId();
1187
  } else {
1188
+ // $replace = array(']','[', '{','}','^','-','<','>','(',')');
1189
+ // $unspsc = str_replace($replace, '', $unspsc);
1190
  $categoryId = $this->_connRes->fetchRow(
1191
  "SELECT entity_id
1192
  FROM `{$this->_tablePrefix}catalog_category_entity_varchar`
1284
  $iceAttributes = array();
1285
  foreach ($importData as $attribute => $value) {
1286
  // map iceimport attributes
1287
+
1288
  if ($attribute == 'sku' ||
1289
  $attribute == 'attribute_set' ||
1290
  $attribute == 'categories' ||
1372
 
1373
  }
1374
 
1375
+
1376
  /**
1377
  * @return array
1378
  */
1579
  }
1580
 
1581
  $query = "SELECT COUNT(*) FROM `{$this->_tablePrefix}catalog_category_product` WHERE category_id = :cat_id ";
1582
+ //$query = "SELECT COUNT(category_id) FROM `{$this->_tablePrefix}catalog_category_product` WHERE category_id = :cat_id ";
1583
  $cat_products = $this->_connRes->fetchRow($query, array(
1584
  ':cat_id' => $category->getId()
1585
  ));
1586
 
1587
+ //if ($cat_products['COUNT(category_id)'] == 0) {
1588
  if ($cat_products['COUNT(*)'] == 0) {
1589
  $query = "SELECT `entity_id` FROM `{$this->_tablePrefix}catalog_category_entity` WHERE parent_id = :cat_id";
1590
  $child_cat = $this->_connRes->fetchAll($query, array(
1595
  //Count child categories products and set them to inactive if they have no
1596
  $this->CountChildProd($child_cat);
1597
  } elseif($this->_getRefreshSetting('update_hide_category') == 1) {
1598
+
1599
  $this->_connRes->query("UPDATE `{$this->_tablePrefix}catalog_category_entity_int`
1600
  SET `value` = 0 WHERE `attribute_id` = @category_active_id AND entity_id = :cat_id", array(
1601
  ':cat_id' => $category->getId()
1602
  ));
1603
+ $query = "SELECT path
1604
+ FROM `{$this->_tablePrefix}catalog_category_entity`
1605
+ WHERE entity_id = :cat_id ";
1606
+ $cat_products = $this->_connRes->fetchRow(
1607
+ $query,
1608
+ array(
1609
+ ':cat_id' => $category->getId()
1610
+ )
1611
+ );
1612
+ $ar_cat_products = explode("/", $cat_products['path']);
1613
+
1614
+ $count_of_all_products = 0;
1615
+
1616
+ foreach($ar_cat_products as $key => $value) {
1617
+ $query = "SELECT COUNT(*) FROM `{$this->_tablePrefix}catalog_category_product` WHERE category_id = :cat_id ";
1618
+ //$query = "SELECT COUNT(category_id) FROM `{$this->_tablePrefix}catalog_category_product` WHERE category_id = :cat_id ";
1619
+ $products_of_category = $this->_connRes->fetchRow($query, array(
1620
+ ':cat_id' => $value
1621
+ ));
1622
+
1623
+ $cat = Mage::getModel('catalog/category')->load($value);
1624
+
1625
+ $subcats = $cat->getChildren();
1626
+ $ar_subcatgs = explode(',',$subcats);
1627
+ foreach($ar_subcatgs as $item) {
1628
+ $query = "SELECT COUNT(*) FROM `{$this->_tablePrefix}catalog_category_product` WHERE category_id = :cat_id ";
1629
+ //$query = "SELECT COUNT(category_id) FROM `{$this->_tablePrefix}catalog_category_product` WHERE category_id = :cat_id ";
1630
+ $products_of_category_children = $this->_connRes->fetchRow($query, array(
1631
+ ':cat_id' => $item
1632
+ ));
1633
+ //$count_of_all_products += $products_of_category_children['COUNT(*)'];
1634
+ if($products_of_category_children > 0) {
1635
+ $count_of_all_products += $products_of_category_children['COUNT(*)'];
1636
+ }
1637
+ }
1638
+
1639
+ //p($count_of_all_products);
1640
+ if($products_of_category['COUNT(*)'] == 0 && $count_of_all_products == 0) {
1641
+ //if($products_of_category['COUNT(category_id)'] == 0 && $count_of_all_products == 0) {
1642
+ $this->_connRes->query("UPDATE `{$this->_tablePrefix}catalog_category_entity_int`
1643
+ SET `value` = 0 WHERE `attribute_id` = @category_active_id AND entity_id = :cat_id", array(
1644
+ ':cat_id' => $value
1645
+ ));
1646
+ }
1647
+ else {
1648
+ $this->_connRes->query("UPDATE `{$this->_tablePrefix}catalog_category_entity_int`
1649
+ SET `value` = 1 WHERE `attribute_id` = @category_active_id AND entity_id = :cat_id", array(
1650
+ ':cat_id' => $value
1651
+ ));
1652
+ }
1653
+ }
1654
+ }
1655
+ else {
1656
+ $this->_connRes->query("UPDATE `{$this->_tablePrefix}catalog_category_entity_int`
1657
+ SET `value` = 1 WHERE `attribute_id` = @category_active_id AND entity_id = :cat_id", array(
1658
+ ':cat_id' => $category->getId()
1659
+ ));
1660
  }
1661
  }
1662
  }
1677
  FROM {$this->_tablePrefix}eav_attribute
1678
  WHERE attribute_code = 'is_iceimport'");
1679
 
1680
+ //$count_prod = $db_res->fetchRow("SELECT COUNT(*) AS count_prod
1681
+ $count_prod = $db_res->fetchRow("SELECT COUNT(cpe.entity_id) AS count_prod
1682
  FROM {$this->_tablePrefix}catalog_product_entity AS cpe
1683
  JOIN {$this->_tablePrefix}catalog_product_entity_varchar AS cpev
1684
  ON cpe.entity_id = cpev.entity_id
1689
 
1690
  if ($count_prod > 0) {
1691
  //iceimport products exists, amount > 0
1692
+ //$count_del_prod = $db_res->fetchRow("SELECT COUNT(*) AS count__del_prod
1693
+ $count_del_prod = $db_res->fetchRow("SELECT COUNT(cpe.entity_id) AS count__del_prod
1694
  FROM {$this->_tablePrefix}catalog_product_entity AS cpe
1695
  JOIN {$this->_tablePrefix}catalog_product_entity_varchar AS cpev
1696
  ON cpe.entity_id = cpev.entity_id
1706
  $count_del_prod = 0;
1707
  }
1708
 
1709
+ $delete_old_products_tolerance = (int)Mage::getStoreConfig('iceshop_iceimport_importprod_root/importprod/delete_old_products_tolerance');
1710
 
1711
  if ($count_del_prod > 0) {
1712
  //iceimport products to delete exists, amount > 0
1730
  } else {
1731
  $error_message = 'Attempt to delete more old products than allowed in Iceimport configuration. Interruption of the process.';
1732
  $DB_logger->insertLogEntry('error_try_delete_product', $error_message);
 
1733
  $error_message2 = 'Old product percentage: ' . round(($count_del_prod / $count_prod * 100), 2) . '%';
1734
  $DB_logger->insertLogEntry('error_try_delete_product_percentage', $error_message2);
1735
+
1736
+ //flag to warning notice
1737
+ $DB_logger->insertLogEntry('try_delete_product_percentage_warning_flag', 'SHOW');
1738
  print $error_message;
1739
  print $error_message2;
1740
  exit;
1755
  /**
1756
  * Back compatibility event
1757
  */
1758
+ $this->_checkAndSetIceField();
1759
  $DB_logger = Mage::helper('iceimport/db');
1760
  $tablePrefix = '';
1761
  $tPrefix = (array)Mage::getConfig()->getTablePrefix();
1767
 
1768
  Mage::dispatchEvent($this->_eventPrefix . '_after', array());
1769
 
1770
+ $re_index_required = (int)Mage::getStoreConfig('iceshop_iceimport_importprod_root/importprod/is_reindex_required_import');
1771
+ if ((isset($re_index_required)) && ($re_index_required == 1)) {
1772
+ $entity = new Varien_Object();
1773
+ Mage::getSingleton('index/indexer')->processEntityAction(
1774
+ $entity,
1775
+ self::ENTITY,
1776
+ Mage_Index_Model_Event::TYPE_SAVE
1777
+ );
1778
+ }
1779
  }
1780
 
1781
 
1792
  ON ea.`attribute_id` = ccev.`attribute_id`
1793
  WHERE ea.`attribute_code`='unspsc' AND (ccev.`store_id` = 0 OR ccev.`store_id`=:store_id) AND ccev.`value` IS NULL;";
1794
 
1795
+ return $this->_connRes->fetchAll($query, array( ':store_id' => $store_id ));
1796
+ }
1797
+
1798
+ /**
1799
+ * Check active_ice field and update if need
1800
+ * @throws Mage_Core_Exception
1801
+ */
1802
+ private function _checkAndSetIceField()
1803
+ {
1804
+ $attribute = Mage::getModel('eav/config')->getAttribute('catalog_product', 'active_ice')->getData();
1805
+ if (isset($attribute['attribute_id'])) {
1806
+ $write = Mage::getSingleton('core/resource')->getConnection('core_write');
1807
+ $read = Mage::getSingleton('core/resource')->getConnection('core_read');
1808
+ $prefix = Mage::getConfig()->getTablePrefix();
1809
+ if (!empty($prefix[0])) {
1810
+ $prefix = $prefix[0];
1811
+ } else {
1812
+ $prefix = '';
1813
+ }
1814
+
1815
+ $sql = "DROP PROCEDURE IF EXISTS FIELD_EXISTS;";
1816
+ $write->query($sql);
1817
+
1818
+ $sql = "CREATE PROCEDURE FIELD_EXISTS(
1819
+ OUT _exists BOOLEAN, -- return value
1820
+ IN tableName CHAR(255) CHARACTER SET 'utf8', -- name of table to look for
1821
+ IN columnName CHAR(255) CHARACTER SET 'utf8', -- name of column to look for
1822
+ IN dbName CHAR(255) CHARACTER SET 'utf8' -- optional specific db
1823
+ ) BEGIN
1824
+ -- try to lookup db if none provided
1825
+ SET @_dbName := IF(dbName IS NULL, database(), dbName);
1826
+
1827
+ IF CHAR_LENGTH(@_dbName) = 0
1828
+ THEN -- no specific or current db to check against
1829
+ SELECT
1830
+ FALSE
1831
+ INTO _exists;
1832
+ ELSE -- we have a db to work with
1833
+ SELECT
1834
+ IF(count(*) > 0, TRUE, FALSE)
1835
+ INTO _exists
1836
+ FROM information_schema.COLUMNS c
1837
+ WHERE
1838
+ c.TABLE_SCHEMA = @_dbName
1839
+ AND c.TABLE_NAME = tableName
1840
+ AND c.COLUMN_NAME = columnName;
1841
+ END IF;
1842
+ END;";
1843
+ $write->query($sql);
1844
+
1845
+ $sql = "CALL FIELD_EXISTS(@_exists, '{$prefix}catalog_product_entity', 'active_ice', NULL);";
1846
+ $read->query($sql);
1847
+
1848
+ $sql = "SELECT @_exists;";
1849
+ $res = $read->fetchCol($sql);
1850
+ if (array_shift($res)) {
1851
+ $options = Mage::getModel('eav/config')->getAttribute('catalog_product', 'active_ice')->getSource()->getAllOptions();
1852
+ $optionId = false;
1853
+ foreach ($options as $option) {
1854
+ if ($option['label'] == 'Yes') {
1855
+ $optionId = $option['value'];
1856
+ break;
1857
+ }
1858
+ }
1859
+ if ($optionId) {
1860
+ $sql = "UPDATE `{$prefix}catalog_product_entity` SET `active_ice` = '{$optionId}' WHERE `active_ice` IS NULL;";
1861
+ $write->query($sql);
1862
+ }
1863
+ }
1864
+ }
1865
  }
1866
  }
1867
+
1868
+
app/code/community/ICEshop/Iceimport/Model/Dataflow/Batch/Import.php CHANGED
@@ -1,53 +1,53 @@
1
- <?php
2
-
3
- /**
4
- * Dataflow Batch import model
5
- *
6
- * @method Mage_Dataflow_Model_Resource_Batch_Import _getResource()
7
- * @method Mage_Dataflow_Model_Resource_Batch_Import getResource()
8
- * @method int getBatchId()
9
- * @method Mage_Dataflow_Model_Batch_Import setBatchId(int $value)
10
- * @method int getStatus()
11
- * @method Mage_Dataflow_Model_Batch_Import setStatus(int $value)
12
- *
13
- * @category Mage
14
- * @package Mage_Dataflow
15
- * @author Magento Core Team <core@magentocommerce.com>
16
- */
17
- class ICEshop_Iceimport_Model_Dataflow_Batch_Import extends Mage_Dataflow_Model_Batch_Import
18
- {
19
- protected $_connRes = null;
20
-
21
- protected function _construct()
22
- {
23
- $this->_connRes = Mage::getSingleton('core/resource')->getConnection('core_write');
24
- $this->_init('dataflow/batch_import');
25
-
26
- }
27
-
28
- public function setBatchData($data)
29
- {
30
-
31
- if ('"libiconv"' == ICONV_IMPL) {
32
- foreach ($data as $item) {
33
- foreach ($item as &$value) {
34
- $value = iconv('utf-8', 'utf-8//IGNORE', $value);
35
- }
36
- }
37
- }
38
-
39
- $batch_import = Mage::getSingleton('core/resource')->getTableName('dataflow/batch_import');
40
- $insert_query = "INSERT INTO " . $batch_import . " (`batch_id`, `batch_data`, `status`) VALUES ";
41
- foreach ($data as $item) {
42
- if (!empty($item)) {
43
- $insert_query .= "(" . $this->getBatchId() . ", '" . addslashes(serialize($item)) . "', 1), ";
44
- }
45
- }
46
- $insert_query = substr($insert_query, 0, -2);
47
-
48
- $this->_connRes->query($insert_query);
49
-
50
- return $this;
51
- }
52
-
53
- }
1
+ <?php
2
+
3
+ /**
4
+ * Dataflow Batch import model
5
+ *
6
+ * @method Mage_Dataflow_Model_Resource_Batch_Import _getResource()
7
+ * @method Mage_Dataflow_Model_Resource_Batch_Import getResource()
8
+ * @method int getBatchId()
9
+ * @method Mage_Dataflow_Model_Batch_Import setBatchId(int $value)
10
+ * @method int getStatus()
11
+ * @method Mage_Dataflow_Model_Batch_Import setStatus(int $value)
12
+ *
13
+ * @category Mage
14
+ * @package Mage_Dataflow
15
+ * @author Magento Core Team <core@magentocommerce.com>
16
+ */
17
+ class ICEshop_Iceimport_Model_Dataflow_Batch_Import extends Mage_Dataflow_Model_Batch_Import
18
+ {
19
+ protected $_connRes = null;
20
+
21
+ protected function _construct()
22
+ {
23
+ $this->_connRes = Mage::getSingleton('core/resource')->getConnection('core_write');
24
+ $this->_init('dataflow/batch_import');
25
+
26
+ }
27
+
28
+ public function setBatchData($data)
29
+ {
30
+
31
+ if ('"libiconv"' == ICONV_IMPL) {
32
+ foreach ($data as $item) {
33
+ foreach ($item as &$value) {
34
+ $value = iconv('utf-8', 'utf-8//IGNORE', $value);
35
+ }
36
+ }
37
+ }
38
+
39
+ $batch_import = Mage::getSingleton('core/resource')->getTableName('dataflow/batch_import');
40
+ $insert_query = "INSERT INTO " . $batch_import . " (`batch_id`, `batch_data`, `status`) VALUES ";
41
+ foreach ($data as $item) {
42
+ if (!empty($item)) {
43
+ $insert_query .= "(" . $this->getBatchId() . ", '" . addslashes(serialize($item)) . "', 1), ";
44
+ }
45
+ }
46
+ $insert_query = substr($insert_query, 0, -2);
47
+
48
+ $this->_connRes->query($insert_query);
49
+
50
+ return $this;
51
+ }
52
+
53
+ }
app/code/community/ICEshop/Iceimport/Model/Dataflow/Convert/Adapter/Io.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class ICEshop_Iceimport_Model_Dataflow_Convert_Adapter_Io extends Mage_Dataflow_Model_Convert_Adapter_Io
4
+ {
5
+ /**
6
+ * Load data
7
+ *
8
+ * @return Mage_Dataflow_Model_Convert_Adapter_Io
9
+ */
10
+ public function load()
11
+ {
12
+ if (!$this->getResource()) {
13
+ return $this;
14
+ }
15
+
16
+ $batchModel = Mage::getSingleton('dataflow/batch');
17
+ $destFile = $batchModel->getIoAdapter()->getFile(true);
18
+
19
+ $result = $this->getResource()->read($this->getVar('filename'), $destFile);
20
+ $filename = $this->getResource()->pwd() . '/' . $this->getVar('filename');
21
+ if (false === $result) {
22
+ $message = Mage::helper('dataflow')->__('Could not load file: "%s".', $filename);
23
+ Mage::throwException($message);
24
+ } else {
25
+ $message = Mage::helper('dataflow')->__('Loaded successfully: "%s".', $filename);
26
+ $this->addException($message);
27
+ }
28
+ //add imported filename in statistic
29
+ $db_helper = Mage::helper('iceimport/db');
30
+ $db_helper->insertLogEntry('import_filename', $this->getVar('filename'), 'info');
31
+
32
+ $this->setData($result);
33
+ return $this;
34
+ }
35
+ }
app/code/community/ICEshop/Iceimport/Model/Dataflow/Convert/Parser/Csv.php CHANGED
@@ -1,193 +1,239 @@
1
- <?php
2
-
3
- /**
4
- * Convert csv parser
5
- *
6
- * @category Mage
7
- * @package Mage_Dataflow
8
- * @author Magento Core Team <core@magentocommerce.com>
9
- */
10
- class ICEshop_Iceimport_Model_Dataflow_Convert_Parser_Csv extends Mage_Dataflow_Model_Convert_Parser_Csv
11
- {
12
- protected $_fields;
13
-
14
- protected $_mapfields = array();
15
-
16
- public function parse()
17
- {
18
- $this->clearIceimportIds();
19
- $DB_logger = Mage::helper('iceimport/db');
20
- $date = date('m/d/Y H:i:s');
21
- $DB_logger->deleteLogEntry('error_try_delete_product');
22
- $DB_logger->deleteLogEntry('error_try_delete_product_percentage');
23
- $DB_logger->insertLogEntry('iceimport_import_started', $date);
24
-
25
- $default_attr_set_id = Mage::getModel('catalog/product')->getResource()->getEntityType()->getDefaultAttributeSetId();
26
- $attributes = Mage::getModel('catalog/product_attribute_api')->items($default_attr_set_id);
27
-
28
- $req_attributes = array('brand_name', 'ean', 'mpn', 'is_iceimport');
29
- $not_found_attr = array();
30
- foreach ($req_attributes as $req_attribute) {
31
- foreach ($attributes as $_attribute) {
32
- if ($_attribute['code'] == $req_attribute) {
33
- unset($not_found_attr[$req_attribute]);
34
- break;
35
- } else {
36
- $not_found_attr[$req_attribute] = $req_attribute;
37
- }
38
- }
39
- }
40
- if (!empty($not_found_attr)) {
41
- echo '
42
- <li style="background-color:#FDD" id="error-0">
43
- <img id="error-0_img" src="' . Mage::getBaseUrl('web') . '/skin/adminhtml/default/default/images/error_msg_icon.gif" class="v-middle" style="margin-right:5px">
44
- <span id="error-0_status" class="text">Not found attributes: ' . implode(", ", $not_found_attr) . ' please check you default attribute set.</span>
45
- </li>';
46
- exit;
47
- }
48
-
49
- // fixed for multibyte characters
50
- setlocale(LC_ALL, Mage::app()->getLocale()->getLocaleCode() . '.UTF-8');
51
-
52
- $fDel = $this->getVar('delimiter', ',');
53
- $fEnc = $this->getVar('enclose', '"');
54
- if ($fDel == '\t') {
55
- $fDel = "\t";
56
- }
57
-
58
- $adapterName = $this->getVar('adapter', null);
59
- $adapterMethod = $this->getVar('method', 'saveRow');
60
-
61
- if (!$adapterName || !$adapterMethod) {
62
- $message = Mage::helper('dataflow')->__('Please declare "adapter" and "method" nodes first.');
63
- $this->addException($message, Mage_Dataflow_Model_Convert_Exception::FATAL);
64
- return $this;
65
- }
66
-
67
- try {
68
- $adapter = Mage::getModel($adapterName);
69
- } catch (Exception $e) {
70
- $message = Mage::helper('dataflow')->__('Declared adapter %s was not found.', $adapterName);
71
- $this->addException($message, Mage_Dataflow_Model_Convert_Exception::FATAL);
72
- return $this;
73
- }
74
-
75
- if (!is_callable(array($adapter, $adapterMethod))) {
76
- $message = Mage::helper('dataflow')->__('Method "%s" not defined in adapter %s.', $adapterMethod, $adapterName);
77
- $this->addException($message, Mage_Dataflow_Model_Convert_Exception::FATAL);
78
- return $this;
79
- }
80
-
81
- $batchModel = $this->getBatchModel();
82
- $batchIoAdapter = $this->getBatchModel()->getIoAdapter();
83
-
84
- if (Mage::app()->getRequest()->getParam('files')) {
85
- $file = Mage::app()->getConfig()->getTempVarDir() . '/import/'
86
- . urldecode(Mage::app()->getRequest()->getParam('files'));
87
- $this->_copy($file);
88
- }
89
-
90
- $batchIoAdapter->open(false);
91
-
92
- $isFieldNames = $this->getVar('fieldnames', '') == 'true' ? true : false;
93
- if (!$isFieldNames && is_array($this->getVar('map'))) {
94
- $fieldNames = $this->getVar('map');
95
- } else {
96
- $fieldNames = array();
97
- foreach ($batchIoAdapter->read(true, $fDel, $fEnc) as $v) {
98
- $fieldNames[$v] = $v;
99
- }
100
- }
101
- $countRows = 0;
102
- $currentRow = 0;
103
- $maxRows = (int)Mage::getStoreConfig(
104
- 'iceshop_iceimport_importprod_root/importprod/iceimport_batch_size',
105
- Mage::app()
106
- ->getWebsite()
107
- ->getDefaultGroup()
108
- ->getDefaultStoreId()
109
- );
110
- $itemData = array();
111
- while (($csvData = $batchIoAdapter->read(true, $fDel, $fEnc)) !== false) {
112
- if (count($csvData) == 1 && $csvData[0] === null) {
113
- continue;
114
- }
115
- $countRows++;
116
- $i = 0;
117
- foreach ($fieldNames as $field) {
118
- $itemData[$currentRow][$field] = isset($csvData[$i]) ? $csvData[$i] : null;
119
- $i++;
120
- }
121
-
122
- if ($currentRow == $maxRows) {
123
- $currentRow = 0;
124
- $batchImportModel = $this->getBatchImportModel()
125
- ->setBatchId($this->getBatchModel()->getId())
126
- ->setBatchData($itemData)->setStatus(1);
127
- $itemData = array();
128
- }
129
- $currentRow++;
130
-
131
- }
132
- if ($currentRow <= $maxRows && $currentRow != 0 && !empty($itemData)) {
133
- $batchImportModel = $this->getBatchImportModel()
134
- ->setBatchId($this->getBatchModel()->getId())
135
- ->setBatchData($itemData)->setStatus(1);
136
- }
137
-
138
- $this->addException(Mage::helper('dataflow')->__('Found %d rows.', $countRows));
139
- $this->addException(Mage::helper('dataflow')->__('Starting %s :: %s', $adapterName, $adapterMethod));
140
-
141
- $batchModel->setParams($this->getVars())
142
- ->setAdapter($adapterName)
143
- ->save();
144
-
145
- //latest session cleaning
146
- //Init session values to count total products and determine the last call of saveRow method
147
- $session = Mage::getSingleton("core/session");
148
- $import_total = $session->getData("import_total");
149
- $counter = $session->getData("counter");
150
- $skipped_counter = $session->getData("skipped_counter");
151
- if (isset($import_total)) {
152
- $session->unsetData("import_total");
153
- }
154
- if (isset($counter)) {
155
- $session->unsetData("counter");
156
- }
157
- if (isset($skipped_counter)) {
158
- $session->unsetData("skipped_counter");
159
- }
160
- $this->updateCatalogCategoryChildren();
161
-
162
- return $this;
163
- }
164
-
165
-
166
- public function clearIceimportIds(){
167
- $db_res = Mage::getSingleton('core/resource')->getConnection('core_write');
168
- $tablePrefix = '';
169
- $tPrefix = (array)Mage::getConfig()->getTablePrefix();
170
- if (!empty($tPrefix)) {
171
- $tablePrefix = $tPrefix[0];
172
- }
173
- $db_res->query("DELETE FROM {$tablePrefix}iceshop_iceimport_imported_product_ids");
174
- }
175
-
176
-
177
- /**
178
- * Update path to children category/root
179
- */
180
- public function updateCatalogCategoryChildren(){
181
- try{
182
- $db_res = Mage::getSingleton('core/resource')->getConnection('core_write');
183
- $tablePrefix = '';
184
- $tPrefix = (array)Mage::getConfig()->getTablePrefix();
185
- if (!empty($tPrefix)) {
186
- $tablePrefix = $tPrefix[0];
187
- }
188
- $db_res->query('UPDATE `'.$tablePrefix.'catalog_category_entity` SET children_count = (SELECT COUNT(*) FROM (SELECT * FROM `'.$tablePrefix.'catalog_category_entity`) AS table2 WHERE path LIKE CONCAT(`'.$tablePrefix.'catalog_category_entity`.path,"/%"));');
189
- } catch (Exception $e){
190
- }
191
- }
192
-
193
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Convert csv parser
5
+ *
6
+ * @category Mage
7
+ * @package Mage_Dataflow
8
+ * @author Magento Core Team <core@magentocommerce.com>
9
+ */
10
+ class ICEshop_Iceimport_Model_Dataflow_Convert_Parser_Csv extends Mage_Dataflow_Model_Convert_Parser_Csv
11
+ {
12
+ protected $_fields;
13
+
14
+ protected $_mapfields = array();
15
+
16
+ public function parse()
17
+ {
18
+ $this->clearIceimportIds();
19
+ $DB_logger = Mage::helper('iceimport/db');
20
+ $date = date('m/d/Y H:i:s');
21
+ $DB_logger->deleteLogEntry('error_try_delete_product');
22
+ $DB_logger->deleteLogEntry('error_try_delete_product_percentage');
23
+ $DB_logger->insertLogEntry('iceimport_import_started', $date);
24
+
25
+ $default_attr_set_id = Mage::getModel('catalog/product')->getResource()->getEntityType()->getDefaultAttributeSetId();
26
+ $attributes = Mage::getModel('catalog/product_attribute_api')->items($default_attr_set_id);
27
+
28
+ $attribute_mapping_mpn = Mage::getStoreConfig('iceshop_iceimport_importprod_root/importprod/attribute_mapping_mpn');
29
+ $attribute_mapping_brand_name = Mage::getStoreConfig('iceshop_iceimport_importprod_root/importprod/attribute_mapping_brand_name');
30
+ $attribute_mapping_ean = Mage::getStoreConfig('iceshop_iceimport_importprod_root/importprod/attribute_mapping_ean');
31
+ $entityAttributeModel = Mage::getResourceModel('eav/entity_attribute');
32
+
33
+ //stock_name and websites check
34
+ $stock_name = Mage::getStoreConfig('iceshop_iceimport_importprod_root/importprod/stock_inventory');
35
+ $websites = Mage::getStoreConfig('iceshop_iceimport_importprod_root/importprod/websites');
36
+
37
+ $not_found_attr = array();
38
+
39
+ if (!$entityAttributeModel->getIdByCode('catalog_product',$attribute_mapping_mpn)) {
40
+ $not_found_attr['mapping']['mpn'] = 'mpn';
41
+ }
42
+ if (!$entityAttributeModel->getIdByCode('catalog_product',$attribute_mapping_brand_name)) {
43
+ $not_found_attr['mapping']['brand_name'] = 'brand name';
44
+ }
45
+ if (!$entityAttributeModel->getIdByCode('catalog_product',$attribute_mapping_ean)) {
46
+ $not_found_attr['mapping']['ean'] = 'ean';
47
+ }
48
+
49
+ if (empty($websites)) {
50
+ $not_found_attr['not_set']['websites'] = 'Websites';
51
+ }
52
+ if (empty($stock_name)) {
53
+ $not_found_attr['not_set']['stock_name'] = 'Stock name';
54
+ }
55
+
56
+
57
+
58
+ foreach ($attributes as $_attribute) {
59
+ if ($_attribute['code'] == 'is_iceimport') {
60
+ unset($not_found_attr['attribute']['is_iceimport']);
61
+ break;
62
+ } else {
63
+ $not_found_attr['attribute']['is_iceimport'] = 'is iceimport';
64
+ }
65
+ }
66
+
67
+ if (!empty($not_found_attr['attribute'])) {
68
+ echo '
69
+ <li style="background-color:#FDD" id="error-0">
70
+ <img id="error-0_img" src="' . Mage::getBaseUrl('web') . '/skin/adminhtml/default/default/images/error_msg_icon.gif" class="v-middle" style="margin-right:5px">
71
+ <span id="error-0_status" class="text">Not found attributes: ' . implode(", ", $not_found_attr['attribute']) . ' please check your default attribute set.</span>
72
+ </li>';
73
+ exit;
74
+ } elseif (!empty($not_found_attr['mapping'])) {
75
+ echo '
76
+ <li style="background-color:#FDD" id="error-0">
77
+ <img id="error-0_img" src="' . Mage::getBaseUrl('web') . '/skin/adminhtml/default/default/images/error_msg_icon.gif" class="v-middle" style="margin-right:5px">
78
+ <span id="error-0_status" class="text">Attributes not set: ' . implode(', ', $not_found_attr['mapping']) . ' please check your attributes mapping.</span>
79
+ </li>';
80
+ exit;
81
+ } elseif (!empty($not_found_attr['not_set'])) {
82
+ echo '
83
+ <li style="background-color:#FDD" id="error-0">
84
+ <img id="error-0_img" src="' . Mage::getBaseUrl('web') . '/skin/adminhtml/default/default/images/error_msg_icon.gif" class="v-middle" style="margin-right:5px">
85
+ <span id="error-0_status" class="text">Attributes not set: ' . implode(', ', $not_found_attr['not_set']) . ' please check your attributes values in ICEImport settings.</span>
86
+ </li>';
87
+ exit;
88
+ }
89
+ // fixed for multibyte characters
90
+ setlocale(LC_ALL, Mage::app()->getLocale()->getLocaleCode() . '.UTF-8');
91
+
92
+ $fDel = $this->getVar('delimiter', ',');
93
+ $fEnc = $this->getVar('enclose', '"');
94
+ if ($fDel == '\t') {
95
+ $fDel = "\t";
96
+ }
97
+
98
+ $adapterName = $this->getVar('adapter', null);
99
+ $adapterMethod = $this->getVar('method', 'saveRow');
100
+
101
+ if (!$adapterName || !$adapterMethod) {
102
+ $message = Mage::helper('dataflow')->__('Please declare "adapter" and "method" nodes first.');
103
+ $this->addException($message, Mage_Dataflow_Model_Convert_Exception::FATAL);
104
+ return $this;
105
+ }
106
+
107
+ try {
108
+ $adapter = Mage::getModel($adapterName);
109
+ } catch (Exception $e) {
110
+ $message = Mage::helper('dataflow')->__('Declared adapter %s was not found.', $adapterName);
111
+ $this->addException($message, Mage_Dataflow_Model_Convert_Exception::FATAL);
112
+ return $this;
113
+ }
114
+
115
+ if (!is_callable(array($adapter, $adapterMethod))) {
116
+ $message = Mage::helper('dataflow')->__('Method "%s" not defined in adapter %s.', $adapterMethod, $adapterName);
117
+ $this->addException($message, Mage_Dataflow_Model_Convert_Exception::FATAL);
118
+ return $this;
119
+ }
120
+
121
+ $batchModel = $this->getBatchModel();
122
+ $batchIoAdapter = $this->getBatchModel()->getIoAdapter();
123
+
124
+ if (Mage::app()->getRequest()->getParam('files')) {
125
+ $file = Mage::app()->getConfig()->getTempVarDir() . '/import/'
126
+ . urldecode(Mage::app()->getRequest()->getParam('files'));
127
+ $this->_copy($file);
128
+ }
129
+
130
+ $batchIoAdapter->open(false);
131
+
132
+ $isFieldNames = $this->getVar('fieldnames', '') == 'true' ? true : false;
133
+ if (!$isFieldNames && is_array($this->getVar('map'))) {
134
+ $fieldNames = $this->getVar('map');
135
+ } else {
136
+ $fieldNames = array();
137
+ foreach ($batchIoAdapter->read(true, $fDel, $fEnc) as $v) {
138
+ $fieldNames[$v] = $v;
139
+ }
140
+ }
141
+ $countRows = 0;
142
+ $currentRow = 0;
143
+ $maxRows = (int)Mage::getStoreConfig(
144
+ 'iceshop_iceimport_importprod_root/importprod/iceimport_batch_size',
145
+ Mage::app()
146
+ ->getWebsite()
147
+ ->getDefaultGroup()
148
+ ->getDefaultStoreId()
149
+ );
150
+ $itemData = array();
151
+ while (($csvData = $batchIoAdapter->read(true, $fDel, $fEnc)) !== false) {
152
+ if (count($csvData) == 1 && $csvData[0] === null) {
153
+ continue;
154
+ }
155
+ $countRows++;
156
+ $i = 0;
157
+ foreach ($fieldNames as $field) {
158
+
159
+ $field == 'mpn' ? $field = Mage::getStoreConfig('iceshop_iceimport_importprod_root/importprod/attribute_mapping_mpn') : '';
160
+ $field == 'brand_name' ? $field = Mage::getStoreConfig('iceshop_iceimport_importprod_root/importprod/attribute_mapping_brand_name') : '';
161
+ $field == 'ean' ? $field = Mage::getStoreConfig('iceshop_iceimport_importprod_root/importprod/attribute_mapping_ean') : '';
162
+ $field == 'delivery_eta' ? $field = Mage::getStoreConfig('iceshop_iceimport_importprod_root/importprod/attribute_mapping_delivery_eta') : '';
163
+
164
+ $itemData[$currentRow][$field] = isset($csvData[$i]) ? $csvData[$i] : null;
165
+ $i++;
166
+ }
167
+
168
+ if ($currentRow == $maxRows) {
169
+ $currentRow = 0;
170
+ $batchImportModel = $this->getBatchImportModel()
171
+ ->setBatchId($this->getBatchModel()->getId())
172
+ ->setBatchData($itemData)->setStatus(1);
173
+ $itemData = array();
174
+ }
175
+ $currentRow++;
176
+
177
+ }
178
+ if ($currentRow <= $maxRows && $currentRow != 0 && !empty($itemData)) {
179
+ $batchImportModel = $this->getBatchImportModel()
180
+ ->setBatchId($this->getBatchModel()->getId())
181
+ ->setBatchData($itemData)->setStatus(1);
182
+ }
183
+
184
+ $this->addException(Mage::helper('dataflow')->__('Found %d rows.', $countRows));
185
+ $this->addException(Mage::helper('dataflow')->__('Starting %s :: %s', $adapterName, $adapterMethod));
186
+
187
+ $batchModel->setParams($this->getVars())
188
+ ->setAdapter($adapterName)
189
+ ->save();
190
+
191
+ //latest session cleaning
192
+ //Init session values to count total products and determine the last call of saveRow method
193
+ $session = Mage::getSingleton("core/session");
194
+ $import_total = $session->getData("import_total");
195
+ $counter = $session->getData("counter");
196
+ $skipped_counter = $session->getData("skipped_counter");
197
+ if (isset($import_total)) {
198
+ $session->unsetData("import_total");
199
+ }
200
+ if (isset($counter)) {
201
+ $session->unsetData("counter");
202
+ }
203
+ if (isset($skipped_counter)) {
204
+ $session->unsetData("skipped_counter");
205
+ }
206
+ $this->updateCatalogCategoryChildren();
207
+
208
+ return $this;
209
+ }
210
+
211
+
212
+ public function clearIceimportIds(){
213
+ $db_res = Mage::getSingleton('core/resource')->getConnection('core_write');
214
+ $tablePrefix = '';
215
+ $tPrefix = (array)Mage::getConfig()->getTablePrefix();
216
+ if (!empty($tPrefix)) {
217
+ $tablePrefix = $tPrefix[0];
218
+ }
219
+ $db_res->query("DELETE FROM {$tablePrefix}iceshop_iceimport_imported_product_ids");
220
+ }
221
+
222
+
223
+ /**
224
+ * Update path to children category/root
225
+ */
226
+ public function updateCatalogCategoryChildren(){
227
+ try{
228
+ $db_res = Mage::getSingleton('core/resource')->getConnection('core_write');
229
+ $tablePrefix = '';
230
+ $tPrefix = (array)Mage::getConfig()->getTablePrefix();
231
+ if (!empty($tPrefix)) {
232
+ $tablePrefix = $tPrefix[0];
233
+ }
234
+ $db_res->query('UPDATE `'.$tablePrefix.'catalog_category_entity` SET children_count = (SELECT COUNT(*) FROM (SELECT * FROM `'.$tablePrefix.'catalog_category_entity`) AS table2 WHERE path LIKE CONCAT(`'.$tablePrefix.'catalog_category_entity`.path,"/%"));');
235
+ } catch (Exception $e){
236
+ }
237
+ }
238
+
239
+ }
app/code/community/ICEshop/Iceimport/Model/Observer.php CHANGED
@@ -1,439 +1,475 @@
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
- $DB_logger->deleteLogEntry('error_try_delete_product');
37
- $DB_logger->deleteLogEntry('error_try_delete_product_percentage');
38
- $this->setCroneStatus('running',$date_crone_start);
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', 0);
50
- ini_set("memory_limit","-1");
51
- $profileId = 3;
52
- $logFileName = 'test.log';
53
- $recordCount = 0;
54
-
55
- //checking locks
56
- $this->indexProcess = new Mage_Index_Model_Process();
57
- $this->indexProcess->setId($this->process_id);
58
- if ($this->indexProcess->isLocked()) {
59
- print 'Error! Another iceimport module cron process is running!';
60
- die();
61
- }
62
- $this->indexProcess->lockAndBlock();
63
-
64
- Mage::log("Import Started", null, $logFileName);
65
-
66
- //basic action fired
67
- $profile = Mage::getModel('dataflow/profile');
68
- $userModel = Mage::getModel('admin/user');
69
- $userModel->setUserId(0);
70
- Mage::getSingleton('admin/session')->setUser($userModel);
71
- if ($profileId) {
72
- $profile->load($profileId);
73
- if (!$profile->getId()) {
74
- Mage::getSingleton('adminhtml/session')->addError('The profile that you are trying to save no longer exists');
75
- }
76
- }
77
- $profile->run();
78
- $batchModel = Mage::getSingleton('dataflow/batch');
79
-
80
- //batch processing
81
- if ($batchModel->getId()) {
82
- if ($batchModel->getAdapter()) {
83
-
84
- $batchId = $batchModel->getId();
85
- $batchImportModel = $batchModel->getBatchImportModel();
86
- $importIds = $batchImportModel->getIdCollection();
87
-
88
- $batchModel = Mage::getModel('dataflow/batch')->load($batchId);
89
- $adapter = Mage::getModel($batchModel->getAdapter());
90
- $run_only_images = 0;
91
- try {
92
- if (method_exists($adapter, 'getAdapterSetting')) {
93
- $run_only_images = $adapter->getAdapterSetting('iceshop_iceimport_importprod_root/importprod/images_queue_processing_only');
94
- }
95
- } catch(Exception $e) {}
96
-
97
- // delete previous products id
98
- $DB_logger->insertLogEntry('iceimport_import_status_cron', 'Running');
99
- try {
100
- $db_res->query("DELETE FROM {$tablePrefix}iceshop_iceimport_imported_product_ids");
101
- } catch (Exception $e) {
102
- $DB_logger->insertLogEntry('iceimport_import_status_cron', 'Failed');
103
- throw new Exception($e->getMessage());
104
- }
105
- if ($run_only_images == 0) {
106
- foreach ($importIds as $importId) {
107
-
108
- $recordCount++;
109
- try {
110
- $batchImportModel->load($importId);
111
- if (!$batchImportModel->getId()) {
112
- $errors[] = Mage::helper('dataflow')->__('Skip undefined row');
113
- continue;
114
- }
115
-
116
- $importData = $batchImportModel->getBatchData();
117
- $importData['batchId'] = $batchId;
118
-
119
- try {
120
- $adapter->saveRow($importData);
121
- } catch (Exception $e) {
122
- $DB_logger->insertLogEntry('iceimport_import_status_cron', 'Failed');
123
- Mage::log($e->getMessage(), null, $logFileName);
124
- continue;
125
- }
126
-
127
- } catch (Exception $ex) {
128
- if (!empty($importData['sku'])) {
129
- Mage::log('Record# ' . $recordCount . ' - SKU = ' . $importData['sku'] . ' - Error - ' . $ex->getMessage(), null, $logFileName);
130
- } else {
131
- Mage::log('Record# ' . $recordCount . ' - SKU = undefined - Error - ' . $ex->getMessage(), null, $logFileName);
132
- }
133
- }
134
- }
135
- }
136
-
137
- //run image queue processing
138
- $adapter->processImageQueue($logFileName);
139
-
140
- $processes = Mage::getSingleton('index/indexer')->getProcessesCollection();
141
- $processes->walk('reindexAll');
142
-
143
- foreach ($profile->getExceptions() as $e) {
144
- Mage::log($e->getMessage(), null, $logFileName);
145
- }
146
- }
147
- }
148
- print 'Import Completed';
149
-
150
- //drop locks
151
- $this->indexProcess->unlock();
152
-
153
- //extra logging
154
- Mage::log("Import Completed", null, $logFileName);
155
- $count_imported_products = $DB_logger->getRowsCount($tablePrefix . "iceshop_iceimport_imported_product_ids");
156
- $DB_logger->insertLogEntry('iceimport_count_imported_products', $count_imported_products);
157
-
158
- // clear dataflow_batch_import table
159
- try {
160
- $this->updateCatalogCategoryChildren();
161
- $db_res->query("DELETE FROM {$tablePrefix}iceshop_iceimport_imported_product_ids");
162
- $db_res->query("TRUNCATE {$tablePrefix}dataflow_batch_import");
163
- } catch (Exception $e) {
164
- $DB_logger->insertLogEntry('iceimport_import_status_cron', 'Failed');
165
- throw new Exception($e->getMessage());
166
- }
167
- //extra logging
168
- $DB_logger->insertLogEntry('iceimport_import_status_cron', 'Finished');
169
- $date = date('m/d/Y H:i:s');
170
- $DB_logger->insertLogEntry('iceimport_import_ended', $date);
171
- $this->setCroneStatus('finished', $date);
172
-
173
- unset($db_res, $DB_logger, $date, $profile, $profileId, $logFileName);
174
- }
175
-
176
- /**
177
- * Change crone status in table `cron_schedule`
178
- * @param string $status
179
- * @param string $date_crone_start
180
- */
181
- public function setCroneStatus($status = 'pending',$date_crone_start){
182
- try{
183
- $db_res = Mage::getSingleton('core/resource')->getConnection('core_write');
184
- $tablePrefix = '';
185
- $tPrefix = (array)Mage::getConfig()->getTablePrefix();
186
- if (!empty($tPrefix)) {
187
- $tablePrefix = $tPrefix[0];
188
- }
189
- $db_res->query("UPDATE `{$tablePrefix}cron_schedule` SET status='$status' WHERE job_code = 'iceshop_iceimport' AND executed_at='$date_crone_start'");
190
- } catch (Exception $e){
191
-
192
- }
193
- }
194
-
195
-
196
- /**
197
- * Update path to children category/root
198
- */
199
- public function updateCatalogCategoryChildren(){
200
- try{
201
- $db_res = Mage::getSingleton('core/resource')->getConnection('core_write');
202
- $tablePrefix = '';
203
- $tPrefix = (array)Mage::getConfig()->getTablePrefix();
204
- if (!empty($tPrefix)) {
205
- $tablePrefix = $tPrefix[0];
206
- }
207
- $db_res->query('UPDATE `'.$tablePrefix.'catalog_category_entity` SET children_count = (SELECT COUNT(*) FROM (SELECT * FROM `'.$tablePrefix.'catalog_category_entity`) AS table2 WHERE path LIKE CONCAT(`'.$tablePrefix.'catalog_category_entity`.path,"/%"));');
208
- } catch (Exception $e){
209
- }
210
- }
211
-
212
-
213
- /**
214
- * Method import imges for product
215
- */
216
- public function importImages(){
217
-
218
- $DB_logger = Mage::helper('iceimport/db');
219
- $import_info = array();
220
- if($_GET['import_run']==1){
221
- $iceimport_count_images = $this->getCountImagesNotImport($_GET['update_images']);
222
- $DB_logger->insertLogEntry('iceimport_count_images', $iceimport_count_images);
223
- } else {
224
- $iceimport_count_images = $DB_logger->getLogEntryByKey('iceimport_count_images');
225
- if(!empty($iceimport_count_images)){
226
- $iceimport_count_images = $iceimport_count_images ['log_value'];
227
- }
228
- }
229
-
230
- $iceimport_current_images_import = $DB_logger->getLogEntryByKey('iceimport_current_images_import');
231
- if(!empty($iceimport_current_images_import)){
232
- $iceimport_current_images_import = $iceimport_current_images_import['log_value'];
233
- }
234
-
235
- if(empty($iceimport_count_images)){
236
- $iceimport_count_images = $this->getCountImagesNotImport($_GET['update_images']);
237
- $DB_logger->insertLogEntry('iceimport_count_images', $iceimport_count_images);
238
- }
239
- $import_info['count_images'] = $iceimport_count_images;
240
-
241
-
242
- if(empty($iceimport_current_images_import)){
243
- $iceimport_current_images_import = 1;
244
- $DB_logger->insertLogEntry('iceimport_current_images_import', $iceimport_current_images_import);
245
- } else {
246
- $iceimport_current_images_import = $iceimport_current_images_import + 1;
247
- $DB_logger->insertLogEntry('iceimport_current_images_import', $iceimport_current_images_import);
248
- }
249
- if($_GET['import_run']==1){
250
- $iceimport_current_images_import = 1;
251
- $DB_logger->insertLogEntry('iceimport_current_images_import', $iceimport_current_images_import);
252
- }
253
- $import_info['current_images_import'] = $iceimport_current_images_import;
254
-
255
- // download & set product images
256
- $queueList = $this->getImageResourceOne($_GET['update_images']);
257
- if (count($queueList) > 0) {
258
- $mediaDir = Mage::getBaseDir('media');
259
- foreach ($queueList as $queue) {
260
- $queueId = $queue['queue_id'];
261
- $productId = $queue['entity_id'];
262
- $imageUrl = $queue['image_url'];
263
-
264
- $preImageName = explode('/', $imageUrl);
265
- $imageName = array_pop($preImageName);
266
- if (file_exists($mediaDir . DS . $imageName)) {
267
- $imageName = rand() . '_' . time() . $imageName;
268
- }
269
-
270
- if (file_put_contents($mediaDir . DS . $imageName, file_get_contents($imageUrl))) {
271
- $product = Mage::getModel('catalog/product')->load($productId);
272
- $product->addImageToMediaGallery($mediaDir . DS . $imageName,
273
- array('image', 'small_image', 'thumbnail'),
274
- true, true
275
- );
276
- $product->save();
277
- $this->setImageAsDownloaded($queueId);
278
- unset($product);
279
- $import_info['images_error'] = 0;
280
- } else {
281
- $this->setImageAsDownloadedError($queueId);
282
-
283
- $iceimport_images_error_entity_id = $DB_logger->getLogEntryByKey('iceimport_images_error_entity_id');
284
- if(empty($iceimport_images_error_entity_id)){
285
- $DB_logger->insertLogEntry('iceimport_images_error_entity_id', $productId);
286
- $DB_logger->insertLogEntry('iceimport_images_error_entity_id_log', $productId);
287
- } else {
288
- if(!empty($iceimport_images_error_entity_id)){
289
- $iceimport_images_error_entity_id = $iceimport_images_error_entity_id['log_value'];
290
- $DB_logger->insertLogEntry('iceimport_images_error_entity_id_log', $iceimport_images_error_entity_id . ', ' . $productId);
291
- $DB_logger->insertLogEntry('iceimport_images_error_entity_id', $iceimport_images_error_entity_id . ', ' . $productId);
292
-
293
- }
294
- }
295
- $import_info['images_error'] = 1;
296
- $import_info['images_error_text'] = 'Requested file is not accessible. '.$imageUrl;
297
- }
298
- }
299
- $import_info['done'] = 0;
300
- } else {
301
- $import_info['done'] = 1;
302
- if($import_info['count_images'] == 0){
303
- $import_info['current_images_import'] = 0;
304
- }
305
- $DB_logger->deleteLogEntry('iceimport_current_images_import');
306
- $DB_logger->deleteLogEntry('iceimport_count_images');
307
- }
308
-
309
- if($import_info['current_images_import'] == $import_info['count_images'] || $import_info['done'] == 1){
310
- $import_info['done'] = 1;
311
- $DB_logger->deleteLogEntry('iceimport_images_error_entity_id');
312
- $DB_logger->deleteLogEntry('iceimport_current_images_import');
313
- $DB_logger->deleteLogEntry('iceimport_count_images');
314
- }elseif ($import_info['count_images'] == 0 || $import_info['current_images_import'] == 0) {
315
- $import_info['count_images'] = 0;
316
- $import_info['current_images_import'] = 0;
317
-
318
- $import_info['done'] = 1;
319
- $DB_logger->deleteLogEntry('iceimport_current_images_import');
320
- $DB_logger->deleteLogEntry('iceimport_count_images');
321
- echo json_encode($import_info);
322
- exit();
323
- } else {
324
- $import_info['done'] = 0;
325
- }
326
- echo json_encode($import_info);
327
-
328
- }
329
-
330
- /**
331
- * @return mixed
332
- */
333
- public function getImageResourceOne($update = 0)
334
- {
335
- try{
336
- $DB_logger = Mage::helper('iceimport/db');
337
- $db_res = Mage::getSingleton('core/resource')->getConnection('core_write');
338
- $tablePrefix = '';
339
- $tPrefix = (array)Mage::getConfig()->getTablePrefix();
340
- if (!empty($tPrefix)) {
341
- $tablePrefix = $tPrefix[0];
342
- }
343
-
344
- $iceimport_images_error_entity_id = $DB_logger->getLogEntryByKey('iceimport_images_error_entity_id');
345
- if(empty($iceimport_images_error_entity_id)){
346
- if($update){
347
- return $db_res->fetchAll("SELECT `queue_id`, `entity_id`, `image_url`
348
- FROM `{$tablePrefix}iceshop_iceimport_image_queue`
349
- WHERE `is_downloaded` = 2 LIMIT 1");
350
- }else{
351
- return $db_res->fetchAll("SELECT `queue_id`, `entity_id`, `image_url`
352
- FROM `{$tablePrefix}iceshop_iceimport_image_queue`
353
- WHERE `is_downloaded` = 0 LIMIT 1");
354
- }
355
-
356
- } else {
357
- $iceimport_images_error_entity_id = $iceimport_images_error_entity_id['log_value'];
358
- if($update){
359
- return $db_res->fetchAll("SELECT `queue_id`, `entity_id`, `image_url`
360
- FROM `{$tablePrefix}iceshop_iceimport_image_queue`
361
- WHERE `is_downloaded` = 2 AND entity_id NOT IN({$iceimport_images_error_entity_id}) LIMIT 1");
362
- } else {
363
- return $db_res->fetchAll("SELECT `queue_id`, `entity_id`, `image_url`
364
- FROM `{$tablePrefix}iceshop_iceimport_image_queue`
365
- WHERE `is_downloaded` = 0 AND entity_id NOT IN({$iceimport_images_error_entity_id}) LIMIT 1");
366
- }
367
-
368
- }
369
-
370
- } catch (Exception $e){
371
- }
372
- }
373
-
374
- /**
375
- * Method fetch count not import images for product
376
- * @return integer
377
- */
378
- public function getCountImagesNotImport($update = 0){
379
- try{
380
- $db_res = Mage::getSingleton('core/resource')->getConnection('core_write');
381
- $tablePrefix = '';
382
- $tPrefix = (array)Mage::getConfig()->getTablePrefix();
383
- if (!empty($tPrefix)) {
384
- $tablePrefix = $tPrefix[0];
385
- }
386
- if($update){
387
- return $return_resulr = $db_res->fetchOne("SELECT COUNT(*) FROM `{$tablePrefix}iceshop_iceimport_image_queue`
388
- WHERE `is_downloaded` = 2");
389
- } else {
390
- return $return_resulr = $db_res->fetchOne("SELECT COUNT(*) FROM `{$tablePrefix}iceshop_iceimport_image_queue`
391
- WHERE `is_downloaded` = 0");
392
- }
393
- } catch (Exception $e){
394
- }
395
- }
396
-
397
-
398
-
399
- /**
400
- * @param bool $queueId
401
- */
402
- private function setImageAsDownloaded($queueId = false)
403
- {
404
- if ($queueId) {
405
- $db_res = Mage::getSingleton('core/resource')->getConnection('core_write');
406
- $tablePrefix = '';
407
- $tPrefix = (array)Mage::getConfig()->getTablePrefix();
408
- if (!empty($tPrefix)) {
409
- $tablePrefix = $tPrefix[0];
410
- }
411
- $db_res->query("UPDATE `{$tablePrefix}iceshop_iceimport_image_queue`
412
- SET is_downloaded = 1
413
- WHERE queue_id = {$queueId}");
414
- }
415
- }
416
-
417
-
418
- /**
419
- * @param bool $queueId
420
- */
421
- private function setImageAsDownloadedError($queueId = false)
422
- {
423
- if ($queueId) {
424
- $db_res = Mage::getSingleton('core/resource')->getConnection('core_write');
425
- $tablePrefix = '';
426
- $tPrefix = (array)Mage::getConfig()->getTablePrefix();
427
- if (!empty($tPrefix)) {
428
- $tablePrefix = $tPrefix[0];
429
- }
430
- $db_res->query(
431
- "UPDATE `{$tablePrefix}iceshop_iceimport_image_queue`
432
- SET is_downloaded = 2
433
- WHERE queue_id = :queue_id",
434
- array(':queue_id' => $queueId)
435
- );
436
- }
437
- }
438
- }
439
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+
30
+ //init logger
31
+
32
+ $transactions_enabled = (int)Mage::getStoreConfig('iceshop_iceimport_importprod_root/importprod/transactions_enabled');
33
+ $DB_logger = Mage::helper('iceimport/db');
34
+ $date_crone_start = date('Y-m-d H:i:s');
35
+ $date = date('m/d/Y H:i:s');
36
+ $DB_logger->insertLogEntry('iceimport_import_status_cron', 'Started');
37
+ $DB_logger->insertLogEntry('iceimport_import_started', $date);
38
+ $DB_logger->insertLogEntry('iceimport_import_ended', '');
39
+ $DB_logger->deleteLogEntry('error_try_delete_product');
40
+ $DB_logger->deleteLogEntry('error_try_delete_product_percentage');
41
+ $DB_logger->deleteLogEntry('try_delete_product_percentage_warning_flag');
42
+ $this->setCroneStatus('running',$date_crone_start);
43
+ //init DB data
44
+ $db_res = Mage::getSingleton('core/resource')->getConnection('core_write');
45
+ $tablePrefix = '';
46
+ $tPrefix = (array)Mage::getConfig()->getTablePrefix();
47
+ if (!empty($tPrefix)) {
48
+ $tablePrefix = $tPrefix[0];
49
+ }
50
+
51
+ //service actions
52
+ ini_set('max_execution_time', 0);
53
+ ini_set("memory_limit","-1");
54
+
55
+ $profileId = (int)Mage::getStoreConfig('iceshop_iceimport_importprod_root/importprod/iceimport_profile');
56
+
57
+ if (!$profileId) {
58
+ $profileId = 3;
59
+ }
60
+ $logFileName = 'test.log';
61
+ $recordCount = 0;
62
+
63
+ //checking locks
64
+ $this->indexProcess = new Mage_Index_Model_Process();
65
+ $this->indexProcess->setId($this->process_id);
66
+
67
+ if ($this->indexProcess->isLocked()) {
68
+ print 'Error! Another iceimport module cron process is running!';
69
+ die();
70
+ }
71
+ $this->indexProcess->lockAndBlock();
72
+
73
+ Mage::log("Import Started", null, $logFileName);
74
+
75
+ //basic action fired
76
+ $profile = Mage::getModel('dataflow/profile');
77
+
78
+ $userModel = Mage::getModel('admin/user');
79
+ $userModel->setUserId(0);
80
+ Mage::getSingleton('admin/session')->setUser($userModel);
81
+
82
+ if ($profileId) {
83
+ $profile->load($profileId);
84
+ if (!$profile->getId()) {
85
+ Mage::getSingleton('adminhtml/session')->addError('The profile that you are trying to save no longer exists');
86
+ }
87
+ }
88
+ $profile->run();
89
+ $batchModel = Mage::getSingleton('dataflow/batch');
90
+ $allMsg = '';
91
+
92
+ //batch processing
93
+
94
+ if ($batchModel->getId()) {
95
+ if ($batchModel->getAdapter()) {
96
+
97
+ $batchId = $batchModel->getId();
98
+
99
+ $batchImportModel = $batchModel->getBatchImportModel();
100
+ $importIds = $batchImportModel->getIdCollection();
101
+
102
+ $batchModel = Mage::getModel('dataflow/batch')->load($batchId);
103
+ $adapter = Mage::getModel($batchModel->getAdapter());
104
+ $run_only_images = 0;
105
+
106
+
107
+ try {
108
+ if (method_exists($adapter, 'getAdapterSetting')) {
109
+ $run_only_images = $adapter->getAdapterSetting('iceshop_iceimport_importprod_root/importprod/images_queue_processing_only');
110
+ }
111
+ } catch(Exception $e) {}
112
+
113
+ // delete previous products id
114
+ $DB_logger->insertLogEntry('iceimport_import_status_cron', 'Running');
115
+ try {
116
+ $db_res->query("DELETE FROM {$tablePrefix}iceshop_iceimport_imported_product_ids");
117
+ } catch (Exception $e) {
118
+ $DB_logger->insertLogEntry('iceimport_import_status_cron', 'Failed');
119
+ throw new Exception($e->getMessage());
120
+ }
121
+ $importData = array();
122
+ if ($run_only_images == 0) {
123
+
124
+ foreach ($importIds as $key => $importId) {
125
+
126
+ $recordCount++;
127
+ try {
128
+ $batchImportModel->load($importId);
129
+ if (!$batchImportModel->getId()) {
130
+ $errors[] = Mage::helper('dataflow')->__('Skip undefined row');
131
+ continue;
132
+ }
133
+
134
+ $importData[$key] = $batchImportModel->getBatchData();
135
+ $importData[$key]['batchId'] = $batchId;
136
+
137
+ } catch (Exception $ex) {
138
+ if (!empty($importData['sku'])) {
139
+ Mage::log('Record# ' . $recordCount . ' - SKU = ' . $importData['sku'] . ' - Error - ' . $ex->getMessage(), null, $logFileName);
140
+ } else {
141
+ Mage::log('Record# ' . $recordCount . ' - SKU = undefined - Error - ' . $ex->getMessage(), null, $logFileName);
142
+ }
143
+ }
144
+ }
145
+
146
+ try {
147
+ $adapter->saveRow($importData);
148
+ } catch (Exception $e) {
149
+ $DB_logger->insertLogEntry('iceimport_import_status_cron', 'Failed');
150
+ Mage::log($e->getMessage(), null, $logFileName);
151
+ }
152
+ }
153
+
154
+ //run image queue processing
155
+
156
+ $adapter->processImageQueue($logFileName);
157
+
158
+ //check indexes and run reindex
159
+
160
+ $re_index_required = (int)Mage::getStoreConfig('iceshop_iceimport_importprod_root/importprod/is_reindex_required_import');
161
+ if ((isset($re_index_required)) && ($re_index_required == 1)) {
162
+ $indexCollection = Mage::getModel('index/process')->getCollection();
163
+ foreach ($indexCollection as $index) {
164
+ $getStatus = $index->getStatus();
165
+ /* @var $index Mage_Index_Model_Process */
166
+ if (($getStatus != Mage_Index_Model_Process::STATUS_RUNNING) && (($getStatus == Mage_Index_Model_Process::STATUS_PENDING) || ($getStatus == Mage_Index_Model_Process::STATUS_REQUIRE_REINDEX))) {
167
+ $index->reindexAll();
168
+ } else {
169
+ $allMsg .= '<p style="color:#ff0000">Process reindex "' . (string)$index->getIndexerCode() . '" cannot run, because another process reindex is running.</p>';
170
+ $msg = ' Process reindex "' . (string)$index->getIndexerCode() . '" cannot run, because another process reindex is running.';
171
+ print $msg;
172
+ Mage::log($msg, null, $logFileName);
173
+ }
174
+ }
175
+ }
176
+
177
+ foreach ($profile->getExceptions() as $e) {
178
+ Mage::log($e->getMessage(), null, $logFileName);
179
+ }
180
+ }
181
+ }
182
+
183
+ print 'Import Completed';
184
+
185
+ //drop locks
186
+ $this->indexProcess->unlock();
187
+
188
+ //extra logging
189
+ Mage::log("Import Completed", null, $logFileName);
190
+ $count_imported_products = $DB_logger->getRowsCount($tablePrefix . "iceshop_iceimport_imported_product_ids");
191
+ $DB_logger->insertLogEntry('iceimport_count_imported_products', $count_imported_products);
192
+
193
+ // clear dataflow_batch_import table
194
+ try {
195
+ $this->updateCatalogCategoryChildren();
196
+ $db_res->query("DELETE FROM {$tablePrefix}iceshop_iceimport_imported_product_ids");
197
+ $db_res->query("TRUNCATE {$tablePrefix}dataflow_batch_import");
198
+ } catch (Exception $e) {
199
+ $DB_logger->insertLogEntry('iceimport_import_status_cron', 'Failed');
200
+ throw new Exception($e->getMessage());
201
+ }
202
+ //extra logging
203
+ $DB_logger->insertLogEntry('iceimport_import_status_cron', 'Finished '.$allMsg);
204
+ $date = date('m/d/Y H:i:s');
205
+ $DB_logger->insertLogEntry('iceimport_import_ended', $date);
206
+ $this->setCroneStatus('finished', $date);
207
+ //$db_res->commit();
208
+ unset($db_res, $DB_logger, $date, $profile, $profileId, $logFileName);
209
+ }
210
+
211
+ /**
212
+ * Change crone status in table `cron_schedule`
213
+ * @param string $status
214
+ * @param string $date_crone_start
215
+ */
216
+ public function setCroneStatus($status = 'pending',$date_crone_start){
217
+ try{
218
+ $db_res = Mage::getSingleton('core/resource')->getConnection('core_write');
219
+ $tablePrefix = '';
220
+ $tPrefix = (array)Mage::getConfig()->getTablePrefix();
221
+ if (!empty($tPrefix)) {
222
+ $tablePrefix = $tPrefix[0];
223
+ }
224
+ $db_res->query("UPDATE `{$tablePrefix}cron_schedule` SET status='$status' WHERE job_code = 'iceshop_iceimport' AND executed_at='$date_crone_start'");
225
+ } catch (Exception $e){
226
+
227
+ }
228
+ }
229
+
230
+
231
+ /**
232
+ * Update path to children category/root
233
+ */
234
+ public function updateCatalogCategoryChildren(){
235
+ try{
236
+ $db_res = Mage::getSingleton('core/resource')->getConnection('core_write');
237
+ $tablePrefix = '';
238
+ $tPrefix = (array)Mage::getConfig()->getTablePrefix();
239
+ if (!empty($tPrefix)) {
240
+ $tablePrefix = $tPrefix[0];
241
+ }
242
+ $db_res->query('UPDATE `'.$tablePrefix.'catalog_category_entity` SET children_count = (SELECT COUNT(*) FROM (SELECT * FROM `'.$tablePrefix.'catalog_category_entity`) AS table2 WHERE path LIKE CONCAT(`'.$tablePrefix.'catalog_category_entity`.path,"/%"));');
243
+ } catch (Exception $e){
244
+ }
245
+ }
246
+
247
+
248
+ /**
249
+ * Method import imges for product
250
+ */
251
+ public function importImages(){
252
+
253
+ $DB_logger = Mage::helper('iceimport/db');
254
+ $import_info = array();
255
+ if($_GET['import_run']==1){
256
+ $iceimport_count_images = $this->getCountImagesNotImport($_GET['update_images']);
257
+ $DB_logger->insertLogEntry('iceimport_count_images', $iceimport_count_images);
258
+ } else {
259
+ $iceimport_count_images = $DB_logger->getLogEntryByKey('iceimport_count_images');
260
+ if(!empty($iceimport_count_images)){
261
+ $iceimport_count_images = $iceimport_count_images ['log_value'];
262
+ }
263
+ }
264
+
265
+ $iceimport_current_images_import = $DB_logger->getLogEntryByKey('iceimport_current_images_import');
266
+ if(!empty($iceimport_current_images_import)){
267
+ $iceimport_current_images_import = $iceimport_current_images_import['log_value'];
268
+ }
269
+
270
+ if(empty($iceimport_count_images)){
271
+ $iceimport_count_images = $this->getCountImagesNotImport($_GET['update_images']);
272
+ $DB_logger->insertLogEntry('iceimport_count_images', $iceimport_count_images);
273
+ }
274
+ $import_info['count_images'] = $iceimport_count_images;
275
+
276
+
277
+ if(empty($iceimport_current_images_import)){
278
+ $iceimport_current_images_import = 1;
279
+ $DB_logger->insertLogEntry('iceimport_current_images_import', $iceimport_current_images_import);
280
+ } else {
281
+ $iceimport_current_images_import = $iceimport_current_images_import + 1;
282
+ $DB_logger->insertLogEntry('iceimport_current_images_import', $iceimport_current_images_import);
283
+ }
284
+ if($_GET['import_run']==1){
285
+ $iceimport_current_images_import = 1;
286
+ $DB_logger->insertLogEntry('iceimport_current_images_import', $iceimport_current_images_import);
287
+ }
288
+ $import_info['current_images_import'] = $iceimport_current_images_import;
289
+
290
+ // download & set product images
291
+ $queueList = $this->getImageResourceOne($_GET['update_images']);
292
+ if (count($queueList) > 0) {
293
+ $mediaDir = Mage::getBaseDir('media');
294
+ foreach ($queueList as $queue) {
295
+ $queueId = $queue['queue_id'];
296
+ $productId = $queue['entity_id'];
297
+ $imageUrl = $queue['image_url'];
298
+
299
+ $preImageName = explode('/', $imageUrl);
300
+ $imageName = array_pop($preImageName);
301
+ if (file_exists($mediaDir . DS . $imageName)) {
302
+ $imageName = rand() . '_' . time() . $imageName;
303
+ }
304
+
305
+ if (file_put_contents($mediaDir . DS . $imageName, file_get_contents($imageUrl))) {
306
+ $product = Mage::getModel('catalog/product')->load($productId);
307
+ $product->addImageToMediaGallery($mediaDir . DS . $imageName,
308
+ array('image', 'small_image', 'thumbnail'),
309
+ true, true
310
+ );
311
+ $product->save();
312
+ $this->setImageAsDownloaded($queueId);
313
+ unset($product);
314
+ $import_info['images_error'] = 0;
315
+ } else {
316
+ $this->setImageAsDownloadedError($queueId);
317
+
318
+ $iceimport_images_error_entity_id = $DB_logger->getLogEntryByKey('iceimport_images_error_entity_id');
319
+ if(empty($iceimport_images_error_entity_id)){
320
+ $DB_logger->insertLogEntry('iceimport_images_error_entity_id', $productId);
321
+ $DB_logger->insertLogEntry('iceimport_images_error_entity_id_log', $productId);
322
+ } else {
323
+ if(!empty($iceimport_images_error_entity_id)){
324
+ $iceimport_images_error_entity_id = $iceimport_images_error_entity_id['log_value'];
325
+ $DB_logger->insertLogEntry('iceimport_images_error_entity_id_log', $iceimport_images_error_entity_id . ', ' . $productId);
326
+ $DB_logger->insertLogEntry('iceimport_images_error_entity_id', $iceimport_images_error_entity_id . ', ' . $productId);
327
+
328
+ }
329
+ }
330
+ $import_info['images_error'] = 1;
331
+ $import_info['images_error_text'] = 'Requested file is not accessible. '.$imageUrl;
332
+ }
333
+ }
334
+ $import_info['done'] = 0;
335
+ } else {
336
+ $import_info['done'] = 1;
337
+ if($import_info['count_images'] == 0){
338
+ $import_info['current_images_import'] = 0;
339
+ }
340
+ $DB_logger->deleteLogEntry('iceimport_current_images_import');
341
+ $DB_logger->deleteLogEntry('iceimport_count_images');
342
+ }
343
+
344
+ if($import_info['current_images_import'] == $import_info['count_images'] || $import_info['done'] == 1){
345
+ $import_info['done'] = 1;
346
+ $DB_logger->deleteLogEntry('iceimport_images_error_entity_id');
347
+ $DB_logger->deleteLogEntry('iceimport_current_images_import');
348
+ $DB_logger->deleteLogEntry('iceimport_count_images');
349
+ }elseif ($import_info['count_images'] == 0 || $import_info['current_images_import'] == 0) {
350
+ $import_info['count_images'] = 0;
351
+ $import_info['current_images_import'] = 0;
352
+
353
+ $import_info['done'] = 1;
354
+ $DB_logger->deleteLogEntry('iceimport_current_images_import');
355
+ $DB_logger->deleteLogEntry('iceimport_count_images');
356
+ echo json_encode($import_info);
357
+ exit();
358
+ } else {
359
+ $import_info['done'] = 0;
360
+ }
361
+ echo json_encode($import_info);
362
+
363
+ }
364
+
365
+ /**
366
+ * @return mixed
367
+ */
368
+ public function getImageResourceOne($update = 0)
369
+ {
370
+ try{
371
+ $DB_logger = Mage::helper('iceimport/db');
372
+ $db_res = Mage::getSingleton('core/resource')->getConnection('core_write');
373
+ $tablePrefix = '';
374
+ $tPrefix = (array)Mage::getConfig()->getTablePrefix();
375
+ if (!empty($tPrefix)) {
376
+ $tablePrefix = $tPrefix[0];
377
+ }
378
+
379
+ $iceimport_images_error_entity_id = $DB_logger->getLogEntryByKey('iceimport_images_error_entity_id');
380
+ if(empty($iceimport_images_error_entity_id)){
381
+ if($update){
382
+ return $db_res->fetchAll("SELECT `queue_id`, `entity_id`, `image_url`
383
+ FROM `{$tablePrefix}iceshop_iceimport_image_queue`
384
+ WHERE `is_downloaded` = 2 LIMIT 1");
385
+ }else{
386
+ return $db_res->fetchAll("SELECT `queue_id`, `entity_id`, `image_url`
387
+ FROM `{$tablePrefix}iceshop_iceimport_image_queue`
388
+ WHERE `is_downloaded` = 0 LIMIT 1");
389
+ }
390
+
391
+ } else {
392
+ $iceimport_images_error_entity_id = $iceimport_images_error_entity_id['log_value'];
393
+ if($update){
394
+ return $db_res->fetchAll("SELECT `queue_id`, `entity_id`, `image_url`
395
+ FROM `{$tablePrefix}iceshop_iceimport_image_queue`
396
+ WHERE `is_downloaded` = 2 AND entity_id NOT IN({$iceimport_images_error_entity_id}) LIMIT 1");
397
+ } else {
398
+ return $db_res->fetchAll("SELECT `queue_id`, `entity_id`, `image_url`
399
+ FROM `{$tablePrefix}iceshop_iceimport_image_queue`
400
+ WHERE `is_downloaded` = 0 AND entity_id NOT IN({$iceimport_images_error_entity_id}) LIMIT 1");
401
+ }
402
+
403
+ }
404
+
405
+ } catch (Exception $e){
406
+ }
407
+ }
408
+
409
+ /**
410
+ * Method fetch count not import images for product
411
+ * @return integer
412
+ */
413
+ public function getCountImagesNotImport($update = 0){
414
+ try{
415
+ $db_res = Mage::getSingleton('core/resource')->getConnection('core_write');
416
+ $tablePrefix = '';
417
+ $tPrefix = (array)Mage::getConfig()->getTablePrefix();
418
+ if (!empty($tPrefix)) {
419
+ $tablePrefix = $tPrefix[0];
420
+ }
421
+ if($update){
422
+ return $return_resulr = $db_res->fetchOne("SELECT COUNT(*) FROM `{$tablePrefix}iceshop_iceimport_image_queue`
423
+ WHERE `is_downloaded` = 2");
424
+ } else {
425
+ return $return_resulr = $db_res->fetchOne("SELECT COUNT(*) FROM `{$tablePrefix}iceshop_iceimport_image_queue`
426
+ WHERE `is_downloaded` = 0");
427
+ }
428
+ } catch (Exception $e){
429
+ }
430
+ }
431
+
432
+
433
+
434
+ /**
435
+ * @param bool $queueId
436
+ */
437
+ private function setImageAsDownloaded($queueId = false)
438
+ {
439
+ if ($queueId) {
440
+ $db_res = Mage::getSingleton('core/resource')->getConnection('core_write');
441
+ $tablePrefix = '';
442
+ $tPrefix = (array)Mage::getConfig()->getTablePrefix();
443
+ if (!empty($tPrefix)) {
444
+ $tablePrefix = $tPrefix[0];
445
+ }
446
+ $db_res->query("UPDATE `{$tablePrefix}iceshop_iceimport_image_queue`
447
+ SET is_downloaded = 1
448
+ WHERE queue_id = {$queueId}");
449
+ }
450
+ }
451
+
452
+
453
+ /**
454
+ * @param bool $queueId
455
+ */
456
+ private function setImageAsDownloadedError($queueId = false)
457
+ {
458
+ if ($queueId) {
459
+ $db_res = Mage::getSingleton('core/resource')->getConnection('core_write');
460
+ $tablePrefix = '';
461
+ $tPrefix = (array)Mage::getConfig()->getTablePrefix();
462
+ if (!empty($tPrefix)) {
463
+ $tablePrefix = $tPrefix[0];
464
+ }
465
+ $db_res->query(
466
+ "UPDATE `{$tablePrefix}iceshop_iceimport_image_queue`
467
+ SET is_downloaded = 2
468
+ WHERE queue_id = :queue_id",
469
+ array(':queue_id' => $queueId)
470
+ );
471
+ }
472
+ }
473
+ }
474
+
475
+
app/code/community/ICEshop/Iceimport/Model/System/Config/Checksystem.php CHANGED
@@ -1,11 +1,11 @@
1
- <?php
2
-
3
- class ICEshop_Iceimport_Model_System_Config_Checksystem
4
- {
5
- public function toOptionArray()
6
- {
7
- return array(
8
- 0 => base64_encode(Mage::getSingleton('adminhtml/url')->getUrl("adminhtml/iceimport/system/"))
9
- );
10
- }
11
  }
1
+ <?php
2
+
3
+ class ICEshop_Iceimport_Model_System_Config_Checksystem
4
+ {
5
+ public function toOptionArray()
6
+ {
7
+ return array(
8
+ 0 => base64_encode(Mage::getSingleton('adminhtml/url')->getUrl("adminhtml/iceimport/system/"))
9
+ );
10
+ }
11
  }
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/Model/System/Config/Explanations.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class ICEshop_Iceimport_Model_System_Config_Explanations
4
+ {
5
+ public function toOptionArray()
6
+ {
7
+ return array(
8
+ 0 => base64_encode(Mage::getSingleton('adminhtml/url')->getUrl("adminhtml/iceimport/explanations/"))
9
+ );
10
+ }
11
+ }
app/code/community/ICEshop/Iceimport/Model/System/Config/Fields/Attributes.php ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class ICEshop_Iceimport_Model_System_Config_Fields_Attributes
5
+ */
6
+ class ICEshop_Iceimport_Model_System_Config_Fields_Attributes
7
+ {
8
+ /**
9
+ * Magento method
10
+ * @access public
11
+ * @return array
12
+ */
13
+ public function toOptionArray()
14
+ {
15
+ $paramsArray = array('' => '--Choose the attribute--');
16
+ $attribute_set_id = Mage::getModel('catalog/product')->getResource()->getEntityType()->getDefaultAttributeSetId();
17
+ if (!empty($attribute_set_id)) {
18
+ return array_merge($paramsArray, $this->getAttributesArrayBySetName($attribute_set_id));
19
+ }
20
+ return $paramsArray;
21
+ }
22
+
23
+ /**
24
+ * Fetch attributes in desired attribute set
25
+ * @access protected
26
+ * @param $attribute_set_id
27
+ * @return array
28
+ */
29
+ protected function getAttributesArrayBySetName($attribute_set_id)
30
+ {
31
+ if (!empty($attribute_set_id)) {
32
+ $params_array = array();
33
+ $attributes = Mage::getResourceModel('eav/entity_attribute_collection');
34
+ $attributes = $attributes->setAttributeSetFilter($attribute_set_id)
35
+ ->getItems();
36
+
37
+ foreach ($attributes as $attribute) {
38
+ $params_array[$attribute->getAttributeCode()] = $attribute->getAttributeCode();
39
+ }
40
+ ksort($params_array);
41
+ return $params_array;
42
+ }
43
+ return array();
44
+ }
45
+
46
+ /**
47
+ * Get attribute set ID by name and entity type ID
48
+ * @access protected
49
+ * @param $attribute_set_name
50
+ * @param $entity_type_id
51
+ * @return bool
52
+ */
53
+ protected function getAttributeSetId($attribute_set_name, $entity_type_id)
54
+ {
55
+ if (!empty($attribute_set_name) && !empty($entity_type_id)) {
56
+ $attribute_set_collection = Mage::getResourceModel('eav/entity_attribute_set_collection')
57
+ ->setEntityTypeFilter($entity_type_id)
58
+ ->getItemsByColumnValue('attribute_set_name', $attribute_set_name);
59
+ foreach ($attribute_set_collection as $attr) {
60
+ $attribute_set_id = $attr->getId();
61
+ break;
62
+ }
63
+ return (!empty($attribute_set_id) ? $attribute_set_id : false);
64
+ }
65
+ return false;
66
+ }
67
+
68
+ /**
69
+ * Get entity type ID by name
70
+ * @access protected
71
+ * @param $entity_type_name
72
+ * @return bool
73
+ */
74
+ protected function getEntityTypeId($entity_type_name)
75
+ {
76
+ if (!empty($entity_type_name)) {
77
+ $entity_type_id = Mage::getModel($entity_type_name)
78
+ ->getResource()
79
+ ->getTypeId();
80
+ return (!empty($entity_type_id) ? $entity_type_id : false);
81
+ }
82
+ return false;
83
+ }
84
+ }
app/code/community/ICEshop/Iceimport/Model/System/Config/Iceshoplink.php CHANGED
@@ -1,11 +1,11 @@
1
- <?php
2
-
3
- class ICEshop_Iceimport_Model_System_Config_Iceshoplink
4
- {
5
- public function toOptionArray()
6
- {
7
- return array(
8
- 0 => base64_encode('http://www.iceshop.biz/contact/')
9
- );
10
- }
11
  }
1
+ <?php
2
+
3
+ class ICEshop_Iceimport_Model_System_Config_Iceshoplink
4
+ {
5
+ public function toOptionArray()
6
+ {
7
+ return array(
8
+ 0 => base64_encode('http://www.iceshop.biz/contact/')
9
+ );
10
+ }
11
  }
app/code/community/ICEshop/Iceimport/Model/System/Config/Profiles.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class ICEshop_Iceimport_Model_System_Config_Profiles
4
+ {
5
+ public function toOptionArray()
6
+ {
7
+
8
+ $profileCollection = Mage::getModel('dataflow/profile')->getCollection();
9
+ $paramsArray = [];
10
+
11
+ foreach ($profileCollection as $profile) {
12
+ $paramsArray[$profile->getId()] = $profile->getName();
13
+ }
14
+
15
+ return $paramsArray;
16
+ }
17
+ }
18
+
19
+ ?>
app/code/community/ICEshop/Iceimport/Model/System/Config/Stock.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class ICEshop_Iceimport_Model_System_Config_Stock
4
+ {
5
+ public function toOptionArray()
6
+ {
7
+ $read = Mage::getSingleton('core/resource')->getConnection('core_read');
8
+
9
+ $prefix = Mage::getConfig()->getTablePrefix();
10
+ $sql = "SELECT * FROM {$prefix}cataloginventory_stock WHERE 1";
11
+ $result = $read->fetchAll($sql);
12
+ $paramsArray = array('' => '--Choose the attribute--');
13
+ if (!empty($result)) {
14
+ foreach ($result as $key => $value) {
15
+ $paramsArray[$value['stock_name']] = $value['stock_name'];
16
+ }
17
+ }
18
+ return $paramsArray;
19
+ }
20
+ }
21
+
22
+ ?>
app/code/community/ICEshop/Iceimport/Model/System/Config/Websites.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class ICEshop_Iceimport_Model_System_Config_Websites
4
+ {
5
+ public function toOptionArray()
6
+ {
7
+ $collection = Mage::app()->getWebsites();
8
+ $paramsArray = array('' => '--Choose the attribute--');
9
+ if (!empty($collection)) {
10
+ foreach ($collection as $key => $value) {
11
+ $paramsArray[$value->getCode()] = $value->getCode();
12
+ }
13
+ }
14
+
15
+ return $paramsArray;
16
+ }
17
+ }
18
+
19
+ ?>
app/code/community/ICEshop/Iceimport/Model/System/Config/Yesno.php CHANGED
@@ -1,15 +1,15 @@
1
- <?php
2
-
3
- class Iceshop_Iceimport_Model_System_Config_Yesno
4
- {
5
- public function toOptionArray()
6
- {
7
- $paramsArray = array(
8
- '1' => 'Yes',
9
- '0' => 'No'
10
- );
11
- return $paramsArray;
12
- }
13
- }
14
-
15
- ?>
1
+ <?php
2
+
3
+ class Iceshop_Iceimport_Model_System_Config_Yesno
4
+ {
5
+ public function toOptionArray()
6
+ {
7
+ $paramsArray = array(
8
+ '1' => 'Yes',
9
+ '0' => 'No'
10
+ );
11
+ return $paramsArray;
12
+ }
13
+ }
14
+
15
+ ?>
app/code/community/ICEshop/Iceimport/controllers/Adminhtml/IceimagesController.php CHANGED
@@ -1,12 +1,17 @@
1
- <?php
2
-
3
- class Iceshop_Icecatlive_Adminhtml_IceimagesController extends Mage_Adminhtml_Controller_Action
4
- {
5
-
6
- public function getGridTable()
7
- {
8
- return $this->getResponse()->setBody(
9
- $this->getLayout()->createBlock('iceimport/adminhtml_images_list_grid')->toHtml()
10
- );
11
- }
 
 
 
 
 
12
  }
1
+ <?php
2
+
3
+ class Iceshop_Icecatlive_Adminhtml_IceimagesController extends Mage_Adminhtml_Controller_Action
4
+ {
5
+
6
+ public function getGridTable()
7
+ {
8
+ return $this->getResponse()->setBody(
9
+ $this->getLayout()->createBlock('iceimport/adminhtml_images_list_grid')->toHtml()
10
+ );
11
+ }
12
+
13
+ protected function _isAllowed()
14
+ {
15
+ return Mage::getSingleton('admin/session')->isAllowed('system/config/iceimport_information');
16
+ }
17
  }
app/code/community/ICEshop/Iceimport/controllers/Adminhtml/IceimportController.php CHANGED
@@ -1,1182 +1,1483 @@
1
- <?php
2
- require_once 'IceimagesController.php';
3
- class ICEshop_Iceimport_Adminhtml_IceimportController extends Mage_Adminhtml_Controller_Action
4
- {
5
- public $_gridTables = NULL;
6
-
7
- public function _construct() {
8
- $this->_gridTables = new Iceshop_Icecatlive_Adminhtml_IceimagesController($this->getRequest(), $this->getResponse());
9
- parent::_construct();
10
- }
11
-
12
-
13
- /**
14
- * indexAction
15
- *
16
- * @return void
17
- *
18
- * TODO prevent hardcoded html structure
19
- */
20
- public function systemAction()
21
- {
22
- $checker = Mage::helper('iceimport/system_systemcheck')->init();
23
- $helper = Mage::helper('iceimport');
24
- ob_start();
25
- ?>
26
- <?php
27
- //Problems Digest
28
- $problems_digest = $checker->getExtensionProblemsDigest();
29
- $problems = $problems_digest->getProblems();
30
- if ($problems_digest->getCount() > 0) :
31
- ?>
32
- <div class="entry-edit" id="iceimport-digest">
33
- <div class="entry-edit-head collapseable">
34
- <a class="open section-toggler-iceimport"
35
- href="#"><?php print $helper->__('Problems Digest'); ?></a>
36
- </div>
37
-
38
- <div class="fieldset">
39
- <div class="hor-scroll">
40
- <table class="form-list" cellspacing="0" cellpadding="0">
41
- <?php print sprintf($helper->__('To guarantee the correct functioning of the Iceimport module you need to solve the following %s problems:'), '<strong class="requirement-failed">' . $problems_digest->getCount() . '</strong>'); ?>
42
- <?php
43
- $i = 1;
44
- foreach ($problems as $problem_section_name => $problem_section) {
45
- if($problem_section_name !='iceimport_delete_product'){
46
-
47
- foreach ($problem_section as $problem_name => $problem_value) {
48
-
49
- print '<tr>';
50
- print '<td class="label">';
51
- print '<label class="problem-digest">' . $helper->__('Problem') . " " . $i . ':</label>';
52
- print '</td>';
53
- print '<td class="value">';
54
- if ($problem_section_name != 'iceimport_log') {
55
- print '<span class="requirement-passed">"' . $problem_value['label'] . '"</span> ' . $helper->__('current value is') . ' <span class="requirement-failed">"' . $problem_value['current_value'] . '"</span> ' . $helper->__('and recommended value is') . ' <span class="requirement-passed">"' . (!empty($problem_value['recommended_value']) ? $problem_value['recommended_value'] : '') . '"</span>. ' . $helper->__(' Check this parameter in') . ' <a class="section-toggler-trigger-iceimport requirement-passed" data-href="#' . $problem_section_name . '-section" href="#' . $problem_section_name . '-section">' . ucfirst($problem_section_name) . '</a> ' . $helper->__('section') . '.';
56
- } else {
57
- print '<span class="requirement-passed">"' . $problem_value['label'] . '"</span> <span class="requirement-failed">"' . $problem_value['current_value'] . '"</span>. ' . $helper->__(' Check ') . ' <a class="section-toggler-trigger-iceimport requirement-passed" data-href="#' . $problem_section_name . '-section" href="#' . $problem_section_name . '-section">' . ucfirst($problem_section_name) . '</a> ' . $helper->__('section') . '.';
58
- }
59
- print '</td>';
60
- if($problem_section_name != 'requirement' && $problem_section_name != 'rewrite'){
61
- print '<td class="value">';
62
- print '<span class="f-right">'
63
- . '<a href="' . Mage::helper("adminhtml")->getUrl("adminhtml/iceimport/checkwarning/", array('warning'=>$problem_name,'section_problems' => $problem_section_name)) . '">'
64
- . Mage::helper( 'iceimport' )->__( 'Acknowledge' ) . '</a></span>';
65
- print '</td>';
66
- } elseif ($problem_section_name == 'requirement') {
67
- print '<td class="value">';
68
- print '<span class="f-right">'
69
- . '<a href="' . Mage::helper("adminhtml")->getUrl("adminhtml/iceimport/checkwarning/", array('warning'=>$problem_value['label'],'section_problems' => $problem_section_name)) . '">'
70
- . Mage::helper( 'iceimport' )->__( 'Acknowledge' ) . '</a></span>';
71
- print '</td>';
72
- } elseif ($problem_section_name == 'rewrite') {
73
- print '<td class="value">';
74
- print '<span class="f-right">'
75
- . '<a href="' . Mage::helper("adminhtml")->getUrl("adminhtml/iceimport/checkwarning/", array('warning'=>$problem_name,'section_problems' => $problem_section_name)) . '">'
76
- . Mage::helper( 'iceimport' )->__( 'Acknowledge' ) . '</a></span>';
77
- print '</td>';
78
- } elseif ($problem_section_name == 'iceimport_log') {
79
- print '<td class="value">';
80
- print '<span class="f-right">'
81
- . '<a href="' . Mage::helper("adminhtml")->getUrl("adminhtml/iceimport/checkwarning/", array('warning'=>$problem_name,'section_problems' => $problem_section_name)) . '">'
82
- . Mage::helper( 'iceimport' )->__( 'Acknowledge' ) . '</a></span>';
83
- print '</td>';
84
- }
85
- print '</tr>';
86
- $i++;
87
- }
88
- } else {
89
- foreach ($problem_section as $problem_name => $problem_value) {
90
- print '<tr>';
91
- print '<td class="label">';
92
- print '<label class="problem-digest">' . $helper->__('Problem') . " " . $i . ':</label>';
93
- print '</td>';
94
- print '<td class="value">';
95
- print '<span class="requirement-failed">' . $problem_value['label'] . ': </span> <span class="requirement">' . $problem_value['current_value'] . '</span> ';
96
- print '</td>';
97
-
98
- print '<td class="value">';
99
- print '<span class="f-right">'
100
- . '<a href="' . Mage::helper("adminhtml")->getUrl("adminhtml/iceimport/checkwarning/", array('warning'=>$problem_name, 'section_problems' => $problem_section_name)) . '">'
101
- . Mage::helper( 'iceimport' )->__( 'Acknowledge' ) .'</a></span>';
102
- print '</td>';
103
-
104
- print '</tr>';
105
- $i++;
106
- }
107
- }
108
- }
109
- ?>
110
- <tr>
111
- <td class="label col1">
112
- <label><?php print $helper->__("Report"); ?></label>
113
- </td>
114
- <td class="value col2" colspan="2">
115
- <a href="<?php print Mage::helper("adminhtml")->getUrl("adminhtml/iceimport/report/") ?>"
116
- target="_blank">&raquo;<?php print $helper->__('Click to generate'); ?></a>
117
- <p class="note"><?php print $helper->__("Use this report for more info on found problems or send it to Iceshop B.V. to help analyzing the problem to speed up solution of any issues."); ?></p>
118
- </td>
119
- <td></td>
120
- </tr>
121
- </table>
122
- </div>
123
- </div>
124
- </div>
125
- <?php
126
- endif;
127
- //Check module
128
- $DB_checker = Mage::helper('iceimport/db');
129
- $data_flows = $DB_checker->getRowCountByField($DB_checker->getTableName('dataflow_batch_import'), 'batch_id', false, ' ORDER BY 1 DESC LIMIT 50');
130
- $currently_imported_products = $DB_checker->getRowsCount($DB_checker->_prefix . "iceshop_iceimport_imported_product_ids");
131
- $table_name = $DB_checker->getTableName('dataflow_profile_history');
132
-
133
- $try_delete_product = $DB_checker->getLogEntryByKey('error_try_delete_product');
134
- $delete_product_percentage = $DB_checker->getLogEntryByKey('error_try_delete_product_percentage');
135
-
136
- $last_started_by_cron = $DB_checker->getLogEntryByKey('iceimport_import_started');
137
- $last_finished_by_cron = $DB_checker->getLogEntryByKey('iceimport_import_ended');
138
- $import_status_cron = $DB_checker->getLogEntryByKey('iceimport_import_status_cron');
139
- $last_deleted_products_count = $DB_checker->getLogEntryByKey('iceimport_count_delete_product');
140
- $last_imported_products_count = $DB_checker->getLogEntryByKey('iceimport_count_imported_products');
141
- $last_run = $DB_checker->readQuery("SELECT `performed_at` FROM {$table_name} WHERE `profile_id` = 3 ORDER BY `performed_at` DESC LIMIT 1");
142
- ?>
143
- <span id="iceimport_statistics-section"></span>
144
- <div class="entry-edit">
145
- <div class="entry-edit-head collapseable">
146
- <a href="#" class="section-toggler-iceimport">
147
- Iceimport Statistics
148
- </a>
149
- </div>
150
-
151
- <div class="fieldset iceimport-hidden">
152
- <div class="hor-scroll">
153
- <table class="form-list" cellspacing="0" cellpadding="0">
154
- <tr>
155
- <td colspan="2" class="label">
156
- <label class="iceimport-label-uppercase iceimport-label-bold">
157
- <?php print $helper->__('Import status by cron'); ?>
158
- </label>
159
- </td>
160
- </tr>
161
- <tr>
162
- <td class="label"><label><?php print $helper->__("Started last time at"); ?>:</label></td>
163
- <td class="value">
164
- <?php if (!empty($last_started_by_cron['log_value'])) echo $last_started_by_cron['log_value']; else print $helper->__("Never started till now"); ?>
165
- </td>
166
- </tr>
167
- <tr>
168
- <td class="label"><label><?php print $helper->__("Finished last time at"); ?>:</label></td>
169
- <td class="value">
170
- <?php if (!empty($last_finished_by_cron['log_value'])) echo $last_finished_by_cron['log_value']; else print $helper->__("Never started till now"); ?>
171
- </td>
172
- </tr>
173
- <tr>
174
- <td class="label"><label><?php print $helper->__("Import cron process status"); ?>:</label>
175
- </td>
176
- <td class="value">
177
- <?php if (!empty($import_status_cron['log_value'])) echo $import_status_cron['log_value']; else print $helper->__("Never started till now"); ?>
178
- </td>
179
- </tr>
180
- <?php if (!empty($currently_imported_products) && ($import_status_cron['log_value'] == 'Running' || $import_status_cron['log_value'] == 'Failed')) { ?>
181
- <tr>
182
- <td class="label"><label><?php print $helper->__("Currently products imported"); ?>
183
- :</label></td>
184
- <td class="value">
185
- <?php echo $currently_imported_products . ' from ' . $data_flows[0]['row_count']; ?>
186
- </td>
187
- </tr>
188
- <?php } ?>
189
- <tr>
190
- <td colspan="2" class="label">
191
- <label class="iceimport-label-uppercase iceimport-label-bold">
192
- <?php print $helper->__('Last import Statistics'); ?>
193
- </label>
194
- </td>
195
- </tr>
196
- <tr>
197
- <td class="label"><label><?php print $helper->__("Products imported last time "); ?>
198
- :</label></td>
199
- <td class="value">
200
- <?php if (!empty($last_imported_products_count['log_value'])) echo $last_imported_products_count['log_value']; else echo "0"; ?>
201
- </td>
202
- </tr>
203
-
204
- <tr>
205
- <td class="label">
206
- <label><?php print $helper->__("Removed out of date products last time "); ?>:</label>
207
- </td>
208
- <td class="value">
209
- <?php if (!empty($last_deleted_products_count['log_value'])) echo $last_deleted_products_count['log_value']; else echo "0"; ?>
210
- </td>
211
- </tr>
212
- <?php if(!empty($delete_product_percentage) && !empty($try_delete_product)) { ?>
213
- <tr>
214
- <td class="label">
215
- <label><?php print $helper->__("Attempt to remove a large amount of products "); ?>:</label>
216
- </td>
217
- <td class="value">
218
- <?php echo $try_delete_product['log_value'].$delete_product_percentage['log_value']; ?>
219
- </td>
220
- </tr>
221
- <?php } ?>
222
-
223
- </table>
224
- </div>
225
- </div>
226
- </div>
227
-
228
- <?php
229
- //Check module
230
- $check_module = $checker->getModulesCollection('ICEshop_Iceimport');
231
- $check_module = $check_module->getLastItem()->getData();
232
- ?>
233
- <span id="extension-section"></span>
234
- <div class="entry-edit">
235
- <div class="entry-edit-head collapseable">
236
- <a href="#"
237
- class="section-toggler-iceimport"><?php print $helper->__('Extension Diagnostic Info'); ?></a>
238
- </div>
239
- <div class="fieldset iceimport-hidden">
240
- <div class="hor-scroll">
241
- <table class="form-list" cellspacing="0" cellpadding="0">
242
- <tr>
243
- <td class="label"><label><?php print $helper->__('Name'); ?>:</label></td>
244
- <td class="value"><?php echo $check_module['name']; ?></td>
245
- </tr>
246
- <tr>
247
- <td class="label"><label><?php print $helper->__('Version'); ?>:</label></td>
248
- <td class="value"><?php echo $check_module['version']; ?></td>
249
- </tr>
250
- <tr>
251
- <td class="label"><label><?php print $helper->__('Code Pool'); ?>:</label></td>
252
- <td class="value"><?php echo $check_module['code_pool']; ?></td>
253
- </tr>
254
- <tr>
255
- <td class="label"><label><?php print $helper->__('Path'); ?>:</label></td>
256
- <td class="value"><?php echo $check_module['path']; ?></td>
257
- </tr>
258
- <tr>
259
- <td class="label"><label><?php print $helper->__('Path Exists'); ?>:</label></td>
260
- <td class="value <?php echo $checker->renderRequirementValue($check_module['path_exists']); ?>">
261
- <?php echo $checker->renderBooleanField($check_module['path_exists']); ?>
262
- </td>
263
- </tr>
264
- <tr>
265
- <td class="label"><label><?php print $helper->__('Config Exists'); ?>:</label></td>
266
- <td class="value <?php echo $checker->renderRequirementValue($check_module['config_exists']); ?>">
267
- <?php echo $checker->renderBooleanField($check_module['config_exists']); ?>
268
- </td>
269
- </tr>
270
- <tr>
271
- <td class="label"><label><?php print $helper->__('Dependencies'); ?>:</label></td>
272
- <td class="value"><?php echo $check_module['dependencies']; ?></td>
273
- </tr>
274
- </table>
275
- </div>
276
- </div>
277
- </div>
278
-
279
- <?php
280
- //Check rewrites
281
- $check_rewrites = $checker->getRewriteCollection('ICEshop_Iceimport');
282
- ?>
283
- <span id="rewrite-section"></span>
284
- <div class="entry-edit">
285
- <div class="entry-edit-head collapseable">
286
- <a href="#"
287
- class="section-toggler-iceimport"><?php print $helper->__('Extension Rewrites Status'); ?></a>
288
- </div>
289
-
290
- <div class="fieldset iceimport-hidden">
291
- <div class="hor-scroll">
292
- <table class="form-list" cellspacing="0" cellpadding="0">
293
- <tbody>
294
- <?php
295
- foreach ($check_rewrites as $rewrite) {
296
- ?>
297
- <tr>
298
- <td>
299
- <span
300
- class="iceimport-label-bold iceimport-label-rewrite"><?php print $helper->__('Path'); ?>
301
- :</span>
302
- <span><?php echo $rewrite['path']; ?></span>
303
- <br/>
304
- <span
305
- class="iceimport-label-bold iceimport-label-rewrite"><?php print $helper->__('Rewrite Class'); ?>
306
- :</span>
307
- <span><?php echo $rewrite['rewrite_class']; ?></span>
308
- <br/>
309
- <span
310
- class="iceimport-label-bold iceimport-label-rewrite"><?php print $helper->__('Active Class'); ?>
311
- :</span>
312
- <span><?php echo $rewrite['active_class']; ?></span>
313
- <br/>
314
- <span
315
- class="iceimport-label-bold iceimport-label-rewrite"><?php print $helper->__('Status'); ?>
316
- :</span>
317
- <span
318
- class="<?php echo $checker->renderRequirementValue($rewrite['status']); ?>">
319
- <?php echo $checker->renderStatusField($rewrite['status']); ?>
320
- </span>
321
- <br/>
322
- <br/>
323
- </td>
324
- </tr>
325
- <?php
326
- }
327
- ?>
328
- </tbody>
329
- </table>
330
- </div>
331
- </div>
332
- </div>
333
-
334
- <span id="requirement-section"></span>
335
- <div class="entry-edit">
336
- <div class="entry-edit-head collapseable">
337
- <a class="section-toggler-iceimport" href="#"><?php print $helper->__('System Requirements'); ?></a>
338
- </div>
339
-
340
- <?php $requirements = $checker->getSystem()->getRequirements()->getData(); ?>
341
- <div class="fieldset iceimport-hidden">
342
- <div class="hor-scroll">
343
- <table class="form-list firegento-settings-table" cellspacing="0" cellpadding="0">
344
- <thead>
345
- <tr>
346
- <th class="label col1"><?php print $helper->__('Requirement'); ?></th>
347
- <th class="value col2"><?php print $helper->__('Current Value'); ?></th>
348
- <th class="value col3"><?php print $helper->__('Recommended Value'); ?></th>
349
- </tr>
350
- </thead>
351
- <tbody>
352
- <?php foreach ($requirements as $requirement): ?>
353
- <tr>
354
- <td class="label col1">
355
- <label><span
356
- class="iceimport-pad-label"><?php echo $requirement['label']; ?></span><?php print $checker->renderAdvice($requirement); ?>
357
- :</label>
358
- </td>
359
- <td class="value col2 <?php echo $checker->renderRequirementValue($requirement['result']) ?>">
360
- <?php echo $requirement['current_value'] ?>
361
- </td>
362
- <td class="value col3"><?php echo $requirement['recommended_value'] ?></td>
363
- </tr>
364
- <?php endforeach; ?>
365
- <tr>
366
- <td class="label col1"><label>phpinfo()</label>
367
- </td>
368
- <td class="value col2" colspan="2">
369
- <a href="<?php print Mage::helper("adminhtml")->getUrl("adminhtml/iceimport/phpinfo/") ?>"
370
- target="_blank">&raquo;<?php print $helper->__('More info'); ?></a>
371
- </td>
372
- </tr>
373
- <?php ?>
374
- </tbody>
375
- </table>
376
- </div>
377
- </div>
378
- </div>
379
-
380
- <span id="magento-section"></span>
381
- <div class="entry-edit">
382
- <div class="entry-edit-head collapseable">
383
- <a href="#" class="section-toggler-iceimport">Magento Info</a>
384
- </div>
385
-
386
- <div class="fieldset iceimport-hidden">
387
- <div class="hor-scroll">
388
- <table class="form-list" cellspacing="0" cellpadding="0">
389
- <tr>
390
- <td class="label"><label>Edition:</label></td>
391
- <td class="value"><?php echo $checker->getSystem()->getMagento()->getEdition() ?></td>
392
- </tr>
393
- <tr>
394
- <td class="label"><label>Version:</label></td>
395
- <td class="value"><?php echo $checker->getSystem()->getMagento()->getVersion() ?></td>
396
- </tr>
397
- <tr>
398
- <td class="label"><label>Developer Mode:</label></td>
399
- <td class="value"><?php echo $checker->renderBooleanField($checker->getSystem()->getMagento()->getDeveloperMode()) ?></td>
400
- </tr>
401
- <tr>
402
- <td class="label"><label>Add Secret Key to URLs:</label></td>
403
- <td class="value"><?php echo $checker->renderBooleanField($checker->getSystem()->getMagento()->getSecretKey()) ?></td>
404
- </tr>
405
- <tr>
406
- <td class="label"><label>Use Flat Catalog Category:</label></td>
407
- <td class="value"><?php echo $checker->renderBooleanField($checker->getSystem()->getMagento()->getFlatCatalogCategory()) ?></td>
408
- </tr>
409
- <tr>
410
- <td class="label"><label>Use Flat Catalog Product:</label></td>
411
- <td class="value"><?php echo $checker->renderBooleanField($checker->getSystem()->getMagento()->getFlatCatalogProduct()) ?></td>
412
- </tr>
413
- <tr>
414
- <td class="label"><label>Cache status:</label></td>
415
- <td class="value">
416
- <?php echo $checker->getSystem()->getMagento()->getCacheStatus() ?><br/>
417
- <a href="<?php echo Mage::helper("adminhtml")->getUrl('adminhtml/cache/') ?>">&raquo;Cache
418
- Management</a>
419
- </td>
420
- </tr>
421
- <tr>
422
- <td class="label"><label>Index status:</label></td>
423
- <td class="value">
424
- <?php echo $checker->getSystem()->getMagento()->getIndexStatus() ?><br/>
425
- <a href="<?php echo Mage::helper("adminhtml")->getUrl('adminhtml/process/list') ?>">&raquo;Index
426
- Management</a>
427
- </td>
428
- </tr>
429
- </table>
430
- </div>
431
- </div>
432
- </div>
433
-
434
- <span id="api-section"></span>
435
- <div class="entry-edit">
436
- <div class="entry-edit-head collapseable">
437
- <a href="#" class="section-toggler-iceimport">Magento Core API Info</a>
438
- </div>
439
-
440
- <div class="fieldset iceimport-hidden">
441
- <div class="hor-scroll">
442
- <table class="form-list" cellspacing="0" cellpadding="0">
443
- <tr>
444
- <td class="label"><label><?php print $helper->__('Default Response Charset'); ?>:</label>
445
- </td>
446
- <td class="value"><?php echo $checker->getSystem()->getMagentoApi()->getCharset() ?></td>
447
- </tr>
448
- <tr>
449
- <?php $magento_api_session_timeout = $checker->getSystem()->getMagentoApi()->getSessionTimeout() ?>
450
- <td class="label"><label><?php print $magento_api_session_timeout['label']; ?>:</label></td>
451
- <td class="value <?php echo $checker->renderRequirementValue($magento_api_session_timeout['result']) ?>"><?php echo $magento_api_session_timeout['current_value'] ?></td>
452
- </tr>
453
- <tr>
454
- <td class="label"><label><?php print $helper->__('WS-I Compliance'); ?>:</label></td>
455
- <td class="value"><?php echo $checker->renderBooleanField($checker->getSystem()->getMagentoApi()->getComplianceWsi()) ?></td>
456
- </tr>
457
- <tr>
458
- <td class="label"><label><?php print $helper->__('WSDL Cache'); ?>:</label></td>
459
- <td class="value"><?php echo $checker->renderBooleanField($checker->getSystem()->getMagentoApi()->getWsdlCacheEnabled()) ?></td>
460
- </tr>
461
- </table>
462
- </div>
463
- </div>
464
- </div>
465
-
466
- <span id="php-section"></span>
467
- <div class="entry-edit">
468
- <div class="entry-edit-head collapseable">
469
- <a href="#" class="section-toggler-iceimport">PHP Info</a>
470
- </div>
471
-
472
- <div class="fieldset iceimport-hidden">
473
- <div class="hor-scroll">
474
- <table class="form-list" cellspacing="0" cellpadding="0">
475
- <tr>
476
- <td class="label"><label><?php print $helper->__('Version'); ?>:</label></td>
477
- <td class="value"><?php echo $checker->getSystem()->getPhp()->getVersion() ?></td>
478
- </tr>
479
- <tr>
480
- <td class="label"><label><?php print $helper->__('Server API'); ?>:</label></td>
481
- <td class="value"><?php echo $checker->getSystem()->getPhp()->getServerApi() ?></td>
482
- </tr>
483
- <tr>
484
- <td class="label"><label><?php print $helper->__('Memory Limit'); ?>:</label></td>
485
- <td class="value"><?php echo $checker->getSystem()->getPhp()->getMemoryLimit() ?></td>
486
- </tr>
487
- <tr>
488
- <td class="label"><label><?php print $helper->__('Max. Execution Time'); ?>:</label></td>
489
- <td class="value"><?php echo $checker->getSystem()->getPhp()->getMaxExecutionTime() ?></td>
490
- </tr>
491
- </table>
492
- </div>
493
- </div>
494
- </div>
495
-
496
- <span id="mysql-section"></span>
497
- <div class="entry-edit">
498
- <div class="entry-edit-head collapseable">
499
- <a href="#" class="section-toggler-iceimport">MySQL Info</a>
500
- </div>
501
-
502
- <div class="fieldset iceimport-hidden">
503
- <div class="hor-scroll">
504
- <table class="form-list" cellspacing="0" cellpadding="0">
505
- <thead>
506
- <tr>
507
- <th class="label col1"><?php print $helper->__('Requirement'); ?></th>
508
- <th class="value col2"><?php print $helper->__('Current Value'); ?></th>
509
- <th class="value col3"><?php print $helper->__('Recommended Value'); ?></th>
510
- </tr>
511
- </thead>
512
- <tbody>
513
- <tr>
514
- <td class="label"><label><?php print $helper->__('Version'); ?>:</label></td>
515
- <td class="value"><?php echo $checker->getSystem()->getMysql()->getVersion() ?></td>
516
- </tr>
517
- <tr>
518
- <td class="label"><label><?php print $helper->__('Server API'); ?>:</label></td>
519
- <td class="value"><?php echo $checker->getSystem()->getMysql()->getServerApi() ?></td>
520
- </tr>
521
- <tr>
522
- <td class="label"><label><?php print $helper->__('Database Name'); ?>:</label></td>
523
- <td class="value"><?php echo $checker->getSystem()->getMysql()->getDatabaseName() ?></td>
524
- </tr>
525
- <tr>
526
- <td class="label"><label><?php print $helper->__('Database Tables'); ?>:</label></td>
527
- <td class="value"><?php echo $checker->getSystem()->getMysql()->getDatabaseTables() ?></td>
528
- </tr>
529
- <tr>
530
- <td class="label"><label><?php print $helper->__('Database Table Prefix'); ?>:</label></td>
531
- <td class="value"><?php echo $checker->getSystem()->getMysql()->getTablePrefix() ?></td>
532
- </tr>
533
- <tr>
534
- <td class="label"><label><?php print $helper->__('Connection Timeout'); ?>:</label></td>
535
- <td class="value"><?php echo $checker->getSystem()->getMysql()->getConnectionTimeout() ?></td>
536
- </tr>
537
- <tr>
538
- <td class="label"><label><?php print $helper->__('Wait Timeout'); ?>:</label></td>
539
- <td class="value"><?php echo $checker->getSystem()->getMysql()->getWaitTimeout() ?></td>
540
- </tr>
541
- <tr>
542
- <?php $thread_stack = $checker->getSystem()->getMysql()->getThreadStack(); ?>
543
- <td class="label col1">
544
- <label><?php print $thread_stack['label']; ?><?php print $checker->renderAdvice($thread_stack); ?>
545
- :</label></td>
546
- <td class="value col2 <?php echo $checker->renderRequirementValue($thread_stack['result']) ?>"><?php echo $thread_stack['current_value'] ?></td>
547
- <td class="value col3"><?php echo $thread_stack['recommended_value'] ?></td>
548
- </tr>
549
- <tr>
550
- <?php $max_allowed_packet = $checker->getSystem()->getMysql()->getMaxAllowedPacket(); ?>
551
- <td class="label col1">
552
- <label><?php print $max_allowed_packet['label']; ?><?php print $checker->renderAdvice($max_allowed_packet); ?>
553
- :</label>
554
- </td>
555
- <td class="value col2 <?php echo $checker->renderRequirementValue($max_allowed_packet['result']) ?>">
556
- <?php echo $max_allowed_packet['current_value'] ?>
557
- </td>
558
- <td class="value col3"><?php echo $max_allowed_packet['recommended_value'] ?></td>
559
- </tr>
560
- </tbody>
561
- </table>
562
- </div>
563
- </div>
564
- </div>
565
-
566
- <span id="mysql_conf-section"></span>
567
- <div class="entry-edit">
568
- <div class="entry-edit-head collapseable">
569
- <a href="#" class="section-toggler-iceimport"><?php print $helper->__('MySQL Configuration'); ?></a>
570
- </div>
571
-
572
- <div class="fieldset iceimport-hidden">
573
- <div class="hor-scroll">
574
- <table class="form-list" cellspacing="0" cellpadding="0">
575
- <?php
576
- $mysql_vars = $checker->getSystem()->getMysqlVars()->getData();
577
- foreach ($mysql_vars as $mysql_var_key => $mysql_var_value) {
578
- print '<tr>';
579
- print '<td><strong>' . $mysql_var_key . ':</strong></td>';
580
- print '<td class="value">' . $mysql_var_value . '</td>';
581
- print '</tr>';
582
- }
583
- ?>
584
- </table>
585
- </div>
586
- </div>
587
- </div>
588
-
589
- <span id="server-section"></span>
590
- <div class="entry-edit">
591
- <div class="entry-edit-head collapseable">
592
- <a href="#" class="section-toggler-iceimport"><?php print $helper->__('Server Info'); ?></a>
593
- </div>
594
-
595
- <div class="fieldset iceimport-hidden">
596
- <div class="hor-scroll">
597
- <table class="form-list" cellspacing="0" cellpadding="0">
598
- <tr>
599
- <td class="label"><label><?php print $helper->__('Info'); ?>:</label></td>
600
- <td class="value"><?php echo $checker->getSystem()->getServer()->getInfo() ?></td>
601
- </tr>
602
- <tr>
603
- <td class="label"><label><?php print $helper->__('Domain'); ?>:</label></td>
604
- <td class="value"><?php echo $checker->getSystem()->getServer()->getDomain() ?></td>
605
- </tr>
606
- <tr>
607
- <td class="label"><label><?php print $helper->__('Server IP'); ?>:</label></td>
608
- <td class="value"><?php echo $checker->getSystem()->getServer()->getIp() ?></td>
609
- </tr>
610
- <tr>
611
- <td class="label"><label><?php print $helper->__('Server Directory'); ?>:</label></td>
612
- <td class="value"><?php echo $checker->getSystem()->getServer()->getDir() ?></td>
613
- </tr>
614
- </table>
615
- </div>
616
- </div>
617
- </div>
618
-
619
- <?php
620
- $iceimport_log = $DB_checker->getLogByType('info', 'neq', 500);
621
- ?>
622
- <span id="iceimport_log-section"></span>
623
- <div class="entry-edit">
624
- <div class="entry-edit-head collapseable">
625
- <a href="#" class="section-toggler-iceimport">Iceimport Log</a>
626
- </div>
627
-
628
- <div class="fieldset iceimport-hidden">
629
- <div class="hor-scroll">
630
- <table class="form-list" cellspacing="0" cellpadding="0">
631
- <?php
632
- if (!empty($iceimport_log) && count($iceimport_log) > 0) {
633
- print '<thead>';
634
- print '<tr>';
635
- print "<th class=\"label col1\">{$helper->__('Time')}</th>";
636
- print "<th class=\"value col2\">{$helper->__('Value')}</th>";
637
- print '</tr>';
638
- print '</thead>';
639
- print '<tbody>';
640
- foreach ($iceimport_log as $iceimport_log_item) {
641
- print '<tr>';
642
- print "<td class=\"label\"><label>{$iceimport_log_item['timecol']}</label></td>";
643
- print "<td class=\"value full-width\"><label>{$iceimport_log_item['log_value']}</label></td>";
644
- print '</tr>';
645
- }
646
- print '</tbody>';
647
- } else {
648
- print '<tbody>';
649
- print '<tr>';
650
- print "<td class=\"label\"><label>{$helper->__('Still empty')}</label></td>";
651
- print '</tr>';
652
- print '</tbody>';
653
- }
654
- ?>
655
- </table>
656
- </div>
657
- </div>
658
- </div>
659
- <?php //Image Statistics ?>
660
- <span id="iceimport_image-statistics-section"></span>
661
- <div class="entry-edit">
662
- <div class="entry-edit-head collapseable">
663
- <a href="#" class="section-toggler-iceimport">Images Statistics</a>
664
- </div>
665
-
666
- <div class="fieldset iceimport-hidden">
667
- <div class="hor-scroll">
668
- <table class="form-list" cellspacing="0" cellpadding="0">
669
- <?php
670
- $image_statistics = $checker->getImagesStatistics();
671
- print '<tbody>';
672
- if(!empty($image_statistics)){
673
- foreach ($image_statistics as $statistic){
674
- if($statistic['type'] == 'total_error_download' && $statistic['value'] > 0){
675
- $update_button = $this->getLayout()->createBlock('iceimport/adminhtml_system_config_form_updatebutton');
676
- print '<tr>';
677
- print "<td class=\"label\"><label>{$statistic['label']}</label></td>";
678
- print "<td class=\"label\"><label>{$statistic['value']}</label></td>";
679
- print "<td class=\"label\">{$update_button->getButtonHtml()}</td>";
680
- print '</tr>';
681
- } else if($statistic['type'] == 'total_waiting_download' && $statistic['value'] > 0){
682
- $button = $this->getLayout()->createBlock('iceimport/adminhtml_system_config_form_button');
683
- print '<tr>';
684
- print "<td class=\"label\"><label>{$statistic['label']}</label></td>";
685
- print "<td class=\"label\"><label>{$statistic['value']}</label></td>";
686
- print "<td class=\"label\">{$button->getButtonHtml()}</td>";
687
- print '</tr>';
688
- } else {
689
- if(!empty($statistic['label']) || !empty($statistic['value'])){
690
- print '<tr>';
691
- print "<td class=\"label\"><label>{$statistic['label']}</label></td>";
692
- print "<td class=\"label\"><label>{$statistic['value']}</label></td>";
693
- print "<td></td>";
694
- print '</tr>';
695
- }
696
- }
697
- }
698
- }
699
- print '</tbody>';
700
- ?>
701
- </table>
702
- <div id="gridActionClener" class="hor-scroll">
703
- <?php
704
- if(!empty($image_statistics)){
705
- if(!empty( $image_statistics['total_error_download']['value'])&&$image_statistics['total_error_download']['value']>0){
706
- $exportall_button = $this->getLayout()->createBlock('iceimport/adminhtml_system_config_form_exportall');
707
- echo $this->_gridTables->getGridTable().$exportall_button->getButtonHtml();
708
-
709
- }
710
- }
711
- ?>
712
- </div>
713
- </div>
714
- </div>
715
- </div>
716
- <style>
717
- .requirement-passed {
718
- color: green;
719
- }
720
-
721
- .requirement-failed {
722
- color: red;
723
- }
724
- </style>
725
- <script type="text/javascript">
726
-
727
-
728
- function import_prod_images(import_run, update){
729
- $('loading_mask_loader').setStyle({
730
- width: '430px',
731
- marginLeft: '-235px',
732
- top: '25%'
733
- });
734
- $('loading-mask').setStyle({
735
- display: 'inline',
736
- opacity: '0.90'
737
- });
738
- $$('#loading_mask_loader > img')[0].setStyle({
739
- 'display': 'inline'
740
- });
741
- var str = $('loading_mask_loader').innerHTML;
742
- str = str.replace('<br>Please wait...', '');
743
- $('loading_mask_loader').innerHTML = str;
744
-
745
- new Ajax.Request('<?php echo Mage::helper("adminhtml")->getUrl("adminhtml/iceimportimages/check/"); ?>', {
746
- method: 'get',
747
- parameters: {import_run: import_run, update_images:update},
748
- onSuccess: function(data){
749
- var import_info = JSON.parse(data.responseText);
750
- var images_error_text = '';
751
- var images_error = import_info.images_error;
752
- if(images_error){
753
- images_error_text = '<p> Import images error: ' + import_info.images_error_text + '</p>';
754
- }
755
- var iceimport_count_images = '<p> Found images not imported: '+import_info.count_images+'</p>';
756
- var iceimport_current_images_import = '<p> Current images import: '+import_info.current_images_import+'</p>';
757
- if(import_info.done != 1){
758
- if($('loading_mask_loader').select('#iceimport-images-response').size() == 0){
759
- $('loading_mask_loader').insert({bottom: '<div id="iceimport-images-response" style="text-align: left">'
760
- +iceimport_count_images
761
- +iceimport_current_images_import
762
- +images_error_text
763
- +'</div>'});
764
- }else{
765
- $('iceimport-images-response').replace('<div id="iceimport-images-response" style="text-align: left">'
766
- +iceimport_count_images
767
- +iceimport_current_images_import
768
- +images_error_text
769
- +'</div>');
770
- }
771
- import_prod_images(0,update);
772
- }else{
773
- if($('loading_mask_loader').select('#iceimport-images-response').size() == 0){
774
- $('loading_mask_loader').insert({bottom: '<div id="iceimport-images-response" style="text-align: left">'
775
- +iceimport_count_images
776
- +iceimport_current_images_import
777
- +images_error_text
778
- +'</div>'
779
- +'<button id="iceimport_images_button_finish" onclick="javascript:hide_progress_popup(); return false;" title="Finish import" type="button" class="scalable " style=""><span><span><span>Finish import</span></span></span></button>'});
780
- }else{
781
- $('iceimport-images-response').replace('<div id="iceimport-images-response" style="text-align: left">'
782
- +iceimport_count_images
783
- +iceimport_current_images_import
784
- +images_error_text
785
- +'</div>'
786
- +'<button id="iceimport_images_button_finish" onclick="javascript:hide_progress_popup(); return false;" title="Finish import" type="button" class="scalable " style=""><span><span><span>Finish import</span></span></span></button>');
787
- }
788
- $$('#loading_mask_loader > img')[0].setStyle({
789
- 'display': 'none'
790
- });
791
- var str = $('loading_mask_loader').innerHTML;
792
- str = str.replace('<br>Please wait...', '');
793
- $('loading_mask_loader').innerHTML = str;
794
- }
795
- },
796
- onComplete: function(){
797
- $('loading_mask').setStyle({
798
- display: 'none'
799
- });
800
- },
801
- onFailure: function() {
802
- import_prod_images(1,update);
803
- }
804
- });
805
- }
806
-
807
- function hide_progress_popup(){
808
- document.getElementById("iceimport_images_button_finish").remove();
809
- document.getElementById('iceimport-images-response').innerHTML = '';
810
- $('loading-mask').setStyle({
811
- display: 'none'
812
- });
813
- }
814
-
815
- </script>
816
- <?php
817
- $system_check_content = ob_get_contents();
818
- ob_end_clean();
819
-
820
- $reset_button_html = $helper->getButtonHtml(array(
821
- 'id' => 'iceimport_check_system_refresh',
822
- 'element_name' => 'iceimport_check_system_refresh',
823
- 'title' => Mage::helper('catalog')->__('Refresh'),
824
- 'type' => 'reset',
825
- 'class' => 'save',
826
- 'label' => Mage::helper('catalog')->__('Refresh'),
827
- 'OnClick' => 'refreshIceimportSystemCheck(\'' . base64_encode(Mage::helper("adminhtml")->getUrl("adminhtml/iceimport/system/")) . '\');'
828
- ));
829
-
830
- $jsonData = json_encode(array('structure' => $system_check_content, 'refresh_btn' => $reset_button_html));
831
- $this->getResponse()->setHeader('Content-type', 'application/json');
832
- $this->getResponse()->setBody($jsonData);
833
- }
834
-
835
- public function phpinfoAction()
836
- {
837
- phpinfo(-1);
838
- }
839
-
840
- public function reportAction()
841
- {
842
- header("Content-Type: text/plain; charset=utf-8");
843
- $report_filename = 'iceimport-report' . (string)Mage::getConfig()->getNode()->modules->ICEshop_Iceimport->version . '.txt';
844
- header("Content-disposition: attachment; filename={$report_filename}");
845
- header("Content-Transfer-Encoding: binary");
846
- header("Pragma: no-cache");
847
- header("Expires: 0");
848
-
849
- //TODO add report content
850
- $checker = Mage::helper('iceimport/system_systemcheck')->init();
851
- $helper = Mage::helper('iceimport');
852
-
853
- //========================================
854
- //Problems Digest
855
- //========================================
856
- $problems_digest = $checker->getExtensionProblemsDigest();
857
- if ($problems_digest->getCount() != 0) {
858
- $problems = $problems_digest->getProblems();
859
- print str_pad('', 100, '=') . "\n";
860
- print 'Problems Digest' . "\n";
861
- print str_pad('', 100, '=') . "\n";
862
- foreach ($problems as $problem_name => $problem_value) {
863
- print $problem_name . "\n";
864
- print_r($problem_value);
865
- }
866
- print str_pad('', 100, '=') . "\n";
867
- print "\n";
868
- }
869
- //========================================
870
-
871
- //========================================
872
- //Check module
873
- //========================================
874
- $check_module = $checker->getModulesCollection('ICEshop_Iceimport');
875
- $check_module = $check_module->getLastItem()->getData();
876
- print str_pad('', 100, '=') . "\n";
877
- print 'Extension Diagnostic Info' . "\n";
878
- print str_pad('', 100, '=') . "\n";
879
- print str_pad('Name', 50) . ':' . str_pad('', 5);
880
- print $check_module['name'] . "\n";
881
-
882
- print str_pad('Version', 50) . ':' . str_pad('', 5);
883
- print $check_module['version'] . "\n";
884
-
885
- print str_pad('Code Pool', 50) . ':' . str_pad('', 5);
886
- print $check_module['code_pool'] . "\n";
887
-
888
- print str_pad('Path', 50) . ':' . str_pad('', 5);
889
- print $check_module['path'] . "\n";
890
-
891
- print str_pad('Path Exists', 50) . ':' . str_pad('', 5);
892
- print $checker->renderBooleanField($check_module['path_exists']) . "\n";
893
-
894
- print str_pad('Config Exists', 50) . ':' . str_pad('', 5);
895
- print $checker->renderBooleanField($check_module['config_exists']) . "\n";
896
-
897
- print str_pad('Dependencies', 50) . ':' . str_pad('', 5);
898
- print $check_module['dependencies'] . "\n";
899
- print str_pad('', 100, '=') . "\n";
900
- print "\n";
901
- //========================================
902
-
903
-
904
- //========================================
905
- //Check rewrites
906
- //========================================
907
- $check_rewrites = $checker->getRewriteCollection('ICEshop_Iceimport');
908
- print str_pad('', 100, '=') . "\n";
909
- print 'Extension Rewrites Status' . "\n";
910
- print str_pad('', 100, '=') . "\n";
911
- foreach ($check_rewrites as $rewrite) {
912
- print str_pad('Path', 50) . ':' . str_pad('', 5);
913
- print $rewrite['path'] . "\n";
914
-
915
- print str_pad('Rewrite Class', 50) . ':' . str_pad('', 5);
916
- print $rewrite['rewrite_class'] . "\n";
917
-
918
- print str_pad('Active Class', 50) . ':' . str_pad('', 5);
919
- print $rewrite['active_class'] . "\n";
920
-
921
- print str_pad('Status', 50) . ':' . str_pad('', 5);
922
- print $checker->renderStatusField($rewrite['status']) . "\n";
923
- }
924
- print str_pad('', 100, '=') . "\n";
925
- print "\n";
926
- //========================================
927
-
928
- //========================================
929
- //System Requirements
930
- //========================================
931
- $requirements = $checker->getSystem()->getRequirements()->getData();
932
- print str_pad('', 100, '=') . "\n";
933
- print 'System Requirements' . "\n";
934
- print str_pad('', 100, '=') . "\n";
935
- foreach ($requirements as $requirement) {
936
- print str_pad($requirement['label'], 50) . ':' . str_pad('', 5);
937
- print str_pad($requirement['recommended_value'], 30);
938
- print $requirement['current_value'] . "\n";
939
- }
940
- print str_pad('', 100, '=') . "\n";
941
- print "\n";
942
- //========================================
943
-
944
- //========================================
945
- //Magento Info
946
- //========================================
947
- print str_pad('', 100, '=') . "\n";
948
- print 'Magento Info' . "\n";
949
- print str_pad('', 100, '=') . "\n";
950
- print str_pad('Edition', 50) . ':' . str_pad('', 5);
951
- print $checker->getSystem()->getMagento()->getEdition() . "\n";
952
-
953
- print str_pad('Version', 50) . ':' . str_pad('', 5);
954
- print $checker->getSystem()->getMagento()->getVersion() . "\n";
955
-
956
- print str_pad('Developer Mode', 50) . ':' . str_pad('', 5);
957
- print $checker->renderBooleanField($checker->getSystem()->getMagento()->getDeveloperMode()) . "\n";
958
-
959
- print str_pad('Add Secret Key to URLs', 50) . ':' . str_pad('', 5);
960
- print print $checker->renderBooleanField($checker->getSystem()->getMagento()->getSecretKey()) . "\n";
961
-
962
- print str_pad('Use Flat Catalog Category', 50) . ':' . str_pad('', 5);
963
- print $checker->renderBooleanField($checker->getSystem()->getMagento()->getFlatCatalogCategory()) . "\n";
964
-
965
- print str_pad('Use Flat Catalog Product', 50) . ':' . str_pad('', 5);
966
- print print $checker->renderBooleanField($checker->getSystem()->getMagento()->getFlatCatalogProduct()) . "\n";
967
- print str_pad('', 100, '=') . "\n";
968
- print "\n";
969
- //========================================
970
-
971
- //========================================
972
- //Magento Core API Info
973
- //========================================
974
- print str_pad('', 100, '=') . "\n";
975
- print 'Magento Core API Info' . "\n";
976
- print str_pad('', 100, '=') . "\n";
977
- print str_pad('Default Response Charset', 50) . ':' . str_pad('', 5);
978
- print print $checker->getSystem()->getMagentoApi()->getCharset() . "\n";
979
-
980
- print str_pad('Client Session Timeout (sec.)', 50) . ':' . str_pad('', 5);
981
- $magento_api_session_timeout = $checker->getSystem()->getMagentoApi()->getSessionTimeout();
982
- print $magento_api_session_timeout['current_value'] . "\n";
983
-
984
- print str_pad('WS-I Compliance', 50) . ':' . str_pad('', 5);
985
- print $checker->renderBooleanField($checker->getSystem()->getMagentoApi()->getComplianceWsi()) . "\n";
986
-
987
- print str_pad('WSDL Cache', 50) . ':' . str_pad('', 5);
988
- print $checker->renderBooleanField($checker->getSystem()->getMagentoApi()->getWsdlCacheEnabled()) . "\n";
989
- print str_pad('', 100, '=') . "\n";
990
- print "\n";
991
- //========================================
992
-
993
- //========================================
994
- //PHP Info
995
- //========================================
996
- print str_pad('', 100, '=') . "\n";
997
- print 'PHP Info' . "\n";
998
- print str_pad('', 100, '=') . "\n";
999
- print str_pad('Version', 50) . ':' . str_pad('', 5);
1000
- print $checker->getSystem()->getPhp()->getVersion() . "\n";
1001
-
1002
- print str_pad('Server API', 50) . ':' . str_pad('', 5);
1003
- print $checker->getSystem()->getPhp()->getServerApi() . "\n";
1004
-
1005
- print str_pad('Memory Limit', 50) . ':' . str_pad('', 5);
1006
- print $checker->getSystem()->getPhp()->getMemoryLimit() . "\n";
1007
-
1008
- print str_pad('Max. Execution Time', 50) . ':' . str_pad('', 5);
1009
- print $checker->getSystem()->getPhp()->getMaxExecutionTime() . "\n";
1010
- print str_pad('', 100, '=') . "\n";
1011
- print "\n";
1012
- //========================================
1013
-
1014
- //========================================
1015
- //MySQL Info
1016
- //========================================
1017
- print str_pad('', 100, '=') . "\n";
1018
- print 'MySQL Info' . "\n";
1019
- print str_pad('', 100, '=') . "\n";
1020
- print str_pad('Version', 50) . ':' . str_pad('', 5);
1021
- print $checker->getSystem()->getMysql()->getVersion() . "\n";
1022
-
1023
- print str_pad('Server API', 50) . ':' . str_pad('', 5);
1024
- print $checker->getSystem()->getMysql()->getServerApi() . "\n";
1025
-
1026
- print str_pad('Database Name', 50) . ':' . str_pad('', 5);
1027
- print $checker->getSystem()->getMysql()->getDatabaseName() . "\n";
1028
-
1029
- print str_pad('Database Tables', 50) . ':' . str_pad('', 5);
1030
- print $checker->getSystem()->getMysql()->getDatabaseTables() . "\n";
1031
-
1032
- print str_pad('Database Table Prefix', 50) . ':' . str_pad('', 5);
1033
- print $checker->getSystem()->getMysql()->getTablePrefix() . "\n";
1034
-
1035
- print str_pad('Connection Timeout', 50) . ':' . str_pad('', 5);
1036
- print $checker->getSystem()->getMysql()->getConnectionTimeout() . "\n";
1037
-
1038
- print str_pad('Wait Timeout', 50) . ':' . str_pad('', 5);
1039
- print $checker->getSystem()->getMysql()->getWaitTimeout() . "\n";
1040
-
1041
- print str_pad('Thread stack', 50) . ':' . str_pad('', 5);
1042
- $thread_stack = $checker->getSystem()->getMysql()->getThreadStack();
1043
- print $thread_stack['current_value'] . "\n";
1044
-
1045
- print str_pad('Max Allowed Packet', 50) . ':' . str_pad('', 5);
1046
- $max_allowed_packet = $checker->getSystem()->getMysql()->getMaxAllowedPacket();
1047
- print $max_allowed_packet['current_value'] . "\n";
1048
- print str_pad('', 100, '=') . "\n";
1049
- print "\n";
1050
- //========================================
1051
-
1052
- //========================================
1053
- //Server Info
1054
- //========================================
1055
- print str_pad('', 100, '=') . "\n";
1056
- print 'Server Info' . "\n";
1057
- print str_pad('', 100, '=') . "\n";
1058
- print str_pad('Info', 50) . ':' . str_pad('', 5);
1059
- print $checker->getSystem()->getServer()->getInfo() . "\n";
1060
-
1061
- print str_pad('Domain', 50) . ':' . str_pad('', 5);
1062
- print $checker->getSystem()->getServer()->getDomain() . "\n";
1063
-
1064
- print str_pad('Server IP', 50) . ':' . str_pad('', 5);
1065
- print $checker->getSystem()->getServer()->getIp() . "\n";
1066
-
1067
- print str_pad('Server Directory', 50) . ':' . str_pad('', 5);
1068
- print $checker->getSystem()->getServer()->getDir() . "\n";
1069
- print str_pad('', 100, '=') . "\n";
1070
- //========================================
1071
-
1072
-
1073
- //========================================
1074
- //phpinfo() full overview
1075
- //========================================
1076
- $formatter = Mage::helper('iceimport/format');
1077
- ob_start();
1078
- phpinfo();
1079
- $phpinfo = ob_get_contents();
1080
- ob_end_clean();
1081
-
1082
- try {
1083
- print str_pad('', 100, '=') . "\n";
1084
- print 'phpinfo() full overview' . "\n";
1085
- print str_pad('', 100, '=') . "\n";
1086
- print $formatter->convert_html_to_text($phpinfo) . "\n";
1087
- print str_pad('', 100, '=') . "\n";
1088
- print "\n";
1089
- } catch (Exception $e) {
1090
- }
1091
- //========================================
1092
-
1093
-
1094
- //========================================
1095
- //MySQL Configuration
1096
- //========================================
1097
- print str_pad('', 100, '=') . "\n";
1098
- print 'MySQL Vars' . "\n";
1099
- print str_pad('', 100, '=') . "\n";
1100
- $mysql_vars = $checker->getSystem()->getMysqlVars()->getData();
1101
- foreach ($mysql_vars as $mysql_var_key => $mysql_var_value) {
1102
- print str_pad($mysql_var_key, 50) . ':' . str_pad('', 5);
1103
- print $mysql_var_value . "\n";
1104
- }
1105
- print str_pad('', 100, '=') . "\n";
1106
- //========================================
1107
- }
1108
-
1109
-
1110
- /**
1111
- * Method for export to csv file
1112
- */
1113
- public function exportIceimportimagesCsvAction()
1114
- {
1115
- $fileName = 'notimport_images.csv';
1116
- $grid = $this->getLayout()->createBlock('iceimport/adminhtml_images_list_grid');
1117
- $grid->setDefaultLimit($grid->getCountImagesNotImport());
1118
- $this->_prepareDownloadResponse($fileName, $grid->getCsvFile());
1119
- }
1120
-
1121
- /**
1122
- * Method for export to excel file
1123
- */
1124
- public function exportIceimportimagesExcelAction() {
1125
- $fileName = 'notimport_images.xml';
1126
- $grid = $this->getLayout()->createBlock('iceimport/adminhtml_images_list_grid');
1127
- $grid->setDefaultLimit($grid->getCountImagesNotImport());
1128
- $this->_prepareDownloadResponse($fileName, $grid->getExcelFile($fileName));
1129
- }
1130
-
1131
- /**
1132
- * Images grid for AJAX request
1133
- */
1134
- public function gridAction() {
1135
- $exportall_button = $this->getLayout()->createBlock('iceimport/adminhtml_system_config_form_exportall');
1136
- $this->_gridTables->getGridTable().$exportall_button->getButtonHtml();
1137
- }
1138
-
1139
- /**
1140
- * Method for export to csv file
1141
- */
1142
- public function exportIceimportimagesCsvAllAction()
1143
- {
1144
- $fileName = 'notimport_images.csv';
1145
- $grid = $this->getLayout()->createBlock('iceimport/adminhtml_images_list_grid');
1146
- $grid->setDefaultLimit($grid->getCountImagesNotImport());
1147
- $this->_prepareDownloadResponse($fileName, $grid->getCsvFile());
1148
- }
1149
-
1150
- /**
1151
- * Add to log skip notifications
1152
- */
1153
- public function checkwarningAction() {
1154
- $DB_logger = Mage::helper('iceimport/db');
1155
- $skip_data = $DB_logger->getLogEntryByKey('iceimport_skip_problems_digest');
1156
-
1157
- $warning = $this->getRequest()->getParam('warning');
1158
- $section_problems = $this->getRequest()->getParam('section_problems');
1159
- if(empty($skip_data['log_value'])){
1160
- $skip_data = array();
1161
- $skip_data[$section_problems][] = $warning;
1162
- $skip_data = json_encode($skip_data);
1163
- $DB_logger->insertLogEntry('iceimport_skip_problems_digest', $skip_data);
1164
- } else {
1165
- $skip_data = (array)json_decode($skip_data['log_value']);
1166
- if(!empty($skip_data[$section_problems])){
1167
- if(!in_array($warning, $skip_data[$section_problems], true)){
1168
- $skip_data[$section_problems][] = $warning;
1169
- $skip_data = json_encode($skip_data);
1170
- $DB_logger->insertLogEntry('iceimport_skip_problems_digest', $skip_data);
1171
- }
1172
- } else {
1173
- $skip_data[$section_problems][] = $warning;
1174
- $skip_data = json_encode($skip_data);
1175
- $DB_logger->insertLogEntry('iceimport_skip_problems_digest', $skip_data);
1176
- }
1177
- }
1178
-
1179
- $this->_redirectUrl(Mage::helper("adminhtml")->getUrl("*/system_config/edit", array('section' => 'iceimport_information')));
1180
- }
1181
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1182
  }
1
+ <?php
2
+ require_once 'IceimagesController.php';
3
+ class ICEshop_Iceimport_Adminhtml_IceimportController extends Mage_Adminhtml_Controller_Action
4
+ {
5
+ public $_gridTables = NULL;
6
+
7
+ public function _construct() {
8
+ $this->_gridTables = new Iceshop_Icecatlive_Adminhtml_IceimagesController($this->getRequest(), $this->getResponse());
9
+ parent::_construct();
10
+ }
11
+
12
+
13
+ /**
14
+ * indexAction
15
+ *
16
+ * @return void
17
+ *
18
+ * TODO prevent hardcoded html structure
19
+ */
20
+ public function systemAction()
21
+ {
22
+ $checker = Mage::helper('iceimport/system_systemcheck')->init();
23
+ $helper = Mage::helper('iceimport');
24
+ ob_start();
25
+ ?>
26
+ <?php
27
+ //Problems Digest
28
+ $problems_digest = $checker->getExtensionProblemsDigest();
29
+ $problems = $problems_digest->getProblems();
30
+ if ($problems_digest->getCount() > 0) :
31
+ ?>
32
+ <div class="entry-edit" id="iceimport-digest">
33
+ <div class="entry-edit-head collapseable">
34
+ <a class="open section-toggler-iceimport"
35
+ href="#"><?php print $helper->__('Problems Digest'); ?></a>
36
+ </div>
37
+
38
+ <div class="fieldset">
39
+ <div class="hor-scroll">
40
+ <table class="form-list" cellspacing="0" cellpadding="0">
41
+ <?php print sprintf($helper->__('To guarantee the correct functioning of the Iceimport module you need to solve the following %s problems:'), '<strong class="requirement-failed">' . $problems_digest->getCount() . '</strong>'); ?>
42
+ <?php
43
+ $i = 1;
44
+ foreach ($problems as $problem_section_name => $problem_section) {
45
+ if($problem_section_name == 'custom_problems'){
46
+ foreach ($problem_section as $problem_name => $problem_value) {
47
+ print '<tr>';
48
+ print '<td class="label">';
49
+ print '<label class="problem-digest">' . $helper->__('Problem') . ':</label>';
50
+ print '</td>';
51
+ print '<td class="value">';
52
+ print '<span class="requirement-failed">' . $problem_value['content'] . '</span> ';
53
+ print '</td>';
54
+ print '</tr>';
55
+
56
+ print '<tr>';
57
+ print '<td class="label">';
58
+ print '<label class="problem-digest">' . $helper->__('Explanation') .':</label>';
59
+ print '</td>';
60
+ print '<td class="value">';
61
+ print '<span class="requirement-failed">' . $problem_value['explanation'] . '</span> ';
62
+ print '</td>';
63
+ print '</tr>';
64
+
65
+ $i++;
66
+ }
67
+ }
68
+ elseif($problem_section_name !='iceimport_delete_product'){
69
+
70
+ foreach ($problem_section as $problem_name => $problem_value) {
71
+
72
+ print '<tr>';
73
+ print '<td class="label">';
74
+ print '<label class="problem-digest">' . $helper->__('Problem') . " " . $i . ':</label>';
75
+ print '</td>';
76
+ print '<td class="value">';
77
+ if ($problem_section_name != 'iceimport_log') {
78
+ print '<span class="requirement-passed">"' . $problem_value['label'] . '"</span> ' . $helper->__('current value is') . ' <span class="requirement-failed">"' . $problem_value['current_value'] . '"</span> ' . $helper->__('and recommended value is') . ' <span class="requirement-passed">"' . (!empty($problem_value['recommended_value']) ? $problem_value['recommended_value'] : '') . '"</span>. ' . $helper->__(' Check this parameter in') . ' <a class="section-toggler-trigger-iceimport requirement-passed" data-href="#' . $problem_section_name . '-section" href="#' . $problem_section_name . '-section">' . ucfirst($problem_section_name) . '</a> ' . $helper->__('section') . '.';
79
+ } else {
80
+ print '<span class="requirement-passed">"' . $problem_value['label'] . '"</span> <span class="requirement-failed">"' . $problem_value['current_value'] . '"</span>. ' . $helper->__(' Check ') . ' <a class="section-toggler-trigger-iceimport requirement-passed" data-href="#' . $problem_section_name . '-section" href="#' . $problem_section_name . '-section">' . ucfirst($problem_section_name) . '</a> ' . $helper->__('section') . '.';
81
+ }
82
+ print '</td>';
83
+ if($problem_section_name != 'requirement' && $problem_section_name != 'rewrite'){
84
+ print '<td class="value">';
85
+ print '<span class="f-right">'
86
+ . '<a href="' . Mage::helper("adminhtml")->getUrl("adminhtml/iceimport/checkwarning/", array('warning'=>$problem_name,'section_problems' => $problem_section_name)) . '">'
87
+ . Mage::helper( 'iceimport' )->__( 'Acknowledge' ) . '</a></span>';
88
+ print '</td>';
89
+ } elseif ($problem_section_name == 'requirement') {
90
+ print '<td class="value">';
91
+ print '<span class="f-right">'
92
+ . '<a href="' . Mage::helper("adminhtml")->getUrl("adminhtml/iceimport/checkwarning/", array('warning'=>$problem_value['label'],'section_problems' => $problem_section_name)) . '">'
93
+ . Mage::helper( 'iceimport' )->__( 'Acknowledge' ) . '</a></span>';
94
+ print '</td>';
95
+ } elseif ($problem_section_name == 'rewrite') {
96
+ print '<td class="value">';
97
+ print '<span class="f-right">'
98
+ . '<a href="' . Mage::helper("adminhtml")->getUrl("adminhtml/iceimport/checkwarning/", array('warning'=>$problem_name,'section_problems' => $problem_section_name)) . '">'
99
+ . Mage::helper( 'iceimport' )->__( 'Acknowledge' ) . '</a></span>';
100
+ print '</td>';
101
+ } elseif ($problem_section_name == 'iceimport_log') {
102
+ print '<td class="value">';
103
+ print '<span class="f-right">'
104
+ . '<a href="' . Mage::helper("adminhtml")->getUrl("adminhtml/iceimport/checkwarning/", array('warning'=>$problem_name,'section_problems' => $problem_section_name)) . '">'
105
+ . Mage::helper( 'iceimport' )->__( 'Acknowledge' ) . '</a></span>';
106
+ print '</td>';
107
+ }
108
+ print '</tr>';
109
+ $i++;
110
+ }
111
+ } else {
112
+ foreach ($problem_section as $problem_name => $problem_value) {
113
+ print '<tr>';
114
+ print '<td class="label">';
115
+ print '<label class="problem-digest">' . $helper->__('Problem') . " " . $i . ':</label>';
116
+ print '</td>';
117
+ print '<td class="value">';
118
+ print '<span class="requirement-failed">' . $problem_value['label'] . ': </span> <span class="requirement">' . $problem_value['current_value'] . '</span> ';
119
+ print '</td>';
120
+
121
+ print '<td class="value">';
122
+ print '<span class="f-right">'
123
+ . '<a href="' . Mage::helper("adminhtml")->getUrl("adminhtml/iceimport/checkwarning/", array('warning'=>$problem_name, 'section_problems' => $problem_section_name)) . '">'
124
+ . Mage::helper( 'iceimport' )->__( 'Acknowledge' ) .'</a></span>';
125
+ print '</td>';
126
+
127
+ print '</tr>';
128
+ $i++;
129
+ }
130
+ }
131
+ }
132
+ ?>
133
+ <tr>
134
+ <td class="label col1">
135
+ <label><?php print $helper->__("Report"); ?></label>
136
+ </td>
137
+ <td class="value col2" colspan="2">
138
+ <a href="<?php print Mage::helper("adminhtml")->getUrl("adminhtml/iceimport/report/") ?>"
139
+ target="_blank">&raquo;<?php print $helper->__('Click to generate'); ?></a>
140
+ <p class="note"><?php print $helper->__("Use this report for more info on found problems or send it to Iceshop B.V. to help analyzing the problem to speed up solution of any issues."); ?></p>
141
+ </td>
142
+ <td></td>
143
+ </tr>
144
+ </table>
145
+ </div>
146
+ </div>
147
+ </div>
148
+ <?php
149
+ endif;
150
+ //Check module
151
+ $DB_checker = Mage::helper('iceimport/db');
152
+ $data_flows = $DB_checker->getRowCountByField($DB_checker->getTableName('dataflow_batch_import'), 'batch_id', false, ' ORDER BY 1 DESC LIMIT 50');
153
+ $currently_imported_products = $DB_checker->getRowsCount($DB_checker->_prefix . "iceshop_iceimport_imported_product_ids");
154
+ $table_name = $DB_checker->getTableName('dataflow_profile_history');
155
+
156
+ $try_delete_product = $DB_checker->getLogEntryByKey('error_try_delete_product');
157
+ $delete_product_percentage = $DB_checker->getLogEntryByKey('error_try_delete_product_percentage');
158
+
159
+ $last_started_by_cron = $DB_checker->getLogEntryByKey('iceimport_import_started');
160
+ $last_finished_by_cron = $DB_checker->getLogEntryByKey('iceimport_import_ended');
161
+ $import_status_cron = $DB_checker->getLogEntryByKey('iceimport_import_status_cron');
162
+ $last_deleted_products_count = $DB_checker->getLogEntryByKey('iceimport_count_delete_product');
163
+ $last_imported_products_count = $DB_checker->getLogEntryByKey('iceimport_count_imported_products');
164
+ $last_run = $DB_checker->readQuery("SELECT `performed_at` FROM {$table_name} WHERE `profile_id` = 3 ORDER BY `performed_at` DESC LIMIT 1");
165
+ $import_filename = $DB_checker->getLogEntryByKey('import_filename')
166
+ ?>
167
+ <span id="iceimport_statistics-section"></span>
168
+ <div class="entry-edit">
169
+ <div class="entry-edit-head collapseable">
170
+ <a href="#" class="section-toggler-iceimport">
171
+ Iceimport Statistics
172
+ </a>
173
+ </div>
174
+
175
+ <div class="fieldset iceimport-hidden">
176
+ <div class="hor-scroll">
177
+ <table class="form-list" cellspacing="0" cellpadding="0">
178
+ <tr>
179
+ <td colspan="2" class="label">
180
+ <label class="iceimport-label-uppercase iceimport-label-bold">
181
+ <?php print $helper->__('Import status by cron'); ?>
182
+ </label>
183
+ </td>
184
+ </tr>
185
+ <tr>
186
+ <td class="label"><label><?php print $helper->__("Started last time at"); ?>:</label></td>
187
+ <td class="value">
188
+ <?php if (!empty($last_started_by_cron['log_value'])) echo $last_started_by_cron['log_value']; else print $helper->__("Never started till now"); ?>
189
+ </td>
190
+ </tr>
191
+ <tr>
192
+ <td class="label"><label><?php print $helper->__("Finished last time at"); ?>:</label></td>
193
+ <td class="value">
194
+ <?php if (!empty($last_finished_by_cron['log_value'])) echo $last_finished_by_cron['log_value']; else print $helper->__("Never started till now"); ?>
195
+ </td>
196
+ </tr>
197
+ <tr>
198
+ <td class="label"><label><?php print $helper->__("Import cron process status"); ?>:</label>
199
+ </td>
200
+ <td class="value">
201
+ <?php if (!empty($import_status_cron['log_value'])) echo $import_status_cron['log_value']; else print $helper->__("Never started till now"); ?>
202
+ </td>
203
+ </tr>
204
+ <?php if (!empty($currently_imported_products) && ($import_status_cron['log_value'] == 'Running' || $import_status_cron['log_value'] == 'Failed')) { ?>
205
+ <tr>
206
+ <td class="label"><label><?php print $helper->__("Currently products imported"); ?>
207
+ :</label></td>
208
+ <td class="value">
209
+ <?php echo $currently_imported_products . ' from ' . $data_flows[0]['row_count']; ?>
210
+ </td>
211
+ </tr>
212
+ <?php } ?>
213
+ <tr>
214
+ <td colspan="2" class="label">
215
+ <label class="iceimport-label-uppercase iceimport-label-bold">
216
+ <?php print $helper->__('Last import Statistics'); ?>
217
+ </label>
218
+ </td>
219
+ </tr>
220
+ <tr>
221
+ <td class="label"><label><?php print $helper->__("Products imported last time "); ?>
222
+ :</label></td>
223
+ <td class="value">
224
+ <?php if (!empty($last_imported_products_count['log_value'])) echo $last_imported_products_count['log_value']; else echo "0"; ?>
225
+ </td>
226
+ </tr>
227
+
228
+ <tr>
229
+ <td class="label">
230
+ <label><?php print $helper->__("Removed out of date products last time "); ?>:</label>
231
+ </td>
232
+ <td class="value">
233
+ <?php if (!empty($last_deleted_products_count['log_value'])) echo $last_deleted_products_count['log_value']; else echo "0"; ?>
234
+ </td>
235
+ </tr>
236
+ <?php if(!empty($delete_product_percentage) && !empty($try_delete_product)) { ?>
237
+ <tr>
238
+ <td class="label">
239
+ <label><?php print $helper->__("Attempt to remove a large amount of products "); ?>:</label>
240
+ </td>
241
+ <td class="value">
242
+ <?php echo $try_delete_product['log_value'].$delete_product_percentage['log_value']; ?>
243
+ </td>
244
+ </tr>
245
+ <?php } ?>
246
+ <tr>
247
+ <td class="label"><label><?php print $helper->__("Import file name"); ?>
248
+ :</label></td>
249
+ <td class="value">
250
+ <?php echo (!empty($import_filename['log_value']))?$import_filename['log_value']:$helper->__("Never started till now"); ?>
251
+ </td>
252
+ </tr>
253
+ <tr>
254
+ <td class="label"><label><?php print $helper->__("Time of import one product"); ?>
255
+ :</label></td>
256
+ <td class="value">
257
+ <?php echo $checker->getModulePerformance($last_imported_products_count, $last_started_by_cron, $last_finished_by_cron); ?>
258
+ </td>
259
+ </tr>
260
+
261
+ </table>
262
+ </div>
263
+ </div>
264
+ </div>
265
+
266
+ <?php
267
+ //Check module
268
+ $check_module = $checker->getModulesCollection('ICEshop_Iceimport');
269
+ $check_module = $check_module->getLastItem()->getData();
270
+ ?>
271
+ <span id="extension-section"></span>
272
+ <div class="entry-edit">
273
+ <div class="entry-edit-head collapseable">
274
+ <a href="#"
275
+ class="section-toggler-iceimport"><?php print $helper->__('Extension Diagnostic Info'); ?></a>
276
+ </div>
277
+ <div class="fieldset iceimport-hidden">
278
+ <div class="hor-scroll">
279
+ <table class="form-list" cellspacing="0" cellpadding="0">
280
+ <tr>
281
+ <td class="label"><label><?php print $helper->__('Name'); ?>:</label></td>
282
+ <td class="value"><?php echo $check_module['name']; ?></td>
283
+ </tr>
284
+ <tr>
285
+ <td class="label"><label><?php print $helper->__('Version'); ?>:</label></td>
286
+ <td class="value"><?php echo $check_module['version']; ?></td>
287
+ </tr>
288
+ <tr>
289
+ <td class="label"><label><?php print $helper->__('Code Pool'); ?>:</label></td>
290
+ <td class="value"><?php echo $check_module['code_pool']; ?></td>
291
+ </tr>
292
+ <tr>
293
+ <td class="label"><label><?php print $helper->__('Path'); ?>:</label></td>
294
+ <td class="value"><?php echo $check_module['path']; ?></td>
295
+ </tr>
296
+ <tr>
297
+ <td class="label"><label><?php print $helper->__('Path Exists'); ?>:</label></td>
298
+ <td class="value <?php echo $checker->renderRequirementValue($check_module['path_exists']); ?>">
299
+ <?php echo $checker->renderBooleanField($check_module['path_exists']); ?>
300
+ </td>
301
+ </tr>
302
+ <tr>
303
+ <td class="label"><label><?php print $helper->__('Config Exists'); ?>:</label></td>
304
+ <td class="value <?php echo $checker->renderRequirementValue($check_module['config_exists']); ?>">
305
+ <?php echo $checker->renderBooleanField($check_module['config_exists']); ?>
306
+ </td>
307
+ </tr>
308
+ <tr>
309
+ <td class="label"><label><?php print $helper->__('Dependencies'); ?>:</label></td>
310
+ <td class="value"><?php echo $check_module['dependencies']; ?></td>
311
+ </tr>
312
+ </table>
313
+ </div>
314
+ </div>
315
+ </div>
316
+
317
+ <?php
318
+ //Check rewrites
319
+ $check_rewrites = $checker->getRewriteCollection('ICEshop_Iceimport');
320
+ ?>
321
+ <span id="rewrite-section"></span>
322
+ <div class="entry-edit">
323
+ <div class="entry-edit-head collapseable">
324
+ <a href="#"
325
+ class="section-toggler-iceimport"><?php print $helper->__('Extension Rewrites Status'); ?></a>
326
+ </div>
327
+
328
+ <div class="fieldset iceimport-hidden">
329
+ <div class="hor-scroll">
330
+ <table class="form-list" cellspacing="0" cellpadding="0">
331
+ <tbody>
332
+ <?php
333
+ foreach ($check_rewrites as $rewrite) {
334
+ ?>
335
+ <tr>
336
+ <td>
337
+ <span
338
+ class="iceimport-label-bold iceimport-label-rewrite"><?php print $helper->__('Path'); ?>
339
+ :</span>
340
+ <span><?php echo $rewrite['path']; ?></span>
341
+ <br/>
342
+ <span
343
+ class="iceimport-label-bold iceimport-label-rewrite"><?php print $helper->__('Rewrite Class'); ?>
344
+ :</span>
345
+ <span><?php echo $rewrite['rewrite_class']; ?></span>
346
+ <br/>
347
+ <span
348
+ class="iceimport-label-bold iceimport-label-rewrite"><?php print $helper->__('Active Class'); ?>
349
+ :</span>
350
+ <span><?php echo $rewrite['active_class']; ?></span>
351
+ <br/>
352
+ <span
353
+ class="iceimport-label-bold iceimport-label-rewrite"><?php print $helper->__('Status'); ?>
354
+ :</span>
355
+ <span
356
+ class="<?php echo $checker->renderRequirementValue($rewrite['status']); ?>">
357
+ <?php echo $checker->renderStatusField($rewrite['status']); ?>
358
+ </span>
359
+ <br/>
360
+ <br/>
361
+ </td>
362
+ </tr>
363
+ <?php
364
+ }
365
+ ?>
366
+ </tbody>
367
+ </table>
368
+ </div>
369
+ </div>
370
+ </div>
371
+
372
+ <span id="requirement-section"></span>
373
+ <div class="entry-edit">
374
+ <div class="entry-edit-head collapseable">
375
+ <a class="section-toggler-iceimport" href="#"><?php print $helper->__('System Requirements'); ?></a>
376
+ </div>
377
+
378
+ <?php $requirements = $checker->getSystem()->getRequirements()->getData(); ?>
379
+ <div class="fieldset iceimport-hidden">
380
+ <div class="hor-scroll">
381
+ <table class="form-list firegento-settings-table" cellspacing="0" cellpadding="0">
382
+ <thead>
383
+ <tr>
384
+ <th class="label col1"><?php print $helper->__('Requirement'); ?></th>
385
+ <th class="value col2"><?php print $helper->__('Current Value'); ?></th>
386
+ <th class="value col3"><?php print $helper->__('Recommended Value'); ?></th>
387
+ </tr>
388
+ </thead>
389
+ <tbody>
390
+ <?php foreach ($requirements as $requirement): ?>
391
+ <tr>
392
+ <td class="label col1">
393
+ <label><span
394
+ class="iceimport-pad-label"><?php echo $requirement['label']; ?></span><?php print $checker->renderAdvice($requirement); ?>
395
+ :</label>
396
+ </td>
397
+ <td class="value col2 <?php echo $checker->renderRequirementValue($requirement['result']) ?>">
398
+ <?php echo $requirement['current_value'] ?>
399
+ </td>
400
+ <td class="value col3"><?php echo $requirement['recommended_value'] ?></td>
401
+ </tr>
402
+ <?php endforeach; ?>
403
+ <tr>
404
+ <td class="label col1"><label>phpinfo()</label>
405
+ </td>
406
+ <td class="value col2" colspan="2">
407
+ <a href="<?php print Mage::helper("adminhtml")->getUrl("adminhtml/iceimport/phpinfo/") ?>"
408
+ target="_blank">&raquo;<?php print $helper->__('More info'); ?></a>
409
+ </td>
410
+ </tr>
411
+ <?php ?>
412
+ </tbody>
413
+ </table>
414
+ </div>
415
+ </div>
416
+ </div>
417
+
418
+ <span id="magento-section"></span>
419
+ <div class="entry-edit">
420
+ <div class="entry-edit-head collapseable">
421
+ <a href="#" class="section-toggler-iceimport">Magento Info</a>
422
+ </div>
423
+
424
+ <div class="fieldset iceimport-hidden">
425
+ <div class="hor-scroll">
426
+ <table class="form-list" cellspacing="0" cellpadding="0">
427
+ <tr>
428
+ <td class="label"><label>Edition:</label></td>
429
+ <td class="value"><?php echo $checker->getSystem()->getMagento()->getEdition() ?></td>
430
+ </tr>
431
+ <tr>
432
+ <td class="label"><label>Version:</label></td>
433
+ <td class="value"><?php echo $checker->getSystem()->getMagento()->getVersion() ?></td>
434
+ </tr>
435
+ <tr>
436
+ <td class="label"><label>Developer Mode:</label></td>
437
+ <td class="value"><?php echo $checker->renderBooleanField($checker->getSystem()->getMagento()->getDeveloperMode()) ?></td>
438
+ </tr>
439
+ <tr>
440
+ <td class="label"><label>Add Secret Key to URLs:</label></td>
441
+ <td class="value"><?php echo $checker->renderBooleanField($checker->getSystem()->getMagento()->getSecretKey()) ?></td>
442
+ </tr>
443
+ <tr>
444
+ <td class="label"><label>Use Flat Catalog Category:</label></td>
445
+ <td class="value"><?php echo $checker->renderBooleanField($checker->getSystem()->getMagento()->getFlatCatalogCategory()) ?></td>
446
+ </tr>
447
+ <tr>
448
+ <td class="label"><label>Use Flat Catalog Product:</label></td>
449
+ <td class="value"><?php echo $checker->renderBooleanField($checker->getSystem()->getMagento()->getFlatCatalogProduct()) ?></td>
450
+ </tr>
451
+ <tr>
452
+ <td class="label"><label>Cache status:</label></td>
453
+ <td class="value">
454
+ <?php echo $checker->getSystem()->getMagento()->getCacheStatus() ?><br/>
455
+ <a href="<?php echo Mage::helper("adminhtml")->getUrl('adminhtml/cache/') ?>">&raquo;Cache
456
+ Management</a>
457
+ </td>
458
+ </tr>
459
+ <tr>
460
+ <td class="label"><label>Index status:</label></td>
461
+ <td class="value">
462
+ <?php echo $checker->getSystem()->getMagento()->getIndexStatus() ?><br/>
463
+ <a href="<?php echo Mage::helper("adminhtml")->getUrl('adminhtml/process/list') ?>">&raquo;Index
464
+ Management</a>
465
+ </td>
466
+ </tr>
467
+ </table>
468
+ </div>
469
+ </div>
470
+ </div>
471
+
472
+ <span id="api-section"></span>
473
+ <div class="entry-edit">
474
+ <div class="entry-edit-head collapseable">
475
+ <a href="#" class="section-toggler-iceimport">Magento Core API Info</a>
476
+ </div>
477
+
478
+ <div class="fieldset iceimport-hidden">
479
+ <div class="hor-scroll">
480
+ <table class="form-list" cellspacing="0" cellpadding="0">
481
+ <tr>
482
+ <td class="label"><label><?php print $helper->__('Default Response Charset'); ?>:</label>
483
+ </td>
484
+ <td class="value"><?php echo $checker->getSystem()->getMagentoApi()->getCharset() ?></td>
485
+ </tr>
486
+ <tr>
487
+ <?php $magento_api_session_timeout = $checker->getSystem()->getMagentoApi()->getSessionTimeout() ?>
488
+ <td class="label"><label><?php print $magento_api_session_timeout['label']; ?>:</label></td>
489
+ <td class="value <?php echo $checker->renderRequirementValue($magento_api_session_timeout['result']) ?>"><?php echo $magento_api_session_timeout['current_value'] ?></td>
490
+ </tr>
491
+ <tr>
492
+ <td class="label"><label><?php print $helper->__('WS-I Compliance'); ?>:</label></td>
493
+ <td class="value"><?php echo $checker->renderBooleanField($checker->getSystem()->getMagentoApi()->getComplianceWsi()) ?></td>
494
+ </tr>
495
+ <tr>
496
+ <td class="label"><label><?php print $helper->__('WSDL Cache'); ?>:</label></td>
497
+ <td class="value"><?php echo $checker->renderBooleanField($checker->getSystem()->getMagentoApi()->getWsdlCacheEnabled()) ?></td>
498
+ </tr>
499
+ </table>
500
+ </div>
501
+ </div>
502
+ </div>
503
+
504
+ <span id="php-section"></span>
505
+ <div class="entry-edit">
506
+ <div class="entry-edit-head collapseable">
507
+ <a href="#" class="section-toggler-iceimport">PHP Info</a>
508
+ </div>
509
+
510
+ <div class="fieldset iceimport-hidden">
511
+ <div class="hor-scroll">
512
+ <table class="form-list" cellspacing="0" cellpadding="0">
513
+ <tr>
514
+ <td class="label"><label><?php print $helper->__('Version'); ?>:</label></td>
515
+ <td class="value"><?php echo $checker->getSystem()->getPhp()->getVersion() ?></td>
516
+ </tr>
517
+ <tr>
518
+ <td class="label"><label><?php print $helper->__('Server API'); ?>:</label></td>
519
+ <td class="value"><?php echo $checker->getSystem()->getPhp()->getServerApi() ?></td>
520
+ </tr>
521
+ <tr>
522
+ <td class="label"><label><?php print $helper->__('Memory Limit'); ?>:</label></td>
523
+ <td class="value"><?php echo $checker->getSystem()->getPhp()->getMemoryLimit() ?></td>
524
+ </tr>
525
+ <tr>
526
+ <td class="label"><label><?php print $helper->__('Max. Execution Time'); ?>:</label></td>
527
+ <td class="value"><?php echo $checker->getSystem()->getPhp()->getMaxExecutionTime() ?></td>
528
+ </tr>
529
+ </table>
530
+ </div>
531
+ </div>
532
+ </div>
533
+
534
+ <span id="mysql-section"></span>
535
+ <div class="entry-edit">
536
+ <div class="entry-edit-head collapseable">
537
+ <a href="#" class="section-toggler-iceimport">MySQL Info</a>
538
+ </div>
539
+
540
+ <div class="fieldset iceimport-hidden">
541
+ <div class="hor-scroll">
542
+ <table class="form-list" cellspacing="0" cellpadding="0">
543
+ <thead>
544
+ <tr>
545
+ <th class="label col1"><?php print $helper->__('Requirement'); ?></th>
546
+ <th class="value col2"><?php print $helper->__('Current Value'); ?></th>
547
+ <th class="value col3"><?php print $helper->__('Recommended Value'); ?></th>
548
+ </tr>
549
+ </thead>
550
+ <tbody>
551
+ <tr>
552
+ <td class="label"><label><?php print $helper->__('Version'); ?>:</label></td>
553
+ <td class="value"><?php echo $checker->getSystem()->getMysql()->getVersion() ?></td>
554
+ </tr>
555
+ <tr>
556
+ <td class="label"><label><?php print $helper->__('Server API'); ?>:</label></td>
557
+ <td class="value"><?php echo $checker->getSystem()->getMysql()->getServerApi() ?></td>
558
+ </tr>
559
+ <tr>
560
+ <td class="label"><label><?php print $helper->__('Database Name'); ?>:</label></td>
561
+ <td class="value"><?php echo $checker->getSystem()->getMysql()->getDatabaseName() ?></td>
562
+ </tr>
563
+ <tr>
564
+ <td class="label"><label><?php print $helper->__('Database Tables'); ?>:</label></td>
565
+ <td class="value"><?php echo $checker->getSystem()->getMysql()->getDatabaseTables() ?></td>
566
+ </tr>
567
+ <tr>
568
+ <td class="label"><label><?php print $helper->__('Database Table Prefix'); ?>:</label></td>
569
+ <td class="value"><?php echo $checker->getSystem()->getMysql()->getTablePrefix() ?></td>
570
+ </tr>
571
+ <tr>
572
+ <td class="label"><label><?php print $helper->__('Connection Timeout'); ?>:</label></td>
573
+ <td class="value"><?php echo $checker->getSystem()->getMysql()->getConnectionTimeout() ?></td>
574
+ </tr>
575
+ <tr>
576
+ <td class="label"><label><?php print $helper->__('Wait Timeout'); ?>:</label></td>
577
+ <td class="value"><?php echo $checker->getSystem()->getMysql()->getWaitTimeout() ?></td>
578
+ </tr>
579
+ <tr>
580
+ <?php $thread_stack = $checker->getSystem()->getMysql()->getThreadStack(); ?>
581
+ <td class="label col1">
582
+ <label><?php print $thread_stack['label']; ?><?php print $checker->renderAdvice($thread_stack); ?>
583
+ :</label></td>
584
+ <td class="value col2 <?php echo $checker->renderRequirementValue($thread_stack['result']) ?>"><?php echo $thread_stack['current_value'] ?></td>
585
+ <td class="value col3"><?php echo $thread_stack['recommended_value'] ?></td>
586
+ </tr>
587
+ <tr>
588
+ <?php $max_allowed_packet = $checker->getSystem()->getMysql()->getMaxAllowedPacket(); ?>
589
+ <td class="label col1">
590
+ <label><?php print $max_allowed_packet['label']; ?><?php print $checker->renderAdvice($max_allowed_packet); ?>
591
+ :</label>
592
+ </td>
593
+ <td class="value col2 <?php echo $checker->renderRequirementValue($max_allowed_packet['result']) ?>">
594
+ <?php echo $max_allowed_packet['current_value'] ?>
595
+ </td>
596
+ <td class="value col3"><?php echo $max_allowed_packet['recommended_value'] ?></td>
597
+ </tr>
598
+ </tbody>
599
+ </table>
600
+ </div>
601
+ </div>
602
+ </div>
603
+
604
+ <span id="mysql_conf-section"></span>
605
+ <div class="entry-edit">
606
+ <div class="entry-edit-head collapseable">
607
+ <a href="#" class="section-toggler-iceimport"><?php print $helper->__('MySQL Configuration'); ?></a>
608
+ </div>
609
+
610
+ <div class="fieldset iceimport-hidden">
611
+ <div class="hor-scroll">
612
+ <table class="form-list" cellspacing="0" cellpadding="0">
613
+ <?php
614
+ $mysql_vars = $checker->getSystem()->getMysqlVars()->getData();
615
+ foreach ($mysql_vars as $mysql_var_key => $mysql_var_value) {
616
+ print '<tr>';
617
+ print '<td><strong>' . $mysql_var_key . ':</strong></td>';
618
+ print '<td class="value">' . $mysql_var_value . '</td>';
619
+ print '</tr>';
620
+ }
621
+ ?>
622
+ </table>
623
+ </div>
624
+ </div>
625
+ </div>
626
+
627
+ <span id="server-section"></span>
628
+ <div class="entry-edit">
629
+ <div class="entry-edit-head collapseable">
630
+ <a href="#" class="section-toggler-iceimport"><?php print $helper->__('Server Info'); ?></a>
631
+ </div>
632
+
633
+ <div class="fieldset iceimport-hidden">
634
+ <div class="hor-scroll">
635
+ <table class="form-list" cellspacing="0" cellpadding="0">
636
+ <tr>
637
+ <td class="label"><label><?php print $helper->__('Info'); ?>:</label></td>
638
+ <td class="value"><?php echo $checker->getSystem()->getServer()->getInfo() ?></td>
639
+ </tr>
640
+ <tr>
641
+ <td class="label"><label><?php print $helper->__('Domain'); ?>:</label></td>
642
+ <td class="value"><?php echo $checker->getSystem()->getServer()->getDomain() ?></td>
643
+ </tr>
644
+ <tr>
645
+ <td class="label"><label><?php print $helper->__('Server IP'); ?>:</label></td>
646
+ <td class="value"><?php echo $checker->getSystem()->getServer()->getIp() ?></td>
647
+ </tr>
648
+ <tr>
649
+ <td class="label"><label><?php print $helper->__('Server Directory'); ?>:</label></td>
650
+ <td class="value"><?php echo $checker->getSystem()->getServer()->getDir() ?></td>
651
+ </tr>
652
+ </table>
653
+ </div>
654
+ </div>
655
+ </div>
656
+
657
+ <?php
658
+ $iceimport_log = $DB_checker->getLogByType('info', 'neq', 500);
659
+ ?>
660
+ <span id="iceimport_log-section"></span>
661
+ <div class="entry-edit">
662
+ <div class="entry-edit-head collapseable">
663
+ <a href="#" class="section-toggler-iceimport">Iceimport Log</a>
664
+ </div>
665
+
666
+ <div class="fieldset iceimport-hidden">
667
+ <div class="hor-scroll">
668
+ <table class="form-list" cellspacing="0" cellpadding="0">
669
+ <?php
670
+ if (!empty($iceimport_log) && count($iceimport_log) > 0) {
671
+ print '<thead>';
672
+ print '<tr>';
673
+ print "<th class=\"label col1\">{$helper->__('Time')}</th>";
674
+ print "<th class=\"value col2\">{$helper->__('Value')}</th>";
675
+ print '</tr>';
676
+ print '</thead>';
677
+ print '<tbody>';
678
+ foreach ($iceimport_log as $iceimport_log_item) {
679
+ print '<tr>';
680
+ print "<td class=\"label\"><label>{$iceimport_log_item['timecol']}</label></td>";
681
+ print "<td class=\"value full-width\"><label>{$iceimport_log_item['log_value']}</label></td>";
682
+ print '</tr>';
683
+ }
684
+ print '</tbody>';
685
+ } else {
686
+ print '<tbody>';
687
+ print '<tr>';
688
+ print "<td class=\"label\"><label>{$helper->__('Still empty')}</label></td>";
689
+ print '</tr>';
690
+ print '</tbody>';
691
+ }
692
+ ?>
693
+ </table>
694
+ </div>
695
+ </div>
696
+ </div>
697
+ <?php //Image Statistics ?>
698
+ <span id="iceimport_image-statistics-section"></span>
699
+ <div class="entry-edit">
700
+ <div class="entry-edit-head collapseable">
701
+ <a href="#" class="section-toggler-iceimport">Images Statistics</a>
702
+ </div>
703
+
704
+ <div class="fieldset iceimport-hidden">
705
+ <div class="hor-scroll">
706
+ <table class="form-list" cellspacing="0" cellpadding="0">
707
+ <?php
708
+ $image_statistics = $checker->getImagesStatistics();
709
+ print '<tbody>';
710
+ if(!empty($image_statistics)){
711
+ foreach ($image_statistics as $statistic){
712
+ if($statistic['type'] == 'total_error_download' && $statistic['value'] > 0){
713
+ $update_button = $this->getLayout()->createBlock('iceimport/adminhtml_system_config_form_updatebutton');
714
+ print '<tr>';
715
+ print "<td class=\"label\"><label>{$statistic['label']}</label></td>";
716
+ print "<td class=\"label\"><label>{$statistic['value']}</label></td>";
717
+ print "<td class=\"label\">{$update_button->getButtonHtml()}</td>";
718
+ print '</tr>';
719
+ } else if($statistic['type'] == 'total_waiting_download' && $statistic['value'] > 0){
720
+ $button = $this->getLayout()->createBlock('iceimport/adminhtml_system_config_form_button');
721
+ print '<tr>';
722
+ print "<td class=\"label\"><label>{$statistic['label']}</label></td>";
723
+ print "<td class=\"label\"><label>{$statistic['value']}</label></td>";
724
+ print "<td class=\"label\">{$button->getButtonHtml()}</td>";
725
+ print '</tr>';
726
+ } else {
727
+ if(!empty($statistic['label']) || !empty($statistic['value'])){
728
+ print '<tr>';
729
+ print "<td class=\"label\"><label>{$statistic['label']}</label></td>";
730
+ print "<td class=\"label\"><label>{$statistic['value']}</label></td>";
731
+ print "<td></td>";
732
+ print '</tr>';
733
+ }
734
+ }
735
+ }
736
+ }
737
+ print '</tbody>';
738
+ ?>
739
+ </table>
740
+ <div id="gridActionClener" class="hor-scroll">
741
+ <?php
742
+ if(!empty($image_statistics)){
743
+ if(!empty( $image_statistics['total_error_download']['value'])&&$image_statistics['total_error_download']['value']>0){
744
+ $exportall_button = $this->getLayout()->createBlock('iceimport/adminhtml_system_config_form_exportall');
745
+ echo $this->_gridTables->getGridTable().$exportall_button->getButtonHtml();
746
+
747
+ }
748
+ }
749
+ ?>
750
+ </div>
751
+ </div>
752
+ </div>
753
+ </div>
754
+ <style>
755
+ .requirement-passed {
756
+ color: green;
757
+ }
758
+
759
+ .requirement-failed {
760
+ color: red;
761
+ }
762
+ </style>
763
+ <script type="text/javascript">
764
+
765
+
766
+ function import_prod_images(import_run, update){
767
+ $('loading_mask_loader').setStyle({
768
+ width: '430px',
769
+ marginLeft: '-235px',
770
+ top: '25%'
771
+ });
772
+ $('loading-mask').setStyle({
773
+ display: 'inline',
774
+ opacity: '0.90'
775
+ });
776
+ $$('#loading_mask_loader > img')[0].setStyle({
777
+ 'display': 'inline'
778
+ });
779
+ var str = $('loading_mask_loader').innerHTML;
780
+ str = str.replace('<br>Please wait...', '');
781
+ $('loading_mask_loader').innerHTML = str;
782
+
783
+ new Ajax.Request('<?php echo Mage::helper("adminhtml")->getUrl("adminhtml/iceimportimages/check/"); ?>', {
784
+ method: 'get',
785
+ parameters: {import_run: import_run, update_images:update},
786
+ onSuccess: function(data){
787
+ var import_info = JSON.parse(data.responseText);
788
+ var images_error_text = '';
789
+ var images_error = import_info.images_error;
790
+ if(images_error){
791
+ images_error_text = '<p> Import images error: ' + import_info.images_error_text + '</p>';
792
+ }
793
+ var iceimport_count_images = '<p> Found images not imported: '+import_info.count_images+'</p>';
794
+ var iceimport_current_images_import = '<p> Current images import: '+import_info.current_images_import+'</p>';
795
+ if(import_info.done != 1){
796
+ if($('loading_mask_loader').select('#iceimport-images-response').size() == 0){
797
+ $('loading_mask_loader').insert({bottom: '<div id="iceimport-images-response" style="text-align: left">'
798
+ +iceimport_count_images
799
+ +iceimport_current_images_import
800
+ +images_error_text
801
+ +'</div>'});
802
+ }else{
803
+ $('iceimport-images-response').replace('<div id="iceimport-images-response" style="text-align: left">'
804
+ +iceimport_count_images
805
+ +iceimport_current_images_import
806
+ +images_error_text
807
+ +'</div>');
808
+ }
809
+ import_prod_images(0,update);
810
+ }else{
811
+ if($('loading_mask_loader').select('#iceimport-images-response').size() == 0){
812
+ $('loading_mask_loader').insert({bottom: '<div id="iceimport-images-response" style="text-align: left">'
813
+ +iceimport_count_images
814
+ +iceimport_current_images_import
815
+ +images_error_text
816
+ +'</div>'
817
+ +'<button id="iceimport_images_button_finish" onclick="javascript:hide_progress_popup(); return false;" title="Finish import" type="button" class="scalable " style=""><span><span><span>Finish import</span></span></span></button>'});
818
+ }else{
819
+ $('iceimport-images-response').replace('<div id="iceimport-images-response" style="text-align: left">'
820
+ +iceimport_count_images
821
+ +iceimport_current_images_import
822
+ +images_error_text
823
+ +'</div>'
824
+ +'<button id="iceimport_images_button_finish" onclick="javascript:hide_progress_popup(); return false;" title="Finish import" type="button" class="scalable " style=""><span><span><span>Finish import</span></span></span></button>');
825
+ }
826
+ $$('#loading_mask_loader > img')[0].setStyle({
827
+ 'display': 'none'
828
+ });
829
+ var str = $('loading_mask_loader').innerHTML;
830
+ str = str.replace('<br>Please wait...', '');
831
+ $('loading_mask_loader').innerHTML = str;
832
+ }
833
+ },
834
+ onComplete: function(){
835
+ $('loading_mask').setStyle({
836
+ display: 'none'
837
+ });
838
+ },
839
+ onFailure: function() {
840
+ import_prod_images(1,update);
841
+ }
842
+ });
843
+ }
844
+
845
+ function hide_progress_popup(){
846
+ document.getElementById("iceimport_images_button_finish").remove();
847
+ document.getElementById('iceimport-images-response').innerHTML = '';
848
+ $('loading-mask').setStyle({
849
+ display: 'none'
850
+ });
851
+ }
852
+
853
+ </script>
854
+ <?php
855
+ $system_check_content = ob_get_contents();
856
+ ob_end_clean();
857
+
858
+ $reset_button_html = $helper->getButtonHtml(array(
859
+ 'id' => 'iceimport_check_system_refresh',
860
+ 'element_name' => 'iceimport_check_system_refresh',
861
+ 'title' => Mage::helper('catalog')->__('Refresh'),
862
+ 'type' => 'reset',
863
+ 'class' => 'save',
864
+ 'label' => Mage::helper('catalog')->__('Refresh'),
865
+ 'OnClick' => 'refreshIceimportSystemCheck(\'' . base64_encode(Mage::helper("adminhtml")->getUrl("adminhtml/iceimport/system/")) . '\');'
866
+ ));
867
+
868
+ $jsonData = json_encode(array('structure' => $system_check_content, 'refresh_btn' => $reset_button_html));
869
+ $this->getResponse()->setHeader('Content-type', 'application/json');
870
+ $this->getResponse()->setBody($jsonData);
871
+ }
872
+
873
+ public function phpinfoAction()
874
+ {
875
+ phpinfo(-1);
876
+ }
877
+
878
+ public function reportAction()
879
+ {
880
+ header("Content-Type: text/plain; charset=utf-8");
881
+ $report_filename = 'iceimport-report' . (string)Mage::getConfig()->getNode()->modules->ICEshop_Iceimport->version . '.txt';
882
+ header("Content-disposition: attachment; filename={$report_filename}");
883
+ header("Content-Transfer-Encoding: binary");
884
+ header("Pragma: no-cache");
885
+ header("Expires: 0");
886
+
887
+ //TODO add report content
888
+ $checker = Mage::helper('iceimport/system_systemcheck')->init();
889
+ $helper = Mage::helper('iceimport');
890
+
891
+ //========================================
892
+ //Problems Digest
893
+ //========================================
894
+ $problems_digest = $checker->getExtensionProblemsDigest();
895
+ if ($problems_digest->getCount() != 0) {
896
+ $problems = $problems_digest->getProblems();
897
+ print str_pad('', 100, '=') . "\n";
898
+ print 'Problems Digest' . "\n";
899
+ print str_pad('', 100, '=') . "\n";
900
+ foreach ($problems as $problem_name => $problem_value) {
901
+ print $problem_name . "\n";
902
+ print_r($problem_value);
903
+ }
904
+ print str_pad('', 100, '=') . "\n";
905
+ print "\n";
906
+ }
907
+ //========================================
908
+
909
+ //========================================
910
+ //Check module
911
+ //========================================
912
+ $check_module = $checker->getModulesCollection('ICEshop_Iceimport');
913
+ $check_module = $check_module->getLastItem()->getData();
914
+ print str_pad('', 100, '=') . "\n";
915
+ print 'Extension Diagnostic Info' . "\n";
916
+ print str_pad('', 100, '=') . "\n";
917
+ print str_pad('Name', 50) . ':' . str_pad('', 5);
918
+ print $check_module['name'] . "\n";
919
+
920
+ print str_pad('Version', 50) . ':' . str_pad('', 5);
921
+ print $check_module['version'] . "\n";
922
+
923
+ print str_pad('Code Pool', 50) . ':' . str_pad('', 5);
924
+ print $check_module['code_pool'] . "\n";
925
+
926
+ print str_pad('Path', 50) . ':' . str_pad('', 5);
927
+ print $check_module['path'] . "\n";
928
+
929
+ print str_pad('Path Exists', 50) . ':' . str_pad('', 5);
930
+ print $checker->renderBooleanField($check_module['path_exists']) . "\n";
931
+
932
+ print str_pad('Config Exists', 50) . ':' . str_pad('', 5);
933
+ print $checker->renderBooleanField($check_module['config_exists']) . "\n";
934
+
935
+ print str_pad('Dependencies', 50) . ':' . str_pad('', 5);
936
+ print $check_module['dependencies'] . "\n";
937
+ print str_pad('', 100, '=') . "\n";
938
+ print "\n";
939
+ //========================================
940
+
941
+
942
+ //========================================
943
+ //Check rewrites
944
+ //========================================
945
+ $check_rewrites = $checker->getRewriteCollection('ICEshop_Iceimport');
946
+ print str_pad('', 100, '=') . "\n";
947
+ print 'Extension Rewrites Status' . "\n";
948
+ print str_pad('', 100, '=') . "\n";
949
+ foreach ($check_rewrites as $rewrite) {
950
+ print str_pad('Path', 50) . ':' . str_pad('', 5);
951
+ print $rewrite['path'] . "\n";
952
+
953
+ print str_pad('Rewrite Class', 50) . ':' . str_pad('', 5);
954
+ print $rewrite['rewrite_class'] . "\n";
955
+
956
+ print str_pad('Active Class', 50) . ':' . str_pad('', 5);
957
+ print $rewrite['active_class'] . "\n";
958
+
959
+ print str_pad('Status', 50) . ':' . str_pad('', 5);
960
+ print $checker->renderStatusField($rewrite['status']) . "\n";
961
+ }
962
+ print str_pad('', 100, '=') . "\n";
963
+ print "\n";
964
+ //========================================
965
+
966
+ //========================================
967
+ //System Requirements
968
+ //========================================
969
+ $requirements = $checker->getSystem()->getRequirements()->getData();
970
+ print str_pad('', 100, '=') . "\n";
971
+ print 'System Requirements' . "\n";
972
+ print str_pad('', 100, '=') . "\n";
973
+ foreach ($requirements as $requirement) {
974
+ print str_pad($requirement['label'], 50) . ':' . str_pad('', 5);
975
+ print str_pad($requirement['recommended_value'], 30);
976
+ print $requirement['current_value'] . "\n";
977
+ }
978
+ print str_pad('', 100, '=') . "\n";
979
+ print "\n";
980
+ //========================================
981
+
982
+ //========================================
983
+ //Magento Info
984
+ //========================================
985
+ print str_pad('', 100, '=') . "\n";
986
+ print 'Magento Info' . "\n";
987
+ print str_pad('', 100, '=') . "\n";
988
+ print str_pad('Edition', 50) . ':' . str_pad('', 5);
989
+ print $checker->getSystem()->getMagento()->getEdition() . "\n";
990
+
991
+ print str_pad('Version', 50) . ':' . str_pad('', 5);
992
+ print $checker->getSystem()->getMagento()->getVersion() . "\n";
993
+
994
+ print str_pad('Developer Mode', 50) . ':' . str_pad('', 5);
995
+ print $checker->renderBooleanField($checker->getSystem()->getMagento()->getDeveloperMode()) . "\n";
996
+
997
+ print str_pad('Add Secret Key to URLs', 50) . ':' . str_pad('', 5);
998
+ print print $checker->renderBooleanField($checker->getSystem()->getMagento()->getSecretKey()) . "\n";
999
+
1000
+ print str_pad('Use Flat Catalog Category', 50) . ':' . str_pad('', 5);
1001
+ print $checker->renderBooleanField($checker->getSystem()->getMagento()->getFlatCatalogCategory()) . "\n";
1002
+
1003
+ print str_pad('Use Flat Catalog Product', 50) . ':' . str_pad('', 5);
1004
+ print print $checker->renderBooleanField($checker->getSystem()->getMagento()->getFlatCatalogProduct()) . "\n";
1005
+ print str_pad('', 100, '=') . "\n";
1006
+ print "\n";
1007
+ //========================================
1008
+
1009
+ //========================================
1010
+ //Magento Core API Info
1011
+ //========================================
1012
+ print str_pad('', 100, '=') . "\n";
1013
+ print 'Magento Core API Info' . "\n";
1014
+ print str_pad('', 100, '=') . "\n";
1015
+ print str_pad('Default Response Charset', 50) . ':' . str_pad('', 5);
1016
+ print print $checker->getSystem()->getMagentoApi()->getCharset() . "\n";
1017
+
1018
+ print str_pad('Client Session Timeout (sec.)', 50) . ':' . str_pad('', 5);
1019
+ $magento_api_session_timeout = $checker->getSystem()->getMagentoApi()->getSessionTimeout();
1020
+ print $magento_api_session_timeout['current_value'] . "\n";
1021
+
1022
+ print str_pad('WS-I Compliance', 50) . ':' . str_pad('', 5);
1023
+ print $checker->renderBooleanField($checker->getSystem()->getMagentoApi()->getComplianceWsi()) . "\n";
1024
+
1025
+ print str_pad('WSDL Cache', 50) . ':' . str_pad('', 5);
1026
+ print $checker->renderBooleanField($checker->getSystem()->getMagentoApi()->getWsdlCacheEnabled()) . "\n";
1027
+ print str_pad('', 100, '=') . "\n";
1028
+ print "\n";
1029
+ //========================================
1030
+
1031
+ //========================================
1032
+ //PHP Info
1033
+ //========================================
1034
+ print str_pad('', 100, '=') . "\n";
1035
+ print 'PHP Info' . "\n";
1036
+ print str_pad('', 100, '=') . "\n";
1037
+ print str_pad('Version', 50) . ':' . str_pad('', 5);
1038
+ print $checker->getSystem()->getPhp()->getVersion() . "\n";
1039
+
1040
+ print str_pad('Server API', 50) . ':' . str_pad('', 5);
1041
+ print $checker->getSystem()->getPhp()->getServerApi() . "\n";
1042
+
1043
+ print str_pad('Memory Limit', 50) . ':' . str_pad('', 5);
1044
+ print $checker->getSystem()->getPhp()->getMemoryLimit() . "\n";
1045
+
1046
+ print str_pad('Max. Execution Time', 50) . ':' . str_pad('', 5);
1047
+ print $checker->getSystem()->getPhp()->getMaxExecutionTime() . "\n";
1048
+ print str_pad('', 100, '=') . "\n";
1049
+ print "\n";
1050
+ //========================================
1051
+
1052
+ //========================================
1053
+ //MySQL Info
1054
+ //========================================
1055
+ print str_pad('', 100, '=') . "\n";
1056
+ print 'MySQL Info' . "\n";
1057
+ print str_pad('', 100, '=') . "\n";
1058
+ print str_pad('Version', 50) . ':' . str_pad('', 5);
1059
+ print $checker->getSystem()->getMysql()->getVersion() . "\n";
1060
+
1061
+ print str_pad('Server API', 50) . ':' . str_pad('', 5);
1062
+ print $checker->getSystem()->getMysql()->getServerApi() . "\n";
1063
+
1064
+ print str_pad('Database Name', 50) . ':' . str_pad('', 5);
1065
+ print $checker->getSystem()->getMysql()->getDatabaseName() . "\n";
1066
+
1067
+ print str_pad('Database Tables', 50) . ':' . str_pad('', 5);
1068
+ print $checker->getSystem()->getMysql()->getDatabaseTables() . "\n";
1069
+
1070
+ print str_pad('Database Table Prefix', 50) . ':' . str_pad('', 5);
1071
+ print $checker->getSystem()->getMysql()->getTablePrefix() . "\n";
1072
+
1073
+ print str_pad('Connection Timeout', 50) . ':' . str_pad('', 5);
1074
+ print $checker->getSystem()->getMysql()->getConnectionTimeout() . "\n";
1075
+
1076
+ print str_pad('Wait Timeout', 50) . ':' . str_pad('', 5);
1077
+ print $checker->getSystem()->getMysql()->getWaitTimeout() . "\n";
1078
+
1079
+ print str_pad('Thread stack', 50) . ':' . str_pad('', 5);
1080
+ $thread_stack = $checker->getSystem()->getMysql()->getThreadStack();
1081
+ print $thread_stack['current_value'] . "\n";
1082
+
1083
+ print str_pad('Max Allowed Packet', 50) . ':' . str_pad('', 5);
1084
+ $max_allowed_packet = $checker->getSystem()->getMysql()->getMaxAllowedPacket();
1085
+ print $max_allowed_packet['current_value'] . "\n";
1086
+ print str_pad('', 100, '=') . "\n";
1087
+ print "\n";
1088
+ //========================================
1089
+
1090
+ //========================================
1091
+ //Server Info
1092
+ //========================================
1093
+ print str_pad('', 100, '=') . "\n";
1094
+ print 'Server Info' . "\n";
1095
+ print str_pad('', 100, '=') . "\n";
1096
+ print str_pad('Info', 50) . ':' . str_pad('', 5);
1097
+ print $checker->getSystem()->getServer()->getInfo() . "\n";
1098
+
1099
+ print str_pad('Domain', 50) . ':' . str_pad('', 5);
1100
+ print $checker->getSystem()->getServer()->getDomain() . "\n";
1101
+
1102
+ print str_pad('Server IP', 50) . ':' . str_pad('', 5);
1103
+ print $checker->getSystem()->getServer()->getIp() . "\n";
1104
+
1105
+ print str_pad('Server Directory', 50) . ':' . str_pad('', 5);
1106
+ print $checker->getSystem()->getServer()->getDir() . "\n";
1107
+ print str_pad('', 100, '=') . "\n";
1108
+ //========================================
1109
+
1110
+
1111
+ //========================================
1112
+ //phpinfo() full overview
1113
+ //========================================
1114
+ $formatter = Mage::helper('iceimport/format');
1115
+ ob_start();
1116
+ phpinfo();
1117
+ $phpinfo = ob_get_contents();
1118
+ ob_end_clean();
1119
+
1120
+ try {
1121
+ print str_pad('', 100, '=') . "\n";
1122
+ print 'phpinfo() full overview' . "\n";
1123
+ print str_pad('', 100, '=') . "\n";
1124
+ print $formatter->convert_html_to_text($phpinfo) . "\n";
1125
+ print str_pad('', 100, '=') . "\n";
1126
+ print "\n";
1127
+ } catch (Exception $e) {
1128
+ }
1129
+ //========================================
1130
+
1131
+
1132
+ //========================================
1133
+ //MySQL Configuration
1134
+ //========================================
1135
+ print str_pad('', 100, '=') . "\n";
1136
+ print 'MySQL Vars' . "\n";
1137
+ print str_pad('', 100, '=') . "\n";
1138
+ $mysql_vars = $checker->getSystem()->getMysqlVars()->getData();
1139
+ foreach ($mysql_vars as $mysql_var_key => $mysql_var_value) {
1140
+ print str_pad($mysql_var_key, 50) . ':' . str_pad('', 5);
1141
+ print $mysql_var_value . "\n";
1142
+ }
1143
+ print str_pad('', 100, '=') . "\n";
1144
+ //========================================
1145
+ }
1146
+
1147
+
1148
+ /**
1149
+ * Method for export to csv file
1150
+ */
1151
+ public function exportIceimportimagesCsvAction()
1152
+ {
1153
+ $fileName = 'notimport_images.csv';
1154
+ $grid = $this->getLayout()->createBlock('iceimport/adminhtml_images_list_grid');
1155
+ $grid->setDefaultLimit($grid->getCountImagesNotImport());
1156
+ $this->_prepareDownloadResponse($fileName, $grid->getCsvFile());
1157
+ }
1158
+
1159
+ /**
1160
+ * Method for export to excel file
1161
+ */
1162
+ public function exportIceimportimagesExcelAction() {
1163
+ $fileName = 'notimport_images.xml';
1164
+ $grid = $this->getLayout()->createBlock('iceimport/adminhtml_images_list_grid');
1165
+ $grid->setDefaultLimit($grid->getCountImagesNotImport());
1166
+ $this->_prepareDownloadResponse($fileName, $grid->getExcelFile($fileName));
1167
+ }
1168
+
1169
+ /**
1170
+ * Images grid for AJAX request
1171
+ */
1172
+ public function gridAction() {
1173
+ $exportall_button = $this->getLayout()->createBlock('iceimport/adminhtml_system_config_form_exportall');
1174
+ $this->_gridTables->getGridTable().$exportall_button->getButtonHtml();
1175
+ }
1176
+
1177
+ /**
1178
+ * Method for export to csv file
1179
+ */
1180
+ public function exportIceimportimagesCsvAllAction()
1181
+ {
1182
+ $fileName = 'notimport_images.csv';
1183
+ $grid = $this->getLayout()->createBlock('iceimport/adminhtml_images_list_grid');
1184
+ $grid->setDefaultLimit($grid->getCountImagesNotImport());
1185
+ $this->_prepareDownloadResponse($fileName, $grid->getCsvFile());
1186
+ }
1187
+
1188
+ /**
1189
+ * Add to log skip notifications
1190
+ */
1191
+ public function checkwarningAction() {
1192
+ $DB_logger = Mage::helper('iceimport/db');
1193
+ $skip_data = $DB_logger->getLogEntryByKey('iceimport_skip_problems_digest');
1194
+
1195
+ $warning = $this->getRequest()->getParam('warning');
1196
+ $section_problems = $this->getRequest()->getParam('section_problems');
1197
+ if(empty($skip_data['log_value'])){
1198
+ $skip_data = array();
1199
+ $skip_data[$section_problems][] = $warning;
1200
+ $skip_data = json_encode($skip_data);
1201
+ $DB_logger->insertLogEntry('iceimport_skip_problems_digest', $skip_data);
1202
+ } else {
1203
+ $skip_data = (array)json_decode($skip_data['log_value']);
1204
+ if(!empty($skip_data[$section_problems])){
1205
+ if(!in_array($warning, $skip_data[$section_problems], true)){
1206
+ $skip_data[$section_problems][] = $warning;
1207
+ $skip_data = json_encode($skip_data);
1208
+ $DB_logger->insertLogEntry('iceimport_skip_problems_digest', $skip_data);
1209
+ }
1210
+ } else {
1211
+ $skip_data[$section_problems][] = $warning;
1212
+ $skip_data = json_encode($skip_data);
1213
+ $DB_logger->insertLogEntry('iceimport_skip_problems_digest', $skip_data);
1214
+ }
1215
+ }
1216
+
1217
+ $this->_redirectUrl(Mage::helper("adminhtml")->getUrl("*/system_config/edit", array('section' => 'iceimport_information')));
1218
+ }
1219
+
1220
+ protected function _isAllowed()
1221
+ {
1222
+ return Mage::getSingleton('admin/session')->isAllowed('system/config/iceimport_information');
1223
+ }
1224
+
1225
+
1226
+ /**
1227
+ * Show explanation for import setting
1228
+ * @return string;
1229
+ */
1230
+ public function explanationsAction(){
1231
+ $content = '
1232
+ <table class="explanation_table" style="border: solid; padding: 0px;">
1233
+ <tbody>
1234
+ <tr>
1235
+ <th><strong>Setting`s name</strong></th>
1236
+ <th><strong>Description</strong></th>
1237
+ <th>Default value</th>
1238
+ <th>Note</th>
1239
+ </tr>
1240
+ <tr>
1241
+ <td colspan="3"><strong>Content Settings</strong></td>
1242
+ <td>&nbsp;</td>
1243
+ </tr>
1244
+ <tr>
1245
+ <td>Update GTIN</td>
1246
+ <td>Update attribute if set "Yes"</td>
1247
+ <td style="text-align: center;">Yes</td>
1248
+ <td>&nbsp;</td>
1249
+ </tr>
1250
+ <tr>
1251
+ <td colspan="1">Update&nbsp;MPN</td>
1252
+ <td colspan="1">Update attribute if set "Yes"</td>
1253
+ <td style="text-align: center;" colspan="1">Yes</td>
1254
+ <td colspan="1">&nbsp;</td>
1255
+ </tr>
1256
+ <tr>
1257
+ <td colspan="1">Update&nbsp;Brand</td>
1258
+ <td colspan="1">Update attribute if set "Yes"</td>
1259
+ <td style="text-align: center;" colspan="1">Yes</td>
1260
+ <td colspan="1">&nbsp;</td>
1261
+ </tr>
1262
+ <tr>
1263
+ <td colspan="1">Update&nbsp;name</td>
1264
+ <td colspan="1">Update attribute if set "Yes"</td>
1265
+ <td style="text-align: center;" colspan="1">Yes</td>
1266
+ <td colspan="1">&nbsp;</td>
1267
+ </tr>
1268
+ <tr>
1269
+ <td colspan="1">Update&nbsp;short description</td>
1270
+ <td colspan="1">Update attribute if set "Yes"</td>
1271
+ <td style="text-align: center;" colspan="1">Yes</td>
1272
+ <td colspan="1">&nbsp;</td>
1273
+ </tr>
1274
+ <tr>
1275
+ <td colspan="1">Update description</td>
1276
+ <td colspan="1">Update attribute if set "Yes"</td>
1277
+ <td style="text-align: center;" colspan="1">Yes</td>
1278
+ <td colspan="1">&nbsp;</td>
1279
+ </tr>
1280
+ <tr>
1281
+ <td colspan="1">Update prices</td>
1282
+ <td colspan="1">Update attribute if set "Yes"</td>
1283
+ <td style="text-align: center;" colspan="1">&nbsp;Yes</td>
1284
+ <td colspan="1">&nbsp;</td>
1285
+ </tr>
1286
+ <tr>
1287
+ <td colspan="1">Update stock</td>
1288
+ <td colspan="1">Update attribute if set "Yes"</td>
1289
+ <td style="text-align: center;" colspan="1">&nbsp;Yes</td>
1290
+ <td colspan="1">&nbsp;</td>
1291
+ </tr>
1292
+ <tr>
1293
+ <td colspan="1">Update Delivery ETA</td>
1294
+ <td colspan="1">Update attribute if set "Yes"</td>
1295
+ <td style="text-align: center;" colspan="1">&nbsp;Yes</td>
1296
+ <td colspan="1">&nbsp;</td>
1297
+ </tr>
1298
+ <tr>
1299
+ <td colspan="1">Update products category</td>
1300
+ <td colspan="1">Update attribute if set "Yes"</td>
1301
+ <td style="text-align: center;" colspan="1">&nbsp;Yes</td>
1302
+ <td colspan="1">&nbsp;</td>
1303
+ </tr>
1304
+ <tr>
1305
+ <td colspan="1">Update status</td>
1306
+ <td colspan="1">Update attribute if set "Yes"</td>
1307
+ <td style="text-align: center;" colspan="1">&nbsp;Yes</td>
1308
+ <td colspan="1">&nbsp;</td>
1309
+ </tr>
1310
+ <tr>
1311
+ <td colspan="1">Update visibility</td>
1312
+ <td colspan="1">Update attribute if set "Yes"</td>
1313
+ <td style="text-align: center;" colspan="1">&nbsp;Yes</td>
1314
+ <td colspan="1">&nbsp;</td>
1315
+ </tr>
1316
+ <tr>
1317
+ <td colspan="1">Update stock availability</td>
1318
+ <td colspan="1">Update attribute if set "Yes"</td>
1319
+ <td style="text-align: center;" colspan="1">&nbsp;Yes</td>
1320
+ <td colspan="1">&nbsp;</td>
1321
+ </tr>
1322
+ <tr>
1323
+ <td colspan="1">Update URL key</td>
1324
+ <td colspan="1">Update attribute if set "Yes"</td>
1325
+ <td style="text-align: center;" colspan="1">&nbsp;Yes</td>
1326
+ <td colspan="1">&nbsp;</td>
1327
+ </tr>
1328
+ <tr>
1329
+ <td colspan="1">Import product images (via Cron)</td>
1330
+ <td colspan="1">If setting is enabled then image will be added to the queue for
1331
+ downloading
1332
+ </td>
1333
+ <td style="text-align: center;" colspan="1">&nbsp;Yes</td>
1334
+ <td colspan="1">&nbsp;</td>
1335
+ </tr>
1336
+ <tr>
1337
+ <td colspan="1">Re-index Required</td>
1338
+ <td colspan="1">Run re-index of all the content after finishing the import process</td>
1339
+ <td style="text-align: center;" colspan="1">&nbsp;Yes</td>
1340
+ <td colspan="1">&nbsp;</td>
1341
+ </tr>
1342
+ <tr>
1343
+ <td colspan="1"><span>When you want to run cron ?</span></td>
1344
+ <td colspan="1">Time when you want to start the cron job of import process</td>
1345
+ <td colspan="1">30 7 * * *</td><td colspan="1">&nbsp;</td>
1346
+ </tr>
1347
+ <tr>
1348
+ <td colspan="4"><h4 id="Magentoextension::IceImport(byshopowner)-Attributesmapping">
1349
+ Attributes mapping</h4></td>
1350
+ </tr>
1351
+ <tr>
1352
+ <td colspan="1">MPN</td>
1353
+ <td colspan="1"><p><span class="short_text" lang="en">This value is required and can`t be empty.</span>
1354
+ </p></td>
1355
+ <td colspan="1">&nbsp;</td>
1356
+ <td colspan="1">&nbsp;</td>
1357
+ </tr>
1358
+ <tr>
1359
+ <td colspan="1">Brand</td>
1360
+ <td colspan="1"><p>This value is required and can`t be empty.</p></td>
1361
+ <td colspan="1">&nbsp;</td>
1362
+ <td colspan="1">&nbsp;</td>
1363
+ </tr>
1364
+ <tr>
1365
+ <td colspan="1">GTIN</td>
1366
+ <td colspan="1"><p>This value is required and can`t be empty.</p></td>
1367
+ <td colspan="1">&nbsp;</td>
1368
+ <td colspan="1">&nbsp;</td>
1369
+ </tr>
1370
+ <tr>
1371
+ <td colspan="1"><span class="short_text" lang="en">Delivery ETA</span></td>
1372
+ <td colspan="1">This value is required and can`t be empty.</td>
1373
+ <td colspan="1">&nbsp;</td>
1374
+ <td colspan="1">&nbsp;</td>
1375
+ </tr>
1376
+ <tr>
1377
+ <td colspan="1">Websites</td>
1378
+ <td colspan="1">Choose website in the Magento to proceed import products</td>
1379
+ <td style="text-align: center;" colspan="1">None</td>
1380
+ <td colspan="1">&nbsp;</td>
1381
+ </tr>
1382
+ <tr>
1383
+ <td colspan="1">Stock name</td>
1384
+ <td colspan="1">Name of stock (parameter of stock name from table `cataloginventory_stock`)</td>
1385
+ <td style="text-align: center;" colspan="1">None</td>
1386
+ <td colspan="1">&nbsp;</td>
1387
+ </tr>
1388
+ <tr>
1389
+ <td colspan="3"><h4 id="Magentoextension::IceImport(byshopowner)-ImportParameters">Import
1390
+ Parameters</h4></td>
1391
+ <td>&nbsp;</td>
1392
+ </tr>
1393
+ <tr>
1394
+ <td colspan="1">Batch size</td>
1395
+ <td colspan="1">This setting is responsing for the count of products that can be added per
1396
+ query
1397
+ </td>
1398
+ <td style="text-align: center;" colspan="1">100</td>
1399
+ <td colspan="1">&nbsp;</td>
1400
+ </tr>
1401
+ <tr>
1402
+ <td colspan="1">Import new products</td>
1403
+ <td colspan="1"><p><span
1404
+ style="color: rgb(47,47,47);">Add products from import file </span></p>
1405
+
1406
+ <p><span style="color: rgb(47,47,47);">if they aren`t presented in shop`s assortment.</span></p></td>
1407
+ <td style="text-align: center;" colspan="1">Yes</td>
1408
+ <td colspan="1">&nbsp;</td>
1409
+ </tr>
1410
+ <tr>
1411
+ <td colspan="1">Remove old products</td>
1412
+ <td colspan="1"><p><span
1413
+ style="color: rgb(47,47,47);">Remove products marked as&nbsp;</span><strong>"is_iceimport"</strong><span
1414
+ style="color: rgb(47,47,47);">&nbsp;</span></p>
1415
+
1416
+ <p><span style="color: rgb(47,47,47);">and not presented in import file.</span></p></td>
1417
+ <td style="text-align: center;" colspan="1">Yes</td>
1418
+ <td colspan="1">&nbsp;</td>
1419
+ </tr>
1420
+ <tr>
1421
+ <td colspan="1">Tolerance of difference (%)</td>
1422
+ <td colspan="1"><p>Indicator of removing old products (products in the store but doesn`t
1423
+ exist any more in an import file). <br>If percentage of "old" products in store more than this value - in
1424
+ this case the removing process will be canceled. <br>If less - old products will be deleted (this process
1425
+ takes effect only to products imported via IceShop Iceimport, <br><strong>any custom products that were
1426
+ created by yourself, won`t be deleted</strong>).</p></td>
1427
+ <td style="text-align: center;" colspan="1">25</td>
1428
+ <td colspan="1">&nbsp;</td>
1429
+ </tr>
1430
+ <tr>
1431
+ <td colspan="1">Set to active imported categories</td>
1432
+ <td colspan="1">All new imported&nbsp;categories will be active</td>
1433
+ <td style="text-align: center;" colspan="1">Yes</td>
1434
+ <td colspan="1">&nbsp;</td>
1435
+ </tr>
1436
+ <tr>
1437
+ <td colspan="1">Sort categories in ASC order</td>
1438
+ <td colspan="1"><p>If setting is enabled then sort order for categories changed</p>
1439
+
1440
+ <p>in depend of category name</p></td>
1441
+ <td style="text-align: center;" colspan="1">Yes</td>
1442
+ <td colspan="1">&nbsp;</td>
1443
+ </tr>
1444
+ <tr>
1445
+ <td colspan="1">Hide empty category</td>
1446
+ <td colspan="1">&nbsp;</td>
1447
+ <td style="text-align: center;" colspan="1">Yes</td>
1448
+ <td colspan="1">&nbsp;</td>
1449
+ </tr>
1450
+ <tr>
1451
+ <td colspan="1">Default tax for product</td>
1452
+ <td colspan="1">You can slelect taxes from dropdown menu</td>
1453
+ <td style="text-align: center;" colspan="1">None</td>
1454
+ <td colspan="1">&nbsp;</td>
1455
+ </tr>
1456
+ <tr>
1457
+ <td colspan="1">ImagesQueueProcessing only</td>
1458
+ <td colspan="1"><p>If <strong>YES</strong> - all images will be downloaded automatically at the end of next import process.</p>
1459
+
1460
+ <p>if <strong>NO</strong> - will be added only links for images, and customer wants - he can download them manually
1461
+ from Iceimport Information Dashboard > Images Statistics.</p></td>
1462
+ <td style="text-align: center;" colspan="1">No</td>
1463
+ <td colspan="1">&nbsp;</td>
1464
+ </tr>
1465
+ <tr>
1466
+ <td colspan="1">Transactions enabled</td>
1467
+ <td colspan="1">This setting is responsing for enabling/disabling of transactions during import process.
1468
+ </td>
1469
+ <td style="text-align: center;" colspan="1">No</td>
1470
+ <td colspan="1">&nbsp;</td>
1471
+ </tr>
1472
+ </tbody>
1473
+ </table>
1474
+ <style>
1475
+ .explanation_table, .explanation_table th, .explanation_table td {
1476
+ border: solid 1px black;
1477
+ }
1478
+ </style>
1479
+ ';
1480
+ echo $content;
1481
+ }
1482
+
1483
  }
app/code/community/ICEshop/Iceimport/controllers/Adminhtml/IceimportimagesController.php CHANGED
@@ -1,18 +1,23 @@
1
- <?php
2
- class ICEshop_Iceimport_Adminhtml_IceimportimagesController extends Mage_Adminhtml_Controller_Action
3
- {
4
-
5
-
6
- /**
7
- * Return some checking result
8
- *
9
- * @return void
10
- */
11
- public function checkAction()
12
- {
13
-
14
- $result = Mage::getModel('iceimport/observer')->importImages();
15
- Mage::app()->getResponse()->setBody($result);
16
- }
17
-
 
 
 
 
 
18
  }
1
+ <?php
2
+ class ICEshop_Iceimport_Adminhtml_IceimportimagesController extends Mage_Adminhtml_Controller_Action
3
+ {
4
+
5
+
6
+ /**
7
+ * Return some checking result
8
+ *
9
+ * @return void
10
+ */
11
+ public function checkAction()
12
+ {
13
+
14
+ $result = Mage::getModel('iceimport/observer')->importImages();
15
+ Mage::app()->getResponse()->setBody($result);
16
+ }
17
+
18
+ protected function _isAllowed()
19
+ {
20
+ return Mage::getSingleton('admin/session')->isAllowed('system/config/iceimport_information');
21
+ }
22
+
23
  }
app/code/community/ICEshop/Iceimport/controllers/Adminhtml/System/Convert/GuiController.php ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ require_once Mage::getModuleDir('controllers', 'Mage_Adminhtml') . DS . 'System' . DS . 'Convert' . DS . 'GuiController.php';
4
+
5
+ class ICEshop_Iceimport_Adminhtml_System_Convert_GuiController extends Mage_Adminhtml_System_Convert_GuiController
6
+ {
7
+
8
+ public function batchRunAction()
9
+ {
10
+
11
+ if ($this->getRequest()->isPost()) {
12
+
13
+ $transactions_enabled = (int)Mage::getStoreConfig('iceshop_iceimport_importprod_root/importprod/transactions_enabled');
14
+ $batchId = $this->getRequest()->getPost('batch_id', 0);
15
+ $rowIds = $this->getRequest()->getPost('rows');
16
+ $db_res = Mage::getSingleton('core/resource')->getConnection('core_write');
17
+ /* @var $batchModel Mage_Dataflow_Model_Batch */
18
+ $batchModel = Mage::getModel('dataflow/batch')->load($batchId);
19
+
20
+ if (!$batchModel->getId()) {
21
+ return;
22
+ }
23
+ if (!is_array($rowIds) || count($rowIds) < 1) {
24
+ return;
25
+ }
26
+ if (!$batchModel->getAdapter()) {
27
+ return;
28
+ }
29
+
30
+ $batchImportModel = $batchModel->getBatchImportModel();
31
+ $importIds = $batchImportModel->getIdCollection();
32
+
33
+ $adapter = Mage::getModel($batchModel->getAdapter());
34
+ $adapter->setBatchParams($batchModel->getParams());
35
+ $importData = array();
36
+
37
+ $errors = array();
38
+ $saved = 0;
39
+ foreach ($rowIds as $importId) {
40
+ $batchImportModel->load($importId);
41
+ if (!$batchImportModel->getId()) {
42
+ $errors[] = Mage::helper('dataflow')->__('Skip undefined row.');
43
+ continue;
44
+ }
45
+
46
+ try {
47
+ $importData[] = $batchImportModel->getBatchData();
48
+ } catch (Exception $e) {
49
+ $errors[] = $e->getMessage();
50
+ continue;
51
+ }
52
+ $saved ++;
53
+ }
54
+
55
+ if ($transactions_enabled != 0) {
56
+ try {
57
+ $db_res->beginTransaction();
58
+ $adapter->saveRow($importData, true);
59
+ $db_res->commit();
60
+ } catch (Exception $e) {
61
+ $db_res->rollBack();
62
+ throw $e;
63
+ }
64
+ }
65
+ else {
66
+ $adapter->saveRow($importData);
67
+ }
68
+
69
+ if (method_exists($adapter, 'getEventPrefix')) {
70
+ /**
71
+ * Event for process rules relations after products import
72
+ */
73
+ Mage::dispatchEvent($adapter->getEventPrefix() . '_finish_before', array(
74
+ 'adapter' => $adapter
75
+ ));
76
+
77
+ /**
78
+ * Clear affected ids for adapter possible reuse
79
+ */
80
+ $adapter->clearAffectedEntityIds();
81
+ }
82
+
83
+ $result = array(
84
+ 'savedRows' => $saved,
85
+ 'errors' => $errors
86
+ );
87
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
88
+ }
89
+ }
90
+ }
app/code/community/ICEshop/Iceimport/etc/adminhtml.xml CHANGED
@@ -1,31 +1,31 @@
1
- <?xml version="1.0"?>
2
- <config>
3
- <acl>
4
- <resources>
5
- <admin>
6
- <children>
7
- <system>
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>
18
- </iceimport_information>
19
- <iceshop_about>
20
- <title>Iceshop Info</title>
21
- <sort_order>40</sort_order>
22
- </iceshop_about>
23
- </children>
24
- </config>
25
- </children>
26
- </system>
27
- </children>
28
- </admin>
29
- </resources>
30
- </acl>
31
  </config>
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <acl>
4
+ <resources>
5
+ <admin>
6
+ <children>
7
+ <system>
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>
18
+ </iceimport_information>
19
+ <iceshop_about>
20
+ <title>Iceshop Info</title>
21
+ <sort_order>40</sort_order>
22
+ </iceshop_about>
23
+ </children>
24
+ </config>
25
+ </children>
26
+ </system>
27
+ </children>
28
+ </admin>
29
+ </resources>
30
+ </acl>
31
  </config>
app/code/community/ICEshop/Iceimport/etc/config.xml CHANGED
@@ -1,143 +1,149 @@
1
- <?xml version="1.0"?>
2
- <config>
3
- <modules>
4
- <ICEshop_Iceimport>
5
- <version>1.7.15</version>
6
- </ICEshop_Iceimport>
7
- </modules>
8
- <admin>
9
- <routers>
10
- <adminhtml>
11
- <args>
12
- <modules>
13
- <iceimport before="Mage_Adminhtml">ICEshop_Iceimport_Adminhtml</iceimport>
14
- </modules>
15
- </args>
16
- </adminhtml>
17
- </routers>
18
- </admin>
19
- <global>
20
- <events>
21
- <controller_action_predispatch_adminhtml_profile_batchfinish>
22
- <observers>
23
- <ICEshop_Iceimport>
24
- <class>ICEshop_Iceimport/Observer</class>
25
- <method>sortCategory</method>
26
- </ICEshop_Iceimport>
27
- </observers>
28
- </controller_action_predispatch_adminhtml_profile_batchfinish>
29
- <controller_action_postdispatch_adminhtml_profile_batchFinish>
30
- <observers>
31
- <ICEshop_Iceimport>
32
- <class>ICEshop_Iceimport/Observer</class>
33
- <method>sortCategory</method>
34
- </ICEshop_Iceimport>
35
- </observers>
36
- </controller_action_postdispatch_adminhtml_profile_batchFinish>
37
- </events>
38
- <blocks>
39
- <iceimport>
40
- <class>ICEshop_Iceimport_Block</class>
41
- </iceimport>
42
- </blocks>
43
- <models>
44
- <catalog>
45
- <rewrite>
46
- <!-- Override Mage_Catalog_Model_Convert_Adapter_Product -->
47
- <convert_adapter_product>ICEshop_Iceimport_Model_Convert_Adapter_Product</convert_adapter_product>
48
- </rewrite>
49
- </catalog>
50
- <dataflow>
51
- <rewrite>
52
- <!-- Override Mage_Catalog_Model_Convert_Adapter_Product -->
53
- <batch_import>ICEshop_Iceimport_Model_Dataflow_Batch_Import</batch_import>
54
- </rewrite>
55
- <rewrite>
56
- <!-- Override Mage_Catalog_Model_Convert_Adapter_Product -->
57
- <convert_parser_csv>ICEshop_Iceimport_Model_Dataflow_Convert_Parser_Csv</convert_parser_csv>
58
- </rewrite>
59
- </dataflow>
60
- <iceimport>
61
- <class>ICEshop_Iceimport_Model</class>
62
- </iceimport>
63
- </models>
64
- <helpers>
65
- <iceimport>
66
- <class>ICEshop_Iceimport_Helper</class>
67
- </iceimport>
68
- </helpers>
69
- <resources>
70
- <iceimport_setup>
71
- <setup>
72
- <module>ICEshop_Iceimport</module>
73
- <class>Mage_Catalog_Model_Resource_Eav_Mysql4_Setup</class>
74
- </setup>
75
- <connection>
76
- <use>core_setup</use>
77
- </connection>
78
- </iceimport_setup>
79
- <iceimport_setup_write>
80
- <connection>
81
- <use>core_write</use>
82
- </connection>
83
- </iceimport_setup_write>
84
- <iceimport_setup_read>
85
- <connection>
86
- <use>core_read</use>
87
- </connection>
88
- </iceimport_setup_read>
89
- </resources>
90
- </global>
91
- <adminhtml>
92
- <layout>
93
- <updates>
94
- <ICEshop_Iceimport module="iceimport">
95
- <file>ICEshop_Iceimport.xml</file>
96
- </ICEshop_Iceimport>
97
- </updates>
98
- </layout>
99
- </adminhtml>
100
- <crontab>
101
- <jobs>
102
- <iceshop_iceimport>
103
- <schedule>
104
- <cron_expr>30 7 * * *</cron_expr>
105
- </schedule>
106
- <run>
107
- <model>iceimport/observer::load</model>
108
- </run>
109
- </iceshop_iceimport>
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_name>1</import_product_brand_name>
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>
124
- <import_product_short_summary_description>1</import_product_short_summary_description>
125
- <import_product_summary_description>1</import_product_summary_description>
126
- <import_prices>1</import_prices>
127
- <import_stock>1</import_stock>
128
- <import_product_delivery_eta>1</import_product_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>
132
- <update_visibility_from_csv>1</update_visibility_from_csv>
133
- <update_is_in_stock_from_csv>1</update_is_in_stock_from_csv>
134
- <update_hide_category>1</update_hide_category>
135
- <update_url_key_from_csv>1</update_url_key_from_csv>
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
- <images_queue_processing_only>0</images_queue_processing_only>
140
- </importprod>
141
- </iceshop_iceimport_importprod_root>
142
- </default>
143
- </config>
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <ICEshop_Iceimport>
5
+ <version>1.7.23</version>
6
+ </ICEshop_Iceimport>
7
+ </modules>
8
+ <admin>
9
+ <routers>
10
+ <adminhtml>
11
+ <args>
12
+ <modules>
13
+ <iceimport before="Mage_Adminhtml">ICEshop_Iceimport_Adminhtml</iceimport>
14
+ </modules>
15
+ </args>
16
+ </adminhtml>
17
+ </routers>
18
+ </admin>
19
+ <global>
20
+ <events>
21
+ <controller_action_predispatch_adminhtml_profile_batchfinish>
22
+ <observers>
23
+ <ICEshop_Iceimport>
24
+ <class>ICEshop_Iceimport/Observer</class>
25
+ <method>sortCategory</method>
26
+ </ICEshop_Iceimport>
27
+ </observers>
28
+ </controller_action_predispatch_adminhtml_profile_batchfinish>
29
+ <controller_action_postdispatch_adminhtml_profile_batchFinish>
30
+ <observers>
31
+ <ICEshop_Iceimport>
32
+ <class>ICEshop_Iceimport/Observer</class>
33
+ <method>sortCategory</method>
34
+ </ICEshop_Iceimport>
35
+ </observers>
36
+ </controller_action_postdispatch_adminhtml_profile_batchFinish>
37
+ </events>
38
+ <blocks>
39
+ <iceimport>
40
+ <class>ICEshop_Iceimport_Block</class>
41
+ </iceimport>
42
+ </blocks>
43
+ <models>
44
+ <catalog>
45
+ <rewrite>
46
+ <!-- Override Mage_Catalog_Model_Convert_Adapter_Product -->
47
+ <convert_adapter_product>ICEshop_Iceimport_Model_Convert_Adapter_Product</convert_adapter_product>
48
+ </rewrite>
49
+ </catalog>
50
+ <dataflow>
51
+ <rewrite>
52
+ <!-- Override Mage_Catalog_Model_Convert_Adapter_Product -->
53
+ <batch_import>ICEshop_Iceimport_Model_Dataflow_Batch_Import</batch_import>
54
+ </rewrite>
55
+ <rewrite>
56
+ <!-- Override Mage_Catalog_Model_Convert_Adapter_Product -->
57
+ <convert_parser_csv>ICEshop_Iceimport_Model_Dataflow_Convert_Parser_Csv</convert_parser_csv>
58
+ </rewrite>
59
+ <rewrite>
60
+ <!-- Override Mage_Dataflow_Model_Convert_Adapter_Io -->
61
+ <convert_adapter_io>ICEshop_Iceimport_Model_Dataflow_Convert_Adapter_Io</convert_adapter_io>
62
+ </rewrite>
63
+ </dataflow>
64
+ <iceimport>
65
+ <class>ICEshop_Iceimport_Model</class>
66
+ </iceimport>
67
+ </models>
68
+ <helpers>
69
+ <iceimport>
70
+ <class>ICEshop_Iceimport_Helper</class>
71
+ </iceimport>
72
+ </helpers>
73
+ <resources>
74
+ <iceimport_setup>
75
+ <setup>
76
+ <module>ICEshop_Iceimport</module>
77
+ <class>Mage_Catalog_Model_Resource_Eav_Mysql4_Setup</class>
78
+ </setup>
79
+ <connection>
80
+ <use>core_setup</use>
81
+ </connection>
82
+ </iceimport_setup>
83
+ <iceimport_setup_write>
84
+ <connection>
85
+ <use>core_write</use>
86
+ </connection>
87
+ </iceimport_setup_write>
88
+ <iceimport_setup_read>
89
+ <connection>
90
+ <use>core_read</use>
91
+ </connection>
92
+ </iceimport_setup_read>
93
+ </resources>
94
+ </global>
95
+ <adminhtml>
96
+ <layout>
97
+ <updates>
98
+ <ICEshop_Iceimport module="iceimport">
99
+ <file>ICEshop_Iceimport.xml</file>
100
+ </ICEshop_Iceimport>
101
+ </updates>
102
+ </layout>
103
+ </adminhtml>
104
+ <crontab>
105
+ <jobs>
106
+ <iceshop_iceimport>
107
+ <schedule>
108
+ <config_path>iceshop_iceimport_importprod_root/importprod/cron_settings</config_path>
109
+ </schedule>
110
+ <run>
111
+ <model>iceimport/observer::load</model>
112
+ </run>
113
+ </iceshop_iceimport>
114
+ </jobs>
115
+ </crontab>
116
+ <default>
117
+ <iceshop_iceimport_importprod_root>
118
+ <importprod>
119
+ <category_active>1</category_active>
120
+ <category_sort>1</category_sort>
121
+ <delete_old_products>1</delete_old_products>
122
+ <import_product_ean>1</import_product_ean>
123
+ <import_product_mpn>1</import_product_mpn>
124
+ <import_product_brand_name>1</import_product_brand_name>
125
+ <import_product_name>1</import_product_name>
126
+ <import_product_short_description>1</import_product_short_description>
127
+ <import_product_description>1</import_product_description>
128
+ <iceimport_profile>3</iceimport_profile>
129
+ <transactions_enabled>0</transactions_enabled>
130
+ <import_prices>1</import_prices>
131
+ <import_stock>1</import_stock>
132
+ <import_product_delivery_eta>1</import_product_delivery_eta>
133
+ <import_images>1</import_images>
134
+ <update_categories_from_csv>1</update_categories_from_csv>
135
+ <update_status_from_csv>1</update_status_from_csv>
136
+ <update_visibility_from_csv>1</update_visibility_from_csv>
137
+ <update_is_in_stock_from_csv>1</update_is_in_stock_from_csv>
138
+ <update_hide_category>1</update_hide_category>
139
+ <update_url_key_from_csv>1</update_url_key_from_csv>
140
+ <iceimport_batch_size>10</iceimport_batch_size>
141
+ <import_new_products>1</import_new_products>
142
+ <delete_old_products_tolerance>25</delete_old_products_tolerance>
143
+ <images_queue_processing_only>0</images_queue_processing_only>
144
+ <is_reindex_required_import>1</is_reindex_required_import>
145
+ <cron_settings>30 7 * * *</cron_settings>
146
+ </importprod>
147
+ </iceshop_iceimport_importprod_root>
148
+ </default>
149
+ </config>
app/code/community/ICEshop/Iceimport/etc/system.xml CHANGED
@@ -1,372 +1,481 @@
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>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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[<a id="iceimport_explanation" target="_blank">Explanation</a>]]></label>
38
+ <comment><![CDATA[]]></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
+ <iceimport_note translate="label">
46
+ <label><![CDATA[<strong>Caution!</strong>]]></label>
47
+ <comment><![CDATA[All these settings are valid and applicable for products that already exist in the store. For the new products (which has not in the store yet, but presents in the import file) will be applied "Yes" i.e. all attributes, such as MPN, GTIN etc. will be ALWAYS imported for NEW products.]]></comment>
48
+ <frontend_type>label</frontend_type>
49
+ <sort_order>2</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
+ </iceimport_note>
54
+ <iceimport_explanation_hidden translate="label comment">
55
+ <label></label>
56
+ <comment></comment>
57
+ <frontend_type>select</frontend_type>
58
+ <source_model>iceimport/system_config_explanations</source_model>
59
+ <sort_order>10</sort_order>
60
+ <show_in_default>1</show_in_default>
61
+ <show_in_website>1</show_in_website>
62
+ <show_in_store>1</show_in_store>
63
+ </iceimport_explanation_hidden>
64
+ <import_product_ean translate="label">
65
+ <label>Update GTIN</label>
66
+ <frontend_type>select</frontend_type>
67
+ <source_model>iceimport/system_config_yesno</source_model>
68
+ <sort_order>21</sort_order>
69
+ <show_in_default>1</show_in_default>
70
+ <show_in_website>1</show_in_website>
71
+ <show_in_store>1</show_in_store>
72
+ </import_product_ean>
73
+ <import_product_mpn translate="label">
74
+ <label>Update MPN</label>
75
+ <frontend_type>select</frontend_type>
76
+ <source_model>iceimport/system_config_yesno</source_model>
77
+ <sort_order>22</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_mpn>
82
+ <import_product_brand_name translate="label">
83
+ <label>Update Brand</label>
84
+ <frontend_type>select</frontend_type>
85
+ <source_model>iceimport/system_config_yesno</source_model>
86
+ <sort_order>23</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
+ <enabled>1</enabled>
91
+ </import_product_brand_name>
92
+ <import_product_name translate="label">
93
+ <label>Update name</label>
94
+ <frontend_type>select</frontend_type>
95
+ <source_model>iceimport/system_config_yesno</source_model>
96
+ <sort_order>24</sort_order>
97
+ <show_in_default>1</show_in_default>
98
+ <show_in_website>1</show_in_website>
99
+ <show_in_store>1</show_in_store>
100
+ </import_product_name>
101
+ <import_product_short_description translate="label">
102
+ <label>Update short description</label>
103
+ <frontend_type>select</frontend_type>
104
+ <source_model>iceimport/system_config_yesno</source_model>
105
+ <sort_order>25</sort_order>
106
+ <show_in_default>1</show_in_default>
107
+ <show_in_website>1</show_in_website>
108
+ <show_in_store>1</show_in_store>
109
+ </import_product_short_description>
110
+ <import_product_description translate="label">
111
+ <label>Update description</label>
112
+ <frontend_type>select</frontend_type>
113
+ <source_model>iceimport/system_config_yesno</source_model>
114
+ <sort_order>26</sort_order>
115
+ <show_in_default>1</show_in_default>
116
+ <show_in_website>1</show_in_website>
117
+ <show_in_store>1</show_in_store>
118
+ </import_product_description>
119
+ <import_prices translate="label">
120
+ <label>Update prices</label>
121
+ <frontend_type>select</frontend_type>
122
+ <source_model>iceimport/system_config_yesno</source_model>
123
+ <sort_order>29</sort_order>
124
+ <show_in_default>1</show_in_default>
125
+ <show_in_website>1</show_in_website>
126
+ <show_in_store>1</show_in_store>
127
+ </import_prices>
128
+ <import_stock translate="label">
129
+ <label>Update stock</label>
130
+ <frontend_type>select</frontend_type>
131
+ <source_model>iceimport/system_config_yesno</source_model>
132
+ <sort_order>30</sort_order>
133
+ <show_in_default>1</show_in_default>
134
+ <show_in_website>1</show_in_website>
135
+ <show_in_store>1</show_in_store>
136
+ </import_stock>
137
+ <import_product_delivery_eta translate="label">
138
+ <label>Update Delivery ETA</label>
139
+ <frontend_type>select</frontend_type>
140
+ <source_model>iceimport/system_config_yesno</source_model>
141
+ <sort_order>31</sort_order>
142
+ <show_in_default>1</show_in_default>
143
+ <show_in_website>1</show_in_website>
144
+ <show_in_store>1</show_in_store>
145
+ </import_product_delivery_eta>
146
+ <update_categories_from_csv translate="label">
147
+ <label><![CDATA[Update products category]]></label>
148
+ <comment><![CDATA[]]></comment>
149
+ <frontend_type>select</frontend_type>
150
+ <source_model>iceimport/system_config_yesno</source_model>
151
+ <sort_order>32</sort_order>
152
+ <show_in_default>1</show_in_default>
153
+ <show_in_website>1</show_in_website>
154
+ <show_in_store>1</show_in_store>
155
+ </update_categories_from_csv>
156
+ <update_status_from_csv translate="label">
157
+ <label><![CDATA[Update status]]></label>
158
+ <comment><![CDATA[]]></comment>
159
+ <frontend_type>select</frontend_type>
160
+ <source_model>iceimport/system_config_yesno</source_model>
161
+ <sort_order>33</sort_order>
162
+ <show_in_default>1</show_in_default>
163
+ <show_in_website>1</show_in_website>
164
+ <show_in_store>1</show_in_store>
165
+ </update_status_from_csv>
166
+ <update_visibility_from_csv translate="label">
167
+ <label><![CDATA[Update visibility]]></label>
168
+ <comment><![CDATA[]]></comment>
169
+ <frontend_type>select</frontend_type>
170
+ <source_model>iceimport/system_config_yesno</source_model>
171
+ <sort_order>34</sort_order>
172
+ <show_in_default>1</show_in_default>
173
+ <show_in_website>1</show_in_website>
174
+ <show_in_store>1</show_in_store>
175
+ </update_visibility_from_csv>
176
+ <update_is_in_stock_from_csv translate="label">
177
+ <label><![CDATA[Update stock availability]]></label>
178
+ <comment><![CDATA[]]></comment>
179
+ <frontend_type>select</frontend_type>
180
+ <source_model>iceimport/system_config_yesno</source_model>
181
+ <sort_order>35</sort_order>
182
+ <show_in_default>1</show_in_default>
183
+ <show_in_website>1</show_in_website>
184
+ <show_in_store>1</show_in_store>
185
+ </update_is_in_stock_from_csv>
186
+ <update_url_key_from_csv translate="label">
187
+ <label><![CDATA[Update URL key]]></label>
188
+ <comment><![CDATA[]]></comment>
189
+ <frontend_type>select</frontend_type>
190
+ <source_model>iceimport/system_config_yesno</source_model>
191
+ <sort_order>36</sort_order>
192
+ <show_in_default>1</show_in_default>
193
+ <show_in_website>1</show_in_website>
194
+ <show_in_store>1</show_in_store>
195
+ </update_url_key_from_csv>
196
+ <import_images translate="label">
197
+ <label>Import product images (via Cron)</label>
198
+ <frontend_type>select</frontend_type>
199
+ <source_model>iceimport/system_config_yesno</source_model>
200
+ <sort_order>37</sort_order>
201
+ <show_in_default>1</show_in_default>
202
+ <show_in_website>1</show_in_website>
203
+ <show_in_store>1</show_in_store>
204
+ </import_images>
205
+ <is_reindex_required_import translate="label comment">
206
+ <label>Re-index Required</label>
207
+ <comment>Choose run re-index all the content after finishing ICEimport or not.</comment>
208
+ <frontend_type>select</frontend_type>
209
+ <source_model>iceimport/system_config_yesno</source_model>
210
+ <sort_order>38</sort_order>
211
+ <show_in_default>1</show_in_default>
212
+ <show_in_website>1</show_in_website>
213
+ <show_in_store>1</show_in_store>
214
+ </is_reindex_required_import>
215
+ <iceimport_profile translate="label">
216
+ <label><![CDATA[Profile]]></label>
217
+ <comment><![CDATA[Import profile]]></comment>
218
+ <frontend_type>select</frontend_type>
219
+ <source_model>iceimport/system_config_profiles</source_model>
220
+ <sort_order>39</sort_order>
221
+ <show_in_default>1</show_in_default>
222
+ <show_in_website>1</show_in_website>
223
+ <show_in_store>1</show_in_store>
224
+ </iceimport_profile>
225
+ <cron_settings>
226
+ <label>When you want to run cron ?</label>
227
+ <frontend_type>text</frontend_type>
228
+ <sort_order>40</sort_order>
229
+ <validate>required-entry</validate>
230
+ <comment>Use Crontab Format (Eg. "30 7 * * *" in 7:30 AM). Don't forget `Flush Magento Cache` and `Flush Cache Storage` after changes.</comment>
231
+ <show_in_default>1</show_in_default>
232
+ </cron_settings>
233
+ <attributes_mapping translate="label">
234
+ <label>Attributes mapping</label>
235
+ <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
236
+ <sort_order>50</sort_order>
237
+ <show_in_default>1</show_in_default>
238
+ <show_in_website>1</show_in_website>
239
+ <show_in_store>1</show_in_store>
240
+ </attributes_mapping>
241
+ <attribute_mapping_mpn translate="label">
242
+ <label>MPN</label>
243
+ <comment>Choose the attribute to use for mapping (In older version was used "mpn" attribute).</comment>
244
+ <frontend_type>select</frontend_type>
245
+ <source_model>iceimport/system_config_fields_attributes</source_model>
246
+ <sort_order>51</sort_order>
247
+ <validate>required-entry</validate>
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
+ </attribute_mapping_mpn>
252
+ <attribute_mapping_brand_name translate="label">
253
+ <label>Brand</label>
254
+ <comment>Choose the attribute to use for mapping (In older version was used "brand" attribute).</comment>
255
+ <frontend_type>select</frontend_type>
256
+ <source_model>iceimport/system_config_fields_attributes</source_model>
257
+ <sort_order>52</sort_order>
258
+ <validate>required-entry</validate>
259
+ <show_in_default>1</show_in_default>
260
+ <show_in_website>1</show_in_website>
261
+ <show_in_store>1</show_in_store>
262
+ </attribute_mapping_brand_name>
263
+ <attribute_mapping_ean translate="label">
264
+ <label>GTIN</label>
265
+ <comment>Choose the attribute to use for mapping (In older version was used "ean" attribute).</comment>
266
+ <frontend_type>select</frontend_type>
267
+ <source_model>iceimport/system_config_fields_attributes</source_model>
268
+ <sort_order>53</sort_order>
269
+ <validate>required-entry</validate>
270
+ <show_in_default>1</show_in_default>
271
+ <show_in_website>1</show_in_website>
272
+ <show_in_store>1</show_in_store>
273
+ </attribute_mapping_ean>
274
+ <attribute_mapping_delivery_eta translate="label">
275
+ <label>Delivery ETA</label>
276
+ <comment>Choose the attribute to use for mapping (In older version was used "delivery_eta" attribute).</comment>
277
+ <frontend_type>select</frontend_type>
278
+ <source_model>iceimport/system_config_fields_attributes</source_model>
279
+ <sort_order>54</sort_order>
280
+ <show_in_default>1</show_in_default>
281
+ <show_in_website>1</show_in_website>
282
+ <show_in_store>1</show_in_store>
283
+ </attribute_mapping_delivery_eta>
284
+ <websites translate="label">
285
+ <label>Websites</label>
286
+ <validate>required-entry</validate>
287
+ <frontend_type>select</frontend_type>
288
+ <source_model>iceimport/system_config_websites</source_model>
289
+ <sort_order>55</sort_order>
290
+ <show_in_default>1</show_in_default>
291
+ <show_in_website>1</show_in_website>
292
+ <show_in_store>1</show_in_store>
293
+ </websites>
294
+ <stock_inventory translate="label">
295
+ <label>Stock Name</label>
296
+ <validate>required-entry</validate>
297
+ <frontend_type>select</frontend_type>
298
+ <source_model>iceimport/system_config_stock</source_model>
299
+ <sort_order>56</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
+ </stock_inventory>
304
+ <refresh_settings_heading translate="label">
305
+ <label>Import Parameters</label>
306
+ <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
307
+ <sort_order>120</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
+ </refresh_settings_heading>
312
+ <iceimport_batch_size translate="label">
313
+ <label><![CDATA[Batch size]]></label>
314
+ <comment><![CDATA[]]></comment>
315
+ <frontend_type>text</frontend_type>
316
+ <validate>validate-greater-than-zero</validate>
317
+ <sort_order>130</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
+ </iceimport_batch_size>
322
+ <import_new_products translate="label">
323
+ <label>Import new products</label>
324
+ <comment><![CDATA[Add products from import file if they aren't presented in shop's assortment.]]></comment>
325
+ <frontend_type>select</frontend_type>
326
+ <source_model>iceimport/system_config_yesno</source_model>
327
+ <sort_order>138</sort_order>
328
+ <show_in_default>1</show_in_default>
329
+ <show_in_website>1</show_in_website>
330
+ <show_in_store>1</show_in_store>
331
+ </import_new_products>
332
+ <delete_old_products translate="label">
333
+ <label>Remove old products</label>
334
+ <comment><![CDATA[Remove products marked as <strong>"is_iceimport"</strong> and not presented in import file.]]></comment>
335
+ <frontend_type>select</frontend_type>
336
+ <source_model>iceimport/system_config_yesno</source_model>
337
+ <sort_order>139</sort_order>
338
+ <show_in_default>1</show_in_default>
339
+ <show_in_website>1</show_in_website>
340
+ <show_in_store>1</show_in_store>
341
+ </delete_old_products>
342
+ <delete_old_products_tolerance translate="label">
343
+ <label><![CDATA[Tolerance of difference (%)]]></label>
344
+ <comment><![CDATA[If difference is greater than this value - remove process will be cancelled.]]></comment>
345
+ <frontend_type>text</frontend_type>
346
+ <validate>validate-greater-than-zero validate-percents</validate>
347
+ <sort_order>140</sort_order>
348
+ <show_in_default>1</show_in_default>
349
+ <show_in_website>1</show_in_website>
350
+ <show_in_store>1</show_in_store>
351
+ <depends>
352
+ <delete_old_products>1</delete_old_products>
353
+ </depends>
354
+ </delete_old_products_tolerance>
355
+ <category_active translate="label">
356
+ <label>Set to active imported categories</label>
357
+ <frontend_type>select</frontend_type>
358
+ <source_model>iceimport/system_config_yesno</source_model>
359
+ <sort_order>141</sort_order>
360
+ <show_in_default>1</show_in_default>
361
+ <show_in_website>1</show_in_website>
362
+ <show_in_store>1</show_in_store>
363
+ </category_active>
364
+ <category_sort translate="label">
365
+ <label>Sort categories in ASC order</label>
366
+ <frontend_type>select</frontend_type>
367
+ <source_model>iceimport/system_config_yesno</source_model>
368
+ <sort_order>142</sort_order>
369
+ <show_in_default>1</show_in_default>
370
+ <show_in_website>1</show_in_website>
371
+ <show_in_store>1</show_in_store>
372
+ </category_sort>
373
+ <update_hide_category translate="label">
374
+ <label><![CDATA[Hide empty category]]></label>
375
+ <comment><![CDATA[]]></comment>
376
+ <frontend_type>select</frontend_type>
377
+ <source_model>iceimport/system_config_yesno</source_model>
378
+ <sort_order>143</sort_order>
379
+ <show_in_default>1</show_in_default>
380
+ <show_in_website>1</show_in_website>
381
+ <show_in_store>1</show_in_store>
382
+ </update_hide_category>
383
+ <default_tax translate="label">
384
+ <label>Default tax for product</label>
385
+ <frontend_type>select</frontend_type>
386
+ <source_model>iceimport/system_config_defaulttax</source_model>
387
+ <sort_order>144</sort_order>
388
+ <show_in_default>1</show_in_default>
389
+ <show_in_website>1</show_in_website>
390
+ <show_in_store>1</show_in_store>
391
+ </default_tax>
392
+ <transactions_enabled translate="label">
393
+ <label>Transactions enabled</label>
394
+ <frontend_type>select</frontend_type>
395
+ <source_model>iceimport/system_config_yesno</source_model>
396
+ <sort_order>145</sort_order>
397
+ <show_in_default>1</show_in_default>
398
+ <show_in_website>1</show_in_website>
399
+ <show_in_store>1</show_in_store>
400
+ </transactions_enabled>
401
+ <images_queue_processing_only translate="label">
402
+ <label><![CDATA[ImagesQueueProcessing only]]></label>
403
+ <comment><![CDATA[Run <strong>ONLY</strong> images queue processing instead of whole actions stack. Setting used <strong>ONLY</strong> while running via Cron.]]></comment>
404
+ <frontend_type>select</frontend_type>
405
+ <source_model>iceimport/system_config_yesno</source_model>
406
+ <sort_order>147</sort_order>
407
+ <show_in_default>1</show_in_default>
408
+ <show_in_website>1</show_in_website>
409
+ <show_in_store>1</show_in_store>
410
+ </images_queue_processing_only>
411
+ </fields>
412
+ </importprod>
413
+ </groups>
414
+ </iceshop_iceimport_importprod_root>
415
+ <iceimport_information translate="label" module="iceimport">
416
+ <label>IceImport Information</label>
417
+ <tab>iceshop</tab>
418
+ <sort_order>40</sort_order>
419
+ <show_in_default>1</show_in_default>
420
+ <show_in_website>1</show_in_website>
421
+ <show_in_store>1</show_in_store>
422
+ <comment><![CDATA[]]></comment>
423
+ <groups>
424
+ <dashboard translate="label comment">
425
+ <label>Dashboard</label>
426
+ <sort_order>50</sort_order>
427
+ <show_in_default>1</show_in_default>
428
+ <show_in_website>1</show_in_website>
429
+ <show_in_store>1</show_in_store>
430
+ <comment><![CDATA[<span style="color: grey;">Loading...</span>]]></comment>
431
+ <fields>
432
+ <check_system_hidden translate="label comment">
433
+ <label></label>
434
+ <comment></comment>
435
+ <frontend_type>select</frontend_type>
436
+ <source_model>iceimport/system_config_checksystem</source_model>
437
+ <sort_order>10</sort_order>
438
+ <show_in_default>1</show_in_default>
439
+ <show_in_website>1</show_in_website>
440
+ <show_in_store>1</show_in_store>
441
+ </check_system_hidden>
442
+ </fields>
443
+ </dashboard>
444
+ </groups>
445
+ </iceimport_information>
446
+ <iceshop_about translate="label" module="iceimport">
447
+ <label>Iceshop</label>
448
+ <tab>iceshop</tab>
449
+ <class>iceshop-info-section</class>
450
+ <header_css>iceshop-info-header</header_css>
451
+ <frontend_type>text</frontend_type>
452
+ <sort_order>100</sort_order>
453
+ <show_in_default>1</show_in_default>
454
+ <show_in_website>1</show_in_website>
455
+ <show_in_store>1</show_in_store>
456
+ <comment><![CDATA[]]></comment>
457
+ <groups>
458
+ <iceshop_iframe translate="label comment">
459
+ <label>More about Iceshop</label>
460
+ <sort_order>50</sort_order>
461
+ <show_in_default>1</show_in_default>
462
+ <show_in_website>1</show_in_website>
463
+ <show_in_store>1</show_in_store>
464
+ <comment><![CDATA[<span style="color: grey;">Loading...</span>]]></comment>
465
+ <fields>
466
+ <iceshop_iframe_hidden translate="label comment">
467
+ <label></label>
468
+ <comment></comment>
469
+ <frontend_type>select</frontend_type>
470
+ <source_model>iceimport/system_config_iceshoplink</source_model>
471
+ <sort_order>10</sort_order>
472
+ <show_in_default>1</show_in_default>
473
+ <show_in_website>1</show_in_website>
474
+ <show_in_store>1</show_in_store>
475
+ </iceshop_iframe_hidden>
476
+ </fields>
477
+ </iceshop_iframe>
478
+ </groups>
479
+ </iceshop_about>
480
+ </sections>
481
+ </config>
app/code/community/ICEshop/Iceimport/sql/iceimport_setup/{mysql4-install-1.7.15.php → mysql4-install-1.7.22.php} RENAMED
@@ -1,75 +1,79 @@
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_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')}`
43
- (`entity_type_id`, `attribute_id`, `entity_id`, `value`)
44
- SELECT '{$entityTypeId}', '{$attributeId}', `entity_id`, '1'
45
- FROM `{$installer->getTable('catalog_category_entity')}`;
46
-
47
- CREATE TABLE IF NOT EXISTS `{$installer->getTable('iceshop_iceimport_image_queue')}` (
48
- `queue_id` INT(10) NOT NULL AUTO_INCREMENT,
49
- `entity_id` INT(10) UNSIGNED NOT NULL,
50
- `image_url` VARCHAR(255) NOT NULL,
51
- `is_downloaded` TINYINT NOT NULL DEFAULT 0,
52
- PRIMARY KEY(`queue_id`),
53
- UNIQUE KEY (`entity_id`, `image_url`),
54
- 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
55
- )ENGINE=InnoDB CHARSET=utf8 COMMENT='Table to manage product image import';
56
-
57
- CREATE TABLE IF NOT EXISTS `{$installer->getTable('iceshop_iceimport_imported_product_ids')}` (
58
- `product_id` int(11) NOT NULL,
59
- `product_sku` varchar(255) DEFAULT NULL,
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,
67
- `log_type` VARCHAR(10) NOT NULL DEFAULT 'info',
68
- `timecol` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
69
- UNIQUE KEY (`log_key`),
70
- KEY `IDX_LOG_TYPE` (`log_type`),
71
- KEY `IDX_TIMECOL` (`timecol`)
72
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Iceshop Connector logs';
73
- ");
74
-
75
- $installer->endSetup();
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+ $installer->startSetup();
5
+
6
+ $entityTypeId = $installer->getEntityTypeId('catalog_category');
7
+ $attributeSetId = $installer->getDefaultAttributeSetId($entityTypeId);
8
+ $attributeGroupId = $installer->getDefaultAttributeGroupId($entityTypeId, $attributeSetId);
9
+
10
+ $installer->addAttribute('catalog_category', 'unspsc', array(
11
+ 'type' => 'varchar',
12
+ 'label' => 'unspsc',
13
+ 'input' => 'text',
14
+ 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
15
+ 'visible' => true,
16
+ 'required' => false,
17
+ 'user_defined' => false,
18
+ 'default' => 0
19
+ ));
20
+
21
+ $installer->addAttributeToGroup(
22
+ $entityTypeId,
23
+ $attributeSetId,
24
+ $attributeGroupId,
25
+ 'unspsc',
26
+ '11'
27
+ );
28
+
29
+ $attributeId = $installer->getAttributeId($entityTypeId, 'unspsc');
30
+
31
+ $installer->run("
32
+
33
+ DROP TABLE IF EXISTS `{$installer->getTable('iceimport_imported_product_ids')}`;
34
+ DROP TABLE IF EXISTS `{$installer->getTable('capacity_product_image_queue')}`;
35
+ DROP TABLE IF EXISTS `{$installer->getTable('iceshop_iceimport_image_queue')}`;
36
+ DROP TABLE IF EXISTS `{$installer->getTable('iceshop_iceimport_imported_product_ids')}`;
37
+ DROP TABLE IF EXISTS `{$installer->getTable('iceshop_extensions_logs')}`;
38
+
39
+
40
+ INSERT IGNORE INTO `{$installer->getTable('catalog_category_entity_varchar')}`
41
+ (`entity_type_id`, `attribute_id`, `entity_id`, `value`)
42
+ SELECT '{$entityTypeId}', '{$attributeId}', `entity_id`, '1'
43
+ FROM `{$installer->getTable('catalog_category_entity')}`;
44
+
45
+ CREATE TABLE IF NOT EXISTS `{$installer->getTable('iceshop_iceimport_image_queue')}` (
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_id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
63
+ `log_key` VARCHAR(255) NOT NULL,
64
+ `log_value` TEXT,
65
+ `log_type` VARCHAR(10) NOT NULL DEFAULT 'info',
66
+ `timecol` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
67
+ UNIQUE KEY (`log_key`),
68
+ KEY `IDX_LOG_TYPE` (`log_type`),
69
+ KEY `IDX_TIMECOL` (`timecol`)
70
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Iceshop Connector logs';
71
+ ");
72
+
73
+ $installer->run("
74
+ INSERT IGNORE INTO `{$installer->getTable('iceshop_extensions_logs')}`
75
+ SET `log_key` = 'first_start', `log_value` = 'yes', `log_type` = 'info';
76
+ ");
77
+
78
+ $installer->endSetup();
79
+
app/code/community/ICEshop/Iceimport/sql/iceimport_setup/mysql4-upgrade-0.1.0-1.7.0.php DELETED
@@ -1,69 +0,0 @@
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_iceimport_imported_product_ids')}`;
38
- DROP TABLE IF EXISTS `{$installer->getTable('iceshop_iceimport_image_queue')}`;
39
-
40
- INSERT IGNORE INTO `{$installer->getTable('catalog_category_entity_varchar')}`
41
- (`entity_type_id`, `attribute_id`, `entity_id`, `value`)
42
- SELECT '{$entityTypeId}', '{$attributeId}', `entity_id`, '1'
43
- FROM `{$installer->getTable('catalog_category_entity')}`;
44
-
45
- CREATE TABLE IF NOT EXISTS `{$installer->getTable('iceshop_iceimport_image_queue')}`
46
- (
47
- `queue_id` INT(10) NOT NULL AUTO_INCREMENT,
48
- `entity_id` INT(10) UNSIGNED NOT NULL,
49
- `image_url` VARCHAR(255) NOT NULL,
50
- `is_downloaded` TINYINT NOT NULL DEFAULT 0,
51
- PRIMARY KEY(`queue_id`),
52
- UNIQUE KEY (`entity_id`, `image_url`),
53
- 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
54
- )ENGINE=InnoDB CHARSET=utf8 COMMENT='Table to manage product image import';
55
-
56
- CREATE TABLE IF NOT EXISTS `{$installer->getTable('iceshop_iceimport_imported_product_ids')}` (
57
- `product_id` int(11) NOT NULL,
58
- `product_sku` varchar(255) DEFAULT NULL,
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`)
66
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Iceshop Connector logs';
67
- ");
68
-
69
- $installer->endSetup();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/ICEshop/Iceimport/sql/iceimport_setup/mysql4-upgrade-1.4.0-1.7.0.php DELETED
@@ -1,69 +0,0 @@
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_iceimport_imported_product_ids')}`;
38
- DROP TABLE IF EXISTS `{$installer->getTable('iceshop_iceimport_image_queue')}`;
39
-
40
- INSERT IGNORE INTO `{$installer->getTable('catalog_category_entity_varchar')}`
41
- (`entity_type_id`, `attribute_id`, `entity_id`, `value`)
42
- SELECT '{$entityTypeId}', '{$attributeId}', `entity_id`, '1'
43
- FROM `{$installer->getTable('catalog_category_entity')}`;
44
-
45
- CREATE TABLE IF NOT EXISTS `{$installer->getTable('iceshop_iceimport_image_queue')}`
46
- (
47
- `queue_id` INT(10) NOT NULL AUTO_INCREMENT,
48
- `entity_id` INT(10) UNSIGNED NOT NULL,
49
- `image_url` VARCHAR(255) NOT NULL,
50
- `is_downloaded` TINYINT NOT NULL DEFAULT 0,
51
- PRIMARY KEY(`queue_id`),
52
- UNIQUE KEY (`entity_id`, `image_url`),
53
- 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
54
- )ENGINE=InnoDB CHARSET=utf8 COMMENT='Table to manage product image import';
55
-
56
- CREATE TABLE IF NOT EXISTS `{$installer->getTable('iceshop_iceimport_imported_product_ids')}` (
57
- `product_id` int(11) NOT NULL,
58
- `product_sku` varchar(255) DEFAULT NULL,
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`)
66
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Iceshop Connector logs';
67
- ");
68
-
69
- $installer->endSetup();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/ICEshop/Iceimport/sql/iceimport_setup/mysql4-upgrade-1.5.0-1.7.0.php DELETED
@@ -1,67 +0,0 @@
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
-
38
- INSERT IGNORE INTO `{$installer->getTable('catalog_category_entity_varchar')}`
39
- (`entity_type_id`, `attribute_id`, `entity_id`, `value`)
40
- SELECT '{$entityTypeId}', '{$attributeId}', `entity_id`, '1'
41
- FROM `{$installer->getTable('catalog_category_entity')}`;
42
-
43
- CREATE TABLE IF NOT EXISTS `{$installer->getTable('iceshop_iceimport_image_queue')}`
44
- (
45
- `queue_id` INT(10) NOT NULL AUTO_INCREMENT,
46
- `entity_id` INT(10) UNSIGNED NOT NULL,
47
- `image_url` VARCHAR(255) NOT NULL,
48
- `is_downloaded` TINYINT NOT NULL DEFAULT 0,
49
- PRIMARY KEY(`queue_id`),
50
- UNIQUE KEY (`entity_id`, `image_url`),
51
- 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
52
- )ENGINE=InnoDB CHARSET=utf8 COMMENT='Table to manage product image import';
53
-
54
- CREATE TABLE IF NOT EXISTS `{$installer->getTable('iceshop_iceimport_imported_product_ids')}` (
55
- `product_id` int(11) NOT NULL,
56
- `product_sku` varchar(255) DEFAULT NULL,
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`)
64
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Iceshop Connector logs';
65
- ");
66
-
67
- $installer->endSetup();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/ICEshop/Iceimport/sql/iceimport_setup/mysql4-upgrade-1.6.0-1.7.0.php DELETED
@@ -1,67 +0,0 @@
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
-
38
- INSERT IGNORE INTO `{$installer->getTable('catalog_category_entity_varchar')}`
39
- (`entity_type_id`, `attribute_id`, `entity_id`, `value`)
40
- SELECT '{$entityTypeId}', '{$attributeId}', `entity_id`, '1'
41
- FROM `{$installer->getTable('catalog_category_entity')}`;
42
-
43
- CREATE TABLE IF NOT EXISTS `{$installer->getTable('iceshop_iceimport_image_queue')}`
44
- (
45
- `queue_id` INT(10) NOT NULL AUTO_INCREMENT,
46
- `entity_id` INT(10) UNSIGNED NOT NULL,
47
- `image_url` VARCHAR(255) NOT NULL,
48
- `is_downloaded` TINYINT NOT NULL DEFAULT 0,
49
- PRIMARY KEY(`queue_id`),
50
- UNIQUE KEY (`entity_id`, `image_url`),
51
- 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
52
- )ENGINE=InnoDB CHARSET=utf8 COMMENT='Table to manage product image import';
53
-
54
- CREATE TABLE IF NOT EXISTS `{$installer->getTable('iceshop_iceimport_imported_product_ids')}` (
55
- `product_id` int(11) NOT NULL,
56
- `product_sku` varchar(255) DEFAULT NULL,
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`)
64
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Iceshop Connector logs';
65
- ");
66
-
67
- $installer->endSetup();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/ICEshop/Iceimport/sql/iceimport_setup/mysql4-upgrade-1.6.0-1.7.5.php DELETED
@@ -1,87 +0,0 @@
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.14-1.7.15.php DELETED
@@ -1,75 +0,0 @@
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_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')}`
43
- (`entity_type_id`, `attribute_id`, `entity_id`, `value`)
44
- SELECT '{$entityTypeId}', '{$attributeId}', `entity_id`, '1'
45
- FROM `{$installer->getTable('catalog_category_entity')}`;
46
-
47
- CREATE TABLE IF NOT EXISTS `{$installer->getTable('iceshop_iceimport_image_queue')}` (
48
- `queue_id` INT(10) NOT NULL AUTO_INCREMENT,
49
- `entity_id` INT(10) UNSIGNED NOT NULL,
50
- `image_url` VARCHAR(255) NOT NULL,
51
- `is_downloaded` TINYINT NOT NULL DEFAULT 0,
52
- PRIMARY KEY(`queue_id`),
53
- UNIQUE KEY (`entity_id`, `image_url`),
54
- 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
55
- )ENGINE=InnoDB CHARSET=utf8 COMMENT='Table to manage product image import';
56
-
57
- CREATE TABLE IF NOT EXISTS `{$installer->getTable('iceshop_iceimport_imported_product_ids')}` (
58
- `product_id` int(11) NOT NULL,
59
- `product_sku` varchar(255) DEFAULT NULL,
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,
67
- `log_type` VARCHAR(10) NOT NULL DEFAULT 'info',
68
- `timecol` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
69
- UNIQUE KEY (`log_key`),
70
- KEY `IDX_LOG_TYPE` (`log_type`),
71
- KEY `IDX_TIMECOL` (`timecol`)
72
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Iceshop Connector logs';
73
- ");
74
-
75
- $installer->endSetup();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/ICEshop/Iceimport/sql/iceimport_setup/mysql4-upgrade-1.7.15-1.7.22.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*$file = 'text.txt';
4
+ $version_greeting = 'Hello from 1.7.15 - 1.7.22';
5
+ file_put_contents($file, $version_greeting, FILE_APPEND);*/
6
+
7
+ include_once('upgrade_run.php');
app/code/community/ICEshop/Iceimport/sql/iceimport_setup/mysql4-upgrade-1.7.16-1.7.22.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*$file = 'text.txt';
4
+ $version_greeting = 'Hello from 1.7.16 - 1.7.22';
5
+ file_put_contents($file, $version_greeting, FILE_APPEND);*/
6
+
7
+ include_once('upgrade_run.php');
app/code/community/ICEshop/Iceimport/sql/iceimport_setup/mysql4-upgrade-1.7.17-1.7.22.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*$file = 'text.txt';
4
+ $version_greeting = 'Hello from 1.7.17 - 1.7.22';
5
+ file_put_contents($file, $version_greeting, FILE_APPEND);*/
6
+
7
+ include_once('upgrade_run.php');
app/code/community/ICEshop/Iceimport/sql/iceimport_setup/mysql4-upgrade-1.7.18-1.7.22.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*$file = 'text.txt';
4
+ $version_greeting = 'Hello from 1.7.18 - 1.7.22';
5
+ file_put_contents($file, $version_greeting, FILE_APPEND);*/
6
+
7
+ include_once('upgrade_run.php');
app/code/community/ICEshop/Iceimport/sql/iceimport_setup/mysql4-upgrade-1.7.19-1.7.22.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*$file = 'text.txt';
4
+ $version_greeting = 'Hello from 1.7.19 - 1.7.22';
5
+ file_put_contents($file, $version_greeting, FILE_APPEND);*/
6
+
7
+ include_once('upgrade_run.php');
app/code/community/ICEshop/Iceimport/sql/iceimport_setup/mysql4-upgrade-1.7.20-1.7.22.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*$file = 'text.txt';
4
+ $version_greeting = 'Hello from 1.7.20 - 1.7.22';
5
+ file_put_contents($file, $version_greeting, FILE_APPEND);*/
6
+
7
+ include_once('upgrade_run.php');
app/code/community/ICEshop/Iceimport/sql/iceimport_setup/mysql4-upgrade-1.7.21-1.7.22.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*$file = 'text.txt';
4
+ $version_greeting = 'Hello from 1.7.21 - 1.7.22';
5
+ file_put_contents($file, $version_greeting, FILE_APPEND);*/
6
+
7
+ include_once('upgrade_run.php');
app/code/community/ICEshop/Iceimport/sql/iceimport_setup/mysql4-upgrade-1.7.5-1.7.9.php DELETED
@@ -1,87 +0,0 @@
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 DELETED
@@ -1,87 +0,0 @@
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.8-1.7.22.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*$file = 'text.txt';
4
+ $version_greeting = 'Hello from 1.7.8 - 1.7.22';
5
+ file_put_contents($file, $version_greeting, FILE_APPEND);*/
6
+
7
+ include_once('upgrade_run.php');
8
+
9
+
app/code/community/ICEshop/Iceimport/sql/iceimport_setup/mysql4-upgrade-1.7.9-1.7.13 DELETED
@@ -1,75 +0,0 @@
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_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')}`
43
- (`entity_type_id`, `attribute_id`, `entity_id`, `value`)
44
- SELECT '{$entityTypeId}', '{$attributeId}', `entity_id`, '1'
45
- FROM `{$installer->getTable('catalog_category_entity')}`;
46
-
47
- CREATE TABLE IF NOT EXISTS `{$installer->getTable('iceshop_iceimport_image_queue')}` (
48
- `queue_id` INT(10) NOT NULL AUTO_INCREMENT,
49
- `entity_id` INT(10) UNSIGNED NOT NULL,
50
- `image_url` VARCHAR(255) NOT NULL,
51
- `is_downloaded` TINYINT NOT NULL DEFAULT 0,
52
- PRIMARY KEY(`queue_id`),
53
- UNIQUE KEY (`entity_id`, `image_url`),
54
- 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
55
- )ENGINE=InnoDB CHARSET=utf8 COMMENT='Table to manage product image import';
56
-
57
- CREATE TABLE IF NOT EXISTS `{$installer->getTable('iceshop_iceimport_imported_product_ids')}` (
58
- `product_id` int(11) NOT NULL,
59
- `product_sku` varchar(255) DEFAULT NULL,
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,
67
- `log_type` VARCHAR(10) NOT NULL DEFAULT 'info',
68
- `timecol` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
69
- UNIQUE KEY (`log_key`),
70
- KEY `IDX_LOG_TYPE` (`log_type`),
71
- KEY `IDX_TIMECOL` (`timecol`)
72
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Iceshop Connector logs';
73
- ");
74
-
75
- $installer->endSetup();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/ICEshop/Iceimport/sql/iceimport_setup/uninstall-old-version.php DELETED
@@ -1,49 +0,0 @@
1
- <?php
2
-
3
- class Uninstall_Capacitywebsolutions_Importproduct
4
- {
5
- /**
6
- * Delete Iceimport extension with old namespace
7
- */
8
- public function uninstall()
9
- {
10
- $code_dir = Mage::getBaseDir('app') . '/code/community/Capacitywebsolutions/Importproduct';
11
- $etc_capacitywebsolutions_xml = Mage::getBaseDir('app') . '/etc/modules/Capacitywebsolutions_Importproduct.xml';
12
-
13
- $this->remove_dir($code_dir);
14
- $this->remove_file($etc_capacitywebsolutions_xml);
15
- }
16
-
17
- public function remove_dir($path)
18
- {
19
- if (file_exists($path) && is_dir($path)) {
20
- $dirHandle = opendir($path);
21
- while (false !== ($file = readdir($dirHandle))) {
22
- if ($file != '.' && $file != '..') {
23
- $tmpPath = $path . '/' . $file;
24
- chmod($tmpPath, 0777);
25
-
26
- if (is_dir($tmpPath)) {
27
- $this->remove_dir($tmpPath);
28
- } else {
29
- if (file_exists($tmpPath)) {
30
- unlink($tmpPath);
31
- }
32
- }
33
- }
34
- }
35
- closedir($dirHandle);
36
-
37
- if (file_exists($path)) {
38
- rmdir($path);
39
- }
40
- }
41
- }
42
-
43
- public function remove_file($path)
44
- {
45
- if (file_exists($path)) {
46
- unlink($path);
47
- }
48
- }
49
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/ICEshop/Iceimport/sql/iceimport_setup/upgrade_run.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+ $installer->startSetup();
5
+
6
+ $installer->run("
7
+ INSERT IGNORE INTO `{$installer->getTable('iceshop_extensions_logs')}`
8
+ SET `log_key` = 'first_start', `log_value` = 'yes', `log_type` = 'info';
9
+ ");
10
+
11
+ $installer->endSetup();
app/design/adminhtml/default/default/layout/ICEshop_Iceimport.xml CHANGED
@@ -1,18 +1,41 @@
1
- <?xml version="1.0"?>
2
- <layout>
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>
10
- <default>
11
- <reference name="notifications">
12
- <reference name="head">
13
- <action method="addCss"><stylesheet>iceshop/iceimport/styles.css</stylesheet></action>
14
- </reference>
15
- <block type="iceimport/adminhtml_notifications" name="iceimport_notifications" template="iceshop/iceimport/notifications.phtml"/>
16
- </reference>
17
- </default>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  </layout>
1
+ <?xml version="1.0"?>
2
+ <layout>
3
+ <adminhtml_dashboard_index>
4
+ <reference name="content">
5
+ <block type="iceimport/adminhtml_dashboard" name="iceimport_dashboard"
6
+ template="iceshop/iceimport/dashboard.phtml"/>
7
+ </reference>
8
+ <reference name="head">
9
+ <action method="addJs">
10
+ <script>ICEshop/Iceimport/jquery-1.11.1.min.js</script>
11
+ </action>
12
+ <action method="addJs">
13
+ <script>ICEshop/Iceimport/dashboard.js</script>
14
+ </action>
15
+ </reference>
16
+ </adminhtml_dashboard_index>
17
+ <adminhtml_system_config_edit>
18
+ <reference name="head">
19
+ <action method="addCss">
20
+ <stylesheet>iceshop/iceimport/styles.css</stylesheet>
21
+ </action>
22
+ <action method="addJs">
23
+ <script>ICEshop/Iceimport/jquery-1.11.1.min.js</script>
24
+ </action>
25
+ <action method="addJs">
26
+ <script>ICEshop/Iceimport/script.js</script>
27
+ </action>
28
+ </reference>
29
+ </adminhtml_system_config_edit>
30
+ <default>
31
+ <reference name="notifications">
32
+ <reference name="head">
33
+ <action method="addCss">
34
+ <stylesheet>iceshop/iceimport/styles.css</stylesheet>
35
+ </action>
36
+ </reference>
37
+ <block type="iceimport/adminhtml_notifications" name="iceimport_notifications"
38
+ template="iceshop/iceimport/notifications.phtml"/>
39
+ </reference>
40
+ </default>
41
  </layout>
app/design/adminhtml/default/default/template/iceshop/iceimport/dashboard.phtml ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="entry-edit" id="iceimport-dashboard" style="display:none">
2
+ <div class="entry-edit-head"><h4>
3
+ <?php echo $this->__('ICEImport Statistic') ?></h4>
4
+ <a href="<?php print $this->getManageUrl(); ?>"
5
+ style="float: right;"><?php echo $this->helper('iceimport')->__('Edit'); ?>
6
+ </a>
7
+ </div>
8
+ <fieldset class="np">
9
+ <div class="grid np">
10
+ <table cellspacing="0" style="border:0;" id="iceImportStatistic_table">
11
+ <thead>
12
+ <tr class="headings">
13
+ <th class="no-link"><span>Name</span></th>
14
+ <th class="no-link"><span></span>Value</span></th>
15
+ </tr>
16
+ </thead>
17
+ <tbody>
18
+ <?php foreach ($this->getStatistics() as $key => $value): ?>
19
+ <tr class="<?php echo ++$key % 2 ? '' : 'even' ?> ">
20
+ <td><?php echo $value['label']; ?></td>
21
+ <td><?php echo $value['value']; ?></td>
22
+ </tr>
23
+ <?php endforeach; ?>
24
+ <tr>
25
+ <td><?php echo $this->getProfiles('Import All Products'); ?></td>
26
+ <td><?php echo $this->getLayout()->createBlock('adminhtml/widget_button')->setType('button')
27
+ ->setClass('save')->setLabel($this->__('Run Profile in Popup'))
28
+ ->setOnClick('startProfile()')
29
+ ->toHtml(); ?>
30
+ <a href="#" style="float: right;"
31
+ onclick="editProfile();"><?php echo $this->helper('iceimport')->__('Edit'); ?>
32
+ </a>
33
+ </td>
34
+ </tr>
35
+ </tbody>
36
+ </table>
37
+ </div>
38
+ </fieldset>
39
+ </div>
40
+
41
+ <script type="text/javascript">
42
+ //run profile import/export
43
+ function startProfile() {
44
+ var profile = jQuery("#ice_export_profiles option:selected").attr('value');
45
+ if (profile != undefined || profile != null) {
46
+ var url = '<?php echo $this->getUrl('/system_convert_gui/run', array('id'=>'{profile_id}')) ?>';
47
+ var run_url = url.replace("{profile_id}", profile);
48
+ window.open(run_url);
49
+ } else {
50
+ alert("Can not run process");
51
+ }
52
+ }
53
+ //edit import/export profile
54
+ function editProfile() {
55
+ var profile = jQuery("#ice_export_profiles option:selected").attr('value');
56
+ if (profile != undefined || profile != null) {
57
+ var url = '<?php echo $this->getUrl('/system_convert_gui/edit', array('id'=>'{profile_id}')) ?>';
58
+ var run_url = url.replace("{profile_id}", profile);
59
+ window.open(run_url);
60
+ } else {
61
+ alert("Can not run process");
62
+ }
63
+ }
64
+ </script>
app/design/adminhtml/default/default/template/iceshop/iceimport/notifications.phtml CHANGED
@@ -1,20 +1,89 @@
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; ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $_problems = $this->getIceimportProblemsDigest() ?>
2
+ <?php
3
+ $priority = true;
4
+ $is_allowed = false;
5
+ try {
6
+ $is_allowed = $this->isAllowed();
7
+ } catch (Exception $e) {
8
+ }
9
+ ?>
10
+
11
+ <?php
12
+ //first launch after install module
13
+ $fistLaunch = $this->firstLaunch();
14
+ if ($fistLaunch != false && $priority):
15
+ ?>
16
+ <?php $priority = false; ?>
17
+ <div class="notification-global iceimport-warning-notification" id="iceimport-warning-notification-delete-products">
18
+ <span class="f-right">
19
+ <a href="<?php print $this->getSettingsPageWithAccepting(); ?>"
20
+ title="<?php echo $this->helper('iceimport')->__('Open in new window'); ?>"><?php echo $this->helper('iceimport')->__('Go to system settings section'); ?></a>
21
+ </span>
22
+ <strong class="label"><?php echo $this->helper('iceimport')->__('Warning'); ?></strong>
23
+ <?php echo $this->helper('iceimport')->__($fistLaunch); ?>
24
+ </div>
25
+ <?php endif; ?>
26
+
27
+ <?php if ($is_allowed == true) : ?>
28
+ <?php if (!empty($_problems) && is_array($_problems) && count($_problems) > 0 && $priority): ?>
29
+ <?php $priority = false; ?>
30
+ <div class="notification-global" id="iceimport-warning">
31
+ <span class="f-right">
32
+ <a href="<?php print $this->getManageUrl(); ?>"
33
+ title="<?php echo $this->helper('iceimport')->__('Open in new window'); ?>"><?php echo $this->helper('iceimport')->__('Go to system check section'); ?></a>
34
+ </span>
35
+ <strong class="label"><?php echo $this->helper('iceimport')->__('Warning'); ?></strong>
36
+ <?php echo $this->helper('iceimport')->__("The Iceimport extensions doesn't work properly, please go to configuration page and check the problems."); ?>
37
+ </div>
38
+ <?php endif; ?>
39
+ <?php endif; ?>
40
+
41
+ <?php
42
+ $mapping = $this->checkSetMapping();
43
+ if (($mapping != false) && $priority):
44
+ ?>
45
+ <?php $priority = false; ?>
46
+ <div class="notification-global iceimport-warning-notification" id="iceimport-warning-notification-delete-products">
47
+ <span class="f-right">
48
+ <a href="<?php print $this->getSettingsPage(); ?>"
49
+ title="<?php echo $this->helper('iceimport')->__('Open in new window'); ?>"><?php echo $this->helper('iceimport')->__('Go to system settings section'); ?></a>
50
+ </span>
51
+ <strong class="label"><?php echo $this->helper('iceimport')->__('Warning'); ?></strong>
52
+ <?php echo $this->helper('iceimport')->__($mapping); ?>
53
+ </div>
54
+ <?php endif; ?>
55
+
56
+ <?php
57
+ //warning when we try delete more products that set in config
58
+ $warning = $this->checkWarning();
59
+ if ($warning != false && $priority):
60
+ ?>
61
+ <?php $priority = false; ?>
62
+ <div class="notification-global iceimport-warning-notification" id="iceimport-warning-notification-delete-products">
63
+ <span class="f-right">
64
+ <a href="<?php print $this->getSettingsPage(); ?>"
65
+ title="<?php echo $this->helper('iceimport')->__('Open in new window'); ?>"><?php echo $this->helper('iceimport')->__('Go to system settings section'); ?></a>
66
+ </span>
67
+ <strong class="label"><?php echo $this->helper('iceimport')->__('Warning'); ?></strong>
68
+ <?php echo $this->helper('iceimport')->__($warning); ?>
69
+ </div>
70
+ <?php endif; ?>
71
+
72
+ <?php
73
+ $warning = $this->checkLastFinishedImport();
74
+ if ($warning != false && $priority):
75
+ ?>
76
+ <?php $priority = false; ?>
77
+ <div class="notification-global iceimport-warning-notification" id="iceimport-warning-notification">
78
+ <span class="f-right">
79
+ <a href="<?php print $this->getManageUrl(); ?>"
80
+ title="<?php echo $this->helper('iceimport')->__('Open in new window'); ?>"><?php echo $this->helper('iceimport')->__('Go to system check section'); ?></a>
81
+ </span>
82
+ <strong class="label"><?php echo $this->helper('iceimport')->__('Warning'); ?></strong>
83
+ <?php echo $this->helper('iceimport')->__($warning); ?>
84
+ </div>
85
+ <?php endif; ?>
86
+
87
+
88
+
89
+
app/etc/modules/ICEshop_Iceimport.xml CHANGED
@@ -1,9 +1,9 @@
1
- <?xml version="1.0"?>
2
- <config>
3
- <modules>
4
- <ICEshop_Iceimport>
5
- <active>true</active>
6
- <codePool>community</codePool>
7
- </ICEshop_Iceimport>
8
- </modules>
9
- </config>
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <ICEshop_Iceimport>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </ICEshop_Iceimport>
8
+ </modules>
9
+ </config>
js/ICEshop/Iceimport/dashboard.js ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //prevent conflict of Prototype and jQuery libraries
2
+ jQuery.noConflict();
3
+
4
+ //script which starts after page is loaded
5
+ jQuery(document).ready(function (jQuery) {
6
+ var block = jQuery('#iceimport-dashboard');
7
+ if (block.length > 0) {
8
+ var target = jQuery("#topSearchGrid_table").parents('.entry-edit');
9
+ if (target.length > 0) {
10
+ target.append(block);
11
+ block.show();
12
+ } else {
13
+ var findTd = jQuery('.entry-edit').eq(0).parents('table').find('td').eq(0);
14
+ if (findTd.length > 0) {
15
+ findTd.append(block);
16
+ block.show();
17
+ }
18
+ }
19
+ }
20
+
21
+
22
+ });
js/ICEshop/Iceimport/jquery-1.11.1.min.js CHANGED
@@ -1,4 +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});
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/script.js CHANGED
@@ -1,247 +1,277 @@
1
- //prevent conflict of Prototype and jQuery libraries
2
- jQuery.noConflict();
3
-
4
- //script which starts after page is loaded
5
- jQuery(document).ready(function ( jQuery ) {
6
-
7
- jQuery('div#content').on('click', 'a.section-toggler-iceimport', function(e){
8
- toggleIceimportFieldset(this);
9
- e.preventDefault();
10
- });
11
-
12
- jQuery('div#content').on('click.go-to-section', 'a.section-toggler-trigger-iceimport', function(e){
13
- var handler = jQuery(this);
14
- var section = handler.data('href');
15
- if (typeof section != 'undefined') {
16
- toggleIceimportFieldset(jQuery(section).next('.entry-edit').find('.section-toggler-iceimport'), 'open');
17
- }
18
- });
19
-
20
- refreshIceimportSystemCheck();
21
-
22
- buildIceshopInfo();
23
- });
24
-
25
- function buildIceshopInfo()
26
- {
27
- var iceshop_info_handler = jQuery('#iceshop_about_iceshop_iframe');
28
- if (iceshop_info_handler.length > 0) {
29
- var iceshop_info_el = jQuery('#iceshop_about_iceshop_iframe_iceshop_iframe_hidden', iceshop_info_handler);
30
- var iceshop_info_url = Base64.decode(iceshop_info_el.find('option')[0].innerHTML);
31
- var wrapper = iceshop_info_el.closest('form#config_edit_form div.entry-edit');
32
- wrapper.find('div.section-config').remove();
33
- var iceshop_info_iframe_el = jQuery('<iframe></iframe>')
34
- .attr('src', iceshop_info_url)
35
- .attr('width', '100%')
36
- .attr('height', '1000')
37
- .text('Your browser doesn\'t work with iframe elements');
38
- iceshop_info_iframe_el.appendTo(wrapper);
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') {
46
- var checking_dashboard = jQuery('#iceimport_information_dashboard');
47
- if (checking_dashboard.length > 0) {
48
- //we're on dashboard page, lod the code
49
- var request_url_el = jQuery('#iceimport_information_dashboard_check_system_hidden', checking_dashboard);
50
- var request_url = Base64.decode(request_url_el.find('option')[0].innerHTML);
51
- request_url_el.closest('table').remove();
52
- jQuery.getJSON(
53
- request_url,
54
- function (response) {
55
- if (typeof response.structure != 'undefined') {
56
- jQuery('div.entry-edit').html(response.structure);
57
- }
58
- if (typeof response.refresh_btn != 'undefined') {
59
- jQuery('div.entry-edit').closest('div.main-col-inner').find('div.content-header').find('table td.form-buttons').html(response.refresh_btn);
60
- jQuery('div.content-header-floating').find('table td.form-buttons').html(response.refresh_btn);
61
- }
62
- }
63
- );
64
- }
65
- } else {
66
- jQuery.getJSON(
67
- Base64.decode(url_string),
68
- function (response) {
69
- if (typeof response.structure != 'undefined') {
70
- jQuery('div.entry-edit').html(response.structure);
71
- }
72
- if (typeof response.refresh_btn != 'undefined') {
73
- jQuery('div.entry-edit').closest('div.main-col-inner').find('div.content-header').find('table td.form-buttons').html(response.refresh_btn);
74
- jQuery('div.content-header-floating').find('table td.form-buttons').html(response.refresh_btn);
75
- }
76
- }
77
- );
78
- }
79
- };
80
-
81
- function toggleIceimportFieldset(element, action_type)
82
- {
83
- if (typeof element != 'undefined') {
84
- if (typeof action_type != 'undefined') {
85
- switch(action_type) {
86
- case 'open':
87
- var handler = jQuery(element);
88
- console.log(element);
89
- if (!handler.hasClass('open')) {
90
- handler.toggleClass('open');
91
- handler.closest('.entry-edit').find('div.fieldset').toggleClass('iceimport-hidden');
92
- }
93
- return true;
94
- break;
95
- case 'close':
96
- var handler = jQuery(element);
97
- if (handler.hasClass('open')) {
98
- handler.toggleClass('open');
99
- handler.closest('.entry-edit').find('div.fieldset').toggleClass('iceimport-hidden');
100
- }
101
- return true;
102
- break;
103
- }
104
- } else {
105
- var handler = jQuery(element);
106
- handler.toggleClass('open');
107
- handler.closest('.entry-edit').find('div.fieldset').toggleClass('iceimport-hidden');
108
- return true;
109
- }
110
- }
111
- return false;
112
- };
113
-
114
- var Base64 = {
115
- // private property
116
- _keyStr: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
117
-
118
- // public method for encoding
119
- encode: function (input) {
120
- var output = "";
121
- var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
122
- var i = 0;
123
-
124
- input = Base64._utf8_encode(input);
125
-
126
- while (i < input.length) {
127
-
128
- chr1 = input.charCodeAt(i++);
129
- chr2 = input.charCodeAt(i++);
130
- chr3 = input.charCodeAt(i++);
131
-
132
- enc1 = chr1 >> 2;
133
- enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
134
- enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
135
- enc4 = chr3 & 63;
136
-
137
- if (isNaN(chr2)) {
138
- enc3 = enc4 = 64;
139
- } else if (isNaN(chr3)) {
140
- enc4 = 64;
141
- }
142
-
143
- output = output +
144
- Base64._keyStr.charAt(enc1) + Base64._keyStr.charAt(enc2) +
145
- Base64._keyStr.charAt(enc3) + Base64._keyStr.charAt(enc4);
146
-
147
- }
148
-
149
- return output;
150
- },
151
-
152
- // public method for decoding
153
- decode: function (input) {
154
- var output = "";
155
- var chr1, chr2, chr3;
156
- var enc1, enc2, enc3, enc4;
157
- var i = 0;
158
-
159
- input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
160
-
161
- while (i < input.length) {
162
-
163
- enc1 = Base64._keyStr.indexOf(input.charAt(i++));
164
- enc2 = Base64._keyStr.indexOf(input.charAt(i++));
165
- enc3 = Base64._keyStr.indexOf(input.charAt(i++));
166
- enc4 = Base64._keyStr.indexOf(input.charAt(i++));
167
-
168
- chr1 = (enc1 << 2) | (enc2 >> 4);
169
- chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
170
- chr3 = ((enc3 & 3) << 6) | enc4;
171
-
172
- output = output + String.fromCharCode(chr1);
173
-
174
- if (enc3 != 64) {
175
- output = output + String.fromCharCode(chr2);
176
- }
177
- if (enc4 != 64) {
178
- output = output + String.fromCharCode(chr3);
179
- }
180
-
181
- }
182
-
183
- output = Base64._utf8_decode(output);
184
-
185
- return output;
186
-
187
- },
188
-
189
- // private method for UTF-8 encoding
190
- _utf8_encode: function (string) {
191
- string = string.replace(/\r\n/g, "\n");
192
- var utftext = "";
193
-
194
- for (var n = 0; n < string.length; n++) {
195
-
196
- var c = string.charCodeAt(n);
197
-
198
- if (c < 128) {
199
- utftext += String.fromCharCode(c);
200
- }
201
- else if ((c > 127) && (c < 2048)) {
202
- utftext += String.fromCharCode((c >> 6) | 192);
203
- utftext += String.fromCharCode((c & 63) | 128);
204
- }
205
- else {
206
- utftext += String.fromCharCode((c >> 12) | 224);
207
- utftext += String.fromCharCode(((c >> 6) & 63) | 128);
208
- utftext += String.fromCharCode((c & 63) | 128);
209
- }
210
-
211
- }
212
-
213
- return utftext;
214
- },
215
-
216
- // private method for UTF-8 decoding
217
- _utf8_decode: function (utftext) {
218
- var string = "";
219
- var i = 0;
220
- var c = 0;
221
- var c2 = 0;
222
- var c3 = 0;
223
-
224
- while (i < utftext.length) {
225
-
226
- c = utftext.charCodeAt(i);
227
-
228
- if (c < 128) {
229
- string += String.fromCharCode(c);
230
- i++;
231
- }
232
- else if ((c > 191) && (c < 224)) {
233
- c2 = utftext.charCodeAt(i + 1);
234
- string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
235
- i += 2;
236
- }
237
- else {
238
- c2 = utftext.charCodeAt(i + 1);
239
- c3 = utftext.charCodeAt(i + 2);
240
- string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
241
- i += 3;
242
- }
243
-
244
- }
245
- return string;
246
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
247
  };
1
+ //prevent conflict of Prototype and jQuery libraries
2
+ jQuery.noConflict();
3
+
4
+ //script which starts after page is loaded
5
+ jQuery(document).ready(function ( jQuery ) {
6
+
7
+ jQuery('div#content').on('click', 'a.section-toggler-iceimport', function(e){
8
+ toggleIceimportFieldset(this);
9
+ e.preventDefault();
10
+ });
11
+
12
+ jQuery('div#content').on('click.go-to-section', 'a.section-toggler-trigger-iceimport', function(e){
13
+ var handler = jQuery(this);
14
+ var section = handler.data('href');
15
+ if (typeof section != 'undefined') {
16
+ toggleIceimportFieldset(jQuery(section).next('.entry-edit').find('.section-toggler-iceimport'), 'open');
17
+ }
18
+ });
19
+
20
+
21
+ var request_url_explanations = jQuery('#iceshop_iceimport_importprod_root_importprod_iceimport_explanation_hidden');
22
+ if(request_url_explanations.length>0){
23
+ var url_explanations = Base64.decode(request_url_explanations.find('option')[0].innerHTML);
24
+ var iceimport_explanation_length = jQuery(('#iceimport_explanation')).length;
25
+ if(iceimport_explanation_length>0){
26
+ jQuery(('#iceimport_explanation')).attr('href',url_explanations)
27
+ }
28
+ jQuery('#iceshop_iceimport_importprod_root_importprod_iceimport_explanation_hidden').parents('tr').remove();
29
+ }
30
+
31
+ refreshIceimportSystemCheck();
32
+
33
+ buildIceshopInfo();
34
+
35
+ cronQueue();
36
+
37
+ jQuery(document).on('change', '#iceshop_iceimport_importprod_root_importprod_import_images', function () {
38
+ cronQueue();
39
+ });
40
+ });
41
+
42
+ function cronQueue() {
43
+ if (jQuery('#iceshop_iceimport_importprod_root_importprod_import_images').length > 0) {
44
+ var selected = jQuery('#iceshop_iceimport_importprod_root_importprod_import_images').val();
45
+
46
+ if (selected == '1') {
47
+ jQuery('#row_iceshop_iceimport_importprod_root_importprod_images_queue_processing_only').show();
48
+ }
49
+ if (selected == '0') {
50
+ jQuery('#row_iceshop_iceimport_importprod_root_importprod_images_queue_processing_only').hide();
51
+ }
52
+ }
53
+ }
54
+
55
+ function buildIceshopInfo()
56
+ {
57
+ var iceshop_info_handler = jQuery('#iceshop_about_iceshop_iframe');
58
+ if (iceshop_info_handler.length > 0) {
59
+ var iceshop_info_el = jQuery('#iceshop_about_iceshop_iframe_iceshop_iframe_hidden', iceshop_info_handler);
60
+ var iceshop_info_url = Base64.decode(iceshop_info_el.find('option')[0].innerHTML);
61
+ var wrapper = iceshop_info_el.closest('form#config_edit_form div.entry-edit');
62
+ wrapper.find('div.section-config').remove();
63
+ var iceshop_info_iframe_el = jQuery('<iframe></iframe>')
64
+ .attr('src', iceshop_info_url)
65
+ .attr('width', '100%')
66
+ .attr('height', '1000')
67
+ .text('Your browser doesn\'t work with iframe elements');
68
+ iceshop_info_iframe_el.appendTo(wrapper);
69
+ jQuery('div.entry-edit').closest('div.main-col-inner').find('div.content-header').find('table td.form-buttons').hide();
70
+ jQuery('div.content-header-floating').find('table td.form-buttons').html('');
71
+ }
72
+ };
73
+
74
+ function refreshIceimportSystemCheck(url_string) {
75
+ if (typeof url_string == 'undefined') {
76
+ var checking_dashboard = jQuery('#iceimport_information_dashboard');
77
+ if (checking_dashboard.length > 0) {
78
+ //we're on dashboard page, lod the code
79
+ var request_url_el = jQuery('#iceimport_information_dashboard_check_system_hidden', checking_dashboard);
80
+ var request_url = Base64.decode(request_url_el.find('option')[0].innerHTML);
81
+ request_url_el.closest('table').remove();
82
+ jQuery.getJSON(
83
+ request_url,
84
+ function (response) {
85
+ if (typeof response.structure != 'undefined') {
86
+ jQuery('div.entry-edit').html(response.structure);
87
+ }
88
+ if (typeof response.refresh_btn != 'undefined') {
89
+ jQuery('div.entry-edit').closest('div.main-col-inner').find('div.content-header').find('table td.form-buttons').html(response.refresh_btn);
90
+ jQuery('div.content-header-floating').find('table td.form-buttons').html(response.refresh_btn);
91
+ }
92
+ }
93
+ );
94
+ }
95
+ } else {
96
+ jQuery.getJSON(
97
+ Base64.decode(url_string),
98
+ function (response) {
99
+ if (typeof response.structure != 'undefined') {
100
+ jQuery('div.entry-edit').html(response.structure);
101
+ }
102
+ if (typeof response.refresh_btn != 'undefined') {
103
+ jQuery('div.entry-edit').closest('div.main-col-inner').find('div.content-header').find('table td.form-buttons').html(response.refresh_btn);
104
+ jQuery('div.content-header-floating').find('table td.form-buttons').html(response.refresh_btn);
105
+ }
106
+ }
107
+ );
108
+ }
109
+ };
110
+
111
+ function toggleIceimportFieldset(element, action_type)
112
+ {
113
+ if (typeof element != 'undefined') {
114
+ if (typeof action_type != 'undefined') {
115
+ switch(action_type) {
116
+ case 'open':
117
+ var handler = jQuery(element);
118
+ console.log(element);
119
+ if (!handler.hasClass('open')) {
120
+ handler.toggleClass('open');
121
+ handler.closest('.entry-edit').find('div.fieldset').toggleClass('iceimport-hidden');
122
+ }
123
+ return true;
124
+ break;
125
+ case 'close':
126
+ var handler = jQuery(element);
127
+ if (handler.hasClass('open')) {
128
+ handler.toggleClass('open');
129
+ handler.closest('.entry-edit').find('div.fieldset').toggleClass('iceimport-hidden');
130
+ }
131
+ return true;
132
+ break;
133
+ }
134
+ } else {
135
+ var handler = jQuery(element);
136
+ handler.toggleClass('open');
137
+ handler.closest('.entry-edit').find('div.fieldset').toggleClass('iceimport-hidden');
138
+ return true;
139
+ }
140
+ }
141
+ return false;
142
+ };
143
+
144
+ var Base64 = {
145
+ // private property
146
+ _keyStr: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
147
+
148
+ // public method for encoding
149
+ encode: function (input) {
150
+ var output = "";
151
+ var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
152
+ var i = 0;
153
+
154
+ input = Base64._utf8_encode(input);
155
+
156
+ while (i < input.length) {
157
+
158
+ chr1 = input.charCodeAt(i++);
159
+ chr2 = input.charCodeAt(i++);
160
+ chr3 = input.charCodeAt(i++);
161
+
162
+ enc1 = chr1 >> 2;
163
+ enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
164
+ enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
165
+ enc4 = chr3 & 63;
166
+
167
+ if (isNaN(chr2)) {
168
+ enc3 = enc4 = 64;
169
+ } else if (isNaN(chr3)) {
170
+ enc4 = 64;
171
+ }
172
+
173
+ output = output +
174
+ Base64._keyStr.charAt(enc1) + Base64._keyStr.charAt(enc2) +
175
+ Base64._keyStr.charAt(enc3) + Base64._keyStr.charAt(enc4);
176
+
177
+ }
178
+
179
+ return output;
180
+ },
181
+
182
+ // public method for decoding
183
+ decode: function (input) {
184
+ var output = "";
185
+ var chr1, chr2, chr3;
186
+ var enc1, enc2, enc3, enc4;
187
+ var i = 0;
188
+
189
+ input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
190
+
191
+ while (i < input.length) {
192
+
193
+ enc1 = Base64._keyStr.indexOf(input.charAt(i++));
194
+ enc2 = Base64._keyStr.indexOf(input.charAt(i++));
195
+ enc3 = Base64._keyStr.indexOf(input.charAt(i++));
196
+ enc4 = Base64._keyStr.indexOf(input.charAt(i++));
197
+
198
+ chr1 = (enc1 << 2) | (enc2 >> 4);
199
+ chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
200
+ chr3 = ((enc3 & 3) << 6) | enc4;
201
+
202
+ output = output + String.fromCharCode(chr1);
203
+
204
+ if (enc3 != 64) {
205
+ output = output + String.fromCharCode(chr2);
206
+ }
207
+ if (enc4 != 64) {
208
+ output = output + String.fromCharCode(chr3);
209
+ }
210
+
211
+ }
212
+
213
+ output = Base64._utf8_decode(output);
214
+
215
+ return output;
216
+
217
+ },
218
+
219
+ // private method for UTF-8 encoding
220
+ _utf8_encode: function (string) {
221
+ string = string.replace(/\r\n/g, "\n");
222
+ var utftext = "";
223
+
224
+ for (var n = 0; n < string.length; n++) {
225
+
226
+ var c = string.charCodeAt(n);
227
+
228
+ if (c < 128) {
229
+ utftext += String.fromCharCode(c);
230
+ }
231
+ else if ((c > 127) && (c < 2048)) {
232
+ utftext += String.fromCharCode((c >> 6) | 192);
233
+ utftext += String.fromCharCode((c & 63) | 128);
234
+ }
235
+ else {
236
+ utftext += String.fromCharCode((c >> 12) | 224);
237
+ utftext += String.fromCharCode(((c >> 6) & 63) | 128);
238
+ utftext += String.fromCharCode((c & 63) | 128);
239
+ }
240
+
241
+ }
242
+
243
+ return utftext;
244
+ },
245
+
246
+ // private method for UTF-8 decoding
247
+ _utf8_decode: function (utftext) {
248
+ var string = "";
249
+ var i = 0;
250
+ var c = 0;
251
+ var c2 = 0;
252
+ var c3 = 0;
253
+
254
+ while (i < utftext.length) {
255
+
256
+ c = utftext.charCodeAt(i);
257
+
258
+ if (c < 128) {
259
+ string += String.fromCharCode(c);
260
+ i++;
261
+ }
262
+ else if ((c > 191) && (c < 224)) {
263
+ c2 = utftext.charCodeAt(i + 1);
264
+ string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
265
+ i += 2;
266
+ }
267
+ else {
268
+ c2 = utftext.charCodeAt(i + 1);
269
+ c3 = utftext.charCodeAt(i + 2);
270
+ string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
271
+ i += 3;
272
+ }
273
+
274
+ }
275
+ return string;
276
+ }
277
  };
package.xml CHANGED
@@ -1,22 +1,27 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>ice_import</name>
4
- <version>1.7.15</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
- - Added acknowledge notifications warning.&#xD;
13
  &#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-05-27</date>
18
- <time>12:47:01</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="magecommunity"><dir name="ICEshop"><dir name="Iceimport"><dir name="Block"><dir name="Adminhtml"><dir name="Images"><dir name="List"><file name="Grid.php" hash="93aec656c6751a65cfefc2f8ebf473b7"/></dir></dir><file name="Notifications.php" hash="66cb81dd34c3b34a8dfb9750487e4f3e"/><dir name="System"><dir name="Config"><dir name="Form"><file name="Button.php" hash="056987a5987c129ccaeff6c04df8678d"/><file name="Exportall.php" hash="c329655e2fc2d0983688699adc400976"/><file name="Updatebutton.php" hash="8400ab44d28d6bf95ddca6dd5a0bd73c"/></dir></dir></dir></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="0d27f2b9f92c4821624937f2e0f6ef25"/></dir></dir><dir name="Model"><dir name="Convert"><dir name="Adapter"><file name="Product.php" hash="701e922073bb5951abaae83ee8543303"/></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="052c8c5a800ab4a11c7ca60a45fd81ba"/></dir></dir></dir><file name="Observer.php" hash="64d712737e4d535d39d79127e2d02fb7"/><dir name="System"><dir name="Config"><file name="Checksystem.php" hash="260200dc8cecfa718b32fa47468282df"/><file name="Defaulttax.php" hash="898bf21060622bf8dc96469eb018c463"/><file name="Iceshoplink.php" hash="bae43572fcb4fddf9e0961f8da5e7f1b"/><file name="Yesno.php" hash="59e349561a36e02f44b47301fce99ef5"/></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="IceimagesController.php" hash="b43840720cb8fca823addc60402047ae"/><file name="IceimportController.php" hash="6353d45b9571e659e521a24565ae59e0"/><file name="IceimportimagesController.php" hash="441910744c4e8fb4e509caf5cc845a72"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="2990ebf927b0476b7702731ad2979682"/><file name="config.xml" hash="2f3f85dc34c85fb058215775958086bc"/><file name="system.xml" hash="7d9ca6cae327ed02bebebaa54c686439"/></dir><dir name="sql"><dir name="iceimport_setup"><file name="mysql4-install-1.7.15.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.14-1.7.15.php" hash="e5b8e89aea9a674f0cd25718d5d62a1c"/><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="mysql4-upgrade-1.7.9-1.7.13" hash="e5b8e89aea9a674f0cd25718d5d62a1c"/><file name="uninstall-old-version.php" hash="4269e8547005958b044946d5e2d670e9"/></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="1babf805c21c1e344b1fd8e7387b327e"/></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="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>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>ice_import</name>
4
+ <version>1.7.23</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>Bug fix:&#xD;
 
12
  &#xD;
13
+ - Add noticing&#xD;
14
+ - Fix user permissions&#xD;
15
+ - Renaming some attributes&#xD;
16
+ - Add explanations&#xD;
17
+ - Add new option 'run reindex'&#xD;
18
+ - Added new option to change cron scheduled time&#xD;
19
+ - Added new feature settings&#xD;
20
+ - Added transactions</notes>
21
  <authors><author><name>IceShop</name><user>IceShop</user><email>support@iceshop.nl</email></author></authors>
22
+ <date>2017-04-19</date>
23
+ <time>12:36:37</time>
24
+ <contents><target name="magecommunity"><dir name="ICEshop"><dir name="Iceimport"><dir name="Block"><dir name="Adminhtml"><file name="Dashboard.php" hash="c5bc53548068c2cc8b97087d4f56d9cd"/><dir name="Images"><dir name="List"><file name="Grid.php" hash="e3c9190844dd7d829ec8c95a3edb53a9"/></dir></dir><file name="Notifications.php" hash="2c917dd62d7119cc0f5b3fda87efc537"/><dir name="System"><dir name="Config"><dir name="Form"><file name="Button.php" hash="a716ac837c2a3548c2b0c8ab7d871321"/><file name="Exportall.php" hash="38bbe2ec93f492230f2ffcee56dd259b"/><file name="Updatebutton.php" hash="bf0344ecdb7b2756f10830c51324f5a2"/></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="29b0d1ddc50a67eaf7160cf1228f24da"/><file name="Db.php" hash="e4214f988bc3e030ad1f73f275453aaf"/><file name="Format.php" hash="20e0c6e3be6ce66b5c5fa2091fe04f4a"/><dir name="System"><file name="System.php" hash="2645d278ecfdd0bcb2bfaf4a9c8ea53e"/><file name="Systemcheck.php" hash="8b4916b33bf1b92610e01758b8f4492f"/></dir></dir><dir name="Model"><dir name="Convert"><dir name="Adapter"><file name="Product.php" hash="7b67df269a68b2e2e66b4f849fdafa73"/></dir></dir><dir name="Dataflow"><dir name="Batch"><file name="Import.php" hash="718a615ac6c585ecefaa9aab93f07b8b"/></dir><dir name="Convert"><dir name="Adapter"><file name="Io.php" hash="0fc5cdfdce12eda0553711355b3c2405"/></dir><dir name="Parser"><file name="Csv.php" hash="c031459fe50a569fbe655262ef286c40"/></dir></dir></dir><file name="Observer.php" hash="ed8d502da60d571dde4521c264faf2d1"/><dir name="System"><dir name="Config"><file name="Checksystem.php" hash="86cda2191bea190d59bdfaf904cd55fd"/><file name="Defaulttax.php" hash="2baea942efcc3880d785da9f021f04fc"/><file name="Explanations.php" hash="5452b370335ef4c03272c11c527e4ca3"/><dir name="Fields"><file name="Attributes.php" hash="e493e1f8a09aee4e5e603b292ac17fef"/></dir><file name="Iceshoplink.php" hash="5a5b523ab4bb13ad8f94c82f321ba19e"/><file name="Profiles.php" hash="6f8525946e12b116c7c2435c74b82e43"/><file name="Stock.php" hash="db933dc508d917904915771de54a998c"/><file name="Websites.php" hash="de666d4e92f777646839e73717e20fd3"/><file name="Yesno.php" hash="273e501e78300ac78360fd787d5f9d1b"/></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="IceimagesController.php" hash="4ab35558c030e353a54cfe64b3d81df1"/><file name="IceimportController.php" hash="53adf9b0bf0fd2be3ce8d7ffd71a51e1"/><file name="IceimportimagesController.php" hash="51d383100bf1b6a4fc97866f0e0a51bb"/><dir name="System"><dir name="Convert"><file name="GuiController.php" hash="aad0c2043b8386312c1a30f9f73c22d9"/></dir></dir></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="aae63620174bbe5791cad5ce154eb8da"/><file name="config.xml" hash="b9611fb0c434c49422fc9bea31dc430f"/><file name="system.xml" hash="9b90997dd2f7e4f93f0384151799f103"/></dir><dir name="sql"><dir name="iceimport_setup"><file name="mysql4-install-1.7.22.php" hash="4f3769e113bf3359d8e31e7ed541f6df"/><file name="mysql4-upgrade-1.7.15-1.7.22.php" hash="51e7eab2a26c9521b3ee1463b66adadd"/><file name="mysql4-upgrade-1.7.16-1.7.22.php" hash="e82b29207bc0bb92b15bdea5b60c071d"/><file name="mysql4-upgrade-1.7.17-1.7.22.php" hash="f6b22ec5557cb2b0e5f6aa469c034937"/><file name="mysql4-upgrade-1.7.18-1.7.22.php" hash="8e6fbf57ebe0a1f38ac8bcbf64eee746"/><file name="mysql4-upgrade-1.7.19-1.7.22.php" hash="7c03da0f59ead15cb1e0a0f7ee2d5d28"/><file name="mysql4-upgrade-1.7.20-1.7.22.php" hash="ac6d4efbd15ba801242635c43ce24270"/><file name="mysql4-upgrade-1.7.21-1.7.22.php" hash="0e7237d0cc4bae04d2f5b931cbc9f5ba"/><file name="mysql4-upgrade-1.7.8-1.7.22.php" hash="361c8fe17ee33d289094fc252501f7a1"/><file name="upgrade_run.php" hash="f77e33b196d987239f7b3176bed27e90"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="ICEshop_Iceimport.xml" hash="ba688dd33def1bb1c1c3f6d312eff468"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="ICEshop_Iceimport.xml" hash="af53e1e9c59f2e351ec75e6b2a452360"/></dir><dir name="template"><dir name="iceshop"><dir name="iceimport"><file name="dashboard.phtml" hash="0fb362cb59eaff591b8b33e812798986"/><file name="notifications.phtml" hash="d41bd462ebfee9392a086530dfd13c55"/></dir></dir></dir></dir></dir></dir></target><target name="mageweb"><dir name="js"><dir name="ICEshop"><dir name="Iceimport"><file name="dashboard.js" hash="54ebceb6b8be6a0cc8f012248a5ea1ba"/><file name="jquery-1.11.1.min.js" hash="00581ba93329e1af4e422831174588f9"/><file name="script.js" hash="3c00573b09de4b67d0776dccb5acf139"/></dir></dir></dir></target><target name="mageskin"><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="dfde1444b1d962bae2e0b8f0a7076334"/></dir></dir></dir></dir></dir></target></contents>
25
  <compatible/>
26
+ <dependencies><required><php><min>5.2.0</min><max>7.0.17</max></php></required></dependencies>
27
  </package>
skin/adminhtml/default/default/iceshop/iceimport/styles.css CHANGED
@@ -1,124 +1,157 @@
1
- #iceimport-warning {
2
- background-color: #ef672f;
3
- background-image: none;
4
- border-bottom: none;
5
- border-color: #c14800;
6
- border-top: none;
7
- color: #ffffff;
8
- font-weight: bold;
9
- }
10
-
11
- #iceimport-warning .f-right {
12
- background-color: #31302b;
13
- display: inline-block;
14
- height: 17px;
15
- margin: -5px 0 -5px 0;
16
- padding: 5px 10px 5px 10px;
17
- }
18
-
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 {
26
- color: #ef672f;
27
- }
28
-
29
- #iceimport-warning strong {
30
- background-color: #31302b;
31
- color: #ffffff;
32
- display: inline-block;
33
- font-weight: bold;
34
- height: 17px;
35
- margin: -5px 10px -5px 0;
36
- padding: 5px 10px 5px 10px;
37
- text-transform: uppercase;
38
- }
39
-
40
- .iceimport-hidden {
41
- display: none;
42
- }
43
-
44
- #iceimport-digest td.label {
45
- width: 105px;
46
- }
47
-
48
- #iceimport-digest td.label label {
49
- width: 70px;
50
- }
51
-
52
- #iceimport-digest td.label label.problem-digest {
53
- background: url(../../images/error_msg_icon.gif) 0px 1px no-repeat;
54
- color: #ef672f;
55
- font-weight: bold;
56
- padding-left: 20px;
57
- }
58
-
59
- .full-width,
60
- #iceimport-digest td.value {
61
- width: 100% !important;
62
- }
63
-
64
- .iceimport-label-bold {
65
- font-weight: bold;
66
- }
67
-
68
- .iceimport-label-uppercase {
69
- text-transform: uppercase;
70
- }
71
-
72
- .iceimport-label-rewrite {
73
- display: inline-block;
74
- width: 120px;
75
- }
76
-
77
- .requirement-passed {
78
- color: green;
79
- }
80
-
81
- .requirement-failed {
82
- color: #ef672f;
83
- }
84
-
85
- a.iceimport-advice {
86
- background: url(../../images/fam_help.gif) 0px 0px no-repeat;
87
- display: inline-block;
88
- height: 16px;
89
- margin: -4px 0 -4px 4px;
90
- width: 16px;
91
- }
92
-
93
- span.iceimport-pad-label {
94
- display: inline-block;
95
- width: 120px;
96
- }
97
-
98
- ul.tabs a.iceshop-info-section,
99
- ul.tabs a.iceshop-info-section:hover {
100
- background: url(../../images/tabs_span_bg.gif) repeat-x 0 100%;
101
- border-bottom: none;
102
- padding: 0.5em 0.5em 0.28em 1.5em;
103
- }
104
-
105
- ul.tabs a.iceshop-info-section:hover {
106
- background-color: #d8e6e6;
107
- }
108
-
109
- ul.tabs a.iceshop-info-section.active, ul.tabs a.iceshop-info-section.active:hover {
110
- background-color: #fff;
111
- }
112
-
113
- ul.tabs a.iceshop-info-section span,
114
- ul.tabs a.iceshop-info-section:hover span {
115
- background: url(./images/iceshop_logo_small_16px.png) no-repeat 0 0;
116
- height: 0;
117
- overflow: hidden;
118
- padding: 16px 0 0;
119
- width: 65px;
120
- }
121
-
122
- #row_iceshop_about_iceshop_iframe_iceshop_iframe_hidden {
123
- display: none;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
124
  }
1
+ #iceimport-warning {
2
+ background-color: #ef672f;
3
+ background-image: none;
4
+ border-bottom: none;
5
+ border-color: #c14800;
6
+ border-top: none;
7
+ color: #ffffff;
8
+ font-weight: bold;
9
+ }
10
+
11
+ #iceimport-warning .f-right {
12
+ background-color: #31302b;
13
+ display: inline-block;
14
+ height: 17px;
15
+ margin: -5px 0 -5px 0;
16
+ padding: 5px 10px 5px 10px;
17
+ }
18
+
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 {
26
+ color: #ef672f;
27
+ }
28
+
29
+ #iceimport-warning strong {
30
+ background-color: #31302b;
31
+ color: #ffffff;
32
+ display: inline-block;
33
+ font-weight: bold;
34
+ height: 17px;
35
+ margin: -5px 10px -5px 0;
36
+ padding: 5px 10px 5px 10px;
37
+ text-transform: uppercase;
38
+ }
39
+
40
+ .iceimport-hidden {
41
+ display: none;
42
+ }
43
+
44
+ #iceimport-digest td.label {
45
+ width: 105px;
46
+ }
47
+
48
+ #iceimport-digest td.label label {
49
+ width: 70px;
50
+ }
51
+
52
+ #iceimport-digest td.label label.problem-digest {
53
+ background: url(../../images/error_msg_icon.gif) 0px 1px no-repeat;
54
+ color: #ef672f;
55
+ font-weight: bold;
56
+ padding-left: 20px;
57
+ }
58
+
59
+ .full-width,
60
+ #iceimport-digest td.value {
61
+ width: 100% !important;
62
+ }
63
+
64
+ .iceimport-label-bold {
65
+ font-weight: bold;
66
+ }
67
+
68
+ .iceimport-label-uppercase {
69
+ text-transform: uppercase;
70
+ }
71
+
72
+ .iceimport-label-rewrite {
73
+ display: inline-block;
74
+ width: 120px;
75
+ }
76
+
77
+ .requirement-passed {
78
+ color: green;
79
+ }
80
+
81
+ .requirement-failed {
82
+ color: #ef672f;
83
+ }
84
+
85
+ a.iceimport-advice {
86
+ background: url(../../images/fam_help.gif) 0px 0px no-repeat;
87
+ display: inline-block;
88
+ height: 16px;
89
+ margin: -4px 0 -4px 4px;
90
+ width: 16px;
91
+ }
92
+
93
+ span.iceimport-pad-label {
94
+ display: inline-block;
95
+ width: 120px;
96
+ }
97
+
98
+ ul.tabs a.iceshop-info-section,
99
+ ul.tabs a.iceshop-info-section:hover {
100
+ background: url(../../images/tabs_span_bg.gif) repeat-x 0 100%;
101
+ border-bottom: none;
102
+ padding: 0.5em 0.5em 0.28em 1.5em;
103
+ }
104
+
105
+ ul.tabs a.iceshop-info-section:hover {
106
+ background-color: #d8e6e6;
107
+ }
108
+
109
+ ul.tabs a.iceshop-info-section.active, ul.tabs a.iceshop-info-section.active:hover {
110
+ background-color: #fff;
111
+ }
112
+
113
+ ul.tabs a.iceshop-info-section span,
114
+ ul.tabs a.iceshop-info-section:hover span {
115
+ background: url(./images/iceshop_logo_small_16px.png) no-repeat 0 0;
116
+ height: 0;
117
+ overflow: hidden;
118
+ padding: 16px 0 0;
119
+ width: 65px;
120
+ }
121
+
122
+ #row_iceshop_about_iceshop_iframe_iceshop_iframe_hidden {
123
+ display: none;
124
+ }
125
+ .iceimport-warning-notification {
126
+ background-color: #ef672f;
127
+ background-image: none;
128
+ border-bottom: none;
129
+ border-color: #c14800;
130
+ border-top: none;
131
+ color: #ffffff;
132
+ font-weight: bold;
133
+ }
134
+ .iceimport-warning-notification strong {
135
+ background-color: #31302b;
136
+ color: #ffffff !important;
137
+ display: inline-block;
138
+ font-weight: bold;
139
+ height: 17px;
140
+ margin: -5px 10px -5px 0;
141
+ padding: 5px 10px 5px 10px;
142
+ text-transform: uppercase;
143
+ }
144
+
145
+ .iceimport-warning-notification .f-right {
146
+ background-color: #31302b;
147
+ display: inline-block;
148
+ height: 17px;
149
+ margin: -5px 0 -5px 0;
150
+ padding: 5px 10px 5px 10px;
151
+ }
152
+
153
+ .iceimport-warning-notification .f-right a {
154
+ color: #ffffff;
155
+ font-weight: bold;
156
+ text-decoration: none;
157
  }