01: package org.emforge.projectmanager.web.bean;
02:
03: import com.ecyrd.jspwiki.parser.MarkupParser;
04:
05: public class SettingsController extends ProjectController {
06:
07: public String getTitleImpl() {
08: if (isNewProject()) {
09: return "Create New Project";
10: } else {
11: return getProject().getName() + ": Project Settings";
12: }
13: }
14:
15: public String getDialogTitle() {
16: if (isNewProject()) {
17: return "New Project Settings";
18: } else {
19: return "Change Project Settings";
20: }
21: }
22:
23: /** This action is used for new project dialog
24: * to automatically generate unique projectName from project Display Name
25: *
26: * @return
27: */
28: public String changeProjectName() {
29: if (isNewProject()) {
30: // this is used only for new projects
31: String displayName = getProject().getDisplayName();
32: String name = MarkupParser.cleanLink(displayName);
33: String projectName = name;
34: int i = 0;
35: // now, check - name should be unique
36: while (m_projectService.getProject(projectName) != null) {
37: i++;
38: projectName = name + i;
39: }
40:
41: getProject().setName(projectName);
42: }
43:
44: return null;
45: }
46:
47: public String cancel() {
48: if (m_trail.getCurrentUrl() != null) {
49: redirect(m_trail.getCurrentUrl());
50: }
51:
52: return null;
53: }
54: }
|