Add call edit functionality
[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     $data['dir'] = $_POST['dir'];
17     $data['call'] = $_POST['call'];
18   } elseif ($_POST['func'] == 'save') {
19     save_call();
20   }
21   header('Content-type: application/json; charset=UTF-8');
22   echo json_encode($data);
23   exit;
24 } elseif (!empty($_GET['dir']) && !empty($_GET['call'])) {
25   send_call($_GET['dir'], $_GET['call']);
26   exit;
27 }
28
29 ?>
30 <html>
31 <head>
32 <title>Infodrom Phone Answering Machine</title>
33 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
34 <link href="phone.css" rel="stylesheet" type="text/css">
35 </head>
36 <script type="text/javascript" src="lib/json_parse.js"></script>
37 <script type="text/javascript" src="lib/basics.js"></script>
38 <script type="text/javascript" src="phone.js"></script>
39 <script type="text/javascript" src="lib/debug_joey.js"></script>
40
41 <body onload="page_init()">
42 <div style="margin-top: -5px">
43 </div>
44
45 <div>
46 <div class="phonelist" id="incoming">
47 <p class="title">Incoming Calls</p>
48 <ul class="phonelist" id="incoming_calls">
49 <li>Loading data...</li>
50 </ul>
51 </div>
52
53 <div class="phonelist" id="archive">
54 <p class="title">Archived Calls</p>
55 <ul class="phonelist" id="archive_calls">
56 <li>Loading data...</li>
57 </ul>
58 </div>
59
60 </div>
61
62 <div class="phonecall">
63 <p class="title">Play message</p>
64 <p id="callspeaker">&nbsp;</p>
65 <iframe class="phonecall" id="phonecall"></iframe>
66 <p id="calldate">&nbsp;</p>
67 <p id="callnote"></p>
68 </div>
69
70 <div class="editcall">
71 <p class="title">Edit message</p>
72 <div style="padding-left: 5px;">
73 <form id="edit_form">
74 <span id="edit_date">&nbsp;</span><br>
75 <input id="edit_dir" type="hidden">
76 <input id="edit_call" type="hidden">
77 Name<br><input id="edit_name" type="text" size="31"><br>
78 Note<br><input id="edit_note" type="text" size="31"><br>
79 <input type="button" class="button" value="Save" onclick="save()" style="margin-top: 5px;">
80 <span id="edit_status"></span>
81 </form>
82 </div>
83 </div>
84
85 </body>
86 </html>