Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Target column substitutions #91

Open
RandyLoeb opened this issue Nov 29, 2019 · 2 comments
Open

Target column substitutions #91

RandyLoeb opened this issue Nov 29, 2019 · 2 comments

Comments

@RandyLoeb
Copy link

I have a number of DMR talk groups I monitor, but it's hard to keep track of their numbers. I started looking at the code and make a little hack to run from the browser console window that substitutes "TG 12345" with the friendly name I want to see displayed:
reloadLastHerd = function (){
$.get("/mmdvmhost/lh.php",null,function(responseText, textStatus, jqXHR){
console.log("hello");
$("#lastHerd").html(responseText
//add your mappings here
.replace(/TG 3112/g,"Florida 3112")
.replace(/TG 31124/g,"South-East-Flori (DMR NET)")
.replace(/TG 31622/g,"South East FL (SW Ranches)")
.replace(/TG 31777/g,"DX Link/NQR Net")
.replace(/TG KI7WKZ/g,"East Coast Reflector")
//etc...
);
setTimeout(reloadLastHerd,1500)
});
}

Very hacky, so I'd like to handle this directly in lh.php. Basically lh.php would have access to a lookup table pairing TG X with a friendly name, and would simply replace with the friendly name (or maybe offer hover-over to see the id). Take javascript out of the equation.

Question is where would be a good place to keep this lookup table, and is there already a gui in place to let users edit such a table? I'm a little new to the software and have been just skimming the code, so figure I'd ask. 73 Randy KN4YRM

@AndyTaylorTweet
Copy link
Owner

AndyTaylorTweet commented Nov 29, 2019 via email

@RandyLoeb
Copy link
Author

Hi Andy,

I was thinking to do the work and submit a pull request.

I was not thinking to poll for the TG list, as some of the TGs I monitor don't seem to be listed, and further I like to name them myself to match whatever I put in the radio. I was just thinking a simple key/value pair lookup in either its own file or some section of an existing config file you might recommend as being a good place. The user goes and fills in this table themselves manually for just the TGs they care about.

For example, lh.php would check for existence of that file, if not there it does nothing. If the file exists though, it opens it and parses it and now it has its lookup table for simple string replacement of matching TGs on the way out. I guess the barebones way then would be to add this to lh.php, and "advanced" users could shell to the filesystem or otherwise move a simple text comma-delimited file over to a pre-defined directory (though would be nice to offer a gui). This is probably what I'll do for myself, as I'm not sure my javascript hack above will work in my phone browser.

As an aside, not sure what you're thinking for re-design but fwiw I work in software, including front end js frameworks, over the years jquery like you're using now, knockoutjs, some angular and lately a lot of reactjs. Worked many years ago heavily in php, was nice to see it's still around. Well anyway if you ever want to discuss re-write ideas let me know. [email protected]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants