| 1 |
<?php /* $Id: page.parking.php 2243 2006-08-12 17:13:17Z p_lindheimer $ */ |
|---|
| 2 |
//Copyright (C) 2006 Astrogen LLC |
|---|
| 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 |
$dispnum = 'parking'; //used for switch on config.php |
|---|
| 15 |
|
|---|
| 16 |
$action = isset($_REQUEST['action'])?$_REQUEST['action']:''; |
|---|
| 17 |
|
|---|
| 18 |
isset($_REQUEST['parkingenabled'])?$parkingenabled=$_REQUEST['parkingenabled']:$parkingenabled=''; |
|---|
| 19 |
isset($_REQUEST['parkext'])?$parkext = trim($_REQUEST['parkext']):$parkext='70'; |
|---|
| 20 |
isset($_REQUEST['numslots'])?$numslots = trim($_REQUEST['numslots']):$numslots='8'; |
|---|
| 21 |
isset($_REQUEST['parkingtime'])?$parkingtime = trim($_REQUEST['parkingtime']):$parkingtime='45'; |
|---|
| 22 |
isset($_REQUEST['parkingcontext'])?$parkingcontext = trim($_REQUEST['parkingcontext']):$parkingcontext='parkedcalls'; |
|---|
| 23 |
isset($_REQUEST['parkalertinfo'])?$parkalertinfo = trim($_REQUEST['parkalertinfo']):$parkalertinfo=''; |
|---|
| 24 |
isset($_REQUEST['parkcid'])?$parkcid = trim($_REQUEST['parkcid']):$parkcid=''; |
|---|
| 25 |
isset($_REQUEST['parkingannmsg'])?$parkingannmsg = trim($_REQUEST['parkingannmsg']):$parkingannmsg=''; |
|---|
| 26 |
|
|---|
| 27 |
if (isset($_REQUEST['goto0']) && isset($_REQUEST[$_REQUEST['goto0']."0"])) { |
|---|
| 28 |
$goto = $_REQUEST[$_REQUEST['goto0']."0"]; |
|---|
| 29 |
} else { |
|---|
| 30 |
$goto = ''; |
|---|
| 31 |
} |
|---|
| 32 |
|
|---|
| 33 |
// do if we are submitting a form |
|---|
| 34 |
if(isset($_POST['action'])){ |
|---|
| 35 |
|
|---|
| 36 |
if ($action == 'edtPARKING') { |
|---|
| 37 |
parking_add($parkingenabled, $parkext, $numslots, $parkingtime, $parkingcontext, $parkalertinfo, $parkcid, $parkingannmsg, $goto); |
|---|
| 38 |
needreload(); |
|---|
| 39 |
redirect_standard(); |
|---|
| 40 |
} |
|---|
| 41 |
} |
|---|
| 42 |
?> |
|---|
| 43 |
</div> |
|---|
| 44 |
<div class="content"> |
|---|
| 45 |
<?php |
|---|
| 46 |
|
|---|
| 47 |
// get the parkinglot settings if not a submit |
|---|
| 48 |
// |
|---|
| 49 |
if (!$action) { |
|---|
| 50 |
$parkinglot_id = 1; // only 1 lot now but prepare for future |
|---|
| 51 |
$parkingInfo = parking_getconfig($parkinglot_id); |
|---|
| 52 |
if (is_array($parkingInfo)) extract($parkingInfo); |
|---|
| 53 |
} |
|---|
| 54 |
|
|---|
| 55 |
?> |
|---|
| 56 |
<h2>Parking Lot Configuration</h2> |
|---|
| 57 |
<form name="parking" action="config.php" method="post" onsubmit="return parking_onsubmit();"> |
|---|
| 58 |
<input type="hidden" name="display" value="parking"/> |
|---|
| 59 |
<input type="hidden" name="action" value="edtPARKING"/> |
|---|
| 60 |
<table> |
|---|
| 61 |
<tr><td colspan="2"><h5><?php echo _("Parking Lot Options")?><hr></h5></td></tr> |
|---|
| 62 |
<tr> |
|---|
| 63 |
<td><a href=# class="info"><?php echo _("Enable Parking Lot Feature")?><span><?php echo _("Check this box to enable the parking feature")?></span></a></td> |
|---|
| 64 |
<td align=right><input type="checkbox" value="s" name="parkingenabled" <?php echo ($parkingenabled ? 'CHECKED' : '')?>></td> |
|---|
| 65 |
</tr> |
|---|
| 66 |
<tr> |
|---|
| 67 |
<td><a href=# class="info"><?php echo _("Parking Lot Extension:")?><span> |
|---|
| 68 |
<?php echo _("This is the extension where you will transfer a call to park it.")?><br> |
|---|
| 69 |
</span></a></td> |
|---|
| 70 |
<td align=right><input type="text" size="3" name="parkext" value="<?php echo htmlspecialchars($parkext)?>"/></td> |
|---|
| 71 |
</tr> |
|---|
| 72 |
<tr> |
|---|
| 73 |
<td><a href="#" class="info"><?php echo _("Number of Slots:")?><span><?php echo _("The total number of parking lot spaces to configure. Example, if 70 is the extension and 8 slots are configured, the parking slots will be 71-79")?></span></a></td> |
|---|
| 74 |
<td align=right> |
|---|
| 75 |
<select name="numslots"/> |
|---|
| 76 |
<?php |
|---|
| 77 |
$default = (isset($numslots) ? $numslots : 8); |
|---|
| 78 |
for ($i=2; $i <= 20; $i++) { |
|---|
| 79 |
echo '<option value="'.$i.'" '.($i == $default ? 'SELECTED' : '').'>'.$i.'</option>'; |
|---|
| 80 |
} |
|---|
| 81 |
?> |
|---|
| 82 |
</select> |
|---|
| 83 |
</td> |
|---|
| 84 |
</tr> |
|---|
| 85 |
<tr> |
|---|
| 86 |
<td><a href="#" class="info"><?php echo _("Parking Timeout:")?><span><?php echo _("The timeout period that a parked call will attempt to ring back the original parker if not answered")?></span></a></td> |
|---|
| 87 |
<td align=right> |
|---|
| 88 |
<select name="parkingtime"/> |
|---|
| 89 |
<?php |
|---|
| 90 |
$default = (isset($parkingtime) ? $parkingtime : 45); |
|---|
| 91 |
for ($i=15; $i <= 600; $i+=15) { |
|---|
| 92 |
echo '<option value="'.$i.'"'.($i == $parkingtime ? ' SELECTED' : '').'>'.parking_timeString($i,true).'</option>'; |
|---|
| 93 |
} |
|---|
| 94 |
?> |
|---|
| 95 |
</select> |
|---|
| 96 |
</td> |
|---|
| 97 |
</tr> |
|---|
| 98 |
<tr> |
|---|
| 99 |
<td><a href=# class="info"><?php echo _("Parking Lot Context:")?><span> |
|---|
| 100 |
<?php echo _("This is the parking lot context. You should not change it from the default unless you know what you are doing.")?><br> |
|---|
| 101 |
</span></a></td> |
|---|
| 102 |
<td align=right><input type="text" size="19" name="parkingcontext" value="<?php echo htmlspecialchars($parkingcontext)?>"/></td> |
|---|
| 103 |
</tr> |
|---|
| 104 |
<tr><td colspan="2"><br><h5><?php echo _("Actions for Timed-Out Orphans")?><hr></h5></td></tr> |
|---|
| 105 |
<tr> |
|---|
| 106 |
<td><a href=# class="info"><?php echo _("Parking Alert-Info:")?><span> |
|---|
| 107 |
<?php echo _("Alert-Info to put in channel before going to defined destination below. This can create distinct rings on some SIP phones and can serve to alert the recipients that the call is from an Orphaned parked call")?><br> |
|---|
| 108 |
</span></a></td> |
|---|
| 109 |
<td align=right><input type="text" size="19" name="parkalertinfo" value="<?php echo htmlspecialchars($parkalertinfo)?>"/></td> |
|---|
| 110 |
</tr> |
|---|
| 111 |
<tr> |
|---|
| 112 |
<td><a href=# class="info"><?php echo _("CallerID Prepend:")?><span> |
|---|
| 113 |
<?php echo _("String to pre-pend to the current Caller-ID associated with this call (if any), before going to defined destination below. This can serve to alert the recipients that the call is from an Orphaned parked call")?><br> |
|---|
| 114 |
</span></a></td> |
|---|
| 115 |
<td align=right><input type="text" size="19" name="parkcid" value="<?php echo htmlspecialchars($parkcid)?>"/></td> |
|---|
| 116 |
</tr> |
|---|
| 117 |
<?php if(function_exists('recordings_list')) { //only include if recordings is enabled?> |
|---|
| 118 |
<tr> |
|---|
| 119 |
<td><a href="#" class="info"><?php echo _("Announcement:")?><span><?php echo _("Optional message to be played to the orphaned caller prior to going on the to supplied destination below.<br><br>To add additional recordings please use the \"System Recordings\" MENU to the left")?></span></a></td> |
|---|
| 120 |
<td align=right> |
|---|
| 121 |
<select name="parkingannmsg"/> |
|---|
| 122 |
<?php |
|---|
| 123 |
$tresults = recordings_list(); |
|---|
| 124 |
$default = (isset($parkingannmsg) ? $parkingannmsg : ''); |
|---|
| 125 |
echo '<option value="">'._("None")."</option>"; |
|---|
| 126 |
if (isset($tresults[0])) { |
|---|
| 127 |
foreach ($tresults as $tresult) { |
|---|
| 128 |
echo '<option value="'.$tresult[2].'"'.($tresult[2] == $default ? ' SELECTED' : '').'>'.$tresult[1]."</option>\n"; |
|---|
| 129 |
} |
|---|
| 130 |
} |
|---|
| 131 |
?> |
|---|
| 132 |
</select> |
|---|
| 133 |
</td> |
|---|
| 134 |
</tr> |
|---|
| 135 |
<?php } else { ?> |
|---|
| 136 |
<tr> |
|---|
| 137 |
<td><a href="#" class="info"><?php echo _("Announcement:")?><span><?php echo _("Optional message to be played to the orphaned caller prior to going on to the supplied destination below.<br><br>You must install and enable the \"Systems Recordings\" Module to edit this option")?></span></a></td> |
|---|
| 138 |
<td align=right> |
|---|
| 139 |
<?php |
|---|
| 140 |
$default = (isset($parkingannmsg) ? $parkingannmsg : ''); |
|---|
| 141 |
?> |
|---|
| 142 |
<input type="hidden" name="parkingannmsg" value="<?php echo $default; ?>"><?php echo ($default != '' ? $default : 'None'); ?> |
|---|
| 143 |
</td> |
|---|
| 144 |
</tr> |
|---|
| 145 |
<?php } ?> |
|---|
| 146 |
|
|---|
| 147 |
<tr><td colspan="2"><br><h5><?php echo _("Destination for Orphaned Parked Calls")?>:<hr></h5></td></tr> |
|---|
| 148 |
<?php |
|---|
| 149 |
//draw goto selects |
|---|
| 150 |
echo drawselects($goto,0); |
|---|
| 151 |
?> |
|---|
| 152 |
<tr> |
|---|
| 153 |
<td colspan="2"><br><h6><input name="Submit" type="submit" value="<?php echo _("Submit Changes")?>"></h6></td> |
|---|
| 154 |
</tr> |
|---|
| 155 |
</table> |
|---|
| 156 |
|
|---|
| 157 |
<script language="javascript"> |
|---|
| 158 |
<!-- |
|---|
| 159 |
|
|---|
| 160 |
var theForm = document.parking; |
|---|
| 161 |
|
|---|
| 162 |
function parking_onsubmit() { |
|---|
| 163 |
var msgInvalidExtension = "<?php echo _('Please enter a valid numeric parking lot extension'); ?>"; |
|---|
| 164 |
|
|---|
| 165 |
defaultEmptyOK = false; |
|---|
| 166 |
if (!isInteger(theForm.parkext.value)) |
|---|
| 167 |
return warnInvalid(theForm.parkext, msgInvalidExtension); |
|---|
| 168 |
return true; |
|---|
| 169 |
} |
|---|
| 170 |
|
|---|
| 171 |
//--> |
|---|
| 172 |
</script> |
|---|
| 173 |
</form> |
|---|