Problems trying to configure google maps in email templates

bemeto20177 years ago

I am trying that when I receive notifications by email, I can follow the link to see the location in google maps.

I know that for this i need to modify the parameter in the templates but I do not understand the syntax

I am editing the geofenceEnter.vm file. I try to enter the web url of google maps "https://www.google.com/maps/search/?api=1"

I understand that the line to edit is this: href="$webUrl?eventId=$event.id">#{if}($position.address)$position.address#{else}$position.latitude°, $position.longitude°#{end}
"

I have tried in many different ways to insert the url of google maps without results.

I would be very grateful if someone would tell me what the correct syntax is.

Regards.

Anton Tananaev7 years ago

So what does your template look like?

bemeto20177 years ago

Hi anton

My template had many looks, I tried inserting the url of google maps in different parts of the line without any positive result. I have tried with more than 30 combinations

Ahora estaba intentando editar el archivo deviceOnline.vm

For example:

#set($subject = "$device.name: online")
<!DOCTYPE html>
<html>
<body>
Device: $device.name<br>
Online<br>
Time: $dateTool.format("YYYY-MM-dd HH:mm:ss", $event.serverTime, $locale, $time$
Point: <a href="https://www.google.com/maps/search/?api=1?#{if}($position.addre$
</body>
</html>
Anton Tananaev7 years ago

Your text editor has cut lines in your template.

bemeto20177 years ago

Yes, I know. That is just when I copy the text in this post.

really when I do the edits tests directly in the .vm file I do not copy and paste from the text editor.

could you put an example of how to put the URL in the file line? would be a great help.

Regards.

Anton Tananaev7 years ago

No, I can check your one and see if I can find any issues. Also, what do you get in the result? What is the problem?

bemeto20177 years ago
#set($subject = "$device.name: moving")
<!DOCTYPE html>
<html>
<body>
Device: $device.name<br>
Online<br>
Time: $dateTool.format("YYYY-MM-dd HH:mm:ss", $event.serverTime, $locale, $timezone)<br>
Point: <a href="https://www.google.com/maps/search/?api=1?eventId=$event.id">#{if}($position.address)$position.address#{else}$position.latitude&deg;, $position.longitude&deg;#{end}</a><br>
</body>
</html>

The result its a text "Device: Audi A3
Online
Time: 2017-09-20 21:33:57
Point: $position.latitude°, $position.longitude°" linked to: http://127.0.1.1:8082/?eventId=17114

But as I said, I have tried another twenty or thirty forms, with similar results.

I do not understand the syntax, so I ask for help.

Regards.

bemeto20177 years ago

Hi Anton. the forum hiden part of the text for the href tag:

Please see a screenshot

http://oi63.tinypic.com/290zgqo.jpg

Anton Tananaev7 years ago

That is not possible. You are definitely missing something. If you changed the template, there is no way Traccar can send the old one.

abyss7 years ago

@bemeto2017
Google know nothing about internal traccar eventId, you should use coordinates to construct link.
We had links to openstreetmap in the first variants of templates https://github.com/tananaev/traccar/blob/6c64c6e87a25b4d2339f2fd8d83fa4bc36d461f2/templates/mail/geofenceEnter.vm#L7
It might help you.

bemeto20177 years ago

@abyss
Sorry to tell you that your code does not work for me. I copied line 7 from the code in my file deviceMoving.vm

I receive the email with this lnik: https://www.openstreetmap.org/?mlat=$position.latitude&mlon=$position.longitude#map=16/$position.latitude/$position.longitude

The code has pasted in my file directly from github whith the option copy line

abyss7 years ago

Could you post here template and email source (body part). Please don't forget format it with Markdown.

bemeto20177 years ago
#set($subject = "$device.name: moving") 
<!DOCTYPE html>
<html>
<body>
Device: $device.name<br>
Online<br>
Time: $dateTool.format("YYYY-MM-dd HH:mm:ss", $event.serverTime, $locale, $timezone)<br>
Point: <a href="https://www.openstreetmap.org/?mlat=$position.latitude&mlon=$position.longitude#map=16/$position.latitude/$position.longitude">#if($position$
</body>
</html>
bemeto20177 years ago

I try use the markdown but like dont work

i no very good in sintax, sorry

abyss7 years ago

You should use 3 grave accent marks, please read the help carefully.