forkel_bars - Version 1.0.0

Version Notes

===== 1.0.0 =====
* Initial version of this module

Download this release

Release Info

Developer Tobias Forkel
Extension forkel_bars
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

Files changed (28) hide show
  1. app/code/community/Forkel/Bars/Block/Adminhtml/Index.php +21 -0
  2. app/code/community/Forkel/Bars/Block/Adminhtml/Index/Edit.php +39 -0
  3. app/code/community/Forkel/Bars/Block/Adminhtml/Index/Edit/Form.php +114 -0
  4. app/code/community/Forkel/Bars/Block/Adminhtml/Index/Grid.php +120 -0
  5. app/code/community/Forkel/Bars/Block/Adminhtml/Notification.php +34 -0
  6. app/code/community/Forkel/Bars/Block/Adminhtml/Server.php +21 -0
  7. app/code/community/Forkel/Bars/Block/Adminhtml/Server/Edit.php +39 -0
  8. app/code/community/Forkel/Bars/Block/Adminhtml/Server/Edit/Form.php +79 -0
  9. app/code/community/Forkel/Bars/Block/Adminhtml/Server/Grid.php +96 -0
  10. app/code/community/Forkel/Bars/Changelog.txt +12 -0
  11. app/code/community/Forkel/Bars/Helper/Data.php +54 -0
  12. app/code/community/Forkel/Bars/Model/Index.php +38 -0
  13. app/code/community/Forkel/Bars/Model/Resource/Index.php +17 -0
  14. app/code/community/Forkel/Bars/Model/Resource/Index/Collection.php +17 -0
  15. app/code/community/Forkel/Bars/Model/Resource/Server.php +17 -0
  16. app/code/community/Forkel/Bars/Model/Resource/Server/Collection.php +17 -0
  17. app/code/community/Forkel/Bars/Model/Server.php +36 -0
  18. app/code/community/Forkel/Bars/controllers/Adminhtml/Forkel/Bars/IndexController.php +163 -0
  19. app/code/community/Forkel/Bars/controllers/Adminhtml/Forkel/Bars/ServerController.php +163 -0
  20. app/code/community/Forkel/Bars/data/forkel_bars_setup/data-install-1.0.0.php +89 -0
  21. app/code/community/Forkel/Bars/etc/adminhtml.xml +54 -0
  22. app/code/community/Forkel/Bars/etc/config.xml +84 -0
  23. app/code/community/Forkel/Bars/sql/forkel_bars_setup/install-1.0.0.php +67 -0
  24. app/design/adminhtml/default/default/layout/forkel/bars.xml +21 -0
  25. app/design/adminhtml/default/default/template/forkel/bars/adminhtml/notification.phtml +28 -0
  26. app/etc/modules/Forkel_Bars.xml +9 -0
  27. js/community/forkel_bars/main.js +3 -0
  28. package.xml +72 -0
app/code/community/Forkel/Bars/Block/Adminhtml/Index.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Forkel Bars
4
+ *
5
+ * @category Forkel
6
+ * @package Forkel_Bars
7
+ * @copyright Copyright (c) 2015 Tobias Forkel (http://www.tobiasforkel.de)
8
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
9
+ */
10
+
11
+ class Forkel_Bars_Block_Adminhtml_Index extends Mage_Adminhtml_Block_Widget_Grid_Container
12
+ {
13
+ public function __construct()
14
+ {
15
+ $this->_blockGroup = Forkel_Bars_Helper_Data::MODULE_KEY;
16
+ $this->_controller = 'adminhtml_index';
17
+ $this->_headerText = $this->__('Forkel Bars');
18
+
19
+ parent::__construct();
20
+ }
21
+ }
app/code/community/Forkel/Bars/Block/Adminhtml/Index/Edit.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Forkel Bars
4
+ *
5
+ * @category Forkel
6
+ * @package Forkel_Bars
7
+ * @copyright Copyright (c) 2015 Tobias Forkel (http://www.tobiasforkel.de)
8
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
9
+ */
10
+
11
+ class Forkel_Bars_Block_Adminhtml_Index_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
12
+ {
13
+ public function __construct()
14
+ {
15
+ $this->_blockGroup = Forkel_Bars_Helper_Data::MODULE_KEY;
16
+ $this->_controller = 'adminhtml_index';
17
+
18
+ parent::__construct();
19
+
20
+ $this->_updateButton('save', 'label', $this->__('Save Record'));
21
+ }
22
+
23
+ /**
24
+ * Get header text
25
+ *
26
+ * Check if global id exists. Return text for "edit" or "new".
27
+ *
28
+ * @return string
29
+ */
30
+ public function getHeaderText()
31
+ {
32
+ if (Mage::registry(Forkel_Bars_Helper_Data::MODULE_KEY)->getId())
33
+ {
34
+ return $this->__('Forkel Bars > %s', $this->__('Edit'));
35
+ }
36
+
37
+ return $this->__('Forkel Bars > %s', $this->__('New'));
38
+ }
39
+ }
app/code/community/Forkel/Bars/Block/Adminhtml/Index/Edit/Form.php ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Forkel Bars
4
+ *
5
+ * @category Forkel
6
+ * @package Forkel_Bars
7
+ * @copyright Copyright (c) 2015 Tobias Forkel (http://www.tobiasforkel.de)
8
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
9
+ */
10
+
11
+ class Forkel_Bars_Block_Adminhtml_Index_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
12
+ {
13
+ public function __construct()
14
+ {
15
+ parent::__construct();
16
+
17
+ $this->setId('forkel_bars_index_form');
18
+ }
19
+
20
+ /**
21
+ * Prepare layout
22
+ *
23
+ * @return void
24
+ */
25
+ protected function _prepareLayout()
26
+ {
27
+ parent::_prepareLayout();
28
+ }
29
+
30
+ /**
31
+ * Prepare form
32
+ *
33
+ * Setup the form fields for inserts/updates. Add all necessary fields.
34
+ *
35
+ * @return Mage_Adminhtml_Block_Widget_Form
36
+ */
37
+ protected function _prepareForm()
38
+ {
39
+ $model = Mage::registry(Forkel_Bars_Helper_Data::MODULE_KEY);
40
+
41
+ $form = new Varien_Data_Form(array(
42
+ 'id' => 'edit_form',
43
+ 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
44
+ 'method' => 'post'
45
+ ));
46
+
47
+ $fieldset = $form->addFieldset('base_fieldset', array(
48
+ 'legend' => $this->__('Edit'),
49
+ 'class' => 'fieldset-wide',
50
+ ));
51
+
52
+ if ($model->getId()) {
53
+ $fieldset->addField('id', 'hidden', array(
54
+ 'name' => 'id',
55
+ ));
56
+ };
57
+
58
+ $fieldset->addField('server_id', 'select', array(
59
+ 'name' => 'server_id',
60
+ 'label' => $this->__('Server'),
61
+ 'title' => $this->__('Server'),
62
+ 'required' => false,
63
+ 'value' => $model->getId(),
64
+ 'values' => Mage::getSingleton('forkel_bars/server')->getOptionArray()
65
+ ));
66
+
67
+ $fieldset->addField('name', 'text', array(
68
+ 'name' => 'name',
69
+ 'label' => $this->__('Name'),
70
+ 'title' => $this->__('Name'),
71
+ 'required' => true,
72
+ ));
73
+
74
+ $fieldset->addField('description', 'textarea', array(
75
+ 'name' => 'description',
76
+ 'label' => $this->__('Description'),
77
+ 'title' => $this->__('Description'),
78
+ 'required' => true,
79
+ 'style' => 'height: 60px;'
80
+ ));
81
+
82
+ $fieldset->addField('color', 'text', array(
83
+ 'name' => 'color',
84
+ 'label' => $this->__('Color'),
85
+ 'title' => $this->__('Color'),
86
+ 'note' => 'Hex code ( such as #a94442 )',
87
+ 'required' => true,
88
+ ));
89
+
90
+ $fieldset->addField('color_background', 'text', array(
91
+ 'name' => 'color_background',
92
+ 'label' => $this->__('Background Color'),
93
+ 'title' => $this->__('Background Color'),
94
+ 'note' => 'Hex code ( such as #f2dede )',
95
+ 'required' => true,
96
+ ));
97
+
98
+ $fieldset->addField('status', 'select', array(
99
+ 'label' => $this->__('Status'),
100
+ 'title' => $this->__('Status'),
101
+ 'name' => 'status',
102
+ 'options' => array(
103
+ '0' => $this->__('Disabled'),
104
+ '1' => $this->__('Enabled')
105
+ )
106
+ ));
107
+
108
+ $form->setValues($model->getData());
109
+ $form->setUseContainer(true);
110
+ $this->setForm($form);
111
+
112
+ return parent::_prepareForm();
113
+ }
114
+ }
app/code/community/Forkel/Bars/Block/Adminhtml/Index/Grid.php ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Forkel Bars
4
+ *
5
+ * @category Forkel
6
+ * @package Forkel_Bars
7
+ * @copyright Copyright (c) 2015 Tobias Forkel (http://www.tobiasforkel.de)
8
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
9
+ */
10
+
11
+ class Forkel_Bars_Block_Adminhtml_Index_Grid extends Mage_Adminhtml_Block_Widget_Grid
12
+ {
13
+ public function __construct()
14
+ {
15
+ parent::__construct();
16
+
17
+ $this->setDefaultSort('id');
18
+ $this->setId('forkel_bars_index_grid');
19
+ $this->setDefaultDir('asc');
20
+ $this->setSaveParametersInSession(true);
21
+ }
22
+
23
+ /**
24
+ * Get collection class
25
+ *
26
+ * Return collection path as a string.
27
+ *
28
+ * @return string
29
+ */
30
+ protected function _getCollectionClass()
31
+ {
32
+ return 'forkel_bars/index_collection';
33
+ }
34
+
35
+ /**
36
+ * Prepare collection
37
+ *
38
+ * Extend collection with joins to other resources.
39
+ *
40
+ * @return Mage_Adminhtml_Block_Widget_Grid
41
+ */
42
+ protected function _prepareCollection()
43
+ {
44
+ $collection = Mage::getResourceModel($this->_getCollectionClass());
45
+ $this->setCollection($collection);
46
+
47
+ return parent::_prepareCollection();
48
+ }
49
+
50
+ /**
51
+ * Prepare columns
52
+ *
53
+ * Add columns to the grid.
54
+ *
55
+ * @return Forkel_Bars_Block_Adminhtml_Index_Grid
56
+ */
57
+ protected function _prepareColumns()
58
+ {
59
+ $this->addColumn('id',
60
+ array(
61
+ 'header' => $this->__('ID'),
62
+ 'align' => 'right',
63
+ 'width' => '50px',
64
+ 'index' => 'id'
65
+ )
66
+ );
67
+
68
+ $this->addColumn('server_id',
69
+ array(
70
+ 'header' => $this->__('Server'),
71
+ 'index' => 'server_id',
72
+ 'type' => 'options',
73
+ 'options' => Mage::getSingleton('forkel_bars/server')->getOptionArray(),
74
+ 'width' => '200px',
75
+ )
76
+ );
77
+
78
+ $this->addColumn('name',
79
+ array(
80
+ 'header' => $this->__('Name'),
81
+ 'index' => 'name',
82
+ 'width' => '200px',
83
+ )
84
+ );
85
+
86
+ $this->addColumn('description',
87
+ array(
88
+ 'header' => $this->__('Description'),
89
+ 'index' => 'description'
90
+ )
91
+ );
92
+
93
+ $this->addColumn('status',
94
+ array(
95
+ 'header' => $this->__('Status'),
96
+ 'index' => 'status',
97
+ 'type' => 'options',
98
+ 'options' => array(
99
+ '0' => $this->__('Disabled'),
100
+ '1' => $this->__('Enabled')
101
+ ),
102
+ 'width' => '50px',
103
+ )
104
+ );
105
+
106
+ return parent::_prepareColumns();
107
+ }
108
+
109
+ /**
110
+ * Get URL for a specific row
111
+ *
112
+ * Return the "edit" form url for each row.
113
+ *
114
+ * @return string
115
+ */
116
+ public function getRowUrl($row)
117
+ {
118
+ return $this->getUrl('*/*/edit', array('id' => $row->getId()));
119
+ }
120
+ }
app/code/community/Forkel/Bars/Block/Adminhtml/Notification.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Forkel Bars
4
+ *
5
+ * @category Forkel
6
+ * @package Forkel_Bars
7
+ * @copyright Copyright (c) 2015 Tobias Forkel (http://www.tobiasforkel.de)
8
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
9
+ */
10
+
11
+ class Forkel_Bars_Block_Adminhtml_Notification extends Mage_Core_Block_Template
12
+ {
13
+ public function getNotification()
14
+ {
15
+ $helper = Mage::helper(Forkel_Bars_Helper_Data::MODULE_KEY);
16
+
17
+ return Mage::getSingleton(Forkel_Bars_Helper_Data::MODEL_INDEX)->loadByHostname(
18
+ $helper->getHostname()
19
+ );
20
+ }
21
+
22
+ /**
23
+ * Get lighter hex color
24
+ *
25
+ * @param $diff The difference to the original color.
26
+ *
27
+ * @return string
28
+ */
29
+ public function getBackgroundLighter($hex = '', $diff = '50')
30
+ {
31
+ return Forkel_Bars_Helper_Data::hexColorLighter($hex, $diff);
32
+ }
33
+
34
+ }
app/code/community/Forkel/Bars/Block/Adminhtml/Server.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Forkel Bars
4
+ *
5
+ * @category Forkel
6
+ * @package Forkel_Bars
7
+ * @copyright Copyright (c) 2015 Tobias Forkel (http://www.tobiasforkel.de)
8
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
9
+ */
10
+
11
+ class Forkel_Bars_Block_Adminhtml_Server extends Mage_Adminhtml_Block_Widget_Grid_Container
12
+ {
13
+ public function __construct()
14
+ {
15
+ $this->_blockGroup = Forkel_Bars_Helper_Data::MODULE_KEY;
16
+ $this->_controller = 'adminhtml_server';
17
+ $this->_headerText = $this->__('Forkel Bars > Server');
18
+
19
+ parent::__construct();
20
+ }
21
+ }
app/code/community/Forkel/Bars/Block/Adminhtml/Server/Edit.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Forkel Bars
4
+ *
5
+ * @category Forkel
6
+ * @package Forkel_Bars
7
+ * @copyright Copyright (c) 2015 Tobias Forkel (http://www.tobiasforkel.de)
8
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
9
+ */
10
+
11
+ class Forkel_Bars_Block_Adminhtml_Server_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
12
+ {
13
+ public function __construct()
14
+ {
15
+ $this->_blockGroup = Forkel_Bars_Helper_Data::MODULE_KEY;
16
+ $this->_controller = 'adminhtml_server';
17
+
18
+ parent::__construct();
19
+
20
+ $this->_updateButton('save', 'label', $this->__('Save Record'));
21
+ }
22
+
23
+ /**
24
+ * Get header text
25
+ *
26
+ * Check if global id exists. Return text for "edit" or "new".
27
+ *
28
+ * @return string
29
+ */
30
+ public function getHeaderText()
31
+ {
32
+ if (Mage::registry(Forkel_Bars_Helper_Data::MODULE_KEY)->getId())
33
+ {
34
+ return $this->__('Forkel Bars > Server > %s', $this->__('Edit'));
35
+ }
36
+
37
+ return $this->__('Forkel Bars > Server > %s', $this->__('New'));
38
+ }
39
+ }
app/code/community/Forkel/Bars/Block/Adminhtml/Server/Edit/Form.php ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Forkel Bars
4
+ *
5
+ * @category Forkel
6
+ * @package Forkel_Bars
7
+ * @copyright Copyright (c) 2015 Tobias Forkel (http://www.tobiasforkel.de)
8
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
9
+ */
10
+
11
+ class Forkel_Bars_Block_Adminhtml_Server_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
12
+ {
13
+ public function __construct()
14
+ {
15
+ parent::__construct();
16
+
17
+ $this->setId('forkel_bars_server_form');
18
+ }
19
+
20
+ /**
21
+ * Prepare layout
22
+ *
23
+ * @return void
24
+ */
25
+ protected function _prepareLayout()
26
+ {
27
+ parent::_prepareLayout();
28
+ }
29
+
30
+ /**
31
+ * Prepare form
32
+ *
33
+ * Setup the form fields for inserts/updates. Add all necessary fields.
34
+ *
35
+ * @return Mage_Adminhtml_Block_Widget_Form
36
+ */
37
+ protected function _prepareForm()
38
+ {
39
+ $model = Mage::registry(Forkel_Bars_Helper_Data::MODULE_KEY);
40
+
41
+ $form = new Varien_Data_Form(array(
42
+ 'id' => 'edit_form',
43
+ 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
44
+ 'method' => 'post'
45
+ ));
46
+
47
+ $fieldset = $form->addFieldset('base_fieldset', array(
48
+ 'legend' => $this->__('Edit'),
49
+ 'class' => 'fieldset-wide',
50
+ ));
51
+
52
+ if ($model->getId()) {
53
+ $fieldset->addField('id', 'hidden', array(
54
+ 'name' => 'id',
55
+ ));
56
+ };
57
+
58
+ $fieldset->addField('name', 'text', array(
59
+ 'name' => 'name',
60
+ 'label' => $this->__('Name'),
61
+ 'title' => $this->__('Name'),
62
+ 'note' => $this->__('The name of the environment.'),
63
+ 'required' => true
64
+ ));
65
+
66
+ $fieldset->addField('hostname', 'text', array(
67
+ 'name' => 'hostname',
68
+ 'label' => $this->__('Hostname'),
69
+ 'title' => $this->__('Hostname'),
70
+ 'note' => $this->__('The hostname without http and slashes /.'),
71
+ ));
72
+
73
+ $form->setValues($model->getData());
74
+ $form->setUseContainer(true);
75
+ $this->setForm($form);
76
+
77
+ return parent::_prepareForm();
78
+ }
79
+ }
app/code/community/Forkel/Bars/Block/Adminhtml/Server/Grid.php ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Forkel Bars
4
+ *
5
+ * @category Forkel
6
+ * @package Forkel_Bars
7
+ * @copyright Copyright (c) 2015 Tobias Forkel (http://www.tobiasforkel.de)
8
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
9
+ */
10
+
11
+ class Forkel_Bars_Block_Adminhtml_Server_Grid extends Mage_Adminhtml_Block_Widget_Grid
12
+ {
13
+ public function __construct()
14
+ {
15
+ parent::__construct();
16
+
17
+ $this->setDefaultSort('id');
18
+ $this->setId('forkel_bars_server_grid');
19
+ $this->setDefaultDir('desc');
20
+ $this->setSaveParametersInSession(true);
21
+ }
22
+
23
+ /**
24
+ * Get collection class
25
+ *
26
+ * Return collection path as a string.
27
+ *
28
+ * @return string
29
+ */
30
+ protected function _getCollectionClass()
31
+ {
32
+ return 'forkel_bars/server_collection';
33
+ }
34
+
35
+ /**
36
+ * Prepare collection
37
+ *
38
+ * Extend collection with joins to other resources.
39
+ *
40
+ * @return Mage_Adminhtml_Block_Widget_Grid
41
+ */
42
+ protected function _prepareCollection()
43
+ {
44
+ $collection = Mage::getResourceModel($this->_getCollectionClass());
45
+ $this->setCollection($collection);
46
+
47
+ return parent::_prepareCollection();
48
+ }
49
+
50
+ /**
51
+ * Prepare columns
52
+ *
53
+ * Add columns to the grid.
54
+ *
55
+ * @return Forkel_Bars_Block_Adminhtml_Bars_Grid
56
+ */
57
+ protected function _prepareColumns()
58
+ {
59
+ $this->addColumn('id',
60
+ array(
61
+ 'header' => $this->__('ID'),
62
+ 'align' => 'right',
63
+ 'width' => '50px',
64
+ 'index' => 'id'
65
+ )
66
+ );
67
+
68
+ $this->addColumn('name',
69
+ array(
70
+ 'header' => $this->__('Name'),
71
+ 'index' => 'name'
72
+ )
73
+ );
74
+
75
+ $this->addColumn('hostname',
76
+ array(
77
+ 'header' => $this->__('Hostname'),
78
+ 'index' => 'hostname'
79
+ )
80
+ );
81
+
82
+ return parent::_prepareColumns();
83
+ }
84
+
85
+ /**
86
+ * Get URL for a specific row
87
+ *
88
+ * Return the "edit" form url for each row.
89
+ *
90
+ * @return string
91
+ */
92
+ public function getRowUrl($row)
93
+ {
94
+ return $this->getUrl('*/*/edit', array('id' => $row->getId()));
95
+ }
96
+ }
app/code/community/Forkel/Bars/Changelog.txt ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Forkel Bars
3
+ *
4
+ * @category Forkel
5
+ * @package Forkel_Bars
6
+ * @copyright Copyright (c) 2015 Tobias Forkel (http://www.tobiasforkel.de)
7
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
8
+ */
9
+
10
+ ===== 1.0.0 =====
11
+
12
+ * Initial version of this module
app/code/community/Forkel/Bars/Helper/Data.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Forkel Bars
4
+ *
5
+ * @category Forkel
6
+ * @package Forkel_Bars
7
+ * @copyright Copyright (c) 2015 Tobias Forkel (http://www.tobiasforkel.de)
8
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
9
+ */
10
+
11
+ class Forkel_Bars_Helper_Data extends Mage_Core_Helper_Abstract
12
+ {
13
+ const MODULE_NAME = 'Forkel_Bars';
14
+ const MODULE_KEY = 'forkel_bars';
15
+
16
+ const MODEL_INDEX = 'forkel_bars/index';
17
+ const MODEL_SERVER = 'forkel_bars/server';
18
+
19
+ /**
20
+ * Return hostname by current url
21
+ *
22
+ * @return array
23
+ */
24
+ public function getHostname()
25
+ {
26
+ $url = Mage::helper('core/url')->getCurrentUrl();
27
+ $url = Mage::getSingleton('core/url')->parseUrl($url);
28
+
29
+ return $url->getHost();
30
+ }
31
+
32
+ /**
33
+ * Change the brightness of the passed color
34
+ *
35
+ * @param string $hex color to be modified
36
+ * @param string $diff amount to change the color
37
+ *
38
+ * @return string
39
+ */
40
+ public function hexColorLighter($hex, $diff)
41
+ {
42
+ $rgb = str_split(trim($hex, '# '), 2);
43
+
44
+ foreach ($rgb as &$hex)
45
+ {
46
+ $dec = hexdec($hex);
47
+ $dec = ($diff >= 0) ? $dec += $diff : $dec -= abs($diff);
48
+ $dec = max(0, min(255, $dec));
49
+ $hex = str_pad(dechex($dec), 2, '0', STR_PAD_LEFT);
50
+ }
51
+
52
+ return '#'.implode($rgb);
53
+ }
54
+ }
app/code/community/Forkel/Bars/Model/Index.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Forkel Bars
4
+ *
5
+ * @category Forkel
6
+ * @package Forkel_Bars
7
+ * @copyright Copyright (c) 2015 Tobias Forkel (http://www.tobiasforkel.de)
8
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
9
+ */
10
+
11
+ class Forkel_Bars_Model_Index extends Mage_Core_Model_Abstract
12
+ {
13
+ protected function _construct()
14
+ {
15
+ $this->_init(Forkel_Bars_Helper_Data::MODEL_INDEX);
16
+ }
17
+
18
+ /**
19
+ * Load collection filtered by hostname and status
20
+ *
21
+ * @return Forkel_Bars_Model_Index
22
+ */
23
+ public function loadByHostname($hostname = '', $status = 1)
24
+ {
25
+ $collection = $this->getCollection();
26
+ $collection->getSelect()->join(array(
27
+ 'server'=> 'forkel_bars_server'),
28
+ 'main_table.server_id = server.id', array(
29
+ 'server_name' => 'server.name'
30
+ )
31
+ );
32
+
33
+ $collection->addFieldToFilter('status', $status);
34
+ $collection->addFieldToFilter('hostname', $hostname);
35
+
36
+ return $collection->getFirstItem();
37
+ }
38
+ }
app/code/community/Forkel/Bars/Model/Resource/Index.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Forkel Bars
4
+ *
5
+ * @category Forkel
6
+ * @package Forkel_Bars
7
+ * @copyright Copyright (c) 2015 Tobias Forkel (http://www.tobiasforkel.de)
8
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
9
+ */
10
+
11
+ class Forkel_Bars_Model_Resource_Index extends Mage_Core_Model_Resource_Db_Abstract
12
+ {
13
+ protected function _construct()
14
+ {
15
+ $this->_init(Forkel_Bars_Helper_Data::MODEL_INDEX, 'id');
16
+ }
17
+ }
app/code/community/Forkel/Bars/Model/Resource/Index/Collection.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Forkel Bars
4
+ *
5
+ * @category Forkel
6
+ * @package Forkel_Bars
7
+ * @copyright Copyright (c) 2015 Tobias Forkel (http://www.tobiasforkel.de)
8
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
9
+ */
10
+
11
+ class Forkel_Bars_Model_Resource_Index_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
12
+ {
13
+ protected function _construct()
14
+ {
15
+ $this->_init(Forkel_Bars_Helper_Data::MODEL_INDEX);
16
+ }
17
+ }
app/code/community/Forkel/Bars/Model/Resource/Server.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Forkel Bars
4
+ *
5
+ * @category Forkel
6
+ * @package Forkel_Bars
7
+ * @copyright Copyright (c) 2015 Tobias Forkel (http://www.tobiasforkel.de)
8
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
9
+ */
10
+
11
+ class Forkel_Bars_Model_Resource_Server extends Mage_Core_Model_Resource_Db_Abstract
12
+ {
13
+ protected function _construct()
14
+ {
15
+ $this->_init(Forkel_Bars_Helper_Data::MODEL_SERVER, 'id');
16
+ }
17
+ }
app/code/community/Forkel/Bars/Model/Resource/Server/Collection.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Forkel Bars
4
+ *
5
+ * @category Forkel
6
+ * @package Forkel_Bars
7
+ * @copyright Copyright (c) 2015 Tobias Forkel (http://www.tobiasforkel.de)
8
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
9
+ */
10
+
11
+ class Forkel_Bars_Model_Resource_Server_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
12
+ {
13
+ protected function _construct()
14
+ {
15
+ $this->_init(Forkel_Bars_Helper_Data::MODEL_SERVER);
16
+ }
17
+ }
app/code/community/Forkel/Bars/Model/Server.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Forkel Bars
4
+ *
5
+ * @category Forkel
6
+ * @package Forkel_Bars
7
+ * @copyright Copyright (c) 2015 Tobias Forkel (http://www.tobiasforkel.de)
8
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
9
+ */
10
+
11
+ class Forkel_Bars_Model_Server extends Mage_Core_Model_Abstract
12
+ {
13
+ protected function _construct()
14
+ {
15
+ $this->_init(Forkel_Bars_Helper_Data::MODEL_SERVER);
16
+ }
17
+
18
+ /**
19
+ * Return all collection as an option array
20
+ *
21
+ * @return array
22
+ */
23
+ public function getOptionArray()
24
+ {
25
+ $collection = $this->getCollection();
26
+
27
+ $options = array();
28
+
29
+ foreach ($collection as $index => $value)
30
+ {
31
+ $options[$index] = $value->getName();
32
+ }
33
+
34
+ return $options;
35
+ }
36
+ }
app/code/community/Forkel/Bars/controllers/Adminhtml/Forkel/Bars/IndexController.php ADDED
@@ -0,0 +1,163 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Forkel Bars
4
+ *
5
+ * @category Forkel
6
+ * @package Forkel_Bars
7
+ * @copyright Copyright (c) 2015 Tobias Forkel (http://www.tobiasforkel.de)
8
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
9
+ */
10
+
11
+ class Forkel_Bars_Adminhtml_Forkel_Bars_IndexController extends Mage_Adminhtml_Controller_Action
12
+ {
13
+ /**
14
+ * Initialize action
15
+ *
16
+ * @return Mage_Adminhtml_Controller_Action
17
+ */
18
+ protected function _initAction()
19
+ {
20
+ $this->loadLayout()->_setActiveMenu('system/forkel_bars/index');
21
+ return $this;
22
+ }
23
+
24
+ /**
25
+ * Index action
26
+ *
27
+ * @return void
28
+ */
29
+ public function indexAction()
30
+ {
31
+ $this->_title($this->__('Forkel Bars'))->_title($this->__('Index'));
32
+ $this->_initAction()->renderLayout();
33
+ }
34
+
35
+ /**
36
+ * Edit action
37
+ *
38
+ * Load data to the edit form
39
+ *
40
+ * @return void
41
+ */
42
+ public function editAction()
43
+ {
44
+ $id = $this->getRequest()->getParam('id');
45
+ $model = Mage::getSingleton(Forkel_Bars_Helper_Data::MODEL_INDEX);
46
+
47
+ if ($id)
48
+ {
49
+ $model->load($id);
50
+
51
+ if (!$model->getId())
52
+ {
53
+ Mage::getSingleton('adminhtml/session')->addError($this->__('The requested record was not found.'));
54
+ $this->_redirect('*/*/');
55
+
56
+ return;
57
+ }
58
+ }
59
+
60
+ $this->_title($model->getId() ? $model->getName() : $this->__('New Record'));
61
+
62
+ Mage::register(Forkel_Bars_Helper_Data::MODULE_KEY, $model);
63
+
64
+ $this->_initAction()
65
+ ->_addContent($this->getLayout()->createBlock('forkel_bars/adminhtml_index_edit')->setData('action', $this->getUrl('*/*/save')))
66
+ ->renderLayout();
67
+ }
68
+
69
+ /**
70
+ * Save action
71
+ *
72
+ * Save or update model.
73
+ *
74
+ * @return void
75
+ */
76
+ public function saveAction()
77
+ {
78
+ if ($postData = $this->getRequest()->getPost())
79
+ {
80
+ try
81
+ {
82
+ $model = Mage::getSingleton(Forkel_Bars_Helper_Data::MODEL_INDEX);
83
+
84
+ $model->setData($postData);
85
+ $model->save();
86
+
87
+ Mage::getSingleton('adminhtml/session')->addSuccess($this->__('The record ( %s ) has been saved.', $model->getName()));
88
+ $this->_redirect('*/*/');
89
+
90
+ return;
91
+ }
92
+
93
+ catch (Mage_Core_Exception $e) {
94
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
95
+ }
96
+
97
+ catch (Exception $e) {
98
+ Mage::getSingleton('adminhtml/session')->addError($this->__('An error occurred while saving this record.'));
99
+ }
100
+ }
101
+ }
102
+
103
+ /**
104
+ * Delete action
105
+ *
106
+ * Delete one item.
107
+ *
108
+ * @return void
109
+ */
110
+ public function deleteAction()
111
+ {
112
+ $id = $this->getRequest()->getParam('id');
113
+
114
+ if (!filter_var($id, FILTER_VALIDATE_INT))
115
+ {
116
+ Mage::getSingleton('adminhtml/session')->addError($this->__('Please select one record.'));
117
+ }
118
+ else
119
+ {
120
+ try
121
+ {
122
+ $model = Mage::getSingleton(Forkel_Bars_Helper_Data::MODEL_INDEX);
123
+ $model->load($id)->delete();
124
+
125
+ Mage::getSingleton('adminhtml/session')->addSuccess($this->__('The selected record was successfully deleted.'));
126
+ }
127
+
128
+ catch (Mage_Core_Exception $e)
129
+ {
130
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
131
+ }
132
+
133
+ catch (Exception $e)
134
+ {
135
+ Mage::getSingleton('adminhtml/session')->addError($this->__('An error occurred while deletion.'));
136
+ }
137
+ }
138
+
139
+ $this->_redirect('*/*/index');
140
+ }
141
+
142
+ /**
143
+ * Check the permissions for current backend user
144
+ *
145
+ * @return bool
146
+ */
147
+ protected function _isAllowed()
148
+ {
149
+ return Mage::getSingleton('admin/session')->isAllowed('system/forkel_bars');
150
+ }
151
+
152
+ /**
153
+ * New action
154
+ *
155
+ * Redirect to action "edit"
156
+ *
157
+ * @return void
158
+ */
159
+ public function newAction()
160
+ {
161
+ $this->_forward('edit');
162
+ }
163
+ }
app/code/community/Forkel/Bars/controllers/Adminhtml/Forkel/Bars/ServerController.php ADDED
@@ -0,0 +1,163 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Forkel Bars
4
+ *
5
+ * @category Forkel
6
+ * @package Forkel_Bars
7
+ * @copyright Copyright (c) 2015 Tobias Forkel (http://www.tobiasforkel.de)
8
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
9
+ */
10
+
11
+ class Forkel_Bars_Adminhtml_Forkel_Bars_ServerController extends Mage_Adminhtml_Controller_Action
12
+ {
13
+ /**
14
+ * Initialize action
15
+ *
16
+ * @return Mage_Adminhtml_Controller_Action
17
+ */
18
+ protected function _initAction()
19
+ {
20
+ $this->loadLayout()->_setActiveMenu('system/forkel_bars/server');
21
+ return $this;
22
+ }
23
+
24
+ /**
25
+ * Index action
26
+ *
27
+ * @return void
28
+ */
29
+ public function indexAction()
30
+ {
31
+ $this->_title($this->__('Forkel Bars'))->_title($this->__('Server'));
32
+ $this->_initAction()->renderLayout();
33
+ }
34
+
35
+ /**
36
+ * Edit action
37
+ *
38
+ * Load data to the edit form
39
+ *
40
+ * @return void
41
+ */
42
+ public function editAction()
43
+ {
44
+ $id = $this->getRequest()->getParam('id');
45
+ $model = Mage::getSingleton(Forkel_Bars_Helper_Data::MODEL_SERVER);
46
+
47
+ if ($id)
48
+ {
49
+ $model->load($id);
50
+
51
+ if (!$model->getId())
52
+ {
53
+ Mage::getSingleton('adminhtml/session')->addError($this->__('The requested record was not found.'));
54
+ $this->_redirect('*/*/');
55
+
56
+ return;
57
+ }
58
+ }
59
+
60
+ $this->_title($model->getId() ? $model->getName() : $this->__('New Record'));
61
+
62
+ Mage::register(Forkel_Bars_Helper_Data::MODULE_KEY, $model);
63
+
64
+ $this->_initAction()
65
+ ->_addContent($this->getLayout()->createBlock('forkel_bars/adminhtml_server_edit')->setData('action', $this->getUrl('*/*/save')))
66
+ ->renderLayout();
67
+ }
68
+
69
+ /**
70
+ * Save action
71
+ *
72
+ * Save or update model.
73
+ *
74
+ * @return void
75
+ */
76
+ public function saveAction()
77
+ {
78
+ if ($postData = $this->getRequest()->getPost())
79
+ {
80
+ try
81
+ {
82
+ $model = Mage::getSingleton(Forkel_Bars_Helper_Data::MODEL_SERVER);
83
+
84
+ $model->setData($postData);
85
+ $model->save();
86
+
87
+ Mage::getSingleton('adminhtml/session')->addSuccess($this->__('The record ( %s ) has been saved.', $model->getName()));
88
+ $this->_redirect('*/*/');
89
+
90
+ return;
91
+ }
92
+
93
+ catch (Mage_Core_Exception $e) {
94
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
95
+ }
96
+
97
+ catch (Exception $e) {
98
+ Mage::getSingleton('adminhtml/session')->addError($this->__('An error occurred while saving this record.'));
99
+ }
100
+ }
101
+ }
102
+
103
+ /**
104
+ * Delete action
105
+ *
106
+ * Delete one item.
107
+ *
108
+ * @return void
109
+ */
110
+ public function deleteAction()
111
+ {
112
+ $id = $this->getRequest()->getParam('id');
113
+
114
+ if (!filter_var($id, FILTER_VALIDATE_INT))
115
+ {
116
+ Mage::getSingleton('adminhtml/session')->addError($this->__('Please select one record.'));
117
+ }
118
+ else
119
+ {
120
+ try
121
+ {
122
+ $model = Mage::getSingleton(Forkel_Bars_Helper_Data::MODEL_SERVER);
123
+ $model->load($id)->delete();
124
+
125
+ Mage::getSingleton('adminhtml/session')->addSuccess($this->__('The selected record was successfully deleted.'));
126
+ }
127
+
128
+ catch (Mage_Core_Exception $e)
129
+ {
130
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
131
+ }
132
+
133
+ catch (Exception $e)
134
+ {
135
+ Mage::getSingleton('adminhtml/session')->addError($this->__('An error occurred while deletion.'));
136
+ }
137
+ }
138
+
139
+ $this->_redirect('*/*/index');
140
+ }
141
+
142
+ /**
143
+ * Check the permissions for current backend user
144
+ *
145
+ * @return bool
146
+ */
147
+ protected function _isAllowed()
148
+ {
149
+ return Mage::getSingleton('admin/session')->isAllowed('system/forkel_bars/server');
150
+ }
151
+
152
+ /**
153
+ * New action
154
+ *
155
+ * Redirect to action "edit"
156
+ *
157
+ * @return void
158
+ */
159
+ public function newAction()
160
+ {
161
+ $this->_forward('edit');
162
+ }
163
+ }
app/code/community/Forkel/Bars/data/forkel_bars_setup/data-install-1.0.0.php ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Forkel Bars
4
+ *
5
+ * @category Forkel
6
+ * @package Forkel_Bars
7
+ * @copyright Copyright (c) 2015 Tobias Forkel (http://www.tobiasforkel.de)
8
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
9
+ */
10
+
11
+ $model = Mage::getModel(Forkel_Bars_Helper_Data::MODEL_INDEX);
12
+
13
+ if ($model->getCollection()->count() == 0)
14
+ {
15
+
16
+ $values = array(
17
+ array(
18
+ 'name' => 'Noooope!',
19
+ 'description' => 'Your boss will fire you right away.',
20
+ 'color' => '#a94442',
21
+ 'color_background' => '#f2dede',
22
+ 'server_id' => 4,
23
+ 'status' => 1
24
+ ),
25
+ array(
26
+ 'name' => 'Please!',
27
+ 'description' => 'This environment is tested and ready for deployment.',
28
+ 'color' => '#715630',
29
+ 'color_background' => '#f5ce96',
30
+ 'server_id' => 3,
31
+ 'status' => 1
32
+ ),
33
+ array(
34
+ 'name' => 'Well ...',
35
+ 'description' => 'Ask your team and project manager before do any changes.',
36
+ 'color' => '#31708f',
37
+ 'color_background' => '#d9edf7',
38
+ 'server_id' => 2,
39
+ 'status' => 1
40
+ ),
41
+ array(
42
+ 'name' => 'Good!',
43
+ 'description' => ' You can do whatever you want.',
44
+ 'color' => '#3c763d',
45
+ 'color_background' => '#dff0d8',
46
+ 'server_id' => 1,
47
+ 'status' => 1
48
+ )
49
+ );
50
+
51
+ foreach($values as $value)
52
+ {
53
+ $model->setData($value)->save();
54
+ }
55
+ }
56
+
57
+ $model = Mage::getModel(Forkel_Bars_Helper_Data::MODEL_SERVER);
58
+
59
+ if ($model->getCollection()->count() == 0)
60
+ {
61
+
62
+ $values = array(
63
+ array(
64
+ 'name' => 'Local Environment',
65
+ 'description' => 'Dictum viverra suspendisse hendrerit quam pellentesque pharetra, elementum sit urna, morbi scelerisque.',
66
+ 'hostname' => 'local.server.com'
67
+ ),
68
+ array(
69
+ 'name' => 'Staging Environment',
70
+ 'description' => 'Diharetra, elementum sit urna, morbi scelerisque.',
71
+ 'hostname' => 'staging.server.com'
72
+ ),
73
+ array(
74
+ 'name' => 'Preview Environment',
75
+ 'description' => 'Sed ut, amet nam, cras in arcu. Mollis aenean pede tortor fusce mattis rutrum, non sollicitudin.',
76
+ 'hostname' => 'preview.server.com'
77
+ ),
78
+ array(
79
+ 'name' => 'Production Environment',
80
+ 'description' => 'Mollis aenean pede tortor fusce mattis rutrum, non sollicitudin.',
81
+ 'hostname' => 'www.server.com'
82
+ ),
83
+ );
84
+
85
+ foreach($values as $value)
86
+ {
87
+ $model->setData($value)->save();
88
+ }
89
+ }
app/code/community/Forkel/Bars/etc/adminhtml.xml ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Forkel Bars
5
+ *
6
+ * @category Forkel
7
+ * @package Forkel_Bars
8
+ * @copyright Copyright (c) 2015 Tobias Forkel (http://www.tobiasforkel.de)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+ -->
12
+
13
+ <config>
14
+ <acl>
15
+ <resources>
16
+ <admin>
17
+ <children>
18
+ <system>
19
+ <children>
20
+ <forkel_bars translate="title" module="forkel_bars">
21
+ <title>Bar</title>
22
+ <sort_order>500</sort_order>
23
+ <children>
24
+ <server translate="title">
25
+ <title>Server</title>
26
+ <sort_order>10</sort_order>
27
+ </server>
28
+ </children>
29
+ </forkel_bars>
30
+ </children>
31
+ </system>
32
+ </children>
33
+ </admin>
34
+ </resources>
35
+ </acl>
36
+ <menu>
37
+ <system>
38
+ <children>
39
+ <forkel_bars translate="title">
40
+ <title>Bars</title>
41
+ <sort_order>500</sort_order>
42
+ <action>adminhtml/forkel_bars_index/index</action>
43
+ <children>
44
+ <server translate="title">
45
+ <title>Server</title>
46
+ <sort_order>10</sort_order>
47
+ <action>adminhtml/forkel_bars_server/index</action>
48
+ </server>
49
+ </children>
50
+ </forkel_bars>
51
+ </children>
52
+ </system>
53
+ </menu>
54
+ </config>
app/code/community/Forkel/Bars/etc/config.xml ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Forkel Bars
5
+ *
6
+ * @category Forkel
7
+ * @package Forkel_Bars
8
+ * @copyright Copyright (c) 2015 Tobias Forkel (http://www.tobiasforkel.de)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+ -->
12
+
13
+ <config>
14
+ <modules>
15
+ <Forkel_Bars>
16
+ <version>1.0.0</version>
17
+ </Forkel_Bars>
18
+ </modules>
19
+ <global>
20
+ <blocks>
21
+ <forkel_bars>
22
+ <class>Forkel_Bars_Block</class>
23
+ </forkel_bars>
24
+ </blocks>
25
+ <helpers>
26
+ <forkel_bars>
27
+ <class>Forkel_Bars_Helper</class>
28
+ </forkel_bars>
29
+ </helpers>
30
+ <models>
31
+ <forkel_bars>
32
+ <class>Forkel_Bars_Model</class>
33
+ <resourceModel>forkel_bars_resource</resourceModel>
34
+ </forkel_bars>
35
+ <forkel_bars_resource>
36
+ <class>Forkel_Bars_Model_Resource</class>
37
+ <entities>
38
+ <index>
39
+ <table>forkel_bars_index</table>
40
+ </index>
41
+ <server>
42
+ <table>forkel_bars_server</table>
43
+ </server>
44
+ </entities>
45
+ </forkel_bars_resource>
46
+ </models>
47
+ <resources>
48
+ <forkel_bars_setup>
49
+ <setup>
50
+ <module>Forkel_Bars</module>
51
+ </setup>
52
+ </forkel_bars_setup>
53
+ </resources>
54
+ </global>
55
+ <admin>
56
+ <routers>
57
+ <adminhtml>
58
+ <args>
59
+ <modules>
60
+ <Forkel_Bars after="Mage_Adminhtml">Forkel_Bars_Adminhtml</Forkel_Bars>
61
+ </modules>
62
+ </args>
63
+ </adminhtml>
64
+ </routers>
65
+ </admin>
66
+ <adminhtml>
67
+ <layout>
68
+ <updates>
69
+ <forkel_bars>
70
+ <file>forkel/bars.xml</file>
71
+ </forkel_bars>
72
+ </updates>
73
+ </layout>
74
+ <translate>
75
+ <modules>
76
+ <forkel_maintenancealert>
77
+ <files>
78
+ <default>Forkel_Bars.csv</default>
79
+ </files>
80
+ </forkel_maintenancealert>
81
+ </modules>
82
+ </translate>
83
+ </adminhtml>
84
+ </config>
app/code/community/Forkel/Bars/sql/forkel_bars_setup/install-1.0.0.php ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /* @var $installer Mage_Core_Model_Resource_Setup */
4
+ $installer = $this;
5
+ $installer->startSetup();
6
+
7
+ /**
8
+ * Create table 'forkel_bars_index'
9
+ */
10
+ $table = $installer->getTable('forkel_bars/index');
11
+ if ($installer->getConnection()->isTableExists($table) != true)
12
+ {
13
+ $table = $installer->getConnection()
14
+ ->newTable($table)
15
+ ->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
16
+ 'identity' => true,
17
+ 'unsigned' => true,
18
+ 'nullable' => false,
19
+ 'primary' => true,
20
+ ), 'Forkel Bars - ID')
21
+ ->addColumn('name', Varien_Db_Ddl_Table::TYPE_TEXT, 128, array(
22
+ 'nullable' => false,
23
+ ), 'Name')
24
+ ->addColumn('description', Varien_Db_Ddl_Table::TYPE_TEXT, 512, array(
25
+ 'nullable' => false,
26
+ ), 'Description)')
27
+ ->addColumn('color', Varien_Db_Ddl_Table::TYPE_TEXT, 7, array(
28
+ 'nullable' => false,
29
+ ), 'Color')
30
+ ->addColumn('color_background', Varien_Db_Ddl_Table::TYPE_TEXT, 7, array(
31
+ 'nullable' => false,
32
+ ), 'Background Color')
33
+ ->addColumn('status', Varien_Db_Ddl_Table::TYPE_TINYINT, 1, array(
34
+ 'nullable' => false,
35
+ 'default' => 0,
36
+ ), 'Status')
37
+ ->addColumn('server_id', Varien_Db_Ddl_Table::TYPE_SMALLINT, null, array(
38
+ 'unsigned' => true,
39
+ 'nullable' => false,
40
+ ), 'Server ID')
41
+ ->setComment('Forkel Bars - Index');
42
+ $installer->getConnection()->createTable($table);
43
+ }
44
+
45
+ /**
46
+ * Create table 'forkel_bars_server'
47
+ */
48
+ $table = $installer->getTable('forkel_bars/server');
49
+ if ($installer->getConnection()->isTableExists($table) != true)
50
+ {
51
+ $table = $installer->getConnection()
52
+ ->newTable($table)
53
+ ->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
54
+ 'identity' => true,
55
+ 'unsigned' => true,
56
+ 'nullable' => false,
57
+ 'primary' => true,
58
+ ), 'Forkel Bars - ID')
59
+ ->addColumn('name', Varien_Db_Ddl_Table::TYPE_TEXT, 128, array(
60
+ 'nullable' => false,
61
+ ), 'Name')
62
+ ->addColumn('hostname', Varien_Db_Ddl_Table::TYPE_TEXT, 256, array(
63
+ 'nullable' => false,
64
+ ), 'Hostname)')
65
+ ->setComment('Forkel Bars - Server');
66
+ $installer->getConnection()->createTable($table);
67
+ }
app/design/adminhtml/default/default/layout/forkel/bars.xml ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout>
3
+ <default>
4
+ <reference name="head">
5
+ <action method="addJs"><script>community/forkel_bars/main.js"></script></action>
6
+ </reference>
7
+ <reference name="notifications">
8
+ <block type="forkel_bars/adminhtml_notification" before="notification_window" name="forkel_bars_adminhtml_notification" template="forkel/bars/adminhtml/notification.phtml" />
9
+ </reference>
10
+ </default>
11
+ <adminhtml_forkel_bars_index_index>
12
+ <reference name="content">
13
+ <block type="forkel_bars/adminhtml_index" name="forkel_bars_index"/>
14
+ </reference>
15
+ </adminhtml_forkel_bars_index_index>
16
+ <adminhtml_forkel_bars_server_index>
17
+ <reference name="content">
18
+ <block type="forkel_bars/adminhtml_server" name="forkel_bars_server"/>
19
+ </reference>
20
+ </adminhtml_forkel_bars_server_index>
21
+ </layout>
app/design/adminhtml/default/default/template/forkel/bars/adminhtml/notification.phtml ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $notification = $this->getNotification(); ?>
2
+
3
+ <?php if ($notification->getId()): ?>
4
+
5
+ <style>
6
+ #forkel_bars_adminhtml_notification {
7
+ color: <?php echo $notification->getColor() ?>;
8
+ overflow: hidden;
9
+ font-size: 1.2em;
10
+ text-align: left;
11
+ padding: 1em 1.5em;
12
+ background: repeating-linear-gradient(
13
+ 45deg,
14
+ <?php echo $this->getBackgroundLighter($notification->getColorBackground(), '20') ?>,
15
+ <?php echo $this->getBackgroundLighter($notification->getColorBackground(), '20') ?> 10px,
16
+ <?php echo $notification->getColorBackground() ?> 10px,
17
+ <?php echo $notification->getColorBackground() ?> 20px
18
+ );
19
+ }
20
+ </style>
21
+
22
+ <div id="forkel_bars_adminhtml_notification">
23
+ <?php echo $notification->getServerName(); ?>:
24
+ <?php echo $notification->getName(); ?>
25
+ <?php echo $notification->getDescription(); ?>
26
+ </div>
27
+
28
+ <?php endif; ?>
app/etc/modules/Forkel_Bars.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Forkel_Bars>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Forkel_Bars>
8
+ </modules>
9
+ </config>
js/community/forkel_bars/main.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ document.observe('dom:loaded', function() {
2
+ $$('.header').first().insert({ before: $$('#forkel_bars_adminhtml_notification').first() });
3
+ });
package.xml ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>forkel_bars</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="https://opensource.org/licenses/OSL-3.0">Open Software License v. 3.0 (OSL-3.0)</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Add a customizable notification bar. It allows you to leave a message for all Admin users on multiple server.</summary>
10
+ <description>&lt;h3&gt;Overview&lt;/h3&gt;&#xD;
11
+ &lt;p&gt;Add a customizable notification bar. It allows you to leave a message for all Admin users on multiple server. No excuse for excitedly changed settings in the Magento admin panel. This module will let all participants know on what environment they are working.&lt;/p&gt;&#xD;
12
+ &#xD;
13
+ &lt;img src="//www.tobiasforkel.de/public/magento/forkel_bars/version/1.0/screenshots/backend/backend_bar_variants.gif" /&gt;&#xD;
14
+ &lt;br /&gt;&#xD;
15
+ &lt;br /&gt;&#xD;
16
+ &#xD;
17
+ &lt;img src="//www.tobiasforkel.de/public/magento/forkel_bars/version/1.0/screenshots/backend/backend_bar_list_overview.gif" /&gt;&#xD;
18
+ &lt;br /&gt;&#xD;
19
+ &lt;br /&gt;&#xD;
20
+ &#xD;
21
+ &lt;h3&gt;Features&lt;/h3&gt;&#xD;
22
+ &lt;p&gt;&#xD;
23
+ &lt;b&gt;1. Bars&lt;/b&gt;&lt;br /&gt;&#xD;
24
+ - Predefined notification bars available right after installation&lt;br /&gt;&#xD;
25
+ - Easily configurable in &lt;i&gt;System &amp;gt; Bars&lt;/i&gt;&lt;br /&gt;&#xD;
26
+ - Edit properties such as &lt;i&gt;Name&lt;/i&gt;, &lt;i&gt;Description&lt;/i&gt;, &lt;i&gt;Status&lt;/i&gt;&lt;br /&gt;&#xD;
27
+ - Edit styling&#xD;
28
+ &lt;/p&gt;&#xD;
29
+ &#xD;
30
+ &lt;img src="//www.tobiasforkel.de/public/magento/forkel_bars/version/1.0/screenshots/backend/backend_bar_edit_overview.gif" /&gt;&#xD;
31
+ &lt;br /&gt;&#xD;
32
+ &lt;br /&gt;&#xD;
33
+ &#xD;
34
+ &lt;p&gt;&#xD;
35
+ &lt;b&gt;2. Server&lt;/b&gt;&lt;br /&gt;&#xD;
36
+ - Predefined server available right after installation&lt;br /&gt;&#xD;
37
+ - Add, edit or delete server&#xD;
38
+ &lt;/p&gt;&#xD;
39
+ &#xD;
40
+ &lt;img src="//www.tobiasforkel.de/public/magento/forkel_bars/version/1.0/screenshots/backend/backend_server_list_overview.gif" /&gt;&#xD;
41
+ &lt;br /&gt;&#xD;
42
+ &lt;br /&gt;&#xD;
43
+ &#xD;
44
+ &lt;p&gt;&#xD;
45
+ &lt;b&gt;3. Template&lt;/b&gt;&lt;br /&gt;&#xD;
46
+ - Customizable in &lt;i&gt;design/adminhtml/default/default/template/forkel/bars/adminhtml/notification.phtml&lt;/i&gt;&#xD;
47
+ &lt;/p&gt;&#xD;
48
+ &#xD;
49
+ &lt;h3&gt;Usage&lt;/h3&gt;&#xD;
50
+ &lt;p&gt;The functionality can be used in the backend section &lt;i&gt;System &amp;gt; Bars&lt;/i&gt;.&lt;/p&gt;&#xD;
51
+ &#xD;
52
+ &lt;h3&gt;Online Guides&lt;/h3&gt;&#xD;
53
+ &lt;p&gt;- In Progress&lt;/p&gt;&#xD;
54
+ &#xD;
55
+ &lt;h3&gt;Warranty&lt;/h3&gt;&#xD;
56
+ &lt;p&gt;This module is provided as-is with no warranty or support. Purchase a Warranty and Support Package on &lt;a href="http://www.tobiasforkel.de"&gt;http://www.tobiasforkel.de&lt;/a&gt; starting from $50.&lt;/p&gt;&#xD;
57
+ &#xD;
58
+ &lt;h3&gt;Updates&lt;/h3&gt;&#xD;
59
+ &lt;p&gt;If you have any issues with this extension, open an issue on &lt;a href="https://github.com/tobias-forkel/Forkel_Bars/issues"&gt;Github&lt;/a&gt;. All &lt;strong&gt;micro&lt;/strong&gt;, &lt;strong&gt;major&lt;/strong&gt; and &lt;strong&gt;minor&lt;/strong&gt; updates are available for free on Magento Connect.&#xD;
60
+ &lt;/p&gt;&#xD;
61
+ &#xD;
62
+ &lt;h3&gt;Support&lt;/h3&gt;&#xD;
63
+ &lt;p&gt;This module is provided as-is with no warranty or support. Purchase a Warranty and Support Package on &lt;a href="http://www.tobiasforkel.de"&gt;http://www.tobiasforkel.de&lt;/a&gt; starting from $50.&lt;/p&gt;</description>
64
+ <notes>===== 1.0.0 =====&#xD;
65
+ * Initial version of this module</notes>
66
+ <authors><author><name>Tobias Forkel</name><user>tforkel</user><email>magento@tobiasforkel.de</email></author></authors>
67
+ <date>2015-12-09</date>
68
+ <time>20:55:44</time>
69
+ <contents><target name="magecommunity"><dir name="Forkel"><dir name="Bars"><dir name="Block"><dir name="Adminhtml"><dir name="Index"><dir name="Edit"><file name="Form.php" hash="1b86ba9f110e560373d2cc33723a7eb7"/></dir><file name="Edit.php" hash="0103c7c1c3459fce8605ed20abbd6e78"/><file name="Grid.php" hash="5a2dbf65cda4161d3b4d077302ec2e9f"/></dir><file name="Index.php" hash="525509035f5c44c2d8adc0967a052415"/><file name="Notification.php" hash="da66304399e22f2bf203682f51bb1c01"/><dir name="Server"><dir name="Edit"><file name="Form.php" hash="a8ff7f4a34ce5102188317b863bdeda6"/></dir><file name="Edit.php" hash="27810453296f514b1f381dbb1841ce43"/><file name="Grid.php" hash="8a70811620d424cfe3a4c162024a1d13"/></dir><file name="Server.php" hash="c993f4e4212e3b3ca3513ebb501def4a"/></dir></dir><file name="Changelog.txt" hash="8a221ad06ab6f1fc7d5b55d7dec0db89"/><dir name="controllers"><dir name="Adminhtml"><dir name="Forkel"><dir name="Bars"><file name="IndexController.php" hash="70d0294b4feff567a79c387bad277aae"/><file name="ServerController.php" hash="1da8c0ef1465fdad96aaed34a74818ee"/></dir></dir></dir></dir><dir name="data"><dir name="forkel_bars_setup"><file name="data-install-1.0.0.php" hash="8f874c404b7f7a0883d9246b14cf81c0"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="8731d3ad2f9ebc933f327f73d4332922"/><file name="config.xml" hash="cc8a74b4774cfe28a6a5cde69e803de7"/></dir><dir name="Helper"><file name="Data.php" hash="3db6cae062e3ea960b0095ce25608202"/></dir><dir name="Model"><file name="Index.php" hash="51d5e63b8a6861fc7c840a3313dde979"/><dir name="Resource"><dir name="Index"><file name="Collection.php" hash="1c9b8c4157f07777058eea128c683426"/></dir><file name="Index.php" hash="16f51afe18dba2f4bf1146ae1bf2a73a"/><dir name="Server"><file name="Collection.php" hash="da06239337f1b586285df29fd308200e"/></dir><file name="Server.php" hash="11141fe5a4646eda013b85e2e1ec7d07"/></dir><file name="Server.php" hash="1b373759e53211ad488d2b5bf1ba2344"/></dir><dir name="sql"><dir name="forkel_bars_setup"><file name="install-1.0.0.php" hash="733fb4e58306eb6d1e4506a9006546c7"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><dir name="forkel"><file name="bars.xml" hash="906e48ef8ad9dd4cf2bb21f46ca7cf24"/></dir></dir><dir name="template"><dir name="forkel"><dir name="bars"><dir><dir name="adminhtml"><file name="notification.phtml" hash="e2e7540c99badb581da8cf7aa1d44b78"/></dir></dir></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Forkel_Bars.xml" hash="1b36f833bbcf2b4061f775a0a95dbdfe"/></dir></target><target name="mage"><dir name="js"><dir name="community"><dir name="forkel_bars"><file name="main.js" hash="475948c3771853ead0aecca7c229776a"/></dir></dir></dir></target><target name="magelocal"><dir name="de_DE"><file name="Forkel_Bars.csv" hash=""/></dir><dir name="en_US"><file name="Forkel_Bars.csv" hash=""/></dir></target></contents>
70
+ <compatible/>
71
+ <dependencies><required><php><min>5.4.0</min><max>5.6.16</max></php></required></dependencies>
72
+ </package>