Changeset 234:142018e051a1
- Timestamp:
- 08/31/09 15:00:15 (4 years ago)
- Author:
- tgambet
- Branch:
- default
- convert_revision:
- svn:cdcfb263-7567-472c-a848-e2c2df3466e7/trunk@235
- Message:
-
unicorn now displays error messages on the index page instead of a dedicated page
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r214
|
r234
|
|
| 12 | 12 | #end |
| 13 | 13 | |
| | 14 | #if ($message) |
| | 15 | <div id="messages"> |
| | 16 | <div class="error"> |
| | 17 | <h4>$message.Message</h4> |
| | 18 | #if ($message.Content) |
| | 19 | <pre>$message.Content</pre> |
| | 20 | #end |
| | 21 | </div> |
| | 22 | </div> |
| | 23 | #end |
| 14 | 24 | <div id="frontforms"> |
| 15 | 25 | <ul id="tabset_tabs"> |
-
|
r214
|
r234
|
|
| 63 | 63 | W3C.TaskOptions.addEvent('mouseout', function() { |
| 64 | 64 | W3C.TaskDescrip.set('text', W3C.TaskOptions[W3C.SelectedTask].title); |
| | 65 | }); |
| | 66 | |
| | 67 | $$('div.error').addClass('pointer'); |
| | 68 | |
| | 69 | $$('div.error pre').slide('hide'); |
| | 70 | |
| | 71 | $$('div.error').each(function(error) { |
| | 72 | error.addEvent('click', function(event) { |
| | 73 | error.getElement('pre').slide('toggle'); |
| | 74 | }); |
| 65 | 75 | }); |
| 66 | 76 | |
-
|
r228
|
r234
|
|
| 304 | 304 | color:#A3756E; |
| 305 | 305 | } |
| 306 | | |
| 307 | | /* After javascript */ |
| | 306 | #messages { |
| | 307 | padding:0.8em; |
| | 308 | font-size:0.9em; |
| | 309 | border:3px solid #FBC2C4; |
| | 310 | background: #FBE3E4; |
| | 311 | color:#8A1F11; |
| | 312 | margin:1.2em 2.3em; |
| | 313 | } |
| | 314 | #messages .error { |
| | 315 | |
| | 316 | } |
| | 317 | #messages .error h4 { |
| | 318 | line-height:18px; |
| | 319 | padding-left:22px; |
| | 320 | background:url(../images/icone_error.png) no-repeat scroll left top; |
| | 321 | } |
| | 322 | #messages .error pre { |
| | 323 | padding-top:0.6em; |
| | 324 | } |
| | 325 | #messages .pointer:hover h4 { |
| | 326 | text-decoration: underline; |
| | 327 | } |
| | 328 | |
| | 329 | /* Post-javascript */ |
| 308 | 330 | fieldset.toggles legend { |
| 309 | 331 | background:url(../images/arrow-closed.png) no-repeat scroll 0.2em 0.35em; |
| … |
… |
|
| 316 | 338 | cursor: pointer; |
| 317 | 339 | } |
| 318 | | #observations .pointer { |
| | 340 | .pointer { |
| 319 | 341 | cursor: pointer; |
| 320 | 342 | } |
-
|
r230
|
r234
|
|
| 10 | 10 | import org.w3c.unicorn.Framework; |
| 11 | 11 | import org.w3c.unicorn.language.Language; |
| | 12 | import org.w3c.unicorn.util.Message; |
| 12 | 13 | import org.w3c.unicorn.util.Property; |
| 13 | 14 | import org.w3c.unicorn.util.Templates; |
| … |
… |
|
| 47 | 48 | velocityContext.put("current_task", Framework.mapOfTask.get(taskParameter)); |
| 48 | 49 | |
| | 50 | if (req.getAttribute("unicorn_message") != null) |
| | 51 | //System.out.println("TOM: " + ((Message) req.getAttribute("unicorn_message")).getMessage()); |
| | 52 | velocityContext.put("message", req.getAttribute("unicorn_message")); |
| | 53 | |
| 49 | 54 | if (req.getHeader("X-Requested-With") != null && req.getHeader("X-Requested-With").equals("XMLHttpRequest")) { |
| 50 | 55 | //for JavaScript testing purposes |
-
|
r230
|
r234
|
|
| 1 | | // $Id: ObserveAction.java,v 1.3 2009-08-31 11:59:09 tgambet Exp $ |
| | 1 | // $Id: ObserveAction.java,v 1.4 2009-08-31 15:00:15 tgambet Exp $ |
| 2 | 2 | // Author: Jean-Guilhem Rouel |
| 3 | 3 | // (c) COPYRIGHT MIT, ERCIM and Keio, 2006. |
| … |
… |
|
| 37 | 37 | import org.w3c.unicorn.output.OutputFormater; |
| 38 | 38 | import org.w3c.unicorn.output.OutputModule; |
| | 39 | import org.w3c.unicorn.util.Message; |
| 39 | 40 | import org.w3c.unicorn.util.Property; |
| 40 | 41 | |
| … |
… |
|
| 98 | 99 | logger.debug("Lang Parameter: " + langParameter); |
| 99 | 100 | |
| 100 | | //velocityContext = new VelocityContext(Language.getContext(langParameter)); |
| | 101 | |
| 101 | 102 | |
| 102 | 103 | // Variables related to the output |
| … |
… |
|
| 125 | 126 | this.addParameter(sParamName, tStringParamValue, aUnicornCall, |
| 126 | 127 | mapOfSpecificParameter, mapOfOutputParameter); |
| 127 | | } // For |
| 128 | | |
| 129 | | if (aUnicornCall.getTask() == null) { |
| | 128 | } |
| | 129 | |
| | 130 | if (aUnicornCall.getTask() == null) |
| | 131 | aUnicornCall.setTask(Framework.mapOfTask.getDefaultTaskId()); |
| | 132 | |
| | 133 | /*if (aUnicornCall.getTask() == null) { |
| 130 | 134 | ObserveAction.logger.error("No task selected."); |
| 131 | 135 | this.createError(resp, new NoTaskException(), |
| 132 | 136 | mapOfSpecificParameter, mapOfOutputParameter); |
| 133 | 137 | return; |
| 134 | | } |
| 135 | | |
| | 138 | }*/ |
| | 139 | |
| | 140 | |
| 136 | 141 | try { |
| 137 | 142 | aUnicornCall.doTask(); |
| … |
… |
|
| 142 | 147 | ObserveAction.logger.error("Exception : " + aException.getMessage(), |
| 143 | 148 | aException); |
| 144 | | this.createError(resp, aException, |
| 145 | | mapOfSpecificParameter, mapOfOutputParameter); |
| | 149 | |
| | 150 | if (mapOfOutputParameter.get("format").equals("xhtml10")) { |
| | 151 | String errorMessage = (String) Framework.getLanguageProperties().get(langParameter).get("stack_trace_text"); |
| | 152 | String errorContent = ""; |
| | 153 | errorContent += aException.getMessage() + "\n"; |
| | 154 | for (StackTraceElement stackTraceElement : aException.getStackTrace()) { |
| | 155 | errorContent += stackTraceElement.toString() + "\n"; |
| | 156 | } |
| | 157 | Message mess = new Message(Message.Level.ERROR, errorMessage, errorContent); |
| | 158 | req.setAttribute("unicorn_message", mess); |
| | 159 | (new IndexAction()).doGet(req, resp); |
| | 160 | |
| | 161 | } else { |
| | 162 | this.createError(resp, aException, mapOfSpecificParameter, mapOfOutputParameter); |
| | 163 | } |
| | 164 | |
| 146 | 165 | } |
| 147 | 166 | } |
| … |
… |
|
| 235 | 254 | ObserveAction.logger.error("Exception : " + aException.getMessage(), |
| 236 | 255 | aException); |
| 237 | | this.createError(resp, aException, |
| 238 | | mapOfSpecificParameter, mapOfOutputParameter); |
| | 256 | |
| | 257 | if (mapOfOutputParameter.get("format").equals("xhtml10")) { |
| | 258 | (new IndexAction()).doGet(req, resp); |
| | 259 | } else { |
| | 260 | this.createError(resp, aException, mapOfSpecificParameter, mapOfOutputParameter); |
| | 261 | } |
| | 262 | |
| 239 | 263 | } finally { |
| 240 | 264 | if ("true".equals(Property.get("DELETE_UPLOADED_FILES")) |