Add reload facility with image from http://www.veryicon.com/icon/png/Internet%20...
[infodrom/phone] / index.php
index 7c08877..b227cf5 100644 (file)
--- a/index.php
+++ b/index.php
@@ -1,3 +1,32 @@
+<?
+include_once('phone.php');
+
+if (!empty($_POST['func'])) {
+  $data = array();
+  if ($_POST['func'] == 'incoming') {
+    $data['incoming'] = read_directory('incoming');
+  } elseif ($_POST['func'] == 'archive') {
+    $data['archive'] = read_directory('archive');
+  } elseif ($_POST['func'] == 'archive_call') {
+    archive_call($_POST['call']);
+  } elseif ($_POST['func'] == 'delete_call') {
+    delete_call($_POST['dir'],$_POST['call']);
+  } elseif ($_POST['func'] == 'callinfo') {
+    $data = callinfo($_POST['dir'],$_POST['call']);
+    $data['dir'] = $_POST['dir'];
+    $data['call'] = $_POST['call'];
+  } elseif ($_POST['func'] == 'save') {
+    save_call();
+  }
+  header('Content-type: application/json; charset=UTF-8');
+  echo json_encode($data);
+  exit;
+} elseif (!empty($_GET['dir']) && !empty($_GET['call'])) {
+  send_call($_GET['dir'], $_GET['call']);
+  exit;
+}
+
+?>
 <html>
 <head>
 <title>Infodrom Phone Answering Machine</title>
 <link href="phone.css" rel="stylesheet" type="text/css">
 </head>
 <script type="text/javascript" src="lib/json_parse.js"></script>
-<script type="text/javascript" src="basics.js"></script>
+<script type="text/javascript" src="lib/basics.js"></script>
 <script type="text/javascript" src="phone.js"></script>
 <script type="text/javascript" src="lib/debug_joey.js"></script>
 
-<body>
+<body onload="page_init()">
 <div style="margin-top: -5px">
-<span id="channels"><span style="margin-right: 450px;">Loading data...</span></span>
+</div>
+
+<div>
+<div class="phonelist" id="incoming">
+<p class="title">Incoming Calls</p>
+<ul class="phonelist" id="incoming_calls">
+<li>Loading data...</li>
+</ul>
+</div>
+
+<div class="phonelist" id="archive">
+<p class="title">Archived Calls</p>
+<ul class="phonelist" id="archive_calls">
+<li>Loading data...</li>
+</ul>
+</div>
+
+</div>
+
+<div class="controls">
+<img src="lib/reload.png" onclick="reload()" title="Check phone box">
+</div>
+
+<div class="phonecall">
+<p class="title">Play message</p>
+<p id="callspeaker">&nbsp;</p>
+<iframe class="phonecall" id="phonecall"></iframe>
+<p id="calldate">&nbsp;</p>
+<p id="callnote"></p>
+</div>
+
+<div class="editcall">
+<p class="title">Edit message</p>
+<div style="padding-left: 5px;">
+<form id="edit_form">
+<span id="edit_date">&nbsp;</span><br>
+<input id="edit_dir" type="hidden">
+<input id="edit_call" type="hidden">
+Name<br><input id="edit_name" type="text" size="31"><br>
+Note<br><input id="edit_note" type="text" size="31"><br>
+<input type="button" class="button" value="Save" onclick="save()" style="margin-top: 5px;">
+<span id="edit_status"></span>
+</form>
+</div>
 </div>
 
 </body>