public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    ModelMap model = new ModelMap();
    // Integer patientId = (Integer) request.getAttribute("patientId");
    String patientIdStr = (String) request.getParameter("patientId");
    Integer patientId = Integer.valueOf(patientIdStr);
    Patient p = Context.getPatientService().getPatient(patientId);
    System.out.println(
        "PatientNotesPortletController handleRequest **************************\n"
            + "Patient id: "
            + patientIdStr);
    model.put("patient", p);
    List<Note> nots = Context.getService(NoteService.class).getNotesByPatient(p);
    ArrayList<Note> notes = new ArrayList<Note>();
    if (nots.size() > 4) {
      for (int i = 0; i < 4; i++) {
        notes.add(nots.get(i));
      }
    } else {
      notes.addAll(nots);
    }
    model.put("notes", notes);

    String filepath;
    // Put any files for reading in the following directory - unix/windows
    if (OpenmrsConstants.UNIX_BASED_OPERATING_SYSTEM) {
      filepath = System.getProperty("user.home") + File.separator + ".OpenMRS";
    } else {
      filepath =
          System.getProperty("user.home")
              + File.separator
              + "Application Data"
              + File.separator
              + "OpenMRS";
    }

    filepath = filepath + File.separator;
    File folder = new File(filepath);

    if (!folder.exists()) {
      model.put("prop", "NO SUCH FILE");
      return new ModelAndView("/module/basicmodule/portlets/patientNotes", model);
    }
    BufferedReader r;
    try {
      String line = "";
      r = new BufferedReader(new FileReader(filepath + "openmrs-runtime.properties.txtt"));
      for (int i = 0; i < 3; i++) {
        line += r.readLine() + "<br>";
      }
      System.out.println(
          "Property file: " + filepath + "openmrs-runtime.properties.txtt" + "   Line: " + line);
      model.put("prop", line);
      r.close();
    } catch (Exception ex) {
      Logger.getLogger(PatientNotesController.class.getName()).log(Level.SEVERE, null, ex);
    }

    return new ModelAndView("/module/basicmodule/portlets/patientNotes", model);
  }
Ejemplo n.º 2
0
  @RequestMapping(value = "/comtMain")
  public String getCumtMain(
      @RequestParam Map<String, Object> paramMap, ModelMap model, Authentication authentication)
      throws Throwable {
    // Spring Security의 Authentication 객를 주입
    MemberInfo memberInfo = (MemberInfo) authentication.getPrincipal();

    // cumt left 메뉴 조회
    List<ComtVo> list = getCumntUserJoinList(memberInfo);
    model.addAttribute("comtlist", list);
    model.addAttribute("memberInfo", memberInfo);

    model.put("compId", memberInfo.getCompId());

    // 커뮤니티내의 게시글 조회(전체)
    paramMap.put("allYn", "");
    paramMap.put("compId", memberInfo.getCompId());
    int total = 0;
    List<ComtBoardVo> boardList = communityService.getComtBoardNewList(paramMap);
    if (boardList != null && boardList.size() > 0) {
      total = boardList.size();
    }

    model.put("comtBdList", boardList);
    model.put("total", total);

    return "/cumtMainLayout/left_community/comtMain";
  }
Ejemplo n.º 3
0
  @RequestMapping("/listRolesAction")
  public String listRolesAction(ModelMap modelmap, String page) {
    StringBuffer url = new StringBuffer();
    // 把action跳转的地址存在url中
    url.append(request.getContextPath() + "/listRolesAction?method=listRoles");
    int current = 1;
    if (page != null && !page.trim().equals("")) {
      current = Integer.parseInt(page);
    }
    try {
      int first = 0;
      int pageSize = Integer.parseInt(String.valueOf(PageBean.pagecount));
      if (current != 0) {
        first = (current - 1) * pageSize;
      }
      int startNum = first;
      Map<String, Object> params = new HashMap<String, Object>();
      params.put("sortName", "roleid");
      params.put("pageSize", pageSize);
      params.put("startNum", startNum);
      int num = rolesService.findByParamsCount(null);
      List<Roles> listRoles = rolesService.findByParams(params);
      PageBean PageBean = new PageBean(current, pageSize, num, listRoles);
      PageBean.setUrl(url.toString());
      modelmap.put("pageBean", PageBean);
      modelmap.put("PageList", PageBean.getList());

    } catch (Exception e) {
      e.printStackTrace();
      return "error/404";
    }

    return "WebRoot/roles/listRole";
  }
Ejemplo n.º 4
0
  @RequestMapping("/image")
  @ResponseBody
  public ModelMap fileUpload(
      @RequestParam(value = "file") MultipartFile file,
      @RequestParam(value = "name") String name,
      ModelMap model,
      HttpServletRequest request) {

    if (file != null) {
      try {
        // 上传地址
        String path = request.getSession().getServletContext().getRealPath("/upload/headimg/");
        String fileName = file.getOriginalFilename();
        file.transferTo(new File(path, fileName));
      } catch (IOException e) {
        e.printStackTrace();
      }
    } else {
      return null;
    }

    model.put("fileName", file.getOriginalFilename());
    model.put("name", name);
    model.put("date", new Date());
    return model;
  }
Ejemplo n.º 5
0
  @RequestMapping("to_login")
  public String ToLogin(HttpServletRequest request, ModelMap map) throws WebException {
    try {
      // X509Certificate[] clientCertChain = (X509Certificate[])
      // request.getAttribute("javax.servlet.request.X509Certificate");
      String certString = request.getHeader("client-cert");
      if (StringUtils.isEmpty(certString)) {
        return LOGINPAGER;
      }
      certString = certString.replaceAll("\t", "\n");
      X509Certificate clientCertChain =
          (X509Certificate) new PEMReader(new StringReader(certString), null, "SUN").readObject();
      if (clientCertChain == null) {
        return LOGINPAGER;
      } else {
        Principal dn = clientCertChain.getSubjectDN();
        X500Name x509Principal = (X500Name) dn;
        String uid = x509Principal.getGivenName();
        if (StringUtils.isNotEmpty(uid)) {
          String[] uids = uid.split(",");
          map.put("accountName", uids[1]);
          map.put("memberName", uids[0]);
        }
      }

      return LOGINPAGER;
    } catch (Exception e) {
      throw new WebException("系统错误", e);
    }
  }
Ejemplo n.º 6
0
 @RequestMapping(value = "/data.htm", method = RequestMethod.GET)
 public String loadSearchSuggestions(
     ModelMap map,
     @RequestParam(value = "data") String finData,
     @RequestParam(value = "cat") String searchBy,
     @RequestParam(value = "id") String searchId) {
   if (searchId.equals("searchUser")) {
     List<User> users;
     if (searchBy.equals("Name")) {
       users = userService.searchUser("fullName", finData);
     } else if (searchBy.equals("Address")) {
       users = userService.searchUser("homeAddress", finData);
       map.put("flag", "address");
     } else {
       users = null;
       map.put("flag", "hideSug");
     }
     map.put("userList", users);
   } else {
     List<Org> orgs = orgService.findOrg("orgName", finData);
     map.put("flag", "org");
     map.put("orgList", orgs);
   }
   return "searchSuggestions";
 }
Ejemplo n.º 7
0
 @RequestMapping(method = RequestMethod.GET)
 public String list(
     ModelMap map, HttpSession session, @RequestParam(value = "page", defaultValue = "1") int page)
     throws Exception {
   SellerReviewSearch reviewSearch = new SellerReviewSearch();
   reviewSearch.setPageIndex(page - 1);
   reviewSearch.setPageSize(20);
   DataPage<SellerReview> search = sellerReviewService.search(reviewSearch);
   List<String> userIds = new ArrayList<>();
   for (SellerReview sellerReview : search.getData()) {
     if (!userIds.contains(sellerReview.getUserId())) {
       userIds.add(sellerReview.getUserId());
     }
     if (!userIds.contains(sellerReview.getSellerId())) {
       userIds.add(sellerReview.getSellerId());
     }
   }
   List<User> users = userService.getUserByIds(userIds);
   for (User user : users) {
     for (SellerReview sellerReview : search.getData()) {
       if (sellerReview.getSellerId() != null && sellerReview.getSellerId().equals(user.getId())) {
         sellerReview.setUserNameSeller(user.getName());
       }
       if (sellerReview.getSellerId() != null && sellerReview.getUserId().equals(user.getId())) {
         sellerReview.setUserNameBuyer(user.getName());
       }
     }
   }
   map.put("dataPage", search);
   map.put("clientScript", "sellerreview.init();");
   return "cp.sellerreview";
 }
Ejemplo n.º 8
0
 @RequestMapping(value = "signIn")
 public String signIn(ModelMap map, String username, String password) {
   String flag = "", message = "";
   if (username == null || username.isEmpty()) {
     flag = "0";
     message = "用户名为空";
   } else if (password == null || password.isEmpty()) {
     flag = "0";
     message = "密码为空";
   } else {
     Account account = loginService.getAccountByUserName(username);
     if (account == null) {
       flag = "0";
       message = "用户名错误";
     } else if (!password.equals(account.getPassword())) {
       flag = "0";
       message = "密码错误";
     } else {
       flag = "1";
       message = "登陆成功";
     }
   }
   map.put("flag", flag);
   map.put("message", message);
   return "login";
 }
Ejemplo n.º 9
0
  @RequestMapping(value = "/s", method = RequestMethod.GET)
  public String s(ModelMap model, HttpServletRequest request) throws Exception {
    StringBuffer paramString = new StringBuffer();
    for (Object paramName : request.getParameterMap().keySet()) {
      String name = (String) paramName;
      for (String value : request.getParameterValues(name)) {
        if (paramString.length() > 0) paramString.append("&");

        try {
          if ("type".equalsIgnoreCase(name)) {
            type = URLEncoder.encode(value, "ISO8859-1");
          }
          paramString.append(name + "=" + URLEncoder.encode(value, "ISO8859-1"));
        } catch (Exception e) {
          paramString.append(name + "=" + value);
        }
      }
    }

    ContentModel contentModel = searchService.listHtml(paramString.toString(), type);

    model.put("content", contentModel.getContent());
    model.put("type", type);
    model.put("key", new String(request.getParameter("wd").getBytes("ISO8859-1"), "utf-8"));

    return PATH + "result";
  }
Ejemplo n.º 10
0
 @RequestMapping(value = "/search/{archive}/query-multiarchive", method = RequestMethod.GET)
 public String queryPageMulti(
     @ModelAttribute("userBean") UserBean userBean,
     @ModelAttribute("confBean") ConfBean confBean,
     @PathVariable String archive,
     ModelMap modelMap,
     HttpServletRequest request,
     HttpServletResponse response)
     throws Exception {
   common(confBean, userBean, archive, modelMap, request, response);
   Map<String, List<Archive>> usersArchives = new LinkedHashMap<String, List<Archive>>();
   serviceUser.loadArchives(userBean, usersArchives);
   modelMap.addAttribute("usersArchives", usersArchives);
   MultiQueryPageCommand queryPageCommand =
       new MultiQueryPageCommand(request.getParameterMap(), modelMap);
   queryPageCommand.execute();
   QueryPageView pageView = new QueryPageView();
   WorkFlowBean workFlowBean = (WorkFlowBean) modelMap.get("workFlowBean");
   pageView.generateView(workFlowBean, confBean, userBean, modelMap);
   modelMap.put("positionMap", pageView.getPositionMap());
   modelMap.put("positionAdminMap", pageView.getPositionAdminMap());
   modelMap.put("outputHourField", pageView.getOutputHourField());
   modelMap.put("outputDataField", pageView.getOutputDataField());
   modelMap.put("outputSortField", pageView.getOutputSortField());
   return "multiArchive/search/query-multiarchive";
 }
Ejemplo n.º 11
0
 // 收货地址保存
 @RequestMapping(value = "/save", method = RequestMethod.POST)
 public String save(ModelMap map, HttpServletRequest request, Receiver receiver) {
   if (StringUtils.isEmpty(receiver.getPhone()) && StringUtils.isEmpty(receiver.getMobile())) {
     map.put("errorMessage", "联系电话、联系手机必须填写其中一项!");
     return ERROR;
   }
   if (!areaService.isAreaPath(receiver.getAreaPath())) {
     map.put("errorMessage", "地区错误!");
     return ERROR;
   }
   Area localArea =
       (Area)
           areaService.get(
               receiver.getAreaPath().substring(receiver.getAreaPath().lastIndexOf(",") + 1));
   if (localArea == null) {
     map.put("errorMessage", "请选择收货地址!");
     return ERROR;
   }
   receiver.setArea(localArea);
   Members loginMember = getLoginMember(request);
   Set<Receiver> receiverSet = loginMember.getReceiverSet();
   if (receiverSet != null
       && Receiver.MAX_RECEIVER_COUNT != null
       && receiverSet.size() >= Receiver.MAX_RECEIVER_COUNT) {
     map.put("errorMessage", "只允许添加最多" + Receiver.MAX_RECEIVER_COUNT + "项收货地址!");
     return ERROR;
   }
   receiver.setMember(loginMember);
   receiverService.save(receiver);
   map.put("redirectUrl", OPERRATE_RETURN_URL);
   return SUCCESS;
 }
Ejemplo n.º 12
0
 /**
  * Display the user profile.
  *
  * @param model
  * @param username
  * @return
  */
 @RequestMapping(value = "/profile/{username:.*}", method = RequestMethod.GET)
 public String userProfileController(
     final ModelMap model,
     @PathVariable String username,
     HttpServletRequest request,
     HttpServletResponse response) {
   username = filterValue(username);
   try {
     final UserAccountBean accountBean = getSecurityService().searchUserByUsername(username);
     setCss(model, "home");
     if (accountBean == null) {
       return "404";
     } else {
       // 1 - load all items poll / survey / poll for {username} order by date
       // 2 - hashtag created by {username}
       // 3 - social link published by {username}
       // 4 - last comments
       log.debug("user --> " + accountBean);
       model.put("profile", accountBean);
       final List<HomeBean> lastItems =
           getFrontService()
               .getLastItemsPublishedFromUserAccount(
                   username, this.profileDefaultItems, false, request);
       model.put("lastItems", lastItems);
       return "profile/view";
     }
   } catch (EnMeNoResultsFoundException e) {
     // e.printStackTrace();
     log.error(e);
     return "500";
   }
 }
Ejemplo n.º 13
0
 /**
  * @author 进入添加目录页面
  * @throws Exception
  */
 @RequestMapping(value = "/add.htm", method = RequestMethod.GET)
 public String login(ModelMap modelMap) throws Exception {
   modelMap.put("folderAll", folderService.getAllFolderList(0, null));
   modelMap.put("folderName", "");
   modelMap.put("folderEname", "");
   return "system/folder/add";
 }
 @RequestMapping("/add/{id}")
 public String add(@PathVariable String id, ModelMap m) {
   m.put("archive_id", id);
   m.put("DicList", dictionaryService.listDictionaryByPid("3"));
   m.put("jxnr", choicenesscontentService.selectByKey(id));
   return "system/jxnr/jxnrinfo";
 }
  @RequestMapping(
      value = "/access/{id}",
      method = RequestMethod.GET,
      produces = MediaType.APPLICATION_JSON_VALUE)
  public String getAccessTokenById(@PathVariable("id") Long id, ModelMap m, Principal p) {

    OAuth2AccessTokenEntity token = tokenService.getAccessTokenById(id);

    if (token == null) {
      logger.error("getToken failed; token not found: " + id);
      m.put(HttpCodeView.CODE, HttpStatus.NOT_FOUND);
      m.put(
          JsonErrorView.ERROR_MESSAGE,
          "The requested token with id " + id + " could not be found.");
      return JsonErrorView.VIEWNAME;
    } else if (!token.getAuthenticationHolder().getAuthentication().getName().equals(p.getName())) {
      logger.error("getToken failed; token does not belong to principal " + p.getName());
      m.put(HttpCodeView.CODE, HttpStatus.FORBIDDEN);
      m.put(JsonErrorView.ERROR_MESSAGE, "You do not have permission to view this token");
      return JsonErrorView.VIEWNAME;
    } else {
      m.put(JsonEntityView.ENTITY, token);
      return TokenApiView.VIEWNAME;
    }
  }
Ejemplo n.º 16
0
  @Secured({"ROLE_DEVELOPER", "ROLE_TESTER"})
  @RequestMapping("goAddBug.htm")
  public ModelAndView goAddBug(HttpServletRequest request) {

    Company company = (Company) request.getSession().getAttribute("company");
    DetachedCriteria dCriteria = DetachedCriteria.forClass(Project.class);
    dCriteria.add(Restrictions.eq("company", company));
    List<Project> projectList = aService.queryAllOfCondition(Project.class, dCriteria);

    DetachedCriteria dCriteria1 = DetachedCriteria.forClass(Department.class);
    dCriteria1.add(Restrictions.eq("company", company));
    List<Department> deptList = aService.queryAllOfCondition(Department.class, dCriteria1);

    DetachedCriteria dCriteria2 = DetachedCriteria.forClass(Developer.class);
    dCriteria2.createCriteria("user").add(Restrictions.in("department", deptList));
    List<Developer> userList = aService.queryAllOfCondition(Developer.class, dCriteria2);

    DetachedCriteria dCriteria3 = DetachedCriteria.forClass(User.class);
    dCriteria3.add(Restrictions.in("department", deptList));
    List<User> userList1 = aService.queryAllOfCondition(User.class, dCriteria3);

    ModelMap map = new ModelMap();
    map.put("projectList", projectList);
    map.put("userList", userList);
    map.put("userList1", userList1);

    return new ModelAndView("/bug/addBug", map);
  }
  @PreAuthorize("hasRole('ROLE_ADMIN')")
  @RequestMapping(
      value = "/registration/{clientId}",
      method = RequestMethod.PUT,
      produces = MediaType.APPLICATION_JSON_VALUE)
  public String rotateRegistrationTokenByClientId(
      @PathVariable("clientId") String clientId, ModelMap m, Principal p) {
    ClientDetailsEntity client = clientService.loadClientByClientId(clientId);

    if (client != null) {
      OAuth2AccessTokenEntity token =
          oidcTokenService.rotateRegistrationAccessTokenForClient(client);
      token = tokenService.saveAccessToken(token);

      if (token != null) {
        m.put(JsonEntityView.ENTITY, token);
        return TokenApiView.VIEWNAME;
      } else {
        m.put(HttpCodeView.CODE, HttpStatus.NOT_FOUND);
        m.put(JsonErrorView.ERROR_MESSAGE, "No registration token could be found.");
        return JsonErrorView.VIEWNAME;
      }
    } else {
      // client not found
      m.put(HttpCodeView.CODE, HttpStatus.NOT_FOUND);
      m.put(
          JsonErrorView.ERROR_MESSAGE,
          "The requested client with id " + clientId + " could not be found.");
      return JsonErrorView.VIEWNAME;
    }
  }
Ejemplo n.º 18
0
  @Secured({"ROLE_DEVELOPER", "ROLE_TESTER"})
  @RequestMapping(value = "showBug/{bugId}.htm", method = RequestMethod.GET)
  public String showBug(@PathVariable Integer bugId, ModelMap map) {

    Bug bug = aService.findById(Bug.class, bugId);

    List<History> histories =
        aService.queryAllOfCondition(
            History.class,
            DetachedCriteria.forClass(History.class)
                .add(Restrictions.eq("objectType", "bug"))
                .add(Restrictions.eq("objectId", bug.getBugId()))
                .addOrder(Order.asc("operateTime")));
    List<Resource> resources =
        aService.queryAllOfCondition(
            Resource.class,
            DetachedCriteria.forClass(Resource.class)
                .add(Restrictions.eq("objectType", "bug"))
                .add(Restrictions.eq("objectId", bug.getBugId()))
                .addOrder(Order.asc("resourceId")));

    map.put("bug", bug);
    map.put("histories", histories);
    map.put("resources", resources);

    return "bug/showBug";
  }
  @RequestMapping(value = "/productDetails.do", method = RequestMethod.GET)
  public String viewProductDetails(
      @RequestParam(value = "productId", required = true) final Long productId, ModelMap modelMap) {
    Product product = productService.getProductDetails(productId);

    List<String> models = new ArrayList<String>();

    models.add(product.getModel());

    List<com.ombillah.ecom4j.remix.domain.Products.Product> products =
        remixService.getRemixProducts(models);

    if (CollectionUtils.isEmpty(products)) {
      // this is for demonstration only to display a similar result!
      products =
          remixService.getProductOfCategory(
              product.getMake(), product.getCategory().getCategoryId());
    }

    if (!CollectionUtils.isEmpty(products)) {
      List<String> skus = new ArrayList<String>();
      skus.add(Integer.toString(products.get(0).getSku()));
      List<Review> reviews = remixService.getRemixReviews(skus);

      modelMap.put("remixProduct", products.get(0));
      modelMap.put("reviews", reviews);
    }

    return "productDetails";
  }
 @RequestMapping(value = "/", method = RequestMethod.GET)
 public String getTasksForPerformer(
     ModelMap model,
     @RequestParam(value = "tag", required = false) String tag,
     @RequestParam(value = "lang", required = false) String lang,
     HttpServletRequest request) {
   if (SecurityContextHolder.getContext().getAuthentication().getPrincipal()
       instanceof UserDetailsImpl) {
     model.put("ordersActive", true);
     model.put("tag", tag != null ? "#" + tag : "");
     return "announcmentsForPerformer";
   } else {
     if (lang != null) {
       return "redirect:/";
     }
     List<LandingSlideModel> allSlidesPeople =
         landingSlideService.findAllSlidesPeopleModel(
             localeResolver.resolveLocale(request).getLanguage());
     List<LandingSlideModel> allSlidesBusiness =
         landingSlideService.findAllSlidesBusinessModel(
             localeResolver.resolveLocale(request).getLanguage());
     List<LandingSlideModel> allSlidesBenefits =
         landingSlideService.findAllSlidesIconsModel(
             localeResolver.resolveLocale(request).getLanguage());
     Hibernate.initialize(allSlidesPeople);
     Hibernate.initialize(allSlidesBusiness);
     Hibernate.initialize(allSlidesBenefits);
     model.put("allSlidesPeople", allSlidesPeople);
     model.put("allSlidesBusiness", allSlidesBusiness);
     model.put("allSlidesBenefits", allSlidesBenefits);
     return "landing";
   }
 }
Ejemplo n.º 21
0
  @RequestMapping(value = "/{uuid}", method = RequestMethod.GET)
  public String get(@PathVariable String uuid, ModelMap model, HttpServletRequest request) {
    ResponseMessage responseMessage = RestUtil.addResponseMessageForModelMap(model);
    ClassNewsJsonform c;
    try {
      c = classNewsService.get(uuid);
      // 定义接口,返回浏览总数.
      model.put(
          RestConstants.Return_ResponseMessage_count,
          countService.count(uuid, SystemConstants.common_type_hudong));
      model.put(
          RestConstants.Return_ResponseMessage_share_url, PxStringUtil.getClassNewsByUuid(uuid));

    } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
      responseMessage.setStatus(RestConstants.Return_ResponseMessage_failed);
      responseMessage.setMessage(e.getMessage());
      return "";
    }
    model.addAttribute(RestConstants.Return_G_entity, c);

    responseMessage.setStatus(RestConstants.Return_ResponseMessage_success);
    return "";
  }
Ejemplo n.º 22
0
  /**
   * 注销健康卡提交页
   *
   * @param model
   * @param mfile
   * @author 韩友军<*****@*****.**>
   * @since 2012-11-20下午12:57:08
   */
  @SuppressWarnings("unchecked")
  @RequestMapping(value = "/doCancelCardByExcel.html", method = RequestMethod.POST)
  public String doCancelCardByExcelAction(ModelMap model, HttpServletRequest request) {

    DiskFileItemFactory objDiskFileItemFactory = new DiskFileItemFactory();
    objDiskFileItemFactory.setSizeThreshold(1024 * 1024); // 缓存
    ServletFileUpload objServletFileUpload = new ServletFileUpload(objDiskFileItemFactory);

    try {
      List<FileItem> fileItems = objServletFileUpload.parseRequest(request);
      Iterator<FileItem> iterator = fileItems.iterator();
      while (iterator.hasNext()) {
        FileItem fileItem = (FileItem) iterator.next();
        if (!fileItem.isFormField()) {
          String strPath = this.context.getRealPath("/upload/");
          File file = new File(strPath + new Date().getTime() + ".xls");
          fileItem.write(file);
          String strFilePath = file.getPath();
          Map<String, Object> mapData = cardBO.cancelCard(strFilePath);
          model.put("data", mapData);
          model.put("success", true);
        }
      }
    } catch (Exception e) {
      model.put("success", false);
    }
    return "card/do_cancel_card_by_excel.html";
  }
Ejemplo n.º 23
0
  @RequestMapping("")
  public String list(
      ModelMap model,
      HttpSession session,
      @RequestParam(value = "page", defaultValue = "0") int page) {

    NewsCategorySearch catNewsSearch = new NewsCategorySearch();

    if (session.getAttribute("catNewsSearch") != null && page != 0) {
      catNewsSearch = (NewsCategorySearch) session.getAttribute("catNewsSearch");

    } else {
      session.setAttribute("catNewsSearch", catNewsSearch);
    }
    if (page > 0) {
      catNewsSearch.setPageIndex(page - 1);
    } else {
      catNewsSearch.setPageIndex(0);
    }
    catNewsSearch.setLevel(-1);
    catNewsSearch.setPageSize(200);

    DataPage<NewsCategory> categoryNewsPage = newsCategoryService.search(catNewsSearch);
    model.put("catNewsSearch", catNewsSearch);
    model.put("categoryNewsPage", categoryNewsPage);
    return "cp.newscategory";
  }
Ejemplo n.º 24
0
 /**
  * 进入设置项目页面
  *
  * @param map
  * @param name
  * @return
  * @throws IOException
  */
 @RequestMapping(value = "/projects/{name}/settings/{module}", method = RequestMethod.GET)
 public String settings(ModelMap map, @PathVariable String name, @PathVariable String module)
     throws IOException {
   Project project = projectService.findProject(name);
   map.put("project", project);
   map.put("module", module);
   return "project/settings";
 }
Ejemplo n.º 25
0
  @RequestMapping(method = RequestMethod.POST)
  public String search(
      @ModelAttribute("contactSearch") ContactSearch contactSearch, ModelMap model) {

    model.put("contactSearch", contactSearch);
    model.put("contactResults", mContactsController.getAllByExample(contactSearch));
    return "index";
  }
 @RequestMapping(value = "/p_info")
 public String personalInfo(ModelMap modelMap) {
   String userId = WebContextThreadLocal.getCurrentUser().getUserId();
   String email = WebContextThreadLocal.getCurrentUser().getUserEmail();
   modelMap.put("userId", userId);
   modelMap.put("email", email);
   return "user/personalInfo";
 }
Ejemplo n.º 27
0
 @RequestMapping("/signUp")
 public String createNewAccount(ModelMap modelMap) {
   UserFormBean userFormBean = new UserFormBean();
   userFormBean.setUser(new User());
   modelMap.put("userFormBean", userFormBean);
   modelMap.put("userFormAction", "/auth/saveUser");
   return "auth/signup";
 }
  @RequestMapping(value = "viewProfile", method = RequestMethod.GET)
  public String viewProfile(@RequestParam String username, ModelMap modelMap) {
    modelMap.put("user", userService.getUserByName(username));
    modelMap.put("tutorialsCreated", tutorialService.countNumberOfTutorialsByUsername(username));
    modelMap.put("exercisesCreated", exerciseService.countNumberOfExercisesByUsername(username));

    return "profile";
  }
Ejemplo n.º 29
0
 @RequestMapping(
     value = "/error/{code}",
     method = {RequestMethod.GET})
 public String toCode(ModelMap model, @PathVariable("code") String code) {
   model.put("code", code);
   model.put("msg", HttpStatus.message(code));
   return "error";
 }
Ejemplo n.º 30
0
 @RequestMapping("/fws/v_add.do")
 public String add(HttpServletRequest request, ModelMap model) {
   List<Website> allsite = websiteMng.getAllList();
   List<Category> categoryList = categoryMng.getChildList(2l, false, null, 584l, null, true);
   model.put("allsite", allsite);
   model.put("categoryList", categoryList);
   return "fws/add";
 }