Exemple #1
0
  // @Post("/projects/create")
  public static void doCreate(Project project) {
    User user = getLoggedin();
    List<ProjectTemplate> templates = ProjectTemplate.getTemplates(user, false);
    if (params.get("project.deadline") == "") {
      project.deadline = null;
    }

    Validation.valid("Project", project);
    if (Validation.hasErrors()) {
      displayValidationMessage();
      render("projects/create.html", project, templates);
    }

    ActionResult res;
    res = project.createAndGetResult(user);

    if (!res.isSuccess()) {
      displayError(res.getMessage(), "save-project");
      render("projects/create.html", project, templates);
    }

    res = project.assignCreator(user, null);
    if (!res.isSuccess()) {
      displayError(res.getMessage(), "set-creator-when-save-project");
      render("projects/create.html", project, templates);
    }
    project.copyFromTemplate(user, project.fromTemplate);

    if (!res.isSuccess()) {
      displayWarning(res.getMessage(), "save-activity-when-create-project");
    }
    structure(project.id);
  }
Exemple #2
0
 public static void doEdit(Project project) {
   if (params.get("project.deadline") == "") {
     project.deadline = null;
   }
   project.save(getLoggedin());
   flash.put("success", "Project Information has been saved");
   dashboard(project.id);
 }