mirror of
https://github.com/Mibew/java.git
synced 2025-01-22 17:40:35 +03:00
Update Chat JavaScript Application
Make prechat survey and leave message parts of the Chat JavaScript Application
This commit is contained in:
parent
9436b486f9
commit
a570ed75d0
@ -47,8 +47,6 @@ if (get_remote_level($_SERVER['HTTP_USER_AGENT']) == 'old') {
|
||||
exit;
|
||||
}
|
||||
|
||||
$page = array();
|
||||
|
||||
if( !isset($_GET['token']) || !isset($_GET['thread']) ) {
|
||||
|
||||
$thread = NULL;
|
||||
@ -57,6 +55,8 @@ if( !isset($_GET['token']) || !isset($_GET['thread']) ) {
|
||||
}
|
||||
|
||||
if( !$thread ) {
|
||||
|
||||
// Load group info
|
||||
$groupid = "";
|
||||
$groupname = "";
|
||||
$group = NULL;
|
||||
@ -72,102 +72,58 @@ if( !isset($_GET['token']) || !isset($_GET['thread']) ) {
|
||||
}
|
||||
}
|
||||
|
||||
// Get visitor info
|
||||
$visitor = visitor_from_request();
|
||||
|
||||
if(isset($_POST['survey']) && $_POST['survey'] == 'on') {
|
||||
$firstmessage = getparam("message");
|
||||
$info = getparam("info");
|
||||
$email = getparam("email");
|
||||
$referrer = urldecode(getparam("referrer"));
|
||||
|
||||
if(Settings::get('usercanchangename') == "1" && isset($_POST['name'])) {
|
||||
$newname = getparam("name");
|
||||
if($newname != $visitor['name']) {
|
||||
$data = strtr(base64_encode(myiconv($webim_encoding,"utf-8",$newname)), '+/=', '-_,');
|
||||
setcookie($namecookie, $data, time()+60*60*24*365);
|
||||
$visitor['name'] = $newname;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$firstmessage = NULL;
|
||||
$info = getgetparam('info');
|
||||
$email = getgetparam('email');
|
||||
$referrer = isset($_GET['url']) ? $_GET['url'] :
|
||||
(isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : "");
|
||||
|
||||
// Get referrer
|
||||
$referrer = isset($_GET['url'])
|
||||
? $_GET['url']
|
||||
: (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : "");
|
||||
|
||||
if(isset($_GET['referrer']) && $_GET['referrer']) {
|
||||
$referrer .= "\n".$_GET['referrer'];
|
||||
}
|
||||
}
|
||||
|
||||
// Check if there are online operators
|
||||
if(!has_online_operators($groupid)) {
|
||||
// Create page array
|
||||
// Display leave message page
|
||||
$page = array_merge_recursive(
|
||||
setup_logo($group),
|
||||
setup_leavemessage($visitor['name'],$email,$firstmessage,$groupid,$groupname,$info,$referrer)
|
||||
setup_leavemessage(
|
||||
$visitor['name'],
|
||||
$email,
|
||||
$groupid,
|
||||
$info,
|
||||
$referrer
|
||||
)
|
||||
);
|
||||
expand("styles/dialogs", getchatstyle(), "leavemessage.tpl");
|
||||
$page['leaveMessageOptions'] = json_encode($page['leaveMessage']);
|
||||
expand("styles/dialogs", getchatstyle(), "chat.tpl");
|
||||
exit;
|
||||
}
|
||||
|
||||
// Get invitation info
|
||||
$invitation_state = invitation_state($_SESSION['visitorid']);
|
||||
$visitor_is_invited = Settings::get('enabletracking') && $invitation_state['invited'] && !$invitation_state['threadid'];
|
||||
if(Settings::get('enablepresurvey') == '1' && !(isset($_POST['survey']) && $_POST['survey'] == 'on') && !$visitor_is_invited) {
|
||||
// Create page array
|
||||
$visitor_is_invited = Settings::get('enabletracking')
|
||||
&& $invitation_state['invited']
|
||||
&& !$invitation_state['threadid'];
|
||||
|
||||
// Check if survey should be displayed
|
||||
if(Settings::get('enablepresurvey') == '1' && !$visitor_is_invited) {
|
||||
// Display prechat survey
|
||||
$page = array_merge_recursive(
|
||||
setup_logo($group),
|
||||
setup_survey($visitor['name'], $email, $groupid, $info, $referrer)
|
||||
);
|
||||
expand("styles/dialogs", getchatstyle(), "survey.tpl");
|
||||
$page['surveyOptions'] = json_encode($page['survey']);
|
||||
expand("styles/dialogs", getchatstyle(), "chat.tpl");
|
||||
exit;
|
||||
}
|
||||
|
||||
$remoteHost = get_remote_host();
|
||||
$userbrowser = $_SERVER['HTTP_USER_AGENT'];
|
||||
|
||||
if(Thread::connectionLimitReached($remoteHost)) {
|
||||
die("number of connections from your IP is exceeded, try again later");
|
||||
}
|
||||
$thread = Thread::create();
|
||||
$thread->groupId = $groupid;
|
||||
$thread->userName = $visitor['name'];
|
||||
$thread->remote = $remoteHost;
|
||||
$thread->referer = $referrer;
|
||||
$thread->locale = $current_locale;
|
||||
$thread->userId = $visitor['id'];
|
||||
$thread->userAgent = $userbrowser;
|
||||
$thread->state = Thread::STATE_LOADING;
|
||||
$thread->save();
|
||||
|
||||
$_SESSION['threadid'] = $thread->id;
|
||||
|
||||
$operator = invitation_accept($_SESSION['visitorid'], $thread->id);
|
||||
if ($operator) {
|
||||
$operator = operator_by_id($operator);
|
||||
$operatorName = ($current_locale == $home_locale) ? $operator['vclocalename'] : $operator['vccommonname'];
|
||||
$thread->postMessage(
|
||||
Thread::KIND_FOR_AGENT,
|
||||
getstring2('chat.visitor.invitation.accepted', array($operatorName))
|
||||
);
|
||||
}
|
||||
|
||||
if( $referrer ) {
|
||||
$thread->postMessage(
|
||||
Thread::KIND_FOR_AGENT,
|
||||
getstring2('chat.came.from',array($referrer))
|
||||
);
|
||||
}
|
||||
$thread->postMessage(Thread::KIND_INFO, getstring('chat.wait'));
|
||||
if($email) {
|
||||
$thread->postMessage(Thread::KIND_FOR_AGENT, getstring2('chat.visitor.email',array($email)));
|
||||
}
|
||||
if($info) {
|
||||
$thread->postMessage(Thread::KIND_FOR_AGENT, getstring2('chat.visitor.info',array($info)));
|
||||
}
|
||||
if($firstmessage) {
|
||||
$postedid = $thread->postMessage(Thread::KIND_USER, $firstmessage, $visitor['name']);
|
||||
$thread->shownMessageId = $postedid;
|
||||
$thread->save();
|
||||
}
|
||||
// Start chat thread
|
||||
$thread = chat_start_for_user($groupid, $visitor['id'], $visitor['name'], $referrer, $info);
|
||||
}
|
||||
$threadid = $thread->id;
|
||||
$token = $thread->lastToken;
|
||||
@ -184,21 +140,14 @@ if (! $thread) {
|
||||
die("wrong thread");
|
||||
}
|
||||
|
||||
$page = array_merge_recursive(
|
||||
$page,
|
||||
setup_chatview_for_user($thread)
|
||||
);
|
||||
$page = setup_chatview_for_user($thread);
|
||||
|
||||
$pparam = verifyparam( "act", "/^(mailthread)$/", "default");
|
||||
if( $pparam == "mailthread" ) {
|
||||
expand("styles/dialogs", getchatstyle(), "mail.tpl");
|
||||
} else {
|
||||
// Load JavaScript plugins and JavaScripts, CSS files required by them
|
||||
$page['additional_css'] = get_additional_css('client_chat_window');
|
||||
$page['additional_js'] = get_additional_js('client_chat_window');
|
||||
$page['js_plugin_options'] = get_js_plugin_options('client_chat_window');
|
||||
// Build js application options
|
||||
$page['chatModule'] = json_encode($page['chat']);
|
||||
$page['chatOptions'] = json_encode($page['chat']);
|
||||
// Expand page
|
||||
expand("styles/dialogs", getchatstyle(), "chat.tpl");
|
||||
}
|
||||
|
@ -5,4 +5,5 @@
|
||||
Copyright (c) 2005-2011 Mibew Messenger Community
|
||||
License: http://mibew.org/license.php
|
||||
*/
|
||||
(function(a,d){var b=a.Application;b.addRegions({mainRegion:"#main-region"});b.addInitializer(function(c){a.Objects.server=new a.Server(d.extend({interactionType:MibewAPIChatInteraction},c.server));b.Chat.start(c)});b.on("start",function(){a.Objects.server.runUpdater()})})(Mibew,_);
|
||||
(function(a,d){var b=a.Application;b.addRegions({mainRegion:"#main-region"});b.addInitializer(function(c){a.Objects.server=new a.Server(d.extend({interactionType:MibewAPIChatInteraction},c.server));a.Objects.Models.page=new a.Models.Page(c.page);switch(c.startFrom){case "chat":b.Chat.start(c.chatOptions);break;case "survey":b.Survey.start(c.surveyOptions);break;case "leaveMessage":b.LeaveMessage.start(c.leaveMessageOptions);break;default:throw Error("Dont know how to start!");}});b.on("start",function(){a.Objects.server.runUpdater()})})(Mibew,
|
||||
_);
|
||||
|
@ -5,4 +5,4 @@
|
||||
Copyright (c) 2005-2011 Mibew Messenger Community
|
||||
License: http://mibew.org/license.php
|
||||
*/
|
||||
(function(a,b){a.Layouts.Chat=b.Marionette.Layout.extend({template:Handlebars.templates.chat_layout,regions:{controlsRegion:"#controls-region",avatarRegion:"#avatar-region",messagesRegion:{selector:"#messages-region",regionType:a.Regions.Messages},statusRegion:"#status-region",messageFormRegion:"#message-form-region",soundRegion:"#sound-region"},serializeData:function(){return{user:a.Objects.Models.user.toJSON()}}})})(Mibew,Backbone);
|
||||
(function(a,c){a.Layouts.Chat=c.Marionette.Layout.extend({template:Handlebars.templates.chat_layout,regions:{controlsRegion:"#controls-region",avatarRegion:"#avatar-region",messagesRegion:{selector:"#messages-region",regionType:a.Regions.Messages},statusRegion:"#status-region",messageFormRegion:"#message-form-region",soundRegion:"#sound-region"},serializeData:function(){var b=a.Objects.Models;return{page:b.page.toJSON(),user:b.user.toJSON()}}})})(Mibew,Backbone);
|
||||
|
@ -0,0 +1,8 @@
|
||||
/*
|
||||
This file is part of Mibew Messenger project.
|
||||
http://mibew.org
|
||||
|
||||
Copyright (c) 2005-2011 Mibew Messenger Community
|
||||
License: http://mibew.org/license.php
|
||||
*/
|
||||
(function(a,b){a.Layouts.LeaveMessage=b.Marionette.Layout.extend({template:Handlebars.templates.leave_message_layout,regions:{leaveMessageFormRegion:"#content-wrapper",descriptionRegion:"#description-region"},serializeData:function(){return{page:a.Objects.Models.page.toJSON()}}})})(Mibew,Backbone);
|
8
src/messenger/webim/js/compiled/chat/layouts/survey.js
Normal file
8
src/messenger/webim/js/compiled/chat/layouts/survey.js
Normal file
@ -0,0 +1,8 @@
|
||||
/*
|
||||
This file is part of Mibew Messenger project.
|
||||
http://mibew.org
|
||||
|
||||
Copyright (c) 2005-2011 Mibew Messenger Community
|
||||
License: http://mibew.org/license.php
|
||||
*/
|
||||
(function(a,b){a.Layouts.Survey=b.Marionette.Layout.extend({template:Handlebars.templates.survey_layout,regions:{surveyFormRegion:"#content-wrapper"},serializeData:function(){return{page:a.Objects.Models.page.toJSON()}}})})(Mibew,Backbone);
|
@ -0,0 +1,8 @@
|
||||
/*
|
||||
This file is part of Mibew Messenger project.
|
||||
http://mibew.org
|
||||
|
||||
Copyright (c) 2005-2011 Mibew Messenger Community
|
||||
License: http://mibew.org/license.php
|
||||
*/
|
||||
(function(a,b,c){a.Views.LeaveMessageDescription=b.Marionette.ItemView.extend({template:c.templates.leave_message_description,serializeData:function(){return{page:a.Objects.Models.page.toJSON()}}})})(Mibew,Backbone,Handlebars);
|
@ -0,0 +1,9 @@
|
||||
/*
|
||||
This file is part of Mibew Messenger project.
|
||||
http://mibew.org
|
||||
|
||||
Copyright (c) 2005-2011 Mibew Messenger Community
|
||||
License: http://mibew.org/license.php
|
||||
*/
|
||||
(function(d,e,b){var c=d.Views.BaseSurveyForm;d.Views.LeaveMessageForm=c.extend({template:e.templates.leave_message_form,events:b.extend({},c.prototype.events,{"click #send-message":"submitForm"}),ui:b.extend({},c.prototype.ui,{captcha:'input[name="captcha"]',captchaImg:"#captcha-img"}),modelEvents:b.extend({},c.prototype.modelEvents,{"submit:error":"showError submitError"}),submitForm:function(){var a={};this.model.get("groups")&&(a.groupId=this.ui.groupSelect.val());a.name=this.ui.name.val()||"";
|
||||
a.email=this.ui.email.val()||"";a.message=this.ui.message.val()||"";this.model.get("showCaptcha")&&(a.captcha=this.ui.captcha.val()||"");this.model.set(a,{validate:!0});this.model.submit()},submitError:function(a,c){if(c.code==a.ERROR_WRONG_CAPTCHA&&a.get("showCaptcha")){var b=this.ui.captchaImg.attr("src"),b=b.replace(/\?d\=[0-9]+/,"");this.ui.captchaImg.attr("src",b+"?d="+(new Date).getTime())}}})})(Mibew,Handlebars,_);
|
@ -0,0 +1,8 @@
|
||||
/*
|
||||
This file is part of Mibew Messenger project.
|
||||
http://mibew.org
|
||||
|
||||
Copyright (c) 2005-2011 Mibew Messenger Community
|
||||
License: http://mibew.org/license.php
|
||||
*/
|
||||
(function(a,b,c){a.Views.LeaveMessageSentDescription=b.Marionette.ItemView.extend({template:c.templates.leave_message_sent_description,serializeData:function(){return{page:a.Objects.Models.page.toJSON()}}})})(Mibew,Backbone,Handlebars);
|
@ -0,0 +1,9 @@
|
||||
/*
|
||||
This file is part of Mibew Messenger project.
|
||||
http://mibew.org
|
||||
|
||||
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);
|
@ -0,0 +1,9 @@
|
||||
/*
|
||||
This file is part of Mibew Messenger project.
|
||||
http://mibew.org
|
||||
|
||||
Copyright (c) 2005-2011 Mibew Messenger Community
|
||||
License: http://mibew.org/license.php
|
||||
*/
|
||||
(function(b,d,e){var c=b.Views.BaseSurveyForm;b.Views.SurveyForm=c.extend({template:d.templates.survey_form,events:e.extend({},c.prototype.events,{"click #submit-survey":"submitForm"}),submitForm:function(){var a={};this.model.get("groups")&&(a.groupId=this.ui.groupSelect.val());this.model.get("canChangeName")&&(a.name=this.ui.name.val()||"");this.model.get("showEmail")&&(a.email=this.ui.email.val()||"");this.model.get("showMessage")&&(a.message=this.ui.message.val()||"");this.model.set(a,{validate:!0});
|
||||
this.model.submit()}})})(Mibew,Handlebars,_);
|
@ -0,0 +1,10 @@
|
||||
/*
|
||||
This file is part of Mibew Messenger project.
|
||||
http://mibew.org
|
||||
|
||||
Copyright (c) 2005-2011 Mibew Messenger Community
|
||||
License: http://mibew.org/license.php
|
||||
*/
|
||||
(function(c,e){var d=c.Models.BaseSurveyForm;c.Models.LeaveMessageForm=d.extend({defaults:e.extend({},d.prototype.defaults,{showCaptcha:!1,captcha:""}),validate:function(a){var b=c.Localization;if("undefined"!=typeof a.email){if(!a.email)return b.get("leavemessage.error.email.required");if(!c.Utils.checkEmail(a.email))return b.get("leavemessage.error.wrong.email")}if("undefined"!=typeof a.name&&!a.name)return b.get("leavemessage.error.name.required");if("undefined"!=typeof a.message&&!a.message)return b.get("leavemessage.error.message.required");
|
||||
if(this.get("showCaptcha")&&"undefined"!=typeof a.captcha&&!a.captcha)return b.get("errors.captcha")},submit:function(){if(!this.validate(this.attributes)){var a=this;c.Objects.server.callFunctions([{"function":"processLeaveMessage",arguments:{references:{},"return":{},groupId:a.get("groupId"),name:a.get("name"),info:a.get("info"),email:a.get("email"),message:a.get("message"),referrer:a.get("referrer"),captcha:a.get("captcha"),threadId:null,token:null}}],function(b){0==b.errorCode?a.trigger("submit:complete",
|
||||
a):a.trigger("submit:error",a,{code:b.errorCode,message:b.errorMessage||""})},!0)}},ERROR_WRONG_CAPTCHA:10})})(Mibew,_);
|
@ -5,4 +5,4 @@
|
||||
Copyright (c) 2005-2011 Mibew Messenger Community
|
||||
License: http://mibew.org/license.php
|
||||
*/
|
||||
EventHelper.register(window,"onload",function(){MessageForm=new ClientForm(document.leaveMessageForm)});
|
||||
(function(a){a.Models.BaseSurveyForm=a.Models.Base.extend({defaults:{name:"",email:"",message:"",info:"",referrer:"",groupId:null,groups:null}})})(Mibew);
|
@ -0,0 +1,10 @@
|
||||
/*
|
||||
This file is part of Mibew Messenger project.
|
||||
http://mibew.org
|
||||
|
||||
Copyright (c) 2005-2011 Mibew Messenger Community
|
||||
License: http://mibew.org/license.php
|
||||
*/
|
||||
(function(b,e){var d=b.Models.BaseSurveyForm;b.Models.SurveyForm=d.extend({defaults:e.extend({},d.prototype.defaults,{showEmail:!1,showMessage:!1,canChangeName:!1}),validate:function(a){if(this.get("showEmail")&&"undefined"!=typeof a.email&&!b.Utils.checkEmail(a.email))return b.Localization.get("presurvey.error.wrong_email")},submit:function(){if(!this.validate(this.attributes)){var a=this;b.Objects.server.callFunctions([{"function":"processSurvey",arguments:{references:{},"return":{next:"next",options:"options"},
|
||||
groupId:a.get("groupId"),name:a.get("name"),info:a.get("info"),email:a.get("email"),message:a.get("message"),referrer:a.get("referrer"),threadId:null,token:null}}],function(c){if(0==c.errorCode)switch(a.trigger("submit:complete",a),b.Application.Survey.stop(),c.next){case "chat":b.Application.Chat.start(c.options);break;case "leaveMessage":b.Application.LeaveMessage.start(c.options);break;default:throw Error("Do not know how to continue!");}else a.trigger("submit:error",a,{code:c.errorCode,message:c.errorMessage||
|
||||
""})},!0)}}})})(Mibew,_);
|
@ -5,10 +5,10 @@
|
||||
Copyright (c) 2005-2011 Mibew Messenger Community
|
||||
License: http://mibew.org/license.php
|
||||
*/
|
||||
(function(a){a.Objects.Models.Controls={};a.Objects.Models.Status={};var j=[],k=a.Application,l=k.module("Chat",{startWithParent:!1});l.addInitializer(function(c){var e=c.chatModule,g=a.Objects,d=a.Objects.Models,b=a.Objects.Models.Controls,h=a.Objects.Models.Status;d.thread=new a.Models.Thread(e.thread);d.user=new a.Models.ChatUser(e.user);d.page=new a.Models.Page(c.page);c=new a.Layouts.Chat;a.Objects.chatLayout=c;k.mainRegion.show(c);var f=new a.Collections.Controls;d.user.get("isAgent")||(b.userName=
|
||||
new a.Models.UserNameControl({weight:220}),f.add(b.userName),b.sendMail=new a.Models.SendMailControl({weight:200,link:e.links.mail,windowParams:e.windowsParams.mail}),f.add(b.sendMail));d.user.get("isAgent")&&(b.redirect=new a.Models.RedirectControl({weight:200,link:e.links.redirect}),f.add(b.redirect),b.history=new a.Models.HistoryControl({weight:180,link:e.links.history,windowParams:e.windowsParams.history}),f.add(b.history));b.sound=new a.Models.SoundControl({weight:160});f.add(b.sound);b.refresh=
|
||||
new a.Models.RefreshControl({weight:140});f.add(b.refresh);e.links.ssl&&(b.secureMode=new a.Models.SecureModeControl({weight:120,link:e.links.ssl}),f.add(b.secureMode));b.close=new a.Models.CloseControl({weight:100});f.add(b.close);g.Collections.controls=f;c.controlsRegion.show(new a.Views.ControlsCollection({collection:f}));h.message=new a.Models.StatusMessage({hideTimeout:5E3});h.typing=new a.Models.StatusTyping({hideTimeout:5E3});g.Collections.status=new a.Collections.Status([h.message,h.typing]);
|
||||
c.statusRegion.show(new a.Views.StatusCollection({collection:g.Collections.status}));d.user.get("isAgent")||(d.avatar=new a.Models.Avatar,c.avatarRegion.show(new a.Views.Avatar({model:d.avatar})));g.Collections.messages=new a.Collections.Messages;d.messageForm=new a.Models.MessageForm(e.messageForm);c.messageFormRegion.show(new a.Views.MessageForm({model:d.messageForm}));c.messagesRegion.show(new a.Views.MessagesCollection({collection:g.Collections.messages}));d.sound=new a.Models.Sound;c.soundRegion.show(new a.Views.Sound({model:d.sound}));
|
||||
j.push(g.server.callFunctionsPeriodically(function(){var b=a.Objects.Models.thread,c=a.Objects.Models.user;return[{"function":"update",arguments:{"return":{typing:"typing",canPost:"canPost"},references:{},threadId:b.get("id"),token:b.get("token"),lastId:b.get("lastId"),typed:c.get("typing"),user:!c.get("isAgent")}}]},function(b){b.errorCode?a.Objects.Models.Status.message.setMessage(b.errorMessage||"refresh failed"):(b.typing&&a.Objects.Models.Status.typing.show(),a.Objects.Models.user.set({canPost:b.canPost||
|
||||
!1}))}))});l.addFinalizer(function(){a.Objects.chatLayout.close();for(var c=0;c<j.length;c++)a.Objects.server.stopCallFunctionsPeriodically(j[c]);"undefined"!=typeof a.Objects.Models.avatar&&a.Objects.Models.avatar.finalize();a.Objects.Collections.messages.finalize();delete a.Objects.chatLayout;delete a.Objects.Models.thread;delete a.Objects.Models.user;delete a.Objects.Models.page;delete a.Objects.Models.avatar;delete a.Objects.Models.messageForm;delete a.Objects.Models.sound;delete a.Objects.Models.Controls;
|
||||
delete a.Objects.Models.Status;delete a.Objects.Collections.messages;delete a.Objects.Collections.controls;delete a.Objects.Collections.status})})(Mibew);
|
||||
(function(a){a.Objects.Models.Controls={};a.Objects.Models.Status={};var j=[],k=a.Application,l=k.module("Chat",{startWithParent:!1});l.addInitializer(function(b){var g=a.Objects,d=a.Objects.Models,c=a.Objects.Models.Controls,h=a.Objects.Models.Status;b.page&&d.page.set(b.page);d.thread=new a.Models.Thread(b.thread);d.user=new a.Models.ChatUser(b.user);var f=new a.Layouts.Chat;g.chatLayout=f;k.mainRegion.show(f);var e=new a.Collections.Controls;d.user.get("isAgent")||(c.userName=new a.Models.UserNameControl({weight:220}),
|
||||
e.add(c.userName),c.sendMail=new a.Models.SendMailControl({weight:200,link:b.links.mail,windowParams:b.windowsParams.mail}),e.add(c.sendMail));d.user.get("isAgent")&&(c.redirect=new a.Models.RedirectControl({weight:200,link:b.links.redirect}),e.add(c.redirect),c.history=new a.Models.HistoryControl({weight:180,link:b.links.history,windowParams:b.windowsParams.history}),e.add(c.history));c.sound=new a.Models.SoundControl({weight:160});e.add(c.sound);c.refresh=new a.Models.RefreshControl({weight:140});
|
||||
e.add(c.refresh);b.links.ssl&&(c.secureMode=new a.Models.SecureModeControl({weight:120,link:b.links.ssl}),e.add(c.secureMode));c.close=new a.Models.CloseControl({weight:100});e.add(c.close);g.Collections.controls=e;f.controlsRegion.show(new a.Views.ControlsCollection({collection:e}));h.message=new a.Models.StatusMessage({hideTimeout:5E3});h.typing=new a.Models.StatusTyping({hideTimeout:5E3});g.Collections.status=new a.Collections.Status([h.message,h.typing]);f.statusRegion.show(new a.Views.StatusCollection({collection:g.Collections.status}));
|
||||
d.user.get("isAgent")||(d.avatar=new a.Models.Avatar,f.avatarRegion.show(new a.Views.Avatar({model:d.avatar})));g.Collections.messages=new a.Collections.Messages;d.messageForm=new a.Models.MessageForm(b.messageForm);f.messageFormRegion.show(new a.Views.MessageForm({model:d.messageForm}));f.messagesRegion.show(new a.Views.MessagesCollection({collection:g.Collections.messages}));d.sound=new a.Models.Sound;f.soundRegion.show(new a.Views.Sound({model:d.sound}));j.push(g.server.callFunctionsPeriodically(function(){var b=
|
||||
a.Objects.Models.thread,c=a.Objects.Models.user;return[{"function":"update",arguments:{"return":{typing:"typing",canPost:"canPost"},references:{},threadId:b.get("id"),token:b.get("token"),lastId:b.get("lastId"),typed:c.get("typing"),user:!c.get("isAgent")}}]},function(b){b.errorCode?a.Objects.Models.Status.message.setMessage(b.errorMessage||"refresh failed"):(b.typing&&a.Objects.Models.Status.typing.show(),a.Objects.Models.user.set({canPost:b.canPost||!1}))}))});l.addFinalizer(function(){a.Objects.chatLayout.close();
|
||||
for(var b=0;b<j.length;b++)a.Objects.server.stopCallFunctionsPeriodically(j[b]);"undefined"!=typeof a.Objects.Models.avatar&&a.Objects.Models.avatar.finalize();a.Objects.Collections.messages.finalize();delete a.Objects.chatLayout;delete a.Objects.Models.thread;delete a.Objects.Models.user;delete a.Objects.Models.page;delete a.Objects.Models.avatar;delete a.Objects.Models.messageForm;delete a.Objects.Models.sound;delete a.Objects.Models.Controls;delete a.Objects.Models.Status;delete a.Objects.Collections.messages;
|
||||
delete a.Objects.Collections.controls;delete a.Objects.Collections.status})})(Mibew);
|
||||
|
@ -0,0 +1,9 @@
|
||||
/*
|
||||
This file is part of Mibew Messenger project.
|
||||
http://mibew.org
|
||||
|
||||
Copyright (c) 2005-2011 Mibew Messenger Community
|
||||
License: http://mibew.org/license.php
|
||||
*/
|
||||
(function(a){var e=a.Application,f=e.module("LeaveMessage",{startWithParent:!1});f.addInitializer(function(d){var b=a.Objects,c=a.Objects.Models;d.page&&c.page.set(d.page);b.leaveMessageLayout=new a.Layouts.LeaveMessage;e.mainRegion.show(b.leaveMessageLayout);c.leaveMessageForm=new a.Models.LeaveMessageForm(d.leaveMessageForm);b.leaveMessageLayout.leaveMessageFormRegion.show(new a.Views.LeaveMessageForm({model:c.leaveMessageForm}));b.leaveMessageLayout.descriptionRegion.show(new a.Views.LeaveMessageDescription);
|
||||
c.leaveMessageForm.on("submit:complete",function(){b.leaveMessageLayout.leaveMessageFormRegion.close();b.leaveMessageLayout.descriptionRegion.close();b.leaveMessageLayout.descriptionRegion.show(new a.Views.LeaveMessageSentDescription)})});f.addFinalizer(function(){a.Objects.leaveMessageLayout.close();delete a.Objects.Models.leaveMessageForm})})(Mibew);
|
8
src/messenger/webim/js/compiled/chat/modules/survey.js
Normal file
8
src/messenger/webim/js/compiled/chat/modules/survey.js
Normal file
@ -0,0 +1,8 @@
|
||||
/*
|
||||
This file is part of Mibew Messenger project.
|
||||
http://mibew.org
|
||||
|
||||
Copyright (c) 2005-2011 Mibew Messenger Community
|
||||
License: http://mibew.org/license.php
|
||||
*/
|
||||
(function(a){var d=a.Application,b=d.module("Survey",{startWithParent:!1});b.addInitializer(function(b){var c=a.Objects,e=a.Objects.Models;c.surveyLayout=new a.Layouts.Survey;d.mainRegion.show(c.surveyLayout);e.surveyForm=new a.Models.SurveyForm(b.surveyForm);c.surveyLayout.surveyFormRegion.show(new a.Views.SurveyForm({model:e.surveyForm}))});b.addFinalizer(function(){a.Objects.surveyLayout.close();delete a.Objects.Models.surveyForm})})(Mibew);
|
@ -25,6 +25,13 @@ MibewAPIChatInteraction=function(){this.obligatoryArguments={"*":{threadId:null,
|
||||
Copyright (c) 2005-2011 Mibew Messenger Community
|
||||
License: http://mibew.org/license.php
|
||||
*/
|
||||
(function(a){a.Models.BaseSurveyForm=a.Models.Base.extend({defaults:{name:"",email:"",message:"",info:"",referrer:"",groupId:null,groups:null}})})(Mibew);
|
||||
/*
|
||||
This file is part of Mibew Messenger project.
|
||||
http://mibew.org
|
||||
Copyright (c) 2005-2011 Mibew Messenger Community
|
||||
License: http://mibew.org/license.php
|
||||
*/
|
||||
(function(b,c){b.Models.Avatar=b.Models.Base.extend({defaults:{imageLink:!1},initialize:function(){this.registeredFunctions=[];this.registeredFunctions.push(b.Objects.server.registerFunction("setupAvatar",c.bind(this.apiSetupAvatar,this)))},finalize:function(){for(var a=0;a<this.registeredFunctions.length;a++)b.Objects.server.unregisterFunction(this.registeredFunctions[a])},apiSetupAvatar:function(a){a.imageLink&&this.set({imageLink:a.imageLink})}})})(Mibew,_);
|
||||
/*
|
||||
This file is part of Mibew Messenger project.
|
||||
@ -95,6 +102,15 @@ MibewAPIChatInteraction=function(){this.obligatoryArguments={"*":{threadId:null,
|
||||
Copyright (c) 2005-2011 Mibew Messenger Community
|
||||
License: http://mibew.org/license.php
|
||||
*/
|
||||
(function(c,e){var d=c.Models.BaseSurveyForm;c.Models.LeaveMessageForm=d.extend({defaults:e.extend({},d.prototype.defaults,{showCaptcha:!1,captcha:""}),validate:function(a){var b=c.Localization;if("undefined"!=typeof a.email){if(!a.email)return b.get("leavemessage.error.email.required");if(!c.Utils.checkEmail(a.email))return b.get("leavemessage.error.wrong.email")}if("undefined"!=typeof a.name&&!a.name)return b.get("leavemessage.error.name.required");if("undefined"!=typeof a.message&&!a.message)return b.get("leavemessage.error.message.required");
|
||||
if(this.get("showCaptcha")&&"undefined"!=typeof a.captcha&&!a.captcha)return b.get("errors.captcha")},submit:function(){if(!this.validate(this.attributes)){var a=this;c.Objects.server.callFunctions([{"function":"processLeaveMessage",arguments:{references:{},"return":{},groupId:a.get("groupId"),name:a.get("name"),info:a.get("info"),email:a.get("email"),message:a.get("message"),referrer:a.get("referrer"),captcha:a.get("captcha"),threadId:null,token:null}}],function(b){0==b.errorCode?a.trigger("submit:complete",
|
||||
a):a.trigger("submit:error",a,{code:b.errorCode,message:b.errorMessage||""})},!0)}},ERROR_WRONG_CAPTCHA:10})})(Mibew,_);
|
||||
/*
|
||||
This file is part of Mibew Messenger project.
|
||||
http://mibew.org
|
||||
Copyright (c) 2005-2011 Mibew Messenger Community
|
||||
License: http://mibew.org/license.php
|
||||
*/
|
||||
(function(a){a.Models.MessageForm=a.Models.Base.extend({defaults:{predefinedAnswers:[],ignoreCtrl:!1},postMessage:function(e){var b=a.Objects.Models.thread,c=a.Objects.Models.user;if(c.get("canPost")){this.trigger("before:post",this);var d=this;a.Objects.server.callFunctions([{"function":"post",arguments:{references:{},"return":{},message:e,threadId:b.get("id"),token:b.get("token"),user:!c.get("isAgent")}}],function(){d.trigger("after:post",d)},!0)}}})})(Mibew);
|
||||
/*
|
||||
This file is part of Mibew Messenger project.
|
||||
@ -116,6 +132,15 @@ MibewAPIChatInteraction=function(){this.obligatoryArguments={"*":{threadId:null,
|
||||
Copyright (c) 2005-2011 Mibew Messenger Community
|
||||
License: http://mibew.org/license.php
|
||||
*/
|
||||
(function(b,e){var d=b.Models.BaseSurveyForm;b.Models.SurveyForm=d.extend({defaults:e.extend({},d.prototype.defaults,{showEmail:!1,showMessage:!1,canChangeName:!1}),validate:function(a){if(this.get("showEmail")&&"undefined"!=typeof a.email&&!b.Utils.checkEmail(a.email))return b.Localization.get("presurvey.error.wrong_email")},submit:function(){if(!this.validate(this.attributes)){var a=this;b.Objects.server.callFunctions([{"function":"processSurvey",arguments:{references:{},"return":{next:"next",options:"options"},
|
||||
groupId:a.get("groupId"),name:a.get("name"),info:a.get("info"),email:a.get("email"),message:a.get("message"),referrer:a.get("referrer"),threadId:null,token:null}}],function(c){if(0==c.errorCode)switch(a.trigger("submit:complete",a),b.Application.Survey.stop(),c.next){case "chat":b.Application.Chat.start(c.options);break;case "leaveMessage":b.Application.LeaveMessage.start(c.options);break;default:throw Error("Do not know how to continue!");}else a.trigger("submit:error",a,{code:c.errorCode,message:c.errorMessage||
|
||||
""})},!0)}}})})(Mibew,_);
|
||||
/*
|
||||
This file is part of Mibew Messenger project.
|
||||
http://mibew.org
|
||||
Copyright (c) 2005-2011 Mibew Messenger Community
|
||||
License: http://mibew.org/license.php
|
||||
*/
|
||||
(function(b,d,f){b.Collections.Messages=d.Collection.extend({model:b.Models.Message,initialize:function(){this.periodicallyCalled=[];this.periodicallyCalled.push(b.Objects.server.callFunctionsPeriodically(f.bind(this.updateMessagesFunctionBuilder,this),f.bind(this.updateMessages,this)))},finalize:function(){for(var a=0;a<this.periodicallyCalled.length;a++)b.Objects.server.stopCallFunctionsPeriodically(this.periodicallyCalled[a])},updateMessages:function(a){a.lastId&&b.Objects.Models.thread.set({lastId:a.lastId});
|
||||
for(var c=[],e=0,d=a.messages.length;e<d;e++)c.push(new b.Models.Message(a.messages[e]));0<c.length&&this.add(c)},updateMessagesFunctionBuilder:function(){var a=b.Objects.Models.thread,c=b.Objects.Models.user;return[{"function":"updateMessages",arguments:{"return":{messages:"messages",lastId:"lastId"},references:{},threadId:a.get("id"),token:a.get("token"),lastId:a.get("lastId"),user:!c.get("isAgent")}}]},add:function(){var a=Array.prototype.slice.apply(arguments),a=d.Collection.prototype.add.apply(this,
|
||||
a);this.trigger("multiple:add");return a}})})(Mibew,Backbone,_);
|
||||
@ -139,6 +164,14 @@ 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);
|
||||
/*
|
||||
This file is part of Mibew Messenger project.
|
||||
http://mibew.org
|
||||
Copyright (c) 2005-2011 Mibew Messenger Community
|
||||
License: http://mibew.org/license.php
|
||||
*/
|
||||
(function(a,b,c){a.Views.Avatar=b.Marionette.ItemView.extend({template:c.templates.avatar,className:"avatar",modelEvents:{change:"render"}})})(Mibew,Backbone,Handlebars);
|
||||
/*
|
||||
This file is part of Mibew Messenger project.
|
||||
@ -204,6 +237,28 @@ this.model.toJSON();a.user=b.Objects.Models.user.toJSON();a.nameInput=this.nameI
|
||||
Copyright (c) 2005-2011 Mibew Messenger Community
|
||||
License: http://mibew.org/license.php
|
||||
*/
|
||||
(function(a,b,c){a.Views.LeaveMessageDescription=b.Marionette.ItemView.extend({template:c.templates.leave_message_description,serializeData:function(){return{page:a.Objects.Models.page.toJSON()}}})})(Mibew,Backbone,Handlebars);
|
||||
/*
|
||||
This file is part of Mibew Messenger project.
|
||||
http://mibew.org
|
||||
Copyright (c) 2005-2011 Mibew Messenger Community
|
||||
License: http://mibew.org/license.php
|
||||
*/
|
||||
(function(d,e,b){var c=d.Views.BaseSurveyForm;d.Views.LeaveMessageForm=c.extend({template:e.templates.leave_message_form,events:b.extend({},c.prototype.events,{"click #send-message":"submitForm"}),ui:b.extend({},c.prototype.ui,{captcha:'input[name="captcha"]',captchaImg:"#captcha-img"}),modelEvents:b.extend({},c.prototype.modelEvents,{"submit:error":"showError submitError"}),submitForm:function(){var a={};this.model.get("groups")&&(a.groupId=this.ui.groupSelect.val());a.name=this.ui.name.val()||"";
|
||||
a.email=this.ui.email.val()||"";a.message=this.ui.message.val()||"";this.model.get("showCaptcha")&&(a.captcha=this.ui.captcha.val()||"");this.model.set(a,{validate:!0});this.model.submit()},submitError:function(a,c){if(c.code==a.ERROR_WRONG_CAPTCHA&&a.get("showCaptcha")){var b=this.ui.captchaImg.attr("src"),b=b.replace(/\?d\=[0-9]+/,"");this.ui.captchaImg.attr("src",b+"?d="+(new Date).getTime())}}})})(Mibew,Handlebars,_);
|
||||
/*
|
||||
This file is part of Mibew Messenger project.
|
||||
http://mibew.org
|
||||
Copyright (c) 2005-2011 Mibew Messenger Community
|
||||
License: http://mibew.org/license.php
|
||||
*/
|
||||
(function(a,b,c){a.Views.LeaveMessageSentDescription=b.Marionette.ItemView.extend({template:c.templates.leave_message_sent_description,serializeData:function(){return{page:a.Objects.Models.page.toJSON()}}})})(Mibew,Backbone,Handlebars);
|
||||
/*
|
||||
This file is part of Mibew Messenger project.
|
||||
http://mibew.org
|
||||
Copyright (c) 2005-2011 Mibew Messenger Community
|
||||
License: http://mibew.org/license.php
|
||||
*/
|
||||
(function(b,d,e){b.Views.MessageForm=d.Marionette.ItemView.extend({template:e.templates.message_form,events:{"click #send-message":"postMessage","keydown #message-input":"messageKeyDown","keyup #message-input":"checkUserTyping","change #message-input":"checkUserTyping","change #predefined":"selectPredefinedAnswer","focus #message-input":"setFocus","blur #message-input":"dropFocus"},modelEvents:{change:"render"},ui:{message:"#message-input",send:"#send-message",predefinedAnswer:"#predefined"},initialize:function(){b.Objects.Models.user.on("change:canPost",
|
||||
this.render,this)},serializeData:function(){var a=this.model.toJSON();a.user=b.Objects.Models.user.toJSON();return a},postMessage:function(){var a=this.ui.message.val();""!=a&&(this.disableInput(),this.model.postMessage(a));b.Objects.Collections.messages.on("multiple:add",this.postMessageComplete,this)},messageKeyDown:function(a){var c=a.which;a=a.ctrlKey;(13==c&&(a||this.model.get("ignoreCtrl"))||10==c)&&this.postMessage()},enableInput:function(){this.ui.message.removeAttr("disabled")},disableInput:function(){this.ui.message.attr("disabled",
|
||||
"disabled")},clearInput:function(){this.ui.message.val("").change()},postMessageComplete:function(){this.clearInput();this.enableInput();this.focused&&this.ui.focus();b.Objects.Collections.messages.off("multiple:add",this.postMessageComplete,this)},selectPredefinedAnswer:function(){var a=this.ui.message,c=this.ui.predefinedAnswer,b=c.get(0).selectedIndex;b&&(a.val(this.model.get("predefinedAnswers")[b-1].full).change(),a.focus(),c.get(0).selectedIndex=0)},checkUserTyping:function(){var a=b.Objects.Models.user,
|
||||
@ -228,6 +283,14 @@ c=""!=this.ui.message.val();c!=a.get("typing")&&a.set({typing:c})},setFocus:func
|
||||
Copyright (c) 2005-2011 Mibew Messenger Community
|
||||
License: http://mibew.org/license.php
|
||||
*/
|
||||
(function(b,d,e){var c=b.Views.BaseSurveyForm;b.Views.SurveyForm=c.extend({template:d.templates.survey_form,events:e.extend({},c.prototype.events,{"click #submit-survey":"submitForm"}),submitForm:function(){var a={};this.model.get("groups")&&(a.groupId=this.ui.groupSelect.val());this.model.get("canChangeName")&&(a.name=this.ui.name.val()||"");this.model.get("showEmail")&&(a.email=this.ui.email.val()||"");this.model.get("showMessage")&&(a.message=this.ui.message.val()||"");this.model.set(a,{validate:!0});
|
||||
this.model.submit()}})})(Mibew,Handlebars,_);
|
||||
/*
|
||||
This file is part of Mibew Messenger project.
|
||||
http://mibew.org
|
||||
Copyright (c) 2005-2011 Mibew Messenger Community
|
||||
License: http://mibew.org/license.php
|
||||
*/
|
||||
(function(a){a.Views.MessagesCollection=a.Views.CollectionBase.extend({itemView:a.Views.Message,className:"messages-collection",initialize:function(){this.collection.on("multiple:add",this.messagesAdded,this);a.Objects.Models.messageForm.on("before:post",this.messagePost,this)},skipNextSound:!0,messagePost:function(){this.skipNextSound=!0},messagesAdded:function(){if(!this.skipNextSound&&a.Objects.Models.Controls.sound.get("enabled")){var b=a.Objects.Models.page.get("webimRoot");b&&a.Objects.Models.sound.play(b+
|
||||
"/sounds/new_message.wav")}this.skipNextSound=!1}})})(Mibew);
|
||||
/*
|
||||
@ -250,24 +313,54 @@ c=""!=this.ui.message.val();c!=a.get("typing")&&a.set({typing:c})},setFocus:func
|
||||
Copyright (c) 2005-2011 Mibew Messenger Community
|
||||
License: http://mibew.org/license.php
|
||||
*/
|
||||
(function(a,b){a.Layouts.Chat=b.Marionette.Layout.extend({template:Handlebars.templates.chat_layout,regions:{controlsRegion:"#controls-region",avatarRegion:"#avatar-region",messagesRegion:{selector:"#messages-region",regionType:a.Regions.Messages},statusRegion:"#status-region",messageFormRegion:"#message-form-region",soundRegion:"#sound-region"},serializeData:function(){return{user:a.Objects.Models.user.toJSON()}}})})(Mibew,Backbone);
|
||||
(function(a,c){a.Layouts.Chat=c.Marionette.Layout.extend({template:Handlebars.templates.chat_layout,regions:{controlsRegion:"#controls-region",avatarRegion:"#avatar-region",messagesRegion:{selector:"#messages-region",regionType:a.Regions.Messages},statusRegion:"#status-region",messageFormRegion:"#message-form-region",soundRegion:"#sound-region"},serializeData:function(){var b=a.Objects.Models;return{page:b.page.toJSON(),user:b.user.toJSON()}}})})(Mibew,Backbone);
|
||||
/*
|
||||
This file is part of Mibew Messenger project.
|
||||
http://mibew.org
|
||||
Copyright (c) 2005-2011 Mibew Messenger Community
|
||||
License: http://mibew.org/license.php
|
||||
*/
|
||||
(function(a){a.Objects.Models.Controls={};a.Objects.Models.Status={};var j=[],k=a.Application,l=k.module("Chat",{startWithParent:!1});l.addInitializer(function(c){var e=c.chatModule,g=a.Objects,d=a.Objects.Models,b=a.Objects.Models.Controls,h=a.Objects.Models.Status;d.thread=new a.Models.Thread(e.thread);d.user=new a.Models.ChatUser(e.user);d.page=new a.Models.Page(c.page);c=new a.Layouts.Chat;a.Objects.chatLayout=c;k.mainRegion.show(c);var f=new a.Collections.Controls;d.user.get("isAgent")||(b.userName=
|
||||
new a.Models.UserNameControl({weight:220}),f.add(b.userName),b.sendMail=new a.Models.SendMailControl({weight:200,link:e.links.mail,windowParams:e.windowsParams.mail}),f.add(b.sendMail));d.user.get("isAgent")&&(b.redirect=new a.Models.RedirectControl({weight:200,link:e.links.redirect}),f.add(b.redirect),b.history=new a.Models.HistoryControl({weight:180,link:e.links.history,windowParams:e.windowsParams.history}),f.add(b.history));b.sound=new a.Models.SoundControl({weight:160});f.add(b.sound);b.refresh=
|
||||
new a.Models.RefreshControl({weight:140});f.add(b.refresh);e.links.ssl&&(b.secureMode=new a.Models.SecureModeControl({weight:120,link:e.links.ssl}),f.add(b.secureMode));b.close=new a.Models.CloseControl({weight:100});f.add(b.close);g.Collections.controls=f;c.controlsRegion.show(new a.Views.ControlsCollection({collection:f}));h.message=new a.Models.StatusMessage({hideTimeout:5E3});h.typing=new a.Models.StatusTyping({hideTimeout:5E3});g.Collections.status=new a.Collections.Status([h.message,h.typing]);
|
||||
c.statusRegion.show(new a.Views.StatusCollection({collection:g.Collections.status}));d.user.get("isAgent")||(d.avatar=new a.Models.Avatar,c.avatarRegion.show(new a.Views.Avatar({model:d.avatar})));g.Collections.messages=new a.Collections.Messages;d.messageForm=new a.Models.MessageForm(e.messageForm);c.messageFormRegion.show(new a.Views.MessageForm({model:d.messageForm}));c.messagesRegion.show(new a.Views.MessagesCollection({collection:g.Collections.messages}));d.sound=new a.Models.Sound;c.soundRegion.show(new a.Views.Sound({model:d.sound}));
|
||||
j.push(g.server.callFunctionsPeriodically(function(){var b=a.Objects.Models.thread,c=a.Objects.Models.user;return[{"function":"update",arguments:{"return":{typing:"typing",canPost:"canPost"},references:{},threadId:b.get("id"),token:b.get("token"),lastId:b.get("lastId"),typed:c.get("typing"),user:!c.get("isAgent")}}]},function(b){b.errorCode?a.Objects.Models.Status.message.setMessage(b.errorMessage||"refresh failed"):(b.typing&&a.Objects.Models.Status.typing.show(),a.Objects.Models.user.set({canPost:b.canPost||
|
||||
!1}))}))});l.addFinalizer(function(){a.Objects.chatLayout.close();for(var c=0;c<j.length;c++)a.Objects.server.stopCallFunctionsPeriodically(j[c]);"undefined"!=typeof a.Objects.Models.avatar&&a.Objects.Models.avatar.finalize();a.Objects.Collections.messages.finalize();delete a.Objects.chatLayout;delete a.Objects.Models.thread;delete a.Objects.Models.user;delete a.Objects.Models.page;delete a.Objects.Models.avatar;delete a.Objects.Models.messageForm;delete a.Objects.Models.sound;delete a.Objects.Models.Controls;
|
||||
delete a.Objects.Models.Status;delete a.Objects.Collections.messages;delete a.Objects.Collections.controls;delete a.Objects.Collections.status})})(Mibew);
|
||||
(function(a,b){a.Layouts.LeaveMessage=b.Marionette.Layout.extend({template:Handlebars.templates.leave_message_layout,regions:{leaveMessageFormRegion:"#content-wrapper",descriptionRegion:"#description-region"},serializeData:function(){return{page:a.Objects.Models.page.toJSON()}}})})(Mibew,Backbone);
|
||||
/*
|
||||
This file is part of Mibew Messenger project.
|
||||
http://mibew.org
|
||||
Copyright (c) 2005-2011 Mibew Messenger Community
|
||||
License: http://mibew.org/license.php
|
||||
*/
|
||||
(function(a,d){var b=a.Application;b.addRegions({mainRegion:"#main-region"});b.addInitializer(function(c){a.Objects.server=new a.Server(d.extend({interactionType:MibewAPIChatInteraction},c.server));b.Chat.start(c)});b.on("start",function(){a.Objects.server.runUpdater()})})(Mibew,_);
|
||||
(function(a,b){a.Layouts.Survey=b.Marionette.Layout.extend({template:Handlebars.templates.survey_layout,regions:{surveyFormRegion:"#content-wrapper"},serializeData:function(){return{page:a.Objects.Models.page.toJSON()}}})})(Mibew,Backbone);
|
||||
/*
|
||||
This file is part of Mibew Messenger project.
|
||||
http://mibew.org
|
||||
Copyright (c) 2005-2011 Mibew Messenger Community
|
||||
License: http://mibew.org/license.php
|
||||
*/
|
||||
(function(a){a.Objects.Models.Controls={};a.Objects.Models.Status={};var j=[],k=a.Application,l=k.module("Chat",{startWithParent:!1});l.addInitializer(function(b){var g=a.Objects,d=a.Objects.Models,c=a.Objects.Models.Controls,h=a.Objects.Models.Status;b.page&&d.page.set(b.page);d.thread=new a.Models.Thread(b.thread);d.user=new a.Models.ChatUser(b.user);var f=new a.Layouts.Chat;g.chatLayout=f;k.mainRegion.show(f);var e=new a.Collections.Controls;d.user.get("isAgent")||(c.userName=new a.Models.UserNameControl({weight:220}),
|
||||
e.add(c.userName),c.sendMail=new a.Models.SendMailControl({weight:200,link:b.links.mail,windowParams:b.windowsParams.mail}),e.add(c.sendMail));d.user.get("isAgent")&&(c.redirect=new a.Models.RedirectControl({weight:200,link:b.links.redirect}),e.add(c.redirect),c.history=new a.Models.HistoryControl({weight:180,link:b.links.history,windowParams:b.windowsParams.history}),e.add(c.history));c.sound=new a.Models.SoundControl({weight:160});e.add(c.sound);c.refresh=new a.Models.RefreshControl({weight:140});
|
||||
e.add(c.refresh);b.links.ssl&&(c.secureMode=new a.Models.SecureModeControl({weight:120,link:b.links.ssl}),e.add(c.secureMode));c.close=new a.Models.CloseControl({weight:100});e.add(c.close);g.Collections.controls=e;f.controlsRegion.show(new a.Views.ControlsCollection({collection:e}));h.message=new a.Models.StatusMessage({hideTimeout:5E3});h.typing=new a.Models.StatusTyping({hideTimeout:5E3});g.Collections.status=new a.Collections.Status([h.message,h.typing]);f.statusRegion.show(new a.Views.StatusCollection({collection:g.Collections.status}));
|
||||
d.user.get("isAgent")||(d.avatar=new a.Models.Avatar,f.avatarRegion.show(new a.Views.Avatar({model:d.avatar})));g.Collections.messages=new a.Collections.Messages;d.messageForm=new a.Models.MessageForm(b.messageForm);f.messageFormRegion.show(new a.Views.MessageForm({model:d.messageForm}));f.messagesRegion.show(new a.Views.MessagesCollection({collection:g.Collections.messages}));d.sound=new a.Models.Sound;f.soundRegion.show(new a.Views.Sound({model:d.sound}));j.push(g.server.callFunctionsPeriodically(function(){var b=
|
||||
a.Objects.Models.thread,c=a.Objects.Models.user;return[{"function":"update",arguments:{"return":{typing:"typing",canPost:"canPost"},references:{},threadId:b.get("id"),token:b.get("token"),lastId:b.get("lastId"),typed:c.get("typing"),user:!c.get("isAgent")}}]},function(b){b.errorCode?a.Objects.Models.Status.message.setMessage(b.errorMessage||"refresh failed"):(b.typing&&a.Objects.Models.Status.typing.show(),a.Objects.Models.user.set({canPost:b.canPost||!1}))}))});l.addFinalizer(function(){a.Objects.chatLayout.close();
|
||||
for(var b=0;b<j.length;b++)a.Objects.server.stopCallFunctionsPeriodically(j[b]);"undefined"!=typeof a.Objects.Models.avatar&&a.Objects.Models.avatar.finalize();a.Objects.Collections.messages.finalize();delete a.Objects.chatLayout;delete a.Objects.Models.thread;delete a.Objects.Models.user;delete a.Objects.Models.page;delete a.Objects.Models.avatar;delete a.Objects.Models.messageForm;delete a.Objects.Models.sound;delete a.Objects.Models.Controls;delete a.Objects.Models.Status;delete a.Objects.Collections.messages;
|
||||
delete a.Objects.Collections.controls;delete a.Objects.Collections.status})})(Mibew);
|
||||
/*
|
||||
This file is part of Mibew Messenger project.
|
||||
http://mibew.org
|
||||
Copyright (c) 2005-2011 Mibew Messenger Community
|
||||
License: http://mibew.org/license.php
|
||||
*/
|
||||
(function(a){var e=a.Application,f=e.module("LeaveMessage",{startWithParent:!1});f.addInitializer(function(d){var b=a.Objects,c=a.Objects.Models;d.page&&c.page.set(d.page);b.leaveMessageLayout=new a.Layouts.LeaveMessage;e.mainRegion.show(b.leaveMessageLayout);c.leaveMessageForm=new a.Models.LeaveMessageForm(d.leaveMessageForm);b.leaveMessageLayout.leaveMessageFormRegion.show(new a.Views.LeaveMessageForm({model:c.leaveMessageForm}));b.leaveMessageLayout.descriptionRegion.show(new a.Views.LeaveMessageDescription);
|
||||
c.leaveMessageForm.on("submit:complete",function(){b.leaveMessageLayout.leaveMessageFormRegion.close();b.leaveMessageLayout.descriptionRegion.close();b.leaveMessageLayout.descriptionRegion.show(new a.Views.LeaveMessageSentDescription)})});f.addFinalizer(function(){a.Objects.leaveMessageLayout.close();delete a.Objects.Models.leaveMessageForm})})(Mibew);
|
||||
/*
|
||||
This file is part of Mibew Messenger project.
|
||||
http://mibew.org
|
||||
Copyright (c) 2005-2011 Mibew Messenger Community
|
||||
License: http://mibew.org/license.php
|
||||
*/
|
||||
(function(a){var d=a.Application,b=d.module("Survey",{startWithParent:!1});b.addInitializer(function(b){var c=a.Objects,e=a.Objects.Models;c.surveyLayout=new a.Layouts.Survey;d.mainRegion.show(c.surveyLayout);e.surveyForm=new a.Models.SurveyForm(b.surveyForm);c.surveyLayout.surveyFormRegion.show(new a.Views.SurveyForm({model:e.surveyForm}))});b.addFinalizer(function(){a.Objects.surveyLayout.close();delete a.Objects.Models.surveyForm})})(Mibew);
|
||||
/*
|
||||
This file is part of Mibew Messenger project.
|
||||
http://mibew.org
|
||||
Copyright (c) 2005-2011 Mibew Messenger Community
|
||||
License: http://mibew.org/license.php
|
||||
*/
|
||||
(function(a,d){var b=a.Application;b.addRegions({mainRegion:"#main-region"});b.addInitializer(function(c){a.Objects.server=new a.Server(d.extend({interactionType:MibewAPIChatInteraction},c.server));a.Objects.Models.page=new a.Models.Page(c.page);switch(c.startFrom){case "chat":b.Chat.start(c.chatOptions);break;case "survey":b.Survey.start(c.surveyOptions);break;case "leaveMessage":b.LeaveMessage.start(c.leaveMessageOptions);break;default:throw Error("Dont know how to start!");}});b.on("start",function(){a.Objects.server.runUpdater()})})(Mibew,
|
||||
_);
|
||||
|
@ -1,8 +0,0 @@
|
||||
/*
|
||||
This file is part of Mibew Messenger project.
|
||||
http://mibew.org
|
||||
|
||||
Copyright (c) 2005-2011 Mibew Messenger Community
|
||||
License: http://mibew.org/license.php
|
||||
*/
|
||||
var SurveyForm=Class.create();Class.inherit(SurveyForm,ClientForm,{checkFields:function(){return null==this.form.email||"hidden"==this.form.email.getAttribute("type")?null:!this.emailIsValid(this.form.email)?this.localizedStrings.wrongEmail||"":null}});EventHelper.register(window,"onload",function(){Survey=new SurveyForm(document.surveyForm);Survey.localize(localizedStrings)});
|
@ -18,14 +18,29 @@
|
||||
|
||||
// Initialize application
|
||||
app.addInitializer(function(options){
|
||||
// Initialize Server, Thread and User
|
||||
// Initialize Server
|
||||
Mibew.Objects.server = new Mibew.Server(_.extend(
|
||||
{
|
||||
'interactionType': MibewAPIChatInteraction
|
||||
},
|
||||
{'interactionType': MibewAPIChatInteraction},
|
||||
options.server
|
||||
));
|
||||
app.Chat.start(options);
|
||||
|
||||
// Initialize Page
|
||||
Mibew.Objects.Models.page = new Mibew.Models.Page(options.page);
|
||||
|
||||
switch (options.startFrom) {
|
||||
case 'chat':
|
||||
app.Chat.start(options.chatOptions);
|
||||
break;
|
||||
case 'survey':
|
||||
app.Survey.start(options.surveyOptions);
|
||||
break;
|
||||
case 'leaveMessage':
|
||||
app.LeaveMessage.start(options.leaveMessageOptions);
|
||||
break;
|
||||
default:
|
||||
throw new Error('Dont know how to start!');
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
app.on('start', function() {
|
||||
|
@ -46,9 +46,10 @@
|
||||
* @returns {Object} Template data
|
||||
*/
|
||||
serializeData: function() {
|
||||
var user = Mibew.Objects.Models.user.toJSON();
|
||||
var models = Mibew.Objects.Models;
|
||||
return {
|
||||
user: user
|
||||
page: models.page.toJSON(),
|
||||
user: models.user.toJSON()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
49
src/messenger/webim/js/source/chat/layouts/leave_message.js
Normal file
49
src/messenger/webim/js/source/chat/layouts/leave_message.js
Normal file
@ -0,0 +1,49 @@
|
||||
/**
|
||||
* @preserve This file is part of Mibew Messenger project.
|
||||
* http://mibew.org
|
||||
*
|
||||
* Copyright (c) 2005-2011 Mibew Messenger Community
|
||||
* License: http://mibew.org/license.php
|
||||
*/
|
||||
|
||||
(function(Mibew, Backbone){
|
||||
|
||||
/**
|
||||
* Represents leave message page layout
|
||||
*/
|
||||
Mibew.Layouts.LeaveMessage = Backbone.Marionette.Layout.extend(
|
||||
/** @lends Mibew.Layouts.LeaveMessage.prototype */
|
||||
{
|
||||
/**
|
||||
* Template function
|
||||
* @type Function
|
||||
*/
|
||||
template: Handlebars.templates.leave_message_layout,
|
||||
|
||||
/**
|
||||
* Regions list
|
||||
* @type Object
|
||||
*/
|
||||
regions: {
|
||||
leaveMessageFormRegion: '#content-wrapper',
|
||||
descriptionRegion: '#description-region'
|
||||
},
|
||||
|
||||
/**
|
||||
* Override Backbone.Marionette.ItemView.serializeData to pass some
|
||||
* extra fields to template.
|
||||
*
|
||||
* Use undocumented feature of layouts: passing data to template via
|
||||
* serializeData method.
|
||||
*
|
||||
* @returns {Object} Template data
|
||||
*/
|
||||
serializeData: function() {
|
||||
return {
|
||||
page: Mibew.Objects.Models.page.toJSON()
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
})(Mibew, Backbone);
|
48
src/messenger/webim/js/source/chat/layouts/survey.js
Normal file
48
src/messenger/webim/js/source/chat/layouts/survey.js
Normal file
@ -0,0 +1,48 @@
|
||||
/**
|
||||
* @preserve This file is part of Mibew Messenger project.
|
||||
* http://mibew.org
|
||||
*
|
||||
* Copyright (c) 2005-2011 Mibew Messenger Community
|
||||
* License: http://mibew.org/license.php
|
||||
*/
|
||||
|
||||
(function(Mibew, Backbone){
|
||||
|
||||
/**
|
||||
* Represents survey layout
|
||||
*/
|
||||
Mibew.Layouts.Survey = Backbone.Marionette.Layout.extend(
|
||||
/** @lends Mibew.Layouts.Survey.prototype */
|
||||
{
|
||||
/**
|
||||
* Template function
|
||||
* @type Function
|
||||
*/
|
||||
template: Handlebars.templates.survey_layout,
|
||||
|
||||
/**
|
||||
* Regions list
|
||||
* @type Object
|
||||
*/
|
||||
regions: {
|
||||
surveyFormRegion: '#content-wrapper'
|
||||
},
|
||||
|
||||
/**
|
||||
* Override Backbone.Marionette.ItemView.serializeData to pass some
|
||||
* extra fields to template.
|
||||
*
|
||||
* Use undocumented feature of layouts: passing data to template via
|
||||
* serializeData method.
|
||||
*
|
||||
* @returns {Object} Template data
|
||||
*/
|
||||
serializeData: function() {
|
||||
return {
|
||||
page: Mibew.Objects.Models.page.toJSON()
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
})(Mibew, Backbone);
|
@ -0,0 +1,40 @@
|
||||
/**
|
||||
* @preserve This file is part of Mibew Messenger project.
|
||||
* http://mibew.org
|
||||
*
|
||||
* Copyright (c) 2005-2011 Mibew Messenger Community
|
||||
* License: http://mibew.org/license.php
|
||||
*/
|
||||
|
||||
(function(Mibew, Backbone, Handlebars){
|
||||
|
||||
/**
|
||||
* @class Represents leave message description
|
||||
*/
|
||||
Mibew.Views.LeaveMessageDescription = Backbone.Marionette.ItemView.extend(
|
||||
/** @lends Mibew.Views.LeaveMessageDescription.prototype */
|
||||
{
|
||||
/**
|
||||
* Template function
|
||||
* @type Function
|
||||
*/
|
||||
template: Handlebars.templates.leave_message_description,
|
||||
|
||||
/**
|
||||
* Override Backbone.Marionette.ItemView.serializeData to pass some
|
||||
* extra fields to template.
|
||||
*
|
||||
* Use undocumented feature of layouts: passing data to template via
|
||||
* serializeData method.
|
||||
*
|
||||
* @returns {Object} Template data
|
||||
*/
|
||||
serializeData: function() {
|
||||
return {
|
||||
page: Mibew.Objects.Models.page.toJSON()
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
})(Mibew, Backbone, Handlebars);
|
@ -0,0 +1,108 @@
|
||||
/**
|
||||
* @preserve This file is part of Mibew Messenger project.
|
||||
* http://mibew.org
|
||||
*
|
||||
* Copyright (c) 2005-2011 Mibew Messenger Community
|
||||
* License: http://mibew.org/license.php
|
||||
*/
|
||||
|
||||
(function(Mibew, Handlebars, _){
|
||||
|
||||
// Create shortcut for base view
|
||||
var BaseView = Mibew.Views.BaseSurveyForm;
|
||||
|
||||
/**
|
||||
* @class Represents leave message form view
|
||||
*/
|
||||
Mibew.Views.LeaveMessageForm = BaseView.extend(
|
||||
/** @lends Mibew.Views.LeaveMessageForm.prototype */
|
||||
{
|
||||
/**
|
||||
* Template function
|
||||
* @type Function
|
||||
*/
|
||||
template: Handlebars.templates.leave_message_form,
|
||||
|
||||
/**
|
||||
* Map ui events to view methods.
|
||||
* The view inherits events from
|
||||
* {@link Mibew.Views.BaseSurveyForm.prototype.events}.
|
||||
* @type Object
|
||||
*/
|
||||
events: _.extend(
|
||||
{},
|
||||
BaseView.prototype.events,
|
||||
{
|
||||
'click #send-message': 'submitForm'
|
||||
}
|
||||
),
|
||||
|
||||
/**
|
||||
* Shortcuts for ui elements.
|
||||
* The view inherits ui elements from
|
||||
* {@link Mibew.Views.BaseSurveyForm.prototype.ui}.
|
||||
* @type Object
|
||||
*/
|
||||
ui: _.extend(
|
||||
{},
|
||||
BaseView.prototype.ui,
|
||||
{
|
||||
captcha: 'input[name="captcha"]',
|
||||
captchaImg: '#captcha-img'
|
||||
}
|
||||
),
|
||||
|
||||
modelEvents: _.extend(
|
||||
{},
|
||||
BaseView.prototype.modelEvents,
|
||||
{
|
||||
'submit:error': 'showError submitError'
|
||||
}
|
||||
),
|
||||
|
||||
/**
|
||||
* Update model fields and call model.submit() method.
|
||||
*/
|
||||
submitForm: function() {
|
||||
// Update model fields
|
||||
var values = {};
|
||||
|
||||
// Update group id
|
||||
if (this.model.get('groups')) {
|
||||
values.groupId = this.ui.groupSelect.val()
|
||||
}
|
||||
|
||||
// Update name
|
||||
values.name = this.ui.name.val() || '';
|
||||
|
||||
// Update email
|
||||
values.email = this.ui.email.val() || '';
|
||||
|
||||
// Update message
|
||||
values.message = this.ui.message.val() || '';
|
||||
|
||||
if (this.model.get('showCaptcha')) {
|
||||
values.captcha = this.ui.captcha.val() || '';
|
||||
}
|
||||
|
||||
// Update model fields
|
||||
this.model.set(values, {validate: true});
|
||||
|
||||
// Submit form
|
||||
this.model.submit();
|
||||
},
|
||||
|
||||
submitError: function(model, error) {
|
||||
if (error.code == model.ERROR_WRONG_CAPTCHA && model.get('showCaptcha')) {
|
||||
var src = this.ui.captchaImg.attr('src');
|
||||
src = src.replace(/\?d\=[0-9]+/, '');
|
||||
this.ui.captchaImg.attr(
|
||||
'src',
|
||||
src + '?d=' + (new Date()).getTime()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
})(Mibew, Handlebars, _);
|
@ -0,0 +1,40 @@
|
||||
/**
|
||||
* @preserve This file is part of Mibew Messenger project.
|
||||
* http://mibew.org
|
||||
*
|
||||
* Copyright (c) 2005-2011 Mibew Messenger Community
|
||||
* License: http://mibew.org/license.php
|
||||
*/
|
||||
|
||||
(function(Mibew, Backbone, Handlebars){
|
||||
|
||||
/**
|
||||
* @class Represents leave message sent description
|
||||
*/
|
||||
Mibew.Views.LeaveMessageSentDescription = Backbone.Marionette.ItemView.extend(
|
||||
/** @lends Mibew.Views.LeaveMessageSentDescription.prototype */
|
||||
{
|
||||
/**
|
||||
* Template function
|
||||
* @type Function
|
||||
*/
|
||||
template: Handlebars.templates.leave_message_sent_description,
|
||||
|
||||
/**
|
||||
* Override Backbone.Marionette.ItemView.serializeData to pass some
|
||||
* extra fields to template.
|
||||
*
|
||||
* Use undocumented feature of layouts: passing data to template via
|
||||
* serializeData method.
|
||||
*
|
||||
* @returns {Object} Template data
|
||||
*/
|
||||
serializeData: function() {
|
||||
return {
|
||||
page: Mibew.Objects.Models.page.toJSON()
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
})(Mibew, Backbone, Handlebars);
|
@ -0,0 +1,81 @@
|
||||
/**
|
||||
* @preserve This file is part of Mibew Messenger project.
|
||||
* http://mibew.org
|
||||
*
|
||||
* Copyright (c) 2005-2011 Mibew Messenger Community
|
||||
* License: http://mibew.org/license.php
|
||||
*/
|
||||
|
||||
(function(Mibew, Backbone){
|
||||
|
||||
/**
|
||||
* @class Represents base class for survey form view
|
||||
*/
|
||||
Mibew.Views.BaseSurveyForm = Backbone.Marionette.ItemView.extend(
|
||||
/** @lends Mibew.Views.BaseSurveyForm.prototype */
|
||||
{
|
||||
/**
|
||||
* Map ui events to view methods.
|
||||
* @type Object
|
||||
*/
|
||||
events: {
|
||||
'change select[name="group"]': 'changeGroupDescription',
|
||||
'submit form': 'preventSubmit'
|
||||
},
|
||||
|
||||
/**
|
||||
* Shortcuts for ui elements
|
||||
* @type Object
|
||||
*/
|
||||
ui: {
|
||||
groupSelect: 'select[name="group"]',
|
||||
groupDescription: '#groupDescription',
|
||||
name: 'input[name="name"]',
|
||||
email: 'input[name="email"]',
|
||||
message: 'textarea[name="message"]',
|
||||
errors: '.errors'
|
||||
},
|
||||
|
||||
/**
|
||||
* Map model events to the view methods
|
||||
* @type Object
|
||||
*/
|
||||
modelEvents: {
|
||||
'invalid': 'showError',
|
||||
'submit:error': 'showError'
|
||||
},
|
||||
|
||||
/**
|
||||
* Prevent form submitting
|
||||
*/
|
||||
preventSubmit: function(event) {
|
||||
event.preventDefault();
|
||||
},
|
||||
|
||||
/**
|
||||
* 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] || '');
|
||||
},
|
||||
|
||||
/**
|
||||
* Display error messages
|
||||
* @param Array errors Array of errors
|
||||
*/
|
||||
showError: function(model, error) {
|
||||
var errorMessage;
|
||||
if (typeof error == 'string') {
|
||||
errorMessage = error;
|
||||
} else {
|
||||
errorMessage = error.message;
|
||||
}
|
||||
// TODO: Think about moving this to template
|
||||
this.ui.errors.html(errorMessage);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
})(Mibew, Backbone);
|
@ -0,0 +1,76 @@
|
||||
/**
|
||||
* @preserve This file is part of Mibew Messenger project.
|
||||
* http://mibew.org
|
||||
*
|
||||
* Copyright (c) 2005-2011 Mibew Messenger Community
|
||||
* License: http://mibew.org/license.php
|
||||
*/
|
||||
|
||||
(function(Mibew, Handlebars, _){
|
||||
|
||||
// Create shortcut for base view
|
||||
var BaseView = Mibew.Views.BaseSurveyForm;
|
||||
|
||||
/**
|
||||
* @class Represents survey form view
|
||||
*/
|
||||
Mibew.Views.SurveyForm = BaseView.extend(
|
||||
/** @lends Mibew.Views.SurveyForm.prototype */
|
||||
{
|
||||
/**
|
||||
* Template function
|
||||
* @type Function
|
||||
*/
|
||||
template: Handlebars.templates.survey_form,
|
||||
|
||||
/**
|
||||
* Map ui events to view methods.
|
||||
* The view inherits events from
|
||||
* {@link Mibew.Views.BaseSurveyForm.prototype.events}.
|
||||
* @type Object
|
||||
*/
|
||||
events: _.extend(
|
||||
{},
|
||||
BaseView.prototype.events,
|
||||
{
|
||||
'click #submit-survey': 'submitForm'
|
||||
}
|
||||
),
|
||||
|
||||
/**
|
||||
* Check form field, update model field and call model.submit()
|
||||
* method.
|
||||
*/
|
||||
submitForm: function() {
|
||||
var values = {};
|
||||
|
||||
// Update group id
|
||||
if (this.model.get('groups')) {
|
||||
values.groupId = this.ui.groupSelect.val()
|
||||
}
|
||||
|
||||
// Update name
|
||||
if (this.model.get('canChangeName')) {
|
||||
values.name = this.ui.name.val() || '';
|
||||
}
|
||||
|
||||
// Update email
|
||||
if (this.model.get('showEmail')) {
|
||||
values.email = this.ui.email.val() || '';
|
||||
}
|
||||
|
||||
// Update message
|
||||
if (this.model.get('showMessage')) {
|
||||
values.message = this.ui.message.val() || '';
|
||||
}
|
||||
|
||||
// Update model fields
|
||||
this.model.set(values, {validate: true});
|
||||
|
||||
// Submit form
|
||||
this.model.submit();
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
})(Mibew, Handlebars, _);
|
@ -0,0 +1,143 @@
|
||||
/**
|
||||
* @preserve This file is part of Mibew Messenger project.
|
||||
* http://mibew.org
|
||||
*
|
||||
* Copyright (c) 2005-2011 Mibew Messenger Community
|
||||
* License: http://mibew.org/license.php
|
||||
*/
|
||||
|
||||
(function(Mibew, _){
|
||||
|
||||
// Create shortcut for base model
|
||||
var BaseModel = Mibew.Models.BaseSurveyForm;
|
||||
|
||||
|
||||
/**
|
||||
* @class Represents leave message form model
|
||||
*/
|
||||
Mibew.Models.LeaveMessageForm = BaseModel.extend(
|
||||
/** @lends Mibew.Models.LeaveMessageForm.prototype */
|
||||
{
|
||||
/**
|
||||
* A list of default model values.
|
||||
* The model inherits default values from
|
||||
* {@link Mibew.Models.BaseSurveyForm.prototype.defaults}
|
||||
* @type Object
|
||||
*/
|
||||
defaults : _.extend(
|
||||
{},
|
||||
BaseModel.prototype.defaults,
|
||||
{
|
||||
/**
|
||||
* Indicate if captcha should be shown
|
||||
* @type Boolean
|
||||
*/
|
||||
showCaptcha: false,
|
||||
|
||||
/**
|
||||
* Value of captcha field
|
||||
* @type String
|
||||
*/
|
||||
captcha: ''
|
||||
}
|
||||
),
|
||||
|
||||
/**
|
||||
* Check attributes before set
|
||||
* @param Object attributes Attributes hash for test
|
||||
*/
|
||||
validate: function(attributes) {
|
||||
// Create some shortcuts
|
||||
var l = Mibew.Localization;
|
||||
|
||||
// Check email
|
||||
if (typeof attributes.email != 'undefined') {
|
||||
if (! attributes.email) {
|
||||
return l.get('leavemessage.error.email.required');
|
||||
}
|
||||
if(! Mibew.Utils.checkEmail(attributes.email)) {
|
||||
return l.get('leavemessage.error.wrong.email');
|
||||
}
|
||||
}
|
||||
|
||||
// Check name
|
||||
if (typeof attributes.name != 'undefined') {
|
||||
if (! attributes.name) {
|
||||
return l.get('leavemessage.error.name.required');
|
||||
}
|
||||
}
|
||||
|
||||
// Check message
|
||||
if (typeof attributes.message != 'undefined') {
|
||||
if (! attributes.message) {
|
||||
return l.get('leavemessage.error.message.required');
|
||||
}
|
||||
}
|
||||
|
||||
// Check captcha
|
||||
if (this.get('showCaptcha')) {
|
||||
if (typeof attributes.captcha != 'undefined') {
|
||||
if (! attributes.captcha) {
|
||||
return l.get('errors.captcha');
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Send form information to server
|
||||
*/
|
||||
submit: function() {
|
||||
if (! this.validate(this.attributes)) {
|
||||
var self = this;
|
||||
Mibew.Objects.server.callFunctions(
|
||||
[{
|
||||
"function": "processLeaveMessage",
|
||||
"arguments": {
|
||||
"references": {},
|
||||
"return": {},
|
||||
"groupId": self.get('groupId'),
|
||||
"name": self.get('name'),
|
||||
"info": self.get('info'),
|
||||
"email": self.get('email'),
|
||||
"message": self.get('message'),
|
||||
"referrer": self.get('referrer'),
|
||||
"captcha": self.get('captcha'),
|
||||
// There is no initialized thread yet
|
||||
"threadId": null,
|
||||
"token": null
|
||||
}
|
||||
}],
|
||||
function(args){
|
||||
if (args.errorCode == 0) {
|
||||
self.trigger('submit:complete', self);
|
||||
} else {
|
||||
self.trigger(
|
||||
'submit:error',
|
||||
self,
|
||||
{
|
||||
code: args.errorCode,
|
||||
message: args.errorMessage || ''
|
||||
}
|
||||
);
|
||||
}
|
||||
},
|
||||
true
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
/** Error codes */
|
||||
|
||||
/**
|
||||
* User enter wrong captcha value.
|
||||
* Correspond ThreadProcessorException::ERROR_WRONG_CAPTCHA at
|
||||
* server side.
|
||||
*/
|
||||
ERROR_WRONG_CAPTCHA: 10
|
||||
|
||||
/** End of error codes */
|
||||
}
|
||||
);
|
||||
|
||||
})(Mibew, _);
|
@ -0,0 +1,76 @@
|
||||
/**
|
||||
* @preserve This file is part of Mibew Messenger project.
|
||||
* http://mibew.org
|
||||
*
|
||||
* Copyright (c) 2005-2011 Mibew Messenger Community
|
||||
* License: http://mibew.org/license.php
|
||||
*/
|
||||
|
||||
(function(Mibew){
|
||||
|
||||
/**
|
||||
* @class Represents base class for survey form model
|
||||
*/
|
||||
Mibew.Models.BaseSurveyForm = Mibew.Models.Base.extend(
|
||||
/** @lends Mibew.Models.BaseSurveyForm.prototype */
|
||||
{
|
||||
/**
|
||||
* A list of default model values.
|
||||
* @type Object
|
||||
*/
|
||||
defaults : {
|
||||
/**
|
||||
* User name
|
||||
* @type String
|
||||
*/
|
||||
name: '',
|
||||
|
||||
/**
|
||||
* User email
|
||||
* @type String
|
||||
*/
|
||||
email: '',
|
||||
|
||||
/**
|
||||
* User message
|
||||
* @type String
|
||||
*/
|
||||
message: '',
|
||||
|
||||
/**
|
||||
* User info
|
||||
* @type String
|
||||
*/
|
||||
info: '',
|
||||
|
||||
/**
|
||||
* Page that user came from
|
||||
* @type String
|
||||
*/
|
||||
referrer: '',
|
||||
|
||||
/**
|
||||
* Selected group id
|
||||
* @type Number
|
||||
*/
|
||||
groupId: null,
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* If there is no available groups this field is equal to null.
|
||||
* @type Object
|
||||
* @todo Create HTML code at client side
|
||||
*/
|
||||
groups: null
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
})(Mibew);
|
137
src/messenger/webim/js/source/chat/models/survey/survey_form.js
Normal file
137
src/messenger/webim/js/source/chat/models/survey/survey_form.js
Normal file
@ -0,0 +1,137 @@
|
||||
/**
|
||||
* @preserve This file is part of Mibew Messenger project.
|
||||
* http://mibew.org
|
||||
*
|
||||
* Copyright (c) 2005-2011 Mibew Messenger Community
|
||||
* License: http://mibew.org/license.php
|
||||
*/
|
||||
|
||||
(function(Mibew, _){
|
||||
|
||||
// Create shortcut for base model
|
||||
var BaseModel = Mibew.Models.BaseSurveyForm;
|
||||
|
||||
/**
|
||||
* @class Represents survey form model
|
||||
*/
|
||||
Mibew.Models.SurveyForm = BaseModel.extend(
|
||||
/** @lends Mibew.Models.SurveyForm.prototype */
|
||||
{
|
||||
/**
|
||||
* A list of default model values.
|
||||
* The model inherits default values from
|
||||
* {@link Mibew.Models.BaseSurveyForm.prototype.defaults}
|
||||
* @type Object
|
||||
*/
|
||||
defaults : _.extend(
|
||||
{},
|
||||
BaseModel.prototype.defaults,
|
||||
{
|
||||
/**
|
||||
* Indicate if filed for email input should be shown
|
||||
* @type Boolean
|
||||
*/
|
||||
showEmail: false,
|
||||
|
||||
/**
|
||||
* Indicate if field for input first message should be shown
|
||||
* @type Boolean
|
||||
*/
|
||||
showMessage: false,
|
||||
|
||||
/**
|
||||
* Indicate if user name can be changed
|
||||
*/
|
||||
canChangeName: false
|
||||
}
|
||||
),
|
||||
|
||||
/**
|
||||
* Check attributes before set
|
||||
* @param Object attributes Attributes hash for test
|
||||
*/
|
||||
validate: function(attributes) {
|
||||
// Check email
|
||||
if (this.get('showEmail')) {
|
||||
if (typeof attributes.email != 'undefined') {
|
||||
if(! Mibew.Utils.checkEmail(attributes.email)) {
|
||||
return Mibew.Localization.get(
|
||||
'presurvey.error.wrong_email'
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Send form information to server
|
||||
*/
|
||||
submit: function() {
|
||||
if (! this.validate(this.attributes)) {
|
||||
var self = this;
|
||||
Mibew.Objects.server.callFunctions(
|
||||
[{
|
||||
"function": "processSurvey",
|
||||
"arguments": {
|
||||
"references": {},
|
||||
"return": {
|
||||
'next': 'next',
|
||||
'options': 'options'
|
||||
},
|
||||
"groupId": self.get('groupId'),
|
||||
"name": self.get('name'),
|
||||
"info": self.get('info'),
|
||||
"email": self.get('email'),
|
||||
"message": self.get('message'),
|
||||
"referrer": self.get('referrer'),
|
||||
// There is no initialized thread yet
|
||||
"threadId": null,
|
||||
"token": null
|
||||
}
|
||||
}],
|
||||
function(args){
|
||||
if (args.errorCode == 0) {
|
||||
self.trigger('submit:complete', self);
|
||||
// Stop survey module
|
||||
Mibew.Application.Survey.stop();
|
||||
|
||||
// Start next module
|
||||
switch (args.next) {
|
||||
case 'chat':
|
||||
// Start chat module
|
||||
Mibew.Application.Chat.start(
|
||||
args.options
|
||||
);
|
||||
break;
|
||||
|
||||
case 'leaveMessage':
|
||||
// Start leave message module
|
||||
Mibew.Application.LeaveMessage.start(
|
||||
args.options
|
||||
);
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new Error(
|
||||
'Do not know how to continue!'
|
||||
);
|
||||
}
|
||||
} else {
|
||||
self.trigger(
|
||||
'submit:error',
|
||||
self,
|
||||
{
|
||||
code: args.errorCode,
|
||||
message: args.errorMessage || ''
|
||||
}
|
||||
);
|
||||
}
|
||||
},
|
||||
true
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
})(Mibew, _);
|
@ -34,22 +34,23 @@
|
||||
// Add module initializer
|
||||
chat.addInitializer(function(options) {
|
||||
// Create some shortcuts
|
||||
var chatOptions = options.chatModule;
|
||||
var objs = Mibew.Objects;
|
||||
var models = Mibew.Objects.Models;
|
||||
var controls = Mibew.Objects.Models.Controls;
|
||||
var status = Mibew.Objects.Models.Status;
|
||||
|
||||
// Initialize Thread and User
|
||||
models.thread = new Mibew.Models.Thread(chatOptions.thread);
|
||||
models.user = new Mibew.Models.ChatUser(chatOptions.user);
|
||||
// Update page options to change logo block
|
||||
if (options.page) {
|
||||
models.page.set(options.page);
|
||||
}
|
||||
|
||||
// Initialize Page
|
||||
models.page = new Mibew.Models.Page(options.page);
|
||||
// Initialize Thread and User
|
||||
models.thread = new Mibew.Models.Thread(options.thread);
|
||||
models.user = new Mibew.Models.ChatUser(options.user);
|
||||
|
||||
// Create instance of the chat layout
|
||||
var layout = new Mibew.Layouts.Chat();
|
||||
Mibew.Objects.chatLayout = layout;
|
||||
objs.chatLayout = layout;
|
||||
|
||||
// Show layout at page
|
||||
app.mainRegion.show(layout);
|
||||
@ -70,8 +71,8 @@
|
||||
// Create mail control
|
||||
controls.sendMail = new Mibew.Models.SendMailControl({
|
||||
weight: 200,
|
||||
link: chatOptions.links.mail,
|
||||
windowParams: chatOptions.windowsParams.mail
|
||||
link: options.links.mail,
|
||||
windowParams: options.windowsParams.mail
|
||||
});
|
||||
ctrlsCollection.add(controls.sendMail);
|
||||
}
|
||||
@ -80,14 +81,14 @@
|
||||
if (models.user.get('isAgent')) {
|
||||
controls.redirect = new Mibew.Models.RedirectControl({
|
||||
weight: 200,
|
||||
link: chatOptions.links.redirect
|
||||
link: options.links.redirect
|
||||
});
|
||||
ctrlsCollection.add(controls.redirect);
|
||||
|
||||
controls.history = new Mibew.Models.HistoryControl({
|
||||
weight: 180,
|
||||
link: chatOptions.links.history,
|
||||
windowParams: chatOptions.windowsParams.history
|
||||
link: options.links.history,
|
||||
windowParams: options.windowsParams.history
|
||||
});
|
||||
ctrlsCollection.add(controls.history);
|
||||
}
|
||||
@ -104,10 +105,10 @@
|
||||
});
|
||||
ctrlsCollection.add(controls.refresh);
|
||||
|
||||
if (chatOptions.links.ssl) {
|
||||
if (options.links.ssl) {
|
||||
controls.secureMode = new Mibew.Models.SecureModeControl({
|
||||
weight: 120,
|
||||
link: chatOptions.links.ssl
|
||||
link: options.links.ssl
|
||||
});
|
||||
ctrlsCollection.add(controls.secureMode);
|
||||
}
|
||||
@ -160,7 +161,7 @@
|
||||
|
||||
// Create message processor model
|
||||
models.messageForm = new Mibew.Models.MessageForm(
|
||||
chatOptions.messageForm
|
||||
options.messageForm
|
||||
);
|
||||
|
||||
// Display message processor
|
||||
|
70
src/messenger/webim/js/source/chat/modules/leave_message.js
Normal file
70
src/messenger/webim/js/source/chat/modules/leave_message.js
Normal file
@ -0,0 +1,70 @@
|
||||
/**
|
||||
* @preserve This file is part of Mibew Messenger project.
|
||||
* http://mibew.org
|
||||
*
|
||||
* Copyright (c) 2005-2011 Mibew Messenger Community
|
||||
* License: http://mibew.org/license.php
|
||||
*/
|
||||
|
||||
(function(Mibew){
|
||||
|
||||
// Create shortcut for Application object
|
||||
var app = Mibew.Application;
|
||||
|
||||
// Create LeaveMessage module
|
||||
var leaveMessage = app.module('LeaveMessage', {startWithParent: false});
|
||||
|
||||
// Add module initializer
|
||||
leaveMessage.addInitializer(function(options) {
|
||||
// Create some shortcuts
|
||||
var objs = Mibew.Objects;
|
||||
var models = Mibew.Objects.Models;
|
||||
|
||||
// Update page options to change logo block
|
||||
if (options.page) {
|
||||
models.page.set(options.page);
|
||||
}
|
||||
|
||||
// Create instance of the leave message layout
|
||||
objs.leaveMessageLayout = new Mibew.Layouts.LeaveMessage();
|
||||
|
||||
// Show layout at page
|
||||
app.mainRegion.show(objs.leaveMessageLayout);
|
||||
|
||||
// Create an instance of the leave message form
|
||||
models.leaveMessageForm = new Mibew.Models.LeaveMessageForm(
|
||||
options.leaveMessageForm
|
||||
);
|
||||
|
||||
objs.leaveMessageLayout.leaveMessageFormRegion.show(
|
||||
new Mibew.Views.LeaveMessageForm({
|
||||
model: models.leaveMessageForm
|
||||
})
|
||||
);
|
||||
objs.leaveMessageLayout.descriptionRegion.show(
|
||||
new Mibew.Views.LeaveMessageDescription()
|
||||
);
|
||||
|
||||
// When message sent form should be hide and description should be
|
||||
// changed
|
||||
models.leaveMessageForm.on('submit:complete', function() {
|
||||
objs.leaveMessageLayout.leaveMessageFormRegion.close();
|
||||
objs.leaveMessageLayout.descriptionRegion.close();
|
||||
|
||||
objs.leaveMessageLayout.descriptionRegion.show(
|
||||
new Mibew.Views.LeaveMessageSentDescription()
|
||||
);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
// Add module finalizer
|
||||
leaveMessage.addFinalizer(function() {
|
||||
// Close layout
|
||||
Mibew.Objects.leaveMessageLayout.close();
|
||||
|
||||
// Remove instance of leaveMessage form model
|
||||
delete Mibew.Objects.Models.leaveMessageForm;
|
||||
});
|
||||
|
||||
})(Mibew);
|
49
src/messenger/webim/js/source/chat/modules/survey.js
Normal file
49
src/messenger/webim/js/source/chat/modules/survey.js
Normal file
@ -0,0 +1,49 @@
|
||||
/**
|
||||
* @preserve This file is part of Mibew Messenger project.
|
||||
* http://mibew.org
|
||||
*
|
||||
* Copyright (c) 2005-2011 Mibew Messenger Community
|
||||
* License: http://mibew.org/license.php
|
||||
*/
|
||||
|
||||
(function(Mibew){
|
||||
|
||||
// Create shortcut for Application object
|
||||
var app = Mibew.Application;
|
||||
|
||||
// Create an Survey module instance
|
||||
var survey = app.module('Survey', {startWithParent: false});
|
||||
|
||||
// Add module initializer
|
||||
survey.addInitializer(function(options) {
|
||||
|
||||
// Create some shortcuts
|
||||
var objs = Mibew.Objects;
|
||||
var models = Mibew.Objects.Models;
|
||||
|
||||
// Create instance of the survey layout
|
||||
objs.surveyLayout = new Mibew.Layouts.Survey();
|
||||
|
||||
// Show layout at page
|
||||
app.mainRegion.show(objs.surveyLayout);
|
||||
|
||||
// Create an instance of the survey form
|
||||
models.surveyForm = new Mibew.Models.SurveyForm(
|
||||
options.surveyForm
|
||||
);
|
||||
|
||||
objs.surveyLayout.surveyFormRegion.show(new Mibew.Views.SurveyForm({
|
||||
model: models.surveyForm
|
||||
}));
|
||||
});
|
||||
|
||||
// Add module finalizer
|
||||
survey.addFinalizer(function() {
|
||||
// Close layout
|
||||
Mibew.Objects.surveyLayout.close();
|
||||
|
||||
// Remove instance of survey form model
|
||||
delete Mibew.Objects.Models.surveyForm;
|
||||
});
|
||||
|
||||
})(Mibew);
|
@ -1,11 +0,0 @@
|
||||
/**
|
||||
* @preserve This file is part of Mibew Messenger project.
|
||||
* http://mibew.org
|
||||
*
|
||||
* Copyright (c) 2005-2011 Mibew Messenger Community
|
||||
* License: http://mibew.org/license.php
|
||||
*/
|
||||
|
||||
EventHelper.register(window, 'onload', function(){
|
||||
MessageForm = new ClientForm(document.leaveMessageForm);
|
||||
});
|
@ -1,25 +0,0 @@
|
||||
/**
|
||||
* @preserve This file is part of Mibew Messenger project.
|
||||
* http://mibew.org
|
||||
*
|
||||
* Copyright (c) 2005-2011 Mibew Messenger Community
|
||||
* License: http://mibew.org/license.php
|
||||
*/
|
||||
|
||||
var SurveyForm = Class.create();
|
||||
Class.inherit(SurveyForm, ClientForm, {
|
||||
checkFields: function() {
|
||||
if(this.form.email == null || this.form.email.getAttribute('type') == 'hidden') {
|
||||
return null;
|
||||
}
|
||||
if(! this.emailIsValid(this.form.email)){
|
||||
return this.localizedStrings.wrongEmail || '';
|
||||
}
|
||||
return null;
|
||||
}
|
||||
});
|
||||
|
||||
EventHelper.register(window, 'onload', function(){
|
||||
Survey = new SurveyForm(document.surveyForm);
|
||||
Survey.localize(localizedStrings);
|
||||
});
|
@ -1,145 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright 2005-2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
require_once('libs/init.php');
|
||||
require_once('libs/chat.php');
|
||||
require_once('libs/expand.php');
|
||||
require_once('libs/groups.php');
|
||||
require_once('libs/captcha.php');
|
||||
require_once('libs/notify.php');
|
||||
require_once('libs/classes/thread.php');
|
||||
|
||||
$errors = array();
|
||||
$page = array();
|
||||
|
||||
function store_message($name, $email, $info, $message,$groupid,$referrer) {
|
||||
global $current_locale;
|
||||
|
||||
$remoteHost = get_remote_host();
|
||||
$userbrowser = $_SERVER['HTTP_USER_AGENT'];
|
||||
$visitor = visitor_from_request();
|
||||
|
||||
$thread = Thread::create();
|
||||
$thread->groupId = $groupid;
|
||||
$thread->userName = $name;
|
||||
$thread->remote = $remoteHost;
|
||||
$thread->referer = $referrer;
|
||||
$thread->locale = $current_locale;
|
||||
$thread->userId = $visitor['id'];
|
||||
$thread->userAgent = $userbrowser;
|
||||
$thread->state = Thread::STATE_LEFT;
|
||||
$thread->save();
|
||||
|
||||
if( $referrer ) {
|
||||
$thread->postMessage(Thread::KIND_FOR_AGENT,getstring2('chat.came.from',array($referrer)));
|
||||
}
|
||||
if($email) {
|
||||
$thread->postMessage(Thread::KIND_FOR_AGENT, getstring2('chat.visitor.email',array($email)));
|
||||
}
|
||||
if($info) {
|
||||
$thread->postMessage(Thread::KIND_FOR_AGENT, getstring2('chat.visitor.info',array($info)));
|
||||
}
|
||||
$thread->postMessage(Thread::KIND_USER, $message, $name);
|
||||
}
|
||||
|
||||
$groupid = "";
|
||||
$groupname = "";
|
||||
$group = NULL;
|
||||
if(Settings::get('enablegroups') == '1') {
|
||||
$groupid = verifyparam( "group", "/^\d{1,8}$/", "");
|
||||
if($groupid) {
|
||||
$group = group_by_id($groupid);
|
||||
if(!$group) {
|
||||
$groupid = "";
|
||||
} else {
|
||||
$groupname = get_group_name($group);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$email = getparam('email');
|
||||
$visitor_name = getparam('name');
|
||||
$message = getparam('message');
|
||||
$info = getparam('info');
|
||||
$referrer = urldecode(getparam("referrer"));
|
||||
|
||||
if( !$email ) {
|
||||
$errors[] = no_field("form.field.email");
|
||||
} else if( !$visitor_name ) {
|
||||
$errors[] = no_field("form.field.name");
|
||||
} else if( !$message ) {
|
||||
$errors[] = no_field("form.field.message");
|
||||
} else {
|
||||
if( !is_valid_email($email)) {
|
||||
$errors[] = wrong_field("form.field.email");
|
||||
}
|
||||
}
|
||||
|
||||
if(Settings::get("enablecaptcha") == "1" && can_show_captcha()) {
|
||||
$captcha = getparam('captcha');
|
||||
$original = isset($_SESSION["mibew_captcha"]) ? $_SESSION["mibew_captcha"] : "";
|
||||
if(empty($original) || empty($captcha) || $captcha != $original) {
|
||||
$errors[] = getlocal('errors.captcha');
|
||||
}
|
||||
unset($_SESSION['mibew_captcha']);
|
||||
}
|
||||
|
||||
if( count($errors) > 0 ) {
|
||||
$page = array_merge_recursive(
|
||||
$page,
|
||||
setup_logo($group),
|
||||
setup_leavemessage($visitor_name,$email,$message,$groupid,$groupname,$info,$referrer)
|
||||
);
|
||||
expand("styles/dialogs", getchatstyle(), "leavemessage.tpl");
|
||||
exit;
|
||||
}
|
||||
|
||||
$message_locale = Settings::get('left_messages_locale');
|
||||
if(!locale_exists($message_locale)) {
|
||||
$message_locale = $home_locale;
|
||||
}
|
||||
|
||||
store_message($visitor_name, $email, $info, $message, $groupid, $referrer);
|
||||
|
||||
$subject = getstring2_("leavemail.subject", array($visitor_name), $message_locale);
|
||||
$body = getstring2_("leavemail.body", array($visitor_name,$email,$message,$info ? "$info\n" : ""), $message_locale);
|
||||
|
||||
if (isset($group) && !empty($group['vcemail'])) {
|
||||
$inbox_mail = $group['vcemail'];
|
||||
} else {
|
||||
if (! is_null($group['parent'])) {
|
||||
$parentgroup = group_by_id($group['parent']);
|
||||
if ($parentgroup && !empty($parentgroup['vcemail'])) {
|
||||
$inbox_mail = $parentgroup['vcemail'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($inbox_mail)) {
|
||||
$inbox_mail = Settings::get('email');
|
||||
}
|
||||
|
||||
if($inbox_mail) {
|
||||
webim_mail($inbox_mail, $email, $subject, $body);
|
||||
}
|
||||
|
||||
$page = array_merge_recursive(
|
||||
$page,
|
||||
setup_logo($group)
|
||||
);
|
||||
expand("styles/dialogs", getchatstyle(), "leavemessagesent.tpl");
|
||||
?>
|
@ -156,42 +156,93 @@ function setup_logo($group = NULL) {
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare values common for chat, prechat survey form and leave message form.
|
||||
* @return array
|
||||
*/
|
||||
function prepare_chat_app_data() {
|
||||
$data = array();
|
||||
|
||||
// Set enter key shortcut
|
||||
if (Settings::get('sendmessagekey') == 'enter') {
|
||||
$data['send_shortcut'] = "Enter";
|
||||
} else {
|
||||
$data['send_shortcut'] = is_mac_opera()
|
||||
? "⌘-Enter"
|
||||
: "Ctrl-Enter";
|
||||
}
|
||||
|
||||
// Set refresh frequency
|
||||
$data['frequency'] = Settings::get('updatefrequency_chat');
|
||||
|
||||
// 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');
|
||||
|
||||
// Set some localized strings
|
||||
$data['localized'] = array(
|
||||
'email.required' => no_field("form.field.email"),
|
||||
'name.required' => no_field("form.field.name"),
|
||||
'message.required' => no_field("form.field.message"),
|
||||
'wrong.email' => wrong_field("form.field.email")
|
||||
);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare data to display leave message form
|
||||
*
|
||||
* @param string $name User name
|
||||
* @param string $email User email
|
||||
* @param string $message First message text
|
||||
* @param int $groupid Id of selected group
|
||||
* @param string $groupname Name of selected group
|
||||
* @param int $group_id Id of selected group
|
||||
* @param string $info User info
|
||||
* @param string $referrer URL of referrer page
|
||||
* @return array Array of leave message form data
|
||||
*
|
||||
* @todo Think about $info param. It seems to this param is meaningless.
|
||||
*/
|
||||
function setup_leavemessage($name, $email, $message, $groupid, $groupname, $info, $referrer) {
|
||||
$data = array();
|
||||
function setup_leavemessage($name, $email, $group_id, $info, $referrer) {
|
||||
$data = prepare_chat_app_data();
|
||||
|
||||
$canshowcaptcha = can_show_captcha();
|
||||
$data['formname'] = topage($name);
|
||||
$data['formemail'] = topage($email);
|
||||
$data['formmessage'] = $message ? topage($message) : "";
|
||||
$data['showcaptcha'] = Settings::get("enablecaptcha") == "1" && $canshowcaptcha ? "1" : "";
|
||||
$data['formgroupid'] = $groupid;
|
||||
$data['formgroupname'] = $groupname;
|
||||
$data['forminfo'] = topage($info);
|
||||
$data['referrer'] = urlencode(topage($referrer));
|
||||
// Create some empty arrays
|
||||
$data['leaveMessage'] = array();
|
||||
|
||||
$group = group_by_id($group_id);
|
||||
$group_name = '';
|
||||
if ($group) {
|
||||
$group_name = get_group_name($group);
|
||||
}
|
||||
|
||||
$data['leaveMessage']['leaveMessageForm'] = array(
|
||||
'name' => topage($name),
|
||||
'email' => topage($email),
|
||||
'groupId' => $group_id,
|
||||
'groupName' => $group_name,
|
||||
'info' => topage($info),
|
||||
'referrer' => topage($referrer),
|
||||
'showCaptcha' => (bool)(Settings::get("enablecaptcha") == "1"
|
||||
&& can_show_captcha())
|
||||
);
|
||||
|
||||
$data['page.title'] = (empty($group_name)?'':$group_name.': ')
|
||||
. getlocal('leavemessage.title');
|
||||
$data['leaveMessage']['page'] = array(
|
||||
'title' => $data['page.title']
|
||||
);
|
||||
|
||||
if (Settings::get('enablegroups') == '1') {
|
||||
$groups = setup_groups_select($groupid, false);
|
||||
$groups = setup_groups_select($group_id, false);
|
||||
if ($groups) {
|
||||
$data['groups'] = $groups['select'];
|
||||
$data['group.descriptions'] = json_encode($groups['descriptions']);
|
||||
$data['default.department.description'] = $groups['defaultdescription'];
|
||||
$data['leaveMessage']['leaveMessageForm']['groups'] = array(
|
||||
'select' => $groups['select'],
|
||||
'descriptions' => $groups['descriptions'],
|
||||
'defaultDescription' => $groups['defaultdescription']
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$data['startFrom'] = 'leaveMessage';
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
@ -200,34 +251,47 @@ function setup_leavemessage($name, $email, $message, $groupid, $groupname, $info
|
||||
*
|
||||
* @param string $name User name
|
||||
* @param string $email User email
|
||||
* @param int $groupid Id of selected group
|
||||
* @param int $group_id Id of selected group
|
||||
* @param string $info User info
|
||||
* @param string $referrer URL of referrer page
|
||||
* @return array Array of survey data
|
||||
*
|
||||
* @todo Think about $info param. It seems to this param is meaningless.
|
||||
*/
|
||||
function setup_survey($name, $email, $groupid, $info, $referrer) {
|
||||
$data = array();
|
||||
function setup_survey($name, $email, $group_id, $info, $referrer) {
|
||||
$data = prepare_chat_app_data();
|
||||
|
||||
$data['formname'] = topage($name);
|
||||
$data['formemail'] = topage($email);
|
||||
$data['formgroupid'] = $groupid;
|
||||
$data['forminfo'] = topage($info);
|
||||
$data['referrer'] = urlencode(topage($referrer));
|
||||
// Create some empty arrays
|
||||
$data['survey'] = array();
|
||||
|
||||
if (Settings::get('enablegroups') == '1' && Settings::get('surveyaskgroup') == '1') {
|
||||
$groups = setup_groups_select($groupid, true);
|
||||
$data['survey']['surveyForm'] = array(
|
||||
'name' => topage($name),
|
||||
'groupId' => $group_id,
|
||||
'email' => topage($email),
|
||||
'info' => topage($info),
|
||||
'referrer' => topage($referrer),
|
||||
'showEmail' => (bool)(Settings::get("surveyaskmail") == "1"),
|
||||
'showMessage' => (bool)(Settings::get("surveyaskmessage") == "1"),
|
||||
'canChangeName' => (bool)(Settings::get('usercanchangename') == "1")
|
||||
);
|
||||
|
||||
$data['page.title'] = getlocal('presurvey.title');
|
||||
$data['survey']['page'] = array(
|
||||
'title' => $data['page.title']
|
||||
);
|
||||
|
||||
if (Settings::get('enablegroups') == '1'
|
||||
&& Settings::get('surveyaskgroup') == '1') {
|
||||
|
||||
$groups = setup_groups_select($group_id, true);
|
||||
if ($groups) {
|
||||
$data['groups'] = $groups['select'];
|
||||
$data['group.descriptions'] = json_encode($groups['descriptions']);
|
||||
$data['default.department.description'] = $groups['defaultdescription'];
|
||||
$data['survey']['surveyForm']['groups'] = array(
|
||||
'select' => $groups['select'],
|
||||
'descriptions' => $groups['descriptions'],
|
||||
'defaultDescription' => $groups['defaultdescription'],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$data['showemail'] = Settings::get("surveyaskmail") == "1" ? "1" : "";
|
||||
$data['showmessage'] = Settings::get("surveyaskmessage") == "1" ? "1" : "";
|
||||
$data['showname'] = Settings::get('usercanchangename') == "1" ? "1" : "";
|
||||
$data['startFrom'] = 'survey';
|
||||
|
||||
return $data;
|
||||
}
|
||||
@ -283,7 +347,7 @@ function setup_groups_select($groupid, $markoffline)
|
||||
* @return array Array of chat view data
|
||||
*/
|
||||
function setup_chatview(Thread $thread) {
|
||||
$data = array();
|
||||
$data = prepare_chat_app_data();
|
||||
|
||||
// Get group info
|
||||
if (! empty($thread->groupId)) {
|
||||
@ -306,11 +370,14 @@ function setup_chatview(Thread $thread) {
|
||||
'token' => $thread->lastToken
|
||||
);
|
||||
|
||||
$data['chat.title'] = topage(
|
||||
$data['page.title'] = topage(
|
||||
empty($group['vcchattitle'])
|
||||
? Settings::get('chattitle')
|
||||
: $group['vcchattitle']
|
||||
);
|
||||
$data['chat']['page'] = array(
|
||||
'title' => $data['page.title']
|
||||
);
|
||||
|
||||
// Setup logo
|
||||
$data = array_merge_recursive(
|
||||
@ -320,12 +387,8 @@ function setup_chatview(Thread $thread) {
|
||||
|
||||
// Set enter key shortcut
|
||||
if (Settings::get('sendmessagekey') == 'enter') {
|
||||
$data['send_shortcut'] = "Enter";
|
||||
$data['chat']['messageForm']['ignoreCtrl'] = true;
|
||||
} else {
|
||||
$data['send_shortcut'] = is_mac_opera()
|
||||
? "⌘-Enter"
|
||||
: "Ctrl-Enter";
|
||||
$data['chat']['messageForm']['ignoreCtrl'] = false;
|
||||
}
|
||||
|
||||
@ -333,9 +396,6 @@ function setup_chatview(Thread $thread) {
|
||||
$data['isOpera95'] = is_agent_opera95();
|
||||
$data['neediframesrc'] = needsFramesrc();
|
||||
|
||||
// Set refresh frequency
|
||||
$data['frequency'] = Settings::get('updatefrequency_chat');
|
||||
|
||||
// Load dialogs style options
|
||||
$style_config = get_dialogs_style_config(getchatstyle());
|
||||
$data['chat']['windowsParams']['mail']
|
||||
@ -346,6 +406,8 @@ function setup_chatview(Thread $thread) {
|
||||
$data['chat']['windowsParams']['history']
|
||||
= $style_config['history']['window_params'];
|
||||
|
||||
$data['startFrom'] = 'chat';
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
@ -531,4 +593,75 @@ function get_remote_host()
|
||||
return isset($_SERVER['REMOTE_HOST']) ? $_SERVER['REMOTE_HOST'] : $extAddr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Start chat thread for user
|
||||
*
|
||||
* @global string $current_locale Current locale code
|
||||
* @param int $group_id Id of group related to thread
|
||||
* @param string $visitor_id Id of the visitor
|
||||
* @param string $visitor_name Name of the visitor
|
||||
* @param string $referrer Page user came from
|
||||
* @param string $info User info
|
||||
*/
|
||||
function chat_start_for_user($group_id, $visitor_id, $visitor_name, $referrer, $info) {
|
||||
global $current_locale;
|
||||
|
||||
// Get user info
|
||||
$remote_host = get_remote_host();
|
||||
$user_browser = $_SERVER['HTTP_USER_AGENT'];
|
||||
|
||||
// Check connection limit
|
||||
if(Thread::connectionLimitReached($remote_host)) {
|
||||
die("number of connections from your IP is exceeded, try again later");
|
||||
}
|
||||
|
||||
// Create thread
|
||||
$thread = Thread::create();
|
||||
$thread->groupId = $group_id;
|
||||
$thread->userName = $visitor_name;
|
||||
$thread->remote = $remote_host;
|
||||
$thread->referer = $referrer;
|
||||
$thread->locale = $current_locale;
|
||||
$thread->userId = $visitor_id;
|
||||
$thread->userAgent = $user_browser;
|
||||
$thread->state = Thread::STATE_LOADING;
|
||||
$thread->save();
|
||||
|
||||
$_SESSION['threadid'] = $thread->id;
|
||||
|
||||
// Check if invitation accept
|
||||
$operator = invitation_accept($_SESSION['visitorid'], $thread->id);
|
||||
if ($operator) {
|
||||
$operator = operator_by_id($operator);
|
||||
$operator_name = get_operator_name($operator);
|
||||
$thread->postMessage(
|
||||
Thread::KIND_FOR_AGENT,
|
||||
getstring2(
|
||||
'chat.visitor.invitation.accepted',
|
||||
array($operator_name)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Send some messages
|
||||
if ($referrer) {
|
||||
$thread->postMessage(
|
||||
Thread::KIND_FOR_AGENT,
|
||||
getstring2('chat.came.from',array($referrer))
|
||||
);
|
||||
}
|
||||
|
||||
$thread->postMessage(Thread::KIND_INFO, getstring('chat.wait'));
|
||||
|
||||
// TODO: May be move sending this message somewhere else?
|
||||
if ($info) {
|
||||
$thread->postMessage(
|
||||
Thread::KIND_FOR_AGENT,
|
||||
getstring2('chat.visitor.info',array($info))
|
||||
);
|
||||
}
|
||||
|
||||
return $thread;
|
||||
}
|
||||
|
||||
?>
|
@ -403,6 +403,254 @@ class ThreadProcessor extends ClientSideProcessor {
|
||||
'closed' => true
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Process submitted prechat survey.
|
||||
*
|
||||
* @global string $namecookie Name of cookie that store visitor name
|
||||
* @param array $args Associative array of arguments. It must contains
|
||||
* following keys:
|
||||
* - 'threadId': for this function this param equals to null;
|
||||
* - 'token': for this function this param equals to null;
|
||||
* - 'name': string, user name;
|
||||
* - 'email': string, user email;
|
||||
* - 'message': string, first user message;
|
||||
* - 'info': string, some info about user;
|
||||
* - 'referrer': page user came from;
|
||||
* - 'groupId': selected group id.
|
||||
* @return array Array of results. It contains following keys:
|
||||
* - 'next': string, indicates what module run next;
|
||||
* - 'options': options array for next module.
|
||||
*/
|
||||
protected function apiProcessSurvey($args) {
|
||||
global $namecookie;
|
||||
|
||||
$visitor = visitor_from_request();
|
||||
|
||||
// Get form values
|
||||
$first_message = $args['message'];
|
||||
$info = $args['info'];
|
||||
$email = $args['email'];
|
||||
$referrer = $args['referrer'];
|
||||
|
||||
// Verify group id
|
||||
$group_id = '';
|
||||
$group = NULL;
|
||||
if(Settings::get('enablegroups') == '1') {
|
||||
if (preg_match("/^\d{1,8}$/", $args['groupId']) != 0) {
|
||||
$group = group_by_id($args['groupId']);
|
||||
if ($group) {
|
||||
$group_id = $args['groupId'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(Settings::get('usercanchangename') == "1" && !empty($args['name'])) {
|
||||
$newname = $args['name'];
|
||||
if($newname != $visitor['name']) {
|
||||
$data = strtr(
|
||||
base64_encode(myiconv($webim_encoding,"utf-8",$newname)),
|
||||
'+/=',
|
||||
'-_,'
|
||||
);
|
||||
setcookie($namecookie, $data, time()+60*60*24*365);
|
||||
$visitor['name'] = $newname;
|
||||
}
|
||||
}
|
||||
|
||||
// Check if there are online operators
|
||||
if(!has_online_operators($group_id)) {
|
||||
// Display leave message page
|
||||
$client_data = setup_leavemessage(
|
||||
$visitor['name'],
|
||||
$email,
|
||||
$group_id,
|
||||
$info,
|
||||
$referrer
|
||||
);
|
||||
$options = $client_data['leaveMessage'];
|
||||
$options['page'] += setup_logo($group);
|
||||
return array(
|
||||
'next' => 'leaveMessage',
|
||||
'options' => $options
|
||||
);
|
||||
}
|
||||
|
||||
// Initialize dialog
|
||||
$thread = chat_start_for_user(
|
||||
$group_id,
|
||||
$visitor['id'],
|
||||
$visitor['name'],
|
||||
$referrer,
|
||||
$info
|
||||
);
|
||||
|
||||
// Send some messages
|
||||
if($email) {
|
||||
$thread->postMessage(
|
||||
Thread::KIND_FOR_AGENT,
|
||||
getstring2('chat.visitor.email',array($email))
|
||||
);
|
||||
}
|
||||
|
||||
if($first_message) {
|
||||
$posted_id = $thread->postMessage(
|
||||
Thread::KIND_USER,
|
||||
$first_message,
|
||||
$visitor['name']
|
||||
);
|
||||
$thread->shownMessageId = $posted_id;
|
||||
$thread->save();
|
||||
}
|
||||
|
||||
// Prepare chat options
|
||||
$client_data = setup_chatview_for_user($thread);
|
||||
$options = $client_data['chat'];
|
||||
$options['page'] += setup_logo($group);
|
||||
|
||||
return array(
|
||||
'next' => 'chat',
|
||||
'options' => $options
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Process submitted leave message form.
|
||||
*
|
||||
* Send message to operator email and create special meil thread.
|
||||
* @global string $home_locale Code of the home locale
|
||||
* @global string $current_locale Code of the current locale
|
||||
* @param array $args Associative array of arguments. It must contains
|
||||
* following keys:
|
||||
* - 'threadId': for this function this param equals to null;
|
||||
* - 'token': for this function this param equals to null;
|
||||
* - 'name': string, user name;
|
||||
* - 'email': string, user email;
|
||||
* - 'message': string, user message;
|
||||
* - 'info': string, some info about user;
|
||||
* - 'referrer': string, page user came from;
|
||||
* - 'captcha': string, captcha value;
|
||||
* - 'groupId': selected group id.
|
||||
*
|
||||
* @throws ThreadProcessorException Can throw an exception if captcha or
|
||||
* email is wrong.
|
||||
*/
|
||||
protected function apiProcessLeaveMessage($args) {
|
||||
global $home_locale, $current_locale;
|
||||
|
||||
// Check captcha
|
||||
if(Settings::get('enablecaptcha') == '1' && can_show_captcha()) {
|
||||
$captcha = $args['captcha'];
|
||||
$original = isset($_SESSION["mibew_captcha"])
|
||||
? $_SESSION["mibew_captcha"]
|
||||
: '';
|
||||
unset($_SESSION['mibew_captcha']);
|
||||
if(empty($original) || empty($captcha) || $captcha != $original) {
|
||||
throw new ThreadProcessorException(
|
||||
getlocal('errors.captcha'),
|
||||
ThreadProcessorException::ERROR_WRONG_CAPTCHA
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Get form fields
|
||||
$email = $args['email'];
|
||||
$name = $args['name'];
|
||||
$message = $args['message'];
|
||||
$info = $args['info'];
|
||||
$referrer = $args['referrer'];
|
||||
|
||||
if( !is_valid_email($email)) {
|
||||
throw new ThreadProcessorException(
|
||||
wrong_field("form.field.email"),
|
||||
ThreadProcessorException::ERROR_WRONG_EMAIL
|
||||
);
|
||||
}
|
||||
|
||||
// Verify group id
|
||||
$group_id = '';
|
||||
if(Settings::get('enablegroups') == '1') {
|
||||
if (preg_match("/^\d{1,8}$/", $args['groupId']) != 0) {
|
||||
$group = group_by_id($args['groupId']);
|
||||
if ($group) {
|
||||
$group_id = $args['groupId'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Create thread for left message
|
||||
$remote_host = get_remote_host();
|
||||
$user_browser = $_SERVER['HTTP_USER_AGENT'];
|
||||
$visitor = visitor_from_request();
|
||||
|
||||
// Get message locale
|
||||
$message_locale = Settings::get('left_messages_locale');
|
||||
if(!locale_exists($message_locale)) {
|
||||
$message_locale = $home_locale;
|
||||
}
|
||||
|
||||
// Create thread
|
||||
$thread = Thread::create();
|
||||
$thread->groupId = $groupid;
|
||||
$thread->userName = $name;
|
||||
$thread->remote = $remote_host;
|
||||
$thread->referer = $referrer;
|
||||
$thread->locale = $current_locale;
|
||||
$thread->userId = $visitor['id'];
|
||||
$thread->userAgent = $user_browser;
|
||||
$thread->state = Thread::STATE_LEFT;
|
||||
$thread->save();
|
||||
|
||||
// Send some messages
|
||||
if ($referrer) {
|
||||
$thread->postMessage(
|
||||
Thread::KIND_FOR_AGENT,
|
||||
getstring2('chat.came.from', array($referrer))
|
||||
);
|
||||
}
|
||||
if($email) {
|
||||
$thread->postMessage(
|
||||
Thread::KIND_FOR_AGENT,
|
||||
getstring2('chat.visitor.email', array($email))
|
||||
);
|
||||
}
|
||||
if($info) {
|
||||
$thread->postMessage(
|
||||
Thread::KIND_FOR_AGENT,
|
||||
getstring2('chat.visitor.info', array($info))
|
||||
);
|
||||
}
|
||||
$thread->postMessage(Thread::KIND_USER, $message, $name);
|
||||
|
||||
// Get email for message
|
||||
$inbox_mail = get_group_email($group_id);
|
||||
|
||||
if (empty($inbox_mail)) {
|
||||
$inbox_mail = Settings::get('email');
|
||||
}
|
||||
|
||||
// Send email
|
||||
if($inbox_mail) {
|
||||
// Prepare message to send by email
|
||||
$subject = getstring2_("leavemail.subject",
|
||||
array($args['name']),
|
||||
$message_locale
|
||||
);
|
||||
$body = getstring2_(
|
||||
"leavemail.body",
|
||||
array(
|
||||
$args['name'],
|
||||
$email,
|
||||
$message,
|
||||
$info ? $info."\n" : ""
|
||||
),
|
||||
$message_locale
|
||||
);
|
||||
|
||||
// Send
|
||||
webim_mail($inbox_mail, $email, $subject, $body);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class ThreadProcessorException extends RequestProcessorException {
|
||||
@ -442,6 +690,14 @@ class ThreadProcessorException extends RequestProcessorException {
|
||||
* Wrong recipient value
|
||||
*/
|
||||
const WRONG_RECIPIENT_VALUE = 9;
|
||||
/**
|
||||
* Wrong captcha value
|
||||
*/
|
||||
const ERROR_WRONG_CAPTCHA = 10;
|
||||
/**
|
||||
* Wrong email address
|
||||
*/
|
||||
const ERROR_WRONG_EMAIL = 11;
|
||||
}
|
||||
|
||||
?>
|
@ -104,4 +104,28 @@ function get_top_level_group($group)
|
||||
return is_null($group['parent'])?$group:group_by_id($group['parent']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Try to load email for specified group or for its parent.
|
||||
* @param int $group_id Group id
|
||||
* @return string|boolean Email address or false if there is no email
|
||||
*/
|
||||
function get_group_email($group_id) {
|
||||
// Try to get group email
|
||||
$group = group_by_id($group_id);
|
||||
if ($group && !empty($group['vcemail'])) {
|
||||
return $group['vcemail'];
|
||||
}
|
||||
|
||||
// Try to get parent group email
|
||||
if (! is_null($group['parent'])) {
|
||||
$group = group_by_id($group['parent']);
|
||||
if ($group && !empty($group['vcemail'])) {
|
||||
return $group['vcemail'];
|
||||
}
|
||||
}
|
||||
|
||||
// There is no email
|
||||
return false;
|
||||
}
|
||||
|
||||
?>
|
@ -128,12 +128,8 @@ if ($pparam == "redirect") {
|
||||
setup_redirect_links($threadid, $operator, $token);
|
||||
expand("../styles/dialogs", getchatstyle(), "redirect.tpl");
|
||||
} else {
|
||||
// Load JavaScript plugins and JavaScripts, CSS files required by them
|
||||
$page['additional_css'] = get_additional_css('agent_chat_window');
|
||||
$page['additional_js'] = get_additional_js('agent_chat_window');
|
||||
$page['js_plugin_options'] = get_js_plugin_options('agent_chat_window');
|
||||
// Build js application options
|
||||
$page['chatModule'] = json_encode($page['chat']);
|
||||
$page['chatOptions'] = json_encode($page['chat']);
|
||||
// Expand page
|
||||
expand("../styles/dialogs", getchatstyle(), "chat.tpl");
|
||||
}
|
||||
|
@ -110,6 +110,12 @@ img {
|
||||
height: 16px;
|
||||
background: transparent url("images/buttons.gif") scroll no-repeat 0 0;
|
||||
}
|
||||
.iclosewin {
|
||||
background-position: -128px -16px;
|
||||
}
|
||||
a:hover .iclosewin {
|
||||
background-position: -128px 0;
|
||||
}
|
||||
.close-control .tpl-image {
|
||||
background-position: -128px -16px;
|
||||
}
|
||||
@ -377,6 +383,8 @@ img {
|
||||
}
|
||||
.wndbr .buttons {
|
||||
top: 14px;
|
||||
position: absolute;
|
||||
right: 25px;
|
||||
}
|
||||
#headers {
|
||||
padding: 0 10px;
|
||||
|
@ -1,3 +1,30 @@
|
||||
{{! Chat window top. Includes logo and some info about company}}
|
||||
<div id="top">
|
||||
<div id="logo">
|
||||
{{#if page.company.chatLogoURL}}
|
||||
{{! Use 'unless' instead of 'if' because of the bug with nested 'if else' in handlebars 1.0.0-rc.3}}
|
||||
{{#unless page.webimHost}}
|
||||
<img src="{{page.company.chatLogoURL}}" alt=""/>
|
||||
{{else}}
|
||||
<a onclick="window.open('{{page.webimHost}}');return false;" href="{{page.webimHost}}">
|
||||
<img src="{{page.company.chatLogoURL}}" alt=""/>
|
||||
</a>
|
||||
{{/unless}}
|
||||
{{else}}
|
||||
{{#if page.webimHost}}
|
||||
<a onclick="window.open('{{page.webimHost}}');return false;" href="{{page.webimHost}}">
|
||||
<img src="{{page.tplRoot}}/images/default-logo.gif" alt=""/>
|
||||
</a>
|
||||
{{else}}
|
||||
<img src="{{page.tplRoot}}/images/default-logo.gif" alt=""/>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
||||
<div id="page-title">{{page.title}}</div>
|
||||
<div class="clear"> </div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{! Chat header}}
|
||||
<div id="chat-header">
|
||||
<div class="bgc"><div class="bgl"><div class="bgr">
|
||||
|
@ -0,0 +1,6 @@
|
||||
<div class="buttons">
|
||||
<a href="javascript:window.close();" title="{{L10n "leavemessage.close"}}">
|
||||
<img class="tpl-image iclosewin" src="{{page.webimRoot}}/images/free.gif" alt="{{L10n "leavemessage.close"}}" />
|
||||
</a>
|
||||
</div>
|
||||
<div class="messagetxt">{{L10n "leavemessage.descr"}}</div>
|
@ -0,0 +1,43 @@
|
||||
<form name="leaveMessageForm" method="post" action="">
|
||||
<input type="hidden" name="style" value="{{page.style}}"/>
|
||||
<input type="hidden" name="info" value="{{info}}"/>
|
||||
<input type="hidden" name="referrer" value="{{referrer}}"/>
|
||||
{{#unless groups}}{{#if groupId}}<input type="hidden" name="group" value="{{groupId}}"/>{{/if}}{{/unless}}
|
||||
|
||||
<div class="errors"></div>
|
||||
|
||||
<table cellspacing="1" cellpadding="5" border="0" class="form">
|
||||
<tr>
|
||||
<td><strong>{{L10n "form.field.email"}}:</strong></td>
|
||||
<td><input type="text" name="email" size="50" value="{{email}}" class="username"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>{{L10n "form.field.name"}}:</strong></td>
|
||||
<td><input type="text" name="name" size="50" value="{{name}}" class="username"/></td>
|
||||
</tr>
|
||||
{{#if groups}}
|
||||
<tr>
|
||||
<td class="text"><strong>{{L10n "form.field.department"}}</strong></td>
|
||||
<td><select name="group" style="min-width:200px;">{{{groups.select}}}</select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="text"><strong>{{L10n "form.field.department.description"}}</strong></td>
|
||||
<td class="text" id="groupDescription">{{groups.defaultDescription}}</td>
|
||||
</tr>
|
||||
{{/if}}
|
||||
<tr>
|
||||
<td><strong>{{L10n "form.field.message"}}:</strong></td>
|
||||
<td valign="top">
|
||||
<textarea name="message" tabindex="0" cols="40" rows="5">{{message}}</textarea>
|
||||
</td>
|
||||
</tr>
|
||||
{{#if showCaptcha}}
|
||||
<tr>
|
||||
<td><img id="captcha-img" src="captcha.php"/></td>
|
||||
<td><input type="text" name="captcha" size="50" maxlength="15" value="" class="username"/></td>
|
||||
</tr>
|
||||
{{/if}}
|
||||
</table>
|
||||
<a href="javascript:void(0);" class="but" id="send-message">{{L10n "mailthread.perform"}}</a>
|
||||
<div class="clear"> </div>
|
||||
</form>
|
@ -0,0 +1,35 @@
|
||||
{{! Logo block}}
|
||||
<div id="top2">
|
||||
<div id="logo">
|
||||
{{#if page.company.chatLogoURL}}
|
||||
{{! Use 'unless' instead of 'if' because of the bug with nested 'if else' in handlebars 1.0.0-rc.3}}
|
||||
{{#unless page.webimHost}}
|
||||
<img src="{{page.company.chatLogoURL}}" alt=""/>
|
||||
{{else}}
|
||||
<a onclick="window.open('{{page.webimHost}}');return false;" href="{{page.webimHost}}">
|
||||
<img src="{{page.company.chatLogoURL}}" alt=""/>
|
||||
</a>
|
||||
{{/unless}}
|
||||
{{else}}
|
||||
{{#if page.webimHost}}
|
||||
<a onclick="window.open('{{page.webimHost}}');return false;" href="{{page.webimHost}}">
|
||||
<img src="{{page.tplRoot}}/images/default-logo.gif" alt=""/>
|
||||
</a>
|
||||
{{else}}
|
||||
<img src="{{page.tplRoot}}/images/default-logo.gif" alt=""/>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
||||
<div id="page-title">{{page.title}}</div>
|
||||
<div class="clear"> </div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{! Header block. Contains description}}
|
||||
<div id="headers">
|
||||
<div class="wndb"><div class="wndl"><div class="wndr"><div class="wndt"><div class="wndtl"><div class="wndtr"><div class="wndbl"><div class="wndbr" id="description-region">
|
||||
</div></div></div></div></div></div></div></div>
|
||||
</div>
|
||||
|
||||
{{! Empty container for main content}}
|
||||
<div id="content-wrapper"></div>
|
@ -0,0 +1,6 @@
|
||||
<div class="buttons">
|
||||
<a href="javascript:window.close();" title="{{L10n "chat.mailthread.sent.close"}}">
|
||||
<img class="tpl-image iclosewin" src="{{page.webimRoot}}/images/free.gif" alt="{{L10n "chat.mailthread.sent.close"}}" />
|
||||
</a>
|
||||
</div>
|
||||
<div class="messagetxt">{{L10n "leavemessage.sent.message"}}</div>
|
@ -0,0 +1,42 @@
|
||||
<form name="surveyForm" method="post" action="">
|
||||
<input type="hidden" name="style" value="{{page.style}}"/>
|
||||
<input type="hidden" name="info" value="{{info}}"/>
|
||||
<input type="hidden" name="referrer" value="{{referrer}}"/>
|
||||
<input type="hidden" name="survey" value="on"/>
|
||||
{{#unless showEmail}}<input type="hidden" name="email" value="{{email}}"/>{{/unless}}
|
||||
{{#unless groups}}{{#if groupId}}<input type="hidden" name="group" value="{{groupId}}"/>{{/if}}{{/unless}}
|
||||
{{#unless showMessage}}<input type="hidden" name="message" value="{{message}}"/>{{/unless}}
|
||||
|
||||
<div class="errors"></div>
|
||||
|
||||
<table class="form">
|
||||
{{#if groups}}
|
||||
<tr>
|
||||
<td><strong>{{L10n "form.field.department"}}</strong></td>
|
||||
<td><select name="group">{{{groups.select}}}</select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>{{L10n "form.field.department.description"}}</strong></td>
|
||||
<td id="groupDescription">{{groups.defaultDescription}}</td>
|
||||
</tr>
|
||||
{{/if}}
|
||||
<tr>
|
||||
<td><strong>{{L10n "presurvey.name"}}</strong></td>
|
||||
<td><input type="text" name="name" size="50" value="{{name}}" class="username" {{#unless canChangeName}}disabled="disabled"{{/unless}}/></td>
|
||||
</tr>
|
||||
{{#if showEmail}}
|
||||
<tr>
|
||||
<td><strong>{{L10n "presurvey.mail"}}</strong></td>
|
||||
<td><input type="text" name="email" size="50" value="{{email}}" class="username"/></td>
|
||||
</tr>
|
||||
{{/if}}
|
||||
{{#if showMessage}}
|
||||
<tr>
|
||||
<td><strong>{{L10n "presurvey.question"}}</strong></td>
|
||||
<td valign="top"><textarea name="message" tabindex="0" cols="45" rows="2">{{message}}</textarea></td>
|
||||
</tr>
|
||||
{{/if}}
|
||||
</table>
|
||||
<a href="javascript:void(0);" class="but" id="submit-survey">{{L10n "presurvey.submit"}}</a>
|
||||
<div class="clear"> </div>
|
||||
</form>
|
@ -0,0 +1,39 @@
|
||||
{{! Logo block}}
|
||||
<div id="top2">
|
||||
<div id="logo">
|
||||
{{#if page.company.chatLogoURL}}
|
||||
{{! Use 'unless' instead of 'if' because of the bug with nested 'if else' in handlebars 1.0.0-rc.3}}
|
||||
{{#unless page.webimHost}}
|
||||
<img src="{{page.company.chatLogoURL}}" alt=""/>
|
||||
{{else}}
|
||||
<a onclick="window.open('{{page.webimHost}}');return false;" href="{{page.webimHost}}">
|
||||
<img src="{{page.company.chatLogoURL}}" alt=""/>
|
||||
</a>
|
||||
{{/unless}}
|
||||
{{else}}
|
||||
{{#if page.webimHost}}
|
||||
<a onclick="window.open('{{page.webimHost}}');return false;" href="{{page.webimHost}}">
|
||||
<img src="{{page.tplRoot}}/images/default-logo.gif" alt=""/>
|
||||
</a>
|
||||
{{else}}
|
||||
<img src="{{page.tplRoot}}/images/default-logo.gif" alt=""/>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
||||
<div id="page-title">{{page.title}}</div>
|
||||
<div class="clear"> </div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{! Header block. Contains description and close link}}
|
||||
<div id="headers">
|
||||
<div class="wndb"><div class="wndl"><div class="wndr"><div class="wndt"><div class="wndtl"><div class="wndtr"><div class="wndbl"><div class="wndbr">
|
||||
<div class="buttons">
|
||||
<a href="javascript:window.close();" title="{{L10n "leavemessage.close"}}"><img class="tpl-image iclosewin" src="{{page.webimRoot}}/images/free.gif" alt="{{L10n "leavemessage.close"}}" /></a>
|
||||
</div>
|
||||
<div class="messagetxt">{{L10n "presurvey.intro"}}</div>
|
||||
</div></div></div></div></div></div></div></div>
|
||||
</div>
|
||||
|
||||
{{! Empty container for main content}}
|
||||
<div id="content-wrapper"></div>
|
@ -4,23 +4,57 @@
|
||||
Copyright (c) 2005-2011 Mibew Messenger Community
|
||||
License: http://mibew.org/license.php
|
||||
*/
|
||||
(function(){var l=Handlebars.template,n=Handlebars.templates=Handlebars.templates||{};n.user_name_control=l(function(d,b,e,g,a){function c(a,d){var c,f,b;c=""+('\n <div class="user-name-control-input-bg"><input id="user-name-control-input" type="text" size="12" value="'+j((f=(f=a.user,null==f||!1===f?f:f.name),typeof f===q?f.apply(a):f))+'" class="username" /></div>\n <a href="javascript:void(0)" class="user-name-control-set tpl-image" title="');b={hash:{},data:d};return c+=j((f=e.L10n,
|
||||
f?f.call(a,"chat.client.changename",b):m.call(a,"L10n","chat.client.changename",b)))+'"></a>\n '}function k(a,d){var c,f,b;b={hash:{},data:d};c='\n <a href="javascript:void(0)" title="'+(j((f=e.L10n,f?f.call(a,"chat.client.changename",b):m.call(a,"L10n","chat.client.changename",b)))+'">'+j((f=(f=a.user,null==f||!1===f?f:f.name),typeof f===q?f.apply(a):f))+'</a>\n <a class="user-name-control-change tpl-image" title="');b={hash:{},data:d};return c+=j((f=e.L10n,f?f.call(a,"chat.client.changename",
|
||||
b):m.call(a,"L10n","chat.client.changename",b)))+'"></a>\n '}this.compilerInfo=[2,">= 1.0.0-rc.3"];e=e||d.helpers;a=a||{};var h,q="function",j=this.escapeExpression,m=e.helperMissing,p=this;return(d=e["if"].call(b,(h=b.user,null==h||!1===h?h:h.canChangeName),{hash:{},inverse:p.program(6,function(a,d){var b,c;b={hash:{},data:d};return b="\n"+(j((c=e.L10n,c?c.call(a,"chat.client.name",b):m.call(a,"L10n","chat.client.name",b)))+" "+j((c=(c=a.user,null==c||!1===c?c:c.name),typeof c===q?c.apply(a):
|
||||
c))+"\n")},a),fn:p.program(1,function(a,d){var b,f;b={hash:{},data:d};b='\n <span class="user-name-control-prefix">'+(j((f=e.L10n,f?f.call(a,"chat.client.name",b):m.call(a,"L10n","chat.client.name",b)))+"</span>\n ");if((f=e["if"].call(a,a.nameInput,{hash:{},inverse:p.program(4,k,d),fn:p.program(2,c,d),data:d}))||0===f)b+=f;return b+="\n"},a),data:a}))||0===d?d:""});n.status_typing=l(function(d,b,e,g,a){this.compilerInfo=[2,">= 1.0.0-rc.3"];e=e||d.helpers;a=a||{};var c;d=e.helperMissing;g=this.escapeExpression;
|
||||
a={hash:{},data:a};return g((c=e.L10n,c?c.call(b,"typing.remote",a):d.call(b,"L10n","typing.remote",a)))});n.chat_layout=l(function(d,b,e,g,a){this.compilerInfo=[2,">= 1.0.0-rc.3"];e=e||d.helpers;a=a||{};var c,k;g=e.helperMissing;var h=this.escapeExpression;d='\n<div id="chat-header">\n <div class="bgc"><div class="bgl"><div class="bgr">\n \n <div id="controls-region"></div>\n </div></div></div>\n</div>\n\n\n<div id="chat">\n <div class="bgl"><div class="bgr"><div class="sdwbgc"><div class="sdwbgl"><div class="sdwbgr">\n ';
|
||||
if((k=e.unless.call(b,(c=b.user,null==c||!1===c?c:c.isAgent),{hash:{},inverse:this.noop,fn:this.program(1,function(){return'\n <div id="avatar-region"></div>\n '},a),data:a}))||0===k)d+=k;a={hash:{},data:a};return d=d+'\n \n <div id="messages-region"></div>\n \n <div id="status-region"></div>\n </div></div></div></div></div>\n</div>\n\n\n<div id="message-form-region"></div>\n\n\n<div id="footer">'+(h((c=e.L10n,c?c.call(b,"chat.window.poweredby",a):g.call(b,
|
||||
"L10n","chat.window.poweredby",a)))+' <a id="poweredByLink" href="http://mibew.org" title="Mibew Community" target="_blank">mibew.org</a></div>\n\n\n<div id="sound-region"></div>')});n.avatar=l(function(d,b,e,g,a){this.compilerInfo=[2,">= 1.0.0-rc.3"];e=e||d.helpers;a=a||{};var c=this.escapeExpression;return(d=e["if"].call(b,b.imageLink,{hash:{},inverse:this.program(3,function(){return'<div class="default-avatar"></div>'},a),fn:this.program(1,function(a,d){var b,j;b='<img src="';(j=e.imageLink)?j=
|
||||
j.call(a,{hash:{},data:d}):(j=a.imageLink,j="function"===typeof j?j.apply(a):j);return b+=c(j)+'" border="0" alt="" />'},a),data:a}))||0===d?d:""});n.close_control=l(function(d,b,e,g,a){this.compilerInfo=[2,">= 1.0.0-rc.3"];e=e||d.helpers;a=a||{};var c;d=e.helperMissing;g=this.escapeExpression;a={hash:{},data:a};return b='<div class="tpl-image" title="'+(g((c=e.L10n,c?c.call(b,"chat.window.close_title",a):d.call(b,"L10n","chat.window.close_title",a)))+'"></div>')});n.history_control=l(function(d,
|
||||
b,e,g,a){this.compilerInfo=[2,">= 1.0.0-rc.3"];e=e||d.helpers;a=a||{};var c;d=e.helperMissing;g=this.escapeExpression;a={hash:{},data:a};return b='<div class="tpl-image" title="'+(g((c=e.L10n,c?c.call(b,"page.analysis.userhistory.title",a):d.call(b,"L10n","page.analysis.userhistory.title",a)))+'"></div>')});n.status_message=l(function(d,b,e,g,a){this.compilerInfo=[2,">= 1.0.0-rc.3"];e=e||d.helpers;a=a||{};d=this.escapeExpression;(e=e.message)?e=e.call(b,{hash:{},data:a}):(e=b.message,e="function"===
|
||||
typeof e?e.apply(b):e);return d(e)});n.secure_mode_control=l(function(){this.compilerInfo=[2,">= 1.0.0-rc.3"];return'<div class="tpl-image" title="SSL"></div>'});n.sound_control=l(function(d,b,e,g,a){this.compilerInfo=[2,">= 1.0.0-rc.3"];e=e||d.helpers;a=a||{};var c=e.helperMissing,k=this.escapeExpression;return(d=e["if"].call(b,b.enabled,{hash:{},inverse:this.program(3,function(a,d){var b,m;b={hash:{},data:d};return b='\n <div class="tpl-image sound-control-off" title="'+(k((m=e.L10n,m?m.call(a,
|
||||
"chat.window.toolbar.turn_on_sound",b):c.call(a,"L10n","chat.window.toolbar.turn_on_sound",b)))+'"></div>\n')},a),fn:this.program(1,function(a,d){var b,m;b={hash:{},data:d};return b='\n <div class="tpl-image sound-control-on" title="'+(k((m=e.L10n,m?m.call(a,"chat.window.toolbar.turn_off_sound",b):c.call(a,"L10n","chat.window.toolbar.turn_off_sound",b)))+'"></div>\n')},a),data:a}))||0===d?d:""});n.message=l(function(d,b,e,g,a){this.compilerInfo=[2,">= 1.0.0-rc.3"];e=e||d.helpers;a=a||{};var c,
|
||||
k=this.escapeExpression,h=e.helperMissing;d={hash:{},data:a};d="<span>"+(k((c=e.formatTime,c?c.call(b,b.created,d):h.call(b,"formatTime",b.created,d)))+"</span> \n");if((c=e["if"].call(b,b.name,{hash:{},inverse:this.noop,fn:this.program(1,function(a,b){var d,c;d="<span class='n";(c=e.kindName)?c=c.call(a,{hash:{},data:b}):(c=a.kindName,c="function"===typeof c?c.apply(a):c);d+=k(c)+"'>";(c=e.name)?c=c.call(a,{hash:{},data:b}):(c=a.name,c="function"===typeof c?c.apply(a):c);return d+=k(c)+"</span>: "},
|
||||
a),data:a}))||0===c)d+=c;d+="\n<span class='m";(c=e.kindName)?c=c.call(b,{hash:{},data:a}):(c=b.kindName,c="function"===typeof c?c.apply(b):c);d+=k(c)+"'>";if((c=e["if"].call(b,b.allowFormatting,{hash:{},inverse:this.program(5,function(a,d){var b,c;c={hash:{},data:d};return k((b=e.apply,b?b.call(a,a.message,"urlReplace, nl2br",c):h.call(a,"apply",a.message,"urlReplace, nl2br",c)))},a),fn:this.program(3,function(a,d){var b,c;c={hash:{},data:d};return k((b=e.apply,b?b.call(a,a.message,"urlReplace, nl2br, allowTags",
|
||||
c):h.call(a,"apply",a.message,"urlReplace, nl2br, allowTags",c)))},a),data:a}))||0===c)d+=c;return d+="</span><br/>"});n.message_form=l(function(d,b,e,g,a){function c(a,b){var c,d;c={hash:{},data:b};c='\n <select id="predefined" size="1" class="answer">\n <option>'+(j((d=e.L10n,d?d.call(a,"chat.window.predefined.select_answer",c):m.call(a,"L10n","chat.window.predefined.select_answer",c)))+"</option>\n ");if((d=e.each.call(a,a.predefinedAnswers,{hash:{},
|
||||
inverse:p.noop,fn:p.program(5,k,b),data:b}))||0===d)c+=d;return c+="\n </select>\n "}function k(a){var c;return a=""+("\n <option>"+j((c=a["short"],typeof c===l?c.apply(a):c))+"</option>\n ")}this.compilerInfo=[2,">= 1.0.0-rc.3"];e=e||d.helpers;a=a||{};var h,l="function",j=this.escapeExpression,m=e.helperMissing,p=this;d='<div id="message">\n';if((g=e["if"].call(b,(h=b.user,null==h||!1===h?h:h.canPost),{hash:{},inverse:p.noop,fn:p.program(1,
|
||||
function(){return'\n <div class="bgc"><div class="bgl"><div class="bgr">\n <textarea id="message-input" class="message" tabindex="0" rows="4" cols="10"></textarea>\n </div></div></div>\n'},a),data:a}))||0===g)d+=g;d+='\n</div>\n\n<div id="send">\n';if((g=e["if"].call(b,(h=b.user,null==h||!1===h?h:h.canPost),{hash:{},inverse:p.noop,fn:p.program(3,function(a,d){var b,f,g;b='\n <div id="postmessage">\n <div id="predefined-wrapper">\n ';if((g=e["if"].call(a,(f=a.user,
|
||||
null==f||!1===f?f:f.isAgent),{hash:{},inverse:p.noop,fn:p.program(4,c,d),data:d}))||0===g)b+=g;g={hash:{},data:d};b=b+'\n </div>\n <a href="javascript:void(0)" id="send-message" title="'+(j((f=e.L10n,f?f.call(a,"chat.window.send_message",g):m.call(a,"L10n","chat.window.send_message",g)))+'">');g={hash:{},data:d};return b+=j((f=e.L10n,f?f.call(a,"chat.window.send_message_short_and_shortcut",g):m.call(a,"L10n","chat.window.send_message_short_and_shortcut",g)))+"</a>\n </div>\n"},a),
|
||||
data:a}))||0===g)d+=g;return d+'\n</div>\n<div class="clear"></div>'});n.send_mail_control=l(function(d,b,e,g,a){this.compilerInfo=[2,">= 1.0.0-rc.3"];e=e||d.helpers;a=a||{};var c;d=e.helperMissing;g=this.escapeExpression;a={hash:{},data:a};return b='<div class="tpl-image" title="'+(g((c=e.L10n,c?c.call(b,"chat.window.toolbar.mail_history",a):d.call(b,"L10n","chat.window.toolbar.mail_history",a)))+'"></div>')});n.refresh_control=l(function(d,b,e,g,a){this.compilerInfo=[2,">= 1.0.0-rc.3"];e=e||d.helpers;
|
||||
a=a||{};var c;d=e.helperMissing;g=this.escapeExpression;a={hash:{},data:a};return b='<div class="tpl-image" title="'+(g((c=e.L10n,c?c.call(b,"chat.window.toolbar.refresh",a):d.call(b,"L10n","chat.window.toolbar.refresh",a)))+'"></div>')});n.redirect_control=l(function(d,b,e,g,a){this.compilerInfo=[2,">= 1.0.0-rc.3"];e=e||d.helpers;a=a||{};var c,k=e.helperMissing,h=this.escapeExpression;return(d=e["if"].call(b,(c=b.user,null==c||!1===c?c:c.canPost),{hash:{},inverse:this.noop,fn:this.program(1,function(a,
|
||||
c){var b,d;b={hash:{},data:c};return b='\n<div class="tpl-image" title="'+(h((d=e.L10n,d?d.call(a,"chat.window.toolbar.redirect_user",b):k.call(a,"L10n","chat.window.toolbar.redirect_user",b)))+'"></div>\n')},a),data:a}))||0===d?d:""});n.status=l(function(d,b,e,g,a){this.compilerInfo=[2,">= 1.0.0-rc.3"];e=e||d.helpers;a=a||{};d=this.escapeExpression;(e=e.title)?e=e.call(b,{hash:{},data:a}):(e=b.title,e="function"===typeof e?e.apply(b):e);return d(e)})})();
|
||||
(function(){var r=Handlebars.template,s=Handlebars.templates=Handlebars.templates||{};s.user_name_control=r(function(a,e,f,b,c){function j(a,b){var d,g,c;d=""+('\n <div class="user-name-control-input-bg"><input id="user-name-control-input" type="text" size="12" value="'+h((g=(g=a.user,null==g||!1===g?g:g.name),typeof g===p?g.apply(a):g))+'" class="username" /></div>\n <a href="javascript:void(0)" class="user-name-control-set tpl-image" title="');c={hash:{},data:b};return d+=h((g=f.L10n,
|
||||
g?g.call(a,"chat.client.changename",c):m.call(a,"L10n","chat.client.changename",c)))+'"></a>\n '}function k(a,b){var d,g,c;c={hash:{},data:b};d='\n <a href="javascript:void(0)" title="'+(h((g=f.L10n,g?g.call(a,"chat.client.changename",c):m.call(a,"L10n","chat.client.changename",c)))+'">'+h((g=(g=a.user,null==g||!1===g?g:g.name),typeof g===p?g.apply(a):g))+'</a>\n <a class="user-name-control-change tpl-image" title="');c={hash:{},data:b};return d+=h((g=f.L10n,g?g.call(a,"chat.client.changename",
|
||||
c):m.call(a,"L10n","chat.client.changename",c)))+'"></a>\n '}this.compilerInfo=[2,">= 1.0.0-rc.3"];f=f||a.helpers;c=c||{};var l,p="function",h=this.escapeExpression,m=f.helperMissing,n=this;return(a=f["if"].call(e,(l=e.user,null==l||!1===l?l:l.canChangeName),{hash:{},inverse:n.program(6,function(a,b){var d,g;d={hash:{},data:b};return d="\n"+(h((g=f.L10n,g?g.call(a,"chat.client.name",d):m.call(a,"L10n","chat.client.name",d)))+" "+h((g=(g=a.user,null==g||!1===g?g:g.name),typeof g===p?g.apply(a):
|
||||
g))+"\n")},c),fn:n.program(1,function(a,b){var d,g;d={hash:{},data:b};d='\n <span class="user-name-control-prefix">'+(h((g=f.L10n,g?g.call(a,"chat.client.name",d):m.call(a,"L10n","chat.client.name",d)))+"</span>\n ");if((g=f["if"].call(a,a.nameInput,{hash:{},inverse:n.program(4,k,b),fn:n.program(2,j,b),data:b}))||0===g)d+=g;return d+="\n"},c),data:c}))||0===a?a:""});s.status_typing=r(function(a,e,f,b,c){this.compilerInfo=[2,">= 1.0.0-rc.3"];f=f||a.helpers;c=c||{};var j;a=f.helperMissing;b=this.escapeExpression;
|
||||
c={hash:{},data:c};return b((j=f.L10n,j?j.call(e,"typing.remote",c):a.call(e,"L10n","typing.remote",c)))});s.leave_message_form=r(function(a,e,f,b,c){function j(a,b){var c,d;c='<input type="hidden" name="group" value="';(d=f.groupId)?d=d.call(a,{hash:{},data:b}):(d=a.groupId,d=typeof d===l?d.apply(a):d);return c+=p(d)+'"/>'}this.compilerInfo=[2,">= 1.0.0-rc.3"];f=f||a.helpers;c=c||{};var k,l="function",p=this.escapeExpression,h=this,m=f.helperMissing;a=""+('<form name="leaveMessageForm" method="post" action="">\n <input type="hidden" name="style" value="'+
|
||||
p((k=(k=e.page,null==k||!1===k?k:k.style),typeof k===l?k.apply(e):k))+'"/>\n <input type="hidden" name="info" value="');(b=f.info)?b=b.call(e,{hash:{},data:c}):(b=e.info,b=typeof b===l?b.apply(e):b);a+=p(b)+'"/>\n <input type="hidden" name="referrer" value="';(b=f.referrer)?b=b.call(e,{hash:{},data:c}):(b=e.referrer,b=typeof b===l?b.apply(e):b);a+=p(b)+'"/>\n ';if((b=f.unless.call(e,e.groups,{hash:{},inverse:h.noop,fn:h.program(1,function(a,b){var c;return(c=f["if"].call(a,a.groupId,{hash:{},
|
||||
inverse:h.noop,fn:h.program(2,j,b),data:b}))||0===c?c:""},c),data:c}))||0===b)a+=b;b={hash:{},data:c};a=a+'\n\n <div class="errors"></div>\n\n <table cellspacing="1" cellpadding="5" border="0" class="form">\n <tr>\n <td><strong>'+(p((k=f.L10n,k?k.call(e,"form.field.email",b):m.call(e,"L10n","form.field.email",b)))+':</strong></td>\n <td><input type="text" name="email" size="50" value="');(b=f.email)?b=b.call(e,{hash:{},data:c}):(b=e.email,b=typeof b===l?b.apply(e):
|
||||
b);a+=p(b)+'" class="username"/></td>\n </tr>\n <tr>\n <td><strong>';b={hash:{},data:c};a+=p((k=f.L10n,k?k.call(e,"form.field.name",b):m.call(e,"L10n","form.field.name",b)))+':</strong></td>\n <td><input type="text" name="name" size="50" value="';(b=f.name)?b=b.call(e,{hash:{},data:c}):(b=e.name,b=typeof b===l?b.apply(e):b);a+=p(b)+'" class="username"/></td>\n </tr>\n ';if((b=f["if"].call(e,e.groups,{hash:{},inverse:h.noop,fn:h.program(4,function(a,b){var c,
|
||||
d,g;g={hash:{},data:b};c='\n <tr>\n <td class="text"><strong>'+(p((d=f.L10n,d?d.call(a,"form.field.department",g):m.call(a,"L10n","form.field.department",g)))+'</strong></td>\n <td><select name="group" style="min-width:200px;">');if((g=(d=(d=a.groups,null==d||!1===d?d:d.select),typeof d===l?d.apply(a):d))||0===g)c+=g;c+='</select></td>\n </tr>\n <tr>\n <td class="text"><strong>';g={hash:{},data:b};return c+=p((d=f.L10n,d?d.call(a,"form.field.department.description",
|
||||
g):m.call(a,"L10n","form.field.department.description",g)))+'</strong></td>\n <td class="text" id="groupDescription">'+p((d=(d=a.groups,null==d||!1===d?d:d.defaultDescription),typeof d===l?d.apply(a):d))+"</td>\n </tr>\n "},c),data:c}))||0===b)a+=b;a+="\n <tr>\n <td><strong>";b={hash:{},data:c};a+=p((k=f.L10n,k?k.call(e,"form.field.message",b):m.call(e,"L10n","form.field.message",b)))+':</strong></td>\n <td valign="top">\n <textarea name="message" tabindex="0" cols="40" rows="5">';
|
||||
(b=f.message)?b=b.call(e,{hash:{},data:c}):(b=e.message,b=typeof b===l?b.apply(e):b);a+=p(b)+"</textarea>\n </td>\n </tr>\n ";if((b=f["if"].call(e,e.showCaptcha,{hash:{},inverse:h.noop,fn:h.program(6,function(){return'\n <tr>\n <td><img id="captcha-img" src="captcha.php"/></td>\n <td><input type="text" name="captcha" size="50" maxlength="15" value="" class="username"/></td>\n </tr>\n '},c),data:c}))||0===b)a+=b;a+='\n </table>\n <a href="javascript:void(0);" class="but" id="send-message">';
|
||||
b={hash:{},data:c};return a+=p((k=f.L10n,k?k.call(e,"mailthread.perform",b):m.call(e,"L10n","mailthread.perform",b)))+'</a>\n <div class="clear"> </div>\n</form>'});s.leave_message_layout=r(function(a,e,f,b,c){function j(a){var d;return a=""+('\n <img src="'+n((d=(d=(d=a.page,null==d||!1===d?d:d.company),null==d||!1===d?d:d.chatLogoURL),typeof d===m?d.apply(a):d))+'" alt=""/>\n ')}function k(a){var d;return a=""+("\n <a onclick=\"window.open('"+n((d=
|
||||
(d=a.page,null==d||!1===d?d:d.webimHost),typeof d===m?d.apply(a):d))+'\');return false;" href="'+n((d=(d=a.page,null==d||!1===d?d:d.webimHost),typeof d===m?d.apply(a):d))+'">\n <img src="'+n((d=(d=(d=a.page,null==d||!1===d?d:d.company),null==d||!1===d?d:d.chatLogoURL),typeof d===m?d.apply(a):d))+'" alt=""/>\n </a>\n ')}function l(a){var d;return a=""+("\n <a onclick=\"window.open('"+n((d=(d=a.page,null==d||!1===d?d:d.webimHost),typeof d===
|
||||
m?d.apply(a):d))+'\');return false;" href="'+n((d=(d=a.page,null==d||!1===d?d:d.webimHost),typeof d===m?d.apply(a):d))+'">\n <img src="'+n((d=(d=a.page,null==d||!1===d?d:d.tplRoot),typeof d===m?d.apply(a):d))+'/images/default-logo.gif" alt=""/>\n </a>\n ')}function p(a){var d;return a=""+('\n <img src="'+n((d=(d=a.page,null==d||!1===d?d:d.tplRoot),typeof d===m?d.apply(a):d))+'/images/default-logo.gif" alt=""/>\n ')}this.compilerInfo=
|
||||
[2,">= 1.0.0-rc.3"];f=f||a.helpers;c=c||{};var h,m="function",n=this.escapeExpression,q=this;a='\n<div id="top2">\n <div id="logo">\n ';if((c=f["if"].call(e,(h=(h=e.page,null==h||!1===h?h:h.company),null==h||!1===h?h:h.chatLogoURL),{hash:{},inverse:q.program(6,function(a,d){var g,b,c;g="\n ";if((c=f["if"].call(a,(b=a.page,null==b||!1===b?b:b.webimHost),{hash:{},inverse:q.program(9,p,d),fn:q.program(7,l,d),data:d}))||0===c)g+=c;return g+"\n "},c),fn:q.program(1,function(a,
|
||||
d){var g,b,c;g="\n \n ";if((c=f.unless.call(a,(b=a.page,null==b||!1===b?b:b.webimHost),{hash:{},inverse:q.program(4,k,d),fn:q.program(2,j,d),data:d}))||0===c)g+=c;return g+"\n "},c),data:c}))||0===c)a+=c;return a+='\n \n <div id="page-title">'+n((h=(h=e.page,null==h||!1===h?h:h.title),typeof h===m?h.apply(e):h))+'</div>\n <div class="clear"> </div>\n </div>\n</div>\n\n\n<div id="headers">\n <div class="wndb"><div class="wndl"><div class="wndr"><div class="wndt"><div class="wndtl"><div class="wndtr"><div class="wndbl"><div class="wndbr" id="description-region">\n </div></div></div></div></div></div></div></div>\n</div>\n\n\n<div id="content-wrapper"></div>'});
|
||||
s.avatar=r(function(a,e,f,b,c){this.compilerInfo=[2,">= 1.0.0-rc.3"];f=f||a.helpers;c=c||{};var j=this.escapeExpression;return(a=f["if"].call(e,e.imageLink,{hash:{},inverse:this.program(3,function(){return'<div class="default-avatar"></div>'},c),fn:this.program(1,function(a,b){var c,e;c='<img src="';(e=f.imageLink)?e=e.call(a,{hash:{},data:b}):(e=a.imageLink,e="function"===typeof e?e.apply(a):e);return c+=j(e)+'" border="0" alt="" />'},c),data:c}))||0===a?a:""});s.close_control=r(function(a,e,f,b,
|
||||
c){this.compilerInfo=[2,">= 1.0.0-rc.3"];f=f||a.helpers;c=c||{};var j;a=f.helperMissing;b=this.escapeExpression;c={hash:{},data:c};return e='<div class="tpl-image" title="'+(b((j=f.L10n,j?j.call(e,"chat.window.close_title",c):a.call(e,"L10n","chat.window.close_title",c)))+'"></div>')});s.history_control=r(function(a,e,f,b,c){this.compilerInfo=[2,">= 1.0.0-rc.3"];f=f||a.helpers;c=c||{};var j;a=f.helperMissing;b=this.escapeExpression;c={hash:{},data:c};return e='<div class="tpl-image" title="'+(b((j=
|
||||
f.L10n,j?j.call(e,"page.analysis.userhistory.title",c):a.call(e,"L10n","page.analysis.userhistory.title",c)))+'"></div>')});s.status_message=r(function(a,e,f,b,c){this.compilerInfo=[2,">= 1.0.0-rc.3"];f=f||a.helpers;c=c||{};a=this.escapeExpression;(f=f.message)?f=f.call(e,{hash:{},data:c}):(f=e.message,f="function"===typeof f?f.apply(e):f);return a(f)});s.survey_form=r(function(a,e,f,b,c){function j(a,b){var c,d;c='<input type="hidden" name="group" value="';(d=f.groupId)?d=d.call(a,{hash:{},data:b}):
|
||||
(d=a.groupId,d=typeof d===l?d.apply(a):d);return c+=p(d)+'"/>'}this.compilerInfo=[2,">= 1.0.0-rc.3"];f=f||a.helpers;c=c||{};var k,l="function",p=this.escapeExpression,h=this,m=f.helperMissing;a=""+('<form name="surveyForm" method="post" action="">\n <input type="hidden" name="style" value="'+p((k=(k=e.page,null==k||!1===k?k:k.style),typeof k===l?k.apply(e):k))+'"/>\n <input type="hidden" name="info" value="');(b=f.info)?b=b.call(e,{hash:{},data:c}):(b=e.info,b=typeof b===l?b.apply(e):b);a+=
|
||||
p(b)+'"/>\n <input type="hidden" name="referrer" value="';(b=f.referrer)?b=b.call(e,{hash:{},data:c}):(b=e.referrer,b=typeof b===l?b.apply(e):b);a+=p(b)+'"/>\n <input type="hidden" name="survey" value="on"/>\n ';if((b=f.unless.call(e,e.showEmail,{hash:{},inverse:h.noop,fn:h.program(1,function(a,b){var c,d;c='<input type="hidden" name="email" value="';(d=f.email)?d=d.call(a,{hash:{},data:b}):(d=a.email,d=typeof d===l?d.apply(a):d);return c+=p(d)+'"/>'},c),data:c}))||0===b)a+=b;a+="\n ";
|
||||
if((b=f.unless.call(e,e.groups,{hash:{},inverse:h.noop,fn:h.program(3,function(a,b){var c;return(c=f["if"].call(a,a.groupId,{hash:{},inverse:h.noop,fn:h.program(4,j,b),data:b}))||0===c?c:""},c),data:c}))||0===b)a+=b;a+="\n ";if((b=f.unless.call(e,e.showMessage,{hash:{},inverse:h.noop,fn:h.program(6,function(a,b){var c,d;c='<input type="hidden" name="message" value="';(d=f.message)?d=d.call(a,{hash:{},data:b}):(d=a.message,d=typeof d===l?d.apply(a):d);return c+=p(d)+'"/>'},c),data:c}))||0===b)a+=
|
||||
b;a+='\n\n <div class="errors"></div>\n\n <table class="form">\n ';if((b=f["if"].call(e,e.groups,{hash:{},inverse:h.noop,fn:h.program(8,function(a,b){var c,d,g;g={hash:{},data:b};c="\n <tr>\n <td><strong>"+(p((d=f.L10n,d?d.call(a,"form.field.department",g):m.call(a,"L10n","form.field.department",g)))+'</strong></td>\n <td><select name="group">');if((g=(d=(d=a.groups,null==d||!1===d?d:d.select),typeof d===l?d.apply(a):d))||0===g)c+=g;c+="</select></td>\n </tr>\n <tr>\n <td><strong>";
|
||||
g={hash:{},data:b};return c+=p((d=f.L10n,d?d.call(a,"form.field.department.description",g):m.call(a,"L10n","form.field.department.description",g)))+'</strong></td>\n <td id="groupDescription">'+p((d=(d=a.groups,null==d||!1===d?d:d.defaultDescription),typeof d===l?d.apply(a):d))+"</td>\n </tr>\n "},c),data:c}))||0===b)a+=b;b={hash:{},data:c};a=a+"\n <tr>\n <td><strong>"+(p((k=f.L10n,k?k.call(e,"presurvey.name",b):m.call(e,"L10n","presurvey.name",b)))+'</strong></td>\n <td><input type="text" name="name" size="50" value="');
|
||||
(b=f.name)?b=b.call(e,{hash:{},data:c}):(b=e.name,b=typeof b===l?b.apply(e):b);a+=p(b)+'" class="username" ';if((b=f.unless.call(e,e.canChangeName,{hash:{},inverse:h.noop,fn:h.program(10,function(){return'disabled="disabled"'},c),data:c}))||0===b)a+=b;a+="/></td>\n </tr>\n ";if((b=f["if"].call(e,e.showEmail,{hash:{},inverse:h.noop,fn:h.program(12,function(a,c){var b,d;b={hash:{},data:c};b="\n <tr>\n <td><strong>"+(p((d=f.L10n,d?d.call(a,"presurvey.mail",b):m.call(a,"L10n",
|
||||
"presurvey.mail",b)))+'</strong></td>\n <td><input type="text" name="email" size="50" value="');(d=f.email)?d=d.call(a,{hash:{},data:c}):(d=a.email,d=typeof d===l?d.apply(a):d);return b+=p(d)+'" class="username"/></td>\n </tr>\n '},c),data:c}))||0===b)a+=b;a+="\n ";if((b=f["if"].call(e,e.showMessage,{hash:{},inverse:h.noop,fn:h.program(14,function(a,b){var c,d;c={hash:{},data:b};c="\n <tr>\n <td><strong>"+(p((d=f.L10n,d?d.call(a,"presurvey.question",c):m.call(a,
|
||||
"L10n","presurvey.question",c)))+'</strong></td>\n <td valign="top"><textarea name="message" tabindex="0" cols="45" rows="2">');(d=f.message)?d=d.call(a,{hash:{},data:b}):(d=a.message,d=typeof d===l?d.apply(a):d);return c+=p(d)+"</textarea></td>\n </tr>\n "},c),data:c}))||0===b)a+=b;a+='\n </table>\n <a href="javascript:void(0);" class="but" id="submit-survey">';b={hash:{},data:c};return a+=p((k=f.L10n,k?k.call(e,"presurvey.submit",b):m.call(e,"L10n","presurvey.submit",
|
||||
b)))+'</a>\n <div class="clear"> </div>\n</form>'});s.chat_layout=r(function(a,e,f,b,c){function j(d){var a;return d=""+('\n <img src="'+q((a=(a=(a=d.page,null==a||!1===a?a:a.company),null==a||!1===a?a:a.chatLogoURL),typeof a===n?a.apply(d):a))+'" alt=""/>\n ')}function k(a){var g;return a=""+("\n <a onclick=\"window.open('"+q((g=(g=a.page,null==g||!1===g?g:g.webimHost),typeof g===n?g.apply(a):g))+'\');return false;" href="'+q((g=(g=a.page,null==g||
|
||||
!1===g?g:g.webimHost),typeof g===n?g.apply(a):g))+'">\n <img src="'+q((g=(g=(g=a.page,null==g||!1===g?g:g.company),null==g||!1===g?g:g.chatLogoURL),typeof g===n?g.apply(a):g))+'" alt=""/>\n </a>\n ')}function l(a){var g;return a=""+("\n <a onclick=\"window.open('"+q((g=(g=a.page,null==g||!1===g?g:g.webimHost),typeof g===n?g.apply(a):g))+'\');return false;" href="'+q((g=(g=a.page,null==g||!1===g?g:g.webimHost),typeof g===n?g.apply(a):g))+
|
||||
'">\n <img src="'+q((g=(g=a.page,null==g||!1===g?g:g.tplRoot),typeof g===n?g.apply(a):g))+'/images/default-logo.gif" alt=""/>\n </a>\n ')}function p(a){var g;return a=""+('\n <img src="'+q((g=(g=a.page,null==g||!1===g?g:g.tplRoot),typeof g===n?g.apply(a):g))+'/images/default-logo.gif" alt=""/>\n ')}this.compilerInfo=[2,">= 1.0.0-rc.3"];f=f||a.helpers;c=c||{};var h,m,n="function",q=this.escapeExpression,t=this;b=f.helperMissing;
|
||||
a='\n<div id="top">\n <div id="logo">\n ';if((m=f["if"].call(e,(h=(h=e.page,null==h||!1===h?h:h.company),null==h||!1===h?h:h.chatLogoURL),{hash:{},inverse:t.program(6,function(a,g){var c,b,e;c="\n ";if((e=f["if"].call(a,(b=a.page,null==b||!1===b?b:b.webimHost),{hash:{},inverse:t.program(9,p,g),fn:t.program(7,l,g),data:g}))||0===e)c+=e;return c+"\n "},c),fn:t.program(1,function(a,g){var c,b,e;c="\n \n ";if((e=f.unless.call(a,(b=a.page,null==b||!1===
|
||||
b?b:b.webimHost),{hash:{},inverse:t.program(4,k,g),fn:t.program(2,j,g),data:g}))||0===e)c+=e;return c+"\n "},c),data:c}))||0===m)a+=m;a+='\n \n <div id="page-title">'+q((h=(h=e.page,null==h||!1===h?h:h.title),typeof h===n?h.apply(e):h))+'</div>\n <div class="clear"> </div>\n </div>\n</div>\n\n\n<div id="chat-header">\n <div class="bgc"><div class="bgl"><div class="bgr">\n \n <div id="controls-region"></div>\n </div></div></div>\n</div>\n\n\n<div id="chat">\n <div class="bgl"><div class="bgr"><div class="sdwbgc"><div class="sdwbgl"><div class="sdwbgr">\n ';
|
||||
if((m=f.unless.call(e,(h=e.user,null==h||!1===h?h:h.isAgent),{hash:{},inverse:t.noop,fn:t.program(11,function(){return'\n <div id="avatar-region"></div>\n '},c),data:c}))||0===m)a+=m;c={hash:{},data:c};return a=a+'\n \n <div id="messages-region"></div>\n \n <div id="status-region"></div>\n </div></div></div></div></div>\n</div>\n\n\n<div id="message-form-region"></div>\n\n\n<div id="footer">'+(q((h=f.L10n,h?h.call(e,"chat.window.poweredby",c):b.call(e,
|
||||
"L10n","chat.window.poweredby",c)))+' <a id="poweredByLink" href="http://mibew.org" title="Mibew Community" target="_blank">mibew.org</a></div>\n\n\n<div id="sound-region"></div>')});s.secure_mode_control=r(function(){this.compilerInfo=[2,">= 1.0.0-rc.3"];return'<div class="tpl-image" title="SSL"></div>'});s.sound_control=r(function(a,e,f,b,c){this.compilerInfo=[2,">= 1.0.0-rc.3"];f=f||a.helpers;c=c||{};var j=f.helperMissing,k=this.escapeExpression;return(a=f["if"].call(e,e.enabled,{hash:{},inverse:this.program(3,
|
||||
function(a,b){var c,e;c={hash:{},data:b};return c='\n <div class="tpl-image sound-control-off" title="'+(k((e=f.L10n,e?e.call(a,"chat.window.toolbar.turn_on_sound",c):j.call(a,"L10n","chat.window.toolbar.turn_on_sound",c)))+'"></div>\n')},c),fn:this.program(1,function(a,c){var b,e;b={hash:{},data:c};return b='\n <div class="tpl-image sound-control-on" title="'+(k((e=f.L10n,e?e.call(a,"chat.window.toolbar.turn_off_sound",b):j.call(a,"L10n","chat.window.toolbar.turn_off_sound",b)))+'"></div>\n')},
|
||||
c),data:c}))||0===a?a:""});s.message=r(function(a,e,f,b,c){this.compilerInfo=[2,">= 1.0.0-rc.3"];f=f||a.helpers;c=c||{};var j,k=this.escapeExpression,l=f.helperMissing;a={hash:{},data:c};a="<span>"+(k((j=f.formatTime,j?j.call(e,e.created,a):l.call(e,"formatTime",e.created,a)))+"</span> \n");if((j=f["if"].call(e,e.name,{hash:{},inverse:this.noop,fn:this.program(1,function(a,b){var c,e;c="<span class='n";(e=f.kindName)?e=e.call(a,{hash:{},data:b}):(e=a.kindName,e="function"===typeof e?e.apply(a):e);
|
||||
c+=k(e)+"'>";(e=f.name)?e=e.call(a,{hash:{},data:b}):(e=a.name,e="function"===typeof e?e.apply(a):e);return c+=k(e)+"</span>: "},c),data:c}))||0===j)a+=j;a+="\n<span class='m";(j=f.kindName)?j=j.call(e,{hash:{},data:c}):(j=e.kindName,j="function"===typeof j?j.apply(e):j);a+=k(j)+"'>";if((j=f["if"].call(e,e.allowFormatting,{hash:{},inverse:this.program(5,function(a,c){var b,e;e={hash:{},data:c};return k((b=f.apply,b?b.call(a,a.message,"urlReplace, nl2br",e):l.call(a,"apply",a.message,"urlReplace, nl2br",
|
||||
e)))},c),fn:this.program(3,function(a,c){var b,e;e={hash:{},data:c};return k((b=f.apply,b?b.call(a,a.message,"urlReplace, nl2br, allowTags",e):l.call(a,"apply",a.message,"urlReplace, nl2br, allowTags",e)))},c),data:c}))||0===j)a+=j;return a+="</span><br/>"});s.message_form=r(function(a,e,f,b,c){function j(a,b){var d,g;d={hash:{},data:b};d='\n <select id="predefined" size="1" class="answer">\n <option>'+(h((g=f.L10n,g?g.call(a,"chat.window.predefined.select_answer",
|
||||
d):m.call(a,"L10n","chat.window.predefined.select_answer",d)))+"</option>\n ");if((g=f.each.call(a,a.predefinedAnswers,{hash:{},inverse:n.noop,fn:n.program(5,k,b),data:b}))||0===g)d+=g;return d+="\n </select>\n "}function k(a){var b;return a=""+("\n <option>"+h((b=a["short"],typeof b===p?b.apply(a):b))+"</option>\n ")}this.compilerInfo=[2,">= 1.0.0-rc.3"];f=f||a.helpers;c=c||{};var l,p="function",h=this.escapeExpression,m=
|
||||
f.helperMissing,n=this;a='<div id="message">\n';if((b=f["if"].call(e,(l=e.user,null==l||!1===l?l:l.canPost),{hash:{},inverse:n.noop,fn:n.program(1,function(){return'\n <div class="bgc"><div class="bgl"><div class="bgr">\n <textarea id="message-input" class="message" tabindex="0" rows="4" cols="10"></textarea>\n </div></div></div>\n'},c),data:c}))||0===b)a+=b;a+='\n</div>\n\n<div id="send">\n';if((b=f["if"].call(e,(l=e.user,null==l||!1===l?l:l.canPost),{hash:{},inverse:n.noop,fn:n.program(3,
|
||||
function(a,b){var d,g,c;d='\n <div id="postmessage">\n <div id="predefined-wrapper">\n ';if((c=f["if"].call(a,(g=a.user,null==g||!1===g?g:g.isAgent),{hash:{},inverse:n.noop,fn:n.program(4,j,b),data:b}))||0===c)d+=c;c={hash:{},data:b};d=d+'\n </div>\n <a href="javascript:void(0)" id="send-message" title="'+(h((g=f.L10n,g?g.call(a,"chat.window.send_message",c):m.call(a,"L10n","chat.window.send_message",c)))+'">');c={hash:{},data:b};return d+=h((g=f.L10n,g?g.call(a,
|
||||
"chat.window.send_message_short_and_shortcut",c):m.call(a,"L10n","chat.window.send_message_short_and_shortcut",c)))+"</a>\n </div>\n"},c),data:c}))||0===b)a+=b;return a+'\n</div>\n<div class="clear"></div>'});s.send_mail_control=r(function(a,e,f,b,c){this.compilerInfo=[2,">= 1.0.0-rc.3"];f=f||a.helpers;c=c||{};var j;a=f.helperMissing;b=this.escapeExpression;c={hash:{},data:c};return e='<div class="tpl-image" title="'+(b((j=f.L10n,j?j.call(e,"chat.window.toolbar.mail_history",c):a.call(e,"L10n",
|
||||
"chat.window.toolbar.mail_history",c)))+'"></div>')});s.survey_layout=r(function(a,e,f,b,c){function j(a){var b;return a=""+('\n <img src="'+q((b=(b=(b=a.page,null==b||!1===b?b:b.company),null==b||!1===b?b:b.chatLogoURL),typeof b===n?b.apply(a):b))+'" alt=""/>\n ')}function k(a){var b;return a=""+("\n <a onclick=\"window.open('"+q((b=(b=a.page,null==b||!1===b?b:b.webimHost),typeof b===n?b.apply(a):b))+'\');return false;" href="'+q((b=(b=a.page,null==b||!1===
|
||||
b?b:b.webimHost),typeof b===n?b.apply(a):b))+'">\n <img src="'+q((b=(b=(b=a.page,null==b||!1===b?b:b.company),null==b||!1===b?b:b.chatLogoURL),typeof b===n?b.apply(a):b))+'" alt=""/>\n </a>\n ')}function l(a){var b;return a=""+("\n <a onclick=\"window.open('"+q((b=(b=a.page,null==b||!1===b?b:b.webimHost),typeof b===n?b.apply(a):b))+'\');return false;" href="'+q((b=(b=a.page,null==b||!1===b?b:b.webimHost),typeof b===n?b.apply(a):b))+'">\n <img src="'+
|
||||
q((b=(b=a.page,null==b||!1===b?b:b.tplRoot),typeof b===n?b.apply(a):b))+'/images/default-logo.gif" alt=""/>\n </a>\n ')}function p(a){var b;return a=""+('\n <img src="'+q((b=(b=a.page,null==b||!1===b?b:b.tplRoot),typeof b===n?b.apply(a):b))+'/images/default-logo.gif" alt=""/>\n ')}this.compilerInfo=[2,">= 1.0.0-rc.3"];f=f||a.helpers;c=c||{};var h,m,n="function",q=this.escapeExpression,r=this;b=f.helperMissing;a='\n<div id="top2">\n <div id="logo">\n ';
|
||||
if((m=f["if"].call(e,(h=(h=e.page,null==h||!1===h?h:h.company),null==h||!1===h?h:h.chatLogoURL),{hash:{},inverse:r.program(6,function(a,b){var c,e,h;c="\n ";if((h=f["if"].call(a,(e=a.page,null==e||!1===e?e:e.webimHost),{hash:{},inverse:r.program(9,p,b),fn:r.program(7,l,b),data:b}))||0===h)c+=h;return c+"\n "},c),fn:r.program(1,function(a,b){var c,e,h;c="\n \n ";if((h=f.unless.call(a,(e=a.page,null==e||!1===e?e:e.webimHost),{hash:{},inverse:r.program(4,k,b),
|
||||
fn:r.program(2,j,b),data:b}))||0===h)c+=h;return c+"\n "},c),data:c}))||0===m)a+=m;a+='\n \n <div id="page-title">'+q((h=(h=e.page,null==h||!1===h?h:h.title),typeof h===n?h.apply(e):h))+'</div>\n <div class="clear"> </div>\n </div>\n</div>\n\n\n<div id="headers">\n <div class="wndb"><div class="wndl"><div class="wndr"><div class="wndt"><div class="wndtl"><div class="wndtr"><div class="wndbl"><div class="wndbr">\n <div class="buttons">\n <a href="javascript:window.close();" title="';
|
||||
m={hash:{},data:c};a+=q((h=f.L10n,h?h.call(e,"leavemessage.close",m):b.call(e,"L10n","leavemessage.close",m)))+'"><img class="tpl-image iclosewin" src="'+q((h=(h=e.page,null==h||!1===h?h:h.webimRoot),typeof h===n?h.apply(e):h))+'/images/free.gif" alt="';m={hash:{},data:c};a+=q((h=f.L10n,h?h.call(e,"leavemessage.close",m):b.call(e,"L10n","leavemessage.close",m)))+'" /></a>\n </div>\n <div class="messagetxt">';m={hash:{},data:c};return a+=q((h=f.L10n,h?h.call(e,"presurvey.intro",m):b.call(e,
|
||||
"L10n","presurvey.intro",m)))+'</div>\n </div></div></div></div></div></div></div></div>\n</div>\n\n\n<div id="content-wrapper"></div>'});s.leave_message_description=r(function(a,e,f,b,c){this.compilerInfo=[2,">= 1.0.0-rc.3"];f=f||a.helpers;c=c||{};var j,k=f.helperMissing,l=this.escapeExpression;b={hash:{},data:c};a='<div class="buttons">\n <a href="javascript:window.close();" title="'+(l((j=f.L10n,j?j.call(e,"leavemessage.close",b):k.call(e,"L10n","leavemessage.close",b)))+'">\n <img class="tpl-image iclosewin" src="'+
|
||||
l((j=(j=e.page,null==j||!1===j?j:j.webimRoot),"function"===typeof j?j.apply(e):j))+'/images/free.gif" alt="');b={hash:{},data:c};a+=l((j=f.L10n,j?j.call(e,"leavemessage.close",b):k.call(e,"L10n","leavemessage.close",b)))+'" />\n </a>\n</div>\n<div class="messagetxt">';b={hash:{},data:c};return a+=l((j=f.L10n,j?j.call(e,"leavemessage.descr",b):k.call(e,"L10n","leavemessage.descr",b)))+"</div>"});s.refresh_control=r(function(a,e,f,b,c){this.compilerInfo=[2,">= 1.0.0-rc.3"];f=f||a.helpers;c=c||{};
|
||||
var j;a=f.helperMissing;b=this.escapeExpression;c={hash:{},data:c};return e='<div class="tpl-image" title="'+(b((j=f.L10n,j?j.call(e,"chat.window.toolbar.refresh",c):a.call(e,"L10n","chat.window.toolbar.refresh",c)))+'"></div>')});s.redirect_control=r(function(a,e,f,b,c){this.compilerInfo=[2,">= 1.0.0-rc.3"];f=f||a.helpers;c=c||{};var j,k=f.helperMissing,l=this.escapeExpression;return(a=f["if"].call(e,(j=e.user,null==j||!1===j?j:j.canPost),{hash:{},inverse:this.noop,fn:this.program(1,function(a,b){var c,
|
||||
e;c={hash:{},data:b};return c='\n<div class="tpl-image" title="'+(l((e=f.L10n,e?e.call(a,"chat.window.toolbar.redirect_user",c):k.call(a,"L10n","chat.window.toolbar.redirect_user",c)))+'"></div>\n')},c),data:c}))||0===a?a:""});s.status=r(function(a,e,f,b,c){this.compilerInfo=[2,">= 1.0.0-rc.3"];f=f||a.helpers;c=c||{};a=this.escapeExpression;(f=f.title)?f=f.call(e,{hash:{},data:c}):(f=e.title,f="function"===typeof f?f.apply(e):f);return a(f)});s.leave_message_sent_description=r(function(a,e,f,b,c){this.compilerInfo=
|
||||
[2,">= 1.0.0-rc.3"];f=f||a.helpers;c=c||{};var j,k=f.helperMissing,l=this.escapeExpression;b={hash:{},data:c};a='<div class="buttons">\n <a href="javascript:window.close();" title="'+(l((j=f.L10n,j?j.call(e,"chat.mailthread.sent.close",b):k.call(e,"L10n","chat.mailthread.sent.close",b)))+'">\n <img class="tpl-image iclosewin" src="'+l((j=(j=e.page,null==j||!1===j?j:j.webimRoot),"function"===typeof j?j.apply(e):j))+'/images/free.gif" alt="');b={hash:{},data:c};a+=l((j=f.L10n,j?j.call(e,
|
||||
"chat.mailthread.sent.close",b):k.call(e,"L10n","chat.mailthread.sent.close",b)))+'" />\n </a>\n</div>\n<div class="messagetxt">';b={hash:{},data:c};return a+=l((j=f.L10n,j?j.call(e,"leavemessage.sent.message",b):k.call(e,"L10n","leavemessage.sent.message",b)))+"</div>"})})();
|
||||
|
@ -46,7 +46,29 @@
|
||||
'chat.client.changename': "${msg:chat.client.changename}",
|
||||
'chat.window.toolbar.turn_off_sound': "${msg:chat.window.toolbar.turn_off_sound}",
|
||||
'chat.window.toolbar.turn_on_sound': "${msg:chat.window.toolbar.turn_on_sound}",
|
||||
'chat.window.poweredby': "${msg:chat.window.poweredby}"
|
||||
'chat.window.poweredby': "${msg:chat.window.poweredby}",
|
||||
'chat.mailthread.sent.close': "${msg:chat.mailthread.sent.close}",
|
||||
'form.field.department': "${msg:form.field.department}",
|
||||
'form.field.department.description': "${msg:form.field.department.description}",
|
||||
'form.field.email': "${msg:form.field.email}",
|
||||
'form.field.name': "${msg:form.field.name}",
|
||||
'form.field.message': "${msg:form.field.message}",
|
||||
'leavemessage.close': "${msg:leavemessage.close}",
|
||||
'leavemessage.descr': "${msg:leavemessage.descr}",
|
||||
'leavemessage.sent.message': "${msg:leavemessage.sent.message}",
|
||||
'leavemessage.error.email.required': '${page:localized.email.required}',
|
||||
'leavemessage.error.name.required': '${page:localized.name.required}',
|
||||
'leavemessage.error.message.required': '${page:localized.message.required}',
|
||||
'leavemessage.error.wrong.email': '${page:localized.wrong.email}',
|
||||
'errors.captcha': '${msg:errors.captcha}',
|
||||
'mailthread.perform': "${msg:mailthread.perform}",
|
||||
'presurvey.name': "${msg:presurvey.name}",
|
||||
'presurvey.mail': "${msg:presurvey.mail}",
|
||||
'presurvey.question': "${msg:presurvey.question}",
|
||||
'presurvey.submit': "${msg:presurvey.submit}",
|
||||
'presurvey.error.wrong_email': "${msg:presurvey.error.wrong_email}",
|
||||
'presurvey.title': "${msg:presurvey.title}",
|
||||
'presurvey.intro': '${msg:presurvey.intro}'
|
||||
});
|
||||
//--></script>
|
||||
|
||||
@ -61,9 +83,24 @@
|
||||
page: {
|
||||
style: '${styleid}',
|
||||
webimRoot: '${webimroot}',
|
||||
tplRoot: '${tplroot}'
|
||||
tplRoot: '${tplroot}',
|
||||
company: {
|
||||
name: '${page:company.name}',
|
||||
chatLogoURL: '${page:company.chatLogoURL}'
|
||||
},
|
||||
chatModule: ${page:chatModule},
|
||||
webimHost: '${page:webimHost}',
|
||||
title: '${page:page.title}'
|
||||
},
|
||||
${if:chatOptions}
|
||||
chatOptions: ${page:chatOptions},
|
||||
${endif:chatOptions}
|
||||
${if:surveyOptions}
|
||||
surveyOptions: ${page:surveyOptions},
|
||||
${endif:surveyOptions}
|
||||
${if:leaveMessageOptions}
|
||||
leaveMessageOptions: ${page:leaveMessageOptions},
|
||||
${endif:leaveMessageOptions}
|
||||
startFrom: "${page:startFrom}",
|
||||
plugins: ${page:js_plugin_options}
|
||||
});
|
||||
});
|
||||
@ -71,33 +108,6 @@
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<!-- Chat window top. Includes logo and some info about company -->
|
||||
<div id="top">
|
||||
<div id="logo">
|
||||
${if:company.chatLogoURL}
|
||||
${if:webimHost}
|
||||
<a onclick="window.open('${page:webimHost}');return false;" href="${page:webimHost}">
|
||||
<img src="${page:company.chatLogoURL}" alt=""/>
|
||||
</a>
|
||||
${else:webimHost}
|
||||
<img src="${page:company.chatLogoURL}" alt=""/>
|
||||
${endif:webimHost}
|
||||
${else:company.chatLogoURL}
|
||||
${if:webimHost}
|
||||
<a onclick="window.open('${page:webimHost}');return false;" href="${page:webimHost}">
|
||||
<img src="${tplroot}/images/default-logo.gif" alt=""/>
|
||||
</a>
|
||||
${else:webimHost}
|
||||
<img src="${tplroot}/images/default-logo.gif" alt=""/>
|
||||
${endif:webimHost}
|
||||
${endif:company.chatLogoURL}
|
||||
|
||||
<div id="page-title">${page:chat.title}</div>
|
||||
<div class="clear"> </div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="main-region"></div>
|
||||
</body>
|
||||
</html>
|
@ -1,98 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>${msg:leavemessage.title}</title>
|
||||
<link rel="shortcut icon" href="${webimroot}/images/favicon.ico" type="image/x-icon"/>
|
||||
<link rel="stylesheet" type="text/css" href="${tplroot}/chat.css" />
|
||||
<script type="text/javascript" language="javascript" src="${webimroot}/js/compiled/common.js"></script>
|
||||
<script type="text/javascript" language="javascript" src="${webimroot}/js/compiled/leavemessage.js"></script>
|
||||
<script type="text/javascript">
|
||||
${if:groups}
|
||||
var groupDescriptions = ${page:group.descriptions};
|
||||
${endif:groups}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<form name="leaveMessageForm" method="post" action="${webimroot}/leavemessage.php">
|
||||
<input type="hidden" name="style" value="${styleid}"/>
|
||||
<input type="hidden" name="info" value="${form:info}"/>
|
||||
<input type="hidden" name="referrer" value="${page:referrer}"/>
|
||||
${ifnot:groups}${if:formgroupid}<input type="hidden" name="group" value="${form:groupid}"/>${endif:formgroupid}${endif:groups}
|
||||
|
||||
<div id="top2">
|
||||
<div id="logo">
|
||||
${if:company.chatLogoURL}
|
||||
${if:webimHost}
|
||||
<a onclick="window.open('${page:webimHost}');return false;" href="${page:webimHost}">
|
||||
<img src="${page:company.chatLogoURL}" alt=""/>
|
||||
</a>
|
||||
${else:webimHost}
|
||||
<img src="${page:company.chatLogoURL}" alt=""/>
|
||||
${endif:webimHost}
|
||||
${else:company.chatLogoURL}
|
||||
${if:webimHost}
|
||||
<a onclick="window.open('${page:webimHost}');return false;" href="${page:webimHost}">
|
||||
<img src="${tplroot}/images/default-logo.gif" alt=""/>
|
||||
</a>
|
||||
${else:webimHost}
|
||||
<img src="${tplroot}/images/default-logo.gif" alt=""/>
|
||||
${endif:webimHost}
|
||||
${endif:company.chatLogoURL}
|
||||
|
||||
<div id="page-title">${if:formgroupname}${form:groupname}: ${endif:formgroupname}${msg:leavemessage.title}</div>
|
||||
<div class="clear"> </div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="headers">
|
||||
<div class="wndb"><div class="wndl"><div class="wndr"><div class="wndt"><div class="wndtl"><div class="wndtr"><div class="wndbl"><div class="wndbr">
|
||||
<div class="buttons">
|
||||
<a href="javascript:window.close();" title="${msg:leavemessage.close}"><img class="tplimage iclosewin" src="${webimroot}/images/free.gif" alt="${msg:leavemessage.close}" /></a>
|
||||
</div>
|
||||
<div class="messagetxt">${msg:leavemessage.descr}</div>
|
||||
</div></div></div></div></div></div></div></div>
|
||||
</div>
|
||||
<div id="content-wrapper">
|
||||
${if:errors}
|
||||
${errors}
|
||||
${endif:errors}
|
||||
<table cellspacing="1" cellpadding="5" border="0" class="form">
|
||||
<tr>
|
||||
<td><strong>${msg:form.field.email}:</strong></td>
|
||||
<td><input type="text" name="email" size="50" value="${form:email}" class="username"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>${msg:form.field.name}:</strong></td>
|
||||
<td><input type="text" name="name" size="50" value="${form:name}" class="username"/></td>
|
||||
</tr>
|
||||
${if:groups}
|
||||
<tr>
|
||||
<td class="text">${msg:form.field.department}</td>
|
||||
<td>
|
||||
<select name="group" style="min-width:200px;" onchange="MessageForm.changeGroup(this, 'departmentDescription', groupDescriptions)">${page:groups}</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="text">${msg:form.field.department.description}</td>
|
||||
<td class="text" id="departmentDescription">${page:default.department.description}</td>
|
||||
</tr>
|
||||
${endif:groups}
|
||||
<tr>
|
||||
<td><strong>${msg:form.field.message}:</strong></td>
|
||||
<td valign="top">
|
||||
<textarea name="message" tabindex="0" cols="40" rows="5">${form:message}</textarea>
|
||||
</td>
|
||||
</tr>
|
||||
${if:showcaptcha}
|
||||
<tr>
|
||||
<td><img src="captcha.php"/></td>
|
||||
<td><input type="text" name="captcha" size="50" maxlength="15" value="" class="username"/></td>
|
||||
</tr>
|
||||
${endif:showcaptcha}
|
||||
</table>
|
||||
<a href="javascript:document.leaveMessageForm.submit();" class="but" id="sndmessagelnk">${msg:mailthread.perform}</a>
|
||||
<div class="clear"> </div>
|
||||
</div>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
@ -1,45 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>${msg:leavemessage.sent.title}</title>
|
||||
<link rel="shortcut icon" href="${webimroot}/images/favicon.ico" type="image/x-icon"/>
|
||||
<link rel="stylesheet" type="text/css" href="${tplroot}/chat.css" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="top2">
|
||||
<div id="logo">
|
||||
${if:company.chatLogoURL}
|
||||
${if:webimHost}
|
||||
<a onclick="window.open('${page:webimHost}');return false;" href="${page:webimHost}">
|
||||
<img src="${page:company.chatLogoURL}" alt=""/>
|
||||
</a>
|
||||
${else:webimHost}
|
||||
<img src="${page:company.chatLogoURL}" alt=""/>
|
||||
${endif:webimHost}
|
||||
${else:company.chatLogoURL}
|
||||
${if:webimHost}
|
||||
<a onclick="window.open('${page:webimHost}');return false;" href="${page:webimHost}">
|
||||
<img src="${tplroot}/images/default-logo.gif" alt=""/>
|
||||
</a>
|
||||
${else:webimHost}
|
||||
<img src="${tplroot}/images/default-logo.gif" alt=""/>
|
||||
${endif:webimHost}
|
||||
${endif:company.chatLogoURL}
|
||||
|
||||
<div id="page-title">${msg:leavemessage.sent.title}</div>
|
||||
<div class="clear"> </div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="headers">
|
||||
<div class="wndb"><div class="wndl"><div class="wndr"><div class="wndt"><div class="wndtl"><div class="wndtr"><div class="wndbl"><div class="wndbr">
|
||||
<div class="buttons">
|
||||
<a href="javascript:window.close();" title="${msg:chat.mailthread.sent.close}"><img class="tplimage iclosewin" src="${webimroot}/images/free.gif" alt="${msg:chat.mailthread.sent.close}" /></a>
|
||||
</div>
|
||||
<div class="messagetxt">${msg:leavemessage.sent.message}</div>
|
||||
</div></div></div></div></div></div></div></div>
|
||||
</div>
|
||||
<div id="content-wrapper">
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -1,96 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>${msg:presurvey.title}</title>
|
||||
<link rel="shortcut icon" href="${webimroot}/images/favicon.ico" type="image/x-icon"/>
|
||||
<link rel="stylesheet" type="text/css" href="${tplroot}/chat.css" />
|
||||
<script type="text/javascript" language="javascript" src="${webimroot}/js/compiled/common.js"></script>
|
||||
<script type="text/javascript" language="javascript" src="${webimroot}/js/compiled/survey.js"></script>
|
||||
<script type="text/javascript">
|
||||
${if:groups}
|
||||
var groupDescriptions = ${page:group.descriptions};
|
||||
${endif:groups}
|
||||
var localizedStrings = {
|
||||
${if:showemail}
|
||||
wrongEmail: '${msg:presurvey.error.wrong_email}',
|
||||
${endif:showemail}
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="top2">
|
||||
<div id="logo">
|
||||
${if:company.chatLogoURL}
|
||||
${if:webimHost}
|
||||
<a onclick="window.open('${page:webimHost}');return false;" href="${page:webimHost}">
|
||||
<img src="${page:company.chatLogoURL}" alt=""/>
|
||||
</a>
|
||||
${else:webimHost}
|
||||
<img src="${page:company.chatLogoURL}" alt=""/>
|
||||
${endif:webimHost}
|
||||
${else:company.chatLogoURL}
|
||||
${if:webimHost}
|
||||
<a onclick="window.open('${page:webimHost}');return false;" href="${page:webimHost}">
|
||||
<img src="${tplroot}/images/default-logo.gif" alt=""/>
|
||||
</a>
|
||||
${else:webimHost}
|
||||
<img src="${tplroot}/images/default-logo.gif" alt=""/>
|
||||
${endif:webimHost}
|
||||
${endif:company.chatLogoURL}
|
||||
|
||||
<div id="page-title">${msg:presurvey.title}</div>
|
||||
<div class="clear"> </div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="headers">
|
||||
<div class="wndb"><div class="wndl"><div class="wndr"><div class="wndt"><div class="wndtl"><div class="wndtr"><div class="wndbl"><div class="wndbr">
|
||||
<div class="buttons">
|
||||
<a href="javascript:window.close();" title="${msg:leavemessage.close}"><img class="tplimage iclosewin" src="${webimroot}/images/free.gif" alt="${msg:leavemessage.close}" /></a>
|
||||
</div>
|
||||
<div class="messagetxt">${msg:presurvey.intro}</div>
|
||||
</div></div></div></div></div></div></div></div>
|
||||
</div>
|
||||
<div id="content-wrapper">
|
||||
|
||||
<form name="surveyForm" method="post" action="${webimroot}/client.php" />
|
||||
<input type="hidden" name="style" value="${styleid}"/>
|
||||
<input type="hidden" name="info" value="${form:info}"/>
|
||||
<input type="hidden" name="referrer" value="${page:referrer}"/>
|
||||
<input type="hidden" name="survey" value="on"/>
|
||||
${ifnot:showemail}<input type="hidden" name="email" value="${form:email}"/>${endif:showemail}
|
||||
${ifnot:groups}${if:formgroupid}<input type="hidden" name="group" value="${form:groupid}"/>${endif:formgroupid}${endif:groups}
|
||||
${ifnot:showmessage}<input type="hidden" name="message" value="${form:message}"/>${endif:showmessage}
|
||||
|
||||
<table class="form">
|
||||
${if:groups}
|
||||
<tr>
|
||||
<td><strong>${msg:form.field.department}</strong></td>
|
||||
<td><select name="group" onchange="Survey.changeGroup(this, 'departmentDescription', groupDescriptions)">${page:groups}</select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>${msg:form.field.department.description}</strong></td>
|
||||
<td id="departmentDescription">${page:default.department.description}</td>
|
||||
</tr>
|
||||
${endif:groups}
|
||||
<tr>
|
||||
<td><strong>${msg:presurvey.name}</strong></td>
|
||||
<td><input type="text" name="name" size="50" value="${form:name}" class="username" ${ifnot:showname}disabled="disabled"${endif:showname}/></td>
|
||||
</tr>
|
||||
${if:showemail}
|
||||
<tr>
|
||||
<td><strong>${msg:presurvey.mail}</strong></td>
|
||||
<td><input type="text" name="email" size="50" value="${form:email}" class="username"/></td>
|
||||
</tr>
|
||||
${endif:showemail}
|
||||
${if:showmessage}
|
||||
<tr>
|
||||
<td><strong>${msg:presurvey.question}:</strong></td>
|
||||
<td valign="top"><textarea name="message" tabindex="0" cols="45" rows="2">${form:message}</textarea></td>
|
||||
</tr>
|
||||
${endif:showmessage}
|
||||
</table>
|
||||
<a href="javascript:Survey.submit();" class="but" id="sndmessagelnk">${msg:presurvey.submit}</a>
|
||||
<div class="clear"> </div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -18,6 +18,10 @@
|
||||
require_once('libs/init.php');
|
||||
require_once('libs/chat.php');
|
||||
require_once('libs/operator.php');
|
||||
require_once('libs/invitation.php');
|
||||
require_once('libs/groups.php');
|
||||
require_once('libs/captcha.php');
|
||||
require_once('libs/notify.php');
|
||||
require_once('libs/classes/thread.php');
|
||||
require_once('libs/classes/mibew_api.php');
|
||||
require_once('libs/classes/mibew_api_interaction.php');
|
||||
|
Loading…
Reference in New Issue
Block a user