Roger Martin's Blog

Coming in 2.2: Improved Integration With Existing Web Sites

Monday, December 01, 2008

The next version of Gallery Server Pro, expected within a month or so, will have an improved UI architecture that will simplify the integration with your existing web site. Although I took advantage of .NET 2.0 techniques such as master pages and themes in GSP 2.0 and 2.1, in practice it has been difficult for developers to add an instance of Gallery Server Pro into an existing web application. This is primarily because an existing site already has an architecture that may include master pages, themes, navigation bar, and header and footer areas. Developers have achieved the look of integration by including GSP in an iframe or by copying their master page into GSP's master page. Neither of these is true integration as GSP still runs as a separate web application in IIS.

For 2.2, I refactored the user interface so that all functionality is wrapped in a single ASP.NET user control. Adding a gallery to your site involves three basic steps:

  1. Copy the Gallery Server Pro files into your web application. Most of them can be placed in a directory of your choosing. A few, such as the SQLite database and .resx resource file, go into pre-defined ASP.NET directories, such as App_Data and App_GlobalResources.
  2. Configure web.config to define a few settings required by GSP and add one line of code to the Application_Start event in global.asax.
  3. Choose one of your web pages to host the gallery. Perhaps you will add a new .aspx page and have it based on your current master page. Add the following to the top of the page:

    <%@ Register TagPrefix="gsp" Namespace="GalleryServerPro.Web" Assembly="GalleryServerPro.Web" %>

    At the location in the page where you want the gallery to appear, add this:

    <gsp:Gallery ID="gallery1" runat="server" />

That's it! Fire up the page and you will notice Gallery Server Pro appears in the location you defined. All the functionality that previously existed, such as logging on, searching, and the task and admin pages are still there. And it will work beautifully with your existing master pages.

As an example, here are a couple screen shots where I added a gallery to a new page named demo.aspx at www.galleryserverpro.com:

gs_integrated_with_gspweb

gs_integrated_with_gspweb2

The demo.aspx page looks like this:

<%@ Page Title="" Language="C#" MasterPageFile="~/master/global.Master" AutoEventWireup="true"
    CodeBehind="demo.aspx.cs" Inherits="TIS.GSPWeb.demo" %>
<%@ Register TagPrefix="gsp" Namespace="GalleryServerPro.Web" Assembly="GalleryServerPro.Web" %>

<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">
    <asp:ScriptManager ID="sm" runat="server" />
    <div id="content">
        <gsp:Gallery ID="gallery1" runat="server" />
    </div>
</asp:Content>

Pretty simple, huh? You can see that it uses a master page named global.Master. GSP requires a ScriptManager because of its AJAX capabilities, so you'll need to make sure you have one defined on the .aspx page or in the master page.

Those of you who run GSP as a stand-alone application can continue to do so. I will release the code in a fully functioning web site with a single page containing the Gallery control. It will work much like you are used to, except you'll notice that the URL's are different. For example, here are a few examples:

Create a new album: http://www.galleryserverpro.com/default.aspx?g=task_createalbum&aid=1
View an album: http://www.galleryserverpro.com/default.aspx?aid=74

View a single photo: http://www.galleryserverpro.com/default.aspx?g=mediaobject&moid=536
Site admin home page: http://www.galleryserverpro.com/default.aspx?g=admin_general

Notice that all functionality is funneled through a single .aspx page (default.aspx in the above examples). The query string contains a "g" parameter that dictates what action is taking place on the page. There will be backwards compatibility with your existing links to albums and media objects. So, for example, a link you may have today that points to a photo at http://www.site.com/default.aspx?moid=536 will continue to point to the same photo in 2.2. However, bookmarks to any task or admin pages will not work in 2.2.

I am working on this every day, and as always I love to hear your feedback.

Posted by Roger Martin, Mon, 01 Dec 2008 15:09:00 GMT

Add comment There is 1 comment.

Due to caching, it may take up to an hour for comments to appear.

Dave Burke said on Mon, 01 Dec 2008 19:06:00 GMT:

Thanks for the update, Roger. That's an interesting approach. I never would have considered GSP being a User Control, but I'll be looking forward to what you come up with as I think your work thusfar has be OUTSTANDING, my man!

Good to hear about compatibility with pre-2.2. One area where I wouldn't mind compatibility breakage would be in the use of key or ID values representing the mediaobject subdirectories rather than the names of the albums. This complicates Urlencoding as well as referencing mediaobjects in other applications.

Maybe RSS support with 2.3?

Thanks again for the wonderful application and your hard work in making GSP even better.

Multilingual Capabilities in Gallery Server Pro

Thursday, October 30, 2008

A great deal of work has gone into making Gallery Server Pro capable of displaying text in multiple languages, and I thought I would give an overview and finish up with a call for volunteers to assist with translating into other languages.

When a user navigates to a web site, most web browsers automatically send the user's preferred language to the web server with the request. Gallery Server Pro uses this setting to automatically return a web page to the user in that language. If no translation has been provided for that language, the default resource - English - is used.

For example, an English user might see a gallery like this:

menu_english

Another user in the Netherlands, whose browser is set to the Dutch language, can view the same gallery and see the resources in Dutch:

menu_dutch

A single installation of Gallery Server Pro automatically provides the correct language, without any intervention by the user. You do not need to choose one language for everyone, nor do your users need to click a special link to read the version in their language. How cool is that!

Be aware that some text in your gallery cannot be automatically served in different languages. This includes any text that is directly editable by an administrator, such as album titles and summaries, and media object titles. It is expected that you edit them directly in your preferred language.

Gallery Server Pro ships with English resources by default. Support for additional languages is provided in language packs which can be downloaded in the Language Translation forum. Deploying a language pack is as simple as copying a few files into the web application. And you can deploy as many packs as you like.

At the moment there is only a Dutch translation and a partially complete Spanish translation, and they are for an older version of Gallery Server Pro. But that is about to change, as I have just finished putting together a process that makes it very easy for volunteers to translate text into their language. I am providing a utility called the Zeta Resource Editor that lets you open two resource files side by side. To create a new translation, make a copy of the English resource file and name it according to your language. For example, the Dutch version of GalleryServerPro.resx is GalleryServerPro.nl.resx. Then you open both files in the Zeta editor:

zeta1

The two files are merged into a single grid where you can easily compare the two languages. Edit the column GalleryServerPro.nl.resx to contain the translation for the text in the column to its left (GalleryServerPro.resx). That's it. No messing around with the underlying XML or that primitive resource editor in Visual Studio.

After an initial translation is complete, it must be updated when new versions of Gallery Server Pro are released. Each resource has a date stamp for when it was last updated. The Zeta editor automatically looks for this date stamp and highlights the resources where they differ. For example, here is a screen shot of the 2.0 version of the Dutch resource when compared to the 2.1 version of the English resource:

zeta2

The yellow, green, and salmon colored cells indicate a resource that must be updated. As you update each one, the background turns white. You know you are done when all the rows are white! (FYI, the first column is always light blue.)

Translators Needed!

Gallery Server Pro is open source and supported entirely by volunteers and donations. If you are able to contribute by providing a translation in your language, we would love your help! As a thank you, I will send everyone who submits a complete translation a copy of the Dilbert book Casual Day Has Gone Too Far.

To get started with a translation, check out the Getting Started thread in the Language Translation forum.

Posted by Roger Martin, Thu, 30 Oct 2008 10:59:00 GMT

Add comment There are 0 comments.

Due to caching, it may take up to an hour for comments to appear.

Gallery Server Pro Version 2.1.3222 Released

Monday, October 27, 2008

This is a minor bug fix release. It contains three bug fixes:

  • (SQL Server only) Error when installing to a SQL Server database that uses a case-sensitive collation
  • Wrong resource name used in edit album popup window (only affects non-English translations)
  • Hidden files are added to the gallery during a synchronization. The synchronization code now inspects the hidden file attribute and ignores all hidden files.

Thanks to forum member KiloMike for helping identify the collation issue. This affects only SQL Server users. I had C# code and SQL in stored procedures that referred to column names that differed only by case, such as AlbumId and AlbumID. That works fine when you are using a case-insensitive collation, which is the default, at least on every installation I have ever done. But this fails in case-sensitive collations, such as SQL_Latin1_General_CP1_CS_AS. As I researched this bug, I also found an issue with the database configuration SQL script. I had originally used Visual Studio Database Edition to produce the SQL that configures the database, and it specifies the SQL_Latin1_General_CP1_CS_AS collation. That has always bothered me, because it just didn't seem right to hard code something so culture-specific. Today I discovered that I could replace these references with "COLLATE database_default", causing it to inherit the collation of the database.

Some of you will have no idea what I am talking about. No worries. The end result is that GSP will now install in more situations and you have the option of enforcing case sensitivity if you want. So, a gallery search for 'Summer Vacation' is different than 'summer vacation'. Again, I am still talking about SQL Server only. SQLite ignores case, and I am not aware of a way to change this (but I admit I haven't looked into it, either).

Finally, there is a change in how GSP synchronizes files. Starting with this release, if it encounters a file with the 'hidden' file attribute, it now ignores it. That will help with Apple OS-X users. Thanks to Ralf from Germany for this suggestion.

Instructions for upgrading are - as always - in the Administrator's Guide.

Posted by Roger Martin, Mon, 27 Oct 2008 14:55:00 GMT

Add comment There are 0 comments.

Due to caching, it may take up to an hour for comments to appear.

Gallery Server Pro Version 2.1.3213 Released

Sunday, October 19, 2008

I released another set of bug fixes for Gallery Server Pro. The most important of these is fixing the Silverlight issue in Firefox 3. As you may recall, while video and audio played fine in Firefox 2, it worked only intermittently in Firefox 3. The code I used was based on Silverlight 2 Beta 2, and Silverlight finally went RTM last week. I downloaded it and extracted the two javascript files from System.Web.Silverlight. That, combined with a little tweaking of the ScriptTemplate in galleryserverpro.config, and I was able to get it rock solid! Wa HOO!

The only remaining limitation with Silverlight is that it does not accept media objects streamed from the ASHX handler that GSP uses for all images, audio, video, and other media objects. When you try, you get an empty player and the Play button doesn't do anything. I will be working with Microsoft to get to the bottom of this. Meanwhile, your Silverlight templates in galleryserverpro.config must use the replacement parameters {MediaObjectAbsoluteUrlNoHandler} (for when your media objects directory is within the web application) or {MediaObjectRelativeUrlNoHandler} (for when your media objects directory is outside the web application). Do not use {MediaObjectUrl}.

There are no database changes in this release, and instructions for upgrading are - as always - in the Administrator's Guide. Here is a list of the remaining changes and bug fixes:

Updates

  • Updated to version 2008.2 SP1 of ComponentArt Web.UI
  • Updated to version 1.0.60.0 of System.Data.SQLite.dll

Bug fixes

  • Silverlight works intermittently in Firefox 3
  • Navigation error when one or more objects in album are deleted by another user
  • NullReferenceException when browsing gallery
  • Permission error when searching gallery
  • Cannot remove user from role
  • Installer does not update provider names
  • Error when logging out of my account page
  • Image metadata items added twice
  • Misleading message during a SQL Server installation

Posted by Roger Martin, Sun, 19 Oct 2008 20:20:00 GMT

Add comment There are 0 comments.

Due to caching, it may take up to an hour for comments to appear.

Gallery Server Pro Version 2.1.3196 Released

Thursday, October 02, 2008

Yesterday I released several bug fixes for Gallery Server Pro and updated a couple third party components. Instructions for installing and upgrading can be found in the Administrator’s Guide.

The most important fix was to address a problem with video and audio not playing in the Silverlight plug-in. When I released the Silverlight feature in August, I had tested it extensively on my internal network and, with the exception of some issues with Firefox 3, it worked great. However, after the release it became apparent that the plug-in did not work in many situations. A blue box would appear, indicating that the Silverlight control was instantiated, but the video never started.

In Gallery Server Pro, all media files – photos, video, etc – are served through an ASHX handler. This provides added security and fine tuned control over how the media is streamed to the browser. Unfortunately, the Silverlight plug-in is not behaving well with the handler, and as best I can tell the issue is with Silverlight and not the handler (when in doubt, blame the other guy, right?).

The browser requires Silverlight 1.0 or higher, but I am using javascript and a player that is distributed with the Silverlight 2.0 Beta 2 Developer Tools. When Silverlight 2.0 goes gold, I will get the latest files and try again. If it still doesn’t work, I’ll contact Microsoft for some assistance.

Meanwhile, there is an easy workaround that is implemented in this release – link directly to the media file instead of using the handler. The way to do this is to open ~/config/galleryserverpro.config and replace {MediaObjectUrl} with {MediaObjectAbsoluteUrlNoHandler} for each of the templates where Silverlight is specified (there are four). If you need more help, there are additional directions in the upgrade section in the Admin Guide. If your media objects directory is outside the Gallery Server Pro web application, you must use {MediaObjectRelativeUrlNoHandler} instead.

You may be wondering about my statement that the ASHX handler provides additional security. When you don’t use the handler, your users can view the HTML source and see something like this:

mediaSource:http://www.galleryserverpro.com/gsdemo-mediaobjects/Videos/3StrikesChipmunk_56.wmv

Anyone can copy this URL and use it to access your video any time they want. IIS happily serves the video without checking with ASP.NET (and the Gallery Server Pro user security model) to make sure the user is allowed to see it. I should note that there is a new feature in IIS 7 where you can restrict access to static files like wmv, but this feature does not provide access to the Gallery Server role/user security so it is not a viable solution.

If you are allowing anonymous users access to your gallery, then you don’t have anything to worry about, because you are not trying to restrict them anyway. I say this more as an FYI to those of you who lock down the gallery to restrict access to only logged-on users. And even then an anonymous user can get at your video only if they can guess the URL.

The Silverlight plug-in still does not reliably work in Firefox 3. Sometimes it plays the video; sometimes it doesn’t. Due to the intermittent nature it may be some kind of javascript timing issue. Microsoft has stated they will offer full support with the 2.0 release. I will keep an eye on this and release updated code as soon as I can.

This release also includes an updated version of the SQLite dll and the just-released 2008.2 ComponentArt Web.UI release. Gallery Server Pro uses many of the CA controls for enhanced UI functionality, including uploading files, the menu, tabs, and grids. Unfortunately, the new release still doesn’t fix an issue where the Add objects page becomes unusable after an upload is aborted, either through clicking Cancel during an upload or after the Upload control aborts an upload because the file exceeds the maximum limit. I am working with them to get a fix.

Below is the full list of bug fixes. If you are bored, you can read a detailed report of the bug fixes.

  • Silverlight media does not play with ASHX handler
  • Silverlight media not playing when %2b is in URL query string
  • Media objects are added in reverse order
  • Hard coded English text in web pages
  • Width and height properties not updated when small images are rotated
  • SQLite provider does not delete related data
  • Incorrect SQL in SQLiteProfileProvider
  • Records associated with anonymous users are not removed
  • SQLite DataReader closes connection during transaction
  • Web.config has <machineKey ...> element
  • Error occurs when creating an album with an empty name
  • Calendar popup appears behind edit album dialog
  • User is allowed to add an empty external object
  • SQL Server password accidentally set to encrypted
  • Invalid password attempt count too low
  • Null reference exception when session and profile are null

Posted by Roger Martin, Thu, 02 Oct 2008 07:13:00 GMT

Add comment There are 0 comments.

Due to caching, it may take up to an hour for comments to appear.

Page generated at 12/4/2008 12:29:37 PM