diff --git a/src/messenger/build.xml b/src/messenger/build.xml
index 86ff4c01..00166ed6 100644
--- a/src/messenger/build.xml
+++ b/src/messenger/build.xml
@@ -334,14 +334,6 @@
-
-
-
-
-
- Invite JavaScript application built.
-
-
@@ -430,7 +422,7 @@
-
+
Mibew Messenger built.
diff --git a/src/messenger/webim/client.php b/src/messenger/webim/client.php
index b0f4eed4..428a6fa7 100644
--- a/src/messenger/webim/client.php
+++ b/src/messenger/webim/client.php
@@ -47,6 +47,24 @@ if (get_remote_level($_SERVER['HTTP_USER_AGENT']) == 'old') {
exit;
}
+if (verifyparam("act", "/^(invitation)$/", "default") == 'invitation') {
+ // Check if user invited to chat
+ $invitation_state = invitation_state($_SESSION['visitorid']);
+
+ if ($invitation_state['invited'] && $invitation_state['threadid']) {
+ $thread = Thread::load($invitation_state['threadid']);
+
+ // Prepare page
+ $page = setup_invitation_view($thread);
+
+ // Build js application options
+ $page['invitationOptions'] = json_encode($page['invitation']);
+ // Expand page
+ expand("styles/dialogs", getchatstyle(), "chat.tpl");
+ exit;
+ }
+}
+
if( !isset($_GET['token']) || !isset($_GET['thread']) ) {
$thread = NULL;
@@ -107,8 +125,7 @@ if( !isset($_GET['token']) || !isset($_GET['thread']) ) {
// Get invitation info
if (Settings::get('enabletracking')) {
$invitation_state = invitation_state($_SESSION['visitorid']);
- $visitor_is_invited = $invitation_state['invited']
- && !$invitation_state['threadid'];
+ $visitor_is_invited = $invitation_state['invited'];
} else {
$visitor_is_invited = false;
}
diff --git a/src/messenger/webim/default.css b/src/messenger/webim/default.css
index 8bc641b5..6982313b 100644
--- a/src/messenger/webim/default.css
+++ b/src/messenger/webim/default.css
@@ -986,17 +986,3 @@ table.awaiting .no-threads, table.awaiting .no-visitors {
float:left;
padding-left:10px;
}
-
-/* invitation wait */
-
-.ajaxWait {
- z-index: -1;
- position: absolute;
- top: 0;
- left: 0;
- width: 100%;
- height: 100%;
- background-image: url(images/ajax-loader.gif);
- background-repeat: no-repeat;
- background-position: center;
-}
diff --git a/src/messenger/webim/images/ajax-loader.gif b/src/messenger/webim/images/ajax-loader.gif
deleted file mode 100644
index 2f6eff25..00000000
Binary files a/src/messenger/webim/images/ajax-loader.gif and /dev/null differ
diff --git a/src/messenger/webim/install/dbinfo.php b/src/messenger/webim/install/dbinfo.php
index 16105282..f1e38851 100644
--- a/src/messenger/webim/install/dbinfo.php
+++ b/src/messenger/webim/install/dbinfo.php
@@ -42,6 +42,7 @@ $dbtables = array(
"dtmmodified" => "int NOT NULL DEFAULT 0",
"lrevision" => "int NOT NULL DEFAULT 0",
"istate" => "int NOT NULL DEFAULT 0",
+ "invitationstate" => "int NOT NULL DEFAULT 0",
"ltoken" => "int NOT NULL",
"remote" => "varchar(255)",
"referer" => "text",
@@ -167,15 +168,12 @@ $dbtables = array(
"${mysqlprefix}chatsitevisitor" => array(
"visitorid" => "INT NOT NULL auto_increment PRIMARY KEY",
- "userid" => "varchar(64) NOT NULL",
- "username" => "varchar(255)",
+ "userid" => "varchar(255) NOT NULL",
+ "username" => "varchar(64)",
"firsttime" => "int NOT NULL DEFAULT 0",
"lasttime" => "int NOT NULL DEFAULT 0",
"entry" => "text NOT NULL",
"details" => "text NOT NULL",
- "invited" => "tinyint(1) NOT NULL DEFAULT 0",
- "invitationtime" => "int NOT NULL DEFAULT 0",
- "invitedby" => "INT references ${mysqlprefix}chatoperator(operatorid) on delete set null",
"invitations" => "INT NOT NULL DEFAULT 0",
"chats" => "INT NOT NULL DEFAULT 0",
"threadid" => "INT references ${mysqlprefix}chatthread(threadid) on delete set null"
@@ -233,7 +231,7 @@ $dbtables_indexes = array(
$memtables = array();
$dbtables_can_update = array(
- "${mysqlprefix}chatthread" => array("agentId", "userTyping", "agentTyping", "messageCount", "nextagent", "shownmessageid", "userid", "userAgent", "groupid", "dtmchatstarted"),
+ "${mysqlprefix}chatthread" => array("agentId", "userTyping", "agentTyping", "messageCount", "nextagent", "shownmessageid", "userid", "userAgent", "groupid", "dtmchatstarted", "invitationstate"),
"${mysqlprefix}chatthreadstatistics" => array(),
"${mysqlprefix}requestbuffer" => array("requestid", "requestkey", "request"),
"${mysqlprefix}chatmessage" => array("agentId"),
diff --git a/src/messenger/webim/install/dbperform.php b/src/messenger/webim/install/dbperform.php
index 9566ab39..3831d667 100644
--- a/src/messenger/webim/install/dbperform.php
+++ b/src/messenger/webim/install/dbperform.php
@@ -128,6 +128,10 @@ if ($act == "silentcreateall") {
runsql("ALTER TABLE ${mysqlprefix}chatthread ADD userid varchar(255) DEFAULT \"\"", $link);
}
+ if (in_array("${mysqlprefix}chatthread.invitationstate", $absent_columns)) {
+ runsql("ALTER TABLE ${mysqlprefix}chatthread ADD invitationstate int NOT NULL DEFAULT 0 AFTER istate", $link);
+ }
+
if (in_array("${mysqlprefix}chatoperator.iperm", $absent_columns)) {
runsql("ALTER TABLE ${mysqlprefix}chatoperator ADD iperm int DEFAULT 65535", $link);
}
diff --git a/src/messenger/webim/js/compiled/chat/app.js b/src/messenger/webim/js/compiled/chat/app.js
index a1967eea..8f464b80 100644
--- a/src/messenger/webim/js/compiled/chat/app.js
+++ b/src/messenger/webim/js/compiled/chat/app.js
@@ -5,5 +5,5 @@
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
*/
-(function(a,d){var c=a.Application;c.addRegions({mainRegion:"#main-region"});c.addInitializer(function(b){a.PluginOptions=b.plugins||{};a.Objects.server=new a.Server(d.extend({interactionType:MibewAPIChatInteraction},b.server));a.Objects.Models.page=new a.Models.Page(b.page);switch(b.startFrom){case "chat":c.Chat.start(b.chatOptions);break;case "survey":c.Survey.start(b.surveyOptions);break;case "leaveMessage":c.LeaveMessage.start(b.leaveMessageOptions);break;default:throw Error("Dont know how to start!");
-}});c.on("start",function(){a.Objects.server.runUpdater()})})(Mibew,_);
+(function(b,d){var c=b.Application;c.addRegions({mainRegion:"#main-region"});c.addInitializer(function(a){b.PluginOptions=a.plugins||{};b.Objects.server=new b.Server(d.extend({interactionType:MibewAPIChatInteraction},a.server));b.Objects.Models.page=new b.Models.Page(a.page);switch(a.startFrom){case "chat":c.Chat.start(a.chatOptions);break;case "survey":c.Survey.start(a.surveyOptions);break;case "leaveMessage":c.LeaveMessage.start(a.leaveMessageOptions);break;case "invitation":c.Invitation.start(a.invitationOptions);
+break;default:throw Error("Dont know how to start!");}});c.on("start",function(){b.Objects.server.runUpdater()})})(Mibew,_);
diff --git a/src/messenger/webim/js/compiled/chat/layouts/invitation.js b/src/messenger/webim/js/compiled/chat/layouts/invitation.js
new file mode 100644
index 00000000..cb4ef85d
--- /dev/null
+++ b/src/messenger/webim/js/compiled/chat/layouts/invitation.js
@@ -0,0 +1,8 @@
+/*
+ Copyright 2005-2013 the original author or authors.
+
+ Licensed under the Apache License, Version 2.0 (the "License").
+ You may obtain a copy of the License at
+ http://www.apache.org/licenses/LICENSE-2.0
+*/
+(function(a,b){a.Layouts.Invitation=b.Marionette.Layout.extend({template:Handlebars.templates.invitation_layout,regions:{messagesRegion:{selector:"#invitation-messages-region",regionType:a.Regions.Messages}}})})(Mibew,Backbone);
diff --git a/src/messenger/webim/js/compiled/chat/modules/invitation.js b/src/messenger/webim/js/compiled/chat/modules/invitation.js
new file mode 100644
index 00000000..cf3dfcdb
--- /dev/null
+++ b/src/messenger/webim/js/compiled/chat/modules/invitation.js
@@ -0,0 +1,10 @@
+/*
+ Copyright 2005-2013 the original author or authors.
+
+ Licensed under the Apache License, Version 2.0 (the "License").
+ You may obtain a copy of the License at
+ http://www.apache.org/licenses/LICENSE-2.0
+*/
+(function(a){var d=[],e=a.Application,b=e.module("Invitation",{startWithParent:!1});b.addInitializer(function(f){var c=a.Objects,b=a.Objects.Models;b.thread=new a.Models.Thread(f.thread);b.user=new a.Models.ChatUser(f.user);c.invitationLayout=new a.Layouts.Invitation;e.mainRegion.show(c.invitationLayout);c.Collections.messages=new a.Collections.Messages;c.invitationLayout.messagesRegion.show(new a.Views.MessagesCollection({collection:c.Collections.messages}));d.push(c.server.callFunctionsPeriodically(function(){var b=
+a.Objects.Models.thread;return[{"function":"update",arguments:{"return":{},references:{},threadId:b.get("id"),token:b.get("token"),lastId:b.get("lastId"),typed:!1,user:!0}}]},function(){}))});b.on("start",function(){a.Objects.server.restartUpdater()});b.addFinalizer(function(){a.Objects.invitationLayout.close();for(var b=0;b