Changeset 8687

Show
Ignore:
Timestamp:
01/26/10 17:09:35 (2 years ago)
Author:
p_lindheimer
Message:

add validation to CID Value and disable field when selection inconsistent with a value re #1718

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/branches/2.7/findmefollow/module.xml

    r8183 r8687  
    22  <rawname>findmefollow</rawname> 
    33  <name>Follow Me</name> 
    4   <version>2.6.0.1</version> 
     4  <version>2.7.0.0</version> 
    55  <publisher>FreePBX</publisher> 
    66  <license>GPLv2+</license> 
    77  <changelog> 
     8    *2.7.0.0* #1718 
    89    *2.6.0.1* #3780 
    910    *2.6.0.0* localizations, misc 
  • modules/branches/2.7/findmefollow/page.findmefollow.php

    r8593 r8687  
    410410        </td> 
    411411        <td> 
    412           <select name="changecid" tabindex="<?php echo ++$tabindex;?>"> 
     412          <select name="changecid" id="changecid" tabindex="<?php echo ++$tabindex;?>"> 
    413413          <?php 
    414414            $default = (isset($changecid) ? $changecid : 'default'); 
     
    418418            echo '<option value="did" '.($default == 'did' ? 'SELECTED' : '').'>'._("Use Dialed Number"); 
    419419            echo '<option value="forcedid" '.($default == 'forcedid' ? 'SELECTED' : '').'>'._("Force Dialed Number"); 
     420            $fixedcid_disabled = ($default != 'fixed' && $default != 'extern') ? 'disabled = "disabled"':''; 
    420421          ?>     
    421422          </select> 
     
    425426      <tr> 
    426427        <td><a href="#" class="info"><?php echo _("Fixed CID Value")?>:<span><?php echo _('Fixed value to replace the CID with used with some of the modes above. Should be in a format of digits only with an option of E164 format using a leading "+".')?></span></a></td> 
    427        <td><input size="30" type="text" name="fixedcid" value="<?php  echo $fixedcid ?>" tabindex="<?php echo ++$tabindex;?>"></td> 
     428        <td><input size="30" type="text" name="fixedcid" id="fixedcid" value="<?php  echo $fixedcid ?>" tabindex="<?php echo ++$tabindex;?>" <?php echo $fixedcid_disabled ?>></td> 
    428429      </tr> 
    429430       
     
    448449<!-- 
    449450 
     451$(document).ready(function(){ 
     452  $("#changecid").change(function(){ 
     453    state = (this.value == "fixed" || this.value == "extern") ? "" : "disabled"; 
     454    $("#fixedcid").attr("disabled",state); 
     455  }); 
     456}); 
     457 
    450458function insertExten() { 
    451459  exten = document.getElementById('insexten').value; 
     
    463471 
    464472function checkGRP(theForm) { 
    465   var msgInvalidGrpNum = "<?php echo _('Invalid Group Number specified'); ?>"; 
    466473  var msgInvalidExtList = "<?php echo _('Please enter an extension list.'); ?>"; 
    467   var msgInvalidGrpPrefix = "<?php echo _('Invalid prefix. Valid characters: a-z A-Z 0-9 : _ -'); ?>"; 
    468474  var msgInvalidTime = "<?php echo _('Invalid time specified'); ?>"; 
    469475  var msgInvalidGrpTimeRange = "<?php echo _('Time must be between 1 and 60 seconds'); ?>"; 
    470476  var msgInvalidRingStrategy = "<?php echo _('Only ringall, ringallv2, hunt and the respective -prim versions are supported when confirmation is checked'); ?>"; 
    471  
    472  
     477  var msgInvalidCID = "<?php echo _('Invalid CID Number. Must be in a format of digits only with an option of E164 format using a leading "+"'); ?>"; 
    473478 
    474479  // set up the Destination stuff 
     
    480485    return warnInvalid(theForm.grplist, msgInvalidExtList); 
    481486 
    482   defaultEmptyOK = false; 
     487  if (!theForm.fixedcid.disabled) { 
     488    fixedcid = $.trim(theForm.fixedcid.value); 
     489    if (theForm.fixedcid.value.substring(0,1) == '+') { 
     490      fixedcid = theForm.fixedcid.value.substring(1); 
     491    } 
     492    if (!isInteger(fixedcid)) { 
     493      return warnInvalid(theForm.fixedcid, msgInvalidCID); 
     494    } 
     495  } 
     496 
    483497  if (!isInteger(theForm.grptime.value)) { 
    484498    return warnInvalid(theForm.grptime, msgInvalidTime); 
     
    494508 
    495509  defaultEmptyOK = true; 
    496   if (!isPrefix(theForm.grppre.value)) 
    497     return warnInvalid(theForm.grppre, msgInvalidGrpPrefix); 
    498510 
    499511  if (!validateDestinations(theForm, 1, true))