-
Notifications
You must be signed in to change notification settings - Fork 0
/
my_contacts.php
93 lines (93 loc) · 3.65 KB
/
my_contacts.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<?php
include_once "config.inc.php";
include_once "functions.inc.php";
?>
<html>
<head>
<title>Contact Messenger</title>
<meta charset="UTF-8" />
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<!-- Include Moxtra JavaScript Library -->
<script type="text/javascript" src="https://www.moxtra.com/api/js/moxtra-latest.js" id="moxtrajs"></script>
<!-- Initialize Moxtra SDK Object -->
<?php
$app_login = "SUCCESS";
if ($app_login == "SUCCESS") {
$uid = $_REQUEST["uid"];
$access_token = get_access_token($uid);
}
?>
<script type="text/javascript">
var options = {
mode: "sandbox",
client_id: "<?php echo $CLIENT_ID; ?>", //
access_token: "<?php echo $access_token; ?>",
invalid_token: function(event) {
//Triggered when the access token is expired or invalid
console.log("Access Token expired, please generate a new access token!");
}
};
Moxtra.init(options);
</script>
<style type="text/css">
#chat_container div {margin:0px !important; padding:0px !important;}
</style>
</head>
<body>
<nav class="navbar navbar-inverse">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Contact Messenger</a>
</div>
</div>
</nav>
<div class="container">
<div class="row" id="contacts">
<!-- Container to hold the contact list -->
<div class="col-md-4" id="contact_list">
<?php
if ($access_token != ""){
show_user_contacts($uid);
}
?>
</div>
<!-- Container to hold the Chat UI -->
<div class="col-md-8" id="chat_container">
</div>
</div>
</div>
<script type="text/javascript">
function start_chat (contact_id) {
var chat_options = {
unique_id: contact_id,
iframe: true,
tagid4iframe: "chat_container",
iframewidth: "500px",
iframeheight: "600px",
autostart_note: false,
start_chat: function(event) {
console.log("Chat started binder ID: " + event.binder_id);
},
publish_feed: function(event) {
console.log(event.message + " " + event.binder_id);
},
receive_feed: function (event) {
console.log(event.message + " " + event.binder_id);
},
error: function(event) {
console.log("Chat error code: " + event.error_code + " error message: " + event.error_message);
}
};
Moxtra.chatView(chat_options);
}
</script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
</body>
</html>