Changeset 9130

Show
Ignore:
Timestamp:
03/11/10 14:42:06 (2 years ago)
Author:
p_lindheimer
Message:

closes #4125 adds some methods to ext-class to add comments and selectively or globally remove all auto-generated custom context includes, as well as amporta.conf setting to enact this and code in retrieve_conf to turn this on

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • freepbx/trunk/amp_conf/bin/retrieve_conf

    r8701 r9130  
    352352require_once($amp_conf['AMPWEBROOT']."/admin/extensions.class.php"); 
    353353$ext = new extensions; 
     354 
     355if ($amp_conf['DISABLECUSTOMCONTEXTS']) { 
     356  $ext->disableCustomContexts(true); 
     357} 
    354358 
    355359// create objects for any module classes 
  • freepbx/trunk/amp_conf/htdocs/admin/extensions.class.php

    r9043 r9130  
    1414   
    1515  var $_sorted; 
     16 
     17  var $_section_comment = array(); 
     18 
     19  var $_section_no_custom = array(); 
     20 
     21  var $disable_custom_contexts = false; 
    1622   
    1723  /** The filename to write this configuration to 
     
    8389    $this->_sorted = true; 
    8490  } 
     91  function addSectionComment($section, $comment) { 
     92    $this->_section_comment[$section] = $comment; 
     93  } 
     94 
     95  function addSectionNoCustom($section, $setting) { 
     96    $this->_section_no_custom[$section] = $setting ? true : false; 
     97  } 
     98 
     99  function disableCustomContexts($setting) { 
     100    $this->_disable_custom_contexts = $setting ? true : false; 
     101  } 
    85102   
    86103  function addHint($section, $extension, $hintvalue) { 
     
    92109  } 
    93110   
    94   function addInclude($section, $incsection) { 
    95    $this->_includes[$section][] = $incsection
     111  function addInclude($section, $incsection, $comment='') { 
     112    $this->_includes[$section][] = array('include' => $incsection, 'comment' => $comment)
    96113  } 
    97114 
     
    266283    if(is_array($this->_exts)){ 
    267284      foreach (array_keys($this->_exts) as $section) { 
    268         $output .= "[".$section."]\n"; 
     285        $comment = isset($this->_section_comment[$section]) ? ' ; '.$this->_section_comment[$section] : ''; 
     286        $output .= "[$section]$comment\n"; 
    269287         
    270         //automatically include a -custom context 
    271         $output .= "include => {$section}-custom\n"; 
     288        //automatically include a -custom context unless no_custom is true 
     289        if (!$this->_disable_custom_contexts && (!isset($this->_section_no_custom[$section]) || $this->_section_no_custom[$section] == false)) { 
     290          $output .= "include => {$section}-custom\n"; 
     291        } 
    272292        //add requested includes for this context 
    273293        if (isset($this->_includes[$section])) { 
    274294          foreach ($this->_includes[$section] as $include) { 
    275             $output .= "include => ".$include."\n"; 
     295            $output .= "include => ".$include['include'] . ($include['comment'] != ''?' ; '.$include['comment']:'') . "\n"; 
    276296          } 
    277297        } 
  • freepbx/trunk/amp_conf/htdocs/admin/functions.inc.php

    r9127 r9130  
    754754  'USEDIALONE'      => array('bool' , false), 
    755755  'RELOADCONFIRM'   => array('bool' , true), 
     756  'DISABLECUSTOMCONTEXTS'   => array('bool' , false), 
    756757); 
    757758 
  • freepbx/trunk/amportal.conf

    r9110 r9130  
    283283# When set to true, a beep is played instead of confirmation message when activating/de-activating: 
    284284# CallForward, CallWaiting, DayNight, DoNotDisturb and FindMeFollow 
     285 
     286DISABLECUSTOMCONTEXTS=true 
     287# DISABLECUSTOMCONTEXTS=true|false 
     288# DEFAULT VALUE: false 
     289# Normally FreePBX auto-generates a custome context that may be usable for adding custom dialplan to modify the normal behavior 
     290# of FreePBX. It takes a good understanding of how Asterisk processes these includes to use this and in many of the cases, there 
     291# is no useful application. All includes will result in a WARNING in the Asterisk log if there is no countext found to include 
     292# though it results in no errors. If you know that you want the includes, you can set this to true. If you comment it out FreePBX 
     293# will revert to legacy behavior and include the contexts.