Small changes to detail pages and change tellstick plugin to write in UTF-8

Former-commit-id: 90320b2bd13c134c0e3ec447759443af3303de42
This commit is contained in:
Ziver Koc 2016-01-25 16:20:16 +01:00
parent b1464d9508
commit ff9709b6d2
4 changed files with 23 additions and 7 deletions

View file

@ -31,6 +31,7 @@ import zutil.log.OutputStreamLogger;
import zutil.struct.TimedHashSet; import zutil.struct.TimedHashSet;
import java.io.*; import java.io.*;
import java.nio.charset.Charset;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
@ -171,8 +172,9 @@ public class TellstickSerialComm implements Runnable, HalSensorController, HalEv
} }
public void write(String data) { public void write(String data) {
try { try {
for(int i=0; i<data.length();i++) //for(int i=0; i<data.length();i++)
out.write(0xFF & data.charAt(i)); // out.write(0xFF & data.charAt(i));
out.write(data.getBytes(Charset.forName("UTF-8")));
out.write('\n'); out.write('\n');
out.flush(); out.flush();
} catch (IOException e) { } catch (IOException e) {

View file

@ -8,7 +8,7 @@
<thead> <thead>
<tr> <tr>
<th class="text-right">Name:</th> <th class="text-right">Name:</th>
<td>{{event.getName()}}</td> <th>{{event.getName()}}</th>
</tr> </tr>
</thead> </thead>
<tr> <tr>
@ -17,8 +17,14 @@
</tr> </tr>
<tr> <tr>
<th class="text-right">Owner:</th> <th class="text-right">Owner:</th>
<td>{{event.getUser().getUsername()}}</td> <td>{{event.getUser().getUsername()}} <p></td>
</tr> </tr>
{{#event.getDeviceConfig().getConfiguration()}}
<tr>
<th class="text-right">{{.getNiceName()}}:</th>
<td>{{.getString()}}</td>
</tr>
{{/event.getDeviceConfig().getConfiguration()}}
</table> </table>
</div> </div>
</div> </div>

View file

@ -34,7 +34,9 @@ $.fn.relTimestamp = function() {
var timestampNow = Date.now(); var timestampNow = Date.now();
var timeDiff = timestampNow - timestamp; var timeDiff = timestampNow - timestamp;
if(timeDiff < 24 * 60 * 60 * 1000) // less than 24 hours if(timeDiff < 10 * 60 * 1000) // less than 10 min
$(this).text(moment(timestamp).fromNow());
else if(timeDiff < 24 * 60 * 60 * 1000) // less than 24 hours
$(this).text(moment(timestamp).fromNow() + " ("+moment(timestamp).format("HH:mm")+")"); $(this).text(moment(timestamp).fromNow() + " ("+moment(timestamp).format("HH:mm")+")");
else else
$(this).text(moment(timestamp).format("YYYY-MM-DD HH:mm")); $(this).text(moment(timestamp).format("YYYY-MM-DD HH:mm"));

View file

@ -38,7 +38,7 @@
<thead> <thead>
<tr> <tr>
<th class="text-right">Name:</th> <th class="text-right">Name:</th>
<td>{{sensor.getName()}}</td> <th>{{sensor.getName()}}</th>
</tr> </tr>
</thead> </thead>
<tr> <tr>
@ -51,8 +51,14 @@
</tr> </tr>
<tr> <tr>
<th class="text-right">Owner:</th> <th class="text-right">Owner:</th>
<td>{{sensor.getUser().getUsername()}}</td> <td>{{sensor.getUser().getUsername()}} <p></td>
</tr> </tr>
{{#sensor.getDeviceConfig().getConfiguration()}}
<tr>
<th class="text-right">{{.getNiceName()}}:</th>
<td>{{.getString()}}</td>
</tr>
{{/sensor.getDeviceConfig().getConfiguration()}}
</table> </table>
</div> </div>
</div> </div>