Package com.multysite.model

Examples of com.multysite.model.CategoryModel


      if (!NamespaceManager.get().equals(Setting.getGeneralNamespace())) {
        String alias = req.getParameter("alias");
        News obj = NewsModel.getById(alias);

        if (obj != null) {
          CategoryModel cateModel = new CategoryModel();
          cateModel.prepareAll();
          if (cateModel.getListResult().size() == 0) {
            List<Category> listCate = new ArrayList<Category>();
            Category cate = new Category();
            cate.setTitle("Uncategory");
            cate.setAlias("uncategory");
            cate.setLevel(1);
            cate.setParentAlias("");
            CategoryModel.insert(cate);
            listCate.add(cate);
            req.setAttribute("listCategory", listCate);
          } else {
            req.setAttribute("listCategory",
                cateModel.getListResult());
          }
          cateModel.prepareAllParrentList();
          req.setAttribute("listParentCategory",
              cateModel.getListResult());
          req.setAttribute("action", "edit");
          req.setAttribute("obj", obj);
          req.getRequestDispatcher("/admin/pages/news-form.jsp")
              .forward(req, resp);
        } else {
View Full Code Here


          bind.put("description_for_layout", config.getDescription());
          bind.put("keyword_for_layout", config.getKeyword());
          bind.put("css_for_layout", template.getCss());
          bind.put("js_for_layout", template.getJs());

          CategoryModel cateModel = new CategoryModel();
          cateModel.prepareAll();
          TagModel tagModel = new TagModel();
          tagModel.prepareList();

          bind.put("keyword", keyword);
          bind.put("recent_view", RecentViewHelper.getRecentView());
          bind.put("list_tag", tagModel.getListResult());
          bind.put("list_category", cateModel.getListResult());

          bind.put("current_page", model.getPage());
          bind.put("total_page", model.getTotalPage());
          bind.put("articles", model.getListResult());
          try {
View Full Code Here

                config.getDescription());
            bind.put("keyword_for_layout", config.getKeyword());
            bind.put("css_for_layout", template.getCss());
            bind.put("js_for_layout", template.getJs());

            CategoryModel cateModel = new CategoryModel();
            cateModel.prepareAll();
            TagModel tagModel = new TagModel();
            tagModel.prepareList();

            bind.put("current_tag", obj);
            bind.put("recent_view",
                RecentViewHelper.getRecentView());
            bind.put("list_tag", tagModel.getListResult());
            bind.put("list_category", cateModel.getListResult());

            List<News> listResult = new ArrayList<News>();
            listResult = obj.recoverListNews();
            int start = (page - 1) * limit;
            double dLimit = limit;
View Full Code Here

            page = 1;
          }
          NewsModel model = new NewsModel();
          model.setPage(page);
          model.prepareList();
          CategoryModel cateModel = new CategoryModel();
          cateModel.prepareAll();
          TagModel tagModel = new TagModel();
          tagModel.prepareList();

          CompiledScript compiledscript = CompileScriptEngine
              .getCompileScript(config.getApplicationId(),
                  "home", template.getHome());
          if (compiledscript != null) {
            Bindings bind = compiledscript.getEngine().getBindings(
                ScriptContext.ENGINE_SCOPE);
            bind.put("title_for_layout", config.getTitle());
            bind.put("description_for_layout",
                config.getDescription());
            bind.put("keyword_for_layout", config.getKeyword());
            bind.put("css_for_layout", template.getCss());
            bind.put("js_for_layout", template.getJs());

            bind.put("recent_view",
                RecentViewHelper.getRecentView());
            bind.put("list_tag", tagModel.getListResult());
            bind.put("list_category", cateModel.getListResult());

            bind.put("current_page", model.getPage());
            bind.put("total_page", model.getTotalPage());
            bind.put("articles", model.getListResult());
            try {
View Full Code Here

          resp.getWriter().print(treeCache.get(alias));
        } else {
          log.warning("-------detail no cache -----");
          News obj = NewsModel.getById(alias);
          if (obj != null) {
            CategoryModel cateModel = new CategoryModel();
            cateModel.prepareAll();
            TagModel tagModel = new TagModel();
            tagModel.prepareList();
            CompiledScript compiledscript = CompileScriptEngine
                .getCompileScript(config.getApplicationId(),
                    "detail", template.getDetail());

            Bindings bind = compiledscript.getEngine().getBindings(
                ScriptContext.ENGINE_SCOPE);
            bind.put("title_for_layout", config.getTitle());
            bind.put("description_for_layout",
                config.getDescription());
            bind.put("keyword_for_layout", config.getKeyword());
            bind.put("css_for_layout", template.getCss());
            bind.put("js_for_layout", template.getJs());

            RecentViewHelper.addRecentView(obj);
            bind.put("recent_view",
                RecentViewHelper.getRecentView());
            bind.put("list_tag", tagModel.getListResult());
            bind.put("list_category", cateModel.getListResult());
            bind.put("article", obj);
            try {
              String result = (String) compiledscript.eval();
              treeCache.put(alias, result);
              resp.getWriter().print(result);
View Full Code Here

  public void doGet(HttpServletRequest req, HttpServletResponse resp)
      throws IOException {
    try {
      resp.setCharacterEncoding("utf-8");
      if (!NamespaceManager.get().equals(Setting.getGeneralNamespace())) {
        CategoryModel cateModel = new CategoryModel();
        cateModel.prepareAll();
        if (cateModel.getListResult().size() == 0) {
          List<Category> listCate = new ArrayList<Category>();
          Category cate = new Category();
          cate.setTitle("Uncategory");
          cate.setAlias("uncategory");
          cate.setLevel(1);
          cate.setParentAlias("");
          CategoryModel.insert(cate);
          listCate.add(cate);
          req.setAttribute("listCategory", listCate);
        } else {
          req.setAttribute("listCategory", cateModel.getListResult());
        }

        cateModel.prepareAllParrentList();
        req.setAttribute("listParentCategory",
            cateModel.getListResult());
        req.setAttribute("action", "add");
        req.setAttribute("obj", new News());
        req.getRequestDispatcher("/admin/pages/news-form.jsp").forward(
            req, resp);
      } else {
View Full Code Here

            List<News> listNews = new ArrayList<News>();
            NewsModel model = new NewsModel();
            model.setPage(page);
            model.prepareListByCategory(categoryAlias);
            listNews = model.getListResult();
            CategoryModel cateModel = new CategoryModel();
            cateModel.prepareAll();
            TagModel tagModel = new TagModel();
            tagModel.prepareList();
            bind.put("recent_view",
                RecentViewHelper.getRecentView());
            bind.put("list_tag", tagModel.getListResult());
            bind.put("list_category", cateModel.getListResult());

            bind.put("category", obj);
            bind.put("current_page", model.getPage());
            bind.put("total_page", model.getTotalPage());
            bind.put("articles", listNews);
View Full Code Here

TOP

Related Classes of com.multysite.model.CategoryModel

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.