quote in results and compact HTML dashboard
- plambrecht
- Posts: 151
- Joined: Wed May 19, 2004 8:11 am
- Location: Belgium
- Contact:
quote in results and compact HTML dashboard
Hi,
As suggested in another post, I'm looking in to the compact html pages to generate a 'Dashboard'.
Works good, for one bug:
when the result contains a single quote character, the HTML code is corrupted:
Result is : enable 'Translate Macros' on the Test Properties
This causes the jscript portion to get corrupted:
<input type=button class=Bad value="16,67 " onclick="showinfo('Test name: \tDiskDelta:\nStatus: \tBad\nLast reply: \tPlease enable 'Translate Macros' on the Test Properties\nReply: \tPlease enable 'Translate Macros' on the Test Properties\n\nLast test time: \t25/08/2004 11:39:13\nInterval: \t00:10:00\nComment: \tDiskDelta\nTest method: \tShell Script\n\nStatus changed at:\t25/08/2004 11:17:53\nTest by: \tHostMonitor\n')">
Can you replace the ' with \' or do some kind of encoding before the text is displayed ?
thx
Pieter
As suggested in another post, I'm looking in to the compact html pages to generate a 'Dashboard'.
Works good, for one bug:
when the result contains a single quote character, the HTML code is corrupted:
Result is : enable 'Translate Macros' on the Test Properties
This causes the jscript portion to get corrupted:
<input type=button class=Bad value="16,67 " onclick="showinfo('Test name: \tDiskDelta:\nStatus: \tBad\nLast reply: \tPlease enable 'Translate Macros' on the Test Properties\nReply: \tPlease enable 'Translate Macros' on the Test Properties\n\nLast test time: \t25/08/2004 11:39:13\nInterval: \t00:10:00\nComment: \tDiskDelta\nTest method: \tShell Script\n\nStatus changed at:\t25/08/2004 11:17:53\nTest by: \tHostMonitor\n')">
Can you replace the ' with \' or do some kind of encoding before the text is displayed ?
thx
Pieter
Done. Update available at www.ks-soft.net/download/hm461.zip
Also we added new variable %LastReply_CStyle%. If you will need to use JavaScript in some "Custom HTML" report, use %Reply_CStyle% and %LastReply_CStyle% variables instead of %Reply% and %LastReply%. It will help to avoid similar problem.
Regards
Alex
Also we added new variable %LastReply_CStyle%. If you will need to use JavaScript in some "Custom HTML" report, use %Reply_CStyle% and %LastReply_CStyle% variables instead of %Reply% and %LastReply%. It will help to avoid similar problem.
Regards
Alex
- plambrecht
- Posts: 151
- Joined: Wed May 19, 2004 8:11 am
- Location: Belgium
- Contact:
Alex,
I found this a very usefull addition to the macro vars...
However, I found that CSTYLE is not always doing the right thing.
It works fine for java-alert things, but not for HTML text.
Could you add an Reply_HTMLEncode ?
This would encode the special HTML chars...
But... I see one problem:
I have UDV's in my reply's that are translated to <br> and other HTML codes...
So if you implement this option, all my <BR>'s are translated to <BR> what is not good
Or would you also add a Reply_DoubleQoute that only replaces the " with "
This one is usefull for the Reply's in report... so that the actual text is retained, but only the problemchar " is fixed...
Or you should start with some kind of functions in the Macro's...
@ToHTML%Reply%@
@ToCStyle%Folder%@
just an idea
regards
Pieter
I found this a very usefull addition to the macro vars...
However, I found that CSTYLE is not always doing the right thing.
It works fine for java-alert things, but not for HTML text.
Could you add an Reply_HTMLEncode ?
This would encode the special HTML chars...
But... I see one problem:
I have UDV's in my reply's that are translated to <br> and other HTML codes...
So if you implement this option, all my <BR>'s are translated to <BR> what is not good

Or would you also add a Reply_DoubleQoute that only replaces the " with "
This one is usefull for the Reply's in report... so that the actual text is retained, but only the problemchar " is fixed...
Or you should start with some kind of functions in the Macro's...
@ToHTML%Reply%@
@ToCStyle%Folder%@
just an idea

regards
Pieter
It is doing right thing. It is designed for java, not for HTMLHowever, I found that CSTYLE is not always doing the right thing.
It works fine for java-alert things, but not for HTML text
When HostMonitor generates HTML reports or HTML mail, it translates fields into HTML automatically.Could you add an Reply_HTMLEncode ?
This would encode the special HTML chars...
Do you mean some of your scripts uses UDV variable as Reply string? And this UDV variable contains some HTML codes? And... I am not sure I follow you...I have UDV's in my reply's that are translated to <br> and other HTML codes...
So if you implement this option, all my <BR>'s are translated to <BR> what is not good
What exactly do you want to implement?
Regards
Alex
- plambrecht
- Posts: 151
- Joined: Wed May 19, 2004 8:11 am
- Location: Belgium
- Contact:
Alex,
I get a lot of errors on my pages when my reply contains certain characters like the double quote..
I'm talking about reports here...
As suggested for the new email-in-html format.... seems to work also for reports
Pieter
does it ?When HostMonitor generates HTML reports or HTML mail, it translates fields into HTML automatically.
I get a lot of errors on my pages when my reply contains certain characters like the double quote..
I'm talking about reports here...
Yes..Do you mean some of your scripts uses UDV variable as Reply string? And this UDV variable contains some HTML codes?
As suggested for the new email-in-html format.... seems to work also for reports

Pieter
HostMonitor does not replace double quotes because it should not be a problem... unless... you are using Reply variable for HTML tags?? Please provide more information about problem.does it ?
I get a lot of errors on my pages when my reply contains certain characters like the double quote..
I'm talking about reports here...
Regards
Alex
- plambrecht
- Posts: 151
- Joined: Wed May 19, 2004 8:11 am
- Location: Belgium
- Contact:
Alex,
Double quotes are a problem...
With your own templates, I have issues when a reply containes a double quote...
With the report, you have colored buttons, that you can click that show the current status:
<input type=button class=OutOfSchedule value="%REPLY%" onclick="showinfo('some suff, including %REPLY% and %LASTREPLY%')">
If the reply containes a double quote, the HTML code is messed up...
P.
(Strange that no-one else has this problem....)
Double quotes are a problem...
With your own templates, I have issues when a reply containes a double quote...
With the report, you have colored buttons, that you can click that show the current status:
<input type=button class=OutOfSchedule value="%REPLY%" onclick="showinfo('some suff, including %REPLY% and %LASTREPLY%')">
If the reply containes a double quote, the HTML code is messed up...
P.
(Strange that no-one else has this problem....)
Java works strange...
E.g.
- this code works fine showinfo("test \"nameofthetest\"")
- this code works fine as well showinfo('test \'nameofthetest\'')
but this code does not work showinfo("test \'nameofthetest\'")
I mean, if string is concluded into single quotation marks, we should use \' for single quotation marks inside the string. But \" will not work correctly in this case.
If string is concluded into double quotation marks, we should use \" for double quotation marks inside the string. But \' will not work correctly in this case.
Why? I don't know, may be some bug in script processor...
It means \" and \' cannot be used in the same string. Possible solution: use \042 and \047 codes instead. But it could have some sideeffects, e.g. I am not sure SQL servers will accept such codes in SQL Query....
Regards
Alex
E.g.
- this code works fine showinfo("test \"nameofthetest\"")
- this code works fine as well showinfo('test \'nameofthetest\'')
but this code does not work showinfo("test \'nameofthetest\'")
I mean, if string is concluded into single quotation marks, we should use \' for single quotation marks inside the string. But \" will not work correctly in this case.
If string is concluded into double quotation marks, we should use \" for double quotation marks inside the string. But \' will not work correctly in this case.
Why? I don't know, may be some bug in script processor...
It means \" and \' cannot be used in the same string. Possible solution: use \042 and \047 codes instead. But it could have some sideeffects, e.g. I am not sure SQL servers will accept such codes in SQL Query....
Regards
Alex
- plambrecht
- Posts: 151
- Joined: Wed May 19, 2004 8:11 am
- Location: Belgium
- Contact:
All 3 items work fine with an alert()....
The thing is that a double quote is not escaped in the reply_cstyle...
I'm (and your defautl html templates) use it in a html tag...
Can you add the double quote to be escaped ?
SQL is another issue...
in MySQL a single quote has to be escaped as a \'
in MS-SQL a single quote has to be escaped as 2 signle quotes
thx
P.
The thing is that a double quote is not escaped in the reply_cstyle...
I'm (and your defautl html templates) use it in a html tag...
Can you add the double quote to be escaped ?
SQL is another issue...
in MySQL a single quote has to be escaped as a \'
in MS-SQL a single quote has to be escaped as 2 signle quotes
thx
P.
It doesn't work on my system. I tried IE 5.0 and Netscape 7.1. Script Host 5.1 is installed.All 3 items work fine with an alert()....
What software do you use?
I prefer to find universal solution that will work for everybody.Can you add the double quote to be escaped ?
Yes, I remember. Can we do that after Christmas?SQL is another issue...
in MySQL a single quote has to be escaped as a \'
in MS-SQL a single quote has to be escaped as 2 signle quotes
Regards
Alex
- plambrecht
- Posts: 151
- Joined: Wed May 19, 2004 8:11 am
- Location: Belgium
- Contact:
H'm, I tried IE 6.00 and Opera 7.54 - browsers do not work with string like ...="showinfo(' test \"nameofthetest\" ')" either.
But string like '...="showinfo(' test "nameofthetest" ')" is interpreted correctly.
Looks like we need another variable that should use HTML rules for some characters (" -> "..) and C/Java rules for other characters (#10 -> \n, #8 -> \t, #13 -> \r)...
Happy New Year
Regards
Alex
But string like '...="showinfo(' test "nameofthetest" ')" is interpreted correctly.
Looks like we need another variable that should use HTML rules for some characters (" -> "..) and C/Java rules for other characters (#10 -> \n, #8 -> \t, #13 -> \r)...
Happy New Year

Regards
Alex
Ok, this update should fix the problem: www.ks-soft.net/download/hm494.zip
This is "unofficial" update, means there are some undocumented modifications. It was tested and seems to be working fine but it was not tested much. So, better if you keep your eyes on it for a while.
Regards
Alex
This is "unofficial" update, means there are some undocumented modifications. It was tested and seems to be working fine but it was not tested much. So, better if you keep your eyes on it for a while.
Regards
Alex
- plambrecht
- Posts: 151
- Joined: Wed May 19, 2004 8:11 am
- Location: Belgium
- Contact: