Does anybody know how to create an HTML details window which uses an external webpage, like the weather panel ?
I know I should add this:
CODE
<report name="weather">
<![CDATA[
<html>
<head>
</body>
</html>
]]>
</report>
to the dsplugin file but how do I set the details window to use it ?
Another question: How do I add a link to the html webpage which can launch the properties dialog box ? For example, like the weather panel acts when you click the change city link in the details window.
eitaneko
Mar 8 2005, 03:22 PM
I believe the weather panel uses an HTMLDetailsWindow, but it does NOT show an external webpage. I believe it creates its own HTML code to do what it wants. If you want to show an external page, use:
IWebBrowserDetailsWnd::Set(BSTR url);
I think that will get you an external page. You don't need to edit the dsplugin file. That is just where the weather panel stores its information b/c it is a DS built in panel. If you want to do your own HTML code, use an HTMLDetailsWindow, make a long string of the code (or multiple strings concatenated together) and send it to the set function.
To do the properties dialog, the panel uses a bit of javascript to do the trick. I'm not sure exactly how it works (prob using the DOM) but copied from the source:
<A CLASS=A1 onclick="javascript:window.external.ChangeCity();window.event.returnValue=false;" href="" >Click here to change city</A>
I can help you with this, if you wish.
No - the weather panel takes the HTML code from the dsplugin. For examle, when we wanted to have big weather icons in the details window, we changed it within the dsplugin file and we got a modified details window. That's how I want my panel to act so that people will be able to customize their own details window.
I need to know how I use the html from the dsplugin with the panel. I know theres a function called SetExternal() but I don't know how to use that.
I know about that java sciprt code but - what exactly does window.external.ChangeCity() do ?

How do I make it open the details window ? Or any other form ?
Thanks for the reply but I think I need more information
eitaneko
Mar 8 2005, 09:21 PM
You can still store your HTML code in an external TXT file and load the input into a string in your program. That works the same way a DSSKIN does and lets the user change things as they want. It just doesn't have to be the basicpanels.dsplugin file.
ChangeCity is a function in the coding of the the weather panel itself. Since it is in the panel's source, you can call the show properties dialog as you please. The html just references that code when you click on the link. (I think)
GoMa
Mar 8 2005, 09:41 PM
I'm not sure, but I think you can use the globalSettings parameter of Create to get the text from the IXmlNode configRoot node you get in Create, something like that:
CODE
Create(..., ..., ..., ..., ..., IXmlNode configRoot, ..., ..., ..., ...)
{
string reportText = configRoot.GetNode("reports\report[@name=MyReportName]").GetBody();
}
This is VERY untested.

It might be completely wrong.
As eitaneko said - to call an a method of the panel from the html code use something:
CODE
<a onclick="javascript:window.external.MethodName();window.event.returnValue=false;" href="">My link text!</a>
Again, untested and might be something the weather panel implements on its own.
Thanks eitaneko and GoMa

I really appreciate your help

I'll try GoMa's suggestions since I think this is what I need.
Thanks again

I'll tell you if it works.
EDIT:
No - it doesn't work

Maybe I don't do something right, but Ii don't think this is the way to do it.
GoMa
Mar 9 2005, 10:40 AM
QUOTE
No - it doesn't work

Maybe I don't do something right, but Ii don't think this is the way to do it.
You mean the DSPLUGIN reading part or the calling of a method from within the HTML DetWin?
This one: string reportText = configRoot.GetNode("reports\report[@name=MyReportName]").GetBody();
I still haven't tried the java script thing.
GoMa
Mar 9 2005, 11:16 AM
I think there was a misunderstanding here - I thought you put the "report" tag inside a "reports" tag like it is in the basic panels. Try this:
CODE
Create(..., ..., ..., ..., ..., IXmlNode configRoot, ..., ..., ..., ...)
{
string reportText = configRoot.GetNode("report[@name=MyReportName]").GetBody();
}
Thanks but I don't think this is the right way to do it. Maybe KeithI can take a look at the DS source code and tell me how the weather panel does it ?
GoMa
Mar 9 2005, 11:43 AM
I think it's very right way to do it. It's similar to what kdam suggested Prism to do. What's wrong with it? Doesn't it work? I made a little test (not with the actual report node but something else) and it worked ok.
When did Prism used it ? I just think that even if I get teh body of that node, I'll have to remove some text from it since it will be:
<![CDATA[
<html>
<head>
And I don't need the <![CDATA[. It just seems as if it isn't the right way to do it. I still haven't tried it, though. I just think that there's an easier way to do it.
GoMa
Mar 9 2005, 11:58 AM
CDATA just says that the code inside it should not be parsed as XML but as raw text (the body of the containing node).
Prism wanted to know how to get data from the DSPLUGIN file. It's actually the same thing apart from you wanting to get it from the global config and he from the panel config inside the DSPLUGIN file.
And I consider 1 line of code easy.
I also want to get it from the dsplugin. Can you please show me your test app so I'll know how to do it ?
Prism
Mar 9 2005, 12:10 PM
I can't remember when did I do it. GoMa, could you please link me for this thread?
eitaneko
Mar 9 2005, 12:48 PM
yyy, what panel are you trying to do this for anyways? Are you talking about putting this stuff in the basicpanels.dsplugin file, or the dsplugin you distribute with your panel?
It's a new one. I'll tell you soon. I want to get it from the dsplugin of the panel. I don't need those which are in the basicpanels.dsplugin.
eitaneko
Mar 9 2005, 01:00 PM
Got it. That was what I was confused about. Let me know if the javascript stuff works. I might want to use it in the alarm panel as well.
Ok. I believe it works - it doesn't seem too hard to do. But the external webpage thing seems complicated.
GoMa
Mar 9 2005, 10:02 PM
I have this in Create:
CODE
IXmlNode node = configRoot.GetNode("report[@name=abc]");
MessageBox.Show(node.GetBody());
And this in the dsplugin:
CODE
<?xml version="1.0" encoding="utf-8" ?>
<plugin progid="DSPanelTest.Plugin" compatible="88" >
<defaults>
<!-- ..... -->
</defaults>
<report name="abc">
<![CDATA[
<html>
<head>
</body>
</html>
]]>
</report>
</plugin>
It works. The messagebox is shown with:
QUOTE
<html>
<head>
</body>
</html>
That's exactly what I did and it didn't work

I'll try it again later. I also want t oadd informatin from the panel to the webpage and I saw that the weather panel does it using $value$. So - does it mean that I need to "analyze" the string and change it before I set it in the details window ?
GoMa
Mar 10 2005, 06:53 AM
Yes. Use String.Replace.
yyy
Mar 10 2005, 09:32 AM
Oh, thanks

Good idea
yyy
Mar 10 2005, 10:08 AM
Thanks a lot GoMa - it works

Your'e great
GoMa
Mar 10 2005, 10:35 AM
No problem, and thanks.
norlander
Mar 12 2005, 01:58 PM
Hi yyy,
Let me know how you make out with this, I have always liked the weather panel and think that concept would be perfect for my intranet. I would love to be able to view my intranet websites via a panel like the weather panel.
Cheers,
Lee
yyy
Mar 12 2005, 02:28 PM
Hi,
Sorry but I don't think I understand you - why do you need to know how to do it ? Do you develop a panel ?
norlander
Mar 13 2005, 11:39 AM
Hi yyy,
I have not developed a panel yet, but I would be intrested in developing a panel like the weather panel for my intranet.
Cheers,
Lee
yyy
Mar 13 2005, 11:53 AM

Great - I'll be happy to see your panels

If you need any help don't hesitate to ask

So here it is with C#:
In the Create function I add this:
CODE
detailsHTML = configRoot.GetNode("report[@name=reportname]").GetBody();
And in the list OnShowDetails function I add this:
CODE
public void OnShowDetails(IListOutput list, IListRow row)
{
IHTMLDetailsWnd details = m_sidebar.GetControlFactory().CreateHTMLDetailsWnd();
((IDetailsWnd)details).Init(m_sidebar.GetGlobalSettings(),m_sidebar.GetSkinManager(),m_panelConfig, this,"Title");
tagPOINT origin;
origin.x = 0;
origin.y = 0;
tagSIZE size;
size.cx = 0;
size.cy = 0;
((IDetailsWnd)details).Create((int)Handle, (int)EDetailFlags.DC_IGNOREORIGIN | (int)EDetailFlags.DC_IGNORESIZE, ref origin, ref size);
details.Set(detailsHTML);
list.TakeoverDetails(details, row);
}
And in the *.dsplugin write this:
HTML
<?xml version="1.0" encoding="utf-8" ?>
<plugin progid="Panel.Plugin" compatible="86" >
<defaults>
<panel name="Panel" >
<item name="decorated" value="1"/>
<item name="frequency" value="1"/>
</panel>
</defaults>
<report name="reportname">
<![CDATA[
<html>
<head>
</head>
<body>
</body>
</html>
]]>
</report>
</plugin>
I might add this as a top in the SDK Documentation forum.
yyy
Mar 20 2005, 08:17 AM
Just one more thing:
I noticed that the weather panel uses a special command to perform the same action for each day.
For example, it is written:
HTML
$FOR_EACH_ITEM$<<
<TR>
<TD CLASS=$STYLE$ WIDTH=100>
<A target=_blank HREF=$LINK$>$DAY$</A><BR>
$DATE$
</TD>
<TD CLASS=$STYLE$ WIDTH=41><IMG SRC="file://$ICON" BORDER=0></TD>
<TD CLASS=$STYLE$ >$DESCRIPTION$</TD>
<TD CLASS=$STYLE$ WIDTH=63><DIV ALIGN=CENTER><B>$TEMPERATURE$</B></DIV></TD>
</TR>
>>
in order to write the same code for each day which the panel can get weather forecast about.
I want to do the same thing but I don't know how

How can I get the code which appears between $FOR_EACH_ITEM$<< and >> , and then put it back in the string which contains the whole html text ?
I don't know how to find where in the text the $FOR_EACH_ITEM$<< command appears.
Does somebody know what is the easiest way to do it?
GoMa
Mar 20 2005, 08:48 AM
You could use the Regex.Replace method.
yyy
Mar 20 2005, 10:26 AM
Thanks but - maybe you also know how to use Regex.Replace in order to do it ?
Sorry to bother you but I absolutely have no idea how to use it
yyy
Mar 23 2005, 12:02 AM

Someone from Neowin forums (weenur) helped me find how to do it:
I don't need regular expressions - but just to use IndexOf:
CODE
string s1;
const string token1 = "$FOR_EACH_ITEM$<<";
const string token2 = ">>";
s1 = detailsHTML;
s1 = s1.Substring( s1.IndexOf( token1 ) + token1.Length ).Trim();
s1 = s1.Substring( 0, s1.IndexOf( token2 ) ).Trim();
details.Set(s1);
That's it
mgcorr
Jul 23 2007, 03:36 PM
Hi,
I'm trying to show an external web page in a details window and found this thread. What I'd like to do is pass a fixed URL to the details window which points to a dynamic web page so the data can be updated by the server.
I tried using the IWebBrowserDetailsWnd.Set() method, passing it a URL, but this didn't seem to do anything - just a blank details window.
From reading this thread, it sounds like the web page contents to be displayed in the IHTMLDetailsWnd details window is retrieved from within the .dsplugin file. What i'm having trouble following is how the actual web page contents are put into the .dsplugin file. From yyy's posts it looks like all he has is
<report name="abc">
<![CDATA[
<html>
<head>
</body>
</html>
]]>
</report>
How does this get updated and how does this get filled with the full HTML page content?
thanks,
Michael
GoMa
Jul 23 2007, 08:33 PM
You don't have to use the "reports" element. See my answer in your other post.
mike_b1954
Jul 24 2007, 03:53 AM
Hey GoMa !!
CONGRATS ON BREAKING THE 5000 POST BARRIER ! !
GoMa
Jul 24 2007, 11:39 AM
Ooh, didn't notice.

I don't look there too much anymore.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please
click here.