Archive for October, 2008

30
Oct

Share this! - The 5 Paths to Web 2.0 Profit

Hey guys,

after I saw this Webinar, I applied the advices by Darren in my own blog with using the new “Share this” button at the top of each post.

By the way, Sitecore is always doing a good job by creating such Webinars. Everybody can attend and you get a lot of advices or experience - and it’s related to Sitecore (of course).
Well, in my case my blog is powered by wordpress, but you see that you can apply the essence of a webinar pretty much to every application.

So go to http://www.sitecore.net/News/Webinars.aspx?nav=s, register and enjoy ;-)

cheers chris

28
Oct

sitecore website login / restrict sites for anonymous *update*

Hey guys,

if you are trying to restrict special sites for the extranet\anonymous user, so only authenticated users (doesn’t matter if it’s a virtual user or a real user account) can view that content.

You can restrict the read right for the anonymous user and add an (undocumentated - the reason I write about it ;-) ) attribute to your site in the web.config. The default one will be website I think.

loginPage=/sitecore/content/home/Registration/Login.aspx

It can also be a sitecore Item and you refer to the virtual path. So after Sitecore sees that the user is not autenticated, it redirects the user to your login page. Unfortunately it passes own query string parameters, and none of them is “returnUrl”. In my case I hooked into the httpRequest pipeline right before the ExecuteRequest processor and created my own SecurityResolver.

[updated]

    public class SecurityResolver : HttpRequestProcessor 
    {     
 
        public override void Process(HttpRequestArgs args) 
        { 
            // Get the site context 
            // [CW] 
            SiteContext site = Sitecore.Context.Site;          
 
            // Check if the current user has sufficient rights to enter this page 
            // [CW] 
            if (SiteManager.CanEnter(site.Name, Sitecore.Context.User)) 
            { 
                string prefix = args.StartPath;          
 
                if(args.LocalPath.Contains("/sitecore/content/home")) 
                    prefix = String.Empty;          
 
                if (Sitecore.Context.Database != null) 
                { 
                    Database contextDatabase = Sitecore.Context.Database;          
 
                    Item contextItem = null;          
 
                    // Get the item using securityDisabler for restricted items 
                    // [CW] 
                    using (new SecurityDisabler()) 
                    { 
                        contextItem = contextDatabase.SelectSingleItem(String.Concat(prefix, args.LocalPath)); 
                    }          
 
                    // Check if a loginPage is given 
                    // (Should be for this website) 
                    // [CW] 
                    if ((contextItem != null) && (contextItem.Access.CanRead() == false) && (site != null) && (site.LoginPage.Length > 0)) 
                    { 
                        // Redirect the user 
                        // [CW] 
                        WebUtil.Redirect(String.Format("{0}?returnUrl={1}", 
                            site.LoginPage, 
                            HttpContext.Current.Server.HtmlEncode(HttpContext.Current.Request.RawUrl))); 
                    } 
                } 
            } 
        } 
    }

Hope it’s helpful for you - You may also post questions or interests. I’m looking forward to develop a sitecore client application with xaml, and can manage to documentate the steps I do.

cheers chris

23
Oct

sitecore related rss feed

Hey guys,

Sitecore related widgetI created a rss widget for my sidebar which displays all related blog posts in the sitecore blogsphere. Hope it’s useful and helpful for you.

cheers chris

22
Oct

Extend your xslt coding speed with code snippets

Hey guys,

are you always typing the same code like <sc:text field=”Headline” /> ? After I spoke about XSLT at one meeting by the german .NET User Group niederrhein, Daniel Fisher showed how to insert code snippets for xml. We tried to create a snippet for xslt as well and it’s pretty easy.

Xslt Code SnippetsAfter this I thought of typical code lines I write for Sitecore projects. I think one is: <sc:<control> field=”<field name>” /> isn’t it? Yes it is possible to create editable areas for xslt code snippets as well, I show you how.

I created a Sitecore.snippet file and placed it under: C:\Dokumente und Einstellungen\<Your Username>\Eigene Dateien\Visual Studio 2008\Code Snippets\XML\My Xml Snippets.

Start your xml file with:

<?xml version=1.0?>
<CodeSnippets xmlns=http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet>

After that you can insert an element for a snippet:

<CodeSnippet Format=1.0.0>
<
Header>
<Title>Sitecore sc:text</Title>
<
Author>Christopher Wojciech</Author>
<Description>Adds an sc:text element to your code</Description>
<
Shortcut>fld</Shortcut>
</Header>
<
Snippet>
<Declarations>
<
Literal Editable=true>
<ID>type</ID>
<
Default>Text</Default>
<ToolTip>Type your function name here.</ToolTip>
</
Literal>
<Literal Editable=true>
<
ID>field</ID>
<Default>field name</Default>
<
ToolTip>Type your field name here.</ToolTip>
</Literal>
</
Declarations>
<Code Language=XML><![CDATA[ <sc:$type$ field=”$field$” />$end$]]></Code>
</
Snippet>
</CodeSnippet>

You can insert an editable area by typing $yourId$ in your CDATA section under <Code Language=”XML” />, you also have to specify the <Literal /> element under <Declarations />. Now you can use your code snippet in xslt by typing <fld>[TAB] and can edit the type of the sitecore control and the field name.

I also added  the <xsl:value-of select=”sc:fld(..)” /> code snippet.

Please post me your snippets you want to have, I will add it to the sitecore.snippet file and upload it to my blog.

- Download Sitecore.snippet

cheers chris

20
Oct

.net debugger display properties

Hey guys,

not really “offtopic”; but I found it in Sitecore while I’m working on my current project for netzkern.

If you are debugging with Visual Studio and want to see directly which values the object have without opening all properties. If you are familiar with Sitecore you know this feature, and that’s why I write about it.

The DebuggerDisplay() attribute:

DebuggerDisplay

You can implement this in your own solution by adding this to your code:

[DebuggerDisplay(”{property1} {property2}”)]
  public class ExampleClass
  {
  }

More Information can be found in the msdn: http://msdn.microsoft.com/de-de/library/x810d419(VS.80).aspx

cheers chris

16
Oct

Flash Player 10 breaks upload in Sitecore

Hey guys,

I know I’m just linking to various blog entries, but I think it’s still good to know and I want to give you all information I get.

Adobe released Flash player version 10 that breaks uploading in Sitecore.

We’re working on a solution,  do not upgrade to Flash 10 if you can. Another option is to set Upload.Classic = “true” option in web.config – this will replace Sitecore 6 upload with the one used in Sitecore 5, which doesn’t rely on flash.

Thanks to Alexey Rusakov and his blog entry.

cheers chris

13
Oct

“Sitecore as Development Platform and Why SharePoint Sucks”

Hey guys,

a pretty theoretically and interesting article or better: comparison of Sharepoint and Sitecore. I think it’s worth reading, but I’m a friend of creating my own opinion :-)

Enjoy… cheers chris

This series will cover the following areas:
- Introduction (Part 1)
- Installation and General Architecture (Part 2)
- Configuration (Part 3)
- Customization and Designer Experience (Part 4)
- Integration with Developer Tools (Part 5)
- Feature Deployment (Part 6)
- API und Data Model (Part 7)
- Integration with other systems (Part 8)
- Conclusion (Part 9)

Blog Article

06
Oct

Missing translations in page editor buttons

Hey guys,

as a Developer in a the german area, I’m creating solutions in the german language more than in english. If you have seen the already the issue that in another website language some buttons aren’t translated you  can resolve it yourself, I missinglanguageonbuttons.jpgwill also create a support ticket at the Sitecore support; but then you have to wait until the next release.

The “self-doing-way”:
Go into the Core Database (you can switch the databases by clicking on the icon left beside the clock) . Switch databases in the sitecore client.Open the content editor and then you have two solutions:

  • Set the field called “Header” in the “WebEdit Button” data template to shared
  • Add new versions to the languages in the “Header” fields under the path: /sitecore/content/Applications/WebEdit/Buttons/Associated Controls/*

You have to be aware of the way to change a template field and set it to shared that other language versions are being lost, and it’s also a heavy change in the Sitecore core database, but in order to point out all ways I have to mention that as well. I would go for the new language versions on content items.

Another issue is that you have to rename the language to the same item name / key as it is in the Sitecore core database. For example: I have created a language called “de-DE” for german, but in the core database is only the “de” language item. So I have to rename the language from “de-DE” to “de”. (Also you can go the other way round, but changing the core database should only be the last solution!)

That’s it for today I guess. I will update my post if the Sitecore support has answered.

Thanks to Steen Pedersen, who a really nice guy and pointed me to the items having the header field. It has been a pleasure to meet you guys.

cheers chris

03
Oct

Create your own replacer tokens

Hey guys,

sitting in the Sitecore 6 Training and solving questions come up while the training I have tried to create my own replacer tokens for Sitecore 6.

You may already know that there is:

  • $name
  • $date
  • $time
  • $now

available in Sitecore 6, but I wanted to know where to hook into to create my own tokens if I maybe want to create default values for the current user or something else.

In the web.config are two pipelines called:

<expandinitialfieldvalue help=”Processors should derive from Sitecore.Pipelines.ExpandInitialFieldValue.ExpandInitialFieldValueProcessor”>
<processor type=”Sitecore.Pipelines.ExpandInitialFieldValue.ReplaceVariables, Sitecore.Kernel”></processor>
</expandinitialfieldvalue>

<expandbranchitemname>
<processor type=”Sitecore.Pipelines.ExpandBranchItemName.ReplaceVariables, Sitecore.Kernel”></processor>
<processor type=”Sitecore.Starterkit.Extensions.CustomItemNameReplacer, Sitecore.Starterkit”></processor>
</expandbranchitemname>

So I have created a class called “CustomItemNameReplacer” hooked into the branchItemName with this code:

namespace Sitecore.Starterkit.Extensions
{
public class CustomItemNameReplacer : ExpandBranchItemNameProcessor
{
public override void Process(ExpandBranchItemNameArgs args)
{
if (args.BranchTemplateItem.Name.Equals(“$myOwnToken”))
args.Result = Sitecore.
Context.User.Name;
}
}
}


If you now create an Item with name equals “$myOwnToken” the item name will be replaced by the current user name e.g. sitecore\admin.

The same could be done for the pipeline “initialfieldvalues” and so you can create your own tokens for your own business case.

Hope I could help. cheers chris and regards from copenhagen ;-)




October 2008
M T W T F S S
« Sep   Dec »
 12345
6789101112
13141516171819
20212223242526
2728293031  

Recent Entries