Dhanuka777
Dhanuka777

Reputation: 8616

Sitecore Workbox - Modify "Open" to open up the content editor item in a new browser tab

In the Workbox we have “Open” and “Preview” functionality. Is it possible to modify the “Open” functionality to open the content editor item in a new browser tab, rather than displaying the “Content Editor” in a pop-up?

Upvotes: 0

Views: 739

Answers (2)

Dhanuka777
Dhanuka777

Reputation: 8616

In the Appconfig/Commands.config you can find commands and classes related to them. I have reflected some commands like preview, open and understood what's going on internally.

e.g. name="item:open" type="Sitecore.Shell.Framework.Commands.ContentEditor.OpenItem,Sitecore.Kernel"

And I have overridded the "Open" mwthod in the workbox as follows to open the content editor item in the new tab,

...
UrlString urlString = new UrlString("/sitecore/shell/Applications/Content%20Editor");

        urlString.Append("id", id);
        urlString.Append("vs", version);
        urlString.Append("ro", sectionId);
        urlString.Append("la", language);
        urlString.Append("fo", id);

        SheerResponse.Eval("window.open('" + (object)urlString + "', '_blank')");
...

It works!!!!!

Upvotes: 0

Trayek
Trayek

Reputation: 4410

That's possible:
First, find out what code is used for the workbox. This can be done by opening the Workbox.xml (located in webroot/sitecore/shell/Applications/Workbox) file. You'll see something like

<CodeBeside Type="Sitecore.Shell.Applications.Workbox.WorkboxForm,Sitecore.Client"/>

By using Reflector on the WorkboxForm class I can see that the following happens when you click 'Open' in workbox:

webControl["Click"] = string.Concat(new object[] { "Open(\"", item.ID, "\", \"", item.Language, "\", \"", item.Version, "\")" });

So you'll need to create your own version of a WorkboxForm, inheriting Sitecore's WorkboxForm class and override the Open method, something like so:

protected new void Open(string id, string language, string version)
{
// Your code goes here
}

In Workbox.xml, change the CodeBeside to point to your new class.

For more information on custom functionality in the Workbox, I can recommend reading through this article, which has a lot of detail in it, also on other methods in the Workbox.
There's also another useful question on StackOverflow already. The comment on the accepted answer points out you can put your Workbox.xml file into /sitecore/shell/override.

Please note that this is based on Sitecore 6.5 update 5, it might differ a bit in other versions.

Upvotes: 3

Related Questions