From ea227b9544a25ee61240442360a8f1b11ef2f071 Mon Sep 17 00:00:00 2001 From: Kirill Date: Mon, 1 Jun 2015 18:07:30 +0300 Subject: [PATCH 1/3] Bugfix. Designer render only first component. --- www/system/library/Designer/Factory.php | 148 ++++++++++++------------ 1 file changed, 75 insertions(+), 73 deletions(-) diff --git a/www/system/library/Designer/Factory.php b/www/system/library/Designer/Factory.php index d9ad53d5..1f6c1d57 100644 --- a/www/system/library/Designer/Factory.php +++ b/www/system/library/Designer/Factory.php @@ -80,33 +80,35 @@ static public function runProject($projectFile , Config_Abstract $designerConfig if(!empty($names)) { - foreach ($names as $name) - { - if($project->getObject($name)->isExtendedComponent()) - { - if($project->getObject($name)->getConfig()->defineOnly) - continue; - - $initCode.= Ext_Code::appendRunNamespace($name).' = Ext.create("'.Ext_Code::appendNamespace($name).'",{});'; - } - } - - if($renderTo) - { - $renderTo = str_replace('-', '_', $renderTo); - $initCode.= ' + if($renderTo){ + $renderTo = str_replace('-', '_', $renderTo); + $initCode.= ' app.content = Ext.create("Ext.container.Container", { layout:"fit", renderTo:"'.$renderTo.'" }); '; + } - $initCode.=' - app.content.add('.Ext_Code::appendRunNamespace($name).'); - app.content.doComponentLayout(); - '; - }else{ - $initCode.='app.content.add('.Ext_Code::appendRunNamespace($name).');'; + foreach ($names as $name) + { + if($project->getObject($name)->isExtendedComponent()) + { + if($project->getObject($name)->getConfig()->defineOnly) + continue; + + $initCode.= Ext_Code::appendRunNamespace($name).' = Ext.create("'.Ext_Code::appendNamespace($name).'",{});'; + } + $initCode.=' + app.content.add('.Ext_Code::appendRunNamespace($name).'); + '; + } + + if($renderTo) + { + $initCode.=' + app.content.doComponentLayout(); + '; } } @@ -120,21 +122,21 @@ static public function runProject($projectFile , Config_Abstract $designerConfig { foreach ($projectData['includes'] as $file) { - if(File::getExt($file) == '.css') - { - if(strpos($file , '?') === false){ - $file = $file .'?'. $cachedKey; - } + if(File::getExt($file) == '.css') + { + if(strpos($file , '?') === false){ + $file = $file .'?'. $cachedKey; + } - $resource->addCss($file , false); - }else{ + $resource->addCss($file , false); + }else{ - if(strpos($file , '?') === false){ - $file = $file .'?'. $cachedKey; - } + if(strpos($file , '?') === false){ + $file = $file .'?'. $cachedKey; + } - $resource->addJs($file , false, false); - } + $resource->addJs($file , false, false); + } } } $resource->addInlineJs($initCode); @@ -161,40 +163,40 @@ static public function getProjectIncludes($cacheKey , Designer_Project $project // include langs if(isset($projectConfig['langs']) && !empty($projectConfig['langs'])) { - $language = Lang::getDefaultDictionary(); - $lansPath = $designerConfig->get('langs_path'); - $langsUrl = $designerConfig->get('langs_url'); - - foreach ($projectConfig['langs'] as $k=>$file) - { - $file = $language.'/'.$file.'.js'; - if(file_exists($lansPath.$file)){ - $includes[] = $langsUrl . $file . '?' . filemtime($lansPath.$file); - } - } + $language = Lang::getDefaultDictionary(); + $lansPath = $designerConfig->get('langs_path'); + $langsUrl = $designerConfig->get('langs_url'); + + foreach ($projectConfig['langs'] as $k=>$file) + { + $file = $language.'/'.$file.'.js'; + if(file_exists($lansPath.$file)){ + $includes[] = $langsUrl . $file . '?' . filemtime($lansPath.$file); + } + } } if(isset($projectConfig['files']) && !empty($projectConfig['files'])) { - foreach ($projectConfig['files'] as $file) + foreach ($projectConfig['files'] as $file) + { + $ext = File::getExt($file); + + if($ext === '.js' || $ext === '.css') { - $ext = File::getExt($file); - - if($ext === '.js' || $ext === '.css') - { - $includes[] = $designerConfig->get('js_url') . $file; - - }else - { - $projectFile = $designerConfig->get('configs') . $file; - $subProject = Designer_Factory::loadProject($designerConfig, $projectFile); - $projectKey = self::getProjectCacheKey($projectFile); - $files = self::getProjectIncludes($projectKey , $subProject , true , $replace); - unset($subProject); - if(!empty($files)) - $includes = array_merge($includes , $files); - } + $includes[] = $designerConfig->get('js_url') . $file; + + }else + { + $projectFile = $designerConfig->get('configs') . $file; + $subProject = Designer_Factory::loadProject($designerConfig, $projectFile); + $projectKey = self::getProjectCacheKey($projectFile); + $files = self::getProjectIncludes($projectKey , $subProject , true , $replace); + unset($subProject); + if(!empty($files)) + $includes = array_merge($includes , $files); } + } } Ext_Code::setRunNamespace($projectConfig['runnamespace']); @@ -221,7 +223,7 @@ static public function getProjectIncludes($cacheKey , Designer_Project $project */ $mTime = 0; if(file_exists('.'.$actionFile)) - $mTime = filemtime('.'.$actionFile); + $mTime = filemtime('.'.$actionFile); $includes[] = $actionFile . '?' . $mTime; return $includes; @@ -247,17 +249,17 @@ static public function getProjectCacheKey($projectFile) */ static public function replaceCodeTemplates(array $replaces , $code) { - if(!empty($replaces)) - { - $k = array(); - $v = array(); - foreach ($replaces as $item) - { - $k[] = $item['tpl']; - $v[] = $item['value']; - } - return str_replace($k , $v , $code); - } + if(!empty($replaces)) + { + $k = array(); + $v = array(); + foreach ($replaces as $item) + { + $k[] = $item['tpl']; + $v[] = $item['value']; + } + return str_replace($k , $v , $code); + } return $code; } } \ No newline at end of file From 354218acbb5e7c575f5ab963967fcb8811853fc7 Mon Sep 17 00:00:00 2001 From: Kirill Date: Mon, 1 Jun 2015 18:24:36 +0300 Subject: [PATCH 2/3] Bugfix. Remove debug function --- www/system/app/Frontend/Controller/Backoffice.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/www/system/app/Frontend/Controller/Backoffice.php b/www/system/app/Frontend/Controller/Backoffice.php index 0a6f8643..3ab4f692 100644 --- a/www/system/app/Frontend/Controller/Backoffice.php +++ b/www/system/app/Frontend/Controller/Backoffice.php @@ -168,8 +168,6 @@ protected function loginAction() public function indexAction() { - var_dump($this->_module); - $this->_resource->addInlineJs(' var canEdit = ' . intval($this->_user->canEdit($this->_module)) . '; var canDelete = ' . intval($this->_user->canDelete($this->_module)) . '; From 98cbe674815d8a6e5103defc13b668ca6a09e540 Mon Sep 17 00:00:00 2001 From: Kirill Date: Mon, 1 Jun 2015 18:27:31 +0300 Subject: [PATCH 3/3] Version update --- www/system/config/versions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/www/system/config/versions.php b/www/system/config/versions.php index 70392bf1..c1d4a352 100644 --- a/www/system/config/versions.php +++ b/www/system/config/versions.php @@ -1,6 +1,6 @@ '0.9.5', + 'core'=>'0.9.5.2', 'designer'=>'0.11', 'reports'=>'0.3.1', 'medialib'=>'0.4',