Ticket #2511: recordings_patch.txt

File recordings_patch.txt, 4.3 kB (added by prolfe, 1 year ago)
Line 
1 --- /usr/src/asterisk/free-pbx-modules/freepbx-modules-2.3/recordings/functions.inc.php 2007-11-28 08:45:42.000000000 +0900
2 +++ functions.inc.php   2007-11-29 09:20:15.000000000 +0900
3 @@ -85,6 +85,7 @@
4          if(DB::IsError($results)) {
5                  $results = null;
6          }
7 +
8          return $results;
9  }
10
11 @@ -129,6 +130,9 @@
12          $astsnd .= "/sounds/";
13         $recordings = Array();
14
15 +       $add_sys_rec_name = "";
16 +       $upd_flow_num = -1;
17 +
18         // Set the file names from the submitted page, sysrec[N]
19         foreach ($_REQUEST as $key => $val) {
20                 $res = strpos($key, 'sysrec');
21 @@ -137,9 +141,31 @@
22                         str_replace('..','',$val);
23
24                         $recordings[substr($key,6)]=$val;
25 +               } else {
26 +                       if ( $key == "sys_recs" )
27 +                       {
28 +                               str_replace('..','',$val);
29 +                               $add_sys_rec_name = $val;
30 +                       }
31 +
32 +                       if ( $key == "updatenum" )
33 +                       {
34 +                               if ( $val != '' )
35 +                               {
36 +                                       $upd_flow_num = $val;
37 +                               }
38 +                       }
39 +
40                 }
41         }
42
43 +       if ( $upd_flow_num != -1 )
44 +       {
45 +               $recordings[$upd_flow_num] = $add_sys_rec_name;
46 +       } else {
47 +               $recordings[count($recordings)-1] = $add_sys_rec_name;
48 +       }
49 +
50         // Stick the filename in the database
51         recordings_set_file($id, implode('&', $recordings));
52
53 --- /usr/src/asterisk/free-pbx-modules/freepbx-modules-2.3/recordings/page.recordings.php       2007-11-28 08:45:42.000000000 +0900
54 +++ page.recordings.php 2007-11-29 09:12:05.000000000 +0900
55 @@ -255,7 +255,16 @@
56         </tr>
57         </table>
58         <hr />
59 -       Files:<br />
60 +       <table border=0>
61 +       <tr>
62 +       <td align="left" valign="top">
63 +       Files:<br /><br />
64 +       <?php
65 +       recordings_display_sndfiles();
66 +       ?>
67 +       </td>
68 +       <td valign="top">
69 +       Flow: <br />
70         <table>
71         <?php
72         $rec = recordings_get($id);
73 @@ -274,6 +283,9 @@
74         recordings_display_sndfile('', $counter, $arraymax, $recordings_astsnd_path);
75         ?>
76         </table>
77 +       </td>
78 +       </tr>
79 +       </table>
80         <input name="Submit" type="submit" value="<?php echo _("Save")?>"></h6>
81         <?php recordings_popup_jscript(); ?>
82         <?php recordings_form_jscript(); ?>
83 @@ -386,12 +398,8 @@
84         $astsnd = isset($asterisk_conf['astvarlibdir'])?$asterisk_conf['astvarlibdir']:'/var/lib/asterisk';
85         $astsnd .= "/sounds/";
86         $sysrecs = recordings_readdir($astsnd, strlen($astsnd)+1);
87 -       print "<tr><td><select id='sysrec$count' name='sysrec$count'>\n";
88 -       echo '<option value=""'.($item == '' ? ' SELECTED' : '')."></option>\n";
89 -       foreach ($sysrecs as $sr) {
90 -               echo '<option value="'.$sr.'"'.($sr == $item ? ' SELECTED' : '').">$sr</option>\n";
91 -       }
92 -       print "</select></td>\n";
93 +       print "<tr><td>".$count."</td><td><input type='text' size='50' name='sysrec".$count."' value='".$item."'>\n";
94 +       print "</td>\n";
95
96         echo "<td>";
97         $audio=$astpath;
98 @@ -425,4 +433,23 @@
99         print "</tr>\n";
100  }
101
102 +function recordings_display_sndfiles() {
103 +       global $amp_conf;
104 +       // Note that when using this, it needs a <table> definition around it.
105 +       $astsnd = isset($asterisk_conf['astvarlibdir'])?$asterisk_conf['astvarlibdir']:'/var/lib/asterisk';
106 +       $astsnd .= "/sounds/";
107 +       $sysrecs = recordings_readdir($astsnd, strlen($astsnd)+1);
108 +       print "<select id='sys_recs' name='sys_recs'>\n";
109 +       foreach ($sysrecs as $sr) {
110 +               echo '<option value="'.$sr.'"'.($sr == $item ? ' SELECTED' : '').">$sr</option>\n";
111 +       }
112 +       print "</select>\n";
113 +       print "<br />";
114 +       print "Insert/Update #: <input type='text' size='2' name='updatenum' />\n";
115 +       // echo  "<input type='submit' name='Update' onClick=\"javascript:copySndFileName(); return false;\" input='foo'  >";
116 +       // copy_snd_file_name_jscript();
117 +       $audio=$astpath;
118 +
119 +}
120 +
121  ?>
Donate



Support
Download
Develop
Forums
News
Documentation
Paid Support
About

Paid Ads