Show
Ignore:
Timestamp:
04/08/11 11:03:12 (2 years ago)
Author:
p_lindheimer
Message:

don't include ajax call unless action is add, also removed old conflict checking code not used re #4871

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/branches/2.9/core/functions.inc.php

    r11980 r11981  
    63646364      $currentcomponent->addjsfunc('onsubmit()', "\treturn checkBlankUserPwd();\n", 9); 
    63656365    } 
    6366     $currentcomponent->addjsfunc('onsubmit()', " 
     6366    if ($action == 'add') { 
     6367      $currentcomponent->addjsfunc('onsubmit()', " 
    63676368      var exten = $('#extension').val(); 
    6368       var exten_action = $('#action').val(); 
    63696369      var ajax_result = true; 
    63706370      $('#error').remove(); 
    6371       if (exten_action != 'edit') { 
    6372         $.ajax({ 
    6373           type: 'POST', 
    6374           url: 'config.php', 
    6375           data: 'handler=api&function=framework_get_conflict_url_helper&args=' + exten, 
    6376           dataType: 'json', 
    6377           cache: false, 
    6378           async: false, 
    6379           success: function(data, textStatus, XMLHttpRequest) { 
    6380             if (data.length !== 0) { 
    6381               $('#title').after('<div id=\"error\"><h5>"._("Conflicting Extensions")."</h5>' + data + '</div>'); 
    6382               ajax_result = false; 
    6383             } 
    6384           }, 
    6385           error: function(data) { 
    6386             console.log('an error was recevied: ' + data); 
    6387             // TODO: Should we stop the submital and do something here? 
     6371      $.ajax({ 
     6372        type: 'POST', 
     6373        url: 'config.php', 
     6374        data: 'handler=api&function=framework_get_conflict_url_helper&args=' + exten, 
     6375        dataType: 'json', 
     6376        cache: false, 
     6377        async: false, 
     6378        success: function(data, textStatus, XMLHttpRequest) { 
     6379          if (data.length !== 0) { 
     6380            $('#title').after('<div id=\"error\"><h5>"._("Conflicting Extensions")."</h5>' + data + '</div>'); 
     6381            ajax_result = false; 
    63886382          } 
    6389         }); 
    6390       } 
     6383        }, 
     6384        error: function(data) { 
     6385          console.log('an error was recevied: ' + data); 
     6386          // TODO: Should we stop the submital and do something here? 
     6387        } 
     6388      }); 
    63916389      if (!ajax_result) { 
    63926390        alert('". _("Extension number conflict, please choose another.") . "'); 
    6393         $('#extension').focus();        return false; 
    6394     }", 9);  
     6391        $('#extension').focus(); 
     6392        return false; 
     6393      }", 9); 
     6394    } 
    63956395    $currentcomponent->addguielem($section, new gui_textbox('name', $name, _("Display Name"), _("The CallerID name for calls from this user will be set to this name. Only enter the name, NOT the number."),  '!isAlphanumeric() || isWhitespace()', $msgInvalidDispName, false)); 
    63966396    $cid_masquerade = (trim($cid_masquerade) == $extdisplay)?"":$cid_masquerade; 
     
    65466546    switch ($action) { 
    65476547      case "add": 
    6548         $conflict_url = array(); 
    6549         $usage_arr = framework_check_extension_usage($_REQUEST['extension']); 
    6550         if (!empty($usage_arr)) { 
    6551           $GLOBALS['abort'] = true; 
    6552           $conflict_url = framework_display_extension_usage_alert($usage_arr,true); 
    6553           global $currentcomponent; 
    6554           $id=0; 
    6555           $currentcomponent->addguielem('_top', new gui_link_label('conflict', _("Conflicting Extensions"), _("The following extension numbers are in conflict, you can click on the item(s) below to edit the conflicting entity."), true)); 
    6556           foreach ($conflict_url as $edit_link) { 
    6557             $currentcomponent->addguielem('_top', new gui_link('conflict'.$id++, $edit_link['label'], $edit_link['url'])); 
    6558           } 
    6559           $msg = ($_REQUEST['display'] == 'users') ? _("Configure user again:") : _("Configure extension again:"); 
    6560           $currentcomponent->addguielem('_top', new gui_subheading('conflict_end', $msg, false)); 
    6561           unset($_REQUEST['action']); 
    6562           redirect_standard_continue(); 
    6563         } elseif (core_users_add($_REQUEST)) { 
     6548        if (core_users_add($_REQUEST)) { 
    65646549          needreload(); 
    65656550          redirect_standard_continue();