From 88fffc078b96ec706dca479e19e7dbc4042105d2 Mon Sep 17 00:00:00 2001 From: Dmitriy Simushev Date: Mon, 4 Mar 2013 09:27:38 +0000 Subject: [PATCH] Build select group box at client side --- .../model_views/survey/base_survey_form.js | 4 +- src/messenger/webim/js/compiled/chat_app.js | 4 +- .../model_views/survey/base_survey_form.js | 8 +- .../chat/models/survey/base_survey_form.js | 14 ++- src/messenger/webim/libs/chat.php | 114 ++++++++++-------- .../leave_message/form.handlebars | 12 +- .../survey/form.handlebars | 10 +- .../dialogs/default/js/compiled/templates.js | 112 ++++++++--------- 8 files changed, 159 insertions(+), 119 deletions(-) diff --git a/src/messenger/webim/js/compiled/chat/model_views/survey/base_survey_form.js b/src/messenger/webim/js/compiled/chat/model_views/survey/base_survey_form.js index c599866d..a0ef4d16 100644 --- a/src/messenger/webim/js/compiled/chat/model_views/survey/base_survey_form.js +++ b/src/messenger/webim/js/compiled/chat/model_views/survey/base_survey_form.js @@ -5,5 +5,5 @@ Copyright (c) 2005-2011 Mibew Messenger Community License: http://mibew.org/license.php */ -(function(c,d){c.Views.BaseSurveyForm=d.Marionette.ItemView.extend({events:{'change select[name="group"]':"changeGroupDescription","submit form":"preventSubmit"},ui:{groupSelect:'select[name="group"]',groupDescription:"#groupDescription",name:'input[name="name"]',email:'input[name="email"]',message:'textarea[name="message"]',errors:".errors"},modelEvents:{invalid:"showError","submit:error":"showError"},preventSubmit:function(b){b.preventDefault()},changeGroupDescription:function(){var b=this.ui.groupSelect.prop("selectedIndex"), -a=this.model.get("groups").descriptions||[];this.ui.groupDescription.text(a[b]||"")},showError:function(b,a){this.ui.errors.html("string"==typeof a?a:a.message)}})})(Mibew,Backbone); +(function(c,d){c.Views.BaseSurveyForm=d.Marionette.ItemView.extend({events:{'change select[name="group"]':"changeGroupDescription","submit form":"preventSubmit"},ui:{groupSelect:'select[name="group"]',groupDescription:"#groupDescription",name:'input[name="name"]',email:'input[name="email"]',message:'textarea[name="message"]',errors:".errors"},modelEvents:{invalid:"showError","submit:error":"showError"},preventSubmit:function(a){a.preventDefault()},changeGroupDescription:function(){var a=this.ui.groupSelect.prop("selectedIndex"), +a=this.model.get("groups")[a].description||"";this.ui.groupDescription.text(a)},showError:function(a,b){this.ui.errors.html("string"==typeof b?b:b.message)}})})(Mibew,Backbone); diff --git a/src/messenger/webim/js/compiled/chat_app.js b/src/messenger/webim/js/compiled/chat_app.js index cc789d30..4cde48c5 100644 --- a/src/messenger/webim/js/compiled/chat_app.js +++ b/src/messenger/webim/js/compiled/chat_app.js @@ -164,8 +164,8 @@ a);this.trigger("multiple:add");return a}})})(Mibew,Backbone,_); Copyright (c) 2005-2011 Mibew Messenger Community License: http://mibew.org/license.php */ -(function(c,d){c.Views.BaseSurveyForm=d.Marionette.ItemView.extend({events:{'change select[name="group"]':"changeGroupDescription","submit form":"preventSubmit"},ui:{groupSelect:'select[name="group"]',groupDescription:"#groupDescription",name:'input[name="name"]',email:'input[name="email"]',message:'textarea[name="message"]',errors:".errors"},modelEvents:{invalid:"showError","submit:error":"showError"},preventSubmit:function(b){b.preventDefault()},changeGroupDescription:function(){var b=this.ui.groupSelect.prop("selectedIndex"), -a=this.model.get("groups").descriptions||[];this.ui.groupDescription.text(a[b]||"")},showError:function(b,a){this.ui.errors.html("string"==typeof a?a:a.message)}})})(Mibew,Backbone); +(function(c,d){c.Views.BaseSurveyForm=d.Marionette.ItemView.extend({events:{'change select[name="group"]':"changeGroupDescription","submit form":"preventSubmit"},ui:{groupSelect:'select[name="group"]',groupDescription:"#groupDescription",name:'input[name="name"]',email:'input[name="email"]',message:'textarea[name="message"]',errors:".errors"},modelEvents:{invalid:"showError","submit:error":"showError"},preventSubmit:function(a){a.preventDefault()},changeGroupDescription:function(){var a=this.ui.groupSelect.prop("selectedIndex"), +a=this.model.get("groups")[a].description||"";this.ui.groupDescription.text(a)},showError:function(a,b){this.ui.errors.html("string"==typeof b?b:b.message)}})})(Mibew,Backbone); /* This file is part of Mibew Messenger project. http://mibew.org diff --git a/src/messenger/webim/js/source/chat/model_views/survey/base_survey_form.js b/src/messenger/webim/js/source/chat/model_views/survey/base_survey_form.js index ea2d8eed..8a3263d8 100644 --- a/src/messenger/webim/js/source/chat/model_views/survey/base_survey_form.js +++ b/src/messenger/webim/js/source/chat/model_views/survey/base_survey_form.js @@ -56,9 +56,11 @@ * Change group description */ changeGroupDescription: function() { - var groupId = this.ui.groupSelect.prop('selectedIndex'); - var descriptions = this.model.get('groups').descriptions || []; - this.ui.groupDescription.text(descriptions[groupId] || ''); + var selectedIndex = this.ui.groupSelect.prop('selectedIndex'); + var description = this.model + .get('groups')[selectedIndex] + .description || ''; + this.ui.groupDescription.text(description); }, /** diff --git a/src/messenger/webim/js/source/chat/models/survey/base_survey_form.js b/src/messenger/webim/js/source/chat/models/survey/base_survey_form.js index 7d7b52d0..f516e4d4 100644 --- a/src/messenger/webim/js/source/chat/models/survey/base_survey_form.js +++ b/src/messenger/webim/js/source/chat/models/survey/base_survey_form.js @@ -58,14 +58,16 @@ /** * Available groups list. * - * Contains following keys: - * - 'select': string, HTML code for select box; - * - 'descriptions': array, groups descriptions; - * - 'defaultDescription': string, description for group that - * selected by default. + * Contains objects with following keys: + * - 'id': int, group id; + * - 'name': string, group name; + * - 'description': string, group description; + * - 'online': boolean, indicates if group online; + * - 'selected': boolean, indicates if group selected + * by default. * * If there is no available groups this field is equal to null. - * @type Object + * @type Array * @todo Create HTML code at client side */ groups: null diff --git a/src/messenger/webim/libs/chat.php b/src/messenger/webim/libs/chat.php index 7228ab7b..55a05759 100644 --- a/src/messenger/webim/libs/chat.php +++ b/src/messenger/webim/libs/chat.php @@ -231,14 +231,8 @@ function setup_leavemessage($name, $email, $group_id, $info, $referrer) { ); if (Settings::get('enablegroups') == '1') { - $groups = setup_groups_select($group_id, false); - if ($groups) { - $data['leaveMessage']['leaveMessageForm']['groups'] = array( - 'select' => $groups['select'], - 'descriptions' => $groups['descriptions'], - 'defaultDescription' => $groups['defaultdescription'] - ); - } + $data['leaveMessage']['leaveMessageForm']['groups'] + = prepare_groups_select($group_id); } $data['startFrom'] = 'leaveMessage'; @@ -280,15 +274,8 @@ function setup_survey($name, $email, $group_id, $info, $referrer) { if (Settings::get('enablegroups') == '1' && Settings::get('surveyaskgroup') == '1') { - - $groups = setup_groups_select($group_id, true); - if ($groups) { - $data['survey']['surveyForm']['groups'] = array( - 'select' => $groups['select'], - 'descriptions' => $groups['descriptions'], - 'defaultDescription' => $groups['defaultdescription'], - ); - } + $data['survey']['surveyForm']['groups'] + = prepare_groups_select($group_id); } $data['startFrom'] = 'survey'; @@ -296,48 +283,81 @@ function setup_survey($name, $email, $group_id, $info, $referrer) { return $data; } -function setup_groups_select($groupid, $markoffline) -{ - $showgroups = ($groupid == '')?true:group_has_children($groupid); - if (!$showgroups) { +/** + * Prepare groups list to build group select box. + * + * If $group_id specified groups list will consist of group with id equals to + * $group_id and its children. + * + * @param int $group_id Id of selected group + * @return array|boolean Array of groups info arrays or boolean false if there + * are no suitable groups. + * Group info array contain following keys: + * - 'id': int, group id; + * - 'name': string, group name; + * - 'description': string, group description; + * - 'online': boolean, indicates if group online; + * - 'selected': boolean, indicates if group selected by default. + */ +function prepare_groups_select($group_id) { + $show_groups = ($group_id == '') + ? true + : group_has_children($group_id); + + if (!$show_groups) { return false; } - $allgroups = get_groups(false); + $all_groups = get_groups(false); - if (empty($allgroups)) { + if (empty($all_groups)) { return false; } - $val = ""; - $selectedgroupid = $groupid; - $groupdescriptions = array(); - $defaultdescription = ""; - foreach ($allgroups as $k) { - $groupname = $k['vclocalname']; - if ($k['inumofagents'] == 0 || ($groupid && $k['parent'] != $groupid && $k['groupid'] != $groupid )) { + $groups_list = array(); + $selected_group_id = $group_id; + + foreach($all_groups as $group) { + $group_is_empty = (bool)($group['inumofagents'] == 0); + $group_related_with_specified = (empty($group_id) + || $group['parent'] == $group_id + || $group['groupid'] == $group_id); + + if ($group_is_empty || !$group_related_with_specified) { continue; } - if ($k['ilastseen'] !== NULL && $k['ilastseen'] < Settings::get('online_timeout')) { - if (!$selectedgroupid) { - $selectedgroupid = $k['groupid']; // select first online group - } - } else { - $groupname .= $markoffline?" (offline)":""; + + if (group_is_online($group) && !$selected_group_id) { + $selected_group_id = $group['groupid']; } - $isselected = $k['groupid'] == $selectedgroupid; - if ($isselected) { - $defaultdescription = $k['vclocaldescription']; - } - $val .= ""; - $groupdescriptions[] = $k['vclocaldescription']; + + $groups_list[] = array( + 'id' => $group['groupid'], + 'name' => get_group_name($group), + 'description' => get_group_description($group), + 'online' => group_is_online($group), + 'selected' => (bool)($group['groupid'] == $selected_group_id) + ); } - return array( - 'select' => $val, - 'descriptions' => $groupdescriptions, - 'defaultdescription' => $defaultdescription - ); + // One group must be selected by default + if (! empty($groups_list)) { + // Check if there is selected group + $selected_group_present = false; + foreach($groups_list as $group) { + if ($group['selected']) { + $selected_group_present = true; + break; + } + } + + // If there is no selected group select the first one + if (! $selected_group_present) { + $groups_list[0]['selected'] = true; + } + } + + return $groups_list; } /** diff --git a/src/messenger/webim/styles/dialogs/default/handlebars_templates/leave_message/form.handlebars b/src/messenger/webim/styles/dialogs/default/handlebars_templates/leave_message/form.handlebars index cb12a115..e2fe15a8 100644 --- a/src/messenger/webim/styles/dialogs/default/handlebars_templates/leave_message/form.handlebars +++ b/src/messenger/webim/styles/dialogs/default/handlebars_templates/leave_message/form.handlebars @@ -18,11 +18,19 @@ {{#if groups}} {{L10n "form.field.department"}} - + + + {{L10n "form.field.department.description"}} - {{groups.defaultDescription}} + + {{#each groups}}{{#if this.selected}}{{this.description}}{{/if}}{{/each}} + {{/if}} diff --git a/src/messenger/webim/styles/dialogs/default/handlebars_templates/survey/form.handlebars b/src/messenger/webim/styles/dialogs/default/handlebars_templates/survey/form.handlebars index 47b43a5a..9a04eeac 100644 --- a/src/messenger/webim/styles/dialogs/default/handlebars_templates/survey/form.handlebars +++ b/src/messenger/webim/styles/dialogs/default/handlebars_templates/survey/form.handlebars @@ -13,11 +13,17 @@ {{#if groups}} {{L10n "form.field.department"}} - + + + {{L10n "form.field.department.description"}} - {{groups.defaultDescription}} + {{#each groups}}{{#if this.selected}}{{this.description}}{{/if}}{{/each}} {{/if}} diff --git a/src/messenger/webim/styles/dialogs/default/js/compiled/templates.js b/src/messenger/webim/styles/dialogs/default/js/compiled/templates.js index 0281befe..de671152 100644 --- a/src/messenger/webim/styles/dialogs/default/js/compiled/templates.js +++ b/src/messenger/webim/styles/dialogs/default/js/compiled/templates.js @@ -4,58 +4,60 @@ Copyright (c) 2005-2011 Mibew Messenger Community License: http://mibew.org/license.php */ -(function(){var r=Handlebars.template,s=Handlebars.templates=Handlebars.templates||{};s.chat_avatar=r(function(a,c,g,b,f){this.compilerInfo=[2,">= 1.0.0-rc.3"];g=g||a.helpers;f=f||{};var j=this.escapeExpression;return(a=g["if"].call(c,c.imageLink,{hash:{},inverse:this.program(3,function(){return'
'},f),fn:this.program(1,function(a,b){var f,c;f=''},f),data:f}))||0===a?a:""});s.chat_controls_close=r(function(a,c,g,b,f){this.compilerInfo=[2,">= 1.0.0-rc.3"];g=g||a.helpers;f=f||{};var j;a=g.helperMissing;b=this.escapeExpression;f={hash:{},data:f};return c='
')});s.chat_controls_history=r(function(a,c,g,b,f){this.compilerInfo=[2,">= 1.0.0-rc.3"];g=g||a.helpers;f=f||{};var j;a=g.helperMissing; -b=this.escapeExpression;f={hash:{},data:f};return c='
')});s.chat_controls_redirect=r(function(a,c,g,b,f){this.compilerInfo=[2,">= 1.0.0-rc.3"];g=g||a.helpers;f=f||{};var j,k=g.helperMissing,l=this.escapeExpression;return(a=g["if"].call(c,(j=c.user,null==j||!1===j?j:j.canPost),{hash:{},inverse:this.noop,fn:this.program(1,function(a,b){var c,f; -c={hash:{},data:b};return c='\n
\n')},f),data:f}))||0===a?a:""});s.chat_controls_refresh=r(function(a,c,g,b,f){this.compilerInfo=[2,">= 1.0.0-rc.3"];g=g||a.helpers;f=f||{};var j;a=g.helperMissing;b=this.escapeExpression;f={hash:{},data:f};return c='
')});s.chat_controls_secure_mode=r(function(){this.compilerInfo=[2,">= 1.0.0-rc.3"];return'
'});s.chat_controls_send_mail=r(function(a,c,g,b,f){this.compilerInfo=[2,">= 1.0.0-rc.3"];g=g||a.helpers;f=f||{};var j;a=g.helperMissing;b=this.escapeExpression;f={hash:{},data:f};return c='
')});s.chat_controls_sound=r(function(a,c,g,b,f){this.compilerInfo=[2,">= 1.0.0-rc.3"];g=g||a.helpers;f=f||{};var j=g.helperMissing,k=this.escapeExpression;return(a=g["if"].call(c,c.enabled,{hash:{},inverse:this.program(3,function(a,b){var c,f;c={hash:{},data:b};return c='\n
\n')},f),fn:this.program(1,function(a, -b){var c,f;c={hash:{},data:b};return c='\n
\n')},f),data:f}))||0===a?a:""});s.chat_controls_user_name=r(function(a,c,g,b,f){function j(a,c){var e,d,b;e=""+('\n
\n \n '}function k(a,b){var e,d,c;c={hash:{},data:b};e='\n '+h((d=(d=a.user,null==d||!1=== -d?d:d.name),typeof d===p?d.apply(a):d))+'\n \n '}this.compilerInfo=[2,">= 1.0.0-rc.3"];g=g||a.helpers;f=f||{};var l,p="function",h=this.escapeExpression,m=g.helperMissing,n=this;return(a=g["if"].call(c,(l=c.user,null==l||!1===l?l:l.canChangeName),{hash:{},inverse:n.program(6,function(a,c){var e,d; -e={hash:{},data:c};return e="\n"+(h((d=g.L10n,d?d.call(a,"chat.client.name",e):m.call(a,"L10n","chat.client.name",e)))+" "+h((d=(d=a.user,null==d||!1===d?d:d.name),typeof d===p?d.apply(a):d))+"\n")},f),fn:n.program(1,function(a,c){var e,d;e={hash:{},data:c};e='\n '+(h((d=g.L10n,d?d.call(a,"chat.client.name",e):m.call(a,"L10n","chat.client.name",e)))+"\n ");if((d=g["if"].call(a,a.nameInput,{hash:{},inverse:n.program(4,k,c),fn:n.program(2,j,c), -data:c}))||0===d)e+=d;return e+="\n"},f),data:f}))||0===a?a:""});s.chat_layout=r(function(a,c,g,b,f){function j(e){var d;return e=""+('\n \n ')}function k(e){var d;return e=""+("\n \n \n \n ')}function l(e){var d;return e=""+("\n \n \n \n ')}function p(e){var d;return e=""+('\n \n ')}this.compilerInfo=[2,">= 1.0.0-rc.3"];g=g||a.helpers;f=f||{};var h,m,n="function",q=this.escapeExpression,t=this;b=g.helperMissing; -a='\n
\n \n
\n\n\n
\n
\n \n
\n
\n
\n\n\n
\n
\n '; -if((m=g.unless.call(c,(h=c.user,null==h||!1===h?h:h.isAgent),{hash:{},inverse:t.noop,fn:t.program(11,function(){return'\n
\n '},f),data:f}))||0===m)a+=m;f={hash:{},data:f};return a=a+'\n \n
\n \n
\n
\n
\n\n\n
\n\n\n')});s.chat_message=r(function(a,c,g,b,f){this.compilerInfo=[2,">= 1.0.0-rc.3"];g=g||a.helpers;f=f||{};var j,k=this.escapeExpression,l=g.helperMissing;a={hash:{},data:f};a=""+(k((j=g.formatTime,j?j.call(c,c.created,a):l.call(c,"formatTime",c.created,a)))+" \n");if((j=g["if"].call(c,c.name,{hash:{},inverse:this.noop,fn:this.program(1,function(a, -c){var b,f;b="";(f=g.name)?f=f.call(a,{hash:{},data:c}):(f=a.name,f="function"===typeof f?f.apply(a):f);return b+=k(f)+": "},f),data:f}))||0===j)a+=j;a+="\n";if((j=g["if"].call(c,c.allowFormatting,{hash:{},inverse:this.program(5,function(a,c){var b, -f;f={hash:{},data:c};return k((b=g.apply,b?b.call(a,a.message,"urlReplace, nl2br",f):l.call(a,"apply",a.message,"urlReplace, nl2br",f)))},f),fn:this.program(3,function(a,c){var b,f;f={hash:{},data:c};return k((b=g.apply,b?b.call(a,a.message,"urlReplace, nl2br, allowTags",f):l.call(a,"apply",a.message,"urlReplace, nl2br, allowTags",f)))},f),data:f}))||0===j)a+=j;return a+="
"});s.chat_message_form=r(function(a,c,g,b,f){function j(a,c){var e,d;e={hash:{},data:c};e='\n \n "}function k(a){var c;return a=""+("\n \n ")}this.compilerInfo=[2,">= 1.0.0-rc.3"];g=g|| -a.helpers;f=f||{};var l,p="function",h=this.escapeExpression,m=g.helperMissing,n=this;a='
\n';if((b=g["if"].call(c,(l=c.user,null==l||!1===l?l:l.canPost),{hash:{},inverse:n.noop,fn:n.program(1,function(){return'\n
\n \n
\n'},f),data:f}))||0===b)a+=b;a+='\n
\n\n
\n';if((b=g["if"].call(c,(l=c.user, -null==l||!1===l?l:l.canPost),{hash:{},inverse:n.noop,fn:n.program(3,function(a,c){var e,d,b;e='\n
\n
\n ';if((b=g["if"].call(a,(d=a.user,null==d||!1===d?d:d.isAgent),{hash:{},inverse:n.noop,fn:n.program(4,j,c),data:c}))||0===b)e+=b;b={hash:{},data:c};e=e+'\n
\n ');b={hash:{},data:c};return e+=h((d=g.L10n,d?d.call(a,"chat.window.send_message_short_and_shortcut",b):m.call(a,"L10n","chat.window.send_message_short_and_shortcut",b)))+"\n
\n"},f),data:f}))||0===b)a+=b;return a+'\n
\n
'});s.chat_status_base=r(function(a,c,g,b,f){this.compilerInfo=[2,">= 1.0.0-rc.3"];g=g||a.helpers;f=f||{};a=this.escapeExpression;(g=g.title)?g=g.call(c,{hash:{},data:f}):(g=c.title,g="function"===typeof g?g.apply(c):g);return a(g)}); -s.chat_status_message=r(function(a,c,g,b,f){this.compilerInfo=[2,">= 1.0.0-rc.3"];g=g||a.helpers;f=f||{};a=this.escapeExpression;(g=g.message)?g=g.call(c,{hash:{},data:f}):(g=c.message,g="function"===typeof g?g.apply(c):g);return a(g)});s.chat_status_typing=r(function(a,c,g,b,f){this.compilerInfo=[2,">= 1.0.0-rc.3"];g=g||a.helpers;f=f||{};var j;a=g.helperMissing;b=this.escapeExpression;f={hash:{},data:f};return b((j=g.L10n,j?j.call(c,"typing.remote",f):a.call(c,"L10n","typing.remote",f)))});s.leave_message_description= -r(function(a,c,g,b,f){this.compilerInfo=[2,">= 1.0.0-rc.3"];g=g||a.helpers;f=f||{};var j,k=g.helperMissing,l=this.escapeExpression;b={hash:{},data:f};a='
\n \n ');b={hash:{},data:f};a+=
-l((j=g.L10n,j?j.call(c,\n \n
\n
';b={hash:{},data:f};return a+=l((j=g.L10n,j?j.call(c,"leavemessage.descr",b):k.call(c,"L10n","leavemessage.descr",b)))+"
"});s.leave_message_form=r(function(a,c,g,b,f){function j(a,c){var b,e;b=''}this.compilerInfo= -[2,">= 1.0.0-rc.3"];g=g||a.helpers;f=f||{};var k,l="function",p=this.escapeExpression,h=this,m=g.helperMissing;a=""+('
\n \n \n \n ';if((b=g.unless.call(c,c.groups,{hash:{},inverse:h.noop,fn:h.program(1,function(a,c){var b;return(b=g["if"].call(a,a.groupId,{hash:{},inverse:h.noop,fn:h.program(2,j,c),data:c}))||0===b?b:""},f),data:f}))||0===b)a+=b;b={hash:{},data:f};a=a+'\n\n
\n\n \n \n \n \n \n \n \n \n \n ';if((b=g["if"].call(c,c.groups,{hash:{},inverse:h.noop,fn:h.program(4,function(a,c){var b,e,d;d={hash:{},data:c};b='\n \n \n \n \n \n \n \n \n "},f),data:f}))|| -0===b)a+=b;a+="\n \n \n \n \n ";if((b=g["if"].call(c,c.showCaptcha,{hash:{},inverse:h.noop,fn:h.program(6, -function(){return'\n \n \n \n \n '},f),data:f}))||0===b)a+=b;a+='\n
'+(p((k=g.L10n,k?k.call(c, -"form.field.email",b):m.call(c,"L10n","form.field.email",b)))+':
';b={hash:{},data:f};a+=p((k=g.L10n,k?k.call(c,"form.field.name",b):m.call(c,"L10n","form.field.name",b)))+':
'+(p((e=g.L10n,e?e.call(a,"form.field.department",d):m.call(a,"L10n","form.field.department",d)))+'
';d={hash:{},data:c};return b+=p((e=g.L10n,e?e.call(a,"form.field.department.description",d):m.call(a,"L10n","form.field.department.description",d)))+''+p((e=(e=a.groups,null==e||!1===e?e:e.defaultDescription),typeof e===l?e.apply(a):e))+"
";b={hash:{},data:f};a+=p((k=g.L10n,k?k.call(c,"form.field.message",b):m.call(c,"L10n","form.field.message",b)))+':\n \n
\n ';b={hash:{},data:f};return a+=p((k=g.L10n,k?k.call(c,"mailthread.perform",b):m.call(c,"L10n","mailthread.perform",b)))+'\n
 
\n
'}); -s.leave_message_layout=r(function(a,c,g,b,f){function j(a){var e;return a=""+('\n \n ')}function k(a){var e;return a=""+("\n \n \n \n ')}function l(a){var e;return a=""+("\n \n \n \n ')}function p(a){var e;return a=""+('\n \n ')}this.compilerInfo=[2,">= 1.0.0-rc.3"];g=g||a.helpers;f=f||{};var h,m="function",n=this.escapeExpression,q=this;a='\n
\n \n
\n\n\n
\n
\n
\n
\n\n\n
'}); -s.leave_message_sent_description=r(function(a,c,g,b,f){this.compilerInfo=[2,">= 1.0.0-rc.3"];g=g||a.helpers;f=f||{};var j,k=g.helperMissing,l=this.escapeExpression;b={hash:{},data:f};a='
\n \n ');b={hash:{},data:f};a+=l((j=g.L10n,j?j.call(c,\n \n
\n
';b={hash:{},data:f};return a+=l((j=g.L10n,j?j.call(c,"leavemessage.sent.message",b):k.call(c,"L10n","leavemessage.sent.message",b)))+"
"});s.survey_form=r(function(a,c,g,b,f){function j(a,c){var b,e;b=''}this.compilerInfo=[2,">= 1.0.0-rc.3"];g=g||a.helpers;f=f||{};var k,l="function",p=this.escapeExpression,h=this,m=g.helperMissing;a=""+('
\n \n \n \n \n ';if((b=g.unless.call(c,c.showEmail,{hash:{},inverse:h.noop,fn:h.program(1,function(a,c){var b,e;b=''},f),data:f}))||0===b)a+=b;a+="\n "; -if((b=g.unless.call(c,c.groups,{hash:{},inverse:h.noop,fn:h.program(3,function(a,c){var b;return(b=g["if"].call(a,a.groupId,{hash:{},inverse:h.noop,fn:h.program(4,j,c),data:c}))||0===b?b:""},f),data:f}))||0===b)a+=b;a+="\n ";if((b=g.unless.call(c,c.showMessage,{hash:{},inverse:h.noop,fn:h.program(6,function(a,c){var b,e;b=''},f),data:f}))||0===b)a+= -b;a+='\n\n
\n\n \n ';if((b=g["if"].call(c,c.groups,{hash:{},inverse:h.noop,fn:h.program(8,function(a,b){var c,e,d;d={hash:{},data:b};c="\n \n \n \n \n \n \n \n \n "},f),data:f}))||0===b)a+=b;b={hash:{},data:f};a=a+"\n \n \n \n \n ";if((b=g["if"].call(c,c.showEmail,{hash:{},inverse:h.noop,fn:h.program(12,function(a,c){var b,e;b={hash:{},data:c};b="\n \n \n \n \n '},f),data:f}))||0===b)a+=b;a+="\n ";if((b=g["if"].call(c,c.showMessage,{hash:{},inverse:h.noop,fn:h.program(14,function(a,c){var b,e;b={hash:{},data:c};b="\n \n \n \n \n "},f),data:f}))||0===b)a+=b;a+='\n
"+(p((e=g.L10n,e?e.call(a,"form.field.department",d):m.call(a,"L10n","form.field.department",d)))+'
"; -d={hash:{},data:b};return c+=p((e=g.L10n,e?e.call(a,"form.field.department.description",d):m.call(a,"L10n","form.field.department.description",d)))+''+p((e=(e=a.groups,null==e||!1===e?e:e.defaultDescription),typeof e===l?e.apply(a):e))+"
"+(p((k=g.L10n,k?k.call(c,"presurvey.name",b):m.call(c,"L10n","presurvey.name",b)))+'
"+(p((e=g.L10n,e?e.call(a,"presurvey.mail",b):m.call(a,"L10n", -"presurvey.mail",b)))+'
"+(p((e=g.L10n,e?e.call(a,"presurvey.question",b):m.call(a, -"L10n","presurvey.question",b)))+'
\n ';b={hash:{},data:f};return a+=p((k=g.L10n,k?k.call(c,"presurvey.submit",b):m.call(c,"L10n","presurvey.submit", -b)))+'\n
 
\n
'});s.survey_layout=r(function(a,c,g,b,f){function j(a){var d;return a=""+('\n \n ')}function k(a){var d;return a=""+("\n \n \n \n ')}function l(a){var d;return a=""+("\n \n \n \n ')}function p(a){var d;return a=""+('\n \n ')}this.compilerInfo=[2,">= 1.0.0-rc.3"];g=g||a.helpers;f=f||{};var h,m,n="function",q=this.escapeExpression,r=this;b=g.helperMissing; -a='\n
\n \n
\n\n\n
\n
\n
\n ';m={hash:{},data:f};a+=q((h=g.L10n,h?h.call(c,\n
\n
';m={hash:{},data:f};return a+=q((h=g.L10n,h?h.call(c,"presurvey.intro",m):b.call(c, -"L10n","presurvey.intro",m)))+'
\n
\n
\n\n\n
'})})(); +(function(){var r=Handlebars.template,s=Handlebars.templates=Handlebars.templates||{};s.chat_avatar=r(function(b,c,f,a,d){this.compilerInfo=[2,">= 1.0.0-rc.3"];f=f||b.helpers;d=d||{};var g=this.escapeExpression;return(b=f["if"].call(c,c.imageLink,{hash:{},inverse:this.program(3,function(){return'
'},d),fn:this.program(1,function(b,a){var d,c;d=''},d),data:d}))||0===b?b:""});s.chat_controls_close=r(function(b,c,f,a,d){this.compilerInfo=[2,">= 1.0.0-rc.3"];f=f||b.helpers;d=d||{};var g;b=f.helperMissing;a=this.escapeExpression;d={hash:{},data:d};return c='
')});s.chat_controls_history=r(function(b,c,f,a,d){this.compilerInfo=[2,">= 1.0.0-rc.3"];f=f||b.helpers;d=d||{};var g;b=f.helperMissing; +a=this.escapeExpression;d={hash:{},data:d};return c='
')});s.chat_controls_redirect=r(function(b,c,f,a,d){this.compilerInfo=[2,">= 1.0.0-rc.3"];f=f||b.helpers;d=d||{};var g,q=f.helperMissing,p=this.escapeExpression;return(b=f["if"].call(c,(g=c.user,null==g||!1===g?g:g.canPost),{hash:{},inverse:this.noop,fn:this.program(1,function(b,a){var c,d; +c={hash:{},data:a};return c='\n
\n')},d),data:d}))||0===b?b:""});s.chat_controls_refresh=r(function(b,c,f,a,d){this.compilerInfo=[2,">= 1.0.0-rc.3"];f=f||b.helpers;d=d||{};var g;b=f.helperMissing;a=this.escapeExpression;d={hash:{},data:d};return c='
')});s.chat_controls_secure_mode=r(function(){this.compilerInfo=[2,">= 1.0.0-rc.3"];return'
'});s.chat_controls_send_mail=r(function(b,c,f,a,d){this.compilerInfo=[2,">= 1.0.0-rc.3"];f=f||b.helpers;d=d||{};var g;b=f.helperMissing;a=this.escapeExpression;d={hash:{},data:d};return c='
')});s.chat_controls_sound=r(function(b,c,f,a,d){this.compilerInfo=[2,">= 1.0.0-rc.3"];f=f||b.helpers;d=d||{};var g=f.helperMissing,q=this.escapeExpression;return(b=f["if"].call(c,c.enabled,{hash:{},inverse:this.program(3,function(b,a){var c,d;c={hash:{},data:a};return c='\n
\n')},d),fn:this.program(1,function(b, +a){var c,d;c={hash:{},data:a};return c='\n
\n')},d),data:d}))||0===b?b:""});s.chat_controls_user_name=r(function(b,c,f,a,d){function g(b,c){var j,e,a;j=""+('\n
\n \n '}function q(b,a){var j,e,c;c={hash:{},data:a};j='\n '+h((e=(e=b.user,null==e||!1=== +e?e:e.name),typeof e===t?e.apply(b):e))+'\n \n '}this.compilerInfo=[2,">= 1.0.0-rc.3"];f=f||b.helpers;d=d||{};var p,t="function",h=this.escapeExpression,l=f.helperMissing,k=this;return(b=f["if"].call(c,(p=c.user,null==p||!1===p?p:p.canChangeName),{hash:{},inverse:k.program(6,function(b,c){var j,e; +j={hash:{},data:c};return j="\n"+(h((e=f.L10n,e?e.call(b,"chat.client.name",j):l.call(b,"L10n","chat.client.name",j)))+" "+h((e=(e=b.user,null==e||!1===e?e:e.name),typeof e===t?e.apply(b):e))+"\n")},d),fn:k.program(1,function(b,c){var j,e;j={hash:{},data:c};j='\n '+(h((e=f.L10n,e?e.call(b,"chat.client.name",j):l.call(b,"L10n","chat.client.name",j)))+"\n ");if((e=f["if"].call(b,b.nameInput,{hash:{},inverse:k.program(4,q,c),fn:k.program(2,g,c), +data:c}))||0===e)j+=e;return j+="\n"},d),data:d}))||0===b?b:""});s.chat_layout=r(function(b,c,f,a,d){function g(j){var e;return j=""+('\n \n ')}function q(j){var e;return j=""+("\n \n \n \n ')}function p(j){var e;return j=""+("\n \n \n \n ')}function t(j){var e;return j=""+('\n \n ')}this.compilerInfo=[2,">= 1.0.0-rc.3"];f=f||b.helpers;d=d||{};var h,l,k="function",m=this.escapeExpression,n=this;a=f.helperMissing; +b='\n
\n \n
\n\n\n
\n
\n \n
\n
\n
\n\n\n
\n
\n '; +if((l=f.unless.call(c,(h=c.user,null==h||!1===h?h:h.isAgent),{hash:{},inverse:n.noop,fn:n.program(11,function(){return'\n
\n '},d),data:d}))||0===l)b+=l;d={hash:{},data:d};return b=b+'\n \n
\n \n
\n
\n
\n\n\n
\n\n\n')});s.chat_message=r(function(b,c,f,a,d){this.compilerInfo=[2,">= 1.0.0-rc.3"];f=f||b.helpers;d=d||{};var g,q=this.escapeExpression,p=f.helperMissing;b={hash:{},data:d};b=""+(q((g=f.formatTime,g?g.call(c,c.created,b):p.call(c,"formatTime",c.created,b)))+" \n");if((g=f["if"].call(c,c.name,{hash:{},inverse:this.noop,fn:this.program(1,function(b, +c){var a,d;a="";(d=f.name)?d=d.call(b,{hash:{},data:c}):(d=b.name,d="function"===typeof d?d.apply(b):d);return a+=q(d)+": "},d),data:d}))||0===g)b+=g;b+="\n";if((g=f["if"].call(c,c.allowFormatting,{hash:{},inverse:this.program(5,function(b,c){var a, +d;d={hash:{},data:c};return q((a=f.apply,a?a.call(b,b.message,"urlReplace, nl2br",d):p.call(b,"apply",b.message,"urlReplace, nl2br",d)))},d),fn:this.program(3,function(b,c){var a,d;d={hash:{},data:c};return q((a=f.apply,a?a.call(b,b.message,"urlReplace, nl2br, allowTags",d):p.call(b,"apply",b.message,"urlReplace, nl2br, allowTags",d)))},d),data:d}))||0===g)b+=g;return b+="
"});s.chat_message_form=r(function(b,c,f,a,d){function g(b,c){var j,e;j={hash:{},data:c};j='\n \n "}function q(b){var c;return b=""+("\n \n ")}this.compilerInfo=[2,">= 1.0.0-rc.3"];f=f|| +b.helpers;d=d||{};var p,r="function",h=this.escapeExpression,l=f.helperMissing,k=this;b='
\n';if((a=f["if"].call(c,(p=c.user,null==p||!1===p?p:p.canPost),{hash:{},inverse:k.noop,fn:k.program(1,function(){return'\n
\n \n
\n'},d),data:d}))||0===a)b+=a;b+='\n
\n\n
\n';if((a=f["if"].call(c,(p=c.user, +null==p||!1===p?p:p.canPost),{hash:{},inverse:k.noop,fn:k.program(3,function(b,c){var j,e,a;j='\n
\n
\n ';if((a=f["if"].call(b,(e=b.user,null==e||!1===e?e:e.isAgent),{hash:{},inverse:k.noop,fn:k.program(4,g,c),data:c}))||0===a)j+=a;a={hash:{},data:c};j=j+'\n
\n ');a={hash:{},data:c};return j+=h((e=f.L10n,e?e.call(b,"chat.window.send_message_short_and_shortcut",a):l.call(b,"L10n","chat.window.send_message_short_and_shortcut",a)))+"\n
\n"},d),data:d}))||0===a)b+=a;return b+'\n
\n
'});s.chat_status_base=r(function(b,c,f,a,d){this.compilerInfo=[2,">= 1.0.0-rc.3"];f=f||b.helpers;d=d||{};b=this.escapeExpression;(f=f.title)?f=f.call(c,{hash:{},data:d}):(f=c.title,f="function"===typeof f?f.apply(c):f);return b(f)}); +s.chat_status_message=r(function(b,c,f,a,d){this.compilerInfo=[2,">= 1.0.0-rc.3"];f=f||b.helpers;d=d||{};b=this.escapeExpression;(f=f.message)?f=f.call(c,{hash:{},data:d}):(f=c.message,f="function"===typeof f?f.apply(c):f);return b(f)});s.chat_status_typing=r(function(b,c,f,a,d){this.compilerInfo=[2,">= 1.0.0-rc.3"];f=f||b.helpers;d=d||{};var g;b=f.helperMissing;a=this.escapeExpression;d={hash:{},data:d};return a((g=f.L10n,g?g.call(c,"typing.remote",d):b.call(c,"L10n","typing.remote",d)))});s.leave_message_description= +r(function(b,c,f,a,d){this.compilerInfo=[2,">= 1.0.0-rc.3"];f=f||b.helpers;d=d||{};var g,q=f.helperMissing,p=this.escapeExpression;a={hash:{},data:d};b='
\n \n ');a={hash:{},data:d};b+=
+p((g=f.L10n,g?g.call(c,\n \n
\n
';a={hash:{},data:d};return b+=p((g=f.L10n,g?g.call(c,"leavemessage.descr",a):q.call(c,"L10n","leavemessage.descr",a)))+"
"});s.leave_message_form=r(function(b,c,f,a,d){function g(e,b){var c,a;c=''}function q(e, +b){var c,a,j;c=""+('\n \n "}function p(){return'selected="selected"'} +function r(){return" (offline)"}function h(b,a){var e;return(e=f["if"].call(b,b.selected,{hash:{},inverse:j.noop,fn:j.program(15,l,a),data:a}))||0===e?e:""}function l(b){var a;return n((a=b.description,typeof a===m?a.apply(b):a))}this.compilerInfo=[2,">= 1.0.0-rc.3"];f=f||b.helpers;d=d||{};var k,m="function",n=this.escapeExpression,j=this,e=f.helperMissing;b=""+('
\n \n \n \n \n ';if((a=f.unless.call(c,c.showEmail,{hash:{},inverse:j.noop,fn:j.program(1,function(b,a){var e,c;e=''},d),data:d}))||0===a)b+=a;b+="\n ";if((a=f.unless.call(c,c.groups,{hash:{},inverse:j.noop,fn:j.program(3,function(b,a){var e;return(e=f["if"].call(b,b.groupId,{hash:{},inverse:j.noop,fn:j.program(4,g,a),data:a}))||0===e?e:""},d),data:d}))||0===a)b+=a;b+="\n ";if((a=f.unless.call(c,c.showMessage,{hash:{},inverse:j.noop,fn:j.program(6,function(b,a){var e,c;e=''},d),data:d}))||0===a)b+=a;b+='\n\n
\n\n \n ';if((a=f["if"].call(c,c.groups,{hash:{},inverse:j.noop,fn:j.program(8,function(b,a){var c,d,g;g={hash:{},data:a};c="\n \n \n \n \n \n \n \n \n "},d),data:d}))||0===a)b+=a;a={hash:{},data:d};b=b+"\n \n \n \n \n ";if((a=f["if"].call(c,c.showEmail,{hash:{},inverse:j.noop,fn:j.program(19,function(b,a){var c,d;c={hash:{},data:a};c="\n \n \n \n \n '}, +d),data:d}))||0===a)b+=a;b+="\n ";if((a=f["if"].call(c,c.showMessage,{hash:{},inverse:j.noop,fn:j.program(21,function(b,a){var c,d;c={hash:{},data:a};c="\n \n \n \n \n "}, +d),data:d}))||0===a)b+=a;b+='\n
"+(n((d=f.L10n,d?d.call(b,"form.field.department",g):e.call(b,"L10n","form.field.department",g)))+'\n \n
";g={hash:{},data:a};c+=n((d=f.L10n,d?d.call(b,"form.field.department.description",g):e.call(b,"L10n","form.field.department.description",g)))+'';if((g=f.each.call(b,b.groups,{hash:{},inverse:j.noop,fn:j.program(14,h,a),data:a}))||0===g)c+=g;return c+= +"
"+(n((k=f.L10n,k?k.call(c,"presurvey.name",a):e.call(c,"L10n","presurvey.name",a)))+'
"+(n((d=f.L10n,d?d.call(b,"presurvey.mail",c):e.call(b,"L10n","presurvey.mail",c)))+'
"+(n((d=f.L10n,d?d.call(b,"presurvey.question",c):e.call(b,"L10n","presurvey.question",c)))+'
\n ';a={hash:{},data:d};return b+=n((k=f.L10n,k?k.call(c,"presurvey.submit",a):e.call(c,"L10n","presurvey.submit",a)))+'\n
 
\n
'});s.survey_layout=r(function(b,c,f,a,d){function g(b){var a;return b=""+('\n \n ')} +function q(b){var a;return b=""+("\n \n \n \n ')}function p(a){var b;return a=""+("\n \n \n \n ')}function r(b){var a;return b=""+('\n \n ')} +this.compilerInfo=[2,">= 1.0.0-rc.3"];f=f||b.helpers;d=d||{};var h,l,k="function",m=this.escapeExpression,n=this;a=f.helperMissing;b='\n
\n \n
\n\n\n
\n
\n
\n ';l={hash:{},data:d};b+=m((h=f.L10n,h?h.call(c,\n
\n
';l={hash:{},data:d};return b+=m((h=f.L10n,h?h.call(c,"presurvey.intro",l):a.call(c, +"L10n","presurvey.intro",l)))+'
\n
\n
\n\n\n
'})})();