Version Notes
Fixes some incompatibility issues with linux servers
Adds drag and drop functionality
Download this release
Release Info
| Developer | Leandro Villagran |
| Extension | Venu_Menu |
| Version | 1.2.0.0 |
| Comparing to | |
| See all releases | |
Code changes from version 1.0.0.0 to 1.2.0.0
- app/code/community/Vstudio/Venu/Block/Adminhtml/Menumanager/Edit/Tab/Form.php +41 -1
- app/code/community/Vstudio/Venu/Block/Adminhtml/Menumanager/Edit/Tab/Form.phpbak +195 -0
- app/code/community/Vstudio/Venu/Model/{MenuItem.php → Menuitem.php} +1 -1
- app/code/community/Vstudio/Venu/Model/Resource/Menuitem.php +1 -2
- app/code/community/Vstudio/Venu/Model/Resource/Menuitem/Collection.php +1 -1
- app/code/community/Vstudio/Venu/Model/Resource/Venu.php +0 -1
- app/code/community/Vstudio/Venu/controllers/Adminhtml/Venu/MenuController.php +19 -0
- app/code/community/Vstudio/Venu/data/vstudio_venu_setup/data-upgrade-1.0.0.0-1.2.0.0.php +1 -0
- app/code/community/Vstudio/Venu/etc/config.xml +1 -1
- app/code/community/Vstudio/Venu/sql/vstudio_venu_setup/upgrade-1.0.0.0-1.2.0.0.php +1 -0
- app/design/adminhtml/default/default/layout/venu.xml +3 -0
- app/design/adminhtml/default/default/template/vstudio/venu/edit/tab/form.phtml +327 -0
- app/design/frontend/default/default/layout/venu.xml +18 -17
- package.xml +10 -29
- skin/adminhtml/default/default/vstudio/venu/venu.css +71 -0
app/code/community/Vstudio/Venu/Block/Adminhtml/Menumanager/Edit/Tab/Form.php
CHANGED
|
@@ -2,6 +2,12 @@
|
|
| 2 |
|
| 3 |
class Vstudio_Venu_Block_Adminhtml_MenuManager_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form {
|
| 4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
protected function _prepareForm() {
|
| 6 |
$form = new Varien_Data_Form();
|
| 7 |
$this->setForm($form);
|
|
@@ -174,7 +180,41 @@ class Vstudio_Venu_Block_Adminhtml_MenuManager_Edit_Tab_Form extends Mage_Adminh
|
|
| 174 |
return parent::_prepareForm();
|
| 175 |
}
|
| 176 |
|
| 177 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 178 |
* Sort a multidimensional array by reference
|
| 179 |
*
|
| 180 |
* @param $data array
|
| 2 |
|
| 3 |
class Vstudio_Venu_Block_Adminhtml_MenuManager_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form {
|
| 4 |
|
| 5 |
+
public function __construct()
|
| 6 |
+
{
|
| 7 |
+
parent::__construct();
|
| 8 |
+
$this->setTemplate('vstudio/venu/edit/tab/form.phtml');
|
| 9 |
+
}
|
| 10 |
+
|
| 11 |
protected function _prepareForm() {
|
| 12 |
$form = new Varien_Data_Form();
|
| 13 |
$this->setForm($form);
|
| 180 |
return parent::_prepareForm();
|
| 181 |
}
|
| 182 |
|
| 183 |
+
|
| 184 |
+
protected function _getVenuData(){
|
| 185 |
+
|
| 186 |
+
$formData = NULL;
|
| 187 |
+
|
| 188 |
+
/** set form data **/
|
| 189 |
+
if (Mage::getSingleton('adminhtml/session')->getVenuData()) {
|
| 190 |
+
$formData = Mage::getSingleton('adminhtml/session')->getVenuData();
|
| 191 |
+
Mage::getSingleton('adminhtml/session')->setVenuData(null);
|
| 192 |
+
} elseif (Mage::registry('venu_data')) {
|
| 193 |
+
|
| 194 |
+
|
| 195 |
+
$formData = Mage::registry('venu_data')->getData();
|
| 196 |
+
// decode menu options and add it to the right field
|
| 197 |
+
if ( ! empty($formData['menu_options'])) {
|
| 198 |
+
$options = json_decode($formData['menu_options']);
|
| 199 |
+
foreach ($options as $option => $value) {
|
| 200 |
+
$formData[$option] = $value;
|
| 201 |
+
}
|
| 202 |
+
unset($formData['menu_options']);
|
| 203 |
+
}
|
| 204 |
+
|
| 205 |
+
$menuItems = Mage::registry('venu_data')->getData('menu_items');
|
| 206 |
+
if (!empty($menuItems)) {
|
| 207 |
+
$this->_sortFields($menuItems, SORT_ASC, 'sort_order');
|
| 208 |
+
$formData['menu_items'] = $menuItems;
|
| 209 |
+
}
|
| 210 |
+
|
| 211 |
+
}
|
| 212 |
+
|
| 213 |
+
return $formData;
|
| 214 |
+
}
|
| 215 |
+
|
| 216 |
+
|
| 217 |
+
/**
|
| 218 |
* Sort a multidimensional array by reference
|
| 219 |
*
|
| 220 |
* @param $data array
|
app/code/community/Vstudio/Venu/Block/Adminhtml/Menumanager/Edit/Tab/Form.phpbak
ADDED
|
@@ -0,0 +1,195 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class Vstudio_Venu_Block_Adminhtml_MenuManager_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form {
|
| 4 |
+
|
| 5 |
+
protected function _prepareForm() {
|
| 6 |
+
$form = new Varien_Data_Form();
|
| 7 |
+
$this->setForm($form);
|
| 8 |
+
$fieldset = $form->addFieldset('menu_edit_form', array('legend' => Mage::helper('vstudio_venu')->__('Menu information')));
|
| 9 |
+
$options = Mage::getSingleton('vstudio_venu/options');
|
| 10 |
+
|
| 11 |
+
$fieldset->addField('menu_title', 'text', array(
|
| 12 |
+
'label' => Mage::helper('vstudio_venu')->__('Menu Title'),
|
| 13 |
+
'class' => 'required-entry',
|
| 14 |
+
'required' => true,
|
| 15 |
+
'name' => 'menu_title',
|
| 16 |
+
));
|
| 17 |
+
|
| 18 |
+
$fieldset->addField('menu_orientation', 'select', array(
|
| 19 |
+
'label' => Mage::helper('vstudio_venu')->__('Menu Orientation'),
|
| 20 |
+
'name' => "menu_options[menu_orientation]",
|
| 21 |
+
'values' => $options->getOptionOrientation(),
|
| 22 |
+
));
|
| 23 |
+
|
| 24 |
+
$fieldset->addField('menu_status', 'select', array(
|
| 25 |
+
'label' => Mage::helper('vstudio_venu')->__('Status'),
|
| 26 |
+
'name' => 'menu_status',
|
| 27 |
+
'values' => $options->getOptionStatus(),
|
| 28 |
+
));
|
| 29 |
+
|
| 30 |
+
$fieldset->addField('advance_options', 'hidden', array('after_element_html' => '<button class="scalable save" type="button" title="Edit Menu Item" id="hide_advance">
|
| 31 |
+
<span><span><span>Show Advance Options</span></span></span></button>
|
| 32 |
+
<script>
|
| 33 |
+
document.observe("dom:loaded", function() {
|
| 34 |
+
$$(\'.advance-options\').invoke(\'up\').invoke(\'up\').invoke(\'hide\');
|
| 35 |
+
$(\'hide_advance\').observe(\'click\', function(event) {
|
| 36 |
+
$$(\'.advance-options\').invoke(\'up\').invoke(\'up\').invoke(\'toggle\');
|
| 37 |
+
});
|
| 38 |
+
});
|
| 39 |
+
</script>', ));
|
| 40 |
+
$fieldset->addField('menu_css_id', 'text', array(
|
| 41 |
+
'label' => Mage::helper('vstudio_venu')->__('Menu CSS Id'),
|
| 42 |
+
'name' => "menu_options[menu_css_id]",
|
| 43 |
+
'class' => 'advance-options',
|
| 44 |
+
'after_element_html' => '<p class="note"><span>The ID that is applied to the ul element which encloses the menu items.</span></p>',
|
| 45 |
+
));
|
| 46 |
+
$fieldset->addField('menu_css_class', 'text', array(
|
| 47 |
+
'label' => Mage::helper('vstudio_venu')->__('Menu CSS Class'),
|
| 48 |
+
'name' => "menu_options[menu_css_class]",
|
| 49 |
+
'class' => 'advance-options',
|
| 50 |
+
'after_element_html' => '<p class="note"><span>The class that is applied to the ul element which encloses the menu items.</span></p>',
|
| 51 |
+
));
|
| 52 |
+
|
| 53 |
+
$fieldset->addField('container_id', 'text', array(
|
| 54 |
+
'label' => Mage::helper('vstudio_venu')->__('Menu container id'),
|
| 55 |
+
'name' => "menu_options[container_id]",
|
| 56 |
+
'class' => 'advance-options',
|
| 57 |
+
'after_element_html' => '<p class="note"><span>The css id that is applied to the container</span></p>',
|
| 58 |
+
));
|
| 59 |
+
$fieldset->addField('container_class', 'text', array(
|
| 60 |
+
'label' => Mage::helper('vstudio_venu')->__('Menu container class'),
|
| 61 |
+
'name' => "menu_options[container_class]",
|
| 62 |
+
'class' => 'advance-options',
|
| 63 |
+
'after_element_html' => '<p class="note"><span>The css class that is applied to the container</span></p>',
|
| 64 |
+
));
|
| 65 |
+
$fieldset->addField('menu_container', 'select', array(
|
| 66 |
+
'label' => Mage::helper('vstudio_venu')->__('Menu Container'),
|
| 67 |
+
'class' => 'advance-options',
|
| 68 |
+
'name' => "menu_options[menu_container]",
|
| 69 |
+
'onclick' => "",
|
| 70 |
+
'onchange' => "",
|
| 71 |
+
'value' => '4',
|
| 72 |
+
'values' => array(
|
| 73 |
+
'1' => array(
|
| 74 |
+
'value' => 'nav',
|
| 75 |
+
'label' => 'Use a nav'
|
| 76 |
+
),
|
| 77 |
+
'2' => array(
|
| 78 |
+
'value' => 'div',
|
| 79 |
+
'label' => 'Use a div'
|
| 80 |
+
),
|
| 81 |
+
'3' => array(
|
| 82 |
+
'value' => 'none',
|
| 83 |
+
'label' => 'Use nothing'
|
| 84 |
+
),
|
| 85 |
+
),
|
| 86 |
+
'after_element_html' => '<p class="note"><span>Whether to wrap the ul, You can use div and nav tags</span></p>',
|
| 87 |
+
));
|
| 88 |
+
|
| 89 |
+
/** set form data **/
|
| 90 |
+
if (Mage::getSingleton('adminhtml/session')->getVenuData()) {
|
| 91 |
+
$form->setValues(Mage::getSingleton('adminhtml/session')->getVenuData());
|
| 92 |
+
Mage::getSingleton('adminhtml/session')->setVenuData(null);
|
| 93 |
+
} elseif (Mage::registry('venu_data')) {
|
| 94 |
+
|
| 95 |
+
$data = Mage::registry('venu_data')->getData();
|
| 96 |
+
// decode menu options and add it to the right field
|
| 97 |
+
if ( ! empty($data['menu_options'])) {
|
| 98 |
+
$options = json_decode($data['menu_options']);
|
| 99 |
+
foreach ($options as $option => $value) {
|
| 100 |
+
$data[$option] = $value;
|
| 101 |
+
}
|
| 102 |
+
}
|
| 103 |
+
$menuItems = Mage::registry('venu_data')->getData('menu_items');
|
| 104 |
+
$form->setValues($data);
|
| 105 |
+
|
| 106 |
+
$code = Mage::registry('venu_data')->getData('menu_code');
|
| 107 |
+
if ( ! empty($code)) {
|
| 108 |
+
$fieldset->addField('menu_code', 'textarea', array(
|
| 109 |
+
'label' => Mage::helper('vstudio_venu')->__('Menu Code'),
|
| 110 |
+
'name' => 'menu_code',
|
| 111 |
+
'value' => $code,
|
| 112 |
+
'onclick' => "this.select();",
|
| 113 |
+
'after_element_html' => '<p class="note">
|
| 114 |
+
<span style="width:100%; color:red;">
|
| 115 |
+
Use this to add this menu into pages,
|
| 116 |
+
category pages or static blocks
|
| 117 |
+
</span></p>',
|
| 118 |
+
));
|
| 119 |
+
}
|
| 120 |
+
|
| 121 |
+
if ($menuItems > 0 && ! empty($menuItems)) {
|
| 122 |
+
$field = 0;
|
| 123 |
+
|
| 124 |
+
$this->_sortFields($menuItems, SORT_ASC, 'sort_order');
|
| 125 |
+
foreach ($menuItems as $item) {
|
| 126 |
+
$fieldset = $form->addFieldset("menu_edit_form_$field", array('legend' => Mage::helper('vstudio_venu')->__("Menu Item {$item['item_label']} Menu Id : {$item['id']}")));
|
| 127 |
+
|
| 128 |
+
$fieldset->addField('item_collapse_' . $field, 'hidden', array(
|
| 129 |
+
'label' => Mage::helper('vstudio_venu')->__('Navigation Label'),
|
| 130 |
+
'after_element_html' => '<button style="" onclick="$$(\'#menu_edit_form_' . $field . ' tr:gt(0) \').invoke(\'toggle\')" class="scalable save" type="button" title="Edit Menu Item" id=""><span><span><span>Edit Menu Link</span></span></span></button>',
|
| 131 |
+
));
|
| 132 |
+
$fieldset->addField('item_label_' . $field, 'text', array(
|
| 133 |
+
'label' => Mage::helper('vstudio_venu')->__('Navigation Label'),
|
| 134 |
+
'name' => 'item[' . $item['id'] . '][item_label]',
|
| 135 |
+
'value' => $item['item_label'],
|
| 136 |
+
));
|
| 137 |
+
$fieldset->addField('item_hidden_' . $field, 'hidden', array(
|
| 138 |
+
'label' => Mage::helper('vstudio_venu')->__('Navigation Label'),
|
| 139 |
+
'name' => 'item[' . $item['id'] . '][id]',
|
| 140 |
+
'value' => $item['id'],
|
| 141 |
+
));
|
| 142 |
+
$fieldset->addField('item_link_' . $field, 'text', array(
|
| 143 |
+
'label' => Mage::helper('vstudio_venu')->__('Url Link'),
|
| 144 |
+
'name' => 'item[' . $item['id'] . '][item_link]',
|
| 145 |
+
'value' => urldecode($item['item_link']),
|
| 146 |
+
));
|
| 147 |
+
$fieldset->addField('sort_order_' . $field, 'text', array(
|
| 148 |
+
'label' => Mage::helper('vstudio_venu')->__('Menu Item Position'),
|
| 149 |
+
'name' => 'item[' . $item['id'] . '][sort_order]',
|
| 150 |
+
'style' => 'width:30%;',
|
| 151 |
+
'value' => $item['sort_order'],
|
| 152 |
+
));
|
| 153 |
+
$fieldset->addField('parent_id_' . $field, 'text', array(
|
| 154 |
+
'label' => Mage::helper('vstudio_venu')->__('Parent Id'),
|
| 155 |
+
'name' => 'item[' . $item['id'] . '][parent_id]',
|
| 156 |
+
'style' => 'width:30%;',
|
| 157 |
+
'value' => $item['parent_id'],
|
| 158 |
+
));
|
| 159 |
+
$fieldset->addField('delete_' . $field, 'checkbox', array(
|
| 160 |
+
'label' => Mage::helper('vstudio_venu')->__('Delete Menu Item'),
|
| 161 |
+
'name' => 'item[' . $item['id'] . '][delete]',
|
| 162 |
+
'value' => $item['id'],
|
| 163 |
+
));
|
| 164 |
+
|
| 165 |
+
$fieldset->addField('hide_elements_' . $field, 'hidden', array(
|
| 166 |
+
'label' => Mage::helper('vstudio_venu')->__('Navigation Label'),
|
| 167 |
+
'after_element_html' => '<script>document.observe("dom:loaded", function() { $$(\'#menu_edit_form_' . $field . ' tr:gt(0) \').invoke(\'hide\'); });</script>',
|
| 168 |
+
));
|
| 169 |
+
|
| 170 |
+
$field++;
|
| 171 |
+
}
|
| 172 |
+
}
|
| 173 |
+
}
|
| 174 |
+
return parent::_prepareForm();
|
| 175 |
+
}
|
| 176 |
+
|
| 177 |
+
/**
|
| 178 |
+
* Sort a multidimensional array by reference
|
| 179 |
+
*
|
| 180 |
+
* @param $data array
|
| 181 |
+
* @param $order order to be sorted
|
| 182 |
+
* @param $sortBy key to be sorted
|
| 183 |
+
*/
|
| 184 |
+
protected function _sortFields(&$data, $order = SORT_ASC, $sortBy = 'sort_order') {
|
| 185 |
+
// Obtain a list of columns
|
| 186 |
+
foreach ($data as $key => $row) {
|
| 187 |
+
$sortOrder[$key] = $row[$sortBy];
|
| 188 |
+
}
|
| 189 |
+
|
| 190 |
+
// Sort the data with $sortBy ascending, edition ascending
|
| 191 |
+
// Add $data as the last parameter, to sort by the common key
|
| 192 |
+
array_multisort($sortOrder, $order, $data);
|
| 193 |
+
}
|
| 194 |
+
|
| 195 |
+
}
|
app/code/community/Vstudio/Venu/Model/{MenuItem.php → Menuitem.php}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
<?php
|
| 2 |
-
class
|
| 3 |
protected $_eventPrefix = 'vstudio_venu_menuitem';
|
| 4 |
protected $_eventObject = 'venu';
|
| 5 |
protected $_categoryInstance = null;
|
| 1 |
<?php
|
| 2 |
+
class Vstudio_Venu_Model_Menuitem extends Mage_Core_Model_Abstract {
|
| 3 |
protected $_eventPrefix = 'vstudio_venu_menuitem';
|
| 4 |
protected $_eventObject = 'venu';
|
| 5 |
protected $_categoryInstance = null;
|
app/code/community/Vstudio/Venu/Model/Resource/Menuitem.php
CHANGED
|
@@ -1,8 +1,7 @@
|
|
| 1 |
<?php
|
| 2 |
-
class
|
| 3 |
extends Mage_Core_Model_Resource_Db_Abstract {
|
| 4 |
protected function _construct() {
|
| 5 |
$this -> _init('vstudio_venu/menuitem', 'id');
|
| 6 |
}
|
| 7 |
-
|
| 8 |
}
|
| 1 |
<?php
|
| 2 |
+
class Vstudio_Venu_Model_Resource_Menuitem
|
| 3 |
extends Mage_Core_Model_Resource_Db_Abstract {
|
| 4 |
protected function _construct() {
|
| 5 |
$this -> _init('vstudio_venu/menuitem', 'id');
|
| 6 |
}
|
|
|
|
| 7 |
}
|
app/code/community/Vstudio/Venu/Model/Resource/Menuitem/Collection.php
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
<?php
|
| 2 |
-
class
|
| 3 |
|
| 4 |
public function _construct() {
|
| 5 |
$this -> _init('vstudio_venu/menuitem');
|
| 1 |
<?php
|
| 2 |
+
class Vstudio_Venu_Model_Resource_Menuitem_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract {
|
| 3 |
|
| 4 |
public function _construct() {
|
| 5 |
$this -> _init('vstudio_venu/menuitem');
|
app/code/community/Vstudio/Venu/Model/Resource/Venu.php
CHANGED
|
@@ -4,5 +4,4 @@ extends Mage_Core_Model_Resource_Db_Abstract {
|
|
| 4 |
protected function _construct() {
|
| 5 |
$this -> _init('vstudio_venu/venu', 'menu_id');
|
| 6 |
}
|
| 7 |
-
|
| 8 |
}
|
| 4 |
protected function _construct() {
|
| 5 |
$this -> _init('vstudio_venu/venu', 'menu_id');
|
| 6 |
}
|
|
|
|
| 7 |
}
|
app/code/community/Vstudio/Venu/controllers/Adminhtml/Venu/MenuController.php
CHANGED
|
@@ -17,6 +17,25 @@ class Vstudio_Venu_Adminhtml_Venu_MenuController
|
|
| 17 |
return $this;
|
| 18 |
}
|
| 19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
public function editAction()
|
| 21 |
{
|
| 22 |
// lets get the id of the menu
|
| 17 |
return $this;
|
| 18 |
}
|
| 19 |
|
| 20 |
+
public function ajaxAction()
|
| 21 |
+
{
|
| 22 |
+
$id = $this->getRequest()->getPost('deleteItem');
|
| 23 |
+
$result = '';
|
| 24 |
+
if ( $id ) {
|
| 25 |
+
|
| 26 |
+
try {
|
| 27 |
+
$menuItem = Mage::getModel('vstudio_venu/menuitem')->setId($id);
|
| 28 |
+
$menuItem->delete();
|
| 29 |
+
$result = "menu item with id : $id. Has been deleted";
|
| 30 |
+
} catch(Exception $e) {
|
| 31 |
+
$result = "Something went wront: " .$e->getMessage();
|
| 32 |
+
}
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
|
| 36 |
+
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
public function editAction()
|
| 40 |
{
|
| 41 |
// lets get the id of the menu
|
app/code/community/Vstudio/Venu/data/vstudio_venu_setup/data-upgrade-1.0.0.0-1.2.0.0.php
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
| 1 |
+
<?php
|
app/code/community/Vstudio/Venu/etc/config.xml
CHANGED
|
@@ -2,7 +2,7 @@
|
|
| 2 |
<config>
|
| 3 |
<modules>
|
| 4 |
<Vstudio_Venu>
|
| 5 |
-
<version>1.
|
| 6 |
</Vstudio_Venu>
|
| 7 |
</modules>
|
| 8 |
<adminhtml>
|
| 2 |
<config>
|
| 3 |
<modules>
|
| 4 |
<Vstudio_Venu>
|
| 5 |
+
<version>1.2.0.0</version>
|
| 6 |
</Vstudio_Venu>
|
| 7 |
</modules>
|
| 8 |
<adminhtml>
|
app/code/community/Vstudio/Venu/sql/vstudio_venu_setup/upgrade-1.0.0.0-1.2.0.0.php
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
| 1 |
+
|
app/design/adminhtml/default/default/layout/venu.xml
CHANGED
|
@@ -18,6 +18,9 @@
|
|
| 18 |
<reference name="content">
|
| 19 |
<block type="vstudio_venu/adminhtml_menumanager_edit" name="manage.menu.edit.grid" />
|
| 20 |
</reference>
|
|
|
|
|
|
|
|
|
|
| 21 |
</adminhtml_venu_menu_edit>
|
| 22 |
<adminhtml_venu_menu_categories>
|
| 23 |
<block type="core/text_list" name="root" output="toHtml">
|
| 18 |
<reference name="content">
|
| 19 |
<block type="vstudio_venu/adminhtml_menumanager_edit" name="manage.menu.edit.grid" />
|
| 20 |
</reference>
|
| 21 |
+
<reference name="head">
|
| 22 |
+
<action method="addCss"><name>vstudio/venu/venu.css</name></action>
|
| 23 |
+
</reference>
|
| 24 |
</adminhtml_venu_menu_edit>
|
| 25 |
<adminhtml_venu_menu_categories>
|
| 26 |
<block type="core/text_list" name="root" output="toHtml">
|
app/design/adminhtml/default/default/template/vstudio/venu/edit/tab/form.phtml
ADDED
|
@@ -0,0 +1,327 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
$_menuData = $this->_getVenuData();
|
| 3 |
+
// get values as variables
|
| 4 |
+
extract($_menuData);
|
| 5 |
+
?>
|
| 6 |
+
<div class="entry-edit">
|
| 7 |
+
<div class="entry-edit-head">
|
| 8 |
+
<h4 class="icon-head head-edit-form fieldset-legend">Menu information</h4>
|
| 9 |
+
<div class="form-buttons"></div>
|
| 10 |
+
</div>
|
| 11 |
+
<div id="menu_edit_form" class="fieldset ">
|
| 12 |
+
<div class="hor-scroll">
|
| 13 |
+
<table cellspacing="0" class="form-list">
|
| 14 |
+
<tbody>
|
| 15 |
+
<tr>
|
| 16 |
+
<td class="label"><label for="menu_title">Menu Title <span class="required">*</span></label></td>
|
| 17 |
+
<td class="value">
|
| 18 |
+
<input type="text" class="required-entry input-text required-entry" <?php echo (isset($menu_title) && !empty($menu_title)) ? 'value="' . $menu_title . '"' : ''; ?> name="menu_title" id="menu_title">
|
| 19 |
+
</td>
|
| 20 |
+
</tr>
|
| 21 |
+
<tr>
|
| 22 |
+
<td class="label"><label for="menu_orientation">Menu Orientation</label></td>
|
| 23 |
+
<td class="value">
|
| 24 |
+
<select class=" select" name="menu_options[menu_orientation]" id="menu_orientation">
|
| 25 |
+
<option <?php echo (isset($menu_orientation) && $menu_orientation == 'horz')? 'selected="selected"' : ''; ?> value="horz">Horizontal</option>
|
| 26 |
+
<option <?php echo (isset($menu_orientation) && $menu_orientation == 'vert')? 'selected="selected"' : ''; ?> value="vert">Vertical</option>
|
| 27 |
+
</select>
|
| 28 |
+
</td>
|
| 29 |
+
</tr>
|
| 30 |
+
<tr>
|
| 31 |
+
<td class="label"><label for="menu_status">Status</label></td>
|
| 32 |
+
<td class="value">
|
| 33 |
+
<select class=" select" name="menu_status" id="menu_status">
|
| 34 |
+
<option <?php echo (isset($menu_status) && $menu_status == 1)? 'selected="selected"' : ''; ?> value="1">Active</option>
|
| 35 |
+
<option <?php echo (isset($menu_status) && $menu_status == 0)? 'selected="selected"' : ''; ?> value="0">Non Active</option>
|
| 36 |
+
</select>
|
| 37 |
+
</td>
|
| 38 |
+
</tr>
|
| 39 |
+
<tr>
|
| 40 |
+
<td class="hidden" colspan="2"><input type="hidden" value="" name="" id="advance_options">
|
| 41 |
+
<button id="hide_advance" title="Edit Menu Item" type="button" class="scalable save">
|
| 42 |
+
<span><span><span>Show Advance Options</span></span></span></button>
|
| 43 |
+
<script>
|
| 44 |
+
document.observe("dom:loaded", function() {
|
| 45 |
+
$$('.advance-options').invoke('up').invoke('up').invoke('hide');
|
| 46 |
+
$('hide_advance').observe('click', function(event) {
|
| 47 |
+
$$('.advance-options').invoke('up').invoke('up').invoke('toggle');
|
| 48 |
+
});
|
| 49 |
+
});
|
| 50 |
+
</script></td>
|
| 51 |
+
</tr>
|
| 52 |
+
<tr style="display: none;">
|
| 53 |
+
<td class="label"><label for="menu_css_id">Menu CSS Id</label></td>
|
| 54 |
+
<td class="value">
|
| 55 |
+
<input type="text" class="advance-options input-text" value="<?php echo (isset($menu_css_id)) ? $menu_css_id : ''; ?>" name="menu_options[menu_css_id]" id="menu_css_id">
|
| 56 |
+
<p class="note"><span>The ID that is applied to the ul element which encloses the menu items.</span></p>
|
| 57 |
+
</td>
|
| 58 |
+
</tr>
|
| 59 |
+
<tr style="display: none;">
|
| 60 |
+
<td class="label"><label for="menu_css_class">Menu CSS Class</label></td>
|
| 61 |
+
<td class="value">
|
| 62 |
+
<input type="text" class="advance-options input-text" value="<?php echo (isset($menu_css_class)) ? $menu_css_class : ''; ?>" name="menu_options[menu_css_class]" id="menu_css_class">
|
| 63 |
+
<p class="note"><span>The class that is applied to the ul element which encloses the menu items.</span></p>
|
| 64 |
+
</td>
|
| 65 |
+
</tr>
|
| 66 |
+
<tr style="display: none;">
|
| 67 |
+
<td class="label"><label for="container_id">Menu container id</label></td>
|
| 68 |
+
<td class="value">
|
| 69 |
+
<input type="text" class="advance-options input-text" value="<?php echo (isset($container_id)) ? $container_id : ''; ?>" name="menu_options[container_id]" id="container_id">
|
| 70 |
+
<p class="note"><span>The css id that is applied to the container</span></p>
|
| 71 |
+
</td>
|
| 72 |
+
</tr>
|
| 73 |
+
<tr style="display: none;">
|
| 74 |
+
<td class="label"><label for="container_class">Menu container class</label></td>
|
| 75 |
+
<td class="value">
|
| 76 |
+
<input type="text" class="advance-options input-text" value="<?php echo (isset($contaner_class)) ? $contaner_class : ''; ?>" name="menu_options[container_class]" id="container_class">
|
| 77 |
+
<p class="note"><span>The css class that is applied to the container</span></p>
|
| 78 |
+
</td>
|
| 79 |
+
</tr>
|
| 80 |
+
<tr style="display: none;">
|
| 81 |
+
<td class="label"><label for="menu_container">Menu Container</label></td>
|
| 82 |
+
<td class="value">
|
| 83 |
+
<select onchange="" onclick="" class="advance-options select" name="menu_options[menu_container]" id="menu_container">
|
| 84 |
+
<option <?php echo (isset($menu_container) && $menu_container == 'nav') ? 'selected="selected"' : ''; ?> value="nav">Use a nav</option>
|
| 85 |
+
<option <?php echo (isset($menu_container) && $menu_container == 'div') ? 'selected="selected"' : ''; ?> value="div">Use a div</option>
|
| 86 |
+
<option <?php echo (isset($menu_container) && $menu_container == 'none') ? 'selected="selected"' : ''; ?> value="none">Use nothing</option>
|
| 87 |
+
</select>
|
| 88 |
+
<p class="note"><span>Whether to wrap the ul, You can use div and nav tags</span></p>
|
| 89 |
+
</td>
|
| 90 |
+
</tr>
|
| 91 |
+
<?php if (!empty($menu_code)) : ?>
|
| 92 |
+
<tr>
|
| 93 |
+
<td class="label"><label for="menu_code">Menu Code</label></td>
|
| 94 |
+
<td class="value">
|
| 95 |
+
|
| 96 |
+
<textarea class=" textarea" cols="15" rows="2" onclick="this.select();" name="menu_code" id="menu_code"><?php echo (!empty($menu_code))? $menu_code : ''; ?></textarea>
|
| 97 |
+
<p class="note">
|
| 98 |
+
<span style="width:100%; color:red;">
|
| 99 |
+
Use this to add this menu into pages,
|
| 100 |
+
category pages or static blocks
|
| 101 |
+
</span></p>
|
| 102 |
+
</td>
|
| 103 |
+
</tr>
|
| 104 |
+
<?php endif; ?>
|
| 105 |
+
</tbody>
|
| 106 |
+
</table>
|
| 107 |
+
</div>
|
| 108 |
+
</div>
|
| 109 |
+
</div>
|
| 110 |
+
|
| 111 |
+
<div class="entry-edit">
|
| 112 |
+
<div class="entry-edit-head">
|
| 113 |
+
<h4 class="icon-head head-edit-form fieldset-legend">Menu</h4>
|
| 114 |
+
<div class="form-bottuns"></div>
|
| 115 |
+
</div>
|
| 116 |
+
<div class="fieldset">
|
| 117 |
+
<div class="hor-scroll">
|
| 118 |
+
<?php
|
| 119 |
+
|
| 120 |
+
function createMenuPreview($items = array(), $parent = 0, $isChild = false)
|
| 121 |
+
{
|
| 122 |
+
if (!empty($items[$parent])) {
|
| 123 |
+
|
| 124 |
+
|
| 125 |
+
$i = 0;
|
| 126 |
+
echo ($isChild) ? '<ul class="venu-menu-sub">' : '<ul id="menu_venu" class="venu-menu">';
|
| 127 |
+
foreach ($items[$parent] as $item) {
|
| 128 |
+
$id = $item['id'];
|
| 129 |
+
$title = $item['item_label'];
|
| 130 |
+
$link = urldecode($item['item_link']);
|
| 131 |
+
$order = $item['sort_order'];
|
| 132 |
+
echo "<li id='$id' class='venu-item'>";
|
| 133 |
+
echo '<button name="delete_'.$id.'" onclick="javascript:deleteMenuItem('.$id.'); return false;">Delete</button>';
|
| 134 |
+
echo '<h4 class="toggler" > ID: '. $id . ' ' . $title . ' </h4><br><div class="panel">';
|
| 135 |
+
echo '<label>Menu Title</label><br>';
|
| 136 |
+
echo '<input type="text" class=" input-text" value="'.$title.'" name="item['.$id.'][item_label]"><br>';
|
| 137 |
+
echo '<label>Menu Link</label><br>';
|
| 138 |
+
echo '<input type="text" class=" input-text" value="'.$link.'" name="item['.$id.'][item_link]"><br>';
|
| 139 |
+
echo '<label>Menu Order ';
|
| 140 |
+
echo '<input type="text" class=" input-text" style="width:28.5%;" value="'.$order.'" name="item['.$id.'][sort_order]" id="sort_order_'.$id.'"></label>';
|
| 141 |
+
echo '<label>Menu Parent ';
|
| 142 |
+
echo '<input type="text" class=" input-text" style="width:29%;" value="'.$parent.'" name="item['.$id.'][parent_id]" id="parent_id_'.$id.'"></lable>';
|
| 143 |
+
echo '<input type="hidden" value="'.$id.'" name="item['.$id.'][id]">';
|
| 144 |
+
echo '</div><span class="venu-menu-sub"><h5>Drop sub items here</h5>';
|
| 145 |
+
createMenuPreview($items, $item['id'], true);
|
| 146 |
+
echo '</span>';
|
| 147 |
+
echo "</li>";
|
| 148 |
+
}
|
| 149 |
+
echo "</ul>";
|
| 150 |
+
}
|
| 151 |
+
}
|
| 152 |
+
|
| 153 |
+
if ( isset($menu_items) && !empty($menu_items) ) {
|
| 154 |
+
$items = array();
|
| 155 |
+
foreach ($menu_items as $item) {
|
| 156 |
+
$items[$item['parent_id']][] = $item;
|
| 157 |
+
}
|
| 158 |
+
createMenuPreview($items);
|
| 159 |
+
}
|
| 160 |
+
?>
|
| 161 |
+
<script>
|
| 162 |
+
|
| 163 |
+
var menu = document.getElementById("menu_venu");
|
| 164 |
+
var togglers = menu.getElementsByTagName("h4");
|
| 165 |
+
$$("div.panel").each(function(item){
|
| 166 |
+
$(item).toggle(true);
|
| 167 |
+
});
|
| 168 |
+
$A($(togglers)).each(function(item) {
|
| 169 |
+
$(item).observe('click', function(event) {
|
| 170 |
+
panel = item.next('div');
|
| 171 |
+
$(panel).toggle();
|
| 172 |
+
});
|
| 173 |
+
});
|
| 174 |
+
|
| 175 |
+
function ajaxDelete(id) {
|
| 176 |
+
url = '<?php echo Mage::helper("adminhtml")->getUrl('/venu_menu/ajax') ?>';
|
| 177 |
+
new Ajax.Request(url, {
|
| 178 |
+
type: "POST",
|
| 179 |
+
parameters: "deleteItem="+id,
|
| 180 |
+
asynchronous: true,
|
| 181 |
+
onFailure: function(transport) {
|
| 182 |
+
var text = transport.responseText;
|
| 183 |
+
var JSON = eval( "(" + text + ")" );
|
| 184 |
+
updateStatus(JSON.code + ": " + JSON.message);
|
| 185 |
+
},
|
| 186 |
+
onSuccess: function(transport) {
|
| 187 |
+
var menu = document.getElementById("menu_venu");
|
| 188 |
+
var items = menu.getElementsByTagName('li');
|
| 189 |
+
|
| 190 |
+
for ( var i = 0; i < items.length; i++ ) {
|
| 191 |
+
if ( items[i].getAttribute('id') == id ) {
|
| 192 |
+
console.log(items[i]);
|
| 193 |
+
items[i].remove();
|
| 194 |
+
}
|
| 195 |
+
}
|
| 196 |
+
|
| 197 |
+
if (200 == transport.status) {
|
| 198 |
+
console.log("sucess: " + transport.responseText);
|
| 199 |
+
createPlaceholder();
|
| 200 |
+
new Effect.Highlight("menu_venu", { startcolor: '#F7C8C8', endcolor: '#ffffff' });
|
| 201 |
+
|
| 202 |
+
} else {
|
| 203 |
+
console.log("something wente wrong: " + transport.status);
|
| 204 |
+
}
|
| 205 |
+
|
| 206 |
+
|
| 207 |
+
}
|
| 208 |
+
});
|
| 209 |
+
|
| 210 |
+
}
|
| 211 |
+
|
| 212 |
+
function deleteMenuItem(id) {
|
| 213 |
+
if ( confirm("do you really want to delete this menu item?") ) {
|
| 214 |
+
var menu = document.getElementById("menu_venu");
|
| 215 |
+
var items = menu.childNodes;
|
| 216 |
+
for ( var i = 0; i < items.length; i++ ) {
|
| 217 |
+
if ( items[i].getAttribute('id') == id ) {
|
| 218 |
+
var subItems = items[i].getElementsByTagName('li');
|
| 219 |
+
if ( subItems.length > 0 ) {
|
| 220 |
+
for (var j = 0; j < subItems.length; j++) {
|
| 221 |
+
var subId = subItems[j].getAttribute('id');
|
| 222 |
+
if (typeof subId !== 'undefined' && subId !== null)
|
| 223 |
+
ajaxDelete(subId);
|
| 224 |
+
}
|
| 225 |
+
}
|
| 226 |
+
}
|
| 227 |
+
}
|
| 228 |
+
ajaxDelete(id);
|
| 229 |
+
}
|
| 230 |
+
}
|
| 231 |
+
var subMenus = $('menu_venu').getElementsByTagName('ul');
|
| 232 |
+
|
| 233 |
+
function createPlaceholder(){
|
| 234 |
+
var droppers = $('menu_venu').getElementsByTagName('span');
|
| 235 |
+
$A(droppers).each( function(item) {
|
| 236 |
+
var uls = item.getElementsByTagName("ul");
|
| 237 |
+
|
| 238 |
+
|
| 239 |
+
if ( !(uls.length > 0) ) {
|
| 240 |
+
item.insert("<ul><li class='placeholder'> </li></ul>");
|
| 241 |
+
} else {
|
| 242 |
+
var children = uls[0].getElementsByTagName("li");
|
| 243 |
+
|
| 244 |
+
if ( !(children.length > 0) )
|
| 245 |
+
uls[0].insert("<li class='placeholder'> </li>");
|
| 246 |
+
}
|
| 247 |
+
});
|
| 248 |
+
}
|
| 249 |
+
|
| 250 |
+
createPlaceholder();
|
| 251 |
+
|
| 252 |
+
$A(subMenus).each( function (item) {
|
| 253 |
+
Sortable.create(item, {
|
| 254 |
+
tree: true,
|
| 255 |
+
treeTag: 'ul',
|
| 256 |
+
onChange: subMenuUpdate
|
| 257 |
+
|
| 258 |
+
});
|
| 259 |
+
});
|
| 260 |
+
|
| 261 |
+
Sortable.create("menu_venu", {
|
| 262 |
+
tree: true,
|
| 263 |
+
treeTag: 'ul',
|
| 264 |
+
onChange: update
|
| 265 |
+
});
|
| 266 |
+
|
| 267 |
+
function update() {
|
| 268 |
+
var elements = document.getElementById("menu_venu").childNodes;
|
| 269 |
+
// set the order of the elements after they have been moved
|
| 270 |
+
for (var i = 0; i < elements.length; i++) {
|
| 271 |
+
var id = elements[i].getAttribute('id');
|
| 272 |
+
var parent = elements[i].up();
|
| 273 |
+
var Order = elements[i].select('input[id="sort_order_' + id + '"]');
|
| 274 |
+
var parentId = elements[i].select('input[id="parent_id_' + id + '"]');
|
| 275 |
+
if (!(typeof parent === 'undefined')) {
|
| 276 |
+
parentId[0].value = 0;
|
| 277 |
+
}
|
| 278 |
+
Order[0].value = i;
|
| 279 |
+
}
|
| 280 |
+
createPlaceholder();
|
| 281 |
+
}
|
| 282 |
+
function subMenuUpdate(item) {
|
| 283 |
+
var itemParent = item.up('ul').up('li');
|
| 284 |
+
var parentId = (typeof itemParent !== 'undefined') ? itemParent.getAttribute('id') : 0;
|
| 285 |
+
var itemId = item.getAttribute('id');
|
| 286 |
+
var inputParent = item.select('input[id="parent_id_' + itemId + '"]');
|
| 287 |
+
|
| 288 |
+
// assign parent id to this item
|
| 289 |
+
inputParent[0].value = parentId;
|
| 290 |
+
|
| 291 |
+
var elements = item.up('ul').childNodes;
|
| 292 |
+
|
| 293 |
+
// set the order of the elements after they have been moved
|
| 294 |
+
for (var i = 0; i < elements.length; i++) {
|
| 295 |
+
var id = elements[i].getAttribute('id');
|
| 296 |
+
if (typeof id !== 'undefined' && id !== null) {
|
| 297 |
+
var elementOrder = elements[i].select('input[id="sort_order_' + id + '"]');
|
| 298 |
+
elementOrder[0].value = i;
|
| 299 |
+
}
|
| 300 |
+
}
|
| 301 |
+
|
| 302 |
+
createPlaceholder();
|
| 303 |
+
|
| 304 |
+
}
|
| 305 |
+
|
| 306 |
+
/* var spans = $('menu_venu').getElementsByTagName('ul');
|
| 307 |
+
$A(spans).each( function (item) {
|
| 308 |
+
Droppables.add( item, {
|
| 309 |
+
hoverclass: 'hoverActive',
|
| 310 |
+
onDrop: moveItem
|
| 311 |
+
}
|
| 312 |
+
);
|
| 313 |
+
});
|
| 314 |
+
|
| 315 |
+
function moveItem(draggable, droparea) {
|
| 316 |
+
droparea.appendChild(draggable);
|
| 317 |
+
var parent = draggable.up('li');
|
| 318 |
+
var id = draggable.getAttribute('id');
|
| 319 |
+
var parentId = parent.getAttribute('id');
|
| 320 |
+
var input = parent.select('input[id="parent_id_' + id + '"]');
|
| 321 |
+
input[0].value = parentId;
|
| 322 |
+
}*/
|
| 323 |
+
</script>
|
| 324 |
+
</div>
|
| 325 |
+
</div>
|
| 326 |
+
|
| 327 |
+
</div>
|
app/design/frontend/default/default/layout/venu.xml
CHANGED
|
@@ -1,19 +1,20 @@
|
|
| 1 |
-
<?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
<layout version="0.1.0">
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
| 19 |
</layout>
|
| 1 |
+
<?xml version="1.0" encoding="UTF-8" ?>
|
| 2 |
<layout version="0.1.0">
|
| 3 |
+
<default>
|
| 4 |
+
<reference name="head">
|
| 5 |
+
<action method="addItem">
|
| 6 |
+
<type>skin_css</type>
|
| 7 |
+
<name>vstudio/venu/master.css</name>
|
| 8 |
+
</action>
|
| 9 |
+
</reference>
|
| 10 |
+
<reference name="footer">
|
| 11 |
+
<block type="vstudio_venu/menu" name="vstudio.venu" as="vstudio_venu"
|
| 12 |
+
template="vstudio/venu/menu.phtml">
|
| 13 |
+
<action method="setData">
|
| 14 |
+
<name>menu_title</name>
|
| 15 |
+
<value>Sample Menu</value>
|
| 16 |
+
</action>
|
| 17 |
+
</block>
|
| 18 |
+
</reference>
|
| 19 |
+
</default>
|
| 20 |
</layout>
|
package.xml
CHANGED
|
@@ -1,39 +1,18 @@
|
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>Venu_Menu</name>
|
| 4 |
-
<version>1.
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license uri="http://opensource.org/licenses/academic.php">("AFL") v. 3.0</license>
|
| 7 |
<channel>community</channel>
|
| 8 |
<extends/>
|
| 9 |
<summary>Create simple but versatile menu navigation from CMS pages, Categories URLs, or external URLs. </summary>
|
| 10 |
-
<description><p>
|
| 11 |
-
<p>Prior to developing websites, I worked as an IT consultant which was an amazing experience that helps me learn to see software engineering in a different way.&nbsp; I&rsquo;m passionate about web development and design. Aside from it, I enjoy reading challenging books, drawing, and singing to my daughter.</p>
|
| 12 |
-
<p>&nbsp;</p>
|
| 13 |
-
<p><strong>Introduction:</strong></p>
|
| 14 |
-
<p>This extension creates an admin menu with options for turning template path hints on, in the front and backend of your website.</p>
|
| 15 |
-
<p><strong>Features:</strong></p>
|
| 16 |
-
<p>- Upgrade Proof Module.<br /> - Tested for Magento version 1.7.0.0 - 1.8.1.0<br /> - Easy to install nothing to configure.</p>
|
| 17 |
-
<p><strong>Installation / Configuration:</strong></p>
|
| 18 |
-
<ol>
|
| 19 |
-
<li>Just copy &amp; paste the 'app' folder provided in the extension zip file to the root of your Magento installation.</li>
|
| 20 |
-
<li>After installation, make sure to clear you cache then:</li>
|
| 21 |
-
</ol>
|
| 22 |
-
<ul>
|
| 23 |
-
<li>To enable the admin path hints navigate and click on Path Hints &gt;&gt; Enable Admin Paths.</li>
|
| 24 |
-
<li>To disable the admin path hints navigate and click on Path Hints &gt;&gt; Disable Admin Paths.</li>
|
| 25 |
-
<li>To enable front-end path hints navigate and click on Path Hints &gt;&gt; Enable Front Paths.</li>
|
| 26 |
-
<li>To disable front-end path hints navigate and click on Path Hints &gt;&gt; Disable Front Paths.</li>
|
| 27 |
-
</ul>
|
| 28 |
-
<p>With this extension you can easily turn on template path hints for both front and back end with a click of menu. No configuration is needed.</p>
|
| 29 |
-
<p>&nbsp;</p>
|
| 30 |
-
<p>&nbsp;</p>
|
| 31 |
-
<p><strong>Introduction:</strong></p>
|
| 32 |
<p>Create simple but versatile menu navigation from CMS pages, Categories URLs, or external URLs. Each element has css class so you can address any element by standard css.</p>
|
| 33 |
<p><strong>Features:</strong></p>
|
| 34 |
<ul>
|
| 35 |
<li>Upgrade Proof Module.</li>
|
| 36 |
-
<li>Tested for Magento version
|
| 37 |
<li>&nbsp;Easy to install nothing to configure.</li>
|
| 38 |
<li>Valid HTML5 structure</li>
|
| 39 |
<li>Valid CSS</li>
|
|
@@ -66,11 +45,13 @@
|
|
| 66 |
<li><strong>&nbsp;NOTE:</strong> Here menu_title will be replaced with the menu name you created.</li>
|
| 67 |
</ol>
|
| 68 |
<p>&nbsp;</p></description>
|
| 69 |
-
<notes>
|
|
|
|
|
|
|
| 70 |
<authors><author><name>Leandro Villagran</name><user>veandro</user><email>veandro@outlook.com</email></author></authors>
|
| 71 |
-
<date>2014-
|
| 72 |
-
<time>
|
| 73 |
-
<contents><target name="mageetc"><dir><dir name="modules"><file name="Vstudio_Venu.xml" hash="9da19de899ff6e71c212774e6c4218cd"/></dir></dir></target><target name="magecommunity"><dir><dir name="Vstudio"><dir name="Venu"><dir name="Block"><dir name="Adminhtml"><dir name="Menumanager"><dir name="Edit"><file name="Form.php" hash="19e215b8bb5ff97f28a1da9c4870ee19"/><dir name="Tab"><file name="Categories.php" hash="cef84d0151c6ed2cc697642e81c07d28"/><file name="Custom.php" hash="c99783ed1eda4209c1c3239596af2cdc"/><file name="Form.php" hash="53c84d188a1b988381296eeafd00eaa4"/><file name="Pages.php" hash="e8e49286b198781e18ee5efa3241096c"/></dir><file name="Tabs.php" hash="4896cfcc4d9b83b54709583b2398caec"/></dir><file name="Edit.php" hash="32b25d351269353432f5925a21d50985"/><file name="Grid.php" hash="68395bbad24c0456e37bd8a0f2fd3ddc"/></dir><file name="Menumanager.php" hash="1006a6046a9b19cd56c343ac82202274"/></dir><file name="Menu.php" hash="f823d21dff135a711eede4deda12f44d"/></dir><dir name="Helper"><file name="Data.php" hash="7cd8247fccf0ec896ed8308b0e517209"/></dir><dir name="Model"><file name="
|
| 74 |
<compatible/>
|
| 75 |
-
<dependencies><required><php><min>5.2.0</min><max>5.
|
| 76 |
</package>
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>Venu_Menu</name>
|
| 4 |
+
<version>1.2.0.0</version>
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license uri="http://opensource.org/licenses/academic.php">("AFL") v. 3.0</license>
|
| 7 |
<channel>community</channel>
|
| 8 |
<extends/>
|
| 9 |
<summary>Create simple but versatile menu navigation from CMS pages, Categories URLs, or external URLs. </summary>
|
| 10 |
+
<description><p><strong>Introduction:</strong></p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
<p>Create simple but versatile menu navigation from CMS pages, Categories URLs, or external URLs. Each element has css class so you can address any element by standard css.</p>
|
| 12 |
<p><strong>Features:</strong></p>
|
| 13 |
<ul>
|
| 14 |
<li>Upgrade Proof Module.</li>
|
| 15 |
+
<li>Tested for Magento version 1.7.0.0 - 1.8.1.0.</li>
|
| 16 |
<li>&nbsp;Easy to install nothing to configure.</li>
|
| 17 |
<li>Valid HTML5 structure</li>
|
| 18 |
<li>Valid CSS</li>
|
| 45 |
<li><strong>&nbsp;NOTE:</strong> Here menu_title will be replaced with the menu name you created.</li>
|
| 46 |
</ol>
|
| 47 |
<p>&nbsp;</p></description>
|
| 48 |
+
<notes>Fixes some incompatibility issues with linux servers
|
| 49 |
+

|
| 50 |
+
Adds drag and drop functionality </notes>
|
| 51 |
<authors><author><name>Leandro Villagran</name><user>veandro</user><email>veandro@outlook.com</email></author></authors>
|
| 52 |
+
<date>2014-05-21</date>
|
| 53 |
+
<time>03:56:26</time>
|
| 54 |
+
<contents><target name="mageetc"><dir><dir name="modules"><file name="Vstudio_Venu.xml" hash="9da19de899ff6e71c212774e6c4218cd"/></dir></dir></target><target name="magecommunity"><dir><dir name="Vstudio"><dir name="Venu"><dir name="Block"><dir name="Adminhtml"><dir name="Menumanager"><dir name="Edit"><file name="Form.php" hash="19e215b8bb5ff97f28a1da9c4870ee19"/><dir name="Tab"><file name="Categories.php" hash="cef84d0151c6ed2cc697642e81c07d28"/><file name="Custom.php" hash="c99783ed1eda4209c1c3239596af2cdc"/><file name="Form.php" hash="540eef57fcf46aaa82d1d48947b959b2"/><file name="Form.phpbak" hash="53c84d188a1b988381296eeafd00eaa4"/><file name="Pages.php" hash="e8e49286b198781e18ee5efa3241096c"/></dir><file name="Tabs.php" hash="4896cfcc4d9b83b54709583b2398caec"/></dir><file name="Edit.php" hash="32b25d351269353432f5925a21d50985"/><file name="Grid.php" hash="68395bbad24c0456e37bd8a0f2fd3ddc"/></dir><file name="Menumanager.php" hash="1006a6046a9b19cd56c343ac82202274"/></dir><file name="Menu.php" hash="f823d21dff135a711eede4deda12f44d"/></dir><dir name="Helper"><file name="Data.php" hash="7cd8247fccf0ec896ed8308b0e517209"/></dir><dir name="Model"><file name="Menuitem.php" hash="14fcb790d4d3b4b57ae7212a4732863b"/><file name="Options.php" hash="ac77800626cab12b28354d8221546c31"/><dir name="Resource"><dir name="Menuitem"><file name="Collection.php" hash="1602973b83dea21b046f100bba8ff7f1"/></dir><file name="Menuitem.php" hash="894f5bba5fa8bb575f28664a5ff90864"/><dir name="Venu"><file name="Collection.php" hash="018e4a8a54ce460ab54d372a1467e49d"/></dir><file name="Venu.php" hash="add7f078ca2f0aad116bfe2d31970142"/></dir><file name="Venu.php" hash="83501fea2b353c8d7e52ef86fbbcfe32"/></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Venu"><file name="MenuController.php" hash="7fb07fd923a8619e889cfb439fc661c3"/></dir></dir><file name="VenuController.php" hash="7f46cea457534d053eebf4c01833def6"/></dir><dir name="data"><dir name="vstudio_venu_setup"><file name="data-install-1.0.0.0.php" hash="efbb9acc38e7dfe72b4ec27699703d76"/><file name="data-upgrade-1.0.0.0-1.2.0.0.php" hash="f84214fc43f665c79b92dc7a092b364f"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="f3c85fa038d8a776800f957cf8a595f1"/><file name="config.xml" hash="f12f5c7d58087d4daaea17d834b56130"/><file name="system.xml" hash="c79e105fc5b825bf85a2479ed881883a"/></dir><dir name="sql"><dir name="vstudio_venu_setup"><file name="install-1.0.0.0.php" hash="98a6e204778f474723e9bcbb11947bc9"/><file name="upgrade-1.0.0.0-1.2.0.0.php" hash="81051bcc2cf1bedf378224b0a93e2877"/></dir></dir></dir></dir></dir></target><target name="magedesign"><dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="venu.xml" hash="8c649db85e0ee2172b94186da487feab"/></dir><dir name="template"><dir name="vstudio"><dir name="venu"><dir name="edit"><dir name="tab"><file name="category.phtml" hash="8b42a4f731790f088bd0cd4c0a7a87fe"/><file name="form.phtml" hash="ee11daa000e19d6054f501cbe8bbe6f1"/></dir></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="venu.xml" hash="c6815463ef7c5ea20866c23b41f0225d"/></dir><dir name="template"><dir name="vstudio"><dir name="venu"><file name="menu.phtml" hash="b06077bcf9e9d1c9579e443fb83b613f"/></dir></dir></dir></dir></dir></dir></dir></target><target name="mageskin"><dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="vstudio"><dir name="venu"><file name="master.css" hash="3f7658a34ee77526fa1967fb600d747c"/></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="vstudio"><dir name="venu"><file name="venu.css" hash="d0ce993dd723e8009bfd3db14ad4b4ef"/></dir></dir></dir></dir></dir></dir></target></contents>
|
| 55 |
<compatible/>
|
| 56 |
+
<dependencies><required><php><min>5.2.0</min><max>5.5.11</max></php></required></dependencies>
|
| 57 |
</package>
|
skin/adminhtml/default/default/vstudio/venu/venu.css
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#menu_venu {
|
| 2 |
+
width: 50%;
|
| 3 |
+
float: left;
|
| 4 |
+
}
|
| 5 |
+
#menu_venu button {
|
| 6 |
+
background: #f00;
|
| 7 |
+
color: #fff;
|
| 8 |
+
padding: .5em;
|
| 9 |
+
margin: .5em;
|
| 10 |
+
float: right;
|
| 11 |
+
}
|
| 12 |
+
#menu_venu div {
|
| 13 |
+
width: 100%;
|
| 14 |
+
float: left;
|
| 15 |
+
}
|
| 16 |
+
#menu_venu li {
|
| 17 |
+
float: left;
|
| 18 |
+
width: 94%;
|
| 19 |
+
padding: 1%;
|
| 20 |
+
margin: 1%;
|
| 21 |
+
border: 1px solid #ccc;
|
| 22 |
+
}
|
| 23 |
+
#menu_venu li h4 {
|
| 24 |
+
text-transform: uppercase;
|
| 25 |
+
float: left;
|
| 26 |
+
width: 100%;
|
| 27 |
+
}
|
| 28 |
+
#menu_venu li h4:hover {
|
| 29 |
+
cursor: pointer;
|
| 30 |
+
}
|
| 31 |
+
#menu_venu li input {
|
| 32 |
+
width: 80%;
|
| 33 |
+
padding: 0.5em;
|
| 34 |
+
margin: 0.5em;
|
| 35 |
+
}
|
| 36 |
+
#menu_venu li input:focus {
|
| 37 |
+
background: #cff9bb;
|
| 38 |
+
color: #1a1a1a;
|
| 39 |
+
}
|
| 40 |
+
#menu_venu li ul {
|
| 41 |
+
padding-left: 2%;
|
| 42 |
+
}
|
| 43 |
+
#menu_venu li span {
|
| 44 |
+
height: 100%;
|
| 45 |
+
background: #f5f4f4;
|
| 46 |
+
float: left;
|
| 47 |
+
width: 100%;
|
| 48 |
+
margin: 10px auto;
|
| 49 |
+
}
|
| 50 |
+
#menu_venu li ul li {
|
| 51 |
+
background: #cff9bb;
|
| 52 |
+
}
|
| 53 |
+
#menu_venu li ul li ul li {
|
| 54 |
+
background: #fdfdd0;
|
| 55 |
+
}
|
| 56 |
+
#menu_venu li ul li ul li ul li {
|
| 57 |
+
background: #ccddeb
|
| 58 |
+
}
|
| 59 |
+
#menu_venu li span h4 {
|
| 60 |
+
|
| 61 |
+
text-transform: uppercase;
|
| 62 |
+
padding: 0.5em;
|
| 63 |
+
margin: 0;
|
| 64 |
+
}
|
| 65 |
+
#menu_venu .placeholder {
|
| 66 |
+
visibility: hidden;
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
.hoverActive {
|
| 70 |
+
background-color: #ffffcc;
|
| 71 |
+
}
|
