KS-Soft. Network Management Solutions
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister    ProfileProfile    Log inLog in 

quote in results and compact HTML dashboard

 
Post new topic   Reply to topic    KS-Soft Forum Index -> Configuration, Maintenance, Troubleshooting
View previous topic :: View next topic  
Author Message
plambrecht



Joined: 19 May 2004
Posts: 151
Location: Belgium

PostPosted: Wed Aug 25, 2004 3:50 am    Post subject: quote in results and compact HTML dashboard Reply with quote

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
Back to top
View user's profile Send private message Visit poster's website
KS-Soft



Joined: 03 Apr 2002
Posts: 12795
Location: USA

PostPosted: Thu Aug 26, 2004 12:22 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Visit poster's website
plambrecht



Joined: 19 May 2004
Posts: 151
Location: Belgium

PostPosted: Mon Dec 20, 2004 3:30 am    Post subject: Reply with quote

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 &lt;BR&gt; what is not good
Or would you also add a Reply_DoubleQoute that only replaces the " with &quot;
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
Back to top
View user's profile Send private message Visit poster's website
KS-Soft



Joined: 03 Apr 2002
Posts: 12795
Location: USA

PostPosted: Tue Dec 21, 2004 4:07 pm    Post subject: Reply with quote

Quote:
However, I found that CSTYLE is not always doing the right thing.
It works fine for java-alert things, but not for HTML text


It is doing right thing. It is designed for java, not for HTML

Quote:
Could you add an Reply_HTMLEncode ?
This would encode the special HTML chars...


When HostMonitor generates HTML reports or HTML mail, it translates fields into HTML automatically.

Quote:
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 &lt;BR&gt; what is not good


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...
What exactly do you want to implement?

Regards
Alex
Back to top
View user's profile Send private message Visit poster's website
plambrecht



Joined: 19 May 2004
Posts: 151
Location: Belgium

PostPosted: Tue Dec 21, 2004 4:59 pm    Post subject: Reply with quote

Alex,

Quote:
When HostMonitor generates HTML reports or HTML mail, it translates fields into HTML automatically.

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...

Quote:
Do you mean some of your scripts uses UDV variable as Reply string? And this UDV variable contains some HTML codes?

Yes..
As suggested for the new email-in-html format.... seems to work also for reports

Pieter
Back to top
View user's profile Send private message Visit poster's website
KS-Soft



Joined: 03 Apr 2002
Posts: 12795
Location: USA

PostPosted: Tue Dec 21, 2004 5:08 pm    Post subject: Reply with quote

Quote:
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...


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.

Regards
Alex
Back to top
View user's profile Send private message Visit poster's website
plambrecht



Joined: 19 May 2004
Posts: 151
Location: Belgium

PostPosted: Wed Dec 22, 2004 2:15 am    Post subject: Reply with quote

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....)
Back to top
View user's profile Send private message Visit poster's website
KS-Soft



Joined: 03 Apr 2002
Posts: 12795
Location: USA

PostPosted: Wed Dec 22, 2004 8:47 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Visit poster's website
plambrecht



Joined: 19 May 2004
Posts: 151
Location: Belgium

PostPosted: Sun Dec 26, 2004 3:50 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message Visit poster's website
KS-Soft



Joined: 03 Apr 2002
Posts: 12795
Location: USA

PostPosted: Sun Dec 26, 2004 6:55 pm    Post subject: Reply with quote

Quote:
All 3 items work fine with an alert()....


It doesn't work on my system. I tried IE 5.0 and Netscape 7.1. Script Host 5.1 is installed.
What software do you use?

Quote:
Can you add the double quote to be escaped ?


I prefer to find universal solution that will work for everybody.

Quote:
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


Yes, I remember. Can we do that after Christmas?

Regards
Alex
Back to top
View user's profile Send private message Visit poster's website
plambrecht



Joined: 19 May 2004
Posts: 151
Location: Belgium

PostPosted: Mon Dec 27, 2004 3:57 am    Post subject: Reply with quote

I tried them under IE6.1 & Firefox 1.0.. all 3 work fine...
probably a feature of IE5

Enjoy your Christmas and Newyear !

Pieter
Back to top
View user's profile Send private message Visit poster's website
KS-Soft



Joined: 03 Apr 2002
Posts: 12795
Location: USA

PostPosted: Mon Dec 27, 2004 3:10 pm    Post subject: Reply with quote

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 &quot;nameofthetest&quot; ')" is interpreted correctly.
Looks like we need another variable that should use HTML rules for some characters (" -> &quot..) and C/Java rules for other characters (#10 -> \n, #8 -> \t, #13 -> \r)...

Happy New Year

Regards
Alex
Back to top
View user's profile Send private message Visit poster's website
KS-Soft



Joined: 03 Apr 2002
Posts: 12795
Location: USA

PostPosted: Thu Jan 06, 2005 12:31 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Visit poster's website
plambrecht



Joined: 19 May 2004
Posts: 151
Location: Belgium

PostPosted: Fri Jan 07, 2005 2:12 am    Post subject: Reply with quote

Alex...

Thx for the 3 fixes!
I'll keep my eye on the ODBC logging thing.
For the undocumented features.
what variable should I use for the HTML and SQL encoding ?

Pieter
Back to top
View user's profile Send private message Visit poster's website
KS-Soft



Joined: 03 Apr 2002
Posts: 12795
Location: USA

PostPosted: Fri Jan 07, 2005 11:33 am    Post subject: Reply with quote

Use regular variable %Reply%.
HostMonitor resolves test specific (only) variables according to place where you are using variable:
- HTML report or HTML mail
- SQL Query
- anywhere else

Regards
Alex
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    KS-Soft Forum Index -> Configuration, Maintenance, Troubleshooting All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group

KS-Soft Forum Index