Sourcecode in MtApi/moveabletypeAPI.js:
1: function setPostCategories(postid, username, password, categories) {
2: var usr = root.blogger.getUser(username, password);
3: var entry = root.storiesByID.get(postid.toString());
4: if (!entry)
5: throw("Couldn't find the story with id " + postid);
6: var level = entry.site.members.getMembershipLevel(usr);
7: try {
8: entry.checkEdit(usr, level);
9: } catch (deny) {
10: throw("You are not allowed to edit the story with id "+postid);
11: }
12: if (categories.length>0)
13: entry.topic = categories[0].categoryId;
14: else
15: entry.topic = null;
16: return true;
17: }
|