Changeset 1881
- Timestamp:
- 05/06/06 15:37:59 (7 years ago)
- Files:
-
- modules/branches/2.1/miscdests/functions.inc.php (modified) (3 diffs)
- modules/branches/2.1/miscdests/module.xml (modified) (1 diff)
- modules/branches/2.1/miscdests/page.miscdests.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
modules/branches/2.1/miscdests/functions.inc.php
r1565 r1881 25 25 case "asterisk": 26 26 $contextname = 'ext-miscdests'; 27 $fctemplate = '/\{(.+)\:(.+)\}/'; 28 27 29 if(is_array($destlist = miscdests_list())) { 28 30 … … 34 36 $miscdialdest = $miscdest['destdial']; 35 37 38 // exchange {mod:fc} for the relevent feature codes in $miscdialdest 39 $miscdialdest = preg_replace_callback($fctemplate, "miscdests_lookupfc", $miscdialdest); 40 41 // write out the dialplan details 36 42 $ext->add($contextname, $miscid, '', new ext_noop('MiscDest: '.$miscdescription)); 37 43 $ext->add($contextname, $miscid, '', new ext_dial('Local/'.$miscdialdest.'@from-internal', '')); … … 74 80 } 75 81 82 function miscdests_lookupfc($matches) { 83 $modulename = $matches[1]; 84 $featurename = $matches[2]; 85 86 $fcc = new featurecode($modulename, $featurename); 87 $fc = $fcc->getCodeActive(); 88 return $fc; 89 } 76 90 ?> modules/branches/2.1/miscdests/module.xml
r1854 r1881 2 2 <rawname>miscdests</rawname> 3 3 <name>Misc Destinations</name> 4 <version>1. 0</version>4 <version>1.1.0</version> 5 5 <type>setup</type> 6 6 <category>Basic</category> modules/branches/2.1/miscdests/page.miscdests.php
r1565 r1881 33 33 } 34 34 35 //get meetme rooms36 //this function needs to be available to other modules (those that use goto destinations)37 //therefore we put it in globalfunctions.php38 35 $miscdests = miscdests_list(); 36 37 // Make array of feature code for <SELECT> list 38 $featurecodes = featurecodes_getAllFeaturesDetailed(); 39 if (isset($featurecodes)) { 40 foreach ($featurecodes as $item) { 41 $moduledesc = _($item['moduledescription']); 42 $moduleena = ($item['moduleenabled'] == 1 ? true : false); 43 if ($moduleena) { 44 $featureena = ($item['featureenabled'] == 1 ? true : false); 45 if ($featureena) { 46 $featureid = $item['modulename'] . ':' . $item['featurename']; 47 $featuredesc = _($item['featuredescription']); 48 49 $featurecodedefault = (isset($item['defaultcode']) ? $item['defaultcode'] : ''); 50 $featurecodecustom = (isset($item['customcode']) ? $item['customcode'] : ''); 51 $featureactualcode = ($featurecodecustom != '' ? $featurecodecustom : $featurecodedefault); 52 53 $fclist[$featureid] = $featuredesc; 54 } 55 } 56 } 57 asort($fclist); 58 } 59 39 60 ?> 40 61 … … 63 84 $thisMiscDest = miscdests_get($extdisplay); 64 85 //create variables 86 $description = ""; 87 $destdial = ""; 65 88 extract($thisMiscDest); 66 89 } … … 91 114 <tr> 92 115 <td><a href="#" class="info"><?php echo _("dial:")?><span><?php echo _("Enter the digits to dial for this Misc Destination.")?></span></a></td> 93 <td><input type="text" name="destdial" value="<?php echo (isset($destdial) ? $destdial : ''); ?>"></td> 116 <td> 117 <input type="text" name="destdial" value="<?php echo (isset($destdial) ? $destdial : ''); ?>"> 118 <?php if (isset($fclist)) { ?> 119 <select id="fc" onchange="fc_onchange();"> 120 <option value="">--<?php echo _("featurecode"); ?>--</option> 121 <?php 122 foreach ($fclist as $fckey => $fcdesc) { 123 ?> 124 <option value="{<?php echo $fckey; ?>}"><?php echo _($fcdesc); ?></option> 125 <?php 126 } 127 ?> 128 </select> 129 <?php } ?> 130 </td> 94 131 </tr> 95 132 96 133 97 134 <tr> 98 <td colspan="2"><br><h6><input name="Submit" type="submit" value="<?php echo _("Submit Changes")?>"></h6></td> 135 <td colspan="2"><br><h6><input name="Submit" type="submit" value="<?php echo _("Submit Changes")?>"></h6> 136 </td> 99 137 </tr> 100 138 </table> … … 118 156 if (!isAlphanumeric(theForm.description.value)) 119 157 return warnInvalid(theForm.description, msgInvalidDescription); 158 159 // go thru text and remove the {} bits so we only check the actual dial digits 160 var fldText = theForm.destdial.value; 161 var chkText = ""; 162 163 if ( (fldText.indexOf("{") > -1) && (fldText.indexOf("}") > -1) ) { // has one or more sets of {mod:fc} 120 164 121 if (!isDialDigits(theForm.destdial.value)) 165 var inbraces = false; 166 for (var i=0; i<fldText.length; i++) { 167 if ( (fldText.charAt(i) == "{") && (inbraces == false) ) { 168 inbraces = true; 169 } else if ( (fldText.charAt(i) == "}") && (inbraces == true) ) { 170 inbraces = false; 171 } else if ( inbraces == false ) { 172 chkText += fldText.charAt(i); 173 } 174 } 175 176 // if there is nothing in chkText but something in fldText 177 // then the field must contain a featurecode only, therefore 178 // there really is something in thre! 179 if ( (chkText == "") & (fldText != "") ) 180 chkText = "0"; 181 182 } else { 183 chkText = fldText; 184 } 185 // now do the check using the chkText var made above 186 if (!isDialDigits(chkText)) 122 187 return warnInvalid(theForm.destdial, msgInvalidDial); 123 188 124 189 return true; 125 190 } 126 191 192 function fc_onchange() { 193 theForm.destdial.value = theForm.fc.value; 194 theForm.fc.selectedIndex = 0; 195 } 127 196 //--> 128 197 </script>
