Merge branch 'master' of github.com:thelia/thelia

This commit is contained in:
Manuel Raynaud
2013-09-18 12:30:38 +02:00
2 changed files with 53 additions and 36 deletions

View File

@@ -27,6 +27,7 @@ use Thelia\Core\Template\Smarty\SmartyPluginDescriptor;
use Thelia\Core\Template\Smarty\AbstractSmartyPlugin; use Thelia\Core\Template\Smarty\AbstractSmartyPlugin;
use Thelia\Tools\URL; use Thelia\Tools\URL;
use Thelia\Core\HttpFoundation\Request; use Thelia\Core\HttpFoundation\Request;
use Thelia\Core\Translation\Translator;
class UrlGenerator extends AbstractSmartyPlugin class UrlGenerator extends AbstractSmartyPlugin
{ {
@@ -47,11 +48,27 @@ class UrlGenerator extends AbstractSmartyPlugin
public function generateUrlFunction($params, &$smarty) public function generateUrlFunction($params, &$smarty)
{ {
// the path to process // 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); $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; if ($target != null) $url .= '#'.$target;

View File

@@ -264,7 +264,7 @@
var $elem = $('#jqplot'); var $elem = $('#jqplot');
var url = '/web/test_to_remove/admin-stats.json', var url = "{url file='/test_to_remove/admin-stats.json'}",
series = [], series = [],
seriesColors = [], seriesColors = [],
ticks = [], ticks = [],