Welcome to Office Zealot Sign in | Join | Help

Cleaning things up

So the site in final beta form was released yesterday. The last build attacked various small issues and also allowed us to clean up some of the code and implement some things in a better fashion.

Blog Aggregator
For example, we know have an OPML feed and a blog roll:

The blog roll was very easy to generate since we already have our blog aggregator working. The blog aggregator can process RSS and Atom feeds with some level of flexibility (i.e. recognizes the feed type and processes accordingly).  

The aggregator gets all feeds from a Sharepoint list and crawls the feed. It parses them and places the last post of all of them in a single file. Then, a small console app runs every four hours (with a Scheduled Task) that updates this file.

Search
Search was fun to setup and customize. Since our site is in itself some kind of "search" site (in the sense that it concentrates information from other places nicely into one repository), our search goes directly to our Community Server, blogs.officezealot.com.

Some of the last minute challenges we found:

- Anonymous authentication was not working for the results page. The solution was simply to recreate the site. We spent a good amount of time trying to figure out what had happened to no avail. The most likely culprit however, seems to be the master page customization and one of the controls used in search.

- Not enough metadata in pages. Amazingly, most sites are not very good at providing metadata (author, description, taxonomy). Our search relies on crawled properties and managed properties.

- Anonymous authentication for resources outside of Sharepoint. The solution was simply to place these resources under its own application context (this way Sharepoint is not involved in handling the URL).

Code Cleanup
Given the speed at which we created this site, we needed to partition the work in smaller pieces for a team of 4 people (some worked with the master pages, others with webparts and yet another with data migration). In the end, the code looks as if one had created it thanks to code formatting and analysis tools. There is still some work to be done to create a common assemly with some of our helper classes...

Sharepoint quirks
Some of the interesting issues that "just happened" in this project:

- Items in a document library would not update after item.Update() was called: solution, recreate the document library column with the same name. Update works afterwards.
- Permissions. No matter what, setting anonymous access correctly for resources across the board was problematic (but this is probably the case due to some of the complexity of this solution, with many assets, like the Community Server web part outside Sharepoint control).
- Sharepoint Designer errors. With some pages,the editor would freeze. We've found that for complex pages, it is better to use Visual Studio as the editor.

Overall it was a fun and challenging project (time-wise).

Posted by omar2 | 0 Comments

How are we doing?

So we finally have a product that we can show.

Here is a screnshot:

 

 And here is the original com:

 So it is pretty close...

 
A few last minute challenges

We faced a couple of challenges:

- URL Rewriting does not want to work with query string parameters.

- Some of the blogs that our site aggregate are down sometimes and that hurts the content.

-There are many pages in the old site with content that is not precisely easy to transfer.

 
We'll continue testing and making another round of bug fixes. But so far, so good.
 

speakTECH Flash Poster

 

The new OfficeZealot home page contains a Flash Poster. The speakTECH Flash Poster is a small but  nifty Flash movie that displays a series of images in sequence with nice animations and a couple of other interesting features.

 

Adding a Flash element to a Sharepoint page is pretty simple, just create a new web part that writes the appropriate object tag (you can also add through the content web part, but then we wouldn't have customizable properties):

 

  private string _transition;

        private string _displaytime;

 

        [WebBrowsable(true),

   Personalizable(PersonalizationScope.Shared),   

   WebDisplayName("Transition Time"),

         WebDescription("Number of transitions")]

        public string transition

        {

            get { return _transition; }

            set { _transition = value; }

        }

 

        [WebBrowsable(true),

         Personalizable(PersonalizationScope.Shared),

   WebDisplayName("Display Time"),

         WebDescription("Time in secs of each transition")]

        public string displaytime

        {

            get { return _displaytime; }

            set { _displaytime = value; }

        }

 

        protected override void Render(HtmlTextWriter writer)

        {

            StringBuilder sb = new StringBuilder();

           

            sb.Append( *Object Tag with properties* );

            writer.Write(sb.ToString());

        }

But in this case that’s not all, the speakTECH Flash Poster requires that we provide it an XML file with a specific schema so that it knows which images to render, for how long, and in which order.

The basic idea is to get all the images from a list, but Flash is not Sharepoint aware.

We created an ASPX page that can handle a simple GET request and created the XML output for Flash. With this we can receive a few parameters through the query string that point to the right list.

As you can see we decided to add some properties to the web part so the users can customize the web part however they like. The web part then sends the parameters to this ASPX page.

 

The following parameter is used in the object/embed tags to request a specific XML file.

 

<param name=\"param\" value=\"configxml=../site/page.aspx?param1=" + _transition + "&param2=" + _displaytime + ");

 

Once the ASPX page receives the request, we get the Document Libraty where the images are stored. It needs to be a document library and not a list since we want to store the images in Sharepoint. An alternative would be to use a List when the images are NOT in Sharepoint but hosted externally... many alternatives as usual.

The ASPX page then creates the XML structure we need, we get all the items from the Document Library/List and output the XML without too much fuss.

  SPList images = UIUtils.GetList("List");

 

        StringWriterUTF8 sw = new StringWriterUTF8();

        XmlTextWriter writer = new XmlTextWriter(sw);

 

        int tt = UIUtils.ParseInt(Request.QueryString["param1"], 2);

        int dt = UIUtils.ParseInt(Request.QueryString["param2"], 5);

 

        writer.WriteStartDocument();

        writer.WriteStartElement("slideshow");

 

        writer.WriteStartElement("config");

        writer.WriteElementString("transitiontime", tt.ToString());

        writer.WriteElementString("displaytime", dt.ToString());

        writer.WriteEndElement(); //end config

 

        writer.WriteStartElement("items");

 

        foreach (SPListItem item in images.Items)

        {

            writer.WriteStartElement("item");

            writer.WriteStartElement("src");

            writer.WriteCData("/"+item.File.Url);

            writer.WriteEndElement(); //end src

            writer.WriteElementString("type", "image");

            writer.WriteStartElement("link");

            if (item["link"] != null)

            {

                writer.WriteCData(item["link"].ToString());

            }

            else

            {

                writer.WriteCData("");

            }

            writer.WriteEndElement(); //end link

            writer.WriteStartElement("text");

            writer.WriteStartElement("header");

            if (item["header"] != null)

            {

                writer.WriteCData(item["header"].ToString());

            }

            else

            {

                writer.WriteCData("");

            }

            writer.WriteEndElement(); //end header

 

            writer.WriteStartElement("description");

            if (item["Description"] != null)

            {

                writer.WriteCData(item["Description"].ToString());

            }

            else

            {

                writer.WriteCData("");

            }

            writer.WriteEndElement(); //end Description

 

            writer.WriteEndElement(); //end text

 

            writer.WriteEndElement(); //end item

        }

        writer.WriteEndElement(); //end items

 

        writer.WriteEndElement(); //end slideshow

        writer.WriteEndDocument();

        SendXmlResponse(sw.ToString());

And that’s it. A nice, configurable Flash Poster driven by a Sharepoint list.

P.S. There are other ways to accomplish this that are more Sharepoint-esque; however, this is as simple at it gets.

Posted by omar2 | 0 Comments

URL Rewriting in Microsoft Office SharePoint Server

The new task for the team was making the URLs from SharePoint go friendly; basically remove the annoying “/Page/” string from the URL.  This has the added benefit that we’ll be able to keep our old URLs and keep Office Zealot rankings in search engines.

While not complicated, Sharepoint cares a lot about handlers.

In essence, we need to create an HTTP Module to handle requests and mangle the request URL to our heart’s content. The URL rewriting process has been hashed many times over in multiple places, so we won’t bore you with those details.

namespace Name

{

    public class ClassName : IHttpModule

    {

        public void Init(HttpApplication context)

        {

            context.BeginRequest += new EventHandler(context_BeginRequest);

        }

 
        private void context_BeginRequest(object sender, EventArgs e)

        {
            //Code to Handle the URL Rewrite

        }

 

        public void Dispose()

        {

        }

    }

} 

We need to sign the assembly and compile the project. Then add the dll to the global assembly cache and restart IIS to reload all the assemblies that SharePoint uses.

Then you need to add the following line on the HttpModules section in the web.config file of the web site you are going to use the Http Module.

<httpModules>

      <clear />

          <add name="Just a Name" type="Namespace.Class, Assembly Name, Version=x.x.x.x, Culture=neutral, PublicKeyToken=xxxxxxxxxxx" />


This line needs to be at the top so you can get the request before SharePoint does. This is important, since Sharepoint does its own rewriting…

And with this you are ready to go. There is still some testing to do, but those are the basics.

Adrian.

speakTECH – Community Server WebPart

Hello all, today we proudly announce that we have implemented on our future site our Community Server  viewer web part. This Web part is capable of rendering different types of content given by Community server, and can be styled with CSS.

After adding the web part into our page, we open the options panel, and we must select what type of Community Server information we want to display.

 

 

After selecting "Tag Cloud Viewer" we must apply changes so the options panel can render specific options for our feed type.

 

 

We need to input our feed Url for our viewer and then click OK.

 

And the speakTECH Community Server Viewer Web Part is ready!!

Sergio

Posted by omar2 | 1 Comments
Attachment(s): csblog_img2.png
More Posts Next page »