01: /*
02: * Copyright 2002-2005 the original author or authors.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16:
17: package info.jtrac.wicket;
18:
19: import info.jtrac.domain.User;
20: import org.apache.wicket.markup.html.link.Link;
21:
22: /**
23: * options menu page
24: */
25: public class OptionsPage extends BasePage {
26:
27: public OptionsPage() {
28:
29: setVersioned(false);
30:
31: final User user = getPrincipal();
32:
33: add(new Link("profile") {
34: public void onClick() {
35: UserFormPage page = new UserFormPage(user);
36: page.setPrevious(OptionsPage.this );
37: setResponsePage(page);
38: }
39: });
40:
41: boolean isAdmin = user.isAdminForAllSpaces();
42:
43: add(new Link("users") {
44: public void onClick() {
45: setResponsePage(new UserListPage());
46: }
47: }.setVisible(isAdmin));
48:
49: add(new Link("spaces") {
50: public void onClick() {
51: setResponsePage(new SpaceListPage());
52: }
53: }.setVisible(isAdmin));
54:
55: add(new Link("settings") {
56: public void onClick() {
57: setResponsePage(new ConfigListPage(null));
58: }
59: }.setVisible(isAdmin));
60:
61: add(new Link("indexes") {
62: public void onClick() {
63: setResponsePage(new IndexRebuildPage(false));
64: }
65: }.setVisible(isAdmin));
66:
67: add(new Link("import") {
68: public void onClick() {
69: }
70: }.setVisible(false));
71:
72: }
73:
74: }
|