Changeset 8173
- Timestamp:
- 08/25/09 23:11:15 (4 years ago)
- Files:
-
- modules/branches/2.6/daynight/functions.inc.php (modified) (8 diffs)
- modules/branches/2.6/daynight/module.xml (modified) (2 diffs)
- modules/branches/2.6/daynight/page.daynight.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
modules/branches/2.6/daynight/functions.inc.php
r7623 r8173 192 192 $passwords = daynight_passwords(); 193 193 $got_code = false; 194 195 $day_recording = daynight_recording('day'); 196 $night_recording = daynight_recording('night'); 194 197 195 198 $id = "app-daynight-toggle"; // The context to be included … … 212 215 } 213 216 $ext->add($id, $c, '', new ext_setvar('INDEX', $index)); 217 $day_file = "beep&silence/1&day&reception&digits/${index}&activated"; 218 $night_file = "beep&silence/1&day&reception&digits/${index}&de-activated"; 219 if (function_exists('recordings_get_file')) { 220 if ($day_recording[$index] != 0 ) { $day_file = recordings_get_file ($day_recording[$index]); } 221 if ($night_recording[$index] != 0 ) { $night_file = recordings_get_file ($night_recording[$index]); } 222 } 223 $ext->add($id, $c, '', new ext_setvar('DAYREC', $day_file)); 224 $ext->add($id, $c, '', new ext_setvar('NIGHTREC', $night_file)); 214 225 $ext->add($id, $c, '', new ext_goto($id.',s,1')); 215 226 } … … 229 240 $ext->add($id, $c, 'hook_day', new ext_playback('beep')); // $cmd,n,Playback(...) 230 241 } else { 231 $ext->add($id, $c, 'hook_day', new ext_playback('beep&silence/1&day&reception&digits/${INDEX}&enabled'));242 $ext->add($id, $c, 'hook_day', new ext_playback('${DAYREC}')); 232 243 } 233 244 $ext->add($id, $c, '', new ext_hangup('')); … … 240 251 $ext->add($id, $c, 'hook_night', new ext_playback('beep')); // $cmd,n,Playback(...) 241 252 } else { 242 $ext->add($id, $c, 'hook_night', new ext_playback('beep&silence/1&beep&silence/1&day&reception&digits/${INDEX}&disabled'));253 $ext->add($id, $c, 'hook_night', new ext_playback('${NIGHTREC}')); 243 254 } 244 255 $ext->add($id, $c, '', new ext_hangup('')); … … 293 304 } 294 305 306 //get the existing daynight recordings 307 //$mode is either 'day' or 'night' 308 function daynight_recording($mode) { 309 $results = sql("SELECT ext, dest FROM daynight WHERE dmode = '".$mode."_recording_id'","getAll",DB_FETCHMODE_ASSOC); 310 if(is_array($results)){ 311 foreach($results as $result){ 312 $list[$result['ext']] = $result['dest']; 313 } 314 } 315 if (isset($list)) { 316 return $list; 317 } else { 318 return array(); 319 } 320 } 321 295 322 function daynight_edit($post, $id=0) { 296 323 global $db; … … 300 327 301 328 // Delete all the old dests 302 sql("DELETE FROM daynight WHERE dmode IN ('day', 'night', 'password', 'fc_description' ) AND ext = '$id'");329 sql("DELETE FROM daynight WHERE dmode IN ('day', 'night', 'password', 'fc_description','day_recording_id','night_recording_id') AND ext = '$id'"); 303 330 304 331 $day = isset($post[$post['goto0'].'0'])?$post[$post['goto0'].'0']:''; … … 314 341 $fc_description = isset($post['fc_description']) ? trim($post['fc_description']) : ""; 315 342 sql("INSERT INTO daynight (ext, dmode, dest) VALUES ('$id', 'fc_description', '".$db->escapeSimple($fc_description)."')"); 343 344 $day_recording_id = isset($post['day_recording_id']) ? trim($post['day_recording_id']) : ""; 345 sql("INSERT INTO daynight (ext, dmode, dest) VALUES ('$id', 'day_recording_id', '$day_recording_id')"); 346 $night_recording_id = isset($post['night_recording_id']) ? trim($post['night_recording_id']) : ""; 347 sql("INSERT INTO daynight (ext, dmode, dest) VALUES ('$id', 'night_recording_id', '$night_recording_id')"); 316 348 317 349 $dn = new dayNightObject($id); … … 350 382 global $db; 351 383 352 $sql = "SELECT dmode, dest FROM daynight WHERE dmode IN ('day', 'night', 'password', 'fc_description' ) AND ext = '$id' ORDER BY dmode";384 $sql = "SELECT dmode, dest FROM daynight WHERE dmode IN ('day', 'night', 'password', 'fc_description','day_recording_id','night_recording_id') AND ext = '$id' ORDER BY dmode"; 353 385 $res = $db->getAll($sql, DB_FETCHMODE_ASSOC); 354 386 if(DB::IsError($res)) { modules/branches/2.6/daynight/module.xml
r7928 r8173 2 2 <rawname>daynight</rawname> 3 3 <name>Day Night Mode</name> 4 <version>2.6.0. 1</version>4 <version>2.6.0.2</version> 5 5 <publisher>FreePBX</publisher> 6 6 <license>GPLv2+</license> … … 12 12 </description> 13 13 <changelog> 14 *2.6.0.2* #3585 custom recordings 14 15 *2.6.0.1* init tabindex 15 16 *2.6.0.0* #3650, #3651 modules/branches/2.6/daynight/page.daynight.php
r7792 r8173 19 19 $password = isset($_REQUEST['password'])?$_REQUEST['password']:''; 20 20 $fc_description = isset($_REQUEST['fc_description'])?$_REQUEST['fc_description']:''; 21 $day_recording_id = isset($_POST['day_recording_id']) ? $_POST['day_recording_id'] : ''; 22 $night_recording_id = isset($_POST['night_recording_id']) ? $_POST['night_recording_id'] : ''; 21 23 22 24 isset($_REQUEST['itemid'])?$itemid=mysql_real_escape_string($_REQUEST['itemid']):$itemid=''; … … 78 80 $fc_description = isset($dests['fc_description'])?$dests['fc_description']:''; 79 81 $state = isset($dests['state'])?$dests['state']:'DAY'; 82 $day_recording_id = isset($dests['day_recording_id'])?$dests['day_recording_id']:''; 83 $night_recording_id = isset($dests['night_recording_id'])?$dests['night_recording_id']:''; 80 84 ?> 81 85 <div class="content"> … … 173 177 </td> 174 178 </tr> 179 180 <?php if(function_exists('recordings_list')) { //only include if recordings are enabled ?> 181 <tr> 182 <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> 183 <td> 184 <select name="day_recording_id" tabindex="<?php echo ++$tabindex;?>"> 185 <?php 186 $tresults = recordings_list(); 187 $default = (isset($day_recording_id) ? $day_recording_id : ''); 188 echo '<option value="0">' ._("Default") ."</option>\n"; 189 if (isset($tresults[0])) { 190 foreach ($tresults as $tresult) { 191 echo '<option value="'.$tresult['id'].'"'.($tresult['id'] == $default ? ' SELECTED' : '').'>'.$tresult['displayname']."</option>\n"; 192 } 193 } 194 ?> 195 </select> 196 </td> 197 </tr> 198 <tr> 199 <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> 200 <td> 201 <select name="night_recording_id" tabindex="<?php echo ++$tabindex;?>"> 202 <?php 203 $default = (isset($night_recording_id) ? $night_recording_id : ''); 204 echo '<option value="0">' ._("Default") ."</option>\n"; 205 if (isset($tresults[0])) { 206 foreach ($tresults as $tresult) { 207 echo '<option value="'.$tresult['id'].'"'.($tresult['id'] == $default ? ' SELECTED' : '').'>'.$tresult['displayname']."</option>\n"; 208 } 209 } 210 ?> 211 </select> 212 </td> 213 </tr> 214 215 <?php } ?> 216 175 217 <tr> 176 218 <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>
