mirror of
https://github.com/Mibew/design.git
synced 2025-01-22 18:10:33 +03:00
Fix bug with client side plugins initialization
Fix prechat survey and leave message page initialization for client
This commit is contained in:
parent
71c327f14c
commit
8869a560ed
@ -199,6 +199,9 @@ function prepare_chat_app_data() {
|
||||
function setup_leavemessage($name, $email, $group_id, $info, $referrer) {
|
||||
$data = prepare_chat_app_data();
|
||||
|
||||
// Load JavaScript plugins and JavaScripts, CSS files required by them
|
||||
$data = array_merge_recursive($data, get_plugins_data('client_chat_window'));
|
||||
|
||||
// Create some empty arrays
|
||||
$data['leaveMessage'] = array();
|
||||
|
||||
@ -248,6 +251,9 @@ function setup_leavemessage($name, $email, $group_id, $info, $referrer) {
|
||||
function setup_survey($name, $email, $group_id, $info, $referrer) {
|
||||
$data = prepare_chat_app_data();
|
||||
|
||||
// Load JavaScript plugins and JavaScripts, CSS files required by them
|
||||
$data = array_merge_recursive($data, get_plugins_data('client_chat_window'));
|
||||
|
||||
// Create some empty arrays
|
||||
$data['survey'] = array();
|
||||
|
||||
@ -440,9 +446,7 @@ function setup_chatview_for_user(Thread $thread) {
|
||||
$data = setup_chatview($thread);
|
||||
|
||||
// Load JavaScript plugins and JavaScripts, CSS files required by them
|
||||
$data['additional_css'] = get_additional_css('client_chat_window');
|
||||
$data['additional_js'] = get_additional_js('client_chat_window');
|
||||
$data['js_plugin_options'] = get_js_plugin_options('client_chat_window');
|
||||
$data = array_merge_recursive($data, get_plugins_data('client_chat_window'));
|
||||
|
||||
// Set user info
|
||||
$data['chat']['user'] = array(
|
||||
@ -485,9 +489,7 @@ function setup_chatview_for_operator(Thread $thread, $operator) {
|
||||
$data = setup_chatview($thread);
|
||||
|
||||
// Load JavaScript plugins and JavaScripts, CSS files required by them
|
||||
$data['additional_css'] = get_additional_css('agent_chat_window');
|
||||
$data['additional_js'] = get_additional_js('agent_chat_window');
|
||||
$data['js_plugin_options'] = get_js_plugin_options('agent_chat_window');
|
||||
$data = array_merge_recursive($data, get_plugins_data('agent_chat_window'));
|
||||
|
||||
// Set operator info
|
||||
$data['chat']['user'] = array(
|
||||
|
@ -159,6 +159,24 @@ function get_js_plugin_options($page_name) {
|
||||
return json_encode($args['plugins']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get additional plugins data for specified page
|
||||
*
|
||||
* @param string $page_name Plugins initialize at this page
|
||||
* @return array Associative array of plugins data. It contains following keys:
|
||||
* - 'additional_css': contains results of the 'get_additional_css function
|
||||
* - 'additional_js': contains results of the 'get_additional_js' function
|
||||
* - 'js_plugin_options': contains results of the 'get_js_plugin_options'
|
||||
* function
|
||||
*/
|
||||
function get_plugins_data($page_name) {
|
||||
return array(
|
||||
'additional_css' => get_additional_css($page_name),
|
||||
'additional_js' => get_additional_js($page_name),
|
||||
'js_plugin_options' => get_js_plugin_options($page_name)
|
||||
);
|
||||
}
|
||||
|
||||
function no_field($key)
|
||||
{
|
||||
return getlocal2("errors.required", array(getlocal($key)));
|
||||
|
Loading…
Reference in New Issue
Block a user