Changeset 6130
- Timestamp:
- 07/22/08 22:31:57 (4 months ago)
- Files:
-
- modules/branches/2.5/parking/functions.inc.php (modified) (6 diffs)
- modules/branches/2.5/parking/install.php (modified) (2 diffs)
- modules/branches/2.5/parking/install.sql (deleted)
- modules/branches/2.5/parking/module.xml (modified) (3 diffs)
- modules/branches/2.5/parking/page.parking.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
modules/branches/2.5/parking/functions.inc.php
r5565 r6130 30 30 $parkalertinfo = isset($results['parkalertinfo'])?$results['parkalertinfo']:''; 31 31 $parkcid = isset($results['parkcid'])?$results['parkcid']:''; 32 $parkingannmsg = isset($results['parkingannmsg'])?$results['parkingannmsg']:'';32 $parkingannmsg_id = isset($results['parkingannmsg_id'])?$results['parkingannmsg_id']:''; 33 33 $goto = isset($results['goto'])?$results['goto']:'from-pstn,s,1'; 34 34 … … 70 70 } 71 71 72 if ($parkingannmsg) { 72 if ($parkingannmsg_id != '') { 73 $parkingannmsg = recordings_get_file($parkingannmsg_id); 73 74 $ext->add($contextname, "t", '', new ext_playback($parkingannmsg)); 74 75 } … … 92 93 } 93 94 94 function parking_add($parkingenabled, $parkext, $numslots, $parkingtime, $parkingcontext, $parkalertinfo, $parkcid, $parkingannmsg , $goto) {95 function parking_add($parkingenabled, $parkext, $numslots, $parkingtime, $parkingcontext, $parkalertinfo, $parkcid, $parkingannmsg_id, $goto) { 95 96 global $db; 96 97 … … 120 121 array($parkinglot_id, 'parkalertinfo', trim("$parkalertinfo")), 121 122 array($parkinglot_id, 'parkcid', trim("$parkcid")), 122 array($parkinglot_id, 'parkingannmsg ', "$parkingannmsg"),123 array($parkinglot_id, 'parkingannmsg_id', "$parkingannmsg_id"), 123 124 array($parkinglot_id, 'goto', "$goto")); 124 125 … … 155 156 $results = sql($sql,"getAll",DB_FETCHMODE_ASSOC); 156 157 157 $type = isset($active_modules[' announcement']['type'])?$active_modules['announcement']['type']:'setup';158 $type = isset($active_modules['parking']['type'])?$active_modules['parking']['type']:'setup'; 158 159 159 160 foreach ($results as $result) { … … 166 167 } 167 168 return $destlist; 169 } 170 171 function parking_recordings_usage($recording_id) { 172 global $active_modules; 173 174 $my_id = sql("SELECT `data` FROM `parkinglot` WHERE `id` = '1' AND `keyword` = 'parkingannmsg_id' AND `data` = '$recording_id'","getOne"); 175 if (!isset($my_id) || $my_id == '') { 176 return array(); 177 } else { 178 $type = isset($active_modules['parking']['type'])?$active_modules['parking']['type']:'setup'; 179 $usage_arr[] = array( 180 'url_query' => 'config.php?type='.$type.'&display=parking', 181 'description' => "Parking Lot", 182 ); 183 return $usage_arr; 184 } 168 185 } 169 186 modules/branches/2.5/parking/install.php
r4767 r6130 1 1 <?php 2 if (! function_exists("out")) { 3 function out($text) { 4 echo $text."<br />"; 5 } 6 } 7 8 if (! function_exists("outn")) { 9 function outn($text) { 10 echo $text; 11 } 12 } 2 13 3 14 global $db; 4 15 global $amp_conf; 16 17 $sql = " 18 CREATE TABLE IF NOT EXISTS `parkinglot` 19 ( 20 `id` VARCHAR( 20 ) NOT NULL default '1', 21 `keyword` varchar(40) NOT NULL default '', 22 `data` varchar(150) NOT NULL default '', 23 PRIMARY KEY (`id`,`keyword`) 24 ) 25 "; 26 $check = $db->query($sql); 27 if(DB::IsError($check)) { 28 die_freepbx("Can not create parkinglot table"); 29 } 5 30 6 31 $results = array(); … … 24 49 } 25 50 51 // Version 2.5 migrate to recording ids 52 // 53 outn(_("Migrating recordings if needed..")); 54 55 $sql = "SELECT `data` FROM `parkinglot` WHERE `id` = '1' AND `keyword` = 'parkingannmsg'"; 56 $results = $db->getAll($sql, DB_FETCHMODE_ASSOC); 57 if(DB::IsError($results)) { 58 die_freepbx($results->getMessage()); 59 } 60 if (isset($results[0])) { 61 if (trim($results[0]['data']) != '') { 62 $rec_id = recordings_get_or_create_id($results[0]['data'], 'parking'); 63 } else { 64 $rec_id = ''; 65 } 66 // Delete just in case 67 $sql="DELETE FROM `parkinglot` WHERE `keyword` = 'parkingannmsg_id'"; 68 $results = $db->query($sql); 69 if(DB::IsError($results)) { 70 out(_("fatal error")); 71 die_freepbx($results->getMessage()); 72 } 73 $sql="INSERT INTO `parkinglot` (`id`, `keyword`, `data`) VALUES ('1', 'parkingannmsg_id', '$rec_id')"; 74 $results = $db->query($sql); 75 if(DB::IsError($results)) { 76 out(_("fatal error")); 77 die_freepbx($results->getMessage()); 78 } 79 // Either way, delete it if it were there 80 $sql="DELETE FROM `parkinglot` WHERE `keyword` = 'parkingannmsg'"; 81 $results = $db->query($sql); 82 if(DB::IsError($results)) { 83 out(_("fatal error")); 84 die_freepbx($results->getMessage()); 85 } 86 out(_("ok")); 87 } else { 88 out(_("not needed")); 89 } 90 26 91 ?> modules/branches/2.5/parking/module.xml
r6092 r6130 2 2 <rawname>parking</rawname> 3 3 <name>Parking Lot</name> 4 <version>2.5. 0</version>4 <version>2.5.1</version> 5 5 <type>setup</type> 6 6 <category>Internal Options & Configuration</category> … … 11 11 </menuitems> 12 12 <changelog> 13 *2.5.1* #2067 change recording to recording id 13 14 *2.5.0* #2845 tabindex 14 15 *2.4.0.6* #2604, #2716, #2843 fix mal-formed html tags, localization fix, Russian Translation … … 26 27 </changelog> 27 28 <depends> 28 <version>2.4.0</version> 29 <version>2.5.0alpha1</version> 30 <module>recordings ge 3.3.8</module> 29 31 </depends> 30 32 <location>release/2.5/parking-2.5.0.tgz</location> modules/branches/2.5/parking/page.parking.php
r5919 r6130 23 23 isset($_REQUEST['parkalertinfo'])?$parkalertinfo = trim($_REQUEST['parkalertinfo']):$parkalertinfo=''; 24 24 isset($_REQUEST['parkcid'])?$parkcid = trim($_REQUEST['parkcid']):$parkcid=''; 25 isset($_REQUEST['parkingannmsg '])?$parkingannmsg = trim($_REQUEST['parkingannmsg']):$parkingannmsg='';25 isset($_REQUEST['parkingannmsg_id'])?$parkingannmsg_id = trim($_REQUEST['parkingannmsg_id']):$parkingannmsg_id=''; 26 26 27 27 if (isset($_REQUEST['goto0']) && isset($_REQUEST[$_REQUEST['goto0']."0"])) { … … 35 35 36 36 if ($action == 'edtPARKING') { 37 parking_add($parkingenabled, $parkext, $numslots, $parkingtime, $parkingcontext, $parkalertinfo, $parkcid, $parkingannmsg , $goto);37 parking_add($parkingenabled, $parkext, $numslots, $parkingtime, $parkingcontext, $parkalertinfo, $parkcid, $parkingannmsg_id, $goto); 38 38 needreload(); 39 39 redirect_standard(); … … 119 119 <td><a href="#" class="info"><?php echo _("Announcement:")?><span><?php echo _("Optional message to be played to the orphaned caller prior to going on the to supplied destination below.<br><br>To add additional recordings please use the \"System Recordings\" MENU to the left")?></span></a></td> 120 120 <td align=right> 121 <select name="parkingannmsg " tabindex="<?php echo ++$tabindex;?>">121 <select name="parkingannmsg_id" tabindex="<?php echo ++$tabindex;?>"> 122 122 <?php 123 123 $tresults = recordings_list(); 124 $default = (isset($parkingannmsg ) ? $parkingannmsg: '');124 $default = (isset($parkingannmsg_id) ? $parkingannmsg_id : ''); 125 125 echo '<option value="">'._("None")."</option>"; 126 126 if (isset($tresults[0])) { 127 127 foreach ($tresults as $tresult) { 128 echo '<option value="'.$tresult[ 2].'"'.($tresult[2] == $default ? ' SELECTED' : '').'>'.$tresult[1]."</option>\n";128 echo '<option value="'.$tresult['id'].'"'.($tresult['id'] == $default ? ' SELECTED' : '').'>'.$tresult['displayname']."</option>\n"; 129 129 } 130 130 } 131 131 132 ?> 132 133 </select> … … 138 139 <td align=right> 139 140 <?php 140 $default = (isset($parkingannmsg ) ? $parkingannmsg: '');141 $default = (isset($parkingannmsg_id) ? $parkingannmsg_id : ''); 141 142 ?> 142 <input type="hidden" name="parkingannmsg " value="<?php echo $default; ?>"><?php echo ($default != '' ? $default : 'None'); ?>143 <input type="hidden" name="parkingannmsg_id" value="<?php echo $default; ?>"><?php echo ($default != '' ? $default : 'None'); ?> 143 144 </td> 144 145 </tr>
