1 package org.apache.turbine.modules.screens.error;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 import org.apache.ecs.ConcreteElement;
25 import org.apache.ecs.ElementContainer;
26
27 import org.apache.ecs.html.A;
28 import org.apache.fulcrum.parser.ParameterParser;
29
30 import org.apache.turbine.modules.Screen;
31 import org.apache.turbine.pipeline.PipelineData;
32 import org.apache.turbine.util.RunData;
33 import org.apache.turbine.util.uri.TurbineURI;
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51 public class InvalidState
52 extends Screen
53 {
54
55
56
57
58
59
60 public ConcreteElement doBuild(RunData data)
61 throws Exception
62 {
63 ElementContainer body = new ElementContainer();
64 ElementContainer message = new ElementContainer();
65
66 StringBuffer sb = new StringBuffer();
67 sb.append("<b>There has been an error.</b>")
68 .append("<p>")
69 .append("- If you used the browser \"Back\" or \"Reload\"")
70 .append(" buttons please use the navigation buttons we provide")
71 .append(" within the screen.")
72 .append("<p>")
73 .append("Please click ");
74
75 message.addElement(sb.toString());
76 ParameterParser pp;
77 pp = (ParameterParser) data.getUser().getTemp("prev_parameters");
78 pp.remove("_session_access_counter");
79
80 TurbineURI back = new TurbineURI(data,(String) data.getUser().getTemp("prev_screen"));
81 back.addPathInfo(pp);
82 message.addElement(new A().setHref(back.getRelativeLink()).addElement("here"));
83
84 message.addElement(" to return the the screen you were working on.");
85
86 body.addElement(message);
87 return body;
88 }
89
90
91
92
93
94
95
96 public ConcreteElement doBuild(PipelineData pipelineData)
97 throws Exception
98 {
99 RunData data = getRunData(pipelineData);
100 return doBuild(data);
101 }
102
103 }