comm100_livechat - Version 2.0.3

Version Notes

First Public Release

Download this release

Release Info

Developer Quality Unit, LLC
Extension comm100_livechat
Version 2.0.3
Comparing to
See all releases


Code changes from version 2.0.1 to 2.0.3

app/code/community/Comm100/Livechat/controllers/Adminhtml/LivechatController.php CHANGED
@@ -116,79 +116,46 @@ class Comm100_Livechat_Adminhtml_LivechatController extends Mage_Adminhtml_Contr
116
  !isset($_POST['plan_id']) ? $plan_id = '0' : $plan_id = $_POST['plan_id'];
117
  !isset($_POST['plan_type']) ? $plan_type = '0' : $plan_type = $_POST['plan_type'];
118
  !isset($_POST['site_id']) ? $site_id = '0' : $site_id = $_POST['site_id'];
 
 
 
119
 
120
  //decode
121
  $email = urldecode($email);
122
 
123
- Mage::log('$site_id='.$site_id.'$plan_id='.$plan_id, null, "comm100.log");
124
 
125
- $this->updateConfigData($email,$password,$site_id,$plan_id,$plan_type);
126
 
127
  }
128
 
129
- private function updateConfigData($email,$password,$site_id,$plan_id,$plan_type)
130
  {
131
  try
132
  {
133
  $config_table = Mage::getSingleton('core/resource')->getTableName('core_config_data');
134
  Mage::log('$config_table is '.$config_table, null, "comm100.log");
135
- $read = Mage::getSingleton('core/resource')->getConnection('core_read');
136
- $query = 'SELECT * FROM ' . $config_table;
137
- $query .= ' WHERE scope="default" AND scope_id=0 AND path="comm100/general/planid" ';
138
- $results = $read->fetchAll($query);
139
-
140
  $write = Mage::getSingleton('core/resource')->getConnection('core_write');
141
-
142
- //check for existing configurations
143
- if ($row = array_pop($results)) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
144
 
145
- $config_id = $row['config_id'];
146
-
147
- Mage::log('exist config siteid is '.$config_id, null, "comm100.log");
148
-
149
- $query = 'UPDATE ' . $config_table;
150
- $query .= ' SET value="' . $plan_id . '"';
151
- $query .= ' WHERE config_id=' . $config_id;
152
- $write->query($query);
153
-
154
- $query = 'UPDATE ' . $config_table;
155
- $query .= ' SET value="' . $plan_type . '"';
156
- $query .= ' WHERE config_id=' . ++$config_id;
157
- $write->query($query);
158
-
159
- $query = 'UPDATE ' . $config_table;
160
- $query .= ' SET value="' . $site_id . '"';
161
- $query .= ' WHERE config_id=' . ++$config_id;
162
- $write->query($query);
163
-
164
- $query = 'UPDATE ' . $config_table;
165
- $query .= ' SET value="' . $email . '"';
166
- $query .= ' WHERE config_id=' . ++$config_id;
167
- $write->query($query);
168
-
169
- $query = 'UPDATE ' . $config_table;
170
- $query .= ' SET value="' . $password . '"';
171
- $query .= ' WHERE config_id=' . ++$config_id;
172
- $write->query($query);
173
-
174
- $query = 'UPDATE ' . $config_table;
175
- $query .= ' SET value=""';
176
- $query .= ' WHERE config_id=' . ++$config_id;
177
- $write->query($query);
178
- } else {
179
-
180
- Mage::log('no exist config ', null, "comm100.log");
181
-
182
- $query = 'INSERT INTO ' . $config_table;
183
- $query .= ' (scope, scope_id, path, value)';
184
- $query .= ' VALUES ("default", 0, "comm100/general/planid", "' . $plan_id . '"),';
185
- $query .= ' ("default", 0, "comm100/general/plantype", "'. $plan_type .'"),';
186
- $query .= ' ("default", 0, "comm100/general/siteid", "'. $site_id .'"),';
187
- $query .= ' ("default", 0, "comm100/general/email", "'. $email .'"),';
188
- $query .= ' ("default", 0, "comm100/general/password", "'. $password .'"),';
189
- $query .= ' ("default", 0, "comm100/general/code", "")';
190
- $write->query($query);
191
- }
192
  }
193
  catch(Exception $ex)
194
  {
116
  !isset($_POST['plan_id']) ? $plan_id = '0' : $plan_id = $_POST['plan_id'];
117
  !isset($_POST['plan_type']) ? $plan_type = '0' : $plan_type = $_POST['plan_type'];
118
  !isset($_POST['site_id']) ? $site_id = '0' : $site_id = $_POST['site_id'];
119
+ !isset($_POST['cpanel_domain']) ? $cpanel_domain = '' : $cpanel_domain = $_POST['cpanel_domain'];
120
+ !isset($_POST['main_chatserver_domain']) ? $main_chatserver_domain = '' : $main_chatserver_domain = $_POST['main_chatserver_domain'];
121
+ !isset($_POST['standby_chatserver_domain']) ? $standby_chatserver_domain = '' : $standby_chatserver_domain = $_POST['standby_chatserver_domain'];
122
 
123
  //decode
124
  $email = urldecode($email);
125
 
126
+ Mage::log('$cpanel_domain='.$cpanel_domain.'$main_chatserver_domain='.$main_chatserver_domain.'$standby_chatserver_domain='.$standby_chatserver_domain, null, "comm100.log");
127
 
128
+ $this->updateConfigData($email,$password,$site_id,$plan_id,$plan_type,$cpanel_domain,$main_chatserver_domain,$standby_chatserver_domain);
129
 
130
  }
131
 
132
+ private function updateConfigData($email,$password,$site_id,$plan_id,$plan_type,$cpanel_domain,$main_chatserver_domain,$standby_chatserver_domain)
133
  {
134
  try
135
  {
136
  $config_table = Mage::getSingleton('core/resource')->getTableName('core_config_data');
137
  Mage::log('$config_table is '.$config_table, null, "comm100.log");
 
 
 
 
 
138
  $write = Mage::getSingleton('core/resource')->getConnection('core_write');
139
+ $query = 'delete FROM ' . $config_table;
140
+ $query .= ' WHERE scope="default" AND scope_id=0 AND path like "%comm100/general/%" ';
141
+ $write->query($query);
142
+
143
+ $query = 'INSERT INTO ' . $config_table;
144
+ $query .= ' (scope, scope_id, path, value)';
145
+ $query .= ' VALUES ("default", 0, "comm100/general/planid", "' . $plan_id . '"),';
146
+ $query .= ' ("default", 0, "comm100/general/plantype", "'. $plan_type .'"),';
147
+ $query .= ' ("default", 0, "comm100/general/siteid", "'. $site_id .'"),';
148
+ $query .= ' ("default", 0, "comm100/general/email", "'. $email .'"),';
149
+ $query .= ' ("default", 0, "comm100/general/password", "'. $password .'"),';
150
+ $query .= ' ("default", 0, "comm100/general/code", ""), ';
151
+ $query .= ' ("default", 0, "comm100/general/cpanel_domain","'. $cpanel_domain .'"),';
152
+ $query .= ' ("default", 0, "comm100/general/main_chatserver_domain", "'. $main_chatserver_domain .'"),';
153
+ $query .= ' ("default", 0, "comm100/general/standby_chatserver_domain", "'. $standby_chatserver_domain .'")';
154
+ $write->query($query);
155
+
156
+ //clear cache
157
+ Mage::app()->cleanCache();
158
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
159
  }
160
  catch(Exception $ex)
161
  {
app/design/adminhtml/default/default/template/comm100/livechat_config.phtml CHANGED
@@ -6,7 +6,6 @@ font-weight: 400;
6
  margin-bottom: 20px;
7
  }
8
  </style>
9
- <script src="https://hosted.comm100.com/AdminPluginService/livechatplugin.ashx?action=session" type="text/javascript"></script>
10
  <script type="text/javascript" src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS); ?>comm100/jquery-1.7.2.min.js"></script>
11
  <script src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS); ?>comm100/plugin.js" type="text/javascript"></script>
12
  <script type="text/javascript">
@@ -18,6 +17,7 @@ margin-bottom: 20px;
18
  <script type="text/javascript">
19
  jQuery(document).ready(function(){
20
  checkExpire();
 
21
  });
22
 
23
  function checkExpire()
@@ -29,7 +29,7 @@ function checkExpire()
29
  <div id="comm100livechat_guide">
30
  <div id="comm100livechat_expire" style="display:none;">
31
  <div class="notification-global" style="magin-left:5px;">
32
- Your free trial has expired. <strong><a href="https://hosted.comm100.com/Billing/Client/Plan/ChooseLiveChat.aspx?siteid=<?php echo Mage::getStoreConfig('comm100/general/siteid') ?>" target="_blank">Buy Now</a></strong>
33
  </div>
34
  <div style="margin-top:18px;"></div>
35
  </div>
@@ -48,8 +48,9 @@ jQuery(document).ready(function(){
48
  <p>To install chat button on your page, you need to <strong>put
49
  the following code in your template</strong>:</p>
50
  <textarea id="chat_button_code" cols="50" rows="12" style="width: 589px; height: 143px;"
51
- readonly="readonly" onclick="this.select()"><!--Begin Comm100 Live Chat Code-->
52
- <div id="comm100-button-{codeplanid}"></div>
 
53
  <script type="text/javascript">
54
  var Comm100API = Comm100API || new Object;
55
  Comm100API.chat_buttons = Comm100API.chat_buttons || [];
@@ -59,14 +60,28 @@ the following code in your template</strong>:</p>
59
  Comm100API.chat_buttons.push(comm100_chatButton);
60
  Comm100API.site_id = {siteid};
61
  Comm100API.main_code_plan = {codeplanid};
 
62
  var comm100_lc = document.createElement('script');
63
  comm100_lc.type = 'text/javascript';
64
  comm100_lc.async = true;
65
- comm100_lc.src = 'https://chatserver.comm100.com/livechat.ashx?siteId=' + Comm100API.site_id;
66
  var comm100_s = document.getElementsByTagName('script')[0];
67
  comm100_s.parentNode.insertBefore(comm100_lc, comm100_s);
 
 
 
 
 
 
 
 
 
 
 
68
  </script>
69
- <!--End Comm100 Live Chat Code--></textarea>
 
 
70
  <p>Need help? Read more in <a
71
  href="http://www.comm100.com/livechat/KnowledgeBase/How-to-install-Comm100-Live-Chat-on-your-Magento-site-_A5000247.aspx?id=5000247"
72
  target="_blank">Comm100 live chat-Magento integration tutorial</a>.</p>
@@ -80,10 +95,10 @@ the following code in your template</strong>:</p>
80
  you can:</p>
81
  <p><a href="http://www.comm100.com/livechat/download.aspx"
82
  target="_blank">Download application</a> or <a
83
- href="https://hosted.comm100.com/livechat/visitormonitor.aspx?siteid=<?php echo Mage::getStoreConfig('comm100/general/siteid'); ?>"
84
  target="_blank">via web browser</a></p>
85
  <div style="margin-top:20px;"></div>
86
- <p>Customize your chat button, <a href="https://hosted.comm100.com/LiveChatFunc/CodePlan/ChatButton.aspx?ifEditPlan=true&codePlanId=<?php echo Mage::getStoreConfig('comm100/general/planid'); ?>&siteId=<?php echo Mage::getStoreConfig('comm100/general/siteid'); ?>" target="_blank">click here</a></p>
87
 
88
  <p>If you need help, free to <a href="http://www.comm100.com/company/contact.aspx" target="_blank">contact us</a></p>
89
 
@@ -128,7 +143,7 @@ you can:</p>
128
  </tr>
129
  <tr>
130
  <th scope="row"></th>
131
- <td><a href="https://hosted.comm100.com/Admin/ForgotPassword.aspx"
132
  target="_blank">Forgot password?</a></td>
133
  </tr>
134
  <tr>
@@ -175,8 +190,7 @@ accounts associated with this operator email. <br /> --> Link up your Comm100 a
175
  <button title="Link Up" type="button" class="scalable" onclick="onComm100Save();" id="save_account" style=""><span><span><span>Link Up</span></span></span></button>
176
  </td>
177
  </tr>
178
- </tbody></table></td>
179
- <td>
180
  <!-- preview image -->
181
 
182
  <div id="preViewImgBox">
@@ -238,20 +252,6 @@ When Operators Offline
238
  maxlength="70" /></td>
239
  </tr>
240
 
241
- <tr>
242
- <th scope="row"><label for="register_verification_code">Validation Code:</label></th>
243
- <td>
244
- <table>
245
- <tr>
246
- <td><input type="text" class="input-text"
247
- name="register_verification_code" id="register_verification_code"
248
- maxlength="70" /></td>
249
- <td><img src="" height="20px" onclick="setValidationCodeImage();" id="register_validation_img" /></td>
250
- </tr>
251
- </table>
252
- </td>
253
- </tr>
254
-
255
  <tr>
256
  <th></th>
257
  <td>
@@ -264,7 +264,7 @@ When Operators Offline
264
  </tr>
265
  <tr>
266
  <th></th>
267
- <td style="width:120px;">By clicking "Create Account",you agree to our <a href="https://hosted.comm100.com/Admin/help/Comm100-Agreement.htm" target="_blank">Service Agreement</a> and <a href="http://www.comm100.com/privacy/" target="_blank">Privacy Policy</a></td>
268
  </tr>
269
 
270
  </table></td>
@@ -298,6 +298,9 @@ When Operators Offline
298
  <input type="hidden" id="txt_site_id" name="site_id" value="<?php echo Mage::getStoreConfig('comm100/general/siteid');?>" />
299
  <input type="hidden" id="txt_actiontype" name="actiontype" value="link" />
300
  <input type="hidden" id="txt_plugin_version" value="2.0.1" name="plugin_version" />
 
 
 
301
  <input type="hidden" id="txt_plugin_check_url" name="plugin_check_url" value="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN); ?>adminhtml/base/default/images/comm100_logo.gif" />
302
  <input type="hidden" id="txt_install_flag" name="install_flag" value="<?php echo Mage::getStoreConfig('comm100/advanced/installflag') ?>" />
303
  </form>
6
  margin-bottom: 20px;
7
  }
8
  </style>
 
9
  <script type="text/javascript" src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS); ?>comm100/jquery-1.7.2.min.js"></script>
10
  <script src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS); ?>comm100/plugin.js" type="text/javascript"></script>
11
  <script type="text/javascript">
17
  <script type="text/javascript">
18
  jQuery(document).ready(function(){
19
  checkExpire();
20
+ //comm100_plugin.login();
21
  });
22
 
23
  function checkExpire()
29
  <div id="comm100livechat_guide">
30
  <div id="comm100livechat_expire" style="display:none;">
31
  <div class="notification-global" style="magin-left:5px;">
32
+ Your free trial has expired. <strong><a href="https://<?php echo Mage::getStoreConfig('comm100/general/cpanel_domain')?>/Billing/Client/Plan/ChooseLiveChat.aspx?siteid=<?php echo Mage::getStoreConfig('comm100/general/siteid') ?>" target="_blank">Buy Now</a></strong>
33
  </div>
34
  <div style="margin-top:18px;"></div>
35
  </div>
48
  <p>To install chat button on your page, you need to <strong>put
49
  the following code in your template</strong>:</p>
50
  <textarea id="chat_button_code" cols="50" rows="12" style="width: 589px; height: 143px;"
51
+ readonly="readonly" onclick="this.select()">
52
+ <!--Begin Comm100 Live Chat Code-->
53
+ <div id="comm100-button-{codeplanid}"></div>
54
  <script type="text/javascript">
55
  var Comm100API = Comm100API || new Object;
56
  Comm100API.chat_buttons = Comm100API.chat_buttons || [];
60
  Comm100API.chat_buttons.push(comm100_chatButton);
61
  Comm100API.site_id = {siteid};
62
  Comm100API.main_code_plan = {codeplanid};
63
+
64
  var comm100_lc = document.createElement('script');
65
  comm100_lc.type = 'text/javascript';
66
  comm100_lc.async = true;
67
+ comm100_lc.src = 'https://{main_chatserver_domain}/livechat.ashx?siteId=' + Comm100API.site_id;
68
  var comm100_s = document.getElementsByTagName('script')[0];
69
  comm100_s.parentNode.insertBefore(comm100_lc, comm100_s);
70
+
71
+ setTimeout(function() {
72
+ if (!Comm100API.loaded) {
73
+ var lc = document.createElement('script');
74
+ lc.type = 'text/javascript';
75
+ lc.async = true;
76
+ lc.src = 'https://{standby_chatserver_domain}/livechat.ashx?siteId=' + Comm100API.site_id;
77
+ var s = document.getElementsByTagName('script')[0];
78
+ s.parentNode.insertBefore(lc, s);
79
+ }
80
+ }, 5000)
81
  </script>
82
+ <!--End Comm100 Live Chat Code-->
83
+
84
+ </textarea>
85
  <p>Need help? Read more in <a
86
  href="http://www.comm100.com/livechat/KnowledgeBase/How-to-install-Comm100-Live-Chat-on-your-Magento-site-_A5000247.aspx?id=5000247"
87
  target="_blank">Comm100 live chat-Magento integration tutorial</a>.</p>
95
  you can:</p>
96
  <p><a href="http://www.comm100.com/livechat/download.aspx"
97
  target="_blank">Download application</a> or <a
98
+ href="https://<?php echo Mage::getStoreConfig('comm100/general/cpanel_domain')?>/livechat/visitormonitor.aspx?siteid=<?php echo Mage::getStoreConfig('comm100/general/siteid'); ?>"
99
  target="_blank">via web browser</a></p>
100
  <div style="margin-top:20px;"></div>
101
+ <p>Customize your chat button, <a href="https://<?php echo Mage::getStoreConfig('comm100/general/cpanel_domain')?>/LiveChatFunc/CodePlan/ChatButton.aspx?ifEditPlan=true&codePlanId=<?php echo Mage::getStoreConfig('comm100/general/planid'); ?>&siteId=<?php echo Mage::getStoreConfig('comm100/general/siteid'); ?>" target="_blank">click here</a></p>
102
 
103
  <p>If you need help, free to <a href="http://www.comm100.com/company/contact.aspx" target="_blank">contact us</a></p>
104
 
143
  </tr>
144
  <tr>
145
  <th scope="row"></th>
146
+ <td><a href="https://www.comm100.com/secure/forgotpassword.aspx"
147
  target="_blank">Forgot password?</a></td>
148
  </tr>
149
  <tr>
190
  <button title="Link Up" type="button" class="scalable" onclick="onComm100Save();" id="save_account" style=""><span><span><span>Link Up</span></span></span></button>
191
  </td>
192
  </tr>
193
+ </tbody></table></td><td>
 
194
  <!-- preview image -->
195
 
196
  <div id="preViewImgBox">
252
  maxlength="70" /></td>
253
  </tr>
254
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
255
  <tr>
256
  <th></th>
257
  <td>
264
  </tr>
265
  <tr>
266
  <th></th>
267
+ <td style="width:120px;">By clicking "Create Account",you agree to our <a href="http://www.comm100.com/help/Comm100-Agreement.htm" target="_blank">Service Agreement</a> and <a href="http://www.comm100.com/privacy/" target="_blank">Privacy Policy</a></td>
268
  </tr>
269
 
270
  </table></td>
298
  <input type="hidden" id="txt_site_id" name="site_id" value="<?php echo Mage::getStoreConfig('comm100/general/siteid');?>" />
299
  <input type="hidden" id="txt_actiontype" name="actiontype" value="link" />
300
  <input type="hidden" id="txt_plugin_version" value="2.0.1" name="plugin_version" />
301
+ <input type="hidden" id="txt_cpanel_domain" value="<?php echo Mage::getStoreConfig('comm100/general/cpanel_domain');?>" name="cpanel_domain" />
302
+ <input type="hidden" id="txt_main_chatserver_domain" value="<?php echo Mage::getStoreConfig('comm100/general/main_chatserver_domain');?>" name="main_chatserver_domain" />
303
+ <input type="hidden" id="txt_standby_chatserver_domain" value="<?php echo Mage::getStoreConfig('comm100/general/standby_chatserver_domain');?>" name="standby_chatserver_domain" />
304
  <input type="hidden" id="txt_plugin_check_url" name="plugin_check_url" value="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN); ?>adminhtml/base/default/images/comm100_logo.gif" />
305
  <input type="hidden" id="txt_install_flag" name="install_flag" value="<?php echo Mage::getStoreConfig('comm100/advanced/installflag') ?>" />
306
  </form>
app/design/frontend/default/default/template/comm100/livechat.phtml CHANGED
@@ -4,9 +4,11 @@
4
  var plan_id = <?php echo Mage::getStoreConfig('comm100/general/planid');?>;
5
  var site_id = <?php echo Mage::getStoreConfig('comm100/general/siteid'); ?>;
6
  var plan_type = <?php echo Mage::getStoreConfig('comm100/general/plantype'); ?>;
 
 
7
  </script>
8
  <!--Begin Comm100 Live Chat Code-->
9
- <div id="comm100-button-<?php echo Mage::getStoreConfig('comm100/general/planid');?>"></div>
10
  <script type="text/javascript">
11
  var Comm100API = Comm100API || new Object;
12
  Comm100API.chat_buttons = Comm100API.chat_buttons || [];
@@ -16,13 +18,28 @@ var plan_type = <?php echo Mage::getStoreConfig('comm100/general/plantype'); ?>;
16
  Comm100API.chat_buttons.push(comm100_chatButton);
17
  Comm100API.site_id = site_id;
18
  Comm100API.main_code_plan = plan_id;
 
19
  var comm100_lc = document.createElement('script');
20
  comm100_lc.type = 'text/javascript';
21
  comm100_lc.async = true;
22
- comm100_lc.src = 'https://chatserver.comm100.com/livechat.ashx?siteId=' + Comm100API.site_id;
23
  var comm100_s = document.getElementsByTagName('script')[0];
24
  comm100_s.parentNode.insertBefore(comm100_lc, comm100_s);
 
 
 
 
 
 
 
 
 
 
 
25
  </script>
26
  <!--End Comm100 Live Chat Code-->
27
  <?php endif; ?>
28
- <?php endif; ?>
 
 
 
4
  var plan_id = <?php echo Mage::getStoreConfig('comm100/general/planid');?>;
5
  var site_id = <?php echo Mage::getStoreConfig('comm100/general/siteid'); ?>;
6
  var plan_type = <?php echo Mage::getStoreConfig('comm100/general/plantype'); ?>;
7
+ var main_chatserver_domain = '<?php echo Mage::getStoreConfig('comm100/general/main_chatserver_domain'); ?>';
8
+ var standby_chatserver_domain = '<?php echo Mage::getStoreConfig('comm100/general/standby_chatserver_domain'); ?>';
9
  </script>
10
  <!--Begin Comm100 Live Chat Code-->
11
+ <div id="comm100-button-<?php echo Mage::getStoreConfig('comm100/general/planid');?>"></div>
12
  <script type="text/javascript">
13
  var Comm100API = Comm100API || new Object;
14
  Comm100API.chat_buttons = Comm100API.chat_buttons || [];
18
  Comm100API.chat_buttons.push(comm100_chatButton);
19
  Comm100API.site_id = site_id;
20
  Comm100API.main_code_plan = plan_id;
21
+
22
  var comm100_lc = document.createElement('script');
23
  comm100_lc.type = 'text/javascript';
24
  comm100_lc.async = true;
25
+ comm100_lc.src = 'https://'+main_chatserver_domain+'/livechat.ashx?siteId=' + Comm100API.site_id;
26
  var comm100_s = document.getElementsByTagName('script')[0];
27
  comm100_s.parentNode.insertBefore(comm100_lc, comm100_s);
28
+
29
+ setTimeout(function() {
30
+ if (!Comm100API.loaded) {
31
+ var lc = document.createElement('script');
32
+ lc.type = 'text/javascript';
33
+ lc.async = true;
34
+ lc.src = 'https://'+standby_chatserver_domain+'/livechat.ashx?siteId=' + Comm100API.site_id;
35
+ var s = document.getElementsByTagName('script')[0];
36
+ s.parentNode.insertBefore(lc, s);
37
+ }
38
+ }, 5000)
39
  </script>
40
  <!--End Comm100 Live Chat Code-->
41
  <?php endif; ?>
42
+ <?php endif; ?>
43
+
44
+
45
+
js/comm100/plugin.js CHANGED
@@ -28,22 +28,71 @@ var comm100livechat_login = 'comm100livechat_login';
28
  //register div id
29
  var comm100livechat_register = 'comm100livechat_register';
30
 
 
 
 
 
 
31
  String.prototype.trim = function()
32
  {
33
  return this.replace(/(^[\s]*)|([\s]*$)/g, "");
34
  }
35
 
 
 
 
36
  function html_encode(html) {
37
  var div=document.createElement("div");
38
  var txt=document.createTextNode(html);
39
  div.appendChild(txt);
40
  return div.innerHTML;
41
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
 
43
- if (typeof comm100_script_id == 'undefined')
44
- comm100_script_id = 0;
45
-
46
- function comm100_script_request(params, success, error) {
 
 
 
47
  function request() {
48
  var _id = 'comm100_script_' + comm100_script_id++;
49
  var _success;
@@ -60,12 +109,11 @@ function comm100_script_request(params, success, error) {
60
  _append_script(_id, url + '&callback=' + _id + '.onresponse');
61
  _timer_timeout = setTimeout(function() {
62
  if (error) error('Operation timeout.');
63
- }, 60 * 1000);
64
 
65
  _success = success || function() {};
66
  }
67
  this.onresponse = function _onresponse(response) {
68
- //alert(response.toString())��
69
  window[_id] = null;
70
  var scr = document.getElementById('_' + _id);
71
  document.getElementsByTagName('head')[0].removeChild(scr);
@@ -79,12 +127,31 @@ function comm100_script_request(params, success, error) {
79
 
80
  var req = new request();
81
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
82
  if(typeof comm100livechat_session == null) {
83
  setTimeout(function() {
84
- req.send('https://hosted.comm100.com/AdminPluginService/(S(' + comm100livechat_session + '))/livechatplugin.ashx' + params, success, error);
85
  }, 1000);
86
  } else {
87
- req.send('https://hosted.comm100.com/AdminPluginService/(S(' + comm100livechat_session + '))/livechatplugin.ashx' + params, success, error);
88
  }
89
  }
90
 
@@ -128,7 +195,7 @@ var comm100_plugin = (function() {
128
  var website = document.getElementById('register_website').value;
129
  var ip = document.getElementById('register_ip').value;
130
  var timezone = _get_timezone();
131
- var verification_code = document.getElementById('register_verification_code').value;
132
  var referrer = window.location.href;
133
 
134
  if(email=='')
@@ -168,10 +235,11 @@ var comm100_plugin = (function() {
168
  website = encodeURIComponent(website);
169
  ip = encodeURIComponent(ip);
170
  timezone = encodeURIComponent(timezone);
171
- verification_code = encodeURIComponent(verification_code);
 
172
  referrer = encodeURIComponent(referrer);
173
 
174
- comm100_script_request('?action=register&float_button=true&edition=' + edition + '&name=' + name + '&email=' + email +
175
  '&password=' + password + '&phone=' + phone + '&website=' + website + '&ip=' + ip + '&timezone=' + timezone + '&verificationCode=' + verification_code + '&referrer=' + referrer
176
  + '&source=' + source
177
  , function(response) {
@@ -183,12 +251,11 @@ var comm100_plugin = (function() {
183
  }
184
  else {
185
  showErrorMessage(response.error);
186
- setValidationCodeImage();
187
  }
188
 
189
- }, function(message) {
190
  document.getElementById(register_submit).disabled = false;
191
- showErrorMessage(response.error);
192
  });
193
  }
194
 
@@ -201,42 +268,53 @@ var comm100_plugin = (function() {
201
  return 2; //others, need widget
202
  }
203
  }
 
204
  function _login(success, error) {
205
- var email = encodeURIComponent(document.getElementById('login_email').value);
206
- var password = encodeURIComponent(document.getElementById('login_password').value);
207
  var timezone = encodeURIComponent(_get_timezone());
208
-
209
  var site_id = encodeURIComponent(document.getElementById('txt_site_id').value.trim());
210
- document.getElementById('txt_email').value = document.getElementById('login_email').value;
211
- document.getElementById('txt_password').value = document.getElementById('login_password').value;
212
-
213
- comm100_script_request('?action=login&siteId=' + site_id + '&email=' + email + '&password=' + password
214
  , function(response) {
215
- if(response.success) {
216
- _get_plans(site_id, function(response) {
217
- var plans = response;
218
- if (plans.length == 1 && jQuery("#comm100_sites_select option").length==1 ) {
219
- //set plan and go to next step
220
- jQuery("#txt_plan_id").val(plans[0].id);
221
- jQuery("#txt_plan_type").val(_get_plan_type(plans[0]));
222
- jQuery("#comm100_loading").hide();
223
- var src = jQuery("#comm100_loading img:first").attr("src");
224
- jQuery("#"+comm100livechat_site_and_plan).html("Linking up...<img src='" + src + "' />");
225
- onComm100Save();
226
- } else {
227
- _show_plans(plans);
228
- }
229
- });
230
- }
231
- else {
232
- error(response.error);
233
- }
 
 
 
 
 
 
 
 
 
 
 
 
234
  }, function(message) {
235
- error(response.message);
236
  });
237
  }
 
238
  function _get_plans(site_id, success, error) {
239
- comm100_script_request('?action=plans&siteId=' + site_id, function(response) {
240
  if(response.error) {
241
  if (typeof error != 'undefined')
242
  error('Comm100 Live Chat is not added to your site yet as you haven\'t linked up any Comm100 account.<br/><a href="admin.php?page=comm100livechat_settings">Link Up your account now</a> and start chatting with your visitors.');
@@ -303,6 +381,7 @@ var comm100_plugin = (function() {
303
  {
304
  jQuery("#txt_plan_id").val(planid);
305
  jQuery("#txt_plan_type").val(plantype);
 
306
  if(button_type==0)
307
  {
308
  if(img_online_id == 0 && img_online_url=="")
@@ -312,8 +391,9 @@ var comm100_plugin = (function() {
312
  }
313
 
314
  var siteid = jQuery("#txt_site_id").val();
315
- var img_online = "https://chatserver.comm100.com/DBResource/DBImage.ashx?imgId="+img_online_id+"&type="+img_type+"&siteId="+siteid;
316
- var img_offline = "https://chatserver.comm100.com/DBResource/DBImage.ashx?imgId="+img_offline_id+"&type="+img_type+"&siteId="+siteid;
 
317
  if(img_type==0)
318
  {
319
  img_online = img_online_url;
@@ -350,12 +430,12 @@ var comm100_plugin = (function() {
350
  }
351
 
352
  function _get_code(site_id, plan_id, callback) {
353
- comm100_script_request('?action=code&siteId=' + site_id + '&planId=' + plan_id, function(response) {
354
  callback(response.response);
355
  });
356
  }
357
  function _get_editions(callback) {
358
- comm100_script_request('?action=editions', function(response) {
359
  callback(response.response);
360
  });
361
  }
@@ -391,38 +471,79 @@ var comm100_plugin = (function() {
391
  {
392
  defaultSelectSiteId = s.id;
393
  }
394
- selSitesObj.append("<option value='"+s.id+"'>"+s.id+"</option>");
 
395
  }
396
 
397
  selSitesObj.change(function(){
398
  showLoadingBar(save_account);
399
- var siteid = jQuery(this).children('option:selected').val();
 
400
  jQuery("#txt_site_id").val(siteid);
401
- _login(function () {
402
- hideLoadingBar();
403
- }, function (error) {
404
- showErrorMessage(error);
405
- })
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
406
  });
407
 
408
  showLoadingBar(save_account);
409
  jQuery("#txt_site_id").val(defaultSelectSiteId);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
410
  _login(function () {
411
- hideLoadingBar();
412
  }, function (error) {
413
-
414
- showErrorMessage(error);
415
- })
416
-
417
  //document.getElementById('num_sites').innerHTML = sites.length;
418
  }
419
 
420
  function _sitesNoStep(email,password)
421
  {
422
- comm100_script_request('?action=sites&email='+email+'&password='+password+'&timezoneoffset='+(new Date()).getTimezoneOffset(),
 
 
 
423
  function (response) {
424
  document.getElementById(login_submit).disabled = false;
425
  if (response.success) {
 
 
 
 
 
426
  var sites = response.response;
427
  if (sites.length == 0) {
428
  showErrorMessage('There is no site associate this account');
@@ -445,20 +566,46 @@ var comm100_plugin = (function() {
445
 
446
  var email = encodeURIComponent(document.getElementById('login_email').value);
447
  var password = encodeURIComponent(document.getElementById('login_password').value);
448
-
449
- comm100_script_request('?action=sites&email='+email+'&password='+password+'&timezoneoffset='+(new Date()).getTimezoneOffset(),
450
- function (response) {
451
- document.getElementById('login_submit').disabled = false;
452
  if (response.success) {
453
  var sites = response.response;
454
  if (sites.length == 0) {
455
  showErrorMessage('There is no site associate this account');
456
  return;
457
  }
458
-
459
  document.getElementById('txt_site_id').value = sites[0].id;
460
  document.getElementById('txt_password').value = password;
 
 
 
 
 
461
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
462
  _show_sites(response.response);
463
 
464
  } else {
@@ -466,15 +613,17 @@ var comm100_plugin = (function() {
466
 
467
  document.getElementById('login_submit').disabled = false;
468
  }
469
- });
 
470
  }
471
 
472
  function _issiteexpire () {
473
  var siteid = jQuery("#txt_site_id").val();
 
474
  var _data = '?action=issiteexpire&siteid='+siteid+'&timezoneoffset='+(new Date()).getTimezoneOffset();
475
- var service = 'https://hosted.comm100.com/AdminPluginService/(S(' + comm100livechat_session + '))/livechatplugin.ashx' + _data;
476
 
477
- comm100_script_request(_data,
478
  function (response) {
479
  if (response.success) {
480
  var result = response.response;
@@ -548,7 +697,6 @@ function setStepShow(step)
548
  }
549
  else if(step == 2)
550
  {
551
- setValidationCodeImage();
552
  jQuery("#"+comm100livechat_register).show();
553
  }
554
  else if(step == 3)
@@ -654,14 +802,6 @@ function postDataToMagento(_email,_password,_site_id,_plan_id,_code)
654
  });
655
  }
656
 
657
- function setValidationCodeImage()
658
- {
659
- var d = new Date();
660
- var timestamp = d.getMilliseconds();
661
- jQuery("#register_validation_img").attr("src","");
662
- jQuery("#register_validation_img").attr("src",'https://hosted.comm100.com/AdminPluginService/(S(' + comm100livechat_session + '))/livechatplugin.ashx?action=verification_code&timestamp='+timestamp);
663
- }
664
-
665
  function resetLinkData()
666
  {
667
  jQuery("#txt_email").val('');
@@ -679,10 +819,16 @@ function setStaticButtonJSCode()
679
  var siteid = jQuery("#txt_site_id").val();
680
  var planid = jQuery("#txt_plan_id").val();
681
  var code = jQuery("#chat_button_code").val();
 
 
682
  re_siteid = new RegExp("{siteid}", "g");
683
  re_planid = new RegExp("{codeplanid}", "g");
 
 
684
  code = code.replace(re_siteid,siteid);
685
  code = code.replace(re_planid,planid);
 
 
686
  jQuery("#chat_button_code").val(code);
687
  jQuery("#pInstalledOkTipMsg").hide();
688
  }
@@ -704,8 +850,7 @@ function uploadActionLog(actionType)
704
  var pluginVersionNo = encodeURIComponent(jQuery("#txt_plugin_version").val());
705
  var checkPluginURL = encodeURIComponent(jQuery("#txt_plugin_check_url").val());
706
  var _data = "?action=uploadactionlog&siteId="+siteId+"&actionType="+actionType+"&planId="+planId+"&appId="+appId+"&domain="+domain+"&linkedEmail="+linkedEmail+"&pluginVersionNo="+pluginVersionNo+"&checkPluginURL="+checkPluginURL+"&timezoneoffset="+(new Date()).getMilliseconds();;
707
- //var service = 'https://hosted.comm100.com/AdminPluginService/(S(' + comm100livechat_session + '))/livechatplugin.ashx' + _data;
708
- comm100_script_request(_data, function(response) {
709
  goAfterLog(actionType);
710
  }, function(message) {
711
  goAfterLog(actionType);
28
  //register div id
29
  var comm100livechat_register = 'comm100livechat_register';
30
 
31
+ //service URL
32
+ var Comm100RouteServiceDomain = "route.comm100.com";
33
+ var Comm100RouteServiceDomain1 = "route1.comm100.com";
34
+ var requestIndex = 0;
35
+
36
  String.prototype.trim = function()
37
  {
38
  return this.replace(/(^[\s]*)|([\s]*$)/g, "");
39
  }
40
 
41
+ if (typeof comm100_script_id == 'undefined')
42
+ comm100_script_id = 0;
43
+
44
  function html_encode(html) {
45
  var div=document.createElement("div");
46
  var txt=document.createTextNode(html);
47
  div.appendChild(txt);
48
  return div.innerHTML;
49
  }
50
+ //STYPE 1: route domain 2: subdomain
51
+ /*
52
+ function comm100_script_request(STYPE,requestIndex,params,_success,_error)
53
+ {
54
+ var _domain = Comm100RouteServiceDomain;
55
+ if(STYPE==1)
56
+ {
57
+ _domain = _domain + "/routeserver/pluginhandler.ashx";
58
+ }
59
+ if(STYPE==2)
60
+ {
61
+ var scr = document.createElement('script');
62
+ scr.src = 'https://'+jQuery("txt_cpanel_domain").val() + '/AdminPluginService/livechatplugin.ashx?action=session';
63
+ scr.type = 'text/javascript';
64
+ document.getElementsByTagName('head')[0].appendChild(scr);
65
+ alert(jQuery("txt_cpanel_domain").val());
66
+ _domain = jQuery("txt_cpanel_domain").val() + '/AdminPluginService/(S(' + comm100livechat_session + '))/livechatplugin.ashx';
67
+ }
68
+ var serviceUrl = "https://"+_domain+params;
69
+ jQuery.ajax({
70
+ type : "get",
71
+ async:false,
72
+ url : serviceUrl,
73
+ dataType : "jsonp",
74
+ jsonp: "callback",
75
+ jsonpCallback:"handleResponse",
76
+ success : function(json){
77
+ _success(json);
78
+ },
79
+ error : function(){
80
+ if(STYPE==1 && requestIndex == 0 )
81
+ {
82
+ comm100_script_request(STYPE,1,params,_success,_error);
83
+ }
84
+ }
85
+ });
86
+ }
87
+ */
88
 
89
+ function comm100_script_request(STYPE,requestIndex,params, success, error) {
90
+ //STYPE 1 : sites
91
+ //STYPE 2 : other request
92
+ //STYPE 3 : register
93
+ var timeoutsecond = 10;
94
+ if(STYPE==3)timeoutsecond = 30;
95
+ var cpanel_domain = jQuery("#txt_cpanel_domain").val();
96
  function request() {
97
  var _id = 'comm100_script_' + comm100_script_id++;
98
  var _success;
109
  _append_script(_id, url + '&callback=' + _id + '.onresponse');
110
  _timer_timeout = setTimeout(function() {
111
  if (error) error('Operation timeout.');
112
+ }, timeoutsecond * 1000);
113
 
114
  _success = success || function() {};
115
  }
116
  this.onresponse = function _onresponse(response) {
 
117
  window[_id] = null;
118
  var scr = document.getElementById('_' + _id);
119
  document.getElementsByTagName('head')[0].removeChild(scr);
127
 
128
  var req = new request();
129
 
130
+ var _domain = Comm100RouteServiceDomain;
131
+ if(STYPE==1)
132
+ {
133
+ if(requestIndex==1)
134
+ {
135
+ _domain = Comm100RouteServiceDomain1;
136
+ }
137
+ _domain = _domain + "/routeserver/pluginhandler.ashx";
138
+ }
139
+ if(STYPE==2)
140
+ {
141
+ _domain = cpanel_domain + '/AdminPluginService/livechatplugin.ashx';
142
+ }
143
+ if(STYPE ==3)
144
+ {
145
+ _domain = Comm100RouteServiceDomain + "/routeserver/pluginhandler.ashx";
146
+ }
147
+ var serviceUrl = "https://"+_domain+params;
148
+
149
  if(typeof comm100livechat_session == null) {
150
  setTimeout(function() {
151
+ req.send(serviceUrl, success, error);
152
  }, 1000);
153
  } else {
154
+ req.send(serviceUrl, success, error);
155
  }
156
  }
157
 
195
  var website = document.getElementById('register_website').value;
196
  var ip = document.getElementById('register_ip').value;
197
  var timezone = _get_timezone();
198
+ //var verification_code = document.getElementById('register_verification_code').value;
199
  var referrer = window.location.href;
200
 
201
  if(email=='')
235
  website = encodeURIComponent(website);
236
  ip = encodeURIComponent(ip);
237
  timezone = encodeURIComponent(timezone);
238
+ //verification_code = encodeURIComponent(verification_code);
239
+ var verification_code = '';
240
  referrer = encodeURIComponent(referrer);
241
 
242
+ comm100_script_request(3,0,'?action=register&float_button=true&edition=' + edition + '&name=' + name + '&email=' + email +
243
  '&password=' + password + '&phone=' + phone + '&website=' + website + '&ip=' + ip + '&timezone=' + timezone + '&verificationCode=' + verification_code + '&referrer=' + referrer
244
  + '&source=' + source
245
  , function(response) {
251
  }
252
  else {
253
  showErrorMessage(response.error);
 
254
  }
255
 
256
+ }, function(error) {
257
  document.getElementById(register_submit).disabled = false;
258
+ showErrorMessage('Operation timeout.');
259
  });
260
  }
261
 
268
  return 2; //others, need widget
269
  }
270
  }
271
+
272
  function _login(success, error) {
273
+ var email = encodeURIComponent(document.getElementById('txt_email').value);
274
+ var password = encodeURIComponent(document.getElementById('txt_password').value);
275
  var timezone = encodeURIComponent(_get_timezone());
276
+ var site_id = encodeURIComponent(document.getElementById('txt_site_id').value);
277
  var site_id = encodeURIComponent(document.getElementById('txt_site_id').value.trim());
278
+ comm100_script_request(2,0,'?action=login&siteId=' + site_id + '&email=' + email + '&password=' + password
 
 
 
279
  , function(response) {
280
+ if(response.success)
281
+ {
282
+ jQuery("#"+save_account).show();
283
+ _get_plans(site_id, function(response) {
284
+ jQuery("#preViewImgBox").show();
285
+
286
+ var plans = response;
287
+ if (plans.length == 1 && jQuery("#comm100_sites_select option").length==1 ) {
288
+ //set plan and go to next step
289
+ jQuery("#txt_plan_id").val(plans[0].id);
290
+ jQuery("#txt_plan_type").val(_get_plan_type(plans[0]));
291
+ jQuery("#comm100_loading").hide();
292
+ var src = jQuery("#comm100_loading img:first").attr("src");
293
+ jQuery("#"+comm100livechat_site_and_plan).html("Linking up...<img src='" + src + "' />");
294
+ onComm100Save();
295
+ } else {
296
+ _show_plans(plans);
297
+ }
298
+ });
299
+
300
+ }
301
+ else
302
+ {
303
+ jQuery("#"+save_account).hide();
304
+ jQuery("#preViewImgBox").hide();
305
+ var selPlansObj = jQuery("#comm100_codeplans_select");
306
+ selPlansObj.empty();
307
+
308
+ showErrorMessage(response.error);
309
+ }
310
+
311
  }, function(message) {
312
+ error(message);
313
  });
314
  }
315
+
316
  function _get_plans(site_id, success, error) {
317
+ comm100_script_request(2,0,'?action=plans&siteId=' + site_id, function(response) {
318
  if(response.error) {
319
  if (typeof error != 'undefined')
320
  error('Comm100 Live Chat is not added to your site yet as you haven\'t linked up any Comm100 account.<br/><a href="admin.php?page=comm100livechat_settings">Link Up your account now</a> and start chatting with your visitors.');
381
  {
382
  jQuery("#txt_plan_id").val(planid);
383
  jQuery("#txt_plan_type").val(plantype);
384
+
385
  if(button_type==0)
386
  {
387
  if(img_online_id == 0 && img_online_url=="")
391
  }
392
 
393
  var siteid = jQuery("#txt_site_id").val();
394
+ var main_chatserver_domain = jQuery("#txt_main_chatserver_domain").val();
395
+ var img_online = "https://"+main_chatserver_domain+"/DBResource/DBImage.ashx?imgId="+img_online_id+"&type="+img_type+"&siteId="+siteid;
396
+ var img_offline = "https://"+main_chatserver_domain+"/DBResource/DBImage.ashx?imgId="+img_offline_id+"&type="+img_type+"&siteId="+siteid;
397
  if(img_type==0)
398
  {
399
  img_online = img_online_url;
430
  }
431
 
432
  function _get_code(site_id, plan_id, callback) {
433
+ comm100_script_request(2,0,'?action=code&siteId=' + site_id + '&planId=' + plan_id, function(response) {
434
  callback(response.response);
435
  });
436
  }
437
  function _get_editions(callback) {
438
+ comm100_script_request(2,0,'?action=editions', function(response) {
439
  callback(response.response);
440
  });
441
  }
471
  {
472
  defaultSelectSiteId = s.id;
473
  }
474
+ var optionVal = s.id;
475
+ selSitesObj.append("<option value='"+optionVal+"'>"+s.id+"</option>");
476
  }
477
 
478
  selSitesObj.change(function(){
479
  showLoadingBar(save_account);
480
+ var optionVal = jQuery(this).children('option:selected').val();
481
+ var siteid = optionVal;
482
  jQuery("#txt_site_id").val(siteid);
483
+ /*
484
+ _get_plans(siteid, function(response) {
485
+ var plans = response;
486
+ if (plans.length == 1 && jQuery("#comm100_sites_select option").length==1 ) {
487
+ //set plan and go to next step
488
+ jQuery("#txt_plan_id").val(plans[0].id);
489
+ jQuery("#txt_plan_type").val(_get_plan_type(plans[0]));
490
+ jQuery("#comm100_loading").hide();
491
+ var src = jQuery("#comm100_loading img:first").attr("src");
492
+ jQuery("#"+comm100livechat_site_and_plan).html("Linking up...<img src='" + src + "' />");
493
+ onComm100Save();
494
+ } else {
495
+ _show_plans(plans);
496
+ }
497
+ }); */
498
+ _login(function () {
499
+ //hideLoadingBar();
500
+ }, function (error) {
501
+ //showErrorMessage(error);
502
+ });
503
  });
504
 
505
  showLoadingBar(save_account);
506
  jQuery("#txt_site_id").val(defaultSelectSiteId);
507
+
508
+ /*
509
+ _get_plans(defaultSelectSiteId, function(response) {
510
+ var plans = response;
511
+ if (plans.length == 1 && jQuery("#comm100_sites_select option").length==1 ) {
512
+ //set plan and go to next step
513
+ jQuery("#txt_plan_id").val(plans[0].id);
514
+ jQuery("#txt_plan_type").val(_get_plan_type(plans[0]));
515
+ jQuery("#comm100_loading").hide();
516
+ var src = jQuery("#comm100_loading img:first").attr("src");
517
+ jQuery("#"+comm100livechat_site_and_plan).html("Linking up...<img src='" + src + "' />");
518
+ onComm100Save();
519
+ } else {
520
+ _show_plans(plans);
521
+ }
522
+ });
523
+ */
524
  _login(function () {
525
+ //hideLoadingBar();
526
  }, function (error) {
527
+ //showErrorMessage(error);
528
+ });
529
+
 
530
  //document.getElementById('num_sites').innerHTML = sites.length;
531
  }
532
 
533
  function _sitesNoStep(email,password)
534
  {
535
+ document.getElementById('txt_email').value = email;
536
+ document.getElementById('txt_password').value = password;
537
+
538
+ comm100_script_request(1,0,'?action=sites&email='+email+'&password='+password+'&timezoneoffset='+(new Date()).getTimezoneOffset(),
539
  function (response) {
540
  document.getElementById(login_submit).disabled = false;
541
  if (response.success) {
542
+
543
+ document.getElementById('txt_cpanel_domain').value = response.cpanel_domain;
544
+ jQuery("#txt_main_chatserver_domain").val(response.main_chatserver_domain);
545
+ jQuery("#txt_standby_chatserver_domain").val(response.standby_chatserver_domain);
546
+
547
  var sites = response.response;
548
  if (sites.length == 0) {
549
  showErrorMessage('There is no site associate this account');
566
 
567
  var email = encodeURIComponent(document.getElementById('login_email').value);
568
  var password = encodeURIComponent(document.getElementById('login_password').value);
569
+ var email1 = document.getElementById('login_email').value;
570
+ comm100_script_request(1,0,'?action=sites&email='+email+'&password='+password+'&timezoneoffset='+(new Date()).getTimezoneOffset(),
571
+ function(response){
572
+ document.getElementById('login_submit').disabled = false;
573
  if (response.success) {
574
  var sites = response.response;
575
  if (sites.length == 0) {
576
  showErrorMessage('There is no site associate this account');
577
  return;
578
  }
579
+ document.getElementById('txt_email').value = email1;
580
  document.getElementById('txt_site_id').value = sites[0].id;
581
  document.getElementById('txt_password').value = password;
582
+ document.getElementById('txt_cpanel_domain').value = response.cpanel_domain;
583
+ jQuery("#txt_main_chatserver_domain").val(response.main_chatserver_domain);
584
+ jQuery("#txt_standby_chatserver_domain").val(response.standby_chatserver_domain);
585
+
586
+ _show_sites(response.response);
587
 
588
+ } else {
589
+ showErrorMessage(response.error);
590
+
591
+ document.getElementById('login_submit').disabled = false;
592
+ }
593
+ },
594
+ function(){
595
+ comm100_script_request(1,1,'?action=sites&email='+email+'&password='+password+'&timezoneoffset='+(new Date()).getTimezoneOffset(), function(response){
596
+ document.getElementById('login_submit').disabled = false;
597
+ if (response.success) {
598
+ var sites = response.response;
599
+ if (sites.length == 0) {
600
+ showErrorMessage('There is no site associate this account');
601
+ return;
602
+ }
603
+ document.getElementById('txt_email').value = email1;
604
+ document.getElementById('txt_site_id').value = sites[0].id;
605
+ document.getElementById('txt_password').value = password;
606
+ document.getElementById('txt_cpanel_domain').value = response.cpanel_domain;
607
+ jQuery("#txt_main_chatserver_domain").val(response.main_chatserver_domain);
608
+ jQuery("#txt_standby_chatserver_domain").val(response.standby_chatserver_domain);
609
  _show_sites(response.response);
610
 
611
  } else {
613
 
614
  document.getElementById('login_submit').disabled = false;
615
  }
616
+ },function(error){showErrorMessage(error);});
617
+ });
618
  }
619
 
620
  function _issiteexpire () {
621
  var siteid = jQuery("#txt_site_id").val();
622
+ var cpanel_domain = jQuery("#txt_cpanel_domain").val();
623
  var _data = '?action=issiteexpire&siteid='+siteid+'&timezoneoffset='+(new Date()).getTimezoneOffset();
624
+ var service = 'https://' + cpanel_domain + '/AdminPluginService/livechatplugin.ashx' + _data;
625
 
626
+ comm100_script_request(2,0,_data,
627
  function (response) {
628
  if (response.success) {
629
  var result = response.response;
697
  }
698
  else if(step == 2)
699
  {
 
700
  jQuery("#"+comm100livechat_register).show();
701
  }
702
  else if(step == 3)
802
  });
803
  }
804
 
 
 
 
 
 
 
 
 
805
  function resetLinkData()
806
  {
807
  jQuery("#txt_email").val('');
819
  var siteid = jQuery("#txt_site_id").val();
820
  var planid = jQuery("#txt_plan_id").val();
821
  var code = jQuery("#chat_button_code").val();
822
+ var main_chatserver_domain = jQuery("#txt_main_chatserver_domain").val();
823
+ var standby_chatserver_domain = jQuery("#txt_standby_chatserver_domain").val();
824
  re_siteid = new RegExp("{siteid}", "g");
825
  re_planid = new RegExp("{codeplanid}", "g");
826
+ re_main_chatserver_domain = new RegExp("{main_chatserver_domain}", "g");
827
+ re_standby_chatserver_domain = new RegExp("{standby_chatserver_domain}", "g");
828
  code = code.replace(re_siteid,siteid);
829
  code = code.replace(re_planid,planid);
830
+ code = code.replace(re_main_chatserver_domain,main_chatserver_domain);
831
+ code = code.replace(re_standby_chatserver_domain,standby_chatserver_domain);
832
  jQuery("#chat_button_code").val(code);
833
  jQuery("#pInstalledOkTipMsg").hide();
834
  }
850
  var pluginVersionNo = encodeURIComponent(jQuery("#txt_plugin_version").val());
851
  var checkPluginURL = encodeURIComponent(jQuery("#txt_plugin_check_url").val());
852
  var _data = "?action=uploadactionlog&siteId="+siteId+"&actionType="+actionType+"&planId="+planId+"&appId="+appId+"&domain="+domain+"&linkedEmail="+linkedEmail+"&pluginVersionNo="+pluginVersionNo+"&checkPluginURL="+checkPluginURL+"&timezoneoffset="+(new Date()).getMilliseconds();;
853
+ comm100_script_request(2,0,_data, function(response) {
 
854
  goAfterLog(actionType);
855
  }, function(message) {
856
  goAfterLog(actionType);
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>comm100_livechat</name>
4
- <version>2.0.1</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">comm100_livechat</license>
7
  <channel>community</channel>
@@ -13,9 +13,9 @@ The extension is designed to make the installation of Comm100 Live Chat on a Mag
13
  </description>
14
  <notes>First Public Release</notes>
15
  <authors><author><name>comm100</name><user>support</user><email>support@comm100.com</email></author></authors>
16
- <date>2014-07-03</date>
17
- <time>08:29:04</time>
18
- <contents><target name="magecommunity"><dir name="Comm100"><dir name="Livechat"><dir name="Block"><dir name="Adminhtml"><dir name="Livechat"><file name="Grid.php" hash="c5d903f1cd5066dc5e0cfa89a631e95c"/></dir><file name="Livechat.php" hash="46286ef11444633a1339f418b5a7dcf8"/></dir><file name="Livechat.php" hash="472098a41d55ac4113db415da1c8331b"/></dir><dir name="Helper"><file name="Data.php" hash="8688a8f04b3965d0508cf0260cd478a6"/></dir><dir name="Model"><file name="Languages.php" hash="be095dde04aa8ffda1cdffe029d84fb3"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="LivechatController.php" hash="e4fb0b76d650814f514fcffe1a4178cf"/></dir><file name="IndexController.php" hash="36326c79e038f988f9ad64c35c37063a"/></dir><dir name="etc"><file name="config.xml" hash="f9e8935cda46217625416d57f094db7a"/><file name="system.xml" hash="e370adf6e13ae2d75319db2b789c66de"/></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="comm100.xml" hash="4c20ced40d9f2525cad37161d720ef5b"/></dir><dir name="template"><dir name="comm100"><file name="livechat_config.phtml" hash="44954cba317a64dc0fddcaf37f560a53"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="comm100.xml" hash="9941d2d25786c6a9cd316d07fe2d007e"/></dir><dir name="template"><dir name="comm100"><file name="livechat.phtml" hash="db6265b0593e25429c2ce1ffb2a52de7"/></dir></dir></dir></dir><dir name="default"><dir name="default"><dir name="layout"><file name="comm100.xml" hash="9941d2d25786c6a9cd316d07fe2d007e"/></dir><dir name="template"><dir name="comm100"><file name="livechat.phtml" hash="db6265b0593e25429c2ce1ffb2a52de7"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Comm100_Livechat.xml" hash="54830b1b30a412a7eec197737f25371b"/></dir></target><target name="mageweb"><dir name="js"><dir name="comm100"><file name="jquery-1.7.2.min.js" hash="b8d64d0bc142b3f670cc0611b0aebcae"/><file name="plugin.js" hash="4ea714326896b66ad7038b8ff0d6b9ef"/></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="base"><dir name="default"><dir name="css"><file name="comm100.css" hash="5a81e931d7c13a73b0848f8bc993b73a"/></dir><dir name="images"><file name="comm100_logo.gif" hash="311e3d7227a1123eb7d94622ee3a3e3d"/><file name="ajax_loader.gif" hash="af962b37779a443a77ab836b3b7a93f5"/></dir></dir></dir></dir></target></contents>
19
  <compatible/>
20
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
21
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>comm100_livechat</name>
4
+ <version>2.0.3</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">comm100_livechat</license>
7
  <channel>community</channel>
13
  </description>
14
  <notes>First Public Release</notes>
15
  <authors><author><name>comm100</name><user>support</user><email>support@comm100.com</email></author></authors>
16
+ <date>2014-11-10</date>
17
+ <time>02:14:50</time>
18
+ <contents><target name="magecommunity"><dir name="Comm100"><dir name="Livechat"><dir name="Block"><dir name="Adminhtml"><dir name="Livechat"><file name="Grid.php" hash="c5d903f1cd5066dc5e0cfa89a631e95c"/></dir><file name="Livechat.php" hash="46286ef11444633a1339f418b5a7dcf8"/></dir><file name="Livechat.php" hash="472098a41d55ac4113db415da1c8331b"/></dir><dir name="Helper"><file name="Data.php" hash="8688a8f04b3965d0508cf0260cd478a6"/></dir><dir name="Model"><file name="Languages.php" hash="be095dde04aa8ffda1cdffe029d84fb3"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="LivechatController.php" hash="f21ed9675f19ce59ca528f7136eec509"/></dir><file name="IndexController.php" hash="36326c79e038f988f9ad64c35c37063a"/></dir><dir name="etc"><file name="config.xml" hash="f9e8935cda46217625416d57f094db7a"/><file name="system.xml" hash="e370adf6e13ae2d75319db2b789c66de"/></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="comm100.xml" hash="4c20ced40d9f2525cad37161d720ef5b"/></dir><dir name="template"><dir name="comm100"><file name="livechat_config.phtml" hash="270ac24b8c4d07fde951156529fefb29"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="comm100.xml" hash="9941d2d25786c6a9cd316d07fe2d007e"/></dir><dir name="template"><dir name="comm100"><file name="livechat.phtml" hash="db6265b0593e25429c2ce1ffb2a52de7"/></dir></dir></dir></dir><dir name="default"><dir name="default"><dir name="layout"><file name="comm100.xml" hash="9941d2d25786c6a9cd316d07fe2d007e"/></dir><dir name="template"><dir name="comm100"><file name="livechat.phtml" hash="fe6dc7a23c3a2cd99758345fc875a623"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Comm100_Livechat.xml" hash="54830b1b30a412a7eec197737f25371b"/></dir></target><target name="mageweb"><dir name="js"><dir name="comm100"><file name="jquery-1.7.2.min.js" hash="b8d64d0bc142b3f670cc0611b0aebcae"/><file name="plugin.js" hash="9bd0754c36c27bbb10ce01a1e6aa429d"/></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="base"><dir name="default"><dir name="css"><file name="comm100.css" hash="5a81e931d7c13a73b0848f8bc993b73a"/></dir><dir name="images"><file name="comm100_logo.gif" hash="311e3d7227a1123eb7d94622ee3a3e3d"/><file name="ajax_loader.gif" hash="af962b37779a443a77ab836b3b7a93f5"/></dir></dir></dir></dir></target></contents>
19
  <compatible/>
20
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
21
  </package>