Diglin_Chat - Version 1.2.0

Version Notes

- Version 1.2.0: - add color swatches in configuration page to get the correct color for the window, give back configuration for theme of the window, fix the donation button. Please donate now :-)
- Version 1.1.1: comment/remove in the layout xml file the option which force some display options. Add some Zopim changes.

Download this release

Release Info

Developer Magento Core Team
Extension Diglin_Chat
Version 1.2.0
Comparing to
See all releases


Code changes from version 1.1.1 to 1.2.0

app/code/community/Diglin/Chat/Block/Adminhtml/Config/Source/Color.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Diglin_Chat_Block_Adminhtml_Config_Source_Color extends Mage_Adminhtml_Block_Abstract implements Varien_Data_Form_Element_Renderer_Interface
3
+ {
4
+ /**
5
+ * Render fieldset html
6
+ *
7
+ * @param Varien_Data_Form_Element_Abstract $element
8
+ * @return string
9
+ */
10
+ public function render (Varien_Data_Form_Element_Abstract $element)
11
+ {
12
+ $staticFolder = Mage::getBaseDir('media') . DS . 'chat' . DS;
13
+ $urlMedia = Mage::getBaseUrl('media') . 'chat' . DS ;
14
+ $colorFile = $staticFolder .'colors.txt';
15
+ $handle = fopen($colorFile, 'r');
16
+ $colors = fread($handle, filesize($colorFile));
17
+ fclose($handle);
18
+
19
+ $colorSwatch = '<tr id="' . $element->getHtmlId() . '">';
20
+ $colorSwatch .= '<td class="label">' . $element->getLabelHtml() . '</td>';
21
+ $colorSwatch .= '<td style="width:625px">';
22
+ $colorSwatch .= '<style type="text/css">.swatch {float: left;width: 15px;height:20px;} .swatch:hover {background-image:url(' . $urlMedia . 'colorselectbg.gif);cursor:pointer;}</style>';
23
+ $colorSwatch .= '<div style=\'display:inline-block;border:11px solid #888;background:#888;color:#fee;\'>';
24
+
25
+ $colors = explode("\n", $colors);
26
+ $i = 0;
27
+ foreach ($colors as $color) {
28
+ $colorSwatch .= "<div class='swatch' style='background-color: $color;' onclick=\"document.getElementById('chat_windowconfig_color').value='$color';\">&nbsp</div>";
29
+ if (++ $i % 40 == 0) {
30
+ $colorSwatch .= '<br />';
31
+ }
32
+ }
33
+
34
+ $colorSwatch .= '</div>';
35
+ $colorSwatch .= '<br />';
36
+ //$colorSwatch .= '<input type="text" name="groups[windowconfig][fields][color][value]" id="' . $element->getHtmlId() . '" value="'.$element->getEscapedValue().'" class="'. $element->getClass() .'" />';
37
+ $colorSwatch .= $element->getAfterElementHtml();
38
+ $colorSwatch .= '</td>';
39
+ $colorSwatch .= '<td class="scope-label">[STORE VIEW]</td>';
40
+ $colorSwatch .= '<td></td>';
41
+
42
+ $colorSwatch .= '</tr>';
43
+
44
+ return $colorSwatch;
45
+ }
46
+ }
app/code/community/Diglin/Chat/Block/Adminhtml/Config/Source/Hint.php CHANGED
@@ -3,7 +3,6 @@ class Diglin_Chat_Block_Adminhtml_Config_Source_Hint
3
  extends Mage_Adminhtml_Block_Abstract
4
  implements Varien_Data_Form_Element_Renderer_Interface
5
  {
6
-
7
  /**
8
  * Render fieldset html
9
  *
@@ -13,8 +12,7 @@ class Diglin_Chat_Block_Adminhtml_Config_Source_Hint
13
  public function render(Varien_Data_Form_Element_Abstract $element)
14
  {
15
  $version = Mage::getConfig()->getModuleConfig('Diglin_Chat')->version;
16
- return '<p><form action="https://www.paypal.com/cgi-bin/webscr" method="post"> <input name="cmd" type="hidden" value="_s-xclick" /> <input name="hosted_button_id" type="hidden" value="9SFPE62WPWG2U" /> <input alt="PayPal - The safer, easier way to pay online!" name="submit" src="https://www.paypal.com/en_US/i/btn/btn_donate_LG.gif" type="image" /> <img src="https://www.paypal.com/fr_FR/i/scr/pixel.gif" border="0" alt="" width="1" height="1" /> </form>Please, Invite me for a drink for the hard work done. Thank you in advance for your donation</p>
17
  <p><strong>Diglin_Chat Version: '.$version.'</strong></p>';
18
-
19
  }
20
  }
3
  extends Mage_Adminhtml_Block_Abstract
4
  implements Varien_Data_Form_Element_Renderer_Interface
5
  {
 
6
  /**
7
  * Render fieldset html
8
  *
12
  public function render(Varien_Data_Form_Element_Abstract $element)
13
  {
14
  $version = Mage::getConfig()->getModuleConfig('Diglin_Chat')->version;
15
+ return '<p><a href="javascript:window.open(\'https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=Y66QHLU5VX5BC\')"><img src="https://www.paypal.com/en_US/i/btn/btn_donate_LG.gif" border="0" alt="Donate via Paypal" /> </a>Please, Invite me for a drink for the hard work done. Thank you in advance for your donation</p>
16
  <p><strong>Diglin_Chat Version: '.$version.'</strong></p>';
 
17
  }
18
  }
app/code/community/Diglin/Chat/Block/Display.php CHANGED
@@ -1,17 +1,22 @@
1
  <?php
2
- class Diglin_Chat_Block_Display extends Mage_Core_Block_Template {
3
-
 
 
 
4
  private $_helper;
 
5
  private $_options;
6
 
7
- public function __construct() {
8
-
9
- $this->_helper = Mage::helper ( 'chat' );
10
- parent::__construct ();
 
11
  }
12
 
13
- public function getGreetingsOptions(){
14
-
15
  $data = array();
16
  $data[] = "'online': ['".$this->_helper->getOnlineGreetingShort() . "', '" . $this->_helper->getOnlineGreetingLong() . "']";
17
  $data[] = "'offline': ['".$this->_helper->getOfflineGreetingShort() . "', '" . $this->_helper->getOfflineGreetingLong() . "']";
@@ -24,7 +29,8 @@ class Diglin_Chat_Block_Display extends Mage_Core_Block_Template {
24
  return;
25
  }
26
 
27
- public function getLanguage(){
 
28
  if($this->_helper->getLanguage() == 'auto'){
29
  return null;
30
  };
@@ -36,15 +42,18 @@ class Diglin_Chat_Block_Display extends Mage_Core_Block_Template {
36
  };
37
  }
38
 
39
- public function getName(){
 
40
  return (($this->_helper->allowName() && strlen(Mage::helper('customer')->getCurrentCustomer()->getName()) > 0)?"name: '".Mage::helper('customer')->getCurrentCustomer()->getName()."'":null);
41
  }
42
 
43
- public function getEmail(){
 
44
  return (($this->_helper->allowEmail() && strlen(Mage::helper('customer')->getCurrentCustomer()->getEmail()) > 0)?"email: '".Mage::helper('customer')->getCurrentCustomer()->getEmail()."'":null);
45
  }
46
 
47
- public function getBubbleOptions(){
 
48
  if(strlen($this->_helper->getBubbleTitle()) > 0){
49
  $out[] = "\$zopim.livechat.bubble.setTitle('" . $this->_helper->getBubbleTitle() . "')";
50
  }
@@ -66,19 +75,22 @@ class Diglin_Chat_Block_Display extends Mage_Core_Block_Template {
66
  }
67
 
68
 
69
- public function getWindowOptions(){
70
-
71
  if(strlen($this->_helper->getWindowColor()) > 0){
72
  $out[] = "\$zopim.livechat.window.setColor('" . $this->_helper->getWindowColor() . "')";
73
  }
74
 
 
 
75
  if(isset($out) && count($out) > 0){
76
  return implode(';' . "\n",$out) . ';' . "\n";
77
  }else
78
  return;
79
  }
80
 
81
- public function getButtonOptions(){
 
82
  $out[] = "\$zopim.livechat.button.setPosition('" . $this->_helper->getButtonPosition() . "')";
83
 
84
  if($this->_helper->getButtonHideOffline()){
@@ -98,25 +110,30 @@ class Diglin_Chat_Block_Display extends Mage_Core_Block_Template {
98
  return implode(';' . "\n", $out). ';' . "\n";
99
  }
100
 
101
- public function forceButtonDisplay($value = false){
 
102
  $this->_options['force_button_display'] = (bool) $value;
103
  return;
104
  }
105
 
106
- public function forceBubbleDisplay($value = false){
 
107
  $this->_options['force_bubble_display'] = (bool) $value;
108
  return;
109
  }
110
 
111
- public function getForceButtonDisplay(){
 
112
  return (isset($this->_options['force_button_display']))?$this->_options['force_button_display']:false;
113
  }
114
 
115
- public function getForceBubbleDisplay(){
 
116
  return (isset($this->_options['force_bubble_display']))?$this->_options['force_bubble_display']:false;
117
  }
118
 
119
- public function getDepartmentsOptions(){
 
120
  if( $this->_helper->getDepartmentsFilter() ) {
121
  $out[] = "\$zopim.livechat.departments.filter(" . $this->_helper->getDepartmentsFilter() . ")";
122
  return implode(';' . "\n", $out). ';' . "\n";
@@ -125,22 +142,24 @@ class Diglin_Chat_Block_Display extends Mage_Core_Block_Template {
125
  }
126
  }
127
 
128
- public function getUnreadFlagOptions(){
 
129
  $out[] = "\$zopim.livechat.unreadflag = " . (($this->_helper->getUnreadFlag())?'\'enable\'':'\'disable\'');
130
  return implode(';' . "\n", $out). ';' . "\n";
131
  }
132
 
133
- protected function _toHtml(){
134
- if($this->_helper->getEnabled()){
 
135
 
136
- if(!$this->_helper->getUseNewApiCall()){
137
- $output = <<<SCRIPT
138
  <script type="text/javascript">
139
  document.write(unescape("%3Cscript src='" + document.location.protocol + "//zopim.com/?{$this->_helper->getKey()}' charset='utf-8' type='text/javascript'%3E%3C/script%3E"));
140
  </script>
141
  SCRIPT;
142
- }else{
143
- $output = <<<SCRIPTONDEMAND
144
  <!-- Start of Zopim Live Chat Script -->
145
  <script type="text/javascript">
146
  window.\$zopim||(function(d,s){var z=\$zopim=function(c){z._.push(c)},$=
@@ -153,34 +172,40 @@ t=+new Date;z._=[];e.parentNode.insertBefore($,e)})(document,'script')
153
  <!-- End of Zopim Live Chat Script -->
154
  SCRIPTONDEMAND;
155
  }
156
- if(strlen($this->getName()) > 0) $data[] = $this->getName();
157
- if(strlen($this->getEmail()) > 0) $data[] = $this->getEmail();
158
- if(strlen($this->getLanguage()) > 0) $data[] = $this->getLanguage();
159
-
160
- $output .= "\n";
161
-
162
- if(isset($data) && count($data) > 0)
163
- {
164
- $line = implode ( ',', $data );
165
- $script = "\$zopim.livechat.set({ $line });" . "\n";
166
- }
167
-
168
- $script .= $this->getWindowOptions();
169
- $script .= $this->getButtonOptions();
170
- $script .= $this->getBubbleOptions();
171
- $script .= $this->getGreetingsOptions();
172
- if($this->_helper->getUseNewApiCall()){
173
- $script .= $this->getDepartmentsOptions();
174
- $script .= $this->getUnreadFlagOptions();
175
- }
176
- if(strlen($script) > 0){
177
- if($this->_helper->getUseNewApiCall()) $script = '$zopim(function(){' . $script . '});'."\n";
178
- $output .= '<script type="text/javascript">' ."\n". $script . "</script>";
179
- }
180
-
181
- return $output;
 
 
 
 
 
 
 
182
  }else
183
  return;
184
-
185
- }
186
  }
1
  <?php
2
+ class Diglin_Chat_Block_Display extends Mage_Core_Block_Template
3
+ {
4
+ /**
5
+ * @var $_helper Diglin_Chat_Helper_Data
6
+ */
7
  private $_helper;
8
+
9
  private $_options;
10
 
11
+ public function __construct ()
12
+ {
13
+ /* @var $_helper Diglin_Chat_Helper_Data */
14
+ $this->_helper = Mage::helper('chat');
15
+ parent::__construct();
16
  }
17
 
18
+ public function getGreetingsOptions()
19
+ {
20
  $data = array();
21
  $data[] = "'online': ['".$this->_helper->getOnlineGreetingShort() . "', '" . $this->_helper->getOnlineGreetingLong() . "']";
22
  $data[] = "'offline': ['".$this->_helper->getOfflineGreetingShort() . "', '" . $this->_helper->getOfflineGreetingLong() . "']";
29
  return;
30
  }
31
 
32
+ public function getLanguage()
33
+ {
34
  if($this->_helper->getLanguage() == 'auto'){
35
  return null;
36
  };
42
  };
43
  }
44
 
45
+ public function getName()
46
+ {
47
  return (($this->_helper->allowName() && strlen(Mage::helper('customer')->getCurrentCustomer()->getName()) > 0)?"name: '".Mage::helper('customer')->getCurrentCustomer()->getName()."'":null);
48
  }
49
 
50
+ public function getEmail()
51
+ {
52
  return (($this->_helper->allowEmail() && strlen(Mage::helper('customer')->getCurrentCustomer()->getEmail()) > 0)?"email: '".Mage::helper('customer')->getCurrentCustomer()->getEmail()."'":null);
53
  }
54
 
55
+ public function getBubbleOptions()
56
+ {
57
  if(strlen($this->_helper->getBubbleTitle()) > 0){
58
  $out[] = "\$zopim.livechat.bubble.setTitle('" . $this->_helper->getBubbleTitle() . "')";
59
  }
75
  }
76
 
77
 
78
+ public function getWindowOptions()
79
+ {
80
  if(strlen($this->_helper->getWindowColor()) > 0){
81
  $out[] = "\$zopim.livechat.window.setColor('" . $this->_helper->getWindowColor() . "')";
82
  }
83
 
84
+ $out[] = "\$zopim.livechat.window.setTheme('" . $this->_helper->getWindowTheme() . "')";
85
+
86
  if(isset($out) && count($out) > 0){
87
  return implode(';' . "\n",$out) . ';' . "\n";
88
  }else
89
  return;
90
  }
91
 
92
+ public function getButtonOptions()
93
+ {
94
  $out[] = "\$zopim.livechat.button.setPosition('" . $this->_helper->getButtonPosition() . "')";
95
 
96
  if($this->_helper->getButtonHideOffline()){
110
  return implode(';' . "\n", $out). ';' . "\n";
111
  }
112
 
113
+ public function forceButtonDisplay($value = false)
114
+ {
115
  $this->_options['force_button_display'] = (bool) $value;
116
  return;
117
  }
118
 
119
+ public function forceBubbleDisplay($value = false)
120
+ {
121
  $this->_options['force_bubble_display'] = (bool) $value;
122
  return;
123
  }
124
 
125
+ public function getForceButtonDisplay()
126
+ {
127
  return (isset($this->_options['force_button_display']))?$this->_options['force_button_display']:false;
128
  }
129
 
130
+ public function getForceBubbleDisplay()
131
+ {
132
  return (isset($this->_options['force_bubble_display']))?$this->_options['force_bubble_display']:false;
133
  }
134
 
135
+ public function getDepartmentsOptions()
136
+ {
137
  if( $this->_helper->getDepartmentsFilter() ) {
138
  $out[] = "\$zopim.livechat.departments.filter(" . $this->_helper->getDepartmentsFilter() . ")";
139
  return implode(';' . "\n", $out). ';' . "\n";
142
  }
143
  }
144
 
145
+ public function getUnreadFlagOptions()
146
+ {
147
  $out[] = "\$zopim.livechat.unreadflag = " . (($this->_helper->getUnreadFlag())?'\'enable\'':'\'disable\'');
148
  return implode(';' . "\n", $out). ';' . "\n";
149
  }
150
 
151
+ protected function _toHtml()
152
+ {
153
+ if($this->_helper->getEnabled()) {
154
 
155
+ if(!$this->_helper->getUseNewApiCall()) {
156
+ $output = <<<SCRIPT
157
  <script type="text/javascript">
158
  document.write(unescape("%3Cscript src='" + document.location.protocol + "//zopim.com/?{$this->_helper->getKey()}' charset='utf-8' type='text/javascript'%3E%3C/script%3E"));
159
  </script>
160
  SCRIPT;
161
+ } else {
162
+ $output = <<<SCRIPTONDEMAND
163
  <!-- Start of Zopim Live Chat Script -->
164
  <script type="text/javascript">
165
  window.\$zopim||(function(d,s){var z=\$zopim=function(c){z._.push(c)},$=
172
  <!-- End of Zopim Live Chat Script -->
173
  SCRIPTONDEMAND;
174
  }
175
+
176
+ if(strlen($this->getName()) > 0){
177
+ $data[] = $this->getName();
178
+ }
179
+ if(strlen($this->getEmail()) > 0){
180
+ $data[] = $this->getEmail();
181
+ }
182
+ if(strlen($this->getLanguage()) > 0){
183
+ $data[] = $this->getLanguage();
184
+ }
185
+
186
+ $output .= "\n";
187
+
188
+ if(isset($data) && count($data) > 0)
189
+ {
190
+ $line = implode ( ',', $data );
191
+ $script = "\$zopim.livechat.set({ $line });" . "\n";
192
+ }
193
+
194
+ $script .= $this->getWindowOptions();
195
+ $script .= $this->getButtonOptions();
196
+ $script .= $this->getBubbleOptions();
197
+ $script .= $this->getGreetingsOptions();
198
+ if($this->_helper->getUseNewApiCall()){
199
+ $script .= $this->getDepartmentsOptions();
200
+ $script .= $this->getUnreadFlagOptions();
201
+ }
202
+ if(strlen($script) > 0){
203
+ if($this->_helper->getUseNewApiCall()) $script = '$zopim(function(){' . $script . '});'."\n";
204
+ $output .= '<script type="text/javascript">' ."\n". $script . "</script>";
205
+ }
206
+
207
+ return $output;
208
  }else
209
  return;
210
+ }
 
211
  }
app/code/community/Diglin/Chat/Helper/Data.php CHANGED
@@ -3,133 +3,156 @@
3
  * Only for String Translation
4
  *
5
  */
6
- class Diglin_Chat_Helper_Data extends Mage_Core_Helper_Abstract {
7
-
8
  private $_config;
9
 
10
- public function __construct() {
11
-
12
- $this->_config = Mage::getStoreConfig ( 'chat' );
13
  }
14
-
15
  /**
16
  *
17
  * @param array $url
18
  */
19
- public function getCurlOptions($url) {
20
-
21
- $curl = new Varien_Http_Adapter_Curl ();
22
- $curl->setConfig ( array ('timeout' => 5 ) );
23
- $curl->write ( Zend_Http_Client::GET, $url );
24
- $response = $curl->read ();
25
  if ($response === false) {
26
  return false;
27
  }
28
- $response = preg_split ( '/^\r?$/m', $response, 2 );
29
- $response = trim ( $response [1] );
30
- $options = explode ( "\n", $response );
31
- $curl->close ();
32
-
33
  return $options;
34
  }
35
-
36
- public function allowName() {
37
- return ( bool ) Mage::getStoreConfig ('chat/chatconfig/allow_name');
 
38
  }
39
 
40
- public function allowEmail() {
41
- return ( bool ) Mage::getStoreConfig ('chat/chatconfig/allow_email');
 
42
  }
43
 
44
- public function getEnabled(){
45
- return (bool) Mage::getStoreConfig ('chat/chatconfig/enabled');
 
46
  }
47
 
48
- public function getLanguage(){
49
- return Mage::getStoreConfig ('chat/chatconfig/language');
 
50
  }
51
-
52
- public function getKey(){
53
- return Mage::getStoreConfig ('chat/chatconfig/key');
 
54
  }
55
 
56
- public function getUnreadFlag(){
57
- return (bool) Mage::getStoreConfig ('chat/chatconfig/unreadflag');
 
58
  }
59
 
60
  /* Greetings Config */
61
-
62
- public function getOnlineGreetingShort() {
63
- return Mage::getStoreConfig ('chat/chatconfig/online_greeting_short');
64
  }
65
 
66
- public function getOnlineGreetingLong() {
67
- return Mage::getStoreConfig ('chat/chatconfig/online_greeting_long');
 
68
  }
69
 
70
- public function getOfflineGreetingShort() {
71
- return Mage::getStoreConfig ('chat/chatconfig/offline_greeting_short');
 
72
  }
73
 
74
- public function getOfflineGreetingLong() {
75
- return Mage::getStoreConfig ('chat/chatconfig/offline_greeting_long');
 
76
  }
77
 
78
- public function getAwayGreetingShort() {
79
- return Mage::getStoreConfig ('chat/chatconfig/away_greeting_short');
 
80
  }
81
 
82
- public function getAwayGreetingLong() {
83
- return Mage::getStoreConfig ('chat/chatconfig/away_greeting_long');
 
84
  }
85
 
86
  /* Bubble Config */
 
 
 
 
87
 
88
- public function getBubbleShow(){
89
- return Mage::getStoreConfig ('chat/bubbleconfig/show');
 
90
  }
91
 
92
- public function getBubbleTitle(){
93
- return Mage::getStoreConfig ('chat/bubbleconfig/title');
 
94
  }
95
 
96
- public function getBubbleText(){
97
- return Mage::getStoreConfig ('chat/bubbleconfig/text');
98
- }
99
-
100
  /* Window Config */
 
 
 
 
101
 
102
- public function getWindowShow(){
103
- return Mage::getStoreConfig ('chat/windowconfig/show');
 
104
  }
105
 
106
- public function getWindowColor(){
107
- return Mage::getStoreConfig ('chat/windowconfig/color');
 
108
  }
109
-
110
- /* Button Config */
111
 
112
- public function getButtonPosition(){
113
- return Mage::getStoreConfig ('chat/buttonconfig/position');
 
 
114
  }
115
 
116
- public function getButtonShow(){
117
- return (bool) Mage::getStoreConfig ('chat/buttonconfig/show');
 
118
  }
119
 
120
- public function getButtonHideOffline(){
121
- return (bool) Mage::getStoreConfig ('chat/buttonconfig/hidewhenoffline');
 
122
  }
123
 
124
- public function getButtonOffset(){
125
- return Mage::getStoreConfig ('chat/buttonconfig/offset');
 
126
  }
127
 
128
- public function getUseNewApiCall(){
129
- return (bool) Mage::getStoreConfig ('chat/chatconfig/newapicall');
 
130
  }
131
 
132
- public function getDepartmentsFilter(){
133
- return Mage::getStoreConfig ('chat/departments/filter');
 
134
  }
135
  }
3
  * Only for String Translation
4
  *
5
  */
6
+ class Diglin_Chat_Helper_Data extends Mage_Core_Helper_Abstract
7
+ {
8
  private $_config;
9
 
10
+ public function __construct ()
11
+ {
12
+ $this->_config = Mage::getStoreConfig('chat');
13
  }
14
+
15
  /**
16
  *
17
  * @param array $url
18
  */
19
+ public function getCurlOptions ($url)
20
+ {
21
+ $curl = new Varien_Http_Adapter_Curl();
22
+ $curl->setConfig(array('timeout' => 5));
23
+ $curl->write(Zend_Http_Client::GET, $url);
24
+ $response = $curl->read();
25
  if ($response === false) {
26
  return false;
27
  }
28
+ $response = preg_split('/^\r?$/m', $response, 2);
29
+ $response = trim($response[1]);
30
+ $options = explode("\n", $response);
31
+ $curl->close();
 
32
  return $options;
33
  }
34
+
35
+ public function allowName ()
36
+ {
37
+ return (bool) Mage::getStoreConfig('chat/chatconfig/allow_name');
38
  }
39
 
40
+ public function allowEmail ()
41
+ {
42
+ return (bool) Mage::getStoreConfig('chat/chatconfig/allow_email');
43
  }
44
 
45
+ public function getEnabled ()
46
+ {
47
+ return (bool) Mage::getStoreConfig('chat/chatconfig/enabled');
48
  }
49
 
50
+ public function getLanguage ()
51
+ {
52
+ return Mage::getStoreConfig('chat/chatconfig/language');
53
  }
54
+
55
+ public function getKey ()
56
+ {
57
+ return Mage::getStoreConfig('chat/chatconfig/key');
58
  }
59
 
60
+ public function getUnreadFlag ()
61
+ {
62
+ return (bool) Mage::getStoreConfig('chat/chatconfig/unreadflag');
63
  }
64
 
65
  /* Greetings Config */
66
+ public function getOnlineGreetingShort ()
67
+ {
68
+ return Mage::getStoreConfig('chat/chatconfig/online_greeting_short');
69
  }
70
 
71
+ public function getOnlineGreetingLong ()
72
+ {
73
+ return Mage::getStoreConfig('chat/chatconfig/online_greeting_long');
74
  }
75
 
76
+ public function getOfflineGreetingShort ()
77
+ {
78
+ return Mage::getStoreConfig('chat/chatconfig/offline_greeting_short');
79
  }
80
 
81
+ public function getOfflineGreetingLong ()
82
+ {
83
+ return Mage::getStoreConfig('chat/chatconfig/offline_greeting_long');
84
  }
85
 
86
+ public function getAwayGreetingShort ()
87
+ {
88
+ return Mage::getStoreConfig('chat/chatconfig/away_greeting_short');
89
  }
90
 
91
+ public function getAwayGreetingLong ()
92
+ {
93
+ return Mage::getStoreConfig('chat/chatconfig/away_greeting_long');
94
  }
95
 
96
  /* Bubble Config */
97
+ public function getBubbleShow ()
98
+ {
99
+ return Mage::getStoreConfig('chat/bubbleconfig/show');
100
+ }
101
 
102
+ public function getBubbleTitle ()
103
+ {
104
+ return Mage::getStoreConfig('chat/bubbleconfig/title');
105
  }
106
 
107
+ public function getBubbleText ()
108
+ {
109
+ return Mage::getStoreConfig('chat/bubbleconfig/text');
110
  }
111
 
 
 
 
 
112
  /* Window Config */
113
+ public function getWindowShow ()
114
+ {
115
+ return Mage::getStoreConfig('chat/windowconfig/show');
116
+ }
117
 
118
+ public function getWindowColor ()
119
+ {
120
+ return Mage::getStoreConfig('chat/windowconfig/color');
121
  }
122
 
123
+ public function getWindowTheme ()
124
+ {
125
+ return Mage::getStoreConfig('chat/windowconfig/theme');
126
  }
 
 
127
 
128
+ /* Button Config */
129
+ public function getButtonPosition ()
130
+ {
131
+ return Mage::getStoreConfig('chat/buttonconfig/position');
132
  }
133
 
134
+ public function getButtonShow ()
135
+ {
136
+ return (bool) Mage::getStoreConfig('chat/buttonconfig/show');
137
  }
138
 
139
+ public function getButtonHideOffline ()
140
+ {
141
+ return (bool) Mage::getStoreConfig('chat/buttonconfig/hidewhenoffline');
142
  }
143
 
144
+ public function getButtonOffset ()
145
+ {
146
+ return Mage::getStoreConfig('chat/buttonconfig/offset');
147
  }
148
 
149
+ public function getUseNewApiCall ()
150
+ {
151
+ return (bool) Mage::getStoreConfig('chat/chatconfig/newapicall');
152
  }
153
 
154
+ public function getDepartmentsFilter ()
155
+ {
156
+ return Mage::getStoreConfig('chat/departments/filter');
157
  }
158
  }
app/code/community/Diglin/Chat/Model/Config/Source/Themes.php CHANGED
@@ -1,9 +1,6 @@
1
  <?php
2
-
3
  class Diglin_Chat_Model_Config_Source_Themes
4
  {
5
- const ZOPIM_THEMES_LIST = "http://zopim.com/assets/dashboard/themes/window/plugins-themes.txt";
6
-
7
  /**
8
  * Options getter
9
  *
@@ -11,7 +8,10 @@ class Diglin_Chat_Model_Config_Source_Themes
11
  */
12
  public function toOptionArray()
13
  {
14
- $themes = Mage::helper('chat')->getCurlOptions(self::ZOPIM_THEMES_LIST);
 
 
 
15
 
16
  foreach($themes as $theme){
17
  $out[] = array('value' => $theme, 'label'=>Mage::helper('chat')->__($theme));
1
  <?php
 
2
  class Diglin_Chat_Model_Config_Source_Themes
3
  {
 
 
4
  /**
5
  * Options getter
6
  *
8
  */
9
  public function toOptionArray()
10
  {
11
+ $filename = Mage::getBaseDir('media') . DS . 'chat' . DS . 'themes.txt';
12
+ $handle = fopen($filename, 'r');
13
+ $themes = explode("\n",fread($handle, filesize($filename)));
14
+ fclose($handle);
15
 
16
  foreach($themes as $theme){
17
  $out[] = array('value' => $theme, 'label'=>Mage::helper('chat')->__($theme));
app/code/community/Diglin/Chat/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Diglin_Chat>
5
- <version>1.1.0</version>
6
  </Diglin_Chat>
7
  </modules>
8
 
@@ -26,9 +26,11 @@
26
  <position>bl</position>
27
  <hidewhenonline>0</hidewhenonline>
28
  </buttonconfig>
29
- <bubbleconfig>
30
- <show></show>
31
- </bubbleconfig>
 
 
32
  </chat>
33
  </default>
34
 
2
  <config>
3
  <modules>
4
  <Diglin_Chat>
5
+ <version>1.2.0</version>
6
  </Diglin_Chat>
7
  </modules>
8
 
26
  <position>bl</position>
27
  <hidewhenonline>0</hidewhenonline>
28
  </buttonconfig>
29
+ <bubbleconfig>
30
+ <show></show>
31
+ <title>Questions?</title>
32
+ <text>Click here to chat with us!</text>
33
+ </bubbleconfig>
34
  </chat>
35
  </default>
36
 
app/code/community/Diglin/Chat/etc/system.xml CHANGED
@@ -9,7 +9,7 @@
9
 
10
  <sections>
11
  <chat module="chat">
12
- <label>Zopim Chat by diglin.com</label>
13
  <tab>diglin</tab>
14
  <frontend_type>text</frontend_type>
15
  <sort_order>110</sort_order>
@@ -218,15 +218,31 @@
218
  <show_in_website>1</show_in_website>
219
  <show_in_store>1</show_in_store>
220
  <fields>
 
 
 
 
 
 
 
221
  <color>
222
  <label>Color of the window</label>
223
  <frontend_type>text</frontend_type>
224
- <sort_order>20</sort_order>
225
- <comment>Provide here an hexa code e.g. #000000</comment>
226
  <show_in_default>1</show_in_default>
227
  <show_in_website>1</show_in_website>
228
  <show_in_store>1</show_in_store>
229
  </color>
 
 
 
 
 
 
 
 
 
230
  </fields>
231
  </windowconfig>
232
  <buttonconfig>
9
 
10
  <sections>
11
  <chat module="chat">
12
+ <label>Zopim Chat</label>
13
  <tab>diglin</tab>
14
  <frontend_type>text</frontend_type>
15
  <sort_order>110</sort_order>
218
  <show_in_website>1</show_in_website>
219
  <show_in_store>1</show_in_store>
220
  <fields>
221
+ <swatches>
222
+ <frontend_model>chat/adminhtml_config_source_color</frontend_model>
223
+ <sort_order>20</sort_order>
224
+ <show_in_default>1</show_in_default>
225
+ <show_in_website>1</show_in_website>
226
+ <show_in_store>1</show_in_store>
227
+ </swatches>
228
  <color>
229
  <label>Color of the window</label>
230
  <frontend_type>text</frontend_type>
231
+ <sort_order>30</sort_order>
232
+ <comment>Use the color swatches to be sure to get a correct display of the chat window. Provide here an hexa code e.g. #000000 for black color</comment>
233
  <show_in_default>1</show_in_default>
234
  <show_in_website>1</show_in_website>
235
  <show_in_store>1</show_in_store>
236
  </color>
237
+ <theme>
238
+ <label>Theme</label>
239
+ <frontend_type>select</frontend_type>
240
+ <source_model>chat/config_source_themes</source_model>
241
+ <sort_order>40</sort_order>
242
+ <show_in_default>1</show_in_default>
243
+ <show_in_website>1</show_in_website>
244
+ <show_in_store>1</show_in_store>
245
+ </theme>
246
  </fields>
247
  </windowconfig>
248
  <buttonconfig>
media/chat/colors.txt ADDED
@@ -0,0 +1,240 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #000000
2
+ #000040
3
+ #000080
4
+ #0000bf
5
+ #0000ff
6
+ #002400
7
+ #002440
8
+ #002480
9
+ #0024bf
10
+ #0024ff
11
+ #004900
12
+ #004940
13
+ #004980
14
+ #0049bf
15
+ #0049ff
16
+ #006d00
17
+ #006d40
18
+ #006d80
19
+ #006dbf
20
+ #006dff
21
+ #009200
22
+ #009240
23
+ #009280
24
+ #0092bf
25
+ #0092ff
26
+ #00b600
27
+ #00b640
28
+ #00b680
29
+ #00b6bf
30
+ #00b6ff
31
+ #00db00
32
+ #00db40
33
+ #00db80
34
+ #00dbbf
35
+ #00dbff
36
+ #00ff00
37
+ #00ff40
38
+ #00ff80
39
+ #00ffbf
40
+ #00ffff
41
+ #330000
42
+ #330040
43
+ #330080
44
+ #3300bf
45
+ #3300ff
46
+ #332400
47
+ #332440
48
+ #332480
49
+ #3324bf
50
+ #3324ff
51
+ #334900
52
+ #334940
53
+ #334980
54
+ #3349bf
55
+ #3349ff
56
+ #336d00
57
+ #336d40
58
+ #336d80
59
+ #336dbf
60
+ #336dff
61
+ #339200
62
+ #339240
63
+ #339280
64
+ #3392bf
65
+ #3392ff
66
+ #33b600
67
+ #33b640
68
+ #33b680
69
+ #33b6bf
70
+ #33b6ff
71
+ #33db00
72
+ #33db40
73
+ #33db80
74
+ #33dbbf
75
+ #33dbff
76
+ #33ff00
77
+ #33ff40
78
+ #33ff80
79
+ #33ffbf
80
+ #33ffff
81
+ #660000
82
+ #660040
83
+ #660080
84
+ #6600bf
85
+ #6600ff
86
+ #662400
87
+ #662440
88
+ #662480
89
+ #6624bf
90
+ #6624ff
91
+ #664900
92
+ #664940
93
+ #664980
94
+ #6649bf
95
+ #6649ff
96
+ #666d00
97
+ #666d40
98
+ #666d80
99
+ #666dbf
100
+ #666dff
101
+ #669200
102
+ #669240
103
+ #669280
104
+ #6692bf
105
+ #6692ff
106
+ #66b600
107
+ #66b640
108
+ #66b680
109
+ #66b6bf
110
+ #66b6ff
111
+ #66db00
112
+ #66db40
113
+ #66db80
114
+ #66dbbf
115
+ #66dbff
116
+ #66ff00
117
+ #66ff40
118
+ #66ff80
119
+ #66ffbf
120
+ #66ffff
121
+ #990000
122
+ #990040
123
+ #990080
124
+ #9900bf
125
+ #9900ff
126
+ #992400
127
+ #992440
128
+ #992480
129
+ #9924bf
130
+ #9924ff
131
+ #994900
132
+ #994940
133
+ #994980
134
+ #9949bf
135
+ #9949ff
136
+ #996d00
137
+ #996d40
138
+ #996d80
139
+ #996dbf
140
+ #996dff
141
+ #999200
142
+ #999240
143
+ #999280
144
+ #9992bf
145
+ #9992ff
146
+ #99b600
147
+ #99b640
148
+ #99b680
149
+ #99b6bf
150
+ #99b6ff
151
+ #99db00
152
+ #99db40
153
+ #99db80
154
+ #99dbbf
155
+ #99dbff
156
+ #99ff00
157
+ #99ff40
158
+ #99ff80
159
+ #99ffbf
160
+ #99ffff
161
+ #cc0000
162
+ #cc0040
163
+ #cc0080
164
+ #cc00bf
165
+ #cc00ff
166
+ #cc2400
167
+ #cc2440
168
+ #cc2480
169
+ #cc24bf
170
+ #cc24ff
171
+ #cc4900
172
+ #cc4940
173
+ #cc4980
174
+ #cc49bf
175
+ #cc49ff
176
+ #cc6d00
177
+ #cc6d40
178
+ #cc6d80
179
+ #cc6dbf
180
+ #cc6dff
181
+ #cc9200
182
+ #cc9240
183
+ #cc9280
184
+ #cc92bf
185
+ #cc92ff
186
+ #ccb600
187
+ #ccb640
188
+ #ccb680
189
+ #ccb6bf
190
+ #ccb6ff
191
+ #ccdb00
192
+ #ccdb40
193
+ #ccdb80
194
+ #ccdbbf
195
+ #ccdbff
196
+ #ccff00
197
+ #ccff40
198
+ #ccff80
199
+ #ccffbf
200
+ #ccffff
201
+ #ff0000
202
+ #ff0040
203
+ #ff0080
204
+ #ff00bf
205
+ #ff00ff
206
+ #ff2400
207
+ #ff2440
208
+ #ff2480
209
+ #ff24bf
210
+ #ff24ff
211
+ #ff4900
212
+ #ff4940
213
+ #ff4980
214
+ #ff49bf
215
+ #ff49ff
216
+ #ff6d00
217
+ #ff6d40
218
+ #ff6d80
219
+ #ff6dbf
220
+ #ff6dff
221
+ #ff9200
222
+ #ff9240
223
+ #ff9280
224
+ #ff92bf
225
+ #ff92ff
226
+ #ffb600
227
+ #ffb640
228
+ #ffb680
229
+ #ffb6bf
230
+ #ffb6ff
231
+ #ffdb00
232
+ #ffdb40
233
+ #ffdb80
234
+ #ffdbbf
235
+ #ffdbff
236
+ #ffff00
237
+ #ffff40
238
+ #ffff80
239
+ #ffffbf
240
+ #ffffff
media/chat/colorselectbg.gif ADDED
Binary file
media/chat/themes.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ alphacube
2
+ plastic
3
+ solid
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Diglin_Chat</name>
4
- <version>1.1.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>
@@ -31,11 +31,12 @@ Documentation&#xD;
31
  &#xD;
32
  Just configure the key of your account in Menu System &gt; Configuration &gt; Rissip &gt; Zopim Chat&#xD;
33
  To find this key, go into the Zopim Dashboard then click on Setting and find the link "Embed widget on my site". In the area where the html code is generated, you can find after //zopim.com/?xyzbufoisfgsigsgdgjbsk. Copy the text after the question mark to the Magento configuration field for the "Key of your account".</description>
34
- <notes>- Version 1.1.1: comment/remove in the layout xml file the option which force some display options. Add some Zopim changes.</notes>
 
35
  <authors><author><name>diglin</name><user>auto-converted</user><email>sly@diglin.com</email></author></authors>
36
- <date>2012-02-13</date>
37
- <time>22:18:41</time>
38
- <contents><target name="mageetc"><dir name="modules"><file name="Diglin_Chat.xml" hash="7da9e2d5c52eba04adf5e83fcab1a28b"/></dir></target><target name="magecommunity"><dir name="Diglin"><dir name="Chat"><dir name="Block"><dir name="Adminhtml"><dir name="Config"><dir name="Source"><file name="Heading.php" hash="973aa753b6e5a2f7b3f4f9bd373443a0"/><file name="Hint.php" hash="af5cb2858f7ad2af18cb499b6b8a43fd"/></dir></dir></dir><file name="Dashboard.php" hash="e3e49025228a949e0e358e4de837e730"/><file name="Display.php" hash="a4f006492d59e4616f3a041aa62488f4"/></dir><dir name="Helper"><file name="Data.php" hash="18802161ccf6bd327a1c149cd4eba3f9"/></dir><dir name="Model"><dir name="Config"><dir name="Source"><file name="Language.php" hash="9bcf4fd61e453c758eae2375f6b8dad4"/><file name="Position.php" hash="2918270c00d87c849abb999411974c2e"/><file name="Showorhide.php" hash="4765fe0a49708ddc4655e91f5c414f34"/><file name="Themes.php" hash="c16a747b8cac13b63c9da4d6fe6332b5"/></dir></dir></dir><dir name="controllers"><file name="AdminController.php" hash="709b74e4e2404a6c2583f582f05bc8d5"/></dir><dir name="etc"><file name="adminhtml.xml" hash="2eb2c12f1d61310a579d171fdbd0646c"/><file name="config.xml" hash="e51b6c667725c9986227b5a9ed33f754"/><file name="system.xml" hash="dbe5c828752f8976d4aca5585061c562"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="chat.xml" hash="94dd132f4ee8e3dd27ebf007c3ba50e2"/></dir><dir name="template"><dir name="chat"><file name="chat.phtml" hash="5717c353a6c50a61201af1f8d7762231"/></dir></dir></dir></dir></dir></target></contents>
39
  <compatible/>
40
  <dependencies/>
41
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Diglin_Chat</name>
4
+ <version>1.2.0</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>
31
  &#xD;
32
  Just configure the key of your account in Menu System &gt; Configuration &gt; Rissip &gt; Zopim Chat&#xD;
33
  To find this key, go into the Zopim Dashboard then click on Setting and find the link "Embed widget on my site". In the area where the html code is generated, you can find after //zopim.com/?xyzbufoisfgsigsgdgjbsk. Copy the text after the question mark to the Magento configuration field for the "Key of your account".</description>
34
+ <notes>- Version 1.2.0: - add color swatches in configuration page to get the correct color for the window, give back configuration for theme of the window, fix the donation button. Please donate now :-)&#xD;
35
+ - Version 1.1.1: comment/remove in the layout xml file the option which force some display options. Add some Zopim changes.</notes>
36
  <authors><author><name>diglin</name><user>auto-converted</user><email>sly@diglin.com</email></author></authors>
37
+ <date>2012-02-21</date>
38
+ <time>22:03:59</time>
39
+ <contents><target name="mageetc"><dir name="modules"><file name="Diglin_Chat.xml" hash="7da9e2d5c52eba04adf5e83fcab1a28b"/></dir></target><target name="magecommunity"><dir name="Diglin"><dir name="Chat"><dir name="Block"><dir name="Adminhtml"><dir name="Config"><dir name="Source"><file name="Color.php" hash="2492de6399fc72cf16eeabfbb70abc3d"/><file name="Heading.php" hash="973aa753b6e5a2f7b3f4f9bd373443a0"/><file name="Hint.php" hash="838916b4a78521660d33a6fe6092e44d"/></dir></dir></dir><file name="Dashboard.php" hash="e3e49025228a949e0e358e4de837e730"/><file name="Display.php" hash="fd0551a09aef4f9f68b3eaba77287cb0"/></dir><dir name="Helper"><file name="Data.php" hash="a69c5b641cda5359336b2789de303be0"/></dir><dir name="Model"><dir name="Config"><dir name="Source"><file name="Language.php" hash="9bcf4fd61e453c758eae2375f6b8dad4"/><file name="Position.php" hash="2918270c00d87c849abb999411974c2e"/><file name="Showorhide.php" hash="4765fe0a49708ddc4655e91f5c414f34"/><file name="Themes.php" hash="265edcf8737874c636eca01c76330440"/></dir></dir></dir><dir name="controllers"><file name="AdminController.php" hash="709b74e4e2404a6c2583f582f05bc8d5"/></dir><dir name="etc"><file name="adminhtml.xml" hash="2eb2c12f1d61310a579d171fdbd0646c"/><file name="config.xml" hash="c2f1fbbbab63d0490f613b22696ee2d6"/><file name="system.xml" hash="d434efdb2db4910a8856635527ca868f"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="chat.xml" hash="94dd132f4ee8e3dd27ebf007c3ba50e2"/></dir><dir name="template"><dir name="chat"><file name="chat.phtml" hash="5717c353a6c50a61201af1f8d7762231"/></dir></dir></dir></dir></dir></target><target name="magemedia"><dir name="chat"><file name="colors.txt" hash="b4360a22dffad673efb4a76b1c5019e3"/><file name="colorselectbg.gif" hash="cf3df3ae5225ff25d69617d72bd9a380"/><file name="themes.txt" hash="cc4d0a0152ef5b8ca2a27d045fac5116"/></dir></target></contents>
40
  <compatible/>
41
  <dependencies/>
42
  </package>