Skip to content

Commit

Permalink
Enhancement #535
Browse files Browse the repository at this point in the history
  • Loading branch information
remdex committed Dec 14, 2014
1 parent fc9be65 commit c73b89b
Show file tree
Hide file tree
Showing 10 changed files with 49 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,14 @@
<td><?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/adminchat','Created')?></td>
<td><?php echo date(erLhcoreClassModule::$dateDateHourFormat,$chat->time)?></td>
</tr>

<?php if ($chat->user_closed_ts > 0 && $chat->user_status == 1) : ?>
<tr>
<td><?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/adminchat','Chat closed at')?></td>
<td><?php echo $chat->user_closed_ts_front?></td>
</tr>
<?php endif;?>

<?php if ($chat->wait_time > 0) : ?>
<tr>
<td><?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/adminchat','Waited')?></td>
Expand Down
3 changes: 3 additions & 0 deletions lhc_web/doc/CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ https://github.com/LiveHelperChat/livehelperchat/issues/370
3. Instead of banning e-mails which are very easy to fake, there is option to ban not only single ip but also IP ranges.
https://github.com/LiveHelperChat/livehelperchat/issues/546

4. Will be recorded time when user has left a chat
https://github.com/LiveHelperChat/livehelperchat/issues/535


2.14v

Expand Down
8 changes: 8 additions & 0 deletions lhc_web/doc/translation_default/translation_web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,10 @@
<source>Show BB Code button</source>
<translation type="unfinished"/>
</message>
<message>
<source>Which ip should not be allowed to chat</source>
<translation type="unfinished"/>
</message>
<message>
<source>Automatic chats purging. 0 - disabled, n &gt; 0 time in minutes before chat is automatically deleted</source>
<translation type="unfinished"/>
Expand Down Expand Up @@ -1556,6 +1560,10 @@
<source>Created</source>
<translation type="unfinished"/>
</message>
<message>
<source>Chat closed at</source>
<translation type="unfinished"/>
</message>
<message>
<source>Waited</source>
<translation type="unfinished"/>
Expand Down
8 changes: 8 additions & 0 deletions lhc_web/doc/update_db/structure.json
Original file line number Diff line number Diff line change
Expand Up @@ -1113,6 +1113,14 @@
"default": "0",
"extra": ""
},
{
"field": "user_closed_ts",
"type": "int(11)",
"null": "NO",
"key": "",
"default": "0",
"extra": ""
},
{
"field": "support_informed",
"type": "int(11)",
Expand Down
6 changes: 5 additions & 1 deletion lhc_web/doc/update_db/update_93.sql
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,8 @@ ALTER TABLE `lh_chat_online_user`
CHANGE `operator_message` `operator_message` text COLLATE 'utf8_general_ci' NOT NULL AFTER `user_country_name`,
COMMENT='';

INSERT INTO `lh_chat_config` (`identifier`, `value`, `type`, `explain`, `hidden`) VALUES ('banned_ip_range','',0,'Which ip should not be allowed to chat',0);
INSERT INTO `lh_chat_config` (`identifier`, `value`, `type`, `explain`, `hidden`) VALUES ('banned_ip_range','',0,'Which ip should not be allowed to chat',0);

ALTER TABLE `lh_chat`
ADD `user_closed_ts` int NOT NULL,
COMMENT='';
9 changes: 9 additions & 0 deletions lhc_web/lib/models/lhchat/erlhcoreclassmodelchat.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public function getState()
'priority' => $this->priority,
'chat_initiator' => $this->chat_initiator,
'user_tz_identifier' => $this->user_tz_identifier,
'user_closed_ts' => $this->user_closed_ts,

'online_user_id' => $this->online_user_id,
'unread_messages_informed' => $this->unread_messages_informed,
Expand Down Expand Up @@ -145,6 +146,11 @@ public function __get($var) {
$this->time_created_front = date('Ymd') == date('Ymd',$this->time) ? date(erLhcoreClassModule::$dateHourFormat,$this->time) : date(erLhcoreClassModule::$dateDateHourFormat,$this->time);
return $this->time_created_front;
break;

case 'user_closed_ts_front':
$this->user_closed_ts_front = date('Ymd') == date('Ymd',$this->user_closed_ts) ? date(erLhcoreClassModule::$dateHourFormat,$this->user_closed_ts) : date(erLhcoreClassModule::$dateDateHourFormat,$this->user_closed_ts);
return $this->user_closed_ts_front;
break;

case 'is_operator_typing':
$this->is_operator_typing = $this->operator_typing > (time()-10); // typing is considered if status did not changed for 30 seconds
Expand Down Expand Up @@ -414,6 +420,9 @@ public function blockUser() {
public $unread_messages_informed = 0;
public $reinform_timeout = 0;

// Time when user closed a chat window
public $user_closed_ts = 0;

// Time since last assignment
public $tslasign = 0;

Expand Down
1 change: 1 addition & 0 deletions lhc_web/modules/lhchat/chatwidgetclosed.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
// User closed chat
$chat->user_status = 1;
$chat->support_informed = 1;
$chat->user_closed_ts = time();

if ($chat->user_typing < (time()-12)) {
$chat->user_typing = time()-5;// Show for shorter period these status messages
Expand Down
1 change: 1 addition & 0 deletions lhc_web/modules/lhchat/userclosechat.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
$chat->support_informed = 1;
$chat->user_typing = time()-5;// Show for shorter period these status messages
$chat->is_user_typing = 1;
$chat->user_closed_ts = time();
$chat->user_typing_txt = htmlspecialchars_decode(erTranslationClassLhTranslation::getInstance()->getTranslation('chat/userleftchat','User has left the chat!'),ENT_QUOTES);

erLhcoreClassChat::getSession()->update($chat);
Expand Down
1 change: 1 addition & 0 deletions lhc_web/modules/lhinstall/install.php
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@
`ip` varchar(100) NOT NULL,
`dep_id` int(11) NOT NULL,
`user_status` int(11) NOT NULL DEFAULT '0',
`user_closed_ts` int(11) NOT NULL DEFAULT '0',
`support_informed` int(11) NOT NULL DEFAULT '0',
`unread_messages_informed` int(11) NOT NULL DEFAULT '0',
`reinform_timeout` int(11) NOT NULL DEFAULT '0',
Expand Down
5 changes: 5 additions & 0 deletions lhc_web/pos/lhchat/erlhcoreclassmodelchat.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@
$def->properties['user_status']->propertyName = 'user_status';
$def->properties['user_status']->propertyType = ezcPersistentObjectProperty::PHP_TYPE_INT;

$def->properties['user_closed_ts'] = new ezcPersistentObjectProperty();
$def->properties['user_closed_ts']->columnName = 'user_closed_ts';
$def->properties['user_closed_ts']->propertyName = 'user_closed_ts';
$def->properties['user_closed_ts']->propertyType = ezcPersistentObjectProperty::PHP_TYPE_INT;

$def->properties['support_informed'] = new ezcPersistentObjectProperty();
$def->properties['support_informed']->columnName = 'support_informed';
$def->properties['support_informed']->propertyName = 'support_informed';
Expand Down

0 comments on commit c73b89b

Please sign in to comment.