简体   繁体   English

Sharepoint 2007天气网络部分

[英]Sharepoint 2007 weather web part

What is the best way to implement a weather web part for 2007 sharepoint. 实现2007 sharepoint的天气Web部件的最佳方法是什么? I want the web part to automatically select the correct location based on the users profile settings or maybe IP range. 我希望Web部件根据用户配置文件设置或IP范围自动选择正确的位置。

Or should I make the webparts connectable to another webpart where the user enters the location? 或者我应该将webparts连接到用户输入位置的另一个webpart吗?

I would appreciate guidance on how to do this. 我很感激如何做到这一点的指导。

Many Thanks, 非常感谢,

A connection is probably not needed, all logic could be contained in the webpart (plus maybe custom editorpart). 可能不需要连接,所有逻辑都可以包含在webpart中(加上可能是自定义编辑器部分)。 If you make the webpart configurable by end users it needs to be personalizable at the least. 如果您使最终用户可以配置webpart,则至少需要个性化。

There are sites (like Yahoo weather) that have javascript API's to get weather info based on zipcode / location. 有些网站(如雅虎天气)有javascript API来获取基于邮政编码/位置的天气信息。 To get a user's geographical location, you need an IP to location database. 要获取用户的地理位置,您需要一个IP到位置数据库。

You could use MaxMind's GeoLite City free database, it maps IP addresses to geographical locations. 您可以使用MaxMind的GeoLite City免费数据库,它将IP地址映射到地理位置。 Because it's free it is not accurate up to a meter, but for weather i'd say accurate enough. 因为它是免费的,它不准确达到一米,但对于天气,我说的足够准确。 The database is updated monthly and comes in both binary and csv format (so you could import the csv into a SQL database). 数据库每月更新,并以二进制和csv格式提供(因此您可以将csv导入SQL数据库)。 More info here . 更多信息在这里

Once you have a geographical location you can use Yahoo's weather API to get the info. 获得地理位置后,您可以使用Yahoo的天气API来获取信息。 Then parse and style the result. 然后解析并设置结果样式。

PS GeoLite City is just an example, there are similar products out there, this is just the one I found googling, I Have no affiliation with them or anything like that. PS GeoLite City只是一个例子,那里有类似的产品,这只是我发现的谷歌搜索,我没有与他们或类似的东西。

The simplest way is to simply add in a Page Viewer web part, and use this for a the link: 最简单的方法是简单地添加一个页面查看器Web部件,并将其用于链接:

http://www.bing.com/webslices/answer.aspx?q=weather&a=WeatherAnswer&s=Weather&form=IE8WSV http://www.bing.com/webslices/answer.aspx?q=weather&a=WeatherAnswer&s=Weather&form=IE8WSV

That will display the weather for the current user's general IP address area. 这将显示当前用户的常规IP地址区域的天气。 You can customize the link to include specific zip codes, if you like, by chaing the "q=weather" to "q=weather XXXXX", where XXXXX is the zip code. 如果您愿意,可以通过将“q = weather”改为“q = weather XXXXX”来自定义链接以包含特定的邮政编码,其中XXXXX是邮政编码。

The next simplest is to use a Content Editor Web Part, and choose any of the weather gadgets on Google Gadgets. 下一个最简单的方法是使用内容编辑器Web部件,并选择Google小工具上的任何天气小工具。 Once you find one you like in the Google Gadget area, click on "Get the Code", and then copy and pase the code into the "Source Editor..." area of the Content Editor Web Part. 在Google Gadget区域中找到您喜欢的一个后,单击“获取代码”,然后将代码复制并压缩到内容编辑器Web部件的“源编辑器...”区域。

If you would like a finished, free solution, you can use the Bamboo Solutions weather web part that they donated to the Community Kit for SharePoint project. 如果您想要一个完整的免费解决方案,您可以使用他们捐赠给Community Kit for SharePoint项目的Bamboo Solutions天气Web部件。

I'd post a link to that project, but the built-in spam protection here limits me to one link per answer. 我发布了一个指向该项目的链接,但这里内置的垃圾邮件保护限制了每个答案一个链接。 Do a google search for CKS Weather, and you will get the link from the first hit. 谷歌搜索CKS天气,你会得到第一个点击的链接。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM