function recording_editpage($id, $num) { global $fcbase; global $default_pos; global $fcode; global $fcode_pass; global $recordings_astsnd_path; ?> <div class="content"> <h2><?php echo _("System Recordings"); ?> </h2> <h3><?php echo _("Edit Recording"); ?> </h3> <?php $this_recording = recordings_get($id); if (!$this_recording) { echo "<tr><td colspan=2><h2>Error reading Recording ID {$id} - Aborting</h2></td></tr></table>"; return; } ?> <?php $usage_list = recordings_list_usage($id); if (count($usage_list)) { ?> <a href="#" class="info"><?php echo _("Usage List"); ?> <span><?php echo _("This recording is being used in the following instances. You can not remove this recording while being used. To re-record, you can enable and use the feature code below if allowed."); ?> </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/application_link.png"/> ' . $link['description'] . '</span>'; echo "<br /><a href=" . $link['url_query'] . ">" . $label . "</a>"; } } else { $delURL = "config.php?display=recordings&action=delete&usersnum=" . urlencode($num) . "&id={$id}"; $tlabel = _("Remove Recording"); $label = '<span><img width="16" height="16" border="0" title="' . $tlabel . '" alt="" src="images/sound_delete.png"/> ' . $tlabel . '</span>'; echo "<a href=" . $delURL . ">" . $label . "</a>"; echo "<i style='font-size: x-small'> ("; echo _("Note, does not delete file from computer"); echo ")</i>"; } ?> <form name="prompt" action="<?php $_SERVER['PHP_SELF']; ?> " method="post" onsubmit="return rec_onsubmit();"> <input type="hidden" name="action" value="edited"> <input type="hidden" name="display" value="recordings"> <input type="hidden" name="usersnum" value="<?php echo $num; ?> "> <input type="hidden" name="id" value="<?php echo $id; ?> "> <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 recording"); ?> </span></a></td> <td><input type="text" name="rname" value="<?php echo $this_recording['displayname']; ?> " tabindex="<?php echo ++$tabindex; ?> "></td> </tr> <tr> <td><a href="#" class="info"><?php echo _("Descriptive Name"); ?> <span><?php echo _("This is displayed, as a hint, when selecting this recording in Queues, Digital Receptionist, etc"); ?> </span></a></td> <td> <textarea name="notes" rows="3" cols="40" tabindex="<?php echo ++$tabindex; ?> "><?php echo $this_recording['description']; ?> </textarea></td> </tr> <?php // This was being called twice: $rec = recordings_get($id); $rec = $this_recording; $fn = $rec['filename']; $files = explode('&', $fn); $counter = 0; $arraymax = count($files) - 1; $sndfile_html = ""; $jq_autofill = ""; foreach ($files as $item) { $sndfile_html .= recordings_display_sndfile($item, $counter, $arraymax, $recordings_astsnd_path, $rec['fcode']); $counter++; // create the jquery autofill statements in advance of the next iteration or the blank one at the end // on mouseover to the <td> element (since select doesn't have mouseover event), we clone the populated // select options and put them into this one which is created just with the selected tag. Then set the // selected value based on what is in the hidden tag. (we skip the hidden tag but for now ...) // $jq_autofill .= ' $("#sysrec' . $counter . '").parent().one("mouseover", function(){ $selectload = $("#selectload' . $counter . '").show(80,function(){ $("#sysrec' . $counter . '").empty().append($optlist.clone()).val($("#sysrecval' . $counter . '").val()); $(this).hide(); }); }); '; } $sndfile_html .= recordings_display_sndfile('', $counter, $arraymax, $recordings_astsnd_path, $rec['fcode']); if ($arraymax == 0 && isset($files[0]) && substr($files[0], 0, 7) == 'custom/') { if ($rec['fcode']) { $fcc = new featurecode("recordings", 'edit-recording-' . $id); $rec_code = $fcc->getCode(); unset($fcc); if ($rec_code == '') { $rec_code = $fcbase . $id; } } else { $rec_code = $fcbase . $id; } ?> <tr> <td><a class="info" href="#"><?php echo _("Link to Feature Code"); ?> <span><?php echo _("Check this box to create an options feature code that will allow this recording to be changed directly."); ?> </span></a>: </td> <td> <input type='checkbox' tabindex="<?php echo ++$tabindex; ?> "name='fcode' id="fcode" <?php if ($rec['fcode'] == "1") { echo 'CHECKED'; } ?> OnClick="resetDefaultSound();"; return true;'><?php echo sprintf(_("Optional Feature Code %s"), $rec_code); ?> </td> </tr> <tr> <td><a href="#" class="info"><?php echo _("Feature Code Password"); ?> <span><?php echo _("Optional password to protect access to this feature code which allows a user to re-record it."); ?> </span></a></td> <td><input type="text" name="fcode_pass" id="fcode_pass" value="<?php echo $rec['fcode_pass']; ?> " tabindex="<?php echo ++$tabindex; ?> "></td> </tr> <?php } else { ?> <tr> <td colspan="2"><a class="info" href="#"><?php echo _("Direct Access Feature Code Not Available"); ?> <span><?php echo _("Direct Access Feature Codes for recordings are not available for built in system recordings or compound recordings made of multiple individual ones."); ?> </span></a>: </td> </tr> <?php } ?> <tr><td colspan="2"><hr /></td></tr> </table> <?php echo _("Files"); ?> :<br /> <table> <?php // globals seem to busted in PHP5 define here for now $recordings_astsnd_path = isset($asterisk_conf['astvarlibdir']) ? $asterisk_conf['astvarlibdir'] : '/var/lib/asterisk'; $recordings_astsnd_path .= "/sounds/"; // recordings_display_sndfile functions need to be run above so we have $default_pos set // echo $sndfile_html; ?> </table> <input name="Submit" type="submit" value="<?php echo _("Save"); ?> " tabindex="<?php echo ++$tabindex; ?> "></h6> <?php recordings_popup_jscript(); ?> <?php recordings_form_jscript(); ?> <script language="javascript"> <!-- Begin var sysrec0_idx; function initPage() { sysrec0_idx = document.getElementById("sysrec0").selectedIndex; alert('Got here with sysrec0_idx as:'.sysrec0_idx); } function resetDefaultSound() { if (document.getElementById('fcode').checked) { document.getElementById('sysrec0').selectedIndex=<?php echo $default_pos; ?> ; document.getElementById('sysrec1').selectedIndex=0; document.getElementById('sysrec0').disabled=true; document.getElementById('sysrec1').disabled=true; document.getElementById('play1').style.visibility='hidden'; document.getElementById('down0').style.visibility='hidden'; document.getElementById('up1').style.visibility='hidden'; document.getElementById('del0').style.visibility='hidden'; document.getElementById('del1').style.visibility='hidden'; } else { document.getElementById('sysrec0').disabled=false; document.getElementById('sysrec1').disabled=false; document.getElementById('play1').style.visibility='visible'; document.getElementById('down0').style.visibility='visible'; document.getElementById('up1').style.visibility='visible'; document.getElementById('del0').style.visibility='visible'; document.getElementById('del1').style.visibility='visible'; } } $(document).ready(function(){ var $reclist = $("#sysrec0"); var $optlist = $("#sysrec0 option"); //$(".slclass").css({ visibility: "visible" }).hide(); $(".slclass").css("visibility", "visible").hide(); $(".autofill").width($reclist.width()); <?php echo $jq_autofill; ?> }); // End --> </script> </form> </div> <?php }
function recordings_get_file($id) { $res = recordings_get($id); return $res['filename']; }
public function doConfigPageInit($page) { $conf = \FreePBX::Config(); $ramp_conf = $conf->get_conf_settings(); foreach ($ramp_conf as $key => $value) { $amp_conf[$key] = $value['value']; } $request = $_REQUEST; $action = isset($request['action']) ? $request['action'] : null; $extdisplay = isset($request['extdisplay']) ? $request['extdisplay'] : null; if ($page == "extensions" || $page == "users") { // Catch the POST. if (isset($request['extdisplay']) && isset($request['intercom_override'])) { if (preg_match('/override=(.+)/', $request['intercom_override'], $match)) { $this->setOverride($request['extdisplay'], $match[1]); } } } if ($page == "paging") { $get_vars = array('action' => '', 'announce' => '', 'conflict_url' => '', 'default_group' => 0, 'description' => '', 'display' => 'paging', 'duplex' => 0, 'extdisplay' => '', 'force_page' => 0, 'pagegrp' => '', 'pagelist' => '', 'pagenbr' => '', 'Submit' => '', 'announcement' => '', 'type' => 'tool'); foreach ($get_vars as $k => $v) { $vars[$k] = isset($request[$k]) ? $request[$k] : $v; } $vars['pagenbr'] = trim($vars['pagenbr']); if ($vars['Submit'] == _('Delete')) { $vars['action'] = 'delete'; $request['action'] = 'delete'; } $vars['announce'] = $vars['announcement']; //action actions switch ($vars['action']) { case 'delete': paging_del($vars['extdisplay']); break; case 'submit': //TODO: issue, we are deleting and adding at the same time so remeber later to check // if we are deleting a destination $usage_arr = array(); if ($vars['pagegrp'] != $vars['pagenbr']) { $usage_arr = framework_check_extension_usage($vars['pagenbr']); } if ($usage_arr) { $vars['conflict_url'] = framework_display_extension_usage_alert($usage_arr); break; } else { //limit saved devices to PAGINGMAXPARTICIPANTS if (isset($amp_conf['PAGINGMAXPARTICIPANTS']) && $amp_conf['PAGINGMAXPARTICIPANTS']) { if (!empty($vars['pagelist'])) { $vars['pagelist'] = array_slice($vars['pagelist'], 0, $amp_conf['PAGINGMAXPARTICIPANTS']); } } paging_modify($vars['pagegrp'], $vars['pagenbr'], $vars['pagelist'], $vars['force_page'], $vars['duplex'], $vars['description'], $vars['default_group'], $vars['announcement']); $request['action'] = $vars['action'] = 'modify'; if ($vars['extdisplay'] == '' || $vars['pagegrp'] != $vars['pagenbr']) { $request['extdisplay'] = $vars['extdisplay'] = $vars['pagenbr']; } $_REQUEST['extdisplay'] = $vars['extdisplay']; } break; case 'save_settings': $def = paging_get_autoanswer_defaults(true); $doptions = 'b(autoanswer^s^1(${ALERTINFO},${CALLINFO}))'; if (ctype_digit($vars['announce'])) { $r = recordings_get($vars['announce']); if ($r) { $vars['announce'] = $r['filename']; } else { $vars['announce'] = 'beep'; } $a = 'A(' . $vars['announce'] . ')' . $doptions; } elseif ($vars['announce'] == 'none') { $a = "A(){$doptions}"; } elseif ($vars['announce'] == 'beep') { $a = "A(beep){$doptions}"; } $this->setDropSilence($state, !empty($vars['drop_silence'])); paging_set_autoanswer_defaults(array('DOPTIONS' => $a)); needreload(); break; case 'getJSON': header('Content-Type: application/json'); switch ($request['jdata']) { case 'grid': $pagelist = paging_list(); $rdata = array(); foreach ($pagelist as $pg) { $rdata[] = array('description' => $pg['description'], 'page_group' => $pg['page_group'], 'is_default' => $pg['is_default'], 'link' => array($pg['description'], $pg['page_group'])); } echo json_encode($rdata); exit; break; default: echo json_encode(array('error' => _("Unknown Request"))); exit; break; } break; default: break; } } }