Diglin_Chat - Version 2.0.6

Version Notes

- 2.0.6: Change menu structure
- 2.0.5: Force SSL use while connecting to Zopim server to get account information
- 2.0.4: Fix cache issue
- 2.0.3 Update Zoppim Assets and add Cache Support
- 2.0.2: fix a bug on specific server configuration -
Zend_Log error fix
- 2.0.0: Complete new version - support of the new widget and API

Download this release

Release Info

Developer diglin
Extension Diglin_Chat
Version 2.0.6
Comparing to
See all releases


Code changes from version 2.0.5 to 2.0.6

app/code/community/Diglin/Chat/Block/Adminhtml/Config/Source/Hint.php CHANGED
@@ -27,6 +27,10 @@ class Diglin_Chat_Block_Adminhtml_Config_Source_Hint
27
  */
28
  public function render(Varien_Data_Form_Element_Abstract $element)
29
  {
 
 
 
 
30
  $buttonSignUp = $this->getLayout()->createBlock('adminhtml/widget_button')->setData(array(
31
  'label' => $this->__('Sign Up or Login to Zopim'),
32
  'onclick' => "window.open('" . $this->getUrl('chat/index/account') . "', '_self');",
@@ -45,6 +49,6 @@ class Diglin_Chat_Block_Adminhtml_Config_Source_Hint
45
  ))
46
  ->toHtml();
47
 
48
- return '<p>' . $buttonSignUp . '&nbsp;' . $buttonDashboard . ' - <strong>Diglin_Chat Version: '. Mage::getConfig()->getModuleConfig('Diglin_Chat')->version .' - Powered by <a href="http://www.diglin.com/?utm_source=magento&utm_medium=extension&utm_campaign=zopim">Diglin GmbH</a></strong></p>';
49
  }
50
  }
27
  */
28
  public function render(Varien_Data_Form_Element_Abstract $element)
29
  {
30
+ $html = '<p><a href="http://www.diglin.com/?utm_source=magento&utm_medium=extension&utm_campaign=zopim">'
31
+ .'<img style="vertical-align:middle" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAALoAAAA7CAYAAADM4pCMAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAADOlJREFUeNrsnV2MG1cVx++MvZs0a+9OygtI0PoBiYKAuKpUCALWI6GqpaLZvESiLY2tSlRFiK6jpg/9wLsBhdKIetPSDyIhOy0tbQR0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glin GmbH | Rütistrasse 14, 8952 Schlieren - Switzerland | <a href="mailto:support@diglin.com?subject=Support Diglin Zopim Chat">support@diglin.com</a></p>';
33
+
34
  $buttonSignUp = $this->getLayout()->createBlock('adminhtml/widget_button')->setData(array(
35
  'label' => $this->__('Sign Up or Login to Zopim'),
36
  'onclick' => "window.open('" . $this->getUrl('chat/index/account') . "', '_self');",
49
  ))
50
  ->toHtml();
51
 
52
+ return $html . '<p>' . $buttonSignUp . '&nbsp;' . $buttonDashboard . ' - <strong>Diglin_Chat Version: '. Mage::getConfig()->getModuleConfig('Diglin_Chat')->version .' - Powered by <a href="http://www.diglin.com/?utm_source=magento&utm_medium=extension&utm_campaign=zopim">Diglin GmbH</a></strong></p>';
53
  }
54
  }
app/code/community/Diglin/Chat/Helper/Data.php CHANGED
@@ -56,15 +56,10 @@ class Diglin_Chat_Helper_Data extends Mage_Core_Helper_Abstract
56
  /**
57
  * @param string $url
58
  * @param array $_data
59
- * @param string $useSSL
60
  * @return mixed
61
  */
62
- public function doPostRequest($url, $_data, $useSSL)
63
  {
64
- if ($useSSL != "zopimUseSSL") {
65
- $url = str_replace("https", "http", $url);
66
- }
67
-
68
  $data = array();
69
  while(list($n,$v) = each($_data)){
70
  $data[] = urlencode($n)."=".urlencode($v);
@@ -72,12 +67,22 @@ class Diglin_Chat_Helper_Data extends Mage_Core_Helper_Abstract
72
  $data = implode('&', $data);
73
 
74
  $ch = curl_init();
75
- curl_setopt($ch, CURLOPT_URL, $url);
76
- curl_setopt($ch, CURLOPT_POST, true);
77
- curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
78
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
 
 
 
 
 
79
 
80
  $response = curl_exec($ch);
 
 
 
 
 
81
  curl_close($ch);
82
 
83
  return $response;
56
  /**
57
  * @param string $url
58
  * @param array $_data
 
59
  * @return mixed
60
  */
61
+ public function doPostRequest($url, $_data)
62
  {
 
 
 
 
63
  $data = array();
64
  while(list($n,$v) = each($_data)){
65
  $data[] = urlencode($n)."=".urlencode($v);
67
  $data = implode('&', $data);
68
 
69
  $ch = curl_init();
70
+
71
+ $options = array(
72
+ CURLOPT_URL => $url,
73
+ CURLOPT_POST => true,
74
+ CURLOPT_POSTFIELDS => $data,
75
+ CURLOPT_RETURNTRANSFER => true
76
+ );
77
+
78
+ curl_setopt_array($ch, $options);
79
 
80
  $response = curl_exec($ch);
81
+
82
+ if (curl_error($ch)) {
83
+ Mage::log('Curl Error for Zopim Login - curl error:' . curl_error($ch) . ' - curl errno:' . curl_errno($ch));
84
+ }
85
+
86
  curl_close($ch);
87
 
88
  return $response;
app/code/community/Diglin/Chat/controllers/Adminhtml/IndexController.php CHANGED
@@ -22,19 +22,15 @@ class Diglin_Chat_Adminhtml_IndexController extends Mage_Adminhtml_Controller_Ac
22
  $this->_forward('account');
23
  }
24
 
25
- /**
26
- *
27
- */
28
  public function dashboardAction()
29
  {
30
  // @deprecated for security reason on Zopim side, we forward to
31
- //$this->loadLayout()->renderLayout();
32
  $this->_redirectUrl(Diglin_Chat_Helper_Data::ZOPIM_DASHBOARD_URL);
33
  }
34
 
35
  /**
36
  * Code partially taken from the old Zopim Live Chat Module
37
- * Lots has been improved but can still better be improved
38
  * @todo split into several actions if possible
39
  */
40
  public function accountAction()
@@ -46,13 +42,11 @@ class Diglin_Chat_Adminhtml_IndexController extends Mage_Adminhtml_Controller_Ac
46
  $key = Mage::getStoreConfig('chat/chatconfig/key');
47
  $username = Mage::getStoreConfig('chat/chatconfig/username');
48
  $salt = Mage::getStoreConfig('chat/chatconfig/salt');
49
- $useSSL = Mage::getStoreConfig('chat/chatconfig/use_ssl');
50
 
51
  $zopimObject = new Varien_Object(array(
52
  'key' => $key,
53
  'username' => $username,
54
- 'salt' => $salt,
55
- 'use_ssl' => $useSSL
56
  ));
57
 
58
  $error = array();
@@ -63,12 +57,6 @@ class Diglin_Chat_Adminhtml_IndexController extends Mage_Adminhtml_Controller_Ac
63
  $zopimObject->setKey('zopim');
64
  } else if ($this->getRequest()->getParam('zopimusername') != "") {
65
  // logging in
66
- if ($this->getRequest()->getParam('zopimUseSSL') != "") {
67
- $zopimObject->setUseSsl(true);
68
- } else {
69
- $zopimObject->setUseSsl(false);
70
- }
71
-
72
  $zopimusername = $this->getRequest()->getParam('zopimusername');
73
  $zopimpassword = $this->getRequest()->getParam('zopimpassword');
74
 
@@ -77,9 +65,7 @@ class Diglin_Chat_Adminhtml_IndexController extends Mage_Adminhtml_Controller_Ac
77
  "password" => $zopimpassword
78
  );
79
 
80
- $loginresult = Zend_Json::decode(Mage::helper('chat')->doPostRequest(Diglin_Chat_Helper_Data::ZOPIM_LOGIN_URL, $logindata, $zopimObject->getUseSsl()));
81
-
82
- Mage::log($loginresult, Zend_Log::DEBUG);
83
 
84
  if (isset($loginresult["error"])) {
85
  $error["login"] = $this->__("<b>Could not log in to Zopim. Please check your login details. If problem persists, try connecting without SSL enabled.</b>");
@@ -90,15 +76,10 @@ class Diglin_Chat_Adminhtml_IndexController extends Mage_Adminhtml_Controller_Ac
90
  $zopimObject->setUsername($zopimusername);
91
  $zopimObject->setSalt($loginresult["salt"]);
92
 
93
- $account = Zend_Json::decode(Mage::helper('chat')->doPostRequest(Diglin_Chat_Helper_Data::ZOPIM_GETACCOUNTDETAILS_URL, array("salt" => $loginresult["salt"]), $zopimObject->getUseSsl()));
94
-
95
- Mage::log($account, Zend_Log::DEBUG);
96
 
97
  if (isset($account)) {
98
  $zopimObject->setKey($account["account_key"]);
99
- // if ($zopimObject->getGreetings() == '') {
100
- // $zopimObject->setGreetings(Zend_Json::encode($account["settings"]["greetings"]));
101
- // }
102
  }
103
  } else {
104
  $zopimObject->setSalt(null);
@@ -106,12 +87,6 @@ class Diglin_Chat_Adminhtml_IndexController extends Mage_Adminhtml_Controller_Ac
106
  }
107
  } else if ($this->getRequest()->getParam('zopimfirstname') != "") {
108
 
109
- if ($this->getRequest()->getParam('zopimUseSSL') != "") {
110
- $zopimObject->setUseSsl(true);
111
- } else {
112
- $zopimObject->setUseSsl(false);
113
- }
114
-
115
  $createdata = array(
116
  "email" => $this->getRequest()->getParam('zopimnewemail'),
117
  "first_name" => $this->getRequest()->getParam('zopimfirstname'),
@@ -124,7 +99,7 @@ class Diglin_Chat_Adminhtml_IndexController extends Mage_Adminhtml_Controller_Ac
124
  "recaptcha_response_field" => $this->getRequest()->getParam('recaptcha_response_field')
125
  );
126
 
127
- $signupresult = Zend_Json::decode(Mage::helper('chat')->doPostRequest(Diglin_Chat_Helper_Data::ZOPIM_SIGNUP_URL, $createdata, $zopimObject->getUseSsl()));
128
  if (isset($signupresult["error"])) {
129
  $error["auth"] = $this->__("Error during activation: <b>" . $signupresult["error"] . "</b> Please try again.");
130
  } else if (isset($signupresult["account_key"])) {
@@ -137,14 +112,13 @@ class Diglin_Chat_Adminhtml_IndexController extends Mage_Adminhtml_Controller_Ac
137
  $error["auth"] = $this->__("<b>Could not activate account. The Magento installation was unable to contact Zopim servers. Please check with your server administrator to ensure that <a href='http://www.php.net/manual/en/book.curl.php'>PHP Curl</a> is installed and permissions are set correctly.</b>");
138
  }
139
  }
140
- //$this->_zmodel->save();
141
 
142
  if ($zopimObject->getKey() != "" && $zopimObject->getKey() != "zopim") {
143
 
144
  if (isset($account)) {
145
  $accountDetails = $account;
146
  } else {
147
- $accountDetails = Zend_Json::decode(Mage::helper('chat')->doPostRequest(Diglin_Chat_Helper_Data::ZOPIM_GETACCOUNTDETAILS_URL, array("salt" => $zopimObject->getSalt()), $zopimObject->getUseSsl()));
148
  }
149
 
150
  if (!isset($accountDetails) || isset($accountDetails["error"])) {
@@ -202,7 +176,6 @@ class Diglin_Chat_Adminhtml_IndexController extends Mage_Adminhtml_Controller_Ac
202
  $config->saveConfig('chat/chatconfig/key', $zopimObject->getKey(), 'default', 0);
203
  $config->saveConfig('chat/chatconfig/username', $zopimObject->getUsername(), 'default', 0);
204
  $config->saveConfig('chat/chatconfig/salt', $zopimObject->getSalt(), 'default', 0);
205
- $config->saveConfig('chat/chatconfig/use_ssl', $zopimObject->getUseSsl(), 'default', 0);
206
 
207
  Mage::app()->cleanCache(array(Mage_Core_Model_Config::CACHE_TAG));
208
 
22
  $this->_forward('account');
23
  }
24
 
 
 
 
25
  public function dashboardAction()
26
  {
27
  // @deprecated for security reason on Zopim side, we forward to
 
28
  $this->_redirectUrl(Diglin_Chat_Helper_Data::ZOPIM_DASHBOARD_URL);
29
  }
30
 
31
  /**
32
  * Code partially taken from the old Zopim Live Chat Module
33
+ * A lot has been improved but can still better be improved
34
  * @todo split into several actions if possible
35
  */
36
  public function accountAction()
42
  $key = Mage::getStoreConfig('chat/chatconfig/key');
43
  $username = Mage::getStoreConfig('chat/chatconfig/username');
44
  $salt = Mage::getStoreConfig('chat/chatconfig/salt');
 
45
 
46
  $zopimObject = new Varien_Object(array(
47
  'key' => $key,
48
  'username' => $username,
49
+ 'salt' => $salt
 
50
  ));
51
 
52
  $error = array();
57
  $zopimObject->setKey('zopim');
58
  } else if ($this->getRequest()->getParam('zopimusername') != "") {
59
  // logging in
 
 
 
 
 
 
60
  $zopimusername = $this->getRequest()->getParam('zopimusername');
61
  $zopimpassword = $this->getRequest()->getParam('zopimpassword');
62
 
65
  "password" => $zopimpassword
66
  );
67
 
68
+ $loginresult = Zend_Json::decode(Mage::helper('chat')->doPostRequest(Diglin_Chat_Helper_Data::ZOPIM_LOGIN_URL, $logindata));
 
 
69
 
70
  if (isset($loginresult["error"])) {
71
  $error["login"] = $this->__("<b>Could not log in to Zopim. Please check your login details. If problem persists, try connecting without SSL enabled.</b>");
76
  $zopimObject->setUsername($zopimusername);
77
  $zopimObject->setSalt($loginresult["salt"]);
78
 
79
+ $account = Zend_Json::decode(Mage::helper('chat')->doPostRequest(Diglin_Chat_Helper_Data::ZOPIM_GETACCOUNTDETAILS_URL, array("salt" => $loginresult["salt"])));
 
 
80
 
81
  if (isset($account)) {
82
  $zopimObject->setKey($account["account_key"]);
 
 
 
83
  }
84
  } else {
85
  $zopimObject->setSalt(null);
87
  }
88
  } else if ($this->getRequest()->getParam('zopimfirstname') != "") {
89
 
 
 
 
 
 
 
90
  $createdata = array(
91
  "email" => $this->getRequest()->getParam('zopimnewemail'),
92
  "first_name" => $this->getRequest()->getParam('zopimfirstname'),
99
  "recaptcha_response_field" => $this->getRequest()->getParam('recaptcha_response_field')
100
  );
101
 
102
+ $signupresult = Zend_Json::decode(Mage::helper('chat')->doPostRequest(Diglin_Chat_Helper_Data::ZOPIM_SIGNUP_URL, $createdata));
103
  if (isset($signupresult["error"])) {
104
  $error["auth"] = $this->__("Error during activation: <b>" . $signupresult["error"] . "</b> Please try again.");
105
  } else if (isset($signupresult["account_key"])) {
112
  $error["auth"] = $this->__("<b>Could not activate account. The Magento installation was unable to contact Zopim servers. Please check with your server administrator to ensure that <a href='http://www.php.net/manual/en/book.curl.php'>PHP Curl</a> is installed and permissions are set correctly.</b>");
113
  }
114
  }
 
115
 
116
  if ($zopimObject->getKey() != "" && $zopimObject->getKey() != "zopim") {
117
 
118
  if (isset($account)) {
119
  $accountDetails = $account;
120
  } else {
121
+ $accountDetails = Zend_Json::decode(Mage::helper('chat')->doPostRequest(Diglin_Chat_Helper_Data::ZOPIM_GETACCOUNTDETAILS_URL, array("salt" => $zopimObject->getSalt())));
122
  }
123
 
124
  if (!isset($accountDetails) || isset($accountDetails["error"])) {
176
  $config->saveConfig('chat/chatconfig/key', $zopimObject->getKey(), 'default', 0);
177
  $config->saveConfig('chat/chatconfig/username', $zopimObject->getUsername(), 'default', 0);
178
  $config->saveConfig('chat/chatconfig/salt', $zopimObject->getSalt(), 'default', 0);
 
179
 
180
  Mage::app()->cleanCache(array(Mage_Core_Model_Config::CACHE_TAG));
181
 
app/code/community/Diglin/Chat/etc/adminhtml.xml CHANGED
@@ -18,27 +18,31 @@
18
  -->
19
  <config>
20
  <menu>
21
- <chat translate="title" module="chat">
22
- <title>Zopim Live Chat</title>
23
- <sort_order>1000</sort_order>
24
  <children>
25
- <dashboard translate="title" module="chat">
26
- <title>Zopim Dashboard</title>
27
- <action>chat/index/dashboard</action>
28
- <sort_order>10</sort_order>
29
- </dashboard>
30
- <account translate="title" module="chat">
31
- <title>Account Setup</title>
32
- <action>chat/index/account</action>
33
- <sort_order>20</sort_order>
34
- </account>
35
- <config>
36
- <title>Configuration</title>
37
- <action>adminhtml/system_config/edit/section/chat</action>
38
- <sort_order>30</sort_order>
39
- </config>
 
 
 
 
 
 
40
  </children>
41
- </chat>
42
  </menu>
43
  <acl>
44
  <resources>
@@ -58,20 +62,24 @@
58
  </config>
59
  </children>
60
  </system>
61
- <chat translate="title" module="chat">
62
- <title>Zopim Live Chat by Diglin GmbH</title>
63
  <children>
64
- <dashboard translate="title" module="chat">
65
- <title>Dashboard</title>
66
- </dashboard>
67
- <account translate="title" module="chat">
68
- <title>Account Setup</title>
69
- </account>
70
- <config translate="title" module="chat">
71
- <title>Configuration</title>
72
- </config>
 
 
 
 
 
73
  </children>
74
- </chat>
75
  </children>
76
  </admin>
77
  </resources>
18
  -->
19
  <config>
20
  <menu>
21
+ <customer>
 
 
22
  <children>
23
+ <chat translate="title" module="chat">
24
+ <title>Zopim Live Chat</title>
25
+ <sort_order>1000</sort_order>
26
+ <children>
27
+ <dashboard translate="title" module="chat">
28
+ <title>Zopim Dashboard</title>
29
+ <action>chat/index/dashboard</action>
30
+ <sort_order>10</sort_order>
31
+ </dashboard>
32
+ <account translate="title" module="chat">
33
+ <title>Account Setup</title>
34
+ <action>chat/index/account</action>
35
+ <sort_order>20</sort_order>
36
+ </account>
37
+ <config>
38
+ <title>Configuration</title>
39
+ <action>adminhtml/system_config/edit/section/chat</action>
40
+ <sort_order>30</sort_order>
41
+ </config>
42
+ </children>
43
+ </chat>
44
  </children>
45
+ </customer>
46
  </menu>
47
  <acl>
48
  <resources>
62
  </config>
63
  </children>
64
  </system>
65
+ <customer>
 
66
  <children>
67
+ <chat translate="title" module="chat">
68
+ <title>Zopim Live Chat by Diglin GmbH</title>
69
+ <children>
70
+ <dashboard translate="title" module="chat">
71
+ <title>Dashboard</title>
72
+ </dashboard>
73
+ <account translate="title" module="chat">
74
+ <title>Account Setup</title>
75
+ </account>
76
+ <config translate="title" module="chat">
77
+ <title>Configuration</title>
78
+ </config>
79
+ </children>
80
+ </chat>
81
  </children>
82
+ </customer>
83
  </children>
84
  </admin>
85
  </resources>
app/code/community/Diglin/Chat/etc/config.xml CHANGED
@@ -19,10 +19,10 @@
19
  <config>
20
  <modules>
21
  <Diglin_Chat>
22
- <version>2.0.4</version>
23
  </Diglin_Chat>
24
  </modules>
25
-
26
  <default>
27
  <chat>
28
  <chatconfig>
@@ -33,8 +33,9 @@
33
  <widget>classic</widget>
34
  <disable_sound>0</disable_sound>
35
  <debug>0</debug>
 
 
36
  <!-- values used internally, keep it here as references -->
37
- <use_ssl>1</use_ssl>
38
  <salt/>
39
  <key/>
40
  <username/>
19
  <config>
20
  <modules>
21
  <Diglin_Chat>
22
+ <version>2.0.6</version>
23
  </Diglin_Chat>
24
  </modules>
25
+
26
  <default>
27
  <chat>
28
  <chatconfig>
33
  <widget>classic</widget>
34
  <disable_sound>0</disable_sound>
35
  <debug>0</debug>
36
+ <stats>1</stats>
37
+ <appid>xmx5ec9n</appid>
38
  <!-- values used internally, keep it here as references -->
 
39
  <salt/>
40
  <key/>
41
  <username/>
app/design/adminhtml/default/default/layout/chat.xml CHANGED
@@ -21,15 +21,11 @@
21
  <reference name="head">
22
  <action method="addCss"><file>zopim/zopim.css</file></action>
23
  </reference>
 
 
 
24
  </adminhtml_system_config_edit>
25
 
26
- <!-- Deprecated for security policy on Zopim side -->
27
- <!--<chat_index_dashboard>-->
28
- <!--<reference name="content">-->
29
- <!--<block type="chat/adminhtml_dashboard" name="zopim_dashboard" as="zopim.dashboard" template="chat/dashboard.phtml" />-->
30
- <!--</reference>-->
31
- <!--</chat_index_dashboard>-->
32
-
33
  <chat_index_account>
34
  <reference name="head">
35
  <action method="addCss"><file>zopim/zopim.css</file></action>
@@ -37,5 +33,8 @@
37
  <reference name="content">
38
  <block type="adminhtml/abstract" name="zopim_account" as="zopim.account" template="chat/account.phtml" />
39
  </reference>
 
 
 
40
  </chat_index_account>
41
  </layout>
21
  <reference name="head">
22
  <action method="addCss"><file>zopim/zopim.css</file></action>
23
  </reference>
24
+ <reference name="before_body_end">
25
+ <block type="adminhtml/template" name="footer_chat" as="footer_chat" template="chat/footer.phtml"/>
26
+ </reference>
27
  </adminhtml_system_config_edit>
28
 
 
 
 
 
 
 
 
29
  <chat_index_account>
30
  <reference name="head">
31
  <action method="addCss"><file>zopim/zopim.css</file></action>
33
  <reference name="content">
34
  <block type="adminhtml/abstract" name="zopim_account" as="zopim.account" template="chat/account.phtml" />
35
  </reference>
36
+ <reference name="before_body_end">
37
+ <block type="adminhtml/template" name="footer_chat" as="footer_chat" template="chat/footer.phtml"/>
38
+ </reference>
39
  </chat_index_account>
40
  </layout>
app/design/adminhtml/default/default/template/chat/account.phtml CHANGED
@@ -98,10 +98,6 @@ if ($this->getIsAuthenticated()) {
98
  <td class="label" style="width:180px;"><?php echo $this->__('Zopim password'); ?></td>
99
  <td class="value"><input class=" input" style="width:200px;padding:2px;" type="password" name="zopimpassword" /></td>
100
  </tr>
101
- <tr>
102
- <td class="label" style="width:180px;"><?php echo $this->__('Use SSL'); ?></td>
103
- <td class="value"><input type="checkbox" name="zopimusessl" value="zopimusessl" checked><?php echo $this->__('Uncheck this if you are unable to login'); ?></td>
104
- </tr>
105
  </tbody>
106
  </table>
107
  </div>
@@ -141,10 +137,6 @@ if ($this->getIsAuthenticated()) {
141
  <td class="label" style="width:180px;"><?php echo $this->__('E-mail'); ?></td>
142
  <td class="value"><input class=" input" style="width:200px;padding:2px;" type="text" id="zopimnewemail" name="zopimnewemail" value="<?php echo $this->getRequest()->getParam('zopimnewemail'); ?>" /></td>
143
  </tr>
144
- <tr>
145
- <td class="label" style="width:180px;"><?php echo $this->__('Use SSL'); ?></td>
146
- <td class="value"><input type="checkbox" name="zopimUseSSL" value="zopimUseSSL" checked><?php echo $this->__('Uncheck this if you are unable to login'); ?></td>
147
- </tr>
148
  <tr>
149
  <td class="label" style="width:180px;"><?php echo $this->__('Verification'); ?></td>
150
  <td class="value">
98
  <td class="label" style="width:180px;"><?php echo $this->__('Zopim password'); ?></td>
99
  <td class="value"><input class=" input" style="width:200px;padding:2px;" type="password" name="zopimpassword" /></td>
100
  </tr>
 
 
 
 
101
  </tbody>
102
  </table>
103
  </div>
137
  <td class="label" style="width:180px;"><?php echo $this->__('E-mail'); ?></td>
138
  <td class="value"><input class=" input" style="width:200px;padding:2px;" type="text" id="zopimnewemail" name="zopimnewemail" value="<?php echo $this->getRequest()->getParam('zopimnewemail'); ?>" /></td>
139
  </tr>
 
 
 
 
140
  <tr>
141
  <td class="label" style="width:180px;"><?php echo $this->__('Verification'); ?></td>
142
  <td class="value">
app/design/adminhtml/default/default/template/chat/footer.phtml ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin GmbH - Switzerland
4
+ *
5
+ * @author Sylvain Rayé <sylvain.raye at diglin.com>
6
+ * @category magento
7
+ * @package magento
8
+ * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com)
9
+ */
10
+
11
+ /* @var $this Mage_Core_Block_Template */
12
+
13
+ $user = Mage::getSingleton('admin/session')->getUser();
14
+ $isEnabled = Mage::getStoreConfigFlag('chat/chatconfig/stats');
15
+ $appid = Mage::getStoreConfig('chat/chatconfig/appid');
16
+
17
+ if ($isEnabled && $user && $user->getUsername()): ?>
18
+ <script>
19
+ window.intercomSettings = {
20
+ name: "<?php echo $user->getFirstname() . ' ' . $user->getLastname(); ?>",
21
+ email: "<?php echo $user->getEmail(); ?>",
22
+ created_at: <?php echo strtotime($user->getCreated()); ?>,
23
+ app_id: "<?php echo $appid ?>"
24
+ };
25
+ </script>
26
+ <script>(function(){var w=window;var ic=w.Intercom;if(typeof ic==="function"){ic('reattach_activator');ic('update',intercomSettings);}else{var d=document;var i=function(){i.c(arguments)};i.q=[];i.c=function(args){i.q.push(args)};w.Intercom=i;function l(){var s=d.createElement('script');s.type='text/javascript';s.async=true;s.src='https://widget.intercom.io/widget/<?php echo $appid ?>';var x=d.getElementsByTagName('script')[0];x.parentNode.insertBefore(s,x);}if(w.attachEvent){w.attachEvent('onload',l);}else{w.addEventListener('load',l,false);}}})()</script>
27
+ <?php endif; ?>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Diglin_Chat</name>
4
- <version>2.0.5</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
  <channel>community</channel>
@@ -84,16 +84,17 @@
84
  &lt;li&gt;Regarding Zopim Chat itself, please visit &lt;a href="http://bit.ly/1kcTNL5"&gt;http://www.zopim.com&lt;/a&gt;&lt;/li&gt;&#xD;
85
  &lt;li&gt;Code is available on &lt;a href="https://github.com/diglin/Diglin_Chat"&gt;Github&lt;/a&gt;&lt;/li&gt;&#xD;
86
  &lt;/ul&gt;</description>
87
- <notes>-2.0.5: Force SSL use while connecting to Zopim server to get account information&#xD;
 
88
  - 2.0.4: Fix cache issue&#xD;
89
  - 2.0.3 Update Zoppim Assets and add Cache Support&#xD;
90
  - 2.0.2: fix a bug on specific server configuration - &#xD;
91
  Zend_Log error fix&#xD;
92
  - 2.0.0: Complete new version - support of the new widget and API</notes>
93
  <authors><author><name>diglin</name><user>diglin</user><email>sly@diglin.com</email></author></authors>
94
- <date>2015-02-10</date>
95
- <time>18:25:21</time>
96
- <contents><target name="mageetc"><dir name="modules"><file name="Diglin_Chat.xml" hash="ff6f5a3e3492e983a02dfb93c55374ed"/></dir></target><target name="magecommunity"><dir name="Diglin"><dir name="Chat"><dir name="Block"><dir name="Adminhtml"><dir name="Config"><dir name="Source"><file name="Heading.php" hash="2f1fa69d19c2b2511a8170fb00dac9b6"/><file name="Hint.php" hash="26a36352dd1136a5a7ec531941d561e6"/></dir></dir><file name="Dashboard.php" hash="5a224b780670cbedc7aef26bdf25cd3d"/></dir><file name="Display.php" hash="f226d7ee803a1c8c904e274467eef350"/></dir><dir name="Helper"><file name="Data.php" hash="950122c6c6016762ff7bd53852f601e6"/></dir><dir name="Model"><dir name="Config"><dir name="Source"><file name="Api.php" hash="f9f4caaa8264141ea360cee865ac6b6c"/><file name="Badgecolor.php" hash="0eb3a51b5a9474a812e3210b095b6d39"/><file name="Bubblecolor.php" hash="bfbc0ed8c2194a0829f11159e38adfaa"/><file name="Buttonposition.php" hash="30624e50b915e498414fcef34e331026"/><file name="Classicthemes.php" hash="6b7f014e233c805b46d5e5f9e00d829a"/><file name="Language.php" hash="6ad9435fa363314b1b8ee3fd33a15742"/><file name="Layout.php" hash="74ea999eb7ab4f27f5c5976f0ea3f135"/><file name="Mobileposition.php" hash="c81669ab6d0b13ae267fe6c2ae4bf988"/><file name="Showhide.php" hash="21e2ad8dae77450edd1d38a5f0a3b5a9"/><file name="Simpleadvanced.php" hash="b81a67776915105f76d2928d583110fd"/><file name="Themes.php" hash="ebac216acc267191fee31d812aac1d1f"/><file name="Windowposition.php" hash="39a6ae8a676b63baf8bd4b8bd7eff26f"/><file name="Windowsize.php" hash="a4c36b741aa23a2379568eeb009cdc2f"/></dir></dir><dir name="Resource"><file name="Setup.php" hash="9ed4d5c5e9c80184594799c7add3ccb9"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="IndexController.php" hash="a76d55d16281389971b2df2bd782e31d"/></dir></dir><dir name="data"><dir name="diglinchat_setup"><file name="data-upgrade-1.3.0-2.0.1.php" hash="1e875c4dc9865932b368c890a8d2c6e0"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="40344d7020df0b07de5e1d9b8dc40180"/><file name="config.xml" hash="4c4997c1703ce2991e24a6b34e39bc35"/><file name="system.xml" hash="5f3b4671ae5445369e9b09099418592f"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="chat.xml" hash="86637d1582ac19d8b1525ad231904cc6"/></dir><dir name="template"><dir name="chat"><file name="test.phtml" hash="6462d6f79dcfd02bd438dc1eba51056f"/><file name="widget.phtml" hash="ddd8dc659efde43ebf8d52abfc96fef2"/></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="chat.xml" hash="9db0217cb4f7670bc54b27645d846e7c"/></dir><dir name="template"><dir name="chat"><file name="account.phtml" hash="e0bf20e6bc31328b32a799c0b1d3797a"/><file name="dashboard.phtml" hash="3b9ad1e7855153f8e5de0f409cb99549"/></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="zopim"><file name="zopim.css" hash="2bbb9b1c17207654f53f8b0ef82c25e0"/></dir></dir></dir></dir></target></contents>
97
  <compatible/>
98
  <dependencies><required><php><min>5.2.9</min><max>6.0.0</max></php></required></dependencies>
99
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Diglin_Chat</name>
4
+ <version>2.0.6</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
  <channel>community</channel>
84
  &lt;li&gt;Regarding Zopim Chat itself, please visit &lt;a href="http://bit.ly/1kcTNL5"&gt;http://www.zopim.com&lt;/a&gt;&lt;/li&gt;&#xD;
85
  &lt;li&gt;Code is available on &lt;a href="https://github.com/diglin/Diglin_Chat"&gt;Github&lt;/a&gt;&lt;/li&gt;&#xD;
86
  &lt;/ul&gt;</description>
87
+ <notes>- 2.0.6: Change menu structure&#xD;
88
+ - 2.0.5: Force SSL use while connecting to Zopim server to get account information&#xD;
89
  - 2.0.4: Fix cache issue&#xD;
90
  - 2.0.3 Update Zoppim Assets and add Cache Support&#xD;
91
  - 2.0.2: fix a bug on specific server configuration - &#xD;
92
  Zend_Log error fix&#xD;
93
  - 2.0.0: Complete new version - support of the new widget and API</notes>
94
  <authors><author><name>diglin</name><user>diglin</user><email>sly@diglin.com</email></author></authors>
95
+ <date>2015-04-26</date>
96
+ <time>17:38:03</time>
97
+ <contents><target name="mageetc"><dir name="modules"><file name="Diglin_Chat.xml" hash="ff6f5a3e3492e983a02dfb93c55374ed"/></dir></target><target name="magecommunity"><dir name="Diglin"><dir name="Chat"><dir name="Block"><dir name="Adminhtml"><dir name="Config"><dir name="Source"><file name="Heading.php" hash="2f1fa69d19c2b2511a8170fb00dac9b6"/><file name="Hint.php" hash="2a86de04db2c894454d514d1936ca689"/></dir></dir><file name="Dashboard.php" hash="5a224b780670cbedc7aef26bdf25cd3d"/></dir><file name="Display.php" hash="f226d7ee803a1c8c904e274467eef350"/></dir><dir name="Helper"><file name="Data.php" hash="086ed2987d1904f5e4eda70b0d879857"/></dir><dir name="Model"><dir name="Config"><dir name="Source"><file name="Api.php" hash="f9f4caaa8264141ea360cee865ac6b6c"/><file name="Badgecolor.php" hash="0eb3a51b5a9474a812e3210b095b6d39"/><file name="Bubblecolor.php" hash="bfbc0ed8c2194a0829f11159e38adfaa"/><file name="Buttonposition.php" hash="30624e50b915e498414fcef34e331026"/><file name="Classicthemes.php" hash="6b7f014e233c805b46d5e5f9e00d829a"/><file name="Language.php" hash="6ad9435fa363314b1b8ee3fd33a15742"/><file name="Layout.php" hash="74ea999eb7ab4f27f5c5976f0ea3f135"/><file name="Mobileposition.php" hash="c81669ab6d0b13ae267fe6c2ae4bf988"/><file name="Showhide.php" hash="21e2ad8dae77450edd1d38a5f0a3b5a9"/><file name="Simpleadvanced.php" hash="b81a67776915105f76d2928d583110fd"/><file name="Themes.php" hash="ebac216acc267191fee31d812aac1d1f"/><file name="Windowposition.php" hash="39a6ae8a676b63baf8bd4b8bd7eff26f"/><file name="Windowsize.php" hash="a4c36b741aa23a2379568eeb009cdc2f"/></dir></dir><dir name="Resource"><file name="Setup.php" hash="9ed4d5c5e9c80184594799c7add3ccb9"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="IndexController.php" hash="338d88c022109f69f674ec544421e065"/></dir></dir><dir name="data"><dir name="diglinchat_setup"><file name="data-upgrade-1.3.0-2.0.1.php" hash="1e875c4dc9865932b368c890a8d2c6e0"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="0c1d0f8361e1a333cf56d95e8b3aaffd"/><file name="config.xml" hash="ee534ae4a3eff502858ddaaa09426a97"/><file name="system.xml" hash="5f3b4671ae5445369e9b09099418592f"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="chat.xml" hash="86637d1582ac19d8b1525ad231904cc6"/></dir><dir name="template"><dir name="chat"><file name="test.phtml" hash="6462d6f79dcfd02bd438dc1eba51056f"/><file name="widget.phtml" hash="ddd8dc659efde43ebf8d52abfc96fef2"/></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="chat.xml" hash="bc38588dbbf0ff83434b07aa22c4401b"/></dir><dir name="template"><dir name="chat"><file name="account.phtml" hash="fb65e0216615095647f87e5e86523f53"/><file name="dashboard.phtml" hash="3b9ad1e7855153f8e5de0f409cb99549"/><file name="footer.phtml" hash="34bc2fcb61fefbb78d6df0830257d522"/></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="zopim"><file name="zopim.css" hash="2bbb9b1c17207654f53f8b0ef82c25e0"/></dir></dir></dir></dir></target></contents>
98
  <compatible/>
99
  <dependencies><required><php><min>5.2.9</min><max>6.0.0</max></php></required></dependencies>
100
  </package>