Changeset 9819

Show
Ignore:
Timestamp:
06/11/10 09:46:57 (2 years ago)
Author:
mbrevda
Message:

re #1447, #1690; reverting r9817 to make way for #4335

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • contributed_modules/modules/customcontexts/functions.inc.php

    r9818 r9819  
    4949        $section = $val[0]; 
    5050        if (isset($ext->_includes[$section])) { 
    51           $i = 0; 
     51               $i = 0; 
    5252          foreach ($ext->_includes[$section] as $include) { 
    5353            if ($section == 'outbound-allroutes') { 
    5454              $i = $i + 1; 
    55             $sql = "update customcontexts_includes_list  set missing = 0, sort = $i where context = '$section' and include = '$include'"; 
     55            $sql = "update customcontexts_includes_list  set missing = 0, sort = $i where context = '$section' and include = '$include'"; 
    5656              $db->query($sql); 
    57              //fix prioritized contexts, description = '$include' 
     57//fix prioritized contexts       , description = '$include' 
    5858              $sql = "update customcontexts_includes_list  set include = '$include', description = '$include', missing = 0, sort = $i where missing = 1 and context = '$section' and substring(include,1,6) = 'outrt-' and substring(include,10) = substring('$include',10)"; 
    5959              $db->query($sql); 
    60              //fix allowed prioritized contexts  (i did not do , sort = $i, maybe i should)    context = '$section' and 
     60//fix allowed prioritized contexts  (i did not do , sort = $i, maybe i should)    context = '$section' and 
    6161              $sql = "update customcontexts_includes set include = '$include' where substr(include,1,6) = 'outrt-' and substr(include,10) = substr('$include',10)"; 
    6262              $db->query($sql); 
     
    6464              $sql = "update customcontexts_includes_list  set missing = 0, sort = $i where context = '$section' and include = '$include'"; 
    6565              $db->query($sql); 
    66            
     66                       
    6767            $sql = "INSERT IGNORE INTO customcontexts_includes_list (context, include, description, sort) VALUES ('$section', '$include', '$include', $i)"; 
    6868            $db->query($sql); 
     
    9090    default: 
    9191        return false; 
     92    break; 
     93  } 
     94} 
     95 
     96//this is to catch any rename reorder or delete route, so i can fix custom contexts 
     97function customcontexts_hookProcess_core($viewing_itemid, $request) { 
     98  switch ($request['display']) { 
     99        case 'routing': 
     100      if(isset($request['Submit'])) { 
     101//        $route = substr($viewing_itemid,4); 
     102//        $priority = (int)(substr($viewing_itemid,0,3)); 
     103      }  
     104      switch ($request['action']) { 
     105        case 'delroute': 
     106//          $route = substr($viewing_itemid,4); 
     107          $priority = (int)(substr($viewing_itemid,0,3)); 
     108          customcontexts_routing_prioritize($request['action'],$priority); 
     109        break; 
     110        case 'prioritizeroute': 
     111          $fullroute = $viewing_itemid; 
     112          if (isset($request['reporoutekey'])) { 
     113                    $outbound_routes = core_routing_getroutenames(); 
     114            $fullroute = $outbound_routes[(int)$request['reporoutekey']][0]; 
     115                } 
     116//          $route = substr($fullroute,4); 
     117          $priority = (int)(substr($fullroute,0,3)); 
     118          $direction = $request['reporoutedirection']; 
     119          customcontexts_routing_prioritize($request['action'],$priority,$direction); 
     120        break; 
     121        case 'renameroute'; 
     122          $newname = $request['newroutename']; 
     123          $route = $viewing_itemid; 
     124          $priority = (substr($viewing_itemid,0,3)); 
     125                    $fullnewname = 'outrt-'.$priority.'-'.$newname; 
     126                    $fullroutename = 'outrt-'.$route; 
     127          customcontexts_routing_editname($fullroutename,$fullnewname); 
     128        break; 
     129        default: 
     130     
     131        break; 
     132      } 
    92133    break; 
    93134  } 
     
    447488         $currentcomponent->addguielem('_top', new gui_hidden('action', ($extdisplay ? 'edit' : 'add'))); 
    448489    $currentcomponent->addguielem('_bottom', new gui_link('help', _(customcontexts_getmodulevalue('moduledisplayname')." v".customcontexts_getmodulevalue('moduleversion')), 'http://www.freepbx.org/support/documentation/module-documentation/third-party-unsupported-modules/customcontexts', true, false), 0); 
     490    $currentcomponent->addguielem('_bottom', new gui_link('bounty', 'Module Going END OF LIFE - Click For Details', 'http://www.freepbx.org/bounties/custom-context', true, false), 0); 
    449491    if (!$extdisplay) { 
    450492      $currentcomponent->addguielem('_top', new gui_pageheading('title', _("Add Context"), false), 0); 
     
    864906    $info = ''; 
    865907    $currentcomponent->addguielem('_bottom', new gui_link('ver', _(customcontexts_getmodulevalue('moduledisplayname')." v".customcontexts_getmodulevalue('moduleversion')), 'http://www.freepbx.org/support/documentation/module-documentation/third-party-unsupported-modules/customcontexts', true, false), 0); 
     908    $currentcomponent->addguielem('_bottom', new gui_link('bounty', 'Module Going END OF LIFE - Click For Details', 'http://www.freepbx.org/bounties/custom-context', true, false), 0); 
    866909    if (!$extdisplay) { 
    867910      $currentcomponent->addguielem('_top', new gui_pageheading('title', _("Add Time Group"), false), 0);