Add context menu to list of calls, support archiving and deletion of messages
[infodrom/phone] / index.php
1 <?
2 include_once('phone.php');
3
4 if (!empty($_POST['func'])) {
5   $data = array();
6   if ($_POST['func'] == 'incoming') {
7     $data['incoming'] = read_directory('incoming');
8   } elseif ($_POST['func'] == 'archive') {
9     $data['archive'] = read_directory('archive');
10   } elseif ($_POST['func'] == 'archive_call') {
11     archive_call($_POST['call']);
12   } elseif ($_POST['func'] == 'delete_call') {
13     delete_call($_POST['dir'],$_POST['call']);
14   } elseif ($_POST['func'] == 'callinfo') {
15     $data = callinfo($_POST['dir'],$_POST['call']);
16   }
17   header('Content-type: application/json; charset=UTF-8');
18   echo json_encode($data);
19   exit;
20 } elseif (!empty($_GET['dir']) && !empty($_GET['call'])) {
21   send_call($_GET['dir'], $_GET['call']);
22   exit;
23 }
24
25 ?>
26 <html>
27 <head>
28 <title>Infodrom Phone Answering Machine</title>
29 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
30 <link href="phone.css" rel="stylesheet" type="text/css">
31 </head>
32 <script type="text/javascript" src="lib/json_parse.js"></script>
33 <script type="text/javascript" src="lib/basics.js"></script>
34 <script type="text/javascript" src="phone.js"></script>
35 <script type="text/javascript" src="lib/debug_joey.js"></script>
36
37 <body onload="page_init()">
38 <div style="margin-top: -5px">
39 </div>
40
41 <div>
42 <div class="phonelist" id="incoming">
43 <p class="title">Incoming Calls</p>
44 <ul class="phonelist" id="incoming_calls">
45 <li>Loading data...</li>
46 </ul>
47 </div>
48
49 <div class="phonelist" id="archive">
50 <p class="title">Archived Calls</p>
51 <ul class="phonelist" id="archive_calls">
52 <li>Loading data...</li>
53 </ul>
54 </div>
55
56 </div>
57
58 <div class="phonecall">
59 <p class="title">Play message</p>
60 <p id="callspeaker">&nbsp;</p>
61 <iframe class="phonecall" id="phonecall"></iframe>
62 <p id="calldate">&nbsp;</p>
63 <p id="callnote"></p>
64 </div>
65
66 </body>
67 </html>