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