Beck_LiveChat - Version 1.3.1

Version Notes

none

Download this release

Release Info

Developer Magento Core Team
Extension Beck_LiveChat
Version 1.3.1
Comparing to
See all releases


Version 1.3.1

Files changed (83) hide show
  1. app/code/community/Beck/LiveChat/Block/Operator.php +36 -0
  2. app/code/community/Beck/LiveChat/Block/Operator/Edit.php +22 -0
  3. app/code/community/Beck/LiveChat/Block/Operator/Edit/Form.php +68 -0
  4. app/code/community/Beck/LiveChat/Block/Operator/List.php +62 -0
  5. app/code/community/Beck/LiveChat/Block/Session/Detail.php +75 -0
  6. app/code/community/Beck/LiveChat/Block/Session/List.php +113 -0
  7. app/code/community/Beck/LiveChat/Block/Template.php +138 -0
  8. app/code/community/Beck/LiveChat/Block/Widget/Chat.php +17 -0
  9. app/code/community/Beck/LiveChat/Block/Widget/Grid/Column/Filter/Dispatched.php +10 -0
  10. app/code/community/Beck/LiveChat/Block/Widget/Grid/Column/Filter/Online.php +10 -0
  11. app/code/community/Beck/LiveChat/Block/Widget/Grid/Column/Filter/State.php +10 -0
  12. app/code/community/Beck/LiveChat/Block/Widget/Grid/Column/Renderer/Dispatched.php +20 -0
  13. app/code/community/Beck/LiveChat/Block/Widget/Grid/Column/Renderer/Online.php +19 -0
  14. app/code/community/Beck/LiveChat/Block/Widget/Grid/Column/Renderer/State.php +50 -0
  15. app/code/community/Beck/LiveChat/Block/Widget/Sessions.php +44 -0
  16. app/code/community/Beck/LiveChat/Helper/Data.php +5 -0
  17. app/code/community/Beck/LiveChat/Model/Api.php +134 -0
  18. app/code/community/Beck/LiveChat/Model/Event.php +60 -0
  19. app/code/community/Beck/LiveChat/Model/Message.php +27 -0
  20. app/code/community/Beck/LiveChat/Model/Mysql4/Message.php +9 -0
  21. app/code/community/Beck/LiveChat/Model/Mysql4/Message/Collection.php +10 -0
  22. app/code/community/Beck/LiveChat/Model/Mysql4/Operator.php +9 -0
  23. app/code/community/Beck/LiveChat/Model/Mysql4/Operator/Collection.php +10 -0
  24. app/code/community/Beck/LiveChat/Model/Mysql4/Session.php +9 -0
  25. app/code/community/Beck/LiveChat/Model/Mysql4/Session/Collection.php +10 -0
  26. app/code/community/Beck/LiveChat/Model/Operator.php +132 -0
  27. app/code/community/Beck/LiveChat/Model/Session.php +167 -0
  28. app/code/community/Beck/LiveChat/Model/Session/List.php +25 -0
  29. app/code/community/Beck/LiveChat/Model/Source/Images.php +16 -0
  30. app/code/community/Beck/LiveChat/Model/Source/Online.php +14 -0
  31. app/code/community/Beck/LiveChat/Model/Source/SessionCreation.php +15 -0
  32. app/code/community/Beck/LiveChat/controllers/ChatController.php +70 -0
  33. app/code/community/Beck/LiveChat/controllers/Operator/ListController.php +76 -0
  34. app/code/community/Beck/LiveChat/controllers/OperatorController.php +67 -0
  35. app/code/community/Beck/LiveChat/controllers/Session/ListController.php +114 -0
  36. app/code/community/Beck/LiveChat/controllers/Session/LiveController.php +181 -0
  37. app/code/community/Beck/LiveChat/etc/api.xml +73 -0
  38. app/code/community/Beck/LiveChat/etc/config.xml +219 -0
  39. app/code/community/Beck/LiveChat/etc/system.xml +255 -0
  40. app/code/community/Beck/LiveChat/sql/livechat_setup/mysql4-install-1.0.0.php +40 -0
  41. app/code/community/Beck/LiveChat/sql/livechat_setup/mysql4-upgrade-1.0.0-1.2.4.php +6 -0
  42. app/code/community/Beck/LiveChat/sql/livechat_setup/mysql4-upgrade-1.2.4-1.2.9.php +6 -0
  43. app/code/community/Beck/LiveChat/sql/livechat_setup/mysql4-upgrade-1.2.9-1.3.0.php +7 -0
  44. app/design/adminhtml/default/default/layout/livechat.xml +32 -0
  45. app/design/adminhtml/default/default/template/livechat/operator.phtml +39 -0
  46. app/design/adminhtml/default/default/template/livechat/widget/chatlive.phtml +79 -0
  47. app/design/adminhtml/default/default/template/livechat/widget/sessionslive.phtml +43 -0
  48. app/design/frontend/default/default/layout/livechat.xml +14 -0
  49. app/design/frontend/default/default/template/livechat/chat.phtml +49 -0
  50. app/design/frontend/default/modern/layout/livechat.xml +17 -0
  51. app/design/frontend/default/modern/template/livechat/chat.phtml +49 -0
  52. app/etc/modules/ZBeck_LiveChat.xml +11 -0
  53. app/locale/fr_FR/Beck_LiveChat.csv +86 -0
  54. js/livechat/js.js +58 -0
  55. package.xml +21 -0
  56. skin/adminhtml/default/default/images/livechat/base_mini_actions_bg.gif +0 -0
  57. skin/adminhtml/default/default/images/livechat/base_mini_head_bg.gif +0 -0
  58. skin/adminhtml/default/default/images/livechat/chat.png +0 -0
  59. skin/adminhtml/default/default/livechat/livechat.css +60 -0
  60. skin/frontend/default/default/css/livechat/livechat.css +1 -0
  61. skin/frontend/default/default/images/livechat/Thumbs.db +0 -0
  62. skin/frontend/default/default/images/livechat/ajax-loader.gif +0 -0
  63. skin/frontend/default/default/images/livechat/chat.png +0 -0
  64. skin/frontend/default/default/images/livechat/livechat_icon_1_offline.gif +0 -0
  65. skin/frontend/default/default/images/livechat/livechat_icon_1_online.gif +0 -0
  66. skin/frontend/default/default/images/livechat/livechat_icon_2_offline.gif +0 -0
  67. skin/frontend/default/default/images/livechat/livechat_icon_2_online.gif +0 -0
  68. skin/frontend/default/default/images/livechat/livechat_icon_3_offline.gif +0 -0
  69. skin/frontend/default/default/images/livechat/livechat_icon_3_online.gif +0 -0
  70. skin/frontend/default/default/images/livechat/livechat_icon_4_offline.gif +0 -0
  71. skin/frontend/default/default/images/livechat/livechat_icon_4_online.gif +0 -0
  72. skin/frontend/default/modern/css/livechat/livechat.css +1 -0
  73. skin/frontend/default/modern/images/livechat/Thumbs.db +0 -0
  74. skin/frontend/default/modern/images/livechat/ajax-loader.gif +0 -0
  75. skin/frontend/default/modern/images/livechat/chat.png +0 -0
  76. skin/frontend/default/modern/images/livechat/livechat_icon_1_offline.gif +0 -0
  77. skin/frontend/default/modern/images/livechat/livechat_icon_1_online.gif +0 -0
  78. skin/frontend/default/modern/images/livechat/livechat_icon_2_offline.gif +0 -0
  79. skin/frontend/default/modern/images/livechat/livechat_icon_2_online.gif +0 -0
  80. skin/frontend/default/modern/images/livechat/livechat_icon_3_offline.gif +0 -0
  81. skin/frontend/default/modern/images/livechat/livechat_icon_3_online.gif +0 -0
  82. skin/frontend/default/modern/images/livechat/livechat_icon_4_offline.gif +0 -0
  83. skin/frontend/default/modern/images/livechat/livechat_icon_4_online.gif +0 -0
app/code/community/Beck/LiveChat/Block/Operator.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Beck_LiveChat_Block_Operator extends Mage_Adminhtml_Block_Template
3
+ {
4
+
5
+ public function __construct()
6
+ {
7
+ parent::__construct();
8
+ $this->setTemplate('livechat/operator.phtml');
9
+ }
10
+
11
+ protected function _prepareLayout()
12
+ {
13
+ $this->setChild('add_new_button',
14
+ $this->getLayout()->createBlock('adminhtml/widget_button')
15
+ ->setData(array(
16
+ 'label' => Mage::helper('livechat')->__('Create new operator'),
17
+ 'onclick' => "setLocation('".$this->getUrl('adminhtml/api_user')."')",
18
+ 'class' => 'add'
19
+ ))
20
+ );
21
+
22
+ $this->setChild('grid', $this->getLayout()->createBlock('livechat/operator_list', 'operator.list'));
23
+ return parent::_prepareLayout();
24
+ }
25
+
26
+ public function getAddNewButtonHtml()
27
+ {
28
+ return $this->getChildHtml('add_new_button');
29
+ }
30
+
31
+ public function getGridHtml()
32
+ {
33
+ return $this->getChildHtml('grid');
34
+ }
35
+
36
+ }
app/code/community/Beck/LiveChat/Block/Operator/Edit.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Beck_LiveChat_Block_Operator_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
4
+ {
5
+ public function __construct()
6
+ {
7
+ parent::__construct();
8
+
9
+ $this->_objectId = 'id';
10
+
11
+ $this->_blockGroup = 'livechat';
12
+ $this->_controller = 'operator';
13
+ $this->_mode = 'edit';
14
+
15
+ $this->_updateButton('save', 'label', $this->__('Save'));
16
+ }
17
+
18
+ public function getHeaderText()
19
+ {
20
+ return Mage::helper('livechat')->__('Edit operator');
21
+ }
22
+ }
app/code/community/Beck/LiveChat/Block/Operator/Edit/Form.php ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Beck_LiveChat_Block_Operator_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
4
+ {
5
+ protected function _prepareForm()
6
+ {
7
+ $form = new Varien_Data_Form(array(
8
+ 'id' => 'edit_form',
9
+ 'action' => $this->getUrl('*/*/save'),
10
+ 'method' => 'post',
11
+ 'enctype' => 'multipart/form-data'
12
+ )
13
+ );
14
+
15
+ $OperatorId = $this->getRequest()->getParam('id', 0);
16
+ $Operator = Mage::getModel('livechat/operator')->load($OperatorId);
17
+ $data = $Operator->getStore_allowed();
18
+ $data = explode('-', $data);
19
+ $form->setUseContainer(true);
20
+ $this->setForm($form);
21
+
22
+ $fieldset = $form->addFieldset('livechat_form', array('legend'=>$this->__('Operator\'s data')));
23
+
24
+ $fieldset->addField('id', 'hidden', array(
25
+ 'class' => 'required-entry',
26
+ 'required' => true,
27
+ 'name' => 'id',
28
+ 'value' => $Operator->getId(),
29
+ ));
30
+
31
+ $field = $fieldset->addField('stores', 'multiselect',
32
+ array(
33
+ 'name' => 'stores',
34
+ 'label' => $Operator->getName(),
35
+ 'value' => $data,
36
+ 'values' => $this->_getValues(),
37
+ ));
38
+
39
+
40
+ return parent::_prepareForm();
41
+ }
42
+
43
+ protected function _getValues()
44
+ {
45
+ $values = array();
46
+ $websiteCollection = Mage::getModel('core/website')->getResourceCollection();
47
+ foreach ($websiteCollection as $website)
48
+ {
49
+ $groupCollection = $website->getGroupCollection();
50
+ foreach ($groupCollection as $group)
51
+ {
52
+ $storeCollection = $group->getStoreCollection();
53
+ $values[$group->getName()]['value'] = array();
54
+ $values[$group->getName()]['label'] = $group->getName();
55
+ foreach ($storeCollection as $store)
56
+ {
57
+ $index = count($values[$group->getName()]['value']);
58
+ $values[$group->getName()]['value'][$index]['value'] = $store->getId();
59
+ $values[$group->getName()]['value'][$index]['label'] = $store->getName();
60
+ $values[$group->getName()]['value'][$index]['title'] = $store->getName();
61
+ }
62
+ }
63
+ }
64
+ //Zend_Debug::dump($this->_values);
65
+ return $values;
66
+ }
67
+
68
+ }
app/code/community/Beck/LiveChat/Block/Operator/List.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Beck_LiveChat_Block_Operator_List extends Mage_Adminhtml_Block_Widget_Grid
4
+ {
5
+ public function __construct()
6
+ {
7
+ parent::__construct();
8
+ $this->setId('id');
9
+ $this->setDefaultSort('id');
10
+ $this->setDefaultDir('asc');
11
+ $this->setSaveParametersInSession(true);
12
+ $this->setUseAjax(true);
13
+ $this->setVarNameFilter('operator_filter');
14
+
15
+ }
16
+
17
+ protected function _prepareCollection()
18
+ {
19
+ $collection = Mage::getModel('livechat/operator')->getCollection();
20
+ $this->setCollection($collection);
21
+ parent::_prepareCollection();
22
+ return $this;
23
+ }
24
+
25
+ protected function _prepareColumns()
26
+ {
27
+ $this->addColumn('operator_id',
28
+ array(
29
+ 'header'=> Mage::helper('catalog')->__('ID'),
30
+ 'width' => '50px',
31
+ 'type' => 'number',
32
+ 'index' => 'id',
33
+ ));
34
+ $this->addColumn('operatorname',
35
+ array(
36
+ 'header'=> Mage::helper('livechat')->__('Name'),
37
+ 'index' => 'name',
38
+ ));
39
+ $this->addColumn('is_online',
40
+ array(
41
+ 'header'=> Mage::helper('livechat')->__('Status'),
42
+ 'type' => 'text',
43
+ 'index' => 'is_online',
44
+ 'type' => 'select',
45
+ 'renderer'=>'livechat/widget_grid_column_renderer_online',
46
+ 'filter'=>'livechat/widget_grid_column_filter_online',
47
+ 'options'=>Beck_LiveChat_Model_Source_Online::toOptionsArray()
48
+ ));
49
+
50
+ return parent::_prepareColumns();
51
+ }
52
+
53
+ public function getGridUrl()
54
+ {
55
+ return $this->getUrl('*/*/grid', array('_current'=>true));
56
+ }
57
+
58
+ public function getRowUrl($row)
59
+ {
60
+ return $this->getUrl('*/*/edit', array('id'=>$row->getId()));
61
+ }
62
+ }
app/code/community/Beck/LiveChat/Block/Session/Detail.php ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Beck_LiveChat_Block_Session_Detail extends Mage_Adminhtml_Block_Widget_Grid
4
+ {
5
+ private $idSession = 0;
6
+
7
+ public function __construct()
8
+ {
9
+ parent::__construct();
10
+ $this->setId('id');
11
+ $this->setDefaultSort('id');
12
+ $this->setDefaultDir('desc');
13
+ $this->setSaveParametersInSession(true);
14
+ $this->setUseAjax(true);
15
+ $this->setVarNameFilter('sessiondetail_filter');
16
+ $this->sessionId = $this->getRequest()->getParam('sessionId', 0);
17
+ }
18
+
19
+ protected function _prepareCollection()
20
+ {
21
+ $session = Mage::getModel('livechat/session')->load($this->sessionId);
22
+ $collection = $session->getMessages();
23
+ $this->setCollection($collection);
24
+ parent::_prepareCollection();
25
+ return $this;
26
+ }
27
+
28
+ protected function _prepareColumns()
29
+ {
30
+ $this->addColumn('message_id',
31
+ array(
32
+ 'header'=> Mage::helper('catalog')->__('ID'),
33
+ 'width' => '50px',
34
+ 'type' => 'number',
35
+ 'index' => 'id',
36
+ ));
37
+ $this->addColumn('date',
38
+ array(
39
+ 'header'=> Mage::helper('livechat')->__('Placed at'),
40
+ 'index' => 'date',
41
+ 'type'=> 'datetime'
42
+ ));
43
+ $this->addColumn('autorname',
44
+ array(
45
+ 'header'=> Mage::helper('livechat')->__('Autor'),
46
+ 'index' => 'autor_name',
47
+ ));
48
+ $this->addColumn('message',
49
+ array(
50
+ 'header'=> Mage::helper('livechat')->__('Message'),
51
+ 'index' => 'message',
52
+ ));
53
+
54
+ return parent::_prepareColumns();
55
+ }
56
+
57
+ protected function _prepareMassaction()
58
+ {
59
+ $this->setMassactionIdField('id');
60
+ $this->getMassactionBlock()->setFormFieldName('message');
61
+
62
+ $this->getMassactionBlock()->addItem('delete', array(
63
+ 'label'=> Mage::helper('livechat')->__('Delete'),
64
+ 'url' => $this->getUrl('*/*/massMessageDelete', array('sessionId'=>$this->sessionId)),
65
+ 'confirm' => Mage::helper('livechat')->__('Are you sure ?')
66
+ ));
67
+
68
+ return $this;
69
+ }
70
+
71
+ public function getGridUrl()
72
+ {
73
+ return $this->getUrl('*/*/detailGrid', array('_current'=>true));
74
+ }
75
+ }
app/code/community/Beck/LiveChat/Block/Session/List.php ADDED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Beck_LiveChat_Block_Session_List extends Mage_Adminhtml_Block_Widget_Grid
4
+ {
5
+ public function __construct()
6
+ {
7
+ parent::__construct();
8
+ $this->setId('id');
9
+ $this->setDefaultSort('date_started');
10
+ $this->setDefaultDir('desc');
11
+ $this->setSaveParametersInSession(true);
12
+ $this->setUseAjax(true);
13
+ $this->setVarNameFilter('session_filter');
14
+
15
+ }
16
+
17
+ protected function _prepareCollection()
18
+ {
19
+ $collection = Mage::getModel('livechat/session')->getCollection();
20
+ $this->setCollection($collection);
21
+ parent::_prepareCollection();
22
+ return $this;
23
+ }
24
+
25
+ protected function _prepareColumns()
26
+ {
27
+ $this->addColumn('session_id',
28
+ array(
29
+ 'header'=> Mage::helper('catalog')->__('ID'),
30
+ 'width' => '50px',
31
+ 'type' => 'number',
32
+ 'index' => 'id',
33
+ ));
34
+ $this->addColumn('customername',
35
+ array(
36
+ 'header'=> Mage::helper('livechat')->__('Customer name'),
37
+ 'index' => 'customer_name',
38
+ ));
39
+ $this->addColumn('customerurl',
40
+ array(
41
+ 'header'=> Mage::helper('livechat')->__('Customer url'),
42
+ 'index' => 'customer_url',
43
+ ));
44
+ $this->addColumn('date_started',
45
+ array(
46
+ 'header'=> Mage::helper('livechat')->__('Started at'),
47
+ 'type' => 'datetime',
48
+ 'index' => 'date_started'
49
+ ));
50
+ $this->addColumn('dispatched',
51
+ array(
52
+ 'header'=> Mage::helper('livechat')->__('Dispatched to'),
53
+ 'index' => 'dispatched',
54
+ 'type' => 'dispatched',
55
+ 'renderer'=>'livechat/widget_grid_column_renderer_dispatched',
56
+ 'filter'=>'livechat/widget_grid_column_filter_dispatched',
57
+ 'options'=>Mage::getModel('livechat/session_list')->getOperatorFilterListToArray()
58
+ ));
59
+ $this->addColumn('store',
60
+ array(
61
+ 'header'=> Mage::helper('livechat')->__('Store'),
62
+ 'type' =>'store',
63
+ 'index' => 'store_id',
64
+ ));
65
+ $this->addColumn('state',
66
+ array(
67
+ 'header'=> Mage::helper('livechat')->__('State'),
68
+ 'type'=>'state',
69
+ 'renderer'=>'livechat/widget_grid_column_renderer_state',
70
+ 'filter'=>'livechat/widget_grid_column_filter_state',
71
+ 'index' => 'close',
72
+ 'options'=>Mage::getModel('livechat/session_list')->getStateFilterListToArray()
73
+ ));
74
+ $this->addColumn('order',
75
+ array(
76
+ 'header'=> Mage::helper('livechat')->__('Order placed'),
77
+ 'type'=>'text',
78
+ //'renderer'=>'livechat/widget_grid_column_renderer_orderplaced',
79
+ //'filter'=>'livechat/widget_grid_column_filter_orderplaced',
80
+ 'index' => 'order_placed'
81
+ ));
82
+
83
+ return parent::_prepareColumns();
84
+ }
85
+
86
+ protected function _prepareMassaction()
87
+ {
88
+ $this->setMassactionIdField('id');
89
+ $this->getMassactionBlock()->setFormFieldName('session');
90
+
91
+ $this->getMassactionBlock()->addItem('close', array(
92
+ 'label'=> Mage::helper('livechat')->__('Close'),
93
+ 'url' => $this->getUrl('*/*/massClose'),
94
+ 'confirm' => Mage::helper('livechat')->__('Are you sure ?')
95
+ ));
96
+ $this->getMassactionBlock()->addItem('delete', array(
97
+ 'label'=> Mage::helper('livechat')->__('Delete'),
98
+ 'url' => $this->getUrl('*/*/massDelete'),
99
+ 'confirm' => Mage::helper('livechat')->__('Are you sure ?')
100
+ ));
101
+ return $this;
102
+ }
103
+
104
+ public function getGridUrl()
105
+ {
106
+ return $this->getUrl('*/*/grid', array('_current'=>true));
107
+ }
108
+
109
+ public function getRowUrl($row)
110
+ {
111
+ return $this->getUrl('*/*/detail', array('sessionId'=>$row->getId()));
112
+ }
113
+ }
app/code/community/Beck/LiveChat/Block/Template.php ADDED
@@ -0,0 +1,138 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Beck_LiveChat_Block_Template extends Mage_Core_Block_Template
4
+ {
5
+ public $isActive = false;
6
+ public $refreshfrequency = 15;
7
+ public $refreshdecay = 1;
8
+ public $chatlabel = 'Need help ? Ask live !';
9
+ public $imageStyle = '3';
10
+ public $unavailablelabel = 'Sorry';
11
+ public $titlelabel = 'LIVECHAT';
12
+
13
+ protected function _construct()
14
+ {
15
+ parent::_construct();
16
+ $this->isActive = $this->getConfigData('livechatconfiguration/general/active') == '0' ? false : true;
17
+ if ($this->isActive)
18
+ {
19
+ $this->refreshfrequency = $this->getConfigData('livechatconfiguration/general/refreshfrequency');
20
+ $this->refreshdecay = $this->getConfigData('livechatconfiguration/general/refreshdecay');
21
+ $this->chatlabel = $this->getConfigData('livechatconfiguration/display/chatlabel');
22
+ $this->imageStyle = $this->getConfigData('livechatconfiguration/display/imagestyle');
23
+ $this->unavailablelabel = $this->getConfigData('livechatconfiguration/display/unavailablelabel');
24
+ $this->titlelabel = $this->getConfigData('livechatconfiguration/display/titlelabel');
25
+ $session_id = Mage::getSingleton('checkout/session')->getEncryptedSessionId();
26
+ $session = Mage::getModel('livechat/session');
27
+ if ($session->Exist($session_id))
28
+ {
29
+ $url = 'http://' . $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];
30
+ if ($session->getCustomer_url() != $url && $session->getClose() == '0')
31
+ {
32
+ $session->setCustomer_url($url)->save();
33
+ }
34
+ }
35
+ else
36
+ {
37
+ $sessionCreation = $this->getConfigData('livechatconfiguration/general/sessioncreation');
38
+ if ($sessionCreation != '0')
39
+ {
40
+ if (Mage::Helper('customer/data')->isLoggedIn())
41
+ {
42
+ $customer_name = Mage::getSingleton('customer/session')->getCustomer()->getName();
43
+ }
44
+ else
45
+ {
46
+ $customer_name = Mage::getStoreConfig('livechatconfiguration/display/defaultcustomername', $this->getStoreId());
47
+ }
48
+ $message = trim(Mage::getStoreConfig('livechatconfiguration/display/systemautosessionmessage', $this->getStoreId()));
49
+ if ($sessionCreation == '1')
50
+ {
51
+ $session->setCustomer_name($customer_name)
52
+ ->setCustomer_session_id($session_id)
53
+ ->setDate_started(now())
54
+ ->setStore_id($this->getStoreId())
55
+ ->save();
56
+ if ($message != '')
57
+ {
58
+ $session->saveMessage(Mage::getStoreConfig('livechatconfiguration/display/systemname', $this->getStoreId()), $message);
59
+ }
60
+ }
61
+ elseif ($sessionCreation == '2' && Mage::Helper('customer/data')->isLoggedIn())
62
+ {
63
+ $session->setCustomer_name($customer_name)
64
+ ->setCustomer_session_id($session_id)
65
+ ->setDate_started(now())
66
+ ->setStore_id($this->getStoreId())
67
+ ->save();
68
+ if ($message != '')
69
+ {
70
+ $session->saveMessage(Mage::getStoreConfig('livechatconfiguration/display/systemname', $this->getStoreId()), $message);
71
+ }
72
+ }
73
+ }
74
+ }
75
+ }
76
+ }
77
+
78
+ protected function getConfigData($path)
79
+ {
80
+ return (Mage::getStoreConfig($path, $this->getStoreId()));
81
+ }
82
+
83
+ public function ChatSessionStarted()
84
+ {
85
+ $session_id = Mage::getSingleton('checkout/session')->getEncryptedSessionId();
86
+ return (Mage::getModel('livechat/session')->Exist($session_id));
87
+ }
88
+
89
+ public function returnChatImage()
90
+ {
91
+ $url =$this->getSkinUrl('images/livechat/livechat_icon_'.$this->imageStyle.'_offline.gif');
92
+ if ($this->AreOperatorOnline())
93
+ {
94
+ $url = $this->getSkinUrl('images/livechat/livechat_icon_'.$this->imageStyle.'_online.gif');
95
+ }
96
+ $img = '<img src="'.$url.'" alt="'.$this->chatlabel.'" style="float:left">';
97
+ return $img;
98
+ }
99
+
100
+ public function AreOperatorOnline()
101
+ {
102
+ $operatorCollection = Mage::getModel('livechat/operator')->getCollection();
103
+ $nb = 0;
104
+ foreach ($operatorCollection as $operator)
105
+ {
106
+ if ($operator->getIs_online() == '1')
107
+ {
108
+ if ($operator->IsOperatorAffectedToStore($this->getStoreId()))
109
+ {
110
+ $nb++;
111
+ }
112
+ }
113
+ }
114
+ if ($nb > 0)
115
+ {
116
+ return true;
117
+ }
118
+ return false;
119
+ }
120
+
121
+ public function getStoreId()
122
+ {
123
+ return (Mage::app()->getStore(true)->getId());
124
+ }
125
+
126
+ public function getMessages()
127
+ {
128
+ $session_id = Mage::getSingleton('checkout/session')->getEncryptedSessionId();
129
+ $session = Mage::getModel('livechat/session');
130
+ if ($session->Exist($session_id))
131
+ {
132
+ $messages = $session->getMessages();
133
+ return ($messages);
134
+ //Zend_Debug::dump($messages);
135
+ }
136
+ return (null);
137
+ }
138
+ }
app/code/community/Beck/LiveChat/Block/Widget/Chat.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Beck_LiveChat_Block_Widget_Chat extends Mage_Adminhtml_Block_Widget
4
+ {
5
+ protected $_session = null;
6
+
7
+ public function __construct()
8
+ {
9
+ parent::__construct();
10
+ $this->setTemplate('livechat'.DS.'widget'.DS.'chatlive.phtml');
11
+ }
12
+
13
+ public function SetSession(Beck_LiveChat_Model_Session $session)
14
+ {
15
+ $this->_session = $session;
16
+ }
17
+ }
app/code/community/Beck/LiveChat/Block/Widget/Grid/Column/Filter/Dispatched.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Beck_LiveChat_Block_Widget_Grid_Column_Filter_Dispatched extends Mage_Adminhtml_Block_Widget_Grid_Column_Filter_Select
4
+ {
5
+ public function getHtml()
6
+ {
7
+ $html = parent::getHtml();
8
+ return $html;
9
+ }
10
+ }
app/code/community/Beck/LiveChat/Block/Widget/Grid/Column/Filter/Online.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Beck_LiveChat_Block_Widget_Grid_Column_Filter_Online extends Mage_Adminhtml_Block_Widget_Grid_Column_Filter_Select
4
+ {
5
+ public function getHtml()
6
+ {
7
+ $html = parent::getHtml();
8
+ return $html;
9
+ }
10
+ }
app/code/community/Beck/LiveChat/Block/Widget/Grid/Column/Filter/State.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Beck_LiveChat_Block_Widget_Grid_Column_Filter_State extends Mage_Adminhtml_Block_Widget_Grid_Column_Filter_Select
4
+ {
5
+ public function getHtml()
6
+ {
7
+ $html = parent::getHtml();
8
+ return $html;
9
+ }
10
+ }
app/code/community/Beck/LiveChat/Block/Widget/Grid/Column/Renderer/Dispatched.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Beck_LiveChat_Block_Widget_Grid_Column_Renderer_Dispatched extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
4
+ {
5
+ public function render(Varien_Object $row)
6
+ {
7
+ $html = '';
8
+ $operatorid = (int)$row->dispatched;
9
+ if ($operatorid <= 0)
10
+ {
11
+ $html .= Mage::Helper('livechat')->__('Not dispatched');
12
+ }
13
+ else
14
+ {
15
+ $html .= Mage::getModel('livechat/operator')->load($operatorid)->getName();
16
+ }
17
+
18
+ return ($html);
19
+ }
20
+ }
app/code/community/Beck/LiveChat/Block/Widget/Grid/Column/Renderer/Online.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Beck_LiveChat_Block_Widget_Grid_Column_Renderer_Online extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
4
+ {
5
+ public function render(Varien_Object $row)
6
+ {
7
+ $html = '';
8
+ $status = (int)$row->is_online;
9
+ if ($status == 1)
10
+ {
11
+ $html .= Mage::Helper('livechat')->__('Online');
12
+ }
13
+ else
14
+ {
15
+ $html .= Mage::Helper('livechat')->__('Disconnected');
16
+ }
17
+ return $html;
18
+ }
19
+ }
app/code/community/Beck/LiveChat/Block/Widget/Grid/Column/Renderer/State.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Beck_LiveChat_Block_Widget_Grid_Column_Renderer_State extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
4
+ {
5
+ public function render(Varien_Object $row)
6
+ {
7
+ $html = '';
8
+ $state = (int)$row->close;
9
+ $session = Mage::getSingleton('adminhtml/session');
10
+ $list = array();
11
+ if ($session->getData('customerOnline') == null)
12
+ {
13
+ try
14
+ {
15
+ $customerOnline = Mage::getResourceSingleton('log/visitor_collection')
16
+ ->useOnlineFilter();
17
+ foreach ($customerOnline as $customer)
18
+ {
19
+ $list[] = $customer->getSession_id();
20
+ }
21
+ $session->setData('customerOnline', $list);
22
+ }
23
+ catch (Exception $e)
24
+ {
25
+ $list = $session->getData('customerOnline');
26
+ }
27
+ }
28
+ else
29
+ {
30
+ $list = $session->getData('customerOnline');
31
+ }
32
+ $session = Mage::getModel('livechat/session')->load($row->id);
33
+ if ($session->Expired($list))
34
+ {
35
+ $session->Close();
36
+ $state = 1;
37
+ }
38
+
39
+ if ($state == 1)
40
+ {
41
+ $html .= Mage::Helper('livechat')->__('Closed');
42
+ }
43
+ else
44
+ {
45
+ $html .= Mage::Helper('livechat')->__('Open');
46
+ }
47
+
48
+ return ($html);
49
+ }
50
+ }
app/code/community/Beck/LiveChat/Block/Widget/Sessions.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Beck_LiveChat_Block_Widget_Sessions extends Mage_Adminhtml_Block_Widget
4
+ {
5
+ protected $urlUpdater = '';
6
+ protected $urlSendMessage = '';
7
+
8
+ public function __construct()
9
+ {
10
+ parent::__construct();
11
+ $this->setTemplate('livechat'.DS.'widget'.DS.'sessionslive.phtml');
12
+ $this->urlUpdater = $this->getUrl('*/*/updater');
13
+ $this->urlSendMessage = $this->getUrl('*/*/sendMessage');
14
+ }
15
+
16
+ protected function _toHtml()
17
+ {
18
+ $html = parent::_toHtml();
19
+ $session = Mage::getSingleton('adminhtml/session');
20
+ if ($session->getData('OperatorName') != null)
21
+ {
22
+ foreach ($this->getSortedChildren() as $name)
23
+ {
24
+ $block = $this->getLayout()->getBlock($name);
25
+ if (!$block)
26
+ {
27
+ Mage::throwException(Mage::helper('core')->__('Invalid block: %s', $name));
28
+ }
29
+ $html .= $block->toHtml();
30
+ }
31
+ }
32
+ return $html;
33
+ }
34
+
35
+
36
+ public function AddChatSession(Beck_LiveChat_Model_Session $session)
37
+ {
38
+ //$block = $this->getLayout()->createBlock('livechat/widget_chat', 'chat_'.$session->getId());
39
+ $block = $this->getLayout()->createBlock('livechat/widget_chat', 'chat_'.rand(1, 9999));
40
+ $block->SetSession($session);
41
+ $this->append($block);
42
+ }
43
+
44
+ }
app/code/community/Beck/LiveChat/Helper/Data.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php
2
+
3
+ class Beck_LiveChat_Helper_Data extends Mage_Core_Helper_Abstract
4
+ {
5
+ }
app/code/community/Beck/LiveChat/Model/Api.php ADDED
@@ -0,0 +1,134 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Beck_LiveChat_Model_Api extends Mage_Api_Model_Resource_Abstract
4
+ {
5
+ public function getsessions($operatorName)
6
+ {
7
+ $result = array();
8
+ $operator = Mage::getModel('livechat/operator');
9
+ $customerOnline = Mage::getResourceSingleton('log/visitor_collection')
10
+ ->useOnlineFilter();
11
+ $list = array();
12
+ foreach ($customerOnline as $customer)
13
+ {
14
+ $list[] = $customer->getSession_id();
15
+ }
16
+ if ($operator->Exist($operatorName))
17
+ {
18
+ $sessions = $operator->getSessionsAvailable();
19
+
20
+ foreach ($sessions as $session)
21
+ {
22
+ if (!$session->Expired($list))
23
+ {
24
+ if ($session->getDispatched() == 0 || $session->getDispatched() == $operator->getId())
25
+ {
26
+ $session->setDispatched($operator->getId())
27
+ ->save();
28
+ $result[] = $session->toArray();
29
+ }
30
+ }
31
+ else
32
+ {
33
+ $session->Close();
34
+ }
35
+ }
36
+ }
37
+ return ($result);
38
+ }
39
+
40
+ public function getmessages($session_id)
41
+ {
42
+ $result = array();
43
+ $session = Mage::getModel('livechat/session');
44
+ if ($session->Exist($session_id))
45
+ {
46
+ $messages = $session->getMessages();
47
+ foreach ($messages as $message)
48
+ {
49
+ $result[] = $message->toArray();
50
+ }
51
+ }
52
+ return ($result);
53
+ }
54
+
55
+ public function sendmessage($session_id, $autor, $message)
56
+ {
57
+ $session = Mage::getModel('livechat/session');
58
+ if ($session->Exist($session_id))
59
+ {
60
+ $session->saveMessage($autor, $message);
61
+ //return true;
62
+ }
63
+ //return false;
64
+ }
65
+
66
+ public function operatorconnect($name)
67
+ {
68
+ $operator = Mage::getModel('livechat/operator');
69
+ if (!$operator->Exist($name))
70
+ {
71
+ $operator->setName($name)
72
+ ->save();
73
+ }
74
+ $operator->Connected();
75
+ }
76
+
77
+ public function operatordisconnect($name)
78
+ {
79
+ $operator = Mage::getModel('livechat/operator');
80
+ if ($operator->Exist($name))
81
+ {
82
+ $operator->Disconnected();
83
+ }
84
+ }
85
+
86
+ public function refreshmessages($current_messages)
87
+ {
88
+ $data = $this->FormatCurrentData($current_messages);
89
+ $session = Mage::getModel('livechat/session');
90
+ $newMessages = array();
91
+ foreach ($data['sessions'] as $sessionData)
92
+ {
93
+ $session->load($sessionData['id']);
94
+ $newMessages = array_merge($session->getNewMessages($sessionData['messages']), $newMessages);
95
+ }
96
+ return ($newMessages);
97
+ }
98
+
99
+ public function refreshsessions($operatorName, $current_sessions)
100
+ {
101
+ $current_sessions = explode('-', $current_sessions);
102
+ $sessions = $this->getsessions($operatorName);
103
+
104
+ $result = array();
105
+ foreach ($sessions as $session)
106
+ {
107
+ if (!in_array($session['id'], $current_sessions, false))
108
+ {
109
+ $result[] = $session;
110
+ }
111
+ }
112
+ return ($result);
113
+ }
114
+
115
+ private function FormatCurrentData($current_Data)
116
+ {
117
+ $data = array();
118
+ $sessions = explode('#', $current_Data);
119
+ foreach ($sessions as $session)
120
+ {
121
+ eregi("^([0-9]+)-", $session, $regs);
122
+ $session_id = $regs[0];
123
+ $session = str_ireplace($session_id, '', $session);
124
+ $session_id = str_ireplace('-', '', $session_id);
125
+ $messages = explode(',', $session);
126
+ $data['sessions'][$session_id]['id'] = $session_id;
127
+ foreach ($messages as $message)
128
+ {
129
+ $data['sessions'][$session_id]['messages'][$message] = $message;
130
+ }
131
+ }
132
+ return ($data);
133
+ }
134
+ }
app/code/community/Beck/LiveChat/Model/Event.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Beck_LiveChat_Model_Event
4
+ {
5
+ public function save_chat_session_order_placed($observer)
6
+ {
7
+ $event = $observer->getEvent();
8
+ $order = $event->getOrder();
9
+ $session_id = Mage::getSingleton('checkout/session')->getEncryptedSessionId();
10
+ $session = Mage::getModel('livechat/session')->loadBySessionId($session_id);
11
+ if (is_object($session))
12
+ {
13
+ $session->PlaceOrder($order->getIncrementId());
14
+ }
15
+ return $this;
16
+ }
17
+
18
+ /*public function after_save($observer)
19
+ {
20
+ Mage::getModel('fianet/log')->log('after_save');
21
+ $object = $observer->getEvent()->getObject();
22
+
23
+ //Zend_Debug::dump($object);
24
+ }*/
25
+
26
+ public function on_customer_login($observer)
27
+ {
28
+ $event = $observer->getEvent();
29
+ try
30
+ {
31
+ $customer_name = $event->getCustomer()->getName();
32
+ $changechatcreator = Mage::getStoreConfig('livechatevents/oncustomerconnexion/changechatcreatorname', 0) == '1' ? true : false;
33
+ $changemessagesautor = Mage::getStoreConfig('livechatevents/oncustomerconnexion/changeallcustomermessageautor', 0) == '1' ? true : false;
34
+ $defaultcustomername = Mage::getStoreConfig('livechatconfiguration/display/defaultcustomername', Mage::app()->getStore(true)->getId());
35
+ $session_id = Mage::getSingleton('checkout/session')->getEncryptedSessionId();
36
+ $session = Mage::getModel('livechat/session');
37
+ if ($changechatcreator == true)
38
+ {
39
+ if ($session->Exist($session_id))
40
+ {
41
+ $session->setCustomer_name($customer_name)->save();
42
+ }
43
+ }
44
+ if ($changemessagesautor == true)
45
+ {
46
+ if ($session->Exist($session_id))
47
+ {
48
+ $messages = $session->getCustomerMessages();
49
+ foreach ($messages as $message)
50
+ {
51
+ $message->setAutor_name($customer_name)->save();
52
+ }
53
+ }
54
+ }
55
+ }
56
+ catch(Exception $ex)
57
+ {
58
+ }
59
+ }
60
+ }
app/code/community/Beck/LiveChat/Model/Message.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Beck_LiveChat_Model_Message extends Mage_Core_Model_Abstract
4
+ {
5
+ protected function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_init('livechat/message');
9
+ }
10
+
11
+ public function RenderLine($customerUrl = '')
12
+ {
13
+ $render = '';
14
+ if ($this->getId() > 0)
15
+ {
16
+ if ($customerUrl == '')
17
+ {
18
+ $render .= '<b>'.$this->getAutor_name() . '</b> : ' . $this->getMessage() . '<br />';
19
+ }
20
+ else
21
+ {
22
+ $render .= '<b><a href="'.$customerUrl.'" title="'.$customerUrl.'">'.$this->getAutor_name() . '</a></b> : ' . $this->getMessage() . '<br />';
23
+ }
24
+ }
25
+ return $render;
26
+ }
27
+ }
app/code/community/Beck/LiveChat/Model/Mysql4/Message.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Beck_LiveChat_Model_Mysql4_Message extends Mage_Core_Model_Mysql4_Abstract
4
+ {
5
+ protected function _construct()
6
+ {
7
+ $this->_init('livechat/livechat_messages', 'id');
8
+ }
9
+ }
app/code/community/Beck/LiveChat/Model/Mysql4/Message/Collection.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Beck_LiveChat_Model_Mysql4_Message_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
4
+ {
5
+ protected function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_init('livechat/message');
9
+ }
10
+ }
app/code/community/Beck/LiveChat/Model/Mysql4/Operator.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Beck_LiveChat_Model_Mysql4_Operator extends Mage_Core_Model_Mysql4_Abstract
4
+ {
5
+ protected function _construct()
6
+ {
7
+ $this->_init('livechat/livechat_operators', 'id');
8
+ }
9
+ }
app/code/community/Beck/LiveChat/Model/Mysql4/Operator/Collection.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Beck_LiveChat_Model_Mysql4_Operator_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
4
+ {
5
+ protected function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_init('livechat/operator');
9
+ }
10
+ }
app/code/community/Beck/LiveChat/Model/Mysql4/Session.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Beck_LiveChat_Model_Mysql4_Session extends Mage_Core_Model_Mysql4_Abstract
4
+ {
5
+ protected function _construct()
6
+ {
7
+ $this->_init('livechat/livechat_sessions', 'id');
8
+ }
9
+ }
app/code/community/Beck/LiveChat/Model/Mysql4/Session/Collection.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Beck_LiveChat_Model_Mysql4_Session_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
4
+ {
5
+ protected function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_init('livechat/session');
9
+ }
10
+ }
app/code/community/Beck/LiveChat/Model/Operator.php ADDED
@@ -0,0 +1,132 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Beck_LiveChat_Model_Operator extends Mage_Core_Model_Abstract
4
+ {
5
+ protected function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_init('livechat/operator');
9
+ }
10
+
11
+ public function IsOperatorAffectedToStore($store_id)
12
+ {
13
+ $data = $this->getStore_allowed();
14
+ if ($data != null)
15
+ {
16
+ $AffectedStore = explode('-', $data);
17
+
18
+ foreach ($AffectedStore as $store)
19
+ {
20
+ if ($store == $store_id)
21
+ {
22
+ return true;
23
+ }
24
+ }
25
+ }
26
+ return false;
27
+ }
28
+
29
+ public function loadByName($name)
30
+ {
31
+ $this->_getResource()->load($this, $name, 'name');
32
+ return ($this);
33
+ }
34
+
35
+ public function Exist($name)
36
+ {
37
+ $this->loadByName($name);
38
+ if ($this->getId() > 0)
39
+ {
40
+ return true;
41
+ }
42
+ else
43
+ {
44
+ return false;
45
+ }
46
+ }
47
+
48
+ public function getSessionsAvailable()
49
+ {
50
+ $result = array();
51
+ if ($this->getId() > 0)
52
+ {
53
+ $sessions = Mage::getModel('livechat/session')->getCollection()
54
+ ->addFilter('close', '0', 'and')
55
+ ->setOrder('date_started', Varien_Data_Collection::SORT_ORDER_ASC);
56
+
57
+ foreach ($sessions as $session)
58
+ {
59
+ if ($this->IsOperatorAffectedToStore($session->getStore_id()))
60
+ {
61
+ $result[] = $session;
62
+ }
63
+ }
64
+ }
65
+ return ($result);
66
+ }
67
+
68
+ public function getDispatchedSessions()
69
+ {
70
+ $sessions = array();
71
+ if ($this->getid() > 0)
72
+ {
73
+ $sessions = Mage::getModel('livechat/session')->getCollection()
74
+ ->addFilter('dispatched', $this->getId(), 'and');
75
+ }
76
+ return $sessions;
77
+ }
78
+
79
+ protected function UndispatchSessions()
80
+ {
81
+ if ($this->getId() > 0)
82
+ {
83
+ $sessions = $this->getDispatchedSessions();
84
+ foreach ($sessions as $session)
85
+ {
86
+ $session->setDispatched(0)->save();
87
+ }
88
+ }
89
+ return $this;
90
+ }
91
+
92
+ protected function CloseSessions()
93
+ {
94
+ if ($this->getId() > 0)
95
+ {
96
+ $sessions = $this->getDispatchedSessions();
97
+ foreach ($sessions as $session)
98
+ {
99
+ $session->close();
100
+ }
101
+ }
102
+ return $this;
103
+ }
104
+
105
+ public function Connected()
106
+ {
107
+ if ($this->getId() > 0)
108
+ {
109
+ $this->setIs_online('1')->save();
110
+ }
111
+ return $this;
112
+ }
113
+
114
+ public function Disconnected()
115
+ {
116
+ if ($this->getId() > 0)
117
+ {
118
+ $this->setIs_online('0')->save();
119
+ $undispatch_sessions = Mage::getStoreConfig('livechatevents/onoperatordisconnect/undispatchsession', 0) == '1' ? true : false;
120
+ $close_sessions = Mage::getStoreConfig('livechatevents/onoperatordisconnect/closesession', 0) == '1' ? true : false;
121
+ if ($close_sessions)
122
+ {
123
+ $this->CloseSessions();
124
+ }
125
+ if ($undispatch_sessions == true)
126
+ {
127
+ $this->UndispatchSessions();
128
+ }
129
+ }
130
+ return $this;
131
+ }
132
+ }
app/code/community/Beck/LiveChat/Model/Session.php ADDED
@@ -0,0 +1,167 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Beck_LiveChat_Model_Session extends Mage_Core_Model_Abstract
4
+ {
5
+ protected function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_init('livechat/session');
9
+ }
10
+
11
+ public function loadBySessionId($session_id)
12
+ {
13
+ $this->_getResource()->load($this, $session_id, 'customer_session_id');
14
+ return ($this);
15
+ }
16
+
17
+ public function Exist($session_id)
18
+ {
19
+ if ($this->getId() > 0)
20
+ {
21
+ return true;
22
+ }
23
+ else
24
+ {
25
+ $this->loadBySessionId($session_id);
26
+ if ($this->getId() > 0)
27
+ {
28
+ return true;
29
+ }
30
+ }
31
+ return false;
32
+ }
33
+
34
+ public function saveMessage($autor, $message, $customer_message = '0')
35
+ {
36
+ if ($this->getId() > 0)
37
+ {
38
+ $message = eregi_replace("(http://)(([[:punct:]]|[[:alnum:]])*)", "<a href=\"\\0\">\\2</a>", $message);
39
+ $sessionmessage = Mage::getModel('livechat/message');
40
+ $sessionmessage->setLivechat_session_id($this->getId())
41
+ ->setAutor_name($autor)
42
+ ->setMessage($message)
43
+ ->setIs_customer_message($customer_message)
44
+ ->setDate(now())
45
+ ->save();
46
+ return ($sessionmessage);
47
+ }
48
+ return null;
49
+ }
50
+
51
+ public function getMessages()
52
+ {
53
+ if ($this->getId() > 0)
54
+ {
55
+ $messages = Mage::getModel('livechat/message')->getCollection()
56
+ ->addFilter('livechat_session_id', $this->getId(), 'and')
57
+ ->setOrder('date', Varien_Data_Collection::SORT_ORDER_ASC);
58
+ return ($messages);
59
+ }
60
+ return null;
61
+ }
62
+
63
+ public function getCustomerMessages()
64
+ {
65
+ if ($this->getId() > 0)
66
+ {
67
+ $messages = Mage::getModel('livechat/message')->getCollection()
68
+ ->addFilter('livechat_session_id', $this->getId(), 'and')
69
+ ->addFilter('is_customer_message', '1', 'and')
70
+ ->setOrder('date', Varien_Data_Collection::SORT_ORDER_ASC);
71
+ return ($messages);
72
+ }
73
+ return null;
74
+ }
75
+
76
+ public function Destroy()
77
+ {
78
+ if ($this->getId() > 0)
79
+ {
80
+ $messages = $this->getMessages();
81
+ if ($messages != null)
82
+ {
83
+ foreach ($messages as $message)
84
+ {
85
+ $message->delete();
86
+ }
87
+ }
88
+ $this->delete();
89
+ }
90
+ }
91
+
92
+ public function Expired(array $customerOnlines)
93
+ {
94
+ $result = true;
95
+ if ($this->getId() > 0)
96
+ {
97
+ if (is_array($customerOnlines))
98
+ {
99
+ foreach ($customerOnlines as $customerSessionID)
100
+ {
101
+ if ($customerSessionID == $this->getCustomer_session_id())
102
+ {
103
+ $result = false;
104
+ }
105
+ }
106
+ }
107
+ else
108
+ {
109
+ return false;
110
+ }
111
+ }
112
+ return ($result);
113
+ }
114
+
115
+ public function getNewMessages($CurrentMessages)
116
+ {
117
+ $newMessages = array();
118
+ if ($this->getId() > 0)
119
+ {
120
+ $messagesList = $this->getMessages();
121
+
122
+ foreach ($messagesList as $message)
123
+ {
124
+ if (!in_array($message->getId(), $CurrentMessages, false))
125
+ {
126
+ $newMessages[] = $message->toArray();
127
+ }
128
+ }
129
+ }
130
+ return $newMessages;
131
+ }
132
+
133
+ public function Close()
134
+ {
135
+ if ($this->getId() > 0)
136
+ {
137
+ if ($this->getClose() == '0')
138
+ {
139
+ $sendclosemessage = Mage::getStoreConfig('livechatevents/onsessionclose/sendclosemessage', 0) == '1' ? true : false;
140
+ if ($sendclosemessage == true)
141
+ {
142
+ $this->saveMessage(Mage::getStoreConfig('livechatconfiguration/display/systemname', $this->getStore_id()), Mage::Helper('livechat')->__('-- Session terminated --'));
143
+ }
144
+ $this->setClose('1')->save();
145
+ }
146
+ }
147
+ return ($this);
148
+ }
149
+
150
+ public function Open()
151
+ {
152
+ if ($this->getId() > 0)
153
+ {
154
+ $this->setClose('0')->save();
155
+ }
156
+ return ($this);
157
+ }
158
+
159
+ public function PlaceOrder($increment_id)
160
+ {
161
+ if ($this->getId() > 0)
162
+ {
163
+ $this->setOrder_placed($increment_id)->save();
164
+ }
165
+ return ($this);
166
+ }
167
+ }
app/code/community/Beck/LiveChat/Model/Session/List.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Beck_LiveChat_Model_Session_List
4
+ {
5
+ public function getOperatorFilterListToArray()
6
+ {
7
+ $list = array(0 => Mage::Helper('livechat')->__('Not dispatched'));
8
+ $operators = Mage::getModel('livechat/operator')->getCollection();
9
+ foreach ($operators as $operator)
10
+ {
11
+ $list[$operator->getId()] = $operator->getName();
12
+ }
13
+
14
+ return $list;
15
+ }
16
+
17
+ public function getStateFilterListToArray()
18
+ {
19
+ $list = array(0 => Mage::Helper('livechat')->__('Open'),
20
+ 1 => Mage::Helper('livechat')->__('Closed'));
21
+
22
+
23
+ return $list;
24
+ }
25
+ }
app/code/community/Beck/LiveChat/Model/Source/Images.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Beck_LiveChat_Model_Source_Images
4
+ {
5
+
6
+ public function toOptionArray()
7
+ {
8
+ return array(
9
+ array('value'=>1, 'label'=>'Style 1'),
10
+ array('value'=>2, 'label'=>'Style 2'),
11
+ array('value'=>3, 'label'=>'Style 3'),
12
+ array('value'=>4, 'label'=>'Style 4')
13
+ );
14
+ }
15
+
16
+ }
app/code/community/Beck/LiveChat/Model/Source/Online.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Beck_LiveChat_Model_Source_Online
4
+ {
5
+ public static function toOptionsArray()
6
+ {
7
+ $list = array(
8
+ 0 => Mage::Helper('livechat')->__('Disconnected'),
9
+ 1 => Mage::Helper('livechat')->__('Online')
10
+ );
11
+
12
+ return ($list);
13
+ }
14
+ }
app/code/community/Beck/LiveChat/Model/Source/SessionCreation.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Beck_LiveChat_Model_Source_SessionCreation
4
+ {
5
+ public static function toOptionArray()
6
+ {
7
+ $list = array(
8
+ 0 => Mage::Helper('livechat')->__('When customer send his first message'),
9
+ 1 => Mage::Helper('livechat')->__('Automatically create a new chatsession for everyone'),
10
+ 2 => Mage::Helper('livechat')->__('Automatically create a new chat session for every customer logged in')
11
+ );
12
+
13
+ return ($list);
14
+ }
15
+ }
app/code/community/Beck/LiveChat/controllers/ChatController.php ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Beck_LiveChat_ChatController extends Mage_Core_Controller_Front_Action
4
+ {
5
+ public function sendmessageAction()
6
+ {
7
+ $store_id = $this->getRequest()->getParam('store_id', 0);
8
+ $session_id = Mage::getSingleton('checkout/session')->getEncryptedSessionId();
9
+ $message = trim($this->getRequest()->getParam('message', ''));
10
+ //$message = trim($message);
11
+ if ($message != '')
12
+ {
13
+ if (Mage::Helper('customer/data')->isLoggedIn())
14
+ {
15
+ $customer_name = Mage::getSingleton('customer/session')->getCustomer()->getName();
16
+ }
17
+ else
18
+ {
19
+ $customer_name = Mage::getStoreConfig('livechatconfiguration/display/defaultcustomername', $store_id);
20
+ }
21
+
22
+ $session = Mage::getModel('livechat/session');
23
+ $new_session = false;
24
+ if (!$session->Exist($session_id))
25
+ {
26
+ $session->setCustomer_name($customer_name)
27
+ ->setCustomer_session_id($session_id)
28
+ ->setDate_started(now())
29
+ ->setStore_id($store_id)
30
+ ->save();
31
+
32
+ $new_session = true;
33
+ }
34
+ $CustomerUrl = Mage::getSingleton('checkout/session')->getData('livechatCustomerUrl');
35
+ if ($session->getClose() == '1')
36
+ {
37
+ $allowreopen = Mage::getStoreConfig('livechatevents/oncustomersendmessage/allowcustomerreopen', 0) == '1' ? true : false;
38
+ if ($allowreopen == true)
39
+ {
40
+ $session->Open();
41
+ $mess = $session->saveMessage($customer_name, $message, '1');
42
+ }
43
+ }
44
+ else
45
+ {
46
+ $mess = $session->saveMessage($customer_name, $message, '1');
47
+ }
48
+ echo $mess->RenderLine();
49
+ if ($new_session)
50
+ {
51
+ $mess = $session->saveMessage(Mage::getStoreConfig('livechatconfiguration/display/systemname', $store_id), Mage::getStoreConfig('livechatconfiguration/display/systemwaitmessage', $store_id));
52
+ echo $mess->RenderLine();
53
+ }
54
+ }
55
+ }
56
+
57
+ public function getMessageSessionAction()
58
+ {
59
+ $session_id = Mage::getSingleton('checkout/session')->getEncryptedSessionId();
60
+ $session = Mage::getModel('livechat/session');
61
+ if ($session->Exist($session_id))
62
+ {
63
+ $messages = $session->getMessages();
64
+ foreach ($messages as $message)
65
+ {
66
+ echo $message->RenderLine();
67
+ }
68
+ }
69
+ }
70
+ }
app/code/community/Beck/LiveChat/controllers/Operator/ListController.php ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Beck_LiveChat_Operator_ListController extends Mage_Adminhtml_Controller_Action
4
+ {
5
+ public function indexAction()
6
+ {
7
+ $this->loadLayout();
8
+ $this->renderLayout();
9
+ }
10
+
11
+ public function gridAction()
12
+ {
13
+ $this->loadLayout();
14
+ $this->getResponse()->setBody(
15
+ $this->getLayout()->createBlock('livechat/operator_list')->toHtml()
16
+ );
17
+ }
18
+
19
+ public function editAction()
20
+ {
21
+ $this->loadLayout();
22
+ $this->renderLayout();
23
+ }
24
+
25
+ public function saveAction()
26
+ {
27
+ $post = $this->getRequest()->getPost();
28
+ //Zend_Debug::dump($post);
29
+ try
30
+ {
31
+ if (empty($post))
32
+ {
33
+ Mage::throwException($this->__('Invalid form data.'));
34
+ }
35
+
36
+ if (is_array($post))
37
+ {
38
+ //Zend_Debug::dump($post);
39
+ $store = '';
40
+ if (isset($post['stores']) && is_array($post['stores']))
41
+ {
42
+ foreach ($post['stores'] as $storeId)
43
+ {
44
+ if ($store == '')
45
+ {
46
+ $store .= $storeId;
47
+ }
48
+ else
49
+ {
50
+ $store .= '-'.$storeId;
51
+ }
52
+
53
+ }
54
+ }
55
+ $operator = Mage::getModel('livechat/operator')->load($post['id']);
56
+
57
+ $operator->setStore_allowed($store)
58
+ ->save();
59
+
60
+ if ($operator->getId() != null)
61
+ {
62
+ Mage::getSingleton('adminhtml/session')->addSuccess($this->__('Operator %s has been successfully modified.', $operator->getName()));
63
+ }
64
+ }
65
+ }
66
+ catch (Exception $e)
67
+ {
68
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
69
+ }
70
+ if (!isset($operator))
71
+ {
72
+ $operator = Mage::getModel('livechat/operator')->load($post['id']);
73
+ }
74
+ $this->_redirect('livechat/operator_list/edit/id/'.$operator->getId());
75
+ }
76
+ }
app/code/community/Beck/LiveChat/controllers/OperatorController.php ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Beck_LiveChat_OperatorController extends Mage_Adminhtml_Controller_Action
4
+ {
5
+
6
+ public function indexAction()
7
+ {
8
+ $this->loadLayout();
9
+ $this->renderLayout();
10
+ }
11
+
12
+ public function createAction()
13
+ {
14
+ $this->loadLayout();
15
+ $this->renderLayout();
16
+ }
17
+
18
+ public function editAction()
19
+ {
20
+ $this->loadLayout();
21
+ $this->renderLayout();
22
+ }
23
+
24
+ public function saveAction()
25
+ {
26
+ $post = $this->getRequest()->getPost();
27
+ //Zend_Debug::dump($post);
28
+ try
29
+ {
30
+ if (empty($post))
31
+ {
32
+ Mage::throwException($this->__('Invalid form data.'));
33
+ }
34
+
35
+ if (is_array($post))
36
+ {
37
+ //Zend_Debug::dump($post);
38
+ $operator = Mage::getModel('livechat/operator')->load($post['id']);
39
+ if ($post['password'] != null && trim($post['password']) != '')
40
+ {
41
+ $operator->setPassword(md5($post['password']));
42
+ }
43
+ $operator->setName($post['name'])
44
+ ->setIs_active($post['active'])
45
+ ->save();
46
+ if ($operator->getId() != null)
47
+ {
48
+ Mage::getSingleton('adminhtml/session')->addSuccess($this->__('Operator %s has been successfully modified.', $post['name']));
49
+ }
50
+ }
51
+ }
52
+ catch (Exception $e)
53
+ {
54
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
55
+ }
56
+ $this->_redirect('adminhtml/system_config/edit', array('section'=>'livechatoperators'));
57
+ }
58
+ /*
59
+ public function deleteAction()
60
+ {
61
+ $OperatorId = $this->getRequest()->getParam('id', 0);
62
+ $Operator = Mage::getModel('livechat/operator')->load($OperatorId);
63
+ $Operator->delete();
64
+ Mage::getSingleton('adminhtml/session')->addSuccess($this->__('Operator %s has been successfully deleted.', $Operator->getName()));
65
+ $this->_redirect('adminhtml/system_config/edit', array('section'=>'livechatoperators'));
66
+ }*/
67
+ }
app/code/community/Beck/LiveChat/controllers/Session/ListController.php ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Beck_LiveChat_Session_ListController extends Mage_Adminhtml_Controller_Action
4
+ {
5
+ public function indexAction()
6
+ {
7
+ $this->loadLayout();
8
+ $this->renderLayout();
9
+ }
10
+
11
+ public function gridAction()
12
+ {
13
+ $this->loadLayout();
14
+ $this->getResponse()->setBody(
15
+ $this->getLayout()->createBlock('livechat/session_list')->toHtml()
16
+ );
17
+ }
18
+
19
+ public function detailAction()
20
+ {
21
+ $this->loadLayout();
22
+ $this->renderLayout();
23
+ }
24
+
25
+ public function detailGridAction()
26
+ {
27
+ $this->loadLayout();
28
+ $this->getResponse()->setBody(
29
+ $this->getLayout()->createBlock('livechat/session_detail')->toHtml()
30
+ );
31
+ }
32
+
33
+ public function massDeleteAction()
34
+ {
35
+ $sessionIds = $this->getRequest()->getParam('session');
36
+ if (!is_array($sessionIds))
37
+ {
38
+ $this->_getSession()->addError($this->__('Please select chat(s)'));
39
+ }
40
+ else
41
+ {
42
+ try
43
+ {
44
+ foreach ($sessionIds as $sessionId)
45
+ {
46
+ $session = Mage::getSingleton('livechat/session')->load($sessionId);
47
+ Mage::dispatchEvent('livechat_controller_session_delete', array('session' => $session));
48
+ $session->Destroy();
49
+ }
50
+ $this->_getSession()->addSuccess($this->__('Total of %d record(s) were successfully deleted', count($sessionIds)));
51
+ }
52
+ catch (Exception $e)
53
+ {
54
+ $this->_getSession()->addError($e->getMessage());
55
+ }
56
+ }
57
+ $this->_redirect('*/*');
58
+ }
59
+
60
+ public function massCloseAction()
61
+ {
62
+ $sessionIds = $this->getRequest()->getParam('session');
63
+ if (!is_array($sessionIds))
64
+ {
65
+ $this->_getSession()->addError($this->__('Please select chat(s)'));
66
+ }
67
+ else
68
+ {
69
+ try
70
+ {
71
+ foreach ($sessionIds as $sessionId)
72
+ {
73
+ $session = Mage::getSingleton('livechat/session')->load($sessionId);
74
+ Mage::dispatchEvent('livechat_controller_session_close', array('session' => $session));
75
+ $session->Close();
76
+ }
77
+ $this->_getSession()->addSuccess($this->__('Total of %d record(s) were successfully closed', count($sessionIds)));
78
+ }
79
+ catch (Exception $e)
80
+ {
81
+ $this->_getSession()->addError($e->getMessage());
82
+ }
83
+ }
84
+ $this->_redirect('*/*');
85
+ }
86
+
87
+ public function massMessageDeleteAction()
88
+ {
89
+ $messageIds = $this->getRequest()->getParam('message');
90
+ $sessionId = $this->getRequest()->getParam('sessionId', 0);
91
+ if (!is_array($messageIds))
92
+ {
93
+ $this->_getSession()->addError($this->__('Please select message(s)'));
94
+ }
95
+ else
96
+ {
97
+ try
98
+ {
99
+ foreach ($messageIds as $messageId)
100
+ {
101
+ $message = Mage::getSingleton('livechat/message')->load($messageId);
102
+ Mage::dispatchEvent('livechat_controller_message_delete', array('message' => $message));
103
+ $message->delete();
104
+ }
105
+ $this->_getSession()->addSuccess($this->__('Total of %d record(s) were successfully deleted', count($messageIds)));
106
+ }
107
+ catch (Exception $e)
108
+ {
109
+ $this->_getSession()->addError($e->getMessage());
110
+ }
111
+ }
112
+ $this->_redirect('*/*/detail', array('sessionId'=>$sessionId));
113
+ }
114
+ }
app/code/community/Beck/LiveChat/controllers/Session/LiveController.php ADDED
@@ -0,0 +1,181 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Beck_LiveChat_Session_LiveController extends Mage_Adminhtml_Controller_Action
4
+ {
5
+ public function indexAction()
6
+ {
7
+ $this->loadLayout();
8
+
9
+ $session = Mage::getSingleton('adminhtml/session');
10
+ $operatorName = $session->getData('OperatorName');
11
+ $operator = Mage::getModel('livechat/operator');
12
+
13
+ if ($operator->Exist($operatorName))
14
+ {
15
+ $customerOnline = Mage::getResourceSingleton('log/visitor_collection')
16
+ ->useOnlineFilter();
17
+ $list = array();
18
+ foreach ($customerOnline as $customer)
19
+ {
20
+ $list[] = $customer->getSession_id();
21
+ }
22
+ $sessions = $operator->getSessionsAvailable();
23
+ if (count($sessions) > 0)
24
+ {
25
+ foreach ($sessions as $session)
26
+ {
27
+ if (!$session->Expired($list))
28
+ {
29
+ if ($session->getDispatched() == 0 || $session->getDispatched() == $operator->getId())
30
+ {
31
+ $session->setDispatched($operator->getId())
32
+ ->save();
33
+ $this->AddChatSession($session);
34
+ }
35
+ }
36
+ else
37
+ {
38
+ $session->Close();
39
+ }
40
+ }
41
+ }
42
+ }
43
+ else
44
+ {
45
+ $session->setData('OperatorName', null);
46
+ }
47
+
48
+ $this->renderLayout();
49
+ }
50
+
51
+ public function updaterAction()
52
+ {
53
+ $post = $this->getRequest()->getPost();
54
+ if (isset($post['sessionId']))
55
+ {
56
+ $session = Mage::getModel('livechat/session')->load($post['sessionId']);
57
+ $messages = $session->getMessages();
58
+ $customerUrl = $session->getCustomer_url();
59
+ foreach ($messages as $message)
60
+ {
61
+ if ($message->getIs_customer_message() == '1')
62
+ {
63
+ echo $message->renderLine($customerUrl);
64
+ }
65
+ else
66
+ {
67
+ echo $message->renderLine();
68
+ }
69
+ }
70
+ if ($session->getClose() == '1')
71
+ {
72
+ echo "<br />".$this->__('This session is closed, you cannot send message.');
73
+ echo "<br /><button class=\"form-button-alt delete\" onclick=\"javascript:Close_".$post['sessionId']."();\">";
74
+ echo "<span>".$this->__('Close')."</span></button>";
75
+ }
76
+ }
77
+ }
78
+
79
+ public function sendMessageAction()
80
+ {
81
+ $post = $this->getRequest()->getPost();
82
+ if (isset($post['sessionId']))
83
+ {
84
+ $message = $post['message'];
85
+ if (trim($message) != '')
86
+ {
87
+ $session = Mage::getModel('livechat/session')->load($post['sessionId']);
88
+ if ($session->getClose() == '0')
89
+ {
90
+ $adminsession = Mage::getSingleton('adminhtml/session');
91
+ $name = $adminsession->getData('OperatorName');
92
+ $message = $session->saveMessage($name, $message);
93
+ echo $message->renderLine();
94
+ }
95
+ }
96
+ }
97
+ }
98
+
99
+ protected function checkUserPermission($login, $key)
100
+ {
101
+ $res = false;
102
+ $user = new Mage_Api_Model_User();
103
+ if ($user->authenticate($login, $key))
104
+ {
105
+ $user->loadByUsername($login);
106
+ $roles = $user->getRoles();
107
+ foreach ($roles as $rid)
108
+ {
109
+ //echo 'Role #' . $rid.'<br>';
110
+ $rules_set = Mage::getResourceModel('api/rules_collection')->getByRoles($rid)->load();
111
+ foreach ($rules_set as $rule)
112
+ {
113
+ //echo 'Rule #'.$rule->getId() . '('.$rule->getResource_id().')<br>';
114
+ if ($rule->getResource_id() == 'all' && $rule->getPermission() == 'allow')
115
+ {
116
+ $res = true;
117
+ }
118
+ if ($rule->getResource_id() == 'livechat' && $rule->getPermission() == 'allow')
119
+ {
120
+ $res = true;
121
+ }
122
+ }
123
+ }
124
+ }
125
+ return $res;
126
+ }
127
+
128
+ public function loginAction()
129
+ {
130
+ $post = $this->getRequest()->getPost();
131
+ if (isset($post['Login']) && isset($post['Key']))
132
+ {
133
+ $res = $this->checkUserPermission($post['Login'], $post['Key']);
134
+ $session = Mage::getSingleton('adminhtml/session');
135
+ if ($res)
136
+ {
137
+ $operator = Mage::getModel('livechat/operator');
138
+ if ($operator->Exist($post['Login']))
139
+ {
140
+
141
+ $session->setData('OperatorName', $post['Login']);
142
+ $operator->Connected();
143
+ }
144
+ else
145
+ {
146
+ $operator->setName($post['Login'])->save();
147
+ $session->setData('OperatorName', $post['Login']);
148
+ $url = $this->getUrl('livechat/operator_list/edit', array('id'=>$operator->getId()));
149
+ $session->addSuccess(Mage::Helper('livechat')->__('Operator %s has just been created configure the store allowed for him <a href=\'%s\'>here</a>.', $post['Login'], $url));
150
+ $operator->Connected();
151
+ }
152
+ }
153
+ else
154
+ {
155
+ $session->addError($this->__('Access denied for %s', $post['Login']));
156
+ }
157
+ }
158
+ $this->_redirect('*/*/index');
159
+ }
160
+
161
+ public function logoutAction()
162
+ {
163
+ $post = $this->getRequest()->getPost();
164
+ $session = Mage::getSingleton('adminhtml/session');
165
+ $operatorName = $session->getData('OperatorName');
166
+ $operator = Mage::getModel('livechat/operator');
167
+ $session->setData('OperatorName', null);
168
+ if ($operator->Exist($operatorName))
169
+ {
170
+ $operator->Disconnected();
171
+ $session->addSuccess($this->__('Operator %s is now disconnected and no longer appear online.', $operatorName));
172
+ }
173
+ $this->_redirect('*/*/index');
174
+ }
175
+
176
+ public function AddChatSession(Beck_LiveChat_Model_Session $session)
177
+ {
178
+ $this->getLayout()->getBlock('livechat.sessions.live')->AddChatSession($session);
179
+ }
180
+
181
+ }
app/code/community/Beck/LiveChat/etc/api.xml ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8" ?>
2
+ <config>
3
+ <api>
4
+ <resources>
5
+ <livechat translate="title" module="livechat">
6
+ <title>LiveChat</title>
7
+ <acl>livechat</acl>
8
+ <model>livechat/api</model>
9
+ <methods>
10
+ <getsessions translate="title" module="livechat">
11
+ <title>Get chat list</title>
12
+ <acl>livechat/getsessions</acl>
13
+ </getsessions>
14
+ <getmessages translate="title" module="livechat">
15
+ <title>Get chat messages messages</title>
16
+ <acl>livechat/getmessages</acl>
17
+ </getmessages>
18
+ <sendmessage translate="title" module="livechat">
19
+ <title>Send message to customer</title>
20
+ <acl>livechat/sendmessage</acl>
21
+ </sendmessage>
22
+ <operatorconnect translate="title" module="livechat">
23
+ <title>Operator connection</title>
24
+ <acl>livechat/operatorconnect</acl>
25
+ </operatorconnect>
26
+ <operatordisconnect translate="title" module="livechat">
27
+ <title>Operator disconnection</title>
28
+ <acl>livechat/operatordisconnect</acl>
29
+ </operatordisconnect>
30
+ <refreshmessages translate="title" module="livechat">
31
+ <title>Get new messages</title>
32
+ <acl>livechat/refreshmessages</acl>
33
+ </refreshmessages>
34
+ <refreshsessions translate="title" module="livechat">
35
+ <title>Get new sessions</title>
36
+ <acl>livechat/refreshsessions</acl>
37
+ </refreshsessions>
38
+ </methods>
39
+ <faults module="livechat">
40
+ </faults>
41
+ </livechat>
42
+ </resources>
43
+ <acl>
44
+ <resources>
45
+ <livechat translate="title" module="livechat">
46
+ <sort_order>5421</sort_order>
47
+ <title>LiveChat</title>
48
+ <getsessions translate="title" module="livechat">
49
+ <title>Get chat list</title>
50
+ </getsessions>
51
+ <getmessages translate="title" module="livechat">
52
+ <title>Get chat messages messages</title>
53
+ </getmessages>
54
+ <sendmessage translate="title" module="livechat">
55
+ <title>Send message to customer</title>
56
+ </sendmessage>
57
+ <operatorconnect translate="title" module="livechat">
58
+ <title>Operator connection</title>
59
+ </operatorconnect>
60
+ <operatordisconnect translate="title" module="livechat">
61
+ <title>Operator disconnection</title>
62
+ </operatordisconnect>
63
+ <refreshmessages translate="title" module="livechat">
64
+ <title>Get new messages</title>
65
+ </refreshmessages>
66
+ <refreshsessions translate="title" module="livechat">
67
+ <title>Get new sessions</title>
68
+ </refreshsessions>
69
+ </livechat>
70
+ </resources>
71
+ </acl>
72
+ </api>
73
+ </config>
app/code/community/Beck/LiveChat/etc/config.xml ADDED
@@ -0,0 +1,219 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8" ?>
2
+ <config>
3
+ <modules>
4
+ <Beck_LiveChat>
5
+ <version>1.3.1</version>
6
+ </Beck_LiveChat>
7
+ </modules>
8
+
9
+ <admin>
10
+ <routers>
11
+ <livechat>
12
+ <use>admin</use>
13
+ <args>
14
+ <module>Beck_LiveChat</module>
15
+ <frontName>livechat</frontName>
16
+ </args>
17
+ </livechat>
18
+ </routers>
19
+ </admin>
20
+
21
+ <adminhtml>
22
+ <menu>
23
+ <customer>
24
+ <children>
25
+ <livechat translate="title" module="livechat">
26
+ <title>LiveChat</title>
27
+ <children>
28
+ <sessionlist translate="title" module="livechat">
29
+ <title>Customers chat list</title>
30
+ <action>livechat/session_list</action>
31
+ </sessionlist>
32
+ <sessionlive translate="title" module="livechat">
33
+ <title>Operator access</title>
34
+ <action>livechat/session_live</action>
35
+ </sessionlive>
36
+ <operatorlist translate="title" module="livechat">
37
+ <title>Operators list</title>
38
+ <action>livechat/operator_list</action>
39
+ </operatorlist>
40
+ </children>
41
+ </livechat>
42
+ </children>
43
+ </customer>
44
+ </menu>
45
+ <acl>
46
+ <resources>
47
+ <all>
48
+ <title>Allow everything</title>
49
+ </all>
50
+ <admin>
51
+ <children>
52
+ <system>
53
+ <children>
54
+ <config>
55
+ <children>
56
+ <livechatconfiguration translate="title" module="livechat">
57
+ <title>LiveChat configuration</title>
58
+ <sort_order>998</sort_order>
59
+ </livechatconfiguration>
60
+ <livechatevents translate="title" module="livechat">
61
+ <title>LiveChat events</title>
62
+ <sort_order>999</sort_order>
63
+ </livechatevents>
64
+ </children>
65
+ </config>
66
+ </children>
67
+ </system>
68
+ </children>
69
+ </admin>
70
+ </resources>
71
+ </acl>
72
+ <helpers>
73
+ <data>Beck_LiveChat_Helper_Data</data>
74
+ </helpers>
75
+ <translate>
76
+ <modules>
77
+ <Beck_LiveChat>
78
+ <files>
79
+ <default>Beck_LiveChat.csv</default>
80
+ </files>
81
+ </Beck_LiveChat>
82
+ </modules>
83
+ </translate>
84
+ <layout>
85
+ <updates>
86
+ <livechat>
87
+ <file>livechat.xml</file>
88
+ </livechat>
89
+ </updates>
90
+ </layout>
91
+ </adminhtml>
92
+ <frontend>
93
+ <translate>
94
+ <modules>
95
+ <Beck_LiveChat>
96
+ <files>
97
+ <default>Beck_LiveChat.csv</default>
98
+ </files>
99
+ </Beck_LiveChat>
100
+ </modules>
101
+ </translate>
102
+ <layout>
103
+ <updates>
104
+ <livechat>
105
+ <file>livechat.xml</file>
106
+ </livechat>
107
+ </updates>
108
+ </layout>
109
+ </frontend>
110
+ <global>
111
+ <models>
112
+ <livechat>
113
+ <class>Beck_LiveChat_Model</class>
114
+ <resourceModel>livechat_mysql4</resourceModel>
115
+ </livechat>
116
+ <livechat_mysql4>
117
+ <class>Beck_LiveChat_Model_Mysql4</class>
118
+ <entities>
119
+ <livechat_messages>
120
+ <table>livechat_messages</table>
121
+ </livechat_messages>
122
+ <livechat_operators>
123
+ <table>livechat_operators</table>
124
+ </livechat_operators>
125
+ <livechat_sessions>
126
+ <table>livechat_sessions</table>
127
+ </livechat_sessions>
128
+ </entities>
129
+ </livechat_mysql4>
130
+ </models>
131
+ <events>
132
+ <sales_order_place_after>
133
+ <observers>
134
+ <LiveChat_Save_Chat_Session_Order_Placed>
135
+ <type>model</type>
136
+ <class>livechat/event</class>
137
+ <method>save_chat_session_order_placed</method>
138
+ </LiveChat_Save_Chat_Session_Order_Placed>
139
+ </observers>
140
+ </sales_order_place_after>
141
+ <customer_login>
142
+ <observers>
143
+ <LiveChat_On_Customer_Login>
144
+ <type>model</type>
145
+ <class>livechat/event</class>
146
+ <method>on_customer_login</method>
147
+ </LiveChat_On_Customer_Login>
148
+ </observers>
149
+ </customer_login>
150
+ </events>
151
+ <resources>
152
+ <livechat_setup>
153
+ <setup>
154
+ <module>Beck_LiveChat</module>
155
+ </setup>
156
+ <connection>
157
+ <use>core_setup</use>
158
+ </connection>
159
+ </livechat_setup>
160
+ <livechat_write>
161
+ <connection>
162
+ <use>core_write</use>
163
+ </connection>
164
+ </livechat_write>
165
+ <livechat_read>
166
+ <connection>
167
+ <use>core_read</use>
168
+ </connection>
169
+ </livechat_read>
170
+ </resources>
171
+ <blocks>
172
+ <livechat>
173
+ <class>Beck_LiveChat_Block</class>
174
+ </livechat>
175
+ </blocks>
176
+ <helpers>
177
+ <livechat>
178
+ <class>Beck_LiveChat_Helper</class>
179
+ </livechat>
180
+ </helpers>
181
+ </global>
182
+ <default>
183
+ <livechatconfiguration>
184
+ <general>
185
+ <active>0</active>
186
+ <refreshfrequency>15</refreshfrequency>
187
+ <refreshdecay>1</refreshdecay>
188
+ <adminrefreshrate>300</adminrefreshrate>
189
+ <sessioncreation>0</sessioncreation>
190
+ </general>
191
+ <display>
192
+ <titlelabel>LIVECHAT</titlelabel>
193
+ <chatlabel>Need help ? Ask live !</chatlabel>
194
+ <imagestyle>3</imagestyle>
195
+ <unavailablelabel>We are sorry we have no operator online. Call 555.845.454</unavailablelabel>
196
+ <defaultcustomername>Customer</defaultcustomername>
197
+ <systemname>System</systemname>
198
+ <systemwaitmessage>Your message has been sent, an operator will answer you soon</systemwaitmessage>
199
+ <systemautosessionmessage>Welcome, you can now discuss with an operator</systemautosessionmessage>
200
+ </display>
201
+ </livechatconfiguration>
202
+ <livechatevents>
203
+ <onoperatordisconnect>
204
+ <closesession>0</closesession>
205
+ <undispatchsession>1</undispatchsession>
206
+ </onoperatordisconnect>
207
+ <onsessionclose>
208
+ <sendclosemessage>0</sendclosemessage>
209
+ </onsessionclose>
210
+ <oncustomerconnexion>
211
+ <changechatcreatorname>1</changechatcreatorname>
212
+ <changeallcustomermessageautor>1</changeallcustomermessageautor>
213
+ </oncustomerconnexion>
214
+ <oncustomersendmessage>
215
+ <allowcustomerreopen>1</allowcustomerreopen>
216
+ </oncustomersendmessage>
217
+ </livechatevents>
218
+ </default>
219
+ </config>
app/code/community/Beck/LiveChat/etc/system.xml ADDED
@@ -0,0 +1,255 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8" ?>
2
+ <config>
3
+ <tabs>
4
+ <livechat translate="label" module="livechat">
5
+ <label>LiveChat</label>
6
+ <sort_order>999</sort_order>
7
+ </livechat>
8
+ </tabs>
9
+ <sections>
10
+ <livechatconfiguration translate="label" module="livechat">
11
+ <label>Configuration</label>
12
+ <tab>livechat</tab>
13
+ <frontend_type>text</frontend_type>
14
+ <sort_order>10</sort_order>
15
+ <show_in_default>1</show_in_default>
16
+ <show_in_website>1</show_in_website>
17
+ <show_in_store>1</show_in_store>
18
+ <groups>
19
+ <general translate="label" module="livechat">
20
+ <label>General options</label>
21
+ <frontend_type>text</frontend_type>
22
+ <sort_order>10</sort_order>
23
+ <show_in_default>1</show_in_default>
24
+ <show_in_website>1</show_in_website>
25
+ <show_in_store>1</show_in_store>
26
+ <fields>
27
+ <active translate="label" module="livechat">
28
+ <label>Is enabled</label>
29
+ <frontend_type>select</frontend_type>
30
+ <source_model>adminhtml/system_config_source_yesno</source_model>
31
+ <sort_order>1</sort_order>
32
+ <show_in_default>1</show_in_default>
33
+ <show_in_website>1</show_in_website>
34
+ <show_in_store>0</show_in_store>
35
+ </active>
36
+ <refreshfrequency translate="label" module="livechat">
37
+ <label>Chat refresh frequency</label>
38
+ <frontend_type>text</frontend_type>
39
+ <sort_order>2</sort_order>
40
+ <show_in_default>1</show_in_default>
41
+ <show_in_website>1</show_in_website>
42
+ <show_in_store>0</show_in_store>
43
+ </refreshfrequency>
44
+ <refreshdecay translate="label" module="livechat">
45
+ <label>Chat refresh decay</label>
46
+ <frontend_type>text</frontend_type>
47
+ <sort_order>3</sort_order>
48
+ <show_in_default>1</show_in_default>
49
+ <show_in_website>0</show_in_website>
50
+ <show_in_store>0</show_in_store>
51
+ </refreshdecay>
52
+ <adminrefreshrate translate="label" module="livechat">
53
+ <label>Admin refresh rate</label>
54
+ <frontend_type>text</frontend_type>
55
+ <sort_order>4</sort_order>
56
+ <show_in_default>1</show_in_default>
57
+ <show_in_website>0</show_in_website>
58
+ <show_in_store>0</show_in_store>
59
+ </adminrefreshrate>
60
+ <sessioncreation translate="label" module="livechat">
61
+ <label>Chat session creation</label>
62
+ <frontend_type>select</frontend_type>
63
+ <source_model>livechat/source_sessionCreation</source_model>
64
+ <sort_order>5</sort_order>
65
+ <show_in_default>1</show_in_default>
66
+ <show_in_website>0</show_in_website>
67
+ <show_in_store>0</show_in_store>
68
+ </sessioncreation>
69
+ </fields>
70
+ </general>
71
+ <display translate="label" module="livechat">
72
+ <label>Display options</label>
73
+ <frontend_type>text</frontend_type>
74
+ <sort_order>20</sort_order>
75
+ <show_in_default>1</show_in_default>
76
+ <show_in_website>1</show_in_website>
77
+ <show_in_store>1</show_in_store>
78
+ <fields>
79
+ <titlelabel translate="label" module="livechat">
80
+ <label>Title label</label>
81
+ <frontend_type>text</frontend_type>
82
+ <sort_order>0</sort_order>
83
+ <show_in_default>1</show_in_default>
84
+ <show_in_website>1</show_in_website>
85
+ <show_in_store>1</show_in_store>
86
+ </titlelabel>
87
+ <chatlabel translate="label" module="livechat">
88
+ <label>Chat label</label>
89
+ <frontend_type>text</frontend_type>
90
+ <sort_order>1</sort_order>
91
+ <show_in_default>1</show_in_default>
92
+ <show_in_website>1</show_in_website>
93
+ <show_in_store>1</show_in_store>
94
+ </chatlabel>
95
+ <imagestyle translate="label" module="livechat">
96
+ <label>Image style</label>
97
+ <frontend_type>select</frontend_type>
98
+ <source_model>livechat/source_images</source_model>
99
+ <sort_order>2</sort_order>
100
+ <show_in_default>1</show_in_default>
101
+ <show_in_website>1</show_in_website>
102
+ <show_in_store>1</show_in_store>
103
+ </imagestyle>
104
+ <unavailablelabel translate="label" module="livechat">
105
+ <label>Unavailable message</label>
106
+ <frontend_type>text</frontend_type>
107
+ <sort_order>3</sort_order>
108
+ <show_in_default>1</show_in_default>
109
+ <show_in_website>1</show_in_website>
110
+ <show_in_store>1</show_in_store>
111
+ </unavailablelabel>
112
+ <defaultcustomername translate="label" module="livechat">
113
+ <label>Default customer name</label>
114
+ <frontend_type>text</frontend_type>
115
+ <sort_order>4</sort_order>
116
+ <show_in_default>1</show_in_default>
117
+ <show_in_website>1</show_in_website>
118
+ <show_in_store>1</show_in_store>
119
+ </defaultcustomername>
120
+ <systemname translate="label" module="livechat">
121
+ <label>System name</label>
122
+ <frontend_type>text</frontend_type>
123
+ <sort_order>5</sort_order>
124
+ <show_in_default>1</show_in_default>
125
+ <show_in_website>1</show_in_website>
126
+ <show_in_store>1</show_in_store>
127
+ </systemname>
128
+ <systemwaitmessage translate="label" module="livechat">
129
+ <label>System wait message</label>
130
+ <frontend_type>text</frontend_type>
131
+ <sort_order>6</sort_order>
132
+ <show_in_default>1</show_in_default>
133
+ <show_in_website>1</show_in_website>
134
+ <show_in_store>1</show_in_store>
135
+ </systemwaitmessage>
136
+ <systemautosessionmessage translate="label" module="livechat">
137
+ <label>System message when session is automatically created</label>
138
+ <frontend_type>text</frontend_type>
139
+ <sort_order>7</sort_order>
140
+ <show_in_default>1</show_in_default>
141
+ <show_in_website>1</show_in_website>
142
+ <show_in_store>1</show_in_store>
143
+ </systemautosessionmessage>
144
+ </fields>
145
+ </display>
146
+ </groups>
147
+ </livechatconfiguration>
148
+ <livechatevents translate="label" module="livechat">
149
+ <label>Behaviour</label>
150
+ <tab>livechat</tab>
151
+ <frontend_type>text</frontend_type>
152
+ <sort_order>20</sort_order>
153
+ <show_in_default>1</show_in_default>
154
+ <show_in_website>0</show_in_website>
155
+ <show_in_store>0</show_in_store>
156
+ <groups>
157
+ <onoperatordisconnect translate="label" module="livechat">
158
+ <label>On Operator disconnect</label>
159
+ <frontend_type>text</frontend_type>
160
+ <sort_order>10</sort_order>
161
+ <show_in_default>1</show_in_default>
162
+ <show_in_website>0</show_in_website>
163
+ <show_in_store>0</show_in_store>
164
+ <fields>
165
+ <closesession translate="label" module="livechat">
166
+ <label>Close dispatched chat session</label>
167
+ <frontend_type>select</frontend_type>
168
+ <source_model>adminhtml/system_config_source_yesno</source_model>
169
+ <sort_order>1</sort_order>
170
+ <show_in_default>1</show_in_default>
171
+ <show_in_website>0</show_in_website>
172
+ <show_in_store>0</show_in_store>
173
+ </closesession>
174
+ <undispatchsession translate="label" module="livechat">
175
+ <label>Undispatch non-closed chat session</label>
176
+ <frontend_type>select</frontend_type>
177
+ <source_model>adminhtml/system_config_source_yesno</source_model>
178
+ <sort_order>1</sort_order>
179
+ <show_in_default>1</show_in_default>
180
+ <show_in_website>0</show_in_website>
181
+ <show_in_store>0</show_in_store>
182
+ </undispatchsession>
183
+ </fields>
184
+ </onoperatordisconnect>
185
+ <onsessionclose translate="label" module="livechat">
186
+ <label>On chat session close</label>
187
+ <frontend_type>text</frontend_type>
188
+ <sort_order>20</sort_order>
189
+ <show_in_default>1</show_in_default>
190
+ <show_in_website>0</show_in_website>
191
+ <show_in_store>0</show_in_store>
192
+ <fields>
193
+ <sendclosemessage translate="label" module="livechat">
194
+ <label>Send a close message</label>
195
+ <frontend_type>select</frontend_type>
196
+ <source_model>adminhtml/system_config_source_yesno</source_model>
197
+ <sort_order>1</sort_order>
198
+ <show_in_default>1</show_in_default>
199
+ <show_in_website>0</show_in_website>
200
+ <show_in_store>0</show_in_store>
201
+ </sendclosemessage>
202
+
203
+ </fields>
204
+ </onsessionclose>
205
+ <oncustomerconnexion translate="label" module="livechat">
206
+ <label>On customer connexion</label>
207
+ <frontend_type>text</frontend_type>
208
+ <sort_order>30</sort_order>
209
+ <show_in_default>1</show_in_default>
210
+ <show_in_website>0</show_in_website>
211
+ <show_in_store>0</show_in_store>
212
+ <fields>
213
+ <changechatcreatorname translate="label" module="livechat">
214
+ <label>Replace the chat session creator name</label>
215
+ <frontend_type>select</frontend_type>
216
+ <source_model>adminhtml/system_config_source_yesno</source_model>
217
+ <sort_order>1</sort_order>
218
+ <show_in_default>1</show_in_default>
219
+ <show_in_website>0</show_in_website>
220
+ <show_in_store>0</show_in_store>
221
+ </changechatcreatorname>
222
+ <changeallcustomermessageautor translate="label" module="livechat">
223
+ <label>Replace all customer's messages autor name</label>
224
+ <frontend_type>select</frontend_type>
225
+ <source_model>adminhtml/system_config_source_yesno</source_model>
226
+ <sort_order>1</sort_order>
227
+ <show_in_default>1</show_in_default>
228
+ <show_in_website>0</show_in_website>
229
+ <show_in_store>0</show_in_store>
230
+ </changeallcustomermessageautor>
231
+ </fields>
232
+ </oncustomerconnexion>
233
+ <oncustomersendmessage translate="label" module="livechat">
234
+ <label>When the customer sends a message</label>
235
+ <frontend_type>text</frontend_type>
236
+ <sort_order>30</sort_order>
237
+ <show_in_default>1</show_in_default>
238
+ <show_in_website>0</show_in_website>
239
+ <show_in_store>0</show_in_store>
240
+ <fields>
241
+ <allowcustomerreopen translate="label" module="livechat">
242
+ <label>Allow to reopen a closed chat session</label>
243
+ <frontend_type>select</frontend_type>
244
+ <source_model>adminhtml/system_config_source_yesno</source_model>
245
+ <sort_order>1</sort_order>
246
+ <show_in_default>1</show_in_default>
247
+ <show_in_website>0</show_in_website>
248
+ <show_in_store>0</show_in_store>
249
+ </allowcustomerreopen>
250
+ </fields>
251
+ </oncustomersendmessage>
252
+ </groups>
253
+ </livechatevents>
254
+ </sections>
255
+ </config>
app/code/community/Beck/LiveChat/sql/livechat_setup/mysql4-install-1.0.0.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+
5
+ $installer->startSetup();
6
+
7
+ $installer->run("CREATE TABLE IF NOT EXISTS `{$this->getTable('livechat_messages')}` (
8
+ `id` int(10) NOT NULL auto_increment,
9
+ `livechat_session_id` int(10) NOT NULL,
10
+ `autor_name` varchar(32) NOT NULL,
11
+ `message` text NOT NULL,
12
+ `date` timestamp NOT NULL default CURRENT_TIMESTAMP,
13
+ PRIMARY KEY (`id`),
14
+ KEY `livechat_session_id` (`livechat_session_id`)
15
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
16
+
17
+
18
+ CREATE TABLE IF NOT EXISTS `{$this->getTable('livechat_operators')}` (
19
+ `id` int(10) unsigned NOT NULL auto_increment,
20
+ `name` varchar(32) NOT NULL,
21
+ `is_online` enum('0','1') NOT NULL default '0',
22
+ PRIMARY KEY (`id`)
23
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
24
+
25
+
26
+
27
+ CREATE TABLE IF NOT EXISTS `{$this->getTable('livechat_sessions')}` (
28
+ `id` int(10) NOT NULL auto_increment,
29
+ `customer_name` varchar(32) NOT NULL,
30
+ `date_started` datetime NOT NULL,
31
+ `customer_session_id` varchar(255) NOT NULL,
32
+ `dispatched` int(10) NOT NULL default '0',
33
+ `store_id` int(10) NOT NULL,
34
+ `order_placed` varchar(25) NOT NULL,
35
+ `close` enum('0','1') NOT NULL default '0',
36
+ PRIMARY KEY (`id`),
37
+ KEY `customer_session_id` (`customer_session_id`)
38
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
39
+ ");
40
+ $installer->endSetup();
app/code/community/Beck/LiveChat/sql/livechat_setup/mysql4-upgrade-1.0.0-1.2.4.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+ $installer = $this;
3
+
4
+ $installer->startSetup();
5
+ $installer->run("ALTER TABLE `{$this->getTable('livechat_operators')}` ADD `store_allowed` VARCHAR( 255 ) NOT NULL;");
6
+ $installer->endSetup();
app/code/community/Beck/LiveChat/sql/livechat_setup/mysql4-upgrade-1.2.4-1.2.9.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+ $installer = $this;
3
+
4
+ $installer->startSetup();
5
+ $installer->run("ALTER TABLE `{$this->getTable('livechat_messages')}` ADD `is_customer_message` ENUM( '0', '1' ) NOT NULL DEFAULT '0' AFTER `autor_name`;");
6
+ $installer->endSetup();
app/code/community/Beck/LiveChat/sql/livechat_setup/mysql4-upgrade-1.2.9-1.3.0.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php
2
+ $installer = $this;
3
+
4
+ $installer->startSetup();
5
+ $installer->run("ALTER TABLE `{$this->getTable('livechat_sessions')}` ADD `customer_url` VARCHAR( 255 ) NOT NULL ;");
6
+ $installer->endSetup();
7
+
app/design/adminhtml/default/default/layout/livechat.xml ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8" ?>
2
+ <layout>
3
+
4
+ <livechat_session_list_index>
5
+ <reference name="content">
6
+ <block type="livechat/session_list" name="livechat.session.list" />
7
+ </reference>
8
+ </livechat_session_list_index>
9
+ <livechat_session_list_detail>
10
+ <reference name="content">
11
+ <block type="livechat/session_detail" name="livechat.session.detail" />
12
+ </reference>
13
+ </livechat_session_list_detail>
14
+ <livechat_operator_list_index>
15
+ <reference name="content">
16
+ <block type="livechat/operator" name="livechat.operator" />
17
+ </reference>
18
+ </livechat_operator_list_index>
19
+ <livechat_operator_list_edit>
20
+ <reference name="content">
21
+ <block type="livechat/operator_edit" name="livechat.operator.edit" />
22
+ </reference>
23
+ </livechat_operator_list_edit>
24
+ <livechat_session_live_index>
25
+ <reference name="head">
26
+ <action method="addCss"><name>livechat/livechat.css</name></action>
27
+ </reference>
28
+ <reference name="content">
29
+ <block type="livechat/widget_sessions" name="livechat.sessions.live" />
30
+ </reference>
31
+ </livechat_session_live_index>
32
+ </layout>
app/design/adminhtml/default/default/template/livechat/operator.phtml ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design_default
22
+ * @package Mage
23
+ * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <div class="content-header">
28
+ <table cellspacing="0">
29
+ <tr>
30
+ <td style="width:50%;"><h3 class="icon-head head-products"><?php echo Mage::helper('livechat')->__('Operators') ?></h3></td>
31
+ <td class="a-right">
32
+ <?php echo $this->getAddNewButtonHtml() ?>
33
+ </td>
34
+ </tr>
35
+ </table>
36
+ </div>
37
+ <div>
38
+ <?php echo $this->getGridHtml() ?>
39
+ </div>
app/design/adminhtml/default/default/template/livechat/widget/chatlive.phtml ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if ($this->_session->getId() > 0): ?>
2
+ <div class="base-livechat livechat-box mini-livechat left" id="chat_<?php echo $this->_session->getId(); ?>" style="display: block;">
3
+ <div class="head"><h4>Session #<?php echo $this->_session->getId(); ?></h4></div>
4
+ <div class="content">
5
+ <p id="livechat_messages_<?php echo $this->_session->getId(); ?>"></p>
6
+ </div>
7
+ <div class="actions">
8
+ <input type="text" id="textmessage_<?php echo $this->_session->getId(); ?>" name="message" onKeyPress="javascript:LiveChatKeyPress_<?php echo $this->_session->getId(); ?>(event);">
9
+ <img id="livechat_ajax_loader_<?php echo $this->_session->getId(); ?>" style="display: none;" src="<?php echo $this->getSkinUrl('images/livechat/ajax-loader.gif'); ?>">
10
+ <div style="text-align: right;">
11
+
12
+ <?php
13
+ echo "<button class=\"form-button-alt add\" onclick=\"javascript:SendMessage_".$this->_session->getId()."();\">";
14
+ ?>
15
+ <span><?php echo $this->__('Send'); ?></span></button></div>
16
+ </div>
17
+ </div>
18
+ <?php endif; ?>
19
+ <script language="javascript">
20
+ var chatupdater<?php echo $this->_session->getId(); ?> = new Ajax.PeriodicalUpdater(
21
+ 'livechat_messages_<?php echo $this->_session->getId(); ?>',
22
+ urlUpdater,
23
+ {
24
+ method: 'post',
25
+ parameters: {sessionId: <?php echo $this->_session->getId(); ?>},
26
+ frequency: 20,
27
+ decay: 1
28
+ }
29
+ );
30
+
31
+ String.prototype.trim = function()
32
+ {
33
+ return this.replace(/(?:^\s+|\s+$)/g, "");
34
+ }
35
+
36
+ function SendMessage_<?php echo $this->_session->getId(); ?>()
37
+ {
38
+ var customermessage = document.getElementById('textmessage_<?php echo $this->_session->getId(); ?>').value.trim();
39
+ document.getElementById('textmessage_<?php echo $this->_session->getId(); ?>').value = '';
40
+ if (customermessage != '')
41
+ {
42
+ var img = document.getElementById('livachat_ajax_loader_<?php echo $this->_session->getId(); ?>');
43
+ if (img != null)
44
+ {
45
+ img.style.display = 'inline';
46
+ }
47
+ var request = new Ajax.Updater(
48
+ 'livechat_messages_<?php echo $this->_session->getId(); ?>',
49
+ urlSendMessage,
50
+ {
51
+ method: 'post',
52
+ parameters: { sessionId: <?php echo $this->_session->getId(); ?>, message: customermessage },
53
+ onSuccess: function(transport, json) {
54
+ var img = document.getElementById('livechat_ajax_loader_<?php echo $this->_session->getId(); ?>');
55
+ if (img != null) {
56
+ img.style.display = 'none';
57
+ }
58
+ },
59
+ insertion: Insertion.Bottom
60
+ }
61
+ );
62
+ }
63
+ }
64
+ function LiveChatKeyPress_<?php echo $this->_session->getId(); ?>(e) {
65
+ if (e.keyCode == 13) {
66
+ SendMessage_<?php echo $this->_session->getId(); ?>();
67
+ }
68
+ }
69
+
70
+ function Close_<?php echo $this->_session->getId() ?>()
71
+ {
72
+ chatupdater<?php echo $this->_session->getId(); ?>.stop();
73
+ var chat = document.getElementById('chat_<?php echo $this->_session->getId(); ?>');
74
+ if (chat != null)
75
+ {
76
+ chat.style.display = 'none';
77
+ }
78
+ }
79
+ </script>
app/design/adminhtml/default/default/template/livechat/widget/sessionslive.phtml ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="content-header">
2
+ <h3 class="icon-head head-system-account">Sessions Live</h3><p class="content-buttons form-buttons">
3
+ <?php
4
+ $session = Mage::getSingleton('adminhtml/session');
5
+ if ($session->getData('OperatorName') != null):
6
+ $refreshrate = (int)Mage::getStoreConfig('livechatconfiguration/general/adminrefreshrate', 0);
7
+ if ($refreshrate < 120)
8
+ {
9
+ $refreshrate = 120;
10
+ }
11
+ ?>
12
+
13
+ <script language="javascript">
14
+ var urlSendMessage = '<?php echo $this->urlSendMessage; ?>';
15
+ var urlUpdater = '<?php echo $this->urlUpdater; ?>';
16
+ </script>
17
+ <form name="livechatloginloginform" id="livechatloginloginform" method="post" action="<?php echo $this->getUrl('*/*/logout'); ?>">
18
+ <input type="hidden" name="form_key" value="<?php echo $this->getFormKey(); ?>">
19
+ <button class="scalable delete" onclick="javascript: livechatloginform.submit(); return false;"><span><?php echo $this->__('Log out'); ?></span></button>
20
+ </form>
21
+ <script type="text/javascript">
22
+
23
+ function refresh (){window.location.replace('<?php echo $this->getUrl('*/*/index'); ?>');}
24
+
25
+
26
+ var livechatloginform = new varienForm('livechatloginloginform');
27
+ var pe = new PeriodicalExecuter(refresh, <?php echo $refreshrate; ?>);
28
+ </script>
29
+ <?php
30
+ else:
31
+ ?>
32
+ <form name="livechatloginloginform" id="livechatloginloginform" method="post" action="<?php echo $this->getUrl('*/*/login'); ?>">
33
+ <input type="hidden" name="form_key" value="<?php echo $this->getFormKey(); ?>">
34
+ <?php echo $this->__('Operator name'); ?> <input type="text" name="Login"><br />
35
+ <?php echo $this->__('Operator key'); ?> <input type="password" name="Key"><br />
36
+ <button class="form-button-alt save" onclick="javascript: livechatloginform.submit(); return false;"><span><?php echo $this->__('Log in'); ?></span></button>
37
+ </form>
38
+ <script type="text/javascript">
39
+ var livechatloginform = new varienForm('livechatloginloginform');
40
+ </script>
41
+ <?php endif; ?>
42
+ </p>
43
+ </div>
app/design/frontend/default/default/layout/livechat.xml ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8" ?>
2
+ <layout>
3
+ <default>
4
+ <reference name="head">
5
+ <action method="addCss"><stylesheet>css/livechat/livechat.css</stylesheet></action>
6
+ <action method="addJs">
7
+ <script>livechat/js.js</script>
8
+ </action>
9
+ </reference>
10
+ <reference name="right">
11
+ <block type="livechat/template" after="cart_sidebar" name="livechat.chat" template="livechat/chat.phtml"/>
12
+ </reference>
13
+ </default>
14
+ </layout>
app/design/frontend/default/default/template/livechat/chat.phtml ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ($this->isActive):
3
+ $urlUpdater = $this->getUrl('livechat/chat/getMessageSession', array('store_id'=>Mage::app()->getStore(true)->getId()));
4
+ $urlSendMessage = $this->getUrl('livechat/chat/sendmessage', array('store_id'=>Mage::app()->getStore(true)->getId()));
5
+
6
+ echo '<script language="javascript">';
7
+ echo "\nvar urlSendMessage = '$urlSendMessage';\n";
8
+ echo "var urlUpdater = '$urlUpdater';\n";
9
+ echo "var frequency = ".$this->refreshfrequency.";\n";
10
+ echo "var decay = ".$this->refreshdecay.";\n";
11
+ echo '</script>';
12
+ ?>
13
+
14
+ <div class="box base-mini mini-livechat">
15
+ <div class="head">
16
+ <h4><?php echo $this->titlelabel; ?></h4>
17
+ </div>
18
+ <?php if($this->ChatSessionStarted()): ?>
19
+ <script language="javascript">
20
+ <?php
21
+ echo "SetUpdater();";
22
+ ?>
23
+ </script>
24
+ <div class="content"><p id="livechat_messages"><?php
25
+ $messages = $this->getMessages();
26
+ foreach ($messages as $message)
27
+ {
28
+ echo $message->RenderLine();
29
+ }
30
+ ?></p></div>
31
+ <?php else: ?>
32
+ <div class="content" id="livechat_messages"><?php echo $this->returnChatImage();echo $this->chatlabel; ?><div style="clear: both;"></div></div>
33
+ <?php endif; ?>
34
+ <div class="actions">
35
+ <?php if ($this->AreOperatorOnline()):?>
36
+ <input type="text" id="textmessage" name="message" onKeyPress="javascript:LiveChatKeyPress(event);">
37
+ <img id="livechat_ajax_loader" style="display: none;" src="<?php echo $this->getSkinUrl('images/livechat/ajax-loader.gif'); ?>">
38
+ <?php
39
+ echo "<button class=\"form-button-alt\" onclick=\"javascript:SendMessage();\">";
40
+ ?>
41
+ <span><?php echo $this->__('Send'); ?></span></button>
42
+ <?php else:?>
43
+ <?php echo $this->unavailablelabel; ?>
44
+ <?php endif;?>
45
+ </div>
46
+ </div>
47
+ <?php
48
+ endif;
49
+ ?>
app/design/frontend/default/modern/layout/livechat.xml ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8" ?>
2
+ <layout>
3
+ <default>
4
+ <reference name="head">
5
+ <action method="addCss"><stylesheet>css/livechat/livechat.css</stylesheet></action>
6
+ <action method="addJs">
7
+ <script>livechat/js.js</script>
8
+ </action>
9
+ </reference>
10
+ <reference name="left">
11
+ <block type="livechat/template" after="cart_sidebar" name="livechat.chat" template="livechat/chat.phtml"/>
12
+ </reference>
13
+ <reference name="right">
14
+ <block type="livechat/template" after="cart_sidebar" name="livechat.chat" template="livechat/chat.phtml"/>
15
+ </reference>
16
+ </default>
17
+ </layout>
app/design/frontend/default/modern/template/livechat/chat.phtml ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ($this->isActive):
3
+ $urlUpdater = $this->getUrl('livechat/chat/getMessageSession', array('store_id'=>Mage::app()->getStore(true)->getId()));
4
+ $urlSendMessage = $this->getUrl('livechat/chat/sendmessage', array('store_id'=>Mage::app()->getStore(true)->getId()));
5
+
6
+ echo '<script language="javascript">';
7
+ echo "\nvar urlSendMessage = '$urlSendMessage';\n";
8
+ echo "var urlUpdater = '$urlUpdater';\n";
9
+ echo "var frequency = ".$this->refreshfrequency.";\n";
10
+ echo "var decay = ".$this->refreshdecay.";\n";
11
+ echo '</script>';
12
+ ?>
13
+
14
+ <div class="box base-mini mini-livechat">
15
+ <div class="head">
16
+ <h4><?php echo $this->titlelabel; ?></h4>
17
+ </div>
18
+ <?php if($this->ChatSessionStarted()): ?>
19
+ <script language="javascript">
20
+ <?php
21
+ echo "SetUpdater();";
22
+ ?>
23
+ </script>
24
+ <div class="content"><p id="livechat_messages"><?php
25
+ $messages = $this->getMessages();
26
+ foreach ($messages as $message)
27
+ {
28
+ echo $message->RenderLine();
29
+ }
30
+ ?></p></div>
31
+ <?php else: ?>
32
+ <div class="content" id="livechat_messages"><?php echo $this->returnChatImage();echo $this->chatlabel; ?><div style="clear: both;"></div></div>
33
+ <?php endif; ?>
34
+ <div class="actions">
35
+ <?php if ($this->AreOperatorOnline()):?>
36
+ <input type="text" id="textmessage" name="message" onKeyPress="javascript:LiveChatKeyPress(event);">
37
+ <img id="livechat_ajax_loader" style="display: none;" src="<?php echo $this->getSkinUrl('images/livechat/ajax-loader.gif'); ?>">
38
+ <?php
39
+ echo "<button class=\"form-button-alt\" onclick=\"javascript:SendMessage();\">";
40
+ ?>
41
+ <span><?php echo $this->__('Send'); ?></span></button>
42
+ <?php else:?>
43
+ <?php echo $this->unavailablelabel; ?>
44
+ <?php endif;?>
45
+ </div>
46
+ </div>
47
+ <?php
48
+ endif;
49
+ ?>
app/etc/modules/ZBeck_LiveChat.xml ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Beck_LiveChat>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ <depends />
8
+ <version>1.3.1</version>
9
+ </Beck_LiveChat>
10
+ </modules>
11
+ </config>
app/locale/fr_FR/Beck_LiveChat.csv ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "Configuration","Configuration"
2
+ "General options","Options g&eacute;n&eacute;rales"
3
+ "Is enabled","Activ&eacute;"
4
+ "Display options","Options d'affichage"
5
+ "Chat label","Accroche"
6
+ "LiveChat configuration","Configuration LiveChat"
7
+ "LiveChat operators","Op&eacute;rateurs LiveChat"
8
+ "Operators","Op&eacute;rateurs"
9
+ "Operators list","Liste des op&eacute;rateurs"
10
+ "Create new operator","Cr&eacute;er un nouvel op&eacute;rateur"
11
+ "Operator's data","Donn&eacute;es de l'op&eacute;rateur"
12
+ "Password","Mot de passe"
13
+ "Name","Nom"
14
+ "Enabled","Activ&eacute;"
15
+ "Disabled","D&eacute;sactiv&eacute;"
16
+ "Save","Sauvegarder"
17
+ "Create","Cr&eacute;er"
18
+ "Operator %s has been successfully created.","L'op&eacute;rateur %s a &eacute;t&eacute; correctement cr&eacute;&eacute;."
19
+ "Operator %s has been successfully modified.","L'op&eacute;rateur %s a &eacute;t&eacute; correctement modifi&eacute;."
20
+ "Operator %s has been successfully deleted.","L'op&eacute;rateur %s a &eacute;t&eacute; correctement effac&eacute;."
21
+ "Edit operator","Modifier un op&eacute;rateur"
22
+ "disabled","d&eacute;sactiv&eacute;"
23
+ "Send","Envoyer"
24
+ "Chat refresh frequency","Fr&eacute;quence de rafraichissement du chat"
25
+ "Chat refresh decay","Fr&eacute;quence d'alt&eacute;ration du rafraichissement"
26
+ "Image style","Style de l'image"
27
+ "Get chat list","Récupérer la liste des chats"
28
+ "Get chat messages messages","Récupérer les messages d'un chat"
29
+ "Send message to customer","Envoyer un message à un client"
30
+ "Operator disconnection","Déconnection de l'opérateur"
31
+ "Operator connection","Connection de l'opérateur"
32
+ "Title label","Libell&eacute; du titre"
33
+ "Unavailable message","Message d'indisponibilit&eacute;"
34
+ "Default customer name","Nom du client par d&eacute;faut"
35
+ "Get new messages","Récupérer les nouveaux messages"
36
+ "Get new sessions","Récupérer les nouveaux chat"
37
+ "System name","Nom du syst&egrave;me"
38
+ "System wait message","Message d'attente syst&egrave;me"
39
+ "Customers chat list","Liste des t'chats client"
40
+ "Customer name","Nom du client"
41
+ "Started at","D&eacute;marr&eacute; &agrave;"
42
+ "Dispatched to","Distribu&eacute; &agrave;"
43
+ "Store","Magasin"
44
+ "State","Etat"
45
+ "Not dispatched","Non distribué"
46
+ "Closed","Ferm&eacute;"
47
+ "Close","Fermer"
48
+ "Open","Ouvert"
49
+ "Are you sure ?","Etes vous sûr ?"
50
+ "Total of %d record(s) were successfully deleted","Un total de %d enregistrement(s) ont &eacute;t&eacute; supprim&eacute;(s) avec succ&egrave;s"
51
+ "Please select chat(s)","Veuillez s&eacute;lectionner des t'chats"
52
+ "Operators list","Liste des op&eacute;rateurs"
53
+ "Status","Status"
54
+ "Online","En ligne"
55
+ "Disconnected","D&eacute;connect&eacute;"
56
+ "Autor","Auteur"
57
+ "Message","Message"
58
+ "Placed at","Post&eacute; &agrave;"
59
+ "Please select message(s)","Veuillez s&eacute;lectionner des messages"
60
+ "Delete","Supprimer"
61
+ "-- Session terminated --","-- Fin de session --"
62
+ "Total of %d record(s) were successfully closed","Un total de %d enregistrement(s) ont &eacute;t&eacute; ferm&eacute;(s) avec succ&egrave;s"
63
+ "There is no chat available for operator %s","Il n'y a pas de t'chat disponible pour l'op&eacute;rateur %s"
64
+ "This session is closed, you cannot send message.","Cette session est termin&eacute;e, vous ne pouvez plus envoyer de message."
65
+ "Access denied for %s","Acc&egrave;s refus&eacute; pour %s"
66
+ "Operator access","Acc&egrave;s op&eacute;rateur"
67
+ "Operator %s is now disconnected and no longer appear online.","L'op&eacute;rateur %s est d&eacute;sormais d&eacute;connect&eacute; et n'apparait plus en ligne."
68
+ "Operator %s has just been created configure the store allowed for him <a href=\'%s\'>here</a>.","L'op&eacute;rateur %s vient juste d'&ecirc;tre cr&eacute;&eacute;, assurez vous de lui affecter des boutiques <a href='%s'>ici</a>"
69
+ "Admin refresh rate","Fr&eacute;quence de rafraichissement admin"
70
+ "Behaviour","Comportement"
71
+ "On Operator disconnect","A la d&eacute;connection d'un op&eacute;rateur"
72
+ "On chat session close","A la fermeture d'une session de t'chat"
73
+ "On customer connexion","A la connection d'un client"
74
+ "Close dispatched chat session","Fermer les sessions de t'chat distribu&eacute;es"
75
+ "Undispatch non-closed chat session","D&eacute;sattribue les sessions de t'chat non-termin&eacute;e"
76
+ "Send a close message","Envoyer un message de fermeture"
77
+ "Allow to reopen a closed chat session","Autoriser la r&eacute;ouverture d'une session de t'chat ferm&eacute;e"
78
+ "Replace the chat session creator name","Remplacer le nom du cr&eacute;ateur de la session de t'chat"
79
+ "Replace all customer's messages autor name","Remplacer le nom du client dans tous ses messages"
80
+ "When the customer sends a message","Quand le client envoi un message"
81
+ "System message when session is automatically created","Message syst&egrave;me lors de la cr&eacute;ation automatique d'une session de t'chat"
82
+ "Chat session creation","Cr&eacute;ation des sessions de t'chat"
83
+ "When customer send his first message","Quand le client envoi son premier message"
84
+ "Automatically create a new chatsession for everyone","Cr&eacute;er automatiquement une nouvelle session de t'chat pour tout le monde"
85
+ "Automatically create a new chat session for every customer logged in","Cr&eacute;er automatiquement une nouvelle session de t'chat pour tous les clients connect&eacute;"
86
+ "Customer url","Url du client"
js/livechat/js.js ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var LiveChatPeriodUpdater = null;
2
+
3
+ String.prototype.trim = function()
4
+ {
5
+ return this.replace(/(?:^\s+|\s+$)/g, "");
6
+ }
7
+
8
+ function SendMessage()
9
+ {
10
+ var customermessage = document.getElementById('textmessage').value.trim();
11
+ document.getElementById('textmessage').value = '';
12
+ if (customermessage != '')
13
+ {
14
+ var img = document.getElementById('livachat_ajax_loader');
15
+ if (img != null)
16
+ {
17
+ img.style.display = 'inline';
18
+ }
19
+ var request = new Ajax.Updater(
20
+ 'livechat_messages',
21
+ urlSendMessage,
22
+ {
23
+ method: 'get',
24
+ parameters: { message: customermessage },
25
+ onSuccess: function(transport, json) {
26
+ var img = document.getElementById('livechat_ajax_loader');
27
+ if (img != null) {
28
+ img.style.display = 'none';
29
+ }
30
+ SetUpdater();
31
+ },
32
+ insertion: Insertion.Bottom
33
+ }
34
+ );
35
+ }
36
+ }
37
+
38
+ function SetUpdater()
39
+ {
40
+ //alert(LiveChatPeriodUpdater);
41
+ if (LiveChatPeriodUpdater == null)
42
+ {
43
+ LiveChatPeriodUpdater = new Ajax.PeriodicalUpdater(
44
+ 'livechat_messages',
45
+ urlUpdater,
46
+ {
47
+ frequency: frequency,
48
+ decay: decay
49
+ }
50
+ );
51
+ }
52
+ }
53
+
54
+ function LiveChatKeyPress(e) {
55
+ if (e.keyCode == 13) {
56
+ SendMessage();
57
+ }
58
+ }
package.xml ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Beck_LiveChat</name>
4
+ <version>1.3.1</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>A LiveChat in your Magento Store</summary>
10
+ <description>Your customer can ask for help to the store's operators.
11
+ You can add one or more operators, each operator can be affected to one or more stores.
12
+ Operator can use the windows software LiveChatOperator wich can stay in tray icon and alert you when new chat session is started or when new message incoming.
13
+ All is free.</description>
14
+ <notes>none</notes>
15
+ <authors><author><name>Fabrice Beck</name><user>auto-converted</user><email>fabrice.beck@fia-net.com</email></author></authors>
16
+ <date>2009-02-08</date>
17
+ <time>17:10:13</time>
18
+ <contents><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="images"><dir name="livechat"><file name="base_mini_actions_bg.gif" hash="da2970eac0a22c850b19ee3680475d51"/><file name="base_mini_head_bg.gif" hash="f8c1f130ad69464fe7aff2f589b2ec75"/><file name="chat.png" hash="0b6147abc4b325b6adc53101020214fd"/></dir></dir><dir name="livechat"><file name="livechat.css" hash="1fb108db21697d43e0da2e0ffd4b3949"/></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="css"><dir name="livechat"><file name="livechat.css" hash="23f6b4208a1828c95d53ca1424e69c1b"/></dir></dir><dir name="images"><dir name="livechat"><file name="ajax-loader.gif" hash="622c5fd994ddbd1dd7295e975a855394"/><file name="chat.png" hash="0b6147abc4b325b6adc53101020214fd"/><file name="livechat_icon_1_offline.gif" hash="6f29645dd823de420f87406adeefbd74"/><file name="livechat_icon_1_online.gif" hash="0fb04fadb0291cae8fb18f077e5cb287"/><file name="livechat_icon_2_offline.gif" hash="ccac8aead3064b6b573b36790c259a4f"/><file name="livechat_icon_2_online.gif" hash="ccffb2ccd56232a48a2886b987095398"/><file name="livechat_icon_3_offline.gif" hash="fee4fd690feaad68955e4d3f17ea61ba"/><file name="livechat_icon_3_online.gif" hash="7218d4f034d4eb13e3d5b0c309687c61"/><file name="livechat_icon_4_offline.gif" hash="17bc9d490e7c66482aaa813c4c542e93"/><file name="livechat_icon_4_online.gif" hash="dd529dbdf1ffc62c593fd6c4548dfd52"/><file name="Thumbs.db" hash="5d6de5587cb6edace482aa9ceb9d5363"/></dir></dir></dir><dir name="modern"><dir name="css"><dir name="livechat"><file name="livechat.css" hash="016c7ca657a01972c199cad16ca823e4"/></dir></dir><dir name="images"><dir name="livechat"><file name="ajax-loader.gif" hash="622c5fd994ddbd1dd7295e975a855394"/><file name="chat.png" hash="0b6147abc4b325b6adc53101020214fd"/><file name="livechat_icon_1_offline.gif" hash="6f29645dd823de420f87406adeefbd74"/><file name="livechat_icon_1_online.gif" hash="0fb04fadb0291cae8fb18f077e5cb287"/><file name="livechat_icon_2_offline.gif" hash="ccac8aead3064b6b573b36790c259a4f"/><file name="livechat_icon_2_online.gif" hash="ccffb2ccd56232a48a2886b987095398"/><file name="livechat_icon_3_offline.gif" hash="fee4fd690feaad68955e4d3f17ea61ba"/><file name="livechat_icon_3_online.gif" hash="7218d4f034d4eb13e3d5b0c309687c61"/><file name="livechat_icon_4_offline.gif" hash="17bc9d490e7c66482aaa813c4c542e93"/><file name="livechat_icon_4_online.gif" hash="dd529dbdf1ffc62c593fd6c4548dfd52"/><file name="Thumbs.db" hash="5d6de5587cb6edace482aa9ceb9d5363"/></dir></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="livechat.xml" hash="8c78b52c69c13a38dd4e33a0d321a691"/></dir><dir name="template"><dir name="livechat"><file name="operator.phtml" hash="72c552ad88fc9c5711bc96115a203069"/><dir name="widget"><file name="chatlive.phtml" hash="e94eb4ebdc56da58ad64edc5abfa9ba9"/><file name="sessionslive.phtml" hash="bca0f87668cf96270c63686dea05908d"/></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="livechat.xml" hash="7a80c2f0893481af99d2acabf14de075"/></dir><dir name="template"><dir name="livechat"><file name="chat.phtml" hash="407798a335d4e3a2c0d9e06d5364c2c2"/></dir></dir></dir><dir name="modern"><dir name="layout"><file name="livechat.xml" hash="37e80dc38dd51095f830c1ca6349cbe5"/></dir><dir name="template"><dir name="livechat"><file name="chat.phtml" hash="407798a335d4e3a2c0d9e06d5364c2c2"/></dir></dir></dir></dir></dir></target><target name="magecommunity"><dir name="Beck"><dir name="LiveChat"><dir name="Block"><file name="Operator.php" hash="359b81c070d1e6599fec6186adbb76cb"/><file name="Template.php" hash="a1ff5f6b84b77e051e11c9c9d127a042"/><dir name="Operator"><file name="Edit.php" hash="540a5246fcff5b1a8e821445e07ebd12"/><file name="List.php" hash="5b371abebd9beb9344831be3d27769f4"/><dir name="Edit"><file name="Form.php" hash="e97d951a63ed996560cb1526e23cb358"/></dir></dir><dir name="Session"><file name="Detail.php" hash="871022cf6b6636142eecbe9307ad79a9"/><file name="List.php" hash="badad9037a65be192abcd9a0cb790e9a"/></dir><dir name="Widget"><file name="Chat.php" hash="926f6fc13b7490d2f97035f1276078e7"/><file name="Sessions.php" hash="878d841a4e7f4a8a1617b40d2520684d"/><dir name="Grid"><dir name="Column"><dir name="Filter"><file name="Dispatched.php" hash="9052fa22cd9e07375d0de4f312c8bcf3"/><file name="Online.php" hash="1810c742fe22fd536798f2f76a11479c"/><file name="State.php" hash="c4367ea40d730b6b42e887fb0f57f758"/></dir><dir name="Renderer"><file name="Dispatched.php" hash="21e79c6d3662fd71737f1f6021509883"/><file name="Online.php" hash="e16ef426e2d329986774670c75188901"/><file name="State.php" hash="9fefcc96895ee514708701cd5e61fcd4"/></dir></dir></dir></dir></dir><dir name="controllers"><file name="ChatController.php" hash="72fd486ae8c4a0ed093e484c42813168"/><file name="OperatorController.php" hash="68e72482a399d247bd8972032c0ea797"/><dir name="Operator"><file name="ListController.php" hash="f46f5c06cf8d91abd14a423d443d9ce9"/></dir><dir name="Session"><file name="ListController.php" hash="ba445256d3ad06115eb0490d9ce6ed6c"/><file name="LiveController.php" hash="b510a233abde4130d1159c29867534e1"/></dir></dir><dir name="etc"><file name="api.xml" hash="70f764b56f32f3aa5018a446979b8e7b"/><file name="config.xml" hash="b7786412045909c3aaae62b1e6ec89b4"/><file name="system.xml" hash="95baf09a113610779673f3792800b919"/></dir><dir name="Helper"><file name="Data.php" hash="495778f70b7e52f13e15786660f990b6"/></dir><dir name="Model"><file name="Api.php" hash="47dd09f6195da8bc4a857057ea8e4a29"/><file name="Event.php" hash="0635e910e3ff53117c7c71ab80cea826"/><file name="Message.php" hash="14b9b7ffef2638e2178ed449945f2189"/><file name="Operator.php" hash="e141c5ba9c98e47d42b0fc2f4738ccc9"/><file name="Session.php" hash="0c04adc3f7637b261369096b35d407ec"/><dir name="Mysql4"><file name="Message.php" hash="15f54ff4ac2e42d499a465ba02f54545"/><file name="Operator.php" hash="183d4556a4adb362080db8b29b3d363b"/><file name="Session.php" hash="23470233413431cb15fd64d6f6a9e57a"/><dir name="Message"><file name="Collection.php" hash="bb9831d35976036acecaf600ba077aed"/></dir><dir name="Operator"><file name="Collection.php" hash="1f85ba68d6c707589b7650fc3fbf1929"/></dir><dir name="Session"><file name="Collection.php" hash="4409f4ba36832a8c0ff8e186b4945de8"/></dir></dir><dir name="Session"><file name="List.php" hash="c97c0507a2ead10e3df948a985f94aae"/></dir><dir name="Source"><file name="Images.php" hash="a78214110d992b5f1267360fac8ffb10"/><file name="Online.php" hash="16a3933b4c4801ce20c714635ea52a47"/><file name="SessionCreation.php" hash="bf20fc0949be23a892b5744e9a68ed4b"/></dir></dir><dir name="sql"><dir name="livechat_setup"><file name="mysql4-install-1.0.0.php" hash="5a967b18d8bc56b345cd3870d1c9ebb7"/><file name="mysql4-upgrade-1.0.0-1.2.4.php" hash="852891c2299a597fe671ca3e06101f82"/><file name="mysql4-upgrade-1.2.4-1.2.9.php" hash="573b71d02e8690e8c4903cf0447a928e"/><file name="mysql4-upgrade-1.2.9-1.3.0.php" hash="d487ca45bb75f68b8f813d4bd3c04ca7"/></dir></dir></dir></dir></target><target name="magelocale"><dir name="fr_FR"><file name="Beck_LiveChat.csv" hash="74b96aa8f3cf54de91f63f293d3d452f"/></dir></target><target name="mage"><dir name="js"><dir name="livechat"><file name="js.js" hash="e2e673b8f54faa02279c669e5db595fa"/></dir></dir></target><target name="mageetc"><dir name="modules"><file name="ZBeck_LiveChat.xml" hash="e3a0f05e82a24794fd23f360cb287835"/></dir></target></contents>
19
+ <compatible/>
20
+ <dependencies/>
21
+ </package>
skin/adminhtml/default/default/images/livechat/base_mini_actions_bg.gif ADDED
Binary file
skin/adminhtml/default/default/images/livechat/base_mini_head_bg.gif ADDED
Binary file
skin/adminhtml/default/default/images/livechat/chat.png ADDED
Binary file
skin/adminhtml/default/default/livechat/livechat.css ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .livechat-box
2
+ {
3
+ margin-bottom: 1.3em;
4
+ margin-right: 1.3em;
5
+ width: 195px;
6
+ }
7
+
8
+ .base-livechat
9
+ {
10
+ border:1px solid #c4c1bc;
11
+ background:#fff;
12
+ font-size:.95em;
13
+ }
14
+
15
+ .base-livechat .head
16
+ {
17
+ margin:0 1px;
18
+ border-bottom:1px solid #ddd;
19
+ background:url(../images/livechat/base_mini_head_bg.gif) repeat-x #fff;
20
+ padding:2px 8px;
21
+ line-height:1.25em;
22
+ text-align: left;
23
+ }
24
+
25
+ .base-livechat .head h4
26
+ {
27
+ min-height:16px;
28
+ color:#e26703;
29
+ background-repeat:no-repeat;
30
+ background-position:0 0; padding:1px 0 1px 21px;
31
+ text-transform:uppercase;
32
+ background-image: url(../images/livechat/chat.png);
33
+ }
34
+
35
+
36
+ .base-livechat .content
37
+ {
38
+ padding-top: 5px;
39
+ padding-right: 10px;
40
+ padding-bottom: 5px;
41
+ padding-left: 10px;
42
+ background-color: #f8f7f5;
43
+ background-image: none;
44
+ background-repeat: repeat;
45
+ background-attachment: scroll;
46
+ background-position: 0% 0%;
47
+ }
48
+
49
+ .base-livechat .actions
50
+ {
51
+ background-color: #dee5e8;
52
+ background-image: url(../images/livechat/base_mini_actions_bg.gif);
53
+ background-repeat: repeat-x;
54
+ background-attachment: scroll;
55
+ background-position: 0% 0%;
56
+ padding-top: 6px;
57
+ padding-right: 6px;
58
+ padding-bottom: 6px;
59
+ padding-left: 6px;
60
+ }
skin/frontend/default/default/css/livechat/livechat.css ADDED
@@ -0,0 +1 @@
 
1
+ .mini-livechat .head h4 { background-image:url(../../images/livechat/chat.png); }
skin/frontend/default/default/images/livechat/Thumbs.db ADDED
Binary file
skin/frontend/default/default/images/livechat/ajax-loader.gif ADDED
Binary file
skin/frontend/default/default/images/livechat/chat.png ADDED
Binary file
skin/frontend/default/default/images/livechat/livechat_icon_1_offline.gif ADDED
Binary file
skin/frontend/default/default/images/livechat/livechat_icon_1_online.gif ADDED
Binary file
skin/frontend/default/default/images/livechat/livechat_icon_2_offline.gif ADDED
Binary file
skin/frontend/default/default/images/livechat/livechat_icon_2_online.gif ADDED
Binary file
skin/frontend/default/default/images/livechat/livechat_icon_3_offline.gif ADDED
Binary file
skin/frontend/default/default/images/livechat/livechat_icon_3_online.gif ADDED
Binary file
skin/frontend/default/default/images/livechat/livechat_icon_4_offline.gif ADDED
Binary file
skin/frontend/default/default/images/livechat/livechat_icon_4_online.gif ADDED
Binary file
skin/frontend/default/modern/css/livechat/livechat.css ADDED
@@ -0,0 +1 @@
 
1
+ .mini-livechat .head h4 { background-image:url(../../images/livechat/chat.png); background-repeat:no-repeat; }
skin/frontend/default/modern/images/livechat/Thumbs.db ADDED
Binary file
skin/frontend/default/modern/images/livechat/ajax-loader.gif ADDED
Binary file
skin/frontend/default/modern/images/livechat/chat.png ADDED
Binary file
skin/frontend/default/modern/images/livechat/livechat_icon_1_offline.gif ADDED
Binary file
skin/frontend/default/modern/images/livechat/livechat_icon_1_online.gif ADDED
Binary file
skin/frontend/default/modern/images/livechat/livechat_icon_2_offline.gif ADDED
Binary file
skin/frontend/default/modern/images/livechat/livechat_icon_2_online.gif ADDED
Binary file
skin/frontend/default/modern/images/livechat/livechat_icon_3_offline.gif ADDED
Binary file
skin/frontend/default/modern/images/livechat/livechat_icon_3_online.gif ADDED
Binary file
skin/frontend/default/modern/images/livechat/livechat_icon_4_offline.gif ADDED
Binary file
skin/frontend/default/modern/images/livechat/livechat_icon_4_online.gif ADDED
Binary file