function ivr_show_edit($id, $nbroptions, $post) { global $db; global $tabindex; $ivr_details = ivr_get_details($id); $ivr_dests = ivr_get_dests($id); ?> <div class="content"> <h2><?php echo _("Digital Receptionist"); ?> </h2> <h3><?php echo _("Edit Menu") . " " . $ivr_details['displayname']; ?> </h3> <?php ?> <form name="prompt" action="<?php $_SERVER['PHP_SELF']; ?> " method="post" onsubmit="return prompt_onsubmit();"> <input type="hidden" name="action" value="edited" /> <input type="hidden" name="display" value="ivr" /> <input type="hidden" name="id" value="<?php echo $id; ?> " /> <input name="Submit" type="submit" value="<?php echo _("Save"); ?> " tabindex="<?php echo ++$tabindex; ?> " disabled> <?php $usage_list = array(); if (function_exists('queues_ivr_usage')) { $usage_list = queues_ivr_usage($id); } if (count($usage_list)) { ?> <a href="#" class="info"><?php echo _("Queue Breakout Menu Usage List"); ?> <span><?php echo _("This IVR is being used by the following Queues, providing an ability for callers to hear this Queue's announcement periodically and giving callers an option to break out of the queue into this IVR's menu options. This queue can not be deleted when being used in this mode"); ?> </span></a> <?php $count = 0; foreach ($usage_list as $link) { $label = '<span><img width="16" height="16" border="0" title="' . $link['description'] . '" alt="" src="images/queue_link.png"/> ' . $link['description'] . '</span>'; echo "<br /><a href=" . $link['url_query'] . ">" . $label . "</a>"; } echo "<br />"; } else { ?> <input name="delete" type="submit" value="<?php echo _("Delete") . " " . _("Digital Receptionist") . " {$ivr_details['displayname']}"; ?> " disabled/> <?php } if ($id) { $usage_list = framework_display_destination_usage(ivr_getdest($id)); if (!empty($usage_list)) { ?> <br /><a href="#" class="info"><?php echo $usage_list['text']; ?> :<span><?php echo $usage_list['tooltip']; ?> </span></a> <?php } } ?> <table> <tr><td colspan=2><hr /></td></tr> <tr> <td><a href="#" class="info"><?php echo _("Change Name"); ?> <span><?php echo _("This changes the short name, visible on the right, of this IVR"); ?> </span></a></td> <td><input type="text" name="displayname" value="<?php echo $ivr_details['displayname']; ?> " tabindex="<?php echo ++$tabindex; ?> "></td> </tr> <?php $annmsg_id = isset($ivr_details['announcement_id']) ? $ivr_details['announcement_id'] : ''; if (function_exists('recordings_list')) { //only include if recordings is enabled ?> <tr> <td><a href="#" class="info"><?php echo _("Announcement"); ?> <span><?php echo _("Message to be played to the caller. To add additional recordings please use the \"System Recordings\" MENU to the left"); ?> </span></a></td> <td> <select name="annmsg_id" tabindex="<?php echo ++$tabindex; ?> "> <?php $tresults = recordings_list(); echo '<option value="">' . _("None") . "</option>"; if (isset($tresults[0])) { foreach ($tresults as $tresult) { echo '<option value="' . $tresult['id'] . '"' . ($tresult['id'] == $annmsg_id ? ' SELECTED' : '') . '>' . $tresult['displayname'] . "</option>\n"; } } ?> </select> </td> </tr> <?php } else { ?> <tr> <td><a href="#" class="info"><?php echo _("Announcement"); ?> <span><?php echo _("Message to be played to the caller.<br><br>You must install and enable the \"Systems Recordings\" Module to edit this option"); ?> </span></a></td> <td> <?php $default = isset($annmsg_id) ? $annmsg_id : ''; ?> <input type="hidden" name="annmsg_id" value="<?php echo $default; ?> "><?php echo $default != '' ? $default : 'None'; ?> </td> </tr> <?php } ?> <tr> <td><a href="#" class="info"><?php echo _("Timeout"); ?> <span><?php echo _("The amount of time (in seconds) before the 't' option, if specified, is used"); ?> </span></a></td> <td><input type="text" name="timeout" value="<?php echo $ivr_details['timeout']; ?> " tabindex="<?php echo ++$tabindex; ?> "></td> </tr> <?php if ($ivr_details['enable_directory'] && function_exists('voicemail_getVoicemail')) { ?> <tr> <td><a href="#" class="info"><?php echo _("Enable Directory"); ?> <span><?php echo _("Let callers into the IVR dial '#' to access the directory. WARNING: this feature is deprecated and will be removed from future versions. You should install the Directory module and assign an IVR destination to use Directory functionality."); ?> </span></a></td> <td><input type="checkbox" name="ena_directory" <?php echo $ivr_details['enable_directory']; ?> tabindex="<?php echo ++$tabindex; ?> "></td> </tr> <tr> <td><a href="#" class="info"><?php echo _("Directory Context"); ?> <span><?php echo _("When # is selected, this is the voicemail directory context that is used"); ?> </span></a></td> <td> <select name="dircontext" tabindex="<?php echo ++$tabindex; ?> "> <?php $vm_results = voicemail_getVoicemail(); $vmcontexts = array_keys($vm_results); foreach ($vmcontexts as $vmc) { if ($vmc != 'general' && $vmc != 'zonemessages') { echo '<option value="' . $vmc . '"' . ($vmc == $ivr_details['dircontext'] ? ' SELECTED' : '') . '>' . $vmc . "</option>\n"; } } ?> </select> </td> </tr> <?php } ?> <tr> <td><a href="#" class="info"><?php echo _("VM Return to IVR"); ?> <span><?php echo _("If checked, upon exiting voicemail a caller will be returned to this IVR if they got a users voicemail"); ?> </span></a></td> <td><input type="checkbox" name="retvm" <?php echo $ivr_details['retvm']; ?> tabindex="<?php echo ++$tabindex; ?> "></td> </tr> <?php if (!function_exists('directory_list')) { ?> <tr> <td><a href="#" class="info"><?php echo _("Enable Direct Dial"); ?> <span><?php echo _("Let callers into the IVR dial an extension directly"); ?> </span></a></td> <td><input type="checkbox" name="ena_directdial" <?php echo $ivr_details['enable_directdial']; ?> tabindex="<?php echo ++$tabindex; ?> "></td> </tr> <?php } else { ?> <tr> <td><a href="#" class="info"><?php echo _("Direct Dial Options"); ?> <span><?php echo _("Provides options for callers to direct dial an extension. Direct dialing can be completely disabled, it can be enabled for all extensions on a system, or it can be tied to a Company Directory allowing any member listed in that directory to be dialed directly if their extension is known. If an extension in the chosen directory is overridden, only that overridden number is dialable"); ?> </span></a></td> <td> <select name="ena_directdial" tabindex="<?php echo ++$tabindex; ?> "> <?php $dlist = directory_list(); echo '<option value=""' . ($ivr_details['enable_directdial'] == '' ? ' SELECTED' : '') . '>' . _('Disabled') . "</option>\n"; echo '<option value="CHECKED"' . (strtoupper($ivr_details['enable_directdial']) == 'CHECKED' ? ' SELECTED' : '') . '>' . _('All Extensions') . "</option>\n"; foreach ($dlist as $dir) { echo '<option value="' . $dir['id'] . '"' . ($ivr_details['enable_directdial'] == $dir['id'] ? ' SELECTED' : '') . '>' . $dir['dirname'] . "</option>\n"; } ?> </select> </td> </tr> <?php } ?> <tr> <td><a href="#" class="info"><?php echo _("Loop Before t-dest"); ?> <span><?php echo _("If checked, and there is a 't' (timeout) destination defined below, the IVR will loop back to the beginning if no input is provided for the designated loop counts prior to going to the timeout (t) destination."); ?> </span></a></td> <td><input type="checkbox" name="alt_timeout" <?php echo $ivr_details['alt_timeout']; ?> tabindex="<?php echo ++$tabindex; ?> "></td> </tr> <?php $timeout_id = isset($ivr_details['timeout_id']) ? $ivr_details['timeout_id'] : ''; if (function_exists('recordings_list')) { //only include if recordings is enabled ?> <tr> <td><a href="#" class="info"><?php echo _("Timeout Message"); ?> <span><?php echo _("If a timeout occurs and a message is selected, it will be played in place of the announcement message when looping back to the top of the IVR. It will not be played if the t destination is the next target."); ?> </span></a></td> <td> <select name="timeout_id" tabindex="<?php echo ++$tabindex; ?> "> <?php //$tresults obtained above echo '<option value="">' . _("None") . "</option>"; if (isset($tresults[0])) { foreach ($tresults as $tresult) { echo '<option value="' . $tresult['id'] . '"' . ($tresult['id'] == $timeout_id ? ' SELECTED' : '') . '>' . $tresult['displayname'] . "</option>\n"; } } ?> </select> </td> </tr> <?php } ?> <tr> <td><a href="#" class="info"><?php echo _("Loop Before i-dest"); ?> <span><?php echo _("If checked, and there is an 'i' (invalid extension) destination defined below, the IVR will play invalid option and then loop back to the beginning for the designated loop counts prior to going to the invalid (i) destination."); ?> </span></a></td> <td><input type="checkbox" name="alt_invalid" <?php echo $ivr_details['alt_invalid']; ?> tabindex="<?php echo ++$tabindex; ?> "></td> </tr> <?php $invalid_id = isset($ivr_details['invalid_id']) ? $ivr_details['invalid_id'] : ''; if (function_exists('recordings_list')) { //only include if recordings is enabled ?> <tr> <td><a href="#" class="info"><?php echo _("Invalid Message"); ?> <span><?php echo _("If an invalid extension is pressed and a message is selected, it will be played in place of the announcement message when looping back to the top of the IVR. It will not be played if the t destination is the next target. If nothing is selected, the system will play a default invalid extension message before going back to the main announcement"); ?> </span></a></td> <td> <select name="invalid_id" tabindex="<?php echo ++$tabindex; ?> "> <?php //$tresults obtained above echo '<option value="">' . _("None") . "</option>"; if (isset($tresults[0])) { foreach ($tresults as $tresult) { echo '<option value="' . $tresult['id'] . '"' . ($tresult['id'] == $invalid_id ? ' SELECTED' : '') . '>' . $tresult['displayname'] . "</option>\n"; } } ?> </select> </td> </tr> <?php } ?> <tr> <td><a href="#" class="info"><?php echo _("Repeat Loops:"); ?> <span><?php echo _("The number of times we should loop when invalid input or no input has been entered before going to the defined or default generated 'i' or 't' options. If the 'i' or 't' options are defined, the above check boxes must be checked in order to loop."); ?> </span></a></td> <td> <select name="loops" tabindex="<?php echo ++$tabindex; ?> "> <?php $default = isset($ivr_details['loops']) ? $ivr_details['loops'] : 2; for ($i = 0; $i <= 9; $i++) { echo '<option value="' . $i . '" ' . ($i == $default ? 'SELECTED' : '') . '>' . $i . '</option>'; } ?> </select> </td> </tr> <tr><td colspan=2><hr /></td></tr> <tr><td colspan=2> <input name="increase" type="submit" value="<?php echo _("Increase Options"); ?> " disabled> <input name="Submit" type="submit" value="<?php echo _("Save"); ?> " tabindex="<?php echo ++$tabindex; ?> " disabled> <?php if ($nbroptions > 1) { ?> <input name="decrease" type="submit" value="<?php echo _("Decrease Options"); ?> " disabled> <?php } ?> </td> </tr> <tr><td colspan=2><hr /></td></tr></table> <style type="text/css"> #ivr-dests tr:nth-child(odd){ background-color: #FCE7CE; } </style> <table id="ivr-dests"> <?php // Draw the destinations $dests = ivr_get_dests($id); $count = 0; if (!empty($dests)) { foreach ($dests as $dest) { drawdestinations($count, $dest['selection'], $dest['dest'], $dest['ivr_ret']); $count++; } } while ($count < $nbroptions) { drawdestinations($count, null, null, 0); $count++; } ?> </table> <?php if ($nbroptions < $count) { echo "<input type='hidden' name='nbroptions' value={$count} />\n"; } else { echo "<input type='hidden' name='nbroptions' value={$nbroptions} />\n"; } global $module_hook; echo $module_hook->hookHtml; ?> <input name="increase" type="submit" value="<?php echo _("Increase Options"); ?> " disabled> <input name="Submit" type="submit" value="<?php echo _("Save"); ?> " disabled> <?php if ($nbroptions > 1) { ?> <input name="decrease" type="submit" value="<?php echo _("Decrease Options"); ?> " disabled> <?php } ?> <script language="javascript"> <!-- $(document).ready(function() { $(':submit:disabled').removeAttr('disabled'); }); function delEntry(e){ $('[name=option'+e+'],[name=goto'+e+']').val('').parent().parent().fadeOut(500,function(){$(this).remove();}); } var theForm = document.prompt; theForm.displayname.focus(); function prompt_onsubmit() { var msgInvalidOption = "<?php echo _("Invalid option"); ?> "; defaultEmptyOK = true; // go thru the form looking for options // where the option isn't blank (as that will be removed) do the validation var allelems = theForm.elements; if (allelems != null) { var i, elem; for (i = 0; elem = allelems[i]; i++) { if (elem.type == 'text' && elem.name.indexOf('option') == 0) { if (elem.value != '') { if (!isIVROption(elem.value)) return warnInvalid(elem, msgInvalidOption); var gotoNum = elem.name.charAt(6); var isok = validateSingleDestination(theForm,gotoNum,true); if (!isok) return false; } } } } return true; } //--> </script> </form> </div> <?php }
function daynight_show_edit($post, $add = "") { global $db; global $itemid; $fcc = new featurecode('daynight', 'toggle-mode-' . $itemid); $code = $fcc->getCodeActive(); unset($fcc); $dests = daynight_get_obj($itemid); $password = isset($dests['password']) ? $dests['password'] : ''; $fc_description = isset($dests['fc_description']) ? $dests['fc_description'] : ''; $state = isset($dests['state']) ? $dests['state'] : 'DAY'; $day_recording_id = isset($dests['day_recording_id']) ? $dests['day_recording_id'] : ''; $night_recording_id = isset($dests['night_recording_id']) ? $dests['night_recording_id'] : ''; ?> <div class="content"> <h2><?php echo _("Day / Night Mode Control"); ?> </h2> <?php if ($itemid != "") { $delURL = $_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING'] . '&action=delete'; $tlabel = sprintf(_("Delete Day/Night Feature Code %s"), $code); $label = '<span><img width="16" height="16" border="0" title="' . $tlabel . '" alt="" src="images/core_delete.png"/> ' . $tlabel . '</span>'; ?> <a href="<?php echo $delURL; ?> "><?php echo $label; ?> </a><br /> <?php $usage_list = framework_display_destination_usage(daynight_getdest($itemid)); if (!empty($usage_list)) { ?> <a href="#" class="info"><?php echo $usage_list['text'] . '<br />'; ?> <span><?php echo $usage_list['tooltip']; ?> </span></a> <?php } $timeconditions_refs = daynight_list_timecondition($itemid); if (!empty($timeconditions_refs)) { echo "<br />"; foreach ($timeconditions_refs as $ref) { $dmode = $ref['dmode'] == 'timeday' ? _("Forces to Day Mode") : _("Forces to Night Mode"); $timecondition_id = $ref['dest']; $tcURL = $_SERVER['PHP_SELF'] . '?' . "display=timeconditions&itemid={$timecondition_id}"; $label = '<span><img width="16" height="16" border="0" title="' . sprintf(_("Linked to Time Condition %s - %s"), $timecondition_id, $dmode) . '" alt="" src="images/clock_link.png"/> ' . sprintf(_("Linked to Time Condition %s - %s"), $timecondition_id, $dmode) . '</span>'; ?> <a href="<?php echo $tcURL; ?> "><?php echo $label; ?> </a><br /> <?php } } } ?> <form name="prompt" action="<?php $_SERVER['PHP_SELF']; ?> " method="post" onsubmit="return prompt_onsubmit();"> <input type="hidden" name="action" value="edited" /> <input type="hidden" name="display" value="daynight" /> <input name="Submit" type="submit" style="display:none;" value="save" /> <table> <tr> <td colspan=2><hr /> </td> </tr> <tr> <td colspan="2"> <input name="Submit" type="submit" value="<?php echo _("Save"); ?> "> <?php if ($itemid != '') { echo "  " . sprintf(_("Use feature code: %s to toggle DAY/NIGHT mode"), "<strong>" . $code . "</strong>"); } ?> </td> </tr> <tr> <td colspan=2> <hr /> </td> </tr> <tr> <td><a href="#" class="info"><?php echo _("Day/Night Feature Code Index:"); ?> <span><?php echo _("There are a total of 10 Feature code objects, 0-9, each can control a call flow and be toggled using the day/night feature code plus the index."); ?> </span></a> </td> <td> <?php if ($add == "add" && $itemid == "") { ?> <select name="itemid" tabindex="<?php echo ++$tabindex; ?> "> <?php $ids = daynight_get_avail(); foreach ($ids as $id) { echo '<option value="' . $id . '" >' . $id . '</option>'; } ?> </select> <?php } else { ?> <input readonly="yes" size="1" type="text" name="itemid" value="<?php echo $itemid; ?> "> <?php } ?> </td> </tr> <tr> <td><a href="#" class="info"><?php echo _("Description"); ?> :<span><?php echo _("Description for this Day/Night Control"); ?> </span></a></td> <td><input size="40" type="text" name="fc_description" value="<?php echo $fc_description; ?> " tabindex="<?php echo ++$tabindex; ?> "> </td> </tr> <tr> <td><a href="#" class="info"><?php echo _("Current Mode:"); ?> <span><?php echo _("This will change the current state for this Day/Night Mode Control, or set the initial state when creating a new one."); ?> </span></a> </td> <td> <select name="state" tabindex="<?php echo ++$tabindex; ?> "> <option value="DAY" <?php echo $state == 'DAY' ? 'SELECTED' : ''; ?> ><?php echo _("Day"); ?> </option> <option value="NIGHT" <?php echo $state == 'NIGHT' ? 'SELECTED' : ''; ?> ><?php echo _("Night"); ?> </option> </select> </td> </tr> <?php if (function_exists('recordings_list')) { //only include if recordings are enabled ?> <tr> <td><a href="#" class="info"><?php echo _("Recording for Day Mode"); ?> <span><?php echo _("Message to be played.<br>To add additional recordings use the \"System Recordings\" MENU to the left"); ?> </span></a></td> <td> <select name="day_recording_id" tabindex="<?php echo ++$tabindex; ?> "> <?php $tresults = recordings_list(); $default = isset($day_recording_id) ? $day_recording_id : ''; echo '<option value="0">' . _("Default") . "</option>\n"; if (isset($tresults[0])) { foreach ($tresults as $tresult) { echo '<option value="' . $tresult['id'] . '"' . ($tresult['id'] == $default ? ' SELECTED' : '') . '>' . $tresult['displayname'] . "</option>\n"; } } ?> </select> </td> </tr> <tr> <td><a href="#" class="info"><?php echo _("Recording for Night Mode"); ?> <span><?php echo _("Message to be played.<br>To add additional recordings use the \"System Recordings\" MENU to the left"); ?> </span></a></td> <td> <select name="night_recording_id" tabindex="<?php echo ++$tabindex; ?> "> <?php $default = isset($night_recording_id) ? $night_recording_id : ''; echo '<option value="0">' . _("Default") . "</option>\n"; if (isset($tresults[0])) { foreach ($tresults as $tresult) { echo '<option value="' . $tresult['id'] . '"' . ($tresult['id'] == $default ? ' SELECTED' : '') . '>' . $tresult['displayname'] . "</option>\n"; } } ?> </select> </td> </tr> <?php } ?> <tr> <td><a href="#" class="info"><?php echo _("Optional Password"); ?> :<span><?php echo _('You can optionally include a password to authenticate before toggling the day/night mode. If left blank anyone can use the feature code and it will be un-protected'); ?> </span></a></td> <td><input size="12" type="text" name="password" value="<?php echo $password; ?> " tabindex="<?php echo ++$tabindex; ?> "> </td> </tr> <tr> <td colspan=2> <hr /> </td> </tr> <?php // Draw the destinations // returns an array, $dest['day'], $dest['night'] // and puts null if nothing set drawdestinations(0, _("DAY"), isset($dests['day']) ? $dests['day'] : ''); drawdestinations(1, _("NIGHT"), isset($dests['night']) ? $dests['night'] : ''); //TODO: Check to make sure a destination radio button was checked, and if custom, that it was not blank // ?> <tr> <td colspan=2> <input name="Submit" type="submit" value="<?php echo _("Save"); ?> "> <?php if ($itemid != '') { echo "  " . sprintf(_("Use feature code: %s to toggle DAY/NIGHT mode"), "<strong>" . $code . "</strong>"); } ?> </td> </tr> <tr> <td colspan=2> <hr /> </td> </tr> </table> <script language="javascript"> <!-- var theForm = document.prompt; function prompt_onsubmit() { var msgInvalidPassword = "******"; defaultEmptyOK = true; if (!isInteger(theForm.password.value)) return warnInvalid(theForm.password, msgInvalidPassword); return true; } //--> </script> </form> <?php }