Welcome to CrankyGoblin.Com Sign in | Join | Help

Public Class GeoffAppleby

Inherits Microsoft.VisualBasic.MVP : Implements IBrainFart
In-line File Uploader Update

Two nights ago I posted about my In-line File Uploader addition for Community Server 2.0. Over the weekend I had less time that I thought I would to keep working on it, but I did fix one fairly important problem.

The way I had it written the extra tab that appeared when writing a new post was second - and this caused other tabs to appear incorrectly. A bit of digging around showed me it was because the code-behind for that page had some hard coded tab indexes (tsk tsk, for shame).

So I've updated CreateEditBlogPost.ascx.cs with a fix so that it's not as hard coded anymore. That is, it's not hard coded to a set of integer array indexes, it's now depending on control id's, which is at least better :)

Here's a quick rundown on the code that I changed. Before, we had code like this:

        const int attachTabIndex = 1;

        const int inkTabIndex = 2;

        const int videoTabIndex = 3;

 

        void Bind()

        {

 

            EditorTabs.Tabs[attachTabIndex].Visible = this.EnableAttachments;

            if(this.EnableInkSupport)

            {

                inkWeb.Enabled = true;

                inkWeb.RegisterLinkButton(this.PostButton);

            }

            else

            {

                inkWeb.Enabled = false;

            }

            EditorTabs.Tabs[inkTabIndex].Visible = inkWeb.Enabled;

            //etc etc - a whole heap more code here

        }

And I changed it to this:

        protected CA.PageView PostAttachmentsPage;

        protected CA.PageView WhiteBoardPage;

        protected CA.PageView VideoPage;

 

        void Bind()

        {

            CA.TabStripTab attachmentsTab = EditorTabs.FindItemById(PostAttachmentsPage.ID);

            CA.TabStripTab inkTab = EditorTabs.FindItemById(WhiteBoardPage.ID);

            CA.TabStripTab videoTab = EditorTabs.FindItemById(VideoPage.ID);

 

            attachmentsTab.Visible = this.EnableAttachments;

            if(this.EnableInkSupport)

            {

                inkWeb.Enabled = true;

                inkWeb.RegisterLinkButton(this.PostButton);

            }

            else

            {

                inkWeb.Enabled = false;

            }

            inkTab.Visible = inkWeb.Enabled;

            //etc etc - a whole heap more code here

        }

Basically, the content of each tab is held in a </componentart:pageview> which has a specific ID. These can be used to look up a specific tab in the tabStrip's tabs collection.

But to make this work, the tabs themselves need a specific ID too - and currently as the default code stands, each tab has ID of String.Empty - whoops :)

So a quick change to tabData.xml (the file which defines the tabs that will appear) to define the IDs, and we're done:

<SiteMap>

    <item Text="Post" KeyboardShortcut = "Alt+C" PageViewId = "ContentPage" id="ContentPage" />

    <item Text="File Uploads" KeyboardShortcut = "Alt+U" PageViewID = "FileUploadPage" id="FileUploadPage" />

    <item Text="Post Attachments" KeyboardShortcut = "Alt+A" PageViewId = "PostAttachmentsPage" id="PostAttachmentsPage" />

    <item Text="WhiteBoard" KeyboardShortcut = "Alt+W" PageViewId = "WhiteBoardPage" id="WhiteBoardPage" />

    <item Text="Video" KeyboardShortcut = "Alt+V" PageViewId = "VideoPage" id="VideoPage" />

    <item Text="Options" KeyboardShortcut = "Alt+M" PageViewId = "PostOptionsPage" id="PostOptionsPage" />

    <item Text="Advanced Options" KeyboardShortcut = "Alt+S" PageViewId = "PostAdvancedOptionsPage" id="PostAdvancedOptionsPage" />

    <item Text = "Preview" ClientSideCommand="SelectPreview()" PageViewId = "PreViewPage" id="PreViewPage" />

</SiteMap>

The download for the mod has now been updated to include this code fix.

Posted: Sunday, 14 May 2006 3:27 AM by Geoff Appleby
Filed under: ,

Comments

Public Class GeoffAppleby said:

Update1 [20060514]: I've updated the code with a fix for one of the bugs. The first version (and this...
# May 14, 2006 3:29 AM

Public Class GeoffAppleby said:

Well, it's been a couple of hours since I said I might get the upgrade to CS 2.1 done over the next couple...
# September 2, 2006 7:48 AM

Public Class GeoffAppleby said:

Well, it's been a couple of hours since I said I might get the upgrade to CS 2.1 done over the next couple...
# September 2, 2006 7:49 AM
Leave a Comment

(required) 

(required) 

(optional)

(required) 

To submit your comment, click on these pictures:
  • Geoff's little sister's pussy
  • Hairy Geoff
  • Searching Geoff
Gaptcha Image - No Peeking! Gaptcha Image - No Peeking! Gaptcha Image - No Peeking!
Gaptcha Image - No Peeking! Gaptcha Image - No Peeking! Gaptcha Image - No Peeking!
Gaptcha Image - No Peeking! Gaptcha Image - No Peeking! Gaptcha Image - No Peeking!
Can't recognise the people in these pictures? Look here for a quick introduction.
There's a time limit for you to get your comment submitted before this set of pictures expires. If you think it's been longer than 10 minutes, get some new pictures first (you won't lose what you've typed so far).
Get some new pictures 

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS