2001-06-28 18:09:37 +00:00
|
|
|
/**
|
2002-02-04 17:26:04 +00:00
|
|
|
* check if user is allowed to post a comment to this story
|
|
|
|
* @param Obj Userobject
|
|
|
|
* @return String Reason for denial (or null if allowed)
|
|
|
|
*/
|
|
|
|
|
2002-03-27 11:19:38 +00:00
|
|
|
function isPostDenied(usr) {
|
|
|
|
if (usr.isSysAdmin())
|
|
|
|
return null;
|
2002-02-04 17:26:04 +00:00
|
|
|
if (!this.weblog.isOnline() && !this.weblog.isUserMember(usr))
|
|
|
|
return ("This weblog is not public!");
|
|
|
|
else if (!this.weblog.hasDiscussions())
|
|
|
|
return ("Sorry, discussions were disabled for this weblog!");
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2001-06-28 18:09:37 +00:00
|
|
|
* check if user is allowed to delete this story
|
2001-12-10 23:22:58 +00:00
|
|
|
* @param Obj Userobject
|
|
|
|
* @return String Reason for denial (or null if allowed)
|
2001-06-28 18:09:37 +00:00
|
|
|
*/
|
|
|
|
|
2001-12-10 23:22:58 +00:00
|
|
|
function isDeleteDenied(usr) {
|
2002-01-22 20:21:13 +00:00
|
|
|
if (this.author != usr) {
|
|
|
|
var membership = this.weblog.isUserMember(usr);
|
|
|
|
if (!membership)
|
|
|
|
return ("You're not a member of this weblog!");
|
|
|
|
else if ((membership.level & MAY_DELETE_ANYSTORY) == 0)
|
|
|
|
return ("You cannot delete the story of somebody else!");
|
|
|
|
}
|
2001-09-05 21:15:45 +00:00
|
|
|
return null;
|
2001-06-28 18:09:37 +00:00
|
|
|
}
|
|
|
|
|
2001-06-18 08:57:33 +00:00
|
|
|
/**
|
|
|
|
* check if user is allowed to edit this story
|
2001-12-10 23:22:58 +00:00
|
|
|
* @param Obj Userobject
|
|
|
|
* @return String Reason for denial (or null if allowed)
|
2001-06-18 08:57:33 +00:00
|
|
|
*/
|
|
|
|
|
2001-12-10 23:22:58 +00:00
|
|
|
function isEditDenied(usr) {
|
2002-01-22 20:21:13 +00:00
|
|
|
if (this.author != usr) {
|
|
|
|
var membership = this.weblog.isUserMember(usr);
|
|
|
|
if (!membership)
|
|
|
|
return ("You're not a member of this weblog!");
|
|
|
|
else if (this.editableby == null && (membership.level & MAY_EDIT_ANYSTORY) == 0)
|
|
|
|
return ("You're not allowed to edit this story!");
|
|
|
|
else if (this.editableby == 1 && (membership.level & MAY_ADD_STORY) == 0)
|
|
|
|
return ("You're not allowed to edit this story!");
|
|
|
|
}
|
2001-09-05 21:15:45 +00:00
|
|
|
return null;
|
2001-07-21 21:46:27 +00:00
|
|
|
}
|
2001-08-15 09:03:16 +00:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
2001-11-18 13:24:53 +00:00
|
|
|
* check if user is allowed to view story
|
2001-12-10 23:22:58 +00:00
|
|
|
* @param Obj Userobject
|
|
|
|
* @return String Reason for denial (or null if allowed)
|
2001-08-15 09:03:16 +00:00
|
|
|
*/
|
|
|
|
|
2001-12-10 23:22:58 +00:00
|
|
|
function isViewDenied(usr) {
|
2002-01-22 20:21:13 +00:00
|
|
|
if (this.weblog.isNotPublic(usr))
|
2001-11-18 13:24:53 +00:00
|
|
|
return ("Sorry, this weblog is not public!");
|
2002-01-22 20:21:13 +00:00
|
|
|
else if (!this.isOnline() && this.author != usr) {
|
|
|
|
var membership = this.weblog.isUserMember(usr);
|
|
|
|
if (!membership)
|
|
|
|
return ("You're not a a member of this weblog!");
|
|
|
|
else if (this.editableby == null && (membership.level & MAY_EDIT_ANYSTORY) == 0)
|
|
|
|
return ("You're not allowed to see this story!");
|
|
|
|
else if (this.editableby == 1 && (membership.level & MAY_ADD_STORY) == 0)
|
|
|
|
return ("Only Contributors are allowed to see this story!");
|
|
|
|
}
|
2001-11-18 13:24:53 +00:00
|
|
|
return null;
|
2001-11-03 09:29:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* function explicitly allowes some macros for use in the text of a story
|
2001-12-10 23:22:58 +00:00
|
|
|
* @param Obj Skin-object to allow macros for
|
2001-11-03 09:29:28 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
function allowTextMacros(s) {
|
|
|
|
s.allowMacro("image");
|
|
|
|
s.allowMacro("this.image");
|
|
|
|
s.allowMacro("weblog.image");
|
|
|
|
s.allowMacro("story.image");
|
|
|
|
s.allowMacro("thumbnail");
|
|
|
|
s.allowMacro("this.thumbnail");
|
|
|
|
s.allowMacro("weblog.thumbnail");
|
|
|
|
s.allowMacro("story.thumbnail");
|
|
|
|
s.allowMacro("link");
|
|
|
|
s.allowMacro("this.link");
|
|
|
|
s.allowMacro("weblog.link");
|
|
|
|
s.allowMacro("story.link");
|
|
|
|
s.allowMacro("goodie");
|
2002-02-04 17:16:38 +00:00
|
|
|
s.allowMacro("poll");
|
2002-02-04 20:12:30 +00:00
|
|
|
s.allowMacro("logo");
|
2001-11-03 09:29:28 +00:00
|
|
|
return;
|
2001-08-15 09:03:16 +00:00
|
|
|
}
|