neklo_scrolltotop - Version 1.0

Version Notes

The first stable release.

Download this release

Release Info

Developer NEKLO
Extension neklo_scrolltotop
Version 1.0
Comparing to
See all releases


Version 1.0

Files changed (39) hide show
  1. app/code/community/Neklo/Core/Block/System/Abstract.php +62 -0
  2. app/code/community/Neklo/Core/Block/System/Contact.php +165 -0
  3. app/code/community/Neklo/Core/Block/System/Extensions.php +66 -0
  4. app/code/community/Neklo/Core/Block/System/Newsletter.php +9 -0
  5. app/code/community/Neklo/Core/Block/System/Newsletter/Subscribe.php +20 -0
  6. app/code/community/Neklo/Core/Block/System/Newsletter/Subscribe/Button.php +35 -0
  7. app/code/community/Neklo/Core/Helper/Data.php +20 -0
  8. app/code/community/Neklo/Core/Model/Feed.php +34 -0
  9. app/code/community/Neklo/Core/Model/Observer.php +16 -0
  10. app/code/community/Neklo/Core/controllers/Adminhtml/Neklo/Core/ContactController.php +54 -0
  11. app/code/community/Neklo/Core/controllers/Adminhtml/Neklo/Core/NewsletterController.php +47 -0
  12. app/code/community/Neklo/Core/etc/adminhtml.xml +26 -0
  13. app/code/community/Neklo/Core/etc/config.xml +75 -0
  14. app/code/community/Neklo/Core/etc/system.xml +77 -0
  15. app/code/community/Neklo/ScrollToTop/Block/Adminhtml/System/Color.php +31 -0
  16. app/code/community/Neklo/ScrollToTop/Block/Adminhtml/System/Color/List.php +40 -0
  17. app/code/community/Neklo/ScrollToTop/Block/Arrow.php +75 -0
  18. app/code/community/Neklo/ScrollToTop/Helper/Config.php +142 -0
  19. app/code/community/Neklo/ScrollToTop/Helper/Data.php +22 -0
  20. app/code/community/Neklo/ScrollToTop/Helper/Page.php +73 -0
  21. app/code/community/Neklo/ScrollToTop/Model/Source/Color.php +28 -0
  22. app/code/community/Neklo/ScrollToTop/Model/Source/Position.php +34 -0
  23. app/code/community/Neklo/ScrollToTop/etc/adminhtml.xml +26 -0
  24. app/code/community/Neklo/ScrollToTop/etc/config.xml +71 -0
  25. app/code/community/Neklo/ScrollToTop/etc/system.xml +187 -0
  26. app/design/adminhtml/default/default/template/neklo/core/system/subscribe/button.phtml +161 -0
  27. app/design/adminhtml/default/default/template/neklo/scrolltotop/system/color/list.phtml +25 -0
  28. app/design/frontend/base/default/layout/neklo/scrolltotop.xml +18 -0
  29. app/design/frontend/base/default/template/neklo/scrolltotop/arrow.phtml +13 -0
  30. app/etc/modules/Neklo_Core.xml +10 -0
  31. app/etc/modules/Neklo_ScrollToTop.xml +15 -0
  32. app/locale/en_US/Neklo_Core.csv +19 -0
  33. package.xml +18 -0
  34. skin/frontend/base/default/neklo/scrolltotop/css/styles.css +44 -0
  35. skin/frontend/base/default/neklo/scrolltotop/fonts/icomoon.eot +0 -0
  36. skin/frontend/base/default/neklo/scrolltotop/fonts/icomoon.svg +12 -0
  37. skin/frontend/base/default/neklo/scrolltotop/fonts/icomoon.ttf +0 -0
  38. skin/frontend/base/default/neklo/scrolltotop/fonts/icomoon.woff +0 -0
  39. skin/frontend/base/default/neklo/scrolltotop/js/script.js +50 -0
app/code/community/Neklo/Core/Block/System/Abstract.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Neklo_Core_Block_System_Abstract extends Mage_Adminhtml_Block_System_Config_Form_Fieldset
4
+ {
5
+ protected $_modules;
6
+ protected $_fieldRenderer;
7
+
8
+ protected function _getFieldRenderer()
9
+ {
10
+ if (empty($this->_fieldRenderer)) {
11
+ $this->_fieldRenderer = Mage::getBlockSingleton('adminhtml/system_config_form_field');
12
+ }
13
+ return $this->_fieldRenderer;
14
+ }
15
+
16
+ protected function _getFooterHtml($element)
17
+ {
18
+ $html = parent::_getFooterHtml($element);
19
+ $html .= Mage::helper('adminhtml/js')->getScript(
20
+ "
21
+ $$('td.form-buttons')[0].update('');
22
+ $('{$element->getHtmlId()}' + '-head').setStyle('background: none;');
23
+ $('{$element->getHtmlId()}' + '-head').writeAttribute('onclick', 'return false;');
24
+ $('{$element->getHtmlId()}').show();
25
+ "
26
+ );
27
+ return $html;
28
+ }
29
+
30
+ protected function _getModules()
31
+ {
32
+ if (is_null($this->modules)) {
33
+ $array = (array)Mage::getConfig()->getNode('modules')->children();
34
+ ksort($array);
35
+ $modules = array();
36
+ $cache = array();
37
+ foreach ($array as $code => $item) {
38
+ $name = explode('_', $code, 2);
39
+
40
+ if (!$item->is('active', 'true')
41
+ || !isset($name)
42
+ || $name[0] != 'Neklo'
43
+ || $code == 'Neklo_Core'
44
+ ) {
45
+ continue;
46
+ }
47
+
48
+ $modules[] = $code;
49
+ $config = Mage::getConfig()->getNode('modules/' . $code);
50
+ $version = explode('.', $config->version);
51
+ $version = (intval($version[0]) - 1) << 12 | intval($version[1]) << 6 | intval($version[2]) << 0;
52
+ $cache[] = dechex(intval($config->build)) . 't' . dechex(intval($config->build) - hexdec($config->encoding)) . 't' . substr(md5(strtolower($code)), 0, 2) . $version;
53
+ }
54
+ $cache = implode('n', $cache);
55
+ $param = '<domain></domain>' . 'cache/' . $cache;
56
+ $param = str_replace('<domain>' . '</domain>', '/', $param) . '/';
57
+ $this->getRequest()->setPost('neklo_' . 'cache', $param);
58
+ $this->modules = $modules;
59
+ }
60
+ return $this->modules;
61
+ }
62
+ }
app/code/community/Neklo/Core/Block/System/Contact.php ADDED
@@ -0,0 +1,165 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Neklo_Core_Block_System_Contact extends Neklo_Core_Block_System_Abstract
4
+ {
5
+ public function render(Varien_Data_Form_Element_Abstract $element)
6
+ {
7
+ $fields = array(
8
+ array(
9
+ 'type' => 'text',
10
+ 'name' => 'name',
11
+ 'label' => $this->__('Contact Name'),
12
+ 'class' => 'required-entry',
13
+ ),
14
+ array(
15
+ 'type' => 'text',
16
+ 'name' => 'email',
17
+ 'label' => $this->__('Contact Email'),
18
+ 'class' => 'required-entry validate-email',
19
+ ),
20
+ array(
21
+ 'type' => 'text',
22
+ 'name' => 'subject',
23
+ 'label' => $this->__('Subject'),
24
+ 'class' => 'required-entry'),
25
+ array(
26
+ 'type' => 'select',
27
+ 'name' => 'reason',
28
+ 'label' => $this->__('Reason'),
29
+ 'values' => $this->_getReasons(),
30
+ 'class' => 'required-entry',
31
+ 'onchange' => 'NekloContact.toggleReason()',
32
+ ),
33
+ array(
34
+ 'type' => 'text',
35
+ 'name' => 'other_reason',
36
+ 'label' => $this->__('Other Reason'),
37
+ 'class' => 'required-entry',
38
+ 'onchange' => 'NekloContact.toggleReason()',
39
+ ),
40
+ array(
41
+ 'type' => 'textarea',
42
+ 'name' => 'message',
43
+ 'label' => $this->__('Message'),
44
+ 'class' => 'required-entry',
45
+ ),
46
+ array(
47
+ 'type' => 'label',
48
+ 'name' => 'send',
49
+ 'after_element_html' => '<div class="right"><button type="button" class="scalable save" onclick="NekloContact.submit()">' . $this->__('Send') . '</button></div><div class="notice" id="ajax-response"></div>',
50
+ ),
51
+ );
52
+ if (!$element->getForm()) {
53
+ return '';
54
+ }
55
+ $html = $this->_getHeaderHtml($element);
56
+ foreach ($fields as $field) {
57
+ $html .= $this->_getFieldHtml($element, $field);
58
+ }
59
+ $html .= $this->_getFooterHtml($element);
60
+ return $html;
61
+ }
62
+
63
+ protected function _getReasons()
64
+ {
65
+ $modules = $this->_getModules();
66
+
67
+ $reasons[] = array(
68
+ 'label' => $this->__('Please select'),
69
+ 'value' => ''
70
+ );
71
+ $reasons[] = array(
72
+ 'label' => $this->__('Magento Related Support (paid)'),
73
+ 'value' => 'Magento v' . Mage::getVersion()
74
+ );
75
+ $reasons[] = array(
76
+ 'label' => $this->__('Request New Extension Development (paid)'),
77
+ 'value' => 'New Extension'
78
+ );
79
+ foreach ($modules as $code) {
80
+ $moduleConfig = Mage::getConfig()->getNode('modules/' . $code);
81
+ $reasons[] = array(
82
+ 'label' => $this->__('%s Support (%s)', ($moduleConfig->extension_name ? $moduleConfig->extension_name : $code) . ' v' . $moduleConfig->version, ($moduleConfig->free ? $this->__('paid') : $this->__('free'))),
83
+ 'value' => $code . ' ' . $moduleConfig->version,
84
+ );
85
+ }
86
+ $reasons[] = array(
87
+ 'label' => $this->__('Other Reason'),
88
+ 'value' => 'other',
89
+ );
90
+ return $reasons;
91
+ }
92
+
93
+ protected function _getFooterHtml($element)
94
+ {
95
+ $ajaxUrl = $this->getUrl('adminhtml/neklo_core_contact');
96
+ $html = parent::_getFooterHtml($element);
97
+ $html = '<h4>' . $this->__('Contact Neklo Support Team or visit <a href="%s" target="_blank">%s</a> for additional information', 'http://store.neklo.com/', 'store.neklo.com') . '</h4>' . $html;
98
+
99
+ $html .= Mage::helper('adminhtml/js')->getScript(
100
+ '
101
+ var NekloContact = {
102
+ toggleReason: function() {
103
+ if ($("reason").getValue() != "other"){
104
+ $("other_reason").up(1).hide();
105
+ $("other_reason").disable();
106
+ } else {
107
+ $("other_reason").enable();
108
+ $("other_reason").up(1).show();
109
+ }
110
+ },
111
+ submit: function() {
112
+ if (supportForm.validator.validate()){
113
+ new Ajax.Request(
114
+ "' . $ajaxUrl . '",
115
+ {
116
+ method: "post",
117
+ parameters: Form.serialize($("' . $element->getHtmlId() . '")),
118
+ onSuccess:function(transport){
119
+ if (transport && transport.responseText){
120
+ try {
121
+ response = eval("(" + transport.responseText + ")");
122
+ } catch (e) {
123
+ response = {};
124
+ }
125
+ }
126
+
127
+ if ((typeof response.message) == "string") {
128
+ $("ajax-response").update(response.message);
129
+ } else {
130
+ $("ajax-response").update(response.message.join("<br/>"));
131
+ }
132
+
133
+ if (response.error==0) {
134
+ $("subject").value = "";
135
+ $("other_reason").value = "";
136
+ $("message").value = "";
137
+ $("reason").selectedIndex = 0;
138
+ }
139
+
140
+ new PeriodicalExecuter(function(pe){ $("ajax-response").update(""); pe.stop(); }, 20);
141
+ }
142
+ }
143
+ );
144
+ }
145
+ }
146
+ };
147
+
148
+ NekloContact.toggleReason();
149
+ supportForm = new varienForm($(' . $element->getHtmlId() . '));
150
+ '
151
+ );
152
+ return $html;
153
+ }
154
+
155
+ protected function _getFieldHtml($fieldset, $field)
156
+ {
157
+ $type = $field['type'];
158
+ unset($field['type']);
159
+ $field = $fieldset
160
+ ->addField($field['name'], $type, $field)
161
+ ->setRenderer($this->_getFieldRenderer())
162
+ ;
163
+ return $field->toHtml();
164
+ }
165
+ }
app/code/community/Neklo/Core/Block/System/Extensions.php ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Neklo_Core_Block_System_Extensions extends Neklo_Core_Block_System_Abstract
4
+ {
5
+ public function render(Varien_Data_Form_Element_Abstract $element)
6
+ {
7
+ $html = $this->_getHeaderHtml($element);
8
+ $html .= '<tr><td colspan="2"><h4>' . $this->__('Installed Neklo Extensions') . '</h4></td></tr>';
9
+ $html .= $this->_getContentHtml($element);
10
+ $html .= $this->_getFooterHtml($element);
11
+ $html .= '<style>.installed-extensions td {padding: 4px;}</style>';
12
+ return $html;
13
+ }
14
+
15
+ protected function _getContentHtml($fieldset)
16
+ {
17
+ $html = '<tr class="installed-extensions">';
18
+ $modules = $this->_getModules();
19
+ $count = count($modules);
20
+
21
+ $columns = 0;
22
+ if ($count < 6) {
23
+ $columns = 5;
24
+ } elseif ($count % 5 == 0) {
25
+ $columns = 5;
26
+ } elseif ($count % 4 == 0) {
27
+ $columns = 4;
28
+ } elseif ($count % 3 == 0) {
29
+ $columns = 3;
30
+ } elseif (($count + 1) % 5 == 0) {
31
+ $columns = 5;
32
+ } elseif (($count + 1) % 4 == 0) {
33
+ $columns = 4;
34
+ } elseif (($count + 1) % 3 == 0) {
35
+ $columns = 3;
36
+ } else {
37
+ $columns = 4;
38
+ }
39
+
40
+ foreach ($modules as $index => $code) {
41
+ if (($index % $columns) == 0 && $index != 0) {
42
+ $html .= '</tr><tr class="installed-extensions">';
43
+ }
44
+ $html .= '<td align="center">';
45
+
46
+ $config = Mage::getConfig()->getNode('modules/' . $code);
47
+
48
+ $name = ($config->extension_name ? $config->extension_name : $code);
49
+
50
+ $imgUrl = Mage::app()->getRequest()->getParam('neklo_cache') . strtolower($code) . '.jpg';
51
+ $img = '<img src="' . $imgUrl . '" alt="' . $name . '">';
52
+
53
+ if ($config->url) {
54
+ $url = '<domain></domain>' . $config->url . '.html';
55
+ $url = str_replace('<domain>' . '</domain>', '/', $url);
56
+ $img = '<a href="' . $url . '" target="_blank">' . $img . '</a>';
57
+ }
58
+
59
+ $html .= $img . '<br>';
60
+ $html .= $name . '<br>v' . $config->version;
61
+ $html .= '</td>';
62
+ }
63
+ $html .= '</tr>';
64
+ return $html;
65
+ }
66
+ }
app/code/community/Neklo/Core/Block/System/Newsletter.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Neklo_Core_Block_System_Newsletter extends Mage_Adminhtml_Block_System_Config_Form_Fieldset
4
+ {
5
+ protected function _getHeaderTitleHtml($element)
6
+ {
7
+ return '<div class="entry-edit-head collapseable"><a id="' . $element->getHtmlId() . '-head" href="#" style="background:none;">' . $element->getLegend() . '</a></div>';
8
+ }
9
+ }
app/code/community/Neklo/Core/Block/System/Newsletter/Subscribe.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Neklo_Core_Block_System_Newsletter_Subscribe extends Mage_Adminhtml_Block_System_Config_Form_Field
4
+ {
5
+ public function render(Varien_Data_Form_Element_Abstract $element)
6
+ {
7
+ $element->setScope(false);
8
+ $element->setCanUseWebsiteValue(false);
9
+ $element->setCanUseDefaultValue(false);
10
+ return parent::render($element);
11
+ }
12
+
13
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
14
+ {
15
+ $subscribeButton = $this->getLayout()->createBlock('neklo_core/system_newsletter_subscribe_button', 'neklo_core_subscribe');
16
+ $subscribeButton->setTemplate('neklo/core/system/subscribe/button.phtml');
17
+ $subscribeButton->setContainerId($element->getContainer()->getHtmlId());
18
+ return $subscribeButton->toHtml();
19
+ }
20
+ }
app/code/community/Neklo/Core/Block/System/Newsletter/Subscribe/Button.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Neklo_Core_Block_System_Newsletter_Subscribe_Button extends Mage_Adminhtml_Block_Template
4
+ {
5
+ /**
6
+ * @return Mage_Adminhtml_Block_Widget_Button
7
+ */
8
+ public function getButton()
9
+ {
10
+ $button = $this->getLayout()->createBlock('adminhtml/widget_button');
11
+ $button
12
+ ->setType('button')
13
+ ->setLabel($this->__('Subscribe'))
14
+ ->setStyle("width:280px")
15
+ ->setId('neklo_core_subscribe')
16
+ ;
17
+ return $button;
18
+ }
19
+
20
+ /**
21
+ * @return string
22
+ */
23
+ public function getButtonHtml()
24
+ {
25
+ return $this->getButton()->toHtml();
26
+ }
27
+
28
+ /**
29
+ * @return string
30
+ */
31
+ public function getContainerId()
32
+ {
33
+ return parent::getContainerId();
34
+ }
35
+ }
app/code/community/Neklo/Core/Helper/Data.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Neklo_Core_Helper_Data extends Mage_Core_Helper_Abstract
4
+ {
5
+ public function __()
6
+ {
7
+ $args = func_get_args();
8
+ if ($args[0] == '[NEKLO]') {
9
+ return '<img src="' . $this->_getLogoUrl() . '" height="11" alt="Neklo" title="" />';
10
+ }
11
+ $expr = new Mage_Core_Model_Translate_Expr(array_shift($args), $this->_getModuleName());
12
+ array_unshift($args, $expr);
13
+ return Mage::app()->getTranslator()->translate($args);
14
+ }
15
+
16
+ protected function _getLogoUrl()
17
+ {
18
+ return $this->_getRequest()->getPost('neklo_cache') . 'neklo.png';
19
+ }
20
+ }
app/code/community/Neklo/Core/Model/Feed.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Neklo_Core_Model_Feed extends Mage_AdminNotification_Model_Feed
4
+ {
5
+ const XML_USE_HTTPS_PATH = 'neklo_core/admin_notification/use_https';
6
+ const XML_FEED_URL_PATH = 'neklo_core/admin_notification/feed_url';
7
+ const XML_FREQUENCY_PATH = 'neklo_core/admin_notification/frequency';
8
+
9
+ const LAST_CHECK_CACHE_KEY = 'neklo_core_admin_notifications_last_check';
10
+
11
+ public function getFrequency()
12
+ {
13
+ return Mage::getStoreConfig(self::XML_FREQUENCY_PATH) * 3600;
14
+ }
15
+
16
+ public function getLastUpdate()
17
+ {
18
+ return Mage::app()->loadCache(self::LAST_CHECK_CACHE_KEY);
19
+ }
20
+
21
+ public function setLastUpdate()
22
+ {
23
+ Mage::app()->saveCache(time(), self::LAST_CHECK_CACHE_KEY);
24
+ return $this;
25
+ }
26
+
27
+ public function getFeedUrl()
28
+ {
29
+ if (is_null($this->_feedUrl)) {
30
+ $this->_feedUrl = (Mage::getStoreConfigFlag(self::XML_USE_HTTPS_PATH) ? 'https://' : 'http://') . Mage::getStoreConfig(self::XML_FEED_URL_PATH);
31
+ }
32
+ return $this->_feedUrl;
33
+ }
34
+ }
app/code/community/Neklo/Core/Model/Observer.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Neklo_Core_Model_Observer
4
+ {
5
+ public function renderContact($observer)
6
+ {
7
+ Mage::getBlockSingleton('neklo_core/system_contact')->render(new Varien_Data_Form_Element_Fieldset);
8
+ }
9
+
10
+ public function checkUpdate(Varien_Event_Observer $observer)
11
+ {
12
+ if (Mage::getSingleton('admin/session')->isLoggedIn()) {
13
+ Mage::getModel('neklo_core/feed')->checkUpdate();
14
+ }
15
+ }
16
+ }
app/code/community/Neklo/Core/controllers/Adminhtml/Neklo/Core/ContactController.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Neklo_Core_Adminhtml_Neklo_Core_ContactController extends Mage_Adminhtml_Controller_Action
4
+ {
5
+ const CONTACT_URL = '<support_url></support_url>';
6
+
7
+ public function indexAction()
8
+ {
9
+ $result = array(
10
+ 'error' => 0,
11
+ );
12
+ try {
13
+ $data = $this->getRequest()->getPost();
14
+ $data['version'] = Mage::getVersion();
15
+ $data['url'] = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
16
+ $data['id'] = '<order_item_customer></order_item_customer>';
17
+ $this->_sendContactEmail($data);
18
+ } catch (Exception $e) {
19
+ $result['message'][] = $e->getMessage();
20
+ $result['error'] = 1;
21
+ $this->getResponse()->setBody(Zend_Json::encode($result));
22
+ return;
23
+ }
24
+ $result['message'][] = $this->__("Thank you for your request.");
25
+ $result['message'][] = $this->__("We'll respond as soon as possible.");
26
+ $result['message'][] = $this->__("We'll send copy of your request to your email.");
27
+ $this->getResponse()->setBody(Zend_Json::encode($result));
28
+ }
29
+
30
+ protected function _isAllowed()
31
+ {
32
+ return Mage::getSingleton('admin/session')->isAllowed('system/config/neklo_core');
33
+ }
34
+
35
+ protected function _sendContactEmail($data)
36
+ {
37
+ $params = Mage::helper('core')->urlEncode(Mage::helper('core')->jsonEncode($data));
38
+ if ($params) {
39
+ $httpClient = new Varien_Http_Client();
40
+ $httpClient
41
+ ->setMethod(Zend_Http_Client::POST)
42
+ ->setUri(self::CONTACT_URL)
43
+ ->setConfig(
44
+ array(
45
+ 'maxredirects' => 0,
46
+ 'timeout' => 30,
47
+ )
48
+ )
49
+ ->setRawData($params)
50
+ ->request()
51
+ ;
52
+ }
53
+ }
54
+ }
app/code/community/Neklo/Core/controllers/Adminhtml/Neklo/Core/NewsletterController.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Neklo_Core_Adminhtml_Neklo_Core_NewsletterController extends Mage_Adminhtml_Controller_Action
4
+ {
5
+ const SUBSCRIBE_URL = '<subscribe_url></subscribe_url>';
6
+
7
+ public function subscribeAction()
8
+ {
9
+ $result = array(
10
+ 'success' => true,
11
+ );
12
+ try {
13
+ $data = $this->getRequest()->getPost();
14
+ $this->_subscribe($data);
15
+ } catch (Exception $e) {
16
+ $result['success'] = false;
17
+ $this->getResponse()->setBody(Zend_Json::encode($result));
18
+ return;
19
+ }
20
+ $this->getResponse()->setBody(Zend_Json::encode($result));
21
+ }
22
+
23
+ protected function _subscribe($data)
24
+ {
25
+ $params = Mage::helper('core')->urlEncode(Mage::helper('core')->jsonEncode($data));
26
+ if ($params) {
27
+ $httpClient = new Varien_Http_Client();
28
+ $httpClient
29
+ ->setMethod(Zend_Http_Client::POST)
30
+ ->setUri(self::SUBSCRIBE_URL)
31
+ ->setConfig(
32
+ array(
33
+ 'maxredirects' => 0,
34
+ 'timeout' => 30,
35
+ )
36
+ )
37
+ ->setRawData($params)
38
+ ->request()
39
+ ;
40
+ }
41
+ }
42
+
43
+ protected function _isAllowed()
44
+ {
45
+ return Mage::getSingleton('admin/session')->isAllowed('system/config/neklo_core');
46
+ }
47
+ }
app/code/community/Neklo/Core/etc/adminhtml.xml ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <acl>
4
+ <resources>
5
+ <all>
6
+ <title>Allow Everything</title>
7
+ </all>
8
+ <admin>
9
+ <children>
10
+ <system>
11
+ <children>
12
+ <config>
13
+ <children>
14
+ <neklo_core translate="title" module="neklo_core">
15
+ <title>Neklo Extensions &amp; Contact</title>
16
+ <sort_order>9999</sort_order>
17
+ </neklo_core>
18
+ </children>
19
+ </config>
20
+ </children>
21
+ </system>
22
+ </children>
23
+ </admin>
24
+ </resources>
25
+ </acl>
26
+ </config>
app/code/community/Neklo/Core/etc/config.xml ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Neklo_Core>
5
+ <version>1.0.2</version>
6
+ </Neklo_Core>
7
+ </modules>
8
+ <admin>
9
+ <routers>
10
+ <adminhtml>
11
+ <args>
12
+ <modules>
13
+ <neklo before="Mage_Adminhtml">Neklo_Core_Adminhtml</neklo>
14
+ </modules>
15
+ </args>
16
+ </adminhtml>
17
+ </routers>
18
+ </admin>
19
+ <global>
20
+ <blocks>
21
+ <neklo_core>
22
+ <class>Neklo_Core_Block</class>
23
+ </neklo_core>
24
+ </blocks>
25
+ <helpers>
26
+ <neklo_core>
27
+ <class>Neklo_Core_Helper</class>
28
+ </neklo_core>
29
+ </helpers>
30
+ <models>
31
+ <neklo_core>
32
+ <class>Neklo_Core_Model</class>
33
+ </neklo_core>
34
+ </models>
35
+ </global>
36
+ <adminhtml>
37
+ <translate>
38
+ <modules>
39
+ <Neklo_Core>
40
+ <files>
41
+ <default>Neklo_Core.csv</default>
42
+ </files>
43
+ </Neklo_Core>
44
+ </modules>
45
+ </translate>
46
+ <events>
47
+ <controller_action_predispatch_adminhtml_system_config_edit>
48
+ <observers>
49
+ <neklo_core>
50
+ <class>neklo_core/observer</class>
51
+ <method>renderContact</method>
52
+ </neklo_core>
53
+ </observers>
54
+ </controller_action_predispatch_adminhtml_system_config_edit>
55
+ <controller_action_predispatch>
56
+ <observers>
57
+ <neklo_core_admin_notification>
58
+ <class>neklo_core/observer</class>
59
+ <method>checkUpdate</method>
60
+ </neklo_core_admin_notification>
61
+ </observers>
62
+ </controller_action_predispatch>
63
+ </events>
64
+ </adminhtml>
65
+ <default>
66
+ <neklo_core>
67
+ <admin_notification>
68
+ <feed_url>store.neklo.com/notifications.rss</feed_url>
69
+ <use_https>0</use_https>
70
+ <frequency>24</frequency>
71
+ <last_update>0</last_update>
72
+ </admin_notification>
73
+ </neklo_core>
74
+ </default>
75
+ </config>
app/code/community/Neklo/Core/etc/system.xml ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <tabs>
4
+ <neklo translate="label" module="neklo_core">
5
+ <label>[NEKLO]</label>
6
+ <sort_order>310</sort_order>
7
+ </neklo>
8
+ </tabs>
9
+ <sections>
10
+ <neklo_core translate="label" module="neklo_core">
11
+ <label>Extensions &amp; Contact</label>
12
+ <tab>neklo</tab>
13
+ <frontend_type>text</frontend_type>
14
+ <sort_order>9999</sort_order>
15
+ <show_in_default>1</show_in_default>
16
+ <show_in_website>1</show_in_website>
17
+ <show_in_store>1</show_in_store>
18
+ <groups>
19
+ <extensions translate="label">
20
+ <label>Extensions Information</label>
21
+ <frontend_type>text</frontend_type>
22
+ <frontend_model>neklo_core/system_extensions</frontend_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
+ </extensions>
28
+ <contact translate="label">
29
+ <label>Contact Form</label>
30
+ <frontend_type>text</frontend_type>
31
+ <frontend_model>neklo_core/system_contact</frontend_model>
32
+ <sort_order>2</sort_order>
33
+ <show_in_default>1</show_in_default>
34
+ <show_in_website>1</show_in_website>
35
+ <show_in_store>1</show_in_store>
36
+ </contact>
37
+ <newsletter translate="label">
38
+ <label>Subscribe to Newsletter</label>
39
+ <frontend_type>text</frontend_type>
40
+ <frontend_model>neklo_core/system_newsletter</frontend_model>
41
+ <sort_order>10</sort_order>
42
+ <show_in_default>1</show_in_default>
43
+ <show_in_website>0</show_in_website>
44
+ <show_in_store>0</show_in_store>
45
+ <expanded>1</expanded>
46
+ <fields>
47
+ <name translate="label">
48
+ <label>Name</label>
49
+ <frontend_type>text</frontend_type>
50
+ <sort_order>10</sort_order>
51
+ <show_in_default>1</show_in_default>
52
+ <show_in_website>0</show_in_website>
53
+ <show_in_store>0</show_in_store>
54
+ <validate>required-entry</validate>
55
+ </name>
56
+ <email translate="label">
57
+ <label>Email</label>
58
+ <frontend_type>text</frontend_type>
59
+ <sort_order>20</sort_order>
60
+ <show_in_default>1</show_in_default>
61
+ <show_in_website>0</show_in_website>
62
+ <show_in_store>0</show_in_store>
63
+ <validate>required-entry validate-email</validate>
64
+ </email>
65
+ <subscribe_button>
66
+ <frontend_model>neklo_core/system_newsletter_subscribe</frontend_model>
67
+ <sort_order>30</sort_order>
68
+ <show_in_default>1</show_in_default>
69
+ <show_in_website>0</show_in_website>
70
+ <show_in_store>0</show_in_store>
71
+ </subscribe_button>
72
+ </fields>
73
+ </newsletter>
74
+ </groups>
75
+ </neklo_core>
76
+ </sections>
77
+ </config>
app/code/community/Neklo/ScrollToTop/Block/Adminhtml/System/Color.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Neklo_ScrollToTop_Block_Adminhtml_System_Color extends Mage_Adminhtml_Block_System_Config_Form_Field
4
+ {
5
+ public function render(Varien_Data_Form_Element_Abstract $element)
6
+ {
7
+ $element->setScope(false);
8
+ $element->setCanUseWebsiteValue(false);
9
+ $element->setCanUseDefaultValue(false);
10
+ return parent::render($element);
11
+ }
12
+
13
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
14
+ {
15
+ $colorList = $this->getLayout()->createBlock('neklo_scrolltotop_adminhtml/system_color_list', 'neklo_scrolltotop_color_list');
16
+ $colorList->setTemplate('neklo/scrolltotop/system/color/list.phtml');
17
+ $colorList->setContainerId($element->getContainer()->getHtmlId());
18
+ return $colorList->toHtml();
19
+ }
20
+
21
+ protected function _prepareLayout()
22
+ {
23
+ /* @var $head Mage_Page_Block_Html_Head */
24
+ $head = $this->getLayout()->getBlock('head');
25
+ if ($head) {
26
+ $head->addItem('skin_css', 'neklo/scrolltotop/css/styles.css');
27
+ $head->addItem('skin_js', 'neklo/scrolltotop/js/script.js');
28
+ }
29
+ return parent::_prepareLayout();
30
+ }
31
+ }
app/code/community/Neklo/ScrollToTop/Block/Adminhtml/System/Color/List.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Neklo_ScrollToTop_Block_Adminhtml_System_Color_List extends Mage_Adminhtml_Block_Template
4
+ {
5
+ public function getColorList()
6
+ {
7
+ return Mage::getModel('neklo_scrolltotop/source_color')->getColorList();
8
+ }
9
+
10
+ public function getColorInputId()
11
+ {
12
+ return $this->getContainerId() . '_color';
13
+ }
14
+
15
+ /**
16
+ * @param null|int|Mage_Core_Model_Store $store
17
+ *
18
+ * @return string
19
+ */
20
+ public function getColor($store = null)
21
+ {
22
+ return $this->getConfig()->getColor($store);;
23
+ }
24
+
25
+ /**
26
+ * @return string
27
+ */
28
+ public function getContainerId()
29
+ {
30
+ return parent::getContainerId();
31
+ }
32
+
33
+ /**
34
+ * @return Neklo_ScrollToTop_Helper_Config
35
+ */
36
+ public function getConfig()
37
+ {
38
+ return Mage::helper('neklo_scrolltotop/config');
39
+ }
40
+ }
app/code/community/Neklo/ScrollToTop/Block/Arrow.php ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Neklo_ScrollToTop_Block_Arrow extends Mage_Core_Block_Template
4
+ {
5
+ /**
6
+ * @return bool
7
+ */
8
+ public function canShow()
9
+ {
10
+ if (!$this->getConfig()->isEnabled()) {
11
+ return false;
12
+ }
13
+ if ($this->getConfig()->canDisplayOnAll()) {
14
+ return true;
15
+ }
16
+ if ($this->getPageHelper()->isHomePage()) {
17
+ return $this->getConfig()->canDisplayOnHome();
18
+ }
19
+ if ($this->getPageHelper()->isCmsPage()) {
20
+ return $this->getConfig()->canDisplayOnCms();
21
+ }
22
+ if ($this->getPageHelper()->isCategoryPage()) {
23
+ return $this->getConfig()->canDisplayOnCategory();
24
+ }
25
+ if ($this->getPageHelper()->isProductPage()) {
26
+ return $this->getConfig()->canDisplayOnProduct();
27
+ }
28
+ if ($this->getPageHelper()->isCheckoutPage()) {
29
+ return $this->getConfig()->canDisplayOnCheckout();
30
+ }
31
+ if ($this->getPageHelper()->isCartPage()) {
32
+ return $this->getConfig()->canDisplayOnCart();
33
+ }
34
+ if ($this->getPageHelper()->isAccountPage()) {
35
+ return $this->getConfig()->canDisplayOnAccount();
36
+ }
37
+ return $this->getConfig()->canDisplayOnOther();
38
+ }
39
+
40
+ /**
41
+ * @param null|int|Mage_Core_Model_Store $store
42
+ *
43
+ * @return string
44
+ */
45
+ public function getColor($store = null)
46
+ {
47
+ return $this->getConfig()->getColor($store);
48
+ }
49
+
50
+ /**
51
+ * @param null|int|Mage_Core_Model_Store $store
52
+ *
53
+ * @return string
54
+ */
55
+ public function getPosition($store = null)
56
+ {
57
+ return $this->getConfig()->getPosition($store);
58
+ }
59
+
60
+ /**
61
+ * @return Neklo_ScrollToTop_Helper_Config
62
+ */
63
+ public function getConfig()
64
+ {
65
+ return Mage::helper('neklo_scrolltotop/config');
66
+ }
67
+
68
+ /**
69
+ * @return Neklo_ScrollToTop_Helper_Page
70
+ */
71
+ public function getPageHelper()
72
+ {
73
+ return Mage::helper('neklo_scrolltotop/page');
74
+ }
75
+ }
app/code/community/Neklo/ScrollToTop/Helper/Config.php ADDED
@@ -0,0 +1,142 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Neklo_ScrollToTop_Helper_Config extends Mage_Core_Helper_Data
4
+ {
5
+ const GENERAL_IS_ENABLED = 'neklo_scrolltotop/general/is_enabled';
6
+
7
+ const FRONTEND_COLOR = 'neklo_scrolltotop/frontend/color';
8
+ const FRONTEND_POSITION = 'neklo_scrolltotop/frontend/position';
9
+
10
+ const DISPLAY_ON_ALL = 'neklo_scrolltotop/display_on/all';
11
+ const DISPLAY_ON_HOME = 'neklo_scrolltotop/display_on/home';
12
+ const DISPLAY_ON_CMS = 'neklo_scrolltotop/display_on/cms';
13
+ const DISPLAY_ON_CATEGORY = 'neklo_scrolltotop/display_on/category';
14
+ const DISPLAY_ON_PRODUCT = 'neklo_scrolltotop/display_on/product';
15
+ const DISPLAY_ON_CHECKOUT = 'neklo_scrolltotop/display_on/checkout';
16
+ const DISPLAY_ON_CART = 'neklo_scrolltotop/display_on/cart';
17
+ const DISPLAY_ON_ACCOUNT = 'neklo_scrolltotop/display_on/account';
18
+ const DISPLAY_ON_OTHER = 'neklo_scrolltotop/display_on/other';
19
+
20
+ /**
21
+ * @param null|int|Mage_Core_Model_Store $store
22
+ *
23
+ * @return bool
24
+ */
25
+ public function isEnabled($store = null)
26
+ {
27
+ $isConfigEnabled = Mage::getStoreConfigFlag(self::GENERAL_IS_ENABLED, $store);
28
+ $isModuleEnabled = $this->isModuleEnabled();
29
+ $isModuleOutputEnabled = $this->isModuleOutputEnabled();
30
+ return $isConfigEnabled && $isModuleEnabled && $isModuleOutputEnabled;
31
+ }
32
+
33
+ /**
34
+ * @param null|int|Mage_Core_Model_Store $store
35
+ *
36
+ * @return bool
37
+ */
38
+ public function getColor($store = null)
39
+ {
40
+ return Mage::getStoreConfig(self::FRONTEND_COLOR, $store);
41
+ }
42
+
43
+ /**
44
+ * @param null|int|Mage_Core_Model_Store $store
45
+ *
46
+ * @return bool
47
+ */
48
+ public function getPosition($store = null)
49
+ {
50
+ return Mage::getStoreConfig(self::FRONTEND_POSITION, $store);
51
+ }
52
+
53
+ /**
54
+ * @param null|int|Mage_Core_Model_Store $store
55
+ *
56
+ * @return string
57
+ */
58
+ public function canDisplayOnAll($store = null)
59
+ {
60
+ return Mage::getStoreConfigFlag(self::DISPLAY_ON_ALL, $store);
61
+ }
62
+
63
+ /**
64
+ * @param null|int|Mage_Core_Model_Store $store
65
+ *
66
+ * @return bool
67
+ */
68
+ public function canDisplayOnHome($store = null)
69
+ {
70
+ return Mage::getStoreConfigFlag(self::DISPLAY_ON_HOME, $store);
71
+ }
72
+
73
+ /**
74
+ * @param null|int|Mage_Core_Model_Store $store
75
+ *
76
+ * @return bool
77
+ */
78
+ public function canDisplayOnCms($store = null)
79
+ {
80
+ return Mage::getStoreConfigFlag(self::DISPLAY_ON_CMS, $store);
81
+ }
82
+
83
+ /**
84
+ * @param null|int|Mage_Core_Model_Store $store
85
+ *
86
+ * @return bool
87
+ */
88
+ public function canDisplayOnCategory($store = null)
89
+ {
90
+ return Mage::getStoreConfigFlag(self::DISPLAY_ON_CATEGORY, $store);
91
+ }
92
+
93
+ /**
94
+ * @param null|int|Mage_Core_Model_Store $store
95
+ *
96
+ * @return bool
97
+ */
98
+ public function canDisplayOnProduct($store = null)
99
+ {
100
+ return Mage::getStoreConfigFlag(self::DISPLAY_ON_PRODUCT, $store);
101
+ }
102
+
103
+ /**
104
+ * @param null|int|Mage_Core_Model_Store $store
105
+ *
106
+ * @return bool
107
+ */
108
+ public function canDisplayOnCheckout($store = null)
109
+ {
110
+ return Mage::getStoreConfigFlag(self::DISPLAY_ON_CHECKOUT, $store);
111
+ }
112
+
113
+ /**
114
+ * @param null|int|Mage_Core_Model_Store $store
115
+ *
116
+ * @return bool
117
+ */
118
+ public function canDisplayOnCart($store = null)
119
+ {
120
+ return Mage::getStoreConfigFlag(self::DISPLAY_ON_CART, $store);
121
+ }
122
+
123
+ /**
124
+ * @param null|int|Mage_Core_Model_Store $store
125
+ *
126
+ * @return bool
127
+ */
128
+ public function canDisplayOnAccount($store = null)
129
+ {
130
+ return Mage::getStoreConfigFlag(self::DISPLAY_ON_ACCOUNT, $store);
131
+ }
132
+
133
+ /**
134
+ * @param null|int|Mage_Core_Model_Store $store
135
+ *
136
+ * @return bool
137
+ */
138
+ public function canDisplayOnOther($store = null)
139
+ {
140
+ return Mage::getStoreConfigFlag(self::DISPLAY_ON_OTHER, $store);
141
+ }
142
+ }
app/code/community/Neklo/ScrollToTop/Helper/Data.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Neklo_ScrollToTop_Helper_Data extends Mage_Core_Helper_Data
4
+ {
5
+ /**
6
+ * @param null|int|Mage_Core_Model_Store $store
7
+ *
8
+ * @return bool
9
+ */
10
+ public function isEnabled($store = null)
11
+ {
12
+ return $this->getConfig()->isEnabled($store);
13
+ }
14
+
15
+ /**
16
+ * @return Neklo_ScrollToTop_Helper_Config
17
+ */
18
+ public function getConfig()
19
+ {
20
+ return Mage::helper('neklo_scrolltotop/config');
21
+ }
22
+ }
app/code/community/Neklo/ScrollToTop/Helper/Page.php ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Neklo_ScrollToTop_Helper_Page extends Mage_Core_Helper_Data
4
+ {
5
+ public function isHomePage()
6
+ {
7
+ $currentUrl = Mage::getUrl('*/*/*', array('_current' => true, '_use_rewrite' => true));
8
+ $homePageUrl = Mage::getUrl('');
9
+ return $currentUrl === $homePageUrl;
10
+ }
11
+
12
+ public function isProductPage()
13
+ {
14
+ $allowedActionNameList = array(
15
+ 'catalog_product_view',
16
+ );
17
+ $product = Mage::registry('current_product');
18
+ return in_array(Mage::app()->getFrontController()->getAction()->getFullActionName(), $allowedActionNameList) && $product && $product->getId();
19
+ }
20
+
21
+ public function isCmsPage()
22
+ {
23
+ $page = Mage::getSingleton('cms/page');
24
+ return $page->getId();
25
+ }
26
+
27
+ public function isCategoryPage()
28
+ {
29
+ $allowedActionNameList = array(
30
+ 'catalog_category_default',
31
+ 'catalog_category_layered',
32
+ );
33
+ $category = Mage::registry('current_category');
34
+ return in_array(Mage::app()->getFrontController()->getAction()->getFullActionName(), $allowedActionNameList) && $category && $category->getId();
35
+ }
36
+
37
+ public function isCheckoutPage()
38
+ {
39
+ $allowedActionNameList = array(
40
+ 'checkout_onepage_index',
41
+ 'checkout_multishipping_login',
42
+ 'checkout_multishipping_index',
43
+ );
44
+ return in_array(Mage::app()->getFrontController()->getAction()->getFullActionName(), $allowedActionNameList);
45
+ }
46
+
47
+ public function isCartPage()
48
+ {
49
+ $allowedActionNameList = array(
50
+ 'checkout_cart_index',
51
+ );
52
+ return in_array(Mage::app()->getFrontController()->getAction()->getFullActionName(), $allowedActionNameList);
53
+ }
54
+
55
+ public function isAccountPage()
56
+ {
57
+ $customerAccountHandle = 'customer_account';
58
+ if (in_array($customerAccountHandle, Mage::app()->getLayout()->getUpdate()->getHandles())) {
59
+ return true;
60
+ }
61
+ $allowedActionNameList = array(
62
+ 'customer_account_logoutSuccess',
63
+ 'customer_account_login',
64
+ 'customer_account_create',
65
+ );
66
+ return in_array(Mage::app()->getFrontController()->getAction()->getFullActionName(), $allowedActionNameList);
67
+ }
68
+
69
+ public function isOtherPage()
70
+ {
71
+ return !$this->isHomePage() && !$this->isProductPage() && $this->isCmsPage() && !$this->isCategoryPage() && !$this->isCheckoutPage() && !$this->isCartPage() && !$this->isAccountPage();
72
+ }
73
+ }
app/code/community/Neklo/ScrollToTop/Model/Source/Color.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Neklo_ScrollToTop_Model_Source_Color
4
+ {
5
+ protected $_arrayList = array(
6
+ '1bbc9d',
7
+ '2fcc71',
8
+ '3598dc',
9
+ '9c59b8',
10
+ 'f49c14',
11
+ 'e84c3d',
12
+ 'bec3c7',
13
+ '808b8d',
14
+ '16a086',
15
+ '27ae61',
16
+ '2a80b9',
17
+ '8f44ad',
18
+ 'fe6b0b',
19
+ 'c1392b',
20
+ '96a6a6',
21
+ '262626',
22
+ );
23
+
24
+ public function getColorList()
25
+ {
26
+ return $this->_arrayList;
27
+ }
28
+ }
app/code/community/Neklo/ScrollToTop/Model/Source/Position.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Neklo_ScrollToTop_Model_Source_Position
4
+ {
5
+ const LEFT_CODE = 'left';
6
+ const LEFT_LABEL = 'Left';
7
+
8
+ const RIGHT_CODE = 'right';
9
+ const RIGHT_LABEL = 'Right';
10
+
11
+ public function toOptionArray()
12
+ {
13
+ $helper = Mage::helper('neklo_scrolltotop');
14
+ return array(
15
+ array(
16
+ 'value' => self::LEFT_CODE,
17
+ 'label' => $helper->__(self::LEFT_LABEL),
18
+ ),
19
+ array(
20
+ 'value' => self::RIGHT_CODE,
21
+ 'label' => $helper->__(self::RIGHT_LABEL),
22
+ ),
23
+ );
24
+ }
25
+
26
+ public function toArray()
27
+ {
28
+ $helper = Mage::helper('neklo_scrolltotop');
29
+ return array(
30
+ self::LEFT_CODE => $helper->__(self::LEFT_LABEL),
31
+ self::RIGHT_CODE => $helper->__(self::RIGHT_LABEL),
32
+ );
33
+ }
34
+ }
app/code/community/Neklo/ScrollToTop/etc/adminhtml.xml ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <acl>
4
+ <resources>
5
+ <all>
6
+ <title>Allow Everything</title>
7
+ </all>
8
+ <admin>
9
+ <children>
10
+ <system>
11
+ <children>
12
+ <config>
13
+ <children>
14
+ <neklo_scrolltotop translate="title" module="neklo_scrolltotop">
15
+ <title>Neklo LLC - Scroll To Top</title>
16
+ <sort_order>150</sort_order>
17
+ </neklo_scrolltotop>
18
+ </children>
19
+ </config>
20
+ </children>
21
+ </system>
22
+ </children>
23
+ </admin>
24
+ </resources>
25
+ </acl>
26
+ </config>
app/code/community/Neklo/ScrollToTop/etc/config.xml ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <modules>
4
+ <Neklo_ScrollToTop>
5
+ <version>1.0.0</version>
6
+ </Neklo_ScrollToTop>
7
+ </modules>
8
+ <global>
9
+ <blocks>
10
+ <neklo_scrolltotop>
11
+ <class>Neklo_ScrollToTop_Block</class>
12
+ </neklo_scrolltotop>
13
+ <neklo_scrolltotop_adminhtml>
14
+ <class>Neklo_ScrollToTop_Block_Adminhtml</class>
15
+ </neklo_scrolltotop_adminhtml>
16
+ </blocks>
17
+ <helpers>
18
+ <neklo_scrolltotop>
19
+ <class>Neklo_ScrollToTop_Helper</class>
20
+ </neklo_scrolltotop>
21
+ </helpers>
22
+ <models>
23
+ <neklo_scrolltotop>
24
+ <class>Neklo_ScrollToTop_Model</class>
25
+ </neklo_scrolltotop>
26
+ </models>
27
+ </global>
28
+ <frontend>
29
+ <layout>
30
+ <updates>
31
+ <neklo_scrolltotop>
32
+ <file>neklo/scrolltotop.xml</file>
33
+ </neklo_scrolltotop>
34
+ </updates>
35
+ </layout>
36
+ <translate>
37
+ <modules>
38
+ <Neklo_ScrollToTop>
39
+ <files>
40
+ <default>Neklo_ScrollToTop.csv</default>
41
+ </files>
42
+ </Neklo_ScrollToTop>
43
+ </modules>
44
+ </translate>
45
+ </frontend>
46
+ <adminhtml>
47
+ <translate>
48
+ <modules>
49
+ <Neklo_ScrollToTop>
50
+ <files>
51
+ <default>Neklo_ScrollToTop.csv</default>
52
+ </files>
53
+ </Neklo_ScrollToTop>
54
+ </modules>
55
+ </translate>
56
+ </adminhtml>
57
+ <default>
58
+ <neklo_scrolltotop>
59
+ <general>
60
+ <is_enabled>1</is_enabled>
61
+ </general>
62
+ <frontend>
63
+ <color>#f49c14</color>
64
+ <position>right</position>
65
+ </frontend>
66
+ <display_on>
67
+ <all>1</all>
68
+ </display_on>
69
+ </neklo_scrolltotop>
70
+ </default>
71
+ </config>
app/code/community/Neklo/ScrollToTop/etc/system.xml ADDED
@@ -0,0 +1,187 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <sections>
4
+ <neklo_scrolltotop translate="label" module="neklo_scrolltotop">
5
+ <label>Scroll To Top</label>
6
+ <tab>neklo</tab>
7
+ <frontend_type>text</frontend_type>
8
+ <sort_order>150</sort_order>
9
+ <show_in_default>1</show_in_default>
10
+ <show_in_website>1</show_in_website>
11
+ <show_in_store>1</show_in_store>
12
+ <groups>
13
+ <general translate="label">
14
+ <label>General Settings</label>
15
+ <frontend_type>text</frontend_type>
16
+ <sort_order>10</sort_order>
17
+ <show_in_default>1</show_in_default>
18
+ <show_in_website>1</show_in_website>
19
+ <show_in_store>1</show_in_store>
20
+ <fields>
21
+ <is_enabled translate="label">
22
+ <label>Is Enabled</label>
23
+ <frontend_type>select</frontend_type>
24
+ <source_model>adminhtml/system_config_source_yesno</source_model>
25
+ <sort_order>10</sort_order>
26
+ <show_in_default>1</show_in_default>
27
+ <show_in_website>1</show_in_website>
28
+ <show_in_store>1</show_in_store>
29
+ </is_enabled>
30
+ </fields>
31
+ </general>
32
+ <frontend translate="label">
33
+ <label>Frontend Settings</label>
34
+ <frontend_type>text</frontend_type>
35
+ <sort_order>20</sort_order>
36
+ <show_in_default>1</show_in_default>
37
+ <show_in_website>1</show_in_website>
38
+ <show_in_store>1</show_in_store>
39
+ <fields>
40
+ <color_list translate="label">
41
+ <label></label>
42
+ <frontend_type>text</frontend_type>
43
+ <frontend_model>neklo_scrolltotop_adminhtml/system_color</frontend_model>
44
+ <sort_order>10</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
+ </color_list>
49
+ <color translate="label">
50
+ <label>Color</label>
51
+ <frontend_type>text</frontend_type>
52
+ <sort_order>20</sort_order>
53
+ <show_in_default>1</show_in_default>
54
+ <show_in_website>0</show_in_website>
55
+ <show_in_store>0</show_in_store>
56
+ <validate>required-entry validate-hex</validate>
57
+ </color>
58
+ <position translate="label">
59
+ <label>Position</label>
60
+ <frontend_type>select</frontend_type>
61
+ <source_model>neklo_scrolltotop/source_position</source_model>
62
+ <sort_order>30</sort_order>
63
+ <show_in_default>1</show_in_default>
64
+ <show_in_website>1</show_in_website>
65
+ <show_in_store>1</show_in_store>
66
+ </position>
67
+ </fields>
68
+ </frontend>
69
+ <display_on>
70
+ <label>Display On</label>
71
+ <frontend_type>text</frontend_type>
72
+ <sort_order>30</sort_order>
73
+ <show_in_default>1</show_in_default>
74
+ <show_in_website>1</show_in_website>
75
+ <show_in_store>1</show_in_store>
76
+ <fields>
77
+ <all translate="label">
78
+ <label>All Pages</label>
79
+ <frontend_type>select</frontend_type>
80
+ <source_model>adminhtml/system_config_source_yesno</source_model>
81
+ <sort_order>10</sort_order>
82
+ <show_in_default>1</show_in_default>
83
+ <show_in_website>1</show_in_website>
84
+ <show_in_store>1</show_in_store>
85
+ </all>
86
+ <home translate="label">
87
+ <label>Home Page</label>
88
+ <frontend_type>select</frontend_type>
89
+ <source_model>adminhtml/system_config_source_yesno</source_model>
90
+ <sort_order>20</sort_order>
91
+ <show_in_default>1</show_in_default>
92
+ <show_in_website>1</show_in_website>
93
+ <show_in_store>1</show_in_store>
94
+ <depends>
95
+ <all>0</all>
96
+ </depends>
97
+ </home>
98
+ <cms translate="label">
99
+ <label>CMS Page</label>
100
+ <frontend_type>select</frontend_type>
101
+ <source_model>adminhtml/system_config_source_yesno</source_model>
102
+ <sort_order>30</sort_order>
103
+ <show_in_default>1</show_in_default>
104
+ <show_in_website>1</show_in_website>
105
+ <show_in_store>1</show_in_store>
106
+ <depends>
107
+ <all>0</all>
108
+ </depends>
109
+ </cms>
110
+ <category translate="label">
111
+ <label>Category Page</label>
112
+ <frontend_type>select</frontend_type>
113
+ <source_model>adminhtml/system_config_source_yesno</source_model>
114
+ <sort_order>40</sort_order>
115
+ <show_in_default>1</show_in_default>
116
+ <show_in_website>1</show_in_website>
117
+ <show_in_store>1</show_in_store>
118
+ <depends>
119
+ <all>0</all>
120
+ </depends>
121
+ </category>
122
+ <product translate="label">
123
+ <label>Product Page</label>
124
+ <frontend_type>select</frontend_type>
125
+ <source_model>adminhtml/system_config_source_yesno</source_model>
126
+ <sort_order>50</sort_order>
127
+ <show_in_default>1</show_in_default>
128
+ <show_in_website>1</show_in_website>
129
+ <show_in_store>1</show_in_store>
130
+ <depends>
131
+ <all>0</all>
132
+ </depends>
133
+ </product>
134
+ <checkout translate="label">
135
+ <label>Checkout Page</label>
136
+ <frontend_type>select</frontend_type>
137
+ <source_model>adminhtml/system_config_source_yesno</source_model>
138
+ <sort_order>60</sort_order>
139
+ <show_in_default>1</show_in_default>
140
+ <show_in_website>1</show_in_website>
141
+ <show_in_store>1</show_in_store>
142
+ <depends>
143
+ <all>0</all>
144
+ </depends>
145
+ </checkout>
146
+ <cart translate="label">
147
+ <label>Cart Page</label>
148
+ <frontend_type>select</frontend_type>
149
+ <source_model>adminhtml/system_config_source_yesno</source_model>
150
+ <sort_order>70</sort_order>
151
+ <show_in_default>1</show_in_default>
152
+ <show_in_website>1</show_in_website>
153
+ <show_in_store>1</show_in_store>
154
+ <depends>
155
+ <all>0</all>
156
+ </depends>
157
+ </cart>
158
+ <account translate="label">
159
+ <label>Customer Account Page</label>
160
+ <frontend_type>select</frontend_type>
161
+ <source_model>adminhtml/system_config_source_yesno</source_model>
162
+ <sort_order>80</sort_order>
163
+ <show_in_default>1</show_in_default>
164
+ <show_in_website>1</show_in_website>
165
+ <show_in_store>1</show_in_store>
166
+ <depends>
167
+ <all>0</all>
168
+ </depends>
169
+ </account>
170
+ <other translate="label">
171
+ <label>Other</label>
172
+ <frontend_type>select</frontend_type>
173
+ <source_model>adminhtml/system_config_source_yesno</source_model>
174
+ <sort_order>90</sort_order>
175
+ <show_in_default>1</show_in_default>
176
+ <show_in_website>1</show_in_website>
177
+ <show_in_store>1</show_in_store>
178
+ <depends>
179
+ <all>0</all>
180
+ </depends>
181
+ </other>
182
+ </fields>
183
+ </display_on>
184
+ </groups>
185
+ </neklo_scrolltotop>
186
+ </sections>
187
+ </config>
app/design/adminhtml/default/default/template/neklo/core/system/subscribe/button.phtml ADDED
@@ -0,0 +1,161 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php /* @var $this Neklo_Core_Block_System_Newsletter_Subscribe_Button */ ?>
2
+ <?php echo $this->getButtonHtml(); ?>
3
+ <div class="neklo_core_message"></div>
4
+ <script>
5
+ var NekloCoreSubscribe = Class.create({
6
+ initialize: function (config) {
7
+ this.initConfig(config);
8
+ this.initElements();
9
+ this.initObservers();
10
+ },
11
+
12
+ initConfig: function (config) {
13
+ this.config = config;
14
+ this.subscribeUrl = this.config.subscribeUrl || '';
15
+
16
+ this.successMessage = this.config.successMessage || '';
17
+ this.errorMessage = this.config.errorMessage || '';
18
+
19
+ this.successMessageClass = this.config.successMessageClass || '';
20
+ this.errorMessageClass = this.config.errorMessageClass || '';
21
+
22
+
23
+ this.formContainerId = this.config.formContainerId || '';
24
+ this.formElementSelectorList = this.config.formElementSelectorList || [];
25
+ },
26
+
27
+ initElements: function () {
28
+ this.subscribeButton = $(this.config.subscribeButtonId) || null;
29
+ this.loadingMask = $(this.config.loadingMaskId) || null;
30
+ this.messageContainer = $$(this.config.messageContainerSelector).first() || null;
31
+ },
32
+
33
+ initObservers: function () {
34
+ if (this.subscribeButton) {
35
+ this.subscribeButton.observe('click', this.subscribe.bind(this));
36
+ }
37
+ },
38
+
39
+ subscribe: function () {
40
+ if (!this.validate()) {
41
+ return;
42
+ }
43
+
44
+ var me = this;
45
+ var subscribeData = {};
46
+ this.formElementSelectorList.each(function (elementSelector) {
47
+ subscribeData[elementSelector] = $(me.formContainerId + '_' + elementSelector).getValue();
48
+ });
49
+
50
+ new Ajax.Request(
51
+ this.subscribeUrl,
52
+ {
53
+ method: 'post',
54
+ parameters: subscribeData,
55
+ onCreate: this._onSubscribeCreate.bind(this),
56
+ onComplete: this._onSubscribeComplete.bind(this),
57
+ onSuccess: this._onSubscribeSuccess.bind(this),
58
+ onFailure: this._onSubscribeFailure.bind(this)
59
+ }
60
+ );
61
+ },
62
+
63
+ validate: function () {
64
+ var me = this;
65
+ var result = true;
66
+ this.formElementSelectorList.each(function (elementSelector) {
67
+ result = Validation.validate($(me.formContainerId + '_' + elementSelector));
68
+ });
69
+ return result;
70
+ },
71
+
72
+ showLoadingMask: function () {
73
+ if (this.loadingMask) {
74
+ this.loadingMask.show();
75
+ }
76
+ },
77
+
78
+ hideLoadingMask: function () {
79
+ if (this.loadingMask) {
80
+ this.loadingMask.hide();
81
+ }
82
+ },
83
+
84
+ _onSubscribeCreate: function () {
85
+ this.clearMessageContainer();
86
+ this.showLoadingMask();
87
+ },
88
+
89
+ _onSubscribeComplete: function () {
90
+ this.hideLoadingMask();
91
+ },
92
+
93
+ _onSubscribeSuccess: function (response) {
94
+ try {
95
+ var result = response.responseText.evalJSON();
96
+ if (typeof(result.success) != 'undefined') {
97
+ if (result.success) {
98
+ this.showSuccess();
99
+ } else {
100
+ this.showError();
101
+ }
102
+ }
103
+ } catch (e) {
104
+ this.showError();
105
+ }
106
+ },
107
+
108
+ _onSubscribeFailure: function () {
109
+ this.showError();
110
+ },
111
+
112
+ showSuccess: function () {
113
+ this.showMessage(this.successMessage, this.successMessageClass);
114
+ },
115
+
116
+ showError: function () {
117
+ this.showMessage(this.errorMessage, this.errorMessageClass);
118
+ },
119
+
120
+ showMessage: function (message, className) {
121
+ this.clearMessageContainer();
122
+ var messageElement = new Element('p', {'class': className}).update(message);
123
+ this.messageContainer.appendChild(messageElement);
124
+ },
125
+
126
+ clearMessageContainer: function () {
127
+ this.messageContainer.update('');
128
+ }
129
+ });
130
+
131
+ var subscribeForm = new NekloCoreSubscribe({
132
+ 'subscribeUrl': '<?php echo $this->getUrl('adminhtml/neklo_core_newsletter/subscribe'); ?>',
133
+
134
+ 'successMessage': '<?php echo $this->__('Successfully subscribed'); ?>',
135
+ 'errorMessage': '<?php echo $this->__('Subscribe error'); ?>',
136
+
137
+ 'successMessageClass': 'success',
138
+ 'errorMessageClass': 'error',
139
+
140
+ 'formContainerId' : '<?php echo $this->getContainerId(); ?>',
141
+ 'formElementSelectorList': ['name', 'email'],
142
+
143
+ 'subscribeButtonId': 'neklo_core_subscribe',
144
+ 'loadingMaskId': 'loading-mask',
145
+ 'messageContainerSelector': '.neklo_core_message'
146
+ });
147
+ </script>
148
+ <style>
149
+ .neklo_core_message {
150
+ text-align: center;
151
+ padding: 5px 0;
152
+ font-weight: bold;
153
+ width: 280px;
154
+ }
155
+ .neklo_core_message .error {
156
+ color: #D40707;
157
+ }
158
+ .neklo_core_message .success {
159
+ color: #3d6611;
160
+ }
161
+ </style>
app/design/adminhtml/default/default/template/neklo/scrolltotop/system/color/list.phtml ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php /* @var $this Neklo_ScrollToTop_Block_Adminhtml_System_Color_List */ ?>
2
+
3
+ <div id="neklo_scrolltotop">
4
+ <?php foreach ($this->getColorList() as $color): ?>
5
+ <div class="neklo_scrolltotop color" data-color="<?php echo $color; ?>" style="background-color: #<?php echo $color; ?>;"></div>
6
+ <?php endforeach; ?>
7
+ </div>
8
+
9
+ <div id="neklo_scrolltotop_arrow" class="arrow" style="color: <?php echo $this->getColor(); ?>;display:none;"></div>
10
+
11
+ <script type="text/javascript">
12
+ Event.observe(
13
+ document, 'dom:loaded', function() {
14
+ new NekloScrollToTop(
15
+ {
16
+ 'colorInputId' : '<?php echo $this->getColorInputId(); ?>',
17
+ 'colorListSelector' : '.neklo_scrolltotop.color',
18
+ 'previewContainerId' : 'neklo_scrolltotop_arrow',
19
+ 'hintContainerSelector' : '#row_neklo_scrolltotop_frontend_color_list td',
20
+ 'colorAttributeName' : 'data-color'
21
+ }
22
+ );
23
+ }
24
+ );
25
+ </script>
app/design/frontend/base/default/layout/neklo/scrolltotop.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout>
3
+ <default>
4
+ <reference name="head">
5
+ <action method="addItem">
6
+ <type>skin_css</type>
7
+ <name>neklo/scrolltotop/css/styles.css</name>
8
+ </action>
9
+ <action method="addItem">
10
+ <type>skin_js</type>
11
+ <name>neklo/scrolltotop/js/script.js</name>
12
+ </action>
13
+ </reference>
14
+ <reference name="before_body_end">
15
+ <block type="neklo_scrolltotop/arrow" name="neklo_scrolltotop_arrow" template="neklo/scrolltotop/arrow.phtml" />
16
+ </reference>
17
+ </default>
18
+ </layout>
app/design/frontend/base/default/template/neklo/scrolltotop/arrow.phtml ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php /* @var $this Neklo_ScrollToTop_Block_Arrow */ ?>
2
+ <?php if ($this->canShow()): ?>
3
+ <div id="neklo_scrolltotop_arrow" class="align-<?php echo $this->getPosition(); ?>" style="color:<?php echo $this->getColor(); ?>;display:none;"></div>
4
+ <script type="text/javascript">
5
+ new NekloScrollToTop({
6
+ 'arrowId' : 'neklo_scrolltotop_arrow',
7
+ 'threshold' : 0.3,
8
+ 'scrollOptions' : {
9
+ 'duration' : '0.5'
10
+ }
11
+ });
12
+ </script>
13
+ <?php endif; ?>
app/etc/modules/Neklo_Core.xml ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Neklo_Core>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ <extension_name>Neklo Core</extension_name>
8
+ </Neklo_Core>
9
+ </modules>
10
+ </config>
app/etc/modules/Neklo_ScrollToTop.xml ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Neklo_ScrollToTop>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ <depends>
8
+ <Neklo_Core/>
9
+ </depends>
10
+ <extension_name>Scroll To Top</extension_name>
11
+ <url></url>
12
+ <encoding></encoding>
13
+ </Neklo_ScrollToTop>
14
+ </modules>
15
+ </config>
app/locale/en_US/Neklo_Core.csv ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ %s Support (%s),%s Support (%s)
2
+ Contact Email,Contact Email
3
+ Contact Form,Contact Form
4
+ Contact Name,Contact Name
5
+ "Contact Neklo Support Team or visit <a href=""%s"" target=""_blank"">%s</a> for additional information","Contact Neklo Support Team or visit <a href=""%s"" target=""_blank"">%s</a> for additional information"
6
+ Extensions &amp; Contact,Extensions &amp; Contact
7
+ Extensions Information,Extensions Information
8
+ Installed Neklo Extensions,Installed Neklo Extensions
9
+ free,free
10
+ Magento Related Support (paid),Magento Related Support (paid)
11
+ Message,Message
12
+ Neklo Extensions &amp; Contact,Neklo Extensions &amp; Contact
13
+ Other Reason,Other Reason
14
+ Reason,Reason
15
+ Request New Extension Development (paid),Request New Extension Development (paid)
16
+ paid,paid
17
+ Please select,Please select
18
+ Send,Send
19
+ Subject,Subject
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Neklo_ScrollUp</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license>License</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Summary</summary>
10
+ <description>Description</description>
11
+ <notes>The first stable release.</notes>
12
+ <authors><author><name>NEKLO</name><user>NEKLO</user><email>info@neklo.com</email></author></authors>
13
+ <date>2015-12-11</date>
14
+ <time>14:50:42</time>
15
+ <contents><target name="magecommunity"><dir name="Neklo"><dir name="ScrollToTop"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Color"><file name="List.php" hash="85274971e643a33699a78ffe15c2da22"/></dir><file name="Color.php" hash="18236ed68b29d715d51839717f524586"/></dir></dir><file name="Arrow.php" hash="04d2dc294db8dae38abca4e81f1f9ba2"/></dir><dir name="Helper"><file name="Config.php" hash="dd29c203cb9dc08f7afe6a98081a930d"/><file name="Data.php" hash="6f85beeaceeb7d717ed0d2726e68a36e"/><file name="Page.php" hash="3d65122258294cf45b1f7a57a3856885"/></dir><dir name="Model"><dir name="Source"><file name="Color.php" hash="c42c148f0274d2e73f271a9daa507940"/><file name="Position.php" hash="468e8de74b2413f232903a61646c6ab6"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="e6f6832ac31db595867009430324f8f5"/><file name="config.xml" hash="f3125c2655f5400a5134b2d7bb5e7658"/><file name="system.xml" hash="a4e386468b7cd73ca1306442ba628fa7"/></dir></dir><dir name="Core"><dir name="Block"><dir name="System"><file name="Abstract.php" hash="ca1a1083ae0fe2b0d7bcffe49313ed72"/><file name="Contact.php" hash="b9d03eda3b0ff0b8ffd17a777bc36d9b"/><file name="Extensions.php" hash="fafa6cb1e0d5b5ce5538a6d01ad6581b"/><dir name="Newsletter"><dir name="Subscribe"><file name="Button.php" hash="c24e57030e1a6d16611eb516a9249c34"/></dir><file name="Subscribe.php" hash="7b9b021aa6f12c0eff8576c4cb6cd60d"/></dir><file name="Newsletter.php" hash="46a84ace83bf1a4a81a3e4bf90272c6c"/></dir></dir><dir name="Helper"><file name="Data.php" hash="e13a6d27a50ea228c8751e6465c8f463"/></dir><dir name="Model"><file name="Feed.php" hash="8a669a60ad96195af2ff706c1e3ec26e"/><file name="Observer.php" hash="dea6141e7f7bb7acde44f242d0ae7083"/></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Neklo"><dir name="Core"><file name="ContactController.php" hash="dcf7ef46b142e9d886c67b2d760ef652"/><file name="NewsletterController.php" hash="86be65da9dadc1a26ebc6133be52f834"/></dir></dir></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="68b00ad4118462d74b0c0a7126063462"/><file name="config.xml" hash="be54033dcedd6d17a68907b2c52b8d32"/><file name="system.xml" hash="66e1ccd2fc1c3fdd511dc99a8575009d"/></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="neklo"><dir name="scrolltotop"><dir name="system"><dir name="color"><file name="list.phtml" hash="651511cdbac77fcf1ba5ad8e3d9ec3ba"/></dir></dir></dir><dir name="core"><dir name="system"><dir name="subscribe"><file name="button.phtml" hash="4e9fe3dfa9e291976ff45c2e25ce7b10"/></dir></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="neklo"><file name="scrolltotop.xml" hash="0de5db73631f1107abffe7485702280f"/></dir></dir><dir name="template"><dir name="neklo"><dir name="scrolltotop"><file name="arrow.phtml" hash="da0212649af14b2224afc2c0f6c77dfd"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Neklo_ScrollToTop.xml" hash="4515f6ae004977d2ac7686c19e22675a"/><file name="Neklo_Core.xml" hash="335032ff690c5272626dca9106642680"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="neklo"><dir name="scrolltotop"><dir name="css"><file name="styles.css" hash="c40e3a912cf91b47b9699f80dc00f030"/></dir><dir name="fonts"><file name="icomoon.eot" hash="38af4e9bfb846f4b7d9668a58c506799"/><file name="icomoon.svg" hash="3a95597bb3591414fb8464be7eb92514"/><file name="icomoon.ttf" hash="1f4ba53c4d581b26b6bcbed36f210141"/><file name="icomoon.woff" hash="01263a8c1723896e541da65819017a56"/></dir><dir name="js"><file name="script.js" hash="994ca8be9f35f1a7f8776cf69dd40c35"/></dir></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="Neklo_Core.csv" hash="c6abfbb8be878de9c02339e2ecfc4e16"/></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.2.7</min><max>6.0.0</max></php></required></dependencies>
18
+ </package>
skin/frontend/base/default/neklo/scrolltotop/css/styles.css ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @font-face {
2
+ font-family: 'icomoon';
3
+ src:url('../fonts/icomoon.eot?tfm3r6');
4
+ src:url('../fonts/icomoon.eot?tfm3r6#iefix') format('embedded-opentype'),
5
+ url('../fonts/icomoon.ttf?tfm3r6') format('truetype'),
6
+ url('../fonts/icomoon.woff?tfm3r6') format('woff'),
7
+ url('../fonts/icomoon.svg?tfm3r6#icomoon') format('svg');
8
+ font-weight: normal;
9
+ font-style: normal;
10
+ }
11
+
12
+
13
+ #neklo_scrolltotop_arrow {
14
+ position: fixed;
15
+ bottom: 20px;
16
+ background: transparent;
17
+ cursor: pointer;
18
+ }
19
+
20
+ #neklo_scrolltotop_arrow.align-left {
21
+ left: 20px;
22
+ }
23
+
24
+ #neklo_scrolltotop_arrow.align-right {
25
+ right: 20px;
26
+ }
27
+
28
+ #neklo_scrolltotop_arrow:before {
29
+ font-family: 'icomoon' !important;
30
+ content: "\e900";
31
+ font-style: normal;
32
+ font-weight: normal;
33
+ font-variant: normal;
34
+ text-transform: none;
35
+ line-height: 1;
36
+ font-size: 50px;
37
+ -webkit-font-smoothing: antialiased;
38
+ -moz-osx-font-smoothing: grayscale;
39
+ }
40
+
41
+ #neklo_scrolltotop_arrow:hover:before {
42
+ content: "\e901";
43
+ }
44
+
skin/frontend/base/default/neklo/scrolltotop/fonts/icomoon.eot ADDED
Binary file
skin/frontend/base/default/neklo/scrolltotop/fonts/icomoon.svg ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" standalone="no"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
3
+ <svg xmlns="http://www.w3.org/2000/svg">
4
+ <metadata>Generated by IcoMoon</metadata>
5
+ <defs>
6
+ <font id="icomoon" horiz-adv-x="1024">
7
+ <font-face units-per-em="1024" ascent="960" descent="-64" />
8
+ <missing-glyph horiz-adv-x="1024" />
9
+ <glyph unicode="&#x20;" horiz-adv-x="512" d="" />
10
+ <glyph unicode="&#xe900;" glyph-name="ScrollUp" d="M40.965 960c-22.633 0-40.965-18.332-40.965-40.965v-942.073c0-22.633 18.332-40.965 40.965-40.965h942.073c22.633 0 40.965 18.332 40.965 40.965v942.073c0 22.633-18.332 40.965-40.965 40.965h-942.073zM40.965 939.518h942.073c11.286 0 20.482-9.197 20.482-20.482v-942.073c0-11.286-9.197-20.482-20.482-20.482h-942.073c-11.286 0-20.482 9.197-20.482 20.482v942.073c0 11.286 9.197 20.482 20.482 20.482zM512.021 692.408c-6.081 0-12.163-2.322-16.802-6.961l-152.058-152.058c-9.279-9.279-9.279-24.325 0-33.604s24.325-9.279 33.604 0l111.493 111.493v-406.049c0-13.129 10.594-23.763 23.723-23.763 13.109 0 23.763 10.634 23.763 23.763v406.049l111.493-111.493c9.279-9.279 24.325-9.279 33.604 0 4.629 4.629 6.961 10.719 6.961 16.802s-2.311 12.173-6.961 16.802l-152.058 152.058c-4.629 4.639-10.681 6.961-16.762 6.961z" />
11
+ <glyph unicode="&#xe901;" glyph-name="ScrollUpHover2" d="M40.965 960c-22.633 0-40.965-18.332-40.965-40.965v-942.073c0-22.633 18.332-40.965 40.965-40.965h942.073c22.633 0 40.965 18.332 40.965 40.965v942.073c0 22.633-18.332 40.965-40.965 40.965h-942.073zM512.021 703.449c6.081 0 12.133-2.322 16.762-6.961l152.058-152.018c4.65-4.629 6.961-10.719 6.961-16.802s-2.332-12.173-6.961-16.802c-9.279-9.279-24.325-9.279-33.604 0l-111.493 111.493v-406.049c0-13.129-10.654-23.763-23.763-23.763-13.129 0-23.763 10.634-23.763 23.763v406.049l-111.453-111.493c-9.279-9.279-24.325-9.279-33.604 0s-9.279 24.325 0 33.604l152.058 152.018c4.639 4.639 10.721 6.961 16.802 6.961z" />
12
+ </font></defs></svg>
skin/frontend/base/default/neklo/scrolltotop/fonts/icomoon.ttf ADDED
Binary file
skin/frontend/base/default/neklo/scrolltotop/fonts/icomoon.woff ADDED
Binary file
skin/frontend/base/default/neklo/scrolltotop/js/script.js ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var NekloScrollToTop = Class.create({
2
+ initialize: function (config) {
3
+ this.initConfig(config);
4
+ this.initElements();
5
+ this.initObservers();
6
+ },
7
+
8
+ initConfig: function (config) {
9
+ this.config = config;
10
+ this.threshold = this.config.threshold;
11
+ this.scrollOptions = this.config.scrollOptions || {};
12
+ },
13
+
14
+ initElements: function () {
15
+ this.arrow = $(this.config.arrowId) || null;
16
+ },
17
+
18
+ initObservers: function () {
19
+ if (this.arrow) {
20
+ Event.observe(this.arrow, 'click', this._onArrowClick.bind(this));
21
+ Event.observe(window, 'scroll', this._onWindowScroll.bind(this));
22
+ }
23
+ },
24
+
25
+ _onArrowClick: function () {
26
+ new Effect.ScrollTo($$('body').first(), this.scrollOptions);
27
+ },
28
+
29
+ _onWindowScroll: function () {
30
+ var scrollOffset = document.viewport.getScrollOffsets()[1];
31
+ var scrollThreshold = document.viewport.getHeight() * this.threshold;
32
+ if (scrollOffset > scrollThreshold) {
33
+ this.showArrow();
34
+ } else {
35
+ this.hideArrow()
36
+ }
37
+ },
38
+
39
+ showArrow: function () {
40
+ if (this.arrow) {
41
+ this.arrow.show();
42
+ }
43
+ },
44
+
45
+ hideArrow: function () {
46
+ if (this.arrow) {
47
+ this.arrow.hide();
48
+ }
49
+ }
50
+ });