| 1 |
<?php /* $Id */ |
|---|
| 2 |
//Copyright (C) 2004 Coalescent Systems Inc. (info@coalescentsystems.ca) |
|---|
| 3 |
// |
|---|
| 4 |
//This program is free software; you can redistribute it and/or |
|---|
| 5 |
//modify it under the terms of the GNU General Public License |
|---|
| 6 |
//as published by the Free Software Foundation; either version 2 |
|---|
| 7 |
//of the License, or (at your option) any later version. |
|---|
| 8 |
// |
|---|
| 9 |
//This program is distributed in the hope that it will be useful, |
|---|
| 10 |
//but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 11 |
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 12 |
//GNU General Public License for more details. |
|---|
| 13 |
|
|---|
| 14 |
isset($_REQUEST['action'])?$action = $_REQUEST['action']:$action=''; |
|---|
| 15 |
|
|---|
| 16 |
//the item we are currently displaying |
|---|
| 17 |
isset($_REQUEST['itemid'])?$itemid=$_REQUEST['itemid']:$itemid=''; |
|---|
| 18 |
|
|---|
| 19 |
$dispnum = "callback"; //used for switch on config.php |
|---|
| 20 |
|
|---|
| 21 |
//if submitting form, update database |
|---|
| 22 |
if(isset($_POST['action'])) { |
|---|
| 23 |
switch ($action) { |
|---|
| 24 |
case "add": |
|---|
| 25 |
callback_add($_POST); |
|---|
| 26 |
needreload(); |
|---|
| 27 |
break; |
|---|
| 28 |
case "delete": |
|---|
| 29 |
callback_del($itemid); |
|---|
| 30 |
needreload(); |
|---|
| 31 |
break; |
|---|
| 32 |
case "edit": |
|---|
| 33 |
callback_edit($itemid,$_POST); |
|---|
| 34 |
needreload(); |
|---|
| 35 |
break; |
|---|
| 36 |
} |
|---|
| 37 |
} |
|---|
| 38 |
|
|---|
| 39 |
//get list of time conditions |
|---|
| 40 |
$callbacks = callback_list(); |
|---|
| 41 |
?> |
|---|
| 42 |
|
|---|
| 43 |
</div> <!-- end content div so we can display rnav properly--> |
|---|
| 44 |
|
|---|
| 45 |
<!-- right side menu --> |
|---|
| 46 |
<div class="rnav"> |
|---|
| 47 |
<li><a id="<?php echo ($itemid=='' ? 'current':'') ?>" href="config.php?display=<?php echo urlencode($dispnum)?>"><?php echo _("Add Callback")?></a></li> |
|---|
| 48 |
<?php |
|---|
| 49 |
if (isset($callbacks)) { |
|---|
| 50 |
foreach ($callbacks as $callback) { |
|---|
| 51 |
echo "<li><a id=\"".($itemid==$callback['callback_id'] ? 'current':'')."\" href=\"config.php?display=".urlencode($dispnum)."&itemid=".urlencode($callback['callback_id'])."\">{$callback['description']}</a></li>"; |
|---|
| 52 |
} |
|---|
| 53 |
} |
|---|
| 54 |
?> |
|---|
| 55 |
</div> |
|---|
| 56 |
|
|---|
| 57 |
<div class="content"> |
|---|
| 58 |
<?php |
|---|
| 59 |
if ($action == 'delete') { |
|---|
| 60 |
echo '<br><h3>'._("Callback ").' '.$itemid.' '._("deleted").'!</h3>'; |
|---|
| 61 |
} else { |
|---|
| 62 |
if ($itemid){ |
|---|
| 63 |
//get details for this time condition |
|---|
| 64 |
$thisItem = callback_get($itemid); |
|---|
| 65 |
} |
|---|
| 66 |
|
|---|
| 67 |
$delURL = $_SERVER['PHP_SELF'].'?'.$_SERVER['QUERY_STRING'].'&action=delete'; |
|---|
| 68 |
$delButton = " |
|---|
| 69 |
<form name=delete action=\"{$_SERVER['PHP_SELF']}\" method=POST> |
|---|
| 70 |
<input type=\"hidden\" name=\"display\" value=\"{$dispnum}\"> |
|---|
| 71 |
<input type=\"hidden\" name=\"itemid\" value=\"{$itemid}\"> |
|---|
| 72 |
<input type=\"hidden\" name=\"action\" value=\"delete\"> |
|---|
| 73 |
<input type=submit value=\""._("Delete Callback")."\"> |
|---|
| 74 |
</form>"; |
|---|
| 75 |
|
|---|
| 76 |
?> |
|---|
| 77 |
|
|---|
| 78 |
<h2><?php echo ($itemid ? _("Callback:")." ". $itemid : _("Add Callback")); ?></h2> |
|---|
| 79 |
|
|---|
| 80 |
<p><?php echo ($itemid ? '' : _("A callback will hang up on the caller and then call them back, directing them to the selected destination. This is useful for reducing mobile phone charges as well as other applications. Outbound calls will proceed according to the dial patterns in Outbound Routes.")); ?></p> |
|---|
| 81 |
|
|---|
| 82 |
<?php if ($itemid){ echo $delButton; } ?> |
|---|
| 83 |
|
|---|
| 84 |
<form autocomplete="off" name="edit" action="<?php $_SERVER['PHP_SELF'] ?>" method="post" onsubmit="return edit_onsubmit();"> |
|---|
| 85 |
<input type="hidden" name="display" value="<?php echo $dispnum?>"> |
|---|
| 86 |
<input type="hidden" name="action" value="<?php echo ($itemid ? 'edit' : 'add') ?>"> |
|---|
| 87 |
<input type="hidden" name="deptname" value="<?php echo $_SESSION["AMP_user"]->_deptname ?>"> |
|---|
| 88 |
<table> |
|---|
| 89 |
<tr><td colspan="2"><h5><?php echo ($itemid ? _("Edit Callback") : _("Add Callback")) ?><hr></h5></td></tr> |
|---|
| 90 |
|
|---|
| 91 |
<?php if ($itemid){ ?> |
|---|
| 92 |
<input type="hidden" name="account" value="<?php echo $itemid; ?>"> |
|---|
| 93 |
<?php }?> |
|---|
| 94 |
|
|---|
| 95 |
<tr> |
|---|
| 96 |
<td><a href="#" class="info"><?php echo _("Callback Description:")?><span><?php echo _("Enter a description for this callback.")?></span></a></td> |
|---|
| 97 |
<td><input type="text" name="description" value="<?php echo (isset($thisItem['description']) ? $thisItem['description'] : ''); ?>"></td> |
|---|
| 98 |
</tr> |
|---|
| 99 |
<tr> |
|---|
| 100 |
<td><a href="#" class="info"><?php echo _("Callback Number:")?><span><?php echo _("Optional: Enter the number to dial for the callback. Leave this blank to just dial the incoming Caller ID Number")?></span></a></td> |
|---|
| 101 |
<td><input type="text" name="callbacknum" value="<?php echo (isset($thisItem['callbacknum']) ? $thisItem['callbacknum'] : ''); ?>"></td> |
|---|
| 102 |
</tr> |
|---|
| 103 |
<tr> |
|---|
| 104 |
<td><a href="#" class="info"><?php echo _("Delay Before Callback:")?><span><?php echo _("Optional: Enter the number of seconds the system should wait before calling back.")?></span></a></td> |
|---|
| 105 |
<td><input size="3" type="text" name="sleep" value="<?php echo (isset($thisItem['sleep']) ? $thisItem['sleep'] : ''); ?>"></td> |
|---|
| 106 |
</tr> |
|---|
| 107 |
<tr><td colspan="2"><br><h5><?php echo _("Destination after Callback")?>:<hr></h5></td></tr> |
|---|
| 108 |
|
|---|
| 109 |
<?php |
|---|
| 110 |
//draw goto selects |
|---|
| 111 |
if (isset($thisItem)) { |
|---|
| 112 |
echo drawselects($thisItem['destination'],0); |
|---|
| 113 |
} else { |
|---|
| 114 |
echo drawselects(null, 0); |
|---|
| 115 |
} |
|---|
| 116 |
?> |
|---|
| 117 |
|
|---|
| 118 |
<tr> |
|---|
| 119 |
<td colspan="2"><br><h6><input name="submit" type="submit" value="<?php echo _("Submit Changes")?>"></h6></td> |
|---|
| 120 |
</tr> |
|---|
| 121 |
</table> |
|---|
| 122 |
<script language="javascript"> |
|---|
| 123 |
<!-- |
|---|
| 124 |
|
|---|
| 125 |
var theForm = document.edit; |
|---|
| 126 |
theForm.description.focus(); |
|---|
| 127 |
|
|---|
| 128 |
function edit_onsubmit() { |
|---|
| 129 |
setDestinations(edit,1); |
|---|
| 130 |
|
|---|
| 131 |
defaultEmptyOK = false; |
|---|
| 132 |
if (!isAlphanumeric(theForm.description.value)) |
|---|
| 133 |
return warnInvalid(theForm.description, "Please enter a valid Description"); |
|---|
| 134 |
|
|---|
| 135 |
if (!validateDestinations(edit,1,true)) |
|---|
| 136 |
return false; |
|---|
| 137 |
|
|---|
| 138 |
return true; |
|---|
| 139 |
} |
|---|
| 140 |
|
|---|
| 141 |
|
|---|
| 142 |
--> |
|---|
| 143 |
</script> |
|---|
| 144 |
|
|---|
| 145 |
|
|---|
| 146 |
</form> |
|---|
| 147 |
<?php |
|---|
| 148 |
} //end if action == delete |
|---|
| 149 |
?> |
|---|