Usersnap_Bugtracker - Version 1.0.0

Version Notes

First Release

Download this release

Release Info

Developer Andreas Pointner
Extension Usersnap_Bugtracker
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

Files changed (26) hide show
  1. app/code/community/Usersnap/Bugtracker/Block/CustomerEmail.php +29 -0
  2. app/code/community/Usersnap/Bugtracker/Block/Debug.php +39 -0
  3. app/code/community/Usersnap/Bugtracker/Block/Track.php +219 -0
  4. app/code/community/Usersnap/Bugtracker/Helper/Config.php +123 -0
  5. app/code/community/Usersnap/Bugtracker/Helper/Data.php +26 -0
  6. app/code/community/Usersnap/Bugtracker/Model/Observer/Debug.php +172 -0
  7. app/code/community/Usersnap/Bugtracker/Model/Observer/Quote.php +99 -0
  8. app/code/community/Usersnap/Bugtracker/Model/Observer/Wishlist.php +35 -0
  9. app/code/community/Usersnap/Bugtracker/Model/System/Config/Source/Abstract.php +45 -0
  10. app/code/community/Usersnap/Bugtracker/Model/System/Config/Source/DefaultNoOptReq.php +17 -0
  11. app/code/community/Usersnap/Bugtracker/Model/System/Config/Source/DefaultYesNo.php +16 -0
  12. app/code/community/Usersnap/Bugtracker/Model/System/Config/Source/Halign.php +18 -0
  13. app/code/community/Usersnap/Bugtracker/Model/System/Config/Source/Language.php +34 -0
  14. app/code/community/Usersnap/Bugtracker/Model/System/Config/Source/Valign.php +18 -0
  15. app/code/community/Usersnap/Bugtracker/etc/config.xml +141 -0
  16. app/code/community/Usersnap/Bugtracker/etc/system.xml +213 -0
  17. app/design/adminhtml/base/default/layout/bugtracker.xml +15 -0
  18. app/design/adminhtml/base/default/template/bugtracker/customerEmail.phtml +1 -0
  19. app/design/adminhtml/base/default/template/bugtracker/debug.phtml +1 -0
  20. app/design/adminhtml/base/default/template/bugtracker/track.phtml +13 -0
  21. app/design/frontend/base/default/layout/bugtracker.xml +15 -0
  22. app/design/frontend/base/default/template/bugtracker/customerEmail.phtml +1 -0
  23. app/design/frontend/base/default/template/bugtracker/debug.phtml +1 -0
  24. app/design/frontend/base/default/template/bugtracker/track.phtml +13 -0
  25. app/etc/modules/Usersnap_Bugtracker.xml +9 -0
  26. package.xml +86 -0
app/code/community/Usersnap/Bugtracker/Block/CustomerEmail.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Usersnap_Bugtracker_Block_CustomerEmail extends Mage_Core_Block_Template
4
+ {
5
+
6
+ /**
7
+ * Only output the replace block if the email should be replaced
8
+ * @return string
9
+ */
10
+ protected function _toHtml()
11
+ {
12
+ if (Mage::helper("bugtracker/config")->getReplaceEmail()) {
13
+ return parent::_toHtml();
14
+ }
15
+ }
16
+
17
+ /**
18
+ * Get Email from current customer
19
+ * @return string
20
+ */
21
+ public function getCustomerEmail()
22
+ {
23
+ $customer = Mage::helper("customer")->getCustomer();
24
+ if ($customer->getId() && $customer->getEmail()) {
25
+ return $customer->getEmail();
26
+ }
27
+ return "";
28
+ }
29
+ }
app/code/community/Usersnap/Bugtracker/Block/Debug.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Usersnap_Bugtracker_Block_Debug extends Mage_Core_Block_Template
4
+ {
5
+
6
+ const USERSNAP_DEBUG_EVENT = "usersnap_debug_info";
7
+
8
+ /**
9
+ * Is Debug Enabled
10
+ * @return mixed
11
+ */
12
+ public function isEnabled()
13
+ {
14
+ return Mage::helper("bugtracker/config")->isDebug();
15
+ }
16
+
17
+ /**
18
+ * Only output html if debug is enabled
19
+ * @return string
20
+ */
21
+ protected function _toHtml()
22
+ {
23
+ if ($this->isEnabled()) {
24
+ return parent::_toHtml();
25
+ }
26
+ return "";
27
+ }
28
+
29
+ /**
30
+ * Returns the debug Info of the debug info object
31
+ * @return string json
32
+ */
33
+ public function getDebugInfo()
34
+ {
35
+ $debugInfo = new Varien_Object();
36
+ Mage::dispatchEvent(self::USERSNAP_DEBUG_EVENT, array("debug_info" => $debugInfo));
37
+ return Mage::helper("core")->jsonEncode($debugInfo->getData());
38
+ }
39
+ }
app/code/community/Usersnap/Bugtracker/Block/Track.php ADDED
@@ -0,0 +1,219 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Usersnap_Bugtracker_Block_Track extends Mage_Core_Block_Template
4
+ {
5
+
6
+ protected $_configHelper;
7
+ protected $_config;
8
+
9
+ /**
10
+ * Usersnap API Key
11
+ * @return mixed
12
+ */
13
+ public function getApiKey()
14
+ {
15
+ return $this->getConfigHelper()->getApiKey();
16
+ }
17
+
18
+ /**
19
+ * Is Usersnap enabled?
20
+ * @return mixed
21
+ */
22
+ public function isEnabled()
23
+ {
24
+ return $this->getConfigHelper()->isEnabled();
25
+ }
26
+
27
+ /**
28
+ * Don't display any output if Usesnap is disabled
29
+ * @return string
30
+ */
31
+ protected function _toHtml()
32
+ {
33
+ if ($this->isEnabled()) {
34
+ return parent::_toHtml();
35
+ }
36
+ return "";
37
+ }
38
+
39
+ /**
40
+ * Get store config from backend
41
+ *
42
+ * @return string usersnap config values
43
+ */
44
+ public function getJsonConfig()
45
+ {
46
+ if (!$this->_config) {
47
+ $cacheKey = 'USERSNAP_CONFIG_JSON_STORE' . (string)Mage::app()->getStore()->getId();
48
+ if (Mage::app()->useCache("config")) {
49
+ $json = Mage::app()->loadCache($cacheKey);
50
+ }
51
+ if (empty($json)) {
52
+ $configArray = $this->getConfigValues();
53
+ $json = "var _usersnapconfig = " . Mage::helper("core")->jsonEncode($configArray) . "; ";
54
+ if (Mage::app()->useCache('config')) {
55
+ Mage::app()->saveCache($json, $cacheKey, array('config'));
56
+ }
57
+ }
58
+ $this->_config = $json;
59
+ }
60
+ return $this->_config;
61
+ }
62
+
63
+ /**
64
+ * Configured values from magento backend + modification to fit to Usersnap definition
65
+ * @return array
66
+ */
67
+ public function getConfigValues()
68
+ {
69
+ $config = new Varien_Object(array(
70
+ 'type' => 'magento',
71
+ 'valign' => $this->getConfigHelper()->getVerticalAlign(),
72
+ 'halign' => $this->getConfigHelper()->getHorizontalAlign(),
73
+ 'btnText' => $this->getConfigHelper()->getButtonText(),
74
+ 'commentBoxPlaceholder' => $this->getConfigHelper()->getCommentValue(),
75
+ 'shortcut' => $this->getConfigHelper()->isShortcutEnabled(),
76
+ 'hideTour' => $this->getConfigHelper()->getHideTour()
77
+ ));
78
+
79
+ $this->addLanguage($config);
80
+ $this->addTools($config);
81
+ $this->addEmail($config);
82
+ $this->addComment($config);
83
+ $this->addEmailValue($config);
84
+ $this->addShowButton($config);
85
+
86
+ $this->filterEmptyValues($config);
87
+
88
+ $this->convertToBool($config, 'shortcut');
89
+
90
+ return $config;
91
+ }
92
+
93
+ /**
94
+ * Add Language Option
95
+ * @param Varien_Object $config
96
+ */
97
+ protected function addLanguage($config)
98
+ {
99
+ $language = $this->getConfigHelper()->getLanguage();
100
+ if ($language) {
101
+ $config->setData('lang', $language);
102
+ }
103
+ }
104
+
105
+ /**
106
+ * Add Tools Option
107
+ * @param Varien_Object $config
108
+ */
109
+ protected function addTools($config)
110
+ {
111
+ $tools = $this->getConfigHelper()->getTools();
112
+ if ($tools) {
113
+ $config->setData('tools', array_filter(explode(",", str_replace(' ', '', $tools))));
114
+ }
115
+ }
116
+
117
+ /**
118
+ * Add Email Option
119
+ * @param Varien_Object $config
120
+ */
121
+ protected function addEmail($config)
122
+ {
123
+ $this->addNoOptReqField($config, "email", $this->getConfigHelper()->getShowEmail());
124
+ }
125
+
126
+ /**
127
+ * Add Comment Option
128
+ * @param Varien_Object $config
129
+ */
130
+ protected function addComment($config)
131
+ {
132
+ $this->addNoOptReqField($config, "comment", $this->getConfigHelper()->getShowComment());
133
+ }
134
+
135
+ /**
136
+ * Crates No Optional Required Config Values
137
+ * @param Varien_Object $config
138
+ * @param $key
139
+ * @param $configValue
140
+ */
141
+ private function addNoOptReqField($config, $key, $configValue)
142
+ {
143
+ switch ($configValue) {
144
+ case "no" :
145
+ $config->setData($key . 'Box', false);
146
+ break;
147
+ case "opt" :
148
+ $config->setData($key . 'Box', true);
149
+ $config->setData($key . 'Required', false);
150
+ break;
151
+ case "req" :
152
+ $config->setData($key . 'Box', true);
153
+ $config->setData($key . 'Required', true);
154
+ break;
155
+ default:
156
+ break;
157
+ }
158
+ }
159
+
160
+ /**
161
+ * Add Default Email Value
162
+ * @param Varien_Object $config
163
+ */
164
+ protected function addEmailValue($config)
165
+ {
166
+ $emailBoxValue = $this->getConfigHelper()->getEmailValue();
167
+ if ($emailBoxValue) {
168
+ $config->setData('emailBoxValue', $emailBoxValue);
169
+ }
170
+ }
171
+
172
+ /**
173
+ * Hide Button if configured
174
+ * @param Varien_Object $config
175
+ */
176
+ protected function addShowButton($config)
177
+ {
178
+ if (!$this->getConfigHelper()->getShowButton()) {
179
+ $config->setData('mode', "report");
180
+ }
181
+ }
182
+
183
+ /**
184
+ * @param Varien_Object $config
185
+ * @param $key
186
+ */
187
+ protected function convertToBool($config, $key)
188
+ {
189
+ if ($config->hasData($key)) {
190
+ $config->setData($key, ((bool)$config->getData($key)));
191
+ }
192
+ }
193
+
194
+ /**
195
+ * Filter Empty Values
196
+ * @param Varien_Object $config
197
+ */
198
+ protected function filterEmptyValues($config)
199
+ {
200
+ $data = $config->getData();
201
+ foreach ($data as $key => $value) {
202
+ if ($value === "" || $value === "-1" || $value === null) {
203
+ $config->unsetData($key);
204
+ }
205
+ }
206
+ }
207
+
208
+ /**
209
+ * @return Usersnap_Bugtracker_Helper_Config
210
+ */
211
+ protected function getConfigHelper()
212
+ {
213
+ if (!$this->_configHelper) {
214
+ $this->_configHelper = Mage::helper("bugtracker/config");
215
+ }
216
+ return $this->_configHelper;
217
+ }
218
+
219
+ }
app/code/community/Usersnap/Bugtracker/Helper/Config.php ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Usersnap_Bugtracker_Helper_Config extends Mage_Core_Helper_Abstract
4
+ {
5
+
6
+ const XML_PATH_API_KEY = 'usersnap/options/api_key';
7
+ const XML_PATH_ENABLE = 'usersnap/options/enable';
8
+ const XML_PATH_HIDE_TOUR = 'usersnap/display/hide_tour';
9
+ const XML_PATH_TOOLS = 'usersnap/display/tools';
10
+ const XML_PATH_DEBUG_ENABLE = 'usersnap/debug/enable';
11
+ const XML_PATH_BUTTON_TEXT = 'usersnap/display/button_text';
12
+ const XML_PATH_COMMENT_PLACEHOLDER = 'usersnap/display/comment_placeholder';
13
+ const XML_PATH_EMAIL_VALUE = 'usersnap/display/email_value';
14
+ const XML_PATH_ENABLE_SHORTCUT = 'usersnap/display/enable_shortcut';
15
+ const XML_PATH_HALIGN = 'usersnap/display/halign';
16
+ const XML_PATH_LANGUAGE = 'usersnap/display/language';
17
+ const XML_PATH_SHOW_BUTTON = 'usersnap/display/show_button';
18
+ const XML_PATH_SHOW_COMMENT = 'usersnap/display/show_comment';
19
+ const XML_PATH_SHOW_EMAIL = 'usersnap/display/show_email';
20
+ const XML_PATH_EMAIL_REPLACE = 'usersnap/display/email_replace';
21
+ const XML_PATH_VALIGN = 'usersnap/display/valign';
22
+
23
+ const USER_EMAIL = "{{USER_EMAIL}}";
24
+
25
+ const LANG_STORE = "store";
26
+
27
+ public function isEnabled()
28
+ {
29
+ return Mage::getStoreConfig(self::XML_PATH_ENABLE);
30
+ }
31
+
32
+ public function getApiKey()
33
+ {
34
+ return Mage::getStoreConfig(self::XML_PATH_API_KEY);
35
+ }
36
+
37
+ public function getTools()
38
+ {
39
+ return Mage::getStoreConfig(self::XML_PATH_TOOLS);
40
+ }
41
+
42
+ public function getHideTour()
43
+ {
44
+ return Mage::getStoreConfig(self::XML_PATH_HIDE_TOUR);
45
+ }
46
+
47
+ public function getShowButton()
48
+ {
49
+ return Mage::getStoreConfig(self::XML_PATH_SHOW_BUTTON);
50
+ }
51
+
52
+ public function getButtonText()
53
+ {
54
+ return Mage::getStoreConfig(self::XML_PATH_BUTTON_TEXT);
55
+ }
56
+
57
+ public function isShortcutEnabled()
58
+ {
59
+ return Mage::getStoreConfig(self::XML_PATH_ENABLE_SHORTCUT);
60
+ }
61
+
62
+ public function getShowEmail()
63
+ {
64
+ return Mage::getStoreConfig(self::XML_PATH_SHOW_EMAIL);
65
+ }
66
+
67
+ public function getEmailValue()
68
+ {
69
+ return Mage::getStoreConfig(self::XML_PATH_EMAIL_VALUE);
70
+ }
71
+
72
+ public function getReplaceEmail()
73
+ {
74
+ return Mage::getStoreConfig(self::XML_PATH_EMAIL_REPLACE);
75
+ }
76
+
77
+ public function getShowComment()
78
+ {
79
+ return Mage::getStoreConfig(self::XML_PATH_SHOW_COMMENT);
80
+ }
81
+
82
+ public function getCommentValue()
83
+ {
84
+ return Mage::getStoreConfig(self::XML_PATH_COMMENT_PLACEHOLDER);
85
+ }
86
+
87
+ public function getVerticalAlign()
88
+ {
89
+ return Mage::getStoreConfig(self::XML_PATH_VALIGN);
90
+ }
91
+
92
+ public function getHorizontalAlign()
93
+ {
94
+ return Mage::getStoreConfig(self::XML_PATH_HALIGN);
95
+ }
96
+
97
+ /**
98
+ * Returns the plain config value
99
+ * @return string
100
+ */
101
+ public function getLanguageConfigValue()
102
+ {
103
+ return Mage::getStoreConfig(self::XML_PATH_LANGUAGE);
104
+ }
105
+
106
+ /**
107
+ * Returns the parsed value according to the option
108
+ * @return string
109
+ */
110
+ public function getLanguage()
111
+ {
112
+ $language = $this->getLanguageConfigValue();
113
+ if ($language == self::LANG_STORE) {
114
+ $language = Mage::app()->getLocale()->getLocale()->getLanguage();
115
+ }
116
+ return $language;
117
+ }
118
+
119
+ public function isDebug()
120
+ {
121
+ return Mage::getStoreConfig(self::XML_PATH_DEBUG_ENABLE);
122
+ }
123
+ }
app/code/community/Usersnap/Bugtracker/Helper/Data.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Usersnap_Bugtracker_Helper_Data extends Mage_Core_Helper_Abstract
4
+ {
5
+
6
+ /**
7
+ * Escapes an array recursive
8
+ * If object is given the class name will be used
9
+ * @param $array
10
+ * @return array
11
+ */
12
+ public function escapeHtmlArray($array)
13
+ {
14
+ $returnArray = array();
15
+ foreach ($array as $key => $value) {
16
+ if (is_array($value)) {
17
+ $returnArray[$this->escapeHtml($key)] = $this->escapeHtmlArray($value);
18
+ } elseif (is_object($value)) {
19
+ $returnArray[$this->escapeHtml($key)] = get_class($value);
20
+ } else {
21
+ $returnArray[$this->escapeHtml($key)] = $this->escapeHtml($value);
22
+ }
23
+ }
24
+ return $returnArray;
25
+ }
26
+ }
app/code/community/Usersnap/Bugtracker/Model/Observer/Debug.php ADDED
@@ -0,0 +1,172 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Usersnap_Bugtracker_Model_Observer_Debug
4
+ {
5
+
6
+ public function addVersionInfo(Varien_Event_Observer $observer)
7
+ {
8
+ $observer->getDebugInfo()->setVersion($this->getVersionInfo());
9
+ }
10
+
11
+ public function addStoreInfo(Varien_Event_Observer $observer)
12
+ {
13
+ $observer->getDebugInfo()->setStore($this->getStoreInfo());
14
+ }
15
+
16
+ public function addControllerInfo(Varien_Event_Observer $observer)
17
+ {
18
+ $observer->getDebugInfo()->setController($this->getControllerInfo());
19
+ }
20
+
21
+ public function addCookieInfo(Varien_Event_Observer $observer)
22
+ {
23
+ $observer->getDebugInfo()->setCookie($this->getCookieInfo());
24
+ }
25
+
26
+ public function addLayoutHandleInfo(Varien_Event_Observer $observer)
27
+ {
28
+ $observer->getDebugInfo()->setLayoutHandles($this->getLayoutHandleInfo());
29
+ }
30
+
31
+ public function addDesignInfo(Varien_Event_Observer $observer)
32
+ {
33
+ $observer->getDebugInfo()->setDesign($this->getDesignInfo());
34
+ }
35
+
36
+ public function addCustomerInfo(Varien_Event_Observer $observer)
37
+ {
38
+ $observer->getDebugInfo()->setCustomer($this->getCustomerInfo());
39
+ }
40
+
41
+
42
+ public function addSessionInfo(Varien_Event_Observer $observer)
43
+ {
44
+ $observer->getDebugInfo()->setSession($this->getSessionInfo());
45
+ }
46
+
47
+ /**
48
+ * Info of the loaded Modules except of Mage Core Modules
49
+ * @return array
50
+ */
51
+ protected function getVersionInfo()
52
+ {
53
+ $items = array();
54
+ $items[] = array(
55
+ 'module' => 'Magento',
56
+ 'codePool' => 'core',
57
+ 'active' => true,
58
+ 'version' => Mage::getVersion()
59
+ );
60
+ $modulesConfig = Mage::getConfig()->getModuleConfig();
61
+ foreach ($modulesConfig as $node) {
62
+ foreach ($node as $module => $data) {
63
+ if ($data->codePool != "core") { //Don't display Magento Core Modules
64
+ $items[] = array(
65
+ "module" => (string)$module,
66
+ "codePool" => (string)$data->codePool,
67
+ "active" => (string)$data->active,
68
+ "version" => (string)$data->version
69
+ );
70
+ }
71
+ }
72
+ }
73
+
74
+ return $items;
75
+ }
76
+
77
+ /**
78
+ * Info of the current store including currency info
79
+ * @return array
80
+ */
81
+ protected function getStoreInfo()
82
+ {
83
+ $store = Mage::app()->getstore();
84
+ return array(
85
+ "id" => $store->getId(),
86
+ "name" => $store->getName(),
87
+ "base_currency" => $store->getBaseCurrencyCode(),
88
+ "current_currency" => $store->getCurrentCurrencyCode(),
89
+ );
90
+ }
91
+
92
+ /**
93
+ * Info of the current request (module, controller, action)
94
+ * @return array
95
+ */
96
+ protected function getControllerInfo()
97
+ {
98
+ $controller = Mage::registry('controller');
99
+ $request = $controller->getRequest();
100
+ return array(
101
+ "route_name" => $request->getRouteName(),
102
+ "controller_module" => $request->getControllerModule(),
103
+ "controller_name" => $request->getControllerName(),
104
+ "action_name" => $request->getActionName(),
105
+ "request_path" => $request->getPathInfo()
106
+ );
107
+ }
108
+
109
+ /**
110
+ * Info of currently set cookies
111
+ * @return array
112
+ */
113
+ protected function getCookieInfo()
114
+ {
115
+ return Mage::helper("bugtracker")->escapeHtmlArray(Mage::app()->getRequest()->getCookie());
116
+ }
117
+
118
+ /**
119
+ * Info of currently set objects inside the session
120
+ * @return array
121
+ */
122
+ protected function getSessionInfo()
123
+ {
124
+ return Mage::helper("bugtracker")->escapeHtmlArray(Mage::getSingleton("core/session")->getData());
125
+ }
126
+
127
+ /**
128
+ * Info of used layout handles
129
+ * @return array
130
+ */
131
+ protected function getLayoutHandleInfo()
132
+ {
133
+ return Mage::getSingleton('core/layout')->getUpdate()->getHandles();
134
+ }
135
+
136
+ /**
137
+ * Design and Template Info
138
+ * @return array
139
+ */
140
+ protected function getDesignInfo()
141
+ {
142
+ $designPackage = Mage::getSingleton('core/design_package');
143
+ return array(
144
+ 'design_area' => $designPackage->getArea(),
145
+ 'package_name' => $designPackage->getPackageName(),
146
+ 'theme' => $designPackage->getTheme('template'),
147
+ );
148
+ }
149
+
150
+ /**
151
+ * Info of current Customer
152
+ * @return array
153
+ */
154
+ protected function getCustomerInfo()
155
+ {
156
+ $customer = Mage::helper("customer")->getCustomer();
157
+ if ($customer->getId()) {
158
+ return array(
159
+ "id" => $customer->getId(),
160
+ "email" => $customer->getEmail(),
161
+ "firstname" => $customer->getFirstname(),
162
+ "lastname" => $customer->getLastname(),
163
+ "group" => $customer->getGroupId(),
164
+ );
165
+ } else {
166
+ return array(
167
+ "id" => $customer->getId()
168
+ );
169
+ }
170
+ }
171
+
172
+ }
app/code/community/Usersnap/Bugtracker/Model/Observer/Quote.php ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Usersnap_Bugtracker_Model_Observer_Quote
4
+ {
5
+
6
+ public function addQuoteInfo(Varien_Event_Observer $observer)
7
+ {
8
+ $observer->getDebugInfo()->setQuote($this->getQuoteInfo());
9
+ }
10
+
11
+ /**
12
+ * Quote information including quote items, payment method, shipping method and billing/shipping address
13
+ * @return array
14
+ */
15
+ protected function getQuoteInfo()
16
+ {
17
+ $quoteInfo = array();
18
+ if (!Mage::helper('core')->isModuleEnabled("Mage_Sales")) {
19
+ return $quoteInfo;
20
+ }
21
+ $quote = Mage::getModel('checkout/cart')->getQuote();
22
+ if ($quote->getId()) {
23
+ $quoteInfo = array(
24
+ "id" => $quote->getId(),
25
+ "quote_currency_code" => $quote->getQuoteCurrencyCode(),
26
+ "store_currency_code" => $quote->getStoreCurrencyCode(),
27
+ "base_currency_code" => $quote->getBaseCurrencyCode(),
28
+ "applied_rule_ids" => $quote->getAppliedRuleIds(),
29
+ "subtotal" => $quote->getSubtotal(),
30
+ "subtotal_with_discount" => $quote->getBaseSubtotalWithDiscount(),
31
+ "grand_total" => $quote->getGrandTotal(),
32
+ "updated_at" => $quote->getUpdatedAt(),
33
+ "customer_group_id" => $quote->getCustomerGroupId(),
34
+ "customer_tax_class_id" => $quote->getCustomerTaxClassId(),
35
+ "billing_address" => $this->formatAddress($quote->getBillingAddress()),
36
+ "shipping_address" => $this->formatAddress($quote->getShippingAddress()),
37
+ "items_count" => $quote->getItemsCount(),
38
+ "items" => $this->getQuoteItems($quote)
39
+ );
40
+ if ($quote->getPayment() && $quote->getPayment()->getMethod()) {
41
+ $quoteInfo['payment_method'] = $quote->getPayment()->getMethod();
42
+ }
43
+ if ($quote->getShippingAddress() && $quote->getShippingAddress()->getShippingMethod()) {
44
+ $quoteInfo['shipping_method'] = $quote->getShippingAddress()->getShippingMethod();
45
+ }
46
+ }
47
+
48
+ return $quoteInfo;
49
+ }
50
+
51
+ /**
52
+ * Return selected address items (type, name, country, vat_id)
53
+ * @param $address
54
+ * @return array|string
55
+ */
56
+ protected function formatAddress($address)
57
+ {
58
+ if (!$address) {
59
+ return "-";
60
+ }
61
+ /** @var $address Mage_Sales_Model_Quote_Address */
62
+ return array(
63
+ "type" => $address->getAddressType(),
64
+ "name" => $address->getName(),
65
+ "country" => $address->getCountryId(),
66
+ "vat_id" => $address->getVatId(),
67
+ );
68
+ }
69
+
70
+ /**
71
+ * Info of quote all quote items
72
+ * @param Mage_Sales_Model_Quote $quote
73
+ * @return array
74
+ */
75
+ protected function getQuoteItems(Mage_Sales_Model_Quote $quote)
76
+ {
77
+ $items = array();
78
+ if ($quote->getItemsCount() > 0) {
79
+ $helper = Mage::helper('catalog/product_configuration');
80
+ /** @var $item Mage_Sales_Model_Quote_Item */
81
+ foreach ($quote->getAllItems() as $item) {
82
+ $items[] = array(
83
+ "row_id" => $item->getId(),
84
+ "price" => $item->getPrice(),
85
+ "qty" => $item->getQty(),
86
+ "product_id" => $item->getProduct()->getId(),
87
+ "sku" => $item->getSku(),
88
+ "name" => $item->getName(),
89
+ "applied_rules" => $item->getAppliedRuleIds(),
90
+ "row_total" => $item->getRowTotal(),
91
+ "row_total_incl_tax" => $item->getRowTotalInclTax(),
92
+ "row_total_with_discount" => $item->getRowTotalWithDiscount(),
93
+ "options" => $helper->getCustomOptions($item),
94
+ );
95
+ }
96
+ }
97
+ return $items;
98
+ }
99
+ }
app/code/community/Usersnap/Bugtracker/Model/Observer/Wishlist.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Usersnap_Bugtracker_Model_Observer_Wishlist
4
+ {
5
+
6
+ public function addWishlistInfo(Varien_Event_Observer $observer)
7
+ {
8
+ $observer->getDebugInfo()->setWishlist($this->getWishlistInfo());
9
+ }
10
+
11
+
12
+ /**
13
+ * Info of wishlist items
14
+ * @return array
15
+ */
16
+ protected function getWishlistInfo()
17
+ {
18
+ $wishlistInfo = array();
19
+ if (!Mage::helper('core')->isModuleEnabled("Mage_Wishlist")) {
20
+ return $wishlistInfo;
21
+ }
22
+ $wishlistItems = Mage::helper('wishlist')->getWishlistItemCollection();
23
+ if ($wishlistItems) {
24
+ /** @var $item Mage_Wishlist_Model_Item */
25
+ foreach ($wishlistItems as $item) {
26
+ $wishlistInfo [] = array(
27
+ "product_id" => $item->getProduct()->getId(),
28
+ "product_sku" => $item->getProduct()->getSku(),
29
+ "product_name" => $item->getProduct()->getName(),
30
+ );
31
+ }
32
+ }
33
+ return $wishlistInfo;
34
+ }
35
+ }
app/code/community/Usersnap/Bugtracker/Model/System/Config/Source/Abstract.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Used in creating options for config value selection
5
+ *
6
+ */
7
+ class Usersnap_Bugtracker_Model_System_Config_Source_Abstract
8
+ {
9
+
10
+ protected $_values = array();
11
+
12
+ /**
13
+ * Options getter
14
+ *
15
+ * @return array
16
+ */
17
+ public function toOptionArray()
18
+ {
19
+ $optionArray = array();
20
+ foreach ($this->_values as $key => $value) {
21
+ $optionArray [] = array('value' => $key, 'label' => $value);
22
+ }
23
+
24
+ return $optionArray;
25
+ }
26
+
27
+ /**
28
+ * Get options in "key-value" format
29
+ *
30
+ * @return array
31
+ */
32
+ public function toArray()
33
+ {
34
+ return $this->_values;
35
+ }
36
+
37
+ /**
38
+ * @return Usersnap_Bugtracker_Helper_Data
39
+ */
40
+ protected function getHelper()
41
+ {
42
+ return Mage::helper("bugtracker");
43
+ }
44
+
45
+ }
app/code/community/Usersnap/Bugtracker/Model/System/Config/Source/DefaultNoOptReq.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ class Usersnap_Bugtracker_Model_System_Config_Source_DefaultNoOptReq
5
+ extends Usersnap_Bugtracker_Model_System_Config_Source_Abstract
6
+ {
7
+
8
+ public function __construct()
9
+ {
10
+ $this->_values = array(
11
+ "" => $this->getHelper()->__("Default"),
12
+ "no" => Mage::helper('adminhtml')->__('No'),
13
+ "opt" => Mage::helper('adminhtml')->__('Optional'),
14
+ "req" => Mage::helper('adminhtml')->__('Required')
15
+ );
16
+ }
17
+ }
app/code/community/Usersnap/Bugtracker/Model/System/Config/Source/DefaultYesNo.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ class Usersnap_Bugtracker_Model_System_Config_Source_DefaultYesNo
5
+ extends Usersnap_Bugtracker_Model_System_Config_Source_Abstract
6
+ {
7
+
8
+ public function __construct()
9
+ {
10
+ $this->_values = array(
11
+ "-1" => $this->getHelper()->__("Default"),
12
+ "1" => Mage::helper('adminhtml')->__('Yes'),
13
+ "0" => Mage::helper('adminhtml')->__('No'),
14
+ );
15
+ }
16
+ }
app/code/community/Usersnap/Bugtracker/Model/System/Config/Source/Halign.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class for Horizontal Align
5
+ */
6
+ class Usersnap_Bugtracker_Model_System_Config_Source_Halign
7
+ extends Usersnap_Bugtracker_Model_System_Config_Source_Abstract
8
+ {
9
+
10
+ public function __construct()
11
+ {
12
+ $this->_values = array(
13
+ "" => $this->getHelper()->__("Default"),
14
+ "right" => $this->getHelper()->__("Right"),
15
+ "left" => $this->getHelper()->__("Left")
16
+ );
17
+ }
18
+ }
app/code/community/Usersnap/Bugtracker/Model/System/Config/Source/Language.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Usersnap_Bugtracker_Model_System_Config_Source_Language
4
+ extends Usersnap_Bugtracker_Model_System_Config_Source_Abstract
5
+ {
6
+
7
+ /**
8
+ * Populate the language array and store it in config
9
+ */
10
+ public function __construct()
11
+ {
12
+ $cacheKey = 'USERSNAP_CONFIG_LANGUAGE_' . (string)Mage::app()->getLocale()->getLocale()->getLanguage();
13
+ $languages = null;
14
+ if (Mage::app()->useCache("config")) {
15
+ $languages = json_decode(Mage::app()->loadCache($cacheKey));
16
+ }
17
+ if (empty($languages)) {
18
+ $languages = array(
19
+ "" => $this->getHelper()->__("Default"),
20
+ Usersnap_Bugtracker_Helper_Config::LANG_STORE => $this->getHelper()->__("Store Specific Language")
21
+ );
22
+ $otherLanguages = Mage::app()->getLocale()->getTranslationList('language');
23
+ uasort($otherLanguages, 'strcoll');
24
+ foreach ($otherLanguages as $code => $name) {
25
+ $languages [$code] = $name;
26
+ }
27
+
28
+ if (Mage::app()->useCache('config')) {
29
+ Mage::app()->saveCache(json_encode($languages), $cacheKey, array('config'));
30
+ }
31
+ }
32
+ $this->_values = $languages;
33
+ }
34
+ }
app/code/community/Usersnap/Bugtracker/Model/System/Config/Source/Valign.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class for Vertical Align
5
+ */
6
+ class Usersnap_Bugtracker_Model_System_Config_Source_Valign
7
+ extends Usersnap_Bugtracker_Model_System_Config_Source_Abstract
8
+ {
9
+
10
+ public function __construct()
11
+ {
12
+ $this->_values = array(
13
+ "" => $this->getHelper()->__("Default"),
14
+ "bottom" => $this->getHelper()->__("Bottom"),
15
+ "middle" => $this->getHelper()->__("Middle")
16
+ );
17
+ }
18
+ }
app/code/community/Usersnap/Bugtracker/etc/config.xml ADDED
@@ -0,0 +1,141 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Usersnap_Bugtracker>
5
+ <version>1.0.0</version>
6
+ </Usersnap_Bugtracker>
7
+ </modules>
8
+ <global>
9
+ <helpers>
10
+ <bugtracker>
11
+ <class>Usersnap_Bugtracker_Helper</class>
12
+ </bugtracker>
13
+ </helpers>
14
+ <models>
15
+ <bugtracker>
16
+ <class>Usersnap_Bugtracker_Model</class>
17
+ </bugtracker>
18
+ </models>
19
+ <blocks>
20
+ <bugtracker>
21
+ <class>Usersnap_Bugtracker_Block</class>
22
+ </bugtracker>
23
+ </blocks>
24
+ <events>
25
+ <usersnap_debug_info>
26
+ <observers>
27
+ <usersnap_debug_add_version_info>
28
+ <type>singleton</type>
29
+ <class>bugtracker/observer_debug</class>
30
+ <method>addVersionInfo</method>
31
+ </usersnap_debug_add_version_info>
32
+ <usersnap_debug_add_store_info>
33
+ <type>singleton</type>
34
+ <class>bugtracker/observer_debug</class>
35
+ <method>addStoreInfo</method>
36
+ </usersnap_debug_add_store_info>
37
+ <usersnap_debug_add_controller_info>
38
+ <type>singleton</type>
39
+ <class>bugtracker/observer_debug</class>
40
+ <method>addControllerInfo</method>
41
+ </usersnap_debug_add_controller_info>
42
+ <usersnap_debug_add_cookie_info>
43
+ <type>singleton</type>
44
+ <class>bugtracker/observer_debug</class>
45
+ <method>addCookieInfo</method>
46
+ </usersnap_debug_add_cookie_info>
47
+ <usersnap_debug_add_layout_handle_info>
48
+ <type>singleton</type>
49
+ <class>bugtracker/observer_debug</class>
50
+ <method>addLayoutHandleInfo</method>
51
+ </usersnap_debug_add_layout_handle_info>
52
+ <usersnap_debug_add_design_info>
53
+ <type>singleton</type>
54
+ <class>bugtracker/observer_debug</class>
55
+ <method>addDesignInfo</method>
56
+ </usersnap_debug_add_design_info>
57
+ <usersnap_debug_add_customer_info>
58
+ <type>singleton</type>
59
+ <class>bugtracker/observer_debug</class>
60
+ <method>addCustomerInfo</method>
61
+ </usersnap_debug_add_customer_info>
62
+ <usersnap_debug_add_quote_info>
63
+ <type>singleton</type>
64
+ <class>bugtracker/observer_quote</class>
65
+ <method>addQuoteInfo</method>
66
+ </usersnap_debug_add_quote_info>
67
+ <usersnap_debug_add_wishlist_info>
68
+ <type>singleton</type>
69
+ <class>bugtracker/observer_wishlist</class>
70
+ <method>addWishlistInfo</method>
71
+ </usersnap_debug_add_wishlist_info>
72
+ <usersnap_debug_add_session_info>
73
+ <type>disabled</type>
74
+ <class>bugtracker/observer_debug</class>
75
+ <method>addSessionInfo</method>
76
+ </usersnap_debug_add_session_info>
77
+ </observers>
78
+ </usersnap_debug_info>
79
+ </events>
80
+ </global>
81
+ <frontend>
82
+ <layout>
83
+ <updates>
84
+ <bugtracker>
85
+ <file>bugtracker.xml</file>
86
+ </bugtracker>
87
+ </updates>
88
+ </layout>
89
+ </frontend>
90
+ <adminhtml>
91
+ <layout>
92
+ <updates>
93
+ <bugtracker>
94
+ <file>bugtracker.xml</file>
95
+ </bugtracker>
96
+ </updates>
97
+ </layout>
98
+ <acl>
99
+ <resources>
100
+ <admin>
101
+ <children>
102
+ <usersnap>
103
+ <title>Usersnap Bugtracker</title>
104
+ <sort_order>10</sort_order>
105
+ </usersnap>
106
+ <system>
107
+ <children>
108
+ <config>
109
+ <children>
110
+ <usersnap>Usersnap Bugtracker</usersnap>
111
+ </children>
112
+ </config>
113
+ </children>
114
+ </system>
115
+ </children>
116
+ </admin>
117
+ </resources>
118
+ </acl>
119
+ </adminhtml>
120
+ <default>
121
+ <usersnap>
122
+ <options>
123
+ <enable>1</enable>
124
+ </options>
125
+ <display>
126
+ <hide_tour>-1</hide_tour>
127
+ <show_button>-1</show_button>
128
+ <enable_shortcut>-1</enable_shortcut>
129
+ <show_email>""</show_email>
130
+ <email_replace>1</email_replace>
131
+ <show_comment>""</show_comment>
132
+ <valign />
133
+ <halign />
134
+ <language />
135
+ </display>
136
+ <debug>
137
+ <enable>1</enable>
138
+ </debug>
139
+ </usersnap>
140
+ </default>
141
+ </config>
app/code/community/Usersnap/Bugtracker/etc/system.xml ADDED
@@ -0,0 +1,213 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <config>
2
+ <sections>
3
+ <usersnap translate="label" module="bugtracker">
4
+ <label>Usersnap Bugtracker</label>
5
+ <tab>advanced</tab>
6
+ <sort_order>110</sort_order>
7
+ <show_in_default>1</show_in_default>
8
+ <show_in_website>1</show_in_website>
9
+ <show_in_store>1</show_in_store>
10
+ <groups>
11
+ <options translate="label">
12
+ <label>Basic Options</label>
13
+ <sort_order>100</sort_order>
14
+ <show_in_default>1</show_in_default>
15
+ <show_in_website>1</show_in_website>
16
+ <show_in_store>1</show_in_store>
17
+ <expanded>1</expanded>
18
+ <fields>
19
+ <enable>
20
+ <label>Enable Bugtracker</label>
21
+ <frontend_type>select</frontend_type>
22
+ <source_model>adminhtml/system_config_source_yesno</source_model>
23
+ <sort_order>1</sort_order>
24
+ <show_in_default>1</show_in_default>
25
+ <show_in_website>1</show_in_website>
26
+ <show_in_store>1</show_in_store>
27
+ <comment><![CDATA[Enables Bugtracker Widget]]></comment>
28
+ <sort_order>0</sort_order>
29
+ </enable>
30
+ <api_key>
31
+ <label>Project API Key</label>
32
+ <frontend_type>text</frontend_type>
33
+ <sort_order>1</sort_order>
34
+ <show_in_default>1</show_in_default>
35
+ <show_in_website>1</show_in_website>
36
+ <show_in_store>1</show_in_store>
37
+ <sort_order>1</sort_order>
38
+ <comment><![CDATA[The Project API Key can be found in the "General Settings" tab of your Project.]]></comment>
39
+ </api_key>
40
+ </fields>
41
+ </options>
42
+ <display translate="label">
43
+ <label>Advanced Options (Optional)</label>
44
+ <sort_order>110</sort_order>
45
+ <show_in_default>1</show_in_default>
46
+ <show_in_website>1</show_in_website>
47
+ <show_in_store>1</show_in_store>
48
+ <expanded>0</expanded>
49
+ <fields>
50
+ <tools>
51
+ <label>Tools</label>
52
+ <frontend_type>text</frontend_type>
53
+ <sort_order>1</sort_order>
54
+ <show_in_default>1</show_in_default>
55
+ <show_in_website>1</show_in_website>
56
+ <show_in_store>1</show_in_store>
57
+ <sort_order>0</sort_order>
58
+ <comment><![CDATA[Comma separated list of the Usersnap tools. Leave empty for no restriction.
59
+ Supported Tools can be found at <a target="_blank" href="https://usersnap.com/docs#tools">https://usersnap.com/docs#tools</a>]]></comment>
60
+ </tools>
61
+ <hide_tour>
62
+ <label>Hide the guided tour</label>
63
+ <frontend_type>select</frontend_type>
64
+ <source_model>bugtracker/system_config_source_defaultYesNo</source_model>
65
+ <sort_order>1</sort_order>
66
+ <show_in_default>1</show_in_default>
67
+ <show_in_website>1</show_in_website>
68
+ <show_in_store>1</show_in_store>
69
+ <comment><![CDATA[Everytime your users open Usersnap for the first time, a guided tour and a help window is being displayed. If you don't want this window to show up per default, you can hide the initial tour window of Usersnap.]]></comment>
70
+ <sort_order>1</sort_order>
71
+ </hide_tour>
72
+ <show_button>
73
+ <label>Show Feedback Button</label>
74
+ <frontend_type>select</frontend_type>
75
+ <source_model>bugtracker/system_config_source_defaultYesNo</source_model>
76
+ <sort_order>1</sort_order>
77
+ <show_in_default>1</show_in_default>
78
+ <show_in_website>1</show_in_website>
79
+ <show_in_store>1</show_in_store>
80
+ <sort_order>2</sort_order>
81
+ </show_button>
82
+ <button_text>
83
+ <label>Feedback Button Text</label>
84
+ <frontend_type>text</frontend_type>
85
+ <sort_order>1</sort_order>
86
+ <show_in_default>1</show_in_default>
87
+ <show_in_website>1</show_in_website>
88
+ <show_in_store>1</show_in_store>
89
+ <sort_order>3</sort_order>
90
+ </button_text>
91
+ <enable_shortcut>
92
+ <label>Enable Usersnap Shortcut</label>
93
+ <frontend_type>select</frontend_type>
94
+ <source_model>bugtracker/system_config_source_defaultYesNo</source_model>
95
+ <sort_order>1</sort_order>
96
+ <show_in_default>1</show_in_default>
97
+ <show_in_website>1</show_in_website>
98
+ <show_in_store>1</show_in_store>
99
+ <sort_order>4</sort_order>
100
+ <comment><![CDATA[Use a keyboard shortcut (Ctrl+U) to open Usersnap.</br>
101
+ You can display the Usersnap widget with this shortcut even if the feedback button is hidden.]]></comment>
102
+ </enable_shortcut>
103
+ <show_email>
104
+ <label>Show Email Field</label>
105
+ <frontend_type>select</frontend_type>
106
+ <source_model>bugtracker/system_config_source_defaultNoOptReq</source_model>
107
+ <sort_order>1</sort_order>
108
+ <show_in_default>1</show_in_default>
109
+ <show_in_website>1</show_in_website>
110
+ <show_in_store>1</show_in_store>
111
+ <comment><![CDATA[Show email field in widget]]></comment>
112
+ <sort_order>5</sort_order>
113
+ </show_email>
114
+ <email_value>
115
+ <label>Default Email Value</label>
116
+ <frontend_type>text</frontend_type>
117
+ <sort_order>1</sort_order>
118
+ <show_in_default>1</show_in_default>
119
+ <show_in_website>1</show_in_website>
120
+ <show_in_store>1</show_in_store>
121
+ <sort_order>6</sort_order>
122
+ </email_value>
123
+ <email_replace>
124
+ <label>Replace Default Email With User Email</label>
125
+ <frontend_type>select</frontend_type>
126
+ <source_model>adminhtml/system_config_source_yesno</source_model>
127
+ <sort_order>1</sort_order>
128
+ <show_in_default>1</show_in_default>
129
+ <show_in_website>1</show_in_website>
130
+ <show_in_store>1</show_in_store>
131
+ <sort_order>7</sort_order>
132
+ </email_replace>
133
+ <show_comment>
134
+ <label>Show Comment Field</label>
135
+ <frontend_type>select</frontend_type>
136
+ <source_model>bugtracker/system_config_source_defaultNoOptReq</source_model>
137
+ <sort_order>1</sort_order>
138
+ <show_in_default>1</show_in_default>
139
+ <show_in_website>1</show_in_website>
140
+ <show_in_store>1</show_in_store>
141
+ <comment><![CDATA[Show comment field in widget]]></comment>
142
+ <sort_order>8</sort_order>
143
+ </show_comment>
144
+ <comment_placeholder>
145
+ <label>Comment Field Placeholder</label>
146
+ <frontend_type>text</frontend_type>
147
+ <sort_order>1</sort_order>
148
+ <show_in_default>1</show_in_default>
149
+ <show_in_website>1</show_in_website>
150
+ <show_in_store>1</show_in_store>
151
+ <sort_order>9</sort_order>
152
+ </comment_placeholder>
153
+ <valign>
154
+ <label>Vertical Align</label>
155
+ <frontend_type>select</frontend_type>
156
+ <source_model>bugtracker/system_config_source_valign</source_model>
157
+ <sort_order>1</sort_order>
158
+ <show_in_default>1</show_in_default>
159
+ <show_in_website>1</show_in_website>
160
+ <show_in_store>1</show_in_store>
161
+ <sort_order>10</sort_order>
162
+ </valign>
163
+ <halign>
164
+ <label>Horizontal Align</label>
165
+ <frontend_type>select</frontend_type>
166
+ <source_model>bugtracker/system_config_source_halign</source_model>
167
+ <sort_order>1</sort_order>
168
+ <show_in_default>1</show_in_default>
169
+ <show_in_website>1</show_in_website>
170
+ <show_in_store>1</show_in_store>
171
+ <sort_order>11</sort_order>
172
+ </halign>
173
+ <language>
174
+ <label>Widget Language</label>
175
+ <frontend_type>select</frontend_type>
176
+ <source_model>bugtracker/system_config_source_language</source_model>
177
+ <sort_order>1</sort_order>
178
+ <show_in_default>1</show_in_default>
179
+ <show_in_website>1</show_in_website>
180
+ <show_in_store>1</show_in_store>
181
+ <sort_order>12</sort_order>
182
+ <comment><![CDATA[If chosen language is not supported it will fall back to default.</br>
183
+ Supported Languages can be found at <a target="_blank" href="https://usersnap.com/docs#language">https://usersnap.com/docs#language</a>]]></comment>
184
+ </language>
185
+ </fields>
186
+ </display>
187
+ <debug translate="label">
188
+ <label>Debug</label>
189
+ <sort_order>120</sort_order>
190
+ <show_in_default>1</show_in_default>
191
+ <show_in_website>1</show_in_website>
192
+ <show_in_store>1</show_in_store>
193
+ <expanded>0</expanded>
194
+ <fields>
195
+ <enable>
196
+ <label>Add Debug Information</label>
197
+ <frontend_type>select</frontend_type>
198
+ <source_model>adminhtml/system_config_source_yesno</source_model>
199
+ <sort_order>1</sort_order>
200
+ <show_in_default>1</show_in_default>
201
+ <show_in_website>1</show_in_website>
202
+ <show_in_store>1</show_in_store>
203
+ <sort_order>1</sort_order>
204
+ <comment><![CDATA[Add additional Magento specific debug information to the Usersnap info object.]]>
205
+ </comment>
206
+ </enable>
207
+ </fields>
208
+ </debug>
209
+ </groups>
210
+ </usersnap>
211
+ </sections>
212
+ </config>
213
+
app/design/adminhtml/base/default/layout/bugtracker.xml ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.1">
3
+ <default>
4
+ <reference name="before_body_end">
5
+ <block type="bugtracker/track" name="usersnap.bugtracker" template="bugtracker/track.phtml" ifconfig="usersnap/options/enable">
6
+ <block type="bugtracker/debug" name="usersnap.debug" template="bugtracker/debug.phtml" ifconfig="usersnap/debug/enable"/>
7
+ </block>
8
+ </reference>
9
+ </default>
10
+ <customer_logged_in>
11
+ <reference name="usersnap.bugtracker">
12
+ <block type="bugtracker/customerEmail" name="usersnap.customerEmail" template="bugtracker/customerEmail.phtml" ifconfig="usersnap/display/email_replace" before="-"/>
13
+ </reference>
14
+ </customer_logged_in>
15
+ </layout>
app/design/adminhtml/base/default/template/bugtracker/customerEmail.phtml ADDED
@@ -0,0 +1 @@
 
1
+ _usersnapconfig["emailBoxValue"] = "<?php echo $this->getCustomerEmail(); ?>";
app/design/adminhtml/base/default/template/bugtracker/debug.phtml ADDED
@@ -0,0 +1 @@
 
1
+ _usersnapconfig["addinfo"] = <?php echo $this->getDebugInfo(); ?>;
app/design/adminhtml/base/default/template/bugtracker/track.phtml ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script type="text/javascript">
2
+ <?php echo $this->getJsonConfig(); ?>
3
+ <?php echo $this->getChildHtml(); ?>
4
+ (function() {
5
+ var s = document.createElement("script");
6
+ s.type = "text/javascript";
7
+ s.async = true;
8
+ s.src = '//api.usersnap.com/load/'+
9
+ '<?php echo $this->getApiKey(); ?>.js';
10
+ var x = document.getElementsByTagName('script')[0];
11
+ x.parentNode.insertBefore(s, x);
12
+ })();
13
+ </script>
app/design/frontend/base/default/layout/bugtracker.xml ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.1">
3
+ <default>
4
+ <reference name="before_body_end">
5
+ <block type="bugtracker/track" name="usersnap.bugtracker" template="bugtracker/track.phtml" ifconfig="usersnap/options/enable">
6
+ <block type="bugtracker/debug" name="usersnap.debug" template="bugtracker/debug.phtml" ifconfig="usersnap/debug/enable"/>
7
+ </block>
8
+ </reference>
9
+ </default>
10
+ <customer_logged_in>
11
+ <reference name="usersnap.bugtracker">
12
+ <block type="bugtracker/customerEmail" name="usersnap.customerEmail" template="bugtracker/customerEmail.phtml" ifconfig="usersnap/display/email_replace" before="-"/>
13
+ </reference>
14
+ </customer_logged_in>
15
+ </layout>
app/design/frontend/base/default/template/bugtracker/customerEmail.phtml ADDED
@@ -0,0 +1 @@
 
1
+ _usersnapconfig["emailBoxValue"] = "<?php echo $this->getCustomerEmail(); ?>";
app/design/frontend/base/default/template/bugtracker/debug.phtml ADDED
@@ -0,0 +1 @@
 
1
+ _usersnapconfig["addinfo"] = <?php echo $this->getDebugInfo(); ?>;
app/design/frontend/base/default/template/bugtracker/track.phtml ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script type="text/javascript">
2
+ <?php echo $this->getJsonConfig(); ?>
3
+ <?php echo $this->getChildHtml(); ?>
4
+ (function() {
5
+ var s = document.createElement("script");
6
+ s.type = "text/javascript";
7
+ s.async = true;
8
+ s.src = '//api.usersnap.com/load/'+
9
+ '<?php echo $this->getApiKey(); ?>.js';
10
+ var x = document.getElementsByTagName('script')[0];
11
+ x.parentNode.insertBefore(s, x);
12
+ })();
13
+ </script>
app/etc/modules/Usersnap_Bugtracker.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Usersnap_Bugtracker>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Usersnap_Bugtracker>
8
+ </modules>
9
+ </config>
package.xml ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Usersnap_Bugtracker</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license>GPL-3.0+</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Usersnap integration with additional debug information</summary>
10
+ <description># Usersnap Bugtracker&#xD;
11
+ We've created a Usersnap Magento integration with some optional debug information.&#xD;
12
+ It is installed as a Magento module without hacking Magento's core.&#xD;
13
+ &#xD;
14
+ ## INSTALLATION &#xD;
15
+ &#xD;
16
+ ### A) Via Composer - Recommended&#xD;
17
+ Add following code to the composer.json&#xD;
18
+ &lt;pre&gt;&#xD;
19
+ "require": {&#xD;
20
+ "usersnap/bugtracker": "*",&#xD;
21
+ },&#xD;
22
+ &lt;/pre&gt;&#xD;
23
+ &#xD;
24
+ ### B) Via Modman (https://github.com/colinmollenhour/modman)&#xD;
25
+ &#xD;
26
+ &lt;pre&gt;&#xD;
27
+ cd [magento root folder]&#xD;
28
+ modman init&#xD;
29
+ modman clone https://github.com/pointia/Usersnap_Bugtracker.git&#xD;
30
+ &lt;/pre&gt;&#xD;
31
+ &#xD;
32
+ - Make sure you've cleaned Magento's cache to enable the new module; hit refresh&#xD;
33
+ &#xD;
34
+ ### C) Via Magento Connect&#xD;
35
+ Extension is not updated regularly. I recommend using modman.&#xD;
36
+ &#xD;
37
+ &lt;pre&gt;&#xD;
38
+ cd [magento root folder]&#xD;
39
+ sudo ./mage install community Usersnap_Bugtracker&#xD;
40
+ &lt;/pre&gt;&#xD;
41
+ &#xD;
42
+ ### Protected Sites / Usersnap behind Firewall&#xD;
43
+ If you are using a staging setup which is protected using BasicAuth (.htaccess), please grant the Usersnap servers (*.usersnap.com) acccess.&#xD;
44
+ &#xD;
45
+ Configuration for Apache&#xD;
46
+ &lt;pre&gt;&#xD;
47
+ Order deny,allow&#xD;
48
+ Deny from all&#xD;
49
+ &#xD;
50
+ AuthType Basic&#xD;
51
+ AuthName "Password protected"&#xD;
52
+ Require valid-user&#xD;
53
+ AuthUserFile /path/to/your/.htpasswd&#xD;
54
+ &#xD;
55
+ Allow from .usersnap.com&#xD;
56
+ Satisfy Any&#xD;
57
+ &lt;/pre&gt;&#xD;
58
+ For further information visit &lt;a href="https://usersnap.com/help/troubleshooting/protected" target="_blank"&gt;https://usersnap.com/help/troubleshooting/protected&lt;/a&gt;&#xD;
59
+ &#xD;
60
+ &#xD;
61
+ &#xD;
62
+ &#xD;
63
+ ## FEATURES &#xD;
64
+ - Easily report bugs with the Usersnap Bugtracker integration (for more info visit &lt;a href="www.usersnap.com" target="_blank"&gt;www.usersnap.com&lt;/a&gt;)&#xD;
65
+ - Connect with 20+ Systems ( E-Mail, Basecamp, Jira, asana, Trello, github, ...)&#xD;
66
+ - Customizable Feedback Widget (Enable, Tools, Button Text, Widget Position, Required Fields, Language, ...)&#xD;
67
+ - Useful Magento Debug Information&#xD;
68
+ - Written as Event Observer (Event: usersnap_debug_info, Object: "debug_info") thus you can write your own code and deactivate default info in the local.xml&#xD;
69
+ - Magento Version + Module Versions (Useful for different Environments)&#xD;
70
+ - Store Information&#xD;
71
+ - Controller Information&#xD;
72
+ - Cookie Information&#xD;
73
+ - Layout Handles&#xD;
74
+ - Design Information&#xD;
75
+ - Customer Information&#xD;
76
+ - Session Information (disabled by default)&#xD;
77
+ - Quote Information (incl. Quote Items, price, currency, address, ...)&#xD;
78
+ - Wishlist Information</description>
79
+ <notes>First Release</notes>
80
+ <authors><author><name>Andreas Pointner</name><user>pointia</user><email>andreaspointner@gmail.com</email></author></authors>
81
+ <date>2014-11-29</date>
82
+ <time>12:55:38</time>
83
+ <contents><target name="magecommunity"><dir name="Usersnap"><dir name="Bugtracker"><dir name="Block"><file name="CustomerEmail.php" hash="8ff80f75b9c2132e7a28d999143cc33e"/><file name="Debug.php" hash="57a7aabca37aa30f08f8390e7b9b3f26"/><file name="Track.php" hash="d4285c58247e753a21af91845631c0e6"/></dir><dir name="Helper"><file name="Config.php" hash="23ba172c93578f5efd6f8c2f06a2e123"/><file name="Data.php" hash="73b900eb09c97653f06f48967e8f343b"/></dir><dir name="Model"><dir name="Observer"><file name="Debug.php" hash="1748eb50b35db3780ea8dd1b4fcb1056"/><file name="Quote.php" hash="f389b7ed96185a2834547e5afb879d81"/><file name="Wishlist.php" hash="cd2a4f4696146e4258f5808121ad1544"/></dir><dir name="System"><dir name="Config"><dir name="Source"><file name="Abstract.php" hash="144b9b9221168758d1617adbcea187aa"/><file name="DefaultNoOptReq.php" hash="67e8b02f74cf5f9da57cf6df52140acb"/><file name="DefaultYesNo.php" hash="fb17fd7a6e1f92eab082565e87327870"/><file name="Halign.php" hash="c26e3701236f14d758bc14754a9fd6cc"/><file name="Language.php" hash="85d3bfa167cb33b242c758617048f75b"/><file name="Valign.php" hash="e51a35d96104c82f5dd8d782113690d9"/></dir></dir></dir></dir><dir name="etc"><file name="config.xml" hash="73125c99b5ab26f6dfef3c69d72f0cca"/><file name="system.xml" hash="d5e1985f9d1f47a4326edc3a947882b1"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="bugtracker.xml" hash="49cb6105c57c2e21d93d007d1d93d419"/></dir><dir name="template"><dir name="bugtracker"><file name="customerEmail.phtml" hash="98b858fb10050c545239f82bfd54c92f"/><file name="debug.phtml" hash="0cf3eadae6eeb607c9a0e5de8bd040fb"/><file name="track.phtml" hash="f5e8f4fbc407d7f0a42bed9b28b8bd66"/></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="base"><dir name="default"><dir name="layout"><file name="bugtracker.xml" hash="49cb6105c57c2e21d93d007d1d93d419"/></dir><dir name="template"><dir name="bugtracker"><file name="customerEmail.phtml" hash="98b858fb10050c545239f82bfd54c92f"/><file name="debug.phtml" hash="0cf3eadae6eeb607c9a0e5de8bd040fb"/><file name="track.phtml" hash="f5e8f4fbc407d7f0a42bed9b28b8bd66"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Usersnap_Bugtracker.xml" hash="5ed937084ac09e88a6c2612594e855a9"/></dir></target></contents>
84
+ <compatible/>
85
+ <dependencies><required><php><min>5.3.0</min><max>6.0.0</max></php></required></dependencies>
86
+ </package>