Examples of LinkForm


Examples of com.dotmarketing.portlets.links.struts.LinkForm

    //calls edit method from super class that returns parent folder
    Folder parentFolder = super._editWebAsset(req, res, config, form, user,
        WebKeys.LINK_EDIT);

    //setting parent folder path and inode on the form bean
    LinkForm lf = (LinkForm) form;
    lf.setParent(parentFolder.getInode());

    //This can't be done on the WebAsset so it needs to be done here.
    Link link = (Link) req.getAttribute(WebKeys.LINK_EDIT);
    link.setParent(parentFolder.getInode());
    if (InodeUtils.isSet(link.getInode())) {
      if (InodeUtils.isSet(link.getInternalLinkIdentifier())) {
        lf.setInternalLinkIdentifier(link.getInternalLinkIdentifier());
      }
    } else {
      lf.setLinkType (LinkType.INTERNAL);
      link.setLinkType (LinkType.INTERNAL.toString());
    }

  }
View Full Code Here

Examples of com.dotmarketing.portlets.links.struts.LinkForm

   
    //wraps request to get session object
    ActionRequestImpl reqImpl = (ActionRequestImpl) req;
    HttpServletRequest httpReq = reqImpl.getHttpServletRequest();

    LinkForm linkForm = (LinkForm) form;
   
    //gets the new information for the link from the request object
    Link link = new Link();
    link.setTitle(((LinkForm) form).getTitle());   
    BeanUtils.copyProperties(link,form);
    req.setAttribute(WebKeys.LINK_FORM_EDIT,link);
   
    boolean previousShowMenu = link.isShowOnMenu();

    //gets the current link being edited from the request object
    Link currentLink = (Link) req.getAttribute(WebKeys.LINK_EDIT);
   
    //parent folder or inode for this file
    Folder parent = APILocator.getFolderAPI().find(req.getParameter("parent"), user, false);
    //http://jira.dotmarketing.net/browse/DOTCMS-5899
    if(UtilMethods.isSet(currentLink.getInode())){
      Identifier id = APILocator.getIdentifierAPI().find(currentLink);
      String URI = id.getURI();
      String uriPath = URI.substring(0,URI.lastIndexOf("/")+1);
      if(!uriPath.equals(APILocator.getIdentifierAPI().find(parent).getPath())){
        id.setURI(APILocator.getIdentifierAPI().find(parent).getPath()+currentLink.getProtocal() + currentLink.getUrl());
        APILocator.getIdentifierAPI().save(id);
      }
    }
   
    //Checking permissions
    _checkPermissions(currentLink, parent, user, httpReq);

    //gets user id from request for mod user
    String userId = user.getUserId();

    // take care of internal links
    if (InodeUtils.isSet(linkForm.getInternalLinkIdentifier())) {

      Identifier internalLinkIdentifier = identifierAPI.findFromInode(linkForm.getInternalLinkIdentifier());
      //link.setLinkType(LinkType.INTERNAL.toString());
      link.setInternalLinkIdentifier(internalLinkIdentifier.getInode());
      link.setProtocal("http://");

      StringBuffer myURL = new StringBuffer();
View Full Code Here

Examples of com.liusoft.dlog4j.formbean.LinkForm

      LinkDAO.create(lbean, 0, false);
      msg = super.getMessage(request, null, "link.added");
      break;
    }while(true);
   
    LinkForm lform = (LinkForm)form;
    String fromPage = lform.getFromPage();
   
    return msgbox(mapping,form,request,response,msg,fromPage);
  }
View Full Code Here

Examples of com.liusoft.dlog4j.formbean.LinkForm

   */
  protected ActionForward doDelete(ActionMapping mapping, ActionForm form,
      HttpServletRequest request, HttpServletResponse response, String s_lnk_id)
      throws Exception
  {
    LinkForm lform = (LinkForm)form;
    try{
      int link_id = Integer.parseInt(s_lnk_id);
      LinkDAO.delete(lform.getSid(), link_id);
    }catch(Exception e){
      context().log("delete link #"+s_lnk_id+" failed.", e);
    }
    return makeForward(mapping.findForward("links"), lform.getSid());
  }
View Full Code Here

Examples of com.liusoft.dlog4j.formbean.LinkForm

   */
  protected ActionForward doMoveUp(ActionMapping mapping, ActionForm form,
      HttpServletRequest request, HttpServletResponse response, String s_lnk_id)
      throws Exception
  {
    LinkForm lform = (LinkForm)form;
    try{
      int link_id = Integer.parseInt(s_lnk_id);
      LinkDAO.move(getSiteBean(request), link_id, true);
    }catch(Exception e){
      context().log("move up link #"+s_lnk_id+" failed.", e);
    }
    return makeForward(mapping.findForward("links"), lform.getSid());
  }
View Full Code Here

Examples of com.liusoft.dlog4j.formbean.LinkForm

   */
  protected ActionForward doMoveDown(ActionMapping mapping, ActionForm form,
      HttpServletRequest request, HttpServletResponse response, String s_lnk_id)
      throws Exception
  {
    LinkForm lform = (LinkForm)form;
    try{
      int link_id = Integer.parseInt(s_lnk_id);
      LinkDAO.move(getSiteBean(request), link_id, false);
    }catch(Exception e){
      context().log("move down link #"+s_lnk_id+" failed.", e);
    }
    return makeForward(mapping.findForward("links"), lform.getSid());
  }
View Full Code Here

Examples of com.liusoft.dlog4j.formbean.LinkForm

   */
  protected ActionForward doCreateLink(ActionMapping mapping, ActionForm form,
      HttpServletRequest request, HttpServletResponse response)
      throws Exception
  {
    LinkForm lform = (LinkForm)form;
    super.validateClientId(request, lform);
    ActionMessages msgs = new ActionMessages();
    if(StringUtils.isEmpty(lform.getTitle())){
      msgs.add("title", new ActionMessage("error.link_title_empty"));
    }
    else if(StringUtils.isEmpty(lform.getUrl())){
      msgs.add("url", new ActionMessage("error.link_url_empty"));
    }
    else{
      LinkBean lbean = new LinkBean();
      lbean.setCreateTime(new Date());
      lbean.setSiteId(lform.getSid());
      lbean.setTitle(lform.getTitle());
      lbean.setUrl(lform.getUrl());
      lbean.setType(lform.getType());
      lbean.setStatus(lform.getStatus());
      try{
        LinkDAO.create(lbean, lform.getId(), (lform.getDirection()==1));
      }catch(Exception e){
        msgs.add("link", new ActionMessage("error.database", e.getMessage()));
      }
    }
   
    if(!msgs.isEmpty())
      return mapping.getInputForward();
   
    return makeForward(mapping.findForward("links"), lform.getSid());
  }
View Full Code Here

Examples of com.liusoft.dlog4j.formbean.LinkForm

  protected ActionForward doUpdateLink(ActionMapping mapping, ActionForm form,
      HttpServletRequest request, HttpServletResponse response)
      throws Exception
  {
    String msg = null;
    LinkForm lform = (LinkForm)form;
    if(StringUtils.isEmpty(lform.getTitle())){
      msg = super.getMessage(request, null, "error.link_title_empty");
    }
    else if(StringUtils.isEmpty(lform.getUrl())){
      msg = super.getMessage(request, null, "error.link_url_empty");
    }
    else{
      SiteBean site = getSiteBean(request);
      LinkBean lbean = LinkDAO.getLinkByID(lform.getId());
      if(lbean!=null && lbean.getSiteId()==site.getId()){
        lbean.setTitle(lform.getTitle());
        lbean.setUrl(lform.getUrl());
        lbean.setType(lform.getType());
        lbean.setStatus(lform.getStatus());
        try{
          LinkDAO.update(lbean);
        }catch(Exception e){
          msg = super.getMessage(request, null, "error.database", e.getMessage());
        }
      }
    }
    return msgbox(mapping,form,request,response,msg,lform.getFromPage());
  }
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.