KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > blojsom > plugin > admin > EditBlogsPlugin


1 /**
2  * Copyright (c) 2003-2006, David A. Czarnecki
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
8  * Redistributions of source code must retain the above copyright notice, this list of conditions and the
9  * following disclaimer.
10  * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the
11  * following disclaimer in the documentation and/or other materials provided with the distribution.
12  * Neither the name of "David A. Czarnecki" and "blojsom" nor the names of its contributors may be used to
13  * endorse or promote products derived from this software without specific prior written permission.
14  * Products derived from this software may not be called "blojsom", nor may "blojsom" appear in their name,
15  * without prior written permission of David A. Czarnecki.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
18  * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
19  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
20  * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
21  * EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
22  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
26  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
27  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
29  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30  */

31 package org.blojsom.plugin.admin;
32
33 import org.apache.commons.logging.Log;
34 import org.apache.commons.logging.LogFactory;
35 import org.blojsom.blog.Blog;
36 import org.blojsom.blog.Entry;
37 import org.blojsom.blog.User;
38 import org.blojsom.fetcher.Fetcher;
39 import org.blojsom.fetcher.FetcherException;
40 import org.blojsom.plugin.PluginException;
41 import org.blojsom.util.BlojsomConstants;
42 import org.blojsom.util.BlojsomUtils;
43
44 import javax.servlet.http.HttpServletRequest JavaDoc;
45 import javax.servlet.http.HttpServletResponse JavaDoc;
46 import java.io.File JavaDoc;
47 import java.io.IOException JavaDoc;
48 import java.util.Date JavaDoc;
49 import java.util.HashMap JavaDoc;
50 import java.util.Map JavaDoc;
51 import java.util.Properties JavaDoc;
52
53 /**
54  * EditBlogsPlugin
55  *
56  * @author David Czarnecki
57  * @version $Id: EditBlogsPlugin.java,v 1.6 2006/09/26 02:55:20 czarneckid Exp $
58  * @since blojsom 3.0
59  */

60 public class EditBlogsPlugin extends BaseAdminPlugin {
61
62     private Log _logger = LogFactory.getLog(EditBlogsPlugin.class);
63
64     // Pages
65
private static final String JavaDoc EDIT_BLOG_USERS_PAGE = "/org/blojsom/plugin/admin/templates/admin-edit-blogs";
66
67     // Localization constants
68
private static final String JavaDoc FAILED_DELETE_BLOGS_PERMISSION_KEY = "failed.delete.blogs.permission.text";
69     private static final String JavaDoc FAILED_REMOVE_BLOG_CONFIGURATION_KEY = "failed.remove.blog.configuration.text";
70     private static final String JavaDoc FAILED_REMOVE_BLOG_DIRECTORY_KEY = "failed.remove.blog.directory.text";
71     private static final String JavaDoc FAILED_REMOVE_BLOG_RESOURCES_DIRECTORY_KEY = "failed.remove.blog.resources.text";
72     private static final String JavaDoc DELETED_BLOG_KEY = "deleted.blog.text";
73
74     private static final String JavaDoc FAILED_DELETE_PROTECTED_BLOG_KEY = "failed.delete.protected.blog.text";
75     private static final String JavaDoc FAILED_ADD_BLOGS_PERMISSION_KEY = "failed.add.blogs.permission.text";
76     private static final String JavaDoc MISSING_WEBLOG_ID_KEY = "missing.weblog.id.text";
77     private static final String JavaDoc WEBLOG_ID_EXISTS_KEY = "weblog.id.exists.text";
78     private static final String JavaDoc WEBLOG_DIRECTORY_EXISTS_KEY = "weblog.directory.exists.text";
79     private static final String JavaDoc PASSWORDS_NOT_MATCHED_KEY = "passwords.not.matched.text";
80     private static final String JavaDoc FAILED_BOOTSTRAP_DIRECTORY_COPY_KEY = "failed.bootstrap.directory.copy.text";
81     private static final String JavaDoc FAILED_BLOG_DIRECTORY_CREATE_KEY = "failed.blog.directory.create.text";
82     private static final String JavaDoc ADDED_NEW_WEBLOG_KEY = "added.new.blog.text";
83
84     private static final String JavaDoc BLOJSOM_PLUGIN_EDIT_BLOGS = "BLOJSOM_PLUGIN_EDIT_BLOGS";
85
86     // Actions
87
private static final String JavaDoc DELETE_BLOG_USER_ACTION = "delete-blog-user";
88     private static final String JavaDoc ADD_BLOG_USER_ACTION = "add-blog-user";
89
90     // Form elements
91
private static final String JavaDoc BLOG_ID = "blog-id";
92     private static final String JavaDoc BLOG_LOGIN_ID = "blog-login-id";
93     private static final String JavaDoc BLOG_USER_EMAIL = "blog-user-email";
94     private static final String JavaDoc BLOG_USER_NAME = "blog-user-name";
95     private static final String JavaDoc BLOG_USER_PASSWORD = "blog-user-password";
96     private static final String JavaDoc BLOG_USER_PASSWORD_CHECK = "blog-user-password-check";
97
98     // Permissions
99
private static final String JavaDoc ADD_BLOG_PERMISSION = "add_blog";
100     private static final String JavaDoc DELETE_BLOG_PERMISSION = "delete_blog";
101
102     private Fetcher _fetcher;
103     private Map JavaDoc _defaultBlogProperties;
104     private Map JavaDoc _defaultTemplateProperties;
105     private Map JavaDoc _defaultPluginProperties;
106     private Properties JavaDoc _blojsomProperties;
107     private Map JavaDoc _protectedBlogs;
108
109     /**
110      * Default constructor.
111      */

112     public EditBlogsPlugin() {
113     }
114
115     /**
116      * Set the {@link Fetcher}
117      *
118      * @param fetcher {@link Fetcher}
119      */

120     public void setFetcher(Fetcher fetcher) {
121         _fetcher = fetcher;
122     }
123
124     /**
125      * Set the default blog properties
126      *
127      * @param defaultBlogProperties Default blog properties
128      */

129     public void setDefaultBlogProperties(Map JavaDoc defaultBlogProperties) {
130         _defaultBlogProperties = defaultBlogProperties;
131     }
132
133     /**
134      * Set the default template properties
135      *
136      * @param defaultTemplateProperties Default template properties
137      */

138     public void setDefaultTemplateProperties(Map JavaDoc defaultTemplateProperties) {
139         _defaultTemplateProperties = defaultTemplateProperties;
140     }
141
142     /**
143      * Set the default plugin properties
144      *
145      * @param defaultPluginProperties Default plugin properties
146      */

147     public void setDefaultPluginProperties(Map JavaDoc defaultPluginProperties) {
148         _defaultPluginProperties = defaultPluginProperties;
149     }
150
151     /**
152      * Set the default blojsom properties
153      *
154      * @param blojsomProperties Default blojsom properties
155      */

156     public void setBlojsomProperties(Properties JavaDoc blojsomProperties) {
157         _blojsomProperties = blojsomProperties;
158     }
159
160     /**
161      * Set the protected blogs (cannot be deleted)
162      *
163      * @param protectedBlogs Map of protected blogs
164      */

165     public void setProtectedBlogs(Map JavaDoc protectedBlogs) {
166         _protectedBlogs = protectedBlogs;
167     }
168
169     /**
170      * Process the blog entries
171      *
172      * @param httpServletRequest Request
173      * @param httpServletResponse Response
174      * @param blog {@link Blog} instance
175      * @param context Context
176      * @param entries Blog entries retrieved for the particular request
177      * @return Modified set of blog entries
178      * @throws PluginException If there is an error processing the blog entries
179      */

180     public Entry[] process(HttpServletRequest JavaDoc httpServletRequest, HttpServletResponse JavaDoc httpServletResponse, Blog blog, Map JavaDoc context, Entry[] entries) throws PluginException {
181         if (!authenticateUser(httpServletRequest, httpServletResponse, context, blog)) {
182             httpServletRequest.setAttribute(BlojsomConstants.PAGE_PARAM, ADMIN_LOGIN_PAGE);
183
184             return entries;
185         }
186
187         String JavaDoc username = getUsernameFromSession(httpServletRequest, blog);
188
189         try {
190             context.put(BLOJSOM_PLUGIN_EDIT_BLOGS, _fetcher.loadBlogIDs());
191         } catch (FetcherException e) {
192             _logger.error(e);
193         }
194
195         String JavaDoc action = BlojsomUtils.getRequestValue(ACTION_PARAM, httpServletRequest);
196         if (BlojsomUtils.checkNullOrBlank(action)) {
197             if (_logger.isDebugEnabled()) {
198                 _logger.debug("User did not request edit action");
199             }
200
201             httpServletRequest.setAttribute(BlojsomConstants.PAGE_PARAM, ADMIN_ADMINISTRATION_PAGE);
202         } else if (PAGE_ACTION.equals(action)) {
203             if (_logger.isDebugEnabled()) {
204                 _logger.debug("User requested edit blogs page");
205             }
206
207             httpServletRequest.setAttribute(BlojsomConstants.PAGE_PARAM, EDIT_BLOG_USERS_PAGE);
208         } else if (DELETE_BLOG_USER_ACTION.equals(action)) {
209             if (_logger.isDebugEnabled()) {
210                 _logger.debug("User requested delete blog action");
211             }
212
213             // Check user is allowed to delete blogs
214
if (!checkPermission(blog, null, username, DELETE_BLOG_PERMISSION)) {
215                 httpServletRequest.setAttribute(BlojsomConstants.PAGE_PARAM, EDIT_BLOG_USERS_PAGE);
216                 addOperationResultMessage(context, getAdminResource(FAILED_DELETE_BLOGS_PERMISSION_KEY, FAILED_DELETE_BLOGS_PERMISSION_KEY, blog.getBlogAdministrationLocale()));
217
218                 return entries;
219             }
220
221             String JavaDoc blogID = BlojsomUtils.getRequestValue(BLOG_ID, httpServletRequest);
222
223             if (BlojsomUtils.checkNullOrBlank(blogID)) {
224                 httpServletRequest.setAttribute(BlojsomConstants.PAGE_PARAM, EDIT_BLOG_USERS_PAGE);
225                 return entries;
226             } else if (_protectedBlogs.containsKey(blogID)) {
227                 httpServletRequest.setAttribute(BlojsomConstants.PAGE_PARAM, EDIT_BLOG_USERS_PAGE);
228                 addOperationResultMessage(context, formatAdminResource(FAILED_DELETE_PROTECTED_BLOG_KEY, FAILED_DELETE_PROTECTED_BLOG_KEY, blog.getBlogAdministrationLocale(), new Object JavaDoc[] {blogID}));
229
230                 return entries;
231             } else {
232                 if (_logger.isDebugEnabled()) {
233                     _logger.debug("Deleting blog: " + blogID);
234                 }
235
236                 try {
237                     Blog blogToDelete = _fetcher.loadBlog(blogID);
238                     _fetcher.deleteBlog(blogToDelete);
239                 } catch (FetcherException e) {
240                     if (_logger.isErrorEnabled()) {
241                         _logger.error(e);
242                     }
243
244                     addOperationResultMessage(context, formatAdminResource(FAILED_REMOVE_BLOG_CONFIGURATION_KEY, FAILED_REMOVE_BLOG_CONFIGURATION_KEY, blog.getBlogAdministrationLocale(), new Object JavaDoc[]{blogID}));
245
246                     return entries;
247                 }
248
249                 String JavaDoc blogsDirectoryPath = _blojsomProperties.getProperty(BlojsomConstants.BLOGS_DIRECTORY_IP, BlojsomConstants.DEFAULT_BLOGS_DIRECTORY);
250                 String JavaDoc resourcesDirectoryPath = _blojsomProperties.getProperty(BlojsomConstants.RESOURCES_DIRECTORY_IP, BlojsomConstants.DEFAULT_RESOURCES_DIRECTORY);
251
252                 File JavaDoc blogDirectory = new File JavaDoc(_servletConfig.getServletContext().getRealPath(BlojsomConstants.DEFAULT_CONFIGURATION_BASE_DIRECTORY) + blogsDirectoryPath + blogID + "/");
253                 if (!BlojsomUtils.deleteDirectory(blogDirectory)) {
254                     if (_logger.isErrorEnabled()) {
255                         _logger.error("Unable to remove blog directory: " + blogDirectory.toString());
256                     }
257
258                     addOperationResultMessage(context, formatAdminResource(FAILED_REMOVE_BLOG_DIRECTORY_KEY, FAILED_REMOVE_BLOG_DIRECTORY_KEY, blog.getBlogAdministrationLocale(), new Object JavaDoc[]{blogID}));
259                 } else {
260                     if (_logger.isDebugEnabled()) {
261                         _logger.debug("Removed blog directory: " + blogDirectory.toString());
262                     }
263                 }
264
265                 File JavaDoc blogResourcesDirectory = new File JavaDoc(_servletConfig.getServletContext().getRealPath("/") + resourcesDirectoryPath + blogID + "/");
266                 if (!BlojsomUtils.deleteDirectory(blogResourcesDirectory)) {
267                     if (_logger.isErrorEnabled()) {
268                         _logger.error("Unable to remove blog resource directory: " + blogResourcesDirectory.toString());
269                     }
270
271                     addOperationResultMessage(context, formatAdminResource(FAILED_REMOVE_BLOG_RESOURCES_DIRECTORY_KEY, FAILED_REMOVE_BLOG_RESOURCES_DIRECTORY_KEY, blog.getBlogAdministrationLocale(), new Object JavaDoc[]{blogID}));
272                 } else {
273                     if (_logger.isDebugEnabled()) {
274                         _logger.debug("Removed blog resource directory: " + blogResourcesDirectory.toString());
275                     }
276                 }
277
278                 if (_logger.isDebugEnabled()) {
279                     _logger.debug("Wrote new blojsom configuration after deleting blog: " + blogID);
280                 }
281
282                 try {
283                     context.put(BLOJSOM_PLUGIN_EDIT_BLOGS, _fetcher.loadBlogIDs());
284                 } catch (FetcherException e) {
285                     _logger.error(e);
286                 }
287
288                 addOperationResultMessage(context, formatAdminResource(DELETED_BLOG_KEY, DELETED_BLOG_KEY, blog.getBlogAdministrationLocale(), new Object JavaDoc[]{blogID}));
289             }
290
291             httpServletRequest.setAttribute(BlojsomConstants.PAGE_PARAM, EDIT_BLOG_USERS_PAGE);
292         } else if (ADD_BLOG_USER_ACTION.equals(action)) {
293             if (_logger.isDebugEnabled()) {
294                 _logger.debug("User requested add blog action");
295             }
296
297             // Check user is allowed to add blogs
298
if (!checkPermission(blog, null, username, ADD_BLOG_PERMISSION)) {
299                 httpServletRequest.setAttribute(BlojsomConstants.PAGE_PARAM, EDIT_BLOG_USERS_PAGE);
300                 addOperationResultMessage(context, getAdminResource(FAILED_ADD_BLOGS_PERMISSION_KEY, FAILED_ADD_BLOGS_PERMISSION_KEY, blog.getBlogAdministrationLocale()));
301
302                 return entries;
303             }
304
305             String JavaDoc blogID = BlojsomUtils.getRequestValue(BLOG_ID, httpServletRequest);
306
307             if (BlojsomUtils.checkNullOrBlank(blogID)) { // Check that we got a blog user ID
308
addOperationResultMessage(context, getAdminResource(MISSING_WEBLOG_ID_KEY, MISSING_WEBLOG_ID_KEY, blog.getBlogAdministrationLocale()));
309                 httpServletRequest.setAttribute(BlojsomConstants.PAGE_PARAM, EDIT_BLOG_USERS_PAGE);
310
311                 return entries;
312             } else { // Begin the process of adding a new user
313
if (_logger.isDebugEnabled()) {
314                     _logger.debug("Adding new blog id: " + blogID);
315                 }
316
317                 try {
318                     _fetcher.loadBlog(blogID);
319
320                     addOperationResultMessage(context, formatAdminResource(WEBLOG_ID_EXISTS_KEY, WEBLOG_ID_EXISTS_KEY, blog.getBlogAdministrationLocale(), new Object JavaDoc[]{blogID}));
321                     httpServletRequest.setAttribute(BlojsomConstants.PAGE_PARAM, EDIT_BLOG_USERS_PAGE);
322
323                     return entries;
324                 } catch (FetcherException e) {
325                 }
326
327                 Blog blogToAdd = _fetcher.newBlog();
328                 blogToAdd.setBlogId(blogID);
329
330                 File JavaDoc blogDirectory = new File JavaDoc(_servletConfig.getServletContext().getRealPath("/") + BlojsomConstants.DEFAULT_CONFIGURATION_BASE_DIRECTORY + blogID);
331                 if (blogDirectory.exists())
332                 { // Make sure that the blog user ID does not conflict with a directory underneath the installation directory
333
if (_logger.isDebugEnabled()) {
334                         _logger.debug("Blog directory already exists for blog ID: " + blogID);
335                     }
336
337                     addOperationResultMessage(context, formatAdminResource(WEBLOG_DIRECTORY_EXISTS_KEY, WEBLOG_DIRECTORY_EXISTS_KEY, blog.getBlogAdministrationLocale(), new Object JavaDoc[]{blogID}));
338                     httpServletRequest.setAttribute(BlojsomConstants.PAGE_PARAM, EDIT_BLOG_USERS_PAGE);
339
340                     return entries;
341                 } else { // Otherwise, check the authorization passwords match
342
String JavaDoc blogUserPassword = BlojsomUtils.getRequestValue(BLOG_USER_PASSWORD, httpServletRequest);
343                     String JavaDoc blogUserPasswordCheck = BlojsomUtils.getRequestValue(BLOG_USER_PASSWORD_CHECK, httpServletRequest);
344
345                     // Check to see that the password and password check are equal
346
if (!blogUserPassword.equals(blogUserPasswordCheck)) {
347                         if (_logger.isDebugEnabled()) {
348                             _logger.debug("User password does not equal password check");
349                         }
350
351                         addOperationResultMessage(context, getAdminResource(PASSWORDS_NOT_MATCHED_KEY, PASSWORDS_NOT_MATCHED_KEY, blog.getBlogAdministrationLocale()));
352                         httpServletRequest.setAttribute(BlojsomConstants.PAGE_PARAM, EDIT_BLOG_USERS_PAGE);
353
354                         return entries;
355                     } else { // And if they do, initialize the user
356
// Setup the blog
357
blogToAdd.setProperties(_defaultBlogProperties);
358                         blogToAdd.setTemplates(_defaultTemplateProperties);
359                         blogToAdd.setPlugins(_defaultPluginProperties);
360
361                         BlojsomUtils.resolveDynamicBaseAndBlogURL(httpServletRequest, blogToAdd, blogID);
362
363                         try {
364                             _fetcher.saveBlog(blogToAdd);
365                         } catch (FetcherException e) {
366                             if (_logger.isErrorEnabled()) {
367                                 _logger.error(e);
368                             }
369
370                             return entries;
371                         }
372
373                         String JavaDoc blogLoginID = BlojsomUtils.getRequestValue(BLOG_LOGIN_ID, httpServletRequest);
374                         String JavaDoc blogUserEmail = BlojsomUtils.getRequestValue(BLOG_USER_EMAIL, httpServletRequest);
375                         String JavaDoc blogUserName = BlojsomUtils.getRequestValue(BLOG_USER_NAME, httpServletRequest);
376
377                         if (!BlojsomUtils.checkNullOrBlank(blogLoginID) && !BlojsomUtils.checkNullOrBlank(blogUserEmail)) {
378                             User user = _fetcher.newUser();
379                             user.setBlogId(blogToAdd.getId());
380                             user.setUserEmail(blogUserEmail);
381                             Map JavaDoc userMetaData = new HashMap JavaDoc();
382                             userMetaData.put("all_permissions_permission", "true");
383                             user.setMetaData(userMetaData);
384                             user.setUserLogin(blogLoginID);
385                             if (!BlojsomUtils.checkNullOrBlank(blogUserName)) {
386                                 user.setUserName(blogUserName);
387                             } else {
388                                 user.setUserName(blogLoginID);
389                             }
390                             user.setUserPassword(blogUserPassword);
391                             user.setUserRegistered(new Date JavaDoc());
392                             user.setUserStatus("new");
393
394                             try {
395                                 _fetcher.saveUser(blogToAdd, user);
396                             } catch (FetcherException e) {
397                                 if (_logger.isErrorEnabled()) {
398                                     _logger.error(e);
399                                 }
400                             }
401
402                             String JavaDoc blogsDirectoryPath = _blojsomProperties.getProperty(BlojsomConstants.BLOGS_DIRECTORY_IP, BlojsomConstants.DEFAULT_BLOGS_DIRECTORY);
403                             String JavaDoc bootstrapDirectoryPath = _blojsomProperties.getProperty(BlojsomConstants.BOOTSTRAP_DIRECTORY_IP, BlojsomConstants.DEFAULT_BOOTSTRAP_DIRECTORY);
404                             String JavaDoc templatesDirectoryPath = _blojsomProperties.getProperty(BlojsomConstants.TEMPLATES_DIRECTORY_IP, BlojsomConstants.DEFAULT_TEMPLATES_DIRECTORY);
405                             String JavaDoc resourcesDirectoryPath = _blojsomProperties.getProperty(BlojsomConstants.RESOURCES_DIRECTORY_IP, BlojsomConstants.DEFAULT_RESOURCES_DIRECTORY);
406
407                             File JavaDoc bootstrapResourcesDirectory = new File JavaDoc(_servletConfig.getServletContext().getRealPath(BlojsomConstants.DEFAULT_CONFIGURATION_BASE_DIRECTORY) + blogsDirectoryPath + bootstrapDirectoryPath + resourcesDirectoryPath);
408                             File JavaDoc newBlogResourcesDirectory = new File JavaDoc(_servletConfig.getServletContext().getRealPath(resourcesDirectoryPath) + "/" + blogID);
409                             File JavaDoc bootstrapTemplatesDirectory = new File JavaDoc(_servletConfig.getServletContext().getRealPath(BlojsomConstants.DEFAULT_CONFIGURATION_BASE_DIRECTORY) + blogsDirectoryPath + bootstrapDirectoryPath + templatesDirectoryPath);
410                             File JavaDoc newBlogTemplatesDirectory = new File JavaDoc(_servletConfig.getServletContext().getRealPath(BlojsomConstants.DEFAULT_CONFIGURATION_BASE_DIRECTORY) + blogsDirectoryPath + blogID + templatesDirectoryPath);
411
412                             try {
413                                 newBlogResourcesDirectory.mkdirs();
414                                 BlojsomUtils.copyDirectory(bootstrapResourcesDirectory, newBlogResourcesDirectory);
415                             } catch (IOException JavaDoc e) {
416                                 if (_logger.isErrorEnabled()) {
417                                     _logger.error(e);
418                                 }
419
420                                 addOperationResultMessage(context, getAdminResource(FAILED_BOOTSTRAP_DIRECTORY_COPY_KEY, FAILED_BOOTSTRAP_DIRECTORY_COPY_KEY, blog.getBlogAdministrationLocale()));
421                                 httpServletRequest.setAttribute(BlojsomConstants.PAGE_PARAM, EDIT_BLOG_USERS_PAGE);
422
423                                 return entries;
424                             }
425
426                             try {
427                                 newBlogTemplatesDirectory.mkdirs();
428                                 BlojsomUtils.copyDirectory(bootstrapTemplatesDirectory, newBlogTemplatesDirectory);
429                             } catch (IOException JavaDoc e) {
430                                 if (_logger.isErrorEnabled()) {
431                                     _logger.error(e);
432                                 }
433
434                                 addOperationResultMessage(context, getAdminResource(FAILED_BLOG_DIRECTORY_CREATE_KEY, FAILED_BLOG_DIRECTORY_CREATE_KEY, blog.getBlogAdministrationLocale()));
435                                 httpServletRequest.setAttribute(BlojsomConstants.PAGE_PARAM, EDIT_BLOG_USERS_PAGE);
436
437                                 return entries;
438                             }
439
440                             try {
441                                 context.put(BLOJSOM_PLUGIN_EDIT_BLOGS, _fetcher.loadBlogIDs());
442                             } catch (FetcherException e) {
443                                 _logger.error(e);
444                             }
445                             
446                             addOperationResultMessage(context, formatAdminResource(ADDED_NEW_WEBLOG_KEY, ADDED_NEW_WEBLOG_KEY, blog.getBlogAdministrationLocale(), new Object JavaDoc[]{blogID}));
447                             httpServletRequest.setAttribute(BlojsomConstants.PAGE_PARAM, EDIT_BLOG_USERS_PAGE);
448                         } else {
449                             // User login ID or user e-mail is null or blank
450
}
451                     }
452                 }
453             }
454         }
455
456         return entries;
457     }
458 }
459
Popular Tags