Index: contributed_modules/modules/customcontexts/module.xml =================================================================== --- contributed_modules/modules/customcontexts/module.xml (revision 9592) +++ contributed_modules/modules/customcontexts/module.xml (revision 9817) @@ -2,5 +2,5 @@ customcontexts Custom Contexts - 0.3.6 + 2.8.0.1 setup Third Party Addon @@ -20,8 +20,9 @@ - lt 2.8.0alpha1 + ge 2.8.0alpha1 core + *2.8.0.1* remove End of Life warning, change dependency requirement, fix for FreePBX 2.8 *0.3.6* fix version, End of Life warning, dependency requirement *0.3.5* #3994 current context on extension page not sticking @@ -56,5 +57,5 @@ REMEMBER! Any device placed in a restricted context will have no access to the dialplan if this module is disabled until it is placed in a normal context! - contributed_modules/release/customcontexts-0.3.6.tgz - d1c83f26c53eb3dfbf5d83263155e3eb + contributed_modules/release/customcontexts-2.8.0.1.tgz + Index: contributed_modules/modules/customcontexts/functions.inc.php =================================================================== --- contributed_modules/modules/customcontexts/functions.inc.php (revision 9591) +++ contributed_modules/modules/customcontexts/functions.inc.php (revision 9817) @@ -51,19 +51,13 @@ $i = 0; foreach ($ext->_includes[$section] as $include) { + $i = $i + 1; if ($section == 'outbound-allroutes') { - $i = $i + 1; - $sql = "update customcontexts_includes_list set missing = 0, sort = $i where context = '$section' and include = '$include'"; - $db->query($sql); -//fix prioritized contexts , description = '$include' - $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)"; - $db->query($sql); -//fix allowed prioritized contexts (i did not do , sort = $i, maybe i should) context = '$section' and - $sql = "update customcontexts_includes set include = '$include' where substr(include,1,6) = 'outrt-' and substr(include,10) = substr('$include',10)"; + $sql = "update customcontexts_includes_list set missing = 0, sort = $i, description = '$include[comment]' where context = '$section' and include = '$include[include]'"; $db->query($sql); } else { - $sql = "update customcontexts_includes_list set missing = 0, sort = $i where context = '$section' and include = '$include'"; + $sql = "update customcontexts_includes_list set missing = 0, sort = $i where context = '$section' and include = '$include[include]'"; $db->query($sql); - } - $sql = "INSERT IGNORE INTO customcontexts_includes_list (context, include, description, sort) VALUES ('$section', '$include', '$include', $i)"; + } + $sql = "INSERT IGNORE INTO customcontexts_includes_list (context, include, description, sort) VALUES ('$section', '$include[include]', '$include[include]', $i)"; $db->query($sql); } @@ -93,103 +87,4 @@ } } - -//this is to catch any rename reorder or delete route, so i can fix custom contexts -function customcontexts_hookProcess_core($viewing_itemid, $request) { - switch ($request['display']) { - case 'routing': - if(isset($request['Submit'])) { -// $route = substr($viewing_itemid,4); -// $priority = (int)(substr($viewing_itemid,0,3)); - } - switch ($request['action']) { - case 'delroute': -// $route = substr($viewing_itemid,4); - $priority = (int)(substr($viewing_itemid,0,3)); - customcontexts_routing_prioritize($request['action'],$priority); - break; - case 'prioritizeroute': - $fullroute = $viewing_itemid; - if (isset($request['reporoutekey'])) { - $outbound_routes = core_routing_getroutenames(); - $fullroute = $outbound_routes[(int)$request['reporoutekey']][0]; - } -// $route = substr($fullroute,4); - $priority = (int)(substr($fullroute,0,3)); - $direction = $request['reporoutedirection']; - customcontexts_routing_prioritize($request['action'],$priority,$direction); - break; - case 'renameroute'; - $newname = $request['newroutename']; - $route = $viewing_itemid; - $priority = (substr($viewing_itemid,0,3)); - $fullnewname = 'outrt-'.$priority.'-'.$newname; - $fullroutename = 'outrt-'.$route; - customcontexts_routing_editname($fullroutename,$fullnewname); - break; - default: - - break; - } - break; - } -} - -function customcontexts_routing_editname($route,$newname) { - global $db; -//fix renamed contexts , description = '$include' - $sql = "update customcontexts_includes_list set include = '$newname', description = '$newname', missing = 0 where context = 'outbound-allroutes' and include = '$route'"; - $db->query($sql); -//fix allowed renamed contexts (i did not do , sort = $i, maybe i should) context = 'outbound-allroutes' and - $sql = "update customcontexts_includes set include = '$newname' where include = '$route'"; - $db->query($sql); -} - -function customcontexts_routing_prioritize($action,$priority,$direction=null) { - global $db; - $outbound_routes = core_routing_getroutenames(); - foreach ($outbound_routes as $route) { - $routename = $route[0]; - $routepriority = (int)(substr($routename,0,3)); - switch ($action) { - case 'prioritizeroute': - $addpriority = ($direction=='up')?-1:1; - if ($priority + $addpriority == $routepriority) { - $newpriority = str_pad($priority, 3, "0", STR_PAD_LEFT); - $newroute = 'outrt-'.$newpriority.'-'.substr($routename,4); - } elseif ($priority == $routepriority) { - $newpriority = str_pad($priority + $addpriority, 3, "0", STR_PAD_LEFT); - $newroute = 'outrt-'.$newpriority.'-'.substr($routename,4); - } - if (isset($newroute)) { -//fix prioritized contexts , description = '$newroute' - $sql = "update customcontexts_includes_list set include = '$newroute', description = '$newroute', missing = 0, sort = $newpriority where context = 'outbound-allroutes' and include= 'outrt-$routename'"; -//echo $sql; - $db->query($sql); -//fix allowed prioritized contexts (i did not do , sort = $i, maybe i should) context = 'outbound-allroutes' and - $sql = "update customcontexts_includes set include = '$newroute' where include = 'outrt-$routename'"; -//echo $sql; - $db->query($sql); - } - unset($newroute); - break; - case 'delroute'; - if ($routepriority > $priority) { - $newpriority = str_pad($routepriority - 1, 3, "0", STR_PAD_LEFT); - $newroute = 'outrt-'.$newpriority.'-'.substr($routename,4); -//fix prioritized contexts , description = '$newroute' - $sql = "update customcontexts_includes_list set include = '$newroute', description = '$newroute', missing = 0, sort = $newpriority where context = 'outbound-allroutes' and include= 'outrt-$routename'"; -//echo $sql; - $db->query($sql); -//fix allowed prioritized contexts (i did not do , sort = $i, maybe i should) context = 'outbound-allroutes' and - $sql = "update customcontexts_includes set include = '$newroute' where include = 'outrt-$routename'"; -//echo $sql; - $db->query($sql); - } - unset($newroute); - break; - } - } -} - //this lists all includes from the sql database (for the requsted context) which we parsed out of the dialplan @@ -488,5 +383,4 @@ $currentcomponent->addguielem('_top', new gui_hidden('action', ($extdisplay ? 'edit' : 'add'))); $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); - $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); if (!$extdisplay) { $currentcomponent->addguielem('_top', new gui_pageheading('title', _("Add Context"), false), 0); @@ -652,5 +546,4 @@ $info = 'The custom context to make will be available in your dialplan. These contexts can be used as a context for a device/extension to allow them limited access to your dialplan.'; $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); - $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); if (!$extdisplay) { $currentcomponent->addguielem('_top', new gui_pageheading('title', _("Add Context"), false), 0); @@ -906,5 +799,4 @@ $info = ''; $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); - $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); if (!$extdisplay) { $currentcomponent->addguielem('_top', new gui_pageheading('title', _("Add Time Group"), false), 0);