Changeset 5949
- Timestamp:
- 07/07/08 16:35:33 (4 years ago)
- Files:
-
- modules/branches/2.5/queues/functions.inc.php (modified) (5 diffs)
- modules/branches/2.5/queues/install.php (modified) (1 diff)
- modules/branches/2.5/queues/module.xml (modified) (2 diffs)
- modules/branches/2.5/queues/page.queues.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
modules/branches/2.5/queues/functions.inc.php
r5834 r5949 159 159 $grppre = (isset($q['prefix'])?$q['prefix']:''); 160 160 $alertinfo = (isset($q['alertinfo'])?$q['alertinfo']:''); 161 162 // Not sure why someone would ever have a ; in the regex, but since Asterisk has problems with them 163 // it would need to be escaped 164 // 165 $qregex = (isset($q['qregex'])?$q['qregex']:''); 166 str_replace(';','\;',$qregex); 161 167 162 168 $ext->add('ext-queues', $exten, '', new ext_macro('user-callerid')); … … 227 233 228 234 //dynamic agent login/logout 235 if (trim($qregex) != '') { 236 $ext->add('ext-queues', $exten."*", '', new ext_setvar('QREGEX', $qregex)); 237 } 229 238 $ext->add('ext-queues', $exten."*", '', new ext_macro('agent-add',$exten.",".$q['password'])); 230 239 $ext->add('ext-queues', $exten."**", '', new ext_macro('agent-del',$exten.",".$exten)); … … 261 270 } 262 271 263 function queues_add($account,$name,$password,$prefix,$goto,$agentannounce,$members,$joinannounce,$maxwait,$alertinfo='',$cwignore='no' ) {272 function queues_add($account,$name,$password,$prefix,$goto,$agentannounce,$members,$joinannounce,$maxwait,$alertinfo='',$cwignore='no',$qregex='') { 264 273 global $db; 265 274 … … 324 333 $dest = isset($goto) ? $goto:''; 325 334 $cwignore = isset($cwignore) ? $cwignore:'0'; 335 $qregex = isset($qregex) ? addslashes($qregex):''; 326 336 327 337 // Assumes it has just been deleted 328 $sql = "INSERT INTO queues_config (extension, descr, grppre, alertinfo, joinannounce, ringing, agentannounce, maxwait, password, ivr_id, dest, cwignore )329 VALUES ('$extension', '$descr', '$grppre', '$alertinfo', '$joinannounce', '$ringing', '$agentannounce', '$maxwait', '$password', '$ivr_id', '$dest', '$cwignore' ) ";338 $sql = "INSERT INTO queues_config (extension, descr, grppre, alertinfo, joinannounce, ringing, agentannounce, maxwait, password, ivr_id, dest, cwignore, qregex) 339 VALUES ('$extension', '$descr', '$grppre', '$alertinfo', '$joinannounce', '$ringing', '$agentannounce', '$maxwait', '$password', '$ivr_id', '$dest', '$cwignore', '$qregex') "; 330 340 $results = sql($sql); 331 341 return true; … … 524 534 $results['rtone'] = $config['ringing']; 525 535 $results['cwignore'] = $config['cwignore']; 536 $results['qregex'] = $config['qregex']; 526 537 } 527 538 modules/branches/2.5/queues/install.php
r5546 r5949 301 301 } 302 302 303 304 305 306 // Version 2.5 upgrade 307 outn(_("checking for qregex field..")); 308 $sql = "SELECT `qregex` FROM queues_config"; 309 $check = $db->getRow($sql, DB_FETCHMODE_ASSOC); 310 if(DB::IsError($check)) { 311 // add new field 312 $sql = "ALTER TABLE queues_config ADD `qregex` VARCHAR( 255 ) NULL ;"; 313 $result = $db->query($sql); 314 if(DB::IsError($result)) { 315 die_freepbx($result->getDebugInfo()); 316 } 317 out(_("OK")); 318 } else { 319 out(_("already exists")); 320 } 321 303 322 ?> modules/branches/2.5/queues/module.xml
r5835 r5949 2 2 <rawname>queues</rawname> 3 3 <name>Queues</name> 4 <version>2. 4.0.8</version>4 <version>2.5.0.0</version> 5 5 <type>setup</type> 6 6 <category>Inbound Call Control</category> … … 9 9 </description> 10 10 <changelog> 11 *2.5.0.0* #2976 Add Optional Regex to filter user agent numbers that they can input 11 12 *2.4.0.8* #2757 allow spaces and other alphanumeric characters in description 12 13 *2.4.0.7* #2604, #2707, #2843 fix mal-formed html tags, typo, Russian Translation, add oldstyle module hook modules/branches/2.5/queues/page.queues.php
r5919 r5949 28 28 $cwignore = isset($_REQUEST['cwignore'])?$_REQUEST['cwignore']:'0'; 29 29 $rtone = isset($_REQUEST['rtone'])?$_REQUEST['rtone']:'0'; 30 $qregex = isset($_REQUEST['qregex'])?$_REQUEST['qregex']:''; 30 31 31 32 if (isset($_REQUEST['goto0']) && isset($_REQUEST[$_REQUEST['goto0']."0"])) { … … 97 98 $conflict_url = framework_display_extension_usage_alert($usage_arr); 98 99 } else { 99 queues_add($account,$name,$password,$prefix,$goto,$agentannounce,$members,$joinannounce,$maxwait,$alertinfo,$cwignore );100 queues_add($account,$name,$password,$prefix,$goto,$agentannounce,$members,$joinannounce,$maxwait,$alertinfo,$cwignore,$qregex); 100 101 needreload(); 101 102 redirect_standard(); … … 109 110 case "edit": //just delete and re-add 110 111 queues_del($account); 111 queues_add($account,$name,$password,$prefix,$goto,$agentannounce,$members,$joinannounce,$maxwait,$alertinfo,$cwignore );112 queues_add($account,$name,$password,$prefix,$goto,$agentannounce,$members,$joinannounce,$maxwait,$alertinfo,$cwignore,$qregex); 112 113 needreload(); 113 114 redirect_standard('extdisplay'); … … 524 525 </select> 525 526 </td> 527 </tr> 528 529 <tr> 530 <td><a href="#" class="info"><?php echo _("Agent Regex Filter")?><span><?php echo _("Provides an optional regex expression that will be applied against the agent callback number. If the callback number does not pass the regex filter then it will be treated as invalid. This can be used to restrict agents to extensions within a range, not allow callbacks to include keys like *, or any other use that may be appropriate. An examle input might be:<br />^([2-4][0-9]{3})$<br />This would restrict agents to extensions 2000-4999. Or <br />^([0-9]+)$ would allow any number of any length, but restrict the * key.<br />WARNING: make sure you undertand what you are doing or otherwise leave this blank!")?></span></a></td> 531 <td><input type="text" name="qregex" value="<?php echo (isset($qregex) ? $qregex : ''); ?>"></td> 526 532 </tr> 527 533 … … 705 711 706 712 function checkQ(theForm) { 707 var bad = "false"; 708 709 var whichitem = 0; 710 while (whichitem < theForm.goto0.length) { 711 if (theForm.goto0[whichitem].checked) { 712 theForm.goto0.value=theForm.goto0[whichitem].value; 713 } 714 whichitem++; 715 } 716 717 if (!isInteger(theForm.account.value)) { 718 <?php echo "alert('"._("Queue Number must not be blank")."')"?>; 719 bad="true"; 720 } 721 722 defaultEmptyOK = false; 723 if (!isAlphanumeric(theForm.name.value)) { 724 <?php echo "alert('"._("Queue name must not be blank and must contain only alpha-numberic characters")."')"?>; 725 bad="true"; 726 } 727 728 if (bad == "false") { 729 theForm.submit(); 730 } 713 var bad = "false"; 714 var msgWarnRegex = "<?php echo _("Using a Regex filter is fairly advanced, please confirm you know what you are doing or leave this blank"); ?>"; 715 716 var whichitem = 0; 717 while (whichitem < theForm.goto0.length) { 718 if (theForm.goto0[whichitem].checked) { 719 theForm.goto0.value=theForm.goto0[whichitem].value; 720 } 721 whichitem++; 722 } 723 724 if (!isInteger(theForm.account.value)) { 725 <?php echo "alert('"._("Queue Number must not be blank")."')"?>; 726 bad="true"; 727 } 728 729 defaultEmptyOK = false; 730 if (!isAlphanumeric(theForm.name.value)) { 731 <?php echo "alert('"._("Queue name must not be blank and must contain only alpha-numberic characters")."')"?>; 732 bad="true"; 733 } 734 if (!isEmpty(theForm.qregex.value)) { 735 if (!confirm(msgWarnRegex)) { 736 bad="true"; 737 } 738 } 739 740 if (bad == "false") { 741 theForm.submit(); 742 } 731 743 } 732 744
