Мелкие правки

This commit is contained in:
origami11 2017-02-17 19:09:01 +03:00
parent a75f450edd
commit 3a77f74177
5 changed files with 13 additions and 22 deletions

View file

@ -118,13 +118,15 @@ class Controller_Action
/*.View_Composite.*/$tpl = new $viewClass($template); /*.View_Composite.*/$tpl = new $viewClass($template);
$assets = Path::join(WWW_PATH, "assets", "css");
$tpl->set('icons', $this->iconPath); // Путь к файлам текущей темы $tpl->set('icons', $this->iconPath); // Путь к файлам текущей темы
$tpl->set('media', $this->themePath); // Путь к файлам текущей темы $tpl->set('media', $this->themePath); // Путь к файлам текущей темы
$tpl->set('assets', Path::join(WWW_PATH, "assets", "css")); $tpl->set('assets', $assets);
$tpl->set('script', $this->jsPath); // Путь к файлам скриптов $tpl->set('script', $this->jsPath); // Путь к файлам скриптов
$tpl->set('template', $path); // Путь к файлам текущего шаблона $tpl->set('template', $path); // Путь к файлам текущего шаблона
$tpl->setAlias(array( $tpl->setAlias(array(
'assets' => $assets,
'icons' => $this->iconPath, 'icons' => $this->iconPath,
'script' => $this->jsPath, 'script' => $this->jsPath,
// Для media и template поиск происходит как для файлов шаблонов // Для media и template поиск происходит как для файлов шаблонов

View file

@ -38,4 +38,8 @@ class View_Composite extends View_View
// postProcess // postProcess
return $this->tal->execute(); return $this->tal->execute();
} }
function setTranslator($t) {
$this->tal->setTranslator($t);
}
} }

View file

@ -27,28 +27,22 @@ class View_Top extends View_Composite {
{ {
$debug = ($debug) ? 'debug=1' : ''; $debug = ($debug) ? 'debug=1' : '';
$path = parse_url(WWW_PATH, PHP_URL_PATH); $path = parse_url(WWW_PATH, PHP_URL_PATH);
// Группы определять в import через ,
$groups = array( ); $groups = array();
$use = array(); $use = array();
$result = array(); $result = array();
foreach ($list as $file) { foreach ($list as $file) {
$name = $this->findGroup($groups, $file); $name = $this->findGroup($groups, $file);
if($name) { if($name) {
$use [$name] = 1; $use[$name] = 1;
} else { } else {
if (strpos($file, 'ckeditor')) { $result[] = $file;
$result [] = $file;
} else {
// $result [] = WWW_PATH . "/min/?$debug&f=" . parse_url($file, PHP_URL_PATH);
$result [] = $file;
}
} }
} }
$list = array(); $list = array();
foreach ($use as $name => $value) { foreach ($use as $name => $value) {
// $list [] = WWW_PATH . "/min/?$debug&f=" . implode(",", $groups[$name]); $list[] = $groups[$name];
$list [] = $groups[$name];
} }
return array_merge($list, $result); return array_merge($list, $result);
@ -70,7 +64,6 @@ class View_Top extends View_Composite {
$alias = $this->doTree('alias'); $alias = $this->doTree('alias');
// require_once 'minify.php';
// Скрипты и стили // Скрипты и стили
$this->set('scriptstring', $this->getScriptRaw()); $this->set('scriptstring', $this->getScriptRaw());
$this->set('scripts', array_unique($this->groupFiles($this->getScripts(), false))); $this->set('scripts', array_unique($this->groupFiles($this->getScripts(), false)));
@ -117,19 +110,10 @@ class View_Top extends View_Composite {
} }
/* echo "<pre>";
print_r($this->require);
print_r(implode("", $startup));
echo "</pre>";*/
//$this->set('scriptstring', '');
$this->set('startup', implode("", $startup) . $this->getScriptStartup()); $this->set('startup', implode("", $startup) . $this->getScriptStartup());
$this->set('require', implode(",", array_map(function ($x) { return "'$x'";}, array_keys($this->require)))); $this->set('require', implode(",", array_map(function ($x) { return "'$x'";}, array_keys($this->require))));
$this->set('deps', implode(",", array_values($this->require))); $this->set('deps', implode(",", array_values($this->require)));
$this->set('title', $this->getTitle()); $this->set('title', $this->getTitle());
$this->set('jspath', WWW_PATH); $this->set('jspath', WWW_PATH);
// //

View file

@ -153,6 +153,7 @@ class View_View
} }
function find_file($pathlist, $file) { function find_file($pathlist, $file) {
foreach($pathlist as $key => $www) { foreach($pathlist as $key => $www) {
if (file_exists($key . '/' . $file)) { if (file_exists($key . '/' . $file)) {
return $www . '/' . $file; return $www . '/' . $file;