| 1 |
<?php |
|---|
| 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 |
|
|---|
| 15 |
isset($_REQUEST['action'])?$action = $_REQUEST['action']:$action=''; |
|---|
| 16 |
|
|---|
| 17 |
isset($_REQUEST['itemid'])?$itemid=mysql_real_escape_string($_REQUEST['itemid']):$itemid=''; |
|---|
| 18 |
|
|---|
| 19 |
$dispnum = "timeconditions"; |
|---|
| 20 |
$tabindex = 0; |
|---|
| 21 |
|
|---|
| 22 |
|
|---|
| 23 |
switch ($action) { |
|---|
| 24 |
case "add": |
|---|
| 25 |
timeconditions_add($_POST); |
|---|
| 26 |
needreload(); |
|---|
| 27 |
redirect_standard(); |
|---|
| 28 |
break; |
|---|
| 29 |
case "delete": |
|---|
| 30 |
timeconditions_del($itemid); |
|---|
| 31 |
needreload(); |
|---|
| 32 |
redirect_standard(); |
|---|
| 33 |
break; |
|---|
| 34 |
case "edit": |
|---|
| 35 |
timeconditions_edit($itemid,$_POST); |
|---|
| 36 |
needreload(); |
|---|
| 37 |
redirect_standard('itemid'); |
|---|
| 38 |
break; |
|---|
| 39 |
} |
|---|
| 40 |
|
|---|
| 41 |
|
|---|
| 42 |
|
|---|
| 43 |
$timeconditions = timeconditions_list(); |
|---|
| 44 |
?> |
|---|
| 45 |
|
|---|
| 46 |
</div> <!-- end content div so we can display rnav properly--> |
|---|
| 47 |
|
|---|
| 48 |
<!-- right side menu --> |
|---|
| 49 |
<div class="rnav"><ul> |
|---|
| 50 |
<li><a id="<?php echo ($itemid=='' ? 'current':'') ?>" href="config.php?display=<?php echo urlencode($dispnum)?>"><?php echo _("Add Time Condition")?></a></li> |
|---|
| 51 |
<?php |
|---|
| 52 |
if (isset($timeconditions)) { |
|---|
| 53 |
foreach ($timeconditions as $timecond) { |
|---|
| 54 |
echo "<li><a id=\"".($itemid==$timecond['timeconditions_id'] ? 'current':'')."\" href=\"config.php?display=".urlencode($dispnum)."&itemid=".urlencode($timecond['timeconditions_id'])."\">{$timecond['displayname']}</a></li>"; |
|---|
| 55 |
} |
|---|
| 56 |
} |
|---|
| 57 |
?> |
|---|
| 58 |
</ul></div> |
|---|
| 59 |
|
|---|
| 60 |
<div class="content"> |
|---|
| 61 |
<?php |
|---|
| 62 |
if ($action == 'delete') { |
|---|
| 63 |
echo '<br><h3>'._("Time Condition").' '.$itemid.' '._("deleted").'!</h3>'; |
|---|
| 64 |
} else { |
|---|
| 65 |
if ($itemid){ |
|---|
| 66 |
|
|---|
| 67 |
$thisItem = timeconditions_get($itemid); |
|---|
| 68 |
} |
|---|
| 69 |
|
|---|
| 70 |
$delURL = $_SERVER['PHP_SELF'].'?'.$_SERVER['QUERY_STRING'].'&action=delete'; |
|---|
| 71 |
?> |
|---|
| 72 |
|
|---|
| 73 |
<h2><?php echo ($itemid ? _("Time Condition:")." ". $itemid : _("Add Time Condition")); ?></h2> |
|---|
| 74 |
<?php if ($itemid){ ?> |
|---|
| 75 |
<p><a href="<?php echo $delURL ?>"><?php echo _("Delete Time Condition")?> <?php echo $itemid; ?></a></p> |
|---|
| 76 |
<?php } ?> |
|---|
| 77 |
<form autocomplete="off" name="edit" action="<?php $_SERVER['PHP_SELF'] ?>" method="post" onsubmit="return edit_onsubmit();"> |
|---|
| 78 |
<input type="hidden" name="display" value="<?php echo $dispnum?>"> |
|---|
| 79 |
<input type="hidden" name="action" value="<?php echo ($itemid ? 'edit' : 'add') ?>"> |
|---|
| 80 |
<input type="hidden" name="deptname" value="<?php echo $_SESSION["AMP_user"]->_deptname ?>"> |
|---|
| 81 |
<table> |
|---|
| 82 |
<tr><td colspan="2"><h5><?php echo ($itemid ? _("Edit Time Condition") : _("Add Time Condition")) ?><hr></h5></td></tr> |
|---|
| 83 |
|
|---|
| 84 |
<?php if ($itemid){ ?> |
|---|
| 85 |
<input type="hidden" name="account" value="<?php echo $itemid; ?>"> |
|---|
| 86 |
<?php }?> |
|---|
| 87 |
|
|---|
| 88 |
<tr> |
|---|
| 89 |
<td><a href="#" class="info"><?php echo _("Time Condition name:")?><span><?php echo _("Give this Time Condition a brief name to help you identify it.")?></span></a></td> |
|---|
| 90 |
<td><input type="text" name="displayname" value="<?php echo (isset($thisItem['displayname']) ? $thisItem['displayname'] : ''); ?>" tabindex="<?php echo ++$tabindex;?>"></td> |
|---|
| 91 |
</tr> |
|---|
| 92 |
<tr> |
|---|
| 93 |
<td><a href="#" class="info"><?php echo _("Time Group:")?><span><?php echo _("Select a Time Group created under Time Groups. Matching times will be sent to matching destination. If no group is selected, call will always go to no-match destination.")?></span></a></td> |
|---|
| 94 |
<td><?php echo timeconditions_timegroups_drawgroupselect('time', (isset($thisItem['time']) ? $thisItem['time'] : ''), true, ''); ?></td> |
|---|
| 95 |
</tr> |
|---|
| 96 |
<tr><td colspan="2"><br><h5><?php echo _("Destination if time matches")?>:<hr></h5></td></tr> |
|---|
| 97 |
<?php |
|---|
| 98 |
|
|---|
| 99 |
if (isset($thisItem)) { |
|---|
| 100 |
echo drawselects($thisItem['truegoto'],0); |
|---|
| 101 |
} else { |
|---|
| 102 |
echo drawselects(null, 0); |
|---|
| 103 |
} |
|---|
| 104 |
?> |
|---|
| 105 |
|
|---|
| 106 |
<tr><td colspan="2"><br><h5><?php echo _("Destination if time does not match")?>:<hr></h5></td></tr> |
|---|
| 107 |
|
|---|
| 108 |
<?php |
|---|
| 109 |
|
|---|
| 110 |
if (isset($thisItem)) { |
|---|
| 111 |
echo drawselects($thisItem['falsegoto'],1); |
|---|
| 112 |
} else { |
|---|
| 113 |
echo drawselects(null, 1); |
|---|
| 114 |
} |
|---|
| 115 |
?> |
|---|
| 116 |
|
|---|
| 117 |
<tr> |
|---|
| 118 |
<td colspan="2"><br><h6><input name="Submit" type="submit" value="<?php echo _("Submit Changes")?>" tabindex="<?php echo ++$tabindex;?>"></h6></td> |
|---|
| 119 |
</tr> |
|---|
| 120 |
</table> |
|---|
| 121 |
<script language="javascript"> |
|---|
| 122 |
<!-- |
|---|
| 123 |
|
|---|
| 124 |
var theForm = document.edit; |
|---|
| 125 |
theForm.displayname.focus(); |
|---|
| 126 |
|
|---|
| 127 |
function edit_onsubmit() { |
|---|
| 128 |
var msgInvalidTimeCondName = "<?php echo _('Please enter a valid Time Conditions Name'); ?>"; |
|---|
| 129 |
var msgInvalidTimeGroup = "<?php echo _('You have not selected a time group to associate with this timecondtion. It will got to the un-matching destination until you update it with a valid grop'); ?>"; |
|---|
| 130 |
|
|---|
| 131 |
defaultEmptyOK = false; |
|---|
| 132 |
if (!isAlphanumeric(theForm.displayname.value)) |
|---|
| 133 |
return warnInvalid(theForm.displayname, msgInvalidTimeCondName); |
|---|
| 134 |
if (isEmpty(theForm.time.value)) |
|---|
| 135 |
return confirm(msgInvalidTimeGroup) |
|---|
| 136 |
|
|---|
| 137 |
if (!validateDestinations(edit,2,true)) |
|---|
| 138 |
return false; |
|---|
| 139 |
|
|---|
| 140 |
return true; |
|---|
| 141 |
} |
|---|
| 142 |
|
|---|
| 143 |
|
|---|
| 144 |
//--> |
|---|
| 145 |
</script> |
|---|
| 146 |
|
|---|
| 147 |
|
|---|
| 148 |
</form> |
|---|
| 149 |
<?php |
|---|
| 150 |
} |
|---|
| 151 |
?> |
|---|
| 152 |
|
|---|