Wednesday, March 28, 2007

 

Gantt chart for WSS 3

Some people have recently asked me about using my Gantt chart web part on WSS3 or MOSS 2007. I assumed that it would just work, WSS3 being more or less backward compatible with WSS2, but alas. It turns out that the web part itself works just fine, but the MSI installer that worked like a charm on WSS2, fails tragically on WSS3. So I just packaged the web part in a WSS3 solution. You can download the .wsp file and a batch file to install it here. Note that after installing the solution, you still have to enable the feature on your site. To do this, go to Site SettingsSite Collection Features. There activate the feature called GanttChart. After that, you will find the web part in the list when you click "Add web part". P.S. Of course, WSS3 comes with it's own Gantt chart view, which may in many cases be just what you need.

Labels:


Saturday, January 13, 2007

 

TIP: Sending mail from SharePoint

Sending an e-mail from code in .NET isn't very hard, but you will have to configure an SMTP server. When your code runs inside SharePoint (WSS 3 or MOSS 2007), this shouldn't be necessary, as SharePoint already knows a working SMTP server (it uses this to send out alert e-mails and other mail). To use this and bypass the configuration bogus, send e-mail using this snippet:
using Microsoft.SharePoint.Utilities;
SPUtility.SendEmail(SPContext.Current.Web, false, false,
     "to-address@mail.com", "E-mail title",
     "E-mail body");

Labels:


Wednesday, January 10, 2007

 

Sources of the GanttChart web part

Someone asked for the sources of the GanttChart web part. While I intend the part to be available for everyone free of charge, I haven't decided on any formal licence yet. I promise not to sue you if you use this code, both for commercial and non-commercial uses. You have no permission to remove the link to my blog from the editor interface, though. Everything provided "as is".

Download the sources here.

Oh, and if you create extensions or fixes that would serve not only yourself, it would be really nice if you share them too.

Labels:


Tuesday, December 19, 2006

 

Using Windows SharePoint Services 3.0 as a web site development platform

Recently, I have been working on a project where we created a fairly straight-forward web site for anonymous use on the internet, using WSS 3.0 as our platform. In earlier versions of the sharePoint product, this was not possible, as it did not (really) support anonymous use and the only authentication scenario was using windows user accounts. This restricted the use of SharePoint to a strictly Windows Intranet environment. The latest version of the product, however, allows for anonymous access and as it is built on top of ASP.NET 2.0, you can create your own authentication mechanism using a standard web form for login. Microsoft promotes the use of the (not very cheap) Microsoft Office SharePoint Server 2007 (MOSS) version for use on internet sites for content management, but we figured that for very simple sites, using the free WSS version would be sufficient. This article details findings in this project.

The approach

We imagined that a simple site would require only the following features:

Anonymous access and logon style

In our situation, most users of the web site would never log in, but would just browse the site and maybe download some documents. Logging in was only necessary for content managers when adding or changing content. We decided to use Windows authentication for the content managers, but select 'Allow anonymous access' to allow all other users to access the site without logging in. This can be configured through Central Administration under Application Management | Authentication Providers. Obviously, anonymous access must also be enabled on the IIS web site and on the SharePoint site level.

Using web part pages for content management

The solution of placing web part pages in a document library and use this as a simple content management environment worked very well. By using versioning, you can have content managers work on pages while anonymous users still only see the last major version (you can set this up through Document Library SettingsVersioning Settings, see image below). You can even have approval required on the library. In our project we did not even use the concept of versioning and have the content managers work directly on the visible pages online. This causes some risk, of course, but in many environments this will meet the requirements and the possible confusion of having multiple versions would not be worth it.

For our site, we wanted to have a specific layout of zones in the web part pages. To do this, we created a custom content type, deriving from WebPart Page and a custom version of spcf.aspx. This is the screen where you can specify the name of your web part page and select a template from a list. For our custom type of web part page, we wanted to have only our specially designed zone layout available, including a thumbnail of our site design to go with it. Then we specified that our 'pages' document library could only contain our custom content type and voila: the library would only show our type in the 'New' menu and this would take you to our custom version of spcf.aspx. The only disappointment here was that it turned out impossible to create web part pages from a different file name than the existing spstd1.aspx to spstd8.aspx, so we had to replace one of these with our own.

Web Page Metadata

In internet sites, search engine visibility is always important. Most important of course is to be linked to by others, but the metadata in the pages can also help. This includes:

Menuing

For navigation, our site used the standard structure of a top links menu and a quick links menu. The rendering of these was done with a custom control that rendered more tidy HTML than the standard Microsoft controls did. Maintaining the menu and it's URLs had to be done manually.

Drawbacks

Preview

Content managers like to have preview functionality. "Show me the page as visitors will see it". This feature is hard to accommodate. You can open a browser wihout logging in and view the page in this browser to check, but if anonymous users cannot even see the page while it has not been published yet, even this approach will not work.

Downloading Office documents

When you offer MS Office documents for download from the site, the Office tools on the client will recognize the SharePoint site as such and will ask the user to login for online editing. Even though the download is perfectly possible without logging in (hit escape), the login box will scare users away. This problem can be resolved mostly by turning off 'Client Integration' for the web application (same screen as allowing anonymous acces, see above). Sadly, even with this feature turned off, some configurations of browser and Office versions will still show the login box. The work-around we found is to remove the OPTIONS verb from the HTTPHandler registration in web.config (yeah, it's a dirty hack).

No master page picker or style library

These features are available in MOSS, but not in WSS. Both where implemented by having a WSS Feature called "Design" that included: This worked really well. Once the solution is handed over to the customer, the design can be turned on or off per site. When a change in the design is required, a new version of the Feature is deployed, updating the design in all sites using it. Selecting master pages by content managers is only confusing, really.

HTML editor

The HTML editor in both Rich Text fields in lists as in the Content Editor Web Part is very limited. It has no real functionality to clear out garbage HTML resulting from copying Word content and worst of all: you cannot select images from Image libraries or directly upload them. The only option in the "insert image" dialog is to manually enter a URL. For most systems this is really not acceptable. We created a small fix for the Word content, but decided to go live without image integration. Presumably, vendors like Telerik will provider better editors soon. I might even provide one myself some day.

Search results uses application.master

The search results page for some reason does not use the default master page of the site, but the application.master. This results in a results page that does not fit in with the rest of the pages. We decided to pull a quick hack here, updating searchresults.aspx to use our custom master instead, but a definite solution here has still to be found.

Performance

I have not performed stress tests, but the performance of the product could in my opinion be better. One of the features offered by MOSS is output caching. I am not sure how hard it would be to add such functionality to a WSS site.

Conclusion

All in all: when requirements of a web site are fairly simple, WSS 3 is very suitable as a web site platform. It allows to customize the look and feel reasonably well and anonymous access seems to work fine. WSS brings some of the flexibility of the SharePoint platform to the realm of internet presence sites. Add a new field to the list of news items on the home page and sort on this? Content manager can do it! All of the requirements for a full blown content management platform (autorization, versioning, flexible content types, workflows, ...) are built in. Most of them, however, lack a user interface.

Labels:


Thursday, July 20, 2006

 

At last: the GanttChart web part with installer and user friendly editor

Many people have (politely) asked me to provide an installer with the Gantt chart web part, because they were not comfortable with editing configuration files and placing dll files in the GAC manually. Over the past half year, I have been promising these people that I was working on it, but that it would take some time. Well: rejoice! I have just uploaded the MSI installer for the web part. And what's even better: the part now includes an editor that lets you pick lists, views and fields from lists in stead of having you type in all of these names. I hope that this will make the part useable for a much wider audience:

Oh, one more thing: I also added a new feature: by selecting the Link To Item option, the bars in the chart will be clickable and will link to the detail page of the clicked item.

Labels:


Thursday, March 02, 2006

 

Gantt chart: new version that doesn't overlap other page elements

I just uploaded a new version of the Gantt chart webpart. It contains two fixes.

  1. No more overlapping. In the previous versions, the chart would hide other screen elements when it grew wider. The new version of the part will claim enough space to show itself and push other screen elements to the side or the bottom (as a proper HTML element should do). If you want to constrain the screen space the chart uses, you can always use the standard web part settings Width and Height from the Appearance tab.
  2. Allows empty start and end dates. In the old version, the part would not work if one more more records would have an empty field (for start or end date). In this new version, records with an empty start or end date will show up in the chart (with their title), but without a time bar.

The sources and binaries can be downloaded here. Procedures for installation and configuration have not changed.

Labels:


Friday, February 10, 2006

 

Step by step Gantt chart setup

Some people were having trouble setting the Gantt chart web part up on their WSS sites, so I thought I'd better show a little how-to. We will create a new list, create a Gantt chart for it. Then we will do the same for a custom created view on the data. This step-by-step guide assumes that you have managed to install the part in your site. Step 1, create a new list based on Task (you can use any list, but the nice thing of Task is that it includes a Start Date and Due Date field, which we need):

Step 2, we add an instance of the Gantt web part to the page:

Note that the part initially doesn't find a list named "". You must pass it the name of the list it should work with. When you do that it will look like this (check out the message in the web part): Note that the View field is still empty, but the error message is about a missing start date. The part automatically uses the default view (in this case 'All Tasks'), which does not include the Start Date. So we add it to the view (step 3):

Now, when you enter the right values for the web part (step 4), it will work like a charm:

Now let's do an extra thingy: we create a new view for the list, showing the 'Created By' and 'Created' fields and grouping by the status field: I added the status field to the list as well. The Group By field must be included in the rendered fields. This may seem odd, but the part needs it. I may fix this requirement, but not right now.

Labels:


Wednesday, February 01, 2006

 

New version of Gantt part: Group By and Year/Month/Week views

I have been making some enhancements to the Gantt chart web part. There are basically 2 new features:

Shots

This is the classic month/day view, but now using groupings:

This is the new month/week view. Keep in mind that week numbers are fairly complex stuff and that the outcome depends on the local culture settings of your server. My development server uses Dutch settings and therefore the week numbers in this image reflect ISO week numbering:

And finally the year/month view:

Apart from the really new features, I also added some more robust error handling, preventing the web part to crash when a wrong or misspelled view name is entered. I hope that this will make the part more usable.

Download and Installing

Download the binaries and sources here. Then install the part on your server using the contained dll and dwp files.

Check out this manual for how to install a web part when you have no installer, but only the dll and dwp files.

When configuring the web part, you'll have to manually enter the list name, view name, start date field, end date field, title field and finally the Timebar mode (valid values are YearMonth, MonthWeek and MonthDay).

Labels:


 

How to manually install a SharePoint web part when you have only the DLL and DWP files

When I posted my Gantt chart web part, some people asked for more guidance on how to deploy web parts that don't come with an installer. In my opinion, a professional web part should come with an installer, but sometimes people post samples or demos and don't have the time (or motivation) to build an installer for you and you are stuck with a DLL file and a DWP file. This post describes how you get it to work.

Prerequisites

Placing the files in the right folders

You will have downloaded a ZIP file containing at the very least a DLL file and a DWP file. These two files are the bare necessities for installing your web part. In a default WSS installation, you will have a folder C:\Inetpub\wwwroot\wpcatalog. Place the DWP file in this folder. Place the accompanying DLL file in the C:\Inetpub\wwwroot\bin folder.

The new web part will now appear in the catalog when you browse for new web parts, but you have to change some settings before you actually use it.

Trusting the part

By default, SharePoint will distrust all DLLs that are placed in its folders. We have to tell SharePoint that our specific web part can be trusted. To achieve this, you open the web.config file in the C:\Inetpub\wwwroot folder. This is an XML file and you must be very careful editing it: when your edit results in invalid XML, the whole WSS system will stop working (if you have no idea what invalid XML is, this post is not for you). Also: every time you save the web.config file, the web server will restart itself (the AppDomain, really). Don't do this casually on a production system. Remember to make a backup of the old web.config. In the XML file, you will find a section <safecontrols> that contains a list of trustworthy web parts. Normally, the web part author will provide you with a snippet that should be added to the list.

Once the web.config is updated, your web part should be ready to roll. Some web parts may need additional steps, but these will then be described in detail by the part's author.

Labels:


Tuesday, January 10, 2006

 

A web part for rendering Gantt charts

I promised a month ago that I would post a web part for charting WSS data into a Gantt chart. Well, here it is. It looks somewhat like this:

The part allows you to specify a list and view to render. You select the fields from the view that will indicate the start and end date of an item. The third required field is the title field. Because the part works with view fields, you can also use calculated fields to specify the start date, end date or title of the item.

Because I was too lazy to create a custom designer, you have to enter the names of the list, view and fields in a textbox. When you specify incorrect values, the part will show you the available options in it's error message.


So you want to use it? I put up a zip file containing both the sources and binaries. I haven't made an installer, but I suppose that most of you know what to do with a dll and dwp file (otherwise, check here). In your web.config you'll have to add a line for trusting the part like this:

The web part is actually more of a sample of using the underlying GanttCharting library. This will render VML that can be directly included into the HTML (IE only!). The charting library has some features that are not used by the web part, but that you may want to build on:

Download installer here

Labels:


This page is powered by Blogger. Isn't yours?