Lemonline_ZEF_Livezhat - Version 0.1.0

Version Notes

Download this release

Release Info

Developer Lemonline
Extension Lemonline_ZEF_Livezhat
Version 0.1.0
Comparing to
See all releases


Version 0.1.0

app/code/community/Lemonline/Livezhat/Block/Adminhtml/System/Config/Fieldset/Hint.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is released and licensed under a limited, non-exclusive and non-assignable commercial license by Lemonline.
7
+ *
8
+ * @category Lemonline
9
+ * @package Lemonline_Livezhat
10
+ * @copyright Copyright (c) 2015 Lemonline (http://www.lemonline.fi)
11
+ * @license http://www.lemonline.fi/licenses/lemonline-license-1.0.txt Lemonline License
12
+ */
13
+ class Lemonline_Livezhat_Block_Adminhtml_System_Config_Fieldset_Hint
14
+ extends Mage_Adminhtml_Block_Abstract
15
+ implements Varien_Data_Form_Element_Renderer_Interface
16
+ {
17
+ protected $_template = 'lemonline/livezhat/system/config/fieldset/hint.phtml';
18
+
19
+ public function render(Varien_Data_Form_Element_Abstract $element)
20
+ {
21
+ return $this->toHtml();
22
+ }
23
+ }
app/code/community/Lemonline/Livezhat/Block/Adminhtml/System/Config/Form/Field/Register.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is released and licensed under a limited, non-exclusive and non-assignable commercial license by Lemonline.
7
+ *
8
+ * @category Lemonline
9
+ * @package Lemonline_Livezhat
10
+ * @copyright Copyright (c) 2015 Lemonline (http://www.lemonline.fi)
11
+ * @license http://www.lemonline.fi/licenses/lemonline-license-1.0.txt Lemonline License
12
+ */
13
+ class Lemonline_Livezhat_Block_Adminhtml_System_Config_Form_Field_Register extends Mage_Adminhtml_Block_System_Config_Form_Field
14
+ {
15
+ /**
16
+ * adds Register -button on the Livezhat adminhtml
17
+ *
18
+ */
19
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
20
+ {
21
+ $this->setElement($element);
22
+ $buttonBlock = $element->getForm()->getParent()->getLayout()->createBlock('adminhtml/widget_button');
23
+ $data = array(
24
+ 'label' => Mage::helper('livezhat')->__('Register'),
25
+ 'onclick' => 'register()',
26
+ 'class' => 'scalable save',
27
+ ''
28
+ );
29
+ $buttonBlock->setData($data);
30
+ $html = $buttonBlock->toHtml();
31
+ $script = '<script type="text/javascript">function register() {';
32
+ $script .= 'var form = document.createElement("form");';
33
+ $script .= 'form.setAttribute("method", "get");';
34
+ $script .= 'form.setAttribute("action", "'. Mage::helper('adminhtml')->getUrl("*/livezhat/register") . '");';
35
+ foreach (Mage::helper("livezhat")->getRegisterFields() as $field) {
36
+ $script .= 'var field = document.createElement("input");';
37
+ $script .= 'field.setAttribute("type", "hidden");';
38
+ $script .= 'field.setAttribute("name", "' . $field . '");';
39
+ $script .= 'field.setAttribute("value", document.getElementById("' . $field .'").value);';
40
+ $script .= 'form.appendChild(field);';
41
+ }
42
+ $script .= 'document.body.appendChild(form);';
43
+ $script .= 'form.submit();';
44
+ $script .= '}</script>';
45
+ $html = $html . $script;
46
+ return $html;
47
+ }
48
+ }
app/code/community/Lemonline/Livezhat/Block/Html.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is released and licensed under a limited, non-exclusive and non-assignable commercial license by Lemonline.
8
+ *
9
+ * @category Lemonline
10
+ * @package Lemonline_Livezhat
11
+ * @copyright Copyright (c) 2015 Lemonline (http://www.lemonline.fi)
12
+ * @license http://www.lemonline.fi/licenses/lemonline-license-1.0.txt Lemonline License
13
+ */
14
+ class Lemonline_Livezhat_Block_Html extends Mage_Core_Block_Template
15
+ {
16
+ /**
17
+ *
18
+ * @return string
19
+ */
20
+ protected function getCustomerKey()
21
+ {
22
+ return Mage::helper('livezhat')->getCustomerKey();
23
+ }
24
+
25
+ /**
26
+ *
27
+ * @return string
28
+ */
29
+ protected function getZhatKey()
30
+ {
31
+ return Mage::helper('livezhat')->getZhatKey();
32
+ }
33
+ }
app/code/community/Lemonline/Livezhat/Helper/Data.php ADDED
@@ -0,0 +1,161 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is released and licensed under a limited, non-exclusive and non-assignable commercial license by Lemonline.
8
+ *
9
+ * @category Lemonline
10
+ * @package Lemonline_Livezhat
11
+ * @copyright Copyright (c) 2015 Lemonline (http://www.lemonline.fi)
12
+ * @license http://www.lemonline.fi/licenses/lemonline-license-1.0.txt Lemonline License
13
+ */
14
+ class Lemonline_Livezhat_Helper_Data extends Mage_Core_Helper_Abstract
15
+ {
16
+ const CONFIG_PATH_CUSTOMER_KEY = 'livezhat/general/customer_key';
17
+ const CONFIG_PATH_ZHAT_KEY = 'livezhat/general/zhat_key';
18
+ const CONFIG_PATH_USER_EMAIL = 'livezhat/register/user_email';
19
+
20
+ /**
21
+ *
22
+ * @return string
23
+ */
24
+ public function getCustomerKey()
25
+ {
26
+ return Mage::getStoreConfig(self::CONFIG_PATH_CUSTOMER_KEY);
27
+ }
28
+
29
+ /**
30
+ *
31
+ * @return string
32
+ */
33
+ public function getZhatKey()
34
+ {
35
+ return Mage::getStoreConfig(self::CONFIG_PATH_ZHAT_KEY);
36
+ }
37
+
38
+ /**
39
+ *
40
+ * @return string
41
+ */
42
+ public function getUserEmail()
43
+ {
44
+ return Mage::getStoreConfig(self::CONFIG_PATH_USER_EMAIL);
45
+ }
46
+
47
+ /**
48
+ *
49
+ * @return string
50
+ */
51
+ public function getZhatRegisterUrl()
52
+ {
53
+ return 'https://zefzhat.appspot.com/PartnerAPI?auth=';
54
+ }
55
+
56
+ /**
57
+ *
58
+ * @return string
59
+ */
60
+ public function getPartnerId()
61
+ {
62
+ return '169094019';
63
+ }
64
+
65
+ /**
66
+ *
67
+ * @return string
68
+ */
69
+ public function getPartnerKey()
70
+ {
71
+ return 'aglzfnplZnpoYXRyEAsSB1BhcnRuZXIYg9fQUAw';
72
+ }
73
+
74
+ /**
75
+ *
76
+ * @return array
77
+ */
78
+ public function getRegisterFields()
79
+ {
80
+ return array (
81
+ "livezhat_register_user_name",
82
+ "livezhat_register_user_email",
83
+ "livezhat_register_company_name",
84
+ //"livezhat_register_company_id", //Not used
85
+ );
86
+ }
87
+
88
+ /**
89
+ * Livezhat registration
90
+ *
91
+ * @param $userName
92
+ * @param $userEmail
93
+ * @param $companyName
94
+ * @param $companyId
95
+ * @return String zhatPw
96
+ */
97
+ public function register($userName, $userEmail, $companyName, $companyId)
98
+ {
99
+ Mage::getConfig()->saveConfig('livezhat/register/user_name', $userName);
100
+ Mage::getConfig()->saveConfig('livezhat/register/user_email', $userEmail);
101
+ Mage::getConfig()->saveConfig('livezhat/register/company_name',$companyName);
102
+ //Mage::getConfig()->saveConfig('livezhat/register/company_id', $companyId);//Not used in configuration
103
+
104
+ $contact_person = array(
105
+ 'name' => $userName,
106
+ 'email' => $userEmail,
107
+ );
108
+ $customer = array(
109
+ 'name' => $companyName,
110
+ 'company_id' => $companyId,
111
+ 'contact_person' => $contact_person,
112
+ );
113
+ $partner = array(
114
+ 'id' => $this->getPartnerId(),
115
+ 'create_customer' => $customer,
116
+ );
117
+ $create_customer = array(
118
+ 'livezhat_partner' => $partner,
119
+ );
120
+ $code = $this->getPartnerKey();
121
+ $content = json_encode($create_customer);
122
+ $secret_hash = md5($code . $content);
123
+ $url = $this->getZhatRegisterUrl() . $secret_hash;
124
+ $curl = curl_init($url);
125
+ curl_setopt($curl, CURLOPT_HEADER, false);
126
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
127
+ curl_setopt($curl, CURLOPT_HTTPHEADER, array("Content-type: application/json"));
128
+ curl_setopt($curl, CURLOPT_POST, true);
129
+ curl_setopt($curl, CURLOPT_POSTFIELDS, $content);
130
+ curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, true);
131
+ $result = curl_exec($curl);
132
+ $response = json_decode($result);
133
+ curl_close($curl);
134
+ if(!isset($response))
135
+ {
136
+ throw new Exception('Unexpected error, request could not be processed', 300);
137
+
138
+ } else if(isset($response->error))
139
+ {
140
+ $error = $response->error;
141
+ throw new Exception($error->msg, $error->code);
142
+ } else {
143
+ if(isset($response->livezhat_customer->key) &&
144
+ isset($response->livezhat_customer->zhat->default_embed_key) &&
145
+ isset($response->livezhat_customer->pwkey)
146
+ ) {
147
+ $zhatUser = $response->livezhat_customer->key;
148
+ $zhatKey = $response->livezhat_customer->zhat->default_embed_key;
149
+ $zhatPw = $response->livezhat_customer->pwkey;
150
+ Mage::getConfig()->saveConfig('livezhat/general/active','1');
151
+ Mage::getConfig()->saveConfig('livezhat/general/customer_key', $zhatUser);
152
+ Mage::getConfig()->saveConfig('livezhat/general/zhat_key', $zhatKey);
153
+ Mage::dispatchEvent('adminhtml_cache_refresh_type', array('type' => 'config'));
154
+ Mage::app()->getCacheInstance()->flush();
155
+ return $zhatPw;
156
+ } else {
157
+ throw new Exception('Unexpected error, interface returned an unexpected result', 301);
158
+ }
159
+ }
160
+ }
161
+ }
app/code/community/Lemonline/Livezhat/controllers/Adminhtml/LivezhatController.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is released and licensed under a limited, non-exclusive and non-assignable commercial license by Lemonline.
7
+ *
8
+ * @category Lemonline
9
+ * @package Lemonline_Livezhat
10
+ * @copyright Copyright (c) 2015 Lemonline (http://www.lemonline.fi)
11
+ * @license http://www.lemonline.fi/licenses/lemonline-license-1.0.txt Lemonline License
12
+ */
13
+ class Lemonline_Livezhat_Adminhtml_LivezhatController extends Mage_Adminhtml_Controller_Action
14
+ {
15
+ /**
16
+ * register action called from Livezhat adminhtml
17
+ *
18
+ */
19
+ public function registerAction() {
20
+ $fields = Mage::helper("livezhat")->getRegisterFields();
21
+ $userName = trim($this->getRequest()->getParam($fields[0]));
22
+ $userEmail = trim($this->getRequest()->getParam($fields[1]));
23
+ $companyName = trim($this->getRequest()->getParam($fields[2]));
24
+ //$companyId = trim($this->getRequest()->getParam($fields[3])); // A generated id is used instead (below)
25
+ $companyId = uniqid();
26
+ if(strlen($userName) > 0 &&
27
+ strlen($userEmail) > 0 &&
28
+ strlen($companyName) > 0 &&
29
+ strlen($companyId) > 0
30
+ )
31
+ {
32
+ try {
33
+ $zhatPw = Mage::helper("livezhat")->register($userName, $userEmail, $companyName, $companyId);
34
+ $this->_getSession()->addSuccess(Mage::helper('livezhat')->__('Thank you for your Livezhat registration, %s.', $userName));
35
+ $this->_getSession()->addSuccess(Mage::helper('livezhat')
36
+ ->__('&raquo; <a href="http://www.livezhat.com/PasswordChange.html?key=%s&email=%s&locale=en" target="_new">Continue to Livezhat account activation</a>', $zhatPw, $userEmail));
37
+ } catch(Exception $e) {
38
+ switch ($e->getCode())
39
+ {
40
+ case 100:
41
+ $this->_getSession()->addError(Mage::helper('livezhat')->__('Livezhat registration error : Customer %s already exists with given information', $userName));
42
+ break;
43
+ case 300:
44
+ $this->_getSession()->addError(Mage::helper('livezhat')->__('Livezhat registration error: Unexpected error, request could not be processed'));
45
+ break;
46
+ case 301:
47
+ $this->_getSession()->addError(Mage::helper('livezhat')->__('Livezhat registration error: Unexpected error, interface returned an unexpected result'));
48
+ break;
49
+ default:
50
+ $this->_getSession()->addError(Mage::helper('livezhat')->__('Livezhat registration error: %s %s', $e->getCode(), $e->getMessage()));
51
+ }
52
+ }
53
+ } else {
54
+ $this->_getSession()->addError(Mage::helper('livezhat')->__('All fields are mandatory for Livezhat registration'));
55
+ }
56
+ $this->_redirectReferer();
57
+ }
58
+ }
app/code/community/Lemonline/Livezhat/etc/config.xml ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+
3
+ <config>
4
+ <modules>
5
+ <Lemonline_Livezhat>
6
+ <version>0.1.0</version>
7
+ </Lemonline_Livezhat>
8
+ </modules>
9
+ <global>
10
+ <models>
11
+ <livezhat>
12
+ <class>Lemonline_Livezhat_Model</class>
13
+ </livezhat>
14
+ </models>
15
+ <blocks>
16
+ <livezhat>
17
+ <class>Lemonline_Livezhat_Block</class>
18
+ </livezhat>
19
+ </blocks>
20
+ <helpers>
21
+ <livezhat>
22
+ <class>Lemonline_Livezhat_Helper</class>
23
+ </livezhat>
24
+ </helpers>
25
+ </global>
26
+ <frontend>
27
+ <translate>
28
+ <modules>
29
+ <livezhat>
30
+ <files>
31
+ <default>Lemonline_Livezhat.csv</default>
32
+ </files>
33
+ </livezhat>
34
+ </modules>
35
+ </translate>
36
+ <layout>
37
+ <updates>
38
+ <livezhat>
39
+ <file>livezhat.xml</file>
40
+ </livezhat>
41
+ </updates>
42
+ </layout>
43
+ </frontend>
44
+ <adminhtml>
45
+ <translate>
46
+ <modules>
47
+ <livezhat>
48
+ <files>
49
+ <default>Lemonline_Livezhat.csv</default>
50
+ </files>
51
+ </livezhat>
52
+ </modules>
53
+ </translate>
54
+ <acl>
55
+ <resources>
56
+ <all>
57
+ <title>Allow Everything</title>
58
+ </all>
59
+ <admin>
60
+ <children>
61
+ <system>
62
+ <children>
63
+ <config>
64
+ <children>
65
+ <livezhat translate="title" module="livezhat">
66
+ <title>Livezhat</title>
67
+ </livezhat>
68
+ </children>
69
+ </config>
70
+ </children>
71
+ </system>
72
+ </children>
73
+ </admin>
74
+ </resources>
75
+ </acl>
76
+ </adminhtml>
77
+ <admin>
78
+ <routers>
79
+ <adminhtml>
80
+ <args>
81
+ <modules>
82
+ <livezhat before="Mage_Adminhtml">Lemonline_Livezhat_Adminhtml</livezhat>
83
+ </modules>
84
+ </args>
85
+ </adminhtml>
86
+ </routers>
87
+ </admin>
88
+ </config>
app/code/community/Lemonline/Livezhat/etc/system.xml ADDED
@@ -0,0 +1,119 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <tabs>
4
+ <livezhat translate="label" module="livezhat">
5
+ <label><![CDATA[<div><img src="https://livezhat.com/images/lz-logo.png" alt="Livezhat" title="Livezhat" height="20" style="display:block;" /></div>]]></label>
6
+ <sort_order>300</sort_order>
7
+ </livezhat>
8
+ </tabs>
9
+ <sections>
10
+ <livezhat translate="label" module="livezhat">
11
+ <label><![CDATA[Livezhat<sup>&reg;</sup>]]></label>
12
+ <tab>livezhat</tab>
13
+ <frontend_type>text</frontend_type>
14
+ <sort_order>100</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
+ <hint>
20
+ <frontend_model>livezhat/adminhtml_system_config_fieldset_hint</frontend_model>
21
+ <sort_order>0</sort_order>
22
+ <show_in_default>1</show_in_default>
23
+ <show_in_website>1</show_in_website>
24
+ <show_in_store>1</show_in_store>
25
+ </hint>
26
+ <register translate="label comment">
27
+ <label>Register</label>
28
+ <frontend_type>text</frontend_type>
29
+ <sort_order>10</sort_order>
30
+ <show_in_default>1</show_in_default>
31
+ <show_in_website>0</show_in_website>
32
+ <show_in_store>0</show_in_store>
33
+ <comment><![CDATA[<b>Start here using Livezhat - 14 days for free and without any commitments!</b>]]></comment>
34
+ <fields>
35
+ <user_name translate="label comment">
36
+ <label>User's name</label>
37
+ <frontend_type>text</frontend_type>
38
+ <sort_order>1</sort_order>
39
+ <show_in_default>1</show_in_default>
40
+ <show_in_website>0</show_in_website>
41
+ <show_in_store>0</show_in_store>
42
+ </user_name>
43
+ <user_email translate="label comment">
44
+ <label>User's email</label>
45
+ <frontend_type>text</frontend_type>
46
+ <sort_order>2</sort_order>
47
+ <show_in_default>1</show_in_default>
48
+ <show_in_website>0</show_in_website>
49
+ <show_in_store>0</show_in_store>
50
+ </user_email>
51
+ <company_name translate="label comment">
52
+ <label>Company name</label>
53
+ <frontend_type>text</frontend_type>
54
+ <sort_order>3</sort_order>
55
+ <show_in_default>1</show_in_default>
56
+ <show_in_website>0</show_in_website>
57
+ <show_in_store>0</show_in_store>
58
+ </company_name>
59
+ <!-- Not used
60
+ <company_id translate="label comment">
61
+ <label>Company id</label>
62
+ <frontend_type>text</frontend_type>
63
+ <sort_order>4</sort_order>
64
+ <show_in_default>1</show_in_default>
65
+ <show_in_website>0</show_in_website>
66
+ <show_in_store>0</show_in_store>
67
+ <comment>Enter here company id</comment>
68
+ </company_id>
69
+ -->
70
+ <register_btn translate="label comment">
71
+ <label></label>
72
+ <frontend_type>text</frontend_type>
73
+ <frontend_model>livezhat/adminhtml_system_config_form_field_register</frontend_model>
74
+ <sort_order>5</sort_order>
75
+ <show_in_default>1</show_in_default>
76
+ <show_in_website>0</show_in_website>
77
+ <show_in_store>0</show_in_store>
78
+ </register_btn>
79
+ </fields>
80
+ </register>
81
+ <general translate="label comment">
82
+ <label>Settings</label>
83
+ <frontend_type>text</frontend_type>
84
+ <sort_order>20</sort_order>
85
+ <show_in_default>1</show_in_default>
86
+ <show_in_website>1</show_in_website>
87
+ <show_in_store>1</show_in_store>
88
+ <fields>
89
+ <active translate="label">
90
+ <label>Enabled</label>
91
+ <frontend_type>select</frontend_type>
92
+ <source_model>adminhtml/system_config_source_yesno</source_model>
93
+ <sort_order>1</sort_order>
94
+ <show_in_default>1</show_in_default>
95
+ <show_in_website>1</show_in_website>
96
+ <show_in_store>1</show_in_store>
97
+ </active>
98
+ <customer_key translate="label">
99
+ <label>Customer Key</label>
100
+ <frontend_type>text</frontend_type>
101
+ <sort_order>2</sort_order>
102
+ <show_in_default>1</show_in_default>
103
+ <show_in_website>1</show_in_website>
104
+ <show_in_store>1</show_in_store>
105
+ </customer_key>
106
+ <zhat_key translate="label">
107
+ <label>Zhat Key</label>
108
+ <frontend_type>text</frontend_type>
109
+ <sort_order>3</sort_order>
110
+ <show_in_default>1</show_in_default>
111
+ <show_in_website>1</show_in_website>
112
+ <show_in_store>1</show_in_store>
113
+ </zhat_key>
114
+ </fields>
115
+ </general>
116
+ </groups>
117
+ </livezhat>
118
+ </sections>
119
+ </config>
app/design/adminhtml/base/default/template/lemonline/livezhat/system/config/fieldset/hint.phtml ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @var $this Lemonline_Livezhat_Block_Adminhtml_System_Config_Fieldset_Hint
4
+ */
5
+ ?>
6
+ <div class="box">
7
+ <?php if(strlen(trim($this->helper('livezhat')->getCustomerKey())) > 0 && strlen(trim($this->helper('livezhat')->getZhatKey()))) :?>
8
+ <div style="background:url('https://livezhat.com/images/lz-logo.png') no-repeat left center;padding-left:160px;min-height:45px;">
9
+ <h4><?php echo $this->helper('livezhat')->__('Amaze your store visitors with a real-time live chat.'); ?></h4>
10
+ <p style="margin-bottom:0;">
11
+ <?php echo $this->helper('livezhat')->__('Login to your account');?>
12
+ <?php echo $this->helper('livezhat')->__('<a href="https://livezhat.com/ui.html?email=%s&locale=en" target="_new">here</a>', $this->helper('livezhat')->getUserEmail());?>
13
+ </p>
14
+ </div>
15
+ <?php else :?>
16
+ <div style="background:url('https://livezhat.com/images/lz-logo.png') no-repeat left center;padding-left:160px;min-height:35px;">
17
+ <h4 style="padding-top: 12px;"><?php echo $this->helper('livezhat')->__('Amaze your store visitors with a real-time live chat.'); ?></h4>
18
+ </div>
19
+ <?php endif; ?>
20
+ </div>
app/design/frontend/base/default/layout/livezhat.xml ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <layout version="0.1.0">
2
+ <default>
3
+ <block type="livezhat/html" name="livezhat" template="livezhat/livezhat.phtml" />
4
+
5
+ <reference name="before_body_end" module="livezhat">
6
+ <action method="append" ifconfig="livezhat/general/active">
7
+ <block>livezhat</block>
8
+ </action>
9
+ </reference>
10
+ </default>
11
+ </layout>
app/design/frontend/base/default/template/livezhat/livezhat.phtml ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <script type="text/javascript">
2
+ (function() {
3
+ var sc = document.createElement('script'); sc.type = 'text/javascript'; sc.async = true;
4
+ sc.src = ('https:' == document.location.protocol ? 'https://zefzhat.appspot.com' : 'http://www.livezhat.com') + '/code/<?php echo $this->getCustomerKey() ?>/<?php echo $this->getZhatKey() ?>';
5
+ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(sc, s);
6
+ })();
7
+ </script>
app/etc/modules/Lemonline_Livezhat.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Lemonline_Livezhat>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Lemonline_Livezhat>
8
+ </modules>
9
+ </config>
app/locale/en_US/Lemonline_Livezhat.csv ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "Amaze your store visitors with a real-time live chat.","Amaze your store visitors with a real-time live chat."
2
+ "Register","Register"
3
+ "Settings","Settings"
4
+ "Register to Livezhat<sup>&reg;</sup>","Register to Livezhat<sup>&reg;</sup>"
5
+ "<b>Start here using Livezhat - 14 days for free and without any commitments!</b>","<b>Start here using Livezhat - 14 days for free and without any commitments!</b>"
6
+ "User's name","User's name"
7
+ "User's email","User's email"
8
+ "Company name","Company name"
9
+ "Company id","Company id"
10
+ "Enter here company id","Enter here company id"
11
+ "Thank you for your Livezhat registration, %s.","Thank you for your Livezhat registration, %s."
12
+ "&raquo; <a href=""http://www.livezhat.com/PasswordChange.html?key=%s&email=%s&locale=en"" target=""_new"">Continue to Livezhat account activation</a>","&raquo; <a href=""http://www.livezhat.com/PasswordChange.html?key=%s&email=%s&locale=en"" target=""_new"">Continue to Livezhat account activation</a>"
13
+ "Login to your account","Login to your account"
14
+ "<a href=""https://livezhat.com/ui.html?email=%s&locale=en"" target=""_new"">here</a>","<a href=""https://livezhat.com/ui.html?email=%s&locale=en"" target=""_new"">here</a>"
15
+ "Customer Key","Customer Key"
16
+ "Zhat Key","Zhat Key"
17
+ "Livezhat registration error : Customer %s already exists with given information","Livezhat registration error : Customer %s already exists with given information"
18
+ "Livezhat registration error: %s %s","Livezhat registration error: %s %s"
19
+ "Livezhat registration error: Unexpected error, request could not be processed","Livezhat registration error: Unexpected error, request could not be processed"
20
+ "Livezhat registration error: Unexpected error, interface returned an unexpected result","Livezhat registration error: Unexpected error, interface returned an unexpected result"
21
+ "All fields are mandatory for Livezhat registration","All fields are mandatory for Livezhat registration"
app/locale/fi_FI/Lemonline_Livezhat.csv ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "Amaze your store visitors with a real-time live chat.","Suomen suosituin live chat ohjelmisto nyt myös sinun verkkokauppaasi."
2
+ "Register","Rekisteröidy"
3
+ "Settings","Asetukset"
4
+ "Register to Livezhat<sup>&reg;</sup>","Rekisteröidy Livezhat<sup>&reg;</sup>iin"
5
+ "<b>Start here using Livezhat - 14 days for free and without any commitments!</b>","<b>Aloita tästä Livezhatin käyttö - 14 päivää ilmaiseksi ja ilman sitoutumista!</b>"
6
+ "User's name","Käyttäjän nimi"
7
+ "User's email","Käyttäjän sähköposti"
8
+ "Company name","Yrityksen nimi"
9
+ "Company id","Yrityksen tunniste"
10
+ "Enter here company id","Yrityksen Y-tunnus tai muu yksilöivä tunniste"
11
+ "Thank you for your Livezhat registration, %s.","Kiitos Livezhat rekisteröitymisestäsi, %s."
12
+ "&raquo; <a href=""http://www.livezhat.com/PasswordChange.html?key=%s&email=%s&locale=en"" target=""_new"">Continue to Livezhat account activation</a>","&raquo; <a href=""http://www.livezhat.com/PasswordChange.html?key=%s&email=%s&locale=fi"" target=""_new"">Jatka Livezhat tilin aktivointiin</a>"
13
+ "Login to your account","Kirjaudu tiliisi"
14
+ "<a href=""https://livezhat.com/ui.html?email=%s&locale=en"" target=""_new"">here</a>","<a href=""https://livezhat.com/ui.html?email=%s&locale=fi"" target=""_new"">täällä</a>"
15
+ "Customer Key","Yrityksen tunnus"
16
+ "Zhat Key","Zhatin tunnus"
17
+ "Livezhat registration error : Customer %s already exists with given information","Livezhat rekisteröitymisvirhe: Asiakas %s on jo olemassa annetuilla tiedoilla"
18
+ "Livezhat registration error: %s %s","Livezhat rekisteröitymisvirhe: %s %s"
19
+ "Livezhat registration error: Unexpected error, request could not be processed","Livezhat rekisteröitymisvirhe: Odottamaton virhe, pyyntöä ei voitu suorittaa"
20
+ "Livezhat registration error: Unexpected error, interface returned an unexpected result","Livezhat rekisteröitymisvirhe: Odottamaton virhe, rajapinta palautti odottamattoman vastauksen"
21
+ "All fields are mandatory for Livezhat registration","Kaikki tiedot ovat Livezhat rekisteröitymisen kannalta pakollisia"
package.xml ADDED
@@ -0,0 +1,2 @@
 
 
1
+ <?xml version="1.0"?>
2
+ <package><name>Lemonline_ZEF_Livezhat</name><version>0.1.0</version><stability>stable</stability><license>OSL</license><channel>community</channel><extends></extends><summary>Lemonline ZEF Livezhat Magento extension</summary><description>With this extension users can register to ZEF Livezhat and get Livezhat enabled on their Magento storefront.</description><notes></notes><authors><author><name>Lemonline</name><user>Lemonline</user><email>info@lemonline.fi</email></author></authors><date>2015-03-02</date><time>4:03:29</time><compatible></compatible><dependencies><required><php><min>5.0.0</min><max>6.0.0</max></php></required></dependencies><contents><target name="mage"><dir name="app"><dir name="code"><dir name="community"><dir name="Lemonline"><dir name="Livezhat"><dir name="Block"><file name="Html.php" hash="dd1e31b4c5b871bb467292fa08026acc"/><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Fieldset"><file name="Hint.php" hash="978b01955a7e3fbb2b2a71fbe4912448"/></dir><dir name="Form"><dir name="Field"><file name="Register.php" hash="93558879aa45bd70095f0dba45cd9ade"/></dir></dir></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="LivezhatController.php" hash="52cd0b0c4291ea02e01b98831c439078"/></dir></dir><dir name="etc"><file name="config.xml" hash="f7eeffd5df33d790c48043f896c824b0"/><file name="system.xml" hash="9beb10377ba5627fc16829576b06e167"/></dir><dir name="Helper"><file name="Data.php" hash="2ba9bc953cf907d75821cc56773a70b7"/></dir></dir></dir></dir></dir><dir name="design"><dir name="adminhtml"><dir name="base"><dir name="default"><dir name="template"><dir name="lemonline"><dir name="livezhat"><dir name="system"><dir name="config"><dir name="fieldset"><file name="hint.phtml" hash="d35c9712fb3ac24bb34cc6161334925c"/></dir></dir></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="livezhat.xml" hash="77f3f20c9ee0c074c5ccd993bded8ad5"/></dir><dir name="template"><dir name="livezhat"><file name="livezhat.phtml" hash="ad825bdaa69f3ca1883303b291c0026d"/></dir></dir></dir></dir></dir></dir><dir name="etc"><dir name="modules"><file name="Lemonline_Livezhat.xml" hash="c2c188cb025dd0d298fdc45983ac5c06"/></dir></dir><dir name="locale"><dir name="en_US"><file name="Lemonline_Livezhat.csv" hash="52d50d9a632b3b5566caae6e5ea97534"/></dir><dir name="fi_FI"><file name="Lemonline_Livezhat.csv" hash="6ffd0e9168bdbfffbf9cdc7031da281f"/></dir></dir></dir></target></contents></package>