Examples of MessageForm


Examples of com.adito.setup.forms.MessageForm

     * @return forward
     * @throws Exception
     */
    public ActionForward toogleShowPersonalPolicies(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
                throws Exception {
        MessageForm mf = (MessageForm)form;
        PropertyList selectedPolicies = new PropertyList();
       
        SessionInfo session = this.getSessionInfo(request);
       
        String users = request.getParameter("users");

        MultiSelectSelectionModel policyModel = initSelectModel(mf, selectedPolicies, mf.isShowPersonalPolicies(), users, session);
       
        mf.setSelectedPolicySelection(policyModel);
        mf.setSelectedPolicies(selectedPolicies);
       
        return mapping.findForward("display");
    }
View Full Code Here

Examples of com.adito.setup.forms.MessageForm

    final static Log log = LogFactory.getLog(SendMessageDispatchAction.class);

    public ActionForward unspecified(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
                    throws Exception {
        MessageForm mf = (MessageForm)form;
        mf.setReferer(CoreUtil.getReferer(request));
        PropertyList selectedPolicies = new PropertyList();
        MultiSelectDataSource policies = new PolicyDataSource();
        SessionInfo session = LogonControllerFactory.getInstance().getSessionInfo(request);
     
        String users = request.getParameter("users");
       
        MultiSelectSelectionModel policyModel = initSelectModel(mf, selectedPolicies, mf.isShowPersonalPolicies(), users, session);
       
        mf.initialise(policyModel, selectedPolicies, getSessionInfo(request));

        return mapping.findForward("display");
    }
View Full Code Here

Examples of com.adito.setup.forms.MessageForm

        return policyModel;
    }
   
    public ActionForward commit(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
                    throws Exception {
        MessageForm mf = (MessageForm)form;
        Realm realm = getSessionInfo(request).getUser().getRealm();
        Message msg = new Message(mf.getSubject(), mf.getContent(), mf.getUrgent());
        for(Iterator i = mf.getSelectedAccountsList().iterator(); i.hasNext(); ) {
            msg.getRecipients().add(new Recipient(Recipient.USER, (String)i.next(), realm.getResourceName()));
        }
        for(Iterator i = mf.getSelectedRolesList().iterator(); i.hasNext(); ) {
            msg.getRecipients().add(new Recipient(Recipient.ROLE, (String)i.next(), realm.getResourceName()));
        }
        for(Iterator i = mf.getSelectedPoliciesList().iterator(); i.hasNext(); ) {
            String policyName = PolicyDatabaseFactory.getInstance().getPolicy(Integer.parseInt((String)i.next())).getResourceName();
            msg.getRecipients().add(new Recipient(Recipient.POLICY, policyName, realm.getResourceName()));
        }
        if(msg.getRecipients().size() == 0) {
            throw new Exception("No recipients in any of the accounts, roles or policies selected.");
        }
        if(mf.getSelectedSink().equals("*")) {
            CoreServlet.getServlet().getNotifier().sendToAll(msg);
        }
        else if(mf.getSelectedSink().equals("^")) {
            CoreServlet.getServlet().getNotifier().sendToFirst(msg);
        }
        else  {
            CoreServlet.getServlet().getNotifier().sendToSink(mf.getSelectedSink(), msg);
        }
        return cancel(mapping, form, request, response);
    }
View Full Code Here

Examples of com.liusoft.dlog4j.formbean.MessageForm

   */
  protected ActionForward doDeleteAll(ActionMapping mapping,
      ActionForm form, HttpServletRequest request,
      HttpServletResponse response, String s_status) throws Exception      
  {
    MessageForm msg = (MessageForm)form;
    UserBean loginUser = super.getLoginUser(request, response);
    if(loginUser!=null){
      try{
        int status = Integer.parseInt(s_status);
        MessageDAO.deleteMsgs(loginUser.getId(),status);
      }catch(Exception e){
        context().log("delete message where status is "+s_status+" failed.", e);
      }
    }
    return makeForward(mapping.findForward("msgs"), msg.getSid());
  }
View Full Code Here

Examples of com.liusoft.dlog4j.formbean.MessageForm

   */
  protected ActionForward doDelete(ActionMapping mapping,
      ActionForm form, HttpServletRequest request,
      HttpServletResponse response, String s_msg_id) throws Exception      
  {
    MessageForm msg = (MessageForm)form;
    UserBean loginUser = super.getLoginUser(request, response);
    if(loginUser!=null){
      try{
        int msg_id = Integer.parseInt(s_msg_id);
        MessageDAO.deleteMsg(loginUser.getId(), msg_id);
      }catch(Exception e){
        context().log("delete message #"+s_msg_id+" failed.", e);
      }
    }
    String ext = null;
    int page = RequestUtils.getParam(request, "p", -1);
    if(page > 1){
      ext = "p="+page;
    }
    return makeForward(mapping.findForward("msgs"), msg.getSid(), ext);
  }
View Full Code Here

Examples of com.liusoft.dlog4j.formbean.MessageForm

   */
  protected ActionForward doDeleteMessages(ActionMapping mapping,
      ActionForm form, HttpServletRequest request,
      HttpServletResponse response) throws Exception      
  {
    MessageForm msg = (MessageForm)form;
    UserBean loginUser = super.getLoginUser(request, response);
    if(loginUser!=null){
      String[] mids = request.getParameterValues("mid");
      MessageDAO.deleteMsgs(loginUser.getId(), mids);
    }
    return makeForward(mapping.findForward("msgs"), msg.getSid());
  }
View Full Code Here

Examples of com.liusoft.dlog4j.formbean.MessageForm

   */
  protected ActionForward doSendMsg(ActionMapping mapping, ActionForm form,
      HttpServletRequest request, HttpServletResponse response)
      throws Exception
  {
    MessageForm msgform = (MessageForm)form;
    super.validateClientId(request, msgform);
    ActionMessages msgs = new ActionMessages();
    while(true){
      if(msgform.getExpiredTime()!=null && msgform.getExpiredTime().before(new Date())){
        msgs.add("message", new ActionMessage("error.expired_time_not_available"));
        break;
      }
      if(StringUtils.isEmpty(msgform.getContent())){
        msgs.add("content", new ActionMessage("error.empty_content"));
        break;
      }
      if(msgform.getReceiverId()==0 || msgform.getSid()==0){
        msgs.add("message", new ActionMessage("error.param"));
        break;
      }
      UserBean loginUser = super.getLoginUser(request, response);
      if(loginUser==null){
        msgs.add("message", new ActionMessage("error.user_not_login"));
        break;
      }
      else if(loginUser.getStatus()!=UserBean.STATUS_NORMAL){
        msgs.add("message", new ActionMessage("error.user_not_available"));
        break;
      }
      else if(DLOGSecurityManager.IllegalGlossary.existIllegalWord(msgform.getContent())){
        msgs.add("message", new ActionMessage("error.illegal_glossary"));
        break;
      }
      UserBean receiver = UserDAO.getUserByID(msgform.getReceiverId());
      if(receiver==null || receiver.getStatus()!=UserBean.STATUS_NORMAL){
        msgs.add("message", new ActionMessage("error.user_not_available"));
        break;
      }
      //�жϽ������Ƿ��Ѿ��������߼�Ϊ������
      if(UserDAO.isUserInBlackList(receiver.getId(), loginUser.getId())){
        msgs.add("message", new ActionMessage("message.sent"));
        break;
      }
      MessageBean msgbean = new MessageBean();
      String content = StringUtils.abbreviate(super.autoFiltrate(null,
          msgform.getContent()), MAX_MESSAGE_LENGTH);
      msgbean.setContent(super.filterScriptAndStyle(content));
      msgbean.setExpiredTime(msgform.getExpiredTime());
      msgbean.setFromUser(loginUser);
      msgbean.setToUser(receiver);
      msgbean.setStatus(MessageBean.STATUS_NEW);
      msgbean.setSendTime(new Date());
      try{
View Full Code Here

Examples of com.liusoft.dlog4j.formbean.MessageForm

   */
  protected ActionForward doReplyMsgAndDeleteOld(ActionMapping mapping, ActionForm form,
      HttpServletRequest request, HttpServletResponse response)
      throws Exception
  {
    MessageForm msgform = (MessageForm)form;
    super.validateClientId(request, msgform);
    ActionMessages msgs = new ActionMessages();
    while(true){
      if(msgform.getExpiredTime()!=null && msgform.getExpiredTime().before(new Date())){
        msgs.add("message", new ActionMessage("error.expired_time_not_available"));
        break;
      }
      if(StringUtils.isEmpty(msgform.getContent())){
        msgs.add("content", new ActionMessage("error.empty_content"));
        break;
      }
      if(msgform.getReceiverId()==0 || msgform.getSid()==0){
        msgs.add("message", new ActionMessage("error.param"));
        break;
      }
      UserBean loginUser = super.getLoginUser(request, response);
      if(loginUser==null){
        msgs.add("message", new ActionMessage("error.user_not_login"));
        break;
      }
      else if(loginUser.getStatus()!=UserBean.STATUS_NORMAL){
        msgs.add("message", new ActionMessage("error.user_not_available"));
        break;
      }
      else if(DLOGSecurityManager.IllegalGlossary.existIllegalWord(msgform.getContent())){
        msgs.add("message", new ActionMessage("error.illegal_glossary"));
        break;
      }
      UserBean receiver = UserDAO.getUserByID(msgform.getReceiverId());
      if(receiver==null || receiver.getStatus()!=UserBean.STATUS_NORMAL){
        msgs.add("message", new ActionMessage("error.user_not_available"));
        break;
      }
      //�жϽ������Ƿ��Ѿ��������߼�Ϊ������
      if(UserDAO.isUserInBlackList(receiver.getId(), loginUser.getId())){
        msgs.add("message", new ActionMessage("message.sent"));
        break;
      }
      MessageBean msgbean = new MessageBean();
      String content = StringUtils.abbreviate(super.autoFiltrate(null,
          msgform.getContent()), MAX_MESSAGE_LENGTH);
      msgbean.setContent(super.filterScriptAndStyle(content));
      msgbean.setExpiredTime(msgform.getExpiredTime());
      msgbean.setFromUser(loginUser);
      msgbean.setToUser(receiver);
      msgbean.setStatus(MessageBean.STATUS_NEW);
      msgbean.setSendTime(new Date());
      try{
        MessageDAO.replyAndDeleteMessage(msgform.getMsgID(), msgbean);
        msgs.add("message", new ActionMessage("message.sent"));
      }catch(HibernateException e){
        context().log("undelete diary failed.", e);
        msgs.add("message", new ActionMessage("error.database", e.getMessage()));
      }
View Full Code Here

Examples of fr.utbm.in56.annonces.struts.form.MessageForm

  public ActionForward execute(ActionMapping mapping, ActionForm form,
      HttpServletRequest request, HttpServletResponse response)
      throws Exception {
   
         
        MessageForm messageForm = (MessageForm) form;

        MessageDao mDao = new MessageDao();

        Message m = new Message();
        HttpSession session = request.getSession();
       
        Object oAnnonce = session.getAttribute("annonce");
        if(oAnnonce instanceof Annonce){
           
            Annonce annonce = (Annonce)session.getAttribute("annonce");
            m.setAnnonce(annonce);
            m.setDestinataire(annonce.getPublicateur());
           
        }else{
            Message message = (Message)session.getAttribute("message");
            m.setAnnonce(message.getAnnonce());
            m.setDestinataire(message.getExpediteur());
        }
       
        m.setExpediteur((Membre)session.getAttribute("membre"));
       

        m.setCorps(messageForm.getCorps());
        m.setDateEnvoi(Calendar.getInstance());
        m.setMessageAuto(false);
        m.setOuvert(false);

        mDao.save(m);
View Full Code Here

Examples of org.jresearch.gossip.forms.MessageForm

    public ActionForward process(ActionMapping mapping, ActionForm form,
            HttpServletRequest request, HttpServletResponse response)
            throws SystemException {
        HttpSession session = request.getSession();
        MessageResources messages = getResources(request);
        MessageForm messageForm = (MessageForm) form;
        User user = (User) session.getAttribute(IConst.SESSION.USER_KEY);
        ForumDAO dao = ForumDAO.getInstance();
        UserDAO userdao = UserDAO.getInstance();
        ActionErrors errors = new ActionErrors();
        StringBuffer forward = new StringBuffer();
        Configurator config = Configurator.getInstance();

        if ((user.getStatus() > 0)) {
            messageForm.setEmail(user.getInfo().getEmail());
            messageForm.setName(user.getName());
        } else { //validation if user is not registered yet

            if (messageForm.getName().trim().equals("")) {
                errors.add(ActionErrors.GLOBAL_ERROR, new ActionError(
                        "errors.ERR20"));
            }

            if (messageForm.getEmail().trim().equals("")) {
                errors.add(ActionErrors.GLOBAL_ERROR, new ActionError(
                        "errors.ERR19"));
            }
        }

        //    Report any errors we have discovered back to the original form
        if (!errors.isEmpty()) {
            saveErrors(request, errors);

            return (mapping.getInputForward());
        }

        try {

            boolean announce = false;
            boolean isUserMod = dao.checkMod(Integer.parseInt(messageForm
                    .getFid()), user);
            Forum currForum = dao.getForumInfo(Integer.parseInt(messageForm
                    .getFid()));

            //      check access rights if forum invisible
            if ((currForum.getLocked() == IConst.Forum.STATUS_INVISIBLE)
                    && (user.getStatus() < Integer.parseInt(Configurator
                            .getInstance().get(IConst.CONFIG.INVADER1)))) { return (mapping
                    .findForward(IConst.TOKEN.DENIED)); }

            //      check access rights if forum topics are locked
            if (((currForum.getLocked() == IConst.Forum.STATUS_TOPICS_LOCKED) && messageForm
                    .getTid().equals(""))
                    && (!isUserMod)) { return (mapping
                    .findForward(IConst.TOKEN.DENIED)); }

            // insert new thread if it is necessary
            if (messageForm.getTid().equals("")) {
                messageForm.setTid(dao.insertNewThread(messageForm.getFid()));

                announce = ((dao.isUserMod(user.getName()) || (user.getStatus() > 7)) && IConst.VALUES.TRUE
                        .equals(messageForm.getAnnounce()));
            }

            // check user access rights if current topic or completely forum is
            // locked
            if ((dao.getThreadInfo(Integer.parseInt(messageForm.getTid()))
                    .getLocked() == IConst.Topic.STATUS_LOCKED || currForum
                    .getLocked() == IConst.Forum.STATUS_COMPLETELY_LOCKED)
                    && (!isUserMod)) { return (mapping
                    .findForward(IConst.TOKEN.DENIED)); }

            // mark username for not registered users
            if (user.getStatus() == 0) {
                messageForm.setName("<" + messageForm.getName() + ">");
            }

            int mid = dao.addMessage(messageForm, request.getRemoteAddr(),
                    announce);
            //save attachment
            if (Configurator.getInstance().getBoolean(
                    IConst.CONFIG.ENABLE_FILE_UPLOAD)) {
                saveAttach(request, mid, ((FileUploadForm) messageForm)
                        .getFileData());
            }
            forward.append("/ShowMessage.do?fid=");
            forward.append(messageForm.getFid());
            forward.append("&tid=");
            forward.append(messageForm.getTid());
            forward.append("&mid=");
            forward.append(mid);

            log(request, "logs.LOG5", messageForm.getTid() + " fid="
                    + messageForm.getFid());

            //      e-mail all the subscribors of this thread...
            ArrayList subscrbe = dao.getSubscribersList(messageForm.getTid(),
                    messageForm.getName());

            if (subscrbe.size() > 0) {
                StringBuffer siteUrl = new StringBuffer();
                siteUrl.append(request.getServerName());
                siteUrl.append(":");
                siteUrl.append(request.getServerPort());
                siteUrl.append("/");
                siteUrl.append(request.getContextPath());
                siteUrl.append(config.get(IConst.CONFIG.MODULE_PREFIX));
                siteUrl.append("/");

                String tSubj = dao.getThreadSubject(messageForm.getTid());
                MessageProcessor mp = MessageProcessor.getInstance();
                String mess = mp.prepareMessage(HtmlCodec.encode(messageForm
                        .getText()), 0, messages);
                mess = mp.cleanup(mess);

                /*
                 * {0} - subsriber's login {1} - site url {2} - show message url
                 * {3} - topic title {4} - new message text {5} - new message
                 * sender {6} - site name
                 */
                Object[] messArgs = new Object[] { "", siteUrl.toString(),
                        forward.toString(), tSubj, mess,
                        HtmlCodec.encode(messageForm.getName()),
                        config.get(IConst.CONFIG.SITE_NAME) };
                MailQueue queue = (MailQueue) session.getServletContext()
                        .getAttribute(IConst.CONTEXT.MAIL_QUEUE);

                Iterator it = subscrbe.iterator();
                BanGuard guard = BanGuard.getInstance();
                while (it.hasNext()) {
                    Subscriber s = (Subscriber) it.next();
                    if (!guard.checkBan(s.getEmail(), BanType.EMAIL)) {
                        messArgs[0] = HtmlCodec.encode(s.getName());

                        queue.push(new MailMessage(messages.getMessage(
                                "mails.NEW_MESSAGE", messArgs), messages
                                .getMessage("mails.NEW_MESSAGE_SUBJ"), config
                                .get(IConst.CONFIG.ADMINMAIL), messages
                                .getMessage("mails.FORUM_ADMIN"), s.getEmail(),
                                s.getName()));
                    }
                }
            }

            //subscribe user to e-mail from this thread...
            if (IConst.VALUES.TRUE.equals(messageForm.getSubscribe())) {
                dao.subscribe(messageForm.getTid(), messageForm.getEmail(),
                        messageForm.getName());
            }

            session.removeAttribute(IConst.REQUEST.CURR_THREAD);

            if (user.getStatus() != UserStatus.GUEST) {

                // set(update) last visit date for this thread
                HashMap last_intime = (HashMap) session
                        .getAttribute(IConst.SESSION.LAST_INTIME);

                if (last_intime.containsKey(messageForm.getTid())) {
                    last_intime.remove(messageForm.getTid());
                }

                last_intime.put(messageForm.getTid(), new Date());
            }
        } catch (SQLException sqle) {
            getServlet().log("Connection.process", sqle);
            throw new SystemException(sqle);
        } catch (FileNotFoundException e) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.