Package org.apache.roller.ui.authoring.struts.formbeans

Examples of org.apache.roller.ui.authoring.struts.formbeans.CreateWebsiteForm


            HttpServletRequest  request,
            HttpServletResponse response)
            throws Exception {
       
        ActionForward forward = mapping.findForward("createWebsite.page");
        CreateWebsiteForm form = (CreateWebsiteForm)actionForm;
       
        RollerSession rses = RollerSession.getRollerSession(request);
        UserData user = rses.getAuthenticatedUser();
        form.setLocale(user.getLocale());
        form.setTimeZone(user.getTimeZone());
        form.setEmailAddress(user.getEmailAddress());
       
        if (!RollerConfig.getBooleanProperty("groupblogging.enabled")) {
            Roller roller = RollerFactory.getRoller();
            List permissions = roller.getUserManager().getAllPermissions(user);
            if (permissions.size() > 0) {
View Full Code Here


            ActionForm          actionForm,
            HttpServletRequest  request,
            HttpServletResponse response)
            throws Exception {
       
        CreateWebsiteForm form = (CreateWebsiteForm)actionForm;
        ActionMessages msgs = new ActionMessages();
        ActionMessages errors = validate(form, new ActionErrors());
        ActionForward forward = mapping.findForward("yourWebsites");
        Roller roller = RollerFactory.getRoller();
        WebsiteData website = null;
        if (!errors.isEmpty()) {
            saveErrors(request, errors);
            forward = mapping.findForward("createWebsite.page");
        } else try {
            RollerContext rollerContext = RollerContext.getRollerContext();
            UserData user =
                    RollerSession.getRollerSession(request).getAuthenticatedUser();
            UserManager mgr = roller.getUserManager();
           
            if (!RollerConfig.getBooleanProperty("groupblogging.enabled")) {
                List permissions = roller.getUserManager().getAllPermissions(user);
                if (permissions.size() > 0) {
                    // sneaky user trying to get around 1 blog limit that applies
                    // only when group blogging is disabled
                    return mapping.findForward("access-denied");
                }
            }
           
            WebsiteData wd = new WebsiteData(
                    form.getHandle(),
                    user,
                    form.getName(),
                    form.getDescription(),
                    form.getEmailAddress(),
                    form.getEmailAddress(),
                    form.getTheme(),
                    form.getLocale(),
                    form.getTimeZone());
           
            try {
                String def = RollerRuntimeConfig.getProperty("users.editor.pages");
                String[] defs = Utilities.stringToStringArray(def,",");
                wd.setEditorPage(defs[0]);
            } catch (Exception ex) {
                log.error("ERROR setting default editor page for weblog", ex);
            }
           
            mgr.addWebsite(wd);
           
            RollerFactory.getRoller().flush();
           
            request.setAttribute("model",
                    new CreateWebsitePageModel(request, response, mapping, website));
           
            msgs.add(ActionMessages.GLOBAL_MESSAGE,
                    new ActionMessage("createWebsite.created", form.getHandle()));
            saveMessages(request, msgs);
        } catch (RollerException e) {
            errors.add(ActionErrors.GLOBAL_ERROR,
                    new ActionError(e.getMessage()));
            saveErrors(request, errors);
View Full Code Here

            HttpServletRequest  request,
            HttpServletResponse response)
            throws Exception {
       
        ActionForward forward = mapping.findForward("createWebsite.page");
        CreateWebsiteForm form = (CreateWebsiteForm)actionForm;
       
        RollerSession rses = RollerSession.getRollerSession(request);
        UserData user = rses.getAuthenticatedUser();
        form.setLocale(user.getLocale());
        form.setTimeZone(user.getTimeZone());
        form.setEmailAddress(user.getEmailAddress());
       
        if (!RollerConfig.getBooleanProperty("groupblogging.enabled")) {
            Roller roller = RollerFactory.getRoller();
            List permissions = roller.getUserManager().getAllPermissions(user);
            if (permissions.size() > 0) {
View Full Code Here

            ActionForm          actionForm,
            HttpServletRequest  request,
            HttpServletResponse response)
            throws Exception {
       
        CreateWebsiteForm form = (CreateWebsiteForm)actionForm;
        ActionMessages msgs = new ActionMessages();
        ActionMessages errors = validate(form, new ActionErrors());
        ActionForward forward = mapping.findForward("yourWebsites");
        Roller roller = RollerFactory.getRoller();
        WebsiteData website = null;
        if (!errors.isEmpty()) {
            saveErrors(request, errors);
            forward = mapping.findForward("createWebsite.page");
        } else try {
            RollerContext rollerContext = RollerContext.getRollerContext();
            UserData user =
                    RollerSession.getRollerSession(request).getAuthenticatedUser();
            UserManager mgr = roller.getUserManager();
           
            if (!RollerConfig.getBooleanProperty("groupblogging.enabled")) {
                List permissions = roller.getUserManager().getAllPermissions(user);
                if (permissions.size() > 0) {
                    // sneaky user trying to get around 1 blog limit that applies
                    // only when group blogging is disabled
                    return mapping.findForward("access-denied");
                }
            }
           
            WebsiteData wd = new WebsiteData(
                    form.getHandle(),
                    user,
                    form.getName(),
                    form.getDescription(),
                    form.getEmailAddress(),
                    form.getEmailAddress(),
                    form.getTheme(),
                    form.getLocale(),
                    form.getTimeZone());
           
            try {
                String def = RollerRuntimeConfig.getProperty("users.editor.pages");
                String[] defs = Utilities.stringToStringArray(def,",");
                wd.setEditorPage(defs[0]);
            } catch (Exception ex) {
                log.error("ERROR setting default editor page for weblog", ex);
            }
           
            mgr.addWebsite(wd);
           
            RollerFactory.getRoller().flush();
           
            request.setAttribute("model",
                    new CreateWebsitePageModel(request, response, mapping, website));
           
            msgs.add(ActionMessages.GLOBAL_MESSAGE,
                    new ActionMessage("createWebsite.created", form.getHandle()));
            saveMessages(request, msgs);
        } catch (RollerException e) {
            errors.add(ActionErrors.GLOBAL_ERROR,
                    new ActionError(e.getMessage()));
            saveErrors(request, errors);
View Full Code Here

TOP

Related Classes of org.apache.roller.ui.authoring.struts.formbeans.CreateWebsiteForm

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.