Wednesday, June 18, 2008

Specifying the web part you need to your developers

Hi All As a part of a SharePoint solution analysis and specifications work, a system analysts has to specify various web parts that need to be developed. When specifying a web part, we should keep in mind some important features that should be clearly defined to the implementing developer:
web part properties - A web part may have a set of dynamic properties that can be configured in run-time by a site administrator. When you specify a web part's requirements you must not forget to define its dynamic behavior - all properties that you wish that a site admin will be able to configure (this actually what makes the web part dynamic).
web part connections - SharePoint (WSS/MOSS) provides a framework which enables web parts to communicate and pass values from one to another in run-time. This framework is called "web part connection framework". This framework defined a standard for any web part to send/receive values from/to other web parts. This way choosing some value for example in one web part, can filter the displayed values in another web part. When you specify a custom web part, don't forget to define the connections that this web part should support.
Standard GUI - SharePoint has a large set of defined styles. Obviously, if your new web part will be displayed inside some portal, you would like it to have the same styles as all other web part on the page. Further more, if a site administrator changes the site's theme (the overall schema of fonts/ colors etc), you will want it to apply also to your custom web part. This means that the web part should be implemented using these standard SharePoint styles and NOT some propriaty styles.

I have created a short web part specifications document to be used as a basic template for defining a custom developed web part.
Download the web part specifications document:
http://www.kwizcom.com/
Click "Specification documents for SharePoint solutions" item in the "KWizCom News" scroller.

Nimrod
http://www.kwizcom.com/

Tuesday, June 17, 2008

SharePoint & e-learning

Hi everyone
Recently i have been working on some MOSS 2007-based elearning projects, using MOSS 2007, SharePoint Learning Kit (SLK) and OCS.

The following presentation presents these technologies and provides some friendly explenations about Web content standards and SCORM:

http://www.kwizcom.com

(Click the "New SharePoint E-learning presentation" link in the news scroller)



cheers
Nimrod Geva
www.kwizcom.com

Friday, April 18, 2008

Rendering list field control manually

Recently I had many customer requesting me to do several development that all required one thing:

Render a field control manually inside my web part.



One development was creating a SharePoint list aggregator. This (upcoming new product on our site soon) web part will get data from several lists and aggregate them into one view.
What we had to support is rendering each item with all of it's fields, even custom field types.

Another development, was to create a web part (also, should be published as a new product on our site soon) that connects to a list, and allows the user to create or edit items in the list - only editing will be done one field at a time using a wizard-like mechanism, where every field you fill will save your changes and will move you to the next field (I called it ItemEditorPlus :) ).

In both cases I needed to load a list item, and display one or more of it's fields using the designated field control - in display mode, or in edit mode, it doesn't matter.

Well, I found this to be a bit tricky to do since after getting the correct field control for the current field type, I found out that each field type acts different when rendering it.

Apart from that, I found 2 methods of doing that. One using a CompositeField control (the easiest way) and the other interrogating the SPField itself.

Using the CompositeField control


This is rather easy, all you need to do is:
1. Get a reference to the SPList and SPListItemyou want to edit
2. Add a CompositeField control to your this.controls collection
3. Set the ListId, ItemId and FieldName properties of the CompositeField control
4. Done!

Here is an example of what should be in your CreateChildControls method:

FieldControlNextField = new CompositeField();
FieldControlNextField.EnableViewState = false;
FieldControlNextField.ListId = list.CurrentList.ID;
FieldControlNextField.FieldName = GetNextFieldName();
FieldControlNextField.ID = "FieldControlNextField";
if (IsEditingMode() )
{
FieldControlNextField.ControlMode = SPControlMode.Edit;
FieldControlNextField.ItemId = this.CurrentItemID;
}
else
{
FieldControlNextField.ControlMode = SPControlMode.New;
}
this.Controls.Add(FieldControlNextField);

So, that done I was able to render just about any field I testes, including our Rating field type and Tagging field type (which are very composite fields to render, I can assure you).

On the other manual method of rendering a field I will take the time to complete my investigation and publish on a later post. It is possible since I have it working, but it just seems too complicated to do so I think I am missing something...

Well, anyways - This is my first post since I moved to Ontario, Canada... Finally got my fast Internet installed at home - so if any of you emailed me and didn't get a response - I'm getting there!

Happy weekend all,
Shai Petel.