hektiker1983 / openhab

Automatically exported from code.google.com/p/openhab
0 stars 0 forks source link

Icons with a space in the name not displayed #311

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1.Item String is two words ie: "Partly Cloudy"
2.icon has a space in the name ie: "w-partly cloudy.png"
3.

What is the expected output? What do you see instead?
No image is displayed

What version of the product are you using? On what operating system?
1.2

Please provide any additional information below.
Solution possibility
transform spaces to be url friendly?
ie: if the icon was "w-partly%20cloudy.png" and all spaces were transformed to 
%20 when referencing the icon?

Original issue reported on code.google.com by g.g.r...@gmail.com on 23 May 2013 at 4:35

GoogleCodeExporter commented 8 years ago
Seems this is an issue with the greent ui, habdroid and ios clients.  Works 
just fine with the classic ui

Original comment by g.g.r...@gmail.com on 26 May 2013 at 3:45

GoogleCodeExporter commented 8 years ago
There are two issues with openHAB 1.2.0 if the icon name contains a hyphen 
("-"):

1. Everything in the name of the icon after and including the hyphen is 
ignored. So "<lock-open>" and "<lock-closed>" both get displayed as "lock.png".

2. The binding configuration is ignored. openHAB does not call 
BindingConfigReader.validateItemType() and 
BindingConfigReader.processBindingConfiguration().

Steps to reproduce (with the NTP addon):

Item configuration:
  DateTime DateNotWorking "Not working [%1$tD %1$tT]" <lock-open> { ntp="Europe/Berlin:de_DE" }
  DateTime DateWorking    "Working     [%1$tD %1$tT]" <lock>      { ntp="Europe/Berlin:de_DE" }

Sitemap configuration:
  Text item=DateWorking
  Text item=DateNotWorking

It helps to set "ntp:refresh=10000" in openhab.cfg.

Both entries will show the same icon "lock.png" and the event log shows that 
"DateNotWorking" ist not updated. This happen also with the Classic UI.

This comment is a follow-up of 
http://code.google.com/p/openhab/issues/detail?id=321.

Original comment by planetre...@gmail.com on 4 Jun 2013 at 10:06

GoogleCodeExporter commented 8 years ago
Icons with a hyphen are working, if the name is put into quotes (single or 
double).

So the above item configuration is working with the following syntax:

  DateTime Date "Date/time [%1$tD %1$tT]" <'lock-open'> { ntp="Europe/Berlin:de_DE" }

Reason is, that icon is defined as
  '<' icon=(ID|STRING) '>'
and that ID does not allow a hyphen ("-"). Putting the name into single or 
double quotes will use the terminal STRING, which allows (almost) any character.

IMHO blanks should work too, if the name is put into quotes. I will verify that.

Original comment by planetre...@gmail.com on 4 Jun 2013 at 2:20

GoogleCodeExporter commented 8 years ago
Although this solution is not very obvious, it is absolutely correct.
Can I assume that we can hence reject this issue?

Original comment by kai.openhab on 9 Jun 2013 at 3:52

GoogleCodeExporter commented 8 years ago
Forgot to update: Blanks work too if used inside of quotes.

Before you close the issue:

I didn't look at the code yet, but why is the icon defined as an "ID" in the 
xtext file:
   icon=(ID|STRING)

Is this id used in the code? Why not something like
   icon=(FILENAME|STRING)
and define a terminal like the following:
   terminal FILENAME _whatever letters are allowed in file names_

Original comment by planetre...@gmail.com on 10 Jun 2013 at 8:20

GoogleCodeExporter commented 8 years ago
Tried the quotes solution, both double and single.
All work fine with the classic UI, but the icon fails to show in Habdroid, IOS 
client and GreenT UI.  Is this more an issue with the clients?

Original comment by g.g.r...@gmail.com on 11 Jun 2013 at 1:20

GoogleCodeExporter commented 8 years ago
That's correct. Spaces in icon names (in single or double quotes) do not work 
on the Android and iOS client. They do work with the classic UI in the Chrome 
browser on both devices.

IMHO the best solution would be (like already suggested in the initial comment 
of this issue), that openHAB encodes the names before sending them to the 
client.

Original comment by planetre...@gmail.com on 11 Jun 2013 at 9:38

GoogleCodeExporter commented 8 years ago
A provided a fix for the escaping problem of the icon names in URIs. See 
https://code.google.com/r/planetrennermartin-openhab-icon-uri/source/detail?r=7e
81e213965e9808704d5a43f75f2d906769b07b

Original comment by planetre...@gmail.com on 13 Jun 2013 at 9:48

GoogleCodeExporter commented 8 years ago
The first fix only repaired the URL escaping for the classic ui.

I added a second fix 
(http://code.google.com/r/planetrennermartin-openhab-icon-uri/source/detail?r=76
776586c06e78e66ef5d944a181debabfed8965) for the REST API. Now icons with 
special characters also work on Habdroid and on the iOS client.

Original comment by planetre...@gmail.com on 15 Jun 2013 at 3:06

GoogleCodeExporter commented 8 years ago
Thanks for the proposed fixes. I am fine with the first one (for the Classic 
UI), but I think the change in the REST API is not valid - the REST response 
contains the icon name and not a URI to it; so the encoding should actually be 
done by the clients when assembling the URI.

Original comment by kai.openhab on 15 Jun 2013 at 7:28

GoogleCodeExporter commented 8 years ago
Okay, so just take the first fix. I already thought something like that and 
that's the reason why I did not change ItemUIRegistryImpl.getIcon(Widget) but 
rather the renderers.

Original comment by planetre...@gmail.com on 16 Jun 2013 at 6:51

GoogleCodeExporter commented 8 years ago
Will do. Just before pulling the fix: Could you briefly confirm that you are 
fine with the licensing terms at 
https://code.google.com/p/openhab/wiki/HowToContribute, i.e. that you allow us 
to use the code under GPL & EPL?

Original comment by kai.openhab on 16 Jun 2013 at 9:00

GoogleCodeExporter commented 8 years ago
I agree with both licenses - GPL and EPL - and grant you the respective rights.

Original comment by planetre...@gmail.com on 17 Jun 2013 at 7:41

GoogleCodeExporter commented 8 years ago
Thanks, I pulled the fix for the Classic UI: 
https://code.google.com/p/openhab/source/detail?r=2710ddffb234ddc2d5a30f6ce0a8f2
2b1ef09588

@Victor, would you be able to fix the same for HABDroid (i.e. do 
RFC2396-escaping when assembling the icon uri)?

Original comment by kai.openhab on 17 Jun 2013 at 11:06

GoogleCodeExporter commented 8 years ago
Fixed in the current build.

Original comment by belovic...@gmail.com on 22 Jul 2013 at 7:30