ajaxified_product_edit - Version 0.1.0

Version Notes

This module will help you manage the product attributes.

Download this release

Release Info

Developer Marcin Frymark
Extension ajaxified_product_edit
Version 0.1.0
Comparing to
See all releases


Version 0.1.0

Files changed (59) hide show
  1. app/code/community/Alekseon/AdminNotification/Block/Adminhtml/System/Config/Form/Field/Notification.php +16 -0
  2. app/code/community/Alekseon/AdminNotification/Helper/Data.php +10 -0
  3. app/code/community/Alekseon/AdminNotification/Model/Feed.php +95 -0
  4. app/code/community/Alekseon/AdminNotification/Model/Observer.php +18 -0
  5. app/code/community/Alekseon/AdminNotification/etc/adminhtml.xml +31 -0
  6. app/code/community/Alekseon/AdminNotification/etc/config.xml +48 -0
  7. app/code/community/Alekseon/AdminNotification/etc/system.xml +74 -0
  8. app/code/community/Alekseon/AjaxifiedProductEdit/Block/Adminhtml/GridView.php +1 -0
  9. app/code/community/Alekseon/AjaxifiedProductEdit/Block/Adminhtml/GridView/Grid.php +236 -0
  10. app/code/community/Alekseon/AjaxifiedProductEdit/Block/Adminhtml/GridView/Grid/Renderer/Input.php +139 -0
  11. app/code/community/Alekseon/AjaxifiedProductEdit/Block/Adminhtml/GridView/Grid/Renderer/SaveButton.php +18 -0
  12. app/code/community/Alekseon/AjaxifiedProductEdit/Block/Adminhtml/GridView/Manager.php +19 -0
  13. app/code/community/Alekseon/AjaxifiedProductEdit/Block/Adminhtml/GridView/Manager/Edit.php +32 -0
  14. app/code/community/Alekseon/AjaxifiedProductEdit/Block/Adminhtml/GridView/Manager/Edit/Form.php +28 -0
  15. app/code/community/Alekseon/AjaxifiedProductEdit/Block/Adminhtml/GridView/Manager/Edit/Tabs.php +17 -0
  16. app/code/community/Alekseon/AjaxifiedProductEdit/Block/Adminhtml/GridView/Manager/Edit/Tabs/General.php +137 -0
  17. app/code/community/Alekseon/AjaxifiedProductEdit/Block/Adminhtml/GridView/Manager/Edit/Tabs/ManageColumns.php +44 -0
  18. app/code/community/Alekseon/AjaxifiedProductEdit/Block/Adminhtml/GridView/Manager/Edit/Tabs/ManageColumns/Attributes.php +169 -0
  19. app/code/community/Alekseon/AjaxifiedProductEdit/Block/Adminhtml/GridView/Manager/Grid.php +63 -0
  20. app/code/community/Alekseon/AjaxifiedProductEdit/Block/Adminhtml/GridViewSwitcher.php +29 -0
  21. app/code/community/Alekseon/AjaxifiedProductEdit/Block/Adminhtml/Store/Switcher.php +1 -0
  22. app/code/community/Alekseon/AjaxifiedProductEdit/Block/Adminhtml/System/Config/Form/Field/ManageGridViewsButton.php +1 -0
  23. app/code/community/Alekseon/AjaxifiedProductEdit/Helper/Data.php +70 -0
  24. app/code/community/Alekseon/AjaxifiedProductEdit/Model/GridView.php +47 -0
  25. app/code/community/Alekseon/AjaxifiedProductEdit/Model/Resource/GridView.php +68 -0
  26. app/code/community/Alekseon/AjaxifiedProductEdit/Model/Resource/GridView/Attribute/Collection.php +41 -0
  27. app/code/community/Alekseon/AjaxifiedProductEdit/Model/Resource/GridView/Collection.php +14 -0
  28. app/code/community/Alekseon/AjaxifiedProductEdit/Model/System/Config/Backend/Cache.php +16 -0
  29. app/code/community/Alekseon/AjaxifiedProductEdit/Model/System/Config/Source/ProductAttributes.php +1 -0
  30. app/code/community/Alekseon/AjaxifiedProductEdit/Model/System/Config/Source/UserRole.php +29 -0
  31. app/code/community/Alekseon/AjaxifiedProductEdit/controllers/Adminhtml/AjaxifiedProductEdit/ManageGridViewsController.php +120 -0
  32. app/code/community/Alekseon/AjaxifiedProductEdit/controllers/Adminhtml/AjaxifiedProductEditController.php +139 -0
  33. app/code/community/Alekseon/AjaxifiedProductEdit/etc/adminhtml.xml +73 -0
  34. app/code/community/Alekseon/AjaxifiedProductEdit/etc/config.xml +1 -1
  35. app/code/community/Alekseon/AjaxifiedProductEdit/etc/logging.xml +18 -0
  36. app/code/community/Alekseon/AjaxifiedProductEdit/etc/system.xml +94 -0
  37. app/code/community/Alekseon/AjaxifiedProductEdit/sql/alekseon_ajaxifiedproductedit_setup/mysql4-install-0.1.0.php +34 -0
  38. app/code/community/Alekseon/Core/Block/Adminhtml/System/Config/Fieldset/Alekseon.php +11 -0
  39. app/code/community/Alekseon/Core/Helper/Data.php +19 -0
  40. app/code/community/Alekseon/Core/etc/config.xml +28 -0
  41. app/design/adminhtml/default/default/layout/alekseon/ajaxifiedProductEdit.xml +88 -0
  42. app/design/adminhtml/default/default/template/alekseon/ajaxifiedProductEdit/grid/input/boolean.phtml +28 -0
  43. app/design/adminhtml/default/default/template/alekseon/ajaxifiedProductEdit/grid/input/date.phtml +1 -0
  44. app/design/adminhtml/default/default/template/alekseon/ajaxifiedProductEdit/grid/input/hidden.phtml +1 -0
  45. app/design/adminhtml/default/default/template/alekseon/ajaxifiedProductEdit/grid/input/multiselect.phtml +29 -0
  46. app/design/adminhtml/default/default/template/alekseon/ajaxifiedProductEdit/grid/input/price.phtml +1 -0
  47. app/design/adminhtml/default/default/template/alekseon/ajaxifiedProductEdit/grid/input/save.phtml +14 -0
  48. app/design/adminhtml/default/default/template/alekseon/ajaxifiedProductEdit/grid/input/select.phtml +28 -0
  49. app/design/adminhtml/default/default/template/alekseon/ajaxifiedProductEdit/grid/input/text.phtml +1 -0
  50. app/design/adminhtml/default/default/template/alekseon/ajaxifiedProductEdit/grid/input/textarea.phtml +1 -0
  51. app/design/adminhtml/default/default/template/alekseon/ajaxifiedProductEdit/grid/input/usedefault.phtml +1 -0
  52. app/design/adminhtml/default/default/template/alekseon/ajaxifiedProductEdit/gridView.phtml +77 -0
  53. app/design/adminhtml/default/default/template/alekseon/ajaxifiedProductEdit/gridViewSwitcher.phtml +36 -0
  54. app/design/adminhtml/default/default/template/alekseon/ajaxifiedProductEdit/store/switcher.phtml +51 -0
  55. app/etc/modules/Alekseon_AdminNotification.xml +21 -0
  56. app/etc/modules/Alekseon_AjaxifiedProductEdit.xml +17 -0
  57. app/etc/modules/Alekseon_Core.xml +17 -0
  58. package.xml +20 -0
  59. skin/adminhtml/default/default/js/alekseon/ajaxifiedProductEdit.js +1 -0
app/code/community/Alekseon/AdminNotification/Block/Adminhtml/System/Config/Form/Field/Notification.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Marcin Frymark
4
+ * @email contact@alekseon.com
5
+ * @company Alekseon
6
+ * @website www.alekseon.com
7
+ */
8
+ class Alekseon_AdminNotification_Block_Adminhtml_System_Config_Form_Field_Notification extends Mage_Adminhtml_Block_System_Config_Form_Field
9
+ {
10
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
11
+ {
12
+ $element->setValue(Mage::app()->loadCache(Alekseon_AdminNotification_Model_Feed::NOTIFICANTION_LASTCHECK_CACHE_KEY));
13
+ $format = Mage::app()->getLocale()->getDateTimeFormat(Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM);
14
+ return Mage::app()->getLocale()->date(intval($element->getValue()))->toString($format);
15
+ }
16
+ }
app/code/community/Alekseon/AdminNotification/Helper/Data.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Marcin Frymark
4
+ * @email contact@alekseon.com
5
+ * @company Alekseon
6
+ * @website www.alekseon.com
7
+ */
8
+ class Alekseon_AdminNotification_Helper_Data extends Mage_Core_Helper_Abstract
9
+ {
10
+ }
app/code/community/Alekseon/AdminNotification/Model/Feed.php ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Marcin Frymark
4
+ * @email contact@alekseon.com
5
+ * @company Alekseon
6
+ * @website www.alekseon.com
7
+ */
8
+ class Alekseon_AdminNotification_Model_Feed extends Mage_AdminNotification_Model_Feed
9
+ {
10
+ const XML_ENABLED_PATH = 'alekseon_adminNotification/general/enabled';
11
+ const XML_FREQUENCY_PATH = 'alekseon_adminNotification/general/frequency';
12
+ const NOTIFICANTION_LASTCHECK_CACHE_KEY = 'alekseon_notifications_lastcheck';
13
+
14
+ protected $_alekseonInstalledModules;
15
+
16
+ public function getFeedUrl()
17
+ {
18
+ if (is_null($this->_feedUrl)) {
19
+ $this->_feedUrl = Mage::helper('alekseon_core')->getAlekseonUrl() . '/rss/magento_rss.xml';
20
+ $query = '?utm_source=' . urlencode(Mage::getStoreConfig('web/unsecure/base_url'));
21
+ $query .= '&utm_medium=' . urlencode('Magento Connect');
22
+ $query .= '&utm_content=' . urlencode(Mage::getEdition() . ' ' . Mage::getVersion());
23
+ $query .= '&utm_term=' . urlencode(implode(',', $this->_getAlekseonInstalledModules()));
24
+
25
+ $this->_feedUrl .= $query;
26
+ }
27
+
28
+ return $this->_feedUrl;
29
+ }
30
+
31
+ public function checkUpdate()
32
+ {
33
+ if (!Mage::getStoreConfig(self::XML_ENABLED_PATH)) {
34
+ return $this;
35
+ }
36
+
37
+ if (($this->getFrequency() + $this->getLastUpdate()) > time()) {
38
+ return $this;
39
+ }
40
+
41
+ $feedData = array();
42
+ $feedXml = $this->getFeedData();
43
+
44
+ if ($feedXml && $feedXml->channel && $feedXml->channel->item) {
45
+ foreach ($feedXml->channel->item as $item) {
46
+
47
+ $module = (string)$item->module;
48
+ if ($module && !in_array($module, $this->_getAlekseonInstalledModules())) {
49
+ continue;
50
+ }
51
+
52
+ $feedData[] = array(
53
+ 'severity' => (int)$item->severity,
54
+ 'date_added' => $this->getDate((string)$item->pubDate),
55
+ 'title' => (string)$item->title,
56
+ 'description' => (string)$item->description,
57
+ 'url' => (string)$item->link,
58
+ );
59
+ }
60
+
61
+ if ($feedData) {
62
+ Mage::getModel('adminnotification/inbox')->parse(array_reverse($feedData));
63
+ }
64
+
65
+ }
66
+ $this->setLastUpdate();
67
+
68
+ return $this;
69
+ }
70
+
71
+ public function getLastUpdate()
72
+ {
73
+ return Mage::app()->loadCache(self::NOTIFICANTION_LASTCHECK_CACHE_KEY);
74
+ }
75
+
76
+ public function setLastUpdate()
77
+ {
78
+ Mage::app()->saveCache(time(), self::NOTIFICANTION_LASTCHECK_CACHE_KEY);
79
+ return $this;
80
+ }
81
+
82
+ protected function _getAlekseonInstalledModules()
83
+ {
84
+ if (is_null($this->_alekseonInstalledModules)) {
85
+ $modules = array_keys((array)Mage::getConfig()->getNode('modules')->children());
86
+ $this->_alekseonInstalledModules = array();
87
+ foreach ($modules as $moduleName) {
88
+ if (substr($moduleName, 0, 9) == 'Alekseon_'){
89
+ $this->_alekseonInstalledModules[] = $moduleName;
90
+ }
91
+ }
92
+ }
93
+ return $this->_alekseonInstalledModules;
94
+ }
95
+ }
app/code/community/Alekseon/AdminNotification/Model/Observer.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Marcin Frymark
4
+ * @email contact@alekseon.com
5
+ * @company Alekseon
6
+ * @website www.alekseon.com
7
+ */
8
+ class Alekseon_AdminNotification_Model_Observer
9
+ {
10
+ public function preDispatch(Varien_Event_Observer $observer)
11
+ {
12
+ if (Mage::getSingleton('admin/session')->isLoggedIn()) {
13
+ $feedModel = Mage::getModel('alekseon_adminNotification/feed');
14
+ $feedModel->checkUpdate();
15
+ }
16
+
17
+ }
18
+ }
app/code/community/Alekseon/AdminNotification/etc/adminhtml.xml ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * @author Marcin Frymark
5
+ * @email contact@alekseon.com
6
+ * @company Alekseon
7
+ * @website www.alekseon.com
8
+ */
9
+ -->
10
+ <config>
11
+ <acl>
12
+ <resources>
13
+ <admin>
14
+ <children>
15
+ <system>
16
+ <children>
17
+ <config>
18
+ <children>
19
+ <alekseon_adminNotification translate="title">
20
+ <title>Alekseon Notifications</title>
21
+ <sort_order>10</sort_order>
22
+ </alekseon_adminNotification>
23
+ </children>
24
+ </config>
25
+ </children>
26
+ </system>
27
+ </children>
28
+ </admin>
29
+ </resources>
30
+ </acl>
31
+ </config>
app/code/community/Alekseon/AdminNotification/etc/config.xml ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * @author Marcin Frymark
5
+ * @email contact@alekseon.com
6
+ * @company Alekseon
7
+ * @website www.alekseon.com
8
+ */
9
+ -->
10
+ <config>
11
+ <modules>
12
+ <Alekseon_AdminNotification>
13
+ <version>0.1.0</version>
14
+ </Alekseon_AdminNotification>
15
+ </modules>
16
+ <global>
17
+ <models>
18
+ <alekseon_adminNotification>
19
+ <class>Alekseon_AdminNotification_Model</class>
20
+ </alekseon_adminNotification>
21
+ </models>
22
+ <helpers>
23
+ <alekseon_adminNotification>
24
+ <class>Alekseon_AdminNotification_Helper</class>
25
+ </alekseon_adminNotification>
26
+ </helpers>
27
+ </global>
28
+ <adminhtml>
29
+ <events>
30
+ <controller_action_predispatch>
31
+ <observers>
32
+ <alekseon_adminNotification>
33
+ <class>alekseon_adminNotification/observer</class>
34
+ <method>preDispatch</method>
35
+ </alekseon_adminNotification>
36
+ </observers>
37
+ </controller_action_predispatch>
38
+ </events>
39
+ </adminhtml>
40
+ <default>
41
+ <alekseon_adminNotification>
42
+ <general>
43
+ <enabled>1</enabled>
44
+ <frequency>12</frequency>
45
+ </general>
46
+ </alekseon_adminNotification>
47
+ </default>
48
+ </config>
app/code/community/Alekseon/AdminNotification/etc/system.xml ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * @author Marcin Frymark
5
+ * @email contact@alekseon.com
6
+ * @company Alekseon
7
+ * @website www.alekseon.com
8
+ */
9
+ -->
10
+ <config>
11
+ <tabs>
12
+ <alekseon>
13
+ <label>Alekseon</label>
14
+ <sort_order>450</sort_order>
15
+ </alekseon>
16
+ </tabs>
17
+ <sections>
18
+ <alekseon_adminNotification translate="label" module="alekseon_adminNotification">
19
+ <label>Alekseon Notifications</label>
20
+ <tab>alekseon</tab>
21
+ <frontend_type>text</frontend_type>
22
+ <sort_order>10</sort_order>
23
+ <show_in_default>1</show_in_default>
24
+ <show_in_website>0</show_in_website>
25
+ <show_in_store>0</show_in_store>
26
+ <groups>
27
+ <hint>
28
+ <frontend_model>alekseon_core/adminhtml_system_config_fieldset_alekseon</frontend_model>
29
+ <sort_order>0</sort_order>
30
+ <show_in_default>1</show_in_default>
31
+ <show_in_website>1</show_in_website>
32
+ <show_in_store>1</show_in_store>
33
+ </hint>
34
+ <general translate="label" module="alekseon_adminNotification">
35
+ <label>General Options</label>
36
+ <frontend_type>text</frontend_type>
37
+ <sort_order>10</sort_order>
38
+ <show_in_default>1</show_in_default>
39
+ <show_in_website>0</show_in_website>
40
+ <show_in_store>0</show_in_store>
41
+ <fields>
42
+ <enabled translate="label">
43
+ <label>Enabled</label>
44
+ <source_model>adminhtml/system_config_source_yesno</source_model>
45
+ <frontend_type>select</frontend_type>
46
+ <sort_order>10</sort_order>
47
+ <show_in_default>1</show_in_default>
48
+ <show_in_website>0</show_in_website>
49
+ <show_in_store>0</show_in_store>
50
+ </enabled>
51
+ <frequency translate="label">
52
+ <label>Update Frequency</label>
53
+ <frontend_type>select</frontend_type>
54
+ <source_model>adminhtml/system_config_source_notification_frequency</source_model>
55
+ <sort_order>20</sort_order>
56
+ <show_in_default>1</show_in_default>
57
+ <show_in_website>0</show_in_website>
58
+ <show_in_store>0</show_in_store>
59
+ </frequency>
60
+ <last_update translate="label">
61
+ <label>Last Update</label>
62
+ <frontend_type>label</frontend_type>
63
+ <frontend_model>adminhtml/system_config_form_field_notification</frontend_model>
64
+ <sort_order>30</sort_order>
65
+ <show_in_default>1</show_in_default>
66
+ <show_in_website>0</show_in_website>
67
+ <show_in_store>0</show_in_store>
68
+ </last_update>
69
+ </fields>
70
+ </general>
71
+ </groups>
72
+ </alekseon_adminNotification>
73
+ </sections>
74
+ </config>
app/code/community/Alekseon/AjaxifiedProductEdit/Block/Adminhtml/GridView.php ADDED
@@ -0,0 +1 @@
 
0
  * @author Marcin Frymark
1
  * @email contact@alekseon.com
2
  * @company Alekseon
3
  * @website www.alekseon.com
4
  */
5
  class Alekseon_AjaxifiedProductEdit_Block_Adminhtml_GridView extends Mage_Adminhtml_Block_Widget_Container
6
  {
7
  protected function _prepareLayout()
8
  {
9
  $this->_addButton('back', array(
10
  'label' => Mage::helper('alekseon_ajaxifiedProductEdit')->__('Back'),
11
  'onclick' => "if (alertIfDataHasChanged()) { setLocation('{$this->getUrl('adminhtml/catalog_product', array('_current'=>true))}'); } else { return false; }",
12
  'class' => 'back'
13
  ));
14
  $this->setChild('gridView_grid', $this->getLayout()->createBlock('alekseon_ajaxifiedProductEdit/adminhtml_gridView_grid', 'gridView.grid'));
15
  return parent::_prepareLayout();
16
  }
17
 
18
  public function isSingleStoreMode()
19
  {
20
  if (!Mage::app()->isSingleStoreMode()) {
21
  return false;
22
  }
23
  return true;
24
  }
25
 
26
  public function getGridHtml()
27
  {
28
  return $this->getChildHtml('gridView_grid');
29
  }
30
 
31
  public function getStoreId()
32
  {
33
  $storeId = (int) $this->getRequest()->getParam('store', 0);
34
  return $storeId;
35
  }
36
  }
1
+ <?php
2
  * @author Marcin Frymark
3
  * @email contact@alekseon.com
4
  * @company Alekseon
5
  * @website www.alekseon.com
6
  */
7
  class Alekseon_AjaxifiedProductEdit_Block_Adminhtml_GridView extends Mage_Adminhtml_Block_Widget_Container
8
  {
9
  protected function _prepareLayout()
10
  {
11
  $this->_addButton('back', array(
12
  'label' => Mage::helper('alekseon_ajaxifiedProductEdit')->__('Back'),
13
  'onclick' => "if (alertIfDataHasChanged()) { setLocation('{$this->getUrl('adminhtml/catalog_product', array('_current'=>true))}'); } else { return false; }",
14
  'class' => 'back'
15
  ));
16
  $this->setChild('gridView_grid', $this->getLayout()->createBlock('alekseon_ajaxifiedProductEdit/adminhtml_gridView_grid', 'gridView.grid'));
17
  return parent::_prepareLayout();
18
  }
19
 
20
  public function isSingleStoreMode()
21
  {
22
  if (!Mage::app()->isSingleStoreMode()) {
23
  return false;
24
  }
25
  return true;
26
  }
27
 
28
  public function getGridHtml()
29
  {
30
  return $this->getChildHtml('gridView_grid');
31
  }
32
 
33
  public function getStoreId()
34
  {
35
  $storeId = (int) $this->getRequest()->getParam('store', 0);
36
  return $storeId;
37
  }
38
  }
app/code/community/Alekseon/AjaxifiedProductEdit/Block/Adminhtml/GridView/Grid.php ADDED
@@ -0,0 +1,236 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Marcin Frymark
4
+ * @email contact@alekseon.com
5
+ * @company Alekseon
6
+ * @website www.alekseon.com
7
+ */
8
+ class Alekseon_AjaxifiedProductEdit_Block_Adminhtml_GridView_Grid extends Mage_Adminhtml_Block_Widget_Grid
9
+ {
10
+ protected $_attributesColumns;
11
+ protected $_selectedAttributes;
12
+
13
+ public function __construct()
14
+ {
15
+ parent::__construct();
16
+ $this->setId('grid_view_' . $this->_getCurrentGridView()->getId());
17
+ $this->setDefaultSort('entity_id');
18
+ $this->setDefaultDir('DESC');
19
+ $this->setSaveParametersInSession(true);
20
+ }
21
+
22
+ protected function _prepareLayout()
23
+ {
24
+ $this->setChild('attributes_selector',
25
+ $this->getLayout()->createBlock('adminhtml/widget_button')
26
+ ->setData(array(
27
+ 'label' => Mage::helper('adminhtml')->__('Select attributes'),
28
+ 'onclick' => "$('attributes_selector').show(); return false;",
29
+ 'class' => 'task'
30
+ ))
31
+ );
32
+
33
+ $this->setChild('reset_filter_button',
34
+ $this->getLayout()->createBlock('adminhtml/widget_button')
35
+ ->setData(array(
36
+ 'label' => Mage::helper('adminhtml')->__('Reset Filter'),
37
+ 'onclick' => 'if (alertIfDataHasChanged()) {' . $this->getJsObjectName().'.resetFilter(); } else { return false; }',
38
+ ))
39
+ );
40
+
41
+ $this->setChild('search_button',
42
+ $this->getLayout()->createBlock('adminhtml/widget_button')
43
+ ->setData(array(
44
+ 'label' => Mage::helper('adminhtml')->__('Search'),
45
+ 'onclick' => 'if (alertIfDataHasChanged()) {' . $this->getJsObjectName().'.doFilter(); } else { return false; }',
46
+ 'class' => 'task'
47
+ ))
48
+ );
49
+
50
+ return Mage_Adminhtml_Block_Widget::_prepareLayout();
51
+ }
52
+
53
+ public function getMainButtonsHtml()
54
+ {
55
+ $html = '';
56
+ if($this->getFilterVisibility()) {
57
+ $html.= $this->getResetFilterButtonHtml();
58
+ $html.= $this->getSearchButtonHtml();
59
+ }
60
+ return $html;
61
+ }
62
+
63
+ protected function _getStore()
64
+ {
65
+ $storeId = (int) $this->getRequest()->getParam('store', 0);
66
+ return Mage::app()->getStore($storeId);
67
+ }
68
+
69
+ protected function _getCurrentGridView()
70
+ {
71
+ return Mage::helper('alekseon_ajaxifiedProductEdit')->getCurrentGridView();
72
+ }
73
+
74
+ protected function _getSelectedAttributes()
75
+ {
76
+ $gridView = $this->_getCurrentGridView();
77
+ if (is_null($this->_selectedAttributes)) {
78
+ $this->_selectedAttributes = array();
79
+ $collection = Mage::getResourceModel('alekseon_ajaxifiedProductEdit/gridView_attribute_collection');
80
+ $collection->setGridViewId($gridView->getId());
81
+ $collection->setOrder('gridview_selectedattributes_position', 'ASC');
82
+ foreach($collection as $attribute) {
83
+ if ($attribute->getGridviewSelectedattributesGridviewid() == $gridView->getId()) {
84
+ $this->_selectedAttributes[] = $attribute;
85
+ }
86
+ }
87
+ }
88
+
89
+ return $this->_selectedAttributes;
90
+ }
91
+
92
+
93
+ protected function _getAttributesColumns()
94
+ {
95
+ if (is_null($this->_attributesColumns)) {
96
+
97
+ $this->_attributesColumns = array();
98
+ foreach($this->_getSelectedAttributes() as $attribute) {
99
+ if ($attribute->getId()) {
100
+ $columnData = array(
101
+ 'attribute' => $attribute,
102
+ 'label' => $attribute->getFrontendLabel(),
103
+ 'scope' => $attribute->getIsGlobal(),
104
+ 'input' => $attribute->getFrontendInput(),
105
+ 'options' => Mage::helper('alekseon_ajaxifiedProductEdit')->getAttributeOptions($attribute),
106
+ 'editable' => false,
107
+ 'renderer' => false,
108
+ );
109
+
110
+ if ($attribute->getGridviewSelectedattributesEditable()) {
111
+ $columnData['renderer'] = 'alekseon_ajaxifiedProductEdit/adminhtml_gridView_grid_renderer_input';
112
+ $columnData['editable'] = true;
113
+ }
114
+
115
+ $this->_attributesColumns[$attribute->getAttributeCode()] = $columnData;
116
+ }
117
+ }
118
+ }
119
+
120
+ return $this->_attributesColumns;
121
+ }
122
+
123
+ protected function _prepareCollection($productIds = array())
124
+ {
125
+ $store = $this->_getStore();
126
+ $collection = Mage::getModel('catalog/product')->getCollection();
127
+
128
+ if (!empty($productIds)) {
129
+ $collection->addFieldToFilter('entity_id', array('in' => $productIds));
130
+ }
131
+
132
+ if ($store->getId()) {
133
+ $adminStore = Mage_Core_Model_App::ADMIN_STORE_ID;
134
+ foreach($this->_getAttributesColumns() as $attribute => $data) {
135
+ if ($data['scope'] !== false && $data['scope'] != Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL) {
136
+ $collection->joinAttribute($attribute, 'catalog_product/' . $attribute, 'entity_id', null, 'left', $store->getId());
137
+ $collection->joinAttribute($attribute . '_defaultValue', 'catalog_product/' . $attribute, 'entity_id', null, 'left', $adminStore);
138
+ } else {
139
+ $collection->addAttributeToSelect($attribute);
140
+ }
141
+ }
142
+ $collection->addStoreFilter($store);
143
+ } else {
144
+ foreach($this->_getAttributesColumns() as $attribute => $data) {
145
+ $collection->addAttributeToSelect($attribute);
146
+ }
147
+ }
148
+
149
+ $this->setCollection($collection);
150
+
151
+ parent::_prepareCollection();
152
+ return $this;
153
+ }
154
+
155
+ protected function _prepareColumns()
156
+ {
157
+ $this->addColumn('entity_id',
158
+ array(
159
+ 'header'=> Mage::helper('catalog')->__('ID'),
160
+ 'width' => '50px',
161
+ 'type' => 'number',
162
+ 'index' => 'entity_id',
163
+ 'input_type' => 'hidden',
164
+ 'renderer' => 'alekseon_ajaxifiedProductEdit/adminhtml_gridView_grid_renderer_input',
165
+ ));
166
+
167
+ $this->addColumn('type',
168
+ array(
169
+ 'header'=> Mage::helper('catalog')->__('Type'),
170
+ 'width' => '60px',
171
+ 'index' => 'type_id',
172
+ 'type' => 'options',
173
+ 'options' => Mage::getSingleton('catalog/product_type')->getOptionArray(),
174
+ ));
175
+
176
+ foreach($this->_getAttributesColumns() as $attribute => $data) {
177
+ $columnSettings = array(
178
+ 'attribute' => $data['attribute'],
179
+ 'header' => Mage::helper('catalog')->__($data['label']) . '<br/>' . $this->_getScope($data['scope']),
180
+ 'index' => $attribute,
181
+ 'input_type' => $data['input'],
182
+ 'scope' => $data['scope'],
183
+ 'options' => $data['options'],
184
+ 'renderer' => $data['renderer'],
185
+ 'editable' => $data['editable'],
186
+ );
187
+
188
+ if ($data['options']) {
189
+ $columnSettings['type'] = 'options';
190
+ }
191
+
192
+ $this->addColumn($attribute, $columnSettings);
193
+ }
194
+
195
+ $this->addColumn('save_button',
196
+ array(
197
+ 'header' => '',
198
+ 'renderer' => 'alekseon_ajaxifiedProductEdit/adminhtml_gridView_grid_renderer_saveButton',
199
+ 'filter' => false,
200
+ ));
201
+
202
+ return parent::_prepareColumns();
203
+ }
204
+
205
+ protected function _getScope($scope)
206
+ {
207
+ if (is_null($scope)) {
208
+ $scope = 0;
209
+ }
210
+
211
+ $scopes = array(
212
+ Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE =>Mage::helper('catalog')->__('Store View'),
213
+ Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE =>Mage::helper('catalog')->__('Website'),
214
+ Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL =>Mage::helper('catalog')->__('Global'),
215
+ );
216
+
217
+ if ($scope!==false && array_key_exists($scope, $scopes)) {
218
+ return '<span class="scope-label">[' . $scopes[$scope] . ']</span>';
219
+ } else {
220
+ return false;
221
+ }
222
+ }
223
+
224
+ public function getRowUrl($row)
225
+ {
226
+ return false;
227
+ }
228
+
229
+ public function prepareRow($productId)
230
+ {
231
+ $this->_prepareColumns();
232
+ $this->_prepareCollection(array($productId));
233
+
234
+ return $this;
235
+ }
236
+ }
app/code/community/Alekseon/AjaxifiedProductEdit/Block/Adminhtml/GridView/Grid/Renderer/Input.php ADDED
@@ -0,0 +1,139 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Marcin Frymark
4
+ * @email contact@alekseon.com
5
+ * @company Alekseon
6
+ * @website www.alekseon.com
7
+ */
8
+ class Alekseon_AjaxifiedProductEdit_Block_Adminhtml_GridView_Grid_Renderer_Input extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
9
+ {
10
+ protected $_attributeSets = array();
11
+ protected $_inputBlock;
12
+ protected $_useDefaultBlock;
13
+
14
+ public function getInputBlock()
15
+ {
16
+ if (is_null($this->_inputBlock)) {
17
+ $inputType = $this->getColumn()->getInputType();
18
+ $blockName = strtolower($inputType) . '_input';
19
+ $this->_inputBlock = $this->getLayout()->getBlock($blockName);
20
+ }
21
+ return $this->_inputBlock;
22
+ }
23
+
24
+ public function getUseDefaultBlock()
25
+ {
26
+ if (is_null($this->_useDefaultBlock)) {
27
+ $inputType = $this->getColumn()->getInputType();
28
+ $blockName = 'use_default';
29
+ $this->_useDefaultBlock = $this->getLayout()->getBlock($blockName);
30
+ }
31
+ return $this->_useDefaultBlock;
32
+ }
33
+
34
+ public function render(Varien_Object $row)
35
+ {
36
+ $id = 'field[' . $row->getData('entity_id') . '][' . $this->getColumn()->getIndex() . ']';
37
+ return '<span id="' . $id . '">' . $this->_renderField($row) . '</span>';
38
+ }
39
+
40
+ protected function _renderField(Varien_Object $row)
41
+ {
42
+ $column = $this->getColumn();
43
+ $index = $column->getIndex();
44
+ $attribute = $column->getAttribute();
45
+ if ($attribute && $attribute->getApplyTo() && !in_array($row->getData('type_id'), $attribute->getApplyTo())) {
46
+ return '<i style="color:grey">' . Mage::helper('alekseon_ajaxifiedProductEdit')->__('Not available for %s product.', $row->getData('type_id')) . '</i>';
47
+ } elseif (!$this->_isAttributeInAttributeSet($index, $row->getData('attribute_set_id'))) {
48
+ return '<i style="color:grey">' . Mage::helper('alekseon_ajaxifiedProductEdit')->__('Not available for this attribute set.') . '</i>';
49
+ } elseif ($inputBlock = $this->getInputBlock()) {
50
+ $scope = $column->getScope();
51
+ $value = $row->getData($index);
52
+ $defaultValue = $row->getData($index . '_defaultValue');
53
+ $rowId = $row->getData('entity_id');
54
+ $name = 'product[' . $rowId . '][' . $index . ']';
55
+
56
+ $canUseDefault = false;
57
+ $useDefault = false;
58
+
59
+ if ($this->_getStoreId() && !is_null($scope) && $scope != Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL) {
60
+ $canUseDefault = true;
61
+ if ($value == $defaultValue) {
62
+ $useDefault = true;
63
+ }
64
+ }
65
+
66
+ $inputBlock->setValue($value);
67
+ $inputBlock->setName($name);
68
+ $inputBlock->setRowId($rowId);
69
+ $inputBlock->setRow($row->getData());
70
+ $inputBlock->setColumn($column);
71
+ $inputBlock->setDisabled(false);
72
+ if ($useDefault) {
73
+ $inputBlock->setHidden(true);
74
+ } else {
75
+ $inputBlock->setHidden(false);
76
+ }
77
+
78
+ $html = $inputBlock->_toHtml();
79
+
80
+ if ($canUseDefault) {
81
+ /* default input */
82
+ $inputBlock->setValue($defaultValue);
83
+ $inputBlock->setDisabled(true);
84
+ $inputBlock->setName($name . '[default_value]');
85
+
86
+ if ($useDefault) {
87
+ $inputBlock->setHidden(false);
88
+ } else {
89
+ $inputBlock->setHidden(true);
90
+ }
91
+
92
+ $html .= $inputBlock->_toHtml();
93
+
94
+ $useDefaultBlock = $this->getUseDefaultBlock();
95
+ $useDefaultBlock->setIsChecked($useDefault);
96
+ $useDefaultBlock->setRowId($rowId);
97
+ $useDefaultBlock->setName($name);
98
+ $html .= $useDefaultBlock->_toHtml();
99
+ }
100
+
101
+ return $html;
102
+ } else {
103
+ return '<i style="color:grey">' . Mage::helper('alekseon_ajaxifiedProductEdit')->__('Attribute type %s is not supported', '<b>' . $this->getColumn()->getInputType() . '</b>') . '</i>';
104
+ }
105
+ }
106
+
107
+ protected function _getStoreId()
108
+ {
109
+ $storeId = Mage::registry('current_storeId', 0);
110
+ return $storeId;
111
+ }
112
+
113
+ public function renderHeader()
114
+ {
115
+ if ($block = $this->getInputBlock()) {
116
+ return parent::renderHeader();
117
+ } else {
118
+ return $this->getColumn()->getHeader();
119
+ }
120
+ }
121
+
122
+ protected function _isAttributeInAttributeSet($attributeCode, $attributeSetId)
123
+ {
124
+ if (!isset($this->_attributeSets[$attributeSetId])) {
125
+ $attributesInSet = Mage::getResourceModel('catalog/product_attribute_collection')
126
+ ->setEntityTypeFilter('catalog_product')
127
+ ->setAttributeSetFilter($attributeSetId)
128
+ ->addStoreLabel($this->_getStoreId());
129
+
130
+ $this->_attributeSets[$attributeSetId] = array('entity_id');
131
+
132
+ foreach($attributesInSet as $attribute) {
133
+ $this->_attributeSets[$attributeSetId][] = $attribute->getAttributeCode();
134
+ }
135
+ }
136
+
137
+ return in_array($attributeCode, $this->_attributeSets[$attributeSetId]);
138
+ }
139
+ }
app/code/community/Alekseon/AjaxifiedProductEdit/Block/Adminhtml/GridView/Grid/Renderer/SaveButton.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Marcin Frymark
4
+ * @email contact@alekseon.com
5
+ * @company Alekseon
6
+ * @website www.alekseon.com
7
+ */
8
+ class Alekseon_AjaxifiedProductEdit_Block_Adminhtml_GridView_Grid_Renderer_SaveButton extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
9
+ {
10
+ public function render(Varien_Object $row)
11
+ {
12
+ $rowId = $row->getData('entity_id');
13
+
14
+ $block = $this->getLayout()->getBlock('save_button');
15
+ $block->setRowId($rowId);
16
+ return $block->_toHtml();
17
+ }
18
+ }
app/code/community/Alekseon/AjaxifiedProductEdit/Block/Adminhtml/GridView/Manager.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Marcin Frymark
4
+ * @email contact@alekseon.com
5
+ * @company Alekseon
6
+ * @website www.alekseon.com
7
+ */
8
+ class Alekseon_AjaxifiedProductEdit_Block_Adminhtml_GridView_Manager extends Mage_Adminhtml_Block_Widget_Grid_Container
9
+ {
10
+ public function __construct()
11
+ {
12
+ $this->_blockGroup = 'alekseon_ajaxifiedProductEdit';
13
+ $this->_controller = 'adminhtml_gridView_manager';
14
+ $this->_headerText = Mage::helper('alekseon_ajaxifiedProductEdit')->__('Manage Grid Views');
15
+ $this->_addButtonLabel = Mage::helper('alekseon_ajaxifiedProductEdit')->__('Add New Grid View');
16
+ parent::__construct();
17
+ }
18
+
19
+ }
app/code/community/Alekseon/AjaxifiedProductEdit/Block/Adminhtml/GridView/Manager/Edit.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Marcin Frymark
4
+ * @email contact@alekseon.com
5
+ * @company Alekseon
6
+ * @website www.alekseon.com
7
+ */
8
+ class Alekseon_AjaxifiedProductEdit_Block_Adminhtml_GridView_Manager_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
9
+ {
10
+ public function __construct()
11
+ {
12
+ $this->_mode = 'edit';
13
+ $this->_blockGroup = 'alekseon_ajaxifiedProductEdit';
14
+ $this->_controller = 'adminhtml_gridView_manager';
15
+
16
+ parent::__construct();
17
+ }
18
+
19
+ public function getHeaderText()
20
+ {
21
+ if ($this->_getCurrentGridView()->getId()) {
22
+ return Mage::helper('alekseon_ajaxifiedProductEdit')->__("Edit Grid View '%s'", $this->escapeHtml($this->_getCurrentGridView()->getLabel()));
23
+ } else {
24
+ return Mage::helper('alekseon_ajaxifiedProductEdit')->__('New Grid View');
25
+ }
26
+ }
27
+
28
+ protected function _getCurrentGridView()
29
+ {
30
+ return Mage::helper('alekseon_ajaxifiedProductEdit')->getCurrentGridView();
31
+ }
32
+ }
app/code/community/Alekseon/AjaxifiedProductEdit/Block/Adminhtml/GridView/Manager/Edit/Form.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Marcin Frymark
4
+ * @email contact@alekseon.com
5
+ * @company Alekseon
6
+ * @website www.alekseon.com
7
+ */
8
+ class Alekseon_AjaxifiedProductEdit_Block_Adminhtml_GridView_Manager_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
9
+ {
10
+ protected function _prepareForm()
11
+ {
12
+ $form = new Varien_Data_Form(array(
13
+ 'id' => 'edit_form',
14
+ 'action' => $this->getActionUrl(),
15
+ 'method' => 'post',
16
+ 'enctype' => 'multipart/form-data'
17
+ ));
18
+ $form->setUseContainer(true);
19
+ $this->setForm($form);
20
+
21
+ return parent::_prepareForm();
22
+ }
23
+
24
+ public function getActionUrl()
25
+ {
26
+ return $this->getUrl('adminhtml/ajaxifiedProductEdit_manageGridViews/save');
27
+ }
28
+ }
app/code/community/Alekseon/AjaxifiedProductEdit/Block/Adminhtml/GridView/Manager/Edit/Tabs.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Marcin Frymark
4
+ * @email contact@alekseon.com
5
+ * @company Alekseon
6
+ * @website www.alekseon.com
7
+ */
8
+ class Alekseon_AjaxifiedProductEdit_Block_Adminhtml_GridView_Manager_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
9
+ {
10
+
11
+ public function __construct()
12
+ {
13
+ parent::__construct();
14
+ $this->setId('alekeson_ajaxifiedProductEdit_greidView_manager_tabs');
15
+ $this->setDestElementId('edit_form');
16
+ }
17
+ }
app/code/community/Alekseon/AjaxifiedProductEdit/Block/Adminhtml/GridView/Manager/Edit/Tabs/General.php ADDED
@@ -0,0 +1,137 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Marcin Frymark
4
+ * @email contact@alekseon.com
5
+ * @company Alekseon
6
+ * @website www.alekseon.com
7
+ */
8
+ class Alekseon_AjaxifiedProductEdit_Block_Adminhtml_GridView_Manager_Edit_Tabs_General extends Mage_Adminhtml_Block_Widget_Form implements Mage_Adminhtml_Block_Widget_Tab_Interface
9
+ {
10
+ public function getTabLabel()
11
+ {
12
+ return Mage::helper('alekseon_ajaxifiedProductEdit')->__('General');
13
+ }
14
+
15
+ public function getTabTitle()
16
+ {
17
+ return Mage::helper('alekseon_ajaxifiedProductEdit')->__('General');
18
+ }
19
+
20
+ public function canShowTab()
21
+ {
22
+ return true;
23
+ }
24
+
25
+ public function isHidden()
26
+ {
27
+ return false;
28
+ }
29
+
30
+ protected function _prepareForm()
31
+ {
32
+ $gridView = Mage::registry('current_gridView');
33
+ $data = $gridView->getData();
34
+
35
+ $form = new Varien_Data_Form();
36
+ $this->setForm($form);
37
+
38
+ $fieldset = $form->addFieldset('general', array('legend'=>Mage::helper('alekseon_ajaxifiedProductEdit')->__('General')));
39
+
40
+ if ($gridView->getId()) {
41
+ $fieldset->addField('id', 'hidden', array(
42
+ 'name' => 'id',
43
+ ));
44
+ }
45
+
46
+ $fieldset->addField('label', 'text', array(
47
+ 'label' => Mage::helper('alekseon_ajaxifiedProductEdit')->__('Label'),
48
+ 'class' => 'required-entry',
49
+ 'required' => true,
50
+ 'name' => 'label',
51
+ ));
52
+
53
+ $fieldset->addField('description', 'textarea', array(
54
+ 'label' => Mage::helper('alekseon_ajaxifiedProductEdit')->__('Description'),
55
+ 'name' => 'description',
56
+ ));
57
+
58
+ $fieldset->addField('enable', 'select', array(
59
+ 'label' => Mage::helper('alekseon_ajaxifiedProductEdit')->__('Enable'),
60
+ 'name' => 'enable',
61
+ 'values' => Mage::getSingleton('adminhtml/system_config_source_yesno')->toOptionArray(),
62
+ ));
63
+
64
+ $fieldset = $form->addFieldset('access', array('legend'=>Mage::helper('alekseon_ajaxifiedProductEdit')->__('Access')));
65
+
66
+ $fieldset->addField('user_roles', 'multiselect', array(
67
+ 'label' => Mage::helper('alekseon_ajaxifiedProductEdit')->__('User Roles'),
68
+ 'name' => 'user_roles',
69
+ 'values' => Mage::getSingleton('alekseon_ajaxifiedProductEdit/system_config_source_userRole')->toOptionArray(),
70
+ ));
71
+
72
+ if(isset($data['user_roles']) && unserialize($data['user_roles'])){
73
+ $data['user_roles'] = unserialize($data['user_roles']);
74
+ }
75
+
76
+ $form->setValues($data);
77
+
78
+ return parent::_prepareForm();
79
+ }
80
+
81
+ protected function _getAttributesColumns()
82
+ {
83
+ $gridView = Mage::registry('current_gridView');
84
+ $attributes = array();
85
+
86
+ foreach(Mage::helper('alekseon_ajaxifiedProductEdit')->getStaticFields() as $fieldCode => $fieldData) {
87
+ $attributes[$fieldCode] = array(
88
+ 'code' => $fieldCode,
89
+ 'label' => $fieldData['label'],
90
+ 'editable' => false,
91
+ 'position' => 0,
92
+ );
93
+ }
94
+
95
+ if(unserialize($gridView->getAttributes())){
96
+ foreach(unserialize($gridView->getAttributes()) as $attributeCode => $attributeData) {
97
+ if (isset($attributes[$attributeCode])) {
98
+ $attributes[$attributeCode]['position'] = $attributeData['position'];
99
+ } else {
100
+ $attributes[$attributeCode] = array(
101
+ 'code' => $attributeCode,
102
+ 'editable' => false,
103
+ 'position' => $attributeData['position'],
104
+ );
105
+ }
106
+ }
107
+ }
108
+
109
+ if(unserialize($gridView->getEditableAttributes())){
110
+ foreach(unserialize($gridView->getEditableAttributes()) as $attributeCode => $attributeData) {
111
+ $attributes[$attributeCode] = array(
112
+ 'code' => $attributeCode,
113
+ 'editable' => true,
114
+ 'position' => $attributeData['position'],
115
+ );
116
+ }
117
+ }
118
+
119
+
120
+
121
+ $productAttributes = Mage::getSingleton('alekseon_ajaxifiedProductEdit/system_config_source_productAttributes')->toOptionArray();
122
+ foreach($productAttributes as $attributeData) {
123
+ $attributeCode = $attributeData['value'];
124
+ if (isset($attributes[$attributeCode])) {
125
+ $attributes[$attributeCode]['label'] = $attributeData['label'];
126
+ }
127
+ }
128
+
129
+ usort($attributes, array($this,'_compareAttributes'));
130
+ return $attributes;
131
+ }
132
+
133
+ protected function _compareAttributes($option1, $option2)
134
+ {
135
+ return (int)$option1['position'] > (int)$option2['position'];
136
+ }
137
+ }
app/code/community/Alekseon/AjaxifiedProductEdit/Block/Adminhtml/GridView/Manager/Edit/Tabs/ManageColumns.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Marcin Frymark
4
+ * @email contact@alekseon.com
5
+ * @company Alekseon
6
+ * @website www.alekseon.com
7
+ */
8
+ class Alekseon_AjaxifiedProductEdit_Block_Adminhtml_GridView_Manager_Edit_Tabs_ManageColumns extends Mage_Adminhtml_Block_Template implements Mage_Adminhtml_Block_Widget_Tab_Interface
9
+ {
10
+ public function getTabLabel()
11
+ {
12
+ return Mage::helper('alekseon_ajaxifiedProductEdit')->__('Manage Columns');
13
+ }
14
+
15
+ public function getTabTitle()
16
+ {
17
+ return Mage::helper('alekseon_ajaxifiedProductEdit')->__('Manage Columns');
18
+ }
19
+
20
+ public function canShowTab()
21
+ {
22
+ return true;
23
+ }
24
+
25
+ public function isHidden()
26
+ {
27
+ return false;
28
+ }
29
+
30
+ public function getTabClass()
31
+ {
32
+ return 'ajax';
33
+ }
34
+
35
+ public function getClass()
36
+ {
37
+ return $this->getTabClass();
38
+ }
39
+
40
+ public function getTabUrl()
41
+ {
42
+ return $this->getUrl('*/*/manageColumns', array('_current' => true));
43
+ }
44
+ }
app/code/community/Alekseon/AjaxifiedProductEdit/Block/Adminhtml/GridView/Manager/Edit/Tabs/ManageColumns/Attributes.php ADDED
@@ -0,0 +1,169 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Marcin Frymark
4
+ * @email contact@alekseon.com
5
+ * @company Alekseon
6
+ * @website www.alekseon.com
7
+ */
8
+ class Alekseon_AjaxifiedProductEdit_Block_Adminhtml_GridView_Manager_Edit_Tabs_ManageColumns_Attributes extends Mage_Adminhtml_Block_Widget_Grid
9
+ {
10
+ protected $_selectedAttributesIds;
11
+
12
+ public function __construct()
13
+ {
14
+ parent::__construct();
15
+ $this->setId('alekseon_ajaxifiedProductEdit_gridView_columns_grid');
16
+
17
+ if ($this->_getGridView()->getId()) {
18
+ $this->setDefaultSort('gridview_selectedattributes_position');
19
+ } else {
20
+ $this->setDefaultSort('attribute_code');
21
+ }
22
+ $this->setDefaultDir('ASC');
23
+
24
+ $this->setUseAjax(true);
25
+ if ($this->_getGridView()->getId()) {
26
+ $this->setDefaultFilter(array('is_selected' => 1));
27
+ }
28
+ }
29
+
30
+ protected function _getGridView()
31
+ {
32
+ return Mage::registry('current_gridView');
33
+ }
34
+
35
+ protected function _prepareCollection()
36
+ {
37
+ $collection = Mage::getResourceModel('alekseon_ajaxifiedProductEdit/gridView_attribute_collection');
38
+ $collection->setGridViewId($this->_getGridView()->getId());
39
+ $this->setCollection($collection);
40
+
41
+ return parent::_prepareCollection();
42
+ }
43
+
44
+ protected function _prepareColumns()
45
+ {
46
+ $this->addColumn('is_selected', array(
47
+ 'header_css_class' => 'a-center',
48
+ 'type' => 'checkbox',
49
+ 'name' => 'is_selected',
50
+ 'values' => $this->_getSelectedAttributesIds(),
51
+ 'align' => 'center',
52
+ 'index' => 'attribute_id'
53
+ ));
54
+
55
+ $this->addColumn('attribute_code', array(
56
+ 'header' => Mage::helper('alekseon_ajaxifiedProductEdit')->__('Attribute Code'),
57
+ 'sortable' => true,
58
+ 'index' => 'attribute_code'
59
+ ));
60
+
61
+ $this->addColumn('frontend_label', array(
62
+ 'header' => Mage::helper('alekseon_ajaxifiedProductEdit')->__('Attribute Label'),
63
+ 'sortable' => true,
64
+ 'index' => 'frontend_label'
65
+ ));
66
+
67
+ $optionsYesNo = array(
68
+ 0 => Mage::helper('alekseon_ajaxifiedProductEdit')->__('No'),
69
+ 1 => Mage::helper('alekseon_ajaxifiedProductEdit')->__('Yes'),
70
+ );
71
+
72
+ $this->addColumn('gridview_selectedattributes_editable', array(
73
+ 'header' => Mage::helper('alekseon_ajaxifiedProductEdit')->__('Is Editable On Grid View'),
74
+ 'sortable' => true,
75
+ 'name' => 'gridview_selectedattributes_editable',
76
+ 'options' => $optionsYesNo,
77
+ 'type' => 'options',
78
+ 'renderer' => 'adminhtml/widget_grid_column_renderer_select',
79
+ 'index' => 'gridview_selectedattributes_editable',
80
+ 'filter_index' => 'selected_attributes.editable',
81
+ 'editable' => true,
82
+ ));
83
+
84
+ $this->addColumn('gridview_selectedattributes_position', array(
85
+ 'header' => Mage::helper('alekseon_ajaxifiedProductEdit')->__('Position'),
86
+ 'name' => 'gridview_selectedattributes_position',
87
+ 'type' => 'number',
88
+ 'validate_class' => 'validate-number',
89
+ 'index' => 'gridview_selectedattributes_position',
90
+ 'width' => 60,
91
+ 'filter_index' => 'selected_attributes.position',
92
+ 'editable' => true,
93
+ ));
94
+
95
+ return parent::_prepareColumns();
96
+ }
97
+
98
+ protected function _addColumnFilterToCollection($column)
99
+ {
100
+ if ($column->getId() == 'is_selected') {
101
+ $attributesIds = $this->_getSelectedAttributesIds();
102
+ if (empty($attributesIds)) {
103
+ $attributesIds = 0;
104
+ }
105
+ if ($column->getFilter()->getValue()) {
106
+ $this->getCollection()->addFieldToFilter('main_table.attribute_id', array('in' => $attributesIds));
107
+ } else {
108
+ if($attributesIds) {
109
+ $this->getCollection()->addFieldToFilter('main_table.attribute_id', array('nin' => $attributesIds));
110
+ }
111
+ }
112
+ } else {
113
+ parent::_addColumnFilterToCollection($column);
114
+ }
115
+
116
+ return $this;
117
+ }
118
+
119
+ protected function _getSelectedAttributesIds()
120
+ {
121
+ $attributesIds = $this->getSelectedAttributesIds();
122
+
123
+ if (!is_array($attributesIds)) {
124
+ $attributesIds = array_keys($this->_getSelectedAttributes());
125
+ }
126
+ return $attributesIds;
127
+ }
128
+
129
+ protected function _getSelectedAttributes()
130
+ {
131
+ if (is_null($this->_selectedAttributesIds)) {
132
+ $this->_selectedAttributesIds = array();
133
+ if ($this->_getGridView()->getId()) {
134
+ $collection = Mage::getResourceModel('alekseon_ajaxifiedProductEdit/gridView_attribute_collection');
135
+ $collection->setGridViewId($this->_getGridView()->getId());
136
+ foreach($collection as $attribute) {
137
+ if ($attribute->getGridviewSelectedattributesGridviewid() == $this->_getGridView()->getId()) {
138
+ $this->_selectedAttributesIds[$attribute->getAttributeId()] = $attribute;
139
+ }
140
+ }
141
+ }
142
+ }
143
+
144
+ return $this->_selectedAttributesIds;
145
+ }
146
+
147
+ public function getSelectedAttributes()
148
+ {
149
+ $attributes = array();
150
+ foreach ($this->_getSelectedAttributes() as $attribute) {
151
+ $attributeData = array(
152
+ 'gridview_selectedattributes_position' => $attribute->getGridviewSelectedattributesPosition(),
153
+ 'gridview_selectedattributes_editable' => $attribute->getGridviewSelectedattributesEditable(),
154
+ );
155
+ $attributes[$attribute->getAttributeId()] = $attributeData;
156
+ }
157
+ return $attributes;
158
+ }
159
+
160
+ public function getGridUrl()
161
+ {
162
+ return $this->getUrl('*/*/manageColumnsGrid', array('_current' => true));
163
+ }
164
+
165
+ public function getRowUrl($row)
166
+ {
167
+ return false;
168
+ }
169
+ }
app/code/community/Alekseon/AjaxifiedProductEdit/Block/Adminhtml/GridView/Manager/Grid.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Marcin Frymark
4
+ * @email contact@alekseon.com
5
+ * @company Alekseon
6
+ * @website www.alekseon.com
7
+ */
8
+ class Alekseon_AjaxifiedProductEdit_Block_Adminhtml_GridView_Manager_Grid extends Mage_Adminhtml_Block_Widget_Grid
9
+ {
10
+
11
+ public function __construct()
12
+ {
13
+ parent::__construct();
14
+ $this->setId('alekseon_ajaxifiedProductEdit_gridView_grid');
15
+ $this->setSaveParametersInSession(true);
16
+ }
17
+
18
+ protected function _prepareCollection()
19
+ {
20
+ $collection = Mage::getModel('alekseon_ajaxifiedProductEdit/gridView')->getCollection();
21
+ $this->setCollection($collection);
22
+
23
+ parent::_prepareCollection();
24
+
25
+ return $this;
26
+ }
27
+
28
+ protected function _prepareColumns()
29
+ {
30
+ $this->addColumn('label',
31
+ array(
32
+ 'header' => Mage::helper('alekseon_ajaxifiedProductEdit')->__('Label'),
33
+ 'index' => 'label',
34
+ 'width' => '1px',
35
+ )
36
+ );
37
+
38
+ $this->addColumn('description',
39
+ array(
40
+ 'header' => Mage::helper('alekseon_ajaxifiedProductEdit')->__('Description'),
41
+ 'index' => 'description',
42
+ )
43
+ );
44
+
45
+ $this->addColumn('enable',
46
+ array(
47
+ 'header' => Mage::helper('alekseon_ajaxifiedProductEdit')->__('Enable'),
48
+ 'index' => 'enable',
49
+ 'width' => '1px',
50
+ 'type' => 'options',
51
+ 'options'=> array(0 => $this->__('No'), 1 => $this->__('Yes')),
52
+ )
53
+ );
54
+
55
+ return parent::_prepareColumns();
56
+ }
57
+
58
+ public function getRowUrl($row)
59
+ {
60
+ return $this->getUrl('*/*/edit', array('id' => $row->getId()));
61
+ }
62
+
63
+ }
app/code/community/Alekseon/AjaxifiedProductEdit/Block/Adminhtml/GridViewSwitcher.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Marcin Frymark
4
+ * @email contact@alekseon.com
5
+ * @company Alekseon
6
+ * @website www.alekseon.com
7
+ */
8
+ class Alekseon_AjaxifiedProductEdit_Block_Adminhtml_GridViewSwitcher extends Mage_Core_Block_Template
9
+ {
10
+ protected $_gridViewCollection;
11
+
12
+ public function getGridViews()
13
+ {
14
+ if (is_null($this->_gridViewCollection)) {
15
+ $this->_gridViewCollection = Mage::helper('alekseon_ajaxifiedProductEdit')->getAvailableGridViews();
16
+ }
17
+ return $this->_gridViewCollection;
18
+ }
19
+
20
+ public function getCurrentGridView()
21
+ {
22
+ return Mage::helper('alekseon_ajaxifiedProductEdit')->getCurrentGridView();
23
+ }
24
+
25
+ public function getSwitchUrl()
26
+ {
27
+ return $this->getUrl('*/*/*', array('_current' => true, 'view' => null));
28
+ }
29
+ }
app/code/community/Alekseon/AjaxifiedProductEdit/Block/Adminhtml/Store/Switcher.php ADDED
@@ -0,0 +1 @@
 
0
  * @author Marcin Frymark
1
  * @email contact@alekseon.com
2
  * @company Alekseon
3
  * @website www.alekseon.com
4
  */
5
  class Alekseon_AjaxifiedProductEdit_Block_Adminhtml_Store_Switcher extends Mage_Adminhtml_Block_Store_Switcher
6
  public function __construct()
7
  {
8
  parent::__construct();
9
  $this->setTemplate('alekseon/ajaxifiedProductEdit/store/switcher.phtml');
10
  }
1
+ <?php
2
  * @author Marcin Frymark
3
  * @email contact@alekseon.com
4
  * @company Alekseon
5
  * @website www.alekseon.com
6
  */
7
  class Alekseon_AjaxifiedProductEdit_Block_Adminhtml_Store_Switcher extends Mage_Adminhtml_Block_Store_Switcher
8
  public function __construct()
9
  {
10
  parent::__construct();
11
  $this->setTemplate('alekseon/ajaxifiedProductEdit/store/switcher.phtml');
12
  }
app/code/community/Alekseon/AjaxifiedProductEdit/Block/Adminhtml/System/Config/Form/Field/ManageGridViewsButton.php ADDED
@@ -0,0 +1 @@
 
0
  * @author Marcin Frymark
1
  * @email contact@alekseon.com
2
  * @company Alekseon
3
  * @website www.alekseon.com
4
  */
5
  protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
6
  {
7
  $this->setElement($element);
8
  $url = $this->getUrl('*/ajaxifiedProductEdit_manageGridViews');
9
  $html = $this->getLayout()->createBlock('adminhtml/widget_button')
10
  ->setType('button')
11
  ->setClass('scalable')
12
  ->setLabel(Mage::helper('alekseon_ajaxifiedProductEdit')->__('Manage Grid Views'))
13
  ->setOnClick("setLocation('$url')")
14
  ->toHtml();
15
  return $html;
16
  }
1
+ <?php
2
  * @author Marcin Frymark
3
  * @email contact@alekseon.com
4
  * @company Alekseon
5
  * @website www.alekseon.com
6
  */
7
  protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
8
  {
9
  $this->setElement($element);
10
  $url = $this->getUrl('*/ajaxifiedProductEdit_manageGridViews');
11
  $html = $this->getLayout()->createBlock('adminhtml/widget_button')
12
  ->setType('button')
13
  ->setClass('scalable')
14
  ->setLabel(Mage::helper('alekseon_ajaxifiedProductEdit')->__('Manage Grid Views'))
15
  ->setOnClick("setLocation('$url')")
16
  ->toHtml();
17
  return $html;
18
  }
app/code/community/Alekseon/AjaxifiedProductEdit/Helper/Data.php ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Marcin Frymark
4
+ * @email contact@alekseon.com
5
+ * @company Alekseon
6
+ * @website www.alekseon.com
7
+ */
8
+ class Alekseon_AjaxifiedProductEdit_Helper_Data extends Mage_Core_Helper_Abstract
9
+ {
10
+ protected $_currentGridView;
11
+ protected $_currentGridViewsCollection;
12
+
13
+ public function getAttributeOptions($attribute)
14
+ {
15
+ $options = false;
16
+
17
+ if ($source = $attribute->getSourceModel()) {
18
+ $sourceModel = Mage::getModel($source);
19
+
20
+ if (method_exists($sourceModel, 'getOptionArray')) {
21
+ $options = $sourceModel->getOptionArray();
22
+ } elseif (method_exists($sourceModel, 'getAllOptions')) {
23
+ $sourceModel->setAttribute($attribute);
24
+ $allOptions = $sourceModel->getAllOptions();
25
+ foreach($allOptions as $option) {
26
+ if (is_array($option['value'])) {
27
+ foreach($option['value'] as $subOption) {
28
+ $options[$subOption['value']] = $subOption['label'];
29
+ }
30
+ } else {
31
+ $options[$option['value']] = $option['label'];
32
+ }
33
+ }
34
+ }
35
+ }
36
+
37
+ return $options;
38
+ }
39
+
40
+ public function getAvailableGridViews()
41
+ {
42
+ if (is_null($this->_currentGridViewsCollection)) {
43
+ $this->_currentGridViewsCollection = Mage::getModel('alekseon_ajaxifiedProductEdit/gridView')->getCollection();
44
+
45
+ foreach($this->_currentGridViewsCollection as $gridView) {
46
+ if (!$gridView->isAvailable()) {
47
+ $this->_currentGridViewsCollection->removeItemByKey($gridView->getId());
48
+ }
49
+ }
50
+ }
51
+
52
+ return $this->_currentGridViewsCollection;
53
+ }
54
+
55
+ public function getCurrentGridView()
56
+ {
57
+ if (is_null($this->_currentGridView)) {
58
+ $this->_currentGridView = Mage::registry('current_gridView', false);
59
+ }
60
+
61
+ return $this->_currentGridView;
62
+ }
63
+
64
+ public function getStaticFields()
65
+ {
66
+ return array('type' => array(
67
+ 'label' => Mage::helper('catalog')->__('Type'),
68
+ ));
69
+ }
70
+ }
app/code/community/Alekseon/AjaxifiedProductEdit/Model/GridView.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Marcin Frymark
4
+ * @email contact@alekseon.com
5
+ * @company Alekseon
6
+ * @website www.alekseon.com
7
+ */
8
+ class Alekseon_AjaxifiedProductEdit_Model_GridView extends Mage_Core_Model_Abstract
9
+ {
10
+ public function __construct($args = array())
11
+ {
12
+ $this->_init('alekseon_ajaxifiedProductEdit/gridView');
13
+ }
14
+
15
+ public function isAvailable()
16
+ {
17
+ if (!$this->getId()) {
18
+ return false;
19
+ }
20
+
21
+ if (!$this->getEnable()) {
22
+ return false;
23
+ }
24
+
25
+ $currentUserRole = Mage::getSingleton('admin/session')->getUser()->getRole()->getRoleId();
26
+
27
+ $userRoles = unserialize($this->getUserRoles());
28
+
29
+ if (is_array($userRoles)) {
30
+ foreach($userRoles as $role) {
31
+ if ($currentUserRole == $role) {
32
+ return true;
33
+ }
34
+ }
35
+ }
36
+
37
+ return false;
38
+ }
39
+
40
+ protected function _afterSave()
41
+ {
42
+ if ($this->getAttributesData()) {
43
+ $this->getResource()->saveAttributeColumns($this, $this->getAttributesData());
44
+ }
45
+ return parent::_afterSave();
46
+ }
47
+ }
app/code/community/Alekseon/AjaxifiedProductEdit/Model/Resource/GridView.php ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Marcin Frymark
4
+ * @email contact@alekseon.com
5
+ * @company Alekseon
6
+ * @website www.alekseon.com
7
+ */
8
+ class Alekseon_AjaxifiedProductEdit_Model_Resource_GridView extends Mage_Core_Model_Resource_Db_Abstract
9
+ {
10
+ protected function _construct()
11
+ {
12
+ $this->_init('alekseon_ajaxifiedProductEdit/gridview', 'id');
13
+ }
14
+
15
+ public function saveAttributeColumns($gridView, $attributesData)
16
+ {
17
+ if (!is_array($attributesData)) {
18
+ $attributesData = array();
19
+ }
20
+
21
+ $adapter = $this->_getWriteAdapter();
22
+
23
+ $bind = array(
24
+ ':grid_view_id' => (int)$gridView->getId(),
25
+ );
26
+
27
+ $attributeColumsTable = $this->getTable('alekseon_ajaxifiedProductEdit/gridview_attributeColumns');
28
+
29
+ $select = $adapter->select()
30
+ ->from($attributeColumsTable, array('attribute_id', 'id'))
31
+ ->where('grid_view_id = :grid_view_id');
32
+
33
+ $currentAttributesColumns = $adapter->fetchPairs($select, $bind);
34
+
35
+ $deleteIds = array();
36
+ foreach($currentAttributesColumns as $attributeId => $id) {
37
+ if (!isset($attributesData[$attributeId])) {
38
+ $deleteIds[] = (int)$id;
39
+ }
40
+ }
41
+ if (!empty($deleteIds)) {
42
+ $adapter->delete($attributeColumsTable, array(
43
+ 'id IN (?)' => $deleteIds,
44
+ ));
45
+ }
46
+
47
+ foreach ($attributesData as $attributeId => $attributeInfo) {
48
+ if (isset($currentAttributesColumns[$attributeId])) {
49
+ $bind = array(
50
+ 'editable' => (bool)$attributeInfo['gridview_selectedattributes_editable'],
51
+ 'position' => (int)$attributeInfo['gridview_selectedattributes_position'],
52
+ );
53
+ $dataWhere = array('id = ?' => $currentAttributesColumns[$attributeId]);
54
+ $adapter->update($attributeColumsTable, $bind, $dataWhere);
55
+ } else {
56
+ $bind = array(
57
+ 'grid_view_id' => (int)$gridView->getId(),
58
+ 'attribute_id' => (int)$attributeId,
59
+ 'editable' => (bool)$attributeInfo['gridview_selectedattributes_editable'],
60
+ 'position' => (int)$attributeInfo['gridview_selectedattributes_position'],
61
+ );
62
+ $adapter->insert($attributeColumsTable, $bind);
63
+ }
64
+ }
65
+
66
+ return $this;
67
+ }
68
+ }
app/code/community/Alekseon/AjaxifiedProductEdit/Model/Resource/GridView/Attribute/Collection.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Marcin Frymark
4
+ * @email contact@alekseon.com
5
+ * @company Alekseon
6
+ * @website www.alekseon.com
7
+ */
8
+ class Alekseon_AjaxifiedProductEdit_Model_Resource_GridView_Attribute_Collection extends Mage_Catalog_Model_Resource_Product_Attribute_Collection
9
+ {
10
+ protected $_gridViewId;
11
+
12
+ public function setGridViewId($gridViewId)
13
+ {
14
+ $this->_gridViewId = $gridViewId;
15
+ return $this;
16
+ }
17
+
18
+ protected function _beforeLoad()
19
+ {
20
+ $this->addVisibleFilter();
21
+ if ($this->_gridViewId) {
22
+ $this->_joinGridViewAttributeColumns();
23
+ }
24
+ return parent::_beforeLoad();
25
+ }
26
+
27
+ protected function _joinGridViewAttributeColumns()
28
+ {
29
+ $this->getSelect()->joinLeft(
30
+ array('selected_attributes' => $this->getTable('alekseon_ajaxifiedProductEdit/gridview_attributeColumns')),
31
+ 'main_table.attribute_id = selected_attributes.attribute_id AND selected_attributes.grid_view_id = ' . $this->_gridViewId,
32
+ array(
33
+ 'gridview_selectedattributes_editable' => 'selected_attributes.editable',
34
+ 'gridview_selectedattributes_position' => 'selected_attributes.position',
35
+ 'gridview_selectedattributes_gridviewid' => 'selected_attributes.grid_view_id',
36
+ 'gridview_selectedattributes_attributeid' => 'selected_attributes.attribute_id',
37
+ )
38
+ );
39
+ return $this;
40
+ }
41
+ }
app/code/community/Alekseon/AjaxifiedProductEdit/Model/Resource/GridView/Collection.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Marcin Frymark
4
+ * @email contact@alekseon.com
5
+ * @company Alekseon
6
+ * @website www.alekseon.com
7
+ */
8
+ class Alekseon_AjaxifiedProductEdit_Model_Resource_GridView_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
9
+ {
10
+ protected function _construct()
11
+ {
12
+ $this->_init('alekseon_ajaxifiedProductEdit/gridView');
13
+ }
14
+ }
app/code/community/Alekseon/AjaxifiedProductEdit/Model/System/Config/Backend/Cache.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Marcin Frymark
4
+ * @email contact@alekseon.com
5
+ * @company Alekseon
6
+ * @website www.alekseon.com
7
+ */
8
+ class Alekseon_AjaxifiedProductEdit_Model_System_Config_Backend_Cache extends Mage_Core_Model_Config_Data
9
+ {
10
+ protected function _afterSave()
11
+ {
12
+ if ($this->isValueChanged()) {
13
+ Mage::app()->cleanCache();
14
+ }
15
+ }
16
+ }
app/code/community/Alekseon/AjaxifiedProductEdit/Model/System/Config/Source/ProductAttributes.php ADDED
@@ -0,0 +1 @@
 
0
  * @author Marcin Frymark
1
  * @email contact@alekseon.com
2
  * @company Alekseon
3
  * @website www.alekseon.com
4
  */
5
  protected $_options;
6
 
7
  public function toOptionArray()
8
  {
9
  if (is_null($this->_options)) {
10
  $entityTypeId = Mage::getModel('eav/entity')
11
  ->setType('catalog_product')
12
  ->getTypeId();
13
 
14
  $collection = Mage::getResourceModel('eav/entity_attribute_collection')
15
  ->setEntityTypeFilter($entityTypeId);
16
  foreach ($collection as $attribute) {
17
  if ($attribute->getFrontendLabel()) {
18
  $this->_options[] = array(
19
  'value' => $attribute->getAttributeCode(),
20
  'label' => $attribute->getFrontendLabel(),
21
  );
22
  }
23
  }
24
  usort($this->_options, array($this,'_compare'));
25
  }
26
  return $this->_options;
27
  }
28
 
29
  protected function _compare($option1, $option2)
30
  {
31
  return strcmp($option1['label'], $option2['label']);
32
  }
1
+ <?php
2
  * @author Marcin Frymark
3
  * @email contact@alekseon.com
4
  * @company Alekseon
5
  * @website www.alekseon.com
6
  */
7
  protected $_options;
8
 
9
  public function toOptionArray()
10
  {
11
  if (is_null($this->_options)) {
12
  $entityTypeId = Mage::getModel('eav/entity')
13
  ->setType('catalog_product')
14
  ->getTypeId();
15
 
16
  $collection = Mage::getResourceModel('eav/entity_attribute_collection')
17
  ->setEntityTypeFilter($entityTypeId);
18
  foreach ($collection as $attribute) {
19
  if ($attribute->getFrontendLabel()) {
20
  $this->_options[] = array(
21
  'value' => $attribute->getAttributeCode(),
22
  'label' => $attribute->getFrontendLabel(),
23
  );
24
  }
25
  }
26
  usort($this->_options, array($this,'_compare'));
27
  }
28
  return $this->_options;
29
  }
30
 
31
  protected function _compare($option1, $option2)
32
  {
33
  return strcmp($option1['label'], $option2['label']);
34
  }
app/code/community/Alekseon/AjaxifiedProductEdit/Model/System/Config/Source/UserRole.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Marcin Frymark
4
+ * @email contact@alekseon.com
5
+ * @company Alekseon
6
+ * @website www.alekseon.com
7
+ */
8
+ class Alekseon_AjaxifiedProductEdit_Model_System_Config_Source_UserRole
9
+ {
10
+ protected $_options;
11
+
12
+ public function toOptionArray()
13
+ {
14
+ if (is_null($this->_options)) {
15
+ $collection = Mage::getModel("admin/roles")->getCollection();
16
+
17
+ $this->_options = array();
18
+
19
+ foreach($collection as $role) {
20
+ $this->_options[] = array(
21
+ 'value' => $role->getRoleId(),
22
+ 'label' => $role->getRoleName(),
23
+ );
24
+ }
25
+ }
26
+
27
+ return $this->_options;
28
+ }
29
+ }
app/code/community/Alekseon/AjaxifiedProductEdit/controllers/Adminhtml/AjaxifiedProductEdit/ManageGridViewsController.php ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Marcin Frymark
4
+ * @email contact@alekseon.com
5
+ * @company Alekseon
6
+ * @website www.alekseon.com
7
+ */
8
+ class Alekseon_AjaxifiedProductEdit_Adminhtml_AjaxifiedProductEdit_ManageGridViewsController extends Mage_Adminhtml_Controller_Action
9
+ {
10
+ public function _initGridView()
11
+ {
12
+ $gridViewId = (int) $this->getRequest()->getParam('id');
13
+ $gridView = Mage::getModel('alekseon_ajaxifiedProductEdit/gridView');
14
+
15
+ if ($gridViewId) {
16
+ $gridView->load($gridViewId);
17
+ }
18
+
19
+ Mage::register('current_gridView', $gridView);
20
+ return $this;
21
+ }
22
+
23
+ public function indexAction()
24
+ {
25
+ $this->loadLayout();
26
+
27
+ $this->_addContent(
28
+ $this->getLayout()->createBlock('alekseon_ajaxifiedProductEdit/adminhtml_gridView_manager', 'manageGridView')
29
+ );
30
+
31
+ $this->renderLayout();
32
+ }
33
+
34
+ public function newAction()
35
+ {
36
+ $this->_forward('edit');
37
+ }
38
+
39
+ public function editAction()
40
+ {
41
+ $this->_initGridView();
42
+
43
+ $this->loadLayout();
44
+ $this->renderLayout();
45
+ }
46
+
47
+ public function deleteAction()
48
+ {
49
+ $this->_initGridView();
50
+ $gridView = Mage::registry('current_gridView');
51
+
52
+ try {
53
+ $gridView->delete();
54
+ } catch (Exception $e) {
55
+ $this->_getSession()->addError($e->getMessage());
56
+ $this->getResponse()->setRedirect($this->getUrl('*/ajaxifiedProductEdit_manageGridViews'));
57
+ return;
58
+ }
59
+
60
+ $this->_getSession()->addSuccess(
61
+ Mage::helper('alekseon_ajaxifiedProductEdit')->__('Grid View set has been saved.')
62
+ );
63
+
64
+ $this->getResponse()->setRedirect($this->getUrl('*/ajaxifiedProductEdit_manageGridViews'));
65
+ }
66
+
67
+ public function saveAction()
68
+ {
69
+ $data = $this->getRequest()->getPost();
70
+
71
+ if ($data) {
72
+ $this->_initGridView();
73
+ $gridView = Mage::registry('current_gridView');
74
+ try {
75
+ $gridView->setData($data);
76
+
77
+ if (isset($data['user_roles'])) {
78
+ $gridView->setUserRoles(serialize($data['user_roles']));
79
+ }
80
+
81
+ if (isset($data['columns'])) {
82
+ $attributes = Mage::helper('adminhtml/js')->decodeGridSerializedInput($data['columns']['attributes']);
83
+ $gridView->setAttributesData($attributes);
84
+ }
85
+
86
+ $gridView->save();
87
+ } catch (Exception $e) {
88
+ $this->_getSession()->addError($e->getMessage());
89
+ $this->getResponse()->setRedirect($this->getUrl('*/ajaxifiedProductEdit_manageGridViews/edit', array('id' => $gridView->getId())));
90
+ return;
91
+ }
92
+ }
93
+
94
+ $this->_getSession()->addSuccess(
95
+ Mage::helper('alekseon_ajaxifiedProductEdit')->__('Grid View set has been saved.')
96
+ );
97
+
98
+ $this->getResponse()->setRedirect($this->getUrl('*/ajaxifiedProductEdit_manageGridViews'));
99
+ }
100
+
101
+ public function manageColumnsAction()
102
+ {
103
+ $this->_initGridView();
104
+
105
+ $this->loadLayout();
106
+ $this->getLayout()->getBlock('grid_view_edit_tabs_manage_columns_attributes')
107
+ ->setSelectedAttributesIds($this->getRequest()->getPost('gridview_selected_attributes', null));
108
+ $this->renderLayout();
109
+ }
110
+
111
+ public function manageColumnsGridAction()
112
+ {
113
+ $this->_initGridView();
114
+
115
+ $this->loadLayout();
116
+ $this->getLayout()->getBlock('grid_view_edit_tabs_manage_columns_attributes')
117
+ ->setSelectedAttributesIds($this->getRequest()->getPost('gridview_selected_attributes', array()));
118
+ $this->renderLayout();
119
+ }
120
+ }
app/code/community/Alekseon/AjaxifiedProductEdit/controllers/Adminhtml/AjaxifiedProductEditController.php ADDED
@@ -0,0 +1,139 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Marcin Frymark
4
+ * @email contact@alekseon.com
5
+ * @company Alekseon
6
+ * @website www.alekseon.com
7
+ */
8
+ class Alekseon_AjaxifiedProductEdit_Adminhtml_AjaxifiedProductEditController extends Mage_Adminhtml_Controller_Action
9
+ {
10
+ public function _initGridView()
11
+ {
12
+ $storeId = (int)$this->getRequest()->getParam('store', false);
13
+ Mage::register('current_storeId', $storeId);
14
+
15
+ $gridViewId = (int)$this->getRequest()->getParam('view', false);
16
+ $availableGridViews = Mage::helper('alekseon_ajaxifiedProductEdit')->getAvailableGridViews();
17
+
18
+ if ($gridViewId) {
19
+ foreach($availableGridViews as $gridView) {
20
+ if ($gridView->getId() == $gridViewId) {
21
+ Mage::register('current_gridView', $gridView);
22
+ return $this;
23
+ }
24
+ }
25
+ } else {
26
+ $gridView = $availableGridViews->getFirstItem();
27
+ Mage::register('current_gridView', $gridView);
28
+ }
29
+
30
+ return $this;
31
+ }
32
+
33
+ public function indexAction()
34
+ {
35
+ if (!Mage::helper('alekseon_ajaxifiedProductEdit')->getAvailableGridViews()->count()) {
36
+ if (Mage::getSingleton('admin/session')->isAllowed('system/alekseon_ajaxifiedProductEdit/managegridviews')) {
37
+ $url = $this->getUrl('*/ajaxifiedProductEdit_manageGridViews/');
38
+ $alekseonEmail = Mage::helper('alekseon_core')->getAlekseonEmail();
39
+ $errorMessage = Mage::helper('alekseon_ajaxifiedProductEdit')->__("Ajaxified Product Edit is unavailable, please edit your <a href=\"%s\">Grid Views</a> or contact with support <a href=\"mailto:%s\">%s</a>.", $url, $alekseonEmail, $alekseonEmail);
40
+ } else {
41
+ $errorMessage = Mage::helper('alekseon_ajaxifiedProductEdit')->__('Ajaxified Product Edit is unavailable, please contact with administrator.');
42
+ }
43
+ $this->_getSession()->addError($errorMessage);
44
+ $this->_redirectReferer();
45
+ return;
46
+ }
47
+
48
+ $this->_initGridView();
49
+ $currentGridView = Mage::helper('alekseon_ajaxifiedProductEdit')->getCurrentGridView();
50
+
51
+ if (!$currentGridView) {
52
+ $this->_forward('noRoute');
53
+ return;
54
+ }
55
+
56
+ $this->loadLayout();
57
+ $this->_setActiveMenu('catalog/products');
58
+ $this->renderLayout();
59
+ }
60
+
61
+ public function saveRowAction()
62
+ {
63
+ $params = $this->getRequest()->getParams();
64
+ $rowId = $params['rowId'];
65
+ $productData = $params['product'][$rowId];
66
+ $storeId = $params['store'];
67
+
68
+ $product = Mage::getModel('catalog/product');
69
+ if ($storeId) {
70
+ $product->setStoreId($storeId);
71
+ }
72
+
73
+ $result = array();
74
+ $result['rowId'] = $rowId;
75
+
76
+ try {
77
+ $product->load($rowId);
78
+
79
+ if (!$product->getId()) {
80
+ Mage::throwException($this->__('Product Id is NULL.'));
81
+ }
82
+
83
+ foreach($productData as $attribute => $data) {
84
+ if ($storeId && isset($data['default'])) {
85
+ $product->setData($attribute, false);
86
+ } elseif (isset($data['value'])) {
87
+ $product->setData($attribute, $data['value']);
88
+ }
89
+ }
90
+ if (!Mage::getStoreConfig('alekseon_ajaxifiedProductEdit/advanced/use_resource')) {
91
+ $product->save();
92
+ } else {
93
+ $product->getResource()->save($product);
94
+ if (Mage::helper('core')->isModuleEnabled('Enterprise_Logging')) {
95
+ Mage::getSingleton('enterprise_logging/processor')->modelActionAfter($product, 'save');
96
+ }
97
+ }
98
+
99
+ if (Mage::getStoreConfig('alekseon_ajaxifiedProductEdit/advanced/refresh_row')) {
100
+ $newFields = $this->_prepareRefreshedFields($rowId);
101
+ foreach($newFields as $attribute => $html) {
102
+ $result['updateData']['field[' . $rowId . '][' . $attribute . ']'] = $html;
103
+ }
104
+ }
105
+
106
+ $result['successMsg'] = $this->__('Save succesed');
107
+ } catch(Exception $e) {
108
+ Mage::log($e->getMessage(), null,'alekseon_ajaxifiedProductEdit.log');
109
+ $result['errorMsg'] = $this->__('Save failed. Check logs for details.');
110
+ }
111
+
112
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
113
+ }
114
+
115
+ protected function _prepareRefreshedFields($productId)
116
+ {
117
+ $this->_initGridView();
118
+ $gridBlock = $this->getLayout()->createBlock('alekseon_ajaxifiedProductEdit/adminhtml_gridView_grid', 'gridRow');
119
+ $gridBlock->prepareRow($productId);
120
+ $this->loadLayout();
121
+
122
+ $result = array();
123
+ foreach($gridBlock->getCollection() as $_item) {
124
+ foreach ($gridBlock->getColumns() as $_columnCode => $_column) {
125
+ if (!$_column->getEditable()) {
126
+ continue;
127
+ }
128
+ $rowField = $_column->getRowField($_item);
129
+ if ($rowField) {
130
+ $result[$_columnCode] = $rowField;
131
+ } else {
132
+ $result[$_columnCode] = '&nbsp;';
133
+ }
134
+ }
135
+ }
136
+
137
+ return $result;
138
+ }
139
+ }
app/code/community/Alekseon/AjaxifiedProductEdit/etc/adminhtml.xml ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * @author Marcin Frymark
5
+ * @email contact@alekseon.com
6
+ * @company Alekseon
7
+ * @website www.alekseon.com
8
+ */
9
+ -->
10
+ <config>
11
+ <menu>
12
+ <system>
13
+ <children>
14
+ <alekseon_ajaxifiedProductEdit translate="title" module="alekseon_ajaxifiedProductEdit">
15
+ <title>Ajaxified Product Edit</title>
16
+ <sort_order>88</sort_order>
17
+ <children>
18
+ <managegridviews translate="title" module="alekseon_ajaxifiedProductEdit">
19
+ <title>Manage Grid Views</title>
20
+ <action>adminhtml/ajaxifiedProductEdit_manageGridViews</action>
21
+ </managegridviews>
22
+ </children>
23
+ </alekseon_ajaxifiedProductEdit>
24
+ </children>
25
+ </system>
26
+ <catalog>
27
+ <children>
28
+ <alekseon_ajaxifiedProductEdit translate="title" module="alekseon_ajaxifiedProductEdit">
29
+ <title>Ajaxified Product Edit</title>
30
+ <sort_order>2</sort_order>
31
+ <action>adminhtml/ajaxifiedProductEdit</action>
32
+ <depends><config>alekseon_ajaxifiedProductEdit/general/enabled</config></depends>
33
+ </alekseon_ajaxifiedProductEdit>
34
+ </children>
35
+ </catalog>
36
+ </menu>
37
+ <acl>
38
+ <resources>
39
+ <admin>
40
+ <children>
41
+ <system>
42
+ <children>
43
+ <config>
44
+ <children>
45
+ <alekseon_ajaxifiedProductEdit translate="title" module="alekseon_ajaxifiedProductEdit">
46
+ <title>Ajaxified Product Edit</title>
47
+ <sort_order>88</sort_order>
48
+ </alekseon_ajaxifiedProductEdit>
49
+ </children>
50
+ </config>
51
+ <alekseon_ajaxifiedProductEdit translate="title">
52
+ <title>Ajaxified Product Edit</title>
53
+ <children>
54
+ <managegridviews translate="title">
55
+ <title>Manage Grid Views</title>
56
+ </managegridviews>
57
+ </children>
58
+ </alekseon_ajaxifiedProductEdit>
59
+ </children>
60
+ </system>
61
+ <catalog>
62
+ <children>
63
+ <alekseon_ajaxifiedProductEdit translate="title">
64
+ <title>Ajaxified Product Edit</title>
65
+ <sort_order>2</sort_order>
66
+ </alekseon_ajaxifiedProductEdit>
67
+ </children>
68
+ </catalog>
69
+ </children>
70
+ </admin>
71
+ </resources>
72
+ </acl>
73
+ </config>
app/code/community/Alekseon/AjaxifiedProductEdit/etc/config.xml ADDED
@@ -0,0 +1 @@
 
0
  * @author Marcin Frymark
1
  * @email contact@alekseon.com
2
  * @company Alekseon
3
  * @website www.alekseon.com
4
  */
5
- ->
6
  <modules>
7
  <Alekseon_AjaxifiedProductEdit>
8
  <version>0.1.0</version>
9
  </Alekseon_AjaxifiedProductEdit>
10
  </modules>
11
  <global>
12
  <blocks>
13
  <alekseon_ajaxifiedProductEdit>
14
  <class>Alekseon_AjaxifiedProductEdit_Block</class>
15
  </alekseon_ajaxifiedProductEdit>
16
  </blocks>
17
  <models>
18
  <alekseon_ajaxifiedProductEdit>
19
  <class>Alekseon_AjaxifiedProductEdit_Model</class>
20
  <resourceModel>alekseon_ajaxifiedproductedit_resource</resourceModel>
21
  </alekseon_ajaxifiedProductEdit>
22
  <alekseon_ajaxifiedproductedit_resource>
23
  <class>Alekseon_AjaxifiedProductEdit_Model_Resource</class>
24
  <gridview>
25
  <table>alekseon_ajaxifiedproductedit_gridview</table>
26
  </gridview>
27
  <gridview_attributeColumns>
28
  <table>alekseon_ajaxifiedproductedit_gridview_attributeColumns</table>
29
  </gridview_attributeColumns>
30
  </entities>
31
  </alekseon_ajaxifiedproductedit_resource>
32
  </models>
33
  <helpers>
34
  <alekseon_ajaxifiedProductEdit>
35
  <class>Alekseon_AjaxifiedProductEdit_Helper</class>
36
  </alekseon_ajaxifiedProductEdit>
37
  </helpers>
38
  <resources>
39
  <alekseon_ajaxifiedproductedit_setup>
40
  <setup>
41
  <module>Alekseon_AjaxifiedProductEdit</module>
42
  <class>Mage_Core_Model_Resource_Setup</class>
43
  </setup>
44
  </alekseon_ajaxifiedproductedit_setup>
45
  </resources>
46
  </global>
47
  <admin>
48
  <routers>
49
  <adminhtml>
50
  <args>
51
  <modules>
52
  <alekseon_ajaxifiedProductEdit before="Mage_Adminhtml">Alekseon_AjaxifiedProductEdit_Adminhtml</alekseon_ajaxifiedProductEdit>
53
  </modules>
54
  </args>
55
  </adminhtml>
56
  </routers>
57
  </admin>
58
  <adminhtml>
59
  <layout>
60
  <updates>
61
  <alekseon_ajaxifiedProductEdit>
62
  <file>alekseon/ajaxifiedProductEdit.xml</file>
63
  </alekseon_ajaxifiedProductEdit>
64
  </updates>
65
  </layout>
66
  </adminhtml>
67
  <default>
68
  <alekseon_ajaxifiedProductEdit>
69
  <general>
70
  <enabled>1</enabled>
71
  </general>
72
  <advanced>
73
  <refresh_row>1</refresh_row>
74
  </advanced>
75
  </alekseon_ajaxifiedProductEdit>
76
  </default>
1
+ <?xml version="1.0"?>
2
  * @author Marcin Frymark
3
  * @email contact@alekseon.com
4
  * @company Alekseon
5
  * @website www.alekseon.com
6
  */
 
7
  <modules>
8
  <Alekseon_AjaxifiedProductEdit>
9
  <version>0.1.0</version>
10
  </Alekseon_AjaxifiedProductEdit>
11
  </modules>
12
  <global>
13
  <blocks>
14
  <alekseon_ajaxifiedProductEdit>
15
  <class>Alekseon_AjaxifiedProductEdit_Block</class>
16
  </alekseon_ajaxifiedProductEdit>
17
  </blocks>
18
  <models>
19
  <alekseon_ajaxifiedProductEdit>
20
  <class>Alekseon_AjaxifiedProductEdit_Model</class>
21
  <resourceModel>alekseon_ajaxifiedproductedit_resource</resourceModel>
22
  </alekseon_ajaxifiedProductEdit>
23
  <alekseon_ajaxifiedproductedit_resource>
24
  <class>Alekseon_AjaxifiedProductEdit_Model_Resource</class>
25
  <gridview>
26
  <table>alekseon_ajaxifiedproductedit_gridview</table>
27
  </gridview>
28
  <gridview_attributeColumns>
29
  <table>alekseon_ajaxifiedproductedit_gridview_attributeColumns</table>
30
  </gridview_attributeColumns>
31
  </entities>
32
  </alekseon_ajaxifiedproductedit_resource>
33
  </models>
34
  <helpers>
35
  <alekseon_ajaxifiedProductEdit>
36
  <class>Alekseon_AjaxifiedProductEdit_Helper</class>
37
  </alekseon_ajaxifiedProductEdit>
38
  </helpers>
39
  <resources>
40
  <alekseon_ajaxifiedproductedit_setup>
41
  <setup>
42
  <module>Alekseon_AjaxifiedProductEdit</module>
43
  <class>Mage_Core_Model_Resource_Setup</class>
44
  </setup>
45
  </alekseon_ajaxifiedproductedit_setup>
46
  </resources>
47
  </global>
48
  <admin>
49
  <routers>
50
  <adminhtml>
51
  <args>
52
  <modules>
53
  <alekseon_ajaxifiedProductEdit before="Mage_Adminhtml">Alekseon_AjaxifiedProductEdit_Adminhtml</alekseon_ajaxifiedProductEdit>
54
  </modules>
55
  </args>
56
  </adminhtml>
57
  </routers>
58
  </admin>
59
  <adminhtml>
60
  <layout>
61
  <updates>
62
  <alekseon_ajaxifiedProductEdit>
63
  <file>alekseon/ajaxifiedProductEdit.xml</file>
64
  </alekseon_ajaxifiedProductEdit>
65
  </updates>
66
  </layout>
67
  </adminhtml>
68
  <default>
69
  <alekseon_ajaxifiedProductEdit>
70
  <general>
71
  <enabled>1</enabled>
72
  </general>
73
  <advanced>
74
  <refresh_row>1</refresh_row>
75
  </advanced>
76
  </alekseon_ajaxifiedProductEdit>
77
  </default>
app/code/community/Alekseon/AjaxifiedProductEdit/etc/logging.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * @author Marcin Frymark
5
+ * @email contact@alekseon.com
6
+ * @company Alekseon
7
+ * @website www.alekseon.com
8
+ */
9
+ -->
10
+ <logging>
11
+ <catalog_products>
12
+ <actions>
13
+ <adminhtml_ajaxifiedProductEdit_saveRow>
14
+ <action>save</action>
15
+ </adminhtml_ajaxifiedProductEdit_saveRow>
16
+ </actions>
17
+ </catalog_products>
18
+ </logging>
app/code/community/Alekseon/AjaxifiedProductEdit/etc/system.xml ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * @author Marcin Frymark
5
+ * @email contact@alekseon.com
6
+ * @company Alekseon
7
+ * @website www.alekseon.com
8
+ */
9
+ -->
10
+ <config>
11
+ <tabs>
12
+ <alekseon>
13
+ <label>Alekseon</label>
14
+ <sort_order>450</sort_order>
15
+ </alekseon>
16
+ </tabs>
17
+ <sections>
18
+ <alekseon_ajaxifiedProductEdit translate="label" module="alekseon_ajaxifiedProductEdit">
19
+ <label>Ajaxified Product Edit</label>
20
+ <tab>alekseon</tab>
21
+ <frontend_type>text</frontend_type>
22
+ <sort_order>20</sort_order>
23
+ <show_in_default>1</show_in_default>
24
+ <show_in_website>1</show_in_website>
25
+ <show_in_store>0</show_in_store>
26
+ <groups>
27
+ <hint>
28
+ <frontend_model>alekseon_core/adminhtml_system_config_fieldset_alekseon</frontend_model>
29
+ <sort_order>0</sort_order>
30
+ <show_in_default>1</show_in_default>
31
+ <show_in_website>1</show_in_website>
32
+ <show_in_store>1</show_in_store>
33
+ </hint>
34
+ <general translate="label" module="alekseon_ajaxifiedProductEdit">
35
+ <label>General Settings</label>
36
+ <frontend_type>text</frontend_type>
37
+ <sort_order>10</sort_order>
38
+ <show_in_default>1</show_in_default>
39
+ <show_in_website>0</show_in_website>
40
+ <show_in_store>0</show_in_store>
41
+ <fields>
42
+ <enabled translate="label">
43
+ <label>Enable Ajaxified Product Edit</label>
44
+ <frontend_type>select</frontend_type>
45
+ <source_model>adminhtml/system_config_source_yesno</source_model>
46
+ <backend_model>alekseon_ajaxifiedProductEdit/system_config_backend_cache</backend_model>
47
+ <sort_order>10</sort_order>
48
+ <show_in_default>1</show_in_default>
49
+ <show_in_website>0</show_in_website>
50
+ <show_in_store>0</show_in_store>
51
+ </enabled>
52
+ <button translate="label">
53
+ <label>Manage Grid Views</label>
54
+ <frontend_type>button</frontend_type>
55
+ <frontend_model>alekseon_ajaxifiedProductEdit/adminhtml_system_config_form_field_manageGridViewsButton</frontend_model>
56
+ <sort_order>20</sort_order>
57
+ <show_in_default>1</show_in_default>
58
+ <show_in_website>0</show_in_website>
59
+ <show_in_store>0</show_in_store>
60
+ </button>
61
+ </fields>
62
+ </general>
63
+ <advanced translate="label" module="alekseon_ajaxifiedProductEdit">
64
+ <label>Advanced Settings</label>
65
+ <frontend_type>text</frontend_type>
66
+ <sort_order>20</sort_order>
67
+ <show_in_default>1</show_in_default>
68
+ <show_in_website>0</show_in_website>
69
+ <show_in_store>0</show_in_store>
70
+ <fields>
71
+ <use_resource translate="label">
72
+ <label>Use resource for save</label>
73
+ <frontend_type>select</frontend_type>
74
+ <source_model>adminhtml/system_config_source_yesno</source_model>
75
+ <sort_order>10</sort_order>
76
+ <show_in_default>1</show_in_default>
77
+ <show_in_website>0</show_in_website>
78
+ <show_in_store>0</show_in_store>
79
+ </use_resource>
80
+ <refresh_row translate="label">
81
+ <label>Refresh product row after save</label>
82
+ <frontend_type>select</frontend_type>
83
+ <source_model>adminhtml/system_config_source_yesno</source_model>
84
+ <sort_order>20</sort_order>
85
+ <show_in_default>1</show_in_default>
86
+ <show_in_website>0</show_in_website>
87
+ <show_in_store>0</show_in_store>
88
+ </refresh_row>
89
+ </fields>
90
+ </advanced>
91
+ </groups>
92
+ </alekseon_ajaxifiedProductEdit>
93
+ </sections>
94
+ </config>
app/code/community/Alekseon/AjaxifiedProductEdit/sql/alekseon_ajaxifiedproductedit_setup/mysql4-install-0.1.0.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Marcin Frymark
4
+ * @email contact@alekseon.com
5
+ * @company Alekseon
6
+ * @website www.alekseon.com
7
+ */
8
+
9
+ $installer = $this;
10
+ $installer->startSetup();
11
+ $installer->run("
12
+
13
+ CREATE TABLE {$this->getTable('alekseon_ajaxifiedProductEdit/gridview')} (
14
+ `id` int(10) unsigned NOT NULL auto_increment,
15
+ `label` varchar(255) default NULL,
16
+ `description` text default NULL,
17
+ `user_roles` text default NULL,
18
+ `enable` bit default 1,
19
+ PRIMARY KEY (`id`)
20
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
21
+
22
+ CREATE TABLE {$this->getTable('alekseon_ajaxifiedProductEdit/gridview_attributeColumns')} (
23
+ `id` int(10) unsigned NOT NULL auto_increment,
24
+ `grid_view_id` int(10) unsigned,
25
+ `attribute_id` smallint unsigned,
26
+ `editable` bit default 0,
27
+ `position` smallint default 0,
28
+ PRIMARY KEY (`id`),
29
+ FOREIGN KEY(`grid_view_id`) REFERENCES `{$installer->getTable('alekseon_ajaxifiedProductEdit/gridview')}`(`id`) ON DELETE CASCADE ON UPDATE CASCADE,
30
+ FOREIGN KEY(`attribute_id`) REFERENCES `{$installer->getTable('eav/attribute')}`(`attribute_id`) ON DELETE CASCADE ON UPDATE CASCADE
31
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
32
+
33
+ ");
34
+ $installer->endSetup();
app/code/community/Alekseon/Core/Block/Adminhtml/System/Config/Fieldset/Alekseon.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Alekseon_Core_Block_Adminhtml_System_Config_Fieldset_Alekseon extends Mage_Adminhtml_Block_Abstract implements Varien_Data_Form_Element_Renderer_Interface
4
+ {
5
+ public function render(Varien_Data_Form_Element_Abstract $element)
6
+ {
7
+ $alekseonUrl = Mage::helper('alekseon_core')->getAlekseonUrl();
8
+ $createdAtImageUrl = $alekseonUrl . '/images/created_by_alekseon.png';
9
+ return '<div><a href="' . $alekseonUrl . '" target="_blank"><img src="' . $createdAtImageUrl . '" alt="Created by Alekseon" title="Created by Alekseon" /></a></div>';
10
+ }
11
+ }
app/code/community/Alekseon/Core/Helper/Data.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Marcin Frymark
4
+ * @email contact@alekseon.com
5
+ * @company Alekseon
6
+ * @website www.alekseon.com
7
+ */
8
+ class Alekseon_Core_Helper_Data extends Mage_Core_Helper_Abstract
9
+ {
10
+ public function getAlekseonUrl()
11
+ {
12
+ return 'http://www.alekseon.com';
13
+ }
14
+
15
+ public function getAlekseonEmail()
16
+ {
17
+ return 'contact@alekseon.com';
18
+ }
19
+ }
app/code/community/Alekseon/Core/etc/config.xml ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * @author Marcin Frymark
5
+ * @email contact@alekseon.com
6
+ * @company Alekseon
7
+ * @website www.alekseon.com
8
+ */
9
+ -->
10
+ <config>
11
+ <modules>
12
+ <Alekseon_Core>
13
+ <version>0.1.0</version>
14
+ </Alekseon_Core>
15
+ </modules>
16
+ <global>
17
+ <blocks>
18
+ <alekseon_core>
19
+ <class>Alekseon_Core_Block</class>
20
+ </alekseon_core>
21
+ </blocks>
22
+ <helpers>
23
+ <alekseon_core>
24
+ <class>Alekseon_Core_Helper</class>
25
+ </alekseon_core>
26
+ </helpers>
27
+ </global>
28
+ </config>
app/design/adminhtml/default/default/layout/alekseon/ajaxifiedProductEdit.xml ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * @author Marcin Frymark
5
+ * @email contact@alekseon.com
6
+ * @company Alekseon
7
+ * @website www.alekseon.com
8
+ */
9
+ -->
10
+ <layout>
11
+ <adminhtml_ajaxifiedproductedit_index>
12
+ <reference name="head">
13
+ <action method="addItem"><type>skin_js</type><name>js/alekseon/ajaxifiedProductEdit.js</name></action>
14
+ </reference>
15
+
16
+ <reference name="content">
17
+ <block type="alekseon_ajaxifiedProductEdit/adminhtml_gridView" template="alekseon/ajaxifiedProductEdit/gridView.phtml" name="grid_view">
18
+ <block type="alekseon_ajaxifiedProductEdit/adminhtml_gridViewSwitcher" name="gridview_switcher" as="gridview_switcher" template="alekseon/ajaxifiedProductEdit/gridViewSwitcher.phtml"/>
19
+ <block type="alekseon_ajaxifiedProductEdit/adminhtml_store_switcher" name="store_switcher" as="store_switcher">
20
+ <action method="setUseConfirm"><params>0</params></action>
21
+ </block>
22
+ </block>
23
+ </reference>
24
+
25
+ <update handle="ajaxifiedProductEdit_grid_input_types" />
26
+ </adminhtml_ajaxifiedproductedit_index>
27
+
28
+ <adminhtml_ajaxifiedproductedit_saverow>
29
+ <update handle="ajaxifiedProductEdit_grid_input_types" />
30
+ </adminhtml_ajaxifiedproductedit_saverow>
31
+
32
+ <ajaxifiedProductEdit_grid_input_types>
33
+ <block type="core/template" name="use_default" template="alekseon/ajaxifiedProductEdit/grid/input/usedefault.phtml" />
34
+ <block type="core/template" name="save_button" template="alekseon/ajaxifiedProductEdit/grid/input/save.phtml" />
35
+ <block type="core/template" name="select_input" template="alekseon/ajaxifiedProductEdit/grid/input/select.phtml" />
36
+ <block type="core/template" name="text_input" template="alekseon/ajaxifiedProductEdit/grid/input/text.phtml" />
37
+ <block type="core/template" name="textarea_input" template="alekseon/ajaxifiedProductEdit/grid/input/textarea.phtml" />
38
+ <block type="core/template" name="price_input" template="alekseon/ajaxifiedProductEdit/grid/input/price.phtml" />
39
+ <block type="core/template" name="multiselect_input" template="alekseon/ajaxifiedProductEdit/grid/input/multiselect.phtml" />
40
+ <block type="core/template" name="boolean_input" template="alekseon/ajaxifiedProductEdit/grid/input/boolean.phtml" />
41
+ <block type="core/template" name="hidden_input" template="alekseon/ajaxifiedProductEdit/grid/input/hidden.phtml" />
42
+ <block type="core/template" name="date_input" template="alekseon/ajaxifiedProductEdit/grid/input/date.phtml" />
43
+ </ajaxifiedProductEdit_grid_input_types>
44
+
45
+ <adminhtml_ajaxifiedproductedit_managegridviews_edit>
46
+ <reference name="head">
47
+ <action method="addItem"><type>skin_js</type><name>js/alekseon/ajaxifiedProductEdit.js</name></action>
48
+ </reference>
49
+ <reference name="content">
50
+ <block type="alekseon_ajaxifiedProductEdit/adminhtml_gridView_manager_edit" name="grid_view_edit"></block>
51
+ </reference>
52
+ <reference name="left">
53
+ <block type="alekseon_ajaxifiedProductEdit/adminhtml_gridView_manager_edit_tabs" name="grid_view_edit_tabs">
54
+ <action method="addTab"><name>general</name><block>alekseon_ajaxifiedProductEdit/adminhtml_gridView_manager_edit_tabs_general</block></action>
55
+ <action method="addTab"><name>manage_columns</name><block>alekseon_ajaxifiedProductEdit/adminhtml_gridView_manager_edit_tabs_manageColumns</block></action>
56
+ </block>
57
+ </reference>
58
+ </adminhtml_ajaxifiedproductedit_managegridviews_edit>
59
+
60
+ <adminhtml_ajaxifiedproductedit_managegridviews_managecolumns>
61
+ <block type="core/text_list" name="root" output="toHtml">
62
+ <block type="alekseon_ajaxifiedProductEdit/adminhtml_gridView_manager_edit_tabs_manageColumns_attributes" name="grid_view_edit_tabs_manage_columns_attributes"/>
63
+ <block type="adminhtml/widget_grid_serializer" name="related_grid_serializer">
64
+ <reference name="related_grid_serializer">
65
+ <action method="initSerializerBlock">
66
+ <grid_block_name>grid_view_edit_tabs_manage_columns_attributes</grid_block_name>
67
+ <data_callback>getSelectedAttributes</data_callback>
68
+ <hidden_input_name>columns[attributes]</hidden_input_name>
69
+ <reload_param_name>gridview_selected_attributes</reload_param_name>
70
+ </action>
71
+ <action method="addColumnInputName">
72
+ <input_name>gridview_selectedattributes_position</input_name>
73
+ </action>
74
+ <action method="addColumnInputName">
75
+ <input_name>gridview_selectedattributes_editable</input_name>
76
+ </action>
77
+ </reference>
78
+ </block>
79
+ </block>
80
+ </adminhtml_ajaxifiedproductedit_managegridviews_managecolumns>
81
+
82
+ <adminhtml_ajaxifiedproductedit_managegridviews_managecolumnsgrid>
83
+ <block type="core/text_list" name="root" output="toHtml">
84
+ <block type="alekseon_ajaxifiedProductEdit/adminhtml_gridView_manager_edit_tabs_manageColumns_attributes" name="grid_view_edit_tabs_manage_columns_attributes"/>
85
+ </block>
86
+ </adminhtml_ajaxifiedproductedit_managegridviews_managecolumnsgrid>
87
+
88
+ </layout>
app/design/adminhtml/default/default/template/alekseon/ajaxifiedProductEdit/grid/input/boolean.phtml ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Marcin Frymark
4
+ * @email contact@alekseon.com
5
+ * @company Alekseon
6
+ * @website www.alekseon.com
7
+ */
8
+ ?>
9
+ <?php $options = $this->getColumn()->getOptions() ?>
10
+ <?php $disabled = '' ?>
11
+ <?php if ($this->getDisabled()): ?>
12
+ <?php $disabled = 'disabled="disabled"' ?>
13
+ <?php endif ?>
14
+ <span <?php if ($this->getHidden()) { echo 'style="display:none"'; } ?>>
15
+ <select name="<?php echo $this->getName() ?>[value]" id="<?php echo $this->getName() ?>" <?php echo $disabled ?> onchange="rowChanged(<?php echo $this->getRowId() ?>)" >
16
+ <?php if ($options): ?>
17
+ <?php foreach($options as $optionsValue => $label): ?>
18
+ <?php if ($this->getValue() == $optionsValue): ?>
19
+ <option value="<?php echo $optionsValue ?>" selected="selected"><?php echo $label ?></option>
20
+ <?php else: ?>
21
+ <option value="<?php echo $optionsValue ?>"><?php echo $label ?></option>
22
+ <?php endif ?>
23
+ <?php endforeach ?>
24
+ <?php else: ?>
25
+ <option value="<?php echo $this->getValue() ?>" selected="selected"><?php echo $this->getValue() ?></option>
26
+ <?php endif ?>
27
+ </select>
28
+ </span>
app/design/adminhtml/default/default/template/alekseon/ajaxifiedProductEdit/grid/input/date.phtml ADDED
@@ -0,0 +1 @@
 
0
  * @author Marcin Frymark
1
  * @email contact@alekseon.com
2
  * @company Alekseon
3
  * @website www.alekseon.com
4
  */
5
  <?php $disabled = 'disabled="disabled"' ?>
6
  <?php $dateElement = new Varien_Data_Form_Element_Date() ?>
7
  <?php $dateElement->setFormat(Mage::app()->getLocale()->getDateFormatWithLongYear()) ?>
8
  <?php $dateElement->setValue($this->getValue()) ?>
9
  <?php $outputFormat = $dateElement->getFormat() ?>
10
  <input name="<?php echo $this->getName() ?>[value]" id="<?php echo $this->getName() ?>" type="text" value="<?php echo $dateElement->getValue() ?>" <?php echo $disabled ?> onchange="rowChanged(<?php echo $this->getRowId() ?>)" />
11
  <?php if (!$this->getDisabled()): ?>
12
  <img src="<?php echo $this->getSkinUrl('images/grid-cal.gif'); ?>" alt="" class="v-middle" id="date_<?php echo $this->getName() ?>" title="Select Date" style="">
13
  <?php endif ?>
14
  <?php $displayFormat = Varien_Date::convertZendToStrFtime($outputFormat, true, false); ?>
15
  <script type="text/javascript">
16
  //<![CDATA[
17
  Calendar.setup({
18
  inputField: "<?php echo $this->getName() ?>",
19
  ifFormat: "<?php echo $displayFormat ?>",
20
  showsTime: false,
21
  button: "date_<?php echo $this->getName() ?>",
22
  align: "Bl",
23
  singleClick : true
24
  });
25
  //]]>
26
  </script>
1
+ <?php
2
  * @author Marcin Frymark
3
  * @email contact@alekseon.com
4
  * @company Alekseon
5
  * @website www.alekseon.com
6
  */
7
  <?php $disabled = 'disabled="disabled"' ?>
8
  <?php $dateElement = new Varien_Data_Form_Element_Date() ?>
9
  <?php $dateElement->setFormat(Mage::app()->getLocale()->getDateFormatWithLongYear()) ?>
10
  <?php $dateElement->setValue($this->getValue()) ?>
11
  <?php $outputFormat = $dateElement->getFormat() ?>
12
  <input name="<?php echo $this->getName() ?>[value]" id="<?php echo $this->getName() ?>" type="text" value="<?php echo $dateElement->getValue() ?>" <?php echo $disabled ?> onchange="rowChanged(<?php echo $this->getRowId() ?>)" />
13
  <?php if (!$this->getDisabled()): ?>
14
  <img src="<?php echo $this->getSkinUrl('images/grid-cal.gif'); ?>" alt="" class="v-middle" id="date_<?php echo $this->getName() ?>" title="Select Date" style="">
15
  <?php endif ?>
16
  <?php $displayFormat = Varien_Date::convertZendToStrFtime($outputFormat, true, false); ?>
17
  <script type="text/javascript">
18
  //<![CDATA[
19
  Calendar.setup({
20
  inputField: "<?php echo $this->getName() ?>",
21
  ifFormat: "<?php echo $displayFormat ?>",
22
  showsTime: false,
23
  button: "date_<?php echo $this->getName() ?>",
24
  align: "Bl",
25
  singleClick : true
26
  });
27
  //]]>
28
  </script>
app/design/adminhtml/default/default/template/alekseon/ajaxifiedProductEdit/grid/input/hidden.phtml ADDED
@@ -0,0 +1 @@
 
0
  * @author Marcin Frymark
1
  * @email contact@alekseon.com
2
  * @company Alekseon
3
  * @website www.alekseon.com
4
  */
5
  <input type="hidden" value="<?php echo $this->getValue() ?>" />
6
  <?php echo $this->getValue() ?>
1
+ <?php
2
  * @author Marcin Frymark
3
  * @email contact@alekseon.com
4
  * @company Alekseon
5
  * @website www.alekseon.com
6
  */
7
  <input type="hidden" value="<?php echo $this->getValue() ?>" />
8
  <?php echo $this->getValue() ?>
app/design/adminhtml/default/default/template/alekseon/ajaxifiedProductEdit/grid/input/multiselect.phtml ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Marcin Frymark
4
+ * @email contact@alekseon.com
5
+ * @company Alekseon
6
+ * @website www.alekseon.com
7
+ */
8
+ ?>
9
+ <?php $options = $this->getColumn()->getOptions() ?>
10
+ <?php $disabled = '' ?>
11
+ <?php if ($this->getDisabled()): ?>
12
+ <?php $disabled = 'disabled="disabled"' ?>
13
+ <?php endif ?>
14
+ <?php $values = explode(',', $this->getValue()) ?>
15
+ <span <?php if ($this->getHidden()) { echo 'style="display:none"'; } ?>>
16
+ <select multiple="multiple" name="<?php echo $this->getName() ?>[value][]" id="<?php echo $this->getName() ?>" <?php echo $disabled ?> onchange="rowChanged(<?php echo $this->getRowId() ?>)" >
17
+ <?php if ($options): ?>
18
+ <?php foreach($options as $optionsValue => $label): ?>
19
+ <?php if (in_array($optionsValue, $values)): ?>
20
+ <option value="<?php echo $optionsValue ?>" selected="selected"><?php echo $label ?></option>
21
+ <?php else: ?>
22
+ <option value="<?php echo $optionsValue ?>"><?php echo $label ?></option>
23
+ <?php endif ?>
24
+ <?php endforeach ?>
25
+ <?php else: ?>
26
+ <option value="<?php echo $this->getValue() ?>" selected="selected"><?php echo $this->getValue() ?></option>
27
+ <?php endif ?>
28
+ </select>
29
+ </span>
app/design/adminhtml/default/default/template/alekseon/ajaxifiedProductEdit/grid/input/price.phtml ADDED
@@ -0,0 +1 @@
 
0
  * @author Marcin Frymark
1
  * @email contact@alekseon.com
2
  * @company Alekseon
3
  * @website www.alekseon.com
4
  */
5
  <?php $disabled = 'disabled="disabled"' ?>
6
  <input name="<?php echo $this->getName() ?>[value]" id="<?php echo $this->getName() ?>" type="text" value="<?php echo $this->getValue() ?>" <?php echo $disabled ?> onchange="rowChanged(<?php echo $this->getRowId() ?>)"/>
1
+ <?php
2
  * @author Marcin Frymark
3
  * @email contact@alekseon.com
4
  * @company Alekseon
5
  * @website www.alekseon.com
6
  */
7
  <?php $disabled = 'disabled="disabled"' ?>
8
  <input name="<?php echo $this->getName() ?>[value]" id="<?php echo $this->getName() ?>" type="text" value="<?php echo $this->getValue() ?>" <?php echo $disabled ?> onchange="rowChanged(<?php echo $this->getRowId() ?>)"/>
app/design/adminhtml/default/default/template/alekseon/ajaxifiedProductEdit/grid/input/save.phtml ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Marcin Frymark
4
+ * @email contact@alekseon.com
5
+ * @company Alekseon
6
+ * @website www.alekseon.com
7
+ */
8
+ ?>
9
+ <?php $saveUrl = $this->getUrl('adminhtml/ajaxifiedProductEdit/saveRow', array('rowId' => $this->getRowId())) ?>
10
+ <button type="button" id="save_button_<?php echo $this->getRowId() ?>" class="disabled save_button" onclick="saveRow('<?php echo $saveUrl ?>', '<?php echo $this->getRowId() ?>')" >
11
+ <span><?php echo $this->__('Save') ?></span>
12
+ </button>
13
+ <br />
14
+ <span id="save_button_message_<?php echo $this->getRowId() ?>"></span>
app/design/adminhtml/default/default/template/alekseon/ajaxifiedProductEdit/grid/input/select.phtml ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Marcin Frymark
4
+ * @email contact@alekseon.com
5
+ * @company Alekseon
6
+ * @website www.alekseon.com
7
+ */
8
+ ?>
9
+ <?php $options = $this->getColumn()->getOptions() ?>
10
+ <?php $disabled = '' ?>
11
+ <?php if ($this->getDisabled()): ?>
12
+ <?php $disabled = 'disabled="disabled"' ?>
13
+ <?php endif ?>
14
+ <span <?php if ($this->getHidden()) { echo 'style="display:none"'; } ?>>
15
+ <select name="<?php echo $this->getName() ?>[value]" id="<?php echo $this->getName() ?>" <?php echo $disabled ?> onchange="rowChanged(<?php echo $this->getRowId() ?>)" >
16
+ <?php if ($options): ?>
17
+ <?php foreach($options as $optionsValue => $label): ?>
18
+ <?php if ($this->getValue() == $optionsValue): ?>
19
+ <option value="<?php echo $optionsValue ?>" selected="selected"><?php echo $label ?></option>
20
+ <?php else: ?>
21
+ <option value="<?php echo $optionsValue ?>"><?php echo $label ?></option>
22
+ <?php endif ?>
23
+ <?php endforeach ?>
24
+ <?php else: ?>
25
+ <option value="<?php echo $this->getValue() ?>" selected="selected"><?php echo $this->getValue() ?></option>
26
+ <?php endif ?>
27
+ </select>
28
+ </span>
app/design/adminhtml/default/default/template/alekseon/ajaxifiedProductEdit/grid/input/text.phtml ADDED
@@ -0,0 +1 @@
 
0
  * @author Marcin Frymark
1
  * @email contact@alekseon.com
2
  * @company Alekseon
3
  * @website www.alekseon.com
4
  */
5
  <?php $disabled = 'disabled="disabled"' ?>
6
  <input name="<?php echo $this->getName() ?>[value]" id="<?php echo $this->getName() ?>" type="text" value="<?php echo $this->getValue() ?>" <?php echo $disabled ?> onchange="rowChanged(<?php echo $this->getRowId() ?>)" />
1
+ <?php
2
  * @author Marcin Frymark
3
  * @email contact@alekseon.com
4
  * @company Alekseon
5
  * @website www.alekseon.com
6
  */
7
  <?php $disabled = 'disabled="disabled"' ?>
8
  <input name="<?php echo $this->getName() ?>[value]" id="<?php echo $this->getName() ?>" type="text" value="<?php echo $this->getValue() ?>" <?php echo $disabled ?> onchange="rowChanged(<?php echo $this->getRowId() ?>)" />
app/design/adminhtml/default/default/template/alekseon/ajaxifiedProductEdit/grid/input/textarea.phtml ADDED
@@ -0,0 +1 @@
 
0
  * @author Marcin Frymark
1
  * @email contact@alekseon.com
2
  * @company Alekseon
3
  * @website www.alekseon.com
4
  */
5
  <?php $disabled = 'disabled="disabled"' ?>
6
  <textarea name="<?php echo $this->getName() ?>[value]" id="<?php echo $this->getName() ?>" <?php echo $disabled ?> onchange="rowChanged(<?php echo $this->getRowId() ?>)" /><?php echo $this->getValue() ?></textarea>
1
+ <?php
2
  * @author Marcin Frymark
3
  * @email contact@alekseon.com
4
  * @company Alekseon
5
  * @website www.alekseon.com
6
  */
7
  <?php $disabled = 'disabled="disabled"' ?>
8
  <textarea name="<?php echo $this->getName() ?>[value]" id="<?php echo $this->getName() ?>" <?php echo $disabled ?> onchange="rowChanged(<?php echo $this->getRowId() ?>)" /><?php echo $this->getValue() ?></textarea>
app/design/adminhtml/default/default/template/alekseon/ajaxifiedProductEdit/grid/input/usedefault.phtml ADDED
@@ -0,0 +1 @@
 
0
  * @author Marcin Frymark
1
  * @email contact@alekseon.com
2
  * @company Alekseon
3
  * @website www.alekseon.com
4
  */
5
  <?php $checked = 'checked="checked"' ?>
1
+ <?php
2
  * @author Marcin Frymark
3
  * @email contact@alekseon.com
4
  * @company Alekseon
5
  * @website www.alekseon.com
6
  */
7
  <?php $checked = 'checked="checked"' ?>
app/design/adminhtml/default/default/template/alekseon/ajaxifiedProductEdit/gridView.phtml ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Marcin Frymark
4
+ * @email contact@alekseon.com
5
+ * @company Alekseon
6
+ * @website www.alekseon.com
7
+ */
8
+ ?>
9
+ <div class="content-header">
10
+ <table cellspacing="0">
11
+ <tr>
12
+ <td style="width:50%;"><h3 class="icon-head head-products"><?php echo Mage::helper('alekseon_ajaxifiedProductEdit')->__('Ajaxified Product Edit') ?></h3></td>
13
+ <td class="a-right">
14
+ <?php echo $this->getButtonsHtml() ?>
15
+ </td>
16
+ </tr>
17
+ </table>
18
+ </form>
19
+ </div>
20
+ <?php echo $this->getBlockHtml('gridview_switcher')?>
21
+ <?php if(!$this->isSingleStoreMode()): ?>
22
+ <?php echo $this->getChildHtml('store_switcher');?>
23
+ <?php endif;?>
24
+ <div>
25
+ <form id="form-ajaxifiedProductEdit" action="" >
26
+ <input type="hidden" id="store" name="store" value="<?php echo $this->getStoreId() ?>" />
27
+ <?php echo $this->getGridHtml() ?>
28
+ </form>
29
+ </div>
30
+ <script type="text/javascript">
31
+ //<![CDATA[
32
+
33
+ var productRow = new ProductRow('form-ajaxifiedProductEdit', '<?php echo $this->__('saving...') ?>', '<?php echo $this->__('Save failed.') ?>');
34
+
35
+ function saveRow(saveUrl, rowId)
36
+ {
37
+ if ($('save_button_' + rowId).hasClassName('disabled')) {
38
+ return false;
39
+ }
40
+
41
+ productRow.save(saveUrl, rowId);
42
+
43
+ return false;
44
+ }
45
+
46
+ function toggleValueElements(element, inputId)
47
+ {
48
+ if (element.checked) {
49
+ $(inputId).up().hide();
50
+ $(inputId + '[default_value]').up().show();
51
+ } else {
52
+ $(inputId).up().show();
53
+ $(inputId + '[default_value]').up().hide();
54
+ }
55
+ }
56
+
57
+ function rowChanged(rowId)
58
+ {
59
+ $('save_button_' + rowId).removeClassName('disabled');
60
+ $('save_button_message_' + rowId).update("<?php echo $this->__('Not saved') ?>");
61
+ }
62
+
63
+ function alertIfDataHasChanged()
64
+ {
65
+ buttons = $$('.save_button')
66
+
67
+ for(i = 0; i< buttons.length; i++) {
68
+ if (!buttons[i].hasClassName('disabled')) {
69
+ return confirm("<?php echo $this->__('All data that hasn\'t been saved will be lost') ?>");
70
+ }
71
+ }
72
+
73
+ return true;
74
+ }
75
+
76
+ //]]>
77
+ </script>
app/design/adminhtml/default/default/template/alekseon/ajaxifiedProductEdit/gridViewSwitcher.phtml ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Marcin Frymark
4
+ * @email contact@alekseon.com
5
+ * @company Alekseon
6
+ * @website www.alekseon.com
7
+ */
8
+ ?>
9
+ <p class="switcher">
10
+ <b><?php echo $this->getCurrentGridView()->getLabel(); ?></b>
11
+ <br />
12
+ <?php echo $this->getCurrentGridView()->getDescription(); ?>
13
+ <?php if ($this->getGridViews()->count() > 1): ?>
14
+ <br />
15
+ <label for="attributes_switcher"><?php echo $this->__('Change Grid View') ?>:</label>
16
+ <select name="attributes_switcher" id="attributes_switcher" onchange="return switchGridView(this);">
17
+ <?php foreach($this->getGridViews() as $gridView): ?>
18
+ <option value="<?php echo $gridView->getId() ?>"<?php if ($this->getCurrentGridView()->getId() == $gridView->getId()): ?> selected="selected"<?php endif; ?>><?php echo $gridView->getLabel() ?></option>
19
+ <?php endforeach ?>
20
+ </select>
21
+ <script type="text/javascript">
22
+ function switchGridView(obj){
23
+ var viewParam = obj.value ? 'view/' + obj.value + '/' : '';
24
+ if(obj.viewParams){
25
+ viewParam += obj.viewParams;
26
+ }
27
+ if (alertIfDataHasChanged()) {
28
+ setLocation('<?php echo $this->getSwitchUrl() ?>' + viewParam);
29
+ } else {
30
+ obj.value = '<?php echo $this->getCurrentGridView()->getId()?>';
31
+ return false;
32
+ }
33
+ }
34
+ </script>
35
+ <?php endif ?>
36
+ </p>
app/design/adminhtml/default/default/template/alekseon/ajaxifiedProductEdit/store/switcher.phtml ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Marcin Frymark
4
+ * @email contact@alekseon.com
5
+ * @company Alekseon
6
+ * @website www.alekseon.com
7
+ */
8
+ ?>
9
+ <?php if ($websites = $this->getWebsites()): ?>
10
+ <p class="switcher"><label for="store_switcher"><?php echo $this->__('Choose Store View') ?>:</label>
11
+ <select name="store_switcher" id="store_switcher" onchange="return switchStore(this);">
12
+ <?php if ($this->hasDefaultOption()): ?>
13
+ <option value=""><?php echo $this->getDefaultStoreName() ?></option>
14
+ <?php endif; ?>
15
+ <?php foreach ($websites as $website): ?>
16
+ <?php $showWebsite=false; ?>
17
+ <?php foreach ($website->getGroups() as $group): ?>
18
+ <?php $showGroup=false; ?>
19
+ <?php foreach ($this->getStores($group) as $store): ?>
20
+ <?php if ($showWebsite == false): ?>
21
+ <?php $showWebsite = true; ?>
22
+ <optgroup label="<?php echo $website->getName() ?>"></optgroup>
23
+ <?php endif; ?>
24
+ <?php if ($showGroup == false): ?>
25
+ <?php $showGroup = true; ?>
26
+ <optgroup label="&nbsp;&nbsp;&nbsp;<?php echo $group->getName() ?>">
27
+ <?php endif; ?>
28
+ <option value="<?php echo $store->getId() ?>"<?php if($this->getStoreId() == $store->getId()): ?> selected="selected"<?php endif; ?>>&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $store->getName() ?></option>
29
+ <?php endforeach; ?>
30
+ <?php if ($showGroup): ?>
31
+ </optgroup>
32
+ <?php endif; ?>
33
+ <?php endforeach; ?>
34
+ <?php endforeach; ?>
35
+ </select>
36
+ </p>
37
+ <script type="text/javascript">
38
+ function switchStore(obj){
39
+ var storeParam = obj.value ? 'store/'+obj.value + '/' : '';
40
+ if(obj.switchParams){
41
+ storeParam+= obj.switchParams;
42
+ }
43
+ if (alertIfDataHasChanged()) {
44
+ setLocation('<?php echo $this->getSwitchUrl() ?>'+storeParam);
45
+ } else {
46
+ obj.value = '<?php echo $this->getStoreId() ?>';
47
+ return false;
48
+ }
49
+ }
50
+ </script>
51
+ <?php endif; ?>
app/etc/modules/Alekseon_AdminNotification.xml ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * @author Marcin Frymark
5
+ * @email contact@alekseon.com
6
+ * @company Alekseon
7
+ * @website www.alekseon.com
8
+ */
9
+ -->
10
+ <config>
11
+ <modules>
12
+ <Alekseon_AdminNotification>
13
+ <active>true</active>
14
+ <codePool>community</codePool>
15
+ <depends>
16
+ <Mage_AdminNotification />
17
+ <Alekseon_Core />
18
+ </depends>
19
+ </Alekseon_AdminNotification>
20
+ </modules>
21
+ </config>
app/etc/modules/Alekseon_AjaxifiedProductEdit.xml ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * @author Marcin Frymark
5
+ * @email contact@alekseon.com
6
+ * @company Alekseon
7
+ * @website www.alekseon.com
8
+ */
9
+ -->
10
+ <config>
11
+ <modules>
12
+ <Alekseon_AjaxifiedProductEdit>
13
+ <active>true</active>
14
+ <codePool>community</codePool>
15
+ </Alekseon_AjaxifiedProductEdit>
16
+ </modules>
17
+ </config>
app/etc/modules/Alekseon_Core.xml ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * @author Marcin Frymark
5
+ * @email contact@alekseon.com
6
+ * @company Alekseon
7
+ * @website www.alekseon.com
8
+ */
9
+ -->
10
+ <config>
11
+ <modules>
12
+ <Alekseon_Core>
13
+ <active>true</active>
14
+ <codePool>community</codePool>
15
+ </Alekseon_Core>
16
+ </modules>
17
+ </config>
package.xml ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>ajaxified_product_edit</name>
4
+ <version>0.1.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>This module will help you manage the product attributes.</summary>
10
+ <description>This module will help you manage the product attributes. Edit values of your product attributes just from grid view and save them by ajax, without reloading page.&#xD;
11
+ &#xD;
12
+ You can create several grid views with different attributes, and manage acces to them for specific user groups.</description>
13
+ <notes>This module will help you manage the product attributes.</notes>
14
+ <authors><author><name>Marcin Frymark</name><user>Alekseon</user><email>contact@alekseon.com</email></author></authors>
15
+ <date>2014-03-06</date>
16
+ <time>17:16:24</time>
17
+ <contents><target name="magecommunity"><dir name="Alekseon"><dir name="AjaxifiedProductEdit"><dir><dir name="Block"><dir name="Adminhtml"><dir name="GridView"><dir name="Grid"><dir name="Renderer"><file name="Input.php" hash="41c6083eca3049aef908a4d7900e63f3"/><file name="SaveButton.php" hash="881214c7b1f657d976c9692231567f05"/></dir></dir><file name="Grid.php" hash="f52db47fcb9c0b0823ce9f7680687ad7"/><dir name="Manager"><dir name="Edit"><file name="Form.php" hash="5a607b626d7aea903f9bbeca066d0803"/><dir name="Tabs"><file name="General.php" hash="baa7871b27568f2bb8f6f8914aee0dd8"/><dir name="ManageColumns"><file name="Attributes.php" hash="5a2e20af80d8171174da915228c3a932"/></dir><file name="ManageColumns.php" hash="36fbd89f31f2ca5e4f5198c329b513ac"/></dir><file name="Tabs.php" hash="9ad143b7b77e307b95f30b87c4e20af1"/></dir><file name="Edit.php" hash="2cc5679f87e5c63b6196898b0cdcd81e"/><file name="Grid.php" hash="6ce65a1fe5f5e6c9b47f926c1d130fe8"/></dir><file name="Manager.php" hash="6f93b82e166d0e65b4b279a25c3958cc"/></dir><file name="GridView.php" hash="dca5276d52cd0f23af91fc4ecd72c236"/><file name="GridViewSwitcher.php" hash="01f6c060326f05ddbf5d566d81a14dd6"/><dir name="Store"><file name="Switcher.php" hash="90287308aeda8573a39b8cff0677e084"/></dir><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><file name="ManageGridViewsButton.php" hash="7ffe45be1540f827c0223e322404dba2"/></dir></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="e1af6d1884acf1dcea37afd5acf45de6"/></dir><dir name="Model"><file name="GridView.php" hash="8486fc0283216f3cbba04275d3dff67f"/><dir name="Resource"><dir name="GridView"><dir name="Attribute"><file name="Collection.php" hash="e81a0072797932cb0e68e1458f2e057a"/></dir><file name="Collection.php" hash="103a52eb43697774f4b4a1a7948ac20a"/></dir><file name="GridView.php" hash="d5f19460fd18a8292848eb974ee67b4b"/></dir><dir name="System"><dir name="Config"><dir name="Backend"><file name="Cache.php" hash="8e3b12fe3a60e4fa2be4d0e3c956fcdf"/></dir><dir name="Source"><file name="ProductAttributes.php" hash="6d685822dd377e403ff9b35f8107c63d"/><file name="UserRole.php" hash="68411f383ed71b48452bac3f575a35dc"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><dir name="AjaxifiedProductEdit"><file name="ManageGridViewsController.php" hash="40388bf41d0885b7650a37949556fba3"/></dir><file name="AjaxifiedProductEditController.php" hash="c59b4c7035e744f1addf49b9182c086d"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="bcaf2ecce772dd2771d908f26ac09196"/><file name="config.xml" hash="6e8ab75fd49ff88b75073cabdee2428a"/><file name="logging.xml" hash="2876868df1ebedfd3f7fe773fdbed0c0"/><file name="system.xml" hash="6b443416dfee0c28384e79c63eead1f0"/></dir><dir name="sql"><dir name="alekseon_ajaxifiedproductedit_setup"><file name="mysql4-install-0.1.0.php" hash="fe315b9f9c6a75439bfc1d164e07f39b"/></dir></dir></dir></dir><dir name="Core"><dir><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Fieldset"><file name="Alekseon.php" hash="1d51aaf89f838ec44b2c2bbafb74a664"/></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="8e117e0ba3c38786238baf66af89a127"/></dir><dir name="etc"><file name="config.xml" hash="e77d6e9d49f28d9f2f8b0884b0d49997"/></dir></dir></dir><dir name="AdminNotification"><dir><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><file name="Notification.php" hash="0cf97c24e0e7497955ee17fb14daef52"/></dir></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="d82dbd74204aace87e9f28be31ba98e6"/></dir><dir name="Model"><file name="Feed.php" hash="d25c0486febfecd06567e9d487ffde11"/><file name="Observer.php" hash="0bc915784005f5424bfa4940bb496d05"/></dir><dir name="etc"><file name="adminhtml.xml" hash="b63f6dd92e49def5499f7560bc1fa15c"/><file name="config.xml" hash="0ed69e4e9d2dbcfbd2cc24d2f79faf46"/><file name="system.xml" hash="7211e39b5159acca15740dfd391f69af"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Alekseon_AjaxifiedProductEdit.xml" hash="f651f22f2378cddd5fccdba04c6fd758"/><file name="Alekseon_AdminNotification.xml" hash="9635261e9cedc0c69e49d20bcddfbc6e"/><file name="Alekseon_Core.xml" hash="c579cb3ce377e8c4ffa86ef00cb7c006"/></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="js"><dir name="alekseon"><file name="ajaxifiedProductEdit.js" hash="5a111780b3e03327972e2b6826178dbd"/></dir></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><dir name="alekseon"><file name="ajaxifiedProductEdit.xml" hash="3cbe92362cc6f89f35915ebc85cc893a"/></dir></dir><dir name="template"><dir name="alekseon"><dir><dir name="ajaxifiedProductEdit"><dir name="grid"><dir name="input"><file name="boolean.phtml" hash="3f473d5ba3a7a91c9cb2901267b0fb87"/><file name="date.phtml" hash="e7d702354ec4d129928ae66acd3a905a"/><file name="hidden.phtml" hash="f9c98f36fa00488c1ea671b219023557"/><file name="multiselect.phtml" hash="7d634e663647cc313c6ac3becba4281c"/><file name="price.phtml" hash="2709f6bdaa70784bfa05ae6e99581769"/><file name="save.phtml" hash="2023ca4a0f48a6ca83d9799bed134e64"/><file name="select.phtml" hash="3f473d5ba3a7a91c9cb2901267b0fb87"/><file name="text.phtml" hash="ca59e8eaa2ed388152a3be547ed7f023"/><file name="textarea.phtml" hash="c8788dd3b628c5ef8cdb0faf6581e9ce"/><file name="usedefault.phtml" hash="82f478a8aba513dab232740abc32c731"/></dir></dir><file name="gridView.phtml" hash="540624c3b84074dce7085eab4719ce98"/><file name="gridViewSwitcher.phtml" hash="2269d77a164d46f59c5567235814882d"/><dir name="store"><file name="switcher.phtml" hash="03c8037a7915b663814419842095473f"/></dir></dir></dir></dir></dir></dir></dir></dir></target></contents>
18
+ <compatible/>
19
+ <dependencies><required><php><min>5.3.0</min><max>6.0.0</max></php></required></dependencies>
20
+ </package>
skin/adminhtml/default/default/js/alekseon/ajaxifiedProductEdit.js ADDED
@@ -0,0 +1 @@
 
0
  * @author Marcin Frymark
1
  * @email contact@alekseon.com
2
  * @company Alekseon
3
  * @website www.alekseon.com
4
  */
5
  initialize: function(form, savingMsg, failureMsg){
6
  this.onSave = this.saveSuccess.bindAsEventListener(this);
7
  this.onFailure = this.saveFailure.bindAsEventListener(this);
8
  this.savingMsg = savingMsg;
9
  this.failureMsg = failureMsg;
10
  this.form = form;
11
  },
12
  save: function(saveUrl, rowId){
13
 
14
  $('save_button_message_' + rowId).update(this.savingMsg);
15
  $('save_button_' + rowId).addClassName('disabled');
16
  var request = new Ajax.Request(
17
  saveUrl,
18
  {
19
  loaderArea: false,
20
  method: 'post',
21
  onComplete: '',
22
  onSuccess: this.onSave,
23
  onFailure: this.onFailure,
24
  evalScripts: true,
25
  parameters: Form.serialize(this.form)
26
  }
27
  );
28
  },
29
 
30
  saveSuccess: function(transport){
31
  response = eval('(' + transport.responseText + ')');;
32
  rowId = response.rowId;
33
  successMsg = response.successMsg;
34
  if (successMsg) {
35
  if (response.updateData) {
36
  for (var data in response.updateData) {
37
  if ($(data)) {
38
  $(data).parentNode.innerHTML = response.updateData[data];
39
  parseAjaxResponse(response.updateData[data]);
40
  }
41
  }
42
  }
43
  $('save_button_message_' + rowId).update(successMsg);
44
  $('save_button_' + rowId).addClassName('disabled');
45
  } else {
46
  $('save_button_message_' + rowId).update(response.errorMsg);
47
  $('save_button_' + rowId).removeClassName('disabled');
48
  }
49
  },
50
  saveFailure: function(transport){
51
  alert(this.failureMsg);
52
  }
53
  var element = Event.findElement(event, 'tr');
54
  if (Event.element(event).type != 'checkbox') {
55
  if(['img', 'a', 'input', 'select', 'option', 'img'].indexOf(Event.element(event).tagName.toLowerCase())!=-1) {
56
  var checkbox = Element.select(element, 'input');
57
  if(checkbox[0] && !checkbox[0].disabled) {
58
  grid.setCheckboxChecked(checkbox[0], true);
59
  }
60
  return;
61
  }
62
  }
63
  if (element.title) {
64
  setLocation(element.title);
65
  }
66
  var source = mixedResponse;
67
  var scripts = new Array();
68
  while(source.indexOf('<script') > -1 || source.indexOf('</script') > -1) {
69
  var s = source.indexOf('<script');
70
  var s_e = source.indexOf('>', s);
71
  var e = source.indexOf('</script', s);
72
  var e_e = source.indexOf('>', e);
73
  scripts.push(source.substring(s_e+1, e));
74
  source = source.substring(0, s) + source.substring(e_e+1);
75
  }
76
  for(var x=0; x<scripts.length; x++) {
77
  try {
78
  eval(scripts[x]);
79
  }
80
  catch(ex) {
81
  }
82
  }
83
  return source;
1
+ /**
2
  * @author Marcin Frymark
3
  * @email contact@alekseon.com
4
  * @company Alekseon
5
  * @website www.alekseon.com
6
  */
7
  initialize: function(form, savingMsg, failureMsg){
8
  this.onSave = this.saveSuccess.bindAsEventListener(this);
9
  this.onFailure = this.saveFailure.bindAsEventListener(this);
10
  this.savingMsg = savingMsg;
11
  this.failureMsg = failureMsg;
12
  this.form = form;
13
  },
14
  save: function(saveUrl, rowId){
15
 
16
  $('save_button_message_' + rowId).update(this.savingMsg);
17
  $('save_button_' + rowId).addClassName('disabled');
18
  var request = new Ajax.Request(
19
  saveUrl,
20
  {
21
  loaderArea: false,
22
  method: 'post',
23
  onComplete: '',
24
  onSuccess: this.onSave,
25
  onFailure: this.onFailure,
26
  evalScripts: true,
27
  parameters: Form.serialize(this.form)
28
  }
29
  );
30
  },
31
 
32
  saveSuccess: function(transport){
33
  response = eval('(' + transport.responseText + ')');;
34
  rowId = response.rowId;
35
  successMsg = response.successMsg;
36
  if (successMsg) {
37
  if (response.updateData) {
38
  for (var data in response.updateData) {
39
  if ($(data)) {
40
  $(data).parentNode.innerHTML = response.updateData[data];
41
  parseAjaxResponse(response.updateData[data]);
42
  }
43
  }
44
  }
45
  $('save_button_message_' + rowId).update(successMsg);
46
  $('save_button_' + rowId).addClassName('disabled');
47
  } else {
48
  $('save_button_message_' + rowId).update(response.errorMsg);
49
  $('save_button_' + rowId).removeClassName('disabled');
50
  }
51
  },
52
  saveFailure: function(transport){
53
  alert(this.failureMsg);
54
  }
55
  var element = Event.findElement(event, 'tr');
56
  if (Event.element(event).type != 'checkbox') {
57
  if(['img', 'a', 'input', 'select', 'option', 'img'].indexOf(Event.element(event).tagName.toLowerCase())!=-1) {
58
  var checkbox = Element.select(element, 'input');
59
  if(checkbox[0] && !checkbox[0].disabled) {
60
  grid.setCheckboxChecked(checkbox[0], true);
61
  }
62
  return;
63
  }
64
  }
65
  if (element.title) {
66
  setLocation(element.title);
67
  }
68
  var source = mixedResponse;
69
  var scripts = new Array();
70
  while(source.indexOf('<script') > -1 || source.indexOf('</script') > -1) {
71
  var s = source.indexOf('<script');
72
  var s_e = source.indexOf('>', s);
73
  var e = source.indexOf('</script', s);
74
  var e_e = source.indexOf('>', e);
75
  scripts.push(source.substring(s_e+1, e));
76
  source = source.substring(0, s) + source.substring(e_e+1);
77
  }
78
  for(var x=0; x<scripts.length; x++) {
79
  try {
80
  eval(scripts[x]);
81
  }
82
  catch(ex) {
83
  }
84
  }
85
  return source;