Changeset 2647

Show
Ignore:
Timestamp:
10/04/06 12:48:15 (7 years ago)
Author:
gregmac
Message:

Use select list to select extensions, instead of textarea

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/branches/2.2/paging/page.paging.php

    r2631 r2647  
    8484  <td><input size='5' type='text' name='pagenbr' value='<?php echo $xtn ?>'></td> 
    8585  </tr><tr> 
    86   <tr><td valign='top'><a href='#' class='info'><?php echo _("device list:")."<span><br>"._("List devices to page, one per line. This will page the specified extension in freepbx extensions mode. In deviceanduser mode it refers to the device which may or may not be the same as the extension") ?>  
     86  <tr><td valign='top'><a href='#' class='info'><?php echo _("extension list:")."<span><br>"._("List extensions to page, one per line.") ?>  
    8787  <br><br></span></a></td> 
    88   <td valign="top"> <textarea id="xtnlist" cols="15" rows="<?php echo $rows ?>" name="pagelist"><?php  
    89     echo ($xtn)?implode("\n",paging_get_devs($xtn)):''; ?></textarea><br> 
     88  <td valign="top">  
     89   
     90  <select multiple="multiple" name="pagelist[]" id="xtnlist" > 
     91  <?php  
     92  $selected = paging_get_devs($xtn);  
     93  if (is_null($selected)) $selected = array(); 
     94  foreach (core_devices_list() as $device) { 
     95    echo '<option value="'.$device[0].'" '; 
     96    if (array_search($device[0], $selected) !== false) echo ' selected="selected" '; 
     97    echo '>'.$device[0].' - '.$device[1].'</option>'; 
     98  } 
     99  ?> 
     100  </select> 
     101     
     102    <br> 
    90103  <input type="submit" style="font-size:10px;" value="<?php echo _("Clean & Remove duplicates")?>" /> 
    91104  </td></tr> 
     
    101114function page_edit_onsubmit() { 
    102115  var msgInvalidPageExt = "<?php echo _('Please enter a valid Paging Extension'); ?>"; 
    103   var msgInvalidExtList = "<?php echo _('Please enter the Extension List details'); ?>"; 
     116  var msgInvalidExtList = "<?php echo _('Please select at least one extension'); ?>"; 
    104117 
    105118  defaultEmptyOK = false; 
     
    107120    return warnInvalid(theForm.pagenbr, msgInvalidPageExt); 
    108121   
    109   if (isEmpty(theForm.xtnlist.value) || isWhitespace(theForm.xtnlist.value)) 
     122  var selected = 0; 
     123  for (var i=0; i < theForm.xtnlist.options.length; i++) { 
     124    if (theForm.xtnlist.options[i].checked) selected += 1; 
     125  } 
     126  if (selected < 1) { 
    110127    return warnInvalid(theForm.xtnlist, msgInvalidExtList); 
     128  } 
    111129     
    112130  return true;