2013-04-15 21:15:15 +00:00
|
|
|
define(["jquery", "google-helper"], function($, googleHelper) {
|
|
|
|
|
|
|
|
// Dependencies
|
|
|
|
var core = undefined;
|
|
|
|
|
|
|
|
var bloggerProvider = {
|
|
|
|
providerId: PROVIDER_BLOGGER,
|
|
|
|
providerName: "Blogger",
|
|
|
|
defaultPublishFormat: "html"
|
|
|
|
};
|
|
|
|
|
|
|
|
bloggerProvider.publish = function(publishAttributes, title, content, callback) {
|
|
|
|
googleHelper.uploadBlogger(publishAttributes.blogUrl,
|
|
|
|
publishAttributes.blogId, publishAttributes.postId, title, content,
|
2013-04-20 00:14:20 +00:00
|
|
|
function(error, blogId, postId) {
|
|
|
|
if(error) {
|
|
|
|
callback(error);
|
2013-04-15 21:15:15 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
publishAttributes.blogId = blogId;
|
|
|
|
publishAttributes.postId = postId;
|
|
|
|
callback();
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
bloggerProvider.newPublishAttributes = function(event) {
|
|
|
|
var publishAttributes = {};
|
|
|
|
publishAttributes.blogUrl = core.getInputValue($("#input-publish-blogger-url"), event);
|
2013-04-20 00:14:20 +00:00
|
|
|
publishAttributes.postId = $("#input-publish-blogger-postid").val() || undefined;
|
2013-04-15 21:15:15 +00:00
|
|
|
if(event.isPropagationStopped()) {
|
|
|
|
return undefined;
|
|
|
|
}
|
|
|
|
return publishAttributes;
|
|
|
|
};
|
|
|
|
|
|
|
|
bloggerProvider.init = function(coreModule) {
|
|
|
|
core = coreModule;
|
|
|
|
};
|
|
|
|
|
|
|
|
return bloggerProvider;
|
|
|
|
});
|