| 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['extdisplay'])?$extdisplay=$_REQUEST['extdisplay']:$extdisplay=''; |
|---|
| 18 |
$dispnum = "conferences"; |
|---|
| 19 |
|
|---|
| 20 |
//check if the extension is within range for this user |
|---|
| 21 |
if (isset($account) && !checkRange($account)){ |
|---|
| 22 |
echo "<script>javascript:alert('"._("Warning! Extension")." $account "._("is not allowed for your account.")."');</script>"; |
|---|
| 23 |
} else { |
|---|
| 24 |
|
|---|
| 25 |
|
|---|
| 26 |
switch ($action) { |
|---|
| 27 |
case "add": |
|---|
| 28 |
conferences_add($_REQUEST['account'],$_REQUEST['name'],$_REQUEST['userpin'],$_REQUEST['adminpin'],$_REQUEST['options'],$_REQUEST['joinmsg']); |
|---|
| 29 |
needreload(); |
|---|
| 30 |
redirect_standard(); |
|---|
| 31 |
break; |
|---|
| 32 |
case "delete": |
|---|
| 33 |
conferences_del($extdisplay); |
|---|
| 34 |
needreload(); |
|---|
| 35 |
redirect_standard(); |
|---|
| 36 |
break; |
|---|
| 37 |
case "edit": |
|---|
| 38 |
conferences_del($_REQUEST['account']); |
|---|
| 39 |
conferences_add($_REQUEST['account'],$_REQUEST['name'],$_REQUEST['userpin'],$_REQUEST['adminpin'],$_REQUEST['options'],$_REQUEST['joinmsg']); |
|---|
| 40 |
needreload(); |
|---|
| 41 |
redirect_standard('extdisplay'); |
|---|
| 42 |
break; |
|---|
| 43 |
} |
|---|
| 44 |
} |
|---|
| 45 |
|
|---|
| 46 |
|
|---|
| 47 |
|
|---|
| 48 |
|
|---|
| 49 |
$meetmes = conferences_list(); |
|---|
| 50 |
?> |
|---|
| 51 |
|
|---|
| 52 |
</div> |
|---|
| 53 |
|
|---|
| 54 |
<!-- right side menu --> |
|---|
| 55 |
<div class="rnav"><ul> |
|---|
| 56 |
<li><a id="<?php echo ($extdisplay=='' ? 'current':'') ?>" href="config.php?display=<?php echo urlencode($dispnum)?>"><?php echo _("Add Conference")?></a></li> |
|---|
| 57 |
<?php |
|---|
| 58 |
if (isset($meetmes)) { |
|---|
| 59 |
foreach ($meetmes as $meetme) { |
|---|
| 60 |
echo "<li><a id=\"".($extdisplay==$meetme[0] ? 'current':'')."\" href=\"config.php?display=".urlencode($dispnum)."&extdisplay=".urlencode($meetme[0])."\">{$meetme[0]}:{$meetme[1]}</a></li>"; |
|---|
| 61 |
} |
|---|
| 62 |
} |
|---|
| 63 |
?> |
|---|
| 64 |
</ul></div> |
|---|
| 65 |
|
|---|
| 66 |
|
|---|
| 67 |
<div class="content"> |
|---|
| 68 |
<?php |
|---|
| 69 |
if ($action == 'delete') { |
|---|
| 70 |
echo '<br><h3>'._("Conference").' '.$extdisplay.' '._("deleted").'!</h3><br><br><br><br><br><br><br><br>'; |
|---|
| 71 |
} else { |
|---|
| 72 |
if ($extdisplay){ |
|---|
| 73 |
|
|---|
| 74 |
$thisMeetme = conferences_get($extdisplay); |
|---|
| 75 |
|
|---|
| 76 |
extract($thisMeetme); |
|---|
| 77 |
} |
|---|
| 78 |
|
|---|
| 79 |
$delURL = $_SERVER['PHP_SELF'].'?'.$_SERVER['QUERY_STRING'].'&action=delete'; |
|---|
| 80 |
?> |
|---|
| 81 |
|
|---|
| 82 |
|
|---|
| 83 |
<?php if ($extdisplay){ ?> |
|---|
| 84 |
<h2><?php echo _("Conference:")." ". $extdisplay; ?></h2> |
|---|
| 85 |
<p><a href="<?php echo $delURL ?>"><?php echo _("Delete Conference")?> <?php echo $extdisplay; ?></a></p> |
|---|
| 86 |
<?php } else { ?> |
|---|
| 87 |
<h2><?php echo _("Add Conference"); ?></h2> |
|---|
| 88 |
<?php } |
|---|
| 89 |
?> |
|---|
| 90 |
<form autocomplete="off" name="editMM" action="<?php $_SERVER['PHP_SELF'] ?>" method="post" onsubmit="return checkConf();"> |
|---|
| 91 |
<input type="hidden" name="display" value="<?php echo $dispnum?>"> |
|---|
| 92 |
<input type="hidden" name="action" value="<?php echo ($extdisplay ? 'edit' : 'add') ?>"> |
|---|
| 93 |
<table> |
|---|
| 94 |
<tr><td colspan="2"><h5><?php echo ($extdisplay ? _("Edit Conference") : _("Add Conference")) ?><hr></h5></td></tr> |
|---|
| 95 |
<tr> |
|---|
| 96 |
<?php if ($extdisplay){ ?> |
|---|
| 97 |
<input type="hidden" name="account" value="<?php echo $extdisplay; ?>"> |
|---|
| 98 |
<?php } else { ?> |
|---|
| 99 |
<td><a href="#" class="info"><?php echo _("conference number:")?><span><?php echo _("Use this number to dial into the conference.")?></span></a></td> |
|---|
| 100 |
<td><input type="text" name="account" value=""></td> |
|---|
| 101 |
<?php } ?> |
|---|
| 102 |
</tr> |
|---|
| 103 |
<tr> |
|---|
| 104 |
<td><a href="#" class="info"><?php echo _("conference name:")?><span><?php echo _("Give this conference a brief name to help you identify it.")?></span></a></td> |
|---|
| 105 |
<td><input type="text" name="name" value="<?php echo (isset($description) ? $description : ''); ?>"></td> |
|---|
| 106 |
</tr> |
|---|
| 107 |
<tr> |
|---|
| 108 |
<td><a href="#" class="info"><?php echo _("user PIN:")?><span><?php echo _("You can require callers to enter a password before they can enter this conference.<br><br>This setting is optional.<br><br>If either PIN is entered, the user will be prompted to enter a PIN.")?></span></a></td> |
|---|
| 109 |
<td><input size="8" type="text" name="userpin" value="<?php echo (isset($userpin) ? $userpin : ''); ?>"></td> |
|---|
| 110 |
</tr> |
|---|
| 111 |
<tr> |
|---|
| 112 |
<td><a href="#" class="info"><?php echo _("admin PIN:")?><span><?php echo _("Enter a PIN number for the admin user.<br><br>This setting is optional unless the 'leader wait' option is in use, then this PIN will identify the leader.")?></span></a></td> |
|---|
| 113 |
<td><input size="8" type="text" name="adminpin" value="<?php echo (isset($adminpin) ? $adminpin : ''); ?>"></td> |
|---|
| 114 |
</tr> |
|---|
| 115 |
|
|---|
| 116 |
<?php |
|---|
| 117 |
$options = (isset($options) ? $options : ""); |
|---|
| 118 |
?> |
|---|
| 119 |
<input type="hidden" name="options" value="<?php echo $options; ?>"> |
|---|
| 120 |
|
|---|
| 121 |
<tr><td colspan="2"><br><h5><?php echo _("Conference Options")?><hr></h5></td></tr> |
|---|
| 122 |
<?php if(function_exists('recordings_list')) { ?> |
|---|
| 123 |
<tr> |
|---|
| 124 |
<td><a href="#" class="info"><?php echo _("join message:")?><span><?php echo _("Message to be played to the caller before joining the conference.<br><br>To add additional recordings please use the \"System Recordings\" MENU to the left")?></span></a></td> |
|---|
| 125 |
<td> |
|---|
| 126 |
<select name="joinmsg"/> |
|---|
| 127 |
<?php |
|---|
| 128 |
$tresults = recordings_list(); |
|---|
| 129 |
$default = (isset($joinmsg) ? $joinmsg : ''); |
|---|
| 130 |
echo '<option value="">'._("None"); |
|---|
| 131 |
if (isset($tresults[0])) { |
|---|
| 132 |
foreach ($tresults as $tresult) { |
|---|
| 133 |
echo '<option value="'.$tresult[2].'"'.($tresult[2] == $default ? ' SELECTED' : '').'>'.$tresult[1]; |
|---|
| 134 |
} |
|---|
| 135 |
} |
|---|
| 136 |
?> |
|---|
| 137 |
</select> |
|---|
| 138 |
</td> |
|---|
| 139 |
</tr> |
|---|
| 140 |
<?php } else { ?> |
|---|
| 141 |
<tr> |
|---|
| 142 |
<td><a href="#" class="info"><?php echo _("join message:")?><span><?php echo _("Message to be played to the caller before joining the conference.<br><br>You must install and enable the \"Systems Recordings\" Module to edit this option")?></span></a></td> |
|---|
| 143 |
<td> |
|---|
| 144 |
<?php |
|---|
| 145 |
$default = (isset($joinmsg) ? $joinmsg : ''); |
|---|
| 146 |
?> |
|---|
| 147 |
<input type="hidden" name="joinmsg" value="<?php echo $default; ?>"><?php echo ($default != '' ? $default : 'None'); ?> |
|---|
| 148 |
</td> |
|---|
| 149 |
</tr> |
|---|
| 150 |
<?php } ?> |
|---|
| 151 |
<tr> |
|---|
| 152 |
<td><a href="#" class="info"><?php echo _("leader wait:")?><span><?php echo _("wait until the conference leader (admin user) arrives before starting the conference")?></span></a></td> |
|---|
| 153 |
<td> |
|---|
| 154 |
<select name="opt#w"> |
|---|
| 155 |
<?php |
|---|
| 156 |
$optselect = strpos($options, "w"); |
|---|
| 157 |
echo '<option value=""' . ($optselect === false ? ' SELECTED' : '') . '>'._("No") . '</option>'; |
|---|
| 158 |
echo '<option value="w"'. ($optselect !== false ? ' SELECTED' : '') . '>'._("Yes"). '</option>'; |
|---|
| 159 |
?> |
|---|
| 160 |
</select> |
|---|
| 161 |
</td> |
|---|
| 162 |
</tr> |
|---|
| 163 |
<tr> |
|---|
| 164 |
<td><a href="#" class="info"><?php echo _("quiet mode:")?><span><?php echo _("quiet mode (do not play enter/leave sounds)")?></span></a></td> |
|---|
| 165 |
<td> |
|---|
| 166 |
<select name="opt#q"> |
|---|
| 167 |
<?php |
|---|
| 168 |
$optselect = strpos($options, "q"); |
|---|
| 169 |
echo '<option value=""' . ($optselect === false ? ' SELECTED' : '') . '>'._("No") . '</option>'; |
|---|
| 170 |
echo '<option value="q"'. ($optselect !== false ? ' SELECTED' : '') . '>'._("Yes"). '</option>'; |
|---|
| 171 |
?> |
|---|
| 172 |
</select> |
|---|
| 173 |
</td> |
|---|
| 174 |
</tr> |
|---|
| 175 |
<tr> |
|---|
| 176 |
<td><a href="#" class="info"><?php echo _("user count:")?><span><?php echo _("announce user(s) count on joining conference")?></span></a></td> |
|---|
| 177 |
<td> |
|---|
| 178 |
<select name="opt#c"> |
|---|
| 179 |
<?php |
|---|
| 180 |
$optselect = strpos($options, "c"); |
|---|
| 181 |
echo '<option value=""' . ($optselect === false ? ' SELECTED' : '') . '>'._("No") . '</option>'; |
|---|
| 182 |
echo '<option value="c"'. ($optselect !== false ? ' SELECTED' : '') . '>'._("Yes"). '</option>'; |
|---|
| 183 |
?> |
|---|
| 184 |
</select> |
|---|
| 185 |
</td> |
|---|
| 186 |
</tr> |
|---|
| 187 |
<tr> |
|---|
| 188 |
<td><a href="#" class="info"><?php echo _("user join/leave:")?><span><?php echo _("announce user join/leave")?></span></a></td> |
|---|
| 189 |
<td> |
|---|
| 190 |
<select name="opt#i"> |
|---|
| 191 |
<?php |
|---|
| 192 |
$optselect = strpos($options, "i"); |
|---|
| 193 |
echo '<option value=""' . ($optselect === false ? ' SELECTED' : '') . '>'._("No") . '</option>'; |
|---|
| 194 |
echo '<option value="i"'. ($optselect !== false ? ' SELECTED' : '') . '>'._("Yes"). '</option>'; |
|---|
| 195 |
?> |
|---|
| 196 |
</select> |
|---|
| 197 |
</td> |
|---|
| 198 |
</tr> |
|---|
| 199 |
<tr> |
|---|
| 200 |
<td><a href="#" class="info"><?php echo _("music on hold:")?><span><?php echo _("enable music on hold when the conference has a single caller")?></span></a></td> |
|---|
| 201 |
<td> |
|---|
| 202 |
<select name="opt#M"> |
|---|
| 203 |
<?php |
|---|
| 204 |
$optselect = strpos($options, "M"); |
|---|
| 205 |
echo '<option value=""' . ($optselect === false ? ' SELECTED' : '') . '>'._("No") . '</option>'; |
|---|
| 206 |
echo '<option value="M"'. ($optselect !== false ? ' SELECTED' : '') . '>'._("Yes"). '</option>'; |
|---|
| 207 |
?> |
|---|
| 208 |
</select> |
|---|
| 209 |
</td> |
|---|
| 210 |
</tr> |
|---|
| 211 |
<tr> |
|---|
| 212 |
<td><a href="#" class="info"><?php echo _("allow menu:")?><span><?php echo _("present menu (user or admin) when '*' is received ('send' to menu)")?></span></a></td> |
|---|
| 213 |
<td> |
|---|
| 214 |
<select name="opt#s"> |
|---|
| 215 |
<?php |
|---|
| 216 |
$optselect = strpos($options, "s"); |
|---|
| 217 |
echo '<option value=""' . ($optselect === false ? ' SELECTED' : '') . '>'._("No") . '</option>'; |
|---|
| 218 |
echo '<option value="s"'. ($optselect !== false ? ' SELECTED' : '') . '>'._("Yes"). '</option>'; |
|---|
| 219 |
?> |
|---|
| 220 |
</select> |
|---|
| 221 |
</td> |
|---|
| 222 |
</tr> |
|---|
| 223 |
|
|---|
| 224 |
|
|---|
| 225 |
<tr> |
|---|
| 226 |
<td colspan="2"><br><h6><input name="Submit" type="submit" value="<?php echo _("Submit Changes")?>"></h6></td> |
|---|
| 227 |
</tr> |
|---|
| 228 |
</table> |
|---|
| 229 |
<script language="javascript"> |
|---|
| 230 |
<!-- |
|---|
| 231 |
|
|---|
| 232 |
var theForm = document.editMM; |
|---|
| 233 |
|
|---|
| 234 |
if (theForm.account.value == "") { |
|---|
| 235 |
theForm.account.focus(); |
|---|
| 236 |
} else { |
|---|
| 237 |
theForm.name.focus(); |
|---|
| 238 |
} |
|---|
| 239 |
|
|---|
| 240 |
function checkConf() |
|---|
| 241 |
{ |
|---|
| 242 |
var msgInvalidConfNumb = "<?php echo _('Please enter a valid Conference Number'); ?>"; |
|---|
| 243 |
var msgInvalidConfName = "<?php echo _('Please enter a valid Conference Name'); ?>"; |
|---|
| 244 |
var msgNeedAdminPIN = "<?php echo _('You must set an admin PIN for the Conference Leader when selecting the leader wait option'); ?>"; |
|---|
| 245 |
|
|---|
| 246 |
defaultEmptyOK = false; |
|---|
| 247 |
if (!isInteger(theForm.account.value)) |
|---|
| 248 |
return warnInvalid(theForm.account, msgInvalidConfNumb); |
|---|
| 249 |
|
|---|
| 250 |
if (!isAlphanumeric(theForm.name.value)) |
|---|
| 251 |
return warnInvalid(theForm.name, msgInvalidConfName); |
|---|
| 252 |
|
|---|
| 253 |
// update $options |
|---|
| 254 |
var theOptionsFld = theForm.options; |
|---|
| 255 |
theOptionsFld.value = ""; |
|---|
| 256 |
for (var i = 0; i < theForm.elements.length; i++) |
|---|
| 257 |
{ |
|---|
| 258 |
var theEle = theForm.elements[i]; |
|---|
| 259 |
var theEleName = theEle.name; |
|---|
| 260 |
if (theEleName.indexOf("#") > 1) |
|---|
| 261 |
{ |
|---|
| 262 |
var arr = theEleName.split("#"); |
|---|
| 263 |
if (arr[0] == "opt") |
|---|
| 264 |
theOptionsFld.value += theEle.value; |
|---|
| 265 |
} |
|---|
| 266 |
} |
|---|
| 267 |
|
|---|
| 268 |
// not possible to have a 'leader' conference with no adminpin |
|---|
| 269 |
if (theForm.options.value.indexOf("w") > -1 && theForm.adminpin.value == "") |
|---|
| 270 |
return warnInvalid(theForm.adminpin, msgNeedAdminPIN); |
|---|
| 271 |
|
|---|
| 272 |
return true; |
|---|
| 273 |
} |
|---|
| 274 |
|
|---|
| 275 |
//--> |
|---|
| 276 |
</script> |
|---|
| 277 |
</form> |
|---|
| 278 |
<?php |
|---|
| 279 |
} |
|---|
| 280 |
?> |
|---|
| 281 |
|
|---|