Package org.apache.roller.ui.core

Examples of org.apache.roller.ui.core.RollerRequest


            throws Exception {
        YourWebsitesForm form = (YourWebsitesForm)actionForm;
       
        RollerSession rses = RollerSession.getRollerSession(request);
        UserData user = rses.getAuthenticatedUser();
        RollerRequest rreq = RollerRequest.getRollerRequest(request);
        WebsiteData website = rreq.getWebsite();
       
        UserManager userMgr = RollerFactory.getRoller().getUserManager();
        PermissionsData perms = userMgr.getPermissions(website, user);
       
        if (perms != null) {
View Full Code Here


            HttpServletRequest  request,
            HttpServletResponse response)
            throws IOException, ServletException {
        ActionForward forward = mapping.findForward("registerUser.page");
        ActionErrors errors = new ActionErrors();
        RollerRequest rreq = RollerRequest.getRollerRequest(request);
        try {
            UserFormEx userForm = (UserFormEx)actionForm;
           
            userForm.setLocale(Locale.getDefault().toString());
            userForm.setTimeZone(TimeZone.getDefault().getID());
View Full Code Here

            ActionForm          actionForm,
            HttpServletRequest  request,
            HttpServletResponse response)
            throws IOException, ServletException {
        UserFormEx form = (UserFormEx)actionForm;
        RollerRequest rreq = RollerRequest.getRollerRequest(request);
        ServletContext ctx = rreq.getServletContext();
        RollerContext rollerContext = RollerContext.getRollerContext();
       
        boolean reg_allowed =
                RollerRuntimeConfig.getBooleanProperty("users.registration.enabled");
       
View Full Code Here

        strutsModule.createActionForm(WeblogEntryFormEx.class);
        form.setTitle("test_title");
        form.setText("Test blog text");
       
        try {
            RollerRequest rreq = new RollerRequest(strutsModule.getMockPageContext());
            rreq.setWebsite(testWeblog);
            strutsModule.setRequestAttribute(RollerRequest.ROLLER_REQUEST, rreq);
            strutsModule.actionPerform(WeblogEntryFormAction.class, form);
        } catch (Throwable t) {
            t.printStackTrace();
            fail();
View Full Code Here

        mapping.setParameter("method");
        strutsModule.addRequestParameter("weblog",testWeblog.getHandle());
        strutsModule.addRequestParameter("method","selectFolder");
       
        try {
            RollerRequest rreq = new RollerRequest(strutsModule.getMockPageContext());
            rreq.setWebsite(testWeblog);
            strutsModule.setRequestAttribute(RollerRequest.ROLLER_REQUEST, rreq);
            strutsModule.actionPerform(BookmarksAction.class, form);
        } catch (Throwable e) {
            e.printStackTrace();
            fail();
View Full Code Here

     */
    public void initNew(HttpServletRequest request, HttpServletResponse response)
    {
        mLogger.debug("init new called");
       
        RollerRequest rreq = RollerRequest.getRollerRequest(request);
        RollerSession rses = RollerSession.getRollerSession(request);
        if (rreq.getWebsite().getDefaultPlugins() != null)
        {
            setPluginsArray(StringUtils.split(
                    rreq.getWebsite().getDefaultPlugins(), ",") );
        }
        status = WeblogEntryData.DRAFT;
        allowComments = Boolean.TRUE;
        locale = rreq.getWebsite().getLocale();
       
        // we want pubTime and updateTime to be empty for new entries -- AG
        //updateTime = new Timestamp(new Date().getTime());
        //pubTime = updateTime;
        //initPubTimeDateStrings(rreq.getWebsite(), request.getLocale());       
View Full Code Here

            HttpServletRequest  request,
            HttpServletResponse response)
            throws IOException, ServletException, RollerException {
       
        CommentManagementForm queryForm = (CommentManagementForm)actionForm;
        RollerRequest rreq = RollerRequest.getRollerRequest(request);
        RollerSession rses = RollerSession.getRollerSession(request);
       
        if (rreq.getWeblogEntry() != null) {
            queryForm.setEntryid(rreq.getWeblogEntry().getId());
            queryForm.setWeblog(rreq.getWeblogEntry().getWebsite().getHandle());
        }       
        else if (rreq.getWebsite() != null) {
            queryForm.setWeblog(rreq.getWebsite().getHandle());
        }       
        request.setAttribute("model", new CommentManagementPageModel(
           "commentManagement.title", request, response, mapping, queryForm));
        if (request.getAttribute("commentManagementForm") == null) {
            request.setAttribute("commentManagementForm", actionForm);
        }
       
        // Ensure user is authorized to view comments in weblog
        if (rreq.getWebsite() != null && rses.isUserAuthorized(rreq.getWebsite())) {
            return mapping.findForward("commentManagement.page");
        }
        // And ensure only global admins can see all comments
        else if (rses.isGlobalAdminUser()) {
            return mapping.findForward("commentManagementGlobal.page");
View Full Code Here

            HttpServletRequest  request,
            HttpServletResponse response)
            throws IOException, ServletException, RollerException {
       
        CommentManagementForm queryForm = (CommentManagementForm)actionForm;
        RollerRequest rreq = RollerRequest.getRollerRequest(request);
        if (rreq.getWeblogEntry() != null) {
            queryForm.setEntryid(rreq.getWeblogEntry().getId());
            queryForm.setWeblog(rreq.getWeblogEntry().getWebsite().getHandle());
        }       
        else if (rreq.getWebsite() != null) {
            queryForm.setWeblog(rreq.getWebsite().getHandle());
        }
        else {
            // user needs Global Admin rights to access site-wide comments
            RollerSession rses = RollerSession.getRollerSession(request);
            if (!rses.isGlobalAdminUser()) {
                return mapping.findForward("access-denied");
            }
        }
        RollerSession rses = RollerSession.getRollerSession(request);
        try {
            if (rses.isGlobalAdminUser()
                || (rreq.getWebsite()!=null && rses.isUserAuthorizedToAuthor(rreq.getWebsite())) ) {
                WeblogManager mgr= RollerFactory.getRoller().getWeblogManager();
               
                // delete all comments with delete box checked
                CommentData deleteComment = null;
                String[] deleteIds = queryForm.getDeleteComments();
                List deletedList = Arrays.asList(deleteIds);
                if (deleteIds != null && deleteIds.length > 0) {
                    for(int j=0; j < deleteIds.length; j++) {
                        deleteComment = mgr.getComment(deleteIds[j]);
                       
                        mgr.removeComment(deleteComment);
                    }
                }
               
                // Collect comments approved for first time, so we can send
                // out comment approved notifications later
                List approvedComments = new ArrayList();
               
                // loop through IDs of all comments displayed on page
                String[] ids = Utilities.stringToStringArray(queryForm.getIds(),",");
                List flushList = new ArrayList();
                for (int i=0; i<ids.length; i++) {                   
                    if (deletedList.contains(ids[i])) continue;                   
                    CommentData comment = mgr.getComment(ids[i]);
                   
                    // apply spam checkbox
                    List spamIds = Arrays.asList(queryForm.getSpamComments());
                    if (spamIds.contains(ids[i])) {
                        comment.setSpam(Boolean.TRUE);
                    } else {
                        comment.setSpam(Boolean.FALSE);
                    }
                   
                    // Only participate in comment review workflow if we're
                    // working within one specfic weblog. Global admins should
                    // be able to mark-as-spam and delete comments without
                    // interfering with moderation by bloggers.
                    if (rreq.getWebsite() != null) {
                       
                        // all comments reviewed, so they're no longer pending
                        if (comment.getPending() != null && comment.getPending().booleanValue()) {
                            comment.setPending(Boolean.FALSE);
                            approvedComments.add(comment);
                        }
                       
                        // apply pending checkbox
                        List approvedIds =
                            Arrays.asList(queryForm.getApprovedComments());
                        if (approvedIds.contains(ids[i])) {
                            comment.setApproved(Boolean.TRUE);
                           
                        } else {
                            comment.setApproved(Boolean.FALSE);
                        }
                    }
                    mgr.saveComment(comment);
                    flushList.add(comment);
                }
               
                RollerFactory.getRoller().flush();
                for (Iterator comments=flushList.iterator(); comments.hasNext();) {
                    CacheManager.invalidate((CommentData)comments.next());
                }
               
                sendCommentNotifications(request, approvedComments);
               
                ActionMessages msgs = new ActionMessages();
                msgs.add(ActionMessages.GLOBAL_MESSAGE,
                    new ActionMessage("commentManagement.updateSuccess"));
                saveMessages(request, msgs);
            }
        } catch (Exception e) {
            ActionMessages errors = new ActionMessages();
            errors.add(ActionErrors.GLOBAL_MESSAGE,
                new ActionMessage("commentManagement.updateError",e.toString()));
            saveErrors(request, errors);
            logger.error("ERROR updating comments", e);      
        }
        CommentManagementPageModel model = new CommentManagementPageModel(
           "commentManagement.title", request, response, mapping, queryForm);
        request.setAttribute("model", model);
        if (request.getAttribute("commentManagementForm") == null) {
            request.setAttribute("commentManagementForm", actionForm);
        }
       
        if (rreq.getWebsite() != null) {
            return mapping.findForward("commentManagement.page");
        }
        return mapping.findForward("commentManagementGlobal.page");
    }
View Full Code Here

           
            super(titleKey, request, response, mapping);
            this.queryForm = queryForm;
           
            Roller roller = RollerFactory.getRoller();
            RollerRequest rreq = RollerRequest.getRollerRequest(request);
            if (rreq.getWeblogEntry() != null) {
                website = rreq.getWeblogEntry().getWebsite();
                weblogEntry = rreq.getWeblogEntry();
            }
            else if (rreq.getWebsite() != null) {
                website = rreq.getWebsite();
            }
            WeblogManager blogmgr = roller.getWeblogManager();

            int offset = queryForm.getOffset();
            comments = blogmgr.getComments(
View Full Code Here

        ActionForm          actionForm,
        HttpServletRequest  request,
        HttpServletResponse response)
        throws Exception
    {
        RollerRequest rreq = RollerRequest.getRollerRequest(request);
        WeblogManager wmgr = RollerFactory.getRoller().getWeblogManager();
        WeblogCategoryFormEx form = (WeblogCategoryFormEx)actionForm;
       
        BasePageModel pageModel = null;
        WeblogCategoryData parentCat = null;
        if (null!=rreq.getWeblogCategory() && null==request.getParameter("correct"))
        {
            // If request specifies Category and we are not correcting an
            // already submitted form then load that Category into the form.
            WeblogCategoryData cd = rreq.getWeblogCategory();
            form.copyFrom(cd, request.getLocale());
            request.setAttribute("state","edit");
                            
            parentCat = cd.getParent();           
            pageModel = new BasePageModel(
                "categoryForm.edit.title", request, response, mapping);
            pageModel.setWebsite(cd.getWebsite());
        }
        else if (null != request.getParameter("correct"))
        {
            // We are correcting a previously submtted form.
            // already submitted form then load that Category into the form.
            WeblogCategoryData cd = rreq.getWeblogCategory();
            request.setAttribute("state","correcting");   
           
            parentCat = wmgr.getWeblogCategory(cd.getId());         
            pageModel = new BasePageModel(
                "categoryForm.correct.title", request, response, mapping);
View Full Code Here

TOP

Related Classes of org.apache.roller.ui.core.RollerRequest

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.