<?php $hooks = \FreePBX::Paging()->hookForm(); extract($request); if ($extdisplay) { $thisGRP = paging_get_pagingconfig($extdisplay); $devices = paging_get_devs($extdisplay); extract($thisGRP); $pagenbr = $extdisplay; $pagegrp = $extdisplay; $delURL = '?display=paging&action=delete&extdisplay=' . urlencode($extdisplay); } else { $force_page = "0"; $devices = array(); $ext = ''; $pagenbr = ''; $pagegrp = ''; $delURL = ''; $duplex = '0'; $description = ''; } $default_group = \FreePBX::Paging()->getDefaultGroup(); $device_list = array(); $cdl = core_devices_list(); $cdl = is_array($cdl) ? $cdl : array(); $devs = core_devices_list(); $devs = is_array($devs) ? $devs : array(); foreach ($devs as $d) { $device_list[$d[0]] = $d[0] . ' - ' . $d[1]; } $devhtml = '';
function paging_show($xtn, $display, $type, $conflict_url = array()) { global $module_hook; if ($xtn) { $selected = paging_get_devs($xtn); $rows = count($selected) + 1; if ($rows < 5) { $rows = 5; } if ($rows > 20) { $rows = 20; } $delURL = $_SERVER['PHP_SELF'] . "?type={$type}&display={$display}&action=delete&selection={$xtn}"; $tlabel = sprintf(_("Delete Group %s"), $xtn); $label = '<span><img width="16" height="16" border="0" title="' . $tlabel . '" alt="" src="images/core_delete.png"/> ' . $tlabel . '</span>'; echo "<a href=" . $delURL . ">" . $label . "</a>"; } else { $rows = 5; } if (!empty($conflict_url)) { echo "<h5>" . _("Conflicting Extensions") . "</h5>"; echo implode('<br />', $conflict_url); } $config = paging_get_pagingconfig($xtn); $force_page = $config['force_page']; $duplex = $config['duplex']; $default_group = $config['default_group']; $description = $config['description']; echo "<form name='page_edit' action='" . $_SERVER['PHP_SELF'] . "' method='post' onsubmit='return page_edit_onsubmit();'>\n"; echo "<input type='hidden' name='display' value='{$display}'>\n"; echo "<input type='hidden' name='type' value='{$type}'>\n"; echo "<input type='hidden' name='pagegrp' value='{$xtn}'>\n"; echo "<input type='hidden' name='action' value='submit'>\n"; echo "<table><tr><td colspan=2><h5>"; echo $xtn ? _("Modify Paging Group") : _("Add Paging Group") . "</h5></td></tr>\n"; ?> <tr> <td><a href='#' class='info'><?php echo _("Paging Extension"); ?> <span><?php echo _("The number users will dial to page this group"); ?> </span></a></td> <td><input size='5' type='text' name='pagenbr' value='<?php echo $xtn; ?> ' tabindex="<?php echo ++$tabindex; ?> "></td> </tr> <tr> <td> <a href="#" class="info"><?php echo _("Group Description"); ?> :<span><?php echo _("Provide a descriptive title for this Page Group."); ?> </span></a></td> <td><input size="24" maxlength="24" type="text" name="description" id="description" value="<?php echo htmlspecialchars($description); ?> " tabindex="<?php echo ++$tabindex; ?> "></td> </tr> <tr><td valign='top'><a href='#' class='info'><?php echo _("Device List:") . "<span><br>" . _("Select Device(s) to page. This is the phone that should be paged. In most installations, this is the same as the Extension. If you are configured to use \"Users & Devices\" this is the actual Device and not the User. Use Ctrl key to select multiple.."); ?> <br><br></span></a></td> <td valign="top"> <select multiple="multiple" name="pagelist[]" id="xtnlist" tabindex="<?php echo ++$tabindex; ?> "> <?php if (!isset($selected)) { $selected = paging_get_devs($xtn); } if (is_null($selected)) { $selected = array(); } foreach (core_devices_list() as $device) { echo '<option value="' . $device[0] . '" '; if (array_search($device[0], $selected) !== false) { echo ' selected="selected" '; } echo '>' . $device[0] . ' - ' . $device[1] . '</option>'; } ?> </select> <br> </td></tr> <tr><td><label for="force_page"><a href='#' class='info'><?php echo _("Force if busy"); ?> <span> <?php echo _("If selected, will not check if the device is in use before paging it. This means conversations can be interrupted by a page (depending on how the device handles it). This is useful for \"emergency\" paging groups "); ?> </span></a></label></td> <td><input type='checkbox' name='force_page' id="force_page" value='1' <?php if ($force_page) { echo 'CHECKED'; } ?> tabindex="<?php echo ++$tabindex; ?> "></td></tr> <tr><td><label for="duplex"><a href='#' class='info'><?php echo _("Duplex"); ?> <span> <?php echo _("Paging is typically one way for announcements only. Checking this will make the paging duplex, allowing all phones in the paging group to be able to talk and be heard by all. This makes it like an \"instant conference\""); ?> </span></a></label></td> <td><input type='checkbox' name='duplex' id="duplex" value='1' <?php if ($duplex) { echo 'CHECKED'; } ?> tabindex="<?php echo ++$tabindex; ?> "></td></tr> <tr><td><label for="default_group"><a href='#' class='info'><?php echo _("Default Page Group"); ?> <span> <?php echo _("Each PBX system can have a single Default Page Group. If specified, extensions can be automatically added (or removed) from this group in the Extensions (or Devices) tab.<br />Making this group the default will uncheck the option from the current default group if specified."); ?> </span></a></label></td> <td><input type='checkbox' name='default_group' id="default_group" value='1' <?php if ($default_group) { echo 'CHECKED'; } ?> tabindex="<?php echo ++$tabindex; ?> "></td></tr> <?php // implementation of module hook // object was initialized in config.php echo $module_hook->hookHtml; ?> <tr> <td colspan="2"><br><h6><input type="submit" name="Submit" type="button" value="<?php echo _("Submit Changes"); ?> " tabindex="<?php echo ++$tabindex; ?> "></h6></td> </tr> </table> <script language="javascript"> <!-- var theForm = document.page_edit; theForm.pagenbr.focus(); function page_edit_onsubmit() { var msgInvalidPageExt = "<?php echo _('Please enter a valid Paging Extension'); ?> "; var msgInvalidExtList = "<?php echo _('Please select at least one extension'); ?> "; defaultEmptyOK = false; if (!isInteger(theForm.pagenbr.value)) return warnInvalid(theForm.pagenbr, msgInvalidPageExt); var selected = 0; for (var i=0; i < theForm.xtnlist.options.length; i++) { if (theForm.xtnlist.options[i].selected) selected += 1; } if (selected < 1) { theForm.xtnlist.focus(); alert(msgInvalidExtList); return false; } return true; } --> </script> </form> <?php }