diff --git a/view-webapp/src/main/config/macros.vtl b/view-webapp/src/main/config/macros.vtl new file mode 100644 index 0000000..6d47969 --- /dev/null +++ b/view-webapp/src/main/config/macros.vtl @@ -0,0 +1,44 @@ +#macro(forward $url) +## $log.debug("forwarding towards $url") + $request.session.servletContext.getRequestDispatcher($url).forward($request,$response) +#end + +#macro(redirect $url) + $log.debug("redirecting towards $url") + $response.sendRedirect($url) +#end + +#macro(seterror $msg)## +$log.error($msg)## +$session.setAttribute('error',$msg)## +#end + +#macro(clearerror)## +$session.removeAttribute('error')## +#end + +#macro(setmessage $msg)## +$log.info($msg)## +#if($message)## +$session.setAttribute('message',"$message
$msg")## +#else## +$session.setAttribute('message',$msg)## +#end## +#end + +#macro(clearmessage)## + $session.removeAttribute('message')## +#end + +#macro(api_error $message) + $api.exception($message) +#end + +#macro(euro $amount) +$number.format('#0.00 €', $amount)## +#end + +#macro(ttc $amount) +#set($ttc = $amount * 1.2)## +$number.format('#0.00 €', $ttc)## +#end diff --git a/view-webapp/src/main/config/tools.xml b/view-webapp/src/main/config/tools.xml new file mode 100644 index 0000000..6240c71 --- /dev/null +++ b/view-webapp/src/main/config/tools.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + diff --git a/view-webapp/src/main/config/velocity.properties b/view-webapp/src/main/config/velocity.properties new file mode 100644 index 0000000..3183c38 --- /dev/null +++ b/view-webapp/src/main/config/velocity.properties @@ -0,0 +1,51 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +runtime.log.name = velocity +runtime.log.track_location = true + +runtime.strict_mode.enable = true + +runtime.introspector.uberspect = org.apache.velocity.util.introspection.UberspectImpl, org.apache.velocity.tools.view.WebappUberspector +resource.manager.log_when_found = false + +# fichier de macros globales +velocimacro.library=/WEB-INF/macros.vtl + +# definition inline des macros +velocimacro.permissions.allow.inline=true +velocimacro.permissions.allow.inline.to.replace.global = true +velocimacro.permissions.allow.inline.local.scope = true + +directive.set.null.allowed = true + +#encoding +input.encoding = UTF8 +output.encoding = UTF8 + +# content type +default.contentType = text/html + +# relative loading +# eventhandler.include.class = com.axonia.web.IncludeRelativeTreePath + + +resource.loaders = webapp,string + +# custom directive + +runtime.custom_directives = org.jeudego.pairgoth.view.TranslateDirective