Package com.dotmarketing.portlets.categories.model

Examples of com.dotmarketing.portlets.categories.model.Category


      idList.add(current.getInode());
    } else {
      List cats = InodeFactory.getParentsOfClass(current, Category.class);
      Iterator it = cats.iterator();
      while (it.hasNext()) {
        Category cat = (Category) it.next();
        idList.add(cat.getInode());
      }
    }
    String[] catsArr = (String[]) idList.toArray(new String[0]);
    return getSelectCategories(parent, level, catsArr, maxlevel, user, respectFrontendRoles);
  }
View Full Code Here


    StringBuffer strHTML = new StringBuffer();
    Iterator m = categories.iterator();

    while (m.hasNext()) {
      Category cat = (Category) m.next();

      if (level == 1) {
        strHTML.append("<option value=\"" + cat.getInode() + "\" class=\"topCat\" ");
      } else {
        strHTML.append("<option value=\"" + cat.getInode() + "\"");
      }

      if (selectedCategoriesIds != null) {
        for (int i = 0; i < selectedCategoriesIds.length; i++) {
          String id = selectedCategoriesIds[i];
          if (cat.getInode().equalsIgnoreCase(id)) {
            strHTML.append(" selected");

          }
        }
      }

      strHTML.append(">");

      for (int k = 0; k < (level - 1); k++) {
        strHTML.append(" &nbsp; &nbsp;");
      }

      strHTML.append("+&nbsp;");
      strHTML.append(cat.getCategoryName() + "</option>");

      if (level <= maxlevel && categoryAPI.getChildren(cat, user, respectFrontendRoles).size() > 0) {
        strHTML.append(getSelectCategories(cat, level, selectedCategoriesIds, maxlevel, user, respectFrontendRoles));
      }
    }
View Full Code Here

    StringBuffer strHTML = new StringBuffer();
    Iterator<Category> m = categories.iterator();

    while (m.hasNext()) {
      Category cat = (Category) m.next();
     
      boolean canUse = categoryAPI.canUseCategory(cat, user, respectFrontendRoles);
      if(canUse){
        if (level == 1) {
          strHTML.append("<option value=\"" + cat.getInode() + "\" class='topCat' ");
        } else {
          strHTML.append("<option value=\"" + cat.getInode() + "\"");
        }
 
        if (current != null) {
          Iterator<Category> l = categoryAPI.getParents(current, user, respectFrontendRoles).iterator();
 
          while (l.hasNext()) {
            Category disCat = (Category) l.next();
 
            if (cat.getInode().equalsIgnoreCase(disCat.getInode())) {
              strHTML.append(" selected");
            }
          }
        }
 
View Full Code Here

    private boolean _saveCategory(ActionForm form, ActionRequest req, ActionResponse res)
      throws IllegalAccessException, InvocationTargetException, DotDataException, DotSecurityException {
     
      User user = _getUser(req);
        BeanUtils.copyProperties(req.getAttribute(WebKeys.CATEGORY_EDIT), form);
        Category cat = (Category) req.getAttribute(WebKeys.CATEGORY_EDIT);
        Category parent = null;
       
        List <Category> categories=categoryAPI.findAll(APILocator.getUserAPI().getSystemUser(), false);
       
        String catvelvar=cat.getCategoryVelocityVarName();
        List <String> velocityvarnames=new ArrayList <String>();
View Full Code Here

     * @return
     * @throws DotDataException
     */
    private boolean _deleteCategory(ActionForm form, ActionRequest req, ActionResponse res) throws DotDataException {
      User user = _getUser(req);
        Category cat = (Category) req.getAttribute(WebKeys.CATEGORY_EDIT);
       
        InodeFactory.deleteInode(cat);
    try {
      categoryAPI.delete(cat, user, false);
    } catch (DotSecurityException e) {
View Full Code Here

   
    //view category for Action request
    private boolean _viewCategory(ActionForm form, ActionRequest req, ActionResponse res)
    throws Exception {
      User user = _getUser(req);
      Category cat = new Category();
      boolean isnew=false;
      if(InodeUtils.isSet(req.getParameter("inode")) && !req.getParameter("inode").equals("0"))
        cat = (Category) categoryAPI.find(req.getParameter("inode"), user, false);
      else
        isnew=true;
View Full Code Here

    /*Private Methods*/
  //delete category
   
   
  private void _deleteCategory(ActionForm form, ActionRequest req, ActionResponse res, User user, HttpSession session) throws Exception {
        Category cat = ( Category ) req.getAttribute(WebKeys.CATEGORY_EDIT);
        ActionErrors errors = new ActionErrors();
        if(!categoryAPI.hasDependencies(cat)){
      req.removeAttribute(WebKeys.CATEGORY_EDIT);
      categoryAPI.delete(cat, user, false);
      SessionMessages.add(req, "message", "message.category.delete");
View Full Code Here

      count = Integer.parseInt(req.getParameter("count"));
    }
    catch (Exception e) {}
    String[] order = new String[(count)];
    for (int i = 0; i < order.length; i++) {
      Category cat = (Category) categoryAPI.find(req.getParameter("inode" + i), user, false);
      cat.setSortOrder(req.getParameter("newOrder" + i));
      categoryAPI.save(null, cat, user, false);
    }
   
    /* http://jira.dotmarketing.net/browse/DOTCMS-2235
     * This method is a public method from the CategoryAPI. The reordering should be done
View Full Code Here

 
  //add child categories
  private void _addChildCategories(ActionForm form, ActionRequest req, ActionResponse res) throws Exception {

    User user = _getUser(req);
    Category cat = ( Category ) req.getAttribute(WebKeys.CATEGORY_EDIT);
    Category child = (Category) categoryAPI.find(req.getParameter("child"), user, false);
   
    categoryAPI.addChild(cat, child, user, false);
    categoryAPI.save(cat, null, user, false);
        Logger.debug(this, "Child Category Added");
    SessionMessages.add(req, "message", "message.category.addchild");
View Full Code Here

    private void _viewCategory(ActionForm form, ActionRequest req, ActionResponse res) throws Exception {

      User user = _getUser(req);
     
      String inode = req.getParameter("inode");
      Category cat = new Category();
      if(inode != null && !inode.equals("null") && InodeUtils.isSet((req.getParameter("inode"))))
        cat = (Category) categoryAPI.find(req.getParameter("inode"), user, false);
    req.setAttribute(WebKeys.CATEGORY_EDIT, cat);
    req.setAttribute(WebKeys.CATEGORY_LIST_TOP, categoryAPI.findTopLevelCategories(user, false));
View Full Code Here

TOP

Related Classes of com.dotmarketing.portlets.categories.model.Category

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.