Location Mapping Regex *Substitute*

I would like to add a feature request for location mapping that doesn’t replace the entire location string, but only part of it. I don’t want to drag the city/street/coordinates into every device’s sysLocation, but I want to keep Rack/Room info.
So what I want is on the device

sysLocation R401,OvalOffice,WHITE

And in the config something like:

$config[‘location_map_regex_sub’][‘/WHITE/’] = “1600 Pennsylvania Ave NW, Washington, DC 20500 [38.8981316,-77.0368046]”

which would result in (keeping rack/room intact. Yes, I doubt that the Oval Office has a rack!)

R401,OvalOffice,1600 Pennsylvania Ave NW, Washington, DC 20500 [38.8981316,-77.0368046]

I currently have a working implementation of that (with the little coding knowledge that I have) - it’s a small patch to ./includes/polling/core.inc.php and ./includes/rewrites.php which I’ll gladly and freely share/submit if there’s any interest.

Regards,
Frank

Just submit it and we’ll code review it :slight_smile:

I’ll try that as soon as I figure out the entire git thing (or can I email the 10 lines as a context diff to someone?)
Fingers crossed… never done “git” before - old school “patch/diff -c” guy here…

Frank

You need to sign the CLA, we can’t accept code contributions any other way.

You can just edit the files within github.com directly (make sure you are in the new branch when selecting the second file), you can then submit a pull request straight in github.

1 Like