Pages

Showing posts with label community server. Show all posts
Showing posts with label community server. Show all posts

Tuesday, September 19, 2006

CS:Editor ViewState

Quick Tip:
CommunityServer 2.1 uses TinyMCE as a rich text editor. They use what appears to be a wrapper to TinyMCE: CommunityServer.Controls.Editor. As I am developing an application on top of CS 2.1 I am using the same rich text editor and encountered the following problem:
I was setting declaratively the Height Property of the Editor control, but it could not retain it's value after postbacks.
Look at the ASPX part:

So far so good but, after a postback the Editor control returned to its default height (messing-up my layout).

To make a long story short, it figured that something is wrong either with timing or with implementation. I mean that either the wrapper, or the wrapped control do not assign the value of Height before ViewState is saved, or they assign it to either a Property that is not saved in view state, or during an Event that fires before LoadViewState.

So what I did to work-around the issue was just disable ViewState in the Editor control.

The problem has gone away and that means that LoadViewState was overwriting my value.

I did not devote any time in looking further into this matter so I'm just posting this work-around, but if I do, I 'll let you know the details.

Saturday, August 6, 2005

MetaBlogAPI for CS 1.1


I wanted to test w.Bloggar and BlogJet today for posting in a CS 1.1 blog. MetaBlogAPI comes as a separate download from CS 1.1 so I tried to find and get it. Believe me I had a real hard time!

After an hour or so of googling around for it, a friend from dotnetzone.gr finally pointed me to it.

Here it is:
http://www.telligentsystems.com/Solutions/license.aspx?File=cs_1.1_metablog

If you need it, go get it…

The other versions found in various posts in communityserver.org/forums are usually older versions and will just give you a "Method not found: System.Collections.ArrayList COmmunityServer.Blogs.Components.Weblogs.GetWebLogs(CommunityServer.ComponentsUser,  Boolean, Boolean, Boolean). (EGetRecentError)" error message.

I wish they had a more standard place for it on the web than just a form post…

Friday, August 5, 2005

CS default language problems

I run into an issue today regarding Community Server 1.1 (CS 1.1).
I changed the default language in communityServer.config from en-US to el-GR, only to get a runtime error.

The change:

<Core defaultLanguage="el-GR">

The error:

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.FormatException: Index (zero based) must be greater than or equal to zero and less than the size of the argument list.

Source Error:
Line 49: message = FindControl("Message") as Literal;
Line 50: if(message != null)

Line 51: message.Text = string.Format(ResourceManager.GetString("DisplayUserWelcome_AlternateUserWelcome"), CSContext.Current.SiteSettings.SiteName);

Source File: C:\Documents and Settings\rousso\My Documents\Visual Studio Projects\CS\1.1\50615src\src\Controls\User\AnonymousUserControl.cs    Line: 51

Stack Trace:

[FormatException: Index (zero based) must be greater than or equal to zero and less than the size of the argument list.] System.Text.StringBuilder.AppendFormat(IFormatProvider provider, String format, Object[] args) +1232

System.String.Format(IFormatProvider provider, String format, Object[] args) +65
System.String.Format(String format, Object arg0) +47
CommunityServer.Controls.AnonymousUserControl.AttachChildControls() 
CommunityServer.Controls.TemplatedWebControl.CreateChildControls() 
System.Web.UI.Control.EnsureChildControls() +100
...
System.Web.UI.Control.PreRenderRecursiveInternal() +125
System.Web.UI.Page.ProcessRequestMain() +1499


After meddling around a a little bit I pin pointed the problem to a translation error.

I turns out that the Greek language resource files located in /Languages/el-GR/Resources.xml were not properly (if at all) converted to reflect changes in code between version 1.0 and 1.1 of CS.

This line was the problem:
<resource name="DisplayUserWelcome_AlternateUserWelcome">Καλώς ορίσατε στο {0} {1}resource>

There, two String.Format arguments are obviously expected. On the other hand, line 51 of AnonymousUserControl.cs, only passes one (see source error above).

Removing the second placeholder from the format string solves the problem:
<resource name="DisplayUserWelcome_AlternateUserWelcome">Καλώς ορίσατε στο {0}resource>
The same stands for fr-FR (French) language resources I checked. Probably for others too.

If you can read Greek see my relevant posts in dotnetzone.gr. Also if you are looking to solve the same problem for the Greek (Hellenic) language see these posts in dotnetzone.gr where you can get the corrected translation for Greek text and buttons (it is attached to the post).