mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
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:
@@ -1,7 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Routing;
|
||||
using System.Xml.Linq;
|
||||
using JetBrains.Annotations;
|
||||
using Orchard.Blogs.Models;
|
||||
using Orchard.ContentManagement;
|
||||
@@ -44,6 +46,11 @@ namespace Orchard.Blogs.Services {
|
||||
|
||||
public ILogger Logger { get; set; }
|
||||
|
||||
public void SetCapabilities(XElement options) {
|
||||
const string manifestUri = "http://schemas.microsoft.com/wlw/manifest/weblog";
|
||||
options.SetElementValue(XName.Get("supportsSlug", manifestUri), "Yes");
|
||||
}
|
||||
|
||||
public void Process(XmlRpcContext context) {
|
||||
var urlHelper = new UrlHelper(context.ControllerContext.RequestContext, _routeCollection);
|
||||
|
||||
@@ -72,7 +79,8 @@ namespace Orchard.Blogs.Services {
|
||||
Convert.ToString(context.Request.Params[1].Value),
|
||||
Convert.ToString(context.Request.Params[2].Value),
|
||||
(XRpcStruct)context.Request.Params[3].Value,
|
||||
Convert.ToBoolean(context.Request.Params[4].Value));
|
||||
Convert.ToBoolean(context.Request.Params[4].Value),
|
||||
context._drivers);
|
||||
|
||||
context.Response = new XRpcMethodResponse().Add(result);
|
||||
}
|
||||
@@ -92,7 +100,8 @@ namespace Orchard.Blogs.Services {
|
||||
Convert.ToString(context.Request.Params[1].Value),
|
||||
Convert.ToString(context.Request.Params[2].Value),
|
||||
(XRpcStruct)context.Request.Params[3].Value,
|
||||
Convert.ToBoolean(context.Request.Params[4].Value));
|
||||
Convert.ToBoolean(context.Request.Params[4].Value),
|
||||
context._drivers);
|
||||
context.Response = new XRpcMethodResponse().Add(result);
|
||||
}
|
||||
|
||||
@@ -102,7 +111,8 @@ namespace Orchard.Blogs.Services {
|
||||
Convert.ToString(context.Request.Params[1].Value),
|
||||
Convert.ToString(context.Request.Params[2].Value),
|
||||
Convert.ToString(context.Request.Params[3].Value),
|
||||
Convert.ToBoolean(context.Request.Params[4].Value));
|
||||
Convert.ToBoolean(context.Request.Params[4].Value),
|
||||
context._drivers);
|
||||
context.Response = new XRpcMethodResponse().Add(result);
|
||||
}
|
||||
}
|
||||
@@ -152,7 +162,8 @@ namespace Orchard.Blogs.Services {
|
||||
string userName,
|
||||
string password,
|
||||
XRpcStruct content,
|
||||
bool publish) {
|
||||
bool publish,
|
||||
IEnumerable<IXmlRpcDriver> drivers) {
|
||||
|
||||
var user = _membershipService.ValidateUser(userName, password);
|
||||
_authorizationService.CheckAccess(Permissions.EditBlogPost, user, null);
|
||||
@@ -191,6 +202,9 @@ namespace Orchard.Blogs.Services {
|
||||
if (publish)
|
||||
_blogPostService.Publish(blogPost);
|
||||
|
||||
foreach (var driver in drivers)
|
||||
driver.Process(blogPost.Id);
|
||||
|
||||
return blogPost.Id;
|
||||
}
|
||||
|
||||
@@ -210,12 +224,7 @@ namespace Orchard.Blogs.Services {
|
||||
return CreateBlogStruct(blogPost, urlHelper);
|
||||
}
|
||||
|
||||
private bool MetaWeblogEditPost(
|
||||
int postId,
|
||||
string userName,
|
||||
string password,
|
||||
XRpcStruct content,
|
||||
bool publish) {
|
||||
private bool MetaWeblogEditPost(int postId, string userName, string password, XRpcStruct content, bool publish, ICollection<IXmlRpcDriver> drivers) {
|
||||
|
||||
var user = _membershipService.ValidateUser(userName, password);
|
||||
_authorizationService.CheckAccess(StandardPermissions.AccessFrontEnd, user, null);
|
||||
@@ -233,19 +242,16 @@ namespace Orchard.Blogs.Services {
|
||||
blogPost.Slug = slug;
|
||||
blogPost.Text = description;
|
||||
|
||||
if (publish) {
|
||||
if (publish)
|
||||
_blogPostService.Publish(blogPost);
|
||||
}
|
||||
|
||||
foreach (var driver in drivers)
|
||||
driver.Process(blogPost.Id);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool MetaWeblogDeletePost(
|
||||
string appkey,
|
||||
string postId,
|
||||
string userName,
|
||||
string password,
|
||||
bool publish) {
|
||||
private bool MetaWeblogDeletePost(string appkey, string postId, string userName, string password, bool publish, ICollection<IXmlRpcDriver> drivers) {
|
||||
var user = _membershipService.ValidateUser(userName, password);
|
||||
_authorizationService.CheckAccess(StandardPermissions.AccessFrontEnd, user, null);
|
||||
|
||||
@@ -253,6 +259,9 @@ namespace Orchard.Blogs.Services {
|
||||
if (blogPost == null)
|
||||
throw new ArgumentException();
|
||||
|
||||
foreach (var driver in drivers)
|
||||
driver.Process(blogPost.Id);
|
||||
|
||||
_blogPostService.Delete(blogPost);
|
||||
return true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user