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

0 Members and 1 Guest are viewing this topic.

dmcdaniel

  • Sr. Member
  • ****
  • Posts: 32
Hello Everyone,

This is a build on SimplyFat's original build. I have edited it so that it will NOT show the webpage groups in the chat area.

1) Create a file called custom.php inside the libs directory - Add the following information to it:

Code: [Select]
<?php

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 libs/common.php and add the following line
Code: [Select]

require_once('custom.php');


3) Change one line in "load_messages"-function (see comment "CUSTOM") in lib/common.php

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;
}


4) Replace the following code in lib/common.php

Code: [Select]

function loadsettings()
{
global $settingsloaded;
if (!$settingsloaded) {
$link = connect();
loadsettings_($link);
mysql_close($link);
}
}


Replace with:

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);
}


5) Go into styles/default/templates/survey.tpl and edit the following code:

Code: [Select]

${if:groups}
<tr>
<td class="text">${msg:presurvey.department}</td>
<td>
<select name="group" style="min-width:200px;">${page:groups}</select>
</td>
</tr>


replace with:

Code: [Select]

${if:groups}
<tr>
<td class="text"></td>
<td>
<select name="group" style="display:none;">${page:groups}</select>
</td>
</tr>


6) Do this for styles/original/templates/survey.tpl and styles/simplicity/templates/survey.tpl

7) Go into operator/users.php and find:

Code: [Select]

$page['showpopup'] = $settings['enablepopupnotification'] == '1' ? "1" : "0";


Replace with:

Code: [Select]

$page['showpopup'] = $settings['enablepopupnotification'] == '1' && $_SESSION['operatorgroups'] != "" ? "1" : "0";


* Note: Most of this trick was from two people on the site, SimplyFat and xupaosso. I did some basic addition and cleaned the code up a little bit. All thanks goes to them!

kyle123

  • Jr. Member
  • **
  • Posts: 2
Re: Using webim on several sites with one central operator console - New
« Reply #1 on: March 02, 2012, 05:04:03 AM »
this doesn't work unable to save settings

bobscan

  • Full Member
  • ***
  • Posts: 10
Re: Using webim on several sites with one central operator console - New
« Reply #2 on: November 20, 2012, 07:06:39 PM »
I concur, this breaks save function of the operator's settings page. Unfortunate, because this would be a very useful extension  for those with multiple frontends.

yuanfang

  • Native
  • *****
  • Posts: 74
Re: Using webim on several sites with one central operator console - New
« Reply #3 on: March 20, 2013, 12:49:43 AM »
Don't count on getting the spectacular sell WOW Gold body of a movie star—unless, that is, you were blessed with a naturally great figure. And certainly don't blame yourself for not measuring up (or down, as the case may be). "Celebrities sell WOW Gold have private chefs; trainers like me working with them 24 hours a day, six days a week; and plastic surgeons to fix whatever problems are left," says Jillian. And then sell WOW Gold there's good lighting, airbrushing, and all sorts of photographic wizardry. "Hollywood," she adds, "is a very small piece of the world. It is not reality."

yuanfang

  • Native
  • *****
  • Posts: 74
Re: Using webim on several sites with one central operator console - New
« Reply #4 on: March 20, 2013, 12:52:09 AM »
Part of changing your eating patterns requires altering your reflexes. "When you find yourself thinking, I'm going to get an ice cream cone because I've had such a bad day D3 Power Leveling, just stop," Bob says. "Take a moment and ask yourself, Am I really hungry? Do I really want this? Why do I want it? The pause gets you firefall gold thinking instead of simply acting on impulse." If it turns out that what you're feeling is something other than hunger, Jillian adds, find a nonfood treat. "Instead of eating the ice cream, reward yourself with Diablo 3 Power Leveling a manicure, massage, or bubble bath. Do something positive, healthy—something that makes you feel beautiful and is incompatible with breaking yourself down."