Friday, April 24, 2015

Sitecore SPEAK Upload Media Dialog doesn't Upload any files

It looks like that the image had been uploaded but it never finished. First of all I've found an exception in the Sitecore:

 No component for supporting the service Sitecore.Controllers.MediaController was found

It was fixed by registering the component in the code:


But unfortunately it didn't help me (: That is mean my current Sitecore should be updated, Sitecore CMS 7.5 rev. 141003 Hotfix 431794-1 should fix it. But if we can't do any updates for some reason, we can switch to the old style Upload dialog.
Just go to  /App_Config/Include/Sitecore.Speak.Applications.config file and comment out the following line:

   <override xmlControl="Sitecore.Shell.Applications.Media.MediaBrowser" 
          with="/sitecore/client/applications/Dialogs/SelectMediaDialog" />

That is it! 

Tuesday, April 14, 2015

Injecting javascript and css to Sitecore Content Editor Page

Sometimes we need to use javascript in our custom fields, to do that we should inject them into Content Editor Page: 

    public class InjectScripts
        public void Process(PipelineArgs args)
            if (Sitecore.Context.ClientPage.IsEvent) return;

            HttpContext current = HttpContext.Current;
            if (current == null) return;

            Page page = current.Handler as Page;
            if (page == null) return;

            string[] strArray = {
            foreach (string str in strArray) page.Header.Controls.Add(new LiteralControl(string.Format("", str)));
            page.Header.Controls.Add(new LiteralControl(""));

And in config file:

<configuration xmlns:patch="">
        <processor patch:before="*[1]" type="CustomField.InjectScripts, CustomField">

Very Easy!