Updating XmlRpc functionality to clear up the confusion with Live Writer (WLW) and categories (since there is not category support)

- updated IXmlRpcHandler to also have a vvoid SetCapabilities(XElement element) so handlers can specify what capabilities they support
- updated the WLW manifest to have a thiner capability set (e.g. no category support) so handlers can light up what they support
- updated the XmlRpcHandlers to add what capabilities they support. there'a room for imporoving (adding/removing) specified capabilities here so the WLW only shows features for what's supported
- added WLW support for tags so a tags input can be used in place of the categories input in the WLW UI

--HG--
branch : dev
This commit is contained in:
Nathan Heskew
2010-11-17 15:36:57 -08:00
parent 5b8bbfb3cf
commit bb3e63b9d9
17 changed files with 331 additions and 111 deletions

View File

@@ -1,10 +1,6 @@
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
using System.Xml.Linq;
using Orchard.Blogs.Extensions;
using Orchard.Blogs.Models;
using Orchard.Blogs.Routing;
using Orchard.Blogs.Services;
using Orchard.Core.Feeds;
@@ -21,22 +17,19 @@ namespace Orchard.Blogs.Controllers {
private readonly IBlogPostService _blogPostService;
private readonly IBlogSlugConstraint _blogSlugConstraint;
private readonly IFeedManager _feedManager;
private readonly RouteCollection _routeCollection;
public BlogController(
IOrchardServices services,
IBlogService blogService,
IBlogPostService blogPostService,
IBlogSlugConstraint blogSlugConstraint,
IFeedManager feedManager,
RouteCollection routeCollection,
IFeedManager feedManager,
IShapeFactory shapeFactory) {
_services = services;
_blogService = blogService;
_blogPostService = blogPostService;
_blogSlugConstraint = blogSlugConstraint;
_feedManager = feedManager;
_routeCollection = routeCollection;
Logger = NullLogger.Instance;
Shape = shapeFactory;
}
@@ -79,64 +72,5 @@ namespace Orchard.Blogs.Controllers {
return View(blog);
}
public ActionResult LiveWriterManifest(string blogSlug) {
Logger.Debug("Live Writer Manifest requested");
BlogPart blogPart = _blogService.Get(blogSlug);
if (blogPart == null)
return HttpNotFound();
const string manifestUri = "http://schemas.microsoft.com/wlw/manifest/weblog";
var options = new XElement(
XName.Get("options", manifestUri),
new XElement(XName.Get("clientType", manifestUri), "Metaweblog"),
new XElement(XName.Get("supportsSlug", manifestUri), "Yes"),
new XElement(XName.Get("supportsKeywords", manifestUri), "Yes"));
var doc = new XDocument(new XElement(
XName.Get("manifest", manifestUri),
options));
Response.Cache.SetCacheability(HttpCacheability.NoCache);
return Content(doc.ToString(), "text/xml");
}
public ActionResult Rsd(string blogSlug) {
Logger.Debug("RSD requested");
BlogPart blogPart = _blogService.Get(blogSlug);
if (blogPart == null)
return HttpNotFound();
const string manifestUri = "http://archipelago.phrasewise.com/rsd";
var urlHelper = new UrlHelper(ControllerContext.RequestContext, _routeCollection);
var url = urlHelper.Action("", "", new { Area = "XmlRpc" });
var options = new XElement(
XName.Get("service", manifestUri),
new XElement(XName.Get("engineName", manifestUri), "Orchard CMS"),
new XElement(XName.Get("engineLink", manifestUri), "http://orchardproject.net"),
new XElement(XName.Get("homePageLink", manifestUri), "http://orchardproject.net"),
new XElement(XName.Get("apis", manifestUri),
new XElement(XName.Get("api", manifestUri),
new XAttribute("name", "MetaWeblog"),
new XAttribute("preferred", true),
new XAttribute("apiLink", url),
new XAttribute("blogID", blogPart.Id))));
var doc = new XDocument(new XElement(
XName.Get("rsd", manifestUri),
new XAttribute("version", "1.0"),
options));
Response.Cache.SetCacheability(HttpCacheability.NoCache);
return Content(doc.ToString(), "text/xml");
}
}
}