Version Notes
changes:
- connection problems fix
Download this release
Release Info
Developer | Juraj Simon |
Extension | Liveagent |
Version | 2.5.9 |
Comparing to | |
See all releases |
Code changes from version 2.5.8 to 2.5.9
- app/code/local/Qualityunit/Liveagent/Block/Account.php +125 -125
- app/code/local/Qualityunit/Liveagent/Block/Base.php +54 -54
- app/code/local/Qualityunit/Liveagent/Block/Buttoncode.php +112 -112
- app/code/local/Qualityunit/Liveagent/Block/Signup.php +124 -124
- app/code/local/Qualityunit/Liveagent/Block/Waiting.php +72 -72
- app/code/local/Qualityunit/Liveagent/Helper/.Auth.php.swp +0 -0
- app/code/local/Qualityunit/Liveagent/Helper/Account.php +14 -14
- app/code/local/Qualityunit/Liveagent/Helper/Auth.php +2 -3
- app/code/local/Qualityunit/Liveagent/Helper/Data.php +22 -22
- app/code/local/Qualityunit/Liveagent/Helper/Settings.php +2 -2
- app/code/local/Qualityunit/Liveagent/Helper/Signup.php +1 -1
- app/code/local/Qualityunit/Liveagent/Model/Buttons.php +9 -9
- app/code/local/Qualityunit/Liveagent/Model/Liveagent.php +9 -9
- app/code/local/Qualityunit/Liveagent/Model/Mysql4/Buttons.php +8 -8
- app/code/local/Qualityunit/Liveagent/Model/Mysql4/Buttons/Collection.php +9 -9
- app/code/local/Qualityunit/Liveagent/Model/Mysql4/Liveagent.php +9 -9
- app/code/local/Qualityunit/Liveagent/Model/Mysql4/Liveagent/Collection.php +9 -9
- app/code/local/Qualityunit/Liveagent/Model/Mysql4/Settings.php +9 -9
- app/code/local/Qualityunit/Liveagent/Model/Mysql4/Settings/Collection.php +9 -9
- app/code/local/Qualityunit/Liveagent/Model/Settings.php +9 -9
- app/code/local/Qualityunit/Liveagent/controllers/Adminhtml/LiveagentController.php +334 -333
- app/code/local/Qualityunit/Liveagent/controllers/IndexController.php +7 -7
- app/code/local/Qualityunit/Liveagent/etc/config.xml +134 -134
- app/code/local/Qualityunit/Liveagent/sql/liveagent_setup/mysql4-install-0.1.0.php +37 -37
- app/code/local/Qualityunit/Liveagent/sql/liveagent_setup/mysql4-install-2.5.4.php +7 -7
- package.xml +5 -5
app/code/local/Qualityunit/Liveagent/Block/Account.php
CHANGED
@@ -1,125 +1,125 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Qualityunit_Liveagent_Block_Account extends Qualityunit_Liveagent_Block_Base {
|
4 |
-
|
5 |
-
const SAVE_ACCOUNT_SETTINGS_ACTION_FLAG = 'sas';
|
6 |
-
const CANCEL_ACCOUNT_ACTION_FLAG = 'c';
|
7 |
-
const CREATE_ACCOUNT_ACTION_FLAF = 's';
|
8 |
-
const CHANGE_ACCOUNT_ACTION_FLAG = 'h';
|
9 |
-
|
10 |
-
public function _prepareLayout() {
|
11 |
-
parent::_prepareLayout();
|
12 |
-
$settings = new Qualityunit_Liveagent_Helper_Settings();
|
13 |
-
$this->assignVariable('dialogCaption', Mage::helper('adminhtml')->__('LiveAgent - Free live chat and helpdesk plugin for Magento'));
|
14 |
-
$this->assignVariable('submitCaption', Mage::helper('adminhtml')->__('Save Account Settings'));
|
15 |
-
$this->assignVariable('settingsSection', Mage::helper('adminhtml')->__('Account Settings'));
|
16 |
-
$this->assignVariable('beforeDeleteQuestion', Mage::helper('adminhtml')->__('Are you sure you want to cancel your account?'));
|
17 |
-
$this->assignVariable('formKey', Mage::getSingleton('core/session')->getFormKey());
|
18 |
-
$this->assignVariable('saveUrlAction', $this->getUrl('*/*/post'));
|
19 |
-
$this->assignVariable('cancelUrlAction', $this->getUrl('*/*/index', array('key' => $this->getRequest()->get('key'), 'action' => self::CANCEL_ACCOUNT_ACTION_FLAG)));
|
20 |
-
$this->assignVariable('urlLabel', Mage::helper('adminhtml')->__('Url')) . ':';
|
21 |
-
$this->assignVariable('urlHelp', Mage::helper('adminhtml')->__('Url where your LiveAgent installation is located'));
|
22 |
-
$this->assignVariable('laOwnerEmailHelp', Mage::helper('adminhtml')->__('Username which you use to login to your Live Agnet'));
|
23 |
-
$this->assignVariable('nameLabel', Mage::helper('adminhtml')->__('Username')) . ':';
|
24 |
-
if ($settings->useApiKey()) {
|
25 |
-
$this->assignVariable('passwordLabel', Mage::helper('adminhtml')->__('Api key')) . ':';
|
26 |
-
$this->assignVariable('laOwnerPasswordHelp', Mage::helper('adminhtml')->__('Your REST api key'));
|
27 |
-
} else {
|
28 |
-
$this->assignVariable('passwordLabel', Mage::helper('adminhtml')->__('Password')) . ':';
|
29 |
-
$this->assignVariable('laOwnerPasswordHelp', Mage::helper('adminhtml')->__('Your password'));
|
30 |
-
}
|
31 |
-
|
32 |
-
$this->assignVariable('cancelLink', Mage::helper('adminhtml')->__('Cancel account'));
|
33 |
-
$this->assignVariable('cancelHelp', Mage::helper('adminhtml')->__('this will clear all your existing account settings and offer you to create a new free account'));
|
34 |
-
$this->assignVariable('contactLink', Mage::helper('adminhtml')->__('contact us'));
|
35 |
-
$this->assignVariable('contactHelp', Mage::helper('adminhtml')->__('Do you need any help with this plugin? Feel free to'));
|
36 |
-
$this->assignVariable(Qualityunit_Liveagent_Helper_Settings::LA_URL_SETTING_NAME, $this->getInputBox(Qualityunit_Liveagent_Helper_Settings::LA_URL_SETTING_NAME, ''));
|
37 |
-
$this->assignVariable(Qualityunit_Liveagent_Helper_Settings::LA_OWNER_EMAIL_SETTING_NAME, $this->getInputBox(Qualityunit_Liveagent_Helper_Settings::LA_OWNER_EMAIL_SETTING_NAME, ''));
|
38 |
-
$this->assignVariable(Qualityunit_Liveagent_Helper_Settings::LA_OWNER_PASSWORD_SETTING_NAME, $this->getPasswordBox(Qualityunit_Liveagent_Helper_Settings::LA_OWNER_PASSWORD_SETTING_NAME, ''));
|
39 |
-
$this->assignVariable('saveActionSettingsFlag', self::SAVE_ACCOUNT_SETTINGS_ACTION_FLAG);
|
40 |
-
}
|
41 |
-
|
42 |
-
protected function getPasswordBox($name, $value) {
|
43 |
-
$params = $this->getRequest()->getParams();
|
44 |
-
if (isset($params[$name])) {
|
45 |
-
return parent::getPasswordBox($name, base64_decode(trim($this->getRequest()->getParam($name))));
|
46 |
-
}
|
47 |
-
$settings = new Qualityunit_Liveagent_Helper_Settings();
|
48 |
-
return parent::getPasswordBox($name, $settings->getOption($name));
|
49 |
-
}
|
50 |
-
|
51 |
-
protected function getInputBox($name, $value) {
|
52 |
-
$params = $this->getRequest()->getParams();
|
53 |
-
if (isset($params[$name])) {
|
54 |
-
return parent::getInputBox($name, base64_decode(trim($this->getRequest()->getParam($name))));
|
55 |
-
}
|
56 |
-
$settings = new Qualityunit_Liveagent_Helper_Settings();
|
57 |
-
return parent::getInputBox($name, $settings->getOption($name));
|
58 |
-
}
|
59 |
-
|
60 |
-
protected function getTemplateString() {
|
61 |
-
return '
|
62 |
-
<script type="text/javascript">
|
63 |
-
var cancelMyAccount = function() {
|
64 |
-
if (confirm(\'{beforeDeleteQuestion}\')) {
|
65 |
-
setLocation(\'{cancelUrlAction}\')
|
66 |
-
}
|
67 |
-
}
|
68 |
-
</script>
|
69 |
-
<form id="configForm" name="edit_form" action="{saveUrlAction}" method="post">
|
70 |
-
<input name="form_key" type="hidden" value="{formKey}" />
|
71 |
-
<input name="action" type="hidden" value="{saveActionSettingsFlag}"/>
|
72 |
-
<div class="content-header">
|
73 |
-
<table cellspacing="0">
|
74 |
-
<tbody><tr>
|
75 |
-
<td style="width:50%;"><h3 class="icon-head head-promo-catalog">{dialogCaption}</h3></td>
|
76 |
-
<td class="form-buttons"><button id="id_5806f3a306fa79f4340cb58c1d190ff5" type="button" class="scalable save" onclick="configForm.submit()" style=""><span>{submitCaption}</span></button></td>
|
77 |
-
</tr>
|
78 |
-
</tbody>
|
79 |
-
</table>
|
80 |
-
</div>
|
81 |
-
<div class="entry-edit">
|
82 |
-
<fieldset>
|
83 |
-
{contactHelp} <a href="http://support.qualityunit.com/submit_ticket" target="_blank">{contactLink}</a>.
|
84 |
-
</fieldset>
|
85 |
-
</div>
|
86 |
-
<div class="entry-edit">
|
87 |
-
<div class="entry-edit-head"><h4>{settingsSection}</h4></div>
|
88 |
-
<fieldset>
|
89 |
-
<table cellspacing="0" class="form-list">
|
90 |
-
<colgroup class="label"></colgroup>
|
91 |
-
<colgroup class="value"></colgroup>
|
92 |
-
<colgroup class="scope-label"></colgroup>
|
93 |
-
<colgroup class=""></colgroup>
|
94 |
-
<tbody>
|
95 |
-
<tr id="row_la_url">
|
96 |
-
<td class="label"><label for="row_la_url">{urlLabel}</label></td>
|
97 |
-
<td class="value">{la-url}
|
98 |
-
<p class="note"><span>{urlHelp}</span></p></td>
|
99 |
-
<td class="scope-label"></td><td></td>
|
100 |
-
</tr>
|
101 |
-
<tr id="row_owner_email">
|
102 |
-
<td class="label"><label for="row_owner_email">{nameLabel}</label></td>
|
103 |
-
<td class="value">{la-owner-email}
|
104 |
-
<p class="note"><span>{laOwnerEmailHelp}</span></p></td>
|
105 |
-
<td class="scope-label"></td><td></td>
|
106 |
-
</tr>
|
107 |
-
<tr id="row_owner_pass">
|
108 |
-
<td class="label"><label for="row_owner_pass">{passwordLabel}</label></td>
|
109 |
-
<td class="value">{la-owner-password}
|
110 |
-
<p class="note"><span>{laOwnerPasswordHelp}</span></p></td>
|
111 |
-
<td class="scope-label"></td><td></td>
|
112 |
-
</tr>
|
113 |
-
<tr>
|
114 |
-
<td colspan="4" class="scope-label"><button onclick="cancelMyAccount()" type="button" class="scalable delete"><span>{cancelLink}</span></button> {cancelHelp}</td>
|
115 |
-
</tr>
|
116 |
-
<tr>
|
117 |
-
<td colspan="4" class="scope-label"></td>
|
118 |
-
</tr>
|
119 |
-
</tbody>
|
120 |
-
</table>
|
121 |
-
</fieldset>
|
122 |
-
</div>
|
123 |
-
';
|
124 |
-
}
|
125 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Qualityunit_Liveagent_Block_Account extends Qualityunit_Liveagent_Block_Base {
|
4 |
+
|
5 |
+
const SAVE_ACCOUNT_SETTINGS_ACTION_FLAG = 'sas';
|
6 |
+
const CANCEL_ACCOUNT_ACTION_FLAG = 'c';
|
7 |
+
const CREATE_ACCOUNT_ACTION_FLAF = 's';
|
8 |
+
const CHANGE_ACCOUNT_ACTION_FLAG = 'h';
|
9 |
+
|
10 |
+
public function _prepareLayout() {
|
11 |
+
parent::_prepareLayout();
|
12 |
+
$settings = new Qualityunit_Liveagent_Helper_Settings();
|
13 |
+
$this->assignVariable('dialogCaption', Mage::helper('adminhtml')->__('LiveAgent - Free live chat and helpdesk plugin for Magento'));
|
14 |
+
$this->assignVariable('submitCaption', Mage::helper('adminhtml')->__('Save Account Settings'));
|
15 |
+
$this->assignVariable('settingsSection', Mage::helper('adminhtml')->__('Account Settings'));
|
16 |
+
$this->assignVariable('beforeDeleteQuestion', Mage::helper('adminhtml')->__('Are you sure you want to cancel your account?'));
|
17 |
+
$this->assignVariable('formKey', Mage::getSingleton('core/session')->getFormKey());
|
18 |
+
$this->assignVariable('saveUrlAction', $this->getUrl('*/*/post'));
|
19 |
+
$this->assignVariable('cancelUrlAction', $this->getUrl('*/*/index', array('key' => $this->getRequest()->get('key'), 'action' => self::CANCEL_ACCOUNT_ACTION_FLAG)));
|
20 |
+
$this->assignVariable('urlLabel', Mage::helper('adminhtml')->__('Url')) . ':';
|
21 |
+
$this->assignVariable('urlHelp', Mage::helper('adminhtml')->__('Url where your LiveAgent installation is located'));
|
22 |
+
$this->assignVariable('laOwnerEmailHelp', Mage::helper('adminhtml')->__('Username which you use to login to your Live Agnet'));
|
23 |
+
$this->assignVariable('nameLabel', Mage::helper('adminhtml')->__('Username')) . ':';
|
24 |
+
if ($settings->useApiKey()) {
|
25 |
+
$this->assignVariable('passwordLabel', Mage::helper('adminhtml')->__('Api key')) . ':';
|
26 |
+
$this->assignVariable('laOwnerPasswordHelp', Mage::helper('adminhtml')->__('Your REST api key'));
|
27 |
+
} else {
|
28 |
+
$this->assignVariable('passwordLabel', Mage::helper('adminhtml')->__('Password')) . ':';
|
29 |
+
$this->assignVariable('laOwnerPasswordHelp', Mage::helper('adminhtml')->__('Your password'));
|
30 |
+
}
|
31 |
+
|
32 |
+
$this->assignVariable('cancelLink', Mage::helper('adminhtml')->__('Cancel account'));
|
33 |
+
$this->assignVariable('cancelHelp', Mage::helper('adminhtml')->__('this will clear all your existing account settings and offer you to create a new free account'));
|
34 |
+
$this->assignVariable('contactLink', Mage::helper('adminhtml')->__('contact us'));
|
35 |
+
$this->assignVariable('contactHelp', Mage::helper('adminhtml')->__('Do you need any help with this plugin? Feel free to'));
|
36 |
+
$this->assignVariable(Qualityunit_Liveagent_Helper_Settings::LA_URL_SETTING_NAME, $this->getInputBox(Qualityunit_Liveagent_Helper_Settings::LA_URL_SETTING_NAME, ''));
|
37 |
+
$this->assignVariable(Qualityunit_Liveagent_Helper_Settings::LA_OWNER_EMAIL_SETTING_NAME, $this->getInputBox(Qualityunit_Liveagent_Helper_Settings::LA_OWNER_EMAIL_SETTING_NAME, ''));
|
38 |
+
$this->assignVariable(Qualityunit_Liveagent_Helper_Settings::LA_OWNER_PASSWORD_SETTING_NAME, $this->getPasswordBox(Qualityunit_Liveagent_Helper_Settings::LA_OWNER_PASSWORD_SETTING_NAME, ''));
|
39 |
+
$this->assignVariable('saveActionSettingsFlag', self::SAVE_ACCOUNT_SETTINGS_ACTION_FLAG);
|
40 |
+
}
|
41 |
+
|
42 |
+
protected function getPasswordBox($name, $value) {
|
43 |
+
$params = $this->getRequest()->getParams();
|
44 |
+
if (isset($params[$name])) {
|
45 |
+
return parent::getPasswordBox($name, base64_decode(trim($this->getRequest()->getParam($name))));
|
46 |
+
}
|
47 |
+
$settings = new Qualityunit_Liveagent_Helper_Settings();
|
48 |
+
return parent::getPasswordBox($name, $settings->getOption($name));
|
49 |
+
}
|
50 |
+
|
51 |
+
protected function getInputBox($name, $value) {
|
52 |
+
$params = $this->getRequest()->getParams();
|
53 |
+
if (isset($params[$name])) {
|
54 |
+
return parent::getInputBox($name, base64_decode(trim($this->getRequest()->getParam($name))));
|
55 |
+
}
|
56 |
+
$settings = new Qualityunit_Liveagent_Helper_Settings();
|
57 |
+
return parent::getInputBox($name, $settings->getOption($name));
|
58 |
+
}
|
59 |
+
|
60 |
+
protected function getTemplateString() {
|
61 |
+
return '
|
62 |
+
<script type="text/javascript">
|
63 |
+
var cancelMyAccount = function() {
|
64 |
+
if (confirm(\'{beforeDeleteQuestion}\')) {
|
65 |
+
setLocation(\'{cancelUrlAction}\')
|
66 |
+
}
|
67 |
+
}
|
68 |
+
</script>
|
69 |
+
<form id="configForm" name="edit_form" action="{saveUrlAction}" method="post">
|
70 |
+
<input name="form_key" type="hidden" value="{formKey}" />
|
71 |
+
<input name="action" type="hidden" value="{saveActionSettingsFlag}"/>
|
72 |
+
<div class="content-header">
|
73 |
+
<table cellspacing="0">
|
74 |
+
<tbody><tr>
|
75 |
+
<td style="width:50%;"><h3 class="icon-head head-promo-catalog">{dialogCaption}</h3></td>
|
76 |
+
<td class="form-buttons"><button id="id_5806f3a306fa79f4340cb58c1d190ff5" type="button" class="scalable save" onclick="configForm.submit()" style=""><span>{submitCaption}</span></button></td>
|
77 |
+
</tr>
|
78 |
+
</tbody>
|
79 |
+
</table>
|
80 |
+
</div>
|
81 |
+
<div class="entry-edit">
|
82 |
+
<fieldset>
|
83 |
+
{contactHelp} <a href="http://support.qualityunit.com/submit_ticket" target="_blank">{contactLink}</a>.
|
84 |
+
</fieldset>
|
85 |
+
</div>
|
86 |
+
<div class="entry-edit">
|
87 |
+
<div class="entry-edit-head"><h4>{settingsSection}</h4></div>
|
88 |
+
<fieldset>
|
89 |
+
<table cellspacing="0" class="form-list">
|
90 |
+
<colgroup class="label"></colgroup>
|
91 |
+
<colgroup class="value"></colgroup>
|
92 |
+
<colgroup class="scope-label"></colgroup>
|
93 |
+
<colgroup class=""></colgroup>
|
94 |
+
<tbody>
|
95 |
+
<tr id="row_la_url">
|
96 |
+
<td class="label"><label for="row_la_url">{urlLabel}</label></td>
|
97 |
+
<td class="value">{la-url}
|
98 |
+
<p class="note"><span>{urlHelp}</span></p></td>
|
99 |
+
<td class="scope-label"></td><td></td>
|
100 |
+
</tr>
|
101 |
+
<tr id="row_owner_email">
|
102 |
+
<td class="label"><label for="row_owner_email">{nameLabel}</label></td>
|
103 |
+
<td class="value">{la-owner-email}
|
104 |
+
<p class="note"><span>{laOwnerEmailHelp}</span></p></td>
|
105 |
+
<td class="scope-label"></td><td></td>
|
106 |
+
</tr>
|
107 |
+
<tr id="row_owner_pass">
|
108 |
+
<td class="label"><label for="row_owner_pass">{passwordLabel}</label></td>
|
109 |
+
<td class="value">{la-owner-password}
|
110 |
+
<p class="note"><span>{laOwnerPasswordHelp}</span></p></td>
|
111 |
+
<td class="scope-label"></td><td></td>
|
112 |
+
</tr>
|
113 |
+
<tr>
|
114 |
+
<td colspan="4" class="scope-label"><button onclick="cancelMyAccount()" type="button" class="scalable delete"><span>{cancelLink}</span></button> {cancelHelp}</td>
|
115 |
+
</tr>
|
116 |
+
<tr>
|
117 |
+
<td colspan="4" class="scope-label"></td>
|
118 |
+
</tr>
|
119 |
+
</tbody>
|
120 |
+
</table>
|
121 |
+
</fieldset>
|
122 |
+
</div>
|
123 |
+
';
|
124 |
+
}
|
125 |
+
}
|
app/code/local/Qualityunit/Liveagent/Block/Base.php
CHANGED
@@ -1,55 +1,55 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Qualityunit_Liveagent_Block_Base extends Mage_Core_Block_Template {
|
4 |
-
|
5 |
-
protected $variables = array();
|
6 |
-
|
7 |
-
protected function curPageURL() {
|
8 |
-
$pageURL = 'http';
|
9 |
-
if (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") {
|
10 |
-
$pageURL .= "s";
|
11 |
-
}
|
12 |
-
$pageURL .= "://";
|
13 |
-
if ($_SERVER["SERVER_PORT"] != "80") {
|
14 |
-
$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
|
15 |
-
} else {
|
16 |
-
$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
|
17 |
-
}
|
18 |
-
|
19 |
-
$pageURL = preg_replace("/\?.*$/", "", $pageURL);
|
20 |
-
|
21 |
-
return $pageURL;
|
22 |
-
}
|
23 |
-
|
24 |
-
protected function getPasswordBox($name, $value) {
|
25 |
-
return '<input type="password" id="'.$name.'" name="'.$name.'" value="'.$value.'" class=" input-text" />';
|
26 |
-
}
|
27 |
-
|
28 |
-
protected function getTextArea($name, $value, $rows = 1, $cols = 10, $additionalClass = '') {
|
29 |
-
return '<textarea rows="'.$rows.'" cols="'.$cols.'" id="'.$name.'" name="'.$name.'" class="'.$additionalClass.'" />'.$value.'</textarea>';
|
30 |
-
}
|
31 |
-
|
32 |
-
protected function getInputBox($name, $value) {
|
33 |
-
return '<input type="text" id="'.$name.'" name="'.$name.'" value="'.$value.'" class=" input-text" />';
|
34 |
-
}
|
35 |
-
|
36 |
-
protected function _toHtml() {
|
37 |
-
$html = $this->getTemplateString();
|
38 |
-
foreach ($this->variables as $name => $value) {
|
39 |
-
$html = str_replace('{'.$name.'}', $value, $html);
|
40 |
-
}
|
41 |
-
return $html;
|
42 |
-
}
|
43 |
-
|
44 |
-
protected function _prepareLayout() {
|
45 |
-
parent::_prepareLayout();
|
46 |
-
}
|
47 |
-
|
48 |
-
protected function assignVariable($name, $value) {
|
49 |
-
$this->variables[$name] = $value;
|
50 |
-
}
|
51 |
-
|
52 |
-
protected function getTemplateString() {
|
53 |
-
return '';
|
54 |
-
}
|
55 |
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Qualityunit_Liveagent_Block_Base extends Mage_Core_Block_Template {
|
4 |
+
|
5 |
+
protected $variables = array();
|
6 |
+
|
7 |
+
protected function curPageURL() {
|
8 |
+
$pageURL = 'http';
|
9 |
+
if (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") {
|
10 |
+
$pageURL .= "s";
|
11 |
+
}
|
12 |
+
$pageURL .= "://";
|
13 |
+
if ($_SERVER["SERVER_PORT"] != "80") {
|
14 |
+
$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
|
15 |
+
} else {
|
16 |
+
$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
|
17 |
+
}
|
18 |
+
|
19 |
+
$pageURL = preg_replace("/\?.*$/", "", $pageURL);
|
20 |
+
|
21 |
+
return $pageURL;
|
22 |
+
}
|
23 |
+
|
24 |
+
protected function getPasswordBox($name, $value) {
|
25 |
+
return '<input type="password" id="'.$name.'" name="'.$name.'" value="'.$value.'" class=" input-text" />';
|
26 |
+
}
|
27 |
+
|
28 |
+
protected function getTextArea($name, $value, $rows = 1, $cols = 10, $additionalClass = '') {
|
29 |
+
return '<textarea rows="'.$rows.'" cols="'.$cols.'" id="'.$name.'" name="'.$name.'" class="'.$additionalClass.'" />'.$value.'</textarea>';
|
30 |
+
}
|
31 |
+
|
32 |
+
protected function getInputBox($name, $value) {
|
33 |
+
return '<input type="text" id="'.$name.'" name="'.$name.'" value="'.$value.'" class=" input-text" />';
|
34 |
+
}
|
35 |
+
|
36 |
+
protected function _toHtml() {
|
37 |
+
$html = $this->getTemplateString();
|
38 |
+
foreach ($this->variables as $name => $value) {
|
39 |
+
$html = str_replace('{'.$name.'}', $value, $html);
|
40 |
+
}
|
41 |
+
return $html;
|
42 |
+
}
|
43 |
+
|
44 |
+
protected function _prepareLayout() {
|
45 |
+
parent::_prepareLayout();
|
46 |
+
}
|
47 |
+
|
48 |
+
protected function assignVariable($name, $value) {
|
49 |
+
$this->variables[$name] = $value;
|
50 |
+
}
|
51 |
+
|
52 |
+
protected function getTemplateString() {
|
53 |
+
return '';
|
54 |
+
}
|
55 |
}
|
app/code/local/Qualityunit/Liveagent/Block/Buttoncode.php
CHANGED
@@ -1,112 +1,112 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Qualityunit_Liveagent_Block_Buttoncode extends Qualityunit_Liveagent_Block_Base {
|
4 |
-
|
5 |
-
const SAVE_BUTTON_CODE_ACTION_FLAG = 'sb';
|
6 |
-
|
7 |
-
public function _prepareLayout() {
|
8 |
-
$settings = new Qualityunit_Liveagent_Helper_Settings();
|
9 |
-
parent::_prepareLayout();
|
10 |
-
$this->assignVariable('dialogCaption', Mage::helper('adminhtml')->__('LiveAgent - Free live chat and helpdesk plugin for Magento'));
|
11 |
-
$this->assignVariable('submitCaption', Mage::helper('adminhtml')->__('Save'));
|
12 |
-
$this->assignVariable('formKey', Mage::getSingleton('core/session')->getFormKey());
|
13 |
-
$this->assignVariable('saveUrlAction', $this->getUrl('*/*/post'));
|
14 |
-
$settings = new Qualityunit_Liveagent_Helper_Settings();
|
15 |
-
$code = htmlentities($settings->getOption(Qualityunit_Liveagent_Helper_Settings::BUTTON_CODE));
|
16 |
-
$this->assignVariable('la-config-button-code', $this->getTextArea('la-config-button-code', $code, 10 ,100, ' textarea'));
|
17 |
-
$this->assignVariable('buttonCodeLabel', Mage::helper('adminhtml')->__('Button code'));
|
18 |
-
$this->assignVariable('buttonCodeHelp', Mage::helper('adminhtml')->__('Place here the code from your LiveAgent admin panel'));
|
19 |
-
$this->assignVariable('saveButtonCodeFlag', self::SAVE_BUTTON_CODE_ACTION_FLAG);
|
20 |
-
$this->assignVariable('accountSectionLabel', Mage::helper('adminhtml')->__('Your account'));
|
21 |
-
$this->assignVariable('accountUrlLabel', Mage::helper('adminhtml')->__('Account url'));
|
22 |
-
$this->assignVariable('la-url', $settings->getOption(Qualityunit_Liveagent_Helper_Settings::LA_URL_SETTING_NAME));
|
23 |
-
$this->assignVariable('loginLabel', Mage::helper('adminhtml')->__('login'));
|
24 |
-
$this->assignVariable('loginUrl', $this->getLoginUrl($settings));
|
25 |
-
$this->assignVariable('ChangeLabel', Mage::helper('adminhtml')->__('change'));
|
26 |
-
$this->assignVariable('ChangeUrl', $this->getUrl('*/*/index', array('key' => $this->getRequest()->get('key'), 'action' => Qualityunit_Liveagent_Block_Account::CHANGE_ACCOUNT_ACTION_FLAG)));
|
27 |
-
$this->assignVariable('integrationSectionLabel', Mage::helper('adminhtml')->__('Integration'));
|
28 |
-
$this->assignVariable('contactLink', Mage::helper('adminhtml')->__('contact us'));
|
29 |
-
$this->assignVariable('contactHelp', Mage::helper('adminhtml')->__('Do you need any help with this plugin? Feel free to'));
|
30 |
-
}
|
31 |
-
|
32 |
-
private function getLoginUrl(Qualityunit_Liveagent_Helper_Settings $settings) {
|
33 |
-
try {
|
34 |
-
$authToken = $settings->getOwnerAuthToken();
|
35 |
-
} catch (Exception $e) {
|
36 |
-
$authToken = '';
|
37 |
-
}
|
38 |
-
if ($authToken == '') {
|
39 |
-
$sessionId = $settings->getOwnerSessionId();
|
40 |
-
if ($sessionId != '') {
|
41 |
-
return $settings->getLiveAgentUrl() . '/agent/index.php?S='.$settings->getOwnerSessionId();
|
42 |
-
}
|
43 |
-
return $settings->getLiveAgentUrl() . '/agent/index.php';
|
44 |
-
}
|
45 |
-
return $settings->getLiveAgentUrl() . '/agent/index.php?AuthToken='.$authToken;
|
46 |
-
}
|
47 |
-
|
48 |
-
protected function getTemplateString() {
|
49 |
-
return '
|
50 |
-
<form id="configForm" name="edit_form" action="{saveUrlAction}" method="post">
|
51 |
-
<input name="form_key" type="hidden" value="{formKey}" />
|
52 |
-
<input name="action" type="hidden" value="{saveButtonCodeFlag}"/>
|
53 |
-
<div class="content-header">
|
54 |
-
<table cellspacing="0">
|
55 |
-
<tbody><tr>
|
56 |
-
<td style="width:50%;"><h3 class="icon-head head-promo-catalog">{dialogCaption}</h3></td>
|
57 |
-
<td class="form-buttons"><button id="id_5806f3a306fa79f4340cb58c1d190ff5" type="button" class="scalable save" onclick="configForm.submit()" style=""><span>{submitCaption}</span></button></td>
|
58 |
-
</tr>
|
59 |
-
</tbody>
|
60 |
-
</table>
|
61 |
-
</div>
|
62 |
-
<div class="entry-edit">
|
63 |
-
<fieldset>
|
64 |
-
{contactHelp} <a href="http://support.qualityunit.com/submit_ticket" target="_blank">{contactLink}</a>.
|
65 |
-
</fieldset>
|
66 |
-
</div>
|
67 |
-
<div class="entry-edit">
|
68 |
-
<div class="entry-edit-head"><h4>{accountSectionLabel}</h4></div>
|
69 |
-
<fieldset>
|
70 |
-
<table cellspacing="0" class="form-list">
|
71 |
-
<colgroup class="label"></colgroup>
|
72 |
-
<colgroup class="value"></colgroup>
|
73 |
-
<colgroup class="scope-label"></colgroup>
|
74 |
-
<colgroup class=""></colgroup>
|
75 |
-
<tbody>
|
76 |
-
<tr id="row_la_url">
|
77 |
-
<td class="label"><label for="row_la_url">{accountUrlLabel}:</label></td>
|
78 |
-
<td class="value">{la-url}
|
79 |
-
<a href="{loginUrl}" target="_balnk">{loginLabel}</a></button>
|
80 |
-
|
81 |
-
<a href="{ChangeUrl}">{ChangeLabel}</a></button>
|
82 |
-
</td>
|
83 |
-
<td class="scope-label"></td><td></td>
|
84 |
-
</tr>
|
85 |
-
</tbody>
|
86 |
-
</table>
|
87 |
-
</fieldset>
|
88 |
-
</div>
|
89 |
-
<div class="entry-edit">
|
90 |
-
<div class="entry-edit-head"><h4>{integrationSectionLabel}</h4></div>
|
91 |
-
<fieldset>
|
92 |
-
<table cellspacing="0" class="form-list">
|
93 |
-
<colgroup class="label"></colgroup>
|
94 |
-
<colgroup class="value"></colgroup>
|
95 |
-
<colgroup class="scope-label"></colgroup>
|
96 |
-
<colgroup class=""></colgroup>
|
97 |
-
<tbody>
|
98 |
-
<tr id="la-config-button-code">
|
99 |
-
<td class="label"><label for="la-config-button-code">{buttonCodeLabel}:</label></td>
|
100 |
-
<td class="value">{la-config-button-code}
|
101 |
-
<p class="note"><span>{buttonCodeHelp}</span></p>
|
102 |
-
</td>
|
103 |
-
<td class="scope-label"></td><td></td>
|
104 |
-
</tr>
|
105 |
-
</tbody>
|
106 |
-
</table>
|
107 |
-
</fieldset>
|
108 |
-
</div>
|
109 |
-
</form>
|
110 |
-
';
|
111 |
-
}
|
112 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Qualityunit_Liveagent_Block_Buttoncode extends Qualityunit_Liveagent_Block_Base {
|
4 |
+
|
5 |
+
const SAVE_BUTTON_CODE_ACTION_FLAG = 'sb';
|
6 |
+
|
7 |
+
public function _prepareLayout() {
|
8 |
+
$settings = new Qualityunit_Liveagent_Helper_Settings();
|
9 |
+
parent::_prepareLayout();
|
10 |
+
$this->assignVariable('dialogCaption', Mage::helper('adminhtml')->__('LiveAgent - Free live chat and helpdesk plugin for Magento'));
|
11 |
+
$this->assignVariable('submitCaption', Mage::helper('adminhtml')->__('Save'));
|
12 |
+
$this->assignVariable('formKey', Mage::getSingleton('core/session')->getFormKey());
|
13 |
+
$this->assignVariable('saveUrlAction', $this->getUrl('*/*/post'));
|
14 |
+
$settings = new Qualityunit_Liveagent_Helper_Settings();
|
15 |
+
$code = htmlentities($settings->getOption(Qualityunit_Liveagent_Helper_Settings::BUTTON_CODE));
|
16 |
+
$this->assignVariable('la-config-button-code', $this->getTextArea('la-config-button-code', $code, 10 ,100, ' textarea'));
|
17 |
+
$this->assignVariable('buttonCodeLabel', Mage::helper('adminhtml')->__('Button code'));
|
18 |
+
$this->assignVariable('buttonCodeHelp', Mage::helper('adminhtml')->__('Place here the code from your LiveAgent admin panel'));
|
19 |
+
$this->assignVariable('saveButtonCodeFlag', self::SAVE_BUTTON_CODE_ACTION_FLAG);
|
20 |
+
$this->assignVariable('accountSectionLabel', Mage::helper('adminhtml')->__('Your account'));
|
21 |
+
$this->assignVariable('accountUrlLabel', Mage::helper('adminhtml')->__('Account url'));
|
22 |
+
$this->assignVariable('la-url', $settings->getOption(Qualityunit_Liveagent_Helper_Settings::LA_URL_SETTING_NAME));
|
23 |
+
$this->assignVariable('loginLabel', Mage::helper('adminhtml')->__('login'));
|
24 |
+
$this->assignVariable('loginUrl', $this->getLoginUrl($settings));
|
25 |
+
$this->assignVariable('ChangeLabel', Mage::helper('adminhtml')->__('change'));
|
26 |
+
$this->assignVariable('ChangeUrl', $this->getUrl('*/*/index', array('key' => $this->getRequest()->get('key'), 'action' => Qualityunit_Liveagent_Block_Account::CHANGE_ACCOUNT_ACTION_FLAG)));
|
27 |
+
$this->assignVariable('integrationSectionLabel', Mage::helper('adminhtml')->__('Integration'));
|
28 |
+
$this->assignVariable('contactLink', Mage::helper('adminhtml')->__('contact us'));
|
29 |
+
$this->assignVariable('contactHelp', Mage::helper('adminhtml')->__('Do you need any help with this plugin? Feel free to'));
|
30 |
+
}
|
31 |
+
|
32 |
+
private function getLoginUrl(Qualityunit_Liveagent_Helper_Settings $settings) {
|
33 |
+
try {
|
34 |
+
$authToken = $settings->getOwnerAuthToken();
|
35 |
+
} catch (Exception $e) {
|
36 |
+
$authToken = '';
|
37 |
+
}
|
38 |
+
if ($authToken == '') {
|
39 |
+
$sessionId = $settings->getOwnerSessionId();
|
40 |
+
if ($sessionId != '') {
|
41 |
+
return $settings->getLiveAgentUrl() . '/agent/index.php?S='.$settings->getOwnerSessionId();
|
42 |
+
}
|
43 |
+
return $settings->getLiveAgentUrl() . '/agent/index.php';
|
44 |
+
}
|
45 |
+
return $settings->getLiveAgentUrl() . '/agent/index.php?AuthToken='.$authToken;
|
46 |
+
}
|
47 |
+
|
48 |
+
protected function getTemplateString() {
|
49 |
+
return '
|
50 |
+
<form id="configForm" name="edit_form" action="{saveUrlAction}" method="post">
|
51 |
+
<input name="form_key" type="hidden" value="{formKey}" />
|
52 |
+
<input name="action" type="hidden" value="{saveButtonCodeFlag}"/>
|
53 |
+
<div class="content-header">
|
54 |
+
<table cellspacing="0">
|
55 |
+
<tbody><tr>
|
56 |
+
<td style="width:50%;"><h3 class="icon-head head-promo-catalog">{dialogCaption}</h3></td>
|
57 |
+
<td class="form-buttons"><button id="id_5806f3a306fa79f4340cb58c1d190ff5" type="button" class="scalable save" onclick="configForm.submit()" style=""><span>{submitCaption}</span></button></td>
|
58 |
+
</tr>
|
59 |
+
</tbody>
|
60 |
+
</table>
|
61 |
+
</div>
|
62 |
+
<div class="entry-edit">
|
63 |
+
<fieldset>
|
64 |
+
{contactHelp} <a href="http://support.qualityunit.com/submit_ticket" target="_blank">{contactLink}</a>.
|
65 |
+
</fieldset>
|
66 |
+
</div>
|
67 |
+
<div class="entry-edit">
|
68 |
+
<div class="entry-edit-head"><h4>{accountSectionLabel}</h4></div>
|
69 |
+
<fieldset>
|
70 |
+
<table cellspacing="0" class="form-list">
|
71 |
+
<colgroup class="label"></colgroup>
|
72 |
+
<colgroup class="value"></colgroup>
|
73 |
+
<colgroup class="scope-label"></colgroup>
|
74 |
+
<colgroup class=""></colgroup>
|
75 |
+
<tbody>
|
76 |
+
<tr id="row_la_url">
|
77 |
+
<td class="label"><label for="row_la_url">{accountUrlLabel}:</label></td>
|
78 |
+
<td class="value">{la-url}
|
79 |
+
<a href="{loginUrl}" target="_balnk">{loginLabel}</a></button>
|
80 |
+
|
81 |
+
<a href="{ChangeUrl}">{ChangeLabel}</a></button>
|
82 |
+
</td>
|
83 |
+
<td class="scope-label"></td><td></td>
|
84 |
+
</tr>
|
85 |
+
</tbody>
|
86 |
+
</table>
|
87 |
+
</fieldset>
|
88 |
+
</div>
|
89 |
+
<div class="entry-edit">
|
90 |
+
<div class="entry-edit-head"><h4>{integrationSectionLabel}</h4></div>
|
91 |
+
<fieldset>
|
92 |
+
<table cellspacing="0" class="form-list">
|
93 |
+
<colgroup class="label"></colgroup>
|
94 |
+
<colgroup class="value"></colgroup>
|
95 |
+
<colgroup class="scope-label"></colgroup>
|
96 |
+
<colgroup class=""></colgroup>
|
97 |
+
<tbody>
|
98 |
+
<tr id="la-config-button-code">
|
99 |
+
<td class="label"><label for="la-config-button-code">{buttonCodeLabel}:</label></td>
|
100 |
+
<td class="value">{la-config-button-code}
|
101 |
+
<p class="note"><span>{buttonCodeHelp}</span></p>
|
102 |
+
</td>
|
103 |
+
<td class="scope-label"></td><td></td>
|
104 |
+
</tr>
|
105 |
+
</tbody>
|
106 |
+
</table>
|
107 |
+
</fieldset>
|
108 |
+
</div>
|
109 |
+
</form>
|
110 |
+
';
|
111 |
+
}
|
112 |
+
}
|
app/code/local/Qualityunit/Liveagent/Block/Signup.php
CHANGED
@@ -1,124 +1,124 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Qualityunit_Liveagent_Block_Signup extends Qualityunit_Liveagent_Block_Base {
|
4 |
-
|
5 |
-
const FULL_NAME_FIELD = 'la-full-name';
|
6 |
-
|
7 |
-
public function _prepareLayout() {
|
8 |
-
parent::_prepareLayout();
|
9 |
-
$this->assignVariable('dialogCaption', Mage::helper('adminhtml')->__('LiveAgent - Free live chat and helpdesk plugin for Magento'));
|
10 |
-
$this->assignVariable(self::FULL_NAME_FIELD, $this->getInputBox(self::FULL_NAME_FIELD, $this->getOwnerName()));
|
11 |
-
$this->assignVariable(Qualityunit_Liveagent_Helper_Settings::LA_OWNER_EMAIL_SETTING_NAME, $this->getInputBox(Qualityunit_Liveagent_Helper_Settings::LA_OWNER_EMAIL_SETTING_NAME, $this->getOwnerEmail()));
|
12 |
-
$this->assignVariable(Qualityunit_Liveagent_Helper_Settings::LA_URL_SETTING_NAME, $this->getInputBox(Qualityunit_Liveagent_Helper_Settings::LA_URL_SETTING_NAME, $this->getdomainOnly()));
|
13 |
-
$this->assignVariable('submitCaption', Mage::helper('adminhtml')->__('Create your Free account'));
|
14 |
-
$this->assignVariable('skipUrlAction', $this->getUrl('*/*/index', array('key' => $this->getRequest()->get('key'), 'action' => Qualityunit_Liveagent_Block_Account::CREATE_ACCOUNT_ACTION_FLAF)));
|
15 |
-
$this->assignVariable('registerUrlAction', $this->getUrl('*/*/post'));
|
16 |
-
$this->assignVariable('formKey', Mage::getSingleton('core/session')->getFormKey());
|
17 |
-
$this->assignVariable('fullNameLabel', Mage::helper('adminhtml')->__('Full name'));
|
18 |
-
$this->assignVariable('emailLabel', Mage::helper('adminhtml')->__('Email'));
|
19 |
-
$this->assignVariable('fullNameHelp', Mage::helper('adminhtml')->__('Your first name and last name'));
|
20 |
-
$this->assignVariable('urlLabel', Mage::helper('adminhtml')->__('Domain selection'));
|
21 |
-
$this->assignVariable('urlHelp', Mage::helper('adminhtml')->__('.ladesk.com'));
|
22 |
-
$this->assignVariable('termsLabel', Mage::helper('adminhtml')->__('By creating an account I agree to'));
|
23 |
-
$this->assignVariable('termsLink', Mage::helper('adminhtml')->__('Terms & Conditions'));
|
24 |
-
$this->assignVariable('skipLink', Mage::helper('adminhtml')->__('Skip this step, I already have an account'));
|
25 |
-
$this->assignVariable('settingsSection', Mage::helper('adminhtml')->__('New account'));
|
26 |
-
$this->assignVariable('pluginHelpText', Mage::helper('adminhtml')->__('We want you to enjoy the full functionality of LiveAgent with the free account. It does not limit the number of agents and you have the option to activate the most of available features.'));
|
27 |
-
}
|
28 |
-
|
29 |
-
private function getdomainOnly() {
|
30 |
-
$domain = preg_replace('/^(.*\.)?([^.]*\..*)$/', '$2', @$_SERVER['HTTP_HOST']);
|
31 |
-
if (trim($domain) == 'localhost') {
|
32 |
-
return '';
|
33 |
-
}
|
34 |
-
if (preg_match('/^[a-zA-Z0-9\-]+$/', $domain) === false) {
|
35 |
-
return '';
|
36 |
-
}
|
37 |
-
return $domain;
|
38 |
-
}
|
39 |
-
|
40 |
-
private function getOwnerName() {
|
41 |
-
try {
|
42 |
-
$user = Mage::getSingleton('admin/session')->getUser();
|
43 |
-
return $user->getFirstname() . ' ' . $user->getLastname();
|
44 |
-
} catch (Exception $e) {
|
45 |
-
Mage::log($e->getMessage(), Zend_Log::ERR);
|
46 |
-
return '';
|
47 |
-
}
|
48 |
-
}
|
49 |
-
|
50 |
-
private function getOwnerEmail() {
|
51 |
-
try {
|
52 |
-
$user = Mage::getSingleton('admin/session')->getUser();
|
53 |
-
return $user->getEmail();
|
54 |
-
} catch (Exception $e) {
|
55 |
-
Mage::log($e->getMessage(), Zend_Log::ERR);
|
56 |
-
return '';
|
57 |
-
}
|
58 |
-
}
|
59 |
-
|
60 |
-
protected function getTemplateString() {
|
61 |
-
return '
|
62 |
-
<script type="text/javascript">
|
63 |
-
var skipCreate = function() {
|
64 |
-
setLocation(\'{skipUrlAction}\')
|
65 |
-
}
|
66 |
-
</script>
|
67 |
-
<form id="configForm" name="edit_form" action="{registerUrlAction}" method="post">
|
68 |
-
<input name="form_key" type="hidden" value="{formKey}" />
|
69 |
-
<input name="action" type="hidden" value="r"/>
|
70 |
-
<div class="content-header">
|
71 |
-
<table cellspacing="0">
|
72 |
-
<tbody><tr>
|
73 |
-
<td style="width:50%;"><h3 class="icon-head head-promo-catalog">{dialogCaption}</h3></td>
|
74 |
-
<td class="form-buttons"><button id="id_5806f3a306fa79f4340cb58c1d190ff5" type="button" class="scalable save" onclick="configForm.submit()" style=""><span>{submitCaption}</span></button></td>
|
75 |
-
</tr>
|
76 |
-
</tbody>
|
77 |
-
</table>
|
78 |
-
</div>
|
79 |
-
<div class="entry-edit">
|
80 |
-
<fieldset>
|
81 |
-
{pluginHelpText}
|
82 |
-
</fieldset>
|
83 |
-
</div>
|
84 |
-
<div class="entry-edit">
|
85 |
-
<div class="entry-edit-head"><h4>{settingsSection}</h4></div>
|
86 |
-
<fieldset>
|
87 |
-
<table cellspacing="0" class="form-list">
|
88 |
-
<colgroup class="label"></colgroup>
|
89 |
-
<colgroup class="value"></colgroup>
|
90 |
-
<colgroup class="scope-label"></colgroup>
|
91 |
-
<colgroup class=""></colgroup>
|
92 |
-
<tbody>
|
93 |
-
<tr id="row_la_full_name">
|
94 |
-
<td class="label"><label for="row_la_full_name">{fullNameLabel}</label></td>
|
95 |
-
<td class="value">{la-full-name}
|
96 |
-
<p class="note"><span>{fullNameHelp}</span></p></td>
|
97 |
-
<td class="scope-label"></td><td></td>
|
98 |
-
</tr>
|
99 |
-
<tr id="row_owner_email">
|
100 |
-
<td class="label"><label for="row_owner_email">{emailLabel}</label></td>
|
101 |
-
<td class="value">{la-owner-email}</td>
|
102 |
-
<td class="scope-label"></td><td></td>
|
103 |
-
</tr>
|
104 |
-
<tr id="row_owner_pass">
|
105 |
-
<td class="label"><label for="row_owner_pass">{urlLabel}</label></td>
|
106 |
-
<td class="value">{la-url}</td>
|
107 |
-
<td class="scope-label">{urlHelp}</td><td></td>
|
108 |
-
</tr>
|
109 |
-
<tr>
|
110 |
-
<td colspan="4" class="scope-label">{termsLabel} <a target="_blank" href="http://www.qualityunit.com/liveagent/pricing/hosted/terms-and-conditions">{termsLink}</a>.</td>
|
111 |
-
</tr>
|
112 |
-
<tr>
|
113 |
-
<td colspan="4" class="scope-label"></td>
|
114 |
-
</tr>
|
115 |
-
<tr>
|
116 |
-
<td colspan="4" class="scope-label"><button onclick="skipCreate()" type="button" class="scalable "><span>{skipLink}</span></button></td>
|
117 |
-
</tr>
|
118 |
-
</tbody>
|
119 |
-
</table>
|
120 |
-
</fieldset>
|
121 |
-
</div>
|
122 |
-
';
|
123 |
-
}
|
124 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Qualityunit_Liveagent_Block_Signup extends Qualityunit_Liveagent_Block_Base {
|
4 |
+
|
5 |
+
const FULL_NAME_FIELD = 'la-full-name';
|
6 |
+
|
7 |
+
public function _prepareLayout() {
|
8 |
+
parent::_prepareLayout();
|
9 |
+
$this->assignVariable('dialogCaption', Mage::helper('adminhtml')->__('LiveAgent - Free live chat and helpdesk plugin for Magento'));
|
10 |
+
$this->assignVariable(self::FULL_NAME_FIELD, $this->getInputBox(self::FULL_NAME_FIELD, $this->getOwnerName()));
|
11 |
+
$this->assignVariable(Qualityunit_Liveagent_Helper_Settings::LA_OWNER_EMAIL_SETTING_NAME, $this->getInputBox(Qualityunit_Liveagent_Helper_Settings::LA_OWNER_EMAIL_SETTING_NAME, $this->getOwnerEmail()));
|
12 |
+
$this->assignVariable(Qualityunit_Liveagent_Helper_Settings::LA_URL_SETTING_NAME, $this->getInputBox(Qualityunit_Liveagent_Helper_Settings::LA_URL_SETTING_NAME, $this->getdomainOnly()));
|
13 |
+
$this->assignVariable('submitCaption', Mage::helper('adminhtml')->__('Create your Free account'));
|
14 |
+
$this->assignVariable('skipUrlAction', $this->getUrl('*/*/index', array('key' => $this->getRequest()->get('key'), 'action' => Qualityunit_Liveagent_Block_Account::CREATE_ACCOUNT_ACTION_FLAF)));
|
15 |
+
$this->assignVariable('registerUrlAction', $this->getUrl('*/*/post'));
|
16 |
+
$this->assignVariable('formKey', Mage::getSingleton('core/session')->getFormKey());
|
17 |
+
$this->assignVariable('fullNameLabel', Mage::helper('adminhtml')->__('Full name'));
|
18 |
+
$this->assignVariable('emailLabel', Mage::helper('adminhtml')->__('Email'));
|
19 |
+
$this->assignVariable('fullNameHelp', Mage::helper('adminhtml')->__('Your first name and last name'));
|
20 |
+
$this->assignVariable('urlLabel', Mage::helper('adminhtml')->__('Domain selection'));
|
21 |
+
$this->assignVariable('urlHelp', Mage::helper('adminhtml')->__('.ladesk.com'));
|
22 |
+
$this->assignVariable('termsLabel', Mage::helper('adminhtml')->__('By creating an account I agree to'));
|
23 |
+
$this->assignVariable('termsLink', Mage::helper('adminhtml')->__('Terms & Conditions'));
|
24 |
+
$this->assignVariable('skipLink', Mage::helper('adminhtml')->__('Skip this step, I already have an account'));
|
25 |
+
$this->assignVariable('settingsSection', Mage::helper('adminhtml')->__('New account'));
|
26 |
+
$this->assignVariable('pluginHelpText', Mage::helper('adminhtml')->__('We want you to enjoy the full functionality of LiveAgent with the free account. It does not limit the number of agents and you have the option to activate the most of available features.'));
|
27 |
+
}
|
28 |
+
|
29 |
+
private function getdomainOnly() {
|
30 |
+
$domain = preg_replace('/^(.*\.)?([^.]*\..*)$/', '$2', @$_SERVER['HTTP_HOST']);
|
31 |
+
if (trim($domain) == 'localhost') {
|
32 |
+
return '';
|
33 |
+
}
|
34 |
+
if (preg_match('/^[a-zA-Z0-9\-]+$/', $domain) === false) {
|
35 |
+
return '';
|
36 |
+
}
|
37 |
+
return $domain;
|
38 |
+
}
|
39 |
+
|
40 |
+
private function getOwnerName() {
|
41 |
+
try {
|
42 |
+
$user = Mage::getSingleton('admin/session')->getUser();
|
43 |
+
return $user->getFirstname() . ' ' . $user->getLastname();
|
44 |
+
} catch (Exception $e) {
|
45 |
+
Mage::log($e->getMessage(), Zend_Log::ERR);
|
46 |
+
return '';
|
47 |
+
}
|
48 |
+
}
|
49 |
+
|
50 |
+
private function getOwnerEmail() {
|
51 |
+
try {
|
52 |
+
$user = Mage::getSingleton('admin/session')->getUser();
|
53 |
+
return $user->getEmail();
|
54 |
+
} catch (Exception $e) {
|
55 |
+
Mage::log($e->getMessage(), Zend_Log::ERR);
|
56 |
+
return '';
|
57 |
+
}
|
58 |
+
}
|
59 |
+
|
60 |
+
protected function getTemplateString() {
|
61 |
+
return '
|
62 |
+
<script type="text/javascript">
|
63 |
+
var skipCreate = function() {
|
64 |
+
setLocation(\'{skipUrlAction}\')
|
65 |
+
}
|
66 |
+
</script>
|
67 |
+
<form id="configForm" name="edit_form" action="{registerUrlAction}" method="post">
|
68 |
+
<input name="form_key" type="hidden" value="{formKey}" />
|
69 |
+
<input name="action" type="hidden" value="r"/>
|
70 |
+
<div class="content-header">
|
71 |
+
<table cellspacing="0">
|
72 |
+
<tbody><tr>
|
73 |
+
<td style="width:50%;"><h3 class="icon-head head-promo-catalog">{dialogCaption}</h3></td>
|
74 |
+
<td class="form-buttons"><button id="id_5806f3a306fa79f4340cb58c1d190ff5" type="button" class="scalable save" onclick="configForm.submit()" style=""><span>{submitCaption}</span></button></td>
|
75 |
+
</tr>
|
76 |
+
</tbody>
|
77 |
+
</table>
|
78 |
+
</div>
|
79 |
+
<div class="entry-edit">
|
80 |
+
<fieldset>
|
81 |
+
{pluginHelpText}
|
82 |
+
</fieldset>
|
83 |
+
</div>
|
84 |
+
<div class="entry-edit">
|
85 |
+
<div class="entry-edit-head"><h4>{settingsSection}</h4></div>
|
86 |
+
<fieldset>
|
87 |
+
<table cellspacing="0" class="form-list">
|
88 |
+
<colgroup class="label"></colgroup>
|
89 |
+
<colgroup class="value"></colgroup>
|
90 |
+
<colgroup class="scope-label"></colgroup>
|
91 |
+
<colgroup class=""></colgroup>
|
92 |
+
<tbody>
|
93 |
+
<tr id="row_la_full_name">
|
94 |
+
<td class="label"><label for="row_la_full_name">{fullNameLabel}</label></td>
|
95 |
+
<td class="value">{la-full-name}
|
96 |
+
<p class="note"><span>{fullNameHelp}</span></p></td>
|
97 |
+
<td class="scope-label"></td><td></td>
|
98 |
+
</tr>
|
99 |
+
<tr id="row_owner_email">
|
100 |
+
<td class="label"><label for="row_owner_email">{emailLabel}</label></td>
|
101 |
+
<td class="value">{la-owner-email}</td>
|
102 |
+
<td class="scope-label"></td><td></td>
|
103 |
+
</tr>
|
104 |
+
<tr id="row_owner_pass">
|
105 |
+
<td class="label"><label for="row_owner_pass">{urlLabel}</label></td>
|
106 |
+
<td class="value">{la-url}</td>
|
107 |
+
<td class="scope-label">{urlHelp}</td><td></td>
|
108 |
+
</tr>
|
109 |
+
<tr>
|
110 |
+
<td colspan="4" class="scope-label">{termsLabel} <a target="_blank" href="http://www.qualityunit.com/liveagent/pricing/hosted/terms-and-conditions">{termsLink}</a>.</td>
|
111 |
+
</tr>
|
112 |
+
<tr>
|
113 |
+
<td colspan="4" class="scope-label"></td>
|
114 |
+
</tr>
|
115 |
+
<tr>
|
116 |
+
<td colspan="4" class="scope-label"><button onclick="skipCreate()" type="button" class="scalable "><span>{skipLink}</span></button></td>
|
117 |
+
</tr>
|
118 |
+
</tbody>
|
119 |
+
</table>
|
120 |
+
</fieldset>
|
121 |
+
</div>
|
122 |
+
';
|
123 |
+
}
|
124 |
+
}
|
app/code/local/Qualityunit/Liveagent/Block/Waiting.php
CHANGED
@@ -1,72 +1,72 @@
|
|
1 |
-
<?php
|
2 |
-
class Qualityunit_Liveagent_Block_Waiting extends Qualityunit_Liveagent_Block_Base {
|
3 |
-
protected function _prepareLayout() {
|
4 |
-
parent::_prepareLayout();
|
5 |
-
$this->assignVariable('dialogCaption', Mage::helper('adminhtml')->__('LiveAgent - Free live chat and helpdesk plugin for Magento'));
|
6 |
-
$this->assignVariable('sectionCaption', Mage::helper('adminhtml')->__('Account Installation'));
|
7 |
-
$this->assignVariable('completeUrlAction', $this->getUrl('*/*/post'));
|
8 |
-
$this->assignVariable('installingText', Mage::helper('adminhtml')->__('Thank you! Your account will be online within next few minutes. Please wait...'));
|
9 |
-
$this->assignVariable('confEmailText', Mage::helper('adminhtml')->__('You should recieve confirmation email with your account credentials shortly.'));
|
10 |
-
$this->assignVariable('bitLongerText', Mage::helper('adminhtml')->__('Note: Sometimes account creation process may take a '));
|
11 |
-
$this->assignVariable('bitLongerLink', Mage::helper('adminhtml')->__('bit longer'));
|
12 |
-
$this->assignVariable('installText', Mage::helper('adminhtml')->__('Installing'));
|
13 |
-
$this->assignVariable('formKey', Mage::getSingleton('core/session')->getFormKey());
|
14 |
-
$this->assignVariable('initializingText', Mage::helper('adminhtml')->__('Initializing...'));
|
15 |
-
|
16 |
-
}
|
17 |
-
|
18 |
-
protected function getTemplateString() {
|
19 |
-
return '
|
20 |
-
<form id="liveagent_wait_form" name="edit_form" action="{completeUrlAction}" method="post">
|
21 |
-
<input name="form_key" type="hidden" value="{formKey}" />
|
22 |
-
<input name="action" type="hidden" value="r"/>
|
23 |
-
</form>
|
24 |
-
<div class="content-header">
|
25 |
-
<table cellspacing="0">
|
26 |
-
<tbody><tr>
|
27 |
-
<td style="width:50%;"><h3 class="icon-head head-promo-catalog">{dialogCaption}</h3></td>
|
28 |
-
</tr>
|
29 |
-
</tbody>
|
30 |
-
</table>
|
31 |
-
</div>
|
32 |
-
<div class="entry-edit">
|
33 |
-
<div class="entry-edit-head"><h4>{sectionCaption}</h4></div>
|
34 |
-
<fieldset>
|
35 |
-
<table cellspacing="0" class="form-list">
|
36 |
-
<tbody>
|
37 |
-
<tr>
|
38 |
-
<td>{installingText}</td>
|
39 |
-
</tr>
|
40 |
-
<tr>
|
41 |
-
<td>{confEmailText}</td>
|
42 |
-
</tr>
|
43 |
-
<tr>
|
44 |
-
<td ></td>
|
45 |
-
</tr>
|
46 |
-
<tr>
|
47 |
-
<td><div name="liveagent_wait_status" id="liveagent_wait_status" style="padding:10px;">{installText}...</div></td>
|
48 |
-
</tr>
|
49 |
-
<tr>
|
50 |
-
<td></td>
|
51 |
-
</tr>
|
52 |
-
<tr>
|
53 |
-
<td><i>{bitLongerText}</i><a href="http://support.qualityunit.com/knowledgebase/live-agent/integration/magento-plugin/frequently-asked-questions.html" target="_blank">{bitLongerLink}</a></td>
|
54 |
-
</tr>
|
55 |
-
</tbody>
|
56 |
-
</table>
|
57 |
-
</fieldset>
|
58 |
-
</div>
|
59 |
-
<script type="text/javascript"><!--//--><![CDATA[//><!--
|
60 |
-
setTimeout("document.getElementById(\'liveagent_wait_status\').innerHTML = \'{initializingText}\'", 5);
|
61 |
-
var timer = 3000;
|
62 |
-
var percentage = 4;
|
63 |
-
for (i=0;i<24;i++) {
|
64 |
-
setTimeout("document.getElementById(\'liveagent_wait_status\').innerHTML = \'{installText} " + percentage + "% ...\'", timer);
|
65 |
-
timer+=1000;
|
66 |
-
percentage+=4;
|
67 |
-
}
|
68 |
-
setTimeout("window.location.reload()", timer);
|
69 |
-
//--><!]]></script>
|
70 |
-
';
|
71 |
-
}
|
72 |
-
}
|
1 |
+
<?php
|
2 |
+
class Qualityunit_Liveagent_Block_Waiting extends Qualityunit_Liveagent_Block_Base {
|
3 |
+
protected function _prepareLayout() {
|
4 |
+
parent::_prepareLayout();
|
5 |
+
$this->assignVariable('dialogCaption', Mage::helper('adminhtml')->__('LiveAgent - Free live chat and helpdesk plugin for Magento'));
|
6 |
+
$this->assignVariable('sectionCaption', Mage::helper('adminhtml')->__('Account Installation'));
|
7 |
+
$this->assignVariable('completeUrlAction', $this->getUrl('*/*/post'));
|
8 |
+
$this->assignVariable('installingText', Mage::helper('adminhtml')->__('Thank you! Your account will be online within next few minutes. Please wait...'));
|
9 |
+
$this->assignVariable('confEmailText', Mage::helper('adminhtml')->__('You should recieve confirmation email with your account credentials shortly.'));
|
10 |
+
$this->assignVariable('bitLongerText', Mage::helper('adminhtml')->__('Note: Sometimes account creation process may take a '));
|
11 |
+
$this->assignVariable('bitLongerLink', Mage::helper('adminhtml')->__('bit longer'));
|
12 |
+
$this->assignVariable('installText', Mage::helper('adminhtml')->__('Installing'));
|
13 |
+
$this->assignVariable('formKey', Mage::getSingleton('core/session')->getFormKey());
|
14 |
+
$this->assignVariable('initializingText', Mage::helper('adminhtml')->__('Initializing...'));
|
15 |
+
|
16 |
+
}
|
17 |
+
|
18 |
+
protected function getTemplateString() {
|
19 |
+
return '
|
20 |
+
<form id="liveagent_wait_form" name="edit_form" action="{completeUrlAction}" method="post">
|
21 |
+
<input name="form_key" type="hidden" value="{formKey}" />
|
22 |
+
<input name="action" type="hidden" value="r"/>
|
23 |
+
</form>
|
24 |
+
<div class="content-header">
|
25 |
+
<table cellspacing="0">
|
26 |
+
<tbody><tr>
|
27 |
+
<td style="width:50%;"><h3 class="icon-head head-promo-catalog">{dialogCaption}</h3></td>
|
28 |
+
</tr>
|
29 |
+
</tbody>
|
30 |
+
</table>
|
31 |
+
</div>
|
32 |
+
<div class="entry-edit">
|
33 |
+
<div class="entry-edit-head"><h4>{sectionCaption}</h4></div>
|
34 |
+
<fieldset>
|
35 |
+
<table cellspacing="0" class="form-list">
|
36 |
+
<tbody>
|
37 |
+
<tr>
|
38 |
+
<td>{installingText}</td>
|
39 |
+
</tr>
|
40 |
+
<tr>
|
41 |
+
<td>{confEmailText}</td>
|
42 |
+
</tr>
|
43 |
+
<tr>
|
44 |
+
<td ></td>
|
45 |
+
</tr>
|
46 |
+
<tr>
|
47 |
+
<td><div name="liveagent_wait_status" id="liveagent_wait_status" style="padding:10px;">{installText}...</div></td>
|
48 |
+
</tr>
|
49 |
+
<tr>
|
50 |
+
<td></td>
|
51 |
+
</tr>
|
52 |
+
<tr>
|
53 |
+
<td><i>{bitLongerText}</i><a href="http://support.qualityunit.com/knowledgebase/live-agent/integration/magento-plugin/frequently-asked-questions.html" target="_blank">{bitLongerLink}</a></td>
|
54 |
+
</tr>
|
55 |
+
</tbody>
|
56 |
+
</table>
|
57 |
+
</fieldset>
|
58 |
+
</div>
|
59 |
+
<script type="text/javascript"><!--//--><![CDATA[//><!--
|
60 |
+
setTimeout("document.getElementById(\'liveagent_wait_status\').innerHTML = \'{initializingText}\'", 5);
|
61 |
+
var timer = 3000;
|
62 |
+
var percentage = 4;
|
63 |
+
for (i=0;i<24;i++) {
|
64 |
+
setTimeout("document.getElementById(\'liveagent_wait_status\').innerHTML = \'{installText} " + percentage + "% ...\'", timer);
|
65 |
+
timer+=1000;
|
66 |
+
percentage+=4;
|
67 |
+
}
|
68 |
+
setTimeout("window.location.reload()", timer);
|
69 |
+
//--><!]]></script>
|
70 |
+
';
|
71 |
+
}
|
72 |
+
}
|
app/code/local/Qualityunit/Liveagent/Helper/.Auth.php.swp
ADDED
Binary file
|
app/code/local/Qualityunit/Liveagent/Helper/Account.php
CHANGED
@@ -1,15 +1,15 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Qualityunit_Liveagent_Helper_Account extends Mage_Core_Helper_Abstract {
|
4 |
-
public static function isOnline() {
|
5 |
-
$auth = new Qualityunit_Liveagent_Helper_Auth();
|
6 |
-
try {
|
7 |
-
$auth->ping();
|
8 |
-
Mage::log('Account is online!', Zend_Log::INFO);
|
9 |
-
return true;
|
10 |
-
} catch (Qualityunit_Liveagent_Exception_ConnectProblem $e) {
|
11 |
-
Mage::log('Account not online', Zend_Log::INFO);
|
12 |
-
return false;
|
13 |
-
}
|
14 |
-
}
|
15 |
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Qualityunit_Liveagent_Helper_Account extends Mage_Core_Helper_Abstract {
|
4 |
+
public static function isOnline() {
|
5 |
+
$auth = new Qualityunit_Liveagent_Helper_Auth();
|
6 |
+
try {
|
7 |
+
$auth->ping();
|
8 |
+
Mage::log('Account is online!', Zend_Log::INFO);
|
9 |
+
return true;
|
10 |
+
} catch (Qualityunit_Liveagent_Exception_ConnectProblem $e) {
|
11 |
+
Mage::log('Account not online', Zend_Log::INFO);
|
12 |
+
return false;
|
13 |
+
}
|
14 |
+
}
|
15 |
}
|
app/code/local/Qualityunit/Liveagent/Helper/Auth.php
CHANGED
@@ -25,9 +25,9 @@ class Qualityunit_Liveagent_Helper_Auth extends Qualityunit_Liveagent_Helper_Bas
|
|
25 |
}
|
26 |
}
|
27 |
|
28 |
-
public function getauthTokenByApi($url, $apiKey) {
|
29 |
$url = $this->getRemoteApiUrl($url);
|
30 |
-
$url .= '?handler=agents/' . urlencode($
|
31 |
|
32 |
$ch = curl_init();
|
33 |
curl_setopt($ch,CURLOPT_URL, $url);
|
@@ -88,4 +88,3 @@ class Qualityunit_Liveagent_Helper_Auth extends Qualityunit_Liveagent_Helper_Bas
|
|
88 |
return $request->getData();
|
89 |
}
|
90 |
}
|
91 |
-
|
25 |
}
|
26 |
}
|
27 |
|
28 |
+
public function getauthTokenByApi($url, $apiKey, $ownerEmail) {
|
29 |
$url = $this->getRemoteApiUrl($url);
|
30 |
+
$url .= '?handler=agents/' . urlencode($ownerEmail) . '&apikey=' . $apiKey;
|
31 |
|
32 |
$ch = curl_init();
|
33 |
curl_setopt($ch,CURLOPT_URL, $url);
|
88 |
return $request->getData();
|
89 |
}
|
90 |
}
|
|
app/code/local/Qualityunit/Liveagent/Helper/Data.php
CHANGED
@@ -1,23 +1,23 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Qualityunit_Liveagent_Helper_Data extends Mage_Core_Helper_Abstract {
|
4 |
-
public static function convertOldButton() {
|
5 |
-
$settings = new Qualityunit_Liveagent_Helper_Settings();
|
6 |
-
$setting = $settings->getOption(Qualityunit_Liveagent_Helper_Settings::BUTTON_CODE);
|
7 |
-
if ($setting != '') {
|
8 |
-
return;
|
9 |
-
}
|
10 |
-
$collection = Mage::getModel('liveagent/buttons')->getCollection();
|
11 |
-
$buttonId = null;
|
12 |
-
foreach ($collection as $button) {
|
13 |
-
if ($buttonId === null && $button->getOnlinestatus() == 'Y' && $button->getContenttype() == 'F') {
|
14 |
-
$buttonId = $button->getButtonid();
|
15 |
-
}
|
16 |
-
$button->delete();
|
17 |
-
}
|
18 |
-
if ($buttonId == null) {
|
19 |
-
return;
|
20 |
-
}
|
21 |
-
$settings->saveButtonCodeForButtonId($buttonId);
|
22 |
-
}
|
23 |
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Qualityunit_Liveagent_Helper_Data extends Mage_Core_Helper_Abstract {
|
4 |
+
public static function convertOldButton() {
|
5 |
+
$settings = new Qualityunit_Liveagent_Helper_Settings();
|
6 |
+
$setting = $settings->getOption(Qualityunit_Liveagent_Helper_Settings::BUTTON_CODE);
|
7 |
+
if ($setting != '') {
|
8 |
+
return;
|
9 |
+
}
|
10 |
+
$collection = Mage::getModel('liveagent/buttons')->getCollection();
|
11 |
+
$buttonId = null;
|
12 |
+
foreach ($collection as $button) {
|
13 |
+
if ($buttonId === null && $button->getOnlinestatus() == 'Y' && $button->getContenttype() == 'F') {
|
14 |
+
$buttonId = $button->getButtonid();
|
15 |
+
}
|
16 |
+
$button->delete();
|
17 |
+
}
|
18 |
+
if ($buttonId == null) {
|
19 |
+
return;
|
20 |
+
}
|
21 |
+
$settings->saveButtonCodeForButtonId($buttonId);
|
22 |
+
}
|
23 |
}
|
app/code/local/Qualityunit/Liveagent/Helper/Settings.php
CHANGED
@@ -62,7 +62,7 @@ class Qualityunit_Liveagent_Helper_Settings {
|
|
62 |
$auth = new Qualityunit_Liveagent_Helper_Auth();
|
63 |
if ($this->getOption(Qualityunit_Liveagent_Helper_Settings::LA_USE_API_KEY) == 'Y') {
|
64 |
//use api and fetch auth token
|
65 |
-
$token = $auth->getauthTokenByApi(null , $this->getOwnerPassword());
|
66 |
$this->setOption(Qualityunit_Liveagent_Helper_Settings::OWNER_AUTHTOKEN, $token);
|
67 |
return $token;
|
68 |
}
|
@@ -143,4 +143,4 @@ function(e){});
|
|
143 |
public function connectionSettingsAreEmpty() {
|
144 |
return $this->getOption(Qualityunit_Liveagent_Helper_Settings::LA_URL_SETTING_NAME) == '' && $this->getOption(Qualityunit_Liveagent_Helper_Settings::LA_OWNER_EMAIL_SETTING_NAME) == '';
|
145 |
}
|
146 |
-
}
|
62 |
$auth = new Qualityunit_Liveagent_Helper_Auth();
|
63 |
if ($this->getOption(Qualityunit_Liveagent_Helper_Settings::LA_USE_API_KEY) == 'Y') {
|
64 |
//use api and fetch auth token
|
65 |
+
$token = $auth->getauthTokenByApi(null , $this->getOwnerPassword(), $this->getOwnerEmail());
|
66 |
$this->setOption(Qualityunit_Liveagent_Helper_Settings::OWNER_AUTHTOKEN, $token);
|
67 |
return $token;
|
68 |
}
|
143 |
public function connectionSettingsAreEmpty() {
|
144 |
return $this->getOption(Qualityunit_Liveagent_Helper_Settings::LA_URL_SETTING_NAME) == '' && $this->getOption(Qualityunit_Liveagent_Helper_Settings::LA_OWNER_EMAIL_SETTING_NAME) == '';
|
145 |
}
|
146 |
+
}
|
app/code/local/Qualityunit/Liveagent/Helper/Signup.php
CHANGED
@@ -44,4 +44,4 @@ class Qualityunit_Liveagent_Helper_Signup extends Qualityunit_Liveagent_Helper_B
|
|
44 |
}
|
45 |
return $decodedResponse->response;
|
46 |
}
|
47 |
-
}
|
44 |
}
|
45 |
return $decodedResponse->response;
|
46 |
}
|
47 |
+
}
|
app/code/local/Qualityunit/Liveagent/Model/Buttons.php
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Qualityunit_Liveagent_Model_Buttons extends Mage_Core_Model_Abstract
|
4 |
-
{
|
5 |
-
public function _construct()
|
6 |
-
{
|
7 |
-
parent::_construct();
|
8 |
-
$this->_init('liveagent/buttons');
|
9 |
-
}
|
10 |
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Qualityunit_Liveagent_Model_Buttons extends Mage_Core_Model_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
parent::_construct();
|
8 |
+
$this->_init('liveagent/buttons');
|
9 |
+
}
|
10 |
}
|
app/code/local/Qualityunit/Liveagent/Model/Liveagent.php
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Qualityunit_Liveagent_Model_Liveagent extends Mage_Core_Model_Abstract
|
4 |
-
{
|
5 |
-
public function _construct()
|
6 |
-
{
|
7 |
-
parent::_construct();
|
8 |
-
$this->_init('liveagent/liveagent');
|
9 |
-
}
|
10 |
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Qualityunit_Liveagent_Model_Liveagent extends Mage_Core_Model_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
parent::_construct();
|
8 |
+
$this->_init('liveagent/liveagent');
|
9 |
+
}
|
10 |
}
|
app/code/local/Qualityunit/Liveagent/Model/Mysql4/Buttons.php
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Qualityunit_Liveagent_Model_Mysql4_Buttons extends Mage_Core_Model_Mysql4_Abstract
|
4 |
-
{
|
5 |
-
public function _construct()
|
6 |
-
{
|
7 |
-
$this->_init('liveagent/liveagentbuttons', 'liveagentbutton_id');
|
8 |
-
}
|
9 |
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Qualityunit_Liveagent_Model_Mysql4_Buttons extends Mage_Core_Model_Mysql4_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
$this->_init('liveagent/liveagentbuttons', 'liveagentbutton_id');
|
8 |
+
}
|
9 |
}
|
app/code/local/Qualityunit/Liveagent/Model/Mysql4/Buttons/Collection.php
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Qualityunit_Liveagent_Model_Mysql4_Buttons_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
4 |
-
{
|
5 |
-
public function _construct()
|
6 |
-
{
|
7 |
-
parent::_construct();
|
8 |
-
$this->_init('liveagent/buttons');
|
9 |
-
}
|
10 |
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Qualityunit_Liveagent_Model_Mysql4_Buttons_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
parent::_construct();
|
8 |
+
$this->_init('liveagent/buttons');
|
9 |
+
}
|
10 |
}
|
app/code/local/Qualityunit/Liveagent/Model/Mysql4/Liveagent.php
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Qualityunit_Liveagent_Model_Mysql4_Liveagent extends Mage_Core_Model_Mysql4_Abstract
|
4 |
-
{
|
5 |
-
public function _construct()
|
6 |
-
{
|
7 |
-
// Note that the liveagent_id refers to the key field in your database table.
|
8 |
-
$this->_init('liveagent/liveagent', 'liveagent_id');
|
9 |
-
}
|
10 |
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Qualityunit_Liveagent_Model_Mysql4_Liveagent extends Mage_Core_Model_Mysql4_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
// Note that the liveagent_id refers to the key field in your database table.
|
8 |
+
$this->_init('liveagent/liveagent', 'liveagent_id');
|
9 |
+
}
|
10 |
}
|
app/code/local/Qualityunit/Liveagent/Model/Mysql4/Liveagent/Collection.php
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Qualityunit_Liveagent_Model_Mysql4_Liveagent_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
4 |
-
{
|
5 |
-
public function _construct()
|
6 |
-
{
|
7 |
-
parent::_construct();
|
8 |
-
$this->_init('liveagent/liveagent');
|
9 |
-
}
|
10 |
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Qualityunit_Liveagent_Model_Mysql4_Liveagent_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
parent::_construct();
|
8 |
+
$this->_init('liveagent/liveagent');
|
9 |
+
}
|
10 |
}
|
app/code/local/Qualityunit/Liveagent/Model/Mysql4/Settings.php
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Qualityunit_Liveagent_Model_Mysql4_Settings extends Mage_Core_Model_Mysql4_Abstract
|
4 |
-
{
|
5 |
-
public function _construct()
|
6 |
-
{
|
7 |
-
// Note that the liveagent_id refers to the key field in your database table.
|
8 |
-
$this->_init('liveagent/liveagentsettings', 'id');
|
9 |
-
}
|
10 |
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Qualityunit_Liveagent_Model_Mysql4_Settings extends Mage_Core_Model_Mysql4_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
// Note that the liveagent_id refers to the key field in your database table.
|
8 |
+
$this->_init('liveagent/liveagentsettings', 'id');
|
9 |
+
}
|
10 |
}
|
app/code/local/Qualityunit/Liveagent/Model/Mysql4/Settings/Collection.php
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Qualityunit_Liveagent_Model_Mysql4_Settings_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
4 |
-
{
|
5 |
-
public function _construct()
|
6 |
-
{
|
7 |
-
parent::_construct();
|
8 |
-
$this->_init('liveagent/liveagentsettings');
|
9 |
-
}
|
10 |
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Qualityunit_Liveagent_Model_Mysql4_Settings_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
parent::_construct();
|
8 |
+
$this->_init('liveagent/liveagentsettings');
|
9 |
+
}
|
10 |
}
|
app/code/local/Qualityunit/Liveagent/Model/Settings.php
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Qualityunit_Liveagent_Model_Settings extends Mage_Core_Model_Abstract
|
4 |
-
{
|
5 |
-
public function _construct()
|
6 |
-
{
|
7 |
-
parent::_construct();
|
8 |
-
$this->_init('liveagent/settings');
|
9 |
-
}
|
10 |
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Qualityunit_Liveagent_Model_Settings extends Mage_Core_Model_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
parent::_construct();
|
8 |
+
$this->_init('liveagent/settings');
|
9 |
+
}
|
10 |
}
|
app/code/local/Qualityunit/Liveagent/controllers/Adminhtml/LiveagentController.php
CHANGED
@@ -1,333 +1,334 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Qualityunit_Liveagent_Adminhtml_LiveagentController extends Mage_Adminhtml_Controller_Action {
|
4 |
-
|
5 |
-
const LIVEAGENT_PLUGIN_NAME = 'liveagent';
|
6 |
-
const ACTION_CREATE = 'c';
|
7 |
-
|
8 |
-
/**
|
9 |
-
* @var Qualityunit_Liveagent_Helper_Settings
|
10 |
-
**/
|
11 |
-
private $settings = null;
|
12 |
-
|
13 |
-
private function includePhpApi() {
|
14 |
-
$path = dirname(__FILE__);
|
15 |
-
if (file_exists($path . '/../../Helper/PhpApi.php')) {
|
16 |
-
include_once $path . '/../../Helper/PhpApi.php';
|
17 |
-
return;
|
18 |
-
}
|
19 |
-
include_once ('Qualityunit_Liveagent_Helper_PhpApi.php');
|
20 |
-
}
|
21 |
-
|
22 |
-
protected function _construct() {
|
23 |
-
$this->includePhpApi();
|
24 |
-
Qualityunit_Liveagent_Helper_Data::convertOldButton();
|
25 |
-
parent::_construct();
|
26 |
-
$this->settings = new Qualityunit_Liveagent_Helper_Settings();
|
27 |
-
}
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
private function initLayout() {
|
32 |
-
$this->loadLayout()
|
33 |
-
->_setActiveMenu('liveagent/account')
|
34 |
-
->_addBreadcrumb(Mage::helper('adminhtml')->__('Account'), Mage::helper('adminhtml')->__('Settings'));
|
35 |
-
}
|
36 |
-
|
37 |
-
private function doAfterPost($params = array()) {
|
38 |
-
$this->_redirect('*/*', $params);
|
39 |
-
}
|
40 |
-
|
41 |
-
private function doPostAction() {
|
42 |
-
$post = $this->getRequest()->getPost();
|
43 |
-
if (!array_key_exists('action', $post)) {
|
44 |
-
$this->doAfterPost();
|
45 |
-
return;
|
46 |
-
}
|
47 |
-
if ($post['action']=="r") {
|
48 |
-
try {
|
49 |
-
$this->validateSignupMail($post[Qualityunit_Liveagent_Helper_Settings::LA_OWNER_EMAIL_SETTING_NAME]);
|
50 |
-
$this->validateSubdomain($post[Qualityunit_Liveagent_Helper_Settings::LA_URL_SETTING_NAME]);
|
51 |
-
$this->registerAccountAction(
|
52 |
-
$post[Qualityunit_Liveagent_Block_Signup::FULL_NAME_FIELD],
|
53 |
-
$post[Qualityunit_Liveagent_Helper_Settings::LA_OWNER_EMAIL_SETTING_NAME],
|
54 |
-
$post[Qualityunit_Liveagent_Helper_Settings::LA_URL_SETTING_NAME],
|
55 |
-
md5(rand(90000,99999) . microtime() . rand(90000,99999)),
|
56 |
-
''
|
57 |
-
);
|
58 |
-
} catch (Qualityunit_Liveagent_Exception_SignupFailed $e) {
|
59 |
-
$this->signupFailed($e);
|
60 |
-
return;
|
61 |
-
}
|
62 |
-
$this->doAfterPost();
|
63 |
-
return;
|
64 |
-
}
|
65 |
-
if ($post['action']==Qualityunit_Liveagent_Block_Account::SAVE_ACCOUNT_SETTINGS_ACTION_FLAG) {
|
66 |
-
if (!$this->checkAccountSettings($post)) {
|
67 |
-
$this->doAfterPost($this->getAccountSettingsPost($post));
|
68 |
-
return;
|
69 |
-
}
|
70 |
-
$auth = new Qualityunit_Liveagent_Helper_Auth();
|
71 |
-
try {
|
72 |
-
$auth->ping($post[Qualityunit_Liveagent_Helper_Settings::LA_URL_SETTING_NAME]);
|
73 |
-
} catch (Qualityunit_Liveagent_Exception_ConnectProblem $e) {
|
74 |
-
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Unable to connect to LiveAgent at') . ' ' . $post[Qualityunit_Liveagent_Helper_Settings::LA_URL_SETTING_NAME] . '. ' . $this->getAccountSettingsChangeRevertLink());
|
75 |
-
$this->doAfterPost($this->getAccountSettingsPost($post));
|
76 |
-
return;
|
77 |
-
}
|
78 |
-
if ($this->settings->useApiKey()) {
|
79 |
-
try {
|
80 |
-
$token = $auth->getauthTokenByApi($post[Qualityunit_Liveagent_Helper_Settings::LA_URL_SETTING_NAME], $post[Qualityunit_Liveagent_Helper_Settings::LA_OWNER_PASSWORD_SETTING_NAME]);
|
81 |
-
$this->settings->setOption(Qualityunit_Liveagent_Helper_Settings::OWNER_AUTHTOKEN, $token);
|
82 |
-
} catch (Qualityunit_Liveagent_Exception_ConnectProblem $e) {
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
$post[Qualityunit_Liveagent_Helper_Settings::
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
Qualityunit_Liveagent_Helper_Settings::
|
123 |
-
Qualityunit_Liveagent_Helper_Settings::
|
124 |
-
'
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
$
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
Mage::
|
152 |
-
|
153 |
-
$this->
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
$this->settings->
|
180 |
-
$this->settings->setOption(Qualityunit_Liveagent_Helper_Settings::
|
181 |
-
$this->settings->setOption(Qualityunit_Liveagent_Helper_Settings::
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
Mage::
|
205 |
-
$
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
$this->
|
236 |
-
$this->
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
$this->
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
$this->
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
$
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
$this->
|
260 |
-
$this->
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
$this->
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
$
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
Mage::log("
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
$this->
|
319 |
-
$this->settings->setOption(Qualityunit_Liveagent_Helper_Settings::
|
320 |
-
$this->settings->setOption(Qualityunit_Liveagent_Helper_Settings::
|
321 |
-
$this->settings->setOption(Qualityunit_Liveagent_Helper_Settings::
|
322 |
-
$this->settings->setOption(Qualityunit_Liveagent_Helper_Settings::
|
323 |
-
$this->settings->setOption(Qualityunit_Liveagent_Helper_Settings::
|
324 |
-
$this->settings->
|
325 |
-
$this->settings->
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
$this->settings->setOption(Qualityunit_Liveagent_Helper_Settings::
|
332 |
-
|
333 |
-
}
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Qualityunit_Liveagent_Adminhtml_LiveagentController extends Mage_Adminhtml_Controller_Action {
|
4 |
+
|
5 |
+
const LIVEAGENT_PLUGIN_NAME = 'liveagent';
|
6 |
+
const ACTION_CREATE = 'c';
|
7 |
+
|
8 |
+
/**
|
9 |
+
* @var Qualityunit_Liveagent_Helper_Settings
|
10 |
+
**/
|
11 |
+
private $settings = null;
|
12 |
+
|
13 |
+
private function includePhpApi() {
|
14 |
+
$path = dirname(__FILE__);
|
15 |
+
if (file_exists($path . '/../../Helper/PhpApi.php')) {
|
16 |
+
include_once $path . '/../../Helper/PhpApi.php';
|
17 |
+
return;
|
18 |
+
}
|
19 |
+
include_once ('Qualityunit_Liveagent_Helper_PhpApi.php');
|
20 |
+
}
|
21 |
+
|
22 |
+
protected function _construct() {
|
23 |
+
$this->includePhpApi();
|
24 |
+
Qualityunit_Liveagent_Helper_Data::convertOldButton();
|
25 |
+
parent::_construct();
|
26 |
+
$this->settings = new Qualityunit_Liveagent_Helper_Settings();
|
27 |
+
}
|
28 |
+
|
29 |
+
|
30 |
+
|
31 |
+
private function initLayout() {
|
32 |
+
$this->loadLayout()
|
33 |
+
->_setActiveMenu('liveagent/account')
|
34 |
+
->_addBreadcrumb(Mage::helper('adminhtml')->__('Account'), Mage::helper('adminhtml')->__('Settings'));
|
35 |
+
}
|
36 |
+
|
37 |
+
private function doAfterPost($params = array()) {
|
38 |
+
$this->_redirect('*/*', $params);
|
39 |
+
}
|
40 |
+
|
41 |
+
private function doPostAction() {
|
42 |
+
$post = $this->getRequest()->getPost();
|
43 |
+
if (!array_key_exists('action', $post)) {
|
44 |
+
$this->doAfterPost();
|
45 |
+
return;
|
46 |
+
}
|
47 |
+
if ($post['action']=="r") {
|
48 |
+
try {
|
49 |
+
$this->validateSignupMail($post[Qualityunit_Liveagent_Helper_Settings::LA_OWNER_EMAIL_SETTING_NAME]);
|
50 |
+
$this->validateSubdomain($post[Qualityunit_Liveagent_Helper_Settings::LA_URL_SETTING_NAME]);
|
51 |
+
$this->registerAccountAction(
|
52 |
+
$post[Qualityunit_Liveagent_Block_Signup::FULL_NAME_FIELD],
|
53 |
+
$post[Qualityunit_Liveagent_Helper_Settings::LA_OWNER_EMAIL_SETTING_NAME],
|
54 |
+
$post[Qualityunit_Liveagent_Helper_Settings::LA_URL_SETTING_NAME],
|
55 |
+
md5(rand(90000,99999) . microtime() . rand(90000,99999)),
|
56 |
+
''
|
57 |
+
);
|
58 |
+
} catch (Qualityunit_Liveagent_Exception_SignupFailed $e) {
|
59 |
+
$this->signupFailed($e);
|
60 |
+
return;
|
61 |
+
}
|
62 |
+
$this->doAfterPost();
|
63 |
+
return;
|
64 |
+
}
|
65 |
+
if ($post['action']==Qualityunit_Liveagent_Block_Account::SAVE_ACCOUNT_SETTINGS_ACTION_FLAG) {
|
66 |
+
if (!$this->checkAccountSettings($post)) {
|
67 |
+
$this->doAfterPost($this->getAccountSettingsPost($post));
|
68 |
+
return;
|
69 |
+
}
|
70 |
+
$auth = new Qualityunit_Liveagent_Helper_Auth();
|
71 |
+
try {
|
72 |
+
$auth->ping($post[Qualityunit_Liveagent_Helper_Settings::LA_URL_SETTING_NAME]);
|
73 |
+
} catch (Qualityunit_Liveagent_Exception_ConnectProblem $e) {
|
74 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Unable to connect to LiveAgent at') . ' ' . $post[Qualityunit_Liveagent_Helper_Settings::LA_URL_SETTING_NAME] . '. ' . $this->getAccountSettingsChangeRevertLink());
|
75 |
+
$this->doAfterPost($this->getAccountSettingsPost($post));
|
76 |
+
return;
|
77 |
+
}
|
78 |
+
if ($this->settings->useApiKey()) {
|
79 |
+
try {
|
80 |
+
$token = $auth->getauthTokenByApi($post[Qualityunit_Liveagent_Helper_Settings::LA_URL_SETTING_NAME], $post[Qualityunit_Liveagent_Helper_Settings::LA_OWNER_PASSWORD_SETTING_NAME], $post[Qualityunit_Liveagent_Helper_Settings::LA_OWNER_EMAIL_SETTING_NAME]);
|
81 |
+
$this->settings->setOption(Qualityunit_Liveagent_Helper_Settings::OWNER_AUTHTOKEN, $token);
|
82 |
+
} catch (Qualityunit_Liveagent_Exception_ConnectProblem $e) {
|
83 |
+
Mage::log('Unable to connect to LA: ' . $e->getMessage(), Zend_log::ERR);
|
84 |
+
}
|
85 |
+
if ($token == null) {
|
86 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Unable to login to LiveAgent with given credentails. Please check your url, username and api key.') . ' ' . $this->getAccountSettingsChangeRevertLink());
|
87 |
+
$this->doAfterPost($this->getAccountSettingsPost($post));
|
88 |
+
return;
|
89 |
+
}
|
90 |
+
} else {
|
91 |
+
try {
|
92 |
+
$auth->LoginAndGetLoginData($post[Qualityunit_Liveagent_Helper_Settings::LA_URL_SETTING_NAME],
|
93 |
+
$post[Qualityunit_Liveagent_Helper_Settings::LA_OWNER_EMAIL_SETTING_NAME],
|
94 |
+
$post[Qualityunit_Liveagent_Helper_Settings::LA_OWNER_PASSWORD_SETTING_NAME]);
|
95 |
+
} catch (Qualityunit_Liveagent_Exception_ConnectProblem $e) {
|
96 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Unable to login to LiveAgent with given credentails. Please check your username and password.') . ' ' . $this->getAccountSettingsChangeRevertLink());
|
97 |
+
$this->doAfterPost($this->getAccountSettingsPost($post));
|
98 |
+
return;
|
99 |
+
}
|
100 |
+
}
|
101 |
+
|
102 |
+
$this->saveAccountSettings($post, $token);
|
103 |
+
if (!$this->isSetStatus()) {
|
104 |
+
$this->settings->setOption(Qualityunit_Liveagent_Helper_Settings::ACCOUNT_STATUS, Qualityunit_Liveagent_Helper_Base::ACCOUNT_STATUS_SET);
|
105 |
+
}
|
106 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Account settings were saved successfully'));
|
107 |
+
}
|
108 |
+
if ($post['action']==Qualityunit_Liveagent_Block_Buttoncode::SAVE_BUTTON_CODE_ACTION_FLAG) {
|
109 |
+
$this->settings->setOption(Qualityunit_Liveagent_Helper_Settings::BUTTON_CODE,
|
110 |
+
html_entity_decode($post[Qualityunit_Liveagent_Helper_Settings::BUTTON_CODE]));
|
111 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Button code was saved successfully'));
|
112 |
+
}
|
113 |
+
$this->doAfterPost();
|
114 |
+
}
|
115 |
+
|
116 |
+
private function getAccountSettingsChangeRevertLink() {
|
117 |
+
return '<a href="'.$this->getUrl('*/*').'">' . Mage::helper('adminhtml')->__('Undo this change') . '</a>';
|
118 |
+
}
|
119 |
+
|
120 |
+
private function getAccountSettingsPost($post) {
|
121 |
+
return array(
|
122 |
+
Qualityunit_Liveagent_Helper_Settings::LA_URL_SETTING_NAME => ' ' . trim(base64_encode($post[Qualityunit_Liveagent_Helper_Settings::LA_URL_SETTING_NAME])),
|
123 |
+
Qualityunit_Liveagent_Helper_Settings::LA_OWNER_EMAIL_SETTING_NAME => ' ' . trim(base64_encode($post[Qualityunit_Liveagent_Helper_Settings::LA_OWNER_EMAIL_SETTING_NAME])),
|
124 |
+
Qualityunit_Liveagent_Helper_Settings::LA_OWNER_PASSWORD_SETTING_NAME => ' ' . trim(base64_encode($post[Qualityunit_Liveagent_Helper_Settings::LA_OWNER_PASSWORD_SETTING_NAME])),
|
125 |
+
'action' => Qualityunit_Liveagent_Block_Account::CHANGE_ACCOUNT_ACTION_FLAG
|
126 |
+
);
|
127 |
+
}
|
128 |
+
|
129 |
+
private function validateSubdomain($subdomain) {
|
130 |
+
if (0 == preg_match('/^[a-z0-9-]{3,}$/', $subdomain)) {
|
131 |
+
throw new Qualityunit_Liveagent_Exception_SignupFailed(Mage::helper('adminhtml')->__('Please enter valid subdomain name'));
|
132 |
+
}
|
133 |
+
}
|
134 |
+
|
135 |
+
private function validateSignupMail($mail) {
|
136 |
+
if (!Zend_Validate::is($mail, 'EmailAddress')) {
|
137 |
+
throw new Qualityunit_Liveagent_Exception_SignupFailed(Mage::helper('adminhtml')->__('Please enter valid email address'));
|
138 |
+
}
|
139 |
+
}
|
140 |
+
|
141 |
+
private function signupFailed($e) {
|
142 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
143 |
+
$this->doAfterPost();
|
144 |
+
}
|
145 |
+
|
146 |
+
public function postAction() {
|
147 |
+
$this->initLayout();
|
148 |
+
try {
|
149 |
+
$this->doPostAction();
|
150 |
+
} catch (Exception $e) {
|
151 |
+
Mage::log($e->getMessage(), Zend_log::ERR);
|
152 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
153 |
+
$this->_redirect('*/*');
|
154 |
+
$this->renderLayout();
|
155 |
+
}
|
156 |
+
}
|
157 |
+
|
158 |
+
private function checkAccountSettings($post) {
|
159 |
+
if (trim($post[Qualityunit_Liveagent_Helper_Settings::LA_OWNER_EMAIL_SETTING_NAME]) == null) {
|
160 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Username can not be empty.') . ' ' . $this->getAccountSettingsChangeRevertLink());
|
161 |
+
return false;
|
162 |
+
}
|
163 |
+
if (trim($post[Qualityunit_Liveagent_Helper_Settings::LA_OWNER_PASSWORD_SETTING_NAME]) == null) {
|
164 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Password can not be empty.') . ' ' . $this->getAccountSettingsChangeRevertLink());
|
165 |
+
return false;
|
166 |
+
}
|
167 |
+
if (trim($post[Qualityunit_Liveagent_Helper_Settings::LA_URL_SETTING_NAME]) == null) {
|
168 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Url can not be empty.') . ' ' . $this->getAccountSettingsChangeRevertLink());
|
169 |
+
return false;
|
170 |
+
}
|
171 |
+
if (strpos($post[Qualityunit_Liveagent_Helper_Settings::LA_OWNER_EMAIL_SETTING_NAME], '@') === false) {
|
172 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Username must be valid email.') . ' ' . $this->getAccountSettingsChangeRevertLink());
|
173 |
+
return false;
|
174 |
+
}
|
175 |
+
return true;
|
176 |
+
}
|
177 |
+
|
178 |
+
private function saveAccountsettings($post, $token = null) {
|
179 |
+
$oldUrl = $this->settings->getOption(Qualityunit_Liveagent_Helper_Settings::LA_URL_SETTING_NAME);
|
180 |
+
$this->settings->setOption(Qualityunit_Liveagent_Helper_Settings::LA_OWNER_EMAIL_SETTING_NAME, $post[Qualityunit_Liveagent_Helper_Settings::LA_OWNER_EMAIL_SETTING_NAME]);
|
181 |
+
$this->settings->setOption(Qualityunit_Liveagent_Helper_Settings::LA_OWNER_PASSWORD_SETTING_NAME, $post[Qualityunit_Liveagent_Helper_Settings::LA_OWNER_PASSWORD_SETTING_NAME]);
|
182 |
+
$this->settings->setOption(Qualityunit_Liveagent_Helper_Settings::LA_URL_SETTING_NAME, $post[Qualityunit_Liveagent_Helper_Settings::LA_URL_SETTING_NAME]);
|
183 |
+
if ($this->settings->useApiKey() && $token != '') {
|
184 |
+
$this->settings->setOption(Qualityunit_Liveagent_Helper_Settings::OWNER_AUTHTOKEN. $token);
|
185 |
+
} else {
|
186 |
+
$this->settings->setOption(Qualityunit_Liveagent_Helper_Settings::OWNER_AUTHTOKEN, '');
|
187 |
+
}
|
188 |
+
$this->settings->setOption(Qualityunit_Liveagent_Helper_Settings::OWNER_SESSIONID, '');
|
189 |
+
if ($oldUrl == $post[Qualityunit_Liveagent_Helper_Settings::LA_URL_SETTING_NAME]) {
|
190 |
+
return;
|
191 |
+
}
|
192 |
+
if ($this->settings->useApiKey()) {
|
193 |
+
|
194 |
+
} else {
|
195 |
+
$this->settings->saveDefaultButtonCode();
|
196 |
+
}
|
197 |
+
}
|
198 |
+
|
199 |
+
public function indexAction() {
|
200 |
+
$this->initLayout();
|
201 |
+
try {
|
202 |
+
$this->doIndexAction();
|
203 |
+
} catch (Exception $e) {
|
204 |
+
Mage::log($e->getMessage(), Zend_log::ERR);
|
205 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
206 |
+
$this->renderLayout();
|
207 |
+
}
|
208 |
+
}
|
209 |
+
|
210 |
+
private function getAccountNotReachableTimes() {
|
211 |
+
$times = $this->settings->getOption(Qualityunit_Liveagent_Helper_Settings::ACCOUNT_NOT_REACHABLE_TIMES);
|
212 |
+
if ($times == '') {
|
213 |
+
return 0;
|
214 |
+
}
|
215 |
+
return $times;
|
216 |
+
}
|
217 |
+
|
218 |
+
/**
|
219 |
+
* @return Qualityunit_Liveagent_Block_Waiting
|
220 |
+
*/
|
221 |
+
private function getWaitingDialog() {
|
222 |
+
$this->settings->setOption(Qualityunit_Liveagent_Helper_Settings::ACCOUNT_NOT_REACHABLE_TIMES, $this->settings->getOption(Qualityunit_Liveagent_Helper_Settings::ACCOUNT_NOT_REACHABLE_TIMES) + 1);
|
223 |
+
return new Qualityunit_Liveagent_Block_Waiting();
|
224 |
+
}
|
225 |
+
|
226 |
+
public function doIndexAction() {
|
227 |
+
if ($this->getRequest()->getParam('action')=="") {
|
228 |
+
if ($this->isNew()) {
|
229 |
+
$block = new Qualityunit_Liveagent_Block_Signup();
|
230 |
+
} else if ($this->isWaiting()) {
|
231 |
+
if ($this->getAccountNotReachableTimes() <= 1) {
|
232 |
+
$block = $this->getWaitingDialog();
|
233 |
+
} else if ($this->getAccountNotReachableTimes() > 1) {
|
234 |
+
if (Qualityunit_Liveagent_Helper_Account::isOnline() || $this->getAccountNotReachableTimes() > 3) {
|
235 |
+
$this->skipWaitAction();
|
236 |
+
$this->renderAccountDialog();
|
237 |
+
$this->renderLayout();
|
238 |
+
return;
|
239 |
+
}
|
240 |
+
$block = $this->getWaitingDialog();
|
241 |
+
}
|
242 |
+
} else {
|
243 |
+
$this->renderAccountDialog();
|
244 |
+
$this->renderLayout();
|
245 |
+
return;
|
246 |
+
}
|
247 |
+
$this->_addContent($this->getLayout()->createBlock($block));
|
248 |
+
$this->renderLayout();
|
249 |
+
return;
|
250 |
+
}
|
251 |
+
if ($this->getRequest()->getParam('action')==Qualityunit_Liveagent_Block_Account::CANCEL_ACCOUNT_ACTION_FLAG) {
|
252 |
+
$this->resetAccountAction();
|
253 |
+
$block = new Qualityunit_Liveagent_Block_Signup();
|
254 |
+
}
|
255 |
+
if ($this->getRequest()->getParam('action') == Qualityunit_Liveagent_Block_Account::CHANGE_ACCOUNT_ACTION_FLAG) {
|
256 |
+
$block = new Qualityunit_Liveagent_Block_Account();
|
257 |
+
}
|
258 |
+
if ($this->getRequest()->getParam('action')=="s") {
|
259 |
+
$this->skipWaitAction();
|
260 |
+
$this->renderAccountDialog();
|
261 |
+
$this->renderLayout();
|
262 |
+
return;
|
263 |
+
}
|
264 |
+
$this->_addContent($this->getLayout()->createBlock($block));
|
265 |
+
$this->renderLayout();
|
266 |
+
}
|
267 |
+
|
268 |
+
private function checkButtonCodeIsEmpty() {
|
269 |
+
if ($this->settings->getOption(Qualityunit_Liveagent_Helper_Settings::BUTTON_CODE) == null) {
|
270 |
+
Mage::getSingleton('adminhtml/session')->addNotice(Mage::helper('adminhtml')->__('The chat button is currently disabled.'));
|
271 |
+
}
|
272 |
+
}
|
273 |
+
|
274 |
+
private function renderAccountDialog() {
|
275 |
+
if ($this->isSetStatus() && Qualityunit_Liveagent_Helper_Account::isOnline()) {
|
276 |
+
$this->checkButtonCodeIsEmpty();
|
277 |
+
$block = new Qualityunit_Liveagent_Block_Buttoncode();
|
278 |
+
}
|
279 |
+
if ($this->isSetStatus() && !Qualityunit_Liveagent_Helper_Account::isOnline()) {
|
280 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Unable to connect LiveAgent at') . ' ' . $this->settings->getLiveAgentUrl());
|
281 |
+
$block = new Qualityunit_Liveagent_Block_Account();
|
282 |
+
}
|
283 |
+
if (!$this->isSetStatus()) {
|
284 |
+
$block = new Qualityunit_Liveagent_Block_Account();
|
285 |
+
}
|
286 |
+
$this->_addContent($this->getLayout()->createBlock($block));
|
287 |
+
}
|
288 |
+
|
289 |
+
private function isNew() {
|
290 |
+
return $this->settings->getAccountStatus() == Qualityunit_Liveagent_Helper_Base::ACCOUNT_STATUS_NOTSET;
|
291 |
+
}
|
292 |
+
|
293 |
+
private function isSetStatus() {
|
294 |
+
return $this->settings->getAccountStatus() == Qualityunit_Liveagent_Helper_Base::ACCOUNT_STATUS_SET;
|
295 |
+
}
|
296 |
+
|
297 |
+
private function isWaiting() {
|
298 |
+
return $this->settings->getAccountStatus() == Qualityunit_Liveagent_Helper_Base::ACCOUNT_STATUS_WAIT;
|
299 |
+
}
|
300 |
+
|
301 |
+
private function resetAccountAction() {
|
302 |
+
$this->settings->setOption(Qualityunit_Liveagent_Helper_Settings::LA_USE_API_KEY, 'Y');
|
303 |
+
$this->settings->setOption(Qualityunit_Liveagent_Helper_Settings::ACCOUNT_STATUS, Qualityunit_Liveagent_Helper_Base::ACCOUNT_STATUS_NOTSET);
|
304 |
+
}
|
305 |
+
|
306 |
+
private function sendSignupRequest($name, $email, $domain, $password, $papvisitorId) {
|
307 |
+
$signupHelper = new Qualityunit_Liveagent_Helper_Signup();
|
308 |
+
try {
|
309 |
+
$response = $signupHelper->signup($name, $email, $domain, $password, $papvisitorId);
|
310 |
+
} catch (Qualityunit_Liveagent_Exception_Base $e) {
|
311 |
+
throw new Qualityunit_Liveagent_Exception_SignupFailed($e->getMessage());
|
312 |
+
}
|
313 |
+
Mage::log("Signup response recieved: " . print_r($response, true), Zend_log::DEBUG);
|
314 |
+
Mage::log("Response OK", Zend_log::DEBUG);
|
315 |
+
}
|
316 |
+
|
317 |
+
private function registerAccountAction($name, $email, $domain, $password, $papvisitorId) {
|
318 |
+
$this->sendSignupRequest($name, $email, $domain, $password, $papvisitorId);
|
319 |
+
$this->settings->setOption(Qualityunit_Liveagent_Helper_Settings::LA_URL_SETTING_NAME, 'http://' . $domain . '.ladesk.com');
|
320 |
+
$this->settings->setOption(Qualityunit_Liveagent_Helper_Settings::LA_OWNER_EMAIL_SETTING_NAME, $email);
|
321 |
+
$this->settings->setOption(Qualityunit_Liveagent_Helper_Settings::LA_OWNER_PASSWORD_SETTING_NAME, $password);
|
322 |
+
$this->settings->setOption(Qualityunit_Liveagent_Helper_Settings::LA_USE_API_KEY, 'Y');
|
323 |
+
$this->settings->setOption(Qualityunit_Liveagent_Helper_Settings::OWNER_AUTHTOKEN, '');
|
324 |
+
$this->settings->setOption(Qualityunit_Liveagent_Helper_Settings::OWNER_SESSIONID, '');
|
325 |
+
$this->settings->saveDefaultButtonCode();
|
326 |
+
$this->settings->setOption(Qualityunit_Liveagent_Helper_Settings::ACCOUNT_STATUS, Qualityunit_Liveagent_Helper_Base::ACCOUNT_STATUS_WAIT);
|
327 |
+
}
|
328 |
+
|
329 |
+
private function skipWaitAction() {
|
330 |
+
$this->settings->setOption(Qualityunit_Liveagent_Helper_Settings::LA_USE_API_KEY, 'Y');
|
331 |
+
$this->settings->setOption(Qualityunit_Liveagent_Helper_Settings::ACCOUNT_STATUS, Qualityunit_Liveagent_Helper_Base::ACCOUNT_STATUS_SET);
|
332 |
+
$this->settings->setOption(Qualityunit_Liveagent_Helper_Settings::ACCOUNT_NOT_REACHABLE_TIMES, 0);
|
333 |
+
}
|
334 |
+
}
|
app/code/local/Qualityunit/Liveagent/controllers/IndexController.php
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
-
<?php
|
2 |
-
class Qualityunit_Liveagent_IndexController extends Mage_Core_Controller_Front_Action {
|
3 |
-
public function indexAction() {
|
4 |
-
Qualityunit_Liveagent_Helper_Data::convertOldButton();
|
5 |
-
$this->loadLayout();
|
6 |
-
$this->renderLayout();
|
7 |
-
}
|
8 |
}
|
1 |
+
<?php
|
2 |
+
class Qualityunit_Liveagent_IndexController extends Mage_Core_Controller_Front_Action {
|
3 |
+
public function indexAction() {
|
4 |
+
Qualityunit_Liveagent_Helper_Data::convertOldButton();
|
5 |
+
$this->loadLayout();
|
6 |
+
$this->renderLayout();
|
7 |
+
}
|
8 |
}
|
app/code/local/Qualityunit/Liveagent/etc/config.xml
CHANGED
@@ -1,135 +1,135 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
-
<config>
|
3 |
-
<modules>
|
4 |
-
<Qualityunit_Liveagent>
|
5 |
-
<version>0.1.0</version>
|
6 |
-
</Qualityunit_Liveagent>
|
7 |
-
</modules>
|
8 |
-
<frontend>
|
9 |
-
<routers>
|
10 |
-
<liveagent>
|
11 |
-
<use>standard</use>
|
12 |
-
<args>
|
13 |
-
<module>Qualityunit_Liveagent</module>
|
14 |
-
<frontName>liveagent</frontName>
|
15 |
-
</args>
|
16 |
-
</liveagent>
|
17 |
-
</routers>
|
18 |
-
<layout>
|
19 |
-
<updates>
|
20 |
-
<liveagent>
|
21 |
-
<file>liveagent.xml</file>
|
22 |
-
</liveagent>
|
23 |
-
</updates>
|
24 |
-
</layout>
|
25 |
-
</frontend>
|
26 |
-
<admin>
|
27 |
-
<routers>
|
28 |
-
<liveagent>
|
29 |
-
<use>admin</use>
|
30 |
-
<args>
|
31 |
-
<module>Qualityunit_Liveagent</module>
|
32 |
-
<frontName>liveagent</frontName>
|
33 |
-
</args>
|
34 |
-
</liveagent>
|
35 |
-
</routers>
|
36 |
-
</admin>
|
37 |
-
<adminhtml>
|
38 |
-
<menu>
|
39 |
-
<liveagent module="liveagent" translate="title">
|
40 |
-
<title>LiveAgent</title>
|
41 |
-
<sort_order>71</sort_order>
|
42 |
-
<children>
|
43 |
-
<account module="liveagent" translate="title">
|
44 |
-
<title>Account settings</title>
|
45 |
-
<sort_order>0</sort_order>
|
46 |
-
<action>liveagent/adminhtml_liveagent</action>
|
47 |
-
</account>
|
48 |
-
</children>
|
49 |
-
</liveagent>
|
50 |
-
</menu>
|
51 |
-
<acl>
|
52 |
-
<resources>
|
53 |
-
<all>
|
54 |
-
<title>Allow Everything</title>
|
55 |
-
</all>
|
56 |
-
<admin>
|
57 |
-
<children>
|
58 |
-
<Qualityunit_Liveagent>
|
59 |
-
<title>Liveagent Module</title>
|
60 |
-
<sort_order>10</sort_order>
|
61 |
-
</Qualityunit_Liveagent>
|
62 |
-
</children>
|
63 |
-
</admin>
|
64 |
-
</resources>
|
65 |
-
</acl>
|
66 |
-
<layout>
|
67 |
-
<updates>
|
68 |
-
<liveagent>
|
69 |
-
<file>liveagent.xml</file>
|
70 |
-
</liveagent>
|
71 |
-
</updates>
|
72 |
-
</layout>
|
73 |
-
<translate>
|
74 |
-
<modules>
|
75 |
-
<liveagent>
|
76 |
-
<files>
|
77 |
-
<default>qualityunit_liveagent.csv</default>
|
78 |
-
</files>
|
79 |
-
</liveagent>
|
80 |
-
</modules>
|
81 |
-
</translate>
|
82 |
-
</adminhtml>
|
83 |
-
<global>
|
84 |
-
<models>
|
85 |
-
<liveagent>
|
86 |
-
<class>Qualityunit_Liveagent_Model</class>
|
87 |
-
<resourceModel>liveagent_mysql4</resourceModel>
|
88 |
-
</liveagent>
|
89 |
-
<liveagent_mysql4>
|
90 |
-
<class>Qualityunit_Liveagent_Model_Mysql4</class>
|
91 |
-
<entities>
|
92 |
-
<liveagentsettings>
|
93 |
-
<table>liveagentsettings</table>
|
94 |
-
</liveagentsettings>
|
95 |
-
<liveagentbuttons>
|
96 |
-
<table>liveagentbuttons</table>
|
97 |
-
</liveagentbuttons>
|
98 |
-
</entities>
|
99 |
-
</liveagent_mysql4>
|
100 |
-
</models>
|
101 |
-
<resources>
|
102 |
-
<liveagent_setup>
|
103 |
-
<setup>
|
104 |
-
<module>Qualityunit_Liveagent</module>
|
105 |
-
</setup>
|
106 |
-
<connection>
|
107 |
-
<use>core_setup</use>
|
108 |
-
</connection>
|
109 |
-
</liveagent_setup>
|
110 |
-
<liveagent_write>
|
111 |
-
<connection>
|
112 |
-
<use>core_write</use>
|
113 |
-
</connection>
|
114 |
-
</liveagent_write>
|
115 |
-
<liveagent_read>
|
116 |
-
<connection>
|
117 |
-
<use>core_read</use>
|
118 |
-
</connection>
|
119 |
-
</liveagent_read>
|
120 |
-
</resources>
|
121 |
-
<blocks>
|
122 |
-
<liveagent>
|
123 |
-
<class>Qualityunit_Liveagent_Block</class>
|
124 |
-
</liveagent>
|
125 |
-
<buttoncode>
|
126 |
-
<class>Qualityunit_Liveagent_Block</class>
|
127 |
-
</buttoncode>
|
128 |
-
</blocks>
|
129 |
-
<helpers>
|
130 |
-
<liveagent>
|
131 |
-
<class>Qualityunit_Liveagent_Helper</class>
|
132 |
-
</liveagent>
|
133 |
-
</helpers>
|
134 |
-
</global>
|
135 |
</config>
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Qualityunit_Liveagent>
|
5 |
+
<version>0.1.0</version>
|
6 |
+
</Qualityunit_Liveagent>
|
7 |
+
</modules>
|
8 |
+
<frontend>
|
9 |
+
<routers>
|
10 |
+
<liveagent>
|
11 |
+
<use>standard</use>
|
12 |
+
<args>
|
13 |
+
<module>Qualityunit_Liveagent</module>
|
14 |
+
<frontName>liveagent</frontName>
|
15 |
+
</args>
|
16 |
+
</liveagent>
|
17 |
+
</routers>
|
18 |
+
<layout>
|
19 |
+
<updates>
|
20 |
+
<liveagent>
|
21 |
+
<file>liveagent.xml</file>
|
22 |
+
</liveagent>
|
23 |
+
</updates>
|
24 |
+
</layout>
|
25 |
+
</frontend>
|
26 |
+
<admin>
|
27 |
+
<routers>
|
28 |
+
<liveagent>
|
29 |
+
<use>admin</use>
|
30 |
+
<args>
|
31 |
+
<module>Qualityunit_Liveagent</module>
|
32 |
+
<frontName>liveagent</frontName>
|
33 |
+
</args>
|
34 |
+
</liveagent>
|
35 |
+
</routers>
|
36 |
+
</admin>
|
37 |
+
<adminhtml>
|
38 |
+
<menu>
|
39 |
+
<liveagent module="liveagent" translate="title">
|
40 |
+
<title>LiveAgent</title>
|
41 |
+
<sort_order>71</sort_order>
|
42 |
+
<children>
|
43 |
+
<account module="liveagent" translate="title">
|
44 |
+
<title>Account settings</title>
|
45 |
+
<sort_order>0</sort_order>
|
46 |
+
<action>liveagent/adminhtml_liveagent</action>
|
47 |
+
</account>
|
48 |
+
</children>
|
49 |
+
</liveagent>
|
50 |
+
</menu>
|
51 |
+
<acl>
|
52 |
+
<resources>
|
53 |
+
<all>
|
54 |
+
<title>Allow Everything</title>
|
55 |
+
</all>
|
56 |
+
<admin>
|
57 |
+
<children>
|
58 |
+
<Qualityunit_Liveagent>
|
59 |
+
<title>Liveagent Module</title>
|
60 |
+
<sort_order>10</sort_order>
|
61 |
+
</Qualityunit_Liveagent>
|
62 |
+
</children>
|
63 |
+
</admin>
|
64 |
+
</resources>
|
65 |
+
</acl>
|
66 |
+
<layout>
|
67 |
+
<updates>
|
68 |
+
<liveagent>
|
69 |
+
<file>liveagent.xml</file>
|
70 |
+
</liveagent>
|
71 |
+
</updates>
|
72 |
+
</layout>
|
73 |
+
<translate>
|
74 |
+
<modules>
|
75 |
+
<liveagent>
|
76 |
+
<files>
|
77 |
+
<default>qualityunit_liveagent.csv</default>
|
78 |
+
</files>
|
79 |
+
</liveagent>
|
80 |
+
</modules>
|
81 |
+
</translate>
|
82 |
+
</adminhtml>
|
83 |
+
<global>
|
84 |
+
<models>
|
85 |
+
<liveagent>
|
86 |
+
<class>Qualityunit_Liveagent_Model</class>
|
87 |
+
<resourceModel>liveagent_mysql4</resourceModel>
|
88 |
+
</liveagent>
|
89 |
+
<liveagent_mysql4>
|
90 |
+
<class>Qualityunit_Liveagent_Model_Mysql4</class>
|
91 |
+
<entities>
|
92 |
+
<liveagentsettings>
|
93 |
+
<table>liveagentsettings</table>
|
94 |
+
</liveagentsettings>
|
95 |
+
<liveagentbuttons>
|
96 |
+
<table>liveagentbuttons</table>
|
97 |
+
</liveagentbuttons>
|
98 |
+
</entities>
|
99 |
+
</liveagent_mysql4>
|
100 |
+
</models>
|
101 |
+
<resources>
|
102 |
+
<liveagent_setup>
|
103 |
+
<setup>
|
104 |
+
<module>Qualityunit_Liveagent</module>
|
105 |
+
</setup>
|
106 |
+
<connection>
|
107 |
+
<use>core_setup</use>
|
108 |
+
</connection>
|
109 |
+
</liveagent_setup>
|
110 |
+
<liveagent_write>
|
111 |
+
<connection>
|
112 |
+
<use>core_write</use>
|
113 |
+
</connection>
|
114 |
+
</liveagent_write>
|
115 |
+
<liveagent_read>
|
116 |
+
<connection>
|
117 |
+
<use>core_read</use>
|
118 |
+
</connection>
|
119 |
+
</liveagent_read>
|
120 |
+
</resources>
|
121 |
+
<blocks>
|
122 |
+
<liveagent>
|
123 |
+
<class>Qualityunit_Liveagent_Block</class>
|
124 |
+
</liveagent>
|
125 |
+
<buttoncode>
|
126 |
+
<class>Qualityunit_Liveagent_Block</class>
|
127 |
+
</buttoncode>
|
128 |
+
</blocks>
|
129 |
+
<helpers>
|
130 |
+
<liveagent>
|
131 |
+
<class>Qualityunit_Liveagent_Helper</class>
|
132 |
+
</liveagent>
|
133 |
+
</helpers>
|
134 |
+
</global>
|
135 |
</config>
|
app/code/local/Qualityunit/Liveagent/sql/liveagent_setup/mysql4-install-0.1.0.php
CHANGED
@@ -1,38 +1,38 @@
|
|
1 |
-
<?php
|
2 |
-
$installer = $this;
|
3 |
-
$installer->startSetup();
|
4 |
-
$installer->run("
|
5 |
-
DROP TABLE IF EXISTS {$this->getTable('liveagentbuttons')};
|
6 |
-
CREATE TABLE {$this->getTable('liveagentbuttons')} (
|
7 |
-
`liveagentbutton_id` int(11) unsigned NOT NULL auto_increment,
|
8 |
-
`buttonid` char(8) NOT NULL,
|
9 |
-
`userid` char(8) DEFAULT NULL,
|
10 |
-
`name` text,
|
11 |
-
`contenttype` char(1) DEFAULT NULL,
|
12 |
-
`onlinestatus` char(1) DEFAULT NULL,
|
13 |
-
`onlinecode` longtext,
|
14 |
-
`offlinecode` longtext,
|
15 |
-
`window_width` varchar(10) DEFAULT NULL,
|
16 |
-
`window_height` varchar(10) DEFAULT NULL,
|
17 |
-
`window_position` varchar(20) DEFAULT NULL,
|
18 |
-
`impressions` int(11) DEFAULT '0',
|
19 |
-
`chats` int(11) DEFAULT '0',
|
20 |
-
`data1` varchar(255) DEFAULT NULL,
|
21 |
-
`data2` varchar(255) DEFAULT NULL,
|
22 |
-
`data3` varchar(255) DEFAULT NULL,
|
23 |
-
`data4` varchar(255) DEFAULT NULL,
|
24 |
-
`data5` varchar(255) DEFAULT NULL,
|
25 |
-
PRIMARY KEY (`liveagentbutton_id`)
|
26 |
-
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
27 |
-
DROP TABLE IF EXISTS {$this->getTable('liveagentsettings')};
|
28 |
-
CREATE TABLE {$this->getTable('liveagentsettings')} (
|
29 |
-
`id` int(11) unsigned NOT NULL auto_increment,
|
30 |
-
`name` varchar(255) NOT NULL,
|
31 |
-
`value` text DEFAULT NULL,
|
32 |
-
PRIMARY KEY (`id`)
|
33 |
-
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
34 |
-
INSERT INTO {$this->getTable('liveagentsettings')} (`name` ,`value`) VALUES ('la-settings_accountstatus', 'N');
|
35 |
-
INSERT INTO {$this->getTable('liveagentsettings')} (`name` ,`value`) VALUES ('la-settings_accountnotreachabletimes', '0');
|
36 |
-
INSERT INTO {$this->getTable('liveagentsettings')} (`name` ,`value`) VALUES ('la-settings_buttoncode', '');
|
37 |
-
");
|
38 |
$installer->endSetup();
|
1 |
+
<?php
|
2 |
+
$installer = $this;
|
3 |
+
$installer->startSetup();
|
4 |
+
$installer->run("
|
5 |
+
DROP TABLE IF EXISTS {$this->getTable('liveagentbuttons')};
|
6 |
+
CREATE TABLE {$this->getTable('liveagentbuttons')} (
|
7 |
+
`liveagentbutton_id` int(11) unsigned NOT NULL auto_increment,
|
8 |
+
`buttonid` char(8) NOT NULL,
|
9 |
+
`userid` char(8) DEFAULT NULL,
|
10 |
+
`name` text,
|
11 |
+
`contenttype` char(1) DEFAULT NULL,
|
12 |
+
`onlinestatus` char(1) DEFAULT NULL,
|
13 |
+
`onlinecode` longtext,
|
14 |
+
`offlinecode` longtext,
|
15 |
+
`window_width` varchar(10) DEFAULT NULL,
|
16 |
+
`window_height` varchar(10) DEFAULT NULL,
|
17 |
+
`window_position` varchar(20) DEFAULT NULL,
|
18 |
+
`impressions` int(11) DEFAULT '0',
|
19 |
+
`chats` int(11) DEFAULT '0',
|
20 |
+
`data1` varchar(255) DEFAULT NULL,
|
21 |
+
`data2` varchar(255) DEFAULT NULL,
|
22 |
+
`data3` varchar(255) DEFAULT NULL,
|
23 |
+
`data4` varchar(255) DEFAULT NULL,
|
24 |
+
`data5` varchar(255) DEFAULT NULL,
|
25 |
+
PRIMARY KEY (`liveagentbutton_id`)
|
26 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
27 |
+
DROP TABLE IF EXISTS {$this->getTable('liveagentsettings')};
|
28 |
+
CREATE TABLE {$this->getTable('liveagentsettings')} (
|
29 |
+
`id` int(11) unsigned NOT NULL auto_increment,
|
30 |
+
`name` varchar(255) NOT NULL,
|
31 |
+
`value` text DEFAULT NULL,
|
32 |
+
PRIMARY KEY (`id`)
|
33 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
34 |
+
INSERT INTO {$this->getTable('liveagentsettings')} (`name` ,`value`) VALUES ('la-settings_accountstatus', 'N');
|
35 |
+
INSERT INTO {$this->getTable('liveagentsettings')} (`name` ,`value`) VALUES ('la-settings_accountnotreachabletimes', '0');
|
36 |
+
INSERT INTO {$this->getTable('liveagentsettings')} (`name` ,`value`) VALUES ('la-settings_buttoncode', '');
|
37 |
+
");
|
38 |
$installer->endSetup();
|
app/code/local/Qualityunit/Liveagent/sql/liveagent_setup/mysql4-install-2.5.4.php
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
-
<?php
|
2 |
-
$installer = $this;
|
3 |
-
$installer->startSetup();
|
4 |
-
$installer->run("
|
5 |
-
ALTER TABLE {$this->getTable('liveagentsettings')}
|
6 |
-
|
7 |
-
");
|
8 |
$installer->endSetup();
|
1 |
+
<?php
|
2 |
+
$installer = $this;
|
3 |
+
$installer->startSetup();
|
4 |
+
$installer->run("
|
5 |
+
ALTER TABLE {$this->getTable('liveagentsettings')}
|
6 |
+
CHANGE `value` `value` text COLLATE 'utf8_general_ci' NULL AFTER `name`;
|
7 |
+
");
|
8 |
$installer->endSetup();
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Liveagent</name>
|
4 |
-
<version>2.5.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.gnu.org/licenses/gpl-3.0.txt">GPLv3</license>
|
7 |
<channel>community</channel>
|
@@ -10,11 +10,11 @@
|
|
10 |
<description>Magento-LiveAgent plugin integrates full featured help desk and live chat software Live Agent into any Magento installation.
|
11 |
Simply add "start chat" button by few simple clicks and be live within 5 minutes.</description>
|
12 |
<notes>changes:
|
13 |
-
-
|
14 |
<authors><author><name>Juraj Simon</name><user>jurajsim</user><email>jsimon@qualityunit.com</email></author></authors>
|
15 |
-
<date>2015-
|
16 |
-
<time>
|
17 |
-
<contents><target name="magelocal"><dir name="Qualityunit"><dir name="Liveagent"><dir name="Block"><file name="Account.php" hash="
|
18 |
<compatible/>
|
19 |
<dependencies><required><php><min>5.2.0</min><max>5.6.0</max></php><extension><name>curl</name><min/><max/></extension></required></dependencies>
|
20 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Liveagent</name>
|
4 |
+
<version>2.5.9</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.gnu.org/licenses/gpl-3.0.txt">GPLv3</license>
|
7 |
<channel>community</channel>
|
10 |
<description>Magento-LiveAgent plugin integrates full featured help desk and live chat software Live Agent into any Magento installation.
|
11 |
Simply add "start chat" button by few simple clicks and be live within 5 minutes.</description>
|
12 |
<notes>changes:
|
13 |
+
- connection problems fix</notes>
|
14 |
<authors><author><name>Juraj Simon</name><user>jurajsim</user><email>jsimon@qualityunit.com</email></author></authors>
|
15 |
+
<date>2015-07-20</date>
|
16 |
+
<time>11:30:19</time>
|
17 |
+
<contents><target name="magelocal"><dir name="Qualityunit"><dir name="Liveagent"><dir name="Block"><file name="Account.php" hash="0a8f24293b3fb9c11dfdb1fa84924389"/><file name="Base.php" hash="5f7aa2fee0855449b968df556f6ade12"/><file name="Buttoncode.php" hash="e99d54a5fb6073ffbc75286254a371d8"/><file name="Signup.php" hash="05d9c1abd21727b13a3120b0c9fdbc62"/><file name="Waiting.php" hash="f77602ac728f2b8b2eab9a4c4c864d9d"/></dir><dir name="Exception"><file name="Base.php" hash="6efd9dcda657c33bc9cfe6709300b883"/><file name="ConnectProblem.php" hash="f2c9840d533e6389ba84989337de32c9"/><file name="SignupFailed.php" hash="e370773d3b306bb8c24e5263d1491860"/></dir><dir name="Helper"><file name="Account.php" hash="8ca177266bd600874cac584a55a5c694"/><file name="Auth.php" hash="c02f7300b35b77e6a30ada49ea6ccefd"/><file name="Base.php" hash="5d7b663453478d14458103a694ab9137"/><file name="Data.php" hash="40b54155794999d0085be4f05889954f"/><file name="PhpApi.php" hash="adb77eb5ef4cc7a2d5b2adc076a3ee81"/><file name="Settings.php" hash="b78e5f9a6c6c98ae2425e1a3be2fc7c8"/><file name="Signup.php" hash="6ed0f547cc736d70cf63d4408eedfd0c"/><file name=".Auth.php.swp" hash="f261f67ddcfc50fd832c42495a9fc53a"/></dir><dir name="Model"><file name="Buttons.php" hash="30907d56865e8e8d182cc6e8d1e7de14"/><file name="Liveagent.php" hash="3288b2194ace43971bb07f9ee05e25f0"/><dir name="Mysql4"><dir name="Buttons"><file name="Collection.php" hash="64edb5ecfc9b1511ae155f347e9a0e6b"/></dir><file name="Buttons.php" hash="5c2fd7184c1bb88b381ef8440bfe1e4f"/><dir name="Liveagent"><file name="Collection.php" hash="29675fde5a317fdf980a549f40502b8e"/></dir><file name="Liveagent.php" hash="559e305b52289e79f9038aea53a85a48"/><dir name="Settings"><file name="Collection.php" hash="d9dfc6b2abadf95ad6dbdee9f52f9c28"/></dir><file name="Settings.php" hash="cdded3171b84b02ed4ad360dd3cb7b71"/></dir><file name="Settings.php" hash="96e3fb575bfbee4181a9e70065cc42dc"/><file name="Status.php" hash="c743fdabadd7527820e7b8ede6937f38"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="LiveagentController.php" hash="dcedbdb68831ff96de2f92c5b6aa099c"/></dir><file name="IndexController.php" hash="2af5a61bf7319c38c97a48e0f3723598"/></dir><dir name="etc"><file name="config.xml" hash="c4c252b355417d64689df9acbada7f7b"/></dir><dir name="sql"><dir name="liveagent_setup"><file name="mysql4-install-0.1.0.php" hash="68891e5aca423bbb7226975413cd82b8"/><file name="mysql4-install-2.5.4.php" hash="2bd7ec4b4c8a366bed9f3afc264ae897"/></dir></dir></dir><file name=".buildpath" hash="0d2475e3be03419439e2a22ebc4e0813"/><file name=".project" hash="41fa1353a5ab19352d5636d52e17351d"/><dir name=".settings"><file name="org.eclipse.php.core.prefs" hash="abf8f34f8087365ab830524698638d7c"/><file name="org.eclipse.wst.jsdt.ui.superType.container" hash="b27d1cf62dde4473bab7c433317bb0ce"/><file name="org.eclipse.wst.jsdt.ui.superType.name" hash="c89686a387d2b12b3c729ce35a0bcb5b"/><file name=".jsdtscope" hash="d098ed1fa924b2d9d9cb377fb391d758"/></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="liveagent.xml" hash="e07cbd75c0faa7d86c9c0a8a2ff53df1"/></dir><dir name="template"><dir name="liveagent"><file name="button.phtml" hash="3cef6df19c905140c8c8ce01520f0ebd"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Qualityunit_Liveagent.xml" hash="db13786c45588e15d5a390201a1709e4"/></dir></target><target name="magelocale"><dir name="en_US"><file name="qualityunit_liveagent.csv" hash="234db3c1cdc05df98928ae633500bc04"/></dir></target></contents>
|
18 |
<compatible/>
|
19 |
<dependencies><required><php><min>5.2.0</min><max>5.6.0</max></php><extension><name>curl</name><min/><max/></extension></required></dependencies>
|
20 |
</package>
|