Skip to content

Commit

Permalink
Use theme text then chat is closed
Browse files Browse the repository at this point in the history
  • Loading branch information
remdex committed Jul 15, 2015
1 parent be38a89 commit 445420e
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 5 deletions.
4 changes: 3 additions & 1 deletion lhc_web/design/defaulttheme/js/lh.js
Expand Up @@ -550,7 +550,9 @@ function lh(){
this.syncroRequestSend = true;
var modeWindow = this.isWidgetMode == true ? '/(mode)/widget' : '';
var operatorTyping = this.operatorTyping == true ? '/(ot)/t' : '';
$.getJSON(this.wwwDir + this.syncuser + this.chat_id + '/'+ this.last_message_id + '/' + this.hash + modeWindow + operatorTyping ,{ }, function(data){
var themeWindow = this.theme !== null ? '/(theme)/'+this.theme : '';

$.getJSON(this.wwwDir + this.syncuser + this.chat_id + '/'+ this.last_message_id + '/' + this.hash + modeWindow + operatorTyping + themeWindow ,{ }, function(data){

inst.updateUserSyncInterface(inst,data);

Expand Down
2 changes: 1 addition & 1 deletion lhc_web/design/defaulttheme/js/lh.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lhc_web/modules/lhchat/module.php
Expand Up @@ -268,7 +268,7 @@

$ViewList['syncuser'] = array(
'params' => array('chat_id','message_id','hash'),
'uparams' => array('mode','ot')
'uparams' => array('mode','ot','theme')
);

$ViewList['usertyping'] = array(
Expand Down
55 changes: 53 additions & 2 deletions lhc_web/modules/lhchat/syncuser.php
Expand Up @@ -27,6 +27,8 @@

if (is_object($chat) && $chat->hash == $Params['user_parameters']['hash'])
{


$db = ezcDbInstance::get();
$db->beginTransaction();
try {
Expand Down Expand Up @@ -107,7 +109,32 @@

// Closed
if ($chat->status == erLhcoreClassModelChat::STATUS_CLOSED_CHAT) {
$status = '<h4>'.erTranslationClassLhTranslation::getInstance()->getTranslation('chat/syncuser','Support staff member has closed this chat').'</h4>';

$theme = false;

if (isset($Params['user_parameters_unordered']['theme']) && (int)$Params['user_parameters_unordered']['theme'] > 0){
try {
$theme = erLhAbstractModelWidgetTheme::fetch($Params['user_parameters_unordered']['theme']);
} catch (Exception $e) {

}
} else {
$defaultTheme = erLhcoreClassModelChatConfig::fetch('default_theme_id')->current_value;
if ($defaultTheme > 0) {
try {
$theme = erLhAbstractModelWidgetTheme::fetch($defaultTheme);
} catch (Exception $e) {

}
}
}

if ($theme !== false && $theme->support_closed != ''){
$status = '<h4>'.htmlspecialchars($theme->support_closed).'</h4>';
} else {
$status = '<h4>'.erTranslationClassLhTranslation::getInstance()->getTranslation('chat/syncuser','Support staff member has closed this chat').'</h4>';
}

$blocked = 'true';
$breakSync = true;
}
Expand Down Expand Up @@ -156,7 +183,31 @@

} else {
$content = 'false';
$status = '<h4>'.erTranslationClassLhTranslation::getInstance()->getTranslation('chat/syncuser','The operator has closed this chat session').'</h4>';
$theme = false;

if (isset($Params['user_parameters_unordered']['theme']) && (int)$Params['user_parameters_unordered']['theme'] > 0){
try {
$theme = erLhAbstractModelWidgetTheme::fetch($Params['user_parameters_unordered']['theme']);
} catch (Exception $e) {

}
} else {
$defaultTheme = erLhcoreClassModelChatConfig::fetch('default_theme_id')->current_value;
if ($defaultTheme > 0) {
try {
$theme = erLhAbstractModelWidgetTheme::fetch($defaultTheme);
} catch (Exception $e) {

}
}
}

if ($theme !== false && $theme->support_closed != ''){
$status = '<h4>'.htmlspecialchars($theme->support_closed).'</h4>';
} else {
$status = '<h4>'.erTranslationClassLhTranslation::getInstance()->getTranslation('chat/syncuser','Support staff member has closed this chat').'</h4>';
}

$blocked = 'true';
}

Expand Down

0 comments on commit 445420e

Please sign in to comment.