From 0214836a54c15000c64500c35d0623029af95205 Mon Sep 17 00:00:00 2001 From: franck Date: Wed, 18 Sep 2013 12:15:17 +0200 Subject: [PATCH] Added {url file='...'} to get file pathes --- .../Template/Smarty/Plugins/UrlGenerator.php | 21 +++++- templates/admin/default/home.html | 68 +++++++++---------- 2 files changed, 53 insertions(+), 36 deletions(-) diff --git a/core/lib/Thelia/Core/Template/Smarty/Plugins/UrlGenerator.php b/core/lib/Thelia/Core/Template/Smarty/Plugins/UrlGenerator.php index 56c853d00..aa96a0014 100755 --- a/core/lib/Thelia/Core/Template/Smarty/Plugins/UrlGenerator.php +++ b/core/lib/Thelia/Core/Template/Smarty/Plugins/UrlGenerator.php @@ -27,6 +27,7 @@ use Thelia\Core\Template\Smarty\SmartyPluginDescriptor; use Thelia\Core\Template\Smarty\AbstractSmartyPlugin; use Thelia\Tools\URL; use Thelia\Core\HttpFoundation\Request; +use Thelia\Core\Translation\Translator; class UrlGenerator extends AbstractSmartyPlugin { @@ -47,11 +48,27 @@ class UrlGenerator extends AbstractSmartyPlugin public function generateUrlFunction($params, &$smarty) { // the path to process - $path = $this->getParam($params, 'path'); + $path = $this->getParam($params, 'path', null); + $file = $this->getParam($params, 'file', null); + + if ($file !== null) { + $path = $file; + $mode = URL::PATH_TO_FILE; + } + else if ($path !== null) { + $mode = URL::WITH_INDEX_PAGE; + } + else { + throw \InvalidArgumentException(Translator::getInstance()->trans("Please specify either 'path' or 'file' parameter in {url} function.")); + } $target = $this->getParam($params, 'target', null); - $url = URL::getInstance()->absoluteUrl($path, $this->getArgsFromParam($params, array('path', 'target'))); + $url = URL::getInstance()->absoluteUrl( + $path, + $this->getArgsFromParam($params, array('path', 'file', 'target')), + $mode + ); if ($target != null) $url .= '#'.$target; diff --git a/templates/admin/default/home.html b/templates/admin/default/home.html index c196ebbe4..c5683620f 100755 --- a/templates/admin/default/home.html +++ b/templates/admin/default/home.html @@ -7,7 +7,7 @@
{module_include location='home_top'} - +
@@ -17,8 +17,8 @@
-
- +
+
@@ -26,11 +26,11 @@ -
+

- +
@@ -42,7 +42,7 @@
- +
@@ -91,10 +91,10 @@ 0 - +
- +
{intl l="Sales statistics"}
@@ -138,7 +138,7 @@ 25.00 € - +
@@ -206,7 +206,7 @@ -
25.00 €
+
@@ -230,7 +230,7 @@ {intl l="Click here"} - + @@ -245,7 +245,7 @@ {javascripts file='assets/js/jqplot/jquery.jqplot.min.js'} - + {javascripts file='assets/js/jqplot/plugins/jqplot.highlighter.min.js'} {/javascripts} @@ -259,19 +259,19 @@