root/modules/branches/2.4/conferences/page.conferences.php

Revision 7252, 11.7 kB (checked in by p_lindheimer, 4 years ago)

Merged revisions 7248 via svnmerge from
http://svn.freepbx.org/modules/branches/2.5

........

r7248 | p_lindheimer | 2008-11-12 07:05:29 -0800 (Wed, 12 Nov 2008) | 1 line


fixes #3392 can't edit or delete conference if numbered 0

........

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
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
15 isset($_REQUEST['action'])?$action = $_REQUEST['action']:$action='';
16 //the extension we are currently displaying
17 isset($_REQUEST['extdisplay'])?$extdisplay=$_REQUEST['extdisplay']:$extdisplay='';
18 $dispnum = "conferences"; //used for switch on config.php
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   //if submitting form, update database
26   switch ($action) {
27     case "add":
28
29       $conflict_url = array();
30       $usage_arr = framework_check_extension_usage($account);
31       if (!empty($usage_arr)) {
32         $conflict_url = framework_display_extension_usage_alert($usage_arr);
33       } elseif (conferences_add($_REQUEST['account'],$_REQUEST['name'],$_REQUEST['userpin'],$_REQUEST['adminpin'],$_REQUEST['options'],$_REQUEST['joinmsg']) !== false) {
34         needreload();
35         redirect_standard();
36       }
37     break;
38     case "delete":
39       conferences_del($extdisplay);
40       needreload();
41       redirect_standard();
42     break;
43     case "edit":  //just delete and re-add
44       conferences_del($_REQUEST['account']);
45       conferences_add($_REQUEST['account'],$_REQUEST['name'],$_REQUEST['userpin'],$_REQUEST['adminpin'],$_REQUEST['options'],$_REQUEST['joinmsg']);
46       needreload();
47       redirect_standard('extdisplay');
48     break;
49   }
50 }
51
52 //get meetme rooms
53 //this function needs to be available to other modules (those that use goto destinations)
54 //therefore we put it in globalfunctions.php
55 $meetmes = conferences_list();
56 ?>
57
58 </div>
59
60 <!-- right side menu -->
61 <div class="rnav"><ul>
62     <li><a id="<?php echo ($extdisplay=='' ? 'current':'') ?>" href="config.php?display=<?php echo urlencode($dispnum)?>"><?php echo _("Add Conference")?></a></li>
63 <?php
64 if (isset($meetmes)) {
65   foreach ($meetmes as $meetme) {
66     echo "<li><a id=\"".($extdisplay==$meetme[0] ? 'current':'')."\" href=\"config.php?display=".urlencode($dispnum)."&extdisplay=".urlencode($meetme[0])."\">{$meetme[0]}:{$meetme[1]}</a></li>";
67   }
68 }
69 ?>
70 </ul></div>
71
72
73 <div class="content">
74 <?php
75 if ($action == 'delete') {
76   echo '<br><h3>'._("Conference").' '.$extdisplay.' '._("deleted").'!</h3><br><br><br><br><br><br><br><br>';
77 } else {
78   if ($extdisplay != ""){
79     //get details for this meetme
80     $thisMeetme = conferences_get($extdisplay);
81     //create variables
82     extract($thisMeetme);
83   }
84
85   $delURL = $_SERVER['PHP_SELF'].'?'.$_SERVER['QUERY_STRING'].'&action=delete';
86 ?>
87 <?php   if ($extdisplay != ""){ ?>
88   <h2><?php echo _("Conference:")." ". $extdisplay; ?></h2>
89   <a href="<?php echo $delURL ?>"><?php echo _("Delete Conference")?> <?php echo $extdisplay; ?></a><br />
90 <?php
91           $usage_list = framework_display_destination_usage(conferences_getdest($extdisplay));
92           if (!empty($usage_list)) {
93 ?>
94             <a href="#" class="info"><?php echo $usage_list['text']?>:<span><?php echo $usage_list['tooltip']?></span></a>
95 <?php
96           }
97 ?>
98
99 <?php   } else { ?>
100   <h2><?php echo _("Add Conference"); ?></h2>
101 <?php   }
102         if (!empty($conflict_url)) {
103           echo "<h5>"._("Conflicting Extensions")."</h5>";
104           echo implode('<br .>',$conflict_url);
105         }
106 ?>
107   <form autocomplete="off" name="editMM" action="<?php $_SERVER['PHP_SELF'] ?>" method="post" onsubmit="return checkConf();">
108   <input type="hidden" name="display" value="<?php echo $dispnum?>">
109   <input type="hidden" name="action" value="<?php echo ($extdisplay ? 'edit' : 'add') ?>">
110   <table>
111   <tr><td colspan="2"><h5><?php echo ($extdisplay != "" ? _("Edit Conference") : _("Add Conference")) ?><hr></h5></td></tr>
112   <tr>
113 <?php   if ($extdisplay != ""){ ?>
114     <input type="hidden" name="account" value="<?php echo $extdisplay; ?>">
115 <?php   } else { ?>
116     <td><a href="#" class="info"><?php echo _("Conference Number:")?><span><?php echo _("Use this number to dial into the conference.")?></span></a></td>
117     <td><input type="text" name="account" value=""></td>
118 <?php   } ?>
119   </tr>
120   <tr>
121     <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>
122     <td><input type="text" name="name" value="<?php echo (isset($description) ? $description : ''); ?>"></td>
123   </tr>
124   <tr>
125     <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>
126     <td><input size="8" type="text" name="userpin" value="<?php echo (isset($userpin) ? $userpin : ''); ?>"></td>
127   </tr>
128   <tr>
129     <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>
130     <td><input size="8" type="text" name="adminpin" value="<?php echo (isset($adminpin) ? $adminpin : ''); ?>"></td>
131   </tr>
132
133   <?php
134   $options = (isset($options) ? $options : "");
135   ?>
136   <input type="hidden" name="options" value="<?php echo $options; ?>">
137  
138   <tr><td colspan="2"><br><h5><?php echo _("Conference Options")?><hr></h5></td></tr>
139 <?php if(function_exists('recordings_list')) { //only include if recordings is enabled?>
140   <tr>
141     <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>
142     <td>
143       <select name="joinmsg">
144       <?php
145         $tresults = recordings_list();
146         $default = (isset($joinmsg) ? $joinmsg : '');
147         echo '<option value="">'._("None");
148         if (isset($tresults[0])) {
149           foreach ($tresults as $tresult) {
150             echo '<option value="'.$tresult[2].'"'.($tresult[2] == $default ? ' SELECTED' : '').'>'.$tresult[1];
151           }
152         }
153       ?>   
154       </select>   
155     </td>
156   </tr>
157 <?php } else { ?>
158   <tr>
159     <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>
160     <td>
161       <?php
162         $default = (isset($joinmsg) ? $joinmsg : '');
163       ?>
164       <input type="hidden" name="joinmsg" value="<?php echo $default; ?>"><?php echo ($default != '' ? $default : 'None'); ?>
165     </td>
166   </tr>
167 <?php } ?>
168   <tr>
169     <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>
170     <td>
171       <select name="opt#w">
172       <?php
173         $optselect = strpos($options, "w");
174         echo '<option value=""' . ($optselect === false ? ' SELECTED' : '') . '>'._("No") . '</option>';
175         echo '<option value="w"'. ($optselect !== false ? ' SELECTED' : '') . '>'._("Yes"). '</option>';
176       ?>   
177       </select>   
178     </td>
179   </tr>
180   <tr>
181     <td><a href="#" class="info"><?php echo _("Quiet Mode:")?><span><?php echo _("quiet mode (do not play enter/leave sounds)")?></span></a></td>
182     <td>
183       <select name="opt#q">
184       <?php
185         $optselect = strpos($options, "q");
186         echo '<option value=""' . ($optselect === false ? ' SELECTED' : '') . '>'._("No") . '</option>';
187         echo '<option value="q"'. ($optselect !== false ? ' SELECTED' : '') . '>'._("Yes"). '</option>';
188       ?>   
189       </select>   
190     </td>
191   </tr>
192   <tr>
193     <td><a href="#" class="info"><?php echo _("User Count:")?><span><?php echo _("announce user(s) count on joining conference")?></span></a></td>
194     <td>
195       <select name="opt#c">
196       <?php
197         $optselect = strpos($options, "c");
198         echo '<option value=""' . ($optselect === false ? ' SELECTED' : '') . '>'._("No") . '</option>';
199         echo '<option value="c"'. ($optselect !== false ? ' SELECTED' : '') . '>'._("Yes"). '</option>';
200       ?>   
201       </select>   
202     </td>
203   </tr>
204   <tr>
205     <td><a href="#" class="info"><?php echo _("User join/leave:")?><span><?php echo _("announce user join/leave")?></span></a></td>
206     <td>
207       <select name="opt#i">
208       <?php
209         $optselect = strpos($options, "i");
210         echo '<option value=""' . ($optselect === false ? ' SELECTED' : '') . '>'._("No") . '</option>';
211         echo '<option value="i"'. ($optselect !== false ? ' SELECTED' : '') . '>'._("Yes"). '</option>';
212       ?>   
213       </select>   
214     </td>
215   </tr>
216   <tr>
217     <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>
218     <td>
219       <select name="opt#M">
220       <?php
221         $optselect = strpos($options, "M");
222         echo '<option value=""' . ($optselect === false ? ' SELECTED' : '') . '>'._("No") . '</option>';
223         echo '<option value="M"'. ($optselect !== false ? ' SELECTED' : '') . '>'._("Yes"). '</option>';
224       ?>   
225       </select>   
226     </td>
227   </tr>
228   <tr>
229     <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>
230     <td>
231       <select name="opt#s">
232       <?php
233         $optselect = strpos($options, "s");
234         echo '<option value=""' . ($optselect === false ? ' SELECTED' : '') . '>'._("No") . '</option>';
235         echo '<option value="s"'. ($optselect !== false ? ' SELECTED' : '') . '>'._("Yes"). '</option>';
236       ?>   
237       </select>   
238     </td>
239   </tr>
240
241   <tr>
242     <td><a href="#" class="info"><?php echo _("Record Conference:")?><span><?php echo _("record the conference call")?></span></a></td>
243     <td>
244       <select name="opt#r">
245         <?php
246         $optselect = strpos($options, "r");
247         echo '<option value=""' . ($optselect === false ? ' SELECTED' : '') . '>'._("No") . '</option>';
248         echo '<option value="r"'. ($optselect !== false ? ' SELECTED' : '') . '>'._("Yes"). '</option>';
249         ?>
250       </select>
251     </td>
252   </tr>
253
254   </table>
255 <?php
256   // implementation of module hook
257   // object was initialized in config.php
258   echo $module_hook->hookHtml;
259 ?>
260   <h6><input name="Submit" type="submit" value="<?php echo _("Submit Changes")?>"></h6>
261 <script language="javascript">
262 <!--
263
264 var theForm = document.editMM;
265
266 if (theForm.account.value == "") {
267   theForm.account.focus();
268 } else {
269   theForm.name.focus();
270 }
271
272 function checkConf()
273 {
274   var msgInvalidConfNumb = "<?php echo _('Please enter a valid Conference Number'); ?>";
275   var msgInvalidConfName = "<?php echo _('Please enter a valid Conference Name'); ?>";
276   var msgNeedAdminPIN = "<?php echo _('You must set an admin PIN for the Conference Leader when selecting the leader wait option'); ?>";
277  
278   defaultEmptyOK = false;
279   if (!isInteger(theForm.account.value))
280     return warnInvalid(theForm.account, msgInvalidConfNumb);
281     
282   if (!isAlphanumeric(theForm.name.value))
283     return warnInvalid(theForm.name, msgInvalidConfName);
284     
285   // update $options
286   var theOptionsFld = theForm.options;
287   theOptionsFld.value = "";
288   for (var i = 0; i < theForm.elements.length; i++)
289   {
290     var theEle = theForm.elements[i];
291     var theEleName = theEle.name;
292     if (theEleName.indexOf("#") > 1)
293     {
294       var arr = theEleName.split("#");
295       if (arr[0] == "opt")
296         theOptionsFld.value += theEle.value;
297     }
298   }
299
300   // not possible to have a 'leader' conference with no adminpin
301   if (theForm.options.value.indexOf("w") > -1 && theForm.adminpin.value == "")
302     return warnInvalid(theForm.adminpin, msgNeedAdminPIN);
303     
304   return true;
305 }
306
307 //-->
308 </script>
309   </form>
310 <?php  
311 } //end if action == delGRP
312 ?>
Note: See TracBrowser for help on using the browser.