Version Notes
* Added documentation
* added toJson wrapper to base model
Download this release
Release Info
Developer | Magento Core Team |
Extension | Eabi_Livehandler |
Version | 0.1.5 |
Comparing to | |
See all releases |
Code changes from version 0.1.4 to 0.1.5
- app/code/community/Eabi/Livehandler/Block/Adminhtml/Config/Form/Field/Button.php +7 -1
- app/code/community/Eabi/Livehandler/Block/Adminhtml/Config/Form/Field/Remove.php +13 -2
- app/code/community/Eabi/Livehandler/Block/Footer.php +4 -1
- app/code/community/Eabi/Livehandler/Model/Abstract.php +11 -3
- app/code/community/Eabi/Livehandler/Model/Action/Abstract.php +65 -9
- app/code/community/Eabi/Livehandler/Model/Action/Postoffice/Print.php +20 -1
- app/code/community/Eabi/Livehandler/Model/Action/Postoffice/Send.php +18 -1
- app/code/community/Eabi/Livehandler/Model/Adminhtml/Gridmanager.php +33 -7
- app/code/community/Eabi/Livehandler/Model/Directory/Collection.php +1 -1
- app/code/community/Eabi/Livehandler/Model/Entry.php +57 -3
- app/code/community/Eabi/Livehandler/Model/File/Object.php +1 -1
- app/code/community/Eabi/Livehandler/Model/Mysql4/Entry.php +1 -2
- app/code/community/Eabi/Livehandler/Model/Mysql4/Entry/Collection.php +27 -2
- app/code/community/Eabi/Livehandler/Model/Ordergrid.php +32 -7
- app/code/community/Eabi/Livehandler/Model/System/Config/Backend/Button.php +18 -2
- app/code/community/Eabi/Livehandler/controllers/Adminhtml/LivehandlerController.php +4 -0
- app/code/community/Eabi/Livehandler/etc/config.xml +1 -1
- app/code/community/Eabi/Livehandler/sql/eabi_livehandler_setup/mysql4-install-0.1.0.php +21 -0
- app/code/community/Eabi/Livehandler/sql/eabi_livehandler_setup/mysql4-upgrade-0.1.0-0.1.1.php +4 -1
- app/etc/modules/Eabi_Livehandler.xml +1 -1
- package.xml +6 -8
app/code/community/Eabi/Livehandler/Block/Adminhtml/Config/Form/Field/Button.php
CHANGED
@@ -31,7 +31,13 @@
|
|
31 |
*/
|
32 |
|
33 |
/**
|
34 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
*
|
36 |
* @author Matis
|
37 |
*/
|
31 |
*/
|
32 |
|
33 |
/**
|
34 |
+
* <p>Renders list of available action buttons in Magento admin > System > Configuration > Eabi Livehandler > Admin Order Grid Helper configuration menu</p>
|
35 |
+
* <p>Each button refers to subclass of <b>Eabi_Livehandler_Model_Action_Abstract</b> and contains following:</p>
|
36 |
+
* <ul>
|
37 |
+
<li><b>button_name</b> - name of the button relative to eabi_livehandler/action_<button-name> or full magento model name</li>
|
38 |
+
<li><b>sort_order</b> - buttons in the order info display are sorted ascending order</li>
|
39 |
+
<li><b>disabled</b> - 0 means button is enabled, 1 means button is disabled</li>
|
40 |
+
</ul>
|
41 |
*
|
42 |
* @author Matis
|
43 |
*/
|
app/code/community/Eabi/Livehandler/Block/Adminhtml/Config/Form/Field/Remove.php
CHANGED
@@ -31,8 +31,19 @@
|
|
31 |
*/
|
32 |
|
33 |
/**
|
34 |
-
*
|
35 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
* @author Matis
|
37 |
*/
|
38 |
class Eabi_Livehandler_Block_Adminhtml_Config_Form_Field_Remove extends Mage_Adminhtml_Block_System_Config_Form_Field {
|
31 |
*/
|
32 |
|
33 |
/**
|
34 |
+
* <p>Renders button, which allows to delete old instance of Eabi_Livehandler from app/code/local folder in Magento admin > System > Configuration > Eabi Livehandler > Admin Order Grid Helper configuration menu, if such old instance exists</p>
|
35 |
+
* <p>Use following system.xml struct to include this button:</p>
|
36 |
+
* <pre>
|
37 |
+
* <removal translate="">
|
38 |
+
<label></label>
|
39 |
+
<frontend_model>eabi_postoffice/adminhtml_config_form_field_remove</frontend_model>
|
40 |
+
<sort_order>1000001</sort_order>
|
41 |
+
<show_in_default>1</show_in_default>
|
42 |
+
<show_in_website>0</show_in_website>
|
43 |
+
<show_in_store>0</show_in_store>
|
44 |
+
</removal>
|
45 |
+
|
46 |
+
* </pre>
|
47 |
* @author Matis
|
48 |
*/
|
49 |
class Eabi_Livehandler_Block_Adminhtml_Config_Form_Field_Remove extends Mage_Adminhtml_Block_System_Config_Form_Field {
|
app/code/community/Eabi/Livehandler/Block/Footer.php
CHANGED
@@ -31,7 +31,10 @@
|
|
31 |
*/
|
32 |
|
33 |
/**
|
34 |
-
*
|
|
|
|
|
|
|
35 |
*
|
36 |
* @author matishalmann
|
37 |
*/
|
31 |
*/
|
32 |
|
33 |
/**
|
34 |
+
* <p>Writes javascript before_body_end when request_var from eabi_livehandler table matches Magentos request full name.</p>
|
35 |
+
* <p>Sets up listener for corresponding Magento model, which comes from model_class field.</p>
|
36 |
+
* <p>Listener works only when matching javascript is rendered and user has not left the page.</p>
|
37 |
+
* <p>On other cases this class does nothing</p>
|
38 |
*
|
39 |
* @author matishalmann
|
40 |
*/
|
app/code/community/Eabi/Livehandler/Model/Abstract.php
CHANGED
@@ -31,12 +31,12 @@
|
|
31 |
*/
|
32 |
|
33 |
/**
|
34 |
-
*
|
|
|
35 |
*
|
36 |
* @author matishalmann
|
37 |
*/
|
38 |
abstract class Eabi_Livehandler_Model_Abstract extends Mage_Core_Model_Abstract {
|
39 |
-
//put your code here
|
40 |
|
41 |
//construct will be done in subclasses
|
42 |
|
@@ -55,6 +55,14 @@ abstract class Eabi_Livehandler_Model_Abstract extends Mage_Core_Model_Abstract
|
|
55 |
public function process($postedData) {
|
56 |
return array();
|
57 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
|
59 |
}
|
60 |
-
?>
|
31 |
*/
|
32 |
|
33 |
/**
|
34 |
+
* <p>Base implementing class for eabi_livehandler.model_class property</p>
|
35 |
+
* <p>This class should fire response for the actual ajax request</p>
|
36 |
*
|
37 |
* @author matishalmann
|
38 |
*/
|
39 |
abstract class Eabi_Livehandler_Model_Abstract extends Mage_Core_Model_Abstract {
|
|
|
40 |
|
41 |
//construct will be done in subclasses
|
42 |
|
55 |
public function process($postedData) {
|
56 |
return array();
|
57 |
}
|
58 |
+
|
59 |
+
/**
|
60 |
+
* <p>Wrapper json_encode in order to make it easier to use in heredoc syntax</p>
|
61 |
+
* @param mixed $input
|
62 |
+
* @return string
|
63 |
+
*/
|
64 |
+
protected function _toJson($input) {
|
65 |
+
return json_encode($input);
|
66 |
+
}
|
67 |
|
68 |
}
|
|
app/code/community/Eabi/Livehandler/Model/Action/Abstract.php
CHANGED
@@ -31,12 +31,23 @@
|
|
31 |
*/
|
32 |
|
33 |
/**
|
34 |
-
*
|
|
|
|
|
35 |
*
|
36 |
* @author Matis
|
37 |
*/
|
38 |
abstract class Eabi_Livehandler_Model_Action_Abstract {
|
|
|
|
|
|
|
|
|
39 |
protected $_position;
|
|
|
|
|
|
|
|
|
|
|
40 |
protected $_code;
|
41 |
protected $_label;
|
42 |
protected $_onClick;
|
@@ -45,46 +56,91 @@ abstract class Eabi_Livehandler_Model_Action_Abstract {
|
|
45 |
|
46 |
/**
|
47 |
* Decides whether the button can be displayed for the current order
|
|
|
48 |
*/
|
49 |
abstract public function canDisplay(Mage_Sales_Model_Order $order);
|
50 |
|
51 |
/**
|
52 |
-
*
|
53 |
-
*
|
54 |
-
*
|
55 |
-
|
56 |
-
|
57 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
*/
|
59 |
abstract public function performDesiredAction(Mage_Sales_Model_Order $order, array $params);
|
60 |
|
61 |
-
|
|
|
|
|
|
|
|
|
62 |
public function setPosition($position) {
|
63 |
$this->_position = $position;
|
64 |
}
|
|
|
|
|
|
|
|
|
|
|
65 |
public function getPosition() {
|
66 |
return $this->_position;
|
67 |
}
|
68 |
|
|
|
|
|
|
|
|
|
|
|
69 |
public function getCode() {
|
70 |
return $this->_code;
|
71 |
}
|
72 |
|
|
|
|
|
|
|
|
|
73 |
public function getLabel() {
|
74 |
return $this->_label;
|
75 |
}
|
76 |
|
|
|
|
|
|
|
|
|
77 |
public function getOnClick() {
|
78 |
return $this->_onClick;
|
79 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
public function getCssClass() {
|
81 |
return $this->_cssClass;
|
82 |
}
|
|
|
|
|
|
|
|
|
|
|
83 |
public function getLongOnClick() {
|
84 |
return $this->_longOnClick;
|
85 |
}
|
86 |
|
87 |
-
|
|
|
|
|
|
|
|
|
88 |
protected function _toJson($input) {
|
89 |
return json_encode($input);
|
90 |
}
|
31 |
*/
|
32 |
|
33 |
/**
|
34 |
+
* <p>Base class for action buttons, which are displayed at Magento Administrators Sales Order Grid.</p>
|
35 |
+
* <p>Buttons are shown when clicking on 'Show Order Info' button.</p>
|
36 |
+
* <p>Buttons can have onclick handler and desired action bound to it, when it is clicked.</p>
|
37 |
*
|
38 |
* @author Matis
|
39 |
*/
|
40 |
abstract class Eabi_Livehandler_Model_Action_Abstract {
|
41 |
+
/**
|
42 |
+
* <p>Buttons are sorted by position in ascending order</p>
|
43 |
+
* @var int
|
44 |
+
*/
|
45 |
protected $_position;
|
46 |
+
|
47 |
+
/**
|
48 |
+
* <p>name of the button relative to eabi_livehandler/action_<button-name> or full magento model name</p>
|
49 |
+
* @var string
|
50 |
+
*/
|
51 |
protected $_code;
|
52 |
protected $_label;
|
53 |
protected $_onClick;
|
56 |
|
57 |
/**
|
58 |
* Decides whether the button can be displayed for the current order
|
59 |
+
* @return bool true, when this button can be displayed for current order.
|
60 |
*/
|
61 |
abstract public function canDisplay(Mage_Sales_Model_Order $order);
|
62 |
|
63 |
/**
|
64 |
+
* <p>This function is called when current button is clicked and data along with it is sent to server.</p>
|
65 |
+
* <p>Returned data should be in following format:</p>
|
66 |
+
* <pre>
|
67 |
+
$result = array(
|
68 |
+
'messages' => array of messages, which are displayed as success messages to the user,
|
69 |
+
'errors' => array of error, which are displayed as errors to the user,
|
70 |
+
'needs_reload' => when set to true, whole page is reloaded when Order Manager is closed,
|
71 |
+
'is_action_error' => when set to true whole page is reloaded immediately,
|
72 |
+
);
|
73 |
+
* </pre>
|
74 |
+
* @param Mage_Sales_Model_Order $order current order that is being displayed
|
75 |
+
* @param array $params assoc array of POST params
|
76 |
+
* @return bool|array when action failed, return false, otherwise return array.
|
77 |
*/
|
78 |
abstract public function performDesiredAction(Mage_Sales_Model_Order $order, array $params);
|
79 |
|
80 |
+
/**
|
81 |
+
*
|
82 |
+
* <p>Buttons are sorted by position in ascending order</p>
|
83 |
+
* @param int $position desired position
|
84 |
+
*/
|
85 |
public function setPosition($position) {
|
86 |
$this->_position = $position;
|
87 |
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* <p>Buttons are sorted by position in ascending order</p>
|
91 |
+
* @return int current position
|
92 |
+
*/
|
93 |
public function getPosition() {
|
94 |
return $this->_position;
|
95 |
}
|
96 |
|
97 |
+
|
98 |
+
/**
|
99 |
+
* <p>name of the button relative to eabi_livehandler/action_<button-name> or full magento model name</p>
|
100 |
+
* @return string
|
101 |
+
*/
|
102 |
public function getCode() {
|
103 |
return $this->_code;
|
104 |
}
|
105 |
|
106 |
+
/**
|
107 |
+
* <p>Label printed on the action button</p>
|
108 |
+
* @return string
|
109 |
+
*/
|
110 |
public function getLabel() {
|
111 |
return $this->_label;
|
112 |
}
|
113 |
|
114 |
+
/**
|
115 |
+
* <p>Gets the onclick parameter for the current action button</p>
|
116 |
+
* @return string javascript
|
117 |
+
*/
|
118 |
public function getOnClick() {
|
119 |
return $this->_onClick;
|
120 |
}
|
121 |
+
|
122 |
+
|
123 |
+
/**
|
124 |
+
* <p>Gets the class parameter for the current action button</p>
|
125 |
+
* @return string
|
126 |
+
*/
|
127 |
public function getCssClass() {
|
128 |
return $this->_cssClass;
|
129 |
}
|
130 |
+
|
131 |
+
/**
|
132 |
+
* <p>Gets the Event.observe('click') javascript for current action button.</p>
|
133 |
+
* @return string javascript
|
134 |
+
*/
|
135 |
public function getLongOnClick() {
|
136 |
return $this->_longOnClick;
|
137 |
}
|
138 |
|
139 |
+
/**
|
140 |
+
* <p>Wrapper function for json_encode for usage in heredoc</p>
|
141 |
+
* @param mixed $input
|
142 |
+
* @return string json encoded string
|
143 |
+
*/
|
144 |
protected function _toJson($input) {
|
145 |
return json_encode($input);
|
146 |
}
|
app/code/community/Eabi/Livehandler/Model/Action/Postoffice/Print.php
CHANGED
@@ -32,15 +32,24 @@
|
|
32 |
*/
|
33 |
|
34 |
/**
|
35 |
-
*
|
|
|
|
|
36 |
*
|
37 |
* @author Matis
|
38 |
*/
|
39 |
class Eabi_Livehandler_Model_Action_Postoffice_Print extends Eabi_Livehandler_Model_Action_Abstract {
|
|
|
|
|
|
|
|
|
40 |
protected $_code = 'postoffice_print';
|
41 |
protected $_label;
|
|
|
|
|
42 |
private static $_module_exists;
|
43 |
|
|
|
44 |
public function __construct() {
|
45 |
if (self::$_module_exists === null) {
|
46 |
$modulesArray = (array)Mage::getConfig()->getNode('modules')->children();
|
@@ -53,6 +62,10 @@ class Eabi_Livehandler_Model_Action_Postoffice_Print extends Eabi_Livehandler_Mo
|
|
53 |
|
54 |
|
55 |
|
|
|
|
|
|
|
|
|
56 |
public function canDisplay(Mage_Sales_Model_Order $order) {
|
57 |
if (self::$_module_exists) {
|
58 |
$this->_label = Mage::helper('eabi_postoffice')->__('Print packing slip');
|
@@ -66,6 +79,12 @@ class Eabi_Livehandler_Model_Action_Postoffice_Print extends Eabi_Livehandler_Mo
|
|
66 |
return false;
|
67 |
}
|
68 |
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
public function performDesiredAction(Mage_Sales_Model_Order $order, array $params) {
|
70 |
|
71 |
$errors = array();
|
32 |
*/
|
33 |
|
34 |
/**
|
35 |
+
* <p>Renders button at the Magento Administrators Sales Order Grid, which allows to print packing slip from remote server for carriers which support this feature.</p>
|
36 |
+
* <p>Button is displayed when order shipping method supports remote packing slip printing and parcel data is sent.</p>
|
37 |
+
* <p>Does nothing when Eabi_Postoffice module is not installed</p>
|
38 |
*
|
39 |
* @author Matis
|
40 |
*/
|
41 |
class Eabi_Livehandler_Model_Action_Postoffice_Print extends Eabi_Livehandler_Model_Action_Abstract {
|
42 |
+
/**
|
43 |
+
* <p>Unique code relative to eabi_livehandler/action</p>
|
44 |
+
* @var string
|
45 |
+
*/
|
46 |
protected $_code = 'postoffice_print';
|
47 |
protected $_label;
|
48 |
+
|
49 |
+
|
50 |
private static $_module_exists;
|
51 |
|
52 |
+
|
53 |
public function __construct() {
|
54 |
if (self::$_module_exists === null) {
|
55 |
$modulesArray = (array)Mage::getConfig()->getNode('modules')->children();
|
62 |
|
63 |
|
64 |
|
65 |
+
/**
|
66 |
+
* @param Mage_Sales_Model_Order $order
|
67 |
+
* @return boolean
|
68 |
+
*/
|
69 |
public function canDisplay(Mage_Sales_Model_Order $order) {
|
70 |
if (self::$_module_exists) {
|
71 |
$this->_label = Mage::helper('eabi_postoffice')->__('Print packing slip');
|
79 |
return false;
|
80 |
}
|
81 |
|
82 |
+
/**
|
83 |
+
* <p>Does nothing</p>
|
84 |
+
* @param Mage_Sales_Model_Order $order
|
85 |
+
* @param array $params
|
86 |
+
* @return array
|
87 |
+
*/
|
88 |
public function performDesiredAction(Mage_Sales_Model_Order $order, array $params) {
|
89 |
|
90 |
$errors = array();
|
app/code/community/Eabi/Livehandler/Model/Action/Postoffice/Send.php
CHANGED
@@ -32,11 +32,17 @@
|
|
32 |
*/
|
33 |
|
34 |
/**
|
35 |
-
*
|
|
|
|
|
36 |
*
|
37 |
* @author Matis
|
38 |
*/
|
39 |
class Eabi_Livehandler_Model_Action_Postoffice_Send extends Eabi_Livehandler_Model_Action_Abstract {
|
|
|
|
|
|
|
|
|
40 |
protected $_code = 'postoffice_send';
|
41 |
protected $_label;
|
42 |
private static $_module_exists;
|
@@ -52,6 +58,10 @@ class Eabi_Livehandler_Model_Action_Postoffice_Send extends Eabi_Livehandler_Mod
|
|
52 |
|
53 |
|
54 |
|
|
|
|
|
|
|
|
|
55 |
public function canDisplay(Mage_Sales_Model_Order $order) {
|
56 |
if (self::$_module_exists) {
|
57 |
$this->_label = Mage::helper('eabi_postoffice')->__('Send shipping data to server');
|
@@ -67,6 +77,13 @@ class Eabi_Livehandler_Model_Action_Postoffice_Send extends Eabi_Livehandler_Mod
|
|
67 |
return false;
|
68 |
}
|
69 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
public function performDesiredAction(Mage_Sales_Model_Order $order, array $params) {
|
71 |
|
72 |
//get the carrier
|
32 |
*/
|
33 |
|
34 |
/**
|
35 |
+
* <p>Renders button at the Magento Administrators Sales Order Grid, which allows to send parcel data to remote server for carriers which support this feature.</p>
|
36 |
+
* <p>Button is displayed when order shipping method supports automatic parcel data sending and parcel data is not already sent.</p>
|
37 |
+
* <p>Does nothing when Eabi_Postoffice module is not installed</p>
|
38 |
*
|
39 |
* @author Matis
|
40 |
*/
|
41 |
class Eabi_Livehandler_Model_Action_Postoffice_Send extends Eabi_Livehandler_Model_Action_Abstract {
|
42 |
+
/**
|
43 |
+
* <p>Unique code relative to eabi_livehandler/action</p>
|
44 |
+
* @var string
|
45 |
+
*/
|
46 |
protected $_code = 'postoffice_send';
|
47 |
protected $_label;
|
48 |
private static $_module_exists;
|
58 |
|
59 |
|
60 |
|
61 |
+
/**
|
62 |
+
* @param Mage_Sales_Model_Order $order
|
63 |
+
* @return boolean
|
64 |
+
*/
|
65 |
public function canDisplay(Mage_Sales_Model_Order $order) {
|
66 |
if (self::$_module_exists) {
|
67 |
$this->_label = Mage::helper('eabi_postoffice')->__('Send shipping data to server');
|
77 |
return false;
|
78 |
}
|
79 |
|
80 |
+
/**
|
81 |
+
* <p>Calls out automatic data send action for selected order and returns the result.</p>
|
82 |
+
* <p>Does not support custom POST params</p>
|
83 |
+
* @param Mage_Sales_Model_Order $order current order
|
84 |
+
* @param array $params supplied POST params
|
85 |
+
* @return boolean|array
|
86 |
+
*/
|
87 |
public function performDesiredAction(Mage_Sales_Model_Order $order, array $params) {
|
88 |
|
89 |
//get the carrier
|
app/code/community/Eabi/Livehandler/Model/Adminhtml/Gridmanager.php
CHANGED
@@ -31,7 +31,7 @@
|
|
31 |
*/
|
32 |
|
33 |
/**
|
34 |
-
*
|
35 |
*
|
36 |
* @author matishalmann
|
37 |
*/
|
@@ -44,6 +44,13 @@ class Eabi_Livehandler_Model_Adminhtml_Gridmanager extends Eabi_Livehandler_Mode
|
|
44 |
$this->_init('eabi_livehandler/adminhtml_gridmanager');
|
45 |
}
|
46 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
public function addActionButton($id, $title, $onclick) {
|
48 |
$this->_actionButtons[$id] = array(
|
49 |
'title' => $title,
|
@@ -52,6 +59,11 @@ class Eabi_Livehandler_Model_Adminhtml_Gridmanager extends Eabi_Livehandler_Mode
|
|
52 |
return $this;
|
53 |
}
|
54 |
|
|
|
|
|
|
|
|
|
|
|
55 |
public function removeActionButton($id) {
|
56 |
if (isset($this->_actionButtons[$id])) {
|
57 |
unset($this->_actionButtons[$id]);
|
@@ -69,21 +81,25 @@ class Eabi_Livehandler_Model_Adminhtml_Gridmanager extends Eabi_Livehandler_Mode
|
|
69 |
|
70 |
}
|
71 |
|
|
|
|
|
|
|
|
|
72 |
public function getJs() {
|
73 |
$js = '';
|
74 |
|
75 |
foreach ($this->_actionButtons as $id => $actionButton) {
|
76 |
-
$onclick =
|
77 |
-
$title =
|
78 |
$js .= <<<EOT
|
79 |
var button_{$id} = new Element('button');
|
80 |
button_{$id}.writeAttribute('id', '{$id}');
|
81 |
button_{$id}.writeAttribute('type', 'button');
|
82 |
button_{$id}.writeAttribute('class', 'scalable');
|
83 |
-
button_{$id}.writeAttribute('onclick',
|
84 |
-
button_{$id}.update('<span>{$title}</span>');
|
85 |
|
86 |
-
$$('
|
87 |
|
88 |
EOT;
|
89 |
}
|
@@ -93,12 +109,22 @@ EOT;
|
|
93 |
return $js;
|
94 |
}
|
95 |
|
|
|
|
|
|
|
|
|
|
|
96 |
protected function _getAdditionalJs($currentJs) {
|
97 |
return '';
|
98 |
}
|
99 |
|
100 |
|
101 |
-
|
|
|
|
|
|
|
|
|
|
|
102 |
public function service($postData) {
|
103 |
return array();
|
104 |
}
|
31 |
*/
|
32 |
|
33 |
/**
|
34 |
+
* <p>Base class for operating in Magento admin Grids</p>
|
35 |
*
|
36 |
* @author matishalmann
|
37 |
*/
|
44 |
$this->_init('eabi_livehandler/adminhtml_gridmanager');
|
45 |
}
|
46 |
|
47 |
+
/**
|
48 |
+
* <p>Adds action button to top right of the grid or its edit view.</p>
|
49 |
+
* @param string $id buttons HTML id attribute
|
50 |
+
* @param string $title buttons printed label
|
51 |
+
* @param string $onclick buttons HTML onclick attribute
|
52 |
+
* @return Eabi_Livehandler_Model_Adminhtml_Gridmanager
|
53 |
+
*/
|
54 |
public function addActionButton($id, $title, $onclick) {
|
55 |
$this->_actionButtons[$id] = array(
|
56 |
'title' => $title,
|
59 |
return $this;
|
60 |
}
|
61 |
|
62 |
+
/**
|
63 |
+
* <p>Removes previusly entered actionbutton by its HTML id</p>
|
64 |
+
* @param string $id buttons HTML id attribute
|
65 |
+
* @return Eabi_Livehandler_Model_Adminhtml_Gridmanager
|
66 |
+
*/
|
67 |
public function removeActionButton($id) {
|
68 |
if (isset($this->_actionButtons[$id])) {
|
69 |
unset($this->_actionButtons[$id]);
|
81 |
|
82 |
}
|
83 |
|
84 |
+
/**
|
85 |
+
* <p>Renders javascript, which adds declared action buttons to the top right of the page next to others.</p>
|
86 |
+
* @return string
|
87 |
+
*/
|
88 |
public function getJs() {
|
89 |
$js = '';
|
90 |
|
91 |
foreach ($this->_actionButtons as $id => $actionButton) {
|
92 |
+
$onclick = json_encode($actionButton['onclick']);
|
93 |
+
$title = json_encode($actionButton['title']);
|
94 |
$js .= <<<EOT
|
95 |
var button_{$id} = new Element('button');
|
96 |
button_{$id}.writeAttribute('id', '{$id}');
|
97 |
button_{$id}.writeAttribute('type', 'button');
|
98 |
button_{$id}.writeAttribute('class', 'scalable');
|
99 |
+
button_{$id}.writeAttribute('onclick', {$onclick});
|
100 |
+
button_{$id}.update('<span>' + {$title} + '</span>');
|
101 |
|
102 |
+
$$('.form-buttons').first().insert(button_{$id}, { position: 'bottom'});
|
103 |
|
104 |
EOT;
|
105 |
}
|
109 |
return $js;
|
110 |
}
|
111 |
|
112 |
+
/**
|
113 |
+
* <p>Subclasses should add their javascript by overriding this function</p>
|
114 |
+
* @param string $currentJs currently generated javascript so far
|
115 |
+
* @return string resulting javascript
|
116 |
+
*/
|
117 |
protected function _getAdditionalJs($currentJs) {
|
118 |
return '';
|
119 |
}
|
120 |
|
121 |
|
122 |
+
/**
|
123 |
+
* <p>This function is called, when this class outputs javascript and ajax data is sent to its generated URL.</p>
|
124 |
+
* <p>Contained POST parameters are passed as assoc array</p>
|
125 |
+
* @param array $postData
|
126 |
+
* @return array
|
127 |
+
*/
|
128 |
public function service($postData) {
|
129 |
return array();
|
130 |
}
|
app/code/community/Eabi/Livehandler/Model/Directory/Collection.php
CHANGED
@@ -32,7 +32,7 @@
|
|
32 |
*/
|
33 |
|
34 |
/**
|
35 |
-
*
|
36 |
*
|
37 |
* @author Matis
|
38 |
*/
|
32 |
*/
|
33 |
|
34 |
/**
|
35 |
+
* <p>Replaces Varien_Directory_Collection for PHP5.3+ compatibility</p>
|
36 |
*
|
37 |
* @author Matis
|
38 |
*/
|
app/code/community/Eabi/Livehandler/Model/Entry.php
CHANGED
@@ -31,14 +31,38 @@
|
|
31 |
*/
|
32 |
|
33 |
/**
|
34 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
*
|
36 |
* @author matishalmann
|
37 |
*/
|
38 |
class Eabi_Livehandler_Model_Entry extends Mage_Core_Model_Abstract {
|
39 |
|
40 |
/**
|
41 |
-
*
|
42 |
* @var Eabi_Livehandler_Model_Adminhtml_Gridmanager
|
43 |
*/
|
44 |
private $_caller;
|
@@ -49,6 +73,10 @@ class Eabi_Livehandler_Model_Entry extends Mage_Core_Model_Abstract {
|
|
49 |
|
50 |
}
|
51 |
|
|
|
|
|
|
|
|
|
52 |
protected function _afterLoad() {
|
53 |
$load = parent::_afterLoad();
|
54 |
if ($this->getData('model_class') != '') {
|
@@ -56,7 +84,11 @@ class Eabi_Livehandler_Model_Entry extends Mage_Core_Model_Abstract {
|
|
56 |
}
|
57 |
return $load;
|
58 |
}
|
59 |
-
|
|
|
|
|
|
|
|
|
60 |
public function getJs() {
|
61 |
$js = trim($this->getData('js'));
|
62 |
if ($js == '' && $this->_caller != null) {
|
@@ -67,6 +99,11 @@ class Eabi_Livehandler_Model_Entry extends Mage_Core_Model_Abstract {
|
|
67 |
|
68 |
}
|
69 |
|
|
|
|
|
|
|
|
|
|
|
70 |
public function getCss() {
|
71 |
$css = trim($this->getData('css'));
|
72 |
if ($css == '' && $this->_caller != null) {
|
@@ -77,6 +114,10 @@ class Eabi_Livehandler_Model_Entry extends Mage_Core_Model_Abstract {
|
|
77 |
|
78 |
}
|
79 |
|
|
|
|
|
|
|
|
|
80 |
public function getHtml() {
|
81 |
$html = trim($this->getData('html'));
|
82 |
if ($html == '' && $this->_caller != null) {
|
@@ -87,6 +128,12 @@ class Eabi_Livehandler_Model_Entry extends Mage_Core_Model_Abstract {
|
|
87 |
|
88 |
}
|
89 |
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
public function runPublic($postedData) {
|
91 |
$result = array();
|
92 |
if ($this->_caller != null) {
|
@@ -94,6 +141,13 @@ class Eabi_Livehandler_Model_Entry extends Mage_Core_Model_Abstract {
|
|
94 |
}
|
95 |
return $result;
|
96 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
97 |
public function runAdmin($postedData) {
|
98 |
$result = array();
|
99 |
if ($this->_caller != null) {
|
31 |
*/
|
32 |
|
33 |
/**
|
34 |
+
* <p>Represents one entry of eabi_livehandler database table.</p>
|
35 |
+
* <p>Performs following:</p>
|
36 |
+
* <ul>
|
37 |
+
<li>Render javascript before_body_end part of the page, when Magento request variables match</li>
|
38 |
+
<li>Generates unique URL, where sending data to causes to fire service() function on the model_class instance.</li>
|
39 |
+
<li>Works only when javascript at the bottom of the page is rendered. Which means if you see this page you can fire the action.</li>
|
40 |
+
</ul>
|
41 |
+
* <p>Structure:</p>
|
42 |
+
* <ul>
|
43 |
+
<li><b>id</b> - unique auto incement id</li>
|
44 |
+
<li><b>name</b> - Human readable description</li>
|
45 |
+
<li><b>is_enabled</b> - 1 means action is enabled, 0 means action is disabled</li>
|
46 |
+
<li><b>is_admin</b> - 1 means action is admin only, 0 means action is public only</li>
|
47 |
+
<li><b>request_var</b> - Magento request var name, which current action must match. Example: adminhtml/sales_order/index - Magentos Sales Order Grid</li>
|
48 |
+
<li><b>store_id</b> - id of the store this action should run in</li>
|
49 |
+
<li><b>website_id</b> - if of the website this action should run in</li>
|
50 |
+
<li><b>model_class</b> - full Magento model name for the implementing class. Must be instance of Eabi_Livehandler_Model_Abstract</li>
|
51 |
+
<li><b>created_time</b> - when was this database entry created</li>
|
52 |
+
<li><b>update_time</b> - when was this database entry updated</li>
|
53 |
+
<li><b>cached_attributes</b> - not in use, could be used to store data in serialized form</li>
|
54 |
+
<li><b>parameters</b> - not in use, could be used to store data in serialized form</li>
|
55 |
+
<li><b>css</b> - used to declare extra css rules, those can also be declared by implementing class. Will be injected to before_body_end as style tag.</li>
|
56 |
+
<li><b>js</b> - used to display extra javascript, those can be also be declared by implementing class. Will be injetected before_body_end in script[type=javascript] tag</li>
|
57 |
+
<li><b>html</b> - used to display extra HTML, those can be also be declared by implementing class. Will be injetected before_body_end</li>
|
58 |
+
</ul>
|
59 |
*
|
60 |
* @author matishalmann
|
61 |
*/
|
62 |
class Eabi_Livehandler_Model_Entry extends Mage_Core_Model_Abstract {
|
63 |
|
64 |
/**
|
65 |
+
* <p>instance of implementing class</p>
|
66 |
* @var Eabi_Livehandler_Model_Adminhtml_Gridmanager
|
67 |
*/
|
68 |
private $_caller;
|
73 |
|
74 |
}
|
75 |
|
76 |
+
/**
|
77 |
+
* <p>Sets up the instance of implementing class</p>
|
78 |
+
* @return Eabi_Livehandler_Model_Entry
|
79 |
+
*/
|
80 |
protected function _afterLoad() {
|
81 |
$load = parent::_afterLoad();
|
82 |
if ($this->getData('model_class') != '') {
|
84 |
}
|
85 |
return $load;
|
86 |
}
|
87 |
+
|
88 |
+
/**
|
89 |
+
* <p>Loads up extra javascript from js property or from implementing class (preferred).</p>
|
90 |
+
* @return string
|
91 |
+
*/
|
92 |
public function getJs() {
|
93 |
$js = trim($this->getData('js'));
|
94 |
if ($js == '' && $this->_caller != null) {
|
99 |
|
100 |
}
|
101 |
|
102 |
+
|
103 |
+
/**
|
104 |
+
* <p>Loads up extra CSS from css property or from implementing class (preferred).</p>
|
105 |
+
* @return string
|
106 |
+
*/
|
107 |
public function getCss() {
|
108 |
$css = trim($this->getData('css'));
|
109 |
if ($css == '' && $this->_caller != null) {
|
114 |
|
115 |
}
|
116 |
|
117 |
+
/**
|
118 |
+
* <p>Loads up extra HTML from html property or from implementing class (preferred).</p>
|
119 |
+
* @return string
|
120 |
+
*/
|
121 |
public function getHtml() {
|
122 |
$html = trim($this->getData('html'));
|
123 |
if ($html == '' && $this->_caller != null) {
|
128 |
|
129 |
}
|
130 |
|
131 |
+
|
132 |
+
/**
|
133 |
+
* <p>Attempts to call implementing classes <code>service</code> function with posted parameters in frontend environment.</p>
|
134 |
+
* @param array $postedData posted parameters
|
135 |
+
* @return array returned result
|
136 |
+
*/
|
137 |
public function runPublic($postedData) {
|
138 |
$result = array();
|
139 |
if ($this->_caller != null) {
|
141 |
}
|
142 |
return $result;
|
143 |
}
|
144 |
+
|
145 |
+
|
146 |
+
/**
|
147 |
+
* <p>Attempts to call implementing classes <code>service</code> function with posted parameters in adminhtml environment.</p>
|
148 |
+
* @param array $postedData posted parameters
|
149 |
+
* @return array returned result
|
150 |
+
*/
|
151 |
public function runAdmin($postedData) {
|
152 |
$result = array();
|
153 |
if ($this->_caller != null) {
|
app/code/community/Eabi/Livehandler/Model/File/Object.php
CHANGED
@@ -32,7 +32,7 @@
|
|
32 |
*/
|
33 |
|
34 |
/**
|
35 |
-
*
|
36 |
*
|
37 |
* @author Matis
|
38 |
*/
|
32 |
*/
|
33 |
|
34 |
/**
|
35 |
+
* <p>Replaces Varien_File_Object for PHP5.3+ compatibility</p>
|
36 |
*
|
37 |
* @author Matis
|
38 |
*/
|
app/code/community/Eabi/Livehandler/Model/Mysql4/Entry.php
CHANGED
@@ -31,12 +31,11 @@
|
|
31 |
*/
|
32 |
|
33 |
/**
|
34 |
-
*
|
35 |
*
|
36 |
* @author matishalmann
|
37 |
*/
|
38 |
class Eabi_Livehandler_Model_Mysql4_Entry extends Mage_Core_Model_Mysql4_Abstract {
|
39 |
-
//put your code here
|
40 |
|
41 |
public function _construct() {
|
42 |
$this->_init('eabi_livehandler/entry', 'id');
|
31 |
*/
|
32 |
|
33 |
/**
|
34 |
+
* <p>Represents one line from eabi_livehandler database table</p>
|
35 |
*
|
36 |
* @author matishalmann
|
37 |
*/
|
38 |
class Eabi_Livehandler_Model_Mysql4_Entry extends Mage_Core_Model_Mysql4_Abstract {
|
|
|
39 |
|
40 |
public function _construct() {
|
41 |
$this->_init('eabi_livehandler/entry', 'id');
|
app/code/community/Eabi/Livehandler/Model/Mysql4/Entry/Collection.php
CHANGED
@@ -31,17 +31,33 @@
|
|
31 |
*/
|
32 |
|
33 |
/**
|
34 |
-
*
|
35 |
*
|
36 |
* @author matishalmann
|
37 |
*/
|
38 |
class Eabi_Livehandler_Model_Mysql4_Entry_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract {
|
39 |
-
|
40 |
public function _construct() {
|
41 |
parent::_construct();
|
42 |
$this->_init('eabi_livehandler/entry');
|
43 |
}
|
44 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
public function setFilter($path, $isAdmin = false, $website = 0, $store = 0) {
|
46 |
$this->addFieldToFilter('request_var', array('like' => $path.'%'));
|
47 |
$this->addFieldToFilter('is_admin', (int)$isAdmin);
|
@@ -53,6 +69,15 @@ class Eabi_Livehandler_Model_Mysql4_Entry_Collection extends Mage_Core_Model_Mys
|
|
53 |
$this->addOrder('store_id', 'desc');
|
54 |
return $this;
|
55 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
public function setModelFilter($model, $isAdmin = false, $website = 0, $store = 0) {
|
57 |
$this->addFieldToFilter('model_class', $model);
|
58 |
$this->addFieldToFilter('is_admin', (int)$isAdmin);
|
31 |
*/
|
32 |
|
33 |
/**
|
34 |
+
* <p>Represents collection of eabi_livehandler database table entries</p>
|
35 |
*
|
36 |
* @author matishalmann
|
37 |
*/
|
38 |
class Eabi_Livehandler_Model_Mysql4_Entry_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract {
|
39 |
+
|
40 |
public function _construct() {
|
41 |
parent::_construct();
|
42 |
$this->_init('eabi_livehandler/entry');
|
43 |
}
|
44 |
|
45 |
+
/**
|
46 |
+
* <p>Finds eabi_livehandler entries by Magento Request name</p>
|
47 |
+
* <p>Request name is constructed as following:</p>
|
48 |
+
* <pre>
|
49 |
+
$routeName = $request->getRequestedRouteName();
|
50 |
+
$controllerName = $request->getRequestedControllerName();
|
51 |
+
$actionName = $request->getRequestedActionName();
|
52 |
+
$path = $routeName . '/' . $controllerName . '/' . $actionName;
|
53 |
+
*
|
54 |
+
* </pre>
|
55 |
+
* @param string $path Magento request name
|
56 |
+
* @param bool $isAdmin true, when eabi_livehandler is declared to be admin only.
|
57 |
+
* @param int $website id of a website, this action should only run on.
|
58 |
+
* @param int $store id of a store, this action should only run on.
|
59 |
+
* @return Eabi_Livehandler_Model_Mysql4_Entry_Collection
|
60 |
+
*/
|
61 |
public function setFilter($path, $isAdmin = false, $website = 0, $store = 0) {
|
62 |
$this->addFieldToFilter('request_var', array('like' => $path.'%'));
|
63 |
$this->addFieldToFilter('is_admin', (int)$isAdmin);
|
69 |
$this->addOrder('store_id', 'desc');
|
70 |
return $this;
|
71 |
}
|
72 |
+
|
73 |
+
/**
|
74 |
+
* <p>Finds eabi_livehandler entries by Magento model name</p>
|
75 |
+
* @param string $model Magento model name
|
76 |
+
* @param bool $isAdmin true, when eabi_livehandler is declared to be admin only.
|
77 |
+
* @param int $website id of a website, this action should only run on.
|
78 |
+
* @param int $store id of a store, this action should only run on.
|
79 |
+
* @return Eabi_Livehandler_Model_Mysql4_Entry_Collection
|
80 |
+
*/
|
81 |
public function setModelFilter($model, $isAdmin = false, $website = 0, $store = 0) {
|
82 |
$this->addFieldToFilter('model_class', $model);
|
83 |
$this->addFieldToFilter('is_admin', (int)$isAdmin);
|
app/code/community/Eabi/Livehandler/Model/Ordergrid.php
CHANGED
@@ -31,14 +31,33 @@
|
|
31 |
*/
|
32 |
|
33 |
/**
|
34 |
-
*
|
|
|
|
|
|
|
35 |
*
|
36 |
* @author matishalmann
|
|
|
|
|
|
|
37 |
*/
|
38 |
class Eabi_Livehandler_Model_Ordergrid extends Eabi_Livehandler_Model_Adminhtml_Gridmanager {
|
39 |
|
|
|
|
|
|
|
|
|
40 |
private static $_allowedActions;
|
|
|
|
|
|
|
|
|
|
|
41 |
private static $_hasButtons = false;
|
|
|
|
|
|
|
|
|
42 |
CONST CACHE_KEY = 'eabi_livehandler_model_ordergrid';
|
43 |
|
44 |
protected $_loadedButtons = array();
|
@@ -50,6 +69,11 @@ class Eabi_Livehandler_Model_Ordergrid extends Eabi_Livehandler_Model_Adminhtml_
|
|
50 |
$this->_initButtons();
|
51 |
}
|
52 |
|
|
|
|
|
|
|
|
|
|
|
53 |
private function _initButtons() {
|
54 |
if (self::$_allowedActions === null) {
|
55 |
//first check the folder model/actions if the checked result is not already stored in cache
|
@@ -111,14 +135,15 @@ class Eabi_Livehandler_Model_Ordergrid extends Eabi_Livehandler_Model_Adminhtml_
|
|
111 |
return (int)$a['sort_order'] < (int)$b['sort_order']?-1:1;
|
112 |
}
|
113 |
|
114 |
-
|
115 |
-
*
|
116 |
-
*
|
117 |
-
* If this module is disabled, then assoc array of
|
118 |
-
* array('result' => false); is returned
|
|
|
119 |
*
|
120 |
* @param array $postData
|
121 |
-
* @return array
|
122 |
*/
|
123 |
public function service($postData) {
|
124 |
$errors = array();
|
31 |
*/
|
32 |
|
33 |
/**
|
34 |
+
* <p>Adds extra button to each row of Magento Adminhtml Sales Order grid called 'Show order info'</p>
|
35 |
+
* <p>Clicking on this button shows almost full information about the order and orders can be switched with press of up-down-left-right arrows.</p>
|
36 |
+
* <p>Order view is synchronized with massaction checkboxes and Merchant can individually check/uncheck orders in this view.</p>
|
37 |
+
* <p>Extra buttons can be added to order view using <code>Eabi_Livehandler_Model_Action_Abstract</code> interface which allow faster order processing than default Magento offers.</p>
|
38 |
*
|
39 |
* @author matishalmann
|
40 |
+
* @see Eabi_Livehandler_Model_Action_Abstract
|
41 |
+
* @see Eabi_Livehandler_Model_Action_Postoffice_Send
|
42 |
+
* @see Eabi_Livehandler_Model_Action_Postoffice_Print
|
43 |
*/
|
44 |
class Eabi_Livehandler_Model_Ordergrid extends Eabi_Livehandler_Model_Adminhtml_Gridmanager {
|
45 |
|
46 |
+
/**
|
47 |
+
* <p>Instance of allowed buttons displayed in order view</p>
|
48 |
+
* @var array
|
49 |
+
*/
|
50 |
private static $_allowedActions;
|
51 |
+
|
52 |
+
/**
|
53 |
+
*
|
54 |
+
* @var bool true if at least one button exists.
|
55 |
+
*/
|
56 |
private static $_hasButtons = false;
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Buttons are cached forever or as long as configuration cache is alive.
|
60 |
+
*/
|
61 |
CONST CACHE_KEY = 'eabi_livehandler_model_ordergrid';
|
62 |
|
63 |
protected $_loadedButtons = array();
|
69 |
$this->_initButtons();
|
70 |
}
|
71 |
|
72 |
+
/**
|
73 |
+
* Attempts to load action buttons from cache and if not successful, then from configuration and place it into cache.
|
74 |
+
* @see Eabi_Livehandler_Block_Adminhtml_Config_Form_Field_Button
|
75 |
+
*
|
76 |
+
*/
|
77 |
private function _initButtons() {
|
78 |
if (self::$_allowedActions === null) {
|
79 |
//first check the folder model/actions if the checked result is not already stored in cache
|
135 |
return (int)$a['sort_order'] < (int)$b['sort_order']?-1:1;
|
136 |
}
|
137 |
|
138 |
+
/**
|
139 |
+
* <p>Returns json with order data and attempts to detect if any action buttons was pressed.</p>
|
140 |
+
* <p>If any action buttons were pressed then corresponding Eabi_Livehandler_Model_Action_Abstract::service() is invoked with supplied extra POST parameters.</p>
|
141 |
+
* <p>If this module is disabled, then assoc array of
|
142 |
+
* array('result' => false); is returned.</p>
|
143 |
+
*
|
144 |
*
|
145 |
* @param array $postData
|
146 |
+
* @return array json with order data
|
147 |
*/
|
148 |
public function service($postData) {
|
149 |
$errors = array();
|
app/code/community/Eabi/Livehandler/Model/System/Config/Backend/Button.php
CHANGED
@@ -31,13 +31,23 @@
|
|
31 |
*/
|
32 |
|
33 |
/**
|
34 |
-
*
|
|
|
35 |
*
|
36 |
* @author Matis
|
|
|
37 |
*/
|
38 |
class Eabi_Livehandler_Model_System_Config_Backend_Button extends Mage_Adminhtml_Model_System_Config_Backend_Serialized_Array {
|
39 |
protected $_eventPrefix = 'eabi_livehandler_system_config_backend_button';
|
40 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
protected function _afterLoad() {
|
42 |
parent::_afterLoad();
|
43 |
// Zend_Debug::dump($this->getValue());
|
@@ -118,6 +128,12 @@ class Eabi_Livehandler_Model_System_Config_Backend_Button extends Mage_Adminhtml
|
|
118 |
}
|
119 |
|
120 |
|
|
|
|
|
|
|
|
|
|
|
|
|
121 |
public static function _sortAction($a, $b) {
|
122 |
if ((bool)$a['disabled'] && !(bool)$b['disabled']) {
|
123 |
return 1;
|
31 |
*/
|
32 |
|
33 |
/**
|
34 |
+
* <p>Represents backend for the <code>Eabi_Livehandler_Block_Adminhtml_Config_Form_Field_Button</code></p>
|
35 |
+
*
|
36 |
*
|
37 |
* @author Matis
|
38 |
+
* @see Eabi_Livehandler_Block_Adminhtml_Config_Form_Field_Button
|
39 |
*/
|
40 |
class Eabi_Livehandler_Model_System_Config_Backend_Button extends Mage_Adminhtml_Model_System_Config_Backend_Serialized_Array {
|
41 |
protected $_eventPrefix = 'eabi_livehandler_system_config_backend_button';
|
42 |
+
|
43 |
+
/**
|
44 |
+
* <p>Attempts to auto load Order Manager action buttons from following locations:</p>
|
45 |
+
* <ul>
|
46 |
+
<li>app/code/community/Eabi/Livehandler/Model/Action</li>
|
47 |
+
<li>app/code/local/Eabi/Livehandler/Model/Action</li>
|
48 |
+
</ul>
|
49 |
+
* <p>Verifies their validity and if new found, then they are added to the configuration automatically.</p>
|
50 |
+
*/
|
51 |
protected function _afterLoad() {
|
52 |
parent::_afterLoad();
|
53 |
// Zend_Debug::dump($this->getValue());
|
128 |
}
|
129 |
|
130 |
|
131 |
+
/**
|
132 |
+
* <p>Sorts buttons by their sort order ascending and leaves disabled buttons as least important.</p>
|
133 |
+
* @param array $a
|
134 |
+
* @param array $b
|
135 |
+
* @return int
|
136 |
+
*/
|
137 |
public static function _sortAction($a, $b) {
|
138 |
if ((bool)$a['disabled'] && !(bool)$b['disabled']) {
|
139 |
return 1;
|
app/code/community/Eabi/Livehandler/controllers/Adminhtml/LivehandlerController.php
CHANGED
@@ -43,6 +43,10 @@ class Eabi_Livehandler_Adminhtml_LivehandlerController extends Mage_Adminhtml_Co
|
|
43 |
return $this;
|
44 |
}
|
45 |
|
|
|
|
|
|
|
|
|
46 |
public function processAction() {
|
47 |
$result = array();
|
48 |
if (!$this->_getEabi()->getConfigData('eabi_livehandler/main/enabled')) {
|
43 |
return $this;
|
44 |
}
|
45 |
|
46 |
+
/**
|
47 |
+
*
|
48 |
+
* @throws Exception
|
49 |
+
*/
|
50 |
public function processAction() {
|
51 |
$result = array();
|
52 |
if (!$this->_getEabi()->getConfigData('eabi_livehandler/main/enabled')) {
|
app/code/community/Eabi/Livehandler/etc/config.xml
CHANGED
@@ -36,7 +36,7 @@
|
|
36 |
<config>
|
37 |
<modules>
|
38 |
<Eabi_Livehandler>
|
39 |
-
<version>0.1.
|
40 |
</Eabi_Livehandler>
|
41 |
</modules>
|
42 |
|
36 |
<config>
|
37 |
<modules>
|
38 |
<Eabi_Livehandler>
|
39 |
+
<version>0.1.5</version>
|
40 |
</Eabi_Livehandler>
|
41 |
</modules>
|
42 |
|
app/code/community/Eabi/Livehandler/sql/eabi_livehandler_setup/mysql4-install-0.1.0.php
CHANGED
@@ -34,6 +34,27 @@ $installer = $this;
|
|
34 |
|
35 |
$installer->startSetup();
|
36 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
$installer->run("
|
38 |
DROP TABLE IF EXISTS {$this->getTable('eabi_livehandler')};
|
39 |
|
34 |
|
35 |
$installer->startSetup();
|
36 |
|
37 |
+
/**
|
38 |
+
* <p>Structure:</p>
|
39 |
+
* <ul>
|
40 |
+
<li><b>id</b> - unique auto incement id</li>
|
41 |
+
<li><b>name</b> - Human readable description</li>
|
42 |
+
<li><b>is_enabled</b> - 1 means action is enabled, 0 means action is disabled</li>
|
43 |
+
<li><b>is_admin</b> - 1 means action is admin only, 0 means action is public only</li>
|
44 |
+
<li><b>request_var</b> - Magento request var name, which current action must match. Example: adminhtml/sales_order/index - Magentos Sales Order Grid</li>
|
45 |
+
<li><b>store_id</b> - id of the store this action should run in</li>
|
46 |
+
<li><b>website_id</b> - if of the website this action should run in</li>
|
47 |
+
<li><b>model_class</b> - full Magento model name for the implementing class. Must be instance of Eabi_Livehandler_Model_Abstract</li>
|
48 |
+
<li><b>created_time</b> - when was this database entry created</li>
|
49 |
+
<li><b>update_time</b> - when was this database entry updated</li>
|
50 |
+
<li><b>cached_attributes</b> - not in use, could be used to store data in serialized form</li>
|
51 |
+
<li><b>parameters</b> - not in use, could be used to store data in serialized form</li>
|
52 |
+
<li><b>css</b> - used to declare extra css rules, those can also be declared by implementing class. Will be injected to before_body_end as style tag.</li>
|
53 |
+
<li><b>js</b> - used to display extra javascript, those can be also be declared by implementing class. Will be injetected before_body_end in script[type=javascript] tag</li>
|
54 |
+
<li><b>html</b> - used to display extra HTML, those can be also be declared by implementing class. Will be injetected before_body_end</li>
|
55 |
+
</ul>
|
56 |
+
*
|
57 |
+
*/
|
58 |
$installer->run("
|
59 |
DROP TABLE IF EXISTS {$this->getTable('eabi_livehandler')};
|
60 |
|
app/code/community/Eabi/Livehandler/sql/eabi_livehandler_setup/mysql4-upgrade-0.1.0-0.1.1.php
CHANGED
@@ -33,7 +33,10 @@
|
|
33 |
$installer = $this;
|
34 |
|
35 |
$installer->startSetup();
|
36 |
-
|
|
|
|
|
|
|
37 |
$installer->run("
|
38 |
|
39 |
DELETE FROM {$this->getTable('eabi_livehandler')} WHERE model_class = 'eabi_admintools/ordergrid';
|
33 |
$installer = $this;
|
34 |
|
35 |
$installer->startSetup();
|
36 |
+
/*
|
37 |
+
* Insert Magento Admin Sales Order Grid manager
|
38 |
+
* Insertion to request_var=adminhtml/sales_order/view must be done because clicking on the order status label causes user to leave the page, thus disabling current grid manager when this entry is not present.
|
39 |
+
*/
|
40 |
$installer->run("
|
41 |
|
42 |
DELETE FROM {$this->getTable('eabi_livehandler')} WHERE model_class = 'eabi_admintools/ordergrid';
|
app/etc/modules/Eabi_Livehandler.xml
CHANGED
@@ -38,7 +38,7 @@
|
|
38 |
<Eabi_Livehandler>
|
39 |
<active>true</active>
|
40 |
<codePool>community</codePool>
|
41 |
-
<version>0.1.
|
42 |
</Eabi_Livehandler>
|
43 |
</modules>
|
44 |
</config>
|
38 |
<Eabi_Livehandler>
|
39 |
<active>true</active>
|
40 |
<codePool>community</codePool>
|
41 |
+
<version>0.1.5</version>
|
42 |
</Eabi_Livehandler>
|
43 |
</modules>
|
44 |
</config>
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Eabi_Livehandler</name>
|
4 |
-
<version>0.1.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL 3.0</license>
|
7 |
<channel>community</channel>
|
@@ -12,14 +12,12 @@
|
|
12 |
<p>You can navigate between orders by pressing directional keys or by pressing left/right icons on the order view</p>
|
13 |
<p>Possibility to create your own action buttons, which allows to save lots of time when managing orders</p>
|
14 |
<p>Possibility to purchase action buttons like <strong>Add order comment</strong>, <strong>Create invoice</strong>, <strong>Ship order</strong> and more</p></description>
|
15 |
-
<notes>* Added
|
16 |
-
*
|
17 |
-
* Added Print packing slip in order to comply with DPD extension
|
18 |
-
* Code is from now on also licensed under GPL v3</notes>
|
19 |
<authors><author><name>Matis Matis</name><user>auto-converted</user><email>info@e-abi.ee</email></author></authors>
|
20 |
-
<date>2014-01-
|
21 |
-
<time>02:
|
22 |
-
<contents><target name="magecommunity"><dir name="Eabi"><dir name="Livehandler"><dir name="Block"><dir name="Adminhtml"><dir name="Config"><dir name="Form"><dir name="Field"><file name="Button.php" hash="
|
23 |
<compatible/>
|
24 |
<dependencies/>
|
25 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Eabi_Livehandler</name>
|
4 |
+
<version>0.1.5</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL 3.0</license>
|
7 |
<channel>community</channel>
|
12 |
<p>You can navigate between orders by pressing directional keys or by pressing left/right icons on the order view</p>
|
13 |
<p>Possibility to create your own action buttons, which allows to save lots of time when managing orders</p>
|
14 |
<p>Possibility to purchase action buttons like <strong>Add order comment</strong>, <strong>Create invoice</strong>, <strong>Ship order</strong> and more</p></description>
|
15 |
+
<notes>* Added documentation
|
16 |
+
* added toJson wrapper to base model</notes>
|
|
|
|
|
17 |
<authors><author><name>Matis Matis</name><user>auto-converted</user><email>info@e-abi.ee</email></author></authors>
|
18 |
+
<date>2014-01-09</date>
|
19 |
+
<time>02:35:16</time>
|
20 |
+
<contents><target name="magecommunity"><dir name="Eabi"><dir name="Livehandler"><dir name="Block"><dir name="Adminhtml"><dir name="Config"><dir name="Form"><dir name="Field"><file name="Button.php" hash="aa2cdefca35fc906943b76063cdf8537"/><file name="Remove.php" hash="e0da5a9c856c10d65143d565f3414347"/></dir></dir></dir></dir><file name="Footer.php" hash="2965dff82f3be4b53b00d282d423b9ef"/></dir><dir name="Helper"><file name="Data.php" hash="5efe08d888222257f24131478d405c0c"/></dir><dir name="Model"><dir name="Action"><dir name="Postoffice"><file name="Print.php" hash="13c64015d6460221d0266ef40698280c"/><file name="Send.php" hash="e990ba8fa14afa1528cf8cd2c74cedbc"/></dir><file name="Abstract.php" hash="4d3fd6cc78037008610d590f742fae51"/></dir><dir name="Adminhtml"><file name="Gridmanager.php" hash="daa2aa0217b91045aa2cf3d21a5f64f1"/></dir><dir name="Directory"><file name="Collection.php" hash="28aca7ecf41b56fd2624139fa3746139"/></dir><dir name="File"><file name="Object.php" hash="278cd8f5cfee8554930de1a04fcd794f"/></dir><dir name="Mysql4"><dir name="Entry"><file name="Collection.php" hash="98020b9eeb67626c42af1a75699f88c5"/></dir><file name="Entry.php" hash="94e8d257cb4f5f7d9cc83150d4b9bb26"/></dir><dir name="System"><dir name="Config"><dir name="Backend"><file name="Button.php" hash="2d401233ebdc077e398c5e09165217b9"/></dir></dir></dir><file name="Abstract.php" hash="cac0cec1ce45d10474a14d37efa0da82"/><file name="Entry.php" hash="6b9ff0824a667e04897afe39dadf2db7"/><file name="Ordergrid.php" hash="8377da25f8c9849b2f16ae3dea2edbd0"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="LivehandlerController.php" hash="e0f36d42a5e87a6359ca179b1cf35d10"/><file name="RemoveController.php" hash="a8578a2b448e91b84b7d8ad93cc1ff75"/></dir><file name="IndexController.php" hash="a9fc4495855a7841cd518b9c099f65c0"/></dir><dir name="etc"><file name="config.xml" hash="44a18cf550de927c224ebac617a2f4f7"/><file name="system.xml" hash="3aae85cb6b4fc84224fdef9e55e3a20c"/></dir><dir name="sql"><dir name="eabi_livehandler_setup"><file name="mysql4-install-0.1.0.php" hash="3542a9b16298e0cb7ab1b75081da09a6"/><file name="mysql4-upgrade-0.1.0-0.1.1.php" hash="66d9663cf4ebfa01f4060090b3af511c"/></dir></dir><file name="CHANGELOG.txt" hash="d2c529c652576f6592990ced43ed51cb"/><file name="LICENCE.txt" hash="7a9e279147a63af4f63a16ca67fae07b"/></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="eabi_livehandler.xml" hash="1fc2fe104ffc719adbcf240db22c9b83"/></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="eabi_livehandler.xml" hash="73db0149877ed655a282a0ed9acefe57"/></dir></dir></dir><dir name="base"><dir name="default"><dir name="layout"><file name="eabi_livehandler.xml" hash="73db0149877ed655a282a0ed9acefe57"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Eabi_Livehandler.xml" hash="9d525508e93cb72aa57b71e0a00562f5"/></dir></target><target name="magelocale"><dir name="en_US"><file name="Eabi_Livehandler.csv" hash="e846cb14835c2c9df355d7c81da2135c"/></dir><dir name="et_EE"><file name="Eabi_Livehandler.csv" hash="e1a2e6c5568ec76ecb3c4078e23710b7"/></dir><dir name="fi_FI"><file name="Eabi_Livehandler.csv" hash="e846cb14835c2c9df355d7c81da2135c"/></dir><dir name="lt_LT"><file name="Eabi_Livehandler.csv" hash="e846cb14835c2c9df355d7c81da2135c"/></dir><dir name="sv_SE"><file name="Eabi_Livehandler.csv" hash="bcb64aae292b417a7914612e57305559"/></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><file name="eabi_admintools.css" hash="0868ed1bfcc8afff6643d5a3b8aab5b9"/></dir></dir></dir></target><target name="mageweb"><dir name="js"><dir name="eabi_js"><file name="crossBrowser_initKeyboardEvent.js" hash="8600c5536225fd70c56ef313ee430e08"/></dir><dir name="livepipe"><file name="contextmenu.js" hash="a5dbab9663d94d9d848e84b524c1f925"/><file name="cookie.js" hash="eab2042ac637aec7777c7c64e3e2bb1a"/><file name="event_behavior.js" hash="a59a00ad652efb1596b5bd2e6f5cfe48"/><file name="hotkey.js" hash="c6193fc03e4cd4c94ee4fb37e3d5ed6b"/><file name="livepipe.js" hash="6e569402b2686976e7390f0b7a25b1eb"/><file name="progressbar.js" hash="69719eccbecbc0378d9919c53a3ef7dd"/><file name="rating.js" hash="adb5ce773c37b40fb590a877d949be7a"/><file name="resizable.js" hash="38fd18daa37e5612495cc7b42fd32b3d"/><file name="scrollbar.js" hash="7a2603c2107944b8a70e41e7a84133ba"/><file name="selection.js" hash="3f48981cccffdb5fcc5f5ff27d0b0b68"/><file name="selectmultiple.js" hash="d8f044eb344061bdcce405f671b15654"/><file name="tabs.js" hash="22abb9a3ec3933d54ff9ede0338ca7f3"/><file name="textarea.js" hash="9825782bf78d38efa53200a206d8cd77"/><file name="window.js" hash="f6eba488d6a80e05f59d97a0cef59730"/></dir></dir></target></contents>
|
21 |
<compatible/>
|
22 |
<dependencies/>
|
23 |
</package>
|