Changeset 5389
- Timestamp:
- 12/10/07 14:01:40 (5 years ago)
- Files:
-
- contributed_modules/modules/vmblast/functions.inc.php (modified) (7 diffs)
- contributed_modules/modules/vmblast/module.xml (modified) (2 diffs)
- contributed_modules/modules/vmblast/page.vmblast.php (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
contributed_modules/modules/vmblast/functions.inc.php
r5381 r5389 50 50 $ext->addInclude('from-internal-additional','vmblast-grp'); 51 51 $contextname = 'vmblast-grp'; 52 $ ringlist = vmblast_list();52 $vmlist = vmblast_list(); 53 53 54 54 if (function_exists('recordings_list')) { … … 59 59 } 60 60 61 if (is_array($ ringlist)) {62 foreach($ ringlist as $item) {61 if (is_array($vmlist)) { 62 foreach($vmlist as $item) { 63 63 $grpnum = ltrim($item['0']); 64 64 $grp = vmblast_get($grpnum); 65 $grplist = explode('&',$grp['grplist']);65 $grplist = $grp['grplist']; 66 66 $ext->add($contextname, $grpnum, '', new ext_macro('user-callerid')); 67 67 $ext->add($contextname, $grpnum, '', new ext_answer('')); … … 139 139 global $db; 140 140 141 $grplist = $grplist; 142 foreach ($grplist as $key => $value) { 143 $grplist[$key] = addslashes(trim($value)); 141 if (is_array($grplist)) { 142 $xtns = $grplist; 143 } else { 144 $xtns = explode("\n",$grplist); 145 } 146 147 foreach ($xtns as $key => $value) { 148 $xtns[$key] = addslashes(trim($value)); 144 149 } 145 150 // Sanity check input. 146 151 147 152 $compiled = $db->prepare("INSERT INTO vmblast_groups (grpnum, ext) values ('$grpnum',?)"); 148 $result = $db->executeMultiple($compiled,$ grplist);153 $result = $db->executeMultiple($compiled,$xtns); 149 154 if(DB::IsError($result)) { 150 155 die_freepbx($result->getDebugInfo()."<br><br>".'error adding to vmblast_groups table'); … … 231 236 } 232 237 233 //if ($tech_hardware != null && ($pagename == 'extensions' || $pagename == 'users')) {234 238 if ($tech_hardware != null || $pagename == 'users') { 235 239 vmblast_applyhooks(); … … 272 276 if ($default_group != "") { 273 277 $in_default_vmblast_grp = vmblast_check_default($extdisplay); 274 $currentcomponent->addguielem($section, new gui_selectbox('in_default_vmblast_grp', $currentcomponent->getoptlist('vmblast_group'), $in_default_vmblast_grp, _('Default VMblast Group'), _('You can include or exclude this extension/ device from being part of the default voicemail blast group when creating or editing.'), false));278 $currentcomponent->addguielem($section, new gui_selectbox('in_default_vmblast_grp', $currentcomponent->getoptlist('vmblast_group'), $in_default_vmblast_grp, _('Default VMblast Group'), _('You can include or exclude this extension/user from being part of the default voicemail blast group when creating or editing. Choosing this option will be ignored if the user does not have a voicemial box.'), false)); 275 279 } 276 280 } … … 285 289 $ext = isset($_REQUEST['extdisplay'])?$_REQUEST['extdisplay']:null; 286 290 $extn = isset($_REQUEST['extension'])?$_REQUEST['extension']:null; 291 $vm_enabled = isset($_REQUEST['vm']) && $_REQUEST['vm'] == 'enabled' ? true : false; 287 292 $in_default_vmblast_grp = isset($_REQUEST['in_default_vmblast_grp'])?$_REQUEST['in_default_vmblast_grp']:false; 288 293 289 294 $extdisplay = ($ext==='') ? $extn : $ext; 290 295 291 if ( $action == "add" || $action == "edit") {296 if (($action == "add" || $action == "edit") && $vm_enabled) { 292 297 if (!isset($GLOBALS['abort']) || $GLOBALS['abort'] !== true) { 293 298 if ($in_default_vmblast_grp !== false) { … … 295 300 } 296 301 } 297 } elseif ($ action == "del") {302 } elseif ($extdisplay != '' && ($action == "del" || ($action == "edit" && !$vm_enabled))) { 298 303 $sql = "DELETE FROM vmblast_groups WHERE ext = '$extdisplay'"; 299 304 sql($sql); contributed_modules/modules/vmblast/module.xml
r5374 r5389 2 2 <rawname>vmblast</rawname> 3 3 <name>VoiceMail Blasting</name> 4 <version>1. 1.2</version>4 <version>1.2.0</version> 5 5 <type>setup</type> 6 6 <category>Internal Options & Configuration</category> … … 9 9 </description> 10 10 <changelog> 11 *1.2.0* change to use proper multi-select list, fix bug in js validation of empty list, add default vmblast group 11 12 *1.1.2* add vmblast_group table and migrate from old grplist field 12 13 *1.1.1* fixed a couple SQL bugs, improved dialplan so you can skip annoucement and messages immeditiately (except if saydigits used) contributed_modules/modules/vmblast/page.vmblast.php
r5381 r5389 21 21 $password = isset($_REQUEST['password']) ? $password : ''; 22 22 $default_group = isset($_REQUEST['default_group']) ? $default_group : '0'; 23 24 if (isset($_REQUEST["grplist"])) { 25 $grplist = explode("\n",$_REQUEST["grplist"]); 26 27 if (!$grplist) { 28 $grplist = array(); 29 } 30 31 foreach (array_keys($grplist) as $key) { 32 //trim it 33 $grplist[$key] = trim($grplist[$key]); 34 35 // remove invalid chars 36 $grplist[$key] = preg_replace("/[^0-9#*]/", "", $grplist[$key]); 37 38 if ($grplist[$key] == ltrim($extdisplay,'GRP-').'#') 39 $grplist[$key] = rtrim($grplist[$key],'#'); 40 41 // remove blanks 42 if ($grplist[$key] == "") unset($grplist[$key]); 43 } 44 45 // check for duplicates, and re-sequence 46 $grplist = array_values(array_unique($grplist)); 47 } 23 $vmblast_list = isset($_REQUEST['vmblast_list']) ? $vmblast_list : ''; 48 24 49 25 // do if we are submitting a form … … 61 37 $conflict_url = framework_display_extension_usage_alert($usage_arr); 62 38 63 } else if (vmblast_add($account,$ grplist,$description)) {39 } else if (vmblast_add($account,$vmblast_list,$description)) { 64 40 needreload(); 65 41 redirect_standard(); … … 77 53 if ($action == 'editGRP') { 78 54 vmblast_del($account); 79 vmblast_add($account,$ grplist,$description,$audio_label,$password,$default_group);55 vmblast_add($account,$vmblast_list,$description,$audio_label,$password,$default_group); 80 56 needreload(); 81 57 redirect_standard('extdisplay'); … … 112 88 $password = $thisgrp['password']; 113 89 $default_group = $thisgrp['default_group']; 114 unset($grpliststr);115 90 unset($thisgrp); 116 91 … … 190 165 <?php } else { ?> 191 166 <tr> 192 <td><a href="#" class="info"><?php echo _("Audio Label:")?><span><?php echo _("The group number will be p ayed to the caller so they can confirm they have dialed the prooper voice mail group number.<br><br>You must install and enable the \"Systems Recordings\" Module to edit this option and choose from recordings.")?></span></a></td>167 <td><a href="#" class="info"><?php echo _("Audio Label:")?><span><?php echo _("The group number will be played to the caller so they can confirm they have dialed the proper voice mail group number.<br><br>You must install and enable the \"Systems Recordings\" Module to edit this option and choose from recordings.")?></span></a></td> 193 168 <td> 194 169 <?php … … 207 182 208 183 <tr> 209 <td valign="top"><a href="#" class="info"><?php echo _("Extension list")?>:<span><br><?php echo _("List Voicemail boxes to mass send to. One per line.")?><br></span></a></td> 210 <td valign="top"> 211 <?php 212 $rows = count($grplist)+1; 213 ($rows < 5) ? 5 : (($rows > 20) ? 20 : $rows); 214 ?> 215 <textarea id="grplist" cols="15" rows="<?php echo $rows ?>" name="grplist"><?php echo implode("\n",$grplist);?></textarea> 216 </td> 217 </tr> 218 219 <tr> 220 <td> 221 <a href=# class="info"><?php echo _("Extension Quick Pick")?> 222 <span> 223 <?php echo _("Choose an extension to append to the end of the extension list above.")?> 224 </span> 225 </a> 226 </td> 227 <td> 228 <select onChange="insertExten();" id="insexten"> 229 <option value=""><?php echo _("(pick extension)")?></option> 230 <?php 184 <td valign='top'><a href='#' class='info'><?php echo _("Voicemail Box List:")."<span><br>"._("Select voice mail boxes to add to this group. Use Ctrl key to select multiple..") ?> 185 <br><br></span></a> 186 </td> 187 <td valign="top"> 188 <select multiple="multiple" name="vmblast_list[]" id="xtnlist" > 189 <?php 231 190 $results = core_users_list(); 191 if (!is_array($results)) $results = array(); 232 192 foreach ($results as $result) { 233 193 if ($result[2] != 'novm') { 234 echo "<option value='".$result[0]."'>".$result[0]." (".$result[1].")</option>\n"; 194 echo '<option value="'.$result[0].'" '; 195 if (array_search($result[0], $grplist) !== false) echo ' selected="selected" '; 196 echo '>'.$result[0].' ('.$result[1].')</option>'; 235 197 } 236 198 } 237 ?>199 ?> 238 200 </select> 239 </td> 240 </tr> 241 242 <tr> 243 <td> 244 <a href='#' class='info'><?php echo _("Default Page Group") ?> 245 <span> <?php echo _("Each PBX system can have a single Default Page Group. If specified, extensions can be automatically added (or removed) from the default page group in the Extensions (or Users) tab.<br />Making this group the default will uncheck the option from the current default group if specified.") ?> </span> 201 <br> 202 </td> 203 </tr> 204 205 <tr> 206 <td> 207 <a href='#' class='info'><?php echo _("Default VMBlast Group") ?> 208 <span> <?php echo _("Each PBX system can have a single Default Voicemail Blast Group. If specified, extensions can be automatically added (or removed) from this default group in the Extensions (or Users) tab.<br />Making this group the default will uncheck the option from the current default group if specified.") ?> </span> 246 209 </a> 247 210 </td> … … 263 226 <script language="javascript"> 264 227 <!-- 265 266 function insertExten() {267 exten = document.getElementById('insexten').value;268 269 grpList=document.getElementById('grplist');270 if (grpList.value[ grpList.value.length - 1 ] == "\n") {271 grpList.value = grpList.value + exten;272 } else {273 grpList.value = grpList.value + '\n' + exten;274 }275 276 // reset element277 document.getElementById('insexten').value = '';278 }279 280 228 281 229 function checkGRP(theForm) { … … 285 233 var msgInvalidDescription = "<?php echo _('Please enter a valid Group Description'); ?>"; 286 234 var msgInvalidPassword = "<?php echo _('Please enter a valid numeric password, only numbers are allowed'); ?>"; 235 var msgInvalidExtList = "<?php echo _('Please select at least one extension'); ?>"; 287 236 288 237 // form validation … … 302 251 return warnInvalid(theForm.description, msgInvalidDescription); 303 252 304 if (isEmpty(theForm.grplist.value)) 305 return warnInvalid(theForm.grplist, msgInvalidExtList); 253 var selected = 0; 254 for (var i=0; i < theForm.xtnlist.options.length; i++) { 255 if (theForm.xtnlist.options[i].selected) selected += 1; 256 } 257 if (selected < 1) { 258 theForm.xtnlist.focus(); 259 alert(msgInvalidExtList); 260 return false; 261 } 306 262 307 263 return true; 308 264 } 265 309 266 //--> 310 267 </script>
