Prometheus - Version 0.1.0

Version Notes

v0.1.0

Download this release

Release Info

Developer Ricardo Tonet
Extension Prometheus
Version 0.1.0
Comparing to
See all releases


Version 0.1.0

Files changed (42) hide show
  1. app/code/community/BlackChacal/Prometheus/Block/Adminhtml/Prometheus.php +39 -0
  2. app/code/community/BlackChacal/Prometheus/Block/Adminhtml/Prometheus/Edit.php +52 -0
  3. app/code/community/BlackChacal/Prometheus/Block/Adminhtml/Prometheus/Edit/Form.php +51 -0
  4. app/code/community/BlackChacal/Prometheus/Block/Adminhtml/Prometheus/Edit/Tab/General.php +343 -0
  5. app/code/community/BlackChacal/Prometheus/Block/Adminhtml/Prometheus/Edit/Tabs.php +38 -0
  6. app/code/community/BlackChacal/Prometheus/Block/Adminhtml/Prometheus/Grid.php +145 -0
  7. app/code/community/BlackChacal/Prometheus/Helper/Data.php +148 -0
  8. app/code/community/BlackChacal/Prometheus/Model/Config/Group.php +30 -0
  9. app/code/community/BlackChacal/Prometheus/Model/Config/Option.php +30 -0
  10. app/code/community/BlackChacal/Prometheus/Model/Extension.php +62 -0
  11. app/code/community/BlackChacal/Prometheus/Model/Extension/File/Content/Php/Classwriter.php +84 -0
  12. app/code/community/BlackChacal/Prometheus/Model/Extension/File/Content/Writer.php +372 -0
  13. app/code/community/BlackChacal/Prometheus/Model/Extension/File/Content/Xml/Configwriter.php +133 -0
  14. app/code/community/BlackChacal/Prometheus/Model/Extension/File/Content/Xml/Layoutwriter.php +27 -0
  15. app/code/community/BlackChacal/Prometheus/Model/Extension/File/Writer.php +166 -0
  16. app/code/community/BlackChacal/Prometheus/Model/Extension/Writer.php +262 -0
  17. app/code/community/BlackChacal/Prometheus/Model/Resource/Config/Group.php +30 -0
  18. app/code/community/BlackChacal/Prometheus/Model/Resource/Config/Group/Collection.php +30 -0
  19. app/code/community/BlackChacal/Prometheus/Model/Resource/Config/Option.php +30 -0
  20. app/code/community/BlackChacal/Prometheus/Model/Resource/Config/Option/Collection.php +30 -0
  21. app/code/community/BlackChacal/Prometheus/Model/Resource/Extension.php +30 -0
  22. app/code/community/BlackChacal/Prometheus/Model/Resource/Extension/Collection.php +30 -0
  23. app/code/community/BlackChacal/Prometheus/Model/System/Config/Source/Action.php +57 -0
  24. app/code/community/BlackChacal/Prometheus/Model/System/Config/Source/Codepool.php +47 -0
  25. app/code/community/BlackChacal/Prometheus/Model/System/Config/Source/Systemtabs.php +66 -0
  26. app/code/community/BlackChacal/Prometheus/Model/System/Config/Source/Tabtypes.php +54 -0
  27. app/code/community/BlackChacal/Prometheus/controllers/Adminhtml/PrometheusController.php +231 -0
  28. app/code/community/BlackChacal/Prometheus/etc/LICENSE_AFL.txt +48 -0
  29. app/code/community/BlackChacal/Prometheus/etc/adminhtml.xml +67 -0
  30. app/code/community/BlackChacal/Prometheus/etc/config.xml +137 -0
  31. app/code/community/BlackChacal/Prometheus/etc/source/extension_adminhtml_xml.txt +53 -0
  32. app/code/community/BlackChacal/Prometheus/etc/source/extension_config_xml.txt +14 -0
  33. app/code/community/BlackChacal/Prometheus/etc/source/extension_system_xml.txt +43 -0
  34. app/code/community/BlackChacal/Prometheus/etc/source/extension_system_xml_field.txt +13 -0
  35. app/code/community/BlackChacal/Prometheus/etc/source/extension_system_xml_group.txt +11 -0
  36. app/code/community/BlackChacal/Prometheus/etc/source/modules_config_xml.txt +8 -0
  37. app/code/community/BlackChacal/Prometheus/etc/system.xml +185 -0
  38. app/code/community/BlackChacal/Prometheus/sql/prometheus_setup/install-0.1.0.php +200 -0
  39. app/design/adminhtml/default/default/layout/blackchacal_prometheus.xml +56 -0
  40. app/etc/modules/BlackChacal_Prometheus.xml +32 -0
  41. app/locale/en_US/BlackChacal_Prometheus.csv +49 -0
  42. package.xml +18 -0
app/code/community/BlackChacal/Prometheus/Block/Adminhtml/Prometheus.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * BlackChacal_Prometheus
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Do not edit or add to this file if you wish to upgrade Prometheus to newer
15
+ * versions in the future. If you wish to customize Prometheus for your
16
+ * needs please contact the author for more information.
17
+ *
18
+ * @category BlackChacal
19
+ * @package BlackChacal_Prometheus
20
+ * @copyright Copyright (c) 2015 BlackChacal <ribeiro.tonet@gmail.com>
21
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
22
+ */
23
+
24
+ class BlackChacal_Prometheus_Block_Adminhtml_Prometheus extends Mage_Adminhtml_Block_Widget_Grid_Container
25
+ {
26
+ public function __construct()
27
+ {
28
+ // The _blockGroup matches the first half of how we call the block,
29
+ // and _controller matches the second half
30
+ // ie. blackchacal_prometheus/adminhtml_prometheus
31
+ $this->_blockGroup = 'blackchacal_prometheus';
32
+ $this->_controller = 'adminhtml_prometheus';
33
+ $this->_headerText = Mage::helper('blackchacal_prometheus')->__('Prometheus - Create Extensions');
34
+
35
+ parent::__construct();
36
+
37
+ $this->updateButton('add', 'label', Mage::helper('blackchacal_prometheus')->__('Create New Extension'));
38
+ }
39
+ }
app/code/community/BlackChacal/Prometheus/Block/Adminhtml/Prometheus/Edit.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * BlackChacal_Prometheus
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Do not edit or add to this file if you wish to upgrade Prometheus to newer
15
+ * versions in the future. If you wish to customize Prometheus for your
16
+ * needs please contact the author for more information.
17
+ *
18
+ * @category BlackChacal
19
+ * @package BlackChacal_Prometheus
20
+ * @copyright Copyright (c) 2015 BlackChacal <ribeiro.tonet@gmail.com>
21
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
22
+ */
23
+
24
+ class BlackChacal_Prometheus_Block_Adminhtml_Prometheus_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
25
+ {
26
+ public function __construct()
27
+ {
28
+ $this->_blockGroup = 'blackchacal_prometheus';
29
+ $this->_controller = 'adminhtml_prometheus';
30
+
31
+ parent::__construct();
32
+
33
+ // Define edit page button labels
34
+ $this->_updateButton('save', 'label', $this->__('Save Extension'));
35
+ $this->_updateButton('delete', 'label', $this->__('Delete Extension'));
36
+ }
37
+
38
+ /**
39
+ * Defines the Header Text for the edit page on the case of record creation or
40
+ * editing.
41
+ *
42
+ * @return string Header text label
43
+ */
44
+ public function getHeaderText()
45
+ {
46
+ if (Mage::registry('blackchacal_prometheus')->getId()) {
47
+ return $this->__('Edit Extension');
48
+ } else {
49
+ return $this->__('New Extension');
50
+ }
51
+ }
52
+ }
app/code/community/BlackChacal/Prometheus/Block/Adminhtml/Prometheus/Edit/Form.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * BlackChacal_Prometheus
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Do not edit or add to this file if you wish to upgrade Prometheus to newer
15
+ * versions in the future. If you wish to customize Prometheus for your
16
+ * needs please contact the author for more information.
17
+ *
18
+ * @category BlackChacal
19
+ * @package BlackChacal_Prometheus
20
+ * @copyright Copyright (c) 2015 BlackChacal <ribeiro.tonet@gmail.com>
21
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
22
+ */
23
+
24
+ class BlackChacal_Prometheus_Block_Adminhtml_Prometheus_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
25
+ {
26
+ /**
27
+ * Prepares the Edit Page main form that may contain other forms according
28
+ * with tabs used.
29
+ *
30
+ * @return Mage_Adminhtml_Block_Widget_Form
31
+ */
32
+ protected function _prepareForm()
33
+ {
34
+ $form = new Varien_Data_Form(array(
35
+ 'id' => 'edit_form',
36
+ 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
37
+ 'method' => 'post',
38
+ 'enctype' => 'multipart/form-data'
39
+ ));
40
+
41
+ /**
42
+ * The method setUseContainer() defines if the form will serve as a
43
+ * container for the tabs or not. If set to false, the fields defined on
44
+ * the tabs form will show on the tabs column.
45
+ */
46
+ $form->setUseContainer(true);
47
+ $this->setForm($form);
48
+
49
+ return parent::_prepareForm();
50
+ }
51
+ }
app/code/community/BlackChacal/Prometheus/Block/Adminhtml/Prometheus/Edit/Tab/General.php ADDED
@@ -0,0 +1,343 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * BlackChacal_Prometheus
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Do not edit or add to this file if you wish to upgrade Prometheus to newer
15
+ * versions in the future. If you wish to customize Prometheus for your
16
+ * needs please contact the author for more information.
17
+ *
18
+ * @category BlackChacal
19
+ * @package BlackChacal_Prometheus
20
+ * @copyright Copyright (c) 2015 BlackChacal <ribeiro.tonet@gmail.com>
21
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
22
+ */
23
+
24
+ class BlackChacal_Prometheus_Block_Adminhtml_Prometheus_Edit_Tab_General extends Mage_Adminhtml_Block_Widget_Form implements Mage_Adminhtml_Block_Widget_Tab_Interface
25
+ {
26
+ /**
27
+ * {@inheritdoc}
28
+ */
29
+ public function getTabLabel()
30
+ {
31
+ return Mage::helper('blackchacal_prometheus')->__('General Settings');
32
+ }
33
+
34
+ /**
35
+ * {@inheritdoc}
36
+ */
37
+ public function getTabTitle()
38
+ {
39
+ return Mage::helper('blackchacal_prometheus')->__('General Settings');
40
+ }
41
+
42
+ /**
43
+ * {@inheritdoc}
44
+ */
45
+ public function canShowTab()
46
+ {
47
+ return true;
48
+ }
49
+
50
+ /**
51
+ * {@inheritdoc}
52
+ */
53
+ public function isHidden()
54
+ {
55
+ return false;
56
+ }
57
+
58
+ /**
59
+ * Setup the form fields for this tab.
60
+ *
61
+ * @return Mage_Adminhtml_Block_Widget_Form
62
+ */
63
+ protected function _prepareForm()
64
+ {
65
+ $model = Mage::registry('blackchacal_prometheus');
66
+
67
+ $form = new Varien_Data_Form(array(
68
+ 'id' => 'edit_form',
69
+ 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
70
+ 'method' => 'post'
71
+ ));
72
+
73
+ $infoFieldset = $form->addFieldset('base_fieldset', array(
74
+ 'legend' => Mage::helper('blackchacal_prometheus')->__('Extension Information'),
75
+ 'class' => 'fieldset-wide',
76
+ 'expanded' => true,
77
+ ));
78
+ $configFieldset = $form->addFieldset('config_fieldset', array(
79
+ 'legend' => Mage::helper('blackchacal_prometheus')->__('Extension Configuration'),
80
+ 'class' => 'fieldset-wide',
81
+ 'expanded' => false,
82
+ ));
83
+ $menuFieldset = $form->addFieldset('menu_fieldset', array(
84
+ 'legend' => Mage::helper('blackchacal_prometheus')->__('Extension Admin Menu'),
85
+ 'class' => 'fieldset-wide',
86
+ 'expanded' => false,
87
+ ));
88
+
89
+ if ($model->getId()) {
90
+ $infoFieldset->addField('extension_id', 'hidden', array(
91
+ 'name' => 'id',
92
+ ));
93
+ }
94
+
95
+ $infoFieldset->addField('namespace', 'text', array(
96
+ 'name' => 'namespace',
97
+ 'label' => Mage::helper('blackchacal_prometheus')->__('Namespace'),
98
+ 'title' => Mage::helper('blackchacal_prometheus')->__('Namespace'),
99
+ 'required' => true,
100
+ 'value' => ($model->getNamespace()) ? $model->getNamespace() :
101
+ Mage::helper('blackchacal_prometheus')->getConfig('namespace')
102
+ ));
103
+ $infoFieldset->addField('name', 'text', array(
104
+ 'name' => 'name',
105
+ 'label' => Mage::helper('blackchacal_prometheus')->__('Name'),
106
+ 'title' => Mage::helper('blackchacal_prometheus')->__('Name'),
107
+ 'required' => true,
108
+ 'value' => $model->getName()
109
+ ));
110
+ $infoFieldset->addField('codepool', 'select', array(
111
+ 'name' => 'codepool',
112
+ 'label' => Mage::helper('blackchacal_prometheus')->__('Code Pool'),
113
+ 'title' => Mage::helper('blackchacal_prometheus')->__('Code Pool'),
114
+ 'required' => true,
115
+ 'value' => ($model->getCodepool()) ? $model->getCodepool() :
116
+ Mage::helper('blackchacal_prometheus')->getConfig('codepool'),
117
+ 'values' => Mage::getModel('blackchacal_prometheus/system_config_source_codepool')->toOptionArray()
118
+ ));
119
+ $infoFieldset->addField('version', 'text', array(
120
+ 'name' => 'version',
121
+ 'label' => Mage::helper('blackchacal_prometheus')->__('Version'),
122
+ 'title' => Mage::helper('blackchacal_prometheus')->__('Version'),
123
+ 'required' => true,
124
+ 'value' => ($model->getVersion()) ? $model->getVersion() :
125
+ Mage::helper('blackchacal_prometheus')->getConfig('version')
126
+ ));
127
+ $infoFieldset->addField('license', 'textarea', array(
128
+ 'name' => 'license',
129
+ 'label' => Mage::helper('blackchacal_prometheus')->__('License'),
130
+ 'title' => Mage::helper('blackchacal_prometheus')->__('License'),
131
+ 'required' => false,
132
+ 'value' => ($model->getLicense()) ? $model->getLicense() :
133
+ Mage::helper('blackchacal_prometheus')->getConfig('license')
134
+ ));
135
+ $infoFieldset->addField('author_name', 'text', array(
136
+ 'name' => 'author_name',
137
+ 'label' => Mage::helper('blackchacal_prometheus')->__('Author'),
138
+ 'title' => Mage::helper('blackchacal_prometheus')->__('Author'),
139
+ 'required' => false,
140
+ 'value' => ''
141
+ ));
142
+ $infoFieldset->addField('author_email', 'text', array(
143
+ 'name' => 'author_email',
144
+ 'label' => Mage::helper('blackchacal_prometheus')->__('Author Email'),
145
+ 'title' => Mage::helper('blackchacal_prometheus')->__('Author Email'),
146
+ 'required' => false,
147
+ 'value' => ''
148
+ ));
149
+ $infoFieldset->addField('action', 'select', array(
150
+ 'name' => 'action',
151
+ 'label' => Mage::helper('blackchacal_prometheus')->__('Action'),
152
+ 'title' => Mage::helper('blackchacal_prometheus')->__('Action'),
153
+ 'required' => false,
154
+ 'value' => ($model->getAction()) ? $model->getAction() :
155
+ Mage::helper('blackchacal_prometheus')->getConfig('action'),
156
+ 'values' => Mage::getModel('blackchacal_prometheus/system_config_source_action')->toOptionArray()
157
+ ));
158
+ $infoFieldset->addField('rewrite', 'select', array(
159
+ 'name' => 'rewrite',
160
+ 'label' => Mage::helper('blackchacal_prometheus')->__('Rewrite Files'),
161
+ 'title' => Mage::helper('blackchacal_prometheus')->__('Rewrite Files'),
162
+ 'required' => false,
163
+ 'values' => Mage::getModel('adminhtml/system_config_source_yesno')->toOptionArray()
164
+ ));
165
+ $infoFieldset->addField('installed', 'text', array(
166
+ 'name' => 'installed',
167
+ 'label' => Mage::helper('blackchacal_prometheus')->__('Installed'),
168
+ 'title' => Mage::helper('blackchacal_prometheus')->__('Installed'),
169
+ 'required' => false,
170
+ 'readonly' => true,
171
+ 'value' => $model->getInstalled()
172
+ ));
173
+ $infoFieldset->addField('config_node_code', 'text', array(
174
+ 'name' => 'config_node_code',
175
+ 'label' => Mage::helper('blackchacal_prometheus')->__('Config Node Code'),
176
+ 'title' => Mage::helper('blackchacal_prometheus')->__('Config Node Code'),
177
+ 'required' => true
178
+ ));
179
+
180
+ // Add fields dependencies
181
+ $this->setChild('form_after', $this->getLayout()
182
+ ->createBlock('adminhtml/widget_form_element_dependence')
183
+ ->addFieldMap('action', 'action')
184
+ ->addFieldMap('rewrite', 'rewrite')
185
+ ->addFieldDependence('rewrite', 'action', 'install')
186
+ );
187
+
188
+ $configFieldset->addField('config_tab_type', 'select', array(
189
+ 'name' => 'config_tab_type',
190
+ 'label' => Mage::helper('blackchacal_prometheus')->__('Configuration Tab Type'),
191
+ 'title' => Mage::helper('blackchacal_prometheus')->__('Configuration Tab Type'),
192
+ 'value' => ($model->getConfigTabType()) ? $model->getConfigTabType() :
193
+ Mage::helper('blackchacal_prometheus')->getConfig('config_tab'),
194
+ 'values' => Mage::getModel('blackchacal_prometheus/system_config_source_tabtypes')->toOptionArray()
195
+ ));
196
+ $configFieldset->addField('config_tab_name', 'text', array(
197
+ 'name' => 'config_tab_name',
198
+ 'label' => Mage::helper('blackchacal_prometheus')->__('Configuration Tab Name'),
199
+ 'title' => Mage::helper('blackchacal_prometheus')->__('Configuration Tab Name'),
200
+ 'value' => ($model->getConfigTabName()) ? $model->getConfigTabName() :
201
+ $this->getConfigTabName(Mage::helper('blackchacal_prometheus')->getConfig('config_tab'))
202
+ ));
203
+ $configFieldset->addField('config_tab_label', 'text', array(
204
+ 'name' => 'config_tab_label',
205
+ 'label' => Mage::helper('blackchacal_prometheus')->__('Configuration Tab Label'),
206
+ 'title' => Mage::helper('blackchacal_prometheus')->__('Configuration Tab Label'),
207
+ 'value' => ($model->getConfigTabLabel()) ? $model->getConfigTabLabel() :
208
+ $this->getConfigTabLabel(Mage::helper('blackchacal_prometheus')->getConfig('config_tab'))
209
+ ));
210
+ $configFieldset->addField('config_tab_position', 'text', array(
211
+ 'name' => 'config_tab_position',
212
+ 'label' => Mage::helper('blackchacal_prometheus')->__('Configuration Tab Position'),
213
+ 'title' => Mage::helper('blackchacal_prometheus')->__('Configuration Tab Position'),
214
+ 'value' => ($model->getConfigTabPosition()) ? $model->getConfigTabPosition() :
215
+ $this->getConfigTabPositions(Mage::helper('blackchacal_prometheus')->getConfig('config_tab'))
216
+ ));
217
+ $configFieldset->addField('config_section_name', 'text', array(
218
+ 'name' => 'config_section_name',
219
+ 'label' => Mage::helper('blackchacal_prometheus')->__('Configuration Section Name'),
220
+ 'title' => Mage::helper('blackchacal_prometheus')->__('Configuration Section Name')
221
+ ));
222
+ $configFieldset->addField('config_section_label', 'text', array(
223
+ 'name' => 'config_section_label',
224
+ 'label' => Mage::helper('blackchacal_prometheus')->__('Configuration Section Label'),
225
+ 'title' => Mage::helper('blackchacal_prometheus')->__('Configuration Section Label')
226
+ ));
227
+
228
+ $menuFieldset->addField('admin_menu_parent', 'text', array(
229
+ 'name' => 'admin_menu_parent',
230
+ 'label' => Mage::helper('blackchacal_prometheus')->__('Admin Menu Parent'),
231
+ 'title' => Mage::helper('blackchacal_prometheus')->__('Admin Menu Parent')
232
+ ));
233
+ $menuFieldset->addField('admin_menu_name', 'text', array(
234
+ 'name' => 'admin_menu_name',
235
+ 'label' => Mage::helper('blackchacal_prometheus')->__('Admin Menu Name'),
236
+ 'title' => Mage::helper('blackchacal_prometheus')->__('Admin Menu Name')
237
+ ));
238
+ $menuFieldset->addField('admin_menu_title', 'text', array(
239
+ 'name' => 'admin_menu_title',
240
+ 'label' => Mage::helper('blackchacal_prometheus')->__('Admin Menu Title'),
241
+ 'title' => Mage::helper('blackchacal_prometheus')->__('Admin Menu Title')
242
+ ));
243
+ $menuFieldset->addField('admin_menu_action', 'text', array(
244
+ 'name' => 'admin_menu_action',
245
+ 'label' => Mage::helper('blackchacal_prometheus')->__('Admin Menu Action'),
246
+ 'title' => Mage::helper('blackchacal_prometheus')->__('Admin Menu Action')
247
+ ));
248
+ $menuFieldset->addField('admin_menu_position', 'text', array(
249
+ 'name' => 'admin_menu_position',
250
+ 'label' => Mage::helper('blackchacal_prometheus')->__('Admin Menu Position'),
251
+ 'title' => Mage::helper('blackchacal_prometheus')->__('Admin Menu Position')
252
+ ));
253
+
254
+ $this->setForm($form);
255
+ /**
256
+ * If is "edit" page use model values. If is "new" page use default
257
+ * configuration data.
258
+ */
259
+ if ($this->getRequest()->getParam('id')) {
260
+ $form->setValues($model->getData());
261
+ }
262
+
263
+ return parent::_prepareForm();
264
+ }
265
+
266
+ /**
267
+ * Retrives the Configuration Tab Label according to config settings.
268
+ *
269
+ * @param $type string
270
+ * @return string
271
+ */
272
+ private function getConfigTabLabel($type)
273
+ {
274
+ switch ($type) {
275
+ case 'namespace':
276
+ $name = Mage::helper('blackchacal_prometheus')->getConfig('namespace');
277
+ $name = Mage::helper('blackchacal_prometheus')->escapeStrings($name);
278
+ return $name;
279
+ break;
280
+ case 'system':
281
+ $tabs = Mage::getModel('blackchacal_prometheus/system_config_source_systemtabs')->toOptionArray();
282
+ foreach($tabs as $tab) {
283
+ if ($tab['value'] == Mage::helper('blackchacal_prometheus')->getConfig('config_tab_system')) {
284
+ return $tab['label'];
285
+ }
286
+ }
287
+ break;
288
+ case 'custom':
289
+ $name = Mage::helper('blackchacal_prometheus')->getConfig('config_tab_custom');
290
+ $name = Mage::helper('blackchacal_prometheus')->escapeStrings($name);
291
+ return $name;
292
+ break;
293
+ }
294
+ }
295
+
296
+ /**
297
+ * Retrives the Configuration Tab Name according to config settings.
298
+ *
299
+ * @param $type string
300
+ * @return string
301
+ */
302
+ private function getConfigTabName($type)
303
+ {
304
+ switch ($type) {
305
+ case 'namespace':
306
+ $name = strtolower(Mage::helper('blackchacal_prometheus')->getConfig('namespace'));
307
+ $name = Mage::helper('blackchacal_prometheus')->escapeStrings($name);
308
+ return preg_replace('/\s+/', '_', $name);
309
+ break;
310
+ case 'system':
311
+ $tabs = Mage::getModel('blackchacal_prometheus/system_config_source_systemtabs')->toOptionArray();
312
+ foreach($tabs as $tab) {
313
+ if ($tab['value'] == Mage::helper('blackchacal_prometheus')->getConfig('config_tab_system')) {
314
+ return $tab['value'];
315
+ }
316
+ }
317
+ break;
318
+ case 'custom':
319
+ $name = strtolower(Mage::helper('blackchacal_prometheus')->getConfig('config_tab_custom'));
320
+ $name = Mage::helper('blackchacal_prometheus')->escapeStrings($name);
321
+ return preg_replace('/\s+/', '_', $name);
322
+ break;
323
+ }
324
+ }
325
+
326
+ /**
327
+ * Retrives the Configuration Tab Position according to config settings.
328
+ *
329
+ * @param $type string
330
+ * @return string
331
+ */
332
+ private function getConfigTabPositions($type)
333
+ {
334
+ switch ($type) {
335
+ case 'namespace':
336
+ return Mage::helper('blackchacal_prometheus')->getConfig('config_tab_namespace_position');
337
+ break;
338
+ case 'custom':
339
+ return Mage::helper('blackchacal_prometheus')->getConfig('config_tab_custom_position');
340
+ break;
341
+ }
342
+ }
343
+ }
app/code/community/BlackChacal/Prometheus/Block/Adminhtml/Prometheus/Edit/Tabs.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * BlackChacal_Prometheus
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Do not edit or add to this file if you wish to upgrade Prometheus to newer
15
+ * versions in the future. If you wish to customize Prometheus for your
16
+ * needs please contact the author for more information.
17
+ *
18
+ * @category BlackChacal
19
+ * @package BlackChacal_Prometheus
20
+ * @copyright Copyright (c) 2015 BlackChacal <ribeiro.tonet@gmail.com>
21
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
22
+ */
23
+
24
+ class BlackChacal_Prometheus_Block_Adminhtml_Prometheus_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
25
+ {
26
+ public function __construct()
27
+ {
28
+ /**
29
+ * The setDestElementId() argument string should match the id of the form
30
+ * defined on the _prepareForm() method from the
31
+ * BlackChacal_Prometheus_Block_Adminhtml_Prometheus_Edit_Form class.
32
+ */
33
+ parent::__construct();
34
+ $this->setId('blackchacal_prometheus_extension_info_tabs');
35
+ $this->setDestElementId('edit_form');
36
+ $this->setTitle(Mage::helper('blackchacal_prometheus')->__('Extension Information'));
37
+ }
38
+ }
app/code/community/BlackChacal/Prometheus/Block/Adminhtml/Prometheus/Grid.php ADDED
@@ -0,0 +1,145 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * BlackChacal_Prometheus
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Do not edit or add to this file if you wish to upgrade Prometheus to newer
15
+ * versions in the future. If you wish to customize Prometheus for your
16
+ * needs please contact the author for more information.
17
+ *
18
+ * @category BlackChacal
19
+ * @package BlackChacal_Prometheus
20
+ * @copyright Copyright (c) 2015 BlackChacal <ribeiro.tonet@gmail.com>
21
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
22
+ */
23
+
24
+ class BlackChacal_Prometheus_Block_Adminhtml_Prometheus_Grid extends Mage_Adminhtml_Block_Widget_Grid
25
+ {
26
+ public function __construct()
27
+ {
28
+ parent::__construct();
29
+
30
+ // Set some defaults for our grid
31
+ $this->setId('blackchacal_prometheus_extensions_grid');
32
+ $this->setUseAjax(true);
33
+ $this->setDefaultSort('extension_id');
34
+ $this->setDefaultDir('asc');
35
+ $this->setSaveParametersInSession(true);
36
+ }
37
+
38
+ /**
39
+ * Define the collection model class to be used on this grid.
40
+ *
41
+ * @return string Collection Model Class
42
+ */
43
+ protected function _getCollectionClass()
44
+ {
45
+ // This is the model we are using for the grid
46
+ return 'blackchacal_prometheus/extension_collection';
47
+ }
48
+
49
+ /**
50
+ * Prepares the collection to be used on the grid.
51
+ *
52
+ * @return Mage_Adminhtml_Block_Widget_Grid
53
+ */
54
+ protected function _prepareCollection()
55
+ {
56
+ // Get and set our collection for the grid
57
+ $collection = Mage::getResourceModel($this->_getCollectionClass());
58
+ $this->setCollection($collection);
59
+
60
+ return parent::_prepareCollection();
61
+ }
62
+
63
+ /**
64
+ * Define the columns to be used on the list page. Each column is added using
65
+ * the $this->addColumn() method.
66
+ *
67
+ * @see Mage_Adminhtml_Block_Widget_Grid
68
+ * @return Mage_Adminhtml_Block_Widget_Grid
69
+ */
70
+ protected function _prepareColumns()
71
+ {
72
+ // Add the columns that should appear in the grid
73
+ $this->addColumn('namespace', array(
74
+ 'header'=> $this->__('Namespace'),
75
+ 'index' => 'namespace'
76
+ ));
77
+ $this->addColumn('name', array(
78
+ 'header'=> $this->__('Name'),
79
+ 'index' => 'name'
80
+ ));
81
+ $this->addColumn('codepool', array(
82
+ 'header'=> $this->__('Code Pool'),
83
+ 'index' => 'codepool'
84
+ ));
85
+ $this->addColumn('version', array(
86
+ 'header'=> $this->__('Version'),
87
+ 'index' => 'version'
88
+ ));
89
+ $this->addColumn('author_name', array(
90
+ 'header'=> $this->__('Author'),
91
+ 'index' => 'author_name'
92
+ ));
93
+ $this->addColumn('author_email', array(
94
+ 'header'=> $this->__('Author Email'),
95
+ 'index' => 'author_email'
96
+ ));
97
+
98
+ return parent::_prepareColumns();
99
+ }
100
+
101
+ /**
102
+ * Prepare the grid to use mass actions.
103
+ *
104
+ * @return Mage_Adminhtml_Block_Widget_Grid
105
+ */
106
+ protected function _prepareMassaction()
107
+ {
108
+ /**
109
+ * - setMassactionIdField() should be the table primary key field.
110
+ * - setFormFieldName() defines the name of the url param which holds the
111
+ * mass action ids.
112
+ * - setUseSelectAll() allows the use of the Select/Unselect All links
113
+ * on the grid.
114
+ */
115
+ $this->setMassactionIdField('extension_id');
116
+ $this->getMassactionBlock()->setFormFieldName('extensions');
117
+ $this->getMassactionBlock()->setUseSelectAll(true);
118
+
119
+ $this->getMassactionBlock()->addItem('delete', array(
120
+ 'label' => Mage::helper('blackchacal_prometheus')->__('Delete'),
121
+ 'url' => $this->getUrl('*/*/massDelete'),
122
+ 'confirm' => Mage::helper('blackchacal_prometheus')->__('Are you sure you want to delete the extension(s)?')
123
+ ));
124
+
125
+ return parent::_prepareMassaction();
126
+ }
127
+
128
+ /**
129
+ * Defines the grid table row url.
130
+ *
131
+ * @see Mage_Adminhtml_Block_Widget_Grid
132
+ * @param Mage_Catalog_Model_Product|Varien_Object $row
133
+ * @return string
134
+ */
135
+ public function getRowUrl($row)
136
+ {
137
+ // This is where our row data will link to
138
+ return $this->getUrl('*/*/edit', array('id' => $row->getExtensionId()));
139
+ }
140
+
141
+ public function getGridUrl()
142
+ {
143
+ return $this->getUrl('*/*/grid', array('_current'=>true));
144
+ }
145
+ }
app/code/community/BlackChacal/Prometheus/Helper/Data.php ADDED
@@ -0,0 +1,148 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * BlackChacal_Prometheus
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Do not edit or add to this file if you wish to upgrade Prometheus to newer
15
+ * versions in the future. If you wish to customize Prometheus for your
16
+ * needs please contact the author for more information.
17
+ *
18
+ * @category BlackChacal
19
+ * @package BlackChacal_Prometheus
20
+ * @copyright Copyright (c) 2015 BlackChacal
21
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
22
+ */
23
+
24
+ class BlackChacal_Prometheus_Helper_Data extends Mage_Core_Helper_Data
25
+ {
26
+ /**
27
+ * Extension directories
28
+ */
29
+ const MODULE_DIR = 'community/BlackChacal/Prometheus';
30
+
31
+ /**
32
+ * System configuration section key
33
+ */
34
+ const XML_PATH_SECTION = 'blackchacal_prometheus';
35
+
36
+ /**
37
+ * System configuration group keys
38
+ */
39
+ const XML_PATH_GENERAL_GROUP = 'general';
40
+ const XML_PATH_DEF_EXTENSION_GROUP = 'default_extension';
41
+
42
+ /**
43
+ * System configuration paths for "General" tab
44
+ */
45
+ const XML_PATH_GENERAL_ACTIVE = 'prometheus/general/enabled';
46
+ const XML_PATH_GENERAL_HELP = 'prometheus/general/help';
47
+
48
+ /**
49
+ * General constants
50
+ */
51
+ const LOG_FILENAME = 'blackchacal_prometheus.log';
52
+
53
+
54
+ /**
55
+ * Returns the configuration options of Prometheus based on group and field.
56
+ *
57
+ * @param string $group Configuration path - group
58
+ * @param string $field Configuration path - field
59
+ * @param mixed $store Store data
60
+ * @return mixed
61
+ */
62
+ public function getConfig($field, $group = 'default_extension', $store = null)
63
+ {
64
+ $configPath = self::XML_PATH_SECTION.'/'.$group.'/'.$field;
65
+ return Mage::getStoreConfig($configPath, $store);
66
+ }
67
+
68
+ /**
69
+ * Checks if the Prometheus extension is active or not. Returns true if active,
70
+ * false otherwise.
71
+ *
72
+ * @return boolean
73
+ */
74
+ public function isPrometheusActive()
75
+ {
76
+ return Mage::getStoreConfig(self::XML_PATH_GENERAL_ACTIVE);
77
+ }
78
+
79
+ /**
80
+ * Checks if the Help tab on the module edit page is active or not. Returns
81
+ * true if active, false otherwise.
82
+ *
83
+ * @return boolean
84
+ */
85
+ public function isHelpTabActive()
86
+ {
87
+ return Mage::getStoreConfig(self::XML_PATH_GENERAL_HELP);
88
+ }
89
+
90
+ /**
91
+ * Returns the filename for Prometheus log.
92
+ *
93
+ * @return string
94
+ */
95
+ public function getLogFilename()
96
+ {
97
+ return self::LOG_FILENAME;
98
+ }
99
+
100
+ /**
101
+ * Returns the End-of-line character.
102
+ *
103
+ * @return string
104
+ */
105
+ public function getEol()
106
+ {
107
+ return "\n";
108
+ }
109
+
110
+ /**
111
+ * Return module dir in relation to app/code folder.
112
+ * @return string
113
+ */
114
+ public function getModuleDir()
115
+ {
116
+ return self::MODULE_DIR;
117
+ }
118
+
119
+ /**
120
+ * Return app/etc/modules directory.
121
+ *
122
+ * @return string
123
+ */
124
+ public function getModulesConfigDir()
125
+ {
126
+ return Mage::getBaseDir('etc').DS.'modules';
127
+ }
128
+
129
+ /**
130
+ * Return directory for extension file creation sources.
131
+ *
132
+ * @return string
133
+ */
134
+ public function getSourceFilesDir()
135
+ {
136
+ return Mage::getBaseDir('code').DS.$this->getModuleDir().DS.'etc'.DS.'source';
137
+ }
138
+
139
+ /**
140
+ * Remove all characters that aren't words, numbers, underscore and spaces.
141
+ *
142
+ * @param $str
143
+ */
144
+ public function escapeStrings($str)
145
+ {
146
+ return preg_replace('/[^ \w+]/', '', $str);
147
+ }
148
+ }
app/code/community/BlackChacal/Prometheus/Model/Config/Group.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * BlackChacal_Prometheus
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Do not edit or add to this file if you wish to upgrade Prometheus to newer
15
+ * versions in the future. If you wish to customize Prometheus for your
16
+ * needs please contact the author for more information.
17
+ *
18
+ * @category BlackChacal
19
+ * @package BlackChacal_Prometheus
20
+ * @copyright Copyright (c) 2015 BlackChacal <ribeiro.tonet@gmail.com>
21
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
22
+ */
23
+
24
+ class BlackChacal_Prometheus_Model_Config_Group extends Mage_Core_Model_Abstract
25
+ {
26
+ protected function _construct()
27
+ {
28
+ $this->_init('blackchacal_prometheus/config_group');
29
+ }
30
+ }
app/code/community/BlackChacal/Prometheus/Model/Config/Option.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * BlackChacal_Prometheus
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Do not edit or add to this file if you wish to upgrade Prometheus to newer
15
+ * versions in the future. If you wish to customize Prometheus for your
16
+ * needs please contact the author for more information.
17
+ *
18
+ * @category BlackChacal
19
+ * @package BlackChacal_Prometheus
20
+ * @copyright Copyright (c) 2015 BlackChacal <ribeiro.tonet@gmail.com>
21
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
22
+ */
23
+
24
+ class BlackChacal_Prometheus_Model_Config_Option extends Mage_Core_Model_Abstract
25
+ {
26
+ protected function _construct()
27
+ {
28
+ $this->_init('blackchacal_prometheus/config_option');
29
+ }
30
+ }
app/code/community/BlackChacal/Prometheus/Model/Extension.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * BlackChacal_Prometheus
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Do not edit or add to this file if you wish to upgrade Prometheus to newer
15
+ * versions in the future. If you wish to customize Prometheus for your
16
+ * needs please contact the author for more information.
17
+ *
18
+ * @category BlackChacal
19
+ * @package BlackChacal_Prometheus
20
+ * @copyright Copyright (c) 2015 BlackChacal <ribeiro.tonet@gmail.com>
21
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
22
+ */
23
+
24
+ class BlackChacal_Prometheus_Model_Extension extends Mage_Core_Model_Abstract
25
+ {
26
+ protected function _construct()
27
+ {
28
+ $this->_init('blackchacal_prometheus/extension');
29
+ }
30
+
31
+ /**
32
+ * Install the extension by creating all the necessary files and folders.
33
+ * It behaves differently according to extension configuration.
34
+ */
35
+ public function install()
36
+ {
37
+ try {
38
+ Mage::getModel('blackchacal_prometheus/extension_writer', array(
39
+ 'extensionModel' => $this,
40
+ ))->install();
41
+ return true;
42
+ } catch (Exception $e) {
43
+ return false;
44
+ }
45
+ }
46
+
47
+ /**
48
+ * Uninstall the extension by deleting all necessary files and folders.
49
+ * It behaves differently according to extension configuration.
50
+ */
51
+ public function uninstall()
52
+ {
53
+ try {
54
+ Mage::getModel('blackchacal_prometheus/extension_writer', array(
55
+ 'extensionModel' => $this,
56
+ ))->deleteExtensionFolderFiles();
57
+ return true;
58
+ } catch (Exception $e) {
59
+ return false;
60
+ }
61
+ }
62
+ }
app/code/community/BlackChacal/Prometheus/Model/Extension/File/Content/Php/Classwriter.php ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * BlackChacal_Prometheus
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Do not edit or add to this file if you wish to upgrade Prometheus to newer
15
+ * versions in the future. If you wish to customize Prometheus for your
16
+ * needs please contact the author for more information.
17
+ *
18
+ * @category BlackChacal
19
+ * @package BlackChacal_Prometheus
20
+ * @copyright Copyright (c) 2015 BlackChacal <ribeiro.tonet@gmail.com>
21
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
22
+ */
23
+
24
+ class BlackChacal_Prometheus_Model_Extension_File_Content_Php_Classwriter extends BlackChacal_Prometheus_Model_Extension_File_Content_Writer
25
+ {
26
+ /**
27
+ * @inheritdoc
28
+ */
29
+ protected $_openingTag = '<?php';
30
+
31
+ /**
32
+ * @inheritdoc
33
+ */
34
+ public function prepareFileContents()
35
+ {
36
+ if ($this->_contentData['type'] != 'php') {
37
+ Mage::throwException("Wrong content type! It should be php.");
38
+ }
39
+
40
+ parent::prepareFileContents();
41
+
42
+ $className = $this->_contentData['className'];
43
+ $extends = $this->_contentData['extends'];
44
+ $implements = $this->_contentData['implements'];
45
+ $contents = $this->_contentData['contents'];
46
+
47
+ $this->_content .= $this->_createClassWrapper($className, $contents, $extends, $implements);
48
+ }
49
+
50
+ private function _createClassWrapper($className, $classContents, $extends = '', $implements = '')
51
+ {
52
+ $extendsBlock = ($extends) ? "extends $extends" : "";
53
+ $implementsBlock = ($implements) ? "implements $implements" : "";
54
+ $contents = $this->_createClassContents($classContents);
55
+
56
+ $classWrapper = "class $className $extendsBlock $implementsBlock {$this->_eol}";
57
+ $classWrapper .= "{{$this->_eol} $contents {$this->_eol}}";
58
+
59
+ return $classWrapper;
60
+ }
61
+
62
+ private function _createClassContents($classContents)
63
+ {
64
+ $contents = "";
65
+ if (is_array($classContents)) {
66
+ foreach($classContents['methods'] as $method) {
67
+ $contents .= $this->_createClassMethod($method['name'], $method['args'], $method['contents'], $method['scope']);
68
+ }
69
+ } else {
70
+ $contents = $classContents;
71
+ }
72
+
73
+ return $contents;
74
+ }
75
+
76
+ private function _createClassMethod($methodName, array $methodArgs, $methodContents, $scope = 'public')
77
+ {
78
+ $args = implode(', ', $methodArgs);
79
+ $methodWrapper = "{$this->_eol} $scope function $methodName($args) {$this->_eol}";
80
+ $methodWrapper .= "{{$this->_eol} $methodContents {$this->_eol}}{$this->_eol}";
81
+
82
+ return $methodWrapper;
83
+ }
84
+ }
app/code/community/BlackChacal/Prometheus/Model/Extension/File/Content/Writer.php ADDED
@@ -0,0 +1,372 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * BlackChacal_Prometheus
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Do not edit or add to this file if you wish to upgrade Prometheus to newer
15
+ * versions in the future. If you wish to customize Prometheus for your
16
+ * needs please contact the author for more information.
17
+ *
18
+ * @category BlackChacal
19
+ * @package BlackChacal_Prometheus
20
+ * @copyright Copyright (c) 2015 BlackChacal <ribeiro.tonet@gmail.com>
21
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
22
+ */
23
+
24
+ class BlackChacal_Prometheus_Model_Extension_File_Content_Writer extends BlackChacal_Prometheus_Model_Extension_File_Writer
25
+ {
26
+ const SOURCE_FOLDER = 'source';
27
+
28
+ /**
29
+ * @var string File content.
30
+ */
31
+ protected $_content;
32
+
33
+ /**
34
+ * @var string
35
+ */
36
+ protected $_eol;
37
+
38
+ /**
39
+ * @var BlackChacal_Prometheus_Helper_Data
40
+ */
41
+ protected $_helper;
42
+
43
+ /**
44
+ * This array should have the following format:
45
+ * [
46
+ * 'type' = 'php'/'xml'/'sql',
47
+ * 'xmlType' = 'modules'/'general'/'adminhtml'/'system'/'layout'
48
+ * 'extensionName' = 'Namespace_ExtensionName',
49
+ * 'codepool' = 'codepool',
50
+ * 'className' = 'class name',
51
+ * 'extends' = 'extended class',
52
+ * 'implements' = 'implemented interface',
53
+ * ['contents'] =
54
+ * [
55
+ * ['methods'] = [
56
+ * [
57
+ * 'name' = 'name',
58
+ * 'contents' = 'contents',
59
+ * 'args' = ['arg1', 'arg2', ...]
60
+ * 'scope' = 'private'/'protected'/'public'
61
+ * ],
62
+ * [...],
63
+ * ...
64
+ * ],
65
+ * ['nodes'] = [
66
+ * [
67
+ * 'nodeName' = 'name',
68
+ * 'nodeValue' = 'value',
69
+ * 'selfClosing' = true/false
70
+ * ],
71
+ * [...],
72
+ * ...
73
+ * ],
74
+ * ['contentString'] = 'content'
75
+ * ],
76
+ * ['copyright'] = 'copyright text'
77
+ * ['author'] = 'author name'
78
+ * ['author_email'] = 'author email'
79
+ * ]
80
+ *
81
+ * @var array Content data.
82
+ */
83
+ protected $_contentData = array();
84
+
85
+ /**
86
+ * List of placeholders for text replacement.
87
+ *
88
+ * @var array
89
+ */
90
+ protected $_placeholders = array(
91
+ 'Namespace' => 'namespace',
92
+ 'Module' => 'name',
93
+ 'Codepool' => 'codepool',
94
+ 'Version' => 'version',
95
+ 'Author' => 'author',
96
+ 'Email' => 'author_email',
97
+ 'Config_Node_Code' => 'config_node_code',
98
+ 'Config_Tab_Name' => 'config_tab_name',
99
+ 'Config_Tab_Label' => 'config_tab_label',
100
+ 'Config_Tab_Position' => 'config_tab_position',
101
+ 'Config_Section_Name' => 'config_section_name',
102
+ 'Config_Section_Label' => 'config_section_label',
103
+ 'Admin_Menu_Parent' => 'admin_menu_parent',
104
+ 'Admin_Menu_Name' => 'admin_menu_name',
105
+ 'Admin_Menu_Title' => 'admin_menu_title',
106
+ 'Admin_Menu_Action' => 'admin_menu_action',
107
+ 'Admin_Menu_Position' => 'admin_menu_position'
108
+ );
109
+
110
+ /**
111
+ * @var string File opening tag. Ex: <?php, <?xml version="1.0"?>
112
+ */
113
+ protected $openingTag = '';
114
+
115
+ public function __construct(array $contentData)
116
+ {
117
+ parent::__construct();
118
+
119
+ $this->_contentData = $contentData;
120
+ $this->_helper = Mage::helper('blackchacal_prometheus');
121
+ $this->_eol = $this->_helper->getEol();
122
+ }
123
+
124
+ /**
125
+ * Returns file content to be written to actual file.
126
+ *
127
+ * @return string
128
+ */
129
+ public function getContents()
130
+ {
131
+ return $this->_content;
132
+ }
133
+
134
+ /**
135
+ * Prepares the file contents according to file type and origin.
136
+ *
137
+ * @return void
138
+ */
139
+ public function prepareFileContents()
140
+ {
141
+ $this->_content = "{$this->_openingTag} {$this->_eol} {$this->getLicenseText()} {$this->_eol}";
142
+ }
143
+
144
+ /**
145
+ * Gets the copyright text to include on the file contents.
146
+ *
147
+ * @return string
148
+ */
149
+ protected function getLicenseText()
150
+ {
151
+ return $this->wrapStringIntoCommentPhpBlock($this->replacePlaceholders($this->_contentData['license']), $this->_contentData['type']);
152
+ }
153
+
154
+ /**
155
+ * Replaces text placeholders by respective value.
156
+ *
157
+ * @param $str
158
+ * @return mixed
159
+ */
160
+ protected function replacePlaceholders($str)
161
+ {
162
+ $newStr = $str;
163
+ $newStr = $this->_processPlaceholderConditionals($newStr, $this->_contentData);
164
+ foreach($this->_placeholders as $placeholder => $value) {
165
+ if (array_key_exists($value, $this->_contentData)) {
166
+ $newStr = str_replace("{{".$placeholder."}}", $this->_contentData[$value], $newStr);
167
+ }
168
+ }
169
+ return $newStr;
170
+ }
171
+
172
+ /**
173
+ * Processes the string conditionals and removes or not blocks of text.
174
+ *
175
+ * @param $str
176
+ */
177
+ private function _processPlaceholderConditionals($str, $data)
178
+ {
179
+ $newStr = $str;
180
+ $conditions = array();
181
+ preg_match_all("/\{\{\@if \((\w+\s.{2,3}\s.+)\) \}\}/", $newStr, $conditionals);
182
+
183
+ if (count($conditionals[0]) > 0) {
184
+ if (count($conditionals[1]) > 0) {
185
+ // Extract all the conditions from if statement
186
+ foreach ($conditionals[1] as $condition) {
187
+ preg_match_all("/(&&|\|\|)/", $condition, $operators);
188
+ $condition = preg_split("/(&&|\|\|)/", $condition);
189
+ if (count($condition) <= 1) {
190
+ $conditions[] = explode(' ', $condition[0]);
191
+ } else {
192
+ $subconditions = array();
193
+ $i = 0;
194
+ foreach ($condition as $subcondition) {
195
+ $subcondition = explode(' ', trim($subcondition));
196
+ if ($i < (count($condition) - 1)) {
197
+ $subcondition['operator'] = $operators[0][$i];
198
+ }
199
+ $subconditions[] = $subcondition;
200
+ $i++;
201
+ }
202
+ $conditions[] = $subconditions;
203
+ }
204
+ }
205
+
206
+ // Remove if statements and/or if blocks from string
207
+ foreach ($conditions as $condition) {
208
+ $conditionStr = $this->_buildConditionString($condition);
209
+
210
+ if ($this->_processMultipleComparisons($condition, $data)) {
211
+ $pattern = "/\s*\{\{\@if \(".$conditionStr."\) \}\}/";
212
+ $newStr = preg_replace($pattern, '', $newStr);
213
+ } else {
214
+ $pattern = "/\s*\{\{\@if \(".$conditionStr."\) \}\}((.|\n)*?)\{\{@endif\}\}/";
215
+ $newStr = preg_replace($pattern, '', $newStr);
216
+ }
217
+ }
218
+ $newStr = preg_replace("/\{\{@endif\}\}\s*/", '', $newStr);
219
+ }
220
+ }
221
+
222
+ return $newStr;
223
+ }
224
+
225
+ /**
226
+ * Process multiple conditional statements "concatenated" by '&&' or '||'.
227
+ *
228
+ * @param $conditions
229
+ * @param $data
230
+ * @return bool
231
+ */
232
+ private function _processMultipleComparisons($conditions, $data)
233
+ {
234
+ if (is_array($conditions[0])) {
235
+ for ($i = 0, $size = (count($conditions) - 1); $i < $size; $i++) {
236
+ if (!isset($result)) {
237
+ $result = $this->_concatComparisons($conditions[$i]['operator'], $conditions[$i], $conditions[$i+1], $data);
238
+ } else {
239
+ $result = $this->_concatComparisons($conditions[$i]['operator'], $result, $conditions[$i+1], $data);
240
+ }
241
+ }
242
+ } else {
243
+ return $this->_processComparisons($data[$conditions[0]], $conditions[1], $conditions[2]);
244
+ }
245
+
246
+ return $result;
247
+ }
248
+
249
+ /**
250
+ * "Concatenate" boolean expressions.
251
+ *
252
+ * @param $operation
253
+ * @param $comparison1
254
+ * @param $comparison2
255
+ * @return bool
256
+ */
257
+ private function _concatComparisons($operation, $comparison1, $comparison2, $data)
258
+ {
259
+ if (is_bool($comparison1)) {
260
+ $leftComp = $comparison1;
261
+ } elseif (is_array($comparison1)) {
262
+ $leftComp = $this->_processComparisons($data[$comparison1[0]], $comparison1[1], $comparison1[2]);
263
+ }
264
+
265
+ if (is_bool($comparison2)) {
266
+ $rightComp = $comparison2;
267
+ } elseif (is_array($comparison2)) {
268
+ $rightComp = $this->_processComparisons($data[$comparison2[0]], $comparison2[1], $comparison2[2]);
269
+ }
270
+
271
+ switch ($operation) {
272
+ case '||':
273
+ return $leftComp || $rightComp;
274
+ break;
275
+ default:
276
+ return $leftComp && $rightComp;
277
+ break;
278
+ }
279
+ }
280
+
281
+ /**
282
+ * Gives the result of comparisons according to operator.
283
+ *
284
+ * @param $var
285
+ * @param $operator
286
+ * @param $value
287
+ */
288
+ private function _processComparisons($var, $operator, $value)
289
+ {
290
+ switch ($operator) {
291
+ case '==':
292
+ return $var == trim(stripslashes($value), "'");
293
+ break;
294
+ case '===':
295
+ return $var === trim(stripslashes($value), "'");
296
+ break;
297
+ case '!=':
298
+ case '<>':
299
+ return $var != trim(stripslashes($value), "'");
300
+ break;
301
+ case '!==':
302
+ return $var !== trim(stripslashes($value), "'");
303
+ break;
304
+ case '<':
305
+ return $var < trim(stripslashes($value), "'");
306
+ break;
307
+ case '>':
308
+ return $var > trim(stripslashes($value), "'");
309
+ break;
310
+ case '<=':
311
+ return $var <= trim(stripslashes($value), "'");
312
+ break;
313
+ case '>=':
314
+ return $var >= trim(stripslashes($value), "'");
315
+ break;
316
+ }
317
+ }
318
+
319
+ /**
320
+ * Create condition string to be used on logical conditions regex.
321
+ *
322
+ * @param $condition
323
+ * @return string
324
+ */
325
+ private function _buildConditionString($condition)
326
+ {
327
+ $conditionStr = '';
328
+ if (is_array($condition[0])) {
329
+ foreach ($condition as $subcondition) {
330
+ $conditionStr .= ' '.implode(' ', $subcondition);
331
+ }
332
+ } else {
333
+ $conditionStr = implode(' ', $condition);
334
+ }
335
+ $conditionStr = trim($conditionStr);
336
+
337
+ return $conditionStr;
338
+ }
339
+
340
+ /**
341
+ * Gets the source file path given the filename.
342
+ *
343
+ * @param $filename
344
+ * @return string
345
+ */
346
+ protected function getSourceFilesPath($filename)
347
+ {
348
+ return $this->_helper->getSourceFilesDir().DS.$filename;
349
+ }
350
+
351
+ /**
352
+ * Wrap a string into a comment block.
353
+ * @param $str
354
+ * @param $type
355
+ * @return string
356
+ */
357
+ protected function wrapStringIntoCommentPhpBlock($str, $type)
358
+ {
359
+ if ($type == 'xml') {
360
+ $newStr = "<!-- {$this->_eol}".$str."{$this->_eol} --> {$this->_eol}";
361
+ } else {
362
+ $newStr = "/**{$this->_eol}";
363
+ $lines = explode($this->_eol, $str);
364
+ foreach ($lines as $line) {
365
+ $newStr .= " * ".$line.$this->_eol;
366
+ }
367
+ $newStr .= " */ {$this->_eol}";
368
+ }
369
+
370
+ return $newStr;
371
+ }
372
+ }
app/code/community/BlackChacal/Prometheus/Model/Extension/File/Content/Xml/Configwriter.php ADDED
@@ -0,0 +1,133 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * BlackChacal_Prometheus
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Do not edit or add to this file if you wish to upgrade Prometheus to newer
15
+ * versions in the future. If you wish to customize Prometheus for your
16
+ * needs please contact the author for more information.
17
+ *
18
+ * @category BlackChacal
19
+ * @package BlackChacal_Prometheus
20
+ * @copyright Copyright (c) 2015 BlackChacal <ribeiro.tonet@gmail.com>
21
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
22
+ */
23
+
24
+ class BlackChacal_Prometheus_Model_Extension_File_Content_Xml_Configwriter extends BlackChacal_Prometheus_Model_Extension_File_Content_Writer
25
+ {
26
+ /**
27
+ * @inheritdoc
28
+ */
29
+ protected $_openingTag = '<?xml version="1.0"?>';
30
+
31
+ /**
32
+ * @inheritdoc
33
+ */
34
+ public function prepareFileContents()
35
+ {
36
+ if ($this->_contentData['type'] != 'xml') {
37
+ Mage::throwException("Wrong content type! It should be xml.");
38
+ }
39
+
40
+ parent::prepareFileContents();
41
+
42
+ $contents = $this->selectXmlFileType();
43
+ $this->_content .= $contents;
44
+ }
45
+
46
+ private function selectXmlFileType()
47
+ {
48
+ $content = '';
49
+ $type = $this->_contentData['xmlType'];
50
+
51
+ switch ($type) {
52
+ case 'modules':
53
+ $content = $this->_getModulesConfigXmlContent();
54
+ break;
55
+ case 'config':
56
+ $content = $this->_getExtensionConfigXmlContent();
57
+ break;
58
+ case 'adminhtml':
59
+ $content = $this->_getExtensionAdminhtmlXmlContent();
60
+ break;
61
+ case 'system':
62
+ $content = $this->_getExtensionSystemXmlContent();
63
+ break;
64
+ default:
65
+ break;
66
+ }
67
+
68
+ return $content;
69
+ }
70
+
71
+ /**
72
+ * Creates app/etc/modules extension config file content.
73
+ *
74
+ * @return mixed|string
75
+ */
76
+ private function _getModulesConfigXmlContent()
77
+ {
78
+ $path = $this->getSourceFilesPath('modules_config_xml.txt');
79
+ return $this->_getXmlFileContent($path);
80
+
81
+ }
82
+
83
+ /**
84
+ * Creates extension etc/config.xml file content.
85
+ *
86
+ * @return mixed|string
87
+ */
88
+ private function _getExtensionConfigXmlContent()
89
+ {
90
+ $path = $this->getSourceFilesPath('extension_config_xml.txt');
91
+ return $this->_getXmlFileContent($path);
92
+ }
93
+
94
+ /**
95
+ * Creates extension etc/system.xml file content.
96
+ *
97
+ * @return mixed|string
98
+ */
99
+ private function _getExtensionSystemXmlContent()
100
+ {
101
+ $path = $this->getSourceFilesPath('extension_system_xml.txt');
102
+ return $this->_getXmlFileContent($path);
103
+ }
104
+
105
+ /**
106
+ * Creates extension etc/adminhtml.xml file content.
107
+ *
108
+ * @return mixed|string
109
+ */
110
+ private function _getExtensionAdminhtmlXmlContent()
111
+ {
112
+ $path = $this->getSourceFilesPath('extension_adminhtml_xml.txt');
113
+ return $this->_getXmlFileContent($path);
114
+ }
115
+
116
+ /**
117
+ * Returns the processed content of the xml file according to file source path.
118
+ *
119
+ * @param $path
120
+ * @return bool|mixed|string
121
+ */
122
+ private function _getXmlFileContent($path)
123
+ {
124
+ try {
125
+ $xmlText = @$this->_filesystem->read($path);
126
+ $xmlText = $this->replacePlaceholders($xmlText);
127
+ } catch(Exception $e) {
128
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
129
+ }
130
+
131
+ return $xmlText;
132
+ }
133
+ }
app/code/community/BlackChacal/Prometheus/Model/Extension/File/Content/Xml/Layoutwriter.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * BlackChacal_Prometheus
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Do not edit or add to this file if you wish to upgrade Prometheus to newer
15
+ * versions in the future. If you wish to customize Prometheus for your
16
+ * needs please contact the author for more information.
17
+ *
18
+ * @category BlackChacal
19
+ * @package BlackChacal_Prometheus
20
+ * @copyright Copyright (c) 2015 BlackChacal <ribeiro.tonet@gmail.com>
21
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
22
+ */
23
+
24
+ class BlackChacal_Prometheus_Model_Extension_File_Content_XML_LayoutWriter
25
+ {
26
+
27
+ }
app/code/community/BlackChacal/Prometheus/Model/Extension/File/Writer.php ADDED
@@ -0,0 +1,166 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * BlackChacal_Prometheus
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Do not edit or add to this file if you wish to upgrade Prometheus to newer
15
+ * versions in the future. If you wish to customize Prometheus for your
16
+ * needs please contact the author for more information.
17
+ *
18
+ * @category BlackChacal
19
+ * @package BlackChacal_Prometheus
20
+ * @copyright Copyright (c) 2015 BlackChacal <ribeiro.tonet@gmail.com>
21
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
22
+ */
23
+
24
+ class BlackChacal_Prometheus_Model_Extension_File_Writer extends BlackChacal_Prometheus_Model_Extension_Writer
25
+ {
26
+ public function __construct()
27
+ {
28
+ $this->_filesystem = new Varien_Io_File();
29
+ }
30
+
31
+ /**
32
+ * Creates modules config xml file.
33
+ *
34
+ * @param array $contentData
35
+ */
36
+ public function createModulesConfigFile(array $contentData) {
37
+ $contentData['type'] = 'xml';
38
+ $contentData['xmlType'] = 'modules';
39
+ $contentObj = Mage::getModel('blackchacal_prometheus/extension_file_content_xml_configwriter', $contentData);
40
+ $contentObj->prepareFileContents();
41
+
42
+ $contents = $contentObj->getContents();
43
+ $filename = $contentData['extensionFullName'].'.xml';
44
+ $filepath = Mage::getBaseDir('etc').DS.self::MODULES_DIR.DS.$filename;
45
+
46
+ try {
47
+ @$this->_filesystem->write($filepath, $contents);
48
+ } catch (Exception $e) {
49
+ Mage::log($e->getMessage(), null, Mage::helper('blackchacal_prometheus')->getLogFilename());
50
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
51
+ }
52
+ }
53
+
54
+ /**
55
+ * Creates extension etc/config.xml file.
56
+ *
57
+ * @param array $contentData
58
+ */
59
+ public function createExtensionEtcConfigFile(array $contentData) {
60
+ $this->_createExtensionEtcFile('config', $contentData);
61
+ }
62
+
63
+ /**
64
+ * Creates extension etc/system.xml file.
65
+ *
66
+ * @param array $contentData
67
+ */
68
+ public function createExtensionEtcSystemFile(array $contentData) {
69
+ if (array_key_exists('config_section_name', $contentData) &&
70
+ array_key_exists('config_section_label', $contentData) &&
71
+ $contentData['config_section_name'] != '' &&
72
+ $contentData['config_section_label'] != '') {
73
+
74
+ $this->_createExtensionEtcFile('system', $contentData);
75
+ }
76
+ }
77
+
78
+ /**
79
+ * Creates extension etc/adminhtml.xml file.
80
+ *
81
+ * @param array $contentData
82
+ */
83
+ public function createExtensionEtcAdminhtmlFile(array $contentData) {
84
+ if (array_key_exists('config_section_name', $contentData) &&
85
+ array_key_exists('config_section_label', $contentData) &&
86
+ $contentData['config_section_name'] != '' &&
87
+ $contentData['config_section_label'] != '') {
88
+
89
+ $this->_createExtensionEtcFile('adminhtml', $contentData);
90
+ }
91
+ }
92
+
93
+ /**
94
+ * Creates extension Helper/Data.php file.
95
+ *
96
+ * @param array $contentData
97
+ */
98
+ public function createExtensionHelperDataFile(array $contentData) {
99
+ $contentData['className'] = $contentData['extensionFullName'].'_Helper_Data';
100
+ $contentData['extends'] = 'Mage_Core_Helper_Data';
101
+ $contentData['implements'] = '';
102
+ $contentData['contents'] = '';
103
+ $this->_createExtensionHelperFile('Data', $contentData);
104
+ }
105
+
106
+ /**
107
+ * Creates the extension etc/ files according to filename.
108
+ *
109
+ * @param $filename
110
+ */
111
+ private function _createExtensionEtcFile($filename, $contentData)
112
+ {
113
+ $contentData['type'] = 'xml';
114
+ $contentData['xmlType'] = $filename;
115
+ $contentObj = Mage::getModel('blackchacal_prometheus/extension_file_content_xml_configwriter', $contentData);
116
+ $contentObj->prepareFileContents();
117
+
118
+ $contents = $contentObj->getContents();
119
+ $filename = $filename.'.xml';
120
+ $filepath = $this->_getExtensionPath($contentData['codepool'], $contentData['namespace'], $contentData['name']).DS.self::ETC_FOLDER.DS.$filename;
121
+
122
+ try {
123
+ @$this->_filesystem->write($filepath, $contents);
124
+ } catch (Exception $e) {
125
+ Mage::log($e->getMessage(), null, Mage::helper('blackchacal_prometheus')->getLogFilename());
126
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
127
+ }
128
+ }
129
+
130
+ /**
131
+ * Creates the extension Helper/ files according to filename.
132
+ *
133
+ * @param $filename
134
+ */
135
+ private function _createExtensionHelperFile($filename, $contentData)
136
+ {
137
+ $contentData['type'] = 'php';
138
+ $contentObj = Mage::getModel('blackchacal_prometheus/extension_file_content_php_classwriter', $contentData);
139
+ $contentObj->prepareFileContents();
140
+
141
+ $contents = $contentObj->getContents();
142
+ $filename = $filename.'.php';
143
+ $filepath = $this->_getExtensionPath($contentData['codepool'], $contentData['namespace'], $contentData['name']).DS.self::HELPER_FOLDER.DS.$filename;
144
+
145
+ try {
146
+ @$this->_filesystem->write($filepath, $contents);
147
+ } catch (Exception $e) {
148
+ Mage::log($e->getMessage(), null, Mage::helper('blackchacal_prometheus')->getLogFilename());
149
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
150
+ }
151
+ }
152
+
153
+ /**
154
+ * Gets extension path.
155
+ *
156
+ * @param $codepool
157
+ * @param $namespace
158
+ * @param $extensionName
159
+ * @return string
160
+ */
161
+ private function _getExtensionPath($codepool, $namespace, $extensionName) {
162
+ $codePath = Mage::getBaseDir('code');
163
+ $extensionPath = $codePath.DS.$codepool.DS.$namespace.DS.$extensionName;
164
+ return $extensionPath;
165
+ }
166
+ }
app/code/community/BlackChacal/Prometheus/Model/Extension/Writer.php ADDED
@@ -0,0 +1,262 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * BlackChacal_Prometheus
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Do not edit or add to this file if you wish to upgrade Prometheus to newer
15
+ * versions in the future. If you wish to customize Prometheus for your
16
+ * needs please contact the author for more information.
17
+ *
18
+ * @category BlackChacal
19
+ * @package BlackChacal_Prometheus
20
+ * @copyright Copyright (c) 2015 BlackChacal <ribeiro.tonet@gmail.com>
21
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
22
+ */
23
+
24
+ class BlackChacal_Prometheus_Model_Extension_Writer
25
+ {
26
+ const MODULES_DIR = 'modules';
27
+
28
+ /**
29
+ * Extension base folders
30
+ */
31
+ const ETC_FOLDER = 'etc';
32
+ const MODEL_FOLDER = 'Model';
33
+ const HELPER_FOLDER = 'Helper';
34
+ const BLOCK_FOLDER = 'Block';
35
+ const CONTROLLERS_FOLDER = 'controllers';
36
+ const CONTROLLER_FOLDER = 'Controller';
37
+ const SQL_FOLDER = 'sql';
38
+
39
+ /**
40
+ * Filesystem wrapper class.
41
+ * @var Varien_Io_File
42
+ */
43
+ protected $_filesystem;
44
+
45
+ /**
46
+ * Extension namespace.
47
+ * @var string
48
+ */
49
+ protected $_namespace;
50
+
51
+ /**
52
+ * Extension name.
53
+ * @var string
54
+ */
55
+ protected $_extensionName;
56
+
57
+ /**
58
+ * Extension code pool.
59
+ * @var string
60
+ */
61
+ protected $_codepool;
62
+
63
+ /**
64
+ * Extension model.
65
+ * @var BlackChacal_Prometheus_Model_Extension
66
+ */
67
+ protected $_model;
68
+
69
+ /**
70
+ * @var BlackChacal_Prometheus_Helper_Data
71
+ */
72
+ protected $_helper;
73
+
74
+ /**
75
+ * Sets the filesystem wrapper and starts managing file creation paths according
76
+ * to type.
77
+ * $args is an array with the following fields:
78
+ * 'model': BlackChacal_Prometheus_Model_Extension
79
+ * 'extensionName': has the format 'Vendor_ExtensionName'
80
+ * 'codepool': 'community'/'local'
81
+ * @param $args
82
+ */
83
+ public function __construct($args)
84
+ {
85
+ $this->_filesystem = new Varien_Io_File();
86
+ $this->_filesystem->setAllowCreateFolders(true);
87
+
88
+ if (is_array($args)) {
89
+ $this->_model = $args['extensionModel'];
90
+ $this->_helper = Mage::helper('blackchacal_prometheus');
91
+ $this->_namespace = $this->_model->getNamespace();
92
+ $this->_extensionName = $this->_model->getName();
93
+ $this->_codepool = $this->_model->getCodepool();
94
+ } else {
95
+ Mage::log('BlackChacal_Prometheus_Model_Extension_Writer constructor has array argument.', null, $this->_helper->getLogFilename());
96
+ Mage::getSingleton('adminhtml/session')->addError('BlackChacal_Prometheus_Model_Extension_Writer constructor has array argument.');
97
+ }
98
+ }
99
+
100
+ /**
101
+ * Install the extension by creating its files and folders
102
+ */
103
+ public function install() {
104
+ $installed = $this->_model->getInstalled();
105
+ $rewrite = $this->_model->getRewrite();
106
+
107
+ if (!$installed || $rewrite) {
108
+ $this->_createExtensionMainFolder();
109
+ $this->_createExtensionBaseFolders();
110
+ $this->_createModulesConfigFile();
111
+ $this->_createExtensionBaseFiles();
112
+ }
113
+ }
114
+
115
+ /**
116
+ * Create extension folders.
117
+ * @param $folderName
118
+ * @throws Exception
119
+ */
120
+ protected function createExtensionFolders($folderName)
121
+ {
122
+ try {
123
+ $this->_filesystem->checkAndCreateFolder($folderName);
124
+ } catch(Exception $e) {
125
+ Mage::log($e->getMessage(), null, $this->_helper->getLogFilename());
126
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
127
+ }
128
+ }
129
+
130
+ /**
131
+ * Deletes all extension folders and the app/etc/modules config file.
132
+ */
133
+ public function deleteExtensionFolderFiles()
134
+ {
135
+ $namespacePath = $this->_getNamespacePath();
136
+ $extensionPath = $this->_getExtensionPath();
137
+
138
+ try {
139
+ $this->_filesystem->rmdir($extensionPath, true);
140
+ if (is_dir($namespacePath)) {
141
+ $this->_filesystem->cd($namespacePath);
142
+
143
+ if (count($this->_filesystem->ls()) == 0) {
144
+ $this->_filesystem->rmdir($namespacePath, true);
145
+ }
146
+ }
147
+
148
+ $modulesConfigFile = $this->_namespace.'_'.$this->_extensionName.'.xml';
149
+ $modulesConfigFilePath = $this->_helper->getModulesConfigDir().DS.$modulesConfigFile;
150
+ if (file_exists($modulesConfigFilePath)) {
151
+ $this->_filesystem->rm($modulesConfigFilePath);
152
+ }
153
+ } catch(Exception $e) {
154
+ Mage::log($e->getMessage(), null, $this->_helper->getLogFilename());
155
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
156
+ }
157
+ }
158
+
159
+ /**
160
+ * Creates the extension namespace folder and extension folder.
161
+ */
162
+ private function _createExtensionMainFolder()
163
+ {
164
+ $namespacePath = $this->_getNamespacePath();
165
+ $extensionPath = $namespacePath.DS.$this->_extensionName;
166
+
167
+ $this->createExtensionFolders($namespacePath);
168
+ $this->createExtensionFolders($extensionPath);
169
+ }
170
+
171
+ /**
172
+ * Creates extension base folders (etc, Helper, etc.)
173
+ */
174
+ private function _createExtensionBaseFolders()
175
+ {
176
+ $extensionPath = $this->_getExtensionPath();
177
+
178
+ $etcPath = $extensionPath.DS.'etc';
179
+ $helperPath = $extensionPath.DS.'Helper';
180
+
181
+ $this->createExtensionFolders($etcPath);
182
+ $this->createExtensionFolders($helperPath);
183
+ }
184
+
185
+ /**
186
+ * Gets namespace path.
187
+ *
188
+ * @return string
189
+ */
190
+ private function _getNamespacePath()
191
+ {
192
+ $codePath = Mage::getBaseDir('code');
193
+ $codepoolPath = $codePath.DS.$this->_codepool;
194
+ $namespacePath = $codepoolPath.DS.$this->_namespace;
195
+
196
+ return $namespacePath;
197
+ }
198
+
199
+ /**
200
+ * Gets extension path.
201
+ *
202
+ * @return string
203
+ */
204
+ private function _getExtensionPath()
205
+ {
206
+ $namespacePath = $this->_getNamespacePath();
207
+ $extensionPath = $namespacePath.DS.$this->_extensionName;
208
+ return $extensionPath;
209
+ }
210
+
211
+ /**
212
+ * Creates app/etc/modules configuration file.
213
+ */
214
+ private function _createModulesConfigFile() {
215
+ $data = array(
216
+ 'namespace' => $this->_namespace,
217
+ 'name' => $this->_extensionName,
218
+ 'extensionFullName' => $this->_namespace.'_'.$this->_extensionName,
219
+ 'codepool' => $this->_codepool,
220
+ 'license' => $this->_model->getLicense(),
221
+ 'author' => $this->_model->getAuthorName(),
222
+ 'author_email' => $this->_model->getAuthorEmail(),
223
+ 'config_node_code' => $this->_model->getConfigNodeCode()
224
+ );
225
+
226
+ Mage::getModel('blackchacal_prometheus/extension_file_writer')->createModulesConfigFile($data);
227
+ }
228
+
229
+ /**
230
+ * Creates extension base files (config.xml, system.xml, Data.php, etc)
231
+ */
232
+ private function _createExtensionBaseFiles()
233
+ {
234
+ $data = array(
235
+ 'namespace' => $this->_namespace,
236
+ 'name' => $this->_extensionName,
237
+ 'extensionFullName' => $this->_namespace.'_'.$this->_extensionName,
238
+ 'codepool' => $this->_codepool,
239
+ 'version' => $this->_model->getVersion(),
240
+ 'license' => $this->_model->getLicense(),
241
+ 'author' => $this->_model->getAuthorName(),
242
+ 'author_email' => $this->_model->getAuthorEmail(),
243
+ 'config_node_code' => $this->_model->getConfigNodeCode(),
244
+ 'config_tab_type' => $this->_model->getConfigTabType(),
245
+ 'config_tab_name' => $this->_model->getConfigTabName(),
246
+ 'config_tab_label' => $this->_model->getConfigTabLabel(),
247
+ 'config_tab_position' => $this->_model->getConfigTabPosition(),
248
+ 'config_section_name' => $this->_model->getConfigSectionName(),
249
+ 'config_section_label' => $this->_model->getConfigSectionLabel(),
250
+ 'admin_menu_parent' => $this->_model->getAdminMenuParent(),
251
+ 'admin_menu_name' => $this->_model->getAdminMenuName(),
252
+ 'admin_menu_title' => $this->_model->getAdminMenuTitle(),
253
+ 'admin_menu_action' => $this->_model->getAdminMenuAction(),
254
+ 'admin_menu_position' => $this->_model->getAdminMenuPosition()
255
+ );
256
+
257
+ Mage::getModel('blackchacal_prometheus/extension_file_writer')->createExtensionEtcConfigFile($data);
258
+ Mage::getModel('blackchacal_prometheus/extension_file_writer')->createExtensionEtcSystemFile($data);
259
+ Mage::getModel('blackchacal_prometheus/extension_file_writer')->createExtensionEtcAdminhtmlFile($data);
260
+ Mage::getModel('blackchacal_prometheus/extension_file_writer')->createExtensionHelperDataFile($data);
261
+ }
262
+ }
app/code/community/BlackChacal/Prometheus/Model/Resource/Config/Group.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * BlackChacal_Prometheus
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Do not edit or add to this file if you wish to upgrade Prometheus to newer
15
+ * versions in the future. If you wish to customize Prometheus for your
16
+ * needs please contact the author for more information.
17
+ *
18
+ * @category BlackChacal
19
+ * @package BlackChacal_Prometheus
20
+ * @copyright Copyright (c) 2015 BlackChacal <ribeiro.tonet@gmail.com>
21
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
22
+ */
23
+
24
+ class BlackChacal_Prometheus_Model_Resource_Config_Group extends Mage_Core_Model_Resource_Db_Abstract
25
+ {
26
+ protected function _construct()
27
+ {
28
+ $this->_init('blackchacal_prometheus/config_group', 'group_id');
29
+ }
30
+ }
app/code/community/BlackChacal/Prometheus/Model/Resource/Config/Group/Collection.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * BlackChacal_Prometheus
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Do not edit or add to this file if you wish to upgrade Prometheus to newer
15
+ * versions in the future. If you wish to customize Prometheus for your
16
+ * needs please contact the author for more information.
17
+ *
18
+ * @category BlackChacal
19
+ * @package BlackChacal_Prometheus
20
+ * @copyright Copyright (c) 2015 BlackChacal <ribeiro.tonet@gmail.com>
21
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
22
+ */
23
+
24
+ class BlackChacal_Prometheus_Model_Resource_Config_Group_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
25
+ {
26
+ public function _construct()
27
+ {
28
+ $this->_init('blackchacal_prometheus/config_group');
29
+ }
30
+ }
app/code/community/BlackChacal/Prometheus/Model/Resource/Config/Option.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * BlackChacal_Prometheus
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Do not edit or add to this file if you wish to upgrade Prometheus to newer
15
+ * versions in the future. If you wish to customize Prometheus for your
16
+ * needs please contact the author for more information.
17
+ *
18
+ * @category BlackChacal
19
+ * @package BlackChacal_Prometheus
20
+ * @copyright Copyright (c) 2015 BlackChacal <ribeiro.tonet@gmail.com>
21
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
22
+ */
23
+
24
+ class BlackChacal_Prometheus_Model_Resource_Config_Option extends Mage_Core_Model_Resource_Db_Abstract
25
+ {
26
+ protected function _construct()
27
+ {
28
+ $this->_init('blackchacal_prometheus/config_option', 'option_id');
29
+ }
30
+ }
app/code/community/BlackChacal/Prometheus/Model/Resource/Config/Option/Collection.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * BlackChacal_Prometheus
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Do not edit or add to this file if you wish to upgrade Prometheus to newer
15
+ * versions in the future. If you wish to customize Prometheus for your
16
+ * needs please contact the author for more information.
17
+ *
18
+ * @category BlackChacal
19
+ * @package BlackChacal_Prometheus
20
+ * @copyright Copyright (c) 2015 BlackChacal <ribeiro.tonet@gmail.com>
21
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
22
+ */
23
+
24
+ class BlackChacal_Prometheus_Model_Resource_Config_Option_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
25
+ {
26
+ public function _construct()
27
+ {
28
+ $this->_init('blackchacal_prometheus/config_option');
29
+ }
30
+ }
app/code/community/BlackChacal/Prometheus/Model/Resource/Extension.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * BlackChacal_Prometheus
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Do not edit or add to this file if you wish to upgrade Prometheus to newer
15
+ * versions in the future. If you wish to customize Prometheus for your
16
+ * needs please contact the author for more information.
17
+ *
18
+ * @category BlackChacal
19
+ * @package BlackChacal_Prometheus
20
+ * @copyright Copyright (c) 2015 BlackChacal <ribeiro.tonet@gmail.com>
21
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
22
+ */
23
+
24
+ class BlackChacal_Prometheus_Model_Resource_Extension extends Mage_Core_Model_Resource_Db_Abstract
25
+ {
26
+ protected function _construct()
27
+ {
28
+ $this->_init('blackchacal_prometheus/extension', 'extension_id');
29
+ }
30
+ }
app/code/community/BlackChacal/Prometheus/Model/Resource/Extension/Collection.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * BlackChacal_Prometheus
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Do not edit or add to this file if you wish to upgrade Prometheus to newer
15
+ * versions in the future. If you wish to customize Prometheus for your
16
+ * needs please contact the author for more information.
17
+ *
18
+ * @category BlackChacal
19
+ * @package BlackChacal_Prometheus
20
+ * @copyright Copyright (c) 2015 BlackChacal <ribeiro.tonet@gmail.com>
21
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
22
+ */
23
+
24
+ class BlackChacal_Prometheus_Model_Resource_Extension_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
25
+ {
26
+ public function _construct()
27
+ {
28
+ $this->_init('blackchacal_prometheus/extension');
29
+ }
30
+ }
app/code/community/BlackChacal/Prometheus/Model/System/Config/Source/Action.php ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * BlackChacal_Prometheus
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Do not edit or add to this file if you wish to upgrade Prometheus to newer
15
+ * versions in the future. If you wish to customize Prometheus for your
16
+ * needs please contact the author for more information.
17
+ *
18
+ * @category BlackChacal
19
+ * @package BlackChacal_Prometheus
20
+ * @copyright Copyright (c) 2015 BlackChacal <ribeiro.tonet@gmail.com>
21
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
22
+ */
23
+
24
+ class BlackChacal_Prometheus_Model_System_Config_Source_Action
25
+ {
26
+ /**
27
+ * Returns the configuration options for the
28
+ * "prometheus/default_extension/action" - "Action" select input.
29
+ *
30
+ * @access public
31
+ * @return array Configuration Options
32
+ */
33
+ public function toOptionArray()
34
+ {
35
+ $helper = Mage::helper('blackchacal_prometheus');
36
+
37
+ $options = array();
38
+ $options[] = array(
39
+ 'value' => 'save',
40
+ 'label' => $helper->__('Save extension.')
41
+ );
42
+ // $options[] = array(
43
+ // 'value' => 'package',
44
+ // 'label' => $helper->__('Save & Package extension.')
45
+ // );
46
+ $options[] = array(
47
+ 'value' => 'install',
48
+ 'label' => $helper->__('Save & Install extension.')
49
+ );
50
+ $options[] = array(
51
+ 'value' => 'uninstall',
52
+ 'label' => $helper->__('Save & Uninstall extension.')
53
+ );
54
+
55
+ return $options;
56
+ }
57
+ }
app/code/community/BlackChacal/Prometheus/Model/System/Config/Source/Codepool.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * BlackChacal_Prometheus
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Do not edit or add to this file if you wish to upgrade Prometheus to newer
15
+ * versions in the future. If you wish to customize Prometheus for your
16
+ * needs please contact the author for more information.
17
+ *
18
+ * @category BlackChacal
19
+ * @package BlackChacal_Prometheus
20
+ * @copyright Copyright (c) 2015 BlackChacal <ribeiro.tonet@gmail.com>
21
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
22
+ */
23
+
24
+ class BlackChacal_Prometheus_Model_System_Config_Source_Codepool
25
+ {
26
+ /**
27
+ * Returns the configuration options for the
28
+ * "prometheus/default_extension/codepool" - "Code Pool" select input.
29
+ *
30
+ * @access public
31
+ * @return array Configuration Options
32
+ */
33
+ public function toOptionArray()
34
+ {
35
+ $options = array();
36
+ $options[] = array(
37
+ 'value' => 'community',
38
+ 'label' => 'community'
39
+ );
40
+ $options[] = array(
41
+ 'value' => 'local',
42
+ 'label' => 'local'
43
+ );
44
+
45
+ return $options;
46
+ }
47
+ }
app/code/community/BlackChacal/Prometheus/Model/System/Config/Source/Systemtabs.php ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * BlackChacal_Prometheus
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Do not edit or add to this file if you wish to upgrade Prometheus to newer
15
+ * versions in the future. If you wish to customize Prometheus for your
16
+ * needs please contact the author for more information.
17
+ *
18
+ * @category BlackChacal
19
+ * @package BlackChacal_Prometheus
20
+ * @copyright Copyright (c) 2015 BlackChacal <ribeiro.tonet@gmail.com>
21
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
22
+ */
23
+
24
+ class BlackChacal_Prometheus_Model_System_Config_Source_Systemtabs
25
+ {
26
+ /**
27
+ * Returns the configuration options for the
28
+ * "prometheus/default_extension/config_tab_system"
29
+ * - "Configuration Tab Name - System Name" select input.
30
+ *
31
+ * @access public
32
+ * @return array Configuration Options
33
+ */
34
+ public function toOptionArray()
35
+ {
36
+ $helper = Mage::helper('blackchacal_prometheus');
37
+
38
+ $options = array();
39
+ $options[] = array(
40
+ 'value' => 'general',
41
+ 'label' => $helper->__('General')
42
+ );
43
+ $options[] = array(
44
+ 'value' => 'catalog',
45
+ 'label' => $helper->__('Catalog')
46
+ );
47
+ $options[] = array(
48
+ 'value' => 'customer',
49
+ 'label' => $helper->__('Customers')
50
+ );
51
+ $options[] = array(
52
+ 'value' => 'sales',
53
+ 'label' => $helper->__('Sales')
54
+ );
55
+ $options[] = array(
56
+ 'value' => 'service',
57
+ 'label' => $helper->__('Services')
58
+ );
59
+ $options[] = array(
60
+ 'value' => 'advanced',
61
+ 'label' => $helper->__('Advanced')
62
+ );
63
+
64
+ return $options;
65
+ }
66
+ }
app/code/community/BlackChacal/Prometheus/Model/System/Config/Source/Tabtypes.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * BlackChacal_Prometheus
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Do not edit or add to this file if you wish to upgrade Prometheus to newer
15
+ * versions in the future. If you wish to customize Prometheus for your
16
+ * needs please contact the author for more information.
17
+ *
18
+ * @category BlackChacal
19
+ * @package BlackChacal_Prometheus
20
+ * @copyright Copyright (c) 2015 BlackChacal <ribeiro.tonet@gmail.com>
21
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
22
+ */
23
+
24
+ class BlackChacal_Prometheus_Model_System_Config_Source_Tabtypes
25
+ {
26
+ /**
27
+ * Returns the configuration options for the
28
+ * "prometheus/default_extension/config_tab" - "Configuration Tab Name"
29
+ * select input.
30
+ *
31
+ * @access public
32
+ * @return array Configuration Options
33
+ */
34
+ public function toOptionArray()
35
+ {
36
+ $helper = Mage::helper('blackchacal_prometheus');
37
+
38
+ $options = array();
39
+ $options[] = array(
40
+ 'value' => 'namespace',
41
+ 'label' => $helper->__('Namespace')
42
+ );
43
+ $options[] = array(
44
+ 'value' => 'system',
45
+ 'label' => $helper->__('System Tabs')
46
+ );
47
+ $options[] = array(
48
+ 'value' => 'custom',
49
+ 'label' => $helper->__('Custom')
50
+ );
51
+
52
+ return $options;
53
+ }
54
+ }
app/code/community/BlackChacal/Prometheus/controllers/Adminhtml/PrometheusController.php ADDED
@@ -0,0 +1,231 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * BlackChacal_Prometheus
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Do not edit or add to this file if you wish to upgrade Prometheus to newer
15
+ * versions in the future. If you wish to customize Prometheus for your
16
+ * needs please contact the author for more information.
17
+ *
18
+ * @category BlackChacal
19
+ * @package BlackChacal_Prometheus
20
+ * @copyright Copyright (c) 2015 BlackChacal <ribeiro.tonet@gmail.com>
21
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
22
+ */
23
+
24
+ class BlackChacal_Prometheus_Adminhtml_PrometheusController extends Mage_Adminhtml_Controller_Action
25
+ {
26
+ /**
27
+ * Controller index action. Sets basic params and renders layout.
28
+ *
29
+ * @return void
30
+ */
31
+ public function indexAction()
32
+ {
33
+ // Let's call our initAction method which will set some basic params for each action
34
+ $this->_initAction();
35
+ $this->renderLayout();
36
+ }
37
+
38
+ /**
39
+ * Controller action for extension creation. It redirects to extension edit
40
+ * action.
41
+ *
42
+ * @return void
43
+ */
44
+ public function newAction()
45
+ {
46
+ // We just forward the new action to a blank edit form
47
+ $this->_forward('edit');
48
+ }
49
+
50
+ /**
51
+ * Controller action for extension editing/creation.
52
+ *
53
+ * @return void
54
+ */
55
+ public function editAction()
56
+ {
57
+ $this->_initAction();
58
+
59
+ // Get id if available
60
+ $id = $this->getRequest()->getParam('id');
61
+ $extensionModel = Mage::getModel('blackchacal_prometheus/extension');
62
+
63
+ if ($id) {
64
+ // Load record
65
+ $extensionModel->load($id);
66
+
67
+ // Check if record is loaded
68
+ if (!$extensionModel->getExtensionId()) {
69
+ Mage::getSingleton('adminhtml/session')->addError($this->__('This extension no longer exists.'));
70
+ $this->_redirect('*/*/');
71
+
72
+ return;
73
+ }
74
+ }
75
+
76
+ $this->_title($extensionModel->getExtensionId() ? $extensionModel->getName() : $this->__('New Extension'));
77
+
78
+ $data = Mage::getSingleton('adminhtml/session')->getExtensionData(true);
79
+ if (!empty($data)) {
80
+ $extensionModel->setData($data);
81
+ }
82
+
83
+ Mage::register('blackchacal_prometheus', $extensionModel);
84
+
85
+ $this->_initAction()
86
+ ->_addBreadcrumb($id ? $this->__('Edit Extension') : $this->__('New Extension'), $id ? $this->__('Edit Extension') : $this->__('New Extension'))
87
+ ->_addContent($this->getLayout()->createBlock('blackchacal_prometheus/adminhtml_prometheus_edit')->setData('action', $this->getUrl('*/*/save')))
88
+ ->renderLayout();
89
+ }
90
+
91
+ /**
92
+ * Controller action for extension saving. It connects to database through
93
+ * model to save data.
94
+ *
95
+ * @return void
96
+ */
97
+ public function saveAction()
98
+ {
99
+ if ($postData = $this->getRequest()->getPost()) {
100
+ $extensionModel = Mage::getSingleton('blackchacal_prometheus/extension');
101
+ $extensionModel->setData($postData);
102
+ if (isset($postData['id'])) {
103
+ $extensionModel->setExtensionId($postData['id']);
104
+ }
105
+
106
+ try {
107
+ $extensionModel->save();
108
+
109
+ switch ($postData['action']) {
110
+ case 'package':
111
+ break;
112
+ case 'install':
113
+ $installed = $extensionModel->install();
114
+ if ($installed) {
115
+ $extensionModel->setInstalled(true);
116
+ $extensionModel->save();
117
+ }
118
+ break;
119
+ case 'uninstall':
120
+ $uninstalled = $extensionModel->uninstall();
121
+ if ($uninstalled) {
122
+ $extensionModel->setInstalled(false);
123
+ $extensionModel->save();
124
+ }
125
+ break;
126
+ default:
127
+ break;
128
+ }
129
+
130
+ Mage::getSingleton('adminhtml/session')->addSuccess($this->__('The extension was saved.'));
131
+ $this->_redirect('*/*/');
132
+
133
+ return;
134
+ } catch (Mage_Core_Exception $e) {
135
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
136
+ } catch (Exception $e) {
137
+ Mage::getSingleton('adminhtml/session')->addError($this->__('An error occurred while saving this extension.'));
138
+ }
139
+
140
+ Mage::getSingleton('adminhtml/session')->setExtensionData($postData);
141
+ $this->_redirectReferer();
142
+ }
143
+ }
144
+
145
+ /**
146
+ * Controller action for individual deletion of extensions. It's the action
147
+ * associated with the "Delete" button on the extension edit page.
148
+ *
149
+ * @return void
150
+ */
151
+ public function deleteAction()
152
+ {
153
+ // Get id if available
154
+ $id = $this->getRequest()->getParam('id');
155
+
156
+ if ($id) {
157
+ try {
158
+ // Delete record
159
+ $extensionModel = Mage::getModel('blackchacal_prometheus/extension');
160
+ $extensionModel->load($id)->delete();
161
+ $extensionModel->uninstall();
162
+
163
+ Mage::getSingleton('adminhtml/session')->addSuccess($this->__('The extension was deleted.'));
164
+ } catch (Exception $e) {
165
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
166
+ }
167
+ }
168
+
169
+ $this->_redirect('*/*/index');
170
+ }
171
+
172
+ /**
173
+ * Controller action for mass deletion of extensions.
174
+ *
175
+ * @return void
176
+ */
177
+ public function massDeleteAction()
178
+ {
179
+ $extensionIds = $this->getRequest()->getParam('extensions');
180
+
181
+ if (!is_array($extensionIds)) {
182
+ Mage::getSingleton('adminhtml/session')->addError($this->__('Please select extension(s).'));
183
+ } else {
184
+ try {
185
+ $extensionModel = Mage::getModel('blackchacal_prometheus/extension');
186
+
187
+ foreach ($extensionIds as $extensionId) {
188
+ $extensionModel->load($extensionId)->delete();
189
+ $extensionModel->uninstall();
190
+ }
191
+
192
+ Mage::getSingleton('adminhtml/session')->addSuccess($this->__('Total of %d record(s) were deleted.', count($extensionIds)));
193
+ } catch (Exception $e) {
194
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
195
+ }
196
+ }
197
+
198
+ $this->_redirect('*/*/index');
199
+ }
200
+
201
+ /**
202
+ * Initialize action
203
+ *
204
+ * Here, we set the breadcrumbs and the active menu.
205
+ *
206
+ * @return Mage_Adminhtml_Controller_Action
207
+ */
208
+ protected function _initAction()
209
+ {
210
+ $this->loadLayout()
211
+ // Make the active menu match the menu config nodes (without 'children' inbetween)
212
+ ->_setActiveMenu('system/blackchacal_prometheus')
213
+ ->_title($this->__('System'))->_title($this->__('Prometheus'))
214
+ ->_addBreadcrumb($this->__('System'), $this->__('System'))
215
+ ->_addBreadcrumb($this->__('Prometheus - Create Extensions'), $this->__('Prometheus - Create Extensions'));
216
+
217
+ return $this;
218
+ }
219
+
220
+ /**
221
+ * Check currently called action by permissions for current user. If this method
222
+ * is not defined, on Magento 1.9.1+, a user with restricted permissions can't
223
+ * access the associated grid page.
224
+ *
225
+ * @return bool
226
+ */
227
+ protected function _isAllowed()
228
+ {
229
+ return Mage::getSingleton('admin/session')->isAllowed('system/blackchacal_prometheus');
230
+ }
231
+ }
app/code/community/BlackChacal/Prometheus/etc/LICENSE_AFL.txt ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ Academic Free License ("AFL") v. 3.0
3
+
4
+ This Academic Free License (the "License") applies to any original work of authorship (the "Original Work") whose owner (the "Licensor") has placed the following licensing notice adjacent to the copyright notice for the Original Work:
5
+
6
+ Licensed under the Academic Free License version 3.0
7
+
8
+ 1. Grant of Copyright License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, for the duration of the copyright, to do the following:
9
+
10
+ 1. to reproduce the Original Work in copies, either alone or as part of a collective work;
11
+
12
+ 2. to translate, adapt, alter, transform, modify, or arrange the Original Work, thereby creating derivative works ("Derivative Works") based upon the Original Work;
13
+
14
+ 3. to distribute or communicate copies of the Original Work and Derivative Works to the public, under any license of your choice that does not contradict the terms and conditions, including Licensor's reserved rights and remedies, in this Academic Free License;
15
+
16
+ 4. to perform the Original Work publicly; and
17
+
18
+ 5. to display the Original Work publicly.
19
+
20
+ 2. Grant of Patent License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, under patent claims owned or controlled by the Licensor that are embodied in the Original Work as furnished by the Licensor, for the duration of the patents, to make, use, sell, offer for sale, have made, and import the Original Work and Derivative Works.
21
+
22
+ 3. Grant of Source Code License. The term "Source Code" means the preferred form of the Original Work for making modifications to it and all available documentation describing how to modify the Original Work. Licensor agrees to provide a machine-readable copy of the Source Code of the Original Work along with each copy of the Original Work that Licensor distributes. Licensor reserves the right to satisfy this obligation by placing a machine-readable copy of the Source Code in an information repository reasonably calculated to permit inexpensive and convenient access by You for as long as Licensor continues to distribute the Original Work.
23
+
24
+ 4. Exclusions From License Grant. Neither the names of Licensor, nor the names of any contributors to the Original Work, nor any of their trademarks or service marks, may be used to endorse or promote products derived from this Original Work without express prior permission of the Licensor. Except as expressly stated herein, nothing in this License grants any license to Licensor's trademarks, copyrights, patents, trade secrets or any other intellectual property. No patent license is granted to make, use, sell, offer for sale, have made, or import embodiments of any patent claims other than the licensed claims defined in Section 2. No license is granted to the trademarks of Licensor even if such marks are included in the Original Work. Nothing in this License shall be interpreted to prohibit Licensor from licensing under terms different from this License any Original Work that Licensor otherwise would have a right to license.
25
+
26
+ 5. External Deployment. The term "External Deployment" means the use, distribution, or communication of the Original Work or Derivative Works in any way such that the Original Work or Derivative Works may be used by anyone other than You, whether those works are distributed or communicated to those persons or made available as an application intended for use over a network. As an express condition for the grants of license hereunder, You must treat any External Deployment by You of the Original Work or a Derivative Work as a distribution under section 1(c).
27
+
28
+ 6. Attribution Rights. You must retain, in the Source Code of any Derivative Works that You create, all copyright, patent, or trademark notices from the Source Code of the Original Work, as well as any notices of licensing and any descriptive text identified therein as an "Attribution Notice." You must cause the Source Code for any Derivative Works that You create to carry a prominent Attribution Notice reasonably calculated to inform recipients that You have modified the Original Work.
29
+
30
+ 7. Warranty of Provenance and Disclaimer of Warranty. Licensor warrants that the copyright in and to the Original Work and the patent rights granted herein by Licensor are owned by the Licensor or are sublicensed to You under the terms of this License with the permission of the contributor(s) of those copyrights and patent rights. Except as expressly stated in the immediately preceding sentence, the Original Work is provided under this License on an "AS IS" BASIS and WITHOUT WARRANTY, either express or implied, including, without limitation, the warranties of non-infringement, merchantability or fitness for a particular purpose. THE ENTIRE RISK AS TO THE QUALITY OF THE ORIGINAL WORK IS WITH YOU. This DISCLAIMER OF WARRANTY constitutes an essential part of this License. No license to the Original Work is granted by this License except under this disclaimer.
31
+
32
+ 8. Limitation of Liability. Under no circumstances and under no legal theory, whether in tort (including negligence), contract, or otherwise, shall the Licensor be liable to anyone for any indirect, special, incidental, or consequential damages of any character arising as a result of this License or the use of the Original Work including, without limitation, damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses. This limitation of liability shall not apply to the extent applicable law prohibits such limitation.
33
+
34
+ 9. Acceptance and Termination. If, at any time, You expressly assented to this License, that assent indicates your clear and irrevocable acceptance of this License and all of its terms and conditions. If You distribute or communicate copies of the Original Work or a Derivative Work, You must make a reasonable effort under the circumstances to obtain the express assent of recipients to the terms of this License. This License conditions your rights to undertake the activities listed in Section 1, including your right to create Derivative Works based upon the Original Work, and doing so without honoring these terms and conditions is prohibited by copyright law and international treaty. Nothing in this License is intended to affect copyright exceptions and limitations (including "fair use" or "fair dealing"). This License shall terminate immediately and You may no longer exercise any of the rights granted to You by this License upon your failure to honor the conditions in Section 1(c).
35
+
36
+ 10. Termination for Patent Action. This License shall terminate automatically and You may no longer exercise any of the rights granted to You by this License as of the date You commence an action, including a cross-claim or counterclaim, against Licensor or any licensee alleging that the Original Work infringes a patent. This termination provision shall not apply for an action alleging patent infringement by combinations of the Original Work with other software or hardware.
37
+
38
+ 11. Jurisdiction, Venue and Governing Law. Any action or suit relating to this License may be brought only in the courts of a jurisdiction wherein the Licensor resides or in which Licensor conducts its primary business, and under the laws of that jurisdiction excluding its conflict-of-law provisions. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any use of the Original Work outside the scope of this License or after its termination shall be subject to the requirements and penalties of copyright or patent law in the appropriate jurisdiction. This section shall survive the termination of this License.
39
+
40
+ 12. Attorneys' Fees. In any action to enforce the terms of this License or seeking damages relating thereto, the prevailing party shall be entitled to recover its costs and expenses, including, without limitation, reasonable attorneys' fees and costs incurred in connection with such action, including any appeal of such action. This section shall survive the termination of this License.
41
+
42
+ 13. Miscellaneous. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable.
43
+
44
+ 14. Definition of "You" in This License. "You" throughout this License, whether in upper or lower case, means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License. For legal entities, "You" includes any entity that controls, is controlled by, or is under common control with you. For purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
45
+
46
+ 15. Right to Use. You may use the Original Work in all ways not otherwise restricted or conditioned by this License or by law, and Licensor promises not to interfere with or be responsible for such uses by You.
47
+
48
+ 16. Modification of This License. This License is Copyright � 2005 Lawrence Rosen. Permission is granted to copy, distribute, or communicate this License without modification. Nothing in this License permits You to modify this License as applied to the Original Work or to Derivative Works. However, You may modify the text of this License and copy, distribute or communicate your modified version (the "Modified License") and apply it to other original works of authorship subject to the following conditions: (i) You may not indicate in any way that your Modified License is the "Academic Free License" or "AFL" and you may not use those names in the name of your Modified License; (ii) You must replace the notice specified in the first paragraph above with the notice "Licensed under <insert your license name here>" or with a notice of your own that is not confusingly similar to the notice in this License; and (iii) You may not claim that your original works are open source software unless your Modified License has been approved by Open Source Initiative (OSI) and You comply with its license review and certification process.
app/code/community/BlackChacal/Prometheus/etc/adminhtml.xml ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * BlackChacal_Prometheus
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Academic Free License (AFL 3.0)
9
+ * that is bundled with this package in the file LICENSE_AFL.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/afl-3.0.php
12
+ *
13
+ * DISCLAIMER
14
+ *
15
+ * Do not edit or add to this file if you wish to upgrade Prometheus to newer
16
+ * versions in the future. If you wish to customize Prometheus for your
17
+ * needs please contact the author for more information.
18
+ *
19
+ * @category BlackChacal
20
+ * @package BlackChacal_Prometheus
21
+ * @copyright Copyright (c) 2015 BlackChacal <ribeiro.tonet@gmail.com>
22
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
23
+ */
24
+ -->
25
+ <config>
26
+ <menu>
27
+ <system>
28
+ <children>
29
+ <blackchacal_prometheus translate="title" module="blackchacal_prometheus">
30
+ <title>Prometheus - Create Extensions</title>
31
+ <sort_order>10</sort_order>
32
+ <action>adminhtml/prometheus</action>
33
+ <depends>
34
+ <module>BlackChacal_Prometheus</module>
35
+ <config>blackchacal_prometheus/general/enabled</config>
36
+ </depends>
37
+ </blackchacal_prometheus>
38
+ </children>
39
+ </system>
40
+ </menu>
41
+ <acl>
42
+ <all>
43
+ <title>Allow Everything</title>
44
+ </all>
45
+ <resources>
46
+ <admin>
47
+ <children>
48
+ <system>
49
+ <children>
50
+ <blackchacal_prometheus translate="title" module="blackchacal_prometheus">
51
+ <title>Prometheus - Create Extensions</title>
52
+ <sort_order>10</sort_order>
53
+ </blackchacal_prometheus>
54
+ <config>
55
+ <children>
56
+ <blackchacal_prometheus translate="title" module="blackchacal_prometheus">
57
+ <title>Prometheus Settings</title>
58
+ </blackchacal_prometheus>
59
+ </children>
60
+ </config>
61
+ </children>
62
+ </system>
63
+ </children>
64
+ </admin>
65
+ </resources>
66
+ </acl>
67
+ </config>
app/code/community/BlackChacal/Prometheus/etc/config.xml ADDED
@@ -0,0 +1,137 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * BlackChacal_Prometheus
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Academic Free License (AFL 3.0)
9
+ * that is bundled with this package in the file LICENSE_AFL.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/afl-3.0.php
12
+ *
13
+ * DISCLAIMER
14
+ *
15
+ * Do not edit or add to this file if you wish to upgrade Prometheus to newer
16
+ * versions in the future. If you wish to customize Prometheus for your
17
+ * needs please contact the author for more information.
18
+ *
19
+ * @category BlackChacal
20
+ * @package BlackChacal_Prometheus
21
+ * @copyright Copyright (c) 2015 BlackChacal <ribeiro.tonet@gmail.com>
22
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
23
+ */
24
+ -->
25
+ <config>
26
+ <modules>
27
+ <BlackChacal_Prometheus>
28
+ <version>0.1.0</version>
29
+ </BlackChacal_Prometheus>
30
+ </modules>
31
+ <global>
32
+ <models>
33
+ <blackchacal_prometheus>
34
+ <class>BlackChacal_Prometheus_Model</class>
35
+ <resourceModel>blackchacal_prometheus_resource</resourceModel>
36
+ </blackchacal_prometheus>
37
+ <blackchacal_prometheus_resource>
38
+ <class>BlackChacal_Prometheus_Model_Resource</class>
39
+ <entities>
40
+ <extension>
41
+ <table>prometheus_general_data</table>
42
+ </extension>
43
+ <config_group>
44
+ <table>prometheus_config_group_data</table>
45
+ </config_group>
46
+ <config_option>
47
+ <table>prometheus_config_options_data</table>
48
+ </config_option>
49
+ </entities>
50
+ </blackchacal_prometheus_resource>
51
+ </models>
52
+ <resources>
53
+ <prometheus_setup>
54
+ <setup>
55
+ <module>BlackChacal_Prometheus</module>
56
+ </setup>
57
+ </prometheus_setup>
58
+ </resources>
59
+ <helpers>
60
+ <blackchacal_prometheus>
61
+ <class>BlackChacal_Prometheus_Helper</class>
62
+ </blackchacal_prometheus>
63
+ </helpers>
64
+ <blocks>
65
+ <blackchacal_prometheus>
66
+ <class>BlackChacal_Prometheus_Block</class>
67
+ </blackchacal_prometheus>
68
+ </blocks>
69
+ </global>
70
+ <admin>
71
+ <routers>
72
+ <adminhtml>
73
+ <args>
74
+ <modules>
75
+ <BlackChacal_Prometheus before="Mage_Adminhtml">BlackChacal_Prometheus_Adminhtml</BlackChacal_Prometheus>
76
+ </modules>
77
+ </args>
78
+ </adminhtml>
79
+ </routers>
80
+ </admin>
81
+ <adminhtml>
82
+ <translate>
83
+ <modules>
84
+ <BlackChacal_Prometheus>
85
+ <files>
86
+ <default>BlackChacal_Prometheus.csv</default>
87
+ </files>
88
+ </BlackChacal_Prometheus>
89
+ </modules>
90
+ </translate>
91
+ <layout>
92
+ <updates>
93
+ <blackchacal_prometheus>
94
+ <file>blackchacal_prometheus.xml</file>
95
+ </blackchacal_prometheus>
96
+ </updates>
97
+ </layout>
98
+ </adminhtml>
99
+ <default>
100
+ <blackchacal_prometheus>
101
+ <general>
102
+ <enabled>1</enabled>
103
+ <help>1</help>
104
+ </general>
105
+ <default_extension>
106
+ <namespace>BlackChacal</namespace>
107
+ <codepool>community</codepool>
108
+ <version>0.1.0</version>
109
+ <action>archive</action>
110
+ <license><![CDATA[
111
+ {{Namespace}}_{{Module}}
112
+
113
+ NOTICE OF LICENSE
114
+
115
+ This source file is subject to the Academic Free License (AFL 3.0)
116
+ that is bundled with this package in the file LICENSE_AFL.txt.
117
+ It is also available through the world-wide-web at this URL:
118
+ http://opensource.org/licenses/afl-3.0.php
119
+
120
+ DISCLAIMER
121
+
122
+ Do not edit or add to this file if you wish to upgrade {{Module}} to newer
123
+ versions in the future. If you wish to customize {{Module}} for your
124
+ needs please contact the author for more information.
125
+
126
+ @category {{Namespace}}
127
+ @package {{Namespace}}_{{Module}}
128
+ @copyright Copyright (c) {{Author}} <{{Email}}>
129
+ @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)]]>
130
+ </license>
131
+ <config_tab>namespace</config_tab>
132
+ <config_tab_namespace_position>500</config_tab_namespace_position>
133
+ <config_tab_custom_position>500</config_tab_custom_position>
134
+ </default_extension>
135
+ </blackchacal_prometheus>
136
+ </default>
137
+ </config>
app/code/community/BlackChacal/Prometheus/etc/source/extension_adminhtml_xml.txt ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <config>
2
+ {{@if (admin_menu_name != '') }}
3
+ <menu>
4
+ <{{Admin_Menu_Parent}}>
5
+ <children>
6
+ <{{Admin_Menu_Name}} translate="title" module="{{Config_Node_Code}}">
7
+ <title>{{Admin_Menu_Title}}</title>
8
+ <sort_order>{{Admin_Menu_Position}}</sort_order>
9
+ <action>adminhtml/{{Admin_Menu_Action}}</action>
10
+ </{{Admin_Menu_Name}}>
11
+ </children>
12
+ </{{Admin_Menu_Parent}}>
13
+ </menu>
14
+ {{@endif}}
15
+ <acl>
16
+ <all>
17
+ <title>Allow Everything</title>
18
+ </all>
19
+ <resources>
20
+ <admin>
21
+ <children>
22
+ {{@if (admin_menu_parent != 'system') }}
23
+ <{{Admin_Menu_Parent}}>
24
+ <children>
25
+ <{{Admin_Menu_Name}} translate="title" module="{{Config_Node_Code}}">
26
+ <title>{{Admin_Menu_Title}}</title>
27
+ <sort_order>{{Admin_Menu_Position}}</sort_order>
28
+ </{{Admin_Menu_Name}}>
29
+ </children>
30
+ </{{Admin_Menu_Parent}}>
31
+ {{@endif}}
32
+ <system>
33
+ <children>
34
+ {{@if (admin_menu_name != '' && admin_menu_parent == 'system') }}
35
+ <{{Admin_Menu_Name}} translate="title" module="{{Config_Node_Code}}">
36
+ <title>{{Admin_Menu_Title}}</title>
37
+ <sort_order>{{Admin_Menu_Position}}</sort_order>
38
+ </{{Admin_Menu_Name}}>
39
+ {{@endif}}
40
+ <config>
41
+ <children>
42
+ <{{Config_Section_Name}} translate="title" module="{{Config_Node_Code}}">
43
+ <title>{{Config_Section_Label}}</title>
44
+ </{{Config_Section_Name}}>
45
+ </children>
46
+ </config>
47
+ </children>
48
+ </system>
49
+ </children>
50
+ </admin>
51
+ </resources>
52
+ </acl>
53
+ </config>
app/code/community/BlackChacal/Prometheus/etc/source/extension_config_xml.txt ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <config>
2
+ <modules>
3
+ <{{Namespace}}_{{Module}}>
4
+ <version>{{Version}}</version>
5
+ </{{Namespace}}_{{Module}}>
6
+ </modules>
7
+ <global>
8
+ <helpers>
9
+ <{{Config_Node_Code}}>
10
+ <class>{{Namespace}}_{{Module}}_Helper</class>
11
+ </{{Config_Node_Code}}>
12
+ </helpers>
13
+ </global>
14
+ </config>
app/code/community/BlackChacal/Prometheus/etc/source/extension_system_xml.txt ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <config>
2
+ {{@if (config_tab_type != 'system') }}
3
+ <tabs>
4
+ <{{Config_Tab_Name}} translate="label" module="{{Config_Node_Code}}">
5
+ <label>{{Config_Tab_Label}}</label>
6
+ <sort_order>{{Config_Tab_Position}}</sort_order>
7
+ </{{Config_Tab_Name}}>
8
+ </tabs>
9
+ {{@endif}}
10
+ <sections>
11
+ <{{Config_Section_Name}} translate="label" module="{{Config_Node_Code}}">
12
+ <label>{{Config_Section_Label}}</label>
13
+ <tab>{{Config_Tab_Name}}</tab>
14
+ <frontend_type>text</frontend_type>
15
+ <sort_order>10</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
+ <general translate="label" module="{{Config_Node_Code}}">
21
+ <label>General Settings</label>
22
+ <frontend_type>text</frontend_type>
23
+ <sort_order>1</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
+ <enabled translate="label,comment" module="{{Config_Node_Code}}">
29
+ <label>Enable</label>
30
+ <comment><![CDATA[Enable/Disable the extension.]]></comment>
31
+ <frontend_type>select</frontend_type>
32
+ <source_model>adminhtml/system_config_source_yesno</source_model>
33
+ <sort_order>1</sort_order>
34
+ <show_in_default>1</show_in_default>
35
+ <show_in_website>1</show_in_website>
36
+ <show_in_store>1</show_in_store>
37
+ </enabled>
38
+ </fields>
39
+ </general>
40
+ </groups>
41
+ </{{Config_Section_Name}}>
42
+ </sections>
43
+ </config>
app/code/community/BlackChacal/Prometheus/etc/source/extension_system_xml_field.txt ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <{{Field Name}} translate="label,comment" module="{{Config Node Code}}">
2
+ <label>{{Field Label}}</label>
3
+ <comment><![CDATA[{{Field Comment}}]]></comment>
4
+ <frontend_type>{{Field Frontend Type}}</frontend_type>
5
+ <source_model>{{Field Source Model}}</source_model>
6
+ <backend_model>{{Field Source Model}}</backend_model>
7
+ <upload_dir>{{Field Upload Dir}}</upload_dir>
8
+ <sort_order>1</sort_order>
9
+ <show_in_default>1</show_in_default>
10
+ <show_in_website>1</show_in_website>
11
+ <show_in_store>1</show_in_store>
12
+ <depends>{{Field Dependency}}</depends>
13
+ </{{Field Name}}>
app/code/community/BlackChacal/Prometheus/etc/source/extension_system_xml_group.txt ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <{{Group Name}} translate="label" module="{{Config Node Code}}">
2
+ <label>{{Group Label}}</label>
3
+ <frontend_type>{{Group Frontend Type}}</frontend_type>
4
+ <sort_order>{{Group Sort Order}}</sort_order>
5
+ <show_in_default>1</show_in_default>
6
+ <show_in_website>1</show_in_website>
7
+ <show_in_store>1</show_in_store>
8
+ <fields>
9
+ {{@Fields}}
10
+ </fields>
11
+ </{{Group Name}}>
app/code/community/BlackChacal/Prometheus/etc/source/modules_config_xml.txt ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <config>
2
+ <modules>
3
+ <{{Namespace}}_{{Module}}>
4
+ <active>true</active>
5
+ <codePool>{{Codepool}}</codePool>
6
+ </{{Namespace}}_{{Module}}>
7
+ </modules>
8
+ </config>
app/code/community/BlackChacal/Prometheus/etc/system.xml ADDED
@@ -0,0 +1,185 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * BlackChacal_Prometheus
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Academic Free License (AFL 3.0)
9
+ * that is bundled with this package in the file LICENSE_AFL.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/afl-3.0.php
12
+ *
13
+ * DISCLAIMER
14
+ *
15
+ * Do not edit or add to this file if you wish to upgrade Prometheus to newer
16
+ * versions in the future. If you wish to customize Prometheus for your
17
+ * needs please contact the author for more information.
18
+ *
19
+ * @category BlackChacal
20
+ * @package BlackChacal_Prometheus
21
+ * @copyright Copyright (c) 2015 BlackChacal <ribeiro.tonet@gmail.com>
22
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
23
+ */
24
+ -->
25
+ <config>
26
+ <sections>
27
+ <blackchacal_prometheus translate="label" module="blackchacal_prometheus">
28
+ <label>Prometheus - Extension Creator</label>
29
+ <tab>advanced</tab>
30
+ <frontend_type>text</frontend_type>
31
+ <sort_order>10</sort_order>
32
+ <show_in_default>1</show_in_default>
33
+ <show_in_website>0</show_in_website>
34
+ <show_in_store>0</show_in_store>
35
+ <groups>
36
+ <general translate="label" module="blackchacal_prometheus">
37
+ <label>General Settings</label>
38
+ <frontend_type>text</frontend_type>
39
+ <sort_order>1</sort_order>
40
+ <show_in_default>1</show_in_default>
41
+ <show_in_website>0</show_in_website>
42
+ <show_in_store>0</show_in_store>
43
+ <fields>
44
+ <enabled translate="label,comment" module="blackchacal_prometheus">
45
+ <label>Enable Prometheus</label>
46
+ <comment><![CDATA[Enable/Disable the extension.]]></comment>
47
+ <frontend_type>select</frontend_type>
48
+ <source_model>adminhtml/system_config_source_yesno</source_model>
49
+ <sort_order>1</sort_order>
50
+ <show_in_default>1</show_in_default>
51
+ <show_in_website>0</show_in_website>
52
+ <show_in_store>0</show_in_store>
53
+ </enabled>
54
+ <!--<help translate="label,comment" module="blackchacal_prometheus">
55
+ <label>Enable Help Tab</label>
56
+ <comment><![CDATA[Enable/Disable the help tab on extension edit pages.]]></comment>
57
+ <frontend_type>select</frontend_type>
58
+ <source_model>adminhtml/system_config_source_yesno</source_model>
59
+ <sort_order>2</sort_order>
60
+ <show_in_default>1</show_in_default>
61
+ <show_in_website>0</show_in_website>
62
+ <show_in_store>0</show_in_store>
63
+ </help>-->
64
+ </fields>
65
+ </general>
66
+ <default_extension translate="label" module="blackchacal_prometheus">
67
+ <label>Default Extension Settings</label>
68
+ <frontend_type>text</frontend_type>
69
+ <sort_order>2</sort_order>
70
+ <show_in_default>1</show_in_default>
71
+ <show_in_website>0</show_in_website>
72
+ <show_in_store>0</show_in_store>
73
+ <fields>
74
+ <namespace translate="label,comment" module="blackchacal_prometheus">
75
+ <label>Namespace</label>
76
+ <comment><![CDATA[]]></comment>
77
+ <frontend_type>text</frontend_type>
78
+ <sort_order>1</sort_order>
79
+ <show_in_default>1</show_in_default>
80
+ <show_in_website>0</show_in_website>
81
+ <show_in_store>0</show_in_store>
82
+ </namespace>
83
+ <codepool translate="label,comment" module="blackchacal_prometheus">
84
+ <label>Code Pool</label>
85
+ <comment><![CDATA[Extension installation's code pool.]]></comment>
86
+ <frontend_type>select</frontend_type>
87
+ <source_model>blackchacal_prometheus/system_config_source_codepool</source_model>
88
+ <sort_order>2</sort_order>
89
+ <show_in_default>1</show_in_default>
90
+ <show_in_website>0</show_in_website>
91
+ <show_in_store>0</show_in_store>
92
+ </codepool>
93
+ <version translate="label,comment" module="blackchacal_prometheus">
94
+ <label>Version</label>
95
+ <comment><![CDATA[Extension version defined on config.xml.]]></comment>
96
+ <frontend_type>text</frontend_type>
97
+ <sort_order>3</sort_order>
98
+ <show_in_default>1</show_in_default>
99
+ <show_in_website>0</show_in_website>
100
+ <show_in_store>0</show_in_store>
101
+ </version>
102
+ <action translate="label,comment" module="blackchacal_prometheus">
103
+ <label>Action</label>
104
+ <comment><![CDATA[What to do on extension creation.]]></comment>
105
+ <frontend_type>select</frontend_type>
106
+ <source_model>blackchacal_prometheus/system_config_source_action</source_model>
107
+ <sort_order>4</sort_order>
108
+ <show_in_default>1</show_in_default>
109
+ <show_in_website>0</show_in_website>
110
+ <show_in_store>0</show_in_store>
111
+ </action>
112
+ <license translate="label,comment" module="blackchacal_prometheus">
113
+ <label>License</label>
114
+ <comment><![CDATA[License comments for extension files.]]></comment>
115
+ <frontend_type>textarea</frontend_type>
116
+ <sort_order>5</sort_order>
117
+ <show_in_default>1</show_in_default>
118
+ <show_in_website>0</show_in_website>
119
+ <show_in_store>0</show_in_store>
120
+ </license>
121
+ <config_tab translate="label,comment" module="blackchacal_prometheus">
122
+ <label>Configuration Tab Name</label>
123
+ <comment><![CDATA[Name for the extension tab on the menu System -> Configuration.]]></comment>
124
+ <frontend_type>select</frontend_type>
125
+ <source_model>blackchacal_prometheus/system_config_source_tabtypes</source_model>
126
+ <sort_order>6</sort_order>
127
+ <show_in_default>1</show_in_default>
128
+ <show_in_website>0</show_in_website>
129
+ <show_in_store>0</show_in_store>
130
+ </config_tab>
131
+ <config_tab_custom translate="label,comment" module="blackchacal_prometheus">
132
+ <label>Configuration Tab Name - Custom Name</label>
133
+ <comment><![CDATA[]]></comment>
134
+ <frontend_type>text</frontend_type>
135
+ <sort_order>7</sort_order>
136
+ <show_in_default>1</show_in_default>
137
+ <show_in_website>0</show_in_website>
138
+ <show_in_store>0</show_in_store>
139
+ <depends>
140
+ <config_tab>custom</config_tab>
141
+ </depends>
142
+ </config_tab_custom>
143
+ <config_tab_system translate="label,comment" module="blackchacal_prometheus">
144
+ <label>Configuration Tab Name - System Name</label>
145
+ <comment><![CDATA[]]></comment>
146
+ <frontend_type>select</frontend_type>
147
+ <source_model>blackchacal_prometheus/system_config_source_systemtabs</source_model>
148
+ <sort_order>8</sort_order>
149
+ <show_in_default>1</show_in_default>
150
+ <show_in_website>0</show_in_website>
151
+ <show_in_store>0</show_in_store>
152
+ <depends>
153
+ <config_tab>system</config_tab>
154
+ </depends>
155
+ </config_tab_system>
156
+ <config_tab_namespace_position translate="label,comment" module="blackchacal_prometheus">
157
+ <label>Configuration Tab Position</label>
158
+ <comment><![CDATA[Position of the extension tab on the menu System -> Configuration.]]></comment>
159
+ <frontend_type>text</frontend_type>
160
+ <sort_order>9</sort_order>
161
+ <show_in_default>1</show_in_default>
162
+ <show_in_website>0</show_in_website>
163
+ <show_in_store>0</show_in_store>
164
+ <depends>
165
+ <config_tab>namespace</config_tab>
166
+ </depends>
167
+ </config_tab_namespace_position>
168
+ <config_tab_custom_position translate="label,comment" module="blackchacal_prometheus">
169
+ <label>Configuration Tab Position</label>
170
+ <comment><![CDATA[Position of the extension tab on the menu System -> Configuration.]]></comment>
171
+ <frontend_type>text</frontend_type>
172
+ <sort_order>10</sort_order>
173
+ <show_in_default>1</show_in_default>
174
+ <show_in_website>0</show_in_website>
175
+ <show_in_store>0</show_in_store>
176
+ <depends>
177
+ <config_tab>custom</config_tab>
178
+ </depends>
179
+ </config_tab_custom_position>
180
+ </fields>
181
+ </default_extension>
182
+ </groups>
183
+ </blackchacal_prometheus>
184
+ </sections>
185
+ </config>
app/code/community/BlackChacal/Prometheus/sql/prometheus_setup/install-0.1.0.php ADDED
@@ -0,0 +1,200 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * BlackChacal_Prometheus
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Do not edit or add to this file if you wish to upgrade Prometheus to newer
15
+ * versions in the future. If you wish to customize Prometheus for your
16
+ * needs please contact the author for more information.
17
+ *
18
+ * @category BlackChacal
19
+ * @package BlackChacal_Prometheus
20
+ * @copyright Copyright (c) 2015 BlackChacal <ribeiro.tonet@gmail.com>
21
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
22
+ */
23
+
24
+ /**
25
+ * @var Mage_Core_Model_Resource_Setup $installer
26
+ */
27
+ $installer = $this;
28
+
29
+ // Insert the table creation scripts between startSetup() and endSetup() calls.
30
+ $installer->startSetup();
31
+
32
+ // Create "prometheus_general_data" table associated to "Extension" model.
33
+ $table = $installer->getConnection()
34
+ ->newTable($installer->getTable('blackchacal_prometheus/extension'))
35
+ ->addColumn('extension_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
36
+ 'identity' => true,
37
+ 'unsigned' => true,
38
+ 'nullable' => false,
39
+ 'primary' => true,
40
+ ), 'Id')
41
+ ->addColumn('namespace', Varien_Db_Ddl_Table::TYPE_VARCHAR, 30, array(
42
+ 'nullable' => false,
43
+ ), 'Namespace')
44
+ ->addColumn('name', Varien_Db_Ddl_Table::TYPE_VARCHAR, 60, array(
45
+ 'nullable' => false,
46
+ ), 'Name')
47
+ ->addColumn('codepool', Varien_Db_Ddl_Table::TYPE_VARCHAR, 10, array(
48
+ 'nullable' => false,
49
+ ), 'Code Pool')
50
+ ->addColumn('version', Varien_Db_Ddl_Table::TYPE_VARCHAR, 10, array(
51
+ 'nullable' => false,
52
+ ), 'Version')
53
+ ->addColumn('license', Varien_Db_Ddl_Table::TYPE_TEXT, null, array(
54
+ 'nullable' => true,
55
+ ), 'License')
56
+ ->addColumn('author_name', Varien_Db_Ddl_Table::TYPE_VARCHAR, 100, array(
57
+ 'nullable' => true,
58
+ ), 'Author Name')
59
+ ->addColumn('author_email', Varien_Db_Ddl_Table::TYPE_VARCHAR, 150, array(
60
+ 'nullable' => true,
61
+ ), 'Author Email')
62
+ ->addColumn('type', Varien_Db_Ddl_Table::TYPE_VARCHAR, 50, array(
63
+ 'nullable' => true,
64
+ ), 'Type')
65
+ ->addColumn('action', Varien_Db_Ddl_Table::TYPE_VARCHAR, 10, array(
66
+ 'nullable' => false,
67
+ ), 'Action')
68
+ ->addColumn('rewrite', Varien_Db_Ddl_Table::TYPE_BOOLEAN, null, array(
69
+ 'nullable' => false,
70
+ ), 'Rewrite')
71
+ ->addColumn('installed', Varien_Db_Ddl_Table::TYPE_BOOLEAN, null, array(
72
+ 'nullable' => false,
73
+ ), 'Installed')
74
+ ->addColumn('config_node_code', Varien_Db_Ddl_Table::TYPE_VARCHAR, 100, array(
75
+ 'nullable' => false,
76
+ ), 'Configuration Node Code')
77
+ ->addColumn('config_tab_type', Varien_Db_Ddl_Table::TYPE_VARCHAR, 60, array(
78
+ 'nullable' => false,
79
+ ), 'Configuration Tab Type')
80
+ ->addColumn('config_tab_name', Varien_Db_Ddl_Table::TYPE_VARCHAR, 60, array(
81
+ 'nullable' => false,
82
+ ), 'Configuration Tab Name')
83
+ ->addColumn('config_tab_label', Varien_Db_Ddl_Table::TYPE_VARCHAR, 100, array(
84
+ 'nullable' => true,
85
+ ), 'Configuration Tab Label')
86
+ ->addColumn('config_tab_position', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
87
+ 'nullable' => true,
88
+ ), 'Configuration Tab Position')
89
+ ->addColumn('config_section_name', Varien_Db_Ddl_Table::TYPE_VARCHAR, 100, array(
90
+ 'nullable' => false,
91
+ ), 'Configuration Section Name')
92
+ ->addColumn('config_section_label', Varien_Db_Ddl_Table::TYPE_VARCHAR, 150, array(
93
+ 'nullable' => false,
94
+ ), 'Configuration Section Label')
95
+ ->addColumn('admin_menu_parent', Varien_Db_Ddl_Table::TYPE_VARCHAR, 60, array(
96
+ 'nullable' => true,
97
+ ), 'Admin Menu Parent')
98
+ ->addColumn('admin_menu_name', Varien_Db_Ddl_Table::TYPE_VARCHAR, 60, array(
99
+ 'nullable' => true,
100
+ ), 'Admin Menu Name')
101
+ ->addColumn('admin_menu_title', Varien_Db_Ddl_Table::TYPE_VARCHAR, 100, array(
102
+ 'nullable' => true,
103
+ ), 'Admin Menu Title')
104
+ ->addColumn('admin_menu_action', Varien_Db_Ddl_Table::TYPE_VARCHAR, 60, array(
105
+ 'nullable' => true,
106
+ ), 'Admin Menu Action')
107
+ ->addColumn('admin_menu_position', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
108
+ 'nullable' => true,
109
+ ), 'Admin Menu Position');
110
+ $installer->getConnection()->createTable($table);
111
+
112
+ // Create "prometheus_config_group_data" table associated to "Config_Group" model.
113
+ $table = $installer->getConnection()
114
+ ->newTable($installer->getTable('blackchacal_prometheus/config_group'))
115
+ ->addColumn('group_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
116
+ 'identity' => true,
117
+ 'unsigned' => true,
118
+ 'nullable' => false,
119
+ 'primary' => true,
120
+ ), 'Id')
121
+ ->addColumn('extension_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
122
+ 'unsigned' => true,
123
+ 'nullable' => false,
124
+ ), 'Extension Id')
125
+ ->addColumn('name', Varien_Db_Ddl_Table::TYPE_VARCHAR, 60, array(
126
+ 'nullable' => false,
127
+ ), 'Group Name')
128
+ ->addColumn('label', Varien_Db_Ddl_Table::TYPE_VARCHAR, 150, array(
129
+ 'nullable' => false,
130
+ ), 'Group Label')
131
+ ->addColumn('frontend_type', Varien_Db_Ddl_Table::TYPE_VARCHAR, 50, array(
132
+ 'nullable' => false,
133
+ ), 'Frontend Type')
134
+ ->addColumn('sort_order', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
135
+ 'nullable' => false,
136
+ ), 'Sort Order')
137
+ ->addColumn('scope', Varien_Db_Ddl_Table::TYPE_VARCHAR, 10, array(
138
+ 'nullable' => false,
139
+ ), 'Group Scope')
140
+ ->addForeignKey(
141
+ $installer->getFkName('blackchacal_prometheus/config_group', 'extension_id', 'blackchacal_prometheus/extension', 'extension_id'),
142
+ 'extension_id',
143
+ $installer->getTable('blackchacal_prometheus/extension'),
144
+ 'extension_id',
145
+ Varien_Db_Ddl_Table::ACTION_CASCADE,
146
+ Varien_Db_Ddl_Table::ACTION_CASCADE
147
+ );
148
+ $installer->getConnection()->createTable($table);
149
+
150
+ // Create "prometheus_config_option_data" table associated to "Config_Option" model.
151
+ $table = $installer->getConnection()
152
+ ->newTable($installer->getTable('blackchacal_prometheus/config_option'))
153
+ ->addColumn('option_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
154
+ 'identity' => true,
155
+ 'unsigned' => true,
156
+ 'nullable' => false,
157
+ 'primary' => true,
158
+ ), 'Id')
159
+ ->addColumn('group_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
160
+ 'unsigned' => true,
161
+ 'nullable' => false,
162
+ ), 'Group Id')
163
+ ->addColumn('name', Varien_Db_Ddl_Table::TYPE_VARCHAR, 60, array(
164
+ 'nullable' => false,
165
+ ), 'Group Name')
166
+ ->addColumn('label', Varien_Db_Ddl_Table::TYPE_VARCHAR, 150, array(
167
+ 'nullable' => false,
168
+ ), 'Group Label')
169
+ ->addColumn('frontend_type', Varien_Db_Ddl_Table::TYPE_VARCHAR, 50, array(
170
+ 'nullable' => false,
171
+ ), 'Frontend Type')
172
+ ->addColumn('source_model', Varien_Db_Ddl_Table::TYPE_VARCHAR, 150, array(
173
+ 'nullable' => true,
174
+ ), 'Source Model')
175
+ ->addColumn('backend_model', Varien_Db_Ddl_Table::TYPE_VARCHAR, 150, array(
176
+ 'nullable' => true,
177
+ ), 'Backend Model')
178
+ ->addColumn('upload_dir', Varien_Db_Ddl_Table::TYPE_VARCHAR, 150, array(
179
+ 'nullable' => true,
180
+ ), 'Upload Directory')
181
+ ->addColumn('sort_order', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
182
+ 'nullable' => false,
183
+ ), 'Sort Order')
184
+ ->addColumn('scope', Varien_Db_Ddl_Table::TYPE_VARCHAR, 10, array(
185
+ 'nullable' => false,
186
+ ), 'Group Scope')
187
+ ->addColumn('depends', Varien_Db_Ddl_Table::TYPE_VARCHAR, 150, array(
188
+ 'nullable' => true,
189
+ ), 'Dependency')
190
+ ->addForeignKey(
191
+ $installer->getFkName('blackchacal_prometheus/config_option', 'group_id', 'blackchacal_prometheus/config_group', 'group_id'),
192
+ 'group_id',
193
+ $installer->getTable('blackchacal_prometheus/config_group'),
194
+ 'group_id',
195
+ Varien_Db_Ddl_Table::ACTION_CASCADE,
196
+ Varien_Db_Ddl_Table::ACTION_CASCADE
197
+ );
198
+ $installer->getConnection()->createTable($table);
199
+
200
+ $installer->endSetup();
app/design/adminhtml/default/default/layout/blackchacal_prometheus.xml ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * BlackChacal_Prometheus
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Academic Free License (AFL 3.0)
9
+ * that is bundled with this package in the file LICENSE_AFL.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/afl-3.0.php
12
+ *
13
+ * DISCLAIMER
14
+ *
15
+ * Do not edit or add to this file if you wish to upgrade Prometheus to newer
16
+ * versions in the future. If you wish to customize Prometheus for your
17
+ * needs please contact the author for more information.
18
+ *
19
+ * @category BlackChacal
20
+ * @package BlackChacal_Prometheus
21
+ * @copyright Copyright (c) 2015 BlackChacal <ribeiro.tonet@gmail.com>
22
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
23
+ */
24
+ -->
25
+ <layout>
26
+ <adminhtml_prometheus_index>
27
+ <reference name="content">
28
+ <block type="blackchacal_prometheus/adminhtml_prometheus" name="blackchacal_prometheus_extensions_list" />
29
+ </reference>
30
+ </adminhtml_prometheus_index>
31
+ <adminhtml_prometheus_edit>
32
+ <reference name="left">
33
+ <block type="blackchacal_prometheus/adminhtml_prometheus_edit_tabs" name="prometheus_edit_tabs">
34
+ <block type="blackchacal_prometheus/adminhtml_prometheus_edit_tab_general" name="prometheus_edit_tab_general" />
35
+ <!-- <block type="adminhtml/prometheus_edit_tab_configoptions" name="prometheus_edit_tab_configoptions" />
36
+ <block type="adminhtml/prometheus_edit_tab_admingrid" name="prometheus_edit_tab_admingrid" />
37
+ <block type="adminhtml/prometheus_edit_tab_frontend" name="prometheus_edit_tab_frontend" />
38
+ <block type="adminhtml/prometheus_edit_tab_entities" name="prometheus_edit_tab_entities" />
39
+ <block type="adminhtml/prometheus_edit_tab_filesfolders" name="prometheus_edit_tab_filesfolders" />
40
+ <block type="adminhtml/prometheus_edit_tab_payment" name="prometheus_edit_tab_payment" />
41
+ <block type="adminhtml/prometheus_edit_tab_shipping" name="prometheus_edit_tab_shipping" />
42
+ <block type="adminhtml/prometheus_edit_tab_help" name="prometheus_edit_tab_help" /> -->
43
+
44
+ <action method="addTab"><name>general_section</name><block>blackchacal_prometheus/adminhtml_prometheus_edit_tab_general</block></action>
45
+ <!-- <action method="addTab"><name>configoptions_section</name><block>promo_quote_edit_tab_configoptions</block></action>
46
+ <action method="addTab"><name>admingrid_section</name><block>promo_quote_edit_tab_admingrid</block></action>
47
+ <action method="addTab"><name>frontend_section</name><block>promo_quote_edit_tab_frontend</block></action>
48
+ <action method="addTab"><name>entities_section</name><block>promo_quote_edit_tab_entities</block></action>
49
+ <action method="addTab"><name>filesfolders_section</name><block>promo_quote_edit_tab_filesfolders</block></action>
50
+ <action method="addTab"><name>payment_section</name><block>promo_quote_edit_tab_payment</block></action>
51
+ <action method="addTab"><name>shipping_section</name><block>promo_quote_edit_tab_shipping</block></action>
52
+ <action method="addTab" ifconfig="blackchacal_prometheus/general/help" condition="1"><name>help_section</name><block>promo_quote_edit_tab_help</block></action> -->
53
+ </block>
54
+ </reference>
55
+ </adminhtml_prometheus_edit>
56
+ </layout>
app/etc/modules/BlackChacal_Prometheus.xml ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * BlackChacal_Prometheus
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Academic Free License (AFL 3.0)
9
+ * that is bundled with this package in the file LICENSE_AFL.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/afl-3.0.php
12
+ *
13
+ * DISCLAIMER
14
+ *
15
+ * Do not edit or add to this file if you wish to upgrade Prometheus to newer
16
+ * versions in the future. If you wish to customize Prometheus for your
17
+ * needs please contact the author for more information.
18
+ *
19
+ * @category BlackChacal
20
+ * @package BlackChacal_Prometheus
21
+ * @copyright Copyright (c) 2015 BlackChacal <ribeiro.tonet@gmail.com>
22
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
23
+ */
24
+ -->
25
+ <config>
26
+ <modules>
27
+ <BlackChacal_Prometheus>
28
+ <active>true</active>
29
+ <codePool>community</codePool>
30
+ </BlackChacal_Prometheus>
31
+ </modules>
32
+ </config>
app/locale/en_US/BlackChacal_Prometheus.csv ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "Save extension.","Save extension."
2
+ "Save & Package extension.","Save & Package extension."
3
+ "Save & Install extension.","Save & Install extension."
4
+ "Save & Uninstall extension.","Save & Uninstall extension."
5
+ "General","General"
6
+ "Catalog","Catalog"
7
+ "Customers","Customers"
8
+ "Sales","Sales"
9
+ "Services","Services"
10
+ "Advanced","Advanced"
11
+ "Namespace","Namespace"
12
+ "System Tabs","System Tabs"
13
+ "Custom","Custom"
14
+ "Prometheus - Create Extensions","Prometheus - Create Extensions"
15
+ "Prometheus Settings","Prometheus Settings"
16
+ "Prometheus - Extension Creator","Prometheus - Extension Creator"
17
+ "General Settings","General Settings"
18
+ "Enable Prometheus","Enable Prometheus"
19
+ "Enable/Disable the extension.","Enable/Disable the extension."
20
+ "Enable Help Tab","Enable Help Tab"
21
+ "Enable/Disable the help tab on extension edit pages.","Enable/Disable the help tab on extension edit pages."
22
+ "Default Extension Settings","Default Extension Settings"
23
+ "Namespace","Namespace"
24
+ "Code Pool","Code Pool"
25
+ "Extension installation's code pool.","Extension installation's code pool."
26
+ "Version","Version"
27
+ "Extension version defined on config.xml.","Extension version defined on config.xml."
28
+ "Action","Action"
29
+ "What to do on extension creation.","What to do on extension creation."
30
+ "License","License"
31
+ "License comments for extension files.","License comments for extension files."
32
+ "Configuration Tab Name","Configuration Tab Name"
33
+ "Name for the extension tab on the menu System -> Configuration.","Name for the extension tab on the menu System -> Configuration."
34
+ "Configuration Tab Name - Custom Name","Configuration Tab Name - Custom Name"
35
+ "Configuration Tab Name - System Name","Configuration Tab Name - System Name"
36
+ "Configuration Tab Position","Configuration Tab Position"
37
+ "Position of the extension tab on the menu System -> Configuration.","Position of the extension tab on the menu System -> Configuration."
38
+ "Configuration Tab Position","Configuration Tab Position"
39
+ "Position of the extension tab on the menu System -> Configuration.","Position of the extension tab on the menu System -> Configuration."
40
+ "This extension no longer exists.","This extension no longer exists."
41
+ "New Extension","New Extension"
42
+ "Edit Extension","Edit Extension"
43
+ "The extension was saved.","The extension was saved."
44
+ "An error occurred while saving this extension.","An error occurred while saving this extension."
45
+ "The extension was deleted.","The extension was deleted."
46
+ "Please select extension(s).","Please select extension(s)."
47
+ "Total of %d record(s) were deleted.","Total of %d record(s) were deleted."
48
+ "System","System"
49
+ "Prometheus","Prometheus"
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Prometheus</name>
4
+ <version>0.1.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Prometheus allows the creation of Magento 1.7+ extensions.</summary>
10
+ <description>Prometheus allows the creation of Magento 1.7+ extensions.</description>
11
+ <notes>v0.1.0</notes>
12
+ <authors><author><name>Ricardo Tonet</name><user>BlackChacal</user><email>ribeiro.tonet@gmail.com</email></author></authors>
13
+ <date>2015-11-17</date>
14
+ <time>22:50:03</time>
15
+ <contents><target name="magecommunity"><dir name="BlackChacal"><dir name="Prometheus"><dir name="Block"><dir name="Adminhtml"><dir name="Prometheus"><dir name="Edit"><file name="Form.php" hash="4d11e041c904626d17e6d3ac42fe8751"/><dir name="Tab"><file name="General.php" hash="f23097b7d1062caa6322f631a729c40c"/></dir><file name="Tabs.php" hash="702875cbf02284f8d814a144fd145e26"/></dir><file name="Edit.php" hash="20a2f8292dcb677acf2d14bfe18a8a70"/><file name="Grid.php" hash="d3000488bb6dadfd4c0d57005edb5c1b"/></dir><file name="Prometheus.php" hash="5b3e6f76247ceab03051320fa633294b"/></dir></dir><dir name="Helper"><file name="Data.php" hash="3fa380a0030fc8a446621e470d258544"/></dir><dir name="Model"><dir name="Config"><file name="Group.php" hash="6baeb301a5ab0e0492a1bdd579a3f0af"/><file name="Option.php" hash="c91c72e19bd6e8d642a56d688091a893"/></dir><dir name="Extension"><dir name="File"><dir name="Content"><dir name="Php"><file name="Classwriter.php" hash="8a9f344cb3f9adba8c23bff08d2ca2d5"/></dir><file name="Writer.php" hash="c949f0b3a652312326cdbdc38a4cd8e9"/><dir name="Xml"><file name="Configwriter.php" hash="ad846114d78652575a316a43bd1113ff"/><file name="Layoutwriter.php" hash="3dcadb828efd2e0c97b5c0a07b5a404e"/></dir></dir><file name="Writer.php" hash="e8f0eb3557f106b2bda753d576b60b0a"/></dir><file name="Writer.php" hash="9552c4663155d233a783f156d1530b41"/></dir><file name="Extension.php" hash="e42125754d11314e6d520b0ede4bad31"/><dir name="Resource"><dir name="Config"><dir name="Group"><file name="Collection.php" hash="ee5e7b5e6d090b196fa57a3a6683971b"/></dir><file name="Group.php" hash="a438c8ec8eb55064f2541d8fda8074fb"/><dir name="Option"><file name="Collection.php" hash="ec817a6630b1609f5a0154c125168baa"/></dir><file name="Option.php" hash="efcff0253a8ffba267d3791dde7c4a4d"/></dir><dir name="Extension"><file name="Collection.php" hash="ce629599b9bf4a7cc04ca308799a98ed"/></dir><file name="Extension.php" hash="b63ebbc48862e54f6e90b88bb87e98ea"/></dir><dir name="System"><dir name="Config"><dir name="Source"><file name="Action.php" hash="10ab280188e3b5586c90739cca331754"/><file name="Codepool.php" hash="c9d809872cacbefb3ea000a5d3ff3520"/><file name="Systemtabs.php" hash="fef12a72ad8781954b93b70bc2560bbf"/><file name="Tabtypes.php" hash="deb9c86eb9fcccc178171f04be460118"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="PrometheusController.php" hash="d5c0ba69628c5a72a4f71db8b3576116"/></dir></dir><dir name="etc"><file name="LICENSE_AFL.txt" hash="45a399f2095030865fb962263ccd7506"/><file name="adminhtml.xml" hash="8da979de8efdd5d05f7e2830c51a15cc"/><file name="config.xml" hash="f7a42e6ae2ad09c9a56cf27de2d23620"/><dir name="source"><file name="extension_adminhtml_xml.txt" hash="e8c5ab77459217f71895d8f19f4dc2b3"/><file name="extension_config_xml.txt" hash="2dc1c45292ace28bfc6e4beda3c85365"/><file name="extension_system_xml.txt" hash="2f4c1d4b7d58956cac55b374bcff2622"/><file name="extension_system_xml_field.txt" hash="96d5122efded479cc4f8360463374e4b"/><file name="extension_system_xml_group.txt" hash="c998dbba9aa842cad17a1477e517fbd4"/><file name="modules_config_xml.txt" hash="e0e32c7bec4447e6911471ebb7cb9cb8"/></dir><file name="system.xml" hash="5b03dd4921d658aa9cf5e8be6094069f"/></dir><dir name="sql"><dir name="prometheus_setup"><file name="install-0.1.0.php" hash="e460eb721e7faff97b1b5ea5799de363"/></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="BlackChacal_Prometheus.csv" hash="b7463ebfb30d1413701916b897a02039"/></dir></target><target name="mageetc"><dir name="modules"><file name="BlackChacal_Prometheus.xml" hash="817f978ce49863913d49625a9b7662e5"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="blackchacal_prometheus.xml" hash="5da71bdbdae99d14da67b359058df741"/></dir></dir></dir></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
18
+ </package>