Author: snoopdave
Date: Wed Apr 19 20:40:46 2006
New Revision: 395471
URL: http://svn.apache.org/viewcvs?rev=395471&view=rev
Log:
ROL-1116: default editor is now configurable (static config)
Modified:
incubator/roller/trunk/src/org/roller/pojos/WebsiteData.java
incubator/roller/trunk/src/org/roller/presentation/website/actions/CreateWebsiteAction.java
incubator/roller/trunk/src/org/roller/presentation/website/actions/WebsiteFormAction.java
Modified: incubator/roller/trunk/src/org/roller/pojos/WebsiteData.java
URL:
http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/pojos/WebsiteData.java?rev=395471&r1=395470&r2=395471&view=diff
==============================================================================
--- incubator/roller/trunk/src/org/roller/pojos/WebsiteData.java (original)
+++ incubator/roller/trunk/src/org/roller/pojos/WebsiteData.java Wed Apr 19
20:40:46 2006
@@ -7,26 +7,24 @@
import java.util.List;
import java.util.Locale;
import java.util.Map;
-import java.util.StringTokenizer;
import java.util.TimeZone;
-import java.util.regex.Pattern;
import org.apache.commons.lang.StringUtils;
import org.roller.RollerException;
-import org.roller.model.Roller;
import org.roller.model.RollerFactory;
import org.roller.util.PojoUtil;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.roller.ThemeNotFoundException;
+import org.roller.config.RollerRuntimeConfig;
import org.roller.model.ThemeManager;
import org.roller.model.UserManager;
/**
- * Website has many-to-many association with users. Website has one-to-many and
+ * Website has many-to-many association with users. Website has one-to-many and
* one-direction associations with weblog entries, weblog categories, folders
and
* other objects. Use UserManager to create, fetch, update and retreive
websites.
- *
+ *
* @author David M Johnson
*
* @ejb:bean name="WebsiteData"
@@ -35,119 +33,88 @@
* @hibernate.cache usage="read-write"
*/
public class WebsiteData extends org.roller.pojos.PersistentObject
- implements java.io.Serializable
-{
+ implements java.io.Serializable {
public static final long serialVersionUID = 206437645033737127L;
private static Log mLogger = LogFactory.getLog(WebsiteData.class);
// Simple properties
- private String id = null;
- private String handle = null;
- private String name = null;
- private String description = null;
- private String defaultPageId = "dummy";
- private String weblogDayPageId = "dummy";
+ private String id = null;
+ private String handle = null;
+ private String name = null;
+ private String description = null;
+ private String defaultPageId = "dummy";
+ private String weblogDayPageId = "dummy";
private Boolean enableBloggerApi = Boolean.TRUE;
- private String editorPage = null;
- private String blacklist = null;
- private Boolean allowComments = Boolean.TRUE;
- private Boolean emailComments = Boolean.FALSE;
+ private String editorPage = null;
+ private String blacklist = null;
+ private Boolean allowComments = Boolean.TRUE;
+ private Boolean emailComments = Boolean.FALSE;
private String emailFromAddress = null;
- private String emailAddress = null;
- private String editorTheme = null;
- private String locale = null;
- private String timeZone = null;
- private String defaultPlugins = null;
- private Boolean enabled = Boolean.TRUE;
- private Boolean active = Boolean.TRUE;
- private Date dateCreated = null;
+ private String emailAddress = null;
+ private String editorTheme = null;
+ private String locale = null;
+ private String timeZone = null;
+ private String defaultPlugins = null;
+ private Boolean enabled = Boolean.TRUE;
+ private Boolean active = Boolean.TRUE;
+ private Date dateCreated = null;
private Boolean defaultAllowComments = Boolean.TRUE;
- private int defaultCommentDays = 0;
- private Boolean moderateComments = Boolean.FALSE;
- private int entryDisplayCount = 15;
-
+ private int defaultCommentDays = 0;
+ private Boolean moderateComments = Boolean.FALSE;
+ private int entryDisplayCount = 15;
+
// Associated objects
private UserData creator = null; // TODO: decide if website.user is needed
- private List permissions = new ArrayList();
+ private List permissions = new ArrayList();
private WeblogCategoryData bloggerCategory = null;
private WeblogCategoryData defaultCategory = null;
-
-
- public WebsiteData()
- {
+
+ public WebsiteData() {
}
-
- public WebsiteData(final String id,
- final String name,
- final String handle,
- final String description,
- final UserData user,
- final String defaultPageId,
- final String weblogDayPageId,
- final Boolean enableBloggerApi,
- final WeblogCategoryData bloggerCategory,
- final WeblogCategoryData defaultCategory,
- final String editorPage,
- final String blacklist,
- final Boolean allowComments,
- final Boolean emailComments,
- final String emailFromAddress,
- final Boolean enabled,
- final String emailAddress,
- final Date dateCreated,
- final Boolean defaultAllowComments,
- final int defaultCommentDays,
- final Boolean moderateComments
- )
- {
- this.id = id;
- this.name = name;
+
+ public WebsiteData(
+ String handle,
+ UserData creator,
+ String name,
+ String desc,
+ String email,
+ String emailFrom,
+ String editorTheme,
+ String locale,
+ String timeZone) {
+
this.handle = handle;
- this.description = description;
- this.creator = user;
- this.defaultPageId = defaultPageId;
- this.weblogDayPageId = weblogDayPageId;
- this.enableBloggerApi = enableBloggerApi;
- this.bloggerCategory = bloggerCategory;
- this.defaultCategory = defaultCategory;
- this.editorPage = editorPage;
- this.blacklist = blacklist;
- this.allowComments = allowComments;
- this.emailComments = emailComments;
- this.emailFromAddress = emailFromAddress;
- this.enabled = enabled;
- this.emailAddress = emailAddress;
- this.defaultAllowComments = defaultAllowComments;
- this.defaultCommentDays = defaultCommentDays;
- this.moderateComments = moderateComments;
- this.dateCreated = dateCreated;
+ this.creator = creator;
+ this.name = name;
+ this.description = desc;
+ this.emailAddress = email;
+ this.emailFromAddress = emailFrom;
+ this.editorTheme = editorTheme;
+ this.locale = locale;
+ this.timeZone = timeZone;
}
-
- public WebsiteData(WebsiteData otherData)
- {
+
+ public WebsiteData(WebsiteData otherData) {
this.setData(otherData);
}
-
- /**
+
+ /**
* @hibernate.bag lazy="true" inverse="true" cascade="delete"
* @hibernate.collection-key column="website_id"
- * @hibernate.collection-one-to-many
+ * @hibernate.collection-one-to-many
* class="org.roller.pojos.PermissionsData"
*/
- public List getPermissions()
- {
+ public List getPermissions() {
return permissions;
}
- public void setPermissions(List perms)
- {
+ public void setPermissions(List perms) {
permissions = perms;
}
- /**
+ /**
* Remove permission from collection.
*/
- public void removePermission(PermissionsData perms)
- {
+ public void removePermission(PermissionsData perms) {
permissions.remove(perms);
}
@@ -252,7 +219,7 @@
ThemeManager themeMgr =
RollerFactory.getRoller().getThemeManager();
Theme usersTheme = themeMgr.getTheme(this.editorTheme);
template = usersTheme.getTemplate(name);
-
+
} catch(ThemeNotFoundException tnfe) {
// i sure hope not!
mLogger.error(tnfe);
@@ -293,7 +260,7 @@
ThemeManager themeMgr =
RollerFactory.getRoller().getThemeManager();
Theme usersTheme = themeMgr.getTheme(this.editorTheme);
template = usersTheme.getTemplateByLink(link);
-
+
} catch(ThemeNotFoundException tnfe) {
// i sure hope not!
mLogger.error(tnfe);
@@ -335,7 +302,7 @@
mLogger.error(e);
}
-
+
// now get theme pages if needed and put them in place of db pages
if(this.editorTheme != null && !this.editorTheme.equals(Theme.CUSTOM))
{
try {
@@ -368,34 +335,30 @@
* @hibernate.id column="id"
* generator-class="uuid.hex" unsaved-value="null"
*/
- public String getId()
- {
+ public String getId() {
return this.id;
}
-
+
/** @ejb:persistent-field */
- public void setId(String id)
- {
+ public void setId(String id) {
this.id = id;
}
-
+
/**
* Short URL safe string that uniquely identifies the website.
* @ejb:persistent-field
* @hibernate.property column="handle" non-null="true" unique="true"
* @roller.wrapPojoMethod type="simple"
*/
- public String getHandle()
- {
+ public String getHandle() {
return this.handle;
}
-
+
/** @ejb:persistent-field */
- public void setHandle(String handle)
- {
+ public void setHandle(String handle) {
this.handle = handle;
}
-
+
/**
* Name of the Website.
*
@@ -403,17 +366,15 @@
* @ejb:persistent-field
* @hibernate.property column="name" non-null="true" unique="false"
*/
- public String getName()
- {
+ public String getName() {
return this.name;
}
-
+
/** @ejb:persistent-field */
- public void setName(String name)
- {
+ public void setName(String name) {
this.name = name;
}
-
+
/**
* Description
*
@@ -421,17 +382,15 @@
* @ejb:persistent-field
* @hibernate.property column="description" non-null="true" unique="false"
*/
- public String getDescription()
- {
+ public String getDescription() {
return this.description;
}
-
+
/** @ejb:persistent-field */
- public void setDescription(String description)
- {
+ public void setDescription(String description) {
this.description = description;
}
-
+
/**
* Original creator of website
*
@@ -439,152 +398,134 @@
* @ejb:persistent-field
* @hibernate.many-to-one column="userid" cascade="none" not-null="true"
*/
- public org.roller.pojos.UserData getCreator()
- {
+ public org.roller.pojos.UserData getCreator() {
return creator;
}
-
+
/** @ejb:persistent-field */
- public void setCreator( org.roller.pojos.UserData ud )
- {
+ public void setCreator( org.roller.pojos.UserData ud ) {
creator = ud;
}
-
+
/**
* @roller.wrapPojoMethod type="simple"
* @ejb:persistent-field
* @hibernate.property column="defaultpageid" non-null="true"
unique="false"
*/
- public String getDefaultPageId()
- {
+ public String getDefaultPageId() {
return this.defaultPageId;
}
-
+
/**
* @ejb:persistent-field
*/
- public void setDefaultPageId(String defaultPageId)
- {
+ public void setDefaultPageId(String defaultPageId) {
this.defaultPageId = defaultPageId;
}
-
+
/**
* @roller.wrapPojoMethod type="simple"
* @deprecated
* @ejb:persistent-field
* @hibernate.property column="weblogdayid" non-null="true" unique="false"
*/
- public String getWeblogDayPageId()
- {
+ public String getWeblogDayPageId() {
return this.weblogDayPageId;
}
-
+
/**
* @deprecated
* @ejb:persistent-field
*/
- public void setWeblogDayPageId(String weblogDayPageId)
- {
+ public void setWeblogDayPageId(String weblogDayPageId) {
this.weblogDayPageId = weblogDayPageId;
}
-
+
/**
* @roller.wrapPojoMethod type="simple"
* @ejb:persistent-field
* @hibernate.property column="enablebloggerapi" non-null="true"
unique="false"
*/
- public Boolean getEnableBloggerApi()
- {
+ public Boolean getEnableBloggerApi() {
return this.enableBloggerApi;
}
-
+
/** @ejb:persistent-field */
- public void setEnableBloggerApi(Boolean enableBloggerApi)
- {
+ public void setEnableBloggerApi(Boolean enableBloggerApi) {
this.enableBloggerApi = enableBloggerApi;
}
-
+
/**
* @roller.wrapPojoMethod type="simple"
* @ejb:persistent-field
* @hibernate.many-to-one column="bloggercatid" non-null="false"
*/
- public WeblogCategoryData getBloggerCategory()
- {
+ public WeblogCategoryData getBloggerCategory() {
return bloggerCategory;
}
-
+
/** @ejb:persistent-field */
- public void setBloggerCategory(WeblogCategoryData bloggerCategory)
- {
+ public void setBloggerCategory(WeblogCategoryData bloggerCategory) {
this.bloggerCategory = bloggerCategory;
}
-
+
/**
* By default,the default category for a weblog is the root and all macros
* work with the top level categories that are immediately under the root.
* Setting a different default category allows you to partition your
weblog.
- *
+ *
* @roller.wrapPojoMethod type="pojo"
* @ejb:persistent-field
* @hibernate.many-to-one column="defaultcatid" non-null="false"
*/
- public WeblogCategoryData getDefaultCategory()
- {
+ public WeblogCategoryData getDefaultCategory() {
return defaultCategory;
}
-
+
/** @ejb:persistent-field */
- public void setDefaultCategory(WeblogCategoryData defaultCategory)
- {
+ public void setDefaultCategory(WeblogCategoryData defaultCategory) {
this.defaultCategory = defaultCategory;
}
-
+
/**
* @roller.wrapPojoMethod type="simple"
* @ejb:persistent-field
* @hibernate.property column="editorpage" non-null="true" unique="false"
*/
- public String getEditorPage()
- {
+ public String getEditorPage() {
return this.editorPage;
}
-
+
/** @ejb:persistent-field */
- public void setEditorPage(String editorPage)
- {
+ public void setEditorPage(String editorPage) {
this.editorPage = editorPage;
}
-
+
/**
* @roller.wrapPojoMethod type="simple"
* @ejb:persistent-field
* @hibernate.property column="blacklist" non-null="true" unique="false"
*/
- public String getBlacklist()
- {
+ public String getBlacklist() {
return this.blacklist;
}
-
+
/** @ejb:persistent-field */
- public void setBlacklist(String blacklist)
- {
+ public void setBlacklist(String blacklist) {
this.blacklist = blacklist;
}
-
+
/**
* @roller.wrapPojoMethod type="simple"
* @ejb:persistent-field
* @hibernate.property column="allowcomments" non-null="true"
unique="false"
*/
- public Boolean getAllowComments()
- {
+ public Boolean getAllowComments() {
return this.allowComments;
}
-
+
/** @ejb:persistent-field */
- public void setAllowComments(Boolean allowComments)
- {
+ public void setAllowComments(Boolean allowComments) {
this.allowComments = allowComments;
}
@@ -596,12 +537,12 @@
public Boolean getDefaultAllowComments() {
return defaultAllowComments;
}
-
+
/** @ejb:persistent-field */
public void setDefaultAllowComments(Boolean defaultAllowComments) {
this.defaultAllowComments = defaultAllowComments;
}
-
+
/**
* @roller.wrapPojoMethod type="simple"
* @ejb:persistent-field
@@ -610,12 +551,12 @@
public int getDefaultCommentDays() {
return defaultCommentDays;
}
-
+
/** @ejb:persistent-field */
public void setDefaultCommentDays(int defaultCommentDays) {
this.defaultCommentDays = defaultCommentDays;
}
-
+
/**
* @roller.wrapPojoMethod type="simple"
* @ejb:persistent-field
@@ -624,25 +565,23 @@
public Boolean getModerateComments() {
return moderateComments;
}
-
+
/** @ejb:persistent-field */
public void setModerateComments(Boolean moderateComments) {
this.moderateComments = moderateComments;
}
-
+
/**
* @roller.wrapPojoMethod type="simple"
* @ejb:persistent-field
* @hibernate.property column="emailcomments" non-null="true"
unique="false"
*/
- public Boolean getEmailComments()
- {
+ public Boolean getEmailComments() {
return this.emailComments;
}
-
+
/** @ejb:persistent-field */
- public void setEmailComments(Boolean emailComments)
- {
+ public void setEmailComments(Boolean emailComments) {
this.emailComments = emailComments;
}
@@ -651,14 +590,12 @@
* @ejb:persistent-field
* @hibernate.property column="emailfromaddress" non-null="true"
unique="false"
*/
- public String getEmailFromAddress()
- {
+ public String getEmailFromAddress() {
return this.emailFromAddress;
}
-
+
/** @ejb:persistent-field */
- public void setEmailFromAddress(String emailFromAddress)
- {
+ public void setEmailFromAddress(String emailFromAddress) {
this.emailFromAddress = emailFromAddress;
}
@@ -667,14 +604,12 @@
* @roller.wrapPojoMethod type="simple"
* @hibernate.property column="emailaddress" non-null="true" unique="false"
*/
- public String getEmailAddress()
- {
+ public String getEmailAddress() {
return this.emailAddress;
}
-
+
/** @ejb:persistent-field */
- public void setEmailAddress(String emailAddress)
- {
+ public void setEmailAddress(String emailAddress) {
this.emailAddress = emailAddress;
}
@@ -685,17 +620,15 @@
* @ejb:persistent-field
* @hibernate.property column="editortheme" non-null="true" unique="false"
*/
- public String getEditorTheme()
- {
+ public String getEditorTheme() {
return this.editorTheme;
}
-
+
/** @ejb:persistent-field */
- public void setEditorTheme(String editorTheme)
- {
+ public void setEditorTheme(String editorTheme) {
this.editorTheme = editorTheme;
}
-
+
/**
* Locale of the Website.
*
@@ -703,17 +636,15 @@
* @ejb:persistent-field
* @hibernate.property column="locale" non-null="true" unique="false"
*/
- public String getLocale()
- {
+ public String getLocale() {
return this.locale;
}
-
+
/** @ejb:persistent-field */
- public void setLocale(String locale)
- {
+ public void setLocale(String locale) {
this.locale = locale;
}
-
+
/**
* Timezone of the Website.
*
@@ -721,45 +652,35 @@
* @ejb:persistent-field
* @hibernate.property column="timeZone" non-null="true" unique="false"
*/
- public String getTimeZone()
- {
+ public String getTimeZone() {
return this.timeZone;
}
-
+
/** @ejb:persistent-field */
- public void setTimeZone(String timeZone)
- {
+ public void setTimeZone(String timeZone) {
this.timeZone = timeZone;
}
-
- /**
- * @ejb:persistent-field
- * @hibernate.property column="datecreated" non-null="true" unique="false"
- */
- public Date getDateCreated()
- {
- if (dateCreated == null)
- {
- return null;
- }
- else
- {
- return (Date)dateCreated.clone();
- }
- }
- /** @ejb:persistent-field */
- public void setDateCreated(final Date date)
- {
- if (date != null)
- {
- dateCreated = (Date)date.clone();
- }
- else
- {
- dateCreated = null;
- }
- }
-
+
+ /**
+ * @ejb:persistent-field
+ * @hibernate.property column="datecreated" non-null="true" unique="false"
+ */
+ public Date getDateCreated() {
+ if (dateCreated == null) {
+ return null;
+ } else {
+ return (Date)dateCreated.clone();
+ }
+ }
+ /** @ejb:persistent-field */
+ public void setDateCreated(final Date date) {
+ if (date != null) {
+ dateCreated = (Date)date.clone();
+ } else {
+ dateCreated = null;
+ }
+ }
+
/**
* Comma-delimited list of user's default Plugins.
*
@@ -767,47 +688,42 @@
* @ejb:persistent-field
* @hibernate.property column="defaultplugins" non-null="false"
unique="false"
*/
- public String getDefaultPlugins()
- {
+ public String getDefaultPlugins() {
return defaultPlugins;
}
-
+
/** @ejb:persistent-field */
- public void setDefaultPlugins(String string)
- {
+ public void setDefaultPlugins(String string) {
defaultPlugins = string;
}
-
- public String toString()
- {
+
+ public String toString() {
StringBuffer str = new StringBuffer("{");
-
+
str.append("id=" + id + " " + "name=" + name + " " + "description=" +
- description + " " +
- "defaultPageId=" + defaultPageId + " " +
- "weblogDayPageId=" + weblogDayPageId + " " +
- "enableBloggerApi=" + enableBloggerApi + " " +
- "bloggerCategory=" + bloggerCategory + " " +
- "defaultCategory=" + defaultCategory + " " +
- "editorPage=" + editorPage + " " +
- "blacklist=" + blacklist + " " +
- "allowComments=" + allowComments + " " +
- "emailAddress=" + emailAddress + " " +
- "emailComments=" + emailComments + " " +
- "emailFromAddress=" + emailFromAddress + " " +
- "editorTheme=" + editorTheme + " " +
- "locale=" + locale + " " +
- "timeZone=" + timeZone + " " +
- "defaultPlugins=" + defaultPlugins);
+ description + " " +
+ "defaultPageId=" + defaultPageId + " " +
+ "weblogDayPageId=" + weblogDayPageId + " " +
+ "enableBloggerApi=" + enableBloggerApi + " " +
+ "bloggerCategory=" + bloggerCategory + " " +
+ "defaultCategory=" + defaultCategory + " " +
+ "editorPage=" + editorPage + " " +
+ "blacklist=" + blacklist + " " +
+ "allowComments=" + allowComments + " " +
+ "emailAddress=" + emailAddress + " " +
+ "emailComments=" + emailComments + " " +
+ "emailFromAddress=" + emailFromAddress + " " +
+ "editorTheme=" + editorTheme + " " +
+ "locale=" + locale + " " +
+ "timeZone=" + timeZone + " " +
+ "defaultPlugins=" + defaultPlugins);
str.append('}');
-
+
return (str.toString());
}
-
- public boolean equals(Object pOther)
- {
- if (pOther instanceof WebsiteData)
- {
+
+ public boolean equals(Object pOther) {
+ if (pOther instanceof WebsiteData) {
WebsiteData lTest = (WebsiteData) pOther;
boolean lEquals = true;
lEquals = PojoUtil.equals(lEquals, this.getId(), lTest.getId());
@@ -821,24 +737,21 @@
lEquals = PojoUtil.equals(lEquals, this.getDefaultCategory(),
lTest.getDefaultCategory());
lEquals = PojoUtil.equals(lEquals, this.getEditorPage(),
lTest.getEditorPage());
lEquals = PojoUtil.equals(lEquals, this.getBlacklist(),
lTest.getBlacklist());
- lEquals = PojoUtil.equals(lEquals, this.getAllowComments(), lTest.getAllowComments());
+ lEquals = PojoUtil.equals(lEquals, this.getAllowComments(), lTest.getAllowComments());
lEquals = PojoUtil.equals(lEquals, this.getEmailComments(),
lTest.getEmailComments());
- lEquals = PojoUtil.equals(lEquals, this.getEmailAddress(), lTest.getEmailAddress());
+ lEquals = PojoUtil.equals(lEquals, this.getEmailAddress(), lTest.getEmailAddress());
lEquals = PojoUtil.equals(lEquals, this.getEmailFromAddress(),
lTest.getEmailFromAddress());
lEquals = PojoUtil.equals(lEquals, this.getEditorTheme(),
lTest.getEditorTheme());
lEquals = PojoUtil.equals(lEquals, this.getLocale(),
lTest.getLocale());
lEquals = PojoUtil.equals(lEquals, this.getTimeZone(),
lTest.getTimeZone());
- lEquals = PojoUtil.equals(lEquals, this.getDefaultPlugins(), lTest.getDefaultPlugins());
+ lEquals = PojoUtil.equals(lEquals, this.getDefaultPlugins(), lTest.getDefaultPlugins());
return lEquals;
- }
- else
- {
+ } else {
return false;
}
}
-
- public int hashCode()
- {
+
+ public int hashCode() {
int result = 17;
result = PojoUtil.addHashCode(result, this.id);
result = PojoUtil.addHashCode(result, this.name);
@@ -859,17 +772,16 @@
result = PojoUtil.addHashCode(result, this.locale);
result = PojoUtil.addHashCode(result, this.timeZone);
result = PojoUtil.addHashCode(result, this.defaultPlugins);
-
+
return result;
}
-
+
/**
* Setter is needed in RollerImpl.storePersistentObject()
*/
- public void setData(org.roller.pojos.PersistentObject otherData)
- {
+ public void setData(org.roller.pojos.PersistentObject otherData) {
WebsiteData other = (WebsiteData)otherData;
-
+
this.id = other.getId();
this.name = other.getName();
this.handle = other.getHandle();
@@ -902,30 +814,23 @@
* @roller.wrapPojoMethod type="simple"
* @return Locale
*/
- public Locale getLocaleInstance()
- {
- if (locale != null)
- {
+ public Locale getLocaleInstance() {
+ if (locale != null) {
String[] localeStr = StringUtils.split(locale,"_");
- if (localeStr.length == 1)
- {
+ if (localeStr.length == 1) {
if (localeStr[0] == null) localeStr[0] = "";
return new Locale(localeStr[0]);
- }
- else if (localeStr.length == 2)
- {
+ } else if (localeStr.length == 2) {
if (localeStr[0] == null) localeStr[0] = "";
if (localeStr[1] == null) localeStr[1] = "";
return new Locale(localeStr[0], localeStr[1]);
- }
- else if (localeStr.length == 3)
- {
+ } else if (localeStr.length == 3) {
if (localeStr[0] == null) localeStr[0] = "";
if (localeStr[1] == null) localeStr[1] = "";
if (localeStr[2] == null) localeStr[2] = "";
return new Locale(localeStr[0], localeStr[1], localeStr[2]);
- }
- }
+ }
+ }
return Locale.getDefault();
}
@@ -936,45 +841,35 @@
* @roller.wrapPojoMethod type="simple"
* @return TimeZone
*/
- public TimeZone getTimeZoneInstance()
- {
- if (timeZone == null)
- {
- if (TimeZone.getDefault() != null)
- {
+ public TimeZone getTimeZoneInstance() {
+ if (timeZone == null) {
+ if (TimeZone.getDefault() != null) {
this.setTimeZone( TimeZone.getDefault().getID() );
- }
- else
- {
+ } else {
this.setTimeZone("America/New_York");
}
}
return TimeZone.getTimeZone(timeZone);
}
-
-
+
+
/**
* Returns true if user has all permissions specified by mask.
*/
- public boolean hasUserPermissions(UserData user, short mask)
- {
+ public boolean hasUserPermissions(UserData user, short mask) {
// look for user in website's permissions
PermissionsData userPerms = null;
Iterator iter = getPermissions().iterator();
- while (iter.hasNext())
- {
+ while (iter.hasNext()) {
PermissionsData perms = (PermissionsData) iter.next();
- if (perms.getUser().getId().equals(user.getId()))
- {
+ if (perms.getUser().getId().equals(user.getId())) {
userPerms = perms;
break;
}
}
// if we found one, does it satisfy the mask?
- if (userPerms != null && !userPerms.isPending())
- {
- if (userPerms != null && (userPerms.getPermissionMask() & mask) == mask)
- {
+ if (userPerms != null && !userPerms.isPending()) {
+ if (userPerms != null && (userPerms.getPermissionMask() & mask) ==
mask) {
return true;
}
}
@@ -984,28 +879,23 @@
}
/** Get number of users associated with website */
- public int getUserCount()
- {
+ public int getUserCount() {
return getPermissions().size();
}
/** No-op needed to please XDoclet generated code */
- private int userCount = 0;
- public void setUserCount(int userCount)
- {
+ private int userCount = 0;
+ public void setUserCount(int userCount) {
// no-op
}
- public int getAdminUserCount()
- {
+ public int getAdminUserCount() {
int count = 0;
PermissionsData userPerms = null;
Iterator iter = getPermissions().iterator();
- while (iter.hasNext())
- {
+ while (iter.hasNext()) {
PermissionsData perms = (PermissionsData) iter.next();
- if (perms.getPermissionMask() == PermissionsData.ADMIN)
- {
+ if (perms.getPermissionMask() == PermissionsData.ADMIN) {
count++;
}
}
@@ -1013,12 +903,11 @@
}
/** No-op needed to please XDoclet generated code */
- private int adminUserCount = 0;
- public void setAdminUserCount(int adminUserCount)
- {
+ private int adminUserCount = 0;
+ public void setAdminUserCount(int adminUserCount) {
// no-op
}
-
+
/**
* @roller.wrapPojoMethod type="simple"
@@ -1028,14 +917,14 @@
public int getEntryDisplayCount() {
return entryDisplayCount;
}
-
+
/**
* @ejb:persistent-field
*/
public void setEntryDisplayCount(int entryDisplayCount) {
this.entryDisplayCount = entryDisplayCount;
}
-
+
/**
* Set to FALSE to completely disable and hide this weblog from public
view.
*
@@ -1043,19 +932,17 @@
* @ejb:persistent-field
* @hibernate.property column="isenabled" non-null="true" unique="false"
*/
- public Boolean getEnabled()
- {
+ public Boolean getEnabled() {
return this.enabled;
}
- /** @ejb:persistent-field */
- public void setEnabled(Boolean enabled)
- {
+ /** @ejb:persistent-field */
+ public void setEnabled(Boolean enabled) {
this.enabled = enabled;
}
/**
- * Set to FALSE to exclude this weblog from community areas such as the
+ * Set to FALSE to exclude this weblog from community areas such as the
* front page and the planet page.
*
* @roller.wrapPojoMethod type="simple"
@@ -1065,10 +952,20 @@
public Boolean getActive() {
return active;
}
-
+
public void setActive(Boolean active) {
this.active = active;
}
+ /**
+ * Returns true if comment moderation is required by website or config.
+ */
+ public boolean getCommentModerationRequired() {
+ return getModerateComments()
+ || RollerRuntimeConfig.getBooleanProperty("users.moderation.required");
+ }
+
+ /** No-op */
+ public void setCommentModerationRequired(boolean modRequired) {}
}
Modified:
incubator/roller/trunk/src/org/roller/presentation/website/actions/CreateWebsiteAction.java
URL:
http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/presentation/website/actions/CreateWebsiteAction.java?rev=395471&r1=395470&r2=395471&view=diff
==============================================================================
---
incubator/roller/trunk/src/org/roller/presentation/website/actions/CreateWebsiteAction.java
(original)
+++
incubator/roller/trunk/src/org/roller/presentation/website/actions/CreateWebsiteAction.java
Wed Apr 19 20:40:46 2006
@@ -136,32 +136,18 @@
}
}
- WebsiteData newWebsite = new WebsiteData(
- null, // id
- form.getName(), // name
- form.getHandle(), // handle
- form.getDescription(), // description
- user, // userId
- "dummy", // defaultPageId
- "dummy", // weblogDayPageId
- Boolean.TRUE, // enableBloggerApi
- null, // bloggerCategory
- null, // defaultCategory
- "editor-text.jsp", // editorPage
- "", // blacklist
- Boolean.TRUE, // allowComments
- Boolean.FALSE, // emailComments
- "", // emailFromAddress
- Boolean.TRUE, // isEnabled
- form.getEmailAddress(), // emailAddress
- new java.util.Date(), // dateCreated
- Boolean.TRUE, // defaultAllowComments
- 0, // defaultCommentDays
- Boolean.FALSE); // moderateComments
- newWebsite.setEditorTheme(form.getTheme());
- newWebsite.setLocale(form.getLocale());
- newWebsite.setTimeZone(form.getTimeZone());
- mgr.addWebsite(newWebsite);
+ WebsiteData wd = new WebsiteData(
+ form.getHandle(),
+ user,
+ form.getName(),
+ form.getDescription(),
+ form.getEmailAddress(),
+ form.getEmailAddress(),
+ form.getTheme(),
+ form.getLocale(),
+ form.getTimeZone());
+ wd.setEditorPage(RollerConfig.getProperty("newweblog.editor"));
+ mgr.addWebsite(wd);
RollerFactory.getRoller().flush();
Modified:
incubator/roller/trunk/src/org/roller/presentation/website/actions/WebsiteFormAction.java
URL:
http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/presentation/website/actions/WebsiteFormAction.java?rev=395471&r1=395470&r2=395471&view=diff
==============================================================================
---
incubator/roller/trunk/src/org/roller/presentation/website/actions/WebsiteFormAction.java
(original)
+++
incubator/roller/trunk/src/org/roller/presentation/website/actions/WebsiteFormAction.java
Wed Apr 19 20:40:46 2006
@@ -296,6 +296,8 @@
public class WebsitePageModel extends BasePageModel {
private List permissions = new ArrayList();
private boolean groupBloggingEnabled = false;
+ private boolean emailNotificationEnabled = false;
+ private boolean moderationRequired = false;
public WebsitePageModel(
String titleKey,
HttpServletRequest request,
@@ -309,15 +311,21 @@
UserData user = rollerSession.getAuthenticatedUser();
permissions = roller.getUserManager().getAllPermissions(website);
groupBloggingEnabled =
- RollerConfig.getBooleanProperty("groupblogging.enabled");
+ RollerConfig.getBooleanProperty("groupblogging.enabled");
+ emailNotificationEnabled =
+ RollerRuntimeConfig.getBooleanProperty("users.comments.emailnotify");
+ moderationRequired =
+ RollerRuntimeConfig.getBooleanProperty("users.moderation.required");
}
public boolean isGroupBloggingEnabled() {
return groupBloggingEnabled;
}
- public void setGroupBloggingEnabled(boolean groupBloggingEnabled) {
- this.groupBloggingEnabled = groupBloggingEnabled;
+ public boolean isEmailNotificationEnabled() {
+ return emailNotificationEnabled;
+ }
+ public boolean isModerationRequired() {
+ return moderationRequired;
}
-
public boolean getHasPagePlugins() {
boolean ret = false;
try {