OrchardCMS / Orchard

Orchard is a free, open source, community-focused Content Management System built on the ASP.NET MVC platform.
https://orchardproject.net
BSD 3-Clause "New" or "Revised" License
2.37k stars 1.12k forks source link

Can't Override Live Writer Theme in XmlRpc Module #1701

Open orchardbot opened 13 years ago

orchardbot commented 13 years ago

jaredbienz created: https://orchard.codeplex.com/workitem/17871

I've installed a custom theme on my site that I bought from BindTuning. It looks great, but Live Writer just cannot seem to download it correctly. Sadly, Live Writer having difficulty with themes is nothing new, but there is a way to force a fix on the server side.

The Live Writer manifest tells Live Writer more information about the site:

http://msdn.microsoft.com/en-us/library/bb463265.aspx

Specifically the element can force Live Writer to use custom pages for Layout (Edit) and Preview modes instead of trying to create them.

http://msdn.microsoft.com/en-us/library/bb463261.aspx

So the fix should be as easy:

  1. Make my own custom pages with the right tokens (like {post-title} and {post-body})
  2. Add the pages to my site (probably somewhere off my Theme folder)
  3. Add a element to the wlmanifest.xml and make it point to the files I added in step #2

The problem is there is no wlmanifest.xml to edit. The manifest it's generated dynamically by LiveWriterController in the Manifest method, and that method provides no way to specify additional elements.

Ideally there would be two text configuration settings for the XmlRpc module: WebLayout Path and WebPreview Path. If either of those fields are not null, the element and appropriate child element would be added to the manifest. It's OK to render only one element if they're not both specified; Live Writer is still supposed to auto-detect the other.

orchardbot commented 13 years ago

jaredbienz commented:

I did some more digging and I now better understand how the XmlRpc configuration chain works. It looks like any module can participate in remote publishing by adding a class that implements IXmlRpcHandler. To specify what options each handler supports, the IXmlRpcHandler interface has a method called SetCapabilities. SetCapabilities takes in an XElement that is the element from the manifest. The handler can then add additional options where it makes sense. For example, the xmlRpcHandler for Media adds the supportsFileUpload option.

Since Orchard can theoretically have different views per blog, it kinda makes sense to have WebLayout Path and WebPreview Path be specified on each blog. That's also a pain though, so a default would be nice.

Having said all that, since the SetCapabilities method only receives the element I don't believe there's any way for the xmlRpcHandler in the Blogs module to add this information.

orchardbot commented 13 years ago

jaredbienz commented:

I've looked through and through and I can’t see any solution without touching the XmlRpc module itself. I created an add-in that implemented IXmlRpcHandler and tried getting to the Parent of the node. That didn't work because the node hasn't been added to anything before it's passed off to the handlers.

I thought about attempting the fix to the XmlRpc module myself and submitting a patch, but I’m just not skilled enough with Orchard to create configuration settings and an edit screen.

I also thought about coding it to look for WebLayout.htm and WebPreview.htm in the current theme, but I don't know what method I should use to determine the current theme path.