Author Topic: Using webim on several sites with one central operator console  (Read 19586 times)

0 Members and 1 Guest are viewing this topic.

simplyfat

  • Full Member
  • ***
  • Posts: 9
i have two companies with one common backoffice/callcenter. there is no obvious relation between these two, so customers of company 1 should not see company name 2 in the live chat window and vice versa. the operators should not have to login into seperate consoles for each companies.

so here is my hack:

1) create a file called "custom.php" somewhere
Code: [Select]
function text_verwursten($key, $val, $locale) {
$company = getCompanyDetails();

switch ($key) {
case 'chat.window.title.agent': case 'chat.window.title.user': case 'site.title':
return $company['name'];

case 'mail.user.history.subject':
return $company['name'] . ': ' . ($locale == 'de' ? 'Chat-Protokoll' : 'dialog history');

case 'site.url':
return $company['url'];

default:
return $val;
}
}

function settings_verwursten($key, $val) {
$company = getCompanyDetails();

switch ($key) {
case 'hosturl':
return $company['url'];
case 'title':
return $company['name'];
case 'logo':
return $company['logo'];
case 'email':
return $company['email'];
case 'chattitle':
return $company['name'] . ' ' . $val;
default:
return $val;
}
}

function getCompanyDetails() {
$ret = array();
switch ($_SERVER['SERVER_NAME']) {
case 'support.company1.com':
$ret['name'] = 'Company 1';
$ret['url'] = 'http://www.company1.com/';
$ret['email'] = 'mail@company1.com';
$ret['logo'] = 'http://www.company1.com/images/logo.jpg';
break;
default:
$ret['name'] = 'Company 2';
$ret['url'] = 'http://www.company2.com/';
$ret['email'] = 'mail@company2.com';
$ret['logo'] = 'http://www.company2.com/images/logo.jpg';
}
return $ret;
}

2) go to webim/libs/common.php
3) add "require_once('/path/to/custom.php');" at the top
4) change one line in "load_messages"-function (see comment "CUSTOM")
Code: [Select]
function load_messages($locale) {
global $messages, $webim_encoding, $output_encoding;
$hash = array();
$current_encoding = $webim_encoding;
$fp = fopen(dirname(__FILE__)."/../locales/$locale/properties", "r");
while (!feof($fp)) {
$line = fgets($fp, 4096);
$keyval = split("=", $line, 2 );
if( isset($keyval[1]) ) {
$keyval[1] = text_verwursten($keyval[0], $keyval[1], $locale); // CUSTOM
if($keyval[0] == 'encoding') {
$current_encoding = trim($keyval[1]);
} else if($keyval[0] == 'output_encoding') {
$output_encoding[$locale] = trim($keyval[1]);
} else if( $current_encoding == $webim_encoding ) {
$hash[$keyval[0]] = str_replace("\\n", "\n",trim($keyval[1]));
} else {
$hash[$keyval[0]] = myiconv($current_encoding, $webim_encoding, str_replace("\\n", "\n",trim($keyval[1])));
}
}
}
fclose($fp);
$messages[$locale] = $hash;
}

5) change one line in "loadsettings"-function (see comment "CUSTOM")
Code: [Select]
function loadsettings() {
global $settingsloaded, $settings_in_db, $settings;
if($settingsloaded) {
return;
}
$settingsloaded = true;

$link = connect();
$sqlresult = mysql_query('select vckey,vcvalue from chatconfig',$link) or die(' Query failed: '.mysql_error().": ".$query);

while ($row = mysql_fetch_array($sqlresult, MYSQL_ASSOC)) {
$name = $row['vckey'];
$settings[$name] = settings_verwursten($name, $row['vcvalue']); // CUSTOM
$settings_in_db[$name] = true;
}
mysql_free_result($sqlresult);
mysql_close($link);
}
« Last Edit: May 20, 2009, 05:05:32 AM by simplyfat »


spencer

  • Jr. Member
  • **
  • Posts: 1
Re: Using webim on several sites with one central operator console
« Reply #1 on: June 01, 2009, 07:10:14 AM »
           Thanks for sharing the above mentioned codes.

« Last Edit: June 06, 2009, 12:01:18 AM by Inspirer »

wilson

  • Full Member
  • ***
  • Posts: 5
Re: Using webim on several sites with one central operator console
« Reply #2 on: September 05, 2009, 04:42:39 PM »
Hi

that is a very interesting hack no doubt :-)

So using your hack, with just one installation of webim we could attend "n" diferent sites?
And if so, how we could generate diferent codes to put the on/off line imagens on those sites?

Thanks

simplyfat

  • Full Member
  • ***
  • Posts: 9
Re: Using webim on several sites with one central operator console
« Reply #3 on: September 05, 2009, 08:43:57 PM »
this hack does only work with 1 company which has n different brandings. however you can use the group feature to have different on-/offline realms.
it is NOT suitable for a hosted solution or similar where many different companies use the service, because every operator can see each other.

r1

  • Jr. Member
  • **
  • Posts: 1
Re: Using webim on several sites with one central operator console
« Reply #4 on: May 10, 2010, 09:40:49 AM »
Hello,
I need this feature for my clients. I am having few projects, and own operators. I need separated per domain site  but every data are in one domain (satellite).
Does anyone can write that for money? Regards.

kokiks87

  • Jr. Member
  • **
  • Posts: 1
Re: Using webim on several sites with one central operator console
« Reply #5 on: May 28, 2010, 10:50:43 AM »
Hello,

I just want to ask if is there any way that a certain operator can access only the group he is intended to operate?
Because as what I have experienced in here is that administrator can only limit the function of the operator  but can not designate on who is the person to chat and who is obliged to chat to a certain group of user.  I have browse all links in the administrators area but there is no feature there to create a group and designate an operator of that group.

Any help is greatly appreciated.

Thanks.

xupaosso

  • Jr. Member
  • **
  • Posts: 1
Re: Using webim on several sites with one central operator console
« Reply #6 on: August 30, 2010, 06:25:49 PM »
To answer the question above, I have found a (temporary) solution:

Change line 46 in operator/users.php to:

Code: [Select]
$page['showpopup'] = $settings['enablepopupnotification'] == '1' && $_SESSION['operatorgroups'] != "" ? "1" : "0";
This probably doesn't cover all bases, but it's a starting point that has so far worked for me.

r2

  • Jr. Member
  • **
  • Posts: 1
Re: Using webim on several sites with one central operator console
« Reply #7 on: October 21, 2010, 11:09:28 AM »
Is there any official feature from mibew concerning this case?

we have multiple WebSites :
http://www.site1.com
http://www.site2.com
http://www.site3.com

Can all visitors from these sites be shown in operator's window with according domains (site1.com, site2.com...).
We need to see from which site the visitor has come