GUI enhancement - jump to targets of drawselects()

Sorry if this isn’t the right place for this – but I wrote a little snippet of PHP that really helps and I’d like to pass it on.

I think one thing that’s missing is the ability to easily jump from screen to screen. I detest having to look at, for example, what an IVR menu is pointing to, then go back to the main menu, select the appropriate option, then dig through the right side menu to find the screen to configure that option. This hack I’ve got below just adds a GO button to bounce the user straight to the config screen for whatever the option points to. I stuck this in the drawselects() function which makes these links come up in any context where the select boxes are shown.

Please note this is 100% hack and I’m sure a real developer could clean it up significantly. I’m a perl guy and making php do things for me is like pulling teeth. So, my apologies.

Anyway, in functions.inc.php, I added the following MESSY code at line 2082 in my copy of FreePBX which is a PBX in a Flash system upgraded to FreePBX 2.8.0.3. I only included code for a few of the modules – the ones I use, so if someone was going to put this in the actual platform, I’d assume they’d want to do some more work on it. Nonetheless, I think you should be able to see its usefulness.

This follows the line:
if(isset($drawselects_module_hash[‘Error’])){unset($drawselects_module_hash[‘Error’]);}

And comes before the line:
if($table){$html.=’’;}//wrap in table tags if requested

My added hacky/messy php:

if ( preg_match("/^ext-group/",$goto) ) {
$words = preg_split("/,/",$goto);
$html .= ‘[GO]’;
}
elseif ( preg_match("/^app-announcement-/",$goto) ) {
$words = preg_split("/,/",$goto);
$words2 = preg_split("/-/",$words[0]);
$html .= ‘[GO]’;
}
elseif ( preg_match("/^ivr-/",$goto) ) {
$words = preg_split("/,/",$goto);
$words2 = preg_split("/-/",$words[0]);
$html .= ‘[GO]’;
}
elseif ( preg_match("/^ext-queues,/",$goto) ) {
$words = preg_split("/,/",$goto);
$html .= ‘[GO]’;
}
elseif ( preg_match("/^timeconditions,/",$goto) ) {
$words = preg_split("/,/",$goto);
$html .= ‘[GO]’;
}
elseif ( preg_match("/^from-did-direct,/",$goto) ) {
$words = preg_split("/,/",$goto);
$html .= ‘[GO]’;
}
elseif ( preg_match("/^ext-local,vm./",$goto) ) {
$words = preg_split("/,/",$goto);
$words2 = preg_split("/vm./",$words[1]);
$html .= ‘[GO]’;
}

Can i offer you some dentures? :wink:
The code looks interesting. Please open a ticket on trac and include a patch against trunk.