Use human-readable way to define chat window params

This commit is contained in:
Dmitriy Simushev 2015-01-14 12:25:25 +00:00
parent 67a0db5349
commit 9faf346634
5 changed files with 20 additions and 8 deletions

View File

@ -193,7 +193,7 @@
+ '/' + threadId
+ (viewOnly ? '?viewonly=true': ''),
'ImCenter' + threadId,
page.get('chatWindowParams')
Mibew.Utils.buildWindowOptions(page.get('chatWindowParams'))
);
},

View File

@ -176,6 +176,11 @@ abstract class AbstractGenerator implements GeneratorInterface
$chat_style = new ChatStyle($style_name);
$chat_configurations = $chat_style->getConfigurations();
return $chat_configurations['chat']['window_params'];
return sprintf(
"toolbar=0,scrollbars=0,location=0,status=1,menubar=0,width=%u,height=%u,resizable=%u",
$chat_configurations['chat']['window']['width'],
$chat_configurations['chat']['window']['height'],
$chat_configurations['chat']['window']['resizable'] ? '1' : '0'
);
}
}

View File

@ -124,12 +124,12 @@ class UsersController extends AbstractController
'banLink' => $request->getBaseUrl() . '/operator/ban',
'inviteLink' => $request->getBaseUrl() . '/operator/invite',
'chatWindowParams' => $chat_style_config['chat']['window_params'],
'chatWindowParams' => $chat_style_config['chat']['window'],
'geoWindowParams' => Settings::get('geolinkparams'),
'trackedUserWindowParams' => $page_style_config['tracked']['user_window_params'],
'trackedVisitorWindowParams' => $page_style_config['tracked']['visitor_window_params'],
'banWindowParams' => $page_style_config['ban']['window_params'],
'inviteWindowParams' => $chat_style_config['chat']['window_params'],
'inviteWindowParams' => $chat_style_config['chat']['window'],
),
))
);

View File

@ -141,7 +141,11 @@ class ChatStyle extends AbstractHandlebarsPoweredStyle implements StyleInterface
{
return array(
'chat' => array(
'window_params' => ''
'window' => array(
'width' => 640,
'height' => 480,
'resizable' => true,
),
),
'mail' => array(
'window_params' => ''

View File

@ -1,8 +1,11 @@
# This file determines some dialog styles options
# This file determines some chat styles options
chat:
# window_param use as param string in JavaScript window.open method
window_params: "toolbar=0,scrollbars=0,location=0,status=1,menubar=0,width=640,height=480,resizable=1"
# These params are used for chat windows opened via JavaScript's window.open.
window:
height: 480
width: 640
resizable: true
mail:
# window_param use as param string in JavaScript window.open method