MTurbo - Version 1.2.0

Version Notes

Visit product homepage at:

http://www.artio.net/magento-extensions/m-turbo-accelerator

Download this release

Release Info

Developer Magento Core Team
Extension MTurbo
Version 1.2.0
Comparing to
See all releases


Code changes from version 1.1.1 to 1.2.0

Files changed (77) hide show
  1. app/code/local/Artio/MTurbo/Block/Adminhtml/Edit/Form.php +1 -1
  2. app/code/local/Artio/MTurbo/Block/Adminhtml/Edit/Tab/Actions.php +3 -3
  3. app/code/local/Artio/MTurbo/Block/Adminhtml/Edit/Tab/Category.php +36 -6
  4. app/code/local/Artio/MTurbo/Block/Adminhtml/Edit/Tab/Cms.php +94 -0
  5. app/code/local/Artio/MTurbo/Block/Adminhtml/Edit/Tab/Dynamic.php +144 -0
  6. app/code/local/Artio/MTurbo/Block/Adminhtml/Edit/Tab/License.php +2 -2
  7. app/code/local/Artio/MTurbo/Block/Adminhtml/Edit/Tab/Main.php +118 -99
  8. app/code/local/Artio/MTurbo/Block/Adminhtml/Edit/Tab/Product.php +10 -2
  9. app/code/local/Artio/MTurbo/Block/Adminhtml/Edit/Tab/Uninstall.php +73 -0
  10. app/code/local/Artio/MTurbo/Block/Adminhtml/Edit/Tab/Url.php +98 -54
  11. app/code/local/Artio/MTurbo/Block/Adminhtml/Edit/Tab/Website.php +160 -0
  12. app/code/local/Artio/MTurbo/Block/Adminhtml/Edit/Tabs.php +0 -5
  13. app/code/local/Artio/MTurbo/Block/Adminhtml/Mturbo.php +10 -8
  14. app/code/local/Artio/MTurbo/Block/Adminhtml/Run.php +9 -6
  15. app/code/local/Artio/MTurbo/Block/Adminhtml/Welcome.php +9 -6
  16. app/code/local/Artio/MTurbo/Block/Adminhtml/Welcome/Form.php +55 -21
  17. app/code/local/Artio/MTurbo/Block/Ajax.php +69 -0
  18. app/code/local/Artio/MTurbo/Block/Data/Form/Element/Button.php +6 -8
  19. app/code/local/Artio/MTurbo/Block/Data/Form/Element/CategoryTree.php +3 -9
  20. app/code/local/Artio/MTurbo/Block/Data/Form/Element/CmsTree.php +179 -0
  21. app/code/local/Artio/MTurbo/Block/Data/Form/Element/Html.php +40 -0
  22. app/code/local/Artio/MTurbo/Block/Data/Form/Element/NoEscLabel.php +1 -6
  23. app/code/local/Artio/MTurbo/Block/Data/Form/Element/SelectDownloadMethod.php +6 -11
  24. app/code/local/Artio/MTurbo/Block/Data/Form/Element/Time.php +3 -7
  25. app/code/local/Artio/MTurbo/Block/Data/Grid/Column/Blocked.php +1 -6
  26. app/code/local/Artio/MTurbo/Block/Data/Grid/Column/ColorOption.php +54 -0
  27. app/code/local/Artio/MTurbo/Block/Data/Grid/Column/FileSize.php +65 -0
  28. app/code/local/Artio/MTurbo/Block/Data/Grid/Column/SwitchAction.php +172 -0
  29. app/code/local/Artio/MTurbo/Helper/Checker.php +0 -90
  30. app/code/local/Artio/MTurbo/Helper/Data.php +31 -46
  31. app/code/local/Artio/MTurbo/Helper/Downloader.php +110 -113
  32. app/code/local/Artio/MTurbo/Helper/Functions.php +245 -0
  33. app/code/local/Artio/MTurbo/Helper/Info.php +25 -26
  34. app/code/local/Artio/MTurbo/Helper/Website.php +116 -0
  35. app/code/local/Artio/MTurbo/Model/Config.php +318 -628
  36. app/code/local/Artio/MTurbo/Model/Config/CmsTransformer.php +77 -0
  37. app/code/local/Artio/MTurbo/Model/Config/DynamicTransformer.php +190 -0
  38. app/code/local/Artio/MTurbo/Model/Config/Website.php +268 -0
  39. app/code/local/Artio/MTurbo/Model/Config/WebsiteTransformer.php +104 -0
  40. app/code/local/Artio/MTurbo/Model/DownloadMethods/Abstract.php +65 -0
  41. app/code/local/Artio/MTurbo/Model/DownloadMethods/Curl.php +80 -0
  42. app/code/local/Artio/MTurbo/Model/DownloadMethods/Direct.php +100 -0
  43. app/code/local/Artio/MTurbo/Model/DownloadMethods/Filegetcontents.php +69 -0
  44. app/code/local/Artio/MTurbo/Model/DownloadMethods/Socket.php +108 -0
  45. app/code/local/Artio/MTurbo/Model/DownloadMethodsFactory.php +92 -0
  46. app/code/local/Artio/MTurbo/Model/File.php +0 -256
  47. app/code/local/Artio/MTurbo/Model/File.php~ +0 -404
  48. app/code/local/Artio/MTurbo/Model/Htaccess.php +468 -0
  49. app/code/local/Artio/MTurbo/Model/LayoutPatch.php +164 -0
  50. app/code/local/Artio/MTurbo/Model/Mturbo.php +294 -274
  51. app/code/local/Artio/MTurbo/Model/Mturbo.php~ +0 -418
  52. app/code/local/Artio/MTurbo/Model/Mturbo/Event.php +283 -0
  53. app/code/local/Artio/MTurbo/Model/Mturbo/File.php +281 -0
  54. app/code/local/Artio/MTurbo/Model/Mysql4/Mturbo.php +1 -6
  55. app/code/local/Artio/MTurbo/Model/Mysql4/Mturbo/Collection.php +1 -6
  56. app/code/local/Artio/MTurbo/Model/Observer.php +320 -77
  57. app/code/local/Artio/MTurbo/Model/Observer2.php +0 -225
  58. app/code/local/Artio/MTurbo/Model/Patch.php +114 -0
  59. app/code/local/Artio/MTurbo/Model/htaccess/htaccess.txt +13 -19
  60. app/code/local/Artio/MTurbo/Model/htaccess/{htaccessroot.txt → htaccessside.txt} +0 -0
  61. app/code/local/Artio/MTurbo/Model/htaccess/htaccessstore.txt +38 -0
  62. app/code/local/Artio/MTurbo/Model/patches/layout.txt +3 -0
  63. app/code/local/Artio/MTurbo/Model/scripts/wgetlib.so +1 -1
  64. app/code/local/Artio/MTurbo/controllers/Adminhtml/CheckController.php +11 -18
  65. app/code/local/Artio/MTurbo/controllers/Adminhtml/MturboController.php +670 -347
  66. app/code/local/Artio/MTurbo/controllers/AdminhtmlController.php +28 -32
  67. app/code/local/Artio/MTurbo/controllers/IndexController.php +149 -0
  68. app/code/local/Artio/MTurbo/etc/config.xml +51 -3
  69. app/code/local/Artio/MTurbo/sql/mturbo_setup/{mysql4-install-1.0.0.php → mysql4-install-1.2.0.php} +30 -14
  70. app/design/adminhtml/default/default/layout/mturbo.xml +9 -0
  71. app/design/adminhtml/default/default/template/mturbo/demo.phtml +10 -1
  72. app/design/adminhtml/default/default/template/mturbo/grid.phtml +230 -0
  73. app/design/adminhtml/default/default/template/mturbo/version.phtml +33 -0
  74. app/design/frontend/default/default/layout/mturbo.xml +37 -0
  75. app/locale/en_US/Artio_MTurbo.csv +161 -61
  76. package.xml +9 -5
  77. skin/frontend/default/default/js/mturbo.js +81 -0
app/code/local/Artio/MTurbo/Block/Adminhtml/Edit/Form.php CHANGED
@@ -30,7 +30,7 @@
30
  *
31
  * @category Artio
32
  * @package Artio_MTurbo
33
- * @author Artio <info@artio.net>
34
  */
35
  class Artio_MTurbo_Block_Adminhtml_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
36
  {
30
  *
31
  * @category Artio
32
  * @package Artio_MTurbo
33
+ * @author Artio Magento Team <info@artio.net>
34
  */
35
  class Artio_MTurbo_Block_Adminhtml_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
36
  {
app/code/local/Artio/MTurbo/Block/Adminhtml/Edit/Tab/Actions.php CHANGED
@@ -75,7 +75,7 @@ class Artio_MTurbo_Block_Adminhtml_Edit_Tab_Actions extends Artio_MTurbo_Block_A
75
 
76
  $layoutFieldset->addField('generate_button', 'widget_button', array(
77
  'name' => 'generate_button',
78
- 'label' => $this->getMyHelper()->__('Generate list of rewrite URLs to the file'),
79
  'onclick' => "setLocation('" . Mage::helper('adminhtml')->getUrl('*/*/generateurllist') . "')",
80
  'comment' => $this->getMyHelper()->__(' Generate a list of the URLs and store it on the disk. This action will be executed if Automatic cache management is enabled.')
81
  ));
@@ -90,9 +90,9 @@ class Artio_MTurbo_Block_Adminhtml_Edit_Tab_Actions extends Artio_MTurbo_Block_A
90
 
91
  $layoutFieldset->addField('htaccess_button', 'widget_button', array(
92
  'name' => 'htaccess_button',
93
- 'label' => $this->getMyHelper()->__('Rebuild .htaccess'),
94
  'onclick' => "setLocation('" . Mage::helper('adminhtml')->getUrl('*/*/htaccessbuild') . "')",
95
- 'comment' => $this->getMyHelper()->__('Rebuild .htaccess file. First remove MTurbo section and then insert it. At the same time check .htaccess file in turbocache folder'),
96
 
97
  ));
98
 
75
 
76
  $layoutFieldset->addField('generate_button', 'widget_button', array(
77
  'name' => 'generate_button',
78
+ 'label' => $this->getMyHelper()->__('Generate URL list for all websites'),
79
  'onclick' => "setLocation('" . Mage::helper('adminhtml')->getUrl('*/*/generateurllist') . "')",
80
  'comment' => $this->getMyHelper()->__(' Generate a list of the URLs and store it on the disk. This action will be executed if Automatic cache management is enabled.')
81
  ));
90
 
91
  $layoutFieldset->addField('htaccess_button', 'widget_button', array(
92
  'name' => 'htaccess_button',
93
+ 'label' => $this->getMyHelper()->__('Rebuild .htaccess for all websites'),
94
  'onclick' => "setLocation('" . Mage::helper('adminhtml')->getUrl('*/*/htaccessbuild') . "')",
95
+ 'comment' => $this->getMyHelper()->__('Rebuild .htaccess for all websites.'),
96
 
97
  ));
98
 
app/code/local/Artio/MTurbo/Block/Adminhtml/Edit/Tab/Category.php CHANGED
@@ -44,25 +44,55 @@ class Artio_MTurbo_Block_Adminhtml_Edit_Tab_Category extends Artio_MTurbo_Block_
44
  protected function _prepareForm() {
45
 
46
  $config = Mage::getSingleton('mturbo/config');
47
- $config->loadAttributes();
48
 
49
  $form = new Varien_Data_Form();
50
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
  $layoutFieldset = $form->addFieldset('categories_fieldset', array(
52
  'legend' => $this->getMyHelper()->__( 'Select categories, where to cache list pages' ),
53
  'class' => 'fieldset'
54
  ));
55
 
 
56
  $layoutFieldset->addType('categories_tree', Artio_MTurbo_Helper_Data::FORM_CATEGORY_TREE);
57
  $layoutFieldset->addField('categories', 'categories_tree', array(
58
- 'name' => 'category_chooser',
59
- 'treeId' => 'category_chooser',
60
- 'categoryIds' => $config->getPreviewCategoryIds(),
61
  'updateElementId' => 'preview_categories',
62
- 'formName' => 'edit_form'
63
  ));
64
 
65
-
 
66
  $this->setForm($form);
67
 
68
  return parent::_prepareForm();
44
  protected function _prepareForm() {
45
 
46
  $config = Mage::getSingleton('mturbo/config');
 
47
 
48
  $form = new Varien_Data_Form();
49
 
50
+ /* fieldset for automatic refresh */
51
+ $layoutFieldsetRefresh = $form->addFieldset('categories_refresh_fieldset', array(
52
+ 'legend' => $this->getMyHelper()->__( 'Automatic refresh settings' ),
53
+ 'class' => 'fieldset'
54
+ ));
55
+
56
+ $layoutFieldsetRefresh->addField('add_newly_category_to_select', 'select', array(
57
+ 'name' => 'add_newly_category_to_select',
58
+ 'label' => $this->getMyHelper()->__('Add newly created categories to select').':',
59
+ 'options' => array(
60
+ 0 => $this->getMyHelper()->__('No'),
61
+ 1 => $this->getMyHelper()->__ ( 'Yes' ) ) ) );
62
+
63
+ $layoutFieldsetRefresh->addField('refresh_category', 'select', array(
64
+ 'name' => 'refresh_category',
65
+ 'label' => $this->getMyHelper()->__('Enable automatic refresh for preview of saved category').':',
66
+ 'options' => array(
67
+ 0 => $this->getMyHelper()->__('No'),
68
+ 1 => $this->getMyHelper()->__ ( 'Yes' ) ) ) );
69
+
70
+ $layoutFieldsetRefresh->addField('refresh_parents_for_category', 'select', array(
71
+ 'name' => 'refresh_parents_for_category',
72
+ 'label' => $this->getMyHelper()->__('Enable automatic refresh for previews of parents of saved category').':',
73
+ 'options' => array(
74
+ 0 => $this->getMyHelper()->__('No'),
75
+ 1 => $this->getMyHelper()->__ ( 'Yes' ) ) ) );
76
+
77
+
78
+ /* fieldset for tree */
79
  $layoutFieldset = $form->addFieldset('categories_fieldset', array(
80
  'legend' => $this->getMyHelper()->__( 'Select categories, where to cache list pages' ),
81
  'class' => 'fieldset'
82
  ));
83
 
84
+ /* tree */
85
  $layoutFieldset->addType('categories_tree', Artio_MTurbo_Helper_Data::FORM_CATEGORY_TREE);
86
  $layoutFieldset->addField('categories', 'categories_tree', array(
87
+ 'name' => 'category_chooser',
88
+ 'treeId' => 'category_chooser',
89
+ 'categoryIds' => $config->getPreviewCategoriesAsArray(),
90
  'updateElementId' => 'preview_categories',
91
+ 'formName' => 'edit_form'
92
  ));
93
 
94
+ /* bind data */
95
+ $form->setValues($config->getData());
96
  $this->setForm($form);
97
 
98
  return parent::_prepareForm();
app/code/local/Artio/MTurbo/Block/Adminhtml/Edit/Tab/Cms.php ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Artio
22
+ * @package Artio_MTurbo
23
+ * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ *
29
+ *
30
+ * @category Artio
31
+ * @package Artio_MTurbo
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+
35
+ class Artio_MTurbo_Block_Adminhtml_Edit_Tab_Cms
36
+ extends Artio_MTurbo_Block_Adminhtml_Edit_Tab_Abstract
37
+ {
38
+
39
+ public function __construct() {
40
+ parent::__construct();
41
+ $this->setId('cms_section');
42
+ $this->_title = $this->getMyHelper()->__('CMS');
43
+ }
44
+
45
+ protected function _prepareForm() {
46
+
47
+ $config = Mage::getSingleton('mturbo/config');
48
+
49
+ $form = new Varien_Data_Form();
50
+
51
+ /* fieldset for automatic refresh */
52
+ $layoutFieldsetRefresh = $form->addFieldset('products_refresh_fieldset', array(
53
+ 'legend' => $this->getMyHelper()->__( 'Automatic refresh settings' ),
54
+ 'class' => 'fieldset'
55
+ ));
56
+
57
+ $layoutFieldsetRefresh->addField('add_newly_cms_to_select', 'select', array(
58
+ 'name' => 'add_newly_cms_to_select',
59
+ 'label' => $this->getMyHelper()->__('Added newly cms to select').':',
60
+ 'options' => array(
61
+ 0 => $this->getMyHelper()->__('No'),
62
+ 1 => $this->getMyHelper()->__ ( 'Yes' ))));
63
+
64
+ $layoutFieldsetRefresh->addField('refresh_cms', 'select', array(
65
+ 'name' => 'refresh_cms',
66
+ 'label' => $this->getMyHelper()->__('Enable automatic refresh after save CMS pages').':',
67
+ 'options' => array(
68
+ 0 => $this->getMyHelper()->__('No'),
69
+ 1 => $this->getMyHelper()->__ ( 'Yes' ))));
70
+
71
+
72
+ /* fieldset for tree */
73
+ $layoutFieldset = $form->addFieldset('products_fieldset', array(
74
+ 'legend' => $this->getMyHelper()->__( 'Select CMS pages to cache' ),
75
+ 'class' => 'fieldset'
76
+ ));
77
+
78
+ /* tree */
79
+ $layoutFieldset->addType('cms_tree', Artio_MTurbo_Helper_Data::FORM_CMS_TREE);
80
+ $layoutFieldset->addField('cms_tree', 'cms_tree', array(
81
+ 'name' => 'cms_tree',
82
+ 'with' => $config->getCmsPagesWithStoresAsArray(),
83
+ 'without' => $config->getCmsPagesWithoutStoresAsArray()
84
+ ));
85
+
86
+
87
+ /* bind data */
88
+ $form->setValues($config->getData());
89
+ $this->setForm($form);
90
+
91
+ return parent::_prepareForm();
92
+ }
93
+
94
+ }
app/code/local/Artio/MTurbo/Block/Adminhtml/Edit/Tab/Dynamic.php ADDED
@@ -0,0 +1,144 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Artio
22
+ * @package Artio_MTurbo
23
+ * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ *
29
+ *
30
+ * @category Artio
31
+ * @package Artio_MTurbo
32
+ * @author Artio Magento Team <jiri.chmiel@artio.cz>
33
+ */
34
+
35
+ class Artio_MTurbo_Block_Adminhtml_Edit_Tab_Dynamic
36
+ extends Artio_MTurbo_Block_Adminhtml_Edit_Tab_Abstract
37
+ {
38
+
39
+ public function __construct() {
40
+ parent::__construct();
41
+ $this->setId('dynamic_section');
42
+ $this->_title = $this->getMyHelper()->__('Dynamic loaded blocks');
43
+ }
44
+
45
+ protected function _prepareForm() {
46
+
47
+ $config = Mage::getSingleton('mturbo/config');
48
+
49
+ $form = new Varien_Data_Form();
50
+
51
+ $layoutPatch = Mage::getSingleton('mturbo/layoutPatch');
52
+ if ($layoutPatch->needToPatch()) {
53
+ $this->_addLayoutPatchFieldset($form);
54
+ }
55
+
56
+ if (!$layoutPatch->needToPatch() || $layoutPatch->isPatched()) {
57
+
58
+ /* fieldset for automatic refresh */
59
+ $layoutFieldsetDefault = $form->addFieldset('dynamic_block_default', array(
60
+ 'legend' => $this->getMyHelper()->__( 'Default dynamic loaded blocks' ),
61
+ 'class' => 'fieldset'
62
+ ));
63
+
64
+ $layoutFieldsetDefault->addField('cartsidebar', 'select', array(
65
+ 'name' => 'cartsidebar',
66
+ 'label' => $this->getMyHelper()->__('Cart Block (sidebar)').':',
67
+ 'options' => array(
68
+ 0 => $this->getMyHelper()->__('No'),
69
+ 1 => $this->getMyHelper()->__ ( 'Yes' ))));
70
+
71
+ $layoutFieldsetDefault->addField('pollsidebar', 'select', array(
72
+ 'name' => 'pollsidebar',
73
+ 'label' => $this->getMyHelper()->__('Poll Block (sidebar)').':',
74
+ 'options' => array(
75
+ 0 => $this->getMyHelper()->__('No'),
76
+ 1 => $this->getMyHelper()->__ ( 'Yes' ))));
77
+
78
+ $layoutFieldsetDefault->addField('comparesidebar', 'select', array(
79
+ 'name' => 'comparesidebar',
80
+ 'label' => $this->getMyHelper()->__('Compare Block (sidebar)').':',
81
+ 'options' => array(
82
+ 0 => $this->getMyHelper()->__('No'),
83
+ 1 => $this->getMyHelper()->__ ( 'Yes' ))));
84
+
85
+
86
+
87
+ $layoutFieldsetUser = $form->addFieldset('dynamic_block_user', array(
88
+ 'legend' => $this->getMyHelper()->__( 'User dynamic loaded blocks (only for advanced developers).' ),
89
+ 'class' => 'fieldset'
90
+ ));
91
+
92
+ $layoutFieldsetUser->addField('userblocks', 'textarea', array(
93
+ 'name' => 'userblocks',
94
+ 'label' => $this->getMyHelper()->__('Layout names of dynamic loaded blocks').':',
95
+ 'after_element_html' => '<span><i>'.$this->getMyHelper()->__("Values separated by (',').").'</i></span>'));
96
+
97
+ }
98
+
99
+ /* bind data */
100
+ $form->setValues(Mage::getSingleton('mturbo/config_dynamicTransformer')->configToForm($config));
101
+ $this->setForm($form);
102
+
103
+ return parent::_prepareForm();
104
+ }
105
+
106
+ /**
107
+ * Fieldset for layout.
108
+ */
109
+ private function _addLayoutPatchFieldset($form) {
110
+
111
+ $patchModel = Mage::getSingleton('mturbo/layoutPatch');
112
+
113
+ /* make fieldset */
114
+ $layoutFieldset = $form->addFieldset('layout_fieldset', array(
115
+ 'legend' => $this->getMyHelper()->__('Layout patch'),
116
+ 'class' => 'fieldset'));
117
+
118
+ /* button for patch Mage.php */
119
+ $label = $patchModel->isPatched() ?
120
+ Mage::helper('mturbo')->__('Remove Layout Patch') :
121
+ Mage::helper('mturbo')->__('Apply Layout Patch');
122
+
123
+ if ($patchModel->isWriteable()) {
124
+
125
+ $layoutFieldset->addType('widget_button', Artio_MTurbo_Helper_Data::FORM_WIDGET_BUTTON);
126
+ $layoutFieldset->addField('laypatch_button', 'widget_button', array(
127
+ 'name' => 'laypatch_button',
128
+ 'label' => $label,
129
+ 'style' => 'width:800px',
130
+ 'onclick' => "setLocation('" . Mage::helper('adminhtml')->getUrl('*/*/layoutpatch') . "')",
131
+ 'comment' => $this->getMyHelper()->__('This patch is required for dynamic loaded blocks. (Patched file: app/code/core/Mage/Core/Model/Layout.php)')));
132
+
133
+ } else {
134
+
135
+ $scriptPath = $patchModel->getLayoutPath();
136
+ $layoutFieldset->addField ( 'layoutstate', 'html_element',
137
+ array ('label' => '<h4>'.$this->getMyHelper()->__('Layout state').'</h4>',
138
+ 'code' => '<span style="color:red">'.Mage::helper('mturbo')->__("Model '%s' is not writeable. Please change permission to write for patch.", $scriptPath).'</span>'));
139
+ }
140
+
141
+
142
+ }
143
+
144
+ }
app/code/local/Artio/MTurbo/Block/Adminhtml/Edit/Tab/License.php CHANGED
@@ -64,8 +64,8 @@ class Artio_MTurbo_Block_Adminhtml_Edit_Tab_License extends Artio_MTurbo_Block_A
64
  ));
65
  $layoutFieldset->addType('noesclabel', Artio_MTurbo_Helper_Data::FORM_NO_ESC_LABEL);
66
 
67
- $layoutFieldset->addField('licenseid', 'text', array(
68
- 'name' => 'licenseid',
69
  'label' => $this->getMyHelper()->__('Your Download ID').':',
70
  'value' => ''
71
  ));
64
  ));
65
  $layoutFieldset->addType('noesclabel', Artio_MTurbo_Helper_Data::FORM_NO_ESC_LABEL);
66
 
67
+ $layoutFieldset->addField('download_id', 'text', array(
68
+ 'name' => 'download_id',
69
  'label' => $this->getMyHelper()->__('Your Download ID').':',
70
  'value' => ''
71
  ));
app/code/local/Artio/MTurbo/Block/Adminhtml/Edit/Tab/Main.php CHANGED
@@ -12,41 +12,53 @@
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
  *
15
- * DISCLAIMER
16
- *
17
- * Do not edit or add to this file if you wish to upgrade Magento to newer
18
- * versions in the future. If you wish to customize Magento for your
19
- * needs please refer to http://www.magentocommerce.com for more information.
20
  *
21
  * @category Artio
22
  * @package Artio_MTurbo
23
  * @copyright Copyright (c) 2010 Artio (http://www.artio.net)
24
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
  */
 
 
 
 
 
 
 
 
 
 
26
  class Artio_MTurbo_Block_Adminhtml_Edit_Tab_Main extends Artio_MTurbo_Block_Adminhtml_Edit_Tab_Abstract
27
  {
28
 
29
  /**
 
30
  * @var Varien_Data_Form
31
  */
32
  private $form;
33
-
34
- public function __construct() {
 
 
 
35
  parent::__construct();
 
36
  $this->setId('main_section');
37
- $this->_title = $this->getMyHelper()->__('Options');
38
  }
39
 
40
  protected function _prepareForm() {
41
 
42
  $config = Mage::getSingleton('mturbo/config');
43
 
 
44
  $this->form = new Varien_Data_Form();
45
- $this->_addGeneralFieldset();
46
- $this->_addHomepageFieldset();
47
- //$this->_addAutomaticDownloadFieldset(); DEMO VERSION
48
  $this->_addDownloadMethodFieldset();
 
 
49
 
 
50
  $this->form->setValues($config->getData());
51
  $this->setForm($this->form);
52
 
@@ -54,107 +66,77 @@ class Artio_MTurbo_Block_Adminhtml_Edit_Tab_Main extends Artio_MTurbo_Block_Admi
54
 
55
  }
56
 
57
- private function _addGeneralFieldset() {
58
-
59
- $layoutFieldset = $this->form->addFieldset('general_fieldset', array(
60
- 'legend' => $this->getMyHelper()->__('General Options'),
61
- 'class' => 'fieldset'
62
- ));
 
 
 
63
 
 
64
  $layoutFieldset->addField('turbopath', 'text', array(
65
  'name' => 'turbopath',
66
- 'label' => $this->getMyHelper()->__('Cache Path').':',
67
- 'value' => 'var/turbocache'
68
- ));
69
-
70
- $layoutFieldset->addField('multistoreview', 'select', array(
71
- 'name' => 'multistoreview',
72
- 'label' => $this->getMyHelper()->__('Enable multi-storeview').':',
73
- 'options' => array(
74
- 0 => $this->getMyHelper()->__('No'),
75
- 1 => $this->getMyHelper()->__('Yes'))
76
- ));
77
-
78
- $layoutFieldset->addField('refreshsave', 'select', array(
79
- 'name' => 'refreshsave',
80
- 'label' => $this->getMyHelper()->__('Refresh cache after product or category save').':',
81
- 'options' => array(
82
- 0 => $this->getMyHelper()->__('No'),
83
- 1 => $this->getMyHelper()->__('Yes'))
84
- ));
85
-
86
  }
87
 
 
 
 
88
  private function _addAutomaticDownloadFieldset() {
89
 
 
90
  $layoutFieldset = $this->form->addFieldset('download_fieldset', array(
91
  'legend' => $this->getMyHelper()->__('Automatic cache management'),
92
- 'class' => 'fieldset'
93
- ));
94
-
95
- $layoutFieldset->addField('automaticdownload', 'select', array(
96
- 'name' => 'automaticdownload',
97
- 'label' => $this->getMyHelper()->__('Enable automatic cache refresh').':',
98
- 'options' => array(
99
- 0 => $this->getMyHelper()->__('No'),
100
- 1 => $this->getMyHelper()->__('Yes'))
101
- ));
102
-
103
- $layoutFieldset->addType('crontime', Artio_MTurbo_Helper_Data::FORM_CRON_HOUR_TIME);
104
- $layoutFieldset->addField('downloadtime', 'crontime', array(
105
- 'name' => 'downloadtime',
106
- 'label' => $this->getMyHelper()->__('Download time').':',
107
- 'style' => 'display:inline;width:40px;'
108
- ));
109
-
110
- $layoutFieldset->addField('lastdownload', 'label', array(
111
- 'name' => 'lastdownload',
112
- 'label' => $this->getMyHelper()->__('Last download').':',
113
- 'style' => 'height:24em;',
114
- 'disabled' => true
115
- ));
116
-
117
-
118
 
119
- }
120
-
121
-
122
- private function _addHomepageFieldset() {
123
-
124
- $layoutFieldset = $this->form->addFieldset('homepage_fieldset', array(
125
- 'legend' => $this->getMyHelper()->__('Homepage Cache Options'),
126
- 'class' => 'fieldset'
127
- ));
128
 
129
- $layoutFieldset->addField('homepage', 'select', array(
130
- 'name' => 'homepage',
131
- 'label' => $this->getMyHelper()->__('Cache homepage').':',
 
132
  'options' => array(
133
  0 => $this->getMyHelper()->__('No'),
134
- 1 => $this->getMyHelper()->__('Yes'))
135
- ));
136
-
137
- }
138
-
139
- private function _addDownloadMethodFieldset() {
140
-
141
- $layoutFieldset = $this->form->addFieldset('downloadmethod_fieldset', array(
142
- 'legend' => $this->getMyHelper()->__('Choice download method'),
143
- 'class' => 'fieldset'
144
- ));
145
-
146
- $layoutFieldset->addType('selectdmet', Artio_MTurbo_Helper_Data::FORM_SELECT_DOW);
147
- $layoutFieldset->addField('downloadmethod', 'selectdmet', array(
148
- 'name' => 'downloadmethod',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
149
  'label' => $this->getMyHelper()->__('Download method').':',
150
- 'options' => array(
151
- DownloadMethods::FILE_GET_CONTENTS => $this->getMyHelper()->__('Use function "file_get_contents"'),
152
- DownloadMethods::SOCKET => $this->getMyHelper()->__('Create connection over sockets'),
153
- DownloadMethods::CURL => $this->getMyHelper()->__('Use CURL PHP extension'),
154
- DownloadMethods::DIRECT_ACCESS => $this->getMyHelper()->__('Direct access (created new instance Magento)'))
155
- ));
156
 
157
- $label = Artio_MTurbo_Helper_Data::getConfig()->isPatched() ?
 
158
  Mage::helper('mturbo')->__('Remove Mage Patch') :
159
  Mage::helper('mturbo')->__('Apply Mage Patch');
160
 
@@ -163,9 +145,46 @@ class Artio_MTurbo_Block_Adminhtml_Edit_Tab_Main extends Artio_MTurbo_Block_Admi
163
  'name' => 'patch_button',
164
  'label' => $label,
165
  'onclick' => "setLocation('" . Mage::helper('adminhtml')->getUrl('*/*/magepatch') . "')",
166
- 'comment' => $this->getMyHelper()->__('Apply the patch only just in case you need to use Direct Access download method!')
167
- ));
168
 
169
  }
170
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
171
  }
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
  *
 
 
 
 
 
15
  *
16
  * @category Artio
17
  * @package Artio_MTurbo
18
  * @copyright Copyright (c) 2010 Artio (http://www.artio.net)
19
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
  */
21
+
22
+ /**
23
+ * Configuration tab contains turbopath settings, download method chooser,
24
+ * automatic downloader settings (only full version), filesize viewing settings and
25
+ * backup of htaccess settings.
26
+ *
27
+ * @category Artio
28
+ * @package Artio_MTurbo
29
+ * @author Artio Magento Team (jiri.chmiel@artio.cz)
30
+ */
31
  class Artio_MTurbo_Block_Adminhtml_Edit_Tab_Main extends Artio_MTurbo_Block_Adminhtml_Edit_Tab_Abstract
32
  {
33
 
34
  /**
35
+ * Form on this tab.
36
  * @var Varien_Data_Form
37
  */
38
  private $form;
39
+
40
+ /**
41
+ * Constructor. Id of this section is 'main_section'.
42
+ */
43
+ public function __construct() {
44
  parent::__construct();
45
+
46
  $this->setId('main_section');
47
+ $this->_title = $this->getMyHelper()->__('Main Configuration');
48
  }
49
 
50
  protected function _prepareForm() {
51
 
52
  $config = Mage::getSingleton('mturbo/config');
53
 
54
+ /* make form */
55
  $this->form = new Varien_Data_Form();
56
+ $this->_addTurboPathFieldset();
 
 
57
  $this->_addDownloadMethodFieldset();
58
+ $this->_addViewSizeMethodFieldset();
59
+ $this->_addHtaccessFieldset();
60
 
61
+ /* bind data */
62
  $this->form->setValues($config->getData());
63
  $this->setForm($this->form);
64
 
66
 
67
  }
68
 
69
+ /**
70
+ * Fieldset for turbo path.
71
+ */
72
+ private function _addTurboPathFieldset() {
73
+
74
+ /* make fieldset */
75
+ $layoutFieldset = $this->form->addFieldset('turbopath_fieldset', array(
76
+ 'legend' => $this->getMyHelper()->__('Turbopath directory'),
77
+ 'class' => 'fieldset'));
78
 
79
+ /* add field for turbopath */
80
  $layoutFieldset->addField('turbopath', 'text', array(
81
  'name' => 'turbopath',
82
+ 'label' => $this->getMyHelper()->__('Relative path from webroot').':',
83
+ 'value' => 'var/turbocache'));
84
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
85
  }
86
 
87
+ /**
88
+ * Fieldset for automatic downloader settings.
89
+ */
90
  private function _addAutomaticDownloadFieldset() {
91
 
92
+ /* make fieldset */
93
  $layoutFieldset = $this->form->addFieldset('download_fieldset', array(
94
  'legend' => $this->getMyHelper()->__('Automatic cache management'),
95
+ 'class' => 'fieldset'));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96
 
97
+ $layoutFieldset->addType('html_element', Artio_MTurbo_Helper_Data::FORM_HTML);
 
 
 
 
 
 
 
 
98
 
99
+ /* indicator whether automatic download is enabled */
100
+ $layoutFieldset->addField('automatic_download', 'select', array(
101
+ 'name' => 'automatic_download',
102
+ 'label' => $this->getMyHelper()->__('Enable automatic cache refresh').':',
103
  'options' => array(
104
  0 => $this->getMyHelper()->__('No'),
105
+ 1 => $this->getMyHelper()->__ ( 'Yes' ))));
106
+
107
+ /* automatic download time */
108
+ $layoutFieldset->addType ( 'crontime', Artio_MTurbo_Helper_Data::FORM_CRON_HOUR_TIME );
109
+ $layoutFieldset->addField ( 'automatic_download_time', 'crontime', array ('name' => 'automatic_download_time', 'label' => $this->getMyHelper ()->__ ( 'Download time' ) . ':', 'style' => 'display:inline;width:40px;' ) );
110
+
111
+ /* label with last download */
112
+ $layoutFieldset->addField ( 'lastdownload', 'label', array ('name' => 'lastdownload', 'label' => $this->getMyHelper ()->__ ( 'Last download' ) . ':', 'style' => 'height:24em;', 'disabled' => true ) );
113
+
114
+ $scriptPath = Mage::helper('mturbo')->getFullDownloadScriptPath();
115
+ if (!is_executable($scriptPath)) {
116
+ $layoutFieldset->addField ( 'scriptstate', 'html_element',
117
+ array ('label' => '<h4>'.$this->getMyHelper()->__('Script state').'</h4>',
118
+ 'code' => '<span style="color:red">'.Mage::helper('mturbo')->__("Script '%s' is not executable. Please change permission", $scriptPath).'</span>'));
119
+ }
120
+
121
+ }
122
+
123
+ /**
124
+ * Fieldset for choose download method.
125
+ */
126
+ private function _addDownloadMethodFieldset() {
127
+
128
+ /* make fieldset */
129
+ $layoutFieldset = $this->form->addFieldset ( 'downloadmethod_fieldset', array ('legend' => $this->getMyHelper ()->__ ( 'Choice download method' ), 'class' => 'fieldset' ) );
130
+
131
+ /* select box for choose download method */
132
+ $layoutFieldset->addType ('selectdmet', Artio_MTurbo_Helper_Data::FORM_SELECT_DOWN );
133
+ $layoutFieldset->addField('download_method', 'selectdmet', array(
134
+ 'name' => 'download_method',
135
  'label' => $this->getMyHelper()->__('Download method').':',
136
+ 'options' => Mage::getModel('mturbo/downloadMethodsFactory')->getList()));
 
 
 
 
 
137
 
138
+ /* button for patch Mage.php */
139
+ $label = Mage::getModel('mturbo/patch')->isPatched() ?
140
  Mage::helper('mturbo')->__('Remove Mage Patch') :
141
  Mage::helper('mturbo')->__('Apply Mage Patch');
142
 
145
  'name' => 'patch_button',
146
  'label' => $label,
147
  'onclick' => "setLocation('" . Mage::helper('adminhtml')->getUrl('*/*/magepatch') . "')",
148
+ 'comment' => $this->getMyHelper()->__('Apply the patch only just in case you need to use Direct Access download method!')));
 
149
 
150
  }
151
 
152
+ /**
153
+ * Add fieldset for settings views on filesize in the grid.
154
+ */
155
+ private function _addViewSizeMethodFieldset() {
156
+
157
+ /* make fieldset */
158
+ $layoutFieldset = $this->form->addFieldset ( 'viewsize_fieldset', array ('legend' => $this->getMyHelper ()->__ ( 'Filesize viewing' ), 'class' => 'fieldset' ) );
159
+
160
+ /* add field for minimal page size */
161
+ $layoutFieldset->addField('minimal_page_size', 'text', array(
162
+ 'name' => 'minimal_page_size',
163
+ 'label' => $this->getMyHelper()->__('The minimum size to decision, the page is alright (bytes)').':',
164
+ 'value' => '512'));
165
+
166
+ }
167
+
168
+ /**
169
+ * Add fieldset for htaccess settings.
170
+ */
171
+ private function _addHtaccessFieldset() {
172
+
173
+ /* make fieldset */
174
+ $layoutFieldset = $this->form->addFieldset ( 'htaccess_fieldset', array ('legend' => $this->getMyHelper ()->__ ( 'Htaccess backup settings' ), 'class' => 'fieldset' ) );
175
+
176
+ $layoutFieldset->addField('enabled_htaccess_backup', 'select', array(
177
+ 'name' => 'enabled_htaccess_backup',
178
+ 'label' => $this->getMyHelper()->__('Enable making htaccess backup').':',
179
+ 'options' => array(
180
+ 0 => $this->getMyHelper()->__('No'),
181
+ 1 => $this->getMyHelper()->__ ( 'Yes' ))));
182
+
183
+ $layoutFieldset->addField('number_of_htaccess_backups', 'text', array(
184
+ 'name' => 'number_of_htaccess_backups',
185
+ 'label' => $this->getMyHelper()->__('The maximum number of htaccess backups').':',
186
+ 'value' => '10'));
187
+
188
+ }
189
+
190
  }
app/code/local/Artio/MTurbo/Block/Adminhtml/Edit/Tab/Product.php CHANGED
@@ -29,12 +29,20 @@
29
  *
30
  * @category Artio
31
  * @package Artio_MTurbo
32
- * @author Magento Core Team <core@magentocommerce.com>
33
  */
34
 
35
  class Artio_MTurbo_Block_Adminhtml_Edit_Tab_Product
36
  extends Artio_MTurbo_Block_Adminhtml_Edit_Tab_Abstract
37
  {
38
 
 
 
 
 
 
39
 
40
- }
 
 
 
29
  *
30
  * @category Artio
31
  * @package Artio_MTurbo
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
  */
34
 
35
  class Artio_MTurbo_Block_Adminhtml_Edit_Tab_Product
36
  extends Artio_MTurbo_Block_Adminhtml_Edit_Tab_Abstract
37
  {
38
 
39
+ public function __construct() {
40
+ parent::__construct();
41
+ $this->setId('product_section');
42
+ $this->_title = $this->getMyHelper()->__('Products');
43
+ }
44
 
45
+ protected function _prepareForm() {
46
+ }
47
+
48
+ }
app/code/local/Artio/MTurbo/Block/Adminhtml/Edit/Tab/Uninstall.php ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Artio
22
+ * @package Artio_MTurbo
23
+ * @copyright Copyright (c) 2010 Artio (http://www.artio.net)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+ class Artio_MTurbo_Block_Adminhtml_Edit_Tab_Uninstall extends Artio_MTurbo_Block_Adminhtml_Edit_Tab_Abstract
27
+ {
28
+
29
+ /**
30
+ * @var Varien_Data_Form
31
+ */
32
+ private $form;
33
+
34
+ public function __construct() {
35
+ parent::__construct();
36
+ $this->setId('action_section');
37
+ $this->_title = $this->getMyHelper()->__('Uninstall');
38
+ }
39
+
40
+ protected function _prepareForm() {
41
+
42
+ $config = Mage::getSingleton('mturbo/config');
43
+
44
+ $this->form = new Varien_Data_Form();
45
+ $this->_addActionFieldset();
46
+
47
+ $this->form->setValues($config->getData());
48
+ $this->setForm($this->form);
49
+
50
+ return parent::_prepareForm();
51
+
52
+ }
53
+
54
+ private function _addActionFieldset() {
55
+
56
+ $layoutFieldset = $this->form->addFieldset('uninstall_fieldset', array(
57
+ 'legend' => $this->getMyHelper()->__('Uninstall M-Turbo'),
58
+ 'class' => 'fieldset'
59
+ ));
60
+
61
+ $layoutFieldset->addType('widget_button', Artio_MTurbo_Helper_Data::FORM_WIDGET_BUTTON);
62
+ $layoutFieldset->addField('clear_button', 'widget_button', array(
63
+ 'name' => 'clear_button',
64
+ 'label' => $this->getMyHelper()->__('Uninstall M-Turbo'),
65
+ 'style' => 'width:850px',
66
+ 'onclick' => "setLocation('" . Mage::helper('adminhtml')->getUrl('*/*/uninstall') . "')",
67
+ 'comment' => $this->getMyHelper()->__('This action completely removes M-Turbo from your Magento')
68
+ ));
69
+
70
+
71
+ }
72
+
73
+ }
app/code/local/Artio/MTurbo/Block/Adminhtml/Edit/Tab/Url.php CHANGED
@@ -12,26 +12,19 @@
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
  *
15
- * DISCLAIMER
16
- *
17
- * Do not edit or add to this file if you wish to upgrade Magento to newer
18
- * versions in the future. If you wish to customize Magento for your
19
- * needs please refer to http://www.magentocommerce.com for more information.
20
- *
21
  * @category Artio
22
  * @package Artio_MTurbo
23
- * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
24
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
  */
26
 
27
  /**
28
- *
29
  *
30
- * @category Artio
31
- * @package Artio_MTurbo
32
- * @author Magento Core Team <core@magentocommerce.com>
33
  */
34
-
35
  class Artio_MTurbo_Block_Adminhtml_Edit_Tab_Url
36
  extends Mage_Adminhtml_Block_Widget_Grid
37
  implements Mage_Adminhtml_Block_Widget_Tab_Interface
@@ -57,7 +50,7 @@ class Artio_MTurbo_Block_Adminhtml_Edit_Tab_Url
57
  protected function _afterLoadCollection() {
58
 
59
  foreach ($this->getCollection() as $model) {
60
- $model->checkExist();
61
  }
62
 
63
  }
@@ -66,20 +59,17 @@ class Artio_MTurbo_Block_Adminhtml_Edit_Tab_Url
66
 
67
  $this->addColumn('mturbo_id', array(
68
  'header' => Mage::helper('mturbo')->__('ID'),
69
- 'align' =>'right',
70
- 'width' => '50px',
71
  'index' => 'mturbo_id',
72
  ));
73
 
74
- if (!Mage::app()->isSingleStoreMode()) {
75
  $this->addColumn('store_id', array(
76
  'header' => $this->__('Store View'),
77
- 'width' => '200px',
78
  'index' => 'store_id',
79
  'type' => 'store',
80
  'store_view' => true,
81
  ));
82
- }
83
 
84
  $this->addColumn('url', array(
85
  'header' => Mage::helper('mturbo')->__('Request path'),
@@ -87,17 +77,30 @@ class Artio_MTurbo_Block_Adminhtml_Edit_Tab_Url
87
  'index' => 'request_path',
88
  ));
89
 
 
 
 
 
 
 
 
 
 
 
 
 
 
90
  $this->addColumn('exist', array(
91
  'header' => Mage::helper('mturbo')->__('Cached'),
92
- 'align' =>'left',
93
  'type' => 'select',
94
  'index' => 'exist',
95
  'filter' => false,
96
  'sortable' => false,
97
- 'renderer' => new Artio_MTurbo_Block_Data_Grid_Column_Blocked(),
98
  'options' => array(
99
- 1 => Mage::helper('mturbo')->__('Not cached'),
100
- 0 => Mage::helper('mturbo')->__('Cached')
101
  )
102
  ));
103
 
@@ -107,13 +110,22 @@ class Artio_MTurbo_Block_Adminhtml_Edit_Tab_Url
107
  'type' => 'datetime',
108
  'index' => 'last_refresh',
109
  'filter' => false,
110
- 'sortable' => false
 
 
 
 
 
 
 
 
 
 
111
  ));
112
 
113
  $this->addColumn('blocked', array(
114
  'header' => Mage::helper('mturbo')->__('Status'),
115
  'align' => 'center',
116
- 'width' => '80px',
117
  'index' => 'blocked',
118
  'type' => 'options',
119
  'renderer' => new Artio_MTurbo_Block_Data_Grid_Column_Blocked(),
@@ -125,16 +137,16 @@ class Artio_MTurbo_Block_Adminhtml_Edit_Tab_Url
125
 
126
  $this->addColumn('action2',
127
  array(
128
- 'header' => Mage::helper('mturbo')->__('Cache'),
129
  'width' => '50px',
130
- 'type' => 'action',
131
- 'getter' => 'getId',
132
  'actions' => array(
133
  array(
134
- 'caption' => Mage::helper('mturbo')->__('Cache'),
135
- 'url' => array(
136
- 'base'=>'*/*/refresh',
137
- ),
138
  'field' => 'id'
139
  )
140
  ),
@@ -142,6 +154,25 @@ class Artio_MTurbo_Block_Adminhtml_Edit_Tab_Url
142
  'sortable' => false,
143
  ));
144
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
145
  return parent::_prepareColumns();
146
  }
147
 
@@ -151,10 +182,6 @@ class Artio_MTurbo_Block_Adminhtml_Edit_Tab_Url
151
  $this->getMassactionBlock()->setTemplate('mturbo/massaction.phtml');
152
  $this->getMassactionBlock()->setFormFieldName('mturbo');
153
 
154
- /* $this->getMassactionBlock()->addItem('refresh', array(
155
- 'label' => Mage::helper('mturbo')->__('Refresh'),
156
- 'url' => $this->getUrl('*//**//*massRefresh')
157
- ));*/
158
 
159
  $this->getMassactionBlock()->addItem('block', array(
160
  'label' => Mage::helper('mturbo')->__('Block'),
@@ -166,6 +193,16 @@ class Artio_MTurbo_Block_Adminhtml_Edit_Tab_Url
166
  'url' => $this->getUrl('*/*/massUnblock')
167
  ));
168
 
 
 
 
 
 
 
 
 
 
 
169
  $this->getMassactionBlock()->addItem('delete', array(
170
  'label' => Mage::helper('mturbo')->__('Delete'),
171
  'url' => $this->getUrl('*/*/massDelete'),
@@ -178,22 +215,34 @@ class Artio_MTurbo_Block_Adminhtml_Edit_Tab_Url
178
  public function getMainButtonsHtml()
179
  {
180
  $html = '';
181
- if($this->getFilterVisibility()){
182
- //$html.= '<span>'.Mage::helper('mturbo')->__('Before synchronization must be configuration saved').'</span>';
183
- $html.= Mage::getSingleton('core/layout')
184
- ->createBlock('adminhtml/widget_button', '', array(
185
- 'label' => Mage::helper('mturbo')->__('Cache selected pages'),
186
- 'type' => 'button',
187
- 'onclick' => $this->_getOnClickScript()
188
- ))->toHtml();
189
- $html.= '<input type="hidden" name="massrefresh" id="massrefresh" value="" />';
190
- $html.= $this->getResetFilterButtonHtml();
191
- $html.= $this->getSearchButtonHtml();
192
- }
 
 
 
 
 
 
193
  return $html;
194
  }
195
 
196
- private function _getOnClickScript() {
 
 
 
 
 
 
197
  return "this.form.target='_blank';
198
  $('massrefresh').value = url_section_massactionJsObject.checkedString;
199
  this.form.action = '".Mage::helper('adminhtml')->getUrl('*/*/massRefresh')."';
@@ -202,11 +251,6 @@ class Artio_MTurbo_Block_Adminhtml_Edit_Tab_Url
202
  this.form.action = '".Mage::helper('adminhtml')->getUrl('*/*/index')."';
203
  this.form.submit();";
204
  }
205
-
206
- public function getRowUrl($row)
207
- {
208
- //return $this->getUrl('*/*/edit', array('id' => $row->getId()));
209
- }
210
 
211
  /**
212
  * Prepare label for tab
@@ -248,4 +292,4 @@ class Artio_MTurbo_Block_Adminhtml_Edit_Tab_Url
248
  return false;
249
  }
250
 
251
- }
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
  *
 
 
 
 
 
 
15
  * @category Artio
16
  * @package Artio_MTurbo
17
+ * @copyright Copyright (c) 2010 Artio (http://www.artio.net)
18
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
20
 
21
  /**
22
+ * Grid tab.
23
  *
24
+ * @category Artio
25
+ * @package Artio_MTurbo
26
+ * @author Artio Magento Team (jiri.chmiel@artio.cz)
27
  */
 
28
  class Artio_MTurbo_Block_Adminhtml_Edit_Tab_Url
29
  extends Mage_Adminhtml_Block_Widget_Grid
30
  implements Mage_Adminhtml_Block_Widget_Tab_Interface
50
  protected function _afterLoadCollection() {
51
 
52
  foreach ($this->getCollection() as $model) {
53
+ $model->loadFileInformation();
54
  }
55
 
56
  }
59
 
60
  $this->addColumn('mturbo_id', array(
61
  'header' => Mage::helper('mturbo')->__('ID'),
62
+ 'width' => '15px',
63
+ 'align' => 'center',
64
  'index' => 'mturbo_id',
65
  ));
66
 
 
67
  $this->addColumn('store_id', array(
68
  'header' => $this->__('Store View'),
 
69
  'index' => 'store_id',
70
  'type' => 'store',
71
  'store_view' => true,
72
  ));
 
73
 
74
  $this->addColumn('url', array(
75
  'header' => Mage::helper('mturbo')->__('Request path'),
77
  'index' => 'request_path',
78
  ));
79
 
80
+ $this->addColumn('type', array(
81
+ 'header' => Mage::helper('mturbo')->__('Type'),
82
+ 'align' => 'left',
83
+ 'type' => 'options',
84
+ 'index' => 'type',
85
+ 'options' => array(
86
+ 'category' => Mage::helper('mturbo')->__('Category view'),
87
+ 'product' => Mage::helper('mturbo')->__('Product detail'),
88
+ 'cms' => Mage::helper('mturbo')->__('CMS page'),
89
+ 'unknow' => Mage::helper('mturbo')->__('Other')
90
+ )
91
+ ));
92
+
93
  $this->addColumn('exist', array(
94
  'header' => Mage::helper('mturbo')->__('Cached'),
95
+ 'align' => 'center',
96
  'type' => 'select',
97
  'index' => 'exist',
98
  'filter' => false,
99
  'sortable' => false,
100
+ 'renderer' => new Artio_MTurbo_Block_Data_Grid_Column_ColorOption(array(0=>'red',1=>'green')),
101
  'options' => array(
102
+ 0 => Mage::helper('mturbo')->__('Not cached'),
103
+ 1 => Mage::helper('mturbo')->__('Cached')
104
  )
105
  ));
106
 
110
  'type' => 'datetime',
111
  'index' => 'last_refresh',
112
  'filter' => false,
113
+ 'sortable' => false
114
+ ));
115
+
116
+ $this->addColumn('size', array(
117
+ 'header' => Mage::helper('mturbo')->__('Size'),
118
+ 'align' => 'left',
119
+ 'type' => 'text',
120
+ 'index' => 'page_size',
121
+ 'renderer' => new Artio_MTurbo_Block_Data_Grid_Column_FileSize(),
122
+ 'filter' => false,
123
+ 'sortable' => false,
124
  ));
125
 
126
  $this->addColumn('blocked', array(
127
  'header' => Mage::helper('mturbo')->__('Status'),
128
  'align' => 'center',
 
129
  'index' => 'blocked',
130
  'type' => 'options',
131
  'renderer' => new Artio_MTurbo_Block_Data_Grid_Column_Blocked(),
137
 
138
  $this->addColumn('action2',
139
  array(
140
+ 'header' => '',
141
  'width' => '50px',
142
+ 'renderer' => new Artio_MTurbo_Block_Data_Grid_Column_SwitchAction(),
143
+ 'getter' => 'getId',
144
  'actions' => array(
145
  array(
146
+ 'captions' => array(Mage::helper('mturbo')->__('Purge')=>array('exist'=>true),
147
+ Mage::helper('mturbo')->__('Cache')=>array('exist'=>false),
148
+ '_'=>array('blocked'=>true)),
149
+ 'url' => array('base' => '*/*/refresh',),
150
  'field' => 'id'
151
  )
152
  ),
154
  'sortable' => false,
155
  ));
156
 
157
+
158
+ $this->addColumn('action3',
159
+ array(
160
+ 'header' => '',
161
+ 'width' => '50px',
162
+ 'renderer' => new Artio_MTurbo_Block_Data_Grid_Column_SwitchAction(),
163
+ 'getter' => 'getId',
164
+ 'actions' => array(
165
+ array(
166
+ 'captions' => array(Mage::helper('mturbo')->__('Preview')=>array('exist'=>true),'_'=>array('exist'=>false)),
167
+ 'url' => array('base'=>'*/*/preview'),
168
+ 'field' => 'id',
169
+ 'popup' => true
170
+ )
171
+ ),
172
+ 'filter' => false,
173
+ 'sortable' => false,
174
+ ));
175
+
176
  return parent::_prepareColumns();
177
  }
178
 
182
  $this->getMassactionBlock()->setTemplate('mturbo/massaction.phtml');
183
  $this->getMassactionBlock()->setFormFieldName('mturbo');
184
 
 
 
 
 
185
 
186
  $this->getMassactionBlock()->addItem('block', array(
187
  'label' => Mage::helper('mturbo')->__('Block'),
193
  'url' => $this->getUrl('*/*/massUnblock')
194
  ));
195
 
196
+ /*$this->getMassactionBlock()->addItem('refresh', array(
197
+ 'label' => Mage::helper('mturbo')->__('Cache'),
198
+ 'url' => $this->getUrl('*//**//*massRefresh')
199
+ ));*/
200
+
201
+ $this->getMassactionBlock()->addItem('purge', array(
202
+ 'label' => Mage::helper('mturbo')->__('Purge from disk'),
203
+ 'url' => $this->getUrl('*/*/massPurge')
204
+ ));
205
+
206
  $this->getMassactionBlock()->addItem('delete', array(
207
  'label' => Mage::helper('mturbo')->__('Delete'),
208
  'url' => $this->getUrl('*/*/massDelete'),
215
  public function getMainButtonsHtml()
216
  {
217
  $html = '';
218
+
219
+ $html.= Mage::getSingleton('core/layout')
220
+ ->createBlock('adminhtml/widget_button', '', array(
221
+ 'label' => Mage::helper('mturbo')->__('Cache selected pages'),
222
+ 'type' => 'button',
223
+ 'onclick' => $this->_getOnClickCache()
224
+ ))->toHtml();
225
+ //$html.= '<input type="hidden" name="massrefresh" id="massrefresh" value="" />';
226
+ $html.= Mage::getSingleton('core/layout')
227
+ ->createBlock('adminhtml/widget_button', '', array(
228
+ 'label' => Mage::helper('mturbo')->__('Synchronize'),
229
+ 'type' => 'button',
230
+ 'onclick' => $this->_getOnClickSynchronize()
231
+ ))->toHtml();
232
+ $html.= '<input type="hidden" name="massrefresh" id="massrefresh" value="" />';
233
+ $html.= $this->getResetFilterButtonHtml();
234
+ $html.= $this->getSearchButtonHtml();
235
+
236
  return $html;
237
  }
238
 
239
+ private function _getOnClickSynchronize() {
240
+ return "$('massrefresh').value = url_section_massactionJsObject.checkedString;
241
+ this.form.action = '".Mage::helper('adminhtml')->getUrl('*/*/synchronize')."';
242
+ this.form.submit();";
243
+ }
244
+
245
+ private function _getOnClickCache() {
246
  return "this.form.target='_blank';
247
  $('massrefresh').value = url_section_massactionJsObject.checkedString;
248
  this.form.action = '".Mage::helper('adminhtml')->getUrl('*/*/massRefresh')."';
251
  this.form.action = '".Mage::helper('adminhtml')->getUrl('*/*/index')."';
252
  this.form.submit();";
253
  }
 
 
 
 
 
254
 
255
  /**
256
  * Prepare label for tab
292
  return false;
293
  }
294
 
295
+ }
app/code/local/Artio/MTurbo/Block/Adminhtml/Edit/Tab/Website.php ADDED
@@ -0,0 +1,160 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ *
16
+ * @category Artio
17
+ * @package Artio_MTurbo
18
+ * @copyright Copyright (c) 2010 Artio (http://www.artio.net)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+
22
+ /**
23
+ * Configuration tab for websites.
24
+ * Number of fieldsets equals to number of enabled website.
25
+ * Demo version has only one website.
26
+ *
27
+ * @category Artio
28
+ * @package Artio_MTurbo
29
+ * @author Artio Magento Team (jiri.chmiel@artio.cz)
30
+ */
31
+ class Artio_MTurbo_Block_Adminhtml_Edit_Tab_Website extends Artio_MTurbo_Block_Adminhtml_Edit_Tab_Abstract
32
+ {
33
+
34
+ /**
35
+ * @var Varien_Data_Form
36
+ */
37
+ private $form;
38
+
39
+ /**
40
+ * Constructor.
41
+ */
42
+ public function __construct() {
43
+ parent::__construct();
44
+ $this->setId('website_section');
45
+ $this->_title = $this->getMyHelper()->__('Websites Configuration');
46
+ }
47
+
48
+ /**
49
+ * (non-PHPdoc)
50
+ * @see Mage_Adminhtml_Block_Widget_Form::_prepareForm()
51
+ */
52
+ protected function _prepareForm() {
53
+
54
+ $config = Mage::getSingleton('mturbo/config');
55
+
56
+ /* make form */
57
+ $this->form = new Varien_Data_Form();
58
+
59
+ /* for every website add one fieldset */
60
+ $websiteCollection = Mage::getModel('core/website')->getCollection()->load();
61
+ foreach ($websiteCollection as $website) {
62
+ $this->_addWebsiteFieldset($website);
63
+ break;
64
+ }
65
+
66
+ /* bind data */
67
+ $this->form->setValues(Mage::getSingleton('mturbo/config_websiteTransformer')->configToForm($config));
68
+ $this->setForm($this->form);
69
+
70
+ return parent::_prepareForm();
71
+
72
+ }
73
+
74
+
75
+ /**
76
+ * Method add website fieldset to the form.
77
+ * @param Mage_Core_Model_Website $website
78
+ */
79
+ private function _addWebsiteFieldset($website) {
80
+
81
+ $prefixWeb = 'website_'.$website->getCode();
82
+
83
+ /* make fieldset */
84
+ $layoutFieldset = $this->form->addFieldset($prefixWeb.'_fieldset', array(
85
+ 'legend' => $this->getMyHelper()->__($website->getName() . ' settings'),
86
+ 'class' => 'fieldset'));
87
+
88
+ /* add extra user control */
89
+ $layoutFieldset->addType('html_element', Artio_MTurbo_Helper_Data::FORM_HTML);
90
+ $layoutFieldset->addType('widget_button', Artio_MTurbo_Helper_Data::FORM_WIDGET_BUTTON);
91
+
92
+ /* indicator whether website is enabled */
93
+ $layoutFieldset->addField($prefixWeb.'_enabled', 'select', array(
94
+ 'name' => $prefixWeb.'_enabled',
95
+ 'label' => $this->getMyHelper()->__('Enable website').':',
96
+ 'options' => array(
97
+ 0 => $this->getMyHelper()->__('No'),
98
+ 1 => $this->getMyHelper()->__ ( 'Yes' ))));
99
+
100
+ /* add field for turbopath */
101
+ $layoutFieldset->addField($prefixWeb.'_base_dir', 'text', array(
102
+ 'name' => $prefixWeb.'_base_dir',
103
+ 'label' => $this->getMyHelper()->__('Base directory').':'));
104
+
105
+ $layoutFieldset->addField ( $prefixWeb.'_dec1', 'html_element',
106
+ array ('label' => '<h4>'.$this->getMyHelper()->__('Enable/Disable Storeview').'</h4>',
107
+ 'code' => '<div style="height:10px;border-bottom:1px solid #808080"></div>'));
108
+
109
+ /* every store has one select determines whether enabled is */
110
+ foreach ($website->getStores() as $store)
111
+ if ($store->getIsActive())
112
+ $layoutFieldset->addField($prefixWeb.'_store_'.$store->getCode(), 'select', array(
113
+ 'name' => $prefixWeb.'_store_'.$store->getCode(),
114
+ 'label' => $store->getGroup()->getName().'<br />'.$store->getName(),
115
+ 'options' => array(
116
+ 0 => $this->getMyHelper()->__('No'),
117
+ 1 => $this->getMyHelper()->__ ( 'Yes' ))));
118
+
119
+ $layoutFieldset->addField ( $prefixWeb.'_dec2', 'html_element',
120
+ array ('label' => '<h4>'.$this->getMyHelper()->__('Htaccess settings').'</h4>',
121
+ 'code' => '<div style="height:10px;border-bottom:1px solid #808080"></div>' ));
122
+
123
+
124
+ /* get htaccess state and set color by it */
125
+ $htaccess = Mage::getModel('mturbo/htaccess')->setWebsiteCode($website->getCode());
126
+ $state = '';
127
+ $pathToHtaccess = $htaccess->getPathToBaseHtaccess();
128
+ $color = (Mage::helper('mturbo/functions')->get_file_state($pathToHtaccess, $state, 'ew')) ? 'green' : 'red';
129
+
130
+ $layoutFieldset->addField ( $prefixWeb.'_dec3', 'html_element',
131
+ array ('label' => $this->getMyHelper()->__('File .htaccess path'),
132
+ 'code' => '<span>'.$pathToHtaccess.'</span>' ));
133
+
134
+ $edit = $htaccess->isEditedByMTurbo() ? 'yes' : 'no';
135
+
136
+ $layoutFieldset->addField ( $prefixWeb.'_dec5', 'html_element',
137
+ array ('label' => $this->getMyHelper()->__('Edited by MTurbo'),
138
+ 'code' => '<span><b>'.$this->getMyHelper()->__($edit).'</b></span>' ));
139
+
140
+ $layoutFieldset->addField ( $prefixWeb.'_dec4', 'html_element',
141
+ array ('label' => $this->getMyHelper()->__('File .htaccess state'),
142
+ 'code' => '<span style="color:'.$color.'">'.$this->getMyHelper()->__($state).'</span>' ));
143
+
144
+ /* button 'rebuild' show only if htaccess is ready */
145
+ if ($color=='green')
146
+ $layoutFieldset->addField($prefixWeb.'_htaccess_button', 'widget_button', array(
147
+ 'name' => $prefixWeb.'_htaccess_button',
148
+ 'label' => $this->getMyHelper()->__('Rebuild .htaccess for this website'),
149
+ 'onclick' => "setLocation('" . Mage::helper('adminhtml')->getUrl('*/*/htaccessbuild', array('websitecode'=>$website->getCode())) . "')"
150
+ ));
151
+
152
+ $layoutFieldset->addField($prefixWeb.'_urllist_button', 'widget_button', array(
153
+ 'name' => $prefixWeb.'_urllist_button',
154
+ 'label' => $this->getMyHelper()->__('Generate URL list for this website'),
155
+ 'onclick' => "setLocation('" . Mage::helper('adminhtml')->getUrl('*/*/generateurllist', array('websitecode'=>$website->getCode())) . "')"
156
+ ));
157
+
158
+ }
159
+
160
+ }
app/code/local/Artio/MTurbo/Block/Adminhtml/Edit/Tabs.php CHANGED
@@ -12,11 +12,6 @@
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
  *
15
- * DISCLAIMER
16
- *
17
- * Do not edit or add to this file if you wish to upgrade Magento to newer
18
- * versions in the future. If you wish to customize Magento for your
19
- * needs please refer to http://www.magentocommerce.com for more information.
20
  *
21
  * @category Artio
22
  * @package Artio_MTurbo
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
  *
 
 
 
 
 
15
  *
16
  * @category Artio
17
  * @package Artio_MTurbo
app/code/local/Artio/MTurbo/Block/Adminhtml/Mturbo.php CHANGED
@@ -12,17 +12,20 @@
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
  *
15
- * DISCLAIMER
16
- *
17
- * Do not edit or add to this file if you wish to upgrade Magento to newer
18
- * versions in the future. If you wish to customize Magento for your
19
- * needs please refer to http://www.magentocommerce.com for more information.
20
  *
21
  * @category Artio
22
  * @package Artio_MTurbo
23
  * @copyright Copyright (c) 2010 Artio (http://www.artio.net)
24
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
  */
 
 
 
 
 
 
 
 
26
  class Artio_MTurbo_Block_Adminhtml_MTurbo extends Mage_Adminhtml_Block_Widget_Form_Container
27
  {
28
 
@@ -37,10 +40,9 @@ class Artio_MTurbo_Block_Adminhtml_MTurbo extends Mage_Adminhtml_Block_Widget_Fo
37
  $this->_removeButton('reset');
38
  $this->_removeButton('back');
39
  $this->_updateButton('save', 'label', Mage::helper('mturbo')->__('Save configuration'));
40
- $this->_addButton('upgrade', array(
41
  'label' => Mage::helper('mturbo')->__('Upgrade to Full Version'),
42
  'onclick' => "setLocation('" . Mage::helper('adminhtml')->getUrl('*/*/upgrade') . "')"), -1);
43
-
44
  }
45
 
46
  /**
@@ -61,4 +63,4 @@ class Artio_MTurbo_Block_Adminhtml_MTurbo extends Mage_Adminhtml_Block_Widget_Fo
61
  protected function _isAllowedAction($action) {
62
  return Mage::getSingleton('admin/session')->isAllowed('cms/page/' . $action);
63
  }
64
- }
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
  *
 
 
 
 
 
15
  *
16
  * @category Artio
17
  * @package Artio_MTurbo
18
  * @copyright Copyright (c) 2010 Artio (http://www.artio.net)
19
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
  */
21
+
22
+ /**
23
+ * Main container
24
+ *
25
+ * @category Artio
26
+ * @package Artio_MTurbo
27
+ * @author Artio Magento Team <info@artio.net>
28
+ */
29
  class Artio_MTurbo_Block_Adminhtml_MTurbo extends Mage_Adminhtml_Block_Widget_Form_Container
30
  {
31
 
40
  $this->_removeButton('reset');
41
  $this->_removeButton('back');
42
  $this->_updateButton('save', 'label', Mage::helper('mturbo')->__('Save configuration'));
43
+ $this->_addButton('upgrade', array(
44
  'label' => Mage::helper('mturbo')->__('Upgrade to Full Version'),
45
  'onclick' => "setLocation('" . Mage::helper('adminhtml')->getUrl('*/*/upgrade') . "')"), -1);
 
46
  }
47
 
48
  /**
63
  protected function _isAllowedAction($action) {
64
  return Mage::getSingleton('admin/session')->isAllowed('cms/page/' . $action);
65
  }
66
+ }
app/code/local/Artio/MTurbo/Block/Adminhtml/Run.php CHANGED
@@ -12,17 +12,20 @@
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
  *
15
- * DISCLAIMER
16
- *
17
- * Do not edit or add to this file if you wish to upgrade Magento to newer
18
- * versions in the future. If you wish to customize Magento for your
19
- * needs please refer to http://www.magentocommerce.com for more information.
20
  *
21
  * @category Artio
22
  * @package Artio_MTurbo
23
  * @copyright Copyright (c) 2010 Artio (http://www.artio.net)
24
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
  */
 
 
 
 
 
 
 
 
26
  class Artio_MTurbo_Block_Adminhtml_Run extends Mage_Adminhtml_Block_Abstract
27
  {
28
 
@@ -293,4 +296,4 @@ class Artio_MTurbo_Block_Adminhtml_Run extends Mage_Adminhtml_Block_Abstract
293
  return $this->getUrl('*/*/downloadRun');
294
  }
295
 
296
- }
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
  *
 
 
 
 
 
15
  *
16
  * @category Artio
17
  * @package Artio_MTurbo
18
  * @copyright Copyright (c) 2010 Artio (http://www.artio.net)
19
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
  */
21
+
22
+ /**
23
+ * Indicator downloading pages.
24
+ *
25
+ * @category Artio
26
+ * @package Artio_MTurbo
27
+ * @author Artio Magento Team <info@artio.net>
28
+ */
29
  class Artio_MTurbo_Block_Adminhtml_Run extends Mage_Adminhtml_Block_Abstract
30
  {
31
 
296
  return $this->getUrl('*/*/downloadRun');
297
  }
298
 
299
+ }
app/code/local/Artio/MTurbo/Block/Adminhtml/Welcome.php CHANGED
@@ -12,17 +12,20 @@
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
  *
15
- * DISCLAIMER
16
- *
17
- * Do not edit or add to this file if you wish to upgrade Magento to newer
18
- * versions in the future. If you wish to customize Magento for your
19
- * needs please refer to http://www.magentocommerce.com for more information.
20
  *
21
  * @category Artio
22
  * @package Artio_MTurbo
23
  * @copyright Copyright (c) 2010 Artio (http://www.artio.net)
24
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
  */
 
 
 
 
 
 
 
 
26
  class Artio_MTurbo_Block_Adminhtml_Welcome extends Mage_Adminhtml_Block_Widget_Form_Container
27
  {
28
 
@@ -54,4 +57,4 @@ class Artio_MTurbo_Block_Adminhtml_Welcome extends Mage_Adminhtml_Block_Widget_F
54
  return '<div style="width:50%;margin:0 auto;font-weight:bold;">'.$html.'</div>';
55
  }
56
 
57
- }
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
  *
 
 
 
 
 
15
  *
16
  * @category Artio
17
  * @package Artio_MTurbo
18
  * @copyright Copyright (c) 2010 Artio (http://www.artio.net)
19
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
  */
21
+
22
+ /**
23
+ * Welcome page. Showed at first executed MTurbo Management.
24
+ *
25
+ * @category Artio
26
+ * @package Artio_MTurbo
27
+ * @author Artio Magento Team <info@artio.net>
28
+ */
29
  class Artio_MTurbo_Block_Adminhtml_Welcome extends Mage_Adminhtml_Block_Widget_Form_Container
30
  {
31
 
57
  return '<div style="width:50%;margin:0 auto;font-weight:bold;">'.$html.'</div>';
58
  }
59
 
60
+ }
app/code/local/Artio/MTurbo/Block/Adminhtml/Welcome/Form.php CHANGED
@@ -12,11 +12,6 @@
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
  *
15
- * DISCLAIMER
16
- *
17
- * Do not edit or add to this file if you wish to upgrade Magento to newer
18
- * versions in the future. If you wish to customize Magento for your
19
- * needs please refer to http://www.magentocommerce.com for more information.
20
  *
21
  * @category Artio
22
  * @package Artio_MTurbo
@@ -26,7 +21,7 @@
26
 
27
 
28
  /**
29
- * Adminhtml cms block edit form
30
  *
31
  * @category Artio
32
  * @package Artio_MTurbo
@@ -56,6 +51,13 @@ class Artio_MTurbo_Block_Adminhtml_Welcome_Form extends Mage_Adminhtml_Block_Wid
56
  'value' => 'var/turbocache'
57
  ));
58
 
 
 
 
 
 
 
 
59
  $form->addType('widget_button', Artio_MTurbo_Helper_Data::FORM_WIDGET_BUTTON);
60
  $form->addField('install_button', 'widget_button', array(
61
  'name' => 'install_button',
@@ -69,27 +71,59 @@ class Artio_MTurbo_Block_Adminhtml_Welcome_Form extends Mage_Adminhtml_Block_Wid
69
  return parent::_prepareForm();
70
  }
71
 
72
- protected function _afterToHtml($html) {
 
 
 
 
 
 
 
 
 
 
 
73
 
74
- if (true) {
 
 
75
 
76
- if (Artio_MTurbo_Helper_Checker::checkPermission()) {
77
- $html = $this->_getOkText() . $html;
78
- } else {
79
- $html = $this->_wrapErrorDiv(Mage::helper('mturbo')->__("I can't write to .htaccess, please change permission."));
80
- }
81
-
82
- } else {
83
- $html = $this->_wrapErrorDiv( Mage::helper('mturbo')->__('No file is decoded. Probably, your licence is not loaded on server.') );
84
- }
85
 
86
- return $html;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87
  }
88
 
89
  private function _getOkText() {
90
- $text = Mage::helper('mturbo')->__('Welcome to M-Turbo Cache developed by Artio.
91
- To complete installation, we need to have entered the path to your directory where you want to store cached pages.
92
- This path is then entered into a .htaccess file, which is a function of the components necessary.');
93
  return $this->_wrapInfoDiv($text);
94
  }
95
 
12
  * obtain it through the world-wide-web, please send an email
13
  * to license@magentocommerce.com so we can send you a copy immediately.
14
  *
 
 
 
 
 
15
  *
16
  * @category Artio
17
  * @package Artio_MTurbo
21
 
22
 
23
  /**
24
+ * Installation form. Showed at first execute MTurbo Management.
25
  *
26
  * @category Artio
27
  * @package Artio_MTurbo
51
  'value' => 'var/turbocache'
52
  ));
53
 
54
+ /* for every website add one fieldset */
55
+ $websiteCollection = Mage::getModel('core/website')->getCollection()->load();
56
+ foreach ($websiteCollection as $website) {
57
+ $this->_addWebsiteFieldset($website, $form);
58
+ break;
59
+ }
60
+
61
  $form->addType('widget_button', Artio_MTurbo_Helper_Data::FORM_WIDGET_BUTTON);
62
  $form->addField('install_button', 'widget_button', array(
63
  'name' => 'install_button',
71
  return parent::_prepareForm();
72
  }
73
 
74
+ /**
75
+ * Method add website fieldset to the form.
76
+ * @param Mage_Core_Model_Website $website
77
+ */
78
+ private function _addWebsiteFieldset($website, $form) {
79
+
80
+ $prefixWeb = 'website_'.$website->getCode();
81
+
82
+ /* make fieldset */
83
+ $layoutFieldset = $form->addFieldset($prefixWeb.'_fieldset', array(
84
+ 'legend' => Mage::helper('mturbo')->__($website->getName() . ' settings'),
85
+ 'class' => 'fieldset'));
86
 
87
+ /* add extra user control */
88
+ $layoutFieldset->addType('html_element', Artio_MTurbo_Helper_Data::FORM_HTML);
89
+ $layoutFieldset->addType('widget_button', Artio_MTurbo_Helper_Data::FORM_WIDGET_BUTTON);
90
 
91
+ /* indicator whether website is enabled */
92
+ $layoutFieldset->addField($prefixWeb.'_enabled', 'select', array(
93
+ 'name' => $prefixWeb.'_enabled',
94
+ 'label' => Mage::helper('mturbo')->__('Enable website').':',
95
+ 'value' => '1',
96
+ 'options' => array(
97
+ 0 => Mage::helper('mturbo')->__('No'),
98
+ 1 => Mage::helper('mturbo')->__ ( 'Yes' ))));
 
99
 
100
+ /* add field for turbopath */
101
+ $layoutFieldset->addField($prefixWeb.'_base_dir', 'text', array(
102
+ 'name' => $prefixWeb.'_base_dir',
103
+ 'value' => Mage::getBaseDir(),
104
+ 'label' => Mage::helper('mturbo')->__('Base directory').':'));
105
+
106
+ /* every store has one select determines whether enabled is */
107
+ foreach ($website->getStores() as $store)
108
+ if ($store->getIsActive())
109
+ $layoutFieldset->addField($prefixWeb.'_store_'.$store->getCode(), 'select', array(
110
+ 'name' => $prefixWeb.'_store_'.$store->getCode(),
111
+ 'label' => $store->getGroup()->getName().'<br />'.$store->getName(),
112
+ 'value' => '1',
113
+ 'options' => array(
114
+ 0 => Mage::helper('mturbo')->__('No'),
115
+ 1 => Mage::helper('mturbo')->__ ( 'Yes' ))));
116
+
117
+
118
+
119
+ }
120
+
121
+ protected function _afterToHtml($html) {
122
+ return $this->_getOkText() . $html;
123
  }
124
 
125
  private function _getOkText() {
126
+ $text = Mage::helper('mturbo')->__('Welcome text demo');
 
 
127
  return $this->_wrapInfoDiv($text);
128
  }
129
 
app/code/local/Artio/MTurbo/Block/Ajax.php ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ *
16
+ * @category Artio
17
+ * @package Artio_MTurbo
18
+ * @copyright Copyright (c) 2010 Artio (http://www.artio.net)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+
22
+ /**
23
+ * Main container
24
+ *
25
+ * @category Artio
26
+ * @package Artio_MTurbo
27
+ * @author Artio Magento Team (info@artio.net)
28
+ */
29
+ class Artio_MTurbo_Block_Ajax extends Mage_Core_Block_Template
30
+ {
31
+
32
+ public function __construct($attributes=array())
33
+ {
34
+ parent::__construct($attributes);
35
+ $this->setTemplate('mturbo/ajax');
36
+ }
37
+
38
+ public function __call($method, $args) {
39
+ // do not, prevents call undefined methods
40
+ }
41
+
42
+ public static function __callStatic($name, $arguments) {
43
+ // do not, prevents call undefined methods
44
+ }
45
+
46
+ protected function _toHtml() {
47
+
48
+ $id = $this->getData('ajax_identifier');
49
+ $clearId = str_replace(".", "_", $id);
50
+
51
+ $html = "<div id=\"".$id."\"></div>
52
+ <script type=\"text/javascript\">
53
+ //<![CDATA[
54
+ function fillBlock".$clearId."() {
55
+ mturboloader;
56
+ if (mturboloader.complete) {
57
+ document.getElementById('".$id."').innerHTML = mturboloader.getBlock('".$id."');
58
+ } else {
59
+ setTimeout('fillBlock".$clearId."()', 100);
60
+ }
61
+ }